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CAAAC,GAAA,gCAAAC,GAAA,qCAAAC,GAAA,iCAAAC,GAAA,sCAAAC,GAAA,4CAAAC,GAAA,kCAAAC,GAAA,yCAAAC,GAAA,mCAAAC,GAAA,6CAAAC,GAAA,qCAAAC,GAAA,2CAAAC,GAAA,gCAAAC,GAAA,+DAAAC,GAAA,+DAAAC,GAAA,yCAAAC,GAAA,mCAAAC,GAAA,mCAAAC,GAAA,mCAAAC,GAAA,mCAAAC,GAAA,6DAAAC,GAAA,qDAAAC,GAAA,gDAAAC,GAAA,yDAAAC,GAAA,iDAAAC,GAAA,mDAAAC,GAAA,4DAAAC,GAAA,uDAAAC,GAAA,iDAAAC,GAAA,iDAAAC,GAAA,4CAAAC,GAAA,qCAAAC,GAAA,uDAAAC,GAAA,0CAAAC,EAAA,kBAAA0qD,CAAA,mBAAC,KAIxD,IAAI3kC,GAAMoX,GAAUy/K,EAAG,EACvB72L,GAAI,OAAO,iBAAiB,UAAY42L,GACxC52L,GAAI,IAAI8d,EAAK,EACb9d,GAAI,IAAI82L,EAAI,EACZ92L,GAAI,MAAM,MAAM","names":["__vite_glob_0_0","__vite_glob_0_1","__vite_glob_0_2","__vite_glob_0_3","__vite_glob_0_4","__vite_glob_0_5","__vite_glob_0_6","__vite_glob_0_7","__vite_glob_0_8","__vite_glob_0_9","__vite_glob_0_10","__vite_glob_0_11","__vite_glob_0_12","__vite_glob_0_13","__vite_glob_0_14","__vite_glob_0_15","__vite_glob_0_16","__vite_glob_0_17","__vite_glob_0_18","__vite_glob_0_19","__vite_glob_0_20","__vite_glob_0_21","__vite_glob_0_22","__vite_glob_0_23","__vite_glob_0_24","__vite_glob_0_25","__vite_glob_0_26","__vite_glob_0_27","__vite_glob_0_28","__vite_glob_0_29","__vite_glob_0_30","__vite_glob_0_31","__vite_glob_0_32","__vite_glob_0_33","__vite_glob_0_34","__vite_glob_0_35","__vite_glob_0_36","__vite_glob_0_37","__vite_glob_0_38","__vite_glob_0_39","__vite_glob_0_40","__vite_glob_0_41","__vite_glob_0_42","__vite_glob_0_43","makeMap","str","expectsLowerCase","map","list","i","val","EMPTY_OBJ","EMPTY_ARR","NOOP","NO","onRE","isOn","key","isModelListener","extend","remove","arr","el","hasOwnProperty","hasOwn","isArray","isMap","toTypeString","isSet","isFunction","isString","isSymbol","isObject","isPromise","objectToString","value","toRawType","isPlainObject","isIntegerKey","isReservedProp","cacheStringFunction","fn","cache","camelizeRE","camelize","_","c","hyphenateRE","hyphenate","capitalize","toHandlerKey","hasChanged","oldValue","invokeArrayFns","fns","arg","def","obj","looseToNumber","n","toNumber","_globalThis","getGlobalThis","normalizeStyle","res","item","normalized","parseStringStyle","listDelimiterRE","propertyDelimiterRE","styleCommentRE","cssText","ret","tmp","normalizeClass","name","specialBooleanAttrs","isSpecialBooleanAttr","includeBooleanAttr","toDisplayString","replacer","_key","entries","val2","activeEffectScope","EffectScope","detached","currentEffectScope","fromParent","l","last","effectScope","recordEffectScope","effect","scope","getCurrentScope","createDep","effects","dep","wasTracked","trackOpBit","newTracked","initDepMarkers","deps","finalizeDepMarkers","ptr","targetMap","effectTrackDepth","maxMarkerBits","activeEffect","ITERATE_KEY","MAP_KEY_ITERATE_KEY","ReactiveEffect","scheduler","parent","lastShouldTrack","shouldTrack","cleanupEffect","effect2","trackStack","pauseTracking","resetTracking","track","target","type","depsMap","trackEffects","debuggerEventExtraInfo","shouldTrack2","trigger","newValue","oldTarget","newLength","key2","triggerEffects","triggerEffect","isNonTrackableKeys","builtInSymbols","get$1","createGetter","shallowGet","readonlyGet","arrayInstrumentations","createArrayInstrumentations","instrumentations","args","toRaw","isReadonly2","shallow","receiver","shallowReadonlyMap","readonlyMap","shallowReactiveMap","reactiveMap","targetIsArray","isRef","readonly","reactive","set$1","createSetter","shallowSet","isReadonly","isShallow","hadKey","result","deleteProperty","has$1","ownKeys","mutableHandlers","readonlyHandlers","shallowReactiveHandlers","toShallow","getProto","v","get","rawTarget","rawKey","has2","wrap","toReadonly","toReactive","has","size","add","set","get2","deleteEntry","clear","hadItems","createForEach","callback","thisArg","observed","createIterableMethod","method","targetIsMap","isPair","isKeyOnly","innerIterator","done","createReadonlyMethod","createInstrumentations","mutableInstrumentations2","shallowInstrumentations2","readonlyInstrumentations2","shallowReadonlyInstrumentations2","mutableInstrumentations","readonlyInstrumentations","shallowInstrumentations","shallowReadonlyInstrumentations","createInstrumentationGetter","mutableCollectionHandlers","shallowCollectionHandlers","readonlyCollectionHandlers","targetTypeMap","rawType","getTargetType","createReactiveObject","shallowReactive","baseHandlers","collectionHandlers","proxyMap","existingProxy","targetType","proxy","isReactive","isProxy","raw","markRaw","trackRefValue","ref2","triggerRefValue","newVal","r","ref","createRef","shallowRef","rawValue","RefImpl","__v_isShallow","useDirectValue","unref","shallowUnwrapHandlers","proxyRefs","objectWithRefs","ComputedRefImpl","getter","_setter","isSSR","self","computed","getterOrOptions","debugOptions","setter","onlyGetter","callWithErrorHandling","instance","err","handleError","callWithAsyncErrorHandling","values","throwInDev","contextVNode","cur","exposedInstance","errorInfo","errorCapturedHooks","appErrorHandler","logError","isFlushing","isFlushPending","queue","flushIndex","pendingPostFlushCbs","activePostFlushCbs","postFlushIndex","resolvedPromise","currentFlushPromise","nextTick","p","findInsertionIndex","id","start","end","middle","getId","queueJob","job","queueFlush","flushJobs","invalidateJob","queuePostFlushCb","cb","flushPreFlushCbs","seen","flushPostFlushCbs","deduped","a","b","comparator","diff","check","emit","event","rawArgs","props","modelArg","modifiersKey","number","trim","handlerName","handler","onceHandler","normalizeEmitsOptions","comp","appContext","asMixin","cached","hasExtends","extendEmits","raw2","normalizedFromExtend","isEmitListener","options","currentRenderingInstance","currentScopeId","setCurrentRenderingInstance","prev","withCtx","ctx","isNonScopedSlot","renderFnWithContext","setBlockTracking","prevInstance","renderComponentRoot","Component","vnode","withProxy","propsOptions","slots","attrs","render","renderCache","data","setupState","inheritAttrs","fallthroughAttrs","proxyToUse","normalizeVNode","render2","getFunctionalFallthrough","blockStack","createVNode","Comment","root","keys","shapeFlag","filterModelListeners","cloneVNode","shouldUpdateComponent","prevVNode","nextVNode","optimized","prevProps","prevChildren","component","nextProps","nextChildren","patchFlag","emits","hasPropsChanged","dynamicProps","emitsOptions","nextKeys","updateHOCHostEl","isSuspense","queueEffectWithSuspense","suspense","INITIAL_WATCHER_VALUE","watch","source","doWatch","immediate","deep","flush","onTrack","onTrigger","_a","currentInstance","forceTrigger","isMultiSource","isShallow$1","s","traverse","cleanup","onCleanup","baseGetter","ssrCleanup","isInSSRComponentSetup","useSSRContext","queuePostRenderEffect","unwatch","instanceWatch","publicThis","createPathGetter","setCurrentInstance","unsetCurrentInstance","path","segments","withDirectives","directives","internalInstance","getExposeProxy","bindings","dir","modifiers","invokeDirectiveHook","oldBindings","binding","hook","useTransitionState","state","onMounted","onBeforeUnmount","TransitionHookValidator","BaseTransitionPropsValidators","BaseTransitionImpl","getCurrentInstance","prevTransitionKey","children","getTransitionRawChildren","child","rawProps","mode","emptyPlaceholder","innerChild","getKeepAliveChild","enterHooks","resolveTransitionHooks","setTransitionHooks","oldChild","oldInnerChild","transitionKeyChanged","getTransitionKey","isSameVNodeType","leavingHooks","earlyRemove","delayedLeave","leavingVNodesCache","getLeavingNodesForType","BaseTransition","leavingVNodes","appear","persisted","onBeforeEnter","onEnter","onAfterEnter","onEnterCancelled","onBeforeLeave","onLeave","onAfterLeave","onLeaveCancelled","onBeforeAppear","onAppear","onAfterAppear","onAppearCancelled","callHook","callAsyncHook","hook2","hooks","leavingVNode","afterHook","cancelHook","called","cancelled","vnode2","isKeepAlive","keepComment","parentKey","keyedFragmentCount","Fragment","defineComponent","extraOptions","isAsyncWrapper","onActivated","registerKeepAliveHook","onDeactivated","wrappedHook","current","injectHook","injectToKeepAliveRoot","keepAliveRoot","injected","onUnmounted","prepend","createHook","lifecycle","onBeforeMount","onBeforeUpdate","onUpdated","onServerPrefetch","onRenderTriggered","onRenderTracked","onErrorCaptured","COMPONENTS","resolveComponent","maybeSelfReference","resolveAsset","NULL_DYNAMIC_COMPONENT","warnMissing","selfName","getComponentName","resolve","registry","renderList","renderItem","index","renderSlot","fallback","noSlotted","slot","openBlock","validSlotContent","ensureValidVNode","rendered","createBlock","vnodes","isVNode","getPublicInstance","isStatefulComponent","publicPropertiesMap","resolveMergedOptions","hasSetupBinding","PublicInstanceProxyHandlers","accessCache","normalizedProps","shouldCacheAccess","publicGetter","cssModule","globalProperties","descriptor","normalizePropsOrEmits","applyOptions","dataOptions","computedOptions","methods","watchOptions","provideOptions","injectOptions","created","beforeMount","mounted","beforeUpdate","updated","activated","deactivated","beforeDestroy","beforeUnmount","destroyed","unmounted","renderTracked","renderTriggered","errorCaptured","serverPrefetch","expose","components","filters","resolveInjections","methodHandler","opt","createWatcher","provides","provide","registerLifecycleHook","register","_hook","exposed","checkDuplicateProperties","normalizeInject","inject","h","base","mixins","extendsOptions","globalMixins","optionMergeStrategies","resolved","m","mergeOptions","to","from","strats","strat","internalOptionMergeStrats","mergeDataFn","mergeEmitsOrPropsOptions","mergeObjectOptions","mergeAsArray","mergeWatchOptions","mergeInject","merged","createAppContext","uid$1","createAppAPI","hydrate","rootComponent","rootProps","context","installedPlugins","isMounted","app","version","plugin","mixin","directive","rootContainer","isHydrate","isSVG","currentApp","parentProvides","defaultValue","treatDefaultAsFactory","initProps","isStateful","InternalObjectKey","setFullProps","updateProps","rawPrevProps","rawCurrentProps","hasAttrsChanged","propsToUpdate","camelizedKey","resolvePropValue","kebabKey","needCastKeys","rawCastValues","camelKey","castValues","isAbsent","hasDefault","propsDefaults","normalizePropsOptions","extendProps","normalizedKey","validatePropName","prop","booleanIndex","getTypeIndex","stringIndex","getType","ctor","match","isSameType","expectedTypes","isInternalKey","normalizeSlotValue","normalizeSlot","rawSlot","normalizeObjectSlots","rawSlots","normalizeVNodeSlots","initSlots","updateSlots","needDeletionCheck","deletionComparisonTarget","setRef","rawRef","oldRawRef","parentSuspense","isUnmount","refValue","owner","oldRef","refs","_isString","_isRef","doSet","existing","createRenderer","baseCreateRenderer","createHydrationFns","hostInsert","hostRemove","hostPatchProp","hostCreateElement","hostCreateText","hostCreateComment","hostSetText","hostSetElementText","hostParentNode","hostNextSibling","hostSetScopeId","hostInsertStaticContent","patch","n1","n2","container","anchor","parentComponent","slotScopeIds","getNextHostNode","unmount","Text","processText","processCommentNode","Static","mountStaticNode","processFragment","processElement","processComponent","internals","moveStaticNode","nextSibling","next","removeStaticNode","mountElement","patchElement","vnodeHook","transition","dirs","mountChildren","setScopeId","unmountChildren","invokeVNodeHook","needCallTransitionHooks","scopeId","subTree","parentVNode","cloneIfMounted","dynamicChildren","oldProps","newProps","toggleRecurse","areChildrenSVG","patchBlockChildren","patchChildren","patchProps","oldChildren","newChildren","fallbackContainer","oldVNode","newVNode","fragmentStartAnchor","fragmentEndAnchor","fragmentSlotScopeIds","traverseStaticChildren","mountComponent","updateComponent","initialVNode","createComponentInstance","setupComponent","setupRenderEffect","placeholder","updateComponentPreRender","componentUpdateFn","bu","u","originNext","nextTree","prevTree","bm","isAsyncWrapperVNode","hydrateNode","hydrateSubTree","scopedInitialVNode","update","c1","prevShapeFlag","c2","patchKeyedChildren","patchUnkeyedChildren","oldLength","commonLength","nextChild","parentAnchor","l2","e1","e2","nextPos","s1","s2","keyToNewIndexMap","j","patched","toBePatched","moved","maxNewIndexSoFar","newIndexToOldIndexMap","prevChild","newIndex","increasingNewIndexSequence","getSequence","nextIndex","move","moveType","leave","delayLeave","afterLeave","remove2","performLeave","doRemove","shouldInvokeDirs","shouldInvokeVnodeHook","unmountComponent","removeFragment","performRemove","bum","um","allowed","ch1","ch2","len","arrI","isTeleport","currentBlock","disableTracking","closeBlock","isBlockTreeEnabled","setupBlock","createElementBlock","createBaseVNode","normalizeKey","normalizeRef","ref_key","ref_for","isBlockNode","needFullChildrenNormalization","normalizeChildren","_createVNode","cloned","isClassComponent","guardReactiveProps","klass","style","extraProps","mergeRef","mergedProps","mergeProps","createTextVNode","text","flag","createCommentVNode","asBlock","slotFlag","toMerge","incoming","emptyAppContext","uid","internalSetCurrentInstance","globalCurrentInstanceSetters","settersKey","setupResult","setupStatefulComponent","setup","setupContext","createSetupContext","resolvedResult","handleSetupResult","e","finishComponentSetup","compile","skipOptions","template","isCustomElement","compilerOptions","delimiters","componentCompilerOptions","finalCompilerOptions","getAttrsProxy","includeInferred","computed$1","propsOrChildren","ssrContextKey","svgNS","doc","templateContainer","nodeOps","tag","is","node","selector","content","before","wrapper","patchClass","transitionClasses","patchStyle","isCssString","setStyle","currentDisplay","importantRE","prefixed","autoPrefix","prefixes","prefixCache","rawName","xlinkNS","patchAttr","isBoolean","patchDOMProp","needRemove","addEventListener","removeEventListener","patchEvent","prevValue","nextValue","invokers","existingInvoker","parseName","invoker","createInvoker","optionsModifierRE","cachedNow","getNow","initialValue","patchStopImmediatePropagation","originalStop","nativeOnRE","patchProp","shouldSetAsProp","TRANSITION","ANIMATION","Transition","resolveTransitionProps","DOMTransitionPropsValidators","h2","hasExplicitCallback","baseProps","duration","enterFromClass","enterActiveClass","enterToClass","appearFromClass","appearActiveClass","appearToClass","leaveFromClass","leaveActiveClass","leaveToClass","durations","normalizeDuration","enterDuration","leaveDuration","finishEnter","isAppear","removeTransitionClass","finishLeave","makeEnterHook","nextFrame","addTransitionClass","whenTransitionEnds","forceReflow","NumberOf","cls","_vtc","endId","expectedType","explicitTimeout","resolveIfNotStale","timeout","propCount","getTransitionInfo","endEvent","ended","onEnd","styles","getStyleProperties","transitionDelays","transitionDurations","transitionTimeout","getTimeout","animationDelays","animationDurations","animationTimeout","hasTransform","delays","d","toMs","vShow","setDisplay","rendererOptions","renderer","ensureRenderer","createApp","mount","containerOrSelector","normalizeContainer","getDevtoolsGlobalHook","getTarget","isProxyAvailable","HOOK_SETUP","HOOK_PLUGIN_SETTINGS_SET","supported","perf","isPerformanceSupported","now","ApiProxy","defaultSettings","localSettingsSaveId","currentSettings","pluginId","_target","setupDevtoolsPlugin","pluginDescriptor","setupFn","enableProxy","storeKey","forEachValue","partial","genericSubscribe","subs","resetStore","store","hot","installModule","resetStoreState","oldState","oldScope","wrappedGetters","computedObj","computedCache","enableStrictMode","rootState","module","isRoot","namespace","parentState","getNestedState","moduleName","local","makeLocalContext","mutation","namespacedType","registerMutation","action","registerAction","registerGetter","noNamespace","_type","_payload","_options","unifyObjectStyle","payload","makeLocalGetters","gettersProxy","splitPos","localType","entry","rawGetter","LABEL_VUEX_BINDINGS","MUTATIONS_LAYER_ID","ACTIONS_LAYER_ID","INSPECTOR_ID","actionId","addDevtools","api","COLOR_LIME_500","nodes","flattenStoreForInspectorTree","formatStoreForInspectorTree","modulePath","formatStoreForInspectorState","getStoreModule","COLOR_DARK","COLOR_WHITE","TAG_NAMESPACED","extractNameFromPath","filter","getters","gettersKeys","storeState","tree","transformPathsToObjectTree","canThrow","leafKey","moduleMap","names","Module","rawModule","runtime","rawState","prototypeAccessors$1","ModuleCollection","rawRootModule","this$1$1","newModule","rawChildModule","targetModule","createStore","Store","plugins","strict","devtools","dispatch","commit","prototypeAccessors","injectKey","useDevtools","sub","reject","error","newOptions","committing","mapMutations","normalizeNamespace","mutations","normalizeMap","getModuleByNamespace","mapGetters","isValidMap","helper","_sfc_main","_hoisted_1","_hoisted_2","_createElementVNode","_hoisted_5","_openBlock","_createElementBlock","_ctx","_hoisted_4","Scalar","epsilon","min","max","length","num","tx","t","maxDelta","amount","value1","tangent1","value2","tangent2","squared","cubed","part1","part2","part3","part4","time","t2","percent","angle","ToGammaSpace","ToLinearSpace","PHI","Epsilon","ArrayTools","itemBuilder","_observeArrayfunction","object","functionName","oldFunction","newFunction","previousLength","returnValue","previous","observedArrayFunctions","_ObserveArray","array","unObserveFunctions","unObserveFunction","_RegisteredTypes","RegisterClass","className","GetClass","fqdn","PerformanceConfigurator","use64bits","matrix","EventState","mask","skipNextObservers","currentTarget","Observer","Observable","promise","onErrorObservable","observable","onObserverAdded","notifyIfTriggered","insertFirst","unregisterOnFirstCall","observer","updateCounter","eventData","userInfo","obs","o","EngineStore","_ExtractAsInt","Vector2","x","y","hash","otherVector","scale","cos","sin","offset","value3","value4","left","right","vector","newVector","transformation","p0","p1","p2","sign","segA","segB","proj","Vector3","z","Quaternion","radius","theta","phi","q","vx","vy","vz","qx","qy","qz","qw","ty","tz","plane","origin","V","MathTmp","denom","scaledV","other","absX","absY","absZ","order","quaternion","point","reference","vector0","vector1","axis","d0","d1","normal","v0","v1","dot","vNormal","forward","TmpVectors","slerp","vector0Dir","vector1Dir","vector0Length","vector1Length","scale0","scale1","omega","invSin","goal","deltaTime","lerpTime","rightHandedSystem","rx","ry","rz","rw","world","transform","viewport","cw","ch","cx","cy","viewportMatrix","Matrix","inDirection","viewportWidth","viewportHeight","view","projection","sourceX","sourceY","sourceZ","screenSource","p1p0","p2p0","p2p1","vectorp0","p1p0L","p2p0L","p2p1L","nl","cosA","projVector","v2","projP","s0","edge","e0","tmp2","tmp3","e0proj","e0projL","cosG","triProj","axis1","axis2","axis3","rotation","quat","Vector4","w","otherQuaternion","q1","conjugate","lengthSquared","inv","zAxisY","limit","sqw","sqz","sqx","sqy","m11","m12","m13","m21","m22","m23","m31","m32","m33","trace","quat0","quat1","vec","vecFrom","vecTo","yaw","pitch","roll","halfRoll","halfPitch","halfYaw","sinRoll","cosRoll","sinPitch","cosPitch","sinYaw","cosYaw","alpha","beta","gamma","halfGammaPlusAlpha","halfGammaMinusAlpha","halfBeta","rotMat","up","num2","num3","num4","num5","num6","isIdentity","isIdentityDirty","isIdentity3x2","isIdentity3x2Dirty","m00","m01","m02","m03","m10","m20","m30","det_22_33","det_21_33","det_21_32","det_20_33","det_20_32","det_20_31","cofact_00","cofact_01","cofact_02","cofact_03","resultM","otherM","det","detInv","det_12_33","det_11_33","det_11_32","det_10_33","det_10_32","det_10_31","det_12_23","det_11_23","det_11_22","det_10_23","det_10_22","det_10_21","cofact_10","cofact_11","cofact_12","cofact_13","cofact_20","cofact_21","cofact_22","cofact_23","cofact_30","cofact_31","cofact_32","cofact_33","vector3","tm0","tm1","tm2","tm3","tm4","tm5","tm6","tm7","tm8","tm9","tm10","tm11","tm12","tm13","tm14","tm15","om0","om1","om2","om3","om4","om5","om6","om7","om8","om9","om10","om11","om12","om13","om14","om15","om","translation","preserveScalingNode","signX","signY","signZ","sx","sy","sz","rowVector","row","initialM11","initialM12","initialM13","initialM14","initialM21","initialM22","initialM23","initialM24","initialM31","initialM32","initialM33","initialM34","initialM41","initialM42","initialM43","initialM44","x2","y2","z2","xx","xy","xz","yy","yz","zz","wx","wy","wz","identity","zero","useYAxisForCoplanar","k","startValue","endValue","gradient","startM","endM","startScale","startRotation","startTranslation","endScale","endRotation","endTranslation","resultScale","resultRotation","resultTranslation","eye","xAxis","yAxis","zAxis","xSquareLength","ex","ey","ez","back","width","height","znear","zfar","halfZRange","f","mtxConvertNDCToHalfZRange","bottom","top","i0","i1","projectionPlaneTilt","rot","fov","aspect","reverseDepthBufferMode","isVerticalFovFixed","rightHanded","rightHandedFactor","upTan","downTan","leftTan","rightTan","xScale","yScale","zmin","zmax","rm","mm","temp","temp2","temp3","xaxis","yaxis","zaxis","zw","zx","yw","xw","colorChannelToLinearSpace","color","colorChannelToLinearSpaceExact","colorChannelToGammaSpace","colorChannelToGammaSpaceExact","Color3","g","Color4","otherColor","intR","intG","intB","dm","exact","convertedColor","hue","saturation","chroma","hex","returnAsColor3","intA","color3","colors","count","colors4","TmpColors","AndOrNotEvaluator","query","evaluateCallback","parenthesisContent","or","ori","and","andj","booleanString","Tags","tagsString","tagsQuery","tags","asString","tagsArray","_WarnImport","__decoratorInitialStore","__mergedStore","_copySource","creationFunction","instanciate","destination","classStore","getMergedStore","textureMap","property","propertyDescriptor","sourceProperty","propertyType","SerializationHelper","getDirectStore","classKey","currentKey","initialStore","generateSerializableMember","sourceName","propertyKey","generateExpandMember","setCallback","targetKey","expandToProperty","serialize","serializeAsTexture","serializeAsColor3","serializeAsFresnelParameters","serializeAsVector2","serializeAsVector3","serializeAsMeshReference","serializeAsColorCurves","serializeAsColor4","serializeAsImageProcessingConfiguration","serializeAsQuaternion","serializeAsMatrix","serializeAsCameraReference","animationIndex","animation","entity","serializationObject","serializedProperties","targetPropertyName","scene","rootUrl","dest","nativeOverride","predicate","jsFunc","params","func","nativeFunc","AnimationKeyInterpolation","AnimationRange","__decorate","decorators","desc","_InternalNodeDataInfo","Node$1","Node","constructorFunc","previousParentNode","rootNodes","lastIdx","behavior","attachImmediately","force","_initialCall","_ignoreParentClass","_completeCheck","_property","checkAncestors","ancestor","results","directDescendantsOnly","nAnimations","deleteFrames","newParent","doNotCloneChildren","directDescendants","animationRanges","loop","speedRatio","onAnimationEnd","range","serializationRanges","localRange","_force","doNotRecurse","disposeMaterialAndTextures","parsedNode","_scene","includeDescendants","thisAbstractMesh","boundingInfo","descendants","descendant","childMesh","boundingBox","minBox","maxBox","_name","_from","_to","Size","src","otherSize","createXMLHttpRequest","WebRequest","url","listener","body","_IAnimationState","evaluateAnimationState","Animation","targetProperty","framePerSecond","totalFrame","loopMode","easingFunction","dataType","animationType","sourceAnimation","referenceFrameOrOptions","cloneOriginal","clonedName","_b","referenceFrame","startIndex","firstKey","endIndex","lastKey","valueStore","rangeValue","startFrame","clippedKeys","targetValue","host","frameRate","endFrame","runtimeAnimation","enableBlending","fullDetails","first","frame","nKeys","outTangent","inTangent","currentFrame","searchClosestKeyOnly","keysLength","startKey","endKey","useTangent","frameDelta","floatValue","quatValue","vec3Value","vec2Value","color3Value","color4Value","clone","dontClone","newKey","animationKey","constructor","parsedAnimation","interpolation","_inTangent","_outTangent","keyData","request","output","serializedAnimation","snippetId","snippet","outputs","Orientation","BezierCurve","x1","y1","f0","f1","f2","refinedT","refinedT2","refinedT3","slope","Angle","radians","delta","degrees","Arc2","startPoint","midPoint","endPoint","startToMid","midToEnd","a1","a2","a3","Path2","newPoint","previousPoint","midX","midY","endX","endY","numberOfSegments","arc","increment","currentAngle","controlX","controlY","equation","val0","val1","step","originTangentX","originTangentY","destinationTangentX","destinationTangentY","val3","isInside","edgeLow","edgeHigh","edgeDx","edgeDy","perpEdge","lastPoint","firstPoint","normalizedLengthPosition","lengthPosition","previousOffset","bToA","nextOffset","localOffset","Path3D","firstNormal","alignTangentsWithPath","position","interpolated","smallestDistance","closestPosition","tangent","subLength","subPosition","distance","_start","curvePoints","slicePoints","tg0","pp0","curTang","prevNor","prevBinor","nNVector","nLVector","vt","va","normal0","tgl","interpolateTNB","currentPoint","currentLength","targetLength","parentIndex","tangentFrom","normalFrom","binormalFrom","tangentTo","normalTo","binormalTo","quatFrom","quatTo","Curve3","nbPoints","bez","v3","t1","nSeg","hermite","points","closed","catmullRom","pointsCount","totalPoints","second","third","steps","fullCircle","vec1","vec2","vec3","len4","len1_sq","len2_sq","len3_sq","len4_sq","len1","len2","len3","dot1","dot2","dot3","center","dStep","curve","continuedPoints","EasingFunction","easingMode","CircleEase","BackEase","amplitude","BounceEase","bounces","bounciness","num9","num15","num65","num13","num8","num12","num7","CubicEase","ElasticEase","oscillations","springiness","ExponentialEase","exponent","PowerEase","power","QuadraticEase","QuarticEase","QuinticEase","SineEase","BezierCurveEase","mouseover","ease","mesh","camera","alphaAnimation","betaAnimation","radiusAnimation","targetAnimation","navigationUI","visibility","pin","_hoisted_3","_hoisted_7","_hoisted_9","$options","_normalizeClass","_hoisted_6","_toDisplayString","_hoisted_8","_hoisted_10","_hoisted_11","code","language","_cache","$event","_Fragment","_renderList","_hoisted_13","_hoisted_14","_hoisted_15","_withDirectives","_hoisted_16","_hoisted_17","productInfo","product","_createBlock","_Transition","pages","_hoisted_12","page","_normalizeStyle","_vShow","TextureSampler","wrapU","wrapV","wrapR","anisotropicFilteringLevel","samplingMode","comparisonFunction","InternalTextureSource","InternalTexture","engine","delayAllocation","depth","swapAndSetIsReady","proxyInternalTexture","swapAll","IsWindowObjectExist","IsNavigatorAvailable","IsDocumentAvailable","GetDOMTextContent","element","DomManagement","Logger","message","level","padStr","date","formattedMessage","defaultAttributeKeywordName","defaultVaryingKeywordName","ShaderCodeNode","preprocessors","_c","_d","_e","_f","_g","processor","attributeKeyword","varyingKeyword","ShaderCodeCursor","line","trimmedLine","semicolonIndex","split","subLine","ShaderCodeConditionNode","ShaderCodeTestNode","ShaderDefineExpression","postfix","stack","infix","cacheItem","stackIdx","pushOperand","operand","push","peek","pop","idx","token","sortedCache","ShaderDefineIsDefinedOperator","define","not","condition","ShaderDefineOrOperator","ShaderDefineAndOperator","ShaderDefineArithmeticOperator","testValue","ShaderLanguage","regexSE","regexSERevert","regexShaderInclude","regexShaderDecl","regexLightX","regexX","reusableMatches","ShaderProcessor","sourceCode","codeWithIncludes","migratedCode","vertexCode","fragmentCode","shouldUseHighPrecisionShader","expression","operators","operator","indexOperator","command","cursor","rootNode","ifNode","first5","elseNode","elifNode","matches","newRootNode","newNode","defines","preparedSourceCode","parts","keepProcessing","includeFile","includeContent","splits","indexString","indexSplits","minIndex","maxIndex","sourceIncludeContent","newParts","part","splitPart","includeShaderUrl","fileContent","onSuccess","onProgress","offlineProvider","useArrayBuffer","onError","ShaderStore","shaderLanguage","Effect","EngineShaderStore","repo","baseName","attributesNamesOrOptions","uniformsNamesOrEngine","samplers","fallbacks","onCompiled","indexParameters","processCodeAfterIncludes","processFinalCode","vertexSource","fragmentSource","hostDocument","processorOptions","shaderCodes","shadersLoaded","migratedVertexCode","migratedFragmentCode","codeBeforeMigration","finalShaders","vertex","fragment","uniformName","previousPipelineContext","shader","optionalKey","shaderCode","shaderBinary","shaderStore","shaderUrl","vertexSourceCode","fragmentSourceCode","scenes","attributesNames","rebuildRebind","isFragment","regexp","errorLine","lineNumber","lines","uniform","attribute","lineErrorVertex","lineErrorFragment","notifyErrors","channel","texture","textures","exName","initialPos","currentExName","channelIndex","postProcess","buffer","bufferName","blockName","matrices","bool","vector2","vector4","color4","pixelShader","vertexShader","DepthCullingState","reset","gl","StencilState","AlphaState","value0","rgb","WebGLShaderProcessor","processingContext","regex","varyingRegex","WebGL2ShaderProcessor","varying","_isFragment","hasDrawBuffersExtension","hasOutput","DataBuffer","WebGLDataBuffer","resource","WebGLPipelineContext","uniformBuffersNames","uniformsNames","uniforms","samplerList","attributes","attr","changed","WebGLHardwareTexture","existingTexture","hardwareTexture","DrawWrapper","createMaterialContext","resetContext","StencilStateComposer","stencilMaterialEnabled","PrecisionDate","BufferPointer","ThinEngine","description","useReverse","dimensions","faceData","cubeData","activate","canvas","canvasOrContext","antialias","adaptToDeviceRatio","_h","_j","_k","_l","devicePixelRatio","limitDeviceRatio","ua","exception","targets","capture","constraint","evt","versionToLog","currentUA","initEngine","depthTest","depthFunc","depthMask","stencilTest","currentState","internalTexture","renderTargetWrapper","uniformBuffer","storageBuffer","rendererInfo","drawBuffersExtension","depthTextureExtension","vertexArrayObjectExtension","instanceExtension","vertexhighp","fragmenthighp","blendMinMaxExtension","sRGBExtension","renderFunction","cancelAnimationFrame","shouldRender","useScreen","bindedRenderFunction","requester","backBuffer","stencil","useStencilGlobalOnly","setBackBufferColor","textureFormat","textureType","requiredWidth","requiredHeight","forceSetSize","changeRatio","boundingRect","rtWrapper","faceIndex","forceFullscreenViewport","lodLevel","layer","webglRTWrapper","depthStencilTexture","attachment","culling","zOffset","reverseSide","cullBackFaces","zOffsetUnits","cullFace","frontFace","enable","framebuffer","disableGenerateMipMaps","onBeforeUnbind","usage","vbo","dataBuffer","indices","updatable","pipelineContext","program","uniformLocation","indx","stride","pointer","indexBuffer","vertexBuffers","overrideVertexBuffers","ai","vertexBuffer","vao","vertexArrayObject","vertexDeclaration","vertexStrideSize","attributesCount","boundBuffer","ul","instancesBuffer","offsetLocation","offsetLocations","attributesInfo","computeStride","attributeLocation","shouldClean","useTriangles","indexStart","indexCount","instancesCount","verticesStart","verticesCount","fillMode","drawMode","indexFormat","mult","webGLPipelineContext","globalDefines","fullDefines","compiledEffect","shaderVersion","tempError","transformFeedbackVaryings","fragmentShader","shaderProcessingContext","shaderProgram","log","createAsRaw","rawVertexSourceCode","rawFragmentSourceCode","webGLRenderingState","oldHandler","bruteForce","generateMipMaps","magFilter","minFilter","delayGPUTextureCreation","format","useSRGBBuffer","samples","label","layers","sizedFormat","internalFormat","noMipmap","invertY","onLoad","prepareTexture","prepareTextureProcessFunction","forcedExtension","mimeType","loaderOptions","fromData","fromBlob","isBase64","originalUrl","lastDot","extension","loader","availableLoader","onLoadObserver","onInternalError","loadMipmap","isCompressed","loadFailed","onload","img","creationFlags","potWidth","potHeight","continuationCallback","isPot","texelFormat","maxTextureSize","input","imageBitmapOptions","onComplete","compression","generateStencil","bilinearFiltering","samplingParameters","lod","imageData","babylonInternalFormat","useTextureWidthAndHeight","lodMaxWidth","lodMaxHeight","xOffset","yOffset","targetForBinding","bindTarget","processFunction","generateStencilBuffer","generateDepthBuffer","depthFormat","msInternalFormat","unbindBuffer","renderBuffer","forTextureDataUpdate","wasPreviouslyBound","isTextureForRendering","sourceSlot","isPartOfTextureArray","videoInternalTexture","needToBind","textureWrapMode","anisotropicFilterExtension","parameter","successful","fb","status","readFormat","readType","hasAlpha","flushRenderer","numChannels","tempcanvas","pot","requestAnimationFrame","PerformanceMonitor","frameSampleSize","RollingAverage","timeMs","dt","history","bottomValue","PerfCounter","newCount","fetchResult","newFrame","currentTime","noDepthWriteChange","allocateAndCopyTypedBuffer","sizeOrDstBuffer","sizeInBytes","copyBuffer","noDataConversion","dummy","byteOffset","byteLength","dataLength","Engine","imageSource","image","imageBitmap","bufferWidth","bufferHeight","engineIndex","sceneIndex","ev","hostWindow","viewportOwner","unbind","stencilFunc","operation","currentViewport","clearColor","numDrawCalls","document","shaders","postProcessInput","requestPointerLock","camIndex","cam","transformFeedback","rtt","hostingScene","hasMipMaps","capacity","sync","flags","intervalms","outputBuffer","buf","loadingScreen","constraints","requestFunction","anyDoc","font","block","div","fontAscent","fontHeight","CloneValue","destinationObject","GetAllPropertyNames","DeepCopier","doNotCopyList","mustCopyList","properties","sourceValue","typeOfSourceValue","clonedValue","FilesInputStore","RetryStrategy","maxRetries","baseInterval","retryIndex","BaseError","proto","ErrorCodes","RuntimeError","errorCode","innerError","EndsWith","suffix","StartsWith","Decode","EncodeArrayBufferToBase64","keyStr","chr1","chr2","chr3","enc1","enc2","enc3","enc4","bytes","DecodeBase64ToString","base64Data","DecodeBase64ToBinary","decodedString","bufferLength","bufferView","PadNumber","StringTools","TimingTools","Base64DataUrlRegEx","LoadFileError","RequestFileError","ReadFileError","file","FileToolsOptions","_CleanUrl","SetCorsBehavior","LoadImage","usingObjectURL","onErrorHandler","inputText","LoadFile","imgBmp","reason","handlersList","loadHandlersList","unloadHandlersList","loadHandler","errorHandler","cspHandler","cspException","noOfflineSupport","contentType","blob","loadFromOfflineSupport","textureName","blobURL","ReadFile","reader","fileRequest","fileOrUrl","onOpened","fileName","TestBase64DataUrl","DecodeBase64UrlToBinary","DecodeBase64UrlToString","RequestFile","loadUrl","aborted","requestFile","retryHandle","onReadyStateChange","unbindEvents","onLoadEnd","retryLoop","IsFileURL","retryStrategy","waitTime","IsBase64DataUrl","uri","initSideEffects","FileTools","_injectLTSFileTools","InstantiationTools","internalClass","RandomGUID","GUID","Tools","strategy","classes","pixels","wrappedU","wrappedV","returnUnchangedIfNoSlash","previousAngle","newAngle","smoothFactor","previousAngleRad","newAngleRad","allowsNullUndefined","eventPrefix","referrerPolicy","FileToolLoadImage","FileToolsLoadFile","scriptUrl","scriptId","head","script","fileToLoad","progressCallback","FileToolsReadFile","fileBlob","decimals","windowElement","events","successCallback","quality","toArrayBuffer","binStr","newWindow","base64data","base64Image","forceDownload","antialiasing","renderSprites","enableStencilBuffer","useLayerMask","counterName","isType","classObj","delay","AsyncLoop","iterations","syncedIterations","breakFunction","iteration","SmartArray","compareFn","SmartArrayNoDuplicate","StringDictionary","factory","curVal","AbstractScene","parser","jsonData","parserName","skeleton","MaterialDefines","externalProperties","disposed","defValue","ColorCurves","colorCurves","positiveUniform","neutralUniform","negativeUniform","uniformsList","density","exposure","brightness","ImageProcessingConfigurationDefines","ImageProcessingConfiguration","samplersList","forPostProcess","overrideAspectRatio","inverseWidth","inverseHeight","aspectRatio","vignetteScaleY","vignetteScaleX","vignetteScaleGeometricMean","vignettePower","textureSize","parsed","elements","ubo","location","UniformBuffer","dynamic","forceNoUniformBuffer","alignment","oldPointer","arraySize","totalPadding","mat","buf1","buf2","dst","arraySizes","countToFour","baseStride","uniformBuffers","Buffer","postponeInternalCreation","instanced","useBytes","divisor","kind","byteStride","VertexBuffer","vertexCount","isInstanced","takeBufferOwnership","vertexData","typeByteLength","totalVertices","forceCopy","tightlyPackedByteStride","copy","remainder","componentCount","componentType","componentIndex","dataView","componentByteLength","componentByteOffset","PickingInfo","useWorldCoordinates","useVerticesNormals","tmp0","tmp1","normals","normal1","normal2","positions","vertex1","vertex2","vertex3","p1p2","p3p2","transformNormalToWorld","pickedMesh","wm","normalForDirectionChecking","uvSet","uvs","uv0","uv1","uv2","ActionEvent","pointerX","pointerY","meshUnderPointer","sourceEvent","additionalData","prim","pointerPos","PostProcessManager","vertices","vb","sourceTexture","postProcesses","pp","targetTexture","doNotBindFrambuffer","doNotPresent","RenderingGroup","opaqueSortCompareFn","alphaTestSortCompareFn","transparentSortCompareFn","customRenderFunction","renderParticles","activeMeshes","stencilState","excludedMeshes","edgesRendererIndex","subMeshes","sortCompareFn","transparent","subIndex","subMesh","cameraPosition","sortedArray","material","meshA","meshB","spriteManager","particleSystem","activeCamera","particleIndex","emitter","RenderingGroupInfo","RenderingManager","renderingGroupId","info","manager","renderingGroup","renderingGroupMask","autoClear","group","autoClearDepthStencil","SceneComponentConstants","Stage","items","PointerEventTypes","PointerInfoBase","PointerInfoPre","localX","localY","PointerInfo","pickInfo","inputManager","AbstractActionManager","tAsInt","KeyboardEventTypes","KeyboardInfo","KeyboardInfoPre","DeviceType","PointerInput","NativePointerInput","DualShockInput","DualSenseInput","XboxInput","SwitchInput","DeviceInputEventType","EventConstants","DeviceEventFactory","deviceType","deviceSlot","inputIndex","deviceInputSystem","elementToAttachTo","pointerId","buttons","isKeyboardActive","altKey","ctrlKey","metaKey","shiftKey","NativeDeviceInputSystem","onDeviceConnected","onDeviceDisconnected","onInputChanged","MAX_KEYCODES","MAX_POINTER_INPUTS","WebDeviceInputSystem","device","currentValue","inputElement","inputs","deviceSlotKey","gamepads","gamepad","currentX","currentY","numberOfInputs","kbKey","deviceEvent","keyCode","previousHorizontal","previousVertical","passiveSupported","noop","gp","deviceName","DeviceSource","InternalDeviceSourceManager","numberOfDeviceTypes","deviceSource","DeviceSourceManager","devices","_ClickInfo","InputManager","canvasRect","pickResult","isMeshPicked","pointerInfo","pi","actionManager","pointerEventInit","doubleTap","clickInfo","doubleClickActionManager","pickedDownActionManager","attachUp","attachDown","attachMove","act","btn","obs1","obs2","checkPicking","needToIgnoreNext","checkSingleClickImmediately","delayedClick","checkDoubleClick","prevEvt","underPointerMesh","Plane","norm","magnitude","invertedMatrix","normalX","normalY","normalZ","finalD","point1","point2","point3","z1","pyth","invPyth","direction","Frustum","frustumPlanes","frustumPlane","UniqueIdGenerator","LightConstants","PointerPickingConfiguration","ScenePerformancePriority","Scene","variableName","isVector3","eyePosition","invertNormal","newStepId","cameras","serializableComponent","fullOptions","checkRenderTargets","currentRenderPassId","isReady","hardwareInstancedRendering","execFunc","wasLoading","viewL","projectionL","viewR","projectionR","sceneUbo","newMesh","recursive","toRemove","newTransformNode","lastNode","index2","animationName","targetMask","lastMaterial","newLight","newCamera","newSkeleton","newParticleSystem","newAnimation","newAnimationGroup","newMultiMaterial","newMaterial","newMorphTargetManager","newGeometry","newActionManager","newTexture","attachControl","allowMultiMaterials","uniqueId","skeletonIndex","boneIndex","geometry","lastGeometry","transformNode","light","bone","managerIndex","morphTargetManager","postProcessIndex","initialMesh","forcePush","skipEvaluateActiveMeshes","freezeMeshes","keepFrustumCulling","psLength","meshes","meshToRender","sourceMesh","leftCamera","rightCamera","rigParent","bindFrameBuffer","skipInitialClear","softwareSkinnedMeshIndex","needRebind","renderIndex","renderTarget","hasSpecialRenderTargetCamera","actionIndex","parameters","otherMesh","areIntersecting","currentIntersectionInProgress","parameterMesh","defaultFrameTime","defaultFPS","stepsTaken","maxSubSteps","internalSteps","passId","updateCameras","ignoreAnimations","cameraIndex","currentActiveCamera","customIndex","animatable","activeRequests","itemsCopy","meshIndex","baseTexture","filterPredicate","cameraViewSpace","enableDistantPicking","fastCheck","trianglePredicate","ray","system","spriteMgr","forEach","listByTags","useOfflineSupport","Space","Axis","Coordinate","Viewport","renderWidth","renderHeight","inlineScheduler","coroutine","onStep","createYieldingScheduler","yieldAfterMS","startTime","runCoroutine","abortSignal","resume","reschedule","stepResult","runCoroutineSync","runCoroutineAsync","makeSyncFunction","coroutineFactory","makeAsyncFunction","Camera","newPosition","halfWidth","halfHeight","rigCamera","setActiveOnSceneIfNoneActive","completeCheck","ignoreParentClass","_ignored","_noPreventDefault","ppIndex","firstPostProcess","rigPostProcess","insertAt","reverseDepth","getProjectionMatrix","checkRigCameras","refRay","rigParams","localAxis","interaxial_distance","isStereoscopicSideBySide","parsedCamera","construct","handednessMultiplier","IntersectionInfo","bv","BoundingBox","worldMatrix","minX","minY","minZ","maxX","maxY","maxZ","vectors","factor","tmpVectors","newRadius","minWorld","maxWorld","directions","vectorsWorld","pointX","pointY","pointZ","sphere","myMin","myMax","myMinX","myMinY","myMinZ","myMaxX","myMaxY","myMaxZ","box0","box1","minPoint","maxPoint","sphereCenter","sphereRadius","boundingVectors","canReturnFalse","BoundingSphere","tempRadiusVector","tempVector","squareDistance","sphere0","sphere1","radiusSum","_result0","_result1","computeBoxExtents","box","r0","r1","r2","axisOverlap","BoundingInfo","minimum","maximum","toEncapsulate","invw","collider","precise","MathHelpers","extractMinAndMaxIndexed","bias","extractMinAndMax","SubMesh","drawWrapper","createIfNotExisting","disposeWrapper","materialContext","materialIndex","renderingMesh","createBoundingBox","addToMesh","replacementMesh","getDefaultMaterial","rootMaterial","effectiveMaterial","enableAlphaMode","linesIndices","checkStopper","intersectionThreshold","intersectInfo","faceId","indexA","indexB","indexC","currentIntersectInfo","newRenderingMesh","minVertexIndex","maxVertexIndex","vertexIndex","VertexDataMaterialInfo","VertexData","meshOrGeometry","isAsync","matInfo","updateExtends","makeItUnique","coordinates","coordinate","transformedCoordinate","transformedNormal","flip","materialInfo","newMaterialInfo","others","use32BitsIndices","forceCloneIndices","mergeMaterialIds","enableCompletion","vertexDatas","indexOffset","vertexOffset","materialInfos","currentMaterialInfo","vertexDataList","matInfoA","matInfoB","vertexDataSource","totalIndices","indexSum","indicesOffset","positionsOffset","nonNullOthers","sumLen","transformRange","ret32","getElementCount","positionsElementCount","validateElementCount","elementCount","materialInfoSerializationObject","copyWhenShared","polygon","sideOrientation","fUV","fColors","frontUVs","backUVs","p1p2x","p1p2y","p1p2z","p3p2x","p3p2y","p3p2z","faceNormalx","faceNormaly","faceNormalz","v1x","v1y","v1z","v2x","v2y","v2z","v3x","v3y","v3z","computeFacetNormals","computeFacetPositions","computeFacetPartitioning","computeDepthSort","faceNormalSign","ratio","distanceTo","xSubRatio","ySubRatio","zSubRatio","subSq","nbFaces","ox","oy","oz","b1x","b1y","b1z","b2x","b2y","b2z","b3x","b3y","b3z","block_idx_v1","block_idx_v2","block_idx_v3","block_idx_o","dsf","li","ln","lp","lu","parsedVertexData","tangents","uvs2","uvs3","uvs4","uvs5","uvs6","matricesIndices","matricesWeights","materialInfoFromJSON","SceneLoaderFlags","CompatibilityOptions","Geometry","disposeExistingBuffer","numOfMeshes","indexToBind","overrideVertexArrayObjects","vbs","vaos","gpuMemoryOnly","needToUpdateSubMeshes","orig","shouldDispose","previousGeometry","onLoaded","tIndices","tTemp","tPositions","tNormals","arrayIdx","stopChecking","vbName","parsedGeometry","geometryUniqueId","geometryId","binaryInfo","positionsData","normalsData","tangentsData","uvsData","uvs2Data","uvs3Data","uvs4Data","uvs5Data","uvs6Data","colorsData","matricesIndicesData","floatIndices","matricesWeightsData","indicesData","subMeshesData","matricesIndex","parsedSubMesh","noInfluenceBoneIndex","matricesIndicesExtra","matricesWeightsExtra","influencers","weight","firstZeroWeight","mweight","convertRHSToLHS","TransformNode","isPure","newRotation","newScaling","postMultiplyPivotMatrix","onNewNodeCreated","newWorldMatrix","decompose","absolutePosition","absolutePositionX","absolutePositionY","absolutePositionZ","invertParentWorldMatrix","invLocalWorldMatrix","targetPoint","yawCor","pitchCor","rollCor","space","dv","pos","rotationMatrix","parentRotationMatrix","quaternionRotation","tmat","preserveScalingSign","updatePivot","quatRotation","invParentMatrix","composedMatrix","currentRotation","affectedTransformNode","resetToPreviousParent","rotationQuaternion","tmpVector","finalScale","finalTranslation","finalRotation","translationMatrix","translationMatrixInv","finalMatrix","displacementVector","tempV3","accumulation","currentRenderId","scaling","cameraWorldMatrix","cameraGlobalPosition","scaleMatrix","orientation","storedTranslation","eulerAngles","camInObjSpace","independentOfChildren","bakedMatrix","tmpRotationQuaternion","currentSerializationObject","parsedTransformNode","transformNodes","ignoreRotation","storedRotation","storedRotationQuaternion","sizeVec","maxDimension","_MeshCollisionData","_FacetDataStorage","_InternalAbstractMeshDataInfo","AbstractMesh","nb","sort","retryCount","disable","renderPassId","response","collisionId","collidedMesh","initialCall","dispose","isIn","removed","renderId","intermediateRendering","amountRight","amountUp","amountForward","rotMatrix","translationDelta","defForwardMult","flipBack","twirlClockwise","tiltRight","applySkeleton","applyMorph","faceIndexCount","positionIndex","targetCount","targetMorph","influence","morphTargetPositions","needExtras","matricesIndicesExtraData","matricesWeightsExtraData","skeletonMatrices","tempMatrix","matWeightIdx","inf","otherBoundingInfo","collisionEnabled","displacement","coordinator","transformMatrix","collisionsScalingMatrix","collisionsTransformMatrix","onlyBoundingInfo","worldToUse","skipBoundingInfo","pickingInfo","anySubmeshSupportIntersect","worldOrigin","pickedPoint","generators","iterator","shadowMap","bInfo","needs32bits","depthSortedFacet","bbSizeMax","sind","facetData","localPos","localNorm","projected","checkFace","facing","invMat","invVect","closest","tmpx","tmpy","tmpz","t0","projx","projy","projz","facetPositions","facetNormals","facetsInBlock","shortest","tmpDistance","fib","upDirection","axisX","axisZ","checkVerticesInsteadOfIndices","addClipPlaneUniforms","prepareStringDefinesForClipPlanes","primaryHolder","secondaryHolder","clipPlane","clipPlane2","clipPlane3","clipPlane4","clipPlane5","clipPlane6","prepareDefinesForClipPlanes","bindClipPlane","setClipPlane","MaterialHelper","useLogarithmicDepth","pointsCloud","fogEnabled","alphaTest","applyDecalAfterDetail","wasOrtho","wasPersp","isOrtho","isPersp","useInstances","useClipPlane","useThinInstances","materialSupportsBoneTexture","prePassRenderer","nonExcluded","useVertexColor","useBones","useMorphTargets","useVertexAlpha","useBakedVertexAnimation","hasVertexColors","previousMultiview","needAlphaBlending","previousDefine","previousDefine16Bits","canRenderToMRT","previousPrePass","texturesList","lightIndex","specularSupported","shadowGenerator","maxSimultaneousLights","disableLighting","caps","projectedLightTexture","uniformBuffersList","updateOnlyBuffersList","uniformsListOrOptions","rank","lightFallbackRank","attribs","maxAttributesCount","uv","needsPreviousMatrices","useSpecular","receiveShadows","linearSpace","prePassConfiguration","boneTexture","abstractMesh","MaterialStencilState","MaterialPluginEvent","Material","doNotAdd","setScene","forceMaterialDirty","overrideOrientation","reverse","targetMaterial","targetPlugin","meshId","localOptions","currentHotSwapingState","checkReady","clipPlaneState","allDone","lastError","tempSubMesh","forceDisposeEffect","forceDisposeTextures","notBoundToMesh","parsedMaterial","pluginClassName","pluginData","pluginClassType","MultiMaterial","oldPush","oldSplice","deleteCount","deleted","subMaterial","cloneChildren","matIndex","subMat","forceDisposeChildren","parsedMultiMaterial","multiMaterial","subMatId","MeshLODLevel","distanceOrScreenCoverage","_CreationDataStorage","_InstanceDataStorage","_InstancesBatch","_ThinInstanceDataStorage","_InternalMeshDataInfo","Mesh","clonePhysicsImpostor","isInstance","ranges","physicsEngine","impostor","ib","sortingOrderFactor","internalDataInfo","boundingSphere","bSphere","distanceToCamera","compareValue","compareSign","screenArea","meshArea","bypassInstanceData","kinds","forceInstanceSupport","generator","renderPassIds","sceneRenderId","needToRecreate","submesh","subdivisionSize","positionFunction","computeNormals","oldGeometry","allowInstancedRendering","subMeshId","isReplacementMode","isInIntermediateRendering","onlyForInstances","batchCache","visibleInstances","defaultRenderId","batch","visibleInstanceCount","instanceStorage","currentInstancesBufferSize","instancesPreviousBuffer","bufferSize","renderSelf","needUpdateBuffer","instanceIndex","instanceMesh","m1","m2","onBeforeDraw","instanceCount","visibleInstancesForSubMesh","effectiveMeshReplacement","numActiveCameras","oldCameraMaxZ","oldCamera","instanceDataStorage","effectiveMesh","mainDeterminant","numWeights","recip","numberNotSorted","missingWeights","maxUsedWeights","numberNotNormalized","numInfluences","usedWeightCounts","toleranceEpsilon","lastWeight","usedWeights","tolerance","numBones","numBadBoneIndices","getBinaryData","materials","multiMaterials","submeshes","bakeIndependentlyOfChildren","minHeight","maxHeight","uvOffset","uvScale","forceUpdate","heightMapWidth","heightMapHeight","normalsCount","flipNormalGeneration","p3","localIndex","flattenNormals","separateVertices","newData","previousSubmeshes","targetIndex","previousOne","flipNormals","vertex_data","numberPerEdge","currentIndices","tempIndices","deltaPosition","deltaNormal","deltaUV","side","positionPtr","uvPtr","normalsPtr","currentUVs","currentPositions","currentColors","currentMatrixIndices","currentMatrixWeights","currentMatrixIndicesExtra","currentMatrixWeightsExtra","matrixIndices","matrixWeights","matrixIndicesExtra","matrixWeightsExtra","pstring","indexPtr","uniquePositions","facet","physicObject","jsonObject","vectorPositions","dupes","realPos","testedPosition","againstPosition","originalSubMeshes","serializationInstance","userThinInstance","morphTarget","parsedMesh","parsedInstance","thinInstances","hasNormals","tempVector3","minVector","maxVector","meshesOrMinMaxVector","minMaxVector","disposeSource","allow32BitsIndices","meshSubclass","subdivideWithSubMeshes","multiMultiMaterials","materialArray","materialIndexArray","indiceArray","currentOverrideMaterialSideOrientation","getVertexDataFromMesh","sourceVertexData","sourceTransform","meshVertexDatas","mergeCoroutine","mergeCoroutineStep","applyToCoroutine","applyToCoroutineStep","pathArray","closeArray","closePath","tessellation","diameter","diameterTop","diameterBottom","subdivisions","thickness","tube","radialSegments","tubularSegments","dashSize","gapSize","dashNb","shape","holes","earcutInjection","cap","scaleFunction","rotationFunction","ribbonCloseArray","ribbonClosePath","xmin","xmax","precision","onReady","alphaFilter","radiusFunction","AutoRotationBehavior","speed","pointerInfoPre","timeToRotation","customTime","zoomHasHitLimit","BouncingBehavior","diagonal","radiusLimit","radiusDelta","FramingBehavior","elevation","focusOnOriginXZ","minimumWorld","maximumWorld","zoomTarget","zoomTargetY","radiusWorld","centerWorld","boxVectorGlobalDiagonal","frustumSlope","distanceForHorizontalFrustum","distanceForVerticalFrustum","timeSinceInteraction","defaultBeta","limitBeta","animatabe","frustumSlopeY","frustumSlopeX","TargetCamera","lockedTarget","lockedTargetPosition","vDir","directionMultiplier","needToMove","needToRotate","parentWorldMatrix","camLeft","camRight","leftSign","rightSign","halfSpace","newFocalTarget","CameraInputTypes","CameraInputsManager","inputToRemove","inputType","noPreventDefault","disconnect","serializedCamera","parsedInputs","parsedinput","BaseCameraPointersInput","previousPinchSquaredDistance","previousMultiTouchPanPosition","isTouch","srcElement","offsetX","offsetY","ed","distX","distY","pinchSquaredDistance","multiTouchPanPosition","_pointA","_pointB","_evt","ArcRotateCameraPointersInput","moveDeltaX","moveDeltaY","pointA","pointB","ArcRotateCameraKeyboardMoveInput","ffMultiplier","ArcRotateCameraMouseWheelInput","mouseWheelDelta","wheelDelta","platformScale","estimatedTargetRadius","targetInertia","inertiaComp","lowerLimit","upperLimit","directionToZoomLocation","ArcRotateCameraInputsManager","ArcRotateCamera","pointers","keyboard","mousewheel","cosa","sina","cosb","sinb","ignored","useCtrlForPanning","panningMouseButton","directionModifier","inertialAlphaOffset","localDirection","previousAlpha","alphaCorrectionTurns","toBoundingCenter","allowSamePosition","cloneAlphaBetaRadius","newTarget","doNotUpdateMaxZ","meshesOrMinMaxVectorAndDistance","minMaxVectorAndDistance","alphaShift","rigCam","ThinTexture","BaseTexture","sceneOrEngine","sampling","isCube","correctedUseSRGBBuffer","texturesCache","texturesCacheEntry","maxWidth","allowEmptyName","numRemaining","onLoadObservable","GenerateBase64StringFromPixelData","npixels","canvas2","ctx2","GenerateBase64StringFromTexture","GenerateBase64StringFromTextureAsync","CopyTools","Texture","noMipmapOrOptions","deleteBuffer","load","loadObserver","uBase","flagMaterialsAsTextureDirty","projectionMatrix","savedName","parsedTexture","parsedCustomTexture","hasInternalTextureUniqueId","mirrorTexture","renderTargetTexture","probe","jsonTexture","renderTargetSize","RenderTargetWrapper","initializeBuffers","isMulti","disposePrevious","faces","face","rtw","textureArray","generateDepthTexture","textureCount","lastTextureSource","samplingModes","types","formats","targetTypes","layerIndex","layerCounts","internalTexture2Index","optionsMRT","bilinear","disposeOnlyFramebuffers","WebGLRenderTargetWrapper","depthbuffer","attachmentIndex","faceIndexOrLayer","currentFB","noColorAttachment","colorAttachment","currentFrameBuffer","internalOptions","hasStencil","glRtWrapper","colorRenderbuffer","defaultOptions","EffectRenderer","effectWrapper","outputTexture","out","EffectWrapper","creationOptions","effectCreationOptions","uniformNames","passPixelShader","DumpTools","data2","fileReader","arrayBuffer","RenderTargetTexture","doNotChangeAspectRatio","_functionName","numPasses","createRenderPassIds","newSize","wasCube","useCameraPostProcess","dumpForDebug","checkReadiness","sceneMeshes","sceneCamera","numLayers","currentRenderList","defaultRenderList","defaultRenderListLength","renderDimension","curved","currentRenderListLength","checkLayerMask","isMasked","saveGenerateMipMaps","PostProcess","postProcessName","customShaderCodeProcessing","fragmentUrl","reusable","vertexUrl","blockCompilation","newUniforms","newSamplers","shaderType","textureOptions","tex","currentlyUsed","needMipMaps","forceDepthStencil","firstPP","maxSize","webVRCamera","desiredWidth","desiredHeight","parsedPostProcess","postProcessType","targetCamera","BlurPostProcess","kernel","_blockCompilation","N","centerIndex","offsets","weights","totalWeight","linearSamplingWeights","linearSamplingOffsets","linearSamplingMap","sharedCell","weightLinear","offsetLinear","maxVaryingRows","freeVaryingVec2","varyingCount","depCount","idealKernel","sigma","denominator","decimalFigures","EffectFallbacks","currentDefines","currentFallbacks","EffectLayer","currentMesh","intensity","refreshRate","preWarm","opaqueSubMeshes","alphaTestSubMeshes","transparentSubMeshes","depthOnlySubMeshes","previousAlphaMode","boundingBoxRendererEnabled","emissiveTexture","renderingMaterial","needAlphaTest","diffuseTexture","needAlphaBlendFromDiffuse","opacityTexture","morphInfluencers","cachedDefines","join","numDraws","currentEffect","ownerMesh","textureMatrix","parsedEffectLayer","parsedData","effectLayer","newEffectLayer","EffectLayerSceneComponent","GlowLayer","effectiveKernel","blurTextureWidth","blurTextureHeight","blurTextureWidth2","blurTextureHeight2","internalTexture2","previousStencilBuffer","textureLevel","emissiveIntensity","parsedGlowLayer","SharpenPostProcess","ImageProcessingPostProcess","configuration","doNotBuild","imageProcessingConfiguration","ChromaticAberrationPostProcess","screenWidth","screenHeight","GrainPostProcess","FxaaPostProcess","texelSize","glInfo","PostProcessRenderPipeline","_engine","renderEffectName","renderEffect","renderEffects","unique","cams","indicesToDelete","cameraName","sampleCount","effectKeys","PostProcessRenderEffect","getPostProcesses","singleInstance","pps","cameraKey","CircleOfConfusionPostProcess","depthTexture","cocPrecalculation","DepthOfFieldBlurPostProcess","circleOfConfusion","imageToBlur","DepthOfFieldMergePostProcess","originalFromInput","_blurSteps","DepthOfFieldEffectBlurLevel","DepthOfFieldEffect","blurLevel","pipelineTextureType","circleOfConfusionTextureFormat","blurCount","kernelSize","adjustedKernelSize","blurY","blurX","effectIndex","ExtractHighlightsPostProcess","BloomMergePostProcess","blurred","BloomEffect","_bloomScale","bloomWeight","bloomKernel","PostProcessRenderPipelineManager","renderPipelineName","pipeline","renderPipeline","PostProcessRenderPipelineManagerSceneComponent","DefaultRenderingPipeline","enabled","oldBloom","oldDof","hdr","automaticBuild","previousState","skipTextureSharing","depthRenderer","disposeNonRecreated","internalSizedFomat","needConversion","_convertRGBtoRGBATextureData","mipmapGenerator","onerror","internalCallback","faceDataArrays","mipData","mipSize","mipFaceData","rgbData","rgbaData","_makeCreateRawTextureFunction","is3D","_makeUpdateRawTextureFunction","internalType","RawTexture","PassPostProcess","PassCubePostProcess","SSAO2Configuration","SSAO2RenderingPipeline","forceGeometryBuffer","ssaoRatio","blurRatio","disableGeometryBufferRenderer","disabled","bilateral","horizontal","blurFilter","ssaoCombineSize","originalColorSize","cosTheta","sinTheta","numSamples","rand","orthoLeft","orthoRight","orthoBottom","orthoTop","randVector","SSAORenderingPipeline","combineRatio","disableDepthRender","dw","sampleSphere","samplesFactor","textureStatus","attachments","depthTextureFormat","defaultType","defaultSamplingMode","defaultUseSRGBBuffer","defaultFormat","defaultTarget","useSRGBBuffers","useStencilTexture","depthStencilBuffer","layerCount","isWebGL2","internalSizedFormat","webGLTextureType","depthTextureType","glDepthTextureInternalFormat","glDepthTextureFormat","glDepthTextureType","glDepthTextureAttachment","useDepthStencil","MultiRenderTarget","textureNames","drawOnlyOnFirstAttachmentByDefault","mapMainInternalTexture2Index","mapInternalTexture2MainIndex","internalTextures","mainIndex","forceFullRebuild","layerIndices","faceIndices","doNotDisposeInternalTextures","MaterialFlags","GeometryBufferRenderer","geometryBufferType","needUv","metallicWorkflow","numMorphInfluencers","layoutAttachmentsAll","layoutAttachmentsAllButDepth","layoutAttachmentsDepthOnly","attachmentsAll","attachmentsAllButDepth","attachmentsDepthOnly","renderSubMesh","bonesTransformations","alphaTexture","MotionBlurConfiguration","_staticOffsetValueQuaternion","_staticOffsetValueVector3","_staticOffsetValueVector2","_staticOffsetValueSize","_staticOffsetValueColor3","RuntimeAnimation","targetPropertyPath","restoreOriginal","originalValue","blendingSpeed","newSpeedRatio","newAbsoluteFrame","elapsedTimeSinceAnimationStart","frameRange","offsetValue","absoluteFrame","highLimitValue","keyOffset","fromValue","toValue","syncRoot","hostNormalizedFrame","Bone","parentBone","localMatrix","restMatrix","bindMatrix","updateAbsoluteBindMatrices","localScaling","localRotation","localPosition","updateLocalMatrix","updateChildren","tNode","translationMode","lm","tvec","scaleChildren","locMat","scaleMat","cm","rotMatInv","rmat","rotMat2","lmat","lx","ly","lz","parentScale","parentScaleInv","poseMatrix","amat","Animatable","fromFrame","toFrame","loopAnimation","animations","onAnimationLoop","isAdditive","playOrder","newRuntimeAnimation","runtimeAnimations","fps","useGlobalSplice","running","isRunning","animatables","animationTime","returnedAnimatable","stopCurrent","shouldRunTargetAnimations","holder","normalizer","finalPosition","finalScaling","finalQuaternion","originalAnimation","skipOverride","animIndex","currentPosition","currentScaling","currentQuaternion","workValue","refQuaternion","cumulativeQuaternion","quaternions","cumulativeAmount","matrixDecomposeMode","finalValue","rangeName","frameOffset","rescaleAsRequired","skelDimensionsRatio","sourceRange","sourceKeys","sourceBoneLength","sourceParent","parentScalingReqd","parentRatio","dimensionsScalingReqd","destKeys","origTranslation","GeometryBufferRendererSceneComponent","renderTargets","MotionBlurPostProcess","skinnedMesh","velocityIndex","viewProjection","depthIndex","ScreenSpaceReflectionsConfiguration","ScreenSpaceReflectionPostProcess","geometryBufferRenderer","roughnessIndex","normalIndex","viewMatrix","StandardRenderingPipeline","strength","shouldRebuild","originalPostProcess","downSampleX4Offsets","brightOffsets","sU","sV","indice","blurWidthKey","geometryRenderer","depthValues","lastLuminance","downSampleOffsets","pixel","bit_shift","outputLiminance","lastTime","resolution","scaleBias1","scaleBias2","camerax","cameraz","camRot","starRotation","lensStarMatrix","mb","motionScale","prevViewProjection","invViewProjection","screenSize","ScreenSpaceReflections2Configuration","DepthRenderer","storeNonLinearDepth","storeCameraSpaceZ","detNeg","reverseSideOrientation","cameraIsOrtho","keysToDelete","trs","trsWebGPU","SSRRenderingPipeline","threshold","downsample","rebuild","isProbe","attenuate","clip","fresnel","automatic","gammaSpace","depthRendererSize","samplerNames","SceneLoaderAnimationGroupLoadingMode","SceneLoader","registeredPlugin","sceneFilename","queryStringPosition","dotPosition","fileInfo","errorMessage","onDispose","pluginExtension","directLoad","dataCallback","responseURL","pluginDisposed","onDisposeObservable","manifestChecked","errorCallback","canUseOfflineSupport","exceptionFound","rawData","sceneFile","filename","extensions","meshNames","loadingToken","disposeHandler","progressHandler","successHandler","particleSystems","skeletons","animationGroups","geometries","lights","syncedPlugin","assets","assetContainer","overwriteAnimations","animationGroupLoadingMode","targetConverter","animationGroup","startingIndexForNewAnimatables","onAssetContainerLoaded","loadedFiles","onfinish","onErrorCallBack","files","loadedImages","tokenPendingData","maxLevel","createPolynomials","lodScale","lodOffset","beforeLoadCubeDataCallback","imageHandler","originalRootUrl","rootUrlWithoutUriParams","onloaddata","images","imgs","CubeTexture","rootUrlKey","prefiltered","delayLoad","isDDS","isEnv","isBasis","trans","oldTexture","onLoadProcessing","newCubeTexture","cubeTexture","PanoramaToCubeMapTools","float32Array","inputWidth","inputHeight","supersample","textureFront","textureBack","textureLeft","textureRight","textureUp","textureDown","texSize","sampleFactor","sampleFactorSqr","rotDX1","rotDX2","dy","fy","xv1","xv2","dx","px","py","inputY","HDRTools","mantissa","float32array","red","green","blue","uint8array","character","endOfHeader","findFormat","lineIndex","hdrInfo","num_scanlines","scanline_width","dataIndex","scanLineArrayBuffer","scanLineArray","resultBuffer","resultArray","SH3ylmBasisConstants","SH3ylmBasisTrigonometricTerms","applySH3","SHCosKernelConvolution","SphericalHarmonics","deltaSolidAngle","colorVector","polynomial","SphericalPolynomial","harmonics","sp","FileFaceOrientation","worldAxisForNormal","worldAxisForFileX","worldAxisForFileY","CubeMapToSphericalPolynomialTools","rightPromise","leftPromise","upPromise","downPromise","frontPromise","backPromise","down","front","cubeInfo","sphericalHarmonics","totalSolidAngle","du","halfTexel","minUV","fileFace","dataArray","worldDirection","currentMax","correctionFactor","HDRFiltering","mipmapsCount","intTexture","onFinished","CreateResizedCopy","useBilinearMode","passPostProcess","ApplyPostProcess","encodedTexture","floatView","int32View","ToHalfFloat","bits","FromHalfFloat","TextureTools","sphericalPolynomial","HDRCubeTexture","generateHarmonics","prefilterOnLoad","byteArray","shortArray","dataFace","previousOnLoad","hdrFiltering","EquiRectangularCubeTexture","loadTextureCallback","floatImageData","AssetTaskState","AbstractAssetTask","msg","AssetsProgressEvent","remainingCount","totalCount","task","ContainerAssetTask","meshesNames","MeshAssetTask","AnimationAssetTask","startingIndexForNewAnimationGroups","TextFileAssetTask","BinaryFileAssetTask","ImageAssetTask","TextureAssetTask","CubeTextureAssetTask","HDRCubeTextureAssetTask","reserved","EquiRectangularCubeTextureAssetTask","AssetsManager","taskName","currentTasks","remainingTasks","customLoadingScreen","stats","$data","_renderSlot","PrePassConfiguration","isFrozen","PushMaterial","storeEffectOnSubMeshes","normalMatrix","rxOption","MaterialPluginManager","defineNamesFromPlugins","hasRenderTargetTextures","hasTexture","customCode","pointName","existingCallback","injectedCode","regexFlags","matchOption","newCode","fullPointName","UnregisterAllMaterialPlugins","inited","RegisterMaterialPlugin","pluginName","_factory","UnregisterMaterialPlugin","MaterialPluginBase","priority","addToPluginList","resolveIncludes","activeTextures","currentRank","ubos","MaterialDetailMapDefines","DetailMapConfiguration","onCreatedEffectParameters","StandardMaterialDefines","modeToEnable","modes","StandardMaterial","oit","forceWasNotReadyPreviously","lightDisposed","shaderName","csnrOptions","previousEffect","mustRebind","cloneTexturesOnlyOnce","Action","triggerOptions","propertyPath","serializedAction","serializedCondition","Condition","ValueCondition","PredicateCondition","StateCondition","SwitchBooleanAction","SetStateAction","SetValueAction","IncrementValueAction","PlayAnimationAction","StopAnimationAction","DoNothingAction","CombineAction","enableChildrenConditions","ExecuteCodeAction","SetParentAction","ActionManager","ownerMeshes","triggers","triggerA","triggerB","parameterPredicate","lowerCase","unicode","triggerObject","parsedActions","instantiate","internalClassType","parseParameter","effectiveTarget","parsedAction","combineArray","combine","actions","param","newAction","nothing","triggerParams","CreateRibbonVertexData","invertUV","defaultOffset","customUV","customColors","us","vs","uTotalDistance","vTotalDistance","minlg","lg","ar1","ar2","idc","closePathCorr","vectlg","dist","path1","path2","l1","shft","path1nb","indexFirst","indexLast","positions32","normals32","uvs32","CreateRibbon","ns","si","pathPoint","colorIndex","ribbon","RibbonBuilder","CreateDiscVertexData","vertexNb","CreateDisc","disc","DiscBuilder","GroundMesh","chunksCount","octreeBlocksSize","thisAsAny","tmpVect","tmpMat","col","quad","subdivisionsX","subdivisionsY","v4","v1v2","v1v3","v1v4","norm1","norm2","cd","d2","CreateGroundVertexData","CreateTiledGroundVertexData","tileRow","tileCol","tileSize","applyTile","xTileMin","zTileMin","xTileMax","zTileMax","rowLength","square","CreateGroundFromHeightMapVertexData","invert","heightMapX","heightMapY","idx1","idx2","idx3","idx4","isVisibleIdx1","isVisibleIdx2","isVisibleIdx3","CreateGround","ground","CreateTiledGround","tiledGround","CreateGroundFromHeightMap","GroundBuilder","CreateBoxVertexData","topBaseAt","bottomBaseAt","topOrder","bottomOrder","topIndex","bottomIndex","basePositions","topFaceBase","bottomFaceBase","topFaceOrder","bottomFaceOrder","scaleArray","accumulator","currentIndex","faceUV","faceColors","totalColors","CreateSegmentedBoxVertexData","widthSegments","heightSegments","depthSegments","bottomPlane","topPlane","negXPlane","posXPlane","negZPlane","posZPlane","CreateBox","BoxBuilder","CreateTiledPlaneVertexData","flipTile","tileWidth","tileHeight","alignH","alignV","tilesX","tilesY","adjustX","adjustY","startX","startY","uvBase","partialBottomRow","partialTopRow","partialLeftCol","partialRightCol","uvPart","uvBaseBR","uvBaseTR","uvBaseLC","uvBaseRC","CreateTiledPlane","TiledPlaneBuilder","CreateTiledBoxVertexData","halfDepth","faceVertexData","baseAlignV","facePositions","faceNormals","newFaceUV","vec0","mtrx0","mtrx2","mtrx3","vec4","mtrx4","mtrx5","CreateTiledBox","TiledBoxBuilder","CreateSphereVertexData","diameterX","diameterY","diameterZ","slice","dedupTopBottomIndices","totalZRotationSteps","totalYRotationSteps","zRotationStep","normalizedZ","angleZ","yRotationStep","normalizedY","angleY","rotationZ","rotationY","afterRotZ","complete","firstIndex","CreateSphere","SphereBuilder","CreateCylinderVertexData","hasRings","enclose","quadNb","ringNb","surfaceNb","angleStep","tan","ringVertex","ringNormal","ringFirstVertex","ringFirstNormal","quadNormal","Y","ringIdx","cs","i2","i3","createCylinderCap","isTop","circleVector","vbase","textureScale","textureCoordinate","CreateCylinder","cylinder","CylinderBuilder","CreateTorusVertexData","outerAngle","innerAngle","nextI","nextJ","CreateTorus","torus","TorusBuilder","CreateTorusKnotVertexData","getPos","cu","su","quOverP","tang","bitan","jNext","CreateTorusKnot","torusKnot","TorusKnotBuilder","InstancedMesh","_value","tempMaster","sourceMeshLODLevels","newSourceMesh","expectedSize","ShaderMaterial","shaderPath","sampler","defineName","existingDefineIdx","defineToAdd","numInfluencers","bvaManager","previousDefines","effectOverride","useSceneUBO","propName","propValue","LinesMesh","_subMesh","colorEffect","doNotDisposeMaterial","InstancedLinesMesh","CreateLineSystemVertexData","vertexColors","CreateDashedLinesVertexData","curvect","dashshft","curshft","CreateLineSystem","vertexColor","lineColors","lineSystem","CreateLines","CreateDashedLines","nbSeg","dashedLines","LinesBuilder","IndexedVector2","original","PolygonPoints","originalPoints","lmin","lmax","Polygon","ymin","ymax","numberOfSides","floats","PolygonMeshBuilder","contours","hole","holepoints","smoothingThreshold","bounds","positionscount","ulength","vc","vp","vn","vc_norm","vp_norm","vn_norm","dotp","dotn","CreatePolygonVertexData","wrp","disp","distZ","totalLen","cumulate","CreatePolygon","polygonTriangulation","hNb","hPoint","ExtrudePolygon","PolygonBuilder","ExtrudeShape","closeShape","_ExtrudeShapeGeneric","ExtrudeShapeCustom","adjustFrame","rotateFunction","rbCA","rbCP","custom","updtbl","extrusionPathArray","path3D","shapePaths","binormals","distances","returnScale","rotate","scl","shapePath","scaleRatio","planed","rotated","capPath","pointCap","barycenter","storage","newShapePaths","extrudedGeneric","ShapeBuilder","CreateLathe","pi2","paths","LatheBuilder","CreatePlaneVertexData","CreatePlane","PlaneBuilder","CreateTube","tubePathArray","circlePaths","radiusFunctionFinal","circlePath","rad","pathIndex","newPathArray","TubeBuilder","CreatePolyhedronVertexData","polyhedra","sizeX","sizeY","sizeZ","nbfaces","flat","faceIdx","indexes","ang","fl","CreatePolyhedron","polyhedron","PolyhedronBuilder","CreateIcoSphereVertexData","radiusX","radiusY","radiusZ","icoVertices","ico_indices","vertices_unalias_id","ico_vertexuv","ustep","vstep","uoffset","voffset","island_u_offset","island_v_offset","island","current_indice","face_vertex_pos","face_vertex_uv","v012","v_id","interp_vertex","pos_x0","pos_x1","pos_interp","vertex_normal","centroid_x0","centroid_x1","uv_x0","uv_x1","uv_interp","CreateIcoSphere","IcoSphereBuilder","xpAxis","xnAxis","ypAxis","ynAxis","zpAxis","znAxis","DecalVertex","vertexIdx","vertexIdxForBones","localPositionOverride","localNormalOverride","matrixIndicesOverride","matrixWeightsOverride","CreateDecal","hasSkeleton","useLocalComputation","meshHasOverridenMaterial","localPositions","localNormals","matIndices","matWeights","matIndicesExtra","matWeightsExtra","cameraWorldTarget","currentVertexDataIndex","extractDecalVector3","indexId","vertexId","emptyArray","clipSize","indexOf","clipVertices","_m","_o","_p","_q","_r","clipFactor","mat0Index","v0Indices","v0Weights","mat1Index","v1Indices","v1Weights","ind","sumw","v0LocalPositionX","v0LocalPositionY","v0LocalPositionZ","v1LocalPositionX","v1LocalPositionY","v1LocalPositionZ","v0LocalNormalX","v0LocalNormalY","v0LocalNormalZ","v1LocalNormalX","v1LocalNormalY","v1LocalNormalZ","interpNormalX","interpNormalY","interpNormalZ","clipResult","total","nV1","nV2","nV3","nV4","d3","v1Out","v2Out","v3Out","sourceMeshAsMesh","matrixData","numMatrices","thinInstanceMatrix","ofst","decalWorldMatrix","inverseDecalWorldMatrix","meshWorldMatrix","oneFaceVertices","faceVertices","vIndex","decal","DecalBuilder","CreateCapsuleVertexData","capDetail","radiusTop","radiusBottom","heightMinusCaps","thetaStart","thetaLength","capsTopSegments","capsBottomSegments","indexArray","cosAlpha","sinAlpha","coneLength","vl","indexRow","sinA","_radius","coneHeight","i4","vDat","CreateCapsule","capsule","CapsuleBuilder","_IsoVector","isoGridSize","_PrimaryIsoTriangle","PolyhedronData","vecToidx","fr","O","A","B","oVec","aVec","bVec","oaVec","abVec","obVec","verts","idxR","isoId","isoIdR","closestTo","vDist","matchIdx","thirdR3","LSQD","pointR","prevR","nextR","maxPrev","maxLeftPrev","faceNb","geodesicData","F","oidx","aidx","bidx","OA","OB","tempVec","distFrom","vert","primVert","cartesian","distFromO","distFromA","distFromB","vertByDist","vertData","category","GeodesicData","primTri","nearTo","close","near","nearIndex","adjVerts","dualFaces","goldbergPolyhedronData","verticesNb","cz","CreateGeodesic","geoOptions","GoldbergMesh","poleOrShared","fromPole","colorRange","newCols","uvRange","points5","points6","newUVs","goldbergData","goldberg","CreateGoldbergVertexData","ba","ca","pdata","vCoord","CreateGoldberg","ShapePath","cpx","cpy","cpx1","cpy1","cpx2","cpy2","CreateShapePath","char","fontData","glyph","outline","CreateTextShapePaths","chars","line_height","CreateText","letterIndex","holeVectors","shapeVectors","localHolesCopy","found","holePoints","bbox","MeshBuilder","Ray","intersectionTreshold","newMinimum","newMaximum","maxValue","rr","vertex0","edge1","edge2","pvec","qvec","invdet","bw","result1","result2","tm","pickingInfoA","pickingInfoB","sega","segb","rsegb","D","sN","sD","tN","tD","sc","tc","qtc","qsc","dP","nearScreenSource","farScreenSource","nearVec3","farVec3","rayFunction","computeWorldMatrixForCamera","currentCamera","forceCompute","tmpMatrix","thinMatrices","pickingInfos","_enableDistantPicking","sizeSmall","timeSlow","RGBDTextureTools","expandTexture","expandRGBDTexture","rgbdPostProcess","expandedTexture","outputTextureType","DefaultEnvironmentTextureImageType","CurrentVersion","MagicBytes","GetEnvInfo","manifestString","charCode","manifest","normalizeEnvInfo","CreateEnvTextureAsync","imageType","sphericalPolynomialPromise","cubeWidth","specularTextures","faceWidth","faceDataFloat","floatData","tempTexture","rgbdEncodedData","imageEncodedData","_CreateEnvTextureIrradiance","infoString","infoBuffer","infoView","strLen","totalSize","finalBuffer","finalBufferView","polynmials","CreateImageDataArrayBufferViews","specularInfo","imageInfo","UploadEnvLevelsAsync","UploadLevelsAsync","_OnImageReadyAsync","generateNonLODTextures","lodTextures","cubeRtt","lodTexture","roughness","minLODIndex","maxLODIndex","lodIndex","mipmapIndex","glTextureFromLod","promises","UploadEnvSpherical","irradianceInfo","_UpdateRGBDAsync","proxyPromise","_internalTexture","EnvironmentTextureTools","_ENVTextureLoader","Light","iAsString","needUpdate","scaledIntensity","clonedLight","parsedLight","photometricScale","lightTypeID","photometricMode","apexAngleRadians","KeepAssets","InstantiatedEntries","AssetContainer","nodesUidMap","dependencyGraph","nodeId","dependsOn","masterMesh","dependedBy","childId","sortedNodes","leaves","visitList","nodeToVisit","dependedByVisitedNode","dependedByVisitedNodeId","dependsOnDependedByVisitedNode","addedIds","nameFunction","cloneMaterials","conversionMap","storeMap","alreadySwappedSkeletons","alreadySwappedMaterials","onClone","clonedMesh","oldMorphTargetManager","nodesToSort","idsOnSortList","onNewCreated","replicatedParentId","replicatedParent","sourceMaterial","swap","multi","instancedNode","replicatedSourceId","replicatedInstancedNode","canInstance","replicatedNode","addedNodes","addedNode","sourceAssets","targetAssets","keepAssets","asset","keepAsset","rootMesh","_targetConverter","nodeInAC","nodeInScene","animationInAC","animationsWithSameProperty","animationInScene","animationWithSameProperty","newAnimationGroups","animationGroupInAC","DataReader","validateAsync","getExternalResource","workerFunc","pendingExternalResources","GLTFValidation","dataCopy","workerContent","workerBlobUrl","worker","onMessage","readAsync","readViewAsync","arrayBufferView","GLTFLoaderCoordinateSystemMode","GLTFLoaderAnimationStartMode","GLTFLoaderState","GLTFFileLoader","webRequest","loaderData","morphTargetManagers","lengthComputable","loaded","minVersion","createLoader","json","dataReader","Binary","magic","unpacked","ContentFormat","contentLength","contentFormat","bodyLength","startByteOffset","ChunkFormat","chunkLength","spaces","EComponentType","EShaderType","EParameterType","ETextureWrapMode","ETextureFilterType","ETextureFormat","ECullingType","EBlendingFunction","FreeCameraKeyboardMoveInput","FreeCameraMouseInput","touchEnabled","BaseCameraMouseWheelInput","_CameraProperty","FreeCameraMouseWheelInput","cameraTransformMatrix","transformedDirection","cameraProperty","FreeCameraTouchInput","allowMouse","previousPosition","isMouseEvent","FreeCameraInputsManager","FreeCamera","mouse","globalPosition","actualDisplacement","Skeleton","engineCaps","nBones","boneDict","sourceBones","boneName","sourceBone","highest","sceneAnimatables","rangeAnimatable","sceneAnimatable","targetMatrix","initialSkinMatrix","mappedIndex","dontCheckFrameId","needsUpdate","textureWidth","serializedBone","parsedSkeleton","parsedBone","parsedBoneIndex","rest","bones","visited","HemisphericLight","_effect","normalizeDirection","lightDataUniformName","ShadowLight","DirectionalLight","shadowMinZ","shadowMaxZ","useReverseDepthBuffer","PointLight","previousNeedCube","SpotLight","lightFar","lightNear","P","Q","S","GLTFUtils","shaderMaterial","accessor","gltfRuntime","loadedBufferView","Constants","ETokenType","Tokenizer","toParse","glTFTransforms","babylonTransforms","glTFAnimationPaths","babylonAnimationPaths","parseBuffers","parsedBuffers","parsedBuffer","parseShaders","parsedShaders","sha","parsedShader","parseObject","parsedObjects","runtimeProperty","parsedObject","normalizeUVs","getAttribute","attributeParameter","loadAnimations","anim","lastAnimation","inputData","outputData","bufferInput","bufferOutput","targetId","targetNode","isBone","targetPath","targetPathIndex","babylonAnimation","arrayOffset","modifyKey","configureBoneTransformation","getParentBone","skins","jointName","nde","getNodeToRoot","nodesToRoot","nodeToRoot","getJointNode","nodeIsInJoints","getNodesToRoot","importSkeleton","nodesToRootToAdd","jointNode","existingBone","foundBone","joint","importMesh","subMaterials","verticesStarts","verticesCounts","indexStarts","indexCounts","tempVertexData","primitive","semantic","uvKind","configureNode","configureNodeFromMatrix","importNode","skin","ambienLight","hemiLight","directionalLight","dirLight","pointLight","ptLight","spotLight","spLight","orthoCamera","perspectiveCamera","persCamera","traverseNodes","meshIncluded","postLoad","currentScene","thing","onBindShaderMaterial","unTreatedUniforms","technique","materialValues","unif","prepareShaderMaterialUniforms","techniqueUniforms","onLoadTexture","GLTFLoaderExtension","onShaderCompileError","onShaderCompileSuccess","parseShaderUniforms","tokenizer","uniformParameter","transformIndex","importMaterials","GLTFLoaderBase","createMipMaps","revokeBlobURL","shaderString","defaultMaterial","states","newVertexShader","newPixelShader","vertexTokenizer","pixelTokenizer","foundAttribute","functions","blendFunc","GLTFLoader$1","GLTFLoader","skl","hasShaders","processShader","hasBuffers","processBuffer","loaderExtension","defaultFunc","extensionName","BinaryExtensionBufferName","GLTFBinaryExtension","extensionsUsed","sourceExt","binaryExtensionShader","shaderBytes","GLTFMaterialsCommonExtension","ambientLight","ambient","directional","spot","standardMaterial","Deferred","TargetedAnimation","AnimationGroup","targetedAnimation","normalize","beginFrame","mergedAnimationGroup","curIndex","newName","cloneAnimations","newGroup","targetedAnimationIndex","parsedAnimationGroup","sourceAnimationGroup","targetedAnimations","fromKey","toKey","dontCloneAnimations","useFrame","newKeys","_environmentBRDFBase64Texture","_instanceNumber","GetEnvironmentBRDFTexture","useDelayedTextureLoading","BRDFTextureTools","MaterialBRDFDefines","PBRBRDFConfiguration","MaterialClearCoatDefines","PBRClearCoatConfiguration","disableBumpMap","invertNormalMapX","invertNormalMapY","identicalTextures","eta","MaterialIridescenceDefines","PBRIridescenceConfiguration","MaterialAnisotropicDefines","PBRAnisotropicConfiguration","MaterialSheenDefines","PBRSheenConfiguration","MaterialSubSurfaceDefines","PBRSubSurfaceConfiguration","refractionTexture","refractionIntensityTextureIsThicknessTexture","translucencyIntensityTextureIsThicknessTexture","useOnlyThicknessTexture","thicknessScale","realTimeFiltering","lodBasedMicrosurface","refractionIor","PBRMaterialDefines","PBRBaseMaterial","reflectionTexture","fallbackRank","polynomials","preScaledHarmonics","ior","outsideIOR","metallicF90","subSurfaceConfiguration","PBRMaterial","MorphTarget","hadPositions","hadNormals","hadTangents","hadUVs","newOne","RawTexture2DArray","MorphTargetManager","influenceCount","mustUpdateTexture","morph","targetData","getVector3","getQuaternion","getWeights","AnimationPropertyInfo","getValue","getStride","TransformNodeAnimationPropertyInfo","WeightAnimationPropertyInfo","babylonMesh","babylonAnimationClone","nodeAnimationData","mergeDeep","objects","pVal","oVal","ArrayItem","nodeMap","resultFunc","loadingToReadyCounterName","loadingToCompleteCounterName","oldBlockMaterialDirtyMechanism","babylonDrawMode","buffers","binaryBuffer","nodeParents","extensionPromise","babylonAnimationGroups","babylonAnimationGroup","assign","loadNode","babylonTransformNode","babylonCamera","childNode","childBabylonMesh","nodeName","babylonTransformNodeForSkin","babylonSkeleton","parentNode","primitives","shouldInstance","babylonAbstractMesh","babylonGeometry","babylonMaterial","loadAttribute","babylonVertexBuffer","divider","oneOverDivider","targetNames","babylonMorphTarget","setData","babylonNode","skeletonId","inverseBindMatricesData","isParent","skeletonNode","babylonBones","joints","babylonBone","parentBabylonBone","baseMatrix","babylonParentBone","perspective","babylonTarget","animationContext","targetInfo","invfps","numAnimations","outputOffset","babylonAnimatable","inputAccessor","outputAccessor","numComponents","typedArray","sparse","indicesBufferView","valuesBufferView","valuesData","sparseLength","sparseData","valuesIndex","indicesIndex","babylonBuffer","babylonData","textureInfo","babylonTexture","textureLoaderOptions","samplerData","deferred","textureCreationOptions","dataUrl","babylonObject","metadata","gltf","componentTypeLength","actionAsync","loaderProperty","activeLoaderExtensionFunctions","extra","RawCubeTexture","UpdateRGBDAsyncEnvTools","NAME","EXT_lights_image_based","extensionContext","mipmap","specularImageContext","lodGenerationScale","refresh","numMaxInstances","staticBuffer","matrixBuffer","forceRefreshParentInfo","numInstances","kindIsMatrix","currentSize","EXT_mesh_gpu_instancing","translationBuffer","rotationBuffer","scaleBuffer","MeshoptCompression","decoder","EXT_meshopt_compression","bufferViewMeshopt","EXT_texture_webp","WorkerPool","workers","workerInfo","nextAction","AutoReleaseWorkerPool","maxWorkers","createWorkerAsync","createDecoderAsync","wasmBinary","decodeMesh","decoderModule","onIndicesData","onAttributeData","numIndices","pointCloud","numPoints","processAttribute","numValues","dracoAttributeTypes","decoderPromise","DracoCompression","numWorkers","decoderInfo","decoderWasmBinary","workerPool","resultIndices","resultAttributes","dataViewCopy","meshData","KHR_draco_mesh_compression","KHR_lights","babylonLight","babylonDirectionalLight","babylonSpotLight","KHR_materials_pbrSpecularGlossiness","KHR_materials_unlit","KHR_materials_clearcoat","KHR_materials_iridescence","KHR_materials_anisotropy","KHR_materials_emissive_strength","KHR_materials_sheen","KHR_materials_specular","KHR_materials_ior","KHR_materials_variants","extensionMetadata","variantName","select","mappingIndex","mapping","mappingVariantIndex","variantIndex","variant","newRoot","variantEntry","TransmissionHelper","oldOptions","transparentIdx","opaqueIdx","sceneImageProcessingapplyByPostProcess","saveSceneEnvIntensity","opaqueRenderTarget","KHR_materials_transmission","pbrMaterial","KHR_materials_translucency","KHR_materials_volume","attenuationDistance","KHR_mesh_quantization","KHR_texture_basisu","KHR_texture_transform","KHR_xmp_json_ld","xmp_gltf","xmp_node","packet","getColor3","getAlpha","getFloat","getMinusFloat","getNextFloat","getFloatBy2","getTextureTransformTree","MaterialAnimationPropertyInfo","CameraAnimationPropertyInfo","LightAnimationPropertyInfo","nodesTree","camerasTree","materialsTree","extensionsTree","animationPointerTree","KHR_animation_pointer","gltfCurrentNode","gltfTargetNode","AnimationEvent","onlyOnce","Sound","timeSinceLastStart","wasPlaying","urlOrArrayBuffer","readyToPlayCallback","currentVolume","currentDistance","maxDistance","refDistance","rolloffFactor","validParameter","urls","codecSupportedFound","audioData","audioBuffer","soundTrackAudioNode","coneInnerAngle","coneOuterAngle","coneOuterGain","newLocalDirection","tryToPlay","playPromise","oldSource","actualOffset","stopTime","newVolume","newPlaybackRate","setBufferAndRun","clonedSound","currentOptions","parsedSound","sourceSound","soundName","soundUrl","newSound","soundPosition","localDirectionToMesh","connectedMesh","WeightedSound","sounds","weightSum","invWeightSum","sound","startOffset","randomValue","MSFT_audio_emitter","emitterIndex","clipPromises","clipContext","objectURL","weightedSound","babylonAnimationEvent","MSFT_lod","indexLOD","firstPromise","nodeLODs","nodeLOD","assignWrap","previousNodeLOD","materialLODs","materialLOD","previousDataLOD","previousIndexLOD","loadAsync","bufferLODs","bufferLOD","ids","babylonMaterials","babylonMaterialsToDispose","babylonTextures","MSFT_minecraftMesh","extraContext","MSFT_sRGBFactors","useExactSrgbConversions","ExtrasAsMetadata","gltfProp","Pin","islandTask","skyboxTask","lightmapName","lightMapTask","lightmap","environmentNode","lightmap_ground","lightmap_house1","lightmap_house3","assignments","assignment","productID","triggerBox","tooltipData","triggerBoxName","intervalID","_component_Pin","Renderer","Aliaxis","Loadingscreen","NavigationTopLeft","NavigationBottomRight","ProductInfos","Tooltip","Tutorial","elem","__vitePreload","search_params","storeLinks","convertTranslation","translationsJSON","_component_ProductInfos","_component_NavigationTopLeft","_component_NavigationBottomRight","_component_Tooltip","_component_Tutorial","_component_Loadingscreen","_component_Renderer","_component_Aliaxis","boolean","camStats","inBrowser","makeSymbol","shareable","generateFormatCacheKey","locale","friendlyJSONstringify","isNumber","isDate","isRegExp","isEmptyObject","escapeHtml","rawText","separator","incrementer","warn","createPosition","column","createLocation","loc","RE_ARGS","identifier","CompileErrorCodes","errorMessages","createCompileError","domain","messages","defaultOnError","CHAR_SP","CHAR_CR","CHAR_LF","CHAR_LS","CHAR_PS","createScanner","_buf","_index","_line","_column","_peekOffset","isCRLF","isLF","isPS","isLS","isLineEnd","peekOffset","charAt","currentChar","currentPeek","resetPeek","skipToPeek","EOF","DOT","LITERAL_DELIMITER","ERROR_DOMAIN$3","createTokenizer","_scnr","currentOffset","_initLoc","_initOffset","_context","emitError","getToken","getEndToken","eat","scnr","peekSpaces","skipSpaces","isIdentifierStart","cc","isNumberStart","isNamedIdentifierStart","currentType","isListIdentifierStart","isLiteralStart","isLinkedDotStart","isLinkedModifierStart","isLinkedDelimiterStart","isLinkedReferStart","isPluralStart","detectModuloStart","isTextStart","hasSpace","detectModulo","takeChar","takeIdentifierChar","takeDigit","takeHexDigit","getDigits","readModulo","readText","readNamedIdentifier","readListIdentifier","readLiteral","literal","readEscapeSequence","readUnicodeEscapeSequence","digits","sequence","readInvalidIdentifier","identifiers","closure","readLinkedModifier","readLinkedRefer","detect","readPlural","plural","readTokenInPlaceholder","readTokenInLinked","validNamedIdentifier","validListIdentifier","validLiteral","readToken","isModulo","nextToken","startLoc","endLoc","ERROR_DOMAIN$2","KNOWN_ESCAPES","fromEscapeSequence","codePoint4","codePoint6","codePoint","createParser","tokenzer","startNode","endNode","parseText","parseList","parseNamed","parseLiteral","parseLinkedModifier","getTokenCaption","parseLinkedKey","parseLinked","linkedNode","nextContext","emptyLinkedKeyNode","parseMessage","endOffset","parsePlural","msgNode","hasEmptyMessage","parseResource","parse","createTransformer","ast","transformer","traverseNode","optimize","optimizeMessageNode","ERROR_DOMAIN$1","minify","cases","valueNode","linked","named","ERROR_DOMAIN","createCodeGenerator","sourceMap","breakLineCode","_needIndent","_newline","withBreakLine","_breakLineCode","indent","withNewLine","deindent","newline","generateLinkedNode","generateNode","generateMessageNode","needIndent","generatePluralNode","generateResource","generate","helpers","baseCompile","assignedOptions","jit","enalbeMinify","enambeOptimize","initFeatureFlags","pathStateMachine","literalValueRE","isLiteral","exp","stripQuotes","getPathCharType","formatSubPath","trimmed","subPathDepth","newChar","typeMap","maybeUnescapeQuote","nextChar","resolveWithKeyValue","resolveValue","hit","DEFAULT_MODIFIER","DEFAULT_MESSAGE","DEFAULT_MESSAGE_DATA_TYPE","DEFAULT_NORMALIZE","DEFAULT_INTERPOLATE","pluralDefault","choice","choicesLength","getPluralIndex","normalizeNamed","pluralIndex","createMessageContext","pluralRule","orgPluralRule","_list","_named","_modifier","interpolate","arg1","arg2","modifier","setDevToolsHook","initI18nDevTools","i18n","meta","translateDevTools","createDevToolsHook","payloads","CoreWarnCodes","fallbackWithSimple","fallbackWithLocaleChain","startLocale","DEFAULT_LOCALE","chain","appendBlockToChain","defaults","blocks","follow","appendLocaleToChain","tokens","appendItemToChain","VERSION","NOT_REOSLVED","MISSING_RESOLVE_VALUE","getDefaultLinkedModifiers","_compiler","registerMessageCompiler","compiler","_resolver","registerMessageResolver","resolver","_fallbacker","registerLocaleFallbacker","fallbacker","_additionalMeta","setAdditionalMeta","getAdditionalMeta","_fallbackContext","setFallbackContext","getFallbackContext","_cid","createCoreContext","onWarn","fallbackLocale","datetimeFormats","numberFormats","pluralRules","missing","missingWarn","fallbackWarn","fallbackFormat","unresolving","postTranslation","warnHtmlMessage","escapeParameter","messageCompiler","messageResolver","localeFallbacker","fallbackContext","__datetimeFormatters","__numberFormatters","__meta","handleMissing","updateFallbackLocale","formatParts","formatMessageParts","_static","acm","formatMessagePart","linkedKey","linkedModifier","inc","CoreErrorCodes","createCoreError","defaultOnCacheKey","compileCache","isMessageAST","detectError","baseCompile$1","compileToFunction","cacheKey","NOOP_MESSAGE_FUNCTION","isMessageFunction","translate","parseTranslateArgs","resolvedMessage","defaultMsgOrKey","enableDefaultMsg","escapeParams","formatScope","targetLocale","resolveMessageFormat","cacheBaseKey","occurred","compileMessageFormat","ctxOptions","getMessageContextOptions","msgContext","messaged","evaluateMessage","locales","missingRet","getCompileContext","msgCtx","arg3","datetime","overrides","parseDateTimeArgs","datetimeFormat","formatter","DATETIME_FORMAT_OPTIONS_KEYS","arg4","dateTime","clearDateTimeFormat","parseNumberArgs","numberFormat","NUMBER_FORMAT_OPTIONS_KEYS","clearNumberFormat","code$1","inc$1","I18nErrorCodes","createI18nError","TranslateVNodeSymbol","DatetimePartsSymbol","NumberPartsSymbol","SetPluralRulesSymbol","InejctWithOptionSymbol","DisposeSymbol","handleFlatJson","subKeys","lastIndex","currentObj","hasStringValue","getLocaleMessages","__i18n","flatJson","deepCopy","isNotObjectOrIsArray","des","getComponentOptions","adjustI18nResources","componentOptions","createTextNode","DEVTOOLS_META","composerID","defineCoreMissingHandler","getMetaInfo","createComposer","VueI18nLegacy","__root","__injectWithOption","_isGlobal","_inheritLocale","_locale","_fallbackLocale","_messages","_datetimeFormats","_numberFormats","_missingWarn","_fallbackWarn","_fallbackRoot","_fallbackFormat","_missing","_runtimeMissing","_postTranslation","_warnHtmlMessage","_escapeParameter","_modifiers","_pluralRules","trackReactivityValues","getPostTranslationHandler","setPostTranslationHandler","getMissingHandler","setMissingHandler","wrapWithDeps","argumentParser","warnType","fallbackSuccess","fallbackFail","successCondition","rt","translateVNode","numberParts","datetimeParts","setPluralRules","rules","te","getLocaleMessage","resolveMessages","targetLocaleMessages","messageValue","setLocaleMessage","mergeLocaleMessage","getDateTimeFormat","setDateTimeFormat","mergeDateTimeFormat","getNumberFormat","setNumberFormat","mergeNumberFormat","composer","convertComposerOptions","fallbackRoot","pluralizationRules","inheritLocale","sharedMessages","createVueI18n","__extender","vueI18n","baseFormatProps","getInterpolateArg","getFragmentableTag","TranslationImpl","useI18n","assignedAttrs","Translation","renderFormatter","slotKeys","partFormatter","NumberFormatImpl","NumberFormat","DatetimeFormatImpl","DatetimeFormat","getComposer$2","i18nInternal","vTDirective","_process","parsedValue","parseValue","makeParams","textContent","apply","pluginOptions","useI18nComponentName","defineMixin","vuei18n","optionsI18n","mergeToGlobal","_vueI18n","I18nInjectionKey","createI18n","__legacyMode","__globalInjection","__allowComposition","__instances","globalScope","__global","createGlobal","symbol","__getInstance","__setInstance","__deleteInstance","opts","globalReleaseHandler","injectGlobalFields","unmountApp","getI18nInstance","getGlobalComposer","getScope","useI18nForLegacy","getComposer","composerOptions","setupLifeCycle","legacyMode","useComponent","getParentComponentInstance","_composer","isLocalScope","warpWithDeps","globalExportProps","globalExportMethods","getMedia","App","I18n"],"sources":["../../src/assets/flags/de.png?url","../../src/assets/flags/en.png?url","../../src/assets/icons/chevron-right.svg?url","../../src/assets/icons/close.svg?url","../../src/assets/icons/fullscreenClose.png?url","../../src/assets/icons/fullscreenOpen.png?url","../../src/assets/icons/help-circle-outline.svg?url","../../src/assets/icons/home.svg?url","../../src/assets/icons/ic_cross.svg?url","../../src/assets/icons/ic_fire.svg?url","../../src/assets/icons/ic_fire_blue.svg?url","../../src/assets/icons/ic_pipe.svg?url","../../src/assets/icons/ic_pipe_blue.svg?url","../../src/assets/icons/ic_water.svg?url","../../src/assets/icons/ic_water_blue.svg?url","../../src/assets/icons/tooltip_ic_openInfo.png?url","../../src/assets/icons/translate.svg?url","../../src/assets/json/products_testing.json?url","../../src/assets/json/storeLinks.json?url","../../src/assets/json/translations_testing.json?url","../../src/assets/logos/Aliaxis_logo.png?url","../../src/assets/logos/aliaxis_logo-white.svg?url","../../src/assets/logos/favicon.png?url","../../src/assets/meshes/ALX_20230922_AliaxisWorld_V37-abnahme.glb?url","../../src/assets/meshes/ALX_20230927_AliaxisWorld_V38-abnahme.glb?url","../../src/assets/textures/aliaxis_env_3.env?url","../../src/assets/textures/btn_pin.png?url","../../src/assets/textures/clouds1.png?url","../../src/assets/textures/clouds2.png?url","../../src/assets/textures/clouds3.png?url","../../src/assets/textures/lightmaps/Aliaxis_Haus_3_Reversed.jpg?url","../../src/assets/textures/lightmaps/graben_abwasser.jpg?url","../../src/assets/textures/lightmaps/graben_gas.jpg?url","../../src/assets/textures/lightmaps/graben_gas_abwasser.jpg?url","../../src/assets/textures/lightmaps/graben_ohne.jpg?url","../../src/assets/textures/lightmaps/graben_wasser.jpg?url","../../src/assets/textures/lightmaps/graben_wasser_abwasser.jpg?url","../../src/assets/textures/lightmaps/graben_wasser_gas.jpg?url","../../src/assets/textures/lightmaps/haus_1_ohne.jpg?url","../../src/assets/textures/lightmaps/haus_3_ohne.jpg?url","../../src/assets/tutorial/aliaxis_overview.png?url","../../src/assets/tutorial/tutorial.json?url","../../src/assets/tutorial/tutorial_catergories_toggle.mp4?url","../../src/assets/tutorial/tutorial_hover.mp4?url","../../node_modules/@vue/shared/dist/shared.esm-bundler.js","../../node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js","../../node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js","../../node_modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js","../../node_modules/@vue/devtools-api/lib/esm/env.js","../../node_modules/@vue/devtools-api/lib/esm/const.js","../../node_modules/@vue/devtools-api/lib/esm/time.js","../../node_modules/@vue/devtools-api/lib/esm/proxy.js","../../node_modules/@vue/devtools-api/lib/esm/index.js","../../node_modules/vuex/dist/vuex.esm-bundler.js","../../src/components/ui/Loadingscreen.vue","../../node_modules/@babylonjs/core/Maths/math.scalar.js","../../node_modules/@babylonjs/core/Maths/math.constants.js","../../node_modules/@babylonjs/core/Misc/arrayTools.js","../../node_modules/@babylonjs/core/Misc/typeStore.js","../../node_modules/@babylonjs/core/Engines/performanceConfigurator.js","../../node_modules/@babylonjs/core/Misc/observable.js","../../node_modules/@babylonjs/core/Engines/engineStore.js","../../node_modules/@babylonjs/core/Maths/math.vector.js","../../node_modules/@babylonjs/core/Maths/math.color.js","../../node_modules/@babylonjs/core/Misc/andOrNotEvaluator.js","../../node_modules/@babylonjs/core/Misc/tags.js","../../node_modules/@babylonjs/core/Misc/devTools.js","../../node_modules/@babylonjs/core/Misc/decorators.js","../../node_modules/@babylonjs/core/Animations/animationKey.js","../../node_modules/@babylonjs/core/Animations/animationRange.js","../../node_modules/@babylonjs/core/tslib.es6.js","../../node_modules/@babylonjs/core/node.js","../../node_modules/@babylonjs/core/Maths/math.size.js","../../node_modules/@babylonjs/core/Misc/webRequest.js","../../node_modules/@babylonjs/core/Animations/animation.js","../../node_modules/@babylonjs/core/Maths/math.path.js","../../node_modules/@babylonjs/core/Animations/easing.js","../../src/components/ui/NavigationTopLeft.vue","../../src/components/ui/NavigationBottomRight.vue","../../src/components/ui/ProductInfos.vue","../../src/components/ui/Tooltip.vue","../../src/components/ui/Tutorial.vue","../../node_modules/@babylonjs/core/Materials/Textures/textureSampler.js","../../node_modules/@babylonjs/core/Materials/Textures/internalTexture.js","../../node_modules/@babylonjs/core/Misc/domManagement.js","../../node_modules/@babylonjs/core/Misc/logger.js","../../node_modules/@babylonjs/core/Engines/Processors/shaderCodeNode.js","../../node_modules/@babylonjs/core/Engines/Processors/shaderCodeCursor.js","../../node_modules/@babylonjs/core/Engines/Processors/shaderCodeConditionNode.js","../../node_modules/@babylonjs/core/Engines/Processors/shaderCodeTestNode.js","../../node_modules/@babylonjs/core/Engines/Processors/Expressions/shaderDefineExpression.js","../../node_modules/@babylonjs/core/Engines/Processors/Expressions/Operators/shaderDefineIsDefinedOperator.js","../../node_modules/@babylonjs/core/Engines/Processors/Expressions/Operators/shaderDefineOrOperator.js","../../node_modules/@babylonjs/core/Engines/Processors/Expressions/Operators/shaderDefineAndOperator.js","../../node_modules/@babylonjs/core/Engines/Processors/Expressions/Operators/shaderDefineArithmeticOperator.js","../../node_modules/@babylonjs/core/Materials/shaderLanguage.js","../../node_modules/@babylonjs/core/Engines/Processors/shaderProcessor.js","../../node_modules/@babylonjs/core/Engines/shaderStore.js","../../node_modules/@babylonjs/core/Materials/effect.js","../../node_modules/@babylonjs/core/States/depthCullingState.js","../../node_modules/@babylonjs/core/States/stencilState.js","../../node_modules/@babylonjs/core/States/alphaCullingState.js","../../node_modules/@babylonjs/core/Engines/WebGL/webGLShaderProcessors.js","../../node_modules/@babylonjs/core/Engines/WebGL/webGL2ShaderProcessors.js","../../node_modules/@babylonjs/core/Buffers/dataBuffer.js","../../node_modules/@babylonjs/core/Meshes/WebGL/webGLDataBuffer.js","../../node_modules/@babylonjs/core/Engines/WebGL/webGLPipelineContext.js","../../node_modules/@babylonjs/core/Engines/WebGL/webGLHardwareTexture.js","../../node_modules/@babylonjs/core/Materials/drawWrapper.js","../../node_modules/@babylonjs/core/States/stencilStateComposer.js","../../node_modules/@babylonjs/core/Misc/precisionDate.js","../../node_modules/@babylonjs/core/Engines/thinEngine.js","../../node_modules/@babylonjs/core/Misc/performanceMonitor.js","../../node_modules/@babylonjs/core/Misc/perfCounter.js","../../node_modules/@babylonjs/core/Engines/Extensions/engine.alpha.js","../../node_modules/@babylonjs/core/Engines/Extensions/engine.readTexture.js","../../node_modules/@babylonjs/core/Engines/Extensions/engine.dynamicBuffer.js","../../node_modules/@babylonjs/core/Engines/engine.js","../../node_modules/@babylonjs/core/Misc/deepCopier.js","../../node_modules/@babylonjs/core/Misc/filesInputStore.js","../../node_modules/@babylonjs/core/Misc/retryStrategy.js","../../node_modules/@babylonjs/core/Misc/error.js","../../node_modules/@babylonjs/core/Misc/stringTools.js","../../node_modules/@babylonjs/core/Misc/timingTools.js","../../node_modules/@babylonjs/core/Misc/fileTools.js","../../node_modules/@babylonjs/core/Misc/instantiationTools.js","../../node_modules/@babylonjs/core/Misc/guid.js","../../node_modules/@babylonjs/core/Misc/tools.js","../../node_modules/@babylonjs/core/Misc/smartArray.js","../../node_modules/@babylonjs/core/Misc/stringDictionary.js","../../node_modules/@babylonjs/core/abstractScene.js","../../node_modules/@babylonjs/core/Materials/materialDefines.js","../../node_modules/@babylonjs/core/Materials/colorCurves.js","../../node_modules/@babylonjs/core/Materials/imageProcessingConfiguration.js","../../node_modules/@babylonjs/core/Engines/Extensions/engine.uniformBuffer.js","../../node_modules/@babylonjs/core/Materials/uniformBuffer.js","../../node_modules/@babylonjs/core/Buffers/buffer.js","../../node_modules/@babylonjs/core/Collisions/pickingInfo.js","../../node_modules/@babylonjs/core/Actions/actionEvent.js","../../node_modules/@babylonjs/core/PostProcesses/postProcessManager.js","../../node_modules/@babylonjs/core/Rendering/renderingGroup.js","../../node_modules/@babylonjs/core/Rendering/renderingManager.js","../../node_modules/@babylonjs/core/sceneComponent.js","../../node_modules/@babylonjs/core/Events/pointerEvents.js","../../node_modules/@babylonjs/core/Actions/abstractActionManager.js","../../node_modules/@babylonjs/core/Events/keyboardEvents.js","../../node_modules/@babylonjs/core/DeviceInput/InputDevices/deviceEnums.js","../../node_modules/@babylonjs/core/Events/deviceInputEvents.js","../../node_modules/@babylonjs/core/DeviceInput/eventFactory.js","../../node_modules/@babylonjs/core/DeviceInput/nativeDeviceInputSystem.js","../../node_modules/@babylonjs/core/DeviceInput/webDeviceInputSystem.js","../../node_modules/@babylonjs/core/DeviceInput/InputDevices/deviceSource.js","../../node_modules/@babylonjs/core/DeviceInput/internalDeviceSourceManager.js","../../node_modules/@babylonjs/core/DeviceInput/InputDevices/deviceSourceManager.js","../../node_modules/@babylonjs/core/Inputs/scene.inputManager.js","../../node_modules/@babylonjs/core/Maths/math.plane.js","../../node_modules/@babylonjs/core/Maths/math.frustum.js","../../node_modules/@babylonjs/core/Misc/uniqueIdGenerator.js","../../node_modules/@babylonjs/core/Lights/lightConstants.js","../../node_modules/@babylonjs/core/Inputs/pointerPickingConfiguration.js","../../node_modules/@babylonjs/core/scene.js","../../node_modules/@babylonjs/core/Maths/math.axis.js","../../node_modules/@babylonjs/core/Maths/math.viewport.js","../../node_modules/@babylonjs/core/Misc/coroutine.js","../../node_modules/@babylonjs/core/Cameras/camera.js","../../node_modules/@babylonjs/core/Collisions/intersectionInfo.js","../../node_modules/@babylonjs/core/Culling/boundingBox.js","../../node_modules/@babylonjs/core/Culling/boundingSphere.js","../../node_modules/@babylonjs/core/Culling/boundingInfo.js","../../node_modules/@babylonjs/core/Maths/math.functions.js","../../node_modules/@babylonjs/core/Meshes/subMesh.js","../../node_modules/@babylonjs/core/Meshes/mesh.vertexData.js","../../node_modules/@babylonjs/core/Loading/sceneLoaderFlags.js","../../node_modules/@babylonjs/core/Compat/compatibilityOptions.js","../../node_modules/@babylonjs/core/Meshes/geometry.js","../../node_modules/@babylonjs/core/Meshes/transformNode.js","../../node_modules/@babylonjs/core/Collisions/meshCollisionData.js","../../node_modules/@babylonjs/core/Meshes/abstractMesh.js","../../node_modules/@babylonjs/core/Materials/clipPlaneMaterialHelper.js","../../node_modules/@babylonjs/core/Materials/materialHelper.js","../../node_modules/@babylonjs/core/Materials/materialStencilState.js","../../node_modules/@babylonjs/core/Materials/materialPluginEvent.js","../../node_modules/@babylonjs/core/Materials/material.js","../../node_modules/@babylonjs/core/Materials/multiMaterial.js","../../node_modules/@babylonjs/core/Meshes/meshLODLevel.js","../../node_modules/@babylonjs/core/Meshes/mesh.js","../../node_modules/@babylonjs/core/Behaviors/Cameras/autoRotationBehavior.js","../../node_modules/@babylonjs/core/Behaviors/Cameras/bouncingBehavior.js","../../node_modules/@babylonjs/core/Behaviors/Cameras/framingBehavior.js","../../node_modules/@babylonjs/core/Cameras/targetCamera.js","../../node_modules/@babylonjs/core/Cameras/cameraInputsManager.js","../../node_modules/@babylonjs/core/Cameras/Inputs/BaseCameraPointersInput.js","../../node_modules/@babylonjs/core/Cameras/Inputs/arcRotateCameraPointersInput.js","../../node_modules/@babylonjs/core/Cameras/Inputs/arcRotateCameraKeyboardMoveInput.js","../../node_modules/@babylonjs/core/Cameras/Inputs/arcRotateCameraMouseWheelInput.js","../../node_modules/@babylonjs/core/Cameras/arcRotateCameraInputsManager.js","../../node_modules/@babylonjs/core/Cameras/arcRotateCamera.js","../../node_modules/@babylonjs/core/Materials/Textures/thinTexture.js","../../node_modules/@babylonjs/core/Materials/Textures/baseTexture.js","../../node_modules/@babylonjs/core/Misc/copyTools.js","../../node_modules/@babylonjs/core/Materials/Textures/texture.js","../../node_modules/@babylonjs/core/Engines/renderTargetWrapper.js","../../node_modules/@babylonjs/core/Engines/WebGL/webGLRenderTargetWrapper.js","../../node_modules/@babylonjs/core/Engines/Extensions/engine.renderTarget.js","../../node_modules/@babylonjs/core/Engines/Extensions/engine.renderTargetCube.js","../../node_modules/@babylonjs/core/Shaders/postprocess.vertex.js","../../node_modules/@babylonjs/core/Materials/effectRenderer.js","../../node_modules/@babylonjs/core/Shaders/pass.fragment.js","../../node_modules/@babylonjs/core/Misc/dumpTools.js","../../node_modules/@babylonjs/core/Materials/Textures/renderTargetTexture.js","../../node_modules/@babylonjs/core/PostProcesses/postProcess.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/kernelBlurVaryingDeclaration.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/packingFunctions.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/kernelBlurFragment.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/kernelBlurFragment2.js","../../node_modules/@babylonjs/core/Shaders/kernelBlur.fragment.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/kernelBlurVertex.js","../../node_modules/@babylonjs/core/Shaders/kernelBlur.vertex.js","../../node_modules/@babylonjs/core/PostProcesses/blurPostProcess.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/helperFunctions.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/clipPlaneFragmentDeclaration.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/clipPlaneFragment.js","../../node_modules/@babylonjs/core/Shaders/glowMapGeneration.fragment.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/bonesDeclaration.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/bakedVertexAnimationDeclaration.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/morphTargetsVertexGlobalDeclaration.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/morphTargetsVertexDeclaration.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/clipPlaneVertexDeclaration.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/instancesDeclaration.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/morphTargetsVertexGlobal.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/morphTargetsVertex.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/instancesVertex.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/bonesVertex.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/bakedVertexAnimation.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/clipPlaneVertex.js","../../node_modules/@babylonjs/core/Shaders/glowMapGeneration.vertex.js","../../node_modules/@babylonjs/core/Materials/effectFallbacks.js","../../node_modules/@babylonjs/core/Layers/effectLayer.js","../../node_modules/@babylonjs/core/Shaders/glowMapMerge.fragment.js","../../node_modules/@babylonjs/core/Shaders/glowMapMerge.vertex.js","../../node_modules/@babylonjs/core/Layers/effectLayerSceneComponent.js","../../node_modules/@babylonjs/core/Layers/glowLayer.js","../../node_modules/@babylonjs/core/Shaders/sharpen.fragment.js","../../node_modules/@babylonjs/core/PostProcesses/sharpenPostProcess.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/imageProcessingDeclaration.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/imageProcessingFunctions.js","../../node_modules/@babylonjs/core/Shaders/imageProcessing.fragment.js","../../node_modules/@babylonjs/core/PostProcesses/imageProcessingPostProcess.js","../../node_modules/@babylonjs/core/Shaders/chromaticAberration.fragment.js","../../node_modules/@babylonjs/core/PostProcesses/chromaticAberrationPostProcess.js","../../node_modules/@babylonjs/core/Shaders/grain.fragment.js","../../node_modules/@babylonjs/core/PostProcesses/grainPostProcess.js","../../node_modules/@babylonjs/core/Shaders/fxaa.fragment.js","../../node_modules/@babylonjs/core/Shaders/fxaa.vertex.js","../../node_modules/@babylonjs/core/PostProcesses/fxaaPostProcess.js","../../node_modules/@babylonjs/core/PostProcesses/RenderPipeline/postProcessRenderPipeline.js","../../node_modules/@babylonjs/core/PostProcesses/RenderPipeline/postProcessRenderEffect.js","../../node_modules/@babylonjs/core/Shaders/circleOfConfusion.fragment.js","../../node_modules/@babylonjs/core/PostProcesses/circleOfConfusionPostProcess.js","../../node_modules/@babylonjs/core/PostProcesses/depthOfFieldBlurPostProcess.js","../../node_modules/@babylonjs/core/Shaders/depthOfFieldMerge.fragment.js","../../node_modules/@babylonjs/core/PostProcesses/depthOfFieldMergePostProcess.js","../../node_modules/@babylonjs/core/PostProcesses/depthOfFieldEffect.js","../../node_modules/@babylonjs/core/Shaders/extractHighlights.fragment.js","../../node_modules/@babylonjs/core/PostProcesses/extractHighlightsPostProcess.js","../../node_modules/@babylonjs/core/Shaders/bloomMerge.fragment.js","../../node_modules/@babylonjs/core/PostProcesses/bloomMergePostProcess.js","../../node_modules/@babylonjs/core/PostProcesses/bloomEffect.js","../../node_modules/@babylonjs/core/PostProcesses/RenderPipeline/postProcessRenderPipelineManager.js","../../node_modules/@babylonjs/core/PostProcesses/RenderPipeline/postProcessRenderPipelineManagerSceneComponent.js","../../node_modules/@babylonjs/core/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js","../../node_modules/@babylonjs/core/Engines/Extensions/engine.rawTexture.js","../../node_modules/@babylonjs/core/Materials/Textures/rawTexture.js","../../node_modules/@babylonjs/core/Shaders/lensHighlights.fragment.js","../../node_modules/@babylonjs/core/Shaders/depthOfField.fragment.js","../../node_modules/@babylonjs/core/Shaders/passCube.fragment.js","../../node_modules/@babylonjs/core/PostProcesses/passPostProcess.js","../../node_modules/@babylonjs/core/Rendering/ssao2Configuration.js","../../node_modules/@babylonjs/core/Shaders/ssao2.fragment.js","../../node_modules/@babylonjs/core/Shaders/ssaoCombine.fragment.js","../../node_modules/@babylonjs/core/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js","../../node_modules/@babylonjs/core/Shaders/ssao.fragment.js","../../node_modules/@babylonjs/core/PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.js","../../node_modules/@babylonjs/core/Engines/Extensions/engine.multiRender.js","../../node_modules/@babylonjs/core/Materials/Textures/multiRenderTarget.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/mrtFragmentDeclaration.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/bumpFragmentMainFunctions.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/samplerFragmentDeclaration.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/bumpFragmentFunctions.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/bumpFragment.js","../../node_modules/@babylonjs/core/Shaders/geometry.fragment.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/geometryVertexDeclaration.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/sceneUboDeclaration.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/geometryUboDeclaration.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/bumpVertex.js","../../node_modules/@babylonjs/core/Shaders/geometry.vertex.js","../../node_modules/@babylonjs/core/Materials/materialFlags.js","../../node_modules/@babylonjs/core/Rendering/geometryBufferRenderer.js","../../node_modules/@babylonjs/core/Rendering/motionBlurConfiguration.js","../../node_modules/@babylonjs/core/Animations/runtimeAnimation.js","../../node_modules/@babylonjs/core/Bones/bone.js","../../node_modules/@babylonjs/core/Animations/animatable.js","../../node_modules/@babylonjs/core/Rendering/geometryBufferRendererSceneComponent.js","../../node_modules/@babylonjs/core/Shaders/motionBlur.fragment.js","../../node_modules/@babylonjs/core/PostProcesses/motionBlurPostProcess.js","../../node_modules/@babylonjs/core/Rendering/screenSpaceReflectionsConfiguration.js","../../node_modules/@babylonjs/core/Shaders/screenSpaceReflection.fragment.js","../../node_modules/@babylonjs/core/PostProcesses/screenSpaceReflectionPostProcess.js","../../node_modules/@babylonjs/core/Shaders/standard.fragment.js","../../node_modules/@babylonjs/core/PostProcesses/RenderPipeline/Pipelines/standardRenderingPipeline.js","../../node_modules/@babylonjs/core/Rendering/screenSpaceReflections2Configuration.js","../../node_modules/@babylonjs/core/Shaders/depth.fragment.js","../../node_modules/@babylonjs/core/Shaders/depth.vertex.js","../../node_modules/@babylonjs/core/Rendering/depthRenderer.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBRDFFunctions.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/screenSpaceRayTrace.js","../../node_modules/@babylonjs/core/Shaders/screenSpaceReflection2.fragment.js","../../node_modules/@babylonjs/core/Shaders/screenSpaceReflection2Blur.fragment.js","../../node_modules/@babylonjs/core/Shaders/screenSpaceReflection2BlurCombiner.fragment.js","../../node_modules/@babylonjs/core/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.js","../../node_modules/@babylonjs/core/Loading/sceneLoader.js","../../node_modules/@babylonjs/core/Engines/Extensions/engine.cubeTexture.js","../../node_modules/@babylonjs/core/Materials/Textures/cubeTexture.js","../../node_modules/@babylonjs/core/Misc/HighDynamicRange/panoramaToCubemap.js","../../node_modules/@babylonjs/core/Misc/HighDynamicRange/hdr.js","../../node_modules/@babylonjs/core/Maths/sphericalPolynomial.js","../../node_modules/@babylonjs/core/Misc/HighDynamicRange/cubemapToSphericalPolynomial.js","../../node_modules/@babylonjs/core/Shaders/hdrFiltering.vertex.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/importanceSampling.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/hdrFilteringFunctions.js","../../node_modules/@babylonjs/core/Shaders/hdrFiltering.fragment.js","../../node_modules/@babylonjs/core/Materials/Textures/Filtering/hdrFiltering.js","../../node_modules/@babylonjs/core/Misc/textureTools.js","../../node_modules/@babylonjs/core/Materials/Textures/baseTexture.polynomial.js","../../node_modules/@babylonjs/core/Materials/Textures/hdrCubeTexture.js","../../node_modules/@babylonjs/core/Materials/Textures/equiRectangularCubeTexture.js","../../node_modules/@babylonjs/core/Misc/assetsManager.js","../../src/components/babylonjs/Renderer.vue","../../node_modules/@babylonjs/core/Materials/prePassConfiguration.js","../../node_modules/@babylonjs/core/Materials/pushMaterial.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/decalFragmentDeclaration.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/defaultFragmentDeclaration.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/meshUboDeclaration.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/defaultUboDeclaration.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/prePassDeclaration.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/oitDeclaration.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/mainUVVaryingDeclaration.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/lightFragmentDeclaration.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/lightUboDeclaration.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/lightsFragmentFunctions.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/shadowsFragmentFunctions.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/fresnelFunction.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/reflectionFunction.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/logDepthDeclaration.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/fogFragmentDeclaration.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/decalFragment.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/depthPrePass.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/lightFragment.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/logDepthFragment.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/fogFragment.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/oitFragment.js","../../node_modules/@babylonjs/core/Shaders/default.fragment.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/decalVertexDeclaration.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/defaultVertexDeclaration.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/uvAttributeDeclaration.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/prePassVertexDeclaration.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/samplerVertexDeclaration.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/bumpVertexDeclaration.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/fogVertexDeclaration.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/lightVxFragmentDeclaration.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/lightVxUboDeclaration.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/prePassVertex.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/uvVariableDeclaration.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/samplerVertexImplementation.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/fogVertex.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/shadowsVertex.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/vertexColorMixing.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/pointCloudVertex.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/logDepthVertex.js","../../node_modules/@babylonjs/core/Shaders/default.vertex.js","../../node_modules/@babylonjs/core/Materials/materialPluginManager.js","../../node_modules/@babylonjs/core/Materials/materialPluginBase.js","../../node_modules/@babylonjs/core/Materials/material.detailMapConfiguration.js","../../node_modules/@babylonjs/core/Materials/standardMaterial.js","../../node_modules/@babylonjs/core/Actions/action.js","../../node_modules/@babylonjs/core/Actions/condition.js","../../node_modules/@babylonjs/core/Actions/directActions.js","../../node_modules/@babylonjs/core/Actions/actionManager.js","../../node_modules/@babylonjs/core/Meshes/Builders/ribbonBuilder.js","../../node_modules/@babylonjs/core/Meshes/Builders/discBuilder.js","../../node_modules/@babylonjs/core/Meshes/groundMesh.js","../../node_modules/@babylonjs/core/Meshes/Builders/groundBuilder.js","../../node_modules/@babylonjs/core/Meshes/Builders/boxBuilder.js","../../node_modules/@babylonjs/core/Meshes/Builders/tiledPlaneBuilder.js","../../node_modules/@babylonjs/core/Meshes/Builders/tiledBoxBuilder.js","../../node_modules/@babylonjs/core/Meshes/Builders/sphereBuilder.js","../../node_modules/@babylonjs/core/Meshes/Builders/cylinderBuilder.js","../../node_modules/@babylonjs/core/Meshes/Builders/torusBuilder.js","../../node_modules/@babylonjs/core/Meshes/Builders/torusKnotBuilder.js","../../node_modules/@babylonjs/core/Meshes/instancedMesh.js","../../node_modules/@babylonjs/core/Materials/shaderMaterial.js","../../node_modules/@babylonjs/core/Shaders/color.fragment.js","../../node_modules/@babylonjs/core/Shaders/color.vertex.js","../../node_modules/@babylonjs/core/Meshes/linesMesh.js","../../node_modules/@babylonjs/core/Meshes/Builders/linesBuilder.js","../../node_modules/@babylonjs/core/Meshes/polygonMesh.js","../../node_modules/@babylonjs/core/Meshes/Builders/polygonBuilder.js","../../node_modules/@babylonjs/core/Meshes/Builders/shapeBuilder.js","../../node_modules/@babylonjs/core/Meshes/Builders/latheBuilder.js","../../node_modules/@babylonjs/core/Meshes/Builders/planeBuilder.js","../../node_modules/@babylonjs/core/Meshes/Builders/tubeBuilder.js","../../node_modules/@babylonjs/core/Meshes/Builders/polyhedronBuilder.js","../../node_modules/@babylonjs/core/Meshes/Builders/icoSphereBuilder.js","../../node_modules/@babylonjs/core/Meshes/Builders/decalBuilder.js","../../node_modules/@babylonjs/core/Meshes/Builders/capsuleBuilder.js","../../node_modules/@babylonjs/core/Maths/math.isovector.js","../../node_modules/@babylonjs/core/Meshes/geodesicMesh.js","../../node_modules/@babylonjs/core/Meshes/Builders/geodesicBuilder.js","../../node_modules/@babylonjs/core/Meshes/goldbergMesh.js","../../node_modules/@babylonjs/core/Meshes/Builders/goldbergBuilder.js","../../node_modules/@babylonjs/core/Meshes/Builders/textBuilder.js","../../node_modules/@babylonjs/core/Meshes/meshBuilder.js","../../node_modules/@babylonjs/core/Culling/ray.js","../../src/components/babylonjs/Pin.vue","../../node_modules/@babylonjs/core/Shaders/rgbdDecode.fragment.js","../../node_modules/@babylonjs/core/Misc/rgbdTextureTools.js","../../node_modules/@babylonjs/core/Shaders/rgbdEncode.fragment.js","../../node_modules/@babylonjs/core/Misc/environmentTextureTools.js","../../node_modules/@babylonjs/core/Materials/Textures/Loaders/envTextureLoader.js","../../node_modules/@babylonjs/core/Lights/light.js","../../node_modules/@babylonjs/core/assetContainer.js","../../node_modules/@babylonjs/core/Misc/dataReader.js","../../node_modules/@babylonjs/loaders/glTF/glTFValidation.js","../../node_modules/@babylonjs/loaders/glTF/glTFFileLoader.js","../../node_modules/@babylonjs/loaders/glTF/1.0/glTFLoaderInterfaces.js","../../node_modules/@babylonjs/core/Cameras/Inputs/freeCameraKeyboardMoveInput.js","../../node_modules/@babylonjs/core/Cameras/Inputs/freeCameraMouseInput.js","../../node_modules/@babylonjs/core/Cameras/Inputs/BaseCameraMouseWheelInput.js","../../node_modules/@babylonjs/core/Cameras/Inputs/freeCameraMouseWheelInput.js","../../node_modules/@babylonjs/core/Cameras/Inputs/freeCameraTouchInput.js","../../node_modules/@babylonjs/core/Cameras/freeCameraInputsManager.js","../../node_modules/@babylonjs/core/Cameras/freeCamera.js","../../node_modules/@babylonjs/core/Bones/skeleton.js","../../node_modules/@babylonjs/core/Lights/hemisphericLight.js","../../node_modules/@babylonjs/core/Lights/shadowLight.js","../../node_modules/@babylonjs/core/Lights/directionalLight.js","../../node_modules/@babylonjs/core/Lights/pointLight.js","../../node_modules/@babylonjs/core/Lights/spotLight.js","../../node_modules/@babylonjs/loaders/glTF/1.0/glTFLoaderUtils.js","../../node_modules/@babylonjs/core/Engines/constants.js","../../node_modules/@babylonjs/loaders/glTF/1.0/glTFLoader.js","../../node_modules/@babylonjs/loaders/glTF/1.0/glTFBinaryExtension.js","../../node_modules/@babylonjs/loaders/glTF/1.0/glTFMaterialsCommonExtension.js","../../node_modules/@babylonjs/core/Misc/deferred.js","../../node_modules/@babylonjs/core/Animations/animationGroup.js","../../node_modules/@babylonjs/core/Misc/brdfTextureTools.js","../../node_modules/@babylonjs/core/Materials/PBR/pbrBRDFConfiguration.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrFragmentDeclaration.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrUboDeclaration.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrFragmentExtraDeclaration.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/samplerFragmentAlternateDeclaration.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrFragmentSamplersDeclaration.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/subSurfaceScatteringFunctions.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrHelperFunctions.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/harmonicsFunctions.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrDirectLightingSetupFunctions.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrDirectLightingFalloffFunctions.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrDirectLightingFunctions.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrIBLFunctions.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockAlbedoOpacity.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockReflectivity.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockAmbientOcclusion.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockAlphaFresnel.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockAnisotropic.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockReflection.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockSheen.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockClearcoat.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockIridescence.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockSubSurface.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockNormalGeometric.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockNormalFinal.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockLightmapInit.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockGeometryInfo.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockReflectance0.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockReflectance.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockDirectLighting.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockFinalLitComponents.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockFinalUnlitComponents.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockFinalColorComposition.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrBlockImageProcessing.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrDebug.js","../../node_modules/@babylonjs/core/Shaders/pbr.fragment.js","../../node_modules/@babylonjs/core/Shaders/ShadersInclude/pbrVertexDeclaration.js","../../node_modules/@babylonjs/core/Shaders/pbr.vertex.js","../../node_modules/@babylonjs/core/Materials/PBR/pbrClearCoatConfiguration.js","../../node_modules/@babylonjs/core/Materials/PBR/pbrIridescenceConfiguration.js","../../node_modules/@babylonjs/core/Materials/PBR/pbrAnisotropicConfiguration.js","../../node_modules/@babylonjs/core/Materials/PBR/pbrSheenConfiguration.js","../../node_modules/@babylonjs/core/Materials/PBR/pbrSubSurfaceConfiguration.js","../../node_modules/@babylonjs/core/Materials/PBR/pbrBaseMaterial.js","../../node_modules/@babylonjs/core/Materials/PBR/pbrMaterial.js","../../node_modules/@babylonjs/core/Morph/morphTarget.js","../../node_modules/@babylonjs/core/Materials/Textures/rawTexture2DArray.js","../../node_modules/@babylonjs/core/Morph/morphTargetManager.js","../../node_modules/@babylonjs/loaders/glTF/2.0/glTFLoaderAnimation.js","../../node_modules/@babylonjs/loaders/glTF/2.0/glTFLoader.js","../../node_modules/@babylonjs/core/Materials/Textures/rawCubeTexture.js","../../node_modules/@babylonjs/loaders/glTF/2.0/Extensions/EXT_lights_image_based.js","../../node_modules/@babylonjs/core/Meshes/thinInstanceMesh.js","../../node_modules/@babylonjs/loaders/glTF/2.0/Extensions/EXT_mesh_gpu_instancing.js","../../node_modules/@babylonjs/core/Meshes/Compression/meshoptCompression.js","../../node_modules/@babylonjs/loaders/glTF/2.0/Extensions/EXT_meshopt_compression.js","../../node_modules/@babylonjs/loaders/glTF/2.0/Extensions/EXT_texture_webp.js","../../node_modules/@babylonjs/core/Misc/workerPool.js","../../node_modules/@babylonjs/core/Meshes/Compression/dracoCompression.js","../../node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_draco_mesh_compression.js","../../node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_lights_punctual.js","../../node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness.js","../../node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_unlit.js","../../node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_clearcoat.js","../../node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_iridescence.js","../../node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_anisotropy.js","../../node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_emissive_strength.js","../../node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_sheen.js","../../node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_specular.js","../../node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_ior.js","../../node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_variants.js","../../node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_transmission.js","../../node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_translucency.js","../../node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_volume.js","../../node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_mesh_quantization.js","../../node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_texture_basisu.js","../../node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_texture_transform.js","../../node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_xmp_json_ld.js","../../node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_animation_pointer.data.js","../../node_modules/@babylonjs/loaders/glTF/2.0/Extensions/KHR_animation_pointer.js","../../node_modules/@babylonjs/core/Animations/animationEvent.js","../../node_modules/@babylonjs/core/Audio/sound.js","../../node_modules/@babylonjs/core/Audio/weightedsound.js","../../node_modules/@babylonjs/loaders/glTF/2.0/Extensions/MSFT_audio_emitter.js","../../node_modules/@babylonjs/loaders/glTF/2.0/Extensions/MSFT_lod.js","../../node_modules/@babylonjs/loaders/glTF/2.0/Extensions/MSFT_minecraftMesh.js","../../node_modules/@babylonjs/loaders/glTF/2.0/Extensions/MSFT_sRGBFactors.js","../../node_modules/@babylonjs/loaders/glTF/2.0/Extensions/ExtrasAsMetadata.js","../../src/components/babylonjs/Aliaxis.vue","../../src/App.vue","../../src/Store.js","../../node_modules/@intlify/shared/dist/shared.mjs","../../node_modules/@intlify/message-compiler/dist/message-compiler.esm-browser.js","../../node_modules/@intlify/core-base/dist/core-base.mjs","../../node_modules/vue-i18n/dist/vue-i18n.mjs","../../src/I18n.js","../../src/main.js"],"sourcesContent":["export default \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAA7AAAAOwBeShxvQAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAJXSURBVFiFxZfNThNRFMd/57alBUYg0ShGjMYKFolh4bemhhgVF7yCb2Bi5An8wMSVJBp9AR/BDRZElIRE0QRJiAsSvysh0UVJW8qUznFBS7A2MJVO55+czZyb8/vfezPnzAjutQO4CsSB08BeYGcx9xv4CbwBJoERIF1F7U11GHgCLAHqMlLAYyC6HXAjcBfIVQEuj2XgTrFWVeoAprcBLo8Z4IBbeC+wWEN4KRaAY252/t0DeCmSm51EGJj1EL7xOhoqGRiqA7wUt8rhhwC7jgZs4CCAKRoYBEKVjsUjhYpMgnP0WFOkujM473No8wpq5dEmG7UKaMW7qlYBxG5A0iEkG0bSESTTjOk5R6slH4kNCPqsFqBqZXAGjMG54gccwMFcNoqc8MsAcNIA7T4aaDfAbh8N7DFbr/FUalgbPH5p0X8Dgr7z0cC0cTAJv+gGZzToEJhoiQfHjWVaJSLNEhJLwtIkDVgSkJq0Yi2orTZpXdGs5jWtOc04aSe1NLn6SgB0/tIjlOu1gLmXPJSu0Rtrr6EyDOTrSLcpBIahOI6la+wTyP264UXuSffIl3UDAOTbhlj7JPNaM9ht65uVjRmd7+tAg1PAfo/gSVad83J0/GvpwV+tWDonfuDoAN40pwWk0L8R/o8BAIm9mEWd4wg1bFD6gQBnpPPlXHmm4jCSI+NJIpkLIKVfs/9VDuU2jdmzEh37VpG1VQWdvxgFuYnKNaDFJTiF8JSCeSCxxOfNFm5pYN3IXJ9FKNgPGgc5BewDdhXTv4Ak6FuQ1yyb59KbyLip+wdqLktg14obcwAAAABJRU5ErkJggg==\"","export default \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABHN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G+f/jFzc5PqUCzrSz20D9RqO7pNS/A/idiLWKLt7XsjcABge/vIG4MDACgKxMyGZt8Un1gLWaq7vuEGRxE/U25ku3rQ6b9i1NjUG6dBptiaFIBi2Ws8SmRzgwJMCgCNZtwQsRaC2FqZVAZAFW/3hcbWi9XPDDo2hDlhZZADAEB9tgT8ZaFGK6ovlKJvz1HwV0Qg3z8U2cWGW8NIH9FTXmfnQHZtc3+KWjN+KSREiHVwVXou1L9emjAAf0kItI8aoUzOQFTyC9yeEzJqHxiWwIJgoTv/EMlJCnga7G5zf6xBFu6E1JVuOrgq/QgEq6OMwoclTFwDK0U8VKmHIG8q1dtPvOduey9DGthGAMBTbLnRgvffF5kQIUbaqhmj4HRyHM75Gp89AOSVtY0LsbnuDyREiHUeCx6Bh5OVDBjqiDKkvsXh3qLKYfjYmdPJcdjrtghZReMf5VhlFTXj25/rRofYdRjyxsu6EOHeoqv7pV6lwIiOKMDTMcLLRVi99UOX6frgewua4OFsOWEA4OVWDgBpq2ZAmLgGAKBUZEG+HaCXLn7MCejI/CGvLoBimVuPSqUKGhwcrFSl50rGwk3V2BCcegD9h06yG7bZRrluWccM+0YdTGiabn2SffyLvpxTxVaKeLJHsvCV4PpC0PLYJkimrXWOj7k70jNuL3De8Nkly6R1cw+4hTx6HfjIEOnnGx7zeLz5zvExl8de17sZSVLiHkIg9I/0sSs3N5vw+GhQFjyCaL8pVzkBPY+m6VZ9HoNnw+8+nckAWLB6399B7d2a3PIHvR6TBQssCILn2tzzFFvL9ku9SvONeA0GGNaJpHcqAHjKsiodrWlLGQAHcFwAsRf5skO9BLEWsuC4agDXon2ndrwY7M/KkAa2FU8i7L8uJVB1IgL9bwAAAABJRU5ErkJggg==\"","export default \"__VITE_ASSET__ea646552__\"","export default \"__VITE_ASSET__aaabd9ba__\"","export default \"__VITE_ASSET__4e52c1d5__\"","export default \"__VITE_ASSET__5604b489__\"","export default \"__VITE_ASSET__5076243f__\"","export default \"__VITE_ASSET__2b4d7694__\"","export default \"__VITE_ASSET__03f21bd6__\"","export default \"__VITE_ASSET__07bcf25e__\"","export default \"__VITE_ASSET__63e30d20__\"","export default \"__VITE_ASSET__dea85f13__\"","export default \"__VITE_ASSET__28fe7a2e__\"","export default \"__VITE_ASSET__19665e7b__\"","export default \"__VITE_ASSET__d59715c2__\"","export default \"data:image/png;base64,/9j/4QAYRXhpZgAASUkqAAgAAAAAAAAAAAAAAP/sABFEdWNreQABAAQAAABQAAD/4QMtaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLwA8P3hwYWNrZXQgYmVnaW49Iu+7vyIgaWQ9Ilc1TTBNcENlaGlIenJlU3pOVGN6a2M5ZCI/PiA8eDp4bXBtZXRhIHhtbG5zOng9ImFkb2JlOm5zOm1ldGEvIiB4OnhtcHRrPSJBZG9iZSBYTVAgQ29yZSA3LjAtYzAwMCA3OS5kYWJhY2JiLCAyMDIxLzA0LzE0LTAwOjM5OjQ0ICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdFJlZj0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlUmVmIyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgMjIuNCAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MzY2MkNGN0Q0QkUyMTFFQzkxQkJFOTAyQjIwODUyRjYiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MzY2MkNGN0U0QkUyMTFFQzkxQkJFOTAyQjIwODUyRjYiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDozNjYyQ0Y3QjRCRTIxMUVDOTFCQkU5MDJCMjA4NTJGNiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDozNjYyQ0Y3QzRCRTIxMUVDOTFCQkU5MDJCMjA4NTJGNiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pv/uAA5BZG9iZQBkwAAAAAH/2wCEAAICAgICAgICAgIDAgICAwQDAgIDBAUEBAQEBAUGBQUFBQUFBgYHBwgHBwYJCQoKCQkMDAwMDAwMDAwMDAwMDAwBAwMDBQQFCQYGCQ0LCQsNDw4ODg4PDwwMDAwMDw8MDAwMDAwPDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDP/AABEIAAkACQMBEQACEQEDEQH/xABtAAEBAAAAAAAAAAAAAAAAAAAJCAEBAQAAAAAAAAAAAAAAAAAABwgQAAAFAwEJAQAAAAAAAAAAAAIDBAYHAAEFFREhQRJCExS0djcRAAIABQMFAQAAAAAAAAAAAAECAEESAwQREwUxMrJzNQb/2gAMAwEAAhEDEQA/AEBfUXMvM2eJcctXQsLHSTIKHO8FChad5C9CQYPTUZR54gi5RB2Gjvbdw6e4vcTz+ZY2Tm3a3vlQlsBBSjkDccquvTtWc50jXL/nsPI3xg2aEx1cvcJc1OgJ20DNp17mlKVUe0kwZQwsm/m0g/NZb0zam3gvoY/tTyEU5z/zsn1XPEwPVUlExx//2Q==\"","export default \"__VITE_ASSET__2cb311a8__\"","export default \"__VITE_ASSET__7524d885__\"","export default \"data:application/json;base64,ewogICAgInJlZ2lvbnMiOlsKICAgICAgICB7CiAgICAgICAgICAgICJpZCI6IkRFIiwKICAgICAgICAgICAgImxhYmVsIjoiRGV1dHNjaGxhbmQiLAogICAgICAgICAgICAidXJsIjoiaHR0cHM6Ly93d3cuYWxpYXhpcy5kZS93ZWJzaXRlL2FsaWF4aXMvc2hvd3Jvb20vcHJvZHVjdHMtZGUuanNvbiIKICAgICAgICB9LAogICAgICAgIHsKICAgICAgICAgICAgImlkIjoiVUsiLAogICAgICAgICAgICAibGFiZWwiOiJVbml0ZWQgS2luZ2RvbSIsCiAgICAgICAgICAgICJ1cmwiOiJodHRwczovL3d3dy5hbGlheGlzLmRlL3dlYnNpdGUvYWxpYXhpcy9zaG93cm9vbS9wcm9kdWN0cy11ay5qc29uIgogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAiaWQiOiJDSCIsCiAgICAgICAgICAgICJsYWJlbCI6IlNjaHdlaXoiLAogICAgICAgICAgICAidXJsIjoiaHR0cHM6Ly93d3cuYWxpYXhpcy5kZS93ZWJzaXRlL2FsaWF4aXMvc2hvd3Jvb20vcHJvZHVjdHMtY2guanNvbiIKICAgICAgICB9LAogICAgICAgIHsKICAgICAgICAgICAgImlkIjoiRVMiLAogICAgICAgICAgICAibGFiZWwiOiJFc3Bhw7FhIiwKICAgICAgICAgICAgInVybCI6Imh0dHBzOi8vd3d3LmFsaWF4aXMuZGUvd2Vic2l0ZS9hbGlheGlzL3Nob3dyb29tL3Byb2R1Y3RzLWVzLmpzb24iCiAgICAgICAgfSwKICAgICAgICB7CiAgICAgICAgICAgICJpZCI6IkZSIiwKICAgICAgICAgICAgImxhYmVsIjoiRnJhbmNlIiwKICAgICAgICAgICAgInVybCI6Imh0dHBzOi8vd3d3LmFsaWF4aXMuZGUvd2Vic2l0ZS9hbGlheGlzL3Nob3dyb29tL3Byb2R1Y3RzLWZyLmpzb24iCiAgICAgICAgfSwKICAgICAgICB7CiAgICAgICAgICAgICJpZCI6IkdSIiwKICAgICAgICAgICAgImxhYmVsIjoizpXOu867zqzOtM6xIiwKICAgICAgICAgICAgInVybCI6Imh0dHBzOi8vd3d3LmFsaWF4aXMuZGUvd2Vic2l0ZS9hbGlheGlzL3Nob3dyb29tL3Byb2R1Y3RzLWdyLm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G9nL2Zhdmljb25zLzIwMjAtMDQtMTQvMWQ5M2VmMWU5YTRjMzcxOTdjODMxMmQzOTIzMTk5NjEuaWNvLnBuZ58b3AwAAAAASUVORK5CYII=\"","export default \"__VITE_ASSET__33228653__\"","export default \"__VITE_ASSET__e89fd3eb__\"","export default \"__VITE_ASSET__6ea60184__\"","export default \"__VITE_ASSET__821170b2__\"","export default \"__VITE_ASSET__8e272314__\"","export default \"__VITE_ASSET__1a38acde__\"","export default \"__VITE_ASSET__683113e0__\"","export default \"__VITE_ASSET__3bafe36a__\"","export default \"__VITE_ASSET__3760ab00__\"","export default \"__VITE_ASSET__10218485__\"","export default \"__VITE_ASSET__699153d1__\"","export default \"__VITE_ASSET__239a99ff__\"","export default \"__VITE_ASSET__a06e3ed0__\"","export default \"__VITE_ASSET__533985ae__\"","export default \"__VITE_ASSET__8d2941b7__\"","export default \"__VITE_ASSET__c1d95d5e__\"","export default \"__VITE_ASSET__bead8ddb__\"","export default \"__VITE_ASSET__58f934a2__\"","export default \"data:application/json;base64,WwogICAgewogICAgICAgICJpZCI6IDAsCiAgICAgICAgIm1lZGlhIjp7CiAgICAgICAgICAgICJ0eXBlIjoiaW1nIiwKICAgICAgICAgICAgInVybCI6ImFsaWF4aXNfb3ZlcnZpZXcucG5nIgogICAgICAgIH0sCiAgICAgICAgInRleHQiOiJUdXRvcmlhbCBQYWdlIDEiCiAgICB9LAogICAgewogICAgICAgICJpZCI6IDEsCiAgICAgICAgIm1lZGlhIjp7CiAgICAgICAgICAgICJ0eXBlIjoidmlkZW8iLAogICAgICAgICAgICAidXJsIjoidHV0b3JpYWxfaG92ZXIubXA0IgogICAgICAgIH0sCiAgICAgICAgInRleHQiOiJUdXRvcmlhbCBQYWdlIDIiCiAgICB9LAogICAgewogICAgICAgICJpZCI6IDIsCiAgICAgICAgIm1lZGlhIjp7CiAgICAgICAgICAgICJ0eXBlIjoidmlkZW8iLAogICAgICAgICAgICAidXJsIjoidHV0b3JpYWxfY2F0ZXJnb3JpZXNfdG9nZ2xlLm1wNCIKICAgICAgICB9LAogICAgICAgICJ0ZXh0IjoiVHV0b3JpYWwgUGFnZSAzIgogICAgfSwKICAgIHsKICAgICAgICAiaWQiOiAzLAogICAgICAgICJtZWRpYSI6ewogICAgICAgICAgICAidHlwZSI6Im5vbmUiLAogICAgICAgICAgICAidXJsIjoiIgogICAgICAgIH0sCiAgICAgICAgInRleHQiOiJUdXRvcmlhbCBQYWdlIDQiCiAgICB9Cgpd\"","export default \"__VITE_ASSET__b1b1844b__\"","export default \"__VITE_ASSET__2fe96e47__\"","function makeMap(str, expectsLowerCase) {\n const map = /* @__PURE__ */ Object.create(null);\n const list = str.split(\",\");\n for (let i = 0; i < list.length; i++) {\n map[list[i]] = true;\n }\n return expectsLowerCase ? (val) => !!map[val.toLowerCase()] : (val) => !!map[val];\n}\n\nconst EMPTY_OBJ = !!(process.env.NODE_ENV !== \"production\") ? Object.freeze({}) : {};\nconst EMPTY_ARR = !!(process.env.NODE_ENV !== \"production\") ? Object.freeze([]) : [];\nconst NOOP = () => {\n};\nconst NO = () => false;\nconst onRE = /^on[^a-z]/;\nconst isOn = (key) => onRE.test(key);\nconst isModelListener = (key) => key.startsWith(\"onUpdate:\");\nconst extend = Object.assign;\nconst remove = (arr, el) => {\n const i = arr.indexOf(el);\n if (i > -1) {\n arr.splice(i, 1);\n }\n};\nconst hasOwnProperty = Object.prototype.hasOwnProperty;\nconst hasOwn = (val, key) => hasOwnProperty.call(val, key);\nconst isArray = Array.isArray;\nconst isMap = (val) => toTypeString(val) === \"[object Map]\";\nconst isSet = (val) => toTypeString(val) === \"[object Set]\";\nconst isDate = (val) => toTypeString(val) === \"[object Date]\";\nconst isRegExp = (val) => toTypeString(val) === \"[object RegExp]\";\nconst isFunction = (val) => typeof val === \"function\";\nconst isString = (val) => typeof val === \"string\";\nconst isSymbol = (val) => typeof val === \"symbol\";\nconst isObject = (val) => val !== null && typeof val === \"object\";\nconst isPromise = (val) => {\n return isObject(val) && isFunction(val.then) && isFunction(val.catch);\n};\nconst objectToString = Object.prototype.toString;\nconst toTypeString = (value) => objectToString.call(value);\nconst toRawType = (value) => {\n return toTypeString(value).slice(8, -1);\n};\nconst isPlainObject = (val) => toTypeString(val) === \"[object Object]\";\nconst isIntegerKey = (key) => isString(key) && key !== \"NaN\" && key[0] !== \"-\" && \"\" + parseInt(key, 10) === key;\nconst isReservedProp = /* @__PURE__ */ makeMap(\n // the leading comma is intentional so empty string \"\" is also included\n \",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted\"\n);\nconst isBuiltInDirective = /* @__PURE__ */ makeMap(\n \"bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo\"\n);\nconst cacheStringFunction = (fn) => {\n const cache = /* @__PURE__ */ Object.create(null);\n return (str) => {\n const hit = cache[str];\n return hit || (cache[str] = fn(str));\n };\n};\nconst camelizeRE = /-(\\w)/g;\nconst camelize = cacheStringFunction((str) => {\n return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : \"\");\n});\nconst hyphenateRE = /\\B([A-Z])/g;\nconst hyphenate = cacheStringFunction(\n (str) => str.replace(hyphenateRE, \"-$1\").toLowerCase()\n);\nconst capitalize = cacheStringFunction(\n (str) => str.charAt(0).toUpperCase() + str.slice(1)\n);\nconst toHandlerKey = cacheStringFunction(\n (str) => str ? `on${capitalize(str)}` : ``\n);\nconst hasChanged = (value, oldValue) => !Object.is(value, oldValue);\nconst invokeArrayFns = (fns, arg) => {\n for (let i = 0; i < fns.length; i++) {\n fns[i](arg);\n }\n};\nconst def = (obj, key, value) => {\n Object.defineProperty(obj, key, {\n configurable: true,\n enumerable: false,\n value\n });\n};\nconst looseToNumber = (val) => {\n const n = parseFloat(val);\n return isNaN(n) ? val : n;\n};\nconst toNumber = (val) => {\n const n = isString(val) ? Number(val) : NaN;\n return isNaN(n) ? val : n;\n};\nlet _globalThis;\nconst getGlobalThis = () => {\n return _globalThis || (_globalThis = typeof globalThis !== \"undefined\" ? globalThis : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : typeof global !== \"undefined\" ? global : {});\n};\nconst identRE = /^[_$a-zA-Z\\xA0-\\uFFFF][_$a-zA-Z0-9\\xA0-\\uFFFF]*$/;\nfunction genPropsAccessExp(name) {\n return identRE.test(name) ? `__props.${name}` : `__props[${JSON.stringify(name)}]`;\n}\n\nconst PatchFlagNames = {\n [1]: `TEXT`,\n [2]: `CLASS`,\n [4]: `STYLE`,\n [8]: `PROPS`,\n [16]: `FULL_PROPS`,\n [32]: `HYDRATE_EVENTS`,\n [64]: `STABLE_FRAGMENT`,\n [128]: `KEYED_FRAGMENT`,\n [256]: `UNKEYED_FRAGMENT`,\n [512]: `NEED_PATCH`,\n [1024]: `DYNAMIC_SLOTS`,\n [2048]: `DEV_ROOT_FRAGMENT`,\n [-1]: `HOISTED`,\n [-2]: `BAIL`\n};\n\nconst slotFlagsText = {\n [1]: \"STABLE\",\n [2]: \"DYNAMIC\",\n [3]: \"FORWARDED\"\n};\n\nconst GLOBALS_WHITE_LISTED = \"Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console\";\nconst isGloballyWhitelisted = /* @__PURE__ */ makeMap(GLOBALS_WHITE_LISTED);\n\nconst range = 2;\nfunction generateCodeFrame(source, start = 0, end = source.length) {\n let lines = source.split(/(\\r?\\n)/);\n const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);\n lines = lines.filter((_, idx) => idx % 2 === 0);\n let count = 0;\n const res = [];\n for (let i = 0; i < lines.length; i++) {\n count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0);\n if (count >= start) {\n for (let j = i - range; j <= i + range || end > count; j++) {\n if (j < 0 || j >= lines.length)\n continue;\n const line = j + 1;\n res.push(\n `${line}${\" \".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`\n );\n const lineLength = lines[j].length;\n const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0;\n if (j === i) {\n const pad = start - (count - (lineLength + newLineSeqLength));\n const length = Math.max(\n 1,\n end > count ? lineLength - pad : end - start\n );\n res.push(` | ` + \" \".repeat(pad) + \"^\".repeat(length));\n } else if (j > i) {\n if (end > count) {\n const length = Math.max(Math.min(end - count, lineLength), 1);\n res.push(` | ` + \"^\".repeat(length));\n }\n count += lineLength + newLineSeqLength;\n }\n }\n break;\n }\n }\n return res.join(\"\\n\");\n}\n\nfunction normalizeStyle(value) {\n if (isArray(value)) {\n const res = {};\n for (let i = 0; i < value.length; i++) {\n const item = value[i];\n const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);\n if (normalized) {\n for (const key in normalized) {\n res[key] = normalized[key];\n }\n }\n }\n return res;\n } else if (isString(value)) {\n return value;\n } else if (isObject(value)) {\n return value;\n }\n}\nconst listDelimiterRE = /;(?![^(]*\\))/g;\nconst propertyDelimiterRE = /:([^]+)/;\nconst styleCommentRE = /\\/\\*[^]*?\\*\\//g;\nfunction parseStringStyle(cssText) {\n const ret = {};\n cssText.replace(styleCommentRE, \"\").split(listDelimiterRE).forEach((item) => {\n if (item) {\n const tmp = item.split(propertyDelimiterRE);\n tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());\n }\n });\n return ret;\n}\nfunction stringifyStyle(styles) {\n let ret = \"\";\n if (!styles || isString(styles)) {\n return ret;\n }\n for (const key in styles) {\n const value = styles[key];\n const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);\n if (isString(value) || typeof value === \"number\") {\n ret += `${normalizedKey}:${value};`;\n }\n }\n return ret;\n}\nfunction normalizeClass(value) {\n let res = \"\";\n if (isString(value)) {\n res = value;\n } else if (isArray(value)) {\n for (let i = 0; i < value.length; i++) {\n const normalized = normalizeClass(value[i]);\n if (normalized) {\n res += normalized + \" \";\n }\n }\n } else if (isObject(value)) {\n for (const name in value) {\n if (value[name]) {\n res += name + \" \";\n }\n }\n }\n return res.trim();\n}\nfunction normalizeProps(props) {\n if (!props)\n return null;\n let { class: klass, style } = props;\n if (klass && !isString(klass)) {\n props.class = normalizeClass(klass);\n }\n if (style) {\n props.style = normalizeStyle(style);\n }\n return props;\n}\n\nconst HTML_TAGS = \"html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot\";\nconst SVG_TAGS = \"svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,text,textPath,title,tspan,unknown,use,view\";\nconst VOID_TAGS = \"area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr\";\nconst isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS);\nconst isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS);\nconst isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);\n\nconst specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;\nconst isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);\nconst isBooleanAttr = /* @__PURE__ */ makeMap(\n specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`\n);\nfunction includeBooleanAttr(value) {\n return !!value || value === \"\";\n}\nconst unsafeAttrCharRE = /[>/=\"'\\u0009\\u000a\\u000c\\u0020]/;\nconst attrValidationCache = {};\nfunction isSSRSafeAttrName(name) {\n if (attrValidationCache.hasOwnProperty(name)) {\n return attrValidationCache[name];\n }\n const isUnsafe = unsafeAttrCharRE.test(name);\n if (isUnsafe) {\n console.error(`unsafe attribute name: ${name}`);\n }\n return attrValidationCache[name] = !isUnsafe;\n}\nconst propsToAttrMap = {\n acceptCharset: \"accept-charset\",\n className: \"class\",\n htmlFor: \"for\",\n httpEquiv: \"http-equiv\"\n};\nconst isKnownHtmlAttr = /* @__PURE__ */ makeMap(\n `accept,accept-charset,accesskey,action,align,allow,alt,async,autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,border,buffered,capture,challenge,charset,checked,cite,class,code,codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,formaction,formenctype,formmethod,formnovalidate,formtarget,headers,height,hidden,high,href,hreflang,http-equiv,icon,id,importance,inert,integrity,ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,target,title,translate,type,usemap,value,width,wrap`\n);\nconst isKnownSvgAttr = /* @__PURE__ */ makeMap(\n `xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,color-interpolation-filters,color-profile,color-rendering,contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,font-family,font-size,font-size-adjust,font-stretch,font-style,font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,overflow,overline-position,overline-thickness,panose-1,paint-order,path,pathLength,patternContentUnits,patternTransform,patternUnits,ping,pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,specularConstant,specularExponent,speed,spreadMethod,startOffset,stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,string,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,text-decoration,text-rendering,textLength,to,transform,transform-origin,type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan`\n);\n\nconst escapeRE = /[\"'&<>]/;\nfunction escapeHtml(string) {\n const str = \"\" + string;\n const match = escapeRE.exec(str);\n if (!match) {\n return str;\n }\n let html = \"\";\n let escaped;\n let index;\n let lastIndex = 0;\n for (index = match.index; index < str.length; index++) {\n switch (str.charCodeAt(index)) {\n case 34:\n escaped = \""\";\n break;\n case 38:\n escaped = \"&\";\n break;\n case 39:\n escaped = \"'\";\n break;\n case 60:\n escaped = \"<\";\n break;\n case 62:\n escaped = \">\";\n break;\n default:\n continue;\n }\n if (lastIndex !== index) {\n html += str.slice(lastIndex, index);\n }\n lastIndex = index + 1;\n html += escaped;\n }\n return lastIndex !== index ? html + str.slice(lastIndex, index) : html;\n}\nconst commentStripRE = /^-?>||--!>| looseEqual(item, val));\n}\n\nconst toDisplayString = (val) => {\n return isString(val) ? val : val == null ? \"\" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? JSON.stringify(val, replacer, 2) : String(val);\n};\nconst replacer = (_key, val) => {\n if (val && val.__v_isRef) {\n return replacer(_key, val.value);\n } else if (isMap(val)) {\n return {\n [`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val2]) => {\n entries[`${key} =>`] = val2;\n return entries;\n }, {})\n };\n } else if (isSet(val)) {\n return {\n [`Set(${val.size})`]: [...val.values()]\n };\n } else if (isObject(val) && !isArray(val) && !isPlainObject(val)) {\n return String(val);\n }\n return val;\n};\n\nexport { EMPTY_ARR, EMPTY_OBJ, NO, NOOP, PatchFlagNames, camelize, capitalize, def, escapeHtml, escapeHtmlComment, extend, genPropsAccessExp, generateCodeFrame, getGlobalThis, hasChanged, hasOwn, hyphenate, includeBooleanAttr, invokeArrayFns, isArray, isBooleanAttr, isBuiltInDirective, isDate, isFunction, isGloballyWhitelisted, isHTMLTag, isIntegerKey, isKnownHtmlAttr, isKnownSvgAttr, isMap, isModelListener, isObject, isOn, isPlainObject, isPromise, isRegExp, isReservedProp, isSSRSafeAttrName, isSVGTag, isSet, isSpecialBooleanAttr, isString, isSymbol, isVoidTag, looseEqual, looseIndexOf, looseToNumber, makeMap, normalizeClass, normalizeProps, normalizeStyle, objectToString, parseStringStyle, propsToAttrMap, remove, slotFlagsText, stringifyStyle, toDisplayString, toHandlerKey, toNumber, toRawType, toTypeString };\n","import { extend, isArray, isMap, isIntegerKey, hasOwn, isSymbol, isObject, hasChanged, makeMap, capitalize, toRawType, def, isFunction, NOOP } from '@vue/shared';\n\nfunction warn(msg, ...args) {\n console.warn(`[Vue warn] ${msg}`, ...args);\n}\n\nlet activeEffectScope;\nclass EffectScope {\n constructor(detached = false) {\n this.detached = detached;\n /**\n * @internal\n */\n this._active = true;\n /**\n * @internal\n */\n this.effects = [];\n /**\n * @internal\n */\n this.cleanups = [];\n this.parent = activeEffectScope;\n if (!detached && activeEffectScope) {\n this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(\n this\n ) - 1;\n }\n }\n get active() {\n return this._active;\n }\n run(fn) {\n if (this._active) {\n const currentEffectScope = activeEffectScope;\n try {\n activeEffectScope = this;\n return fn();\n } finally {\n activeEffectScope = currentEffectScope;\n }\n } else if (!!(process.env.NODE_ENV !== \"production\")) {\n warn(`cannot run an inactive effect scope.`);\n }\n }\n /**\n * This should only be called on non-detached scopes\n * @internal\n */\n on() {\n activeEffectScope = this;\n }\n /**\n * This should only be called on non-detached scopes\n * @internal\n */\n off() {\n activeEffectScope = this.parent;\n }\n stop(fromParent) {\n if (this._active) {\n let i, l;\n for (i = 0, l = this.effects.length; i < l; i++) {\n this.effects[i].stop();\n }\n for (i = 0, l = this.cleanups.length; i < l; i++) {\n this.cleanups[i]();\n }\n if (this.scopes) {\n for (i = 0, l = this.scopes.length; i < l; i++) {\n this.scopes[i].stop(true);\n }\n }\n if (!this.detached && this.parent && !fromParent) {\n const last = this.parent.scopes.pop();\n if (last && last !== this) {\n this.parent.scopes[this.index] = last;\n last.index = this.index;\n }\n }\n this.parent = void 0;\n this._active = false;\n }\n }\n}\nfunction effectScope(detached) {\n return new EffectScope(detached);\n}\nfunction recordEffectScope(effect, scope = activeEffectScope) {\n if (scope && scope.active) {\n scope.effects.push(effect);\n }\n}\nfunction getCurrentScope() {\n return activeEffectScope;\n}\nfunction onScopeDispose(fn) {\n if (activeEffectScope) {\n activeEffectScope.cleanups.push(fn);\n } else if (!!(process.env.NODE_ENV !== \"production\")) {\n warn(\n `onScopeDispose() is called when there is no active effect scope to be associated with.`\n );\n }\n}\n\nconst createDep = (effects) => {\n const dep = new Set(effects);\n dep.w = 0;\n dep.n = 0;\n return dep;\n};\nconst wasTracked = (dep) => (dep.w & trackOpBit) > 0;\nconst newTracked = (dep) => (dep.n & trackOpBit) > 0;\nconst initDepMarkers = ({ deps }) => {\n if (deps.length) {\n for (let i = 0; i < deps.length; i++) {\n deps[i].w |= trackOpBit;\n }\n }\n};\nconst finalizeDepMarkers = (effect) => {\n const { deps } = effect;\n if (deps.length) {\n let ptr = 0;\n for (let i = 0; i < deps.length; i++) {\n const dep = deps[i];\n if (wasTracked(dep) && !newTracked(dep)) {\n dep.delete(effect);\n } else {\n deps[ptr++] = dep;\n }\n dep.w &= ~trackOpBit;\n dep.n &= ~trackOpBit;\n }\n deps.length = ptr;\n }\n};\n\nconst targetMap = /* @__PURE__ */ new WeakMap();\nlet effectTrackDepth = 0;\nlet trackOpBit = 1;\nconst maxMarkerBits = 30;\nlet activeEffect;\nconst ITERATE_KEY = Symbol(!!(process.env.NODE_ENV !== \"production\") ? \"iterate\" : \"\");\nconst MAP_KEY_ITERATE_KEY = Symbol(!!(process.env.NODE_ENV !== \"production\") ? \"Map key iterate\" : \"\");\nclass ReactiveEffect {\n constructor(fn, scheduler = null, scope) {\n this.fn = fn;\n this.scheduler = scheduler;\n this.active = true;\n this.deps = [];\n this.parent = void 0;\n recordEffectScope(this, scope);\n }\n run() {\n if (!this.active) {\n return this.fn();\n }\n let parent = activeEffect;\n let lastShouldTrack = shouldTrack;\n while (parent) {\n if (parent === this) {\n return;\n }\n parent = parent.parent;\n }\n try {\n this.parent = activeEffect;\n activeEffect = this;\n shouldTrack = true;\n trackOpBit = 1 << ++effectTrackDepth;\n if (effectTrackDepth <= maxMarkerBits) {\n initDepMarkers(this);\n } else {\n cleanupEffect(this);\n }\n return this.fn();\n } finally {\n if (effectTrackDepth <= maxMarkerBits) {\n finalizeDepMarkers(this);\n }\n trackOpBit = 1 << --effectTrackDepth;\n activeEffect = this.parent;\n shouldTrack = lastShouldTrack;\n this.parent = void 0;\n if (this.deferStop) {\n this.stop();\n }\n }\n }\n stop() {\n if (activeEffect === this) {\n this.deferStop = true;\n } else if (this.active) {\n cleanupEffect(this);\n if (this.onStop) {\n this.onStop();\n }\n this.active = false;\n }\n }\n}\nfunction cleanupEffect(effect2) {\n const { deps } = effect2;\n if (deps.length) {\n for (let i = 0; i < deps.length; i++) {\n deps[i].delete(effect2);\n }\n deps.length = 0;\n }\n}\nfunction effect(fn, options) {\n if (fn.effect) {\n fn = fn.effect.fn;\n }\n const _effect = new ReactiveEffect(fn);\n if (options) {\n extend(_effect, options);\n if (options.scope)\n recordEffectScope(_effect, options.scope);\n }\n if (!options || !options.lazy) {\n _effect.run();\n }\n const runner = _effect.run.bind(_effect);\n runner.effect = _effect;\n return runner;\n}\nfunction stop(runner) {\n runner.effect.stop();\n}\nlet shouldTrack = true;\nconst trackStack = [];\nfunction pauseTracking() {\n trackStack.push(shouldTrack);\n shouldTrack = false;\n}\nfunction enableTracking() {\n trackStack.push(shouldTrack);\n shouldTrack = true;\n}\nfunction resetTracking() {\n const last = trackStack.pop();\n shouldTrack = last === void 0 ? true : last;\n}\nfunction track(target, type, key) {\n if (shouldTrack && activeEffect) {\n let depsMap = targetMap.get(target);\n if (!depsMap) {\n targetMap.set(target, depsMap = /* @__PURE__ */ new Map());\n }\n let dep = depsMap.get(key);\n if (!dep) {\n depsMap.set(key, dep = createDep());\n }\n const eventInfo = !!(process.env.NODE_ENV !== \"production\") ? { effect: activeEffect, target, type, key } : void 0;\n trackEffects(dep, eventInfo);\n }\n}\nfunction trackEffects(dep, debuggerEventExtraInfo) {\n let shouldTrack2 = false;\n if (effectTrackDepth <= maxMarkerBits) {\n if (!newTracked(dep)) {\n dep.n |= trackOpBit;\n shouldTrack2 = !wasTracked(dep);\n }\n } else {\n shouldTrack2 = !dep.has(activeEffect);\n }\n if (shouldTrack2) {\n dep.add(activeEffect);\n activeEffect.deps.push(dep);\n if (!!(process.env.NODE_ENV !== \"production\") && activeEffect.onTrack) {\n activeEffect.onTrack(\n extend(\n {\n effect: activeEffect\n },\n debuggerEventExtraInfo\n )\n );\n }\n }\n}\nfunction trigger(target, type, key, newValue, oldValue, oldTarget) {\n const depsMap = targetMap.get(target);\n if (!depsMap) {\n return;\n }\n let deps = [];\n if (type === \"clear\") {\n deps = [...depsMap.values()];\n } else if (key === \"length\" && isArray(target)) {\n const newLength = Number(newValue);\n depsMap.forEach((dep, key2) => {\n if (key2 === \"length\" || key2 >= newLength) {\n deps.push(dep);\n }\n });\n } else {\n if (key !== void 0) {\n deps.push(depsMap.get(key));\n }\n switch (type) {\n case \"add\":\n if (!isArray(target)) {\n deps.push(depsMap.get(ITERATE_KEY));\n if (isMap(target)) {\n deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));\n }\n } else if (isIntegerKey(key)) {\n deps.push(depsMap.get(\"length\"));\n }\n break;\n case \"delete\":\n if (!isArray(target)) {\n deps.push(depsMap.get(ITERATE_KEY));\n if (isMap(target)) {\n deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));\n }\n }\n break;\n case \"set\":\n if (isMap(target)) {\n deps.push(depsMap.get(ITERATE_KEY));\n }\n break;\n }\n }\n const eventInfo = !!(process.env.NODE_ENV !== \"production\") ? { target, type, key, newValue, oldValue, oldTarget } : void 0;\n if (deps.length === 1) {\n if (deps[0]) {\n if (!!(process.env.NODE_ENV !== \"production\")) {\n triggerEffects(deps[0], eventInfo);\n } else {\n triggerEffects(deps[0]);\n }\n }\n } else {\n const effects = [];\n for (const dep of deps) {\n if (dep) {\n effects.push(...dep);\n }\n }\n if (!!(process.env.NODE_ENV !== \"production\")) {\n triggerEffects(createDep(effects), eventInfo);\n } else {\n triggerEffects(createDep(effects));\n }\n }\n}\nfunction triggerEffects(dep, debuggerEventExtraInfo) {\n const effects = isArray(dep) ? dep : [...dep];\n for (const effect2 of effects) {\n if (effect2.computed) {\n triggerEffect(effect2, debuggerEventExtraInfo);\n }\n }\n for (const effect2 of effects) {\n if (!effect2.computed) {\n triggerEffect(effect2, debuggerEventExtraInfo);\n }\n }\n}\nfunction triggerEffect(effect2, debuggerEventExtraInfo) {\n if (effect2 !== activeEffect || effect2.allowRecurse) {\n if (!!(process.env.NODE_ENV !== \"production\") && effect2.onTrigger) {\n effect2.onTrigger(extend({ effect: effect2 }, debuggerEventExtraInfo));\n }\n if (effect2.scheduler) {\n effect2.scheduler();\n } else {\n effect2.run();\n }\n }\n}\nfunction getDepFromReactive(object, key) {\n var _a;\n return (_a = targetMap.get(object)) == null ? void 0 : _a.get(key);\n}\n\nconst isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);\nconst builtInSymbols = new Set(\n /* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== \"arguments\" && key !== \"caller\").map((key) => Symbol[key]).filter(isSymbol)\n);\nconst get$1 = /* @__PURE__ */ createGetter();\nconst shallowGet = /* @__PURE__ */ createGetter(false, true);\nconst readonlyGet = /* @__PURE__ */ createGetter(true);\nconst shallowReadonlyGet = /* @__PURE__ */ createGetter(true, true);\nconst arrayInstrumentations = /* @__PURE__ */ createArrayInstrumentations();\nfunction createArrayInstrumentations() {\n const instrumentations = {};\n [\"includes\", \"indexOf\", \"lastIndexOf\"].forEach((key) => {\n instrumentations[key] = function(...args) {\n const arr = toRaw(this);\n for (let i = 0, l = this.length; i < l; i++) {\n track(arr, \"get\", i + \"\");\n }\n const res = arr[key](...args);\n if (res === -1 || res === false) {\n return arr[key](...args.map(toRaw));\n } else {\n return res;\n }\n };\n });\n [\"push\", \"pop\", \"shift\", \"unshift\", \"splice\"].forEach((key) => {\n instrumentations[key] = function(...args) {\n pauseTracking();\n const res = toRaw(this)[key].apply(this, args);\n resetTracking();\n return res;\n };\n });\n return instrumentations;\n}\nfunction hasOwnProperty(key) {\n const obj = toRaw(this);\n track(obj, \"has\", key);\n return obj.hasOwnProperty(key);\n}\nfunction createGetter(isReadonly2 = false, shallow = false) {\n return function get2(target, key, receiver) {\n if (key === \"__v_isReactive\") {\n return !isReadonly2;\n } else if (key === \"__v_isReadonly\") {\n return isReadonly2;\n } else if (key === \"__v_isShallow\") {\n return shallow;\n } else if (key === \"__v_raw\" && receiver === (isReadonly2 ? shallow ? shallowReadonlyMap : readonlyMap : shallow ? shallowReactiveMap : reactiveMap).get(target)) {\n return target;\n }\n const targetIsArray = isArray(target);\n if (!isReadonly2) {\n if (targetIsArray && hasOwn(arrayInstrumentations, key)) {\n return Reflect.get(arrayInstrumentations, key, receiver);\n }\n if (key === \"hasOwnProperty\") {\n return hasOwnProperty;\n }\n }\n const res = Reflect.get(target, key, receiver);\n if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {\n return res;\n }\n if (!isReadonly2) {\n track(target, \"get\", key);\n }\n if (shallow) {\n return res;\n }\n if (isRef(res)) {\n return targetIsArray && isIntegerKey(key) ? res : res.value;\n }\n if (isObject(res)) {\n return isReadonly2 ? readonly(res) : reactive(res);\n }\n return res;\n };\n}\nconst set$1 = /* @__PURE__ */ createSetter();\nconst shallowSet = /* @__PURE__ */ createSetter(true);\nfunction createSetter(shallow = false) {\n return function set2(target, key, value, receiver) {\n let oldValue = target[key];\n if (isReadonly(oldValue) && isRef(oldValue) && !isRef(value)) {\n return false;\n }\n if (!shallow) {\n if (!isShallow(value) && !isReadonly(value)) {\n oldValue = toRaw(oldValue);\n value = toRaw(value);\n }\n if (!isArray(target) && isRef(oldValue) && !isRef(value)) {\n oldValue.value = value;\n return true;\n }\n }\n const hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key);\n const result = Reflect.set(target, key, value, receiver);\n if (target === toRaw(receiver)) {\n if (!hadKey) {\n trigger(target, \"add\", key, value);\n } else if (hasChanged(value, oldValue)) {\n trigger(target, \"set\", key, value, oldValue);\n }\n }\n return result;\n };\n}\nfunction deleteProperty(target, key) {\n const hadKey = hasOwn(target, key);\n const oldValue = target[key];\n const result = Reflect.deleteProperty(target, key);\n if (result && hadKey) {\n trigger(target, \"delete\", key, void 0, oldValue);\n }\n return result;\n}\nfunction has$1(target, key) {\n const result = Reflect.has(target, key);\n if (!isSymbol(key) || !builtInSymbols.has(key)) {\n track(target, \"has\", key);\n }\n return result;\n}\nfunction ownKeys(target) {\n track(target, \"iterate\", isArray(target) ? \"length\" : ITERATE_KEY);\n return Reflect.ownKeys(target);\n}\nconst mutableHandlers = {\n get: get$1,\n set: set$1,\n deleteProperty,\n has: has$1,\n ownKeys\n};\nconst readonlyHandlers = {\n get: readonlyGet,\n set(target, key) {\n if (!!(process.env.NODE_ENV !== \"production\")) {\n warn(\n `Set operation on key \"${String(key)}\" failed: target is readonly.`,\n target\n );\n }\n return true;\n },\n deleteProperty(target, key) {\n if (!!(process.env.NODE_ENV !== \"production\")) {\n warn(\n `Delete operation on key \"${String(key)}\" failed: target is readonly.`,\n target\n );\n }\n return true;\n }\n};\nconst shallowReactiveHandlers = /* @__PURE__ */ extend(\n {},\n mutableHandlers,\n {\n get: shallowGet,\n set: shallowSet\n }\n);\nconst shallowReadonlyHandlers = /* @__PURE__ */ extend(\n {},\n readonlyHandlers,\n {\n get: shallowReadonlyGet\n }\n);\n\nconst toShallow = (value) => value;\nconst getProto = (v) => Reflect.getPrototypeOf(v);\nfunction get(target, key, isReadonly = false, isShallow = false) {\n target = target[\"__v_raw\"];\n const rawTarget = toRaw(target);\n const rawKey = toRaw(key);\n if (!isReadonly) {\n if (key !== rawKey) {\n track(rawTarget, \"get\", key);\n }\n track(rawTarget, \"get\", rawKey);\n }\n const { has: has2 } = getProto(rawTarget);\n const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;\n if (has2.call(rawTarget, key)) {\n return wrap(target.get(key));\n } else if (has2.call(rawTarget, rawKey)) {\n return wrap(target.get(rawKey));\n } else if (target !== rawTarget) {\n target.get(key);\n }\n}\nfunction has(key, isReadonly = false) {\n const target = this[\"__v_raw\"];\n const rawTarget = toRaw(target);\n const rawKey = toRaw(key);\n if (!isReadonly) {\n if (key !== rawKey) {\n track(rawTarget, \"has\", key);\n }\n track(rawTarget, \"has\", rawKey);\n }\n return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);\n}\nfunction size(target, isReadonly = false) {\n target = target[\"__v_raw\"];\n !isReadonly && track(toRaw(target), \"iterate\", ITERATE_KEY);\n return Reflect.get(target, \"size\", target);\n}\nfunction add(value) {\n value = toRaw(value);\n const target = toRaw(this);\n const proto = getProto(target);\n const hadKey = proto.has.call(target, value);\n if (!hadKey) {\n target.add(value);\n trigger(target, \"add\", value, value);\n }\n return this;\n}\nfunction set(key, value) {\n value = toRaw(value);\n const target = toRaw(this);\n const { has: has2, get: get2 } = getProto(target);\n let hadKey = has2.call(target, key);\n if (!hadKey) {\n key = toRaw(key);\n hadKey = has2.call(target, key);\n } else if (!!(process.env.NODE_ENV !== \"production\")) {\n checkIdentityKeys(target, has2, key);\n }\n const oldValue = get2.call(target, key);\n target.set(key, value);\n if (!hadKey) {\n trigger(target, \"add\", key, value);\n } else if (hasChanged(value, oldValue)) {\n trigger(target, \"set\", key, value, oldValue);\n }\n return this;\n}\nfunction deleteEntry(key) {\n const target = toRaw(this);\n const { has: has2, get: get2 } = getProto(target);\n let hadKey = has2.call(target, key);\n if (!hadKey) {\n key = toRaw(key);\n hadKey = has2.call(target, key);\n } else if (!!(process.env.NODE_ENV !== \"production\")) {\n checkIdentityKeys(target, has2, key);\n }\n const oldValue = get2 ? get2.call(target, key) : void 0;\n const result = target.delete(key);\n if (hadKey) {\n trigger(target, \"delete\", key, void 0, oldValue);\n }\n return result;\n}\nfunction clear() {\n const target = toRaw(this);\n const hadItems = target.size !== 0;\n const oldTarget = !!(process.env.NODE_ENV !== \"production\") ? isMap(target) ? new Map(target) : new Set(target) : void 0;\n const result = target.clear();\n if (hadItems) {\n trigger(target, \"clear\", void 0, void 0, oldTarget);\n }\n return result;\n}\nfunction createForEach(isReadonly, isShallow) {\n return function forEach(callback, thisArg) {\n const observed = this;\n const target = observed[\"__v_raw\"];\n const rawTarget = toRaw(target);\n const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;\n !isReadonly && track(rawTarget, \"iterate\", ITERATE_KEY);\n return target.forEach((value, key) => {\n return callback.call(thisArg, wrap(value), wrap(key), observed);\n });\n };\n}\nfunction createIterableMethod(method, isReadonly, isShallow) {\n return function(...args) {\n const target = this[\"__v_raw\"];\n const rawTarget = toRaw(target);\n const targetIsMap = isMap(rawTarget);\n const isPair = method === \"entries\" || method === Symbol.iterator && targetIsMap;\n const isKeyOnly = method === \"keys\" && targetIsMap;\n const innerIterator = target[method](...args);\n const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;\n !isReadonly && track(\n rawTarget,\n \"iterate\",\n isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY\n );\n return {\n // iterator protocol\n next() {\n const { value, done } = innerIterator.next();\n return done ? { value, done } : {\n value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),\n done\n };\n },\n // iterable protocol\n [Symbol.iterator]() {\n return this;\n }\n };\n };\n}\nfunction createReadonlyMethod(type) {\n return function(...args) {\n if (!!(process.env.NODE_ENV !== \"production\")) {\n const key = args[0] ? `on key \"${args[0]}\" ` : ``;\n console.warn(\n `${capitalize(type)} operation ${key}failed: target is readonly.`,\n toRaw(this)\n );\n }\n return type === \"delete\" ? false : this;\n };\n}\nfunction createInstrumentations() {\n const mutableInstrumentations2 = {\n get(key) {\n return get(this, key);\n },\n get size() {\n return size(this);\n },\n has,\n add,\n set,\n delete: deleteEntry,\n clear,\n forEach: createForEach(false, false)\n };\n const shallowInstrumentations2 = {\n get(key) {\n return get(this, key, false, true);\n },\n get size() {\n return size(this);\n },\n has,\n add,\n set,\n delete: deleteEntry,\n clear,\n forEach: createForEach(false, true)\n };\n const readonlyInstrumentations2 = {\n get(key) {\n return get(this, key, true);\n },\n get size() {\n return size(this, true);\n },\n has(key) {\n return has.call(this, key, true);\n },\n add: createReadonlyMethod(\"add\"),\n set: createReadonlyMethod(\"set\"),\n delete: createReadonlyMethod(\"delete\"),\n clear: createReadonlyMethod(\"clear\"),\n forEach: createForEach(true, false)\n };\n const shallowReadonlyInstrumentations2 = {\n get(key) {\n return get(this, key, true, true);\n },\n get size() {\n return size(this, true);\n },\n has(key) {\n return has.call(this, key, true);\n },\n add: createReadonlyMethod(\"add\"),\n set: createReadonlyMethod(\"set\"),\n delete: createReadonlyMethod(\"delete\"),\n clear: createReadonlyMethod(\"clear\"),\n forEach: createForEach(true, true)\n };\n const iteratorMethods = [\"keys\", \"values\", \"entries\", Symbol.iterator];\n iteratorMethods.forEach((method) => {\n mutableInstrumentations2[method] = createIterableMethod(\n method,\n false,\n false\n );\n readonlyInstrumentations2[method] = createIterableMethod(\n method,\n true,\n false\n );\n shallowInstrumentations2[method] = createIterableMethod(\n method,\n false,\n true\n );\n shallowReadonlyInstrumentations2[method] = createIterableMethod(\n method,\n true,\n true\n );\n });\n return [\n mutableInstrumentations2,\n readonlyInstrumentations2,\n shallowInstrumentations2,\n shallowReadonlyInstrumentations2\n ];\n}\nconst [\n mutableInstrumentations,\n readonlyInstrumentations,\n shallowInstrumentations,\n shallowReadonlyInstrumentations\n] = /* @__PURE__ */ createInstrumentations();\nfunction createInstrumentationGetter(isReadonly, shallow) {\n const instrumentations = shallow ? isReadonly ? shallowReadonlyInstrumentations : shallowInstrumentations : isReadonly ? readonlyInstrumentations : mutableInstrumentations;\n return (target, key, receiver) => {\n if (key === \"__v_isReactive\") {\n return !isReadonly;\n } else if (key === \"__v_isReadonly\") {\n return isReadonly;\n } else if (key === \"__v_raw\") {\n return target;\n }\n return Reflect.get(\n hasOwn(instrumentations, key) && key in target ? instrumentations : target,\n key,\n receiver\n );\n };\n}\nconst mutableCollectionHandlers = {\n get: /* @__PURE__ */ createInstrumentationGetter(false, false)\n};\nconst shallowCollectionHandlers = {\n get: /* @__PURE__ */ createInstrumentationGetter(false, true)\n};\nconst readonlyCollectionHandlers = {\n get: /* @__PURE__ */ createInstrumentationGetter(true, false)\n};\nconst shallowReadonlyCollectionHandlers = {\n get: /* @__PURE__ */ createInstrumentationGetter(true, true)\n};\nfunction checkIdentityKeys(target, has2, key) {\n const rawKey = toRaw(key);\n if (rawKey !== key && has2.call(target, rawKey)) {\n const type = toRawType(target);\n console.warn(\n `Reactive ${type} contains both the raw and reactive versions of the same object${type === `Map` ? ` as keys` : ``}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`\n );\n }\n}\n\nconst reactiveMap = /* @__PURE__ */ new WeakMap();\nconst shallowReactiveMap = /* @__PURE__ */ new WeakMap();\nconst readonlyMap = /* @__PURE__ */ new WeakMap();\nconst shallowReadonlyMap = /* @__PURE__ */ new WeakMap();\nfunction targetTypeMap(rawType) {\n switch (rawType) {\n case \"Object\":\n case \"Array\":\n return 1 /* COMMON */;\n case \"Map\":\n case \"Set\":\n case \"WeakMap\":\n case \"WeakSet\":\n return 2 /* COLLECTION */;\n default:\n return 0 /* INVALID */;\n }\n}\nfunction getTargetType(value) {\n return value[\"__v_skip\"] || !Object.isExtensible(value) ? 0 /* INVALID */ : targetTypeMap(toRawType(value));\n}\nfunction reactive(target) {\n if (isReadonly(target)) {\n return target;\n }\n return createReactiveObject(\n target,\n false,\n mutableHandlers,\n mutableCollectionHandlers,\n reactiveMap\n );\n}\nfunction shallowReactive(target) {\n return createReactiveObject(\n target,\n false,\n shallowReactiveHandlers,\n shallowCollectionHandlers,\n shallowReactiveMap\n );\n}\nfunction readonly(target) {\n return createReactiveObject(\n target,\n true,\n readonlyHandlers,\n readonlyCollectionHandlers,\n readonlyMap\n );\n}\nfunction shallowReadonly(target) {\n return createReactiveObject(\n target,\n true,\n shallowReadonlyHandlers,\n shallowReadonlyCollectionHandlers,\n shallowReadonlyMap\n );\n}\nfunction createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {\n if (!isObject(target)) {\n if (!!(process.env.NODE_ENV !== \"production\")) {\n console.warn(`value cannot be made reactive: ${String(target)}`);\n }\n return target;\n }\n if (target[\"__v_raw\"] && !(isReadonly2 && target[\"__v_isReactive\"])) {\n return target;\n }\n const existingProxy = proxyMap.get(target);\n if (existingProxy) {\n return existingProxy;\n }\n const targetType = getTargetType(target);\n if (targetType === 0 /* INVALID */) {\n return target;\n }\n const proxy = new Proxy(\n target,\n targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers\n );\n proxyMap.set(target, proxy);\n return proxy;\n}\nfunction isReactive(value) {\n if (isReadonly(value)) {\n return isReactive(value[\"__v_raw\"]);\n }\n return !!(value && value[\"__v_isReactive\"]);\n}\nfunction isReadonly(value) {\n return !!(value && value[\"__v_isReadonly\"]);\n}\nfunction isShallow(value) {\n return !!(value && value[\"__v_isShallow\"]);\n}\nfunction isProxy(value) {\n return isReactive(value) || isReadonly(value);\n}\nfunction toRaw(observed) {\n const raw = observed && observed[\"__v_raw\"];\n return raw ? toRaw(raw) : observed;\n}\nfunction markRaw(value) {\n def(value, \"__v_skip\", true);\n return value;\n}\nconst toReactive = (value) => isObject(value) ? reactive(value) : value;\nconst toReadonly = (value) => isObject(value) ? readonly(value) : value;\n\nfunction trackRefValue(ref2) {\n if (shouldTrack && activeEffect) {\n ref2 = toRaw(ref2);\n if (!!(process.env.NODE_ENV !== \"production\")) {\n trackEffects(ref2.dep || (ref2.dep = createDep()), {\n target: ref2,\n type: \"get\",\n key: \"value\"\n });\n } else {\n trackEffects(ref2.dep || (ref2.dep = createDep()));\n }\n }\n}\nfunction triggerRefValue(ref2, newVal) {\n ref2 = toRaw(ref2);\n const dep = ref2.dep;\n if (dep) {\n if (!!(process.env.NODE_ENV !== \"production\")) {\n triggerEffects(dep, {\n target: ref2,\n type: \"set\",\n key: \"value\",\n newValue: newVal\n });\n } else {\n triggerEffects(dep);\n }\n }\n}\nfunction isRef(r) {\n return !!(r && r.__v_isRef === true);\n}\nfunction ref(value) {\n return createRef(value, false);\n}\nfunction shallowRef(value) {\n return createRef(value, true);\n}\nfunction createRef(rawValue, shallow) {\n if (isRef(rawValue)) {\n return rawValue;\n }\n return new RefImpl(rawValue, shallow);\n}\nclass RefImpl {\n constructor(value, __v_isShallow) {\n this.__v_isShallow = __v_isShallow;\n this.dep = void 0;\n this.__v_isRef = true;\n this._rawValue = __v_isShallow ? value : toRaw(value);\n this._value = __v_isShallow ? value : toReactive(value);\n }\n get value() {\n trackRefValue(this);\n return this._value;\n }\n set value(newVal) {\n const useDirectValue = this.__v_isShallow || isShallow(newVal) || isReadonly(newVal);\n newVal = useDirectValue ? newVal : toRaw(newVal);\n if (hasChanged(newVal, this._rawValue)) {\n this._rawValue = newVal;\n this._value = useDirectValue ? newVal : toReactive(newVal);\n triggerRefValue(this, newVal);\n }\n }\n}\nfunction triggerRef(ref2) {\n triggerRefValue(ref2, !!(process.env.NODE_ENV !== \"production\") ? ref2.value : void 0);\n}\nfunction unref(ref2) {\n return isRef(ref2) ? ref2.value : ref2;\n}\nfunction toValue(source) {\n return isFunction(source) ? source() : unref(source);\n}\nconst shallowUnwrapHandlers = {\n get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),\n set: (target, key, value, receiver) => {\n const oldValue = target[key];\n if (isRef(oldValue) && !isRef(value)) {\n oldValue.value = value;\n return true;\n } else {\n return Reflect.set(target, key, value, receiver);\n }\n }\n};\nfunction proxyRefs(objectWithRefs) {\n return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);\n}\nclass CustomRefImpl {\n constructor(factory) {\n this.dep = void 0;\n this.__v_isRef = true;\n const { get, set } = factory(\n () => trackRefValue(this),\n () => triggerRefValue(this)\n );\n this._get = get;\n this._set = set;\n }\n get value() {\n return this._get();\n }\n set value(newVal) {\n this._set(newVal);\n }\n}\nfunction customRef(factory) {\n return new CustomRefImpl(factory);\n}\nfunction toRefs(object) {\n if (!!(process.env.NODE_ENV !== \"production\") && !isProxy(object)) {\n console.warn(`toRefs() expects a reactive object but received a plain one.`);\n }\n const ret = isArray(object) ? new Array(object.length) : {};\n for (const key in object) {\n ret[key] = propertyToRef(object, key);\n }\n return ret;\n}\nclass ObjectRefImpl {\n constructor(_object, _key, _defaultValue) {\n this._object = _object;\n this._key = _key;\n this._defaultValue = _defaultValue;\n this.__v_isRef = true;\n }\n get value() {\n const val = this._object[this._key];\n return val === void 0 ? this._defaultValue : val;\n }\n set value(newVal) {\n this._object[this._key] = newVal;\n }\n get dep() {\n return getDepFromReactive(toRaw(this._object), this._key);\n }\n}\nclass GetterRefImpl {\n constructor(_getter) {\n this._getter = _getter;\n this.__v_isRef = true;\n this.__v_isReadonly = true;\n }\n get value() {\n return this._getter();\n }\n}\nfunction toRef(source, key, defaultValue) {\n if (isRef(source)) {\n return source;\n } else if (isFunction(source)) {\n return new GetterRefImpl(source);\n } else if (isObject(source) && arguments.length > 1) {\n return propertyToRef(source, key, defaultValue);\n } else {\n return ref(source);\n }\n}\nfunction propertyToRef(source, key, defaultValue) {\n const val = source[key];\n return isRef(val) ? val : new ObjectRefImpl(\n source,\n key,\n defaultValue\n );\n}\n\nclass ComputedRefImpl {\n constructor(getter, _setter, isReadonly, isSSR) {\n this._setter = _setter;\n this.dep = void 0;\n this.__v_isRef = true;\n this[\"__v_isReadonly\"] = false;\n this._dirty = true;\n this.effect = new ReactiveEffect(getter, () => {\n if (!this._dirty) {\n this._dirty = true;\n triggerRefValue(this);\n }\n });\n this.effect.computed = this;\n this.effect.active = this._cacheable = !isSSR;\n this[\"__v_isReadonly\"] = isReadonly;\n }\n get value() {\n const self = toRaw(this);\n trackRefValue(self);\n if (self._dirty || !self._cacheable) {\n self._dirty = false;\n self._value = self.effect.run();\n }\n return self._value;\n }\n set value(newValue) {\n this._setter(newValue);\n }\n}\nfunction computed(getterOrOptions, debugOptions, isSSR = false) {\n let getter;\n let setter;\n const onlyGetter = isFunction(getterOrOptions);\n if (onlyGetter) {\n getter = getterOrOptions;\n setter = !!(process.env.NODE_ENV !== \"production\") ? () => {\n console.warn(\"Write operation failed: computed value is readonly\");\n } : NOOP;\n } else {\n getter = getterOrOptions.get;\n setter = getterOrOptions.set;\n }\n const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);\n if (!!(process.env.NODE_ENV !== \"production\") && debugOptions && !isSSR) {\n cRef.effect.onTrack = debugOptions.onTrack;\n cRef.effect.onTrigger = debugOptions.onTrigger;\n }\n return cRef;\n}\n\nconst tick = /* @__PURE__ */ Promise.resolve();\nconst queue = [];\nlet queued = false;\nconst scheduler = (fn) => {\n queue.push(fn);\n if (!queued) {\n queued = true;\n tick.then(flush);\n }\n};\nconst flush = () => {\n for (let i = 0; i < queue.length; i++) {\n queue[i]();\n }\n queue.length = 0;\n queued = false;\n};\nclass DeferredComputedRefImpl {\n constructor(getter) {\n this.dep = void 0;\n this._dirty = true;\n this.__v_isRef = true;\n this[\"__v_isReadonly\"] = true;\n let compareTarget;\n let hasCompareTarget = false;\n let scheduled = false;\n this.effect = new ReactiveEffect(getter, (computedTrigger) => {\n if (this.dep) {\n if (computedTrigger) {\n compareTarget = this._value;\n hasCompareTarget = true;\n } else if (!scheduled) {\n const valueToCompare = hasCompareTarget ? compareTarget : this._value;\n scheduled = true;\n hasCompareTarget = false;\n scheduler(() => {\n if (this.effect.active && this._get() !== valueToCompare) {\n triggerRefValue(this);\n }\n scheduled = false;\n });\n }\n for (const e of this.dep) {\n if (e.computed instanceof DeferredComputedRefImpl) {\n e.scheduler(\n true\n /* computedTrigger */\n );\n }\n }\n }\n this._dirty = true;\n });\n this.effect.computed = this;\n }\n _get() {\n if (this._dirty) {\n this._dirty = false;\n return this._value = this.effect.run();\n }\n return this._value;\n }\n get value() {\n trackRefValue(this);\n return toRaw(this)._get();\n }\n}\nfunction deferredComputed(getter) {\n return new DeferredComputedRefImpl(getter);\n}\n\nexport { EffectScope, ITERATE_KEY, ReactiveEffect, computed, customRef, deferredComputed, effect, effectScope, enableTracking, getCurrentScope, isProxy, isReactive, isReadonly, isRef, isShallow, markRaw, onScopeDispose, pauseTracking, proxyRefs, reactive, readonly, ref, resetTracking, shallowReactive, shallowReadonly, shallowRef, stop, toRaw, toRef, toRefs, toValue, track, trigger, triggerRef, unref };\n","import { pauseTracking, resetTracking, isRef, toRaw, getCurrentScope, isShallow as isShallow$1, isReactive, ReactiveEffect, ref, shallowReadonly, track, reactive, shallowReactive, trigger, isProxy, proxyRefs, markRaw, EffectScope, computed as computed$1, isReadonly } from '@vue/reactivity';\nexport { EffectScope, ReactiveEffect, customRef, effect, effectScope, getCurrentScope, isProxy, isReactive, isReadonly, isRef, isShallow, markRaw, onScopeDispose, proxyRefs, reactive, readonly, ref, shallowReactive, shallowReadonly, shallowRef, stop, toRaw, toRef, toRefs, toValue, triggerRef, unref } from '@vue/reactivity';\nimport { isString, isFunction, isPromise, isArray, NOOP, getGlobalThis, extend, EMPTY_OBJ, toHandlerKey, looseToNumber, hyphenate, camelize, isObject, isOn, hasOwn, isModelListener, toNumber, hasChanged, remove, isSet, isMap, isPlainObject, isBuiltInDirective, invokeArrayFns, isRegExp, capitalize, isGloballyWhitelisted, NO, def, isReservedProp, EMPTY_ARR, toRawType, makeMap, normalizeClass, normalizeStyle } from '@vue/shared';\nexport { camelize, capitalize, normalizeClass, normalizeProps, normalizeStyle, toDisplayString, toHandlerKey } from '@vue/shared';\n\nconst stack = [];\nfunction pushWarningContext(vnode) {\n stack.push(vnode);\n}\nfunction popWarningContext() {\n stack.pop();\n}\nfunction warn(msg, ...args) {\n if (!!!(process.env.NODE_ENV !== \"production\"))\n return;\n pauseTracking();\n const instance = stack.length ? stack[stack.length - 1].component : null;\n const appWarnHandler = instance && instance.appContext.config.warnHandler;\n const trace = getComponentTrace();\n if (appWarnHandler) {\n callWithErrorHandling(\n appWarnHandler,\n instance,\n 11,\n [\n msg + args.join(\"\"),\n instance && instance.proxy,\n trace.map(\n ({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`\n ).join(\"\\n\"),\n trace\n ]\n );\n } else {\n const warnArgs = [`[Vue warn]: ${msg}`, ...args];\n if (trace.length && // avoid spamming console during tests\n true) {\n warnArgs.push(`\n`, ...formatTrace(trace));\n }\n console.warn(...warnArgs);\n }\n resetTracking();\n}\nfunction getComponentTrace() {\n let currentVNode = stack[stack.length - 1];\n if (!currentVNode) {\n return [];\n }\n const normalizedStack = [];\n while (currentVNode) {\n const last = normalizedStack[0];\n if (last && last.vnode === currentVNode) {\n last.recurseCount++;\n } else {\n normalizedStack.push({\n vnode: currentVNode,\n recurseCount: 0\n });\n }\n const parentInstance = currentVNode.component && currentVNode.component.parent;\n currentVNode = parentInstance && parentInstance.vnode;\n }\n return normalizedStack;\n}\nfunction formatTrace(trace) {\n const logs = [];\n trace.forEach((entry, i) => {\n logs.push(...i === 0 ? [] : [`\n`], ...formatTraceEntry(entry));\n });\n return logs;\n}\nfunction formatTraceEntry({ vnode, recurseCount }) {\n const postfix = recurseCount > 0 ? `... (${recurseCount} recursive calls)` : ``;\n const isRoot = vnode.component ? vnode.component.parent == null : false;\n const open = ` at <${formatComponentName(\n vnode.component,\n vnode.type,\n isRoot\n )}`;\n const close = `>` + postfix;\n return vnode.props ? [open, ...formatProps(vnode.props), close] : [open + close];\n}\nfunction formatProps(props) {\n const res = [];\n const keys = Object.keys(props);\n keys.slice(0, 3).forEach((key) => {\n res.push(...formatProp(key, props[key]));\n });\n if (keys.length > 3) {\n res.push(` ...`);\n }\n return res;\n}\nfunction formatProp(key, value, raw) {\n if (isString(value)) {\n value = JSON.stringify(value);\n return raw ? value : [`${key}=${value}`];\n } else if (typeof value === \"number\" || typeof value === \"boolean\" || value == null) {\n return raw ? value : [`${key}=${value}`];\n } else if (isRef(value)) {\n value = formatProp(key, toRaw(value.value), true);\n return raw ? value : [`${key}=Ref<`, value, `>`];\n } else if (isFunction(value)) {\n return [`${key}=fn${value.name ? `<${value.name}>` : ``}`];\n } else {\n value = toRaw(value);\n return raw ? value : [`${key}=`, value];\n }\n}\nfunction assertNumber(val, type) {\n if (!!!(process.env.NODE_ENV !== \"production\"))\n return;\n if (val === void 0) {\n return;\n } else if (typeof val !== \"number\") {\n warn(`${type} is not a valid number - got ${JSON.stringify(val)}.`);\n } else if (isNaN(val)) {\n warn(`${type} is NaN - the duration expression might be incorrect.`);\n }\n}\n\nconst ErrorTypeStrings = {\n [\"sp\"]: \"serverPrefetch hook\",\n [\"bc\"]: \"beforeCreate hook\",\n [\"c\"]: \"created hook\",\n [\"bm\"]: \"beforeMount hook\",\n [\"m\"]: \"mounted hook\",\n [\"bu\"]: \"beforeUpdate hook\",\n [\"u\"]: \"updated\",\n [\"bum\"]: \"beforeUnmount hook\",\n [\"um\"]: \"unmounted hook\",\n [\"a\"]: \"activated hook\",\n [\"da\"]: \"deactivated hook\",\n [\"ec\"]: \"errorCaptured hook\",\n [\"rtc\"]: \"renderTracked hook\",\n [\"rtg\"]: \"renderTriggered hook\",\n [0]: \"setup function\",\n [1]: \"render function\",\n [2]: \"watcher getter\",\n [3]: \"watcher callback\",\n [4]: \"watcher cleanup function\",\n [5]: \"native event handler\",\n [6]: \"component event handler\",\n [7]: \"vnode hook\",\n [8]: \"directive hook\",\n [9]: \"transition hook\",\n [10]: \"app errorHandler\",\n [11]: \"app warnHandler\",\n [12]: \"ref function\",\n [13]: \"async component loader\",\n [14]: \"scheduler flush. This is likely a Vue internals bug. Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/core\"\n};\nfunction callWithErrorHandling(fn, instance, type, args) {\n let res;\n try {\n res = args ? fn(...args) : fn();\n } catch (err) {\n handleError(err, instance, type);\n }\n return res;\n}\nfunction callWithAsyncErrorHandling(fn, instance, type, args) {\n if (isFunction(fn)) {\n const res = callWithErrorHandling(fn, instance, type, args);\n if (res && isPromise(res)) {\n res.catch((err) => {\n handleError(err, instance, type);\n });\n }\n return res;\n }\n const values = [];\n for (let i = 0; i < fn.length; i++) {\n values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));\n }\n return values;\n}\nfunction handleError(err, instance, type, throwInDev = true) {\n const contextVNode = instance ? instance.vnode : null;\n if (instance) {\n let cur = instance.parent;\n const exposedInstance = instance.proxy;\n const errorInfo = !!(process.env.NODE_ENV !== \"production\") ? ErrorTypeStrings[type] : type;\n while (cur) {\n const errorCapturedHooks = cur.ec;\n if (errorCapturedHooks) {\n for (let i = 0; i < errorCapturedHooks.length; i++) {\n if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {\n return;\n }\n }\n }\n cur = cur.parent;\n }\n const appErrorHandler = instance.appContext.config.errorHandler;\n if (appErrorHandler) {\n callWithErrorHandling(\n appErrorHandler,\n null,\n 10,\n [err, exposedInstance, errorInfo]\n );\n return;\n }\n }\n logError(err, type, contextVNode, throwInDev);\n}\nfunction logError(err, type, contextVNode, throwInDev = true) {\n if (!!(process.env.NODE_ENV !== \"production\")) {\n const info = ErrorTypeStrings[type];\n if (contextVNode) {\n pushWarningContext(contextVNode);\n }\n warn(`Unhandled error${info ? ` during execution of ${info}` : ``}`);\n if (contextVNode) {\n popWarningContext();\n }\n if (throwInDev) {\n throw err;\n } else {\n console.error(err);\n }\n } else {\n console.error(err);\n }\n}\n\nlet isFlushing = false;\nlet isFlushPending = false;\nconst queue = [];\nlet flushIndex = 0;\nconst pendingPostFlushCbs = [];\nlet activePostFlushCbs = null;\nlet postFlushIndex = 0;\nconst resolvedPromise = /* @__PURE__ */ Promise.resolve();\nlet currentFlushPromise = null;\nconst RECURSION_LIMIT = 100;\nfunction nextTick(fn) {\n const p = currentFlushPromise || resolvedPromise;\n return fn ? p.then(this ? fn.bind(this) : fn) : p;\n}\nfunction findInsertionIndex(id) {\n let start = flushIndex + 1;\n let end = queue.length;\n while (start < end) {\n const middle = start + end >>> 1;\n const middleJobId = getId(queue[middle]);\n middleJobId < id ? start = middle + 1 : end = middle;\n }\n return start;\n}\nfunction queueJob(job) {\n if (!queue.length || !queue.includes(\n job,\n isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex\n )) {\n if (job.id == null) {\n queue.push(job);\n } else {\n queue.splice(findInsertionIndex(job.id), 0, job);\n }\n queueFlush();\n }\n}\nfunction queueFlush() {\n if (!isFlushing && !isFlushPending) {\n isFlushPending = true;\n currentFlushPromise = resolvedPromise.then(flushJobs);\n }\n}\nfunction invalidateJob(job) {\n const i = queue.indexOf(job);\n if (i > flushIndex) {\n queue.splice(i, 1);\n }\n}\nfunction queuePostFlushCb(cb) {\n if (!isArray(cb)) {\n if (!activePostFlushCbs || !activePostFlushCbs.includes(\n cb,\n cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex\n )) {\n pendingPostFlushCbs.push(cb);\n }\n } else {\n pendingPostFlushCbs.push(...cb);\n }\n queueFlush();\n}\nfunction flushPreFlushCbs(seen, i = isFlushing ? flushIndex + 1 : 0) {\n if (!!(process.env.NODE_ENV !== \"production\")) {\n seen = seen || /* @__PURE__ */ new Map();\n }\n for (; i < queue.length; i++) {\n const cb = queue[i];\n if (cb && cb.pre) {\n if (!!(process.env.NODE_ENV !== \"production\") && checkRecursiveUpdates(seen, cb)) {\n continue;\n }\n queue.splice(i, 1);\n i--;\n cb();\n }\n }\n}\nfunction flushPostFlushCbs(seen) {\n if (pendingPostFlushCbs.length) {\n const deduped = [...new Set(pendingPostFlushCbs)];\n pendingPostFlushCbs.length = 0;\n if (activePostFlushCbs) {\n activePostFlushCbs.push(...deduped);\n return;\n }\n activePostFlushCbs = deduped;\n if (!!(process.env.NODE_ENV !== \"production\")) {\n seen = seen || /* @__PURE__ */ new Map();\n }\n activePostFlushCbs.sort((a, b) => getId(a) - getId(b));\n for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {\n if (!!(process.env.NODE_ENV !== \"production\") && checkRecursiveUpdates(seen, activePostFlushCbs[postFlushIndex])) {\n continue;\n }\n activePostFlushCbs[postFlushIndex]();\n }\n activePostFlushCbs = null;\n postFlushIndex = 0;\n }\n}\nconst getId = (job) => job.id == null ? Infinity : job.id;\nconst comparator = (a, b) => {\n const diff = getId(a) - getId(b);\n if (diff === 0) {\n if (a.pre && !b.pre)\n return -1;\n if (b.pre && !a.pre)\n return 1;\n }\n return diff;\n};\nfunction flushJobs(seen) {\n isFlushPending = false;\n isFlushing = true;\n if (!!(process.env.NODE_ENV !== \"production\")) {\n seen = seen || /* @__PURE__ */ new Map();\n }\n queue.sort(comparator);\n const check = !!(process.env.NODE_ENV !== \"production\") ? (job) => checkRecursiveUpdates(seen, job) : NOOP;\n try {\n for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {\n const job = queue[flushIndex];\n if (job && job.active !== false) {\n if (!!(process.env.NODE_ENV !== \"production\") && check(job)) {\n continue;\n }\n callWithErrorHandling(job, null, 14);\n }\n }\n } finally {\n flushIndex = 0;\n queue.length = 0;\n flushPostFlushCbs(seen);\n isFlushing = false;\n currentFlushPromise = null;\n if (queue.length || pendingPostFlushCbs.length) {\n flushJobs(seen);\n }\n }\n}\nfunction checkRecursiveUpdates(seen, fn) {\n if (!seen.has(fn)) {\n seen.set(fn, 1);\n } else {\n const count = seen.get(fn);\n if (count > RECURSION_LIMIT) {\n const instance = fn.ownerInstance;\n const componentName = instance && getComponentName(instance.type);\n warn(\n `Maximum recursive updates exceeded${componentName ? ` in component <${componentName}>` : ``}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`\n );\n return true;\n } else {\n seen.set(fn, count + 1);\n }\n }\n}\n\nlet isHmrUpdating = false;\nconst hmrDirtyComponents = /* @__PURE__ */ new Set();\nif (!!(process.env.NODE_ENV !== \"production\")) {\n getGlobalThis().__VUE_HMR_RUNTIME__ = {\n createRecord: tryWrap(createRecord),\n rerender: tryWrap(rerender),\n reload: tryWrap(reload)\n };\n}\nconst map = /* @__PURE__ */ new Map();\nfunction registerHMR(instance) {\n const id = instance.type.__hmrId;\n let record = map.get(id);\n if (!record) {\n createRecord(id, instance.type);\n record = map.get(id);\n }\n record.instances.add(instance);\n}\nfunction unregisterHMR(instance) {\n map.get(instance.type.__hmrId).instances.delete(instance);\n}\nfunction createRecord(id, initialDef) {\n if (map.has(id)) {\n return false;\n }\n map.set(id, {\n initialDef: normalizeClassComponent(initialDef),\n instances: /* @__PURE__ */ new Set()\n });\n return true;\n}\nfunction normalizeClassComponent(component) {\n return isClassComponent(component) ? component.__vccOpts : component;\n}\nfunction rerender(id, newRender) {\n const record = map.get(id);\n if (!record) {\n return;\n }\n record.initialDef.render = newRender;\n [...record.instances].forEach((instance) => {\n if (newRender) {\n instance.render = newRender;\n normalizeClassComponent(instance.type).render = newRender;\n }\n instance.renderCache = [];\n isHmrUpdating = true;\n instance.update();\n isHmrUpdating = false;\n });\n}\nfunction reload(id, newComp) {\n const record = map.get(id);\n if (!record)\n return;\n newComp = normalizeClassComponent(newComp);\n updateComponentDef(record.initialDef, newComp);\n const instances = [...record.instances];\n for (const instance of instances) {\n const oldComp = normalizeClassComponent(instance.type);\n if (!hmrDirtyComponents.has(oldComp)) {\n if (oldComp !== record.initialDef) {\n updateComponentDef(oldComp, newComp);\n }\n hmrDirtyComponents.add(oldComp);\n }\n instance.appContext.propsCache.delete(instance.type);\n instance.appContext.emitsCache.delete(instance.type);\n instance.appContext.optionsCache.delete(instance.type);\n if (instance.ceReload) {\n hmrDirtyComponents.add(oldComp);\n instance.ceReload(newComp.styles);\n hmrDirtyComponents.delete(oldComp);\n } else if (instance.parent) {\n queueJob(instance.parent.update);\n } else if (instance.appContext.reload) {\n instance.appContext.reload();\n } else if (typeof window !== \"undefined\") {\n window.location.reload();\n } else {\n console.warn(\n \"[HMR] Root or manually mounted instance modified. Full reload required.\"\n );\n }\n }\n queuePostFlushCb(() => {\n for (const instance of instances) {\n hmrDirtyComponents.delete(\n normalizeClassComponent(instance.type)\n );\n }\n });\n}\nfunction updateComponentDef(oldComp, newComp) {\n extend(oldComp, newComp);\n for (const key in oldComp) {\n if (key !== \"__file\" && !(key in newComp)) {\n delete oldComp[key];\n }\n }\n}\nfunction tryWrap(fn) {\n return (id, arg) => {\n try {\n return fn(id, arg);\n } catch (e) {\n console.error(e);\n console.warn(\n `[HMR] Something went wrong during Vue component hot-reload. Full reload required.`\n );\n }\n };\n}\n\nlet devtools;\nlet buffer = [];\nlet devtoolsNotInstalled = false;\nfunction emit$1(event, ...args) {\n if (devtools) {\n devtools.emit(event, ...args);\n } else if (!devtoolsNotInstalled) {\n buffer.push({ event, args });\n }\n}\nfunction setDevtoolsHook(hook, target) {\n var _a, _b;\n devtools = hook;\n if (devtools) {\n devtools.enabled = true;\n buffer.forEach(({ event, args }) => devtools.emit(event, ...args));\n buffer = [];\n } else if (\n // handle late devtools injection - only do this if we are in an actual\n // browser environment to avoid the timer handle stalling test runner exit\n // (#4815)\n typeof window !== \"undefined\" && // some envs mock window but not fully\n window.HTMLElement && // also exclude jsdom\n !((_b = (_a = window.navigator) == null ? void 0 : _a.userAgent) == null ? void 0 : _b.includes(\"jsdom\"))\n ) {\n const replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || [];\n replay.push((newHook) => {\n setDevtoolsHook(newHook, target);\n });\n setTimeout(() => {\n if (!devtools) {\n target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null;\n devtoolsNotInstalled = true;\n buffer = [];\n }\n }, 3e3);\n } else {\n devtoolsNotInstalled = true;\n buffer = [];\n }\n}\nfunction devtoolsInitApp(app, version) {\n emit$1(\"app:init\" /* APP_INIT */, app, version, {\n Fragment,\n Text,\n Comment,\n Static\n });\n}\nfunction devtoolsUnmountApp(app) {\n emit$1(\"app:unmount\" /* APP_UNMOUNT */, app);\n}\nconst devtoolsComponentAdded = /* @__PURE__ */ createDevtoolsComponentHook(\n \"component:added\" /* COMPONENT_ADDED */\n);\nconst devtoolsComponentUpdated = /* @__PURE__ */ createDevtoolsComponentHook(\"component:updated\" /* COMPONENT_UPDATED */);\nconst _devtoolsComponentRemoved = /* @__PURE__ */ createDevtoolsComponentHook(\n \"component:removed\" /* COMPONENT_REMOVED */\n);\nconst devtoolsComponentRemoved = (component) => {\n if (devtools && typeof devtools.cleanupBuffer === \"function\" && // remove the component if it wasn't buffered\n !devtools.cleanupBuffer(component)) {\n _devtoolsComponentRemoved(component);\n }\n};\nfunction createDevtoolsComponentHook(hook) {\n return (component) => {\n emit$1(\n hook,\n component.appContext.app,\n component.uid,\n component.parent ? component.parent.uid : void 0,\n component\n );\n };\n}\nconst devtoolsPerfStart = /* @__PURE__ */ createDevtoolsPerformanceHook(\n \"perf:start\" /* PERFORMANCE_START */\n);\nconst devtoolsPerfEnd = /* @__PURE__ */ createDevtoolsPerformanceHook(\n \"perf:end\" /* PERFORMANCE_END */\n);\nfunction createDevtoolsPerformanceHook(hook) {\n return (component, type, time) => {\n emit$1(hook, component.appContext.app, component.uid, component, type, time);\n };\n}\nfunction devtoolsComponentEmit(component, event, params) {\n emit$1(\n \"component:emit\" /* COMPONENT_EMIT */,\n component.appContext.app,\n component,\n event,\n params\n );\n}\n\nfunction emit(instance, event, ...rawArgs) {\n if (instance.isUnmounted)\n return;\n const props = instance.vnode.props || EMPTY_OBJ;\n if (!!(process.env.NODE_ENV !== \"production\")) {\n const {\n emitsOptions,\n propsOptions: [propsOptions]\n } = instance;\n if (emitsOptions) {\n if (!(event in emitsOptions) && true) {\n if (!propsOptions || !(toHandlerKey(event) in propsOptions)) {\n warn(\n `Component emitted event \"${event}\" but it is neither declared in the emits option nor as an \"${toHandlerKey(event)}\" prop.`\n );\n }\n } else {\n const validator = emitsOptions[event];\n if (isFunction(validator)) {\n const isValid = validator(...rawArgs);\n if (!isValid) {\n warn(\n `Invalid event arguments: event validation failed for event \"${event}\".`\n );\n }\n }\n }\n }\n }\n let args = rawArgs;\n const isModelListener = event.startsWith(\"update:\");\n const modelArg = isModelListener && event.slice(7);\n if (modelArg && modelArg in props) {\n const modifiersKey = `${modelArg === \"modelValue\" ? \"model\" : modelArg}Modifiers`;\n const { number, trim } = props[modifiersKey] || EMPTY_OBJ;\n if (trim) {\n args = rawArgs.map((a) => isString(a) ? a.trim() : a);\n }\n if (number) {\n args = rawArgs.map(looseToNumber);\n }\n }\n if (!!(process.env.NODE_ENV !== \"production\") || __VUE_PROD_DEVTOOLS__) {\n devtoolsComponentEmit(instance, event, args);\n }\n if (!!(process.env.NODE_ENV !== \"production\")) {\n const lowerCaseEvent = event.toLowerCase();\n if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) {\n warn(\n `Event \"${lowerCaseEvent}\" is emitted in component ${formatComponentName(\n instance,\n instance.type\n )} but the handler is registered for \"${event}\". Note that HTML attributes are case-insensitive and you cannot use v-on to listen to camelCase events when using in-DOM templates. You should probably use \"${hyphenate(event)}\" instead of \"${event}\".`\n );\n }\n }\n let handlerName;\n let handler = props[handlerName = toHandlerKey(event)] || // also try camelCase event handler (#2249)\n props[handlerName = toHandlerKey(camelize(event))];\n if (!handler && isModelListener) {\n handler = props[handlerName = toHandlerKey(hyphenate(event))];\n }\n if (handler) {\n callWithAsyncErrorHandling(\n handler,\n instance,\n 6,\n args\n );\n }\n const onceHandler = props[handlerName + `Once`];\n if (onceHandler) {\n if (!instance.emitted) {\n instance.emitted = {};\n } else if (instance.emitted[handlerName]) {\n return;\n }\n instance.emitted[handlerName] = true;\n callWithAsyncErrorHandling(\n onceHandler,\n instance,\n 6,\n args\n );\n }\n}\nfunction normalizeEmitsOptions(comp, appContext, asMixin = false) {\n const cache = appContext.emitsCache;\n const cached = cache.get(comp);\n if (cached !== void 0) {\n return cached;\n }\n const raw = comp.emits;\n let normalized = {};\n let hasExtends = false;\n if (__VUE_OPTIONS_API__ && !isFunction(comp)) {\n const extendEmits = (raw2) => {\n const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true);\n if (normalizedFromExtend) {\n hasExtends = true;\n extend(normalized, normalizedFromExtend);\n }\n };\n if (!asMixin && appContext.mixins.length) {\n appContext.mixins.forEach(extendEmits);\n }\n if (comp.extends) {\n extendEmits(comp.extends);\n }\n if (comp.mixins) {\n comp.mixins.forEach(extendEmits);\n }\n }\n if (!raw && !hasExtends) {\n if (isObject(comp)) {\n cache.set(comp, null);\n }\n return null;\n }\n if (isArray(raw)) {\n raw.forEach((key) => normalized[key] = null);\n } else {\n extend(normalized, raw);\n }\n if (isObject(comp)) {\n cache.set(comp, normalized);\n }\n return normalized;\n}\nfunction isEmitListener(options, key) {\n if (!options || !isOn(key)) {\n return false;\n }\n key = key.slice(2).replace(/Once$/, \"\");\n return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);\n}\n\nlet currentRenderingInstance = null;\nlet currentScopeId = null;\nfunction setCurrentRenderingInstance(instance) {\n const prev = currentRenderingInstance;\n currentRenderingInstance = instance;\n currentScopeId = instance && instance.type.__scopeId || null;\n return prev;\n}\nfunction pushScopeId(id) {\n currentScopeId = id;\n}\nfunction popScopeId() {\n currentScopeId = null;\n}\nconst withScopeId = (_id) => withCtx;\nfunction withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {\n if (!ctx)\n return fn;\n if (fn._n) {\n return fn;\n }\n const renderFnWithContext = (...args) => {\n if (renderFnWithContext._d) {\n setBlockTracking(-1);\n }\n const prevInstance = setCurrentRenderingInstance(ctx);\n let res;\n try {\n res = fn(...args);\n } finally {\n setCurrentRenderingInstance(prevInstance);\n if (renderFnWithContext._d) {\n setBlockTracking(1);\n }\n }\n if (!!(process.env.NODE_ENV !== \"production\") || __VUE_PROD_DEVTOOLS__) {\n devtoolsComponentUpdated(ctx);\n }\n return res;\n };\n renderFnWithContext._n = true;\n renderFnWithContext._c = true;\n renderFnWithContext._d = true;\n return renderFnWithContext;\n}\n\nlet accessedAttrs = false;\nfunction markAttrsAccessed() {\n accessedAttrs = true;\n}\nfunction renderComponentRoot(instance) {\n const {\n type: Component,\n vnode,\n proxy,\n withProxy,\n props,\n propsOptions: [propsOptions],\n slots,\n attrs,\n emit,\n render,\n renderCache,\n data,\n setupState,\n ctx,\n inheritAttrs\n } = instance;\n let result;\n let fallthroughAttrs;\n const prev = setCurrentRenderingInstance(instance);\n if (!!(process.env.NODE_ENV !== \"production\")) {\n accessedAttrs = false;\n }\n try {\n if (vnode.shapeFlag & 4) {\n const proxyToUse = withProxy || proxy;\n result = normalizeVNode(\n render.call(\n proxyToUse,\n proxyToUse,\n renderCache,\n props,\n setupState,\n data,\n ctx\n )\n );\n fallthroughAttrs = attrs;\n } else {\n const render2 = Component;\n if (!!(process.env.NODE_ENV !== \"production\") && attrs === props) {\n markAttrsAccessed();\n }\n result = normalizeVNode(\n render2.length > 1 ? render2(\n props,\n !!(process.env.NODE_ENV !== \"production\") ? {\n get attrs() {\n markAttrsAccessed();\n return attrs;\n },\n slots,\n emit\n } : { attrs, slots, emit }\n ) : render2(\n props,\n null\n /* we know it doesn't need it */\n )\n );\n fallthroughAttrs = Component.props ? attrs : getFunctionalFallthrough(attrs);\n }\n } catch (err) {\n blockStack.length = 0;\n handleError(err, instance, 1);\n result = createVNode(Comment);\n }\n let root = result;\n let setRoot = void 0;\n if (!!(process.env.NODE_ENV !== \"production\") && result.patchFlag > 0 && result.patchFlag & 2048) {\n [root, setRoot] = getChildRoot(result);\n }\n if (fallthroughAttrs && inheritAttrs !== false) {\n const keys = Object.keys(fallthroughAttrs);\n const { shapeFlag } = root;\n if (keys.length) {\n if (shapeFlag & (1 | 6)) {\n if (propsOptions && keys.some(isModelListener)) {\n fallthroughAttrs = filterModelListeners(\n fallthroughAttrs,\n propsOptions\n );\n }\n root = cloneVNode(root, fallthroughAttrs);\n } else if (!!(process.env.NODE_ENV !== \"production\") && !accessedAttrs && root.type !== Comment) {\n const allAttrs = Object.keys(attrs);\n const eventAttrs = [];\n const extraAttrs = [];\n for (let i = 0, l = allAttrs.length; i < l; i++) {\n const key = allAttrs[i];\n if (isOn(key)) {\n if (!isModelListener(key)) {\n eventAttrs.push(key[2].toLowerCase() + key.slice(3));\n }\n } else {\n extraAttrs.push(key);\n }\n }\n if (extraAttrs.length) {\n warn(\n `Extraneous non-props attributes (${extraAttrs.join(\", \")}) were passed to component but could not be automatically inherited because component renders fragment or text root nodes.`\n );\n }\n if (eventAttrs.length) {\n warn(\n `Extraneous non-emits event listeners (${eventAttrs.join(\", \")}) were passed to component but could not be automatically inherited because component renders fragment or text root nodes. If the listener is intended to be a component custom event listener only, declare it using the \"emits\" option.`\n );\n }\n }\n }\n }\n if (vnode.dirs) {\n if (!!(process.env.NODE_ENV !== \"production\") && !isElementRoot(root)) {\n warn(\n `Runtime directive used on component with non-element root node. The directives will not function as intended.`\n );\n }\n root = cloneVNode(root);\n root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;\n }\n if (vnode.transition) {\n if (!!(process.env.NODE_ENV !== \"production\") && !isElementRoot(root)) {\n warn(\n `Component inside renders non-element root node that cannot be animated.`\n );\n }\n root.transition = vnode.transition;\n }\n if (!!(process.env.NODE_ENV !== \"production\") && setRoot) {\n setRoot(root);\n } else {\n result = root;\n }\n setCurrentRenderingInstance(prev);\n return result;\n}\nconst getChildRoot = (vnode) => {\n const rawChildren = vnode.children;\n const dynamicChildren = vnode.dynamicChildren;\n const childRoot = filterSingleRoot(rawChildren);\n if (!childRoot) {\n return [vnode, void 0];\n }\n const index = rawChildren.indexOf(childRoot);\n const dynamicIndex = dynamicChildren ? dynamicChildren.indexOf(childRoot) : -1;\n const setRoot = (updatedRoot) => {\n rawChildren[index] = updatedRoot;\n if (dynamicChildren) {\n if (dynamicIndex > -1) {\n dynamicChildren[dynamicIndex] = updatedRoot;\n } else if (updatedRoot.patchFlag > 0) {\n vnode.dynamicChildren = [...dynamicChildren, updatedRoot];\n }\n }\n };\n return [normalizeVNode(childRoot), setRoot];\n};\nfunction filterSingleRoot(children) {\n let singleRoot;\n for (let i = 0; i < children.length; i++) {\n const child = children[i];\n if (isVNode(child)) {\n if (child.type !== Comment || child.children === \"v-if\") {\n if (singleRoot) {\n return;\n } else {\n singleRoot = child;\n }\n }\n } else {\n return;\n }\n }\n return singleRoot;\n}\nconst getFunctionalFallthrough = (attrs) => {\n let res;\n for (const key in attrs) {\n if (key === \"class\" || key === \"style\" || isOn(key)) {\n (res || (res = {}))[key] = attrs[key];\n }\n }\n return res;\n};\nconst filterModelListeners = (attrs, props) => {\n const res = {};\n for (const key in attrs) {\n if (!isModelListener(key) || !(key.slice(9) in props)) {\n res[key] = attrs[key];\n }\n }\n return res;\n};\nconst isElementRoot = (vnode) => {\n return vnode.shapeFlag & (6 | 1) || vnode.type === Comment;\n};\nfunction shouldUpdateComponent(prevVNode, nextVNode, optimized) {\n const { props: prevProps, children: prevChildren, component } = prevVNode;\n const { props: nextProps, children: nextChildren, patchFlag } = nextVNode;\n const emits = component.emitsOptions;\n if (!!(process.env.NODE_ENV !== \"production\") && (prevChildren || nextChildren) && isHmrUpdating) {\n return true;\n }\n if (nextVNode.dirs || nextVNode.transition) {\n return true;\n }\n if (optimized && patchFlag >= 0) {\n if (patchFlag & 1024) {\n return true;\n }\n if (patchFlag & 16) {\n if (!prevProps) {\n return !!nextProps;\n }\n return hasPropsChanged(prevProps, nextProps, emits);\n } else if (patchFlag & 8) {\n const dynamicProps = nextVNode.dynamicProps;\n for (let i = 0; i < dynamicProps.length; i++) {\n const key = dynamicProps[i];\n if (nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)) {\n return true;\n }\n }\n }\n } else {\n if (prevChildren || nextChildren) {\n if (!nextChildren || !nextChildren.$stable) {\n return true;\n }\n }\n if (prevProps === nextProps) {\n return false;\n }\n if (!prevProps) {\n return !!nextProps;\n }\n if (!nextProps) {\n return true;\n }\n return hasPropsChanged(prevProps, nextProps, emits);\n }\n return false;\n}\nfunction hasPropsChanged(prevProps, nextProps, emitsOptions) {\n const nextKeys = Object.keys(nextProps);\n if (nextKeys.length !== Object.keys(prevProps).length) {\n return true;\n }\n for (let i = 0; i < nextKeys.length; i++) {\n const key = nextKeys[i];\n if (nextProps[key] !== prevProps[key] && !isEmitListener(emitsOptions, key)) {\n return true;\n }\n }\n return false;\n}\nfunction updateHOCHostEl({ vnode, parent }, el) {\n while (parent && parent.subTree === vnode) {\n (vnode = parent.vnode).el = el;\n parent = parent.parent;\n }\n}\n\nconst isSuspense = (type) => type.__isSuspense;\nconst SuspenseImpl = {\n name: \"Suspense\",\n // In order to make Suspense tree-shakable, we need to avoid importing it\n // directly in the renderer. The renderer checks for the __isSuspense flag\n // on a vnode's type and calls the `process` method, passing in renderer\n // internals.\n __isSuspense: true,\n process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, rendererInternals) {\n if (n1 == null) {\n mountSuspense(\n n2,\n container,\n anchor,\n parentComponent,\n parentSuspense,\n isSVG,\n slotScopeIds,\n optimized,\n rendererInternals\n );\n } else {\n patchSuspense(\n n1,\n n2,\n container,\n anchor,\n parentComponent,\n isSVG,\n slotScopeIds,\n optimized,\n rendererInternals\n );\n }\n },\n hydrate: hydrateSuspense,\n create: createSuspenseBoundary,\n normalize: normalizeSuspenseChildren\n};\nconst Suspense = SuspenseImpl ;\nfunction triggerEvent(vnode, name) {\n const eventListener = vnode.props && vnode.props[name];\n if (isFunction(eventListener)) {\n eventListener();\n }\n}\nfunction mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, rendererInternals) {\n const {\n p: patch,\n o: { createElement }\n } = rendererInternals;\n const hiddenContainer = createElement(\"div\");\n const suspense = vnode.suspense = createSuspenseBoundary(\n vnode,\n parentSuspense,\n parentComponent,\n container,\n hiddenContainer,\n anchor,\n isSVG,\n slotScopeIds,\n optimized,\n rendererInternals\n );\n patch(\n null,\n suspense.pendingBranch = vnode.ssContent,\n hiddenContainer,\n null,\n parentComponent,\n suspense,\n isSVG,\n slotScopeIds\n );\n if (suspense.deps > 0) {\n triggerEvent(vnode, \"onPending\");\n triggerEvent(vnode, \"onFallback\");\n patch(\n null,\n vnode.ssFallback,\n container,\n anchor,\n parentComponent,\n null,\n // fallback tree will not have suspense context\n isSVG,\n slotScopeIds\n );\n setActiveBranch(suspense, vnode.ssFallback);\n } else {\n suspense.resolve(false, true);\n }\n}\nfunction patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotScopeIds, optimized, { p: patch, um: unmount, o: { createElement } }) {\n const suspense = n2.suspense = n1.suspense;\n suspense.vnode = n2;\n n2.el = n1.el;\n const newBranch = n2.ssContent;\n const newFallback = n2.ssFallback;\n const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense;\n if (pendingBranch) {\n suspense.pendingBranch = newBranch;\n if (isSameVNodeType(newBranch, pendingBranch)) {\n patch(\n pendingBranch,\n newBranch,\n suspense.hiddenContainer,\n null,\n parentComponent,\n suspense,\n isSVG,\n slotScopeIds,\n optimized\n );\n if (suspense.deps <= 0) {\n suspense.resolve();\n } else if (isInFallback) {\n patch(\n activeBranch,\n newFallback,\n container,\n anchor,\n parentComponent,\n null,\n // fallback tree will not have suspense context\n isSVG,\n slotScopeIds,\n optimized\n );\n setActiveBranch(suspense, newFallback);\n }\n } else {\n suspense.pendingId++;\n if (isHydrating) {\n suspense.isHydrating = false;\n suspense.activeBranch = pendingBranch;\n } else {\n unmount(pendingBranch, parentComponent, suspense);\n }\n suspense.deps = 0;\n suspense.effects.length = 0;\n suspense.hiddenContainer = createElement(\"div\");\n if (isInFallback) {\n patch(\n null,\n newBranch,\n suspense.hiddenContainer,\n null,\n parentComponent,\n suspense,\n isSVG,\n slotScopeIds,\n optimized\n );\n if (suspense.deps <= 0) {\n suspense.resolve();\n } else {\n patch(\n activeBranch,\n newFallback,\n container,\n anchor,\n parentComponent,\n null,\n // fallback tree will not have suspense context\n isSVG,\n slotScopeIds,\n optimized\n );\n setActiveBranch(suspense, newFallback);\n }\n } else if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {\n patch(\n activeBranch,\n newBranch,\n container,\n anchor,\n parentComponent,\n suspense,\n isSVG,\n slotScopeIds,\n optimized\n );\n suspense.resolve(true);\n } else {\n patch(\n null,\n newBranch,\n suspense.hiddenContainer,\n null,\n parentComponent,\n suspense,\n isSVG,\n slotScopeIds,\n optimized\n );\n if (suspense.deps <= 0) {\n suspense.resolve();\n }\n }\n }\n } else {\n if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {\n patch(\n activeBranch,\n newBranch,\n container,\n anchor,\n parentComponent,\n suspense,\n isSVG,\n slotScopeIds,\n optimized\n );\n setActiveBranch(suspense, newBranch);\n } else {\n triggerEvent(n2, \"onPending\");\n suspense.pendingBranch = newBranch;\n suspense.pendingId++;\n patch(\n null,\n newBranch,\n suspense.hiddenContainer,\n null,\n parentComponent,\n suspense,\n isSVG,\n slotScopeIds,\n optimized\n );\n if (suspense.deps <= 0) {\n suspense.resolve();\n } else {\n const { timeout, pendingId } = suspense;\n if (timeout > 0) {\n setTimeout(() => {\n if (suspense.pendingId === pendingId) {\n suspense.fallback(newFallback);\n }\n }, timeout);\n } else if (timeout === 0) {\n suspense.fallback(newFallback);\n }\n }\n }\n }\n}\nlet hasWarned = false;\nfunction createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, isSVG, slotScopeIds, optimized, rendererInternals, isHydrating = false) {\n if (!!(process.env.NODE_ENV !== \"production\") && true && !hasWarned) {\n hasWarned = true;\n console[console.info ? \"info\" : \"log\"](\n ` is an experimental feature and its API will likely change.`\n );\n }\n const {\n p: patch,\n m: move,\n um: unmount,\n n: next,\n o: { parentNode, remove }\n } = rendererInternals;\n let parentSuspenseId;\n const isSuspensible = isVNodeSuspensible(vnode);\n if (isSuspensible) {\n if (parentSuspense == null ? void 0 : parentSuspense.pendingBranch) {\n parentSuspenseId = parentSuspense.pendingId;\n parentSuspense.deps++;\n }\n }\n const timeout = vnode.props ? toNumber(vnode.props.timeout) : void 0;\n if (!!(process.env.NODE_ENV !== \"production\")) {\n assertNumber(timeout, `Suspense timeout`);\n }\n const suspense = {\n vnode,\n parent: parentSuspense,\n parentComponent,\n isSVG,\n container,\n hiddenContainer,\n anchor,\n deps: 0,\n pendingId: 0,\n timeout: typeof timeout === \"number\" ? timeout : -1,\n activeBranch: null,\n pendingBranch: null,\n isInFallback: true,\n isHydrating,\n isUnmounted: false,\n effects: [],\n resolve(resume = false, sync = false) {\n if (!!(process.env.NODE_ENV !== \"production\")) {\n if (!resume && !suspense.pendingBranch) {\n throw new Error(\n `suspense.resolve() is called without a pending branch.`\n );\n }\n if (suspense.isUnmounted) {\n throw new Error(\n `suspense.resolve() is called on an already unmounted suspense boundary.`\n );\n }\n }\n const {\n vnode: vnode2,\n activeBranch,\n pendingBranch,\n pendingId,\n effects,\n parentComponent: parentComponent2,\n container: container2\n } = suspense;\n if (suspense.isHydrating) {\n suspense.isHydrating = false;\n } else if (!resume) {\n const delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === \"out-in\";\n if (delayEnter) {\n activeBranch.transition.afterLeave = () => {\n if (pendingId === suspense.pendingId) {\n move(pendingBranch, container2, anchor2, 0);\n }\n };\n }\n let { anchor: anchor2 } = suspense;\n if (activeBranch) {\n anchor2 = next(activeBranch);\n unmount(activeBranch, parentComponent2, suspense, true);\n }\n if (!delayEnter) {\n move(pendingBranch, container2, anchor2, 0);\n }\n }\n setActiveBranch(suspense, pendingBranch);\n suspense.pendingBranch = null;\n suspense.isInFallback = false;\n let parent = suspense.parent;\n let hasUnresolvedAncestor = false;\n while (parent) {\n if (parent.pendingBranch) {\n parent.effects.push(...effects);\n hasUnresolvedAncestor = true;\n break;\n }\n parent = parent.parent;\n }\n if (!hasUnresolvedAncestor) {\n queuePostFlushCb(effects);\n }\n suspense.effects = [];\n if (isSuspensible) {\n if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {\n parentSuspense.deps--;\n if (parentSuspense.deps === 0 && !sync) {\n parentSuspense.resolve();\n }\n }\n }\n triggerEvent(vnode2, \"onResolve\");\n },\n fallback(fallbackVNode) {\n if (!suspense.pendingBranch) {\n return;\n }\n const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, isSVG: isSVG2 } = suspense;\n triggerEvent(vnode2, \"onFallback\");\n const anchor2 = next(activeBranch);\n const mountFallback = () => {\n if (!suspense.isInFallback) {\n return;\n }\n patch(\n null,\n fallbackVNode,\n container2,\n anchor2,\n parentComponent2,\n null,\n // fallback tree will not have suspense context\n isSVG2,\n slotScopeIds,\n optimized\n );\n setActiveBranch(suspense, fallbackVNode);\n };\n const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === \"out-in\";\n if (delayEnter) {\n activeBranch.transition.afterLeave = mountFallback;\n }\n suspense.isInFallback = true;\n unmount(\n activeBranch,\n parentComponent2,\n null,\n // no suspense so unmount hooks fire now\n true\n // shouldRemove\n );\n if (!delayEnter) {\n mountFallback();\n }\n },\n move(container2, anchor2, type) {\n suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type);\n suspense.container = container2;\n },\n next() {\n return suspense.activeBranch && next(suspense.activeBranch);\n },\n registerDep(instance, setupRenderEffect) {\n const isInPendingSuspense = !!suspense.pendingBranch;\n if (isInPendingSuspense) {\n suspense.deps++;\n }\n const hydratedEl = instance.vnode.el;\n instance.asyncDep.catch((err) => {\n handleError(err, instance, 0);\n }).then((asyncSetupResult) => {\n if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) {\n return;\n }\n instance.asyncResolved = true;\n const { vnode: vnode2 } = instance;\n if (!!(process.env.NODE_ENV !== \"production\")) {\n pushWarningContext(vnode2);\n }\n handleSetupResult(instance, asyncSetupResult, false);\n if (hydratedEl) {\n vnode2.el = hydratedEl;\n }\n const placeholder = !hydratedEl && instance.subTree.el;\n setupRenderEffect(\n instance,\n vnode2,\n // component may have been moved before resolve.\n // if this is not a hydration, instance.subTree will be the comment\n // placeholder.\n parentNode(hydratedEl || instance.subTree.el),\n // anchor will not be used if this is hydration, so only need to\n // consider the comment placeholder case.\n hydratedEl ? null : next(instance.subTree),\n suspense,\n isSVG,\n optimized\n );\n if (placeholder) {\n remove(placeholder);\n }\n updateHOCHostEl(instance, vnode2.el);\n if (!!(process.env.NODE_ENV !== \"production\")) {\n popWarningContext();\n }\n if (isInPendingSuspense && --suspense.deps === 0) {\n suspense.resolve();\n }\n });\n },\n unmount(parentSuspense2, doRemove) {\n suspense.isUnmounted = true;\n if (suspense.activeBranch) {\n unmount(\n suspense.activeBranch,\n parentComponent,\n parentSuspense2,\n doRemove\n );\n }\n if (suspense.pendingBranch) {\n unmount(\n suspense.pendingBranch,\n parentComponent,\n parentSuspense2,\n doRemove\n );\n }\n }\n };\n return suspense;\n}\nfunction hydrateSuspense(node, vnode, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, rendererInternals, hydrateNode) {\n const suspense = vnode.suspense = createSuspenseBoundary(\n vnode,\n parentSuspense,\n parentComponent,\n node.parentNode,\n document.createElement(\"div\"),\n null,\n isSVG,\n slotScopeIds,\n optimized,\n rendererInternals,\n true\n /* hydrating */\n );\n const result = hydrateNode(\n node,\n suspense.pendingBranch = vnode.ssContent,\n parentComponent,\n suspense,\n slotScopeIds,\n optimized\n );\n if (suspense.deps === 0) {\n suspense.resolve(false, true);\n }\n return result;\n}\nfunction normalizeSuspenseChildren(vnode) {\n const { shapeFlag, children } = vnode;\n const isSlotChildren = shapeFlag & 32;\n vnode.ssContent = normalizeSuspenseSlot(\n isSlotChildren ? children.default : children\n );\n vnode.ssFallback = isSlotChildren ? normalizeSuspenseSlot(children.fallback) : createVNode(Comment);\n}\nfunction normalizeSuspenseSlot(s) {\n let block;\n if (isFunction(s)) {\n const trackBlock = isBlockTreeEnabled && s._c;\n if (trackBlock) {\n s._d = false;\n openBlock();\n }\n s = s();\n if (trackBlock) {\n s._d = true;\n block = currentBlock;\n closeBlock();\n }\n }\n if (isArray(s)) {\n const singleChild = filterSingleRoot(s);\n if (!!(process.env.NODE_ENV !== \"production\") && !singleChild) {\n warn(` slots expect a single root node.`);\n }\n s = singleChild;\n }\n s = normalizeVNode(s);\n if (block && !s.dynamicChildren) {\n s.dynamicChildren = block.filter((c) => c !== s);\n }\n return s;\n}\nfunction queueEffectWithSuspense(fn, suspense) {\n if (suspense && suspense.pendingBranch) {\n if (isArray(fn)) {\n suspense.effects.push(...fn);\n } else {\n suspense.effects.push(fn);\n }\n } else {\n queuePostFlushCb(fn);\n }\n}\nfunction setActiveBranch(suspense, branch) {\n suspense.activeBranch = branch;\n const { vnode, parentComponent } = suspense;\n const el = vnode.el = branch.el;\n if (parentComponent && parentComponent.subTree === vnode) {\n parentComponent.vnode.el = el;\n updateHOCHostEl(parentComponent, el);\n }\n}\nfunction isVNodeSuspensible(vnode) {\n var _a;\n return ((_a = vnode.props) == null ? void 0 : _a.suspensible) != null && vnode.props.suspensible !== false;\n}\n\nfunction watchEffect(effect, options) {\n return doWatch(effect, null, options);\n}\nfunction watchPostEffect(effect, options) {\n return doWatch(\n effect,\n null,\n !!(process.env.NODE_ENV !== \"production\") ? extend({}, options, { flush: \"post\" }) : { flush: \"post\" }\n );\n}\nfunction watchSyncEffect(effect, options) {\n return doWatch(\n effect,\n null,\n !!(process.env.NODE_ENV !== \"production\") ? extend({}, options, { flush: \"sync\" }) : { flush: \"sync\" }\n );\n}\nconst INITIAL_WATCHER_VALUE = {};\nfunction watch(source, cb, options) {\n if (!!(process.env.NODE_ENV !== \"production\") && !isFunction(cb)) {\n warn(\n `\\`watch(fn, options?)\\` signature has been moved to a separate API. Use \\`watchEffect(fn, options?)\\` instead. \\`watch\\` now only supports \\`watch(source, cb, options?) signature.`\n );\n }\n return doWatch(source, cb, options);\n}\nfunction doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EMPTY_OBJ) {\n var _a;\n if (!!(process.env.NODE_ENV !== \"production\") && !cb) {\n if (immediate !== void 0) {\n warn(\n `watch() \"immediate\" option is only respected when using the watch(source, callback, options?) signature.`\n );\n }\n if (deep !== void 0) {\n warn(\n `watch() \"deep\" option is only respected when using the watch(source, callback, options?) signature.`\n );\n }\n }\n const warnInvalidSource = (s) => {\n warn(\n `Invalid watch source: `,\n s,\n `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`\n );\n };\n const instance = getCurrentScope() === ((_a = currentInstance) == null ? void 0 : _a.scope) ? currentInstance : null;\n let getter;\n let forceTrigger = false;\n let isMultiSource = false;\n if (isRef(source)) {\n getter = () => source.value;\n forceTrigger = isShallow$1(source);\n } else if (isReactive(source)) {\n getter = () => source;\n deep = true;\n } else if (isArray(source)) {\n isMultiSource = true;\n forceTrigger = source.some((s) => isReactive(s) || isShallow$1(s));\n getter = () => source.map((s) => {\n if (isRef(s)) {\n return s.value;\n } else if (isReactive(s)) {\n return traverse(s);\n } else if (isFunction(s)) {\n return callWithErrorHandling(s, instance, 2);\n } else {\n !!(process.env.NODE_ENV !== \"production\") && warnInvalidSource(s);\n }\n });\n } else if (isFunction(source)) {\n if (cb) {\n getter = () => callWithErrorHandling(source, instance, 2);\n } else {\n getter = () => {\n if (instance && instance.isUnmounted) {\n return;\n }\n if (cleanup) {\n cleanup();\n }\n return callWithAsyncErrorHandling(\n source,\n instance,\n 3,\n [onCleanup]\n );\n };\n }\n } else {\n getter = NOOP;\n !!(process.env.NODE_ENV !== \"production\") && warnInvalidSource(source);\n }\n if (cb && deep) {\n const baseGetter = getter;\n getter = () => traverse(baseGetter());\n }\n let cleanup;\n let onCleanup = (fn) => {\n cleanup = effect.onStop = () => {\n callWithErrorHandling(fn, instance, 4);\n };\n };\n let ssrCleanup;\n if (isInSSRComponentSetup) {\n onCleanup = NOOP;\n if (!cb) {\n getter();\n } else if (immediate) {\n callWithAsyncErrorHandling(cb, instance, 3, [\n getter(),\n isMultiSource ? [] : void 0,\n onCleanup\n ]);\n }\n if (flush === \"sync\") {\n const ctx = useSSRContext();\n ssrCleanup = ctx.__watcherHandles || (ctx.__watcherHandles = []);\n } else {\n return NOOP;\n }\n }\n let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;\n const job = () => {\n if (!effect.active) {\n return;\n }\n if (cb) {\n const newValue = effect.run();\n if (deep || forceTrigger || (isMultiSource ? newValue.some(\n (v, i) => hasChanged(v, oldValue[i])\n ) : hasChanged(newValue, oldValue)) || false) {\n if (cleanup) {\n cleanup();\n }\n callWithAsyncErrorHandling(cb, instance, 3, [\n newValue,\n // pass undefined as the old value when it's changed for the first time\n oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,\n onCleanup\n ]);\n oldValue = newValue;\n }\n } else {\n effect.run();\n }\n };\n job.allowRecurse = !!cb;\n let scheduler;\n if (flush === \"sync\") {\n scheduler = job;\n } else if (flush === \"post\") {\n scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);\n } else {\n job.pre = true;\n if (instance)\n job.id = instance.uid;\n scheduler = () => queueJob(job);\n }\n const effect = new ReactiveEffect(getter, scheduler);\n if (!!(process.env.NODE_ENV !== \"production\")) {\n effect.onTrack = onTrack;\n effect.onTrigger = onTrigger;\n }\n if (cb) {\n if (immediate) {\n job();\n } else {\n oldValue = effect.run();\n }\n } else if (flush === \"post\") {\n queuePostRenderEffect(\n effect.run.bind(effect),\n instance && instance.suspense\n );\n } else {\n effect.run();\n }\n const unwatch = () => {\n effect.stop();\n if (instance && instance.scope) {\n remove(instance.scope.effects, effect);\n }\n };\n if (ssrCleanup)\n ssrCleanup.push(unwatch);\n return unwatch;\n}\nfunction instanceWatch(source, value, options) {\n const publicThis = this.proxy;\n const getter = isString(source) ? source.includes(\".\") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);\n let cb;\n if (isFunction(value)) {\n cb = value;\n } else {\n cb = value.handler;\n options = value;\n }\n const cur = currentInstance;\n setCurrentInstance(this);\n const res = doWatch(getter, cb.bind(publicThis), options);\n if (cur) {\n setCurrentInstance(cur);\n } else {\n unsetCurrentInstance();\n }\n return res;\n}\nfunction createPathGetter(ctx, path) {\n const segments = path.split(\".\");\n return () => {\n let cur = ctx;\n for (let i = 0; i < segments.length && cur; i++) {\n cur = cur[segments[i]];\n }\n return cur;\n };\n}\nfunction traverse(value, seen) {\n if (!isObject(value) || value[\"__v_skip\"]) {\n return value;\n }\n seen = seen || /* @__PURE__ */ new Set();\n if (seen.has(value)) {\n return value;\n }\n seen.add(value);\n if (isRef(value)) {\n traverse(value.value, seen);\n } else if (isArray(value)) {\n for (let i = 0; i < value.length; i++) {\n traverse(value[i], seen);\n }\n } else if (isSet(value) || isMap(value)) {\n value.forEach((v) => {\n traverse(v, seen);\n });\n } else if (isPlainObject(value)) {\n for (const key in value) {\n traverse(value[key], seen);\n }\n }\n return value;\n}\n\nfunction validateDirectiveName(name) {\n if (isBuiltInDirective(name)) {\n warn(\"Do not use built-in directive ids as custom directive id: \" + name);\n }\n}\nfunction withDirectives(vnode, directives) {\n const internalInstance = currentRenderingInstance;\n if (internalInstance === null) {\n !!(process.env.NODE_ENV !== \"production\") && warn(`withDirectives can only be used inside render functions.`);\n return vnode;\n }\n const instance = getExposeProxy(internalInstance) || internalInstance.proxy;\n const bindings = vnode.dirs || (vnode.dirs = []);\n for (let i = 0; i < directives.length; i++) {\n let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];\n if (dir) {\n if (isFunction(dir)) {\n dir = {\n mounted: dir,\n updated: dir\n };\n }\n if (dir.deep) {\n traverse(value);\n }\n bindings.push({\n dir,\n instance,\n value,\n oldValue: void 0,\n arg,\n modifiers\n });\n }\n }\n return vnode;\n}\nfunction invokeDirectiveHook(vnode, prevVNode, instance, name) {\n const bindings = vnode.dirs;\n const oldBindings = prevVNode && prevVNode.dirs;\n for (let i = 0; i < bindings.length; i++) {\n const binding = bindings[i];\n if (oldBindings) {\n binding.oldValue = oldBindings[i].value;\n }\n let hook = binding.dir[name];\n if (hook) {\n pauseTracking();\n callWithAsyncErrorHandling(hook, instance, 8, [\n vnode.el,\n binding,\n vnode,\n prevVNode\n ]);\n resetTracking();\n }\n }\n}\n\nfunction useTransitionState() {\n const state = {\n isMounted: false,\n isLeaving: false,\n isUnmounting: false,\n leavingVNodes: /* @__PURE__ */ new Map()\n };\n onMounted(() => {\n state.isMounted = true;\n });\n onBeforeUnmount(() => {\n state.isUnmounting = true;\n });\n return state;\n}\nconst TransitionHookValidator = [Function, Array];\nconst BaseTransitionPropsValidators = {\n mode: String,\n appear: Boolean,\n persisted: Boolean,\n // enter\n onBeforeEnter: TransitionHookValidator,\n onEnter: TransitionHookValidator,\n onAfterEnter: TransitionHookValidator,\n onEnterCancelled: TransitionHookValidator,\n // leave\n onBeforeLeave: TransitionHookValidator,\n onLeave: TransitionHookValidator,\n onAfterLeave: TransitionHookValidator,\n onLeaveCancelled: TransitionHookValidator,\n // appear\n onBeforeAppear: TransitionHookValidator,\n onAppear: TransitionHookValidator,\n onAfterAppear: TransitionHookValidator,\n onAppearCancelled: TransitionHookValidator\n};\nconst BaseTransitionImpl = {\n name: `BaseTransition`,\n props: BaseTransitionPropsValidators,\n setup(props, { slots }) {\n const instance = getCurrentInstance();\n const state = useTransitionState();\n let prevTransitionKey;\n return () => {\n const children = slots.default && getTransitionRawChildren(slots.default(), true);\n if (!children || !children.length) {\n return;\n }\n let child = children[0];\n if (children.length > 1) {\n let hasFound = false;\n for (const c of children) {\n if (c.type !== Comment) {\n if (!!(process.env.NODE_ENV !== \"production\") && hasFound) {\n warn(\n \" can only be used on a single element or component. Use for lists.\"\n );\n break;\n }\n child = c;\n hasFound = true;\n if (!!!(process.env.NODE_ENV !== \"production\"))\n break;\n }\n }\n }\n const rawProps = toRaw(props);\n const { mode } = rawProps;\n if (!!(process.env.NODE_ENV !== \"production\") && mode && mode !== \"in-out\" && mode !== \"out-in\" && mode !== \"default\") {\n warn(`invalid mode: ${mode}`);\n }\n if (state.isLeaving) {\n return emptyPlaceholder(child);\n }\n const innerChild = getKeepAliveChild(child);\n if (!innerChild) {\n return emptyPlaceholder(child);\n }\n const enterHooks = resolveTransitionHooks(\n innerChild,\n rawProps,\n state,\n instance\n );\n setTransitionHooks(innerChild, enterHooks);\n const oldChild = instance.subTree;\n const oldInnerChild = oldChild && getKeepAliveChild(oldChild);\n let transitionKeyChanged = false;\n const { getTransitionKey } = innerChild.type;\n if (getTransitionKey) {\n const key = getTransitionKey();\n if (prevTransitionKey === void 0) {\n prevTransitionKey = key;\n } else if (key !== prevTransitionKey) {\n prevTransitionKey = key;\n transitionKeyChanged = true;\n }\n }\n if (oldInnerChild && oldInnerChild.type !== Comment && (!isSameVNodeType(innerChild, oldInnerChild) || transitionKeyChanged)) {\n const leavingHooks = resolveTransitionHooks(\n oldInnerChild,\n rawProps,\n state,\n instance\n );\n setTransitionHooks(oldInnerChild, leavingHooks);\n if (mode === \"out-in\") {\n state.isLeaving = true;\n leavingHooks.afterLeave = () => {\n state.isLeaving = false;\n if (instance.update.active !== false) {\n instance.update();\n }\n };\n return emptyPlaceholder(child);\n } else if (mode === \"in-out\" && innerChild.type !== Comment) {\n leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {\n const leavingVNodesCache = getLeavingNodesForType(\n state,\n oldInnerChild\n );\n leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;\n el._leaveCb = () => {\n earlyRemove();\n el._leaveCb = void 0;\n delete enterHooks.delayedLeave;\n };\n enterHooks.delayedLeave = delayedLeave;\n };\n }\n }\n return child;\n };\n }\n};\nconst BaseTransition = BaseTransitionImpl;\nfunction getLeavingNodesForType(state, vnode) {\n const { leavingVNodes } = state;\n let leavingVNodesCache = leavingVNodes.get(vnode.type);\n if (!leavingVNodesCache) {\n leavingVNodesCache = /* @__PURE__ */ Object.create(null);\n leavingVNodes.set(vnode.type, leavingVNodesCache);\n }\n return leavingVNodesCache;\n}\nfunction resolveTransitionHooks(vnode, props, state, instance) {\n const {\n appear,\n mode,\n persisted = false,\n onBeforeEnter,\n onEnter,\n onAfterEnter,\n onEnterCancelled,\n onBeforeLeave,\n onLeave,\n onAfterLeave,\n onLeaveCancelled,\n onBeforeAppear,\n onAppear,\n onAfterAppear,\n onAppearCancelled\n } = props;\n const key = String(vnode.key);\n const leavingVNodesCache = getLeavingNodesForType(state, vnode);\n const callHook = (hook, args) => {\n hook && callWithAsyncErrorHandling(\n hook,\n instance,\n 9,\n args\n );\n };\n const callAsyncHook = (hook, args) => {\n const done = args[1];\n callHook(hook, args);\n if (isArray(hook)) {\n if (hook.every((hook2) => hook2.length <= 1))\n done();\n } else if (hook.length <= 1) {\n done();\n }\n };\n const hooks = {\n mode,\n persisted,\n beforeEnter(el) {\n let hook = onBeforeEnter;\n if (!state.isMounted) {\n if (appear) {\n hook = onBeforeAppear || onBeforeEnter;\n } else {\n return;\n }\n }\n if (el._leaveCb) {\n el._leaveCb(\n true\n /* cancelled */\n );\n }\n const leavingVNode = leavingVNodesCache[key];\n if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el._leaveCb) {\n leavingVNode.el._leaveCb();\n }\n callHook(hook, [el]);\n },\n enter(el) {\n let hook = onEnter;\n let afterHook = onAfterEnter;\n let cancelHook = onEnterCancelled;\n if (!state.isMounted) {\n if (appear) {\n hook = onAppear || onEnter;\n afterHook = onAfterAppear || onAfterEnter;\n cancelHook = onAppearCancelled || onEnterCancelled;\n } else {\n return;\n }\n }\n let called = false;\n const done = el._enterCb = (cancelled) => {\n if (called)\n return;\n called = true;\n if (cancelled) {\n callHook(cancelHook, [el]);\n } else {\n callHook(afterHook, [el]);\n }\n if (hooks.delayedLeave) {\n hooks.delayedLeave();\n }\n el._enterCb = void 0;\n };\n if (hook) {\n callAsyncHook(hook, [el, done]);\n } else {\n done();\n }\n },\n leave(el, remove) {\n const key2 = String(vnode.key);\n if (el._enterCb) {\n el._enterCb(\n true\n /* cancelled */\n );\n }\n if (state.isUnmounting) {\n return remove();\n }\n callHook(onBeforeLeave, [el]);\n let called = false;\n const done = el._leaveCb = (cancelled) => {\n if (called)\n return;\n called = true;\n remove();\n if (cancelled) {\n callHook(onLeaveCancelled, [el]);\n } else {\n callHook(onAfterLeave, [el]);\n }\n el._leaveCb = void 0;\n if (leavingVNodesCache[key2] === vnode) {\n delete leavingVNodesCache[key2];\n }\n };\n leavingVNodesCache[key2] = vnode;\n if (onLeave) {\n callAsyncHook(onLeave, [el, done]);\n } else {\n done();\n }\n },\n clone(vnode2) {\n return resolveTransitionHooks(vnode2, props, state, instance);\n }\n };\n return hooks;\n}\nfunction emptyPlaceholder(vnode) {\n if (isKeepAlive(vnode)) {\n vnode = cloneVNode(vnode);\n vnode.children = null;\n return vnode;\n }\n}\nfunction getKeepAliveChild(vnode) {\n return isKeepAlive(vnode) ? vnode.children ? vnode.children[0] : void 0 : vnode;\n}\nfunction setTransitionHooks(vnode, hooks) {\n if (vnode.shapeFlag & 6 && vnode.component) {\n setTransitionHooks(vnode.component.subTree, hooks);\n } else if (vnode.shapeFlag & 128) {\n vnode.ssContent.transition = hooks.clone(vnode.ssContent);\n vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);\n } else {\n vnode.transition = hooks;\n }\n}\nfunction getTransitionRawChildren(children, keepComment = false, parentKey) {\n let ret = [];\n let keyedFragmentCount = 0;\n for (let i = 0; i < children.length; i++) {\n let child = children[i];\n const key = parentKey == null ? child.key : String(parentKey) + String(child.key != null ? child.key : i);\n if (child.type === Fragment) {\n if (child.patchFlag & 128)\n keyedFragmentCount++;\n ret = ret.concat(\n getTransitionRawChildren(child.children, keepComment, key)\n );\n } else if (keepComment || child.type !== Comment) {\n ret.push(key != null ? cloneVNode(child, { key }) : child);\n }\n }\n if (keyedFragmentCount > 1) {\n for (let i = 0; i < ret.length; i++) {\n ret[i].patchFlag = -2;\n }\n }\n return ret;\n}\n\nfunction defineComponent(options, extraOptions) {\n return isFunction(options) ? (\n // #8326: extend call and options.name access are considered side-effects\n // by Rollup, so we have to wrap it in a pure-annotated IIFE.\n /* @__PURE__ */ (() => extend({ name: options.name }, extraOptions, { setup: options }))()\n ) : options;\n}\n\nconst isAsyncWrapper = (i) => !!i.type.__asyncLoader;\nfunction defineAsyncComponent(source) {\n if (isFunction(source)) {\n source = { loader: source };\n }\n const {\n loader,\n loadingComponent,\n errorComponent,\n delay = 200,\n timeout,\n // undefined = never times out\n suspensible = true,\n onError: userOnError\n } = source;\n let pendingRequest = null;\n let resolvedComp;\n let retries = 0;\n const retry = () => {\n retries++;\n pendingRequest = null;\n return load();\n };\n const load = () => {\n let thisRequest;\n return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {\n err = err instanceof Error ? err : new Error(String(err));\n if (userOnError) {\n return new Promise((resolve, reject) => {\n const userRetry = () => resolve(retry());\n const userFail = () => reject(err);\n userOnError(err, userRetry, userFail, retries + 1);\n });\n } else {\n throw err;\n }\n }).then((comp) => {\n if (thisRequest !== pendingRequest && pendingRequest) {\n return pendingRequest;\n }\n if (!!(process.env.NODE_ENV !== \"production\") && !comp) {\n warn(\n `Async component loader resolved to undefined. If you are using retry(), make sure to return its return value.`\n );\n }\n if (comp && (comp.__esModule || comp[Symbol.toStringTag] === \"Module\")) {\n comp = comp.default;\n }\n if (!!(process.env.NODE_ENV !== \"production\") && comp && !isObject(comp) && !isFunction(comp)) {\n throw new Error(`Invalid async component load result: ${comp}`);\n }\n resolvedComp = comp;\n return comp;\n }));\n };\n return defineComponent({\n name: \"AsyncComponentWrapper\",\n __asyncLoader: load,\n get __asyncResolved() {\n return resolvedComp;\n },\n setup() {\n const instance = currentInstance;\n if (resolvedComp) {\n return () => createInnerComp(resolvedComp, instance);\n }\n const onError = (err) => {\n pendingRequest = null;\n handleError(\n err,\n instance,\n 13,\n !errorComponent\n /* do not throw in dev if user provided error component */\n );\n };\n if (suspensible && instance.suspense || isInSSRComponentSetup) {\n return load().then((comp) => {\n return () => createInnerComp(comp, instance);\n }).catch((err) => {\n onError(err);\n return () => errorComponent ? createVNode(errorComponent, {\n error: err\n }) : null;\n });\n }\n const loaded = ref(false);\n const error = ref();\n const delayed = ref(!!delay);\n if (delay) {\n setTimeout(() => {\n delayed.value = false;\n }, delay);\n }\n if (timeout != null) {\n setTimeout(() => {\n if (!loaded.value && !error.value) {\n const err = new Error(\n `Async component timed out after ${timeout}ms.`\n );\n onError(err);\n error.value = err;\n }\n }, timeout);\n }\n load().then(() => {\n loaded.value = true;\n if (instance.parent && isKeepAlive(instance.parent.vnode)) {\n queueJob(instance.parent.update);\n }\n }).catch((err) => {\n onError(err);\n error.value = err;\n });\n return () => {\n if (loaded.value && resolvedComp) {\n return createInnerComp(resolvedComp, instance);\n } else if (error.value && errorComponent) {\n return createVNode(errorComponent, {\n error: error.value\n });\n } else if (loadingComponent && !delayed.value) {\n return createVNode(loadingComponent);\n }\n };\n }\n });\n}\nfunction createInnerComp(comp, parent) {\n const { ref: ref2, props, children, ce } = parent.vnode;\n const vnode = createVNode(comp, props, children);\n vnode.ref = ref2;\n vnode.ce = ce;\n delete parent.vnode.ce;\n return vnode;\n}\n\nconst isKeepAlive = (vnode) => vnode.type.__isKeepAlive;\nconst KeepAliveImpl = {\n name: `KeepAlive`,\n // Marker for special handling inside the renderer. We are not using a ===\n // check directly on KeepAlive in the renderer, because importing it directly\n // would prevent it from being tree-shaken.\n __isKeepAlive: true,\n props: {\n include: [String, RegExp, Array],\n exclude: [String, RegExp, Array],\n max: [String, Number]\n },\n setup(props, { slots }) {\n const instance = getCurrentInstance();\n const sharedContext = instance.ctx;\n if (!sharedContext.renderer) {\n return () => {\n const children = slots.default && slots.default();\n return children && children.length === 1 ? children[0] : children;\n };\n }\n const cache = /* @__PURE__ */ new Map();\n const keys = /* @__PURE__ */ new Set();\n let current = null;\n if (!!(process.env.NODE_ENV !== \"production\") || __VUE_PROD_DEVTOOLS__) {\n instance.__v_cache = cache;\n }\n const parentSuspense = instance.suspense;\n const {\n renderer: {\n p: patch,\n m: move,\n um: _unmount,\n o: { createElement }\n }\n } = sharedContext;\n const storageContainer = createElement(\"div\");\n sharedContext.activate = (vnode, container, anchor, isSVG, optimized) => {\n const instance2 = vnode.component;\n move(vnode, container, anchor, 0, parentSuspense);\n patch(\n instance2.vnode,\n vnode,\n container,\n anchor,\n instance2,\n parentSuspense,\n isSVG,\n vnode.slotScopeIds,\n optimized\n );\n queuePostRenderEffect(() => {\n instance2.isDeactivated = false;\n if (instance2.a) {\n invokeArrayFns(instance2.a);\n }\n const vnodeHook = vnode.props && vnode.props.onVnodeMounted;\n if (vnodeHook) {\n invokeVNodeHook(vnodeHook, instance2.parent, vnode);\n }\n }, parentSuspense);\n if (!!(process.env.NODE_ENV !== \"production\") || __VUE_PROD_DEVTOOLS__) {\n devtoolsComponentAdded(instance2);\n }\n };\n sharedContext.deactivate = (vnode) => {\n const instance2 = vnode.component;\n move(vnode, storageContainer, null, 1, parentSuspense);\n queuePostRenderEffect(() => {\n if (instance2.da) {\n invokeArrayFns(instance2.da);\n }\n const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;\n if (vnodeHook) {\n invokeVNodeHook(vnodeHook, instance2.parent, vnode);\n }\n instance2.isDeactivated = true;\n }, parentSuspense);\n if (!!(process.env.NODE_ENV !== \"production\") || __VUE_PROD_DEVTOOLS__) {\n devtoolsComponentAdded(instance2);\n }\n };\n function unmount(vnode) {\n resetShapeFlag(vnode);\n _unmount(vnode, instance, parentSuspense, true);\n }\n function pruneCache(filter) {\n cache.forEach((vnode, key) => {\n const name = getComponentName(vnode.type);\n if (name && (!filter || !filter(name))) {\n pruneCacheEntry(key);\n }\n });\n }\n function pruneCacheEntry(key) {\n const cached = cache.get(key);\n if (!current || !isSameVNodeType(cached, current)) {\n unmount(cached);\n } else if (current) {\n resetShapeFlag(current);\n }\n cache.delete(key);\n keys.delete(key);\n }\n watch(\n () => [props.include, props.exclude],\n ([include, exclude]) => {\n include && pruneCache((name) => matches(include, name));\n exclude && pruneCache((name) => !matches(exclude, name));\n },\n // prune post-render after `current` has been updated\n { flush: \"post\", deep: true }\n );\n let pendingCacheKey = null;\n const cacheSubtree = () => {\n if (pendingCacheKey != null) {\n cache.set(pendingCacheKey, getInnerChild(instance.subTree));\n }\n };\n onMounted(cacheSubtree);\n onUpdated(cacheSubtree);\n onBeforeUnmount(() => {\n cache.forEach((cached) => {\n const { subTree, suspense } = instance;\n const vnode = getInnerChild(subTree);\n if (cached.type === vnode.type && cached.key === vnode.key) {\n resetShapeFlag(vnode);\n const da = vnode.component.da;\n da && queuePostRenderEffect(da, suspense);\n return;\n }\n unmount(cached);\n });\n });\n return () => {\n pendingCacheKey = null;\n if (!slots.default) {\n return null;\n }\n const children = slots.default();\n const rawVNode = children[0];\n if (children.length > 1) {\n if (!!(process.env.NODE_ENV !== \"production\")) {\n warn(`KeepAlive should contain exactly one component child.`);\n }\n current = null;\n return children;\n } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) {\n current = null;\n return rawVNode;\n }\n let vnode = getInnerChild(rawVNode);\n const comp = vnode.type;\n const name = getComponentName(\n isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp\n );\n const { include, exclude, max } = props;\n if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {\n current = vnode;\n return rawVNode;\n }\n const key = vnode.key == null ? comp : vnode.key;\n const cachedVNode = cache.get(key);\n if (vnode.el) {\n vnode = cloneVNode(vnode);\n if (rawVNode.shapeFlag & 128) {\n rawVNode.ssContent = vnode;\n }\n }\n pendingCacheKey = key;\n if (cachedVNode) {\n vnode.el = cachedVNode.el;\n vnode.component = cachedVNode.component;\n if (vnode.transition) {\n setTransitionHooks(vnode, vnode.transition);\n }\n vnode.shapeFlag |= 512;\n keys.delete(key);\n keys.add(key);\n } else {\n keys.add(key);\n if (max && keys.size > parseInt(max, 10)) {\n pruneCacheEntry(keys.values().next().value);\n }\n }\n vnode.shapeFlag |= 256;\n current = vnode;\n return isSuspense(rawVNode.type) ? rawVNode : vnode;\n };\n }\n};\nconst KeepAlive = KeepAliveImpl;\nfunction matches(pattern, name) {\n if (isArray(pattern)) {\n return pattern.some((p) => matches(p, name));\n } else if (isString(pattern)) {\n return pattern.split(\",\").includes(name);\n } else if (isRegExp(pattern)) {\n return pattern.test(name);\n }\n return false;\n}\nfunction onActivated(hook, target) {\n registerKeepAliveHook(hook, \"a\", target);\n}\nfunction onDeactivated(hook, target) {\n registerKeepAliveHook(hook, \"da\", target);\n}\nfunction registerKeepAliveHook(hook, type, target = currentInstance) {\n const wrappedHook = hook.__wdc || (hook.__wdc = () => {\n let current = target;\n while (current) {\n if (current.isDeactivated) {\n return;\n }\n current = current.parent;\n }\n return hook();\n });\n injectHook(type, wrappedHook, target);\n if (target) {\n let current = target.parent;\n while (current && current.parent) {\n if (isKeepAlive(current.parent.vnode)) {\n injectToKeepAliveRoot(wrappedHook, type, target, current);\n }\n current = current.parent;\n }\n }\n}\nfunction injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {\n const injected = injectHook(\n type,\n hook,\n keepAliveRoot,\n true\n /* prepend */\n );\n onUnmounted(() => {\n remove(keepAliveRoot[type], injected);\n }, target);\n}\nfunction resetShapeFlag(vnode) {\n vnode.shapeFlag &= ~256;\n vnode.shapeFlag &= ~512;\n}\nfunction getInnerChild(vnode) {\n return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;\n}\n\nfunction injectHook(type, hook, target = currentInstance, prepend = false) {\n if (target) {\n const hooks = target[type] || (target[type] = []);\n const wrappedHook = hook.__weh || (hook.__weh = (...args) => {\n if (target.isUnmounted) {\n return;\n }\n pauseTracking();\n setCurrentInstance(target);\n const res = callWithAsyncErrorHandling(hook, target, type, args);\n unsetCurrentInstance();\n resetTracking();\n return res;\n });\n if (prepend) {\n hooks.unshift(wrappedHook);\n } else {\n hooks.push(wrappedHook);\n }\n return wrappedHook;\n } else if (!!(process.env.NODE_ENV !== \"production\")) {\n const apiName = toHandlerKey(ErrorTypeStrings[type].replace(/ hook$/, \"\"));\n warn(\n `${apiName} is called when there is no active component instance to be associated with. Lifecycle injection APIs can only be used during execution of setup().` + (` If you are using async setup(), make sure to register lifecycle hooks before the first await statement.` )\n );\n }\n}\nconst createHook = (lifecycle) => (hook, target = currentInstance) => (\n // post-create lifecycle registrations are noops during SSR (except for serverPrefetch)\n (!isInSSRComponentSetup || lifecycle === \"sp\") && injectHook(lifecycle, (...args) => hook(...args), target)\n);\nconst onBeforeMount = createHook(\"bm\");\nconst onMounted = createHook(\"m\");\nconst onBeforeUpdate = createHook(\"bu\");\nconst onUpdated = createHook(\"u\");\nconst onBeforeUnmount = createHook(\"bum\");\nconst onUnmounted = createHook(\"um\");\nconst onServerPrefetch = createHook(\"sp\");\nconst onRenderTriggered = createHook(\n \"rtg\"\n);\nconst onRenderTracked = createHook(\n \"rtc\"\n);\nfunction onErrorCaptured(hook, target = currentInstance) {\n injectHook(\"ec\", hook, target);\n}\n\nconst COMPONENTS = \"components\";\nconst DIRECTIVES = \"directives\";\nfunction resolveComponent(name, maybeSelfReference) {\n return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;\n}\nconst NULL_DYNAMIC_COMPONENT = Symbol.for(\"v-ndc\");\nfunction resolveDynamicComponent(component) {\n if (isString(component)) {\n return resolveAsset(COMPONENTS, component, false) || component;\n } else {\n return component || NULL_DYNAMIC_COMPONENT;\n }\n}\nfunction resolveDirective(name) {\n return resolveAsset(DIRECTIVES, name);\n}\nfunction resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {\n const instance = currentRenderingInstance || currentInstance;\n if (instance) {\n const Component = instance.type;\n if (type === COMPONENTS) {\n const selfName = getComponentName(\n Component,\n false\n /* do not include inferred name to avoid breaking existing code */\n );\n if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {\n return Component;\n }\n }\n const res = (\n // local registration\n // check instance[type] first which is resolved for options API\n resolve(instance[type] || Component[type], name) || // global registration\n resolve(instance.appContext[type], name)\n );\n if (!res && maybeSelfReference) {\n return Component;\n }\n if (!!(process.env.NODE_ENV !== \"production\") && warnMissing && !res) {\n const extra = type === COMPONENTS ? `\nIf this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;\n warn(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);\n }\n return res;\n } else if (!!(process.env.NODE_ENV !== \"production\")) {\n warn(\n `resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`\n );\n }\n}\nfunction resolve(registry, name) {\n return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);\n}\n\nfunction renderList(source, renderItem, cache, index) {\n let ret;\n const cached = cache && cache[index];\n if (isArray(source) || isString(source)) {\n ret = new Array(source.length);\n for (let i = 0, l = source.length; i < l; i++) {\n ret[i] = renderItem(source[i], i, void 0, cached && cached[i]);\n }\n } else if (typeof source === \"number\") {\n if (!!(process.env.NODE_ENV !== \"production\") && !Number.isInteger(source)) {\n warn(`The v-for range expect an integer value but got ${source}.`);\n }\n ret = new Array(source);\n for (let i = 0; i < source; i++) {\n ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]);\n }\n } else if (isObject(source)) {\n if (source[Symbol.iterator]) {\n ret = Array.from(\n source,\n (item, i) => renderItem(item, i, void 0, cached && cached[i])\n );\n } else {\n const keys = Object.keys(source);\n ret = new Array(keys.length);\n for (let i = 0, l = keys.length; i < l; i++) {\n const key = keys[i];\n ret[i] = renderItem(source[key], key, i, cached && cached[i]);\n }\n }\n } else {\n ret = [];\n }\n if (cache) {\n cache[index] = ret;\n }\n return ret;\n}\n\nfunction createSlots(slots, dynamicSlots) {\n for (let i = 0; i < dynamicSlots.length; i++) {\n const slot = dynamicSlots[i];\n if (isArray(slot)) {\n for (let j = 0; j < slot.length; j++) {\n slots[slot[j].name] = slot[j].fn;\n }\n } else if (slot) {\n slots[slot.name] = slot.key ? (...args) => {\n const res = slot.fn(...args);\n if (res)\n res.key = slot.key;\n return res;\n } : slot.fn;\n }\n }\n return slots;\n}\n\nfunction renderSlot(slots, name, props = {}, fallback, noSlotted) {\n if (currentRenderingInstance.isCE || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.isCE) {\n if (name !== \"default\")\n props.name = name;\n return createVNode(\"slot\", props, fallback && fallback());\n }\n let slot = slots[name];\n if (!!(process.env.NODE_ENV !== \"production\") && slot && slot.length > 1) {\n warn(\n `SSR-optimized slot function detected in a non-SSR-optimized render function. You need to mark this component with $dynamic-slots in the parent template.`\n );\n slot = () => [];\n }\n if (slot && slot._c) {\n slot._d = false;\n }\n openBlock();\n const validSlotContent = slot && ensureValidVNode(slot(props));\n const rendered = createBlock(\n Fragment,\n {\n key: props.key || // slot content array of a dynamic conditional slot may have a branch\n // key attached in the `createSlots` helper, respect that\n validSlotContent && validSlotContent.key || `_${name}`\n },\n validSlotContent || (fallback ? fallback() : []),\n validSlotContent && slots._ === 1 ? 64 : -2\n );\n if (!noSlotted && rendered.scopeId) {\n rendered.slotScopeIds = [rendered.scopeId + \"-s\"];\n }\n if (slot && slot._c) {\n slot._d = true;\n }\n return rendered;\n}\nfunction ensureValidVNode(vnodes) {\n return vnodes.some((child) => {\n if (!isVNode(child))\n return true;\n if (child.type === Comment)\n return false;\n if (child.type === Fragment && !ensureValidVNode(child.children))\n return false;\n return true;\n }) ? vnodes : null;\n}\n\nfunction toHandlers(obj, preserveCaseIfNecessary) {\n const ret = {};\n if (!!(process.env.NODE_ENV !== \"production\") && !isObject(obj)) {\n warn(`v-on with no argument expects an object value.`);\n return ret;\n }\n for (const key in obj) {\n ret[preserveCaseIfNecessary && /[A-Z]/.test(key) ? `on:${key}` : toHandlerKey(key)] = obj[key];\n }\n return ret;\n}\n\nconst getPublicInstance = (i) => {\n if (!i)\n return null;\n if (isStatefulComponent(i))\n return getExposeProxy(i) || i.proxy;\n return getPublicInstance(i.parent);\n};\nconst publicPropertiesMap = (\n // Move PURE marker to new line to workaround compiler discarding it\n // due to type annotation\n /* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), {\n $: (i) => i,\n $el: (i) => i.vnode.el,\n $data: (i) => i.data,\n $props: (i) => !!(process.env.NODE_ENV !== \"production\") ? shallowReadonly(i.props) : i.props,\n $attrs: (i) => !!(process.env.NODE_ENV !== \"production\") ? shallowReadonly(i.attrs) : i.attrs,\n $slots: (i) => !!(process.env.NODE_ENV !== \"production\") ? shallowReadonly(i.slots) : i.slots,\n $refs: (i) => !!(process.env.NODE_ENV !== \"production\") ? shallowReadonly(i.refs) : i.refs,\n $parent: (i) => getPublicInstance(i.parent),\n $root: (i) => getPublicInstance(i.root),\n $emit: (i) => i.emit,\n $options: (i) => __VUE_OPTIONS_API__ ? resolveMergedOptions(i) : i.type,\n $forceUpdate: (i) => i.f || (i.f = () => queueJob(i.update)),\n $nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),\n $watch: (i) => __VUE_OPTIONS_API__ ? instanceWatch.bind(i) : NOOP\n })\n);\nconst isReservedPrefix = (key) => key === \"_\" || key === \"$\";\nconst hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key);\nconst PublicInstanceProxyHandlers = {\n get({ _: instance }, key) {\n const { ctx, setupState, data, props, accessCache, type, appContext } = instance;\n if (!!(process.env.NODE_ENV !== \"production\") && key === \"__isVue\") {\n return true;\n }\n let normalizedProps;\n if (key[0] !== \"$\") {\n const n = accessCache[key];\n if (n !== void 0) {\n switch (n) {\n case 1 /* SETUP */:\n return setupState[key];\n case 2 /* DATA */:\n return data[key];\n case 4 /* CONTEXT */:\n return ctx[key];\n case 3 /* PROPS */:\n return props[key];\n }\n } else if (hasSetupBinding(setupState, key)) {\n accessCache[key] = 1 /* SETUP */;\n return setupState[key];\n } else if (data !== EMPTY_OBJ && hasOwn(data, key)) {\n accessCache[key] = 2 /* DATA */;\n return data[key];\n } else if (\n // only cache other properties when instance has declared (thus stable)\n // props\n (normalizedProps = instance.propsOptions[0]) && hasOwn(normalizedProps, key)\n ) {\n accessCache[key] = 3 /* PROPS */;\n return props[key];\n } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {\n accessCache[key] = 4 /* CONTEXT */;\n return ctx[key];\n } else if (!__VUE_OPTIONS_API__ || shouldCacheAccess) {\n accessCache[key] = 0 /* OTHER */;\n }\n }\n const publicGetter = publicPropertiesMap[key];\n let cssModule, globalProperties;\n if (publicGetter) {\n if (key === \"$attrs\") {\n track(instance, \"get\", key);\n !!(process.env.NODE_ENV !== \"production\") && markAttrsAccessed();\n } else if (!!(process.env.NODE_ENV !== \"production\") && key === \"$slots\") {\n track(instance, \"get\", key);\n }\n return publicGetter(instance);\n } else if (\n // css module (injected by vue-loader)\n (cssModule = type.__cssModules) && (cssModule = cssModule[key])\n ) {\n return cssModule;\n } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {\n accessCache[key] = 4 /* CONTEXT */;\n return ctx[key];\n } else if (\n // global properties\n globalProperties = appContext.config.globalProperties, hasOwn(globalProperties, key)\n ) {\n {\n return globalProperties[key];\n }\n } else if (!!(process.env.NODE_ENV !== \"production\") && currentRenderingInstance && (!isString(key) || // #1091 avoid internal isRef/isVNode checks on component instance leading\n // to infinite warning loop\n key.indexOf(\"__v\") !== 0)) {\n if (data !== EMPTY_OBJ && isReservedPrefix(key[0]) && hasOwn(data, key)) {\n warn(\n `Property ${JSON.stringify(\n key\n )} must be accessed via $data because it starts with a reserved character (\"$\" or \"_\") and is not proxied on the render context.`\n );\n } else if (instance === currentRenderingInstance) {\n warn(\n `Property ${JSON.stringify(key)} was accessed during render but is not defined on instance.`\n );\n }\n }\n },\n set({ _: instance }, key, value) {\n const { data, setupState, ctx } = instance;\n if (hasSetupBinding(setupState, key)) {\n setupState[key] = value;\n return true;\n } else if (!!(process.env.NODE_ENV !== \"production\") && setupState.__isScriptSetup && hasOwn(setupState, key)) {\n warn(`Cannot mutate \n\n","/**\n * Scalar computation library\n */\nexport class Scalar {\n /**\n * Boolean : true if the absolute difference between a and b is lower than epsilon (default = 1.401298E-45)\n * @param a number\n * @param b number\n * @param epsilon (default = 1.401298E-45)\n * @returns true if the absolute difference between a and b is lower than epsilon (default = 1.401298E-45)\n */\n static WithinEpsilon(a, b, epsilon = 1.401298e-45) {\n return Math.abs(a - b) <= epsilon;\n }\n /**\n * Returns a string : the upper case translation of the number i to hexadecimal.\n * @param i number\n * @returns the upper case translation of the number i to hexadecimal.\n */\n static ToHex(i) {\n const str = i.toString(16);\n if (i <= 15) {\n return (\"0\" + str).toUpperCase();\n }\n return str.toUpperCase();\n }\n /**\n * Returns -1 if value is negative and +1 is value is positive.\n * @param value the value\n * @returns the value itself if it's equal to zero.\n */\n static Sign(value) {\n value = +value; // convert to a number\n if (value === 0 || isNaN(value)) {\n return value;\n }\n return value > 0 ? 1 : -1;\n }\n /**\n * Returns the value itself if it's between min and max.\n * Returns min if the value is lower than min.\n * Returns max if the value is greater than max.\n * @param value the value to clmap\n * @param min the min value to clamp to (default: 0)\n * @param max the max value to clamp to (default: 1)\n * @returns the clamped value\n */\n static Clamp(value, min = 0, max = 1) {\n return Math.min(max, Math.max(min, value));\n }\n /**\n * the log2 of value.\n * @param value the value to compute log2 of\n * @returns the log2 of value.\n */\n static Log2(value) {\n return Math.log(value) * Math.LOG2E;\n }\n /**\n * the floor part of a log2 value.\n * @param value the value to compute log2 of\n * @returns the log2 of value.\n */\n static ILog2(value) {\n if (Math.log2) {\n return Math.floor(Math.log2(value));\n }\n if (value < 0) {\n return NaN;\n }\n else if (value === 0) {\n return -Infinity;\n }\n let n = 0;\n if (value < 1) {\n while (value < 1) {\n n++;\n value = value * 2;\n }\n n = -n;\n }\n else if (value > 1) {\n while (value > 1) {\n n++;\n value = Math.floor(value / 2);\n }\n }\n return n;\n }\n /**\n * Loops the value, so that it is never larger than length and never smaller than 0.\n *\n * This is similar to the modulo operator but it works with floating point numbers.\n * For example, using 3.0 for t and 2.5 for length, the result would be 0.5.\n * With t = 5 and length = 2.5, the result would be 0.0.\n * Note, however, that the behaviour is not defined for negative numbers as it is for the modulo operator\n * @param value the value\n * @param length the length\n * @returns the looped value\n */\n static Repeat(value, length) {\n return value - Math.floor(value / length) * length;\n }\n /**\n * Normalize the value between 0.0 and 1.0 using min and max values\n * @param value value to normalize\n * @param min max to normalize between\n * @param max min to normalize between\n * @returns the normalized value\n */\n static Normalize(value, min, max) {\n return (value - min) / (max - min);\n }\n /**\n * Denormalize the value from 0.0 and 1.0 using min and max values\n * @param normalized value to denormalize\n * @param min max to denormalize between\n * @param max min to denormalize between\n * @returns the denormalized value\n */\n static Denormalize(normalized, min, max) {\n return normalized * (max - min) + min;\n }\n /**\n * Calculates the shortest difference between two given angles given in degrees.\n * @param current current angle in degrees\n * @param target target angle in degrees\n * @returns the delta\n */\n static DeltaAngle(current, target) {\n let num = Scalar.Repeat(target - current, 360.0);\n if (num > 180.0) {\n num -= 360.0;\n }\n return num;\n }\n /**\n * PingPongs the value t, so that it is never larger than length and never smaller than 0.\n * @param tx value\n * @param length length\n * @returns The returned value will move back and forth between 0 and length\n */\n static PingPong(tx, length) {\n const t = Scalar.Repeat(tx, length * 2.0);\n return length - Math.abs(t - length);\n }\n /**\n * Interpolates between min and max with smoothing at the limits.\n *\n * This function interpolates between min and max in a similar way to Lerp. However, the interpolation will gradually speed up\n * from the start and slow down toward the end. This is useful for creating natural-looking animation, fading and other transitions.\n * @param from from\n * @param to to\n * @param tx value\n * @returns the smooth stepped value\n */\n static SmoothStep(from, to, tx) {\n let t = Scalar.Clamp(tx);\n t = -2.0 * t * t * t + 3.0 * t * t;\n return to * t + from * (1.0 - t);\n }\n /**\n * Moves a value current towards target.\n *\n * This is essentially the same as Mathf.Lerp but instead the function will ensure that the speed never exceeds maxDelta.\n * Negative values of maxDelta pushes the value away from target.\n * @param current current value\n * @param target target value\n * @param maxDelta max distance to move\n * @returns resulting value\n */\n static MoveTowards(current, target, maxDelta) {\n let result = 0;\n if (Math.abs(target - current) <= maxDelta) {\n result = target;\n }\n else {\n result = current + Scalar.Sign(target - current) * maxDelta;\n }\n return result;\n }\n /**\n * Same as MoveTowards but makes sure the values interpolate correctly when they wrap around 360 degrees.\n *\n * Variables current and target are assumed to be in degrees. For optimization reasons, negative values of maxDelta\n * are not supported and may cause oscillation. To push current away from a target angle, add 180 to that angle instead.\n * @param current current value\n * @param target target value\n * @param maxDelta max distance to move\n * @returns resulting angle\n */\n static MoveTowardsAngle(current, target, maxDelta) {\n const num = Scalar.DeltaAngle(current, target);\n let result = 0;\n if (-maxDelta < num && num < maxDelta) {\n result = target;\n }\n else {\n target = current + num;\n result = Scalar.MoveTowards(current, target, maxDelta);\n }\n return result;\n }\n /**\n * Creates a new scalar with values linearly interpolated of \"amount\" between the start scalar and the end scalar.\n * @param start start value\n * @param end target value\n * @param amount amount to lerp between\n * @returns the lerped value\n */\n static Lerp(start, end, amount) {\n return start + (end - start) * amount;\n }\n /**\n * Same as Lerp but makes sure the values interpolate correctly when they wrap around 360 degrees.\n * The parameter t is clamped to the range [0, 1]. Variables a and b are assumed to be in degrees.\n * @param start start value\n * @param end target value\n * @param amount amount to lerp between\n * @returns the lerped value\n */\n static LerpAngle(start, end, amount) {\n let num = Scalar.Repeat(end - start, 360.0);\n if (num > 180.0) {\n num -= 360.0;\n }\n return start + num * Scalar.Clamp(amount);\n }\n /**\n * Calculates the linear parameter t that produces the interpolant value within the range [a, b].\n * @param a start value\n * @param b target value\n * @param value value between a and b\n * @returns the inverseLerp value\n */\n static InverseLerp(a, b, value) {\n let result = 0;\n if (a != b) {\n result = Scalar.Clamp((value - a) / (b - a));\n }\n else {\n result = 0.0;\n }\n return result;\n }\n /**\n * Returns a new scalar located for \"amount\" (float) on the Hermite spline defined by the scalars \"value1\", \"value3\", \"tangent1\", \"tangent2\".\n * @see http://mathworld.wolfram.com/HermitePolynomial.html\n * @param value1 defines the first control point\n * @param tangent1 defines the first tangent\n * @param value2 defines the second control point\n * @param tangent2 defines the second tangent\n * @param amount defines the amount on the interpolation spline (between 0 and 1)\n * @returns hermite result\n */\n static Hermite(value1, tangent1, value2, tangent2, amount) {\n const squared = amount * amount;\n const cubed = amount * squared;\n const part1 = 2.0 * cubed - 3.0 * squared + 1.0;\n const part2 = -2.0 * cubed + 3.0 * squared;\n const part3 = cubed - 2.0 * squared + amount;\n const part4 = cubed - squared;\n return value1 * part1 + value2 * part2 + tangent1 * part3 + tangent2 * part4;\n }\n /**\n * Returns a new scalar which is the 1st derivative of the Hermite spline defined by the scalars \"value1\", \"value2\", \"tangent1\", \"tangent2\".\n * @param value1 defines the first control point\n * @param tangent1 defines the first tangent\n * @param value2 defines the second control point\n * @param tangent2 defines the second tangent\n * @param time define where the derivative must be done\n * @returns 1st derivative\n */\n static Hermite1stDerivative(value1, tangent1, value2, tangent2, time) {\n const t2 = time * time;\n return (t2 - time) * 6 * value1 + (3 * t2 - 4 * time + 1) * tangent1 + (-t2 + time) * 6 * value2 + (3 * t2 - 2 * time) * tangent2;\n }\n /**\n * Returns a random float number between and min and max values\n * @param min min value of random\n * @param max max value of random\n * @returns random value\n */\n static RandomRange(min, max) {\n if (min === max) {\n return min;\n }\n return Math.random() * (max - min) + min;\n }\n /**\n * This function returns percentage of a number in a given range.\n *\n * RangeToPercent(40,20,60) will return 0.5 (50%)\n * RangeToPercent(34,0,100) will return 0.34 (34%)\n * @param number to convert to percentage\n * @param min min range\n * @param max max range\n * @returns the percentage\n */\n static RangeToPercent(number, min, max) {\n return (number - min) / (max - min);\n }\n /**\n * This function returns number that corresponds to the percentage in a given range.\n *\n * PercentToRange(0.34,0,100) will return 34.\n * @param percent to convert to number\n * @param min min range\n * @param max max range\n * @returns the number\n */\n static PercentToRange(percent, min, max) {\n return (max - min) * percent + min;\n }\n /**\n * Returns the angle converted to equivalent value between -Math.PI and Math.PI radians.\n * @param angle The angle to normalize in radian.\n * @returns The converted angle.\n */\n static NormalizeRadians(angle) {\n // More precise but slower version kept for reference.\n // angle = angle % Tools.TwoPi;\n // angle = (angle + Tools.TwoPi) % Tools.TwoPi;\n //if (angle > Math.PI) {\n //\tangle -= Tools.TwoPi;\n //}\n angle -= Scalar.TwoPi * Math.floor((angle + Math.PI) / Scalar.TwoPi);\n return angle;\n }\n /**\n * Returns the highest common factor of two integers.\n * @param a first parameter\n * @param b second parameter\n * @returns HCF of a and b\n */\n static HCF(a, b) {\n const r = a % b;\n if (r === 0) {\n return b;\n }\n return Scalar.HCF(b, r);\n }\n}\n/**\n * Two pi constants convenient for computation.\n */\nScalar.TwoPi = Math.PI * 2;\n//# sourceMappingURL=math.scalar.js.map","/**\n * Constant used to convert a value to gamma space\n * @ignorenaming\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const ToGammaSpace = 1 / 2.2;\n/**\n * Constant used to convert a value to linear space\n * @ignorenaming\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const ToLinearSpace = 2.2;\n/**\n * Constant Golden Ratio value in Babylon.js\n * @ignorenaming\n */\nexport const PHI = (1 + Math.sqrt(5)) / 2;\n/**\n * Constant used to define the minimal number value in Babylon.js\n * @ignorenaming\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nconst Epsilon = 0.001;\nexport { Epsilon };\n//# sourceMappingURL=math.constants.js.map","/* eslint-disable @typescript-eslint/naming-convention */\n/**\n * Class containing a set of static utilities functions for arrays.\n */\nexport class ArrayTools {\n /**\n * Returns an array of the given size filled with elements built from the given constructor and the parameters.\n * @param size the number of element to construct and put in the array.\n * @param itemBuilder a callback responsible for creating new instance of item. Called once per array entry.\n * @returns a new array filled with new objects.\n */\n static BuildArray(size, itemBuilder) {\n const a = [];\n for (let i = 0; i < size; ++i) {\n a.push(itemBuilder());\n }\n return a;\n }\n /**\n * Returns a tuple of the given size filled with elements built from the given constructor and the parameters.\n * @param size he number of element to construct and put in the tuple.\n * @param itemBuilder a callback responsible for creating new instance of item. Called once per tuple entry.\n * @returns a new tuple filled with new objects.\n */\n static BuildTuple(size, itemBuilder) {\n return ArrayTools.BuildArray(size, itemBuilder);\n }\n}\n/**\n * Observes a function and calls the given callback when it is called.\n * @param object Defines the object the function to observe belongs to.\n * @param functionName Defines the name of the function to observe.\n * @param callback Defines the callback to call when the function is called.\n * @returns A function to call to stop observing\n */\nfunction _observeArrayfunction(object, functionName, callback) {\n // Finds the function to observe\n const oldFunction = object[functionName];\n if (typeof oldFunction !== \"function\") {\n return null;\n }\n // Creates a new function that calls the callback and the old function\n const newFunction = function () {\n const previousLength = object.length;\n const returnValue = newFunction.previous.apply(object, arguments);\n callback(functionName, previousLength);\n return returnValue;\n };\n // Doublishly links the new function and the old function\n oldFunction.next = newFunction;\n newFunction.previous = oldFunction;\n // Replaces the old function with the new function\n object[functionName] = newFunction;\n // Returns a function to disable the hook\n return () => {\n // Only unhook if the function is still hooked\n const previous = newFunction.previous;\n if (!previous) {\n return;\n }\n // Finds the ref to the next function in the chain\n const next = newFunction.next;\n // If in the middle of the chain, link the previous and next functions\n if (next) {\n previous.next = next;\n next.previous = previous;\n }\n // If at the end of the chain, remove the reference to the previous function\n // and restore the previous function\n else {\n previous.next = undefined;\n object[functionName] = previous;\n }\n // Lose reference to the previous and next functions\n newFunction.next = undefined;\n newFunction.previous = undefined;\n };\n}\n/**\n * Defines the list of functions to proxy when observing an array.\n * The scope is currently reduced to the common functions used in the render target render list and the scene cameras.\n */\nconst observedArrayFunctions = [\"push\", \"splice\", \"pop\", \"shift\", \"unshift\"];\n/**\n * Observes an array and notifies the given observer when the array is modified.\n * @param array Defines the array to observe\n * @param callback Defines the function to call when the array is modified (in the limit of the observed array functions)\n * @returns A function to call to stop observing the array\n * @internal\n */\nexport function _ObserveArray(array, callback) {\n // Observes all the required array functions and stores the unhook functions\n const unObserveFunctions = observedArrayFunctions.map((name) => {\n return _observeArrayfunction(array, name, callback);\n });\n // Returns a function that unhook all the observed functions\n return () => {\n unObserveFunctions.forEach((unObserveFunction) => {\n unObserveFunction === null || unObserveFunction === void 0 ? void 0 : unObserveFunction();\n });\n };\n}\n//# sourceMappingURL=arrayTools.js.map","/** @internal */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nconst _RegisteredTypes = {};\n/**\n * @internal\n */\nexport function RegisterClass(className, type) {\n _RegisteredTypes[className] = type;\n}\n/**\n * @internal\n */\nexport function GetClass(fqdn) {\n return _RegisteredTypes[fqdn];\n}\n//# sourceMappingURL=typeStore.js.map","/** @internal */\nexport class PerformanceConfigurator {\n /**\n * @internal\n */\n static SetMatrixPrecision(use64bits) {\n PerformanceConfigurator.MatrixTrackPrecisionChange = false;\n if (use64bits && !PerformanceConfigurator.MatrixUse64Bits) {\n if (PerformanceConfigurator.MatrixTrackedMatrices) {\n for (let m = 0; m < PerformanceConfigurator.MatrixTrackedMatrices.length; ++m) {\n const matrix = PerformanceConfigurator.MatrixTrackedMatrices[m];\n const values = matrix._m;\n matrix._m = new Array(16);\n for (let i = 0; i < 16; ++i) {\n matrix._m[i] = values[i];\n }\n }\n }\n }\n PerformanceConfigurator.MatrixUse64Bits = use64bits;\n PerformanceConfigurator.MatrixCurrentType = PerformanceConfigurator.MatrixUse64Bits ? Array : Float32Array;\n PerformanceConfigurator.MatrixTrackedMatrices = null; // reclaim some memory, as we don't need _TrackedMatrices anymore\n }\n}\n/** @internal */\nPerformanceConfigurator.MatrixUse64Bits = false;\n/** @internal */\nPerformanceConfigurator.MatrixTrackPrecisionChange = true;\n/** @internal */\nPerformanceConfigurator.MatrixCurrentType = Float32Array;\n/** @internal */\nPerformanceConfigurator.MatrixTrackedMatrices = [];\n//# sourceMappingURL=performanceConfigurator.js.map","/**\n * A class serves as a medium between the observable and its observers\n */\nexport class EventState {\n /**\n * Create a new EventState\n * @param mask defines the mask associated with this state\n * @param skipNextObservers defines a flag which will instruct the observable to skip following observers when set to true\n * @param target defines the original target of the state\n * @param currentTarget defines the current target of the state\n */\n constructor(mask, skipNextObservers = false, target, currentTarget) {\n this.initialize(mask, skipNextObservers, target, currentTarget);\n }\n /**\n * Initialize the current event state\n * @param mask defines the mask associated with this state\n * @param skipNextObservers defines a flag which will instruct the observable to skip following observers when set to true\n * @param target defines the original target of the state\n * @param currentTarget defines the current target of the state\n * @returns the current event state\n */\n initialize(mask, skipNextObservers = false, target, currentTarget) {\n this.mask = mask;\n this.skipNextObservers = skipNextObservers;\n this.target = target;\n this.currentTarget = currentTarget;\n return this;\n }\n}\n/**\n * Represent an Observer registered to a given Observable object.\n */\nexport class Observer {\n /**\n * Creates a new observer\n * @param callback defines the callback to call when the observer is notified\n * @param mask defines the mask of the observer (used to filter notifications)\n * @param scope defines the current scope used to restore the JS context\n */\n constructor(\n /**\n * Defines the callback to call when the observer is notified\n */\n callback, \n /**\n * Defines the mask of the observer (used to filter notifications)\n */\n mask, \n /**\n * Defines the current scope used to restore the JS context\n */\n scope = null) {\n this.callback = callback;\n this.mask = mask;\n this.scope = scope;\n /** @internal */\n this._willBeUnregistered = false;\n /**\n * Gets or sets a property defining that the observer as to be unregistered after the next notification\n */\n this.unregisterOnNextCall = false;\n /**\n * this function can be used to remove the observer from the observable.\n * It will be set by the observable that the observer belongs to.\n * @internal\n */\n this._remove = null;\n }\n /**\n * Remove the observer from its observable\n * This can be used instead of using the observable's remove function.\n */\n remove() {\n if (this._remove) {\n this._remove();\n }\n }\n}\n/**\n * The Observable class is a simple implementation of the Observable pattern.\n *\n * There's one slight particularity though: a given Observable can notify its observer using a particular mask value, only the Observers registered with this mask value will be notified.\n * This enable a more fine grained execution without having to rely on multiple different Observable objects.\n * For instance you may have a given Observable that have four different types of notifications: Move (mask = 0x01), Stop (mask = 0x02), Turn Right (mask = 0X04), Turn Left (mask = 0X08).\n * A given observer can register itself with only Move and Stop (mask = 0x03), then it will only be notified when one of these two occurs and will never be for Turn Left/Right.\n */\nexport class Observable {\n /**\n * Create an observable from a Promise.\n * @param promise a promise to observe for fulfillment.\n * @param onErrorObservable an observable to notify if a promise was rejected.\n * @returns the new Observable\n */\n static FromPromise(promise, onErrorObservable) {\n const observable = new Observable();\n promise\n .then((ret) => {\n observable.notifyObservers(ret);\n })\n .catch((err) => {\n if (onErrorObservable) {\n onErrorObservable.notifyObservers(err);\n }\n else {\n throw err;\n }\n });\n return observable;\n }\n /**\n * Gets the list of observers\n * Note that observers that were recently deleted may still be present in the list because they are only really deleted on the next javascript tick!\n */\n get observers() {\n return this._observers;\n }\n /**\n * Creates a new observable\n * @param onObserverAdded defines a callback to call when a new observer is added\n * @param notifyIfTriggered If set to true the observable will notify when an observer was added if the observable was already triggered.\n */\n constructor(onObserverAdded, \n /**\n * If set to true the observable will notify when an observer was added if the observable was already triggered.\n * This is helpful to single-state observables like the scene onReady or the dispose observable.\n */\n notifyIfTriggered = false) {\n this.notifyIfTriggered = notifyIfTriggered;\n this._observers = new Array();\n this._numObserversMarkedAsDeleted = 0;\n this._hasNotified = false;\n this._eventState = new EventState(0);\n if (onObserverAdded) {\n this._onObserverAdded = onObserverAdded;\n }\n }\n /**\n * Create a new Observer with the specified callback\n * @param callback the callback that will be executed for that Observer\n * @param mask the mask used to filter observers\n * @param insertFirst if true the callback will be inserted at the first position, hence executed before the others ones. If false (default behavior) the callback will be inserted at the last position, executed after all the others already present.\n * @param scope optional scope for the callback to be called from\n * @param unregisterOnFirstCall defines if the observer as to be unregistered after the next notification\n * @returns the new observer created for the callback\n */\n add(callback, mask = -1, insertFirst = false, scope = null, unregisterOnFirstCall = false) {\n if (!callback) {\n return null;\n }\n const observer = new Observer(callback, mask, scope);\n observer.unregisterOnNextCall = unregisterOnFirstCall;\n if (insertFirst) {\n this._observers.unshift(observer);\n }\n else {\n this._observers.push(observer);\n }\n if (this._onObserverAdded) {\n this._onObserverAdded(observer);\n }\n // If the observable was already triggered and the observable is set to notify if triggered, notify the new observer\n if (this._hasNotified && this.notifyIfTriggered) {\n if (this._lastNotifiedValue !== undefined) {\n this.notifyObserver(observer, this._lastNotifiedValue);\n }\n }\n // attach the remove function to the observer\n observer._remove = () => {\n this.remove(observer);\n };\n return observer;\n }\n /**\n * Create a new Observer with the specified callback and unregisters after the next notification\n * @param callback the callback that will be executed for that Observer\n * @returns the new observer created for the callback\n */\n addOnce(callback) {\n return this.add(callback, undefined, undefined, undefined, true);\n }\n /**\n * Remove an Observer from the Observable object\n * @param observer the instance of the Observer to remove\n * @returns false if it doesn't belong to this Observable\n */\n remove(observer) {\n if (!observer) {\n return false;\n }\n observer._remove = null;\n const index = this._observers.indexOf(observer);\n if (index !== -1) {\n this._deferUnregister(observer);\n return true;\n }\n return false;\n }\n /**\n * Remove a callback from the Observable object\n * @param callback the callback to remove\n * @param scope optional scope. If used only the callbacks with this scope will be removed\n * @returns false if it doesn't belong to this Observable\n */\n removeCallback(callback, scope) {\n for (let index = 0; index < this._observers.length; index++) {\n const observer = this._observers[index];\n if (observer._willBeUnregistered) {\n continue;\n }\n if (observer.callback === callback && (!scope || scope === observer.scope)) {\n this._deferUnregister(observer);\n return true;\n }\n }\n return false;\n }\n /**\n * @internal\n */\n _deferUnregister(observer) {\n if (observer._willBeUnregistered) {\n return;\n }\n this._numObserversMarkedAsDeleted++;\n observer.unregisterOnNextCall = false;\n observer._willBeUnregistered = true;\n setTimeout(() => {\n this._remove(observer);\n }, 0);\n }\n // This should only be called when not iterating over _observers to avoid callback skipping.\n // Removes an observer from the _observer Array.\n _remove(observer, updateCounter = true) {\n if (!observer) {\n return false;\n }\n const index = this._observers.indexOf(observer);\n if (index !== -1) {\n if (updateCounter) {\n this._numObserversMarkedAsDeleted--;\n }\n this._observers.splice(index, 1);\n return true;\n }\n return false;\n }\n /**\n * Moves the observable to the top of the observer list making it get called first when notified\n * @param observer the observer to move\n */\n makeObserverTopPriority(observer) {\n this._remove(observer, false);\n this._observers.unshift(observer);\n }\n /**\n * Moves the observable to the bottom of the observer list making it get called last when notified\n * @param observer the observer to move\n */\n makeObserverBottomPriority(observer) {\n this._remove(observer, false);\n this._observers.push(observer);\n }\n /**\n * Notify all Observers by calling their respective callback with the given data\n * Will return true if all observers were executed, false if an observer set skipNextObservers to true, then prevent the subsequent ones to execute\n * @param eventData defines the data to send to all observers\n * @param mask defines the mask of the current notification (observers with incompatible mask (ie mask & observer.mask === 0) will not be notified)\n * @param target defines the original target of the state\n * @param currentTarget defines the current target of the state\n * @param userInfo defines any user info to send to observers\n * @returns false if the complete observer chain was not processed (because one observer set the skipNextObservers to true)\n */\n notifyObservers(eventData, mask = -1, target, currentTarget, userInfo) {\n // this prevents potential memory leaks - if an object is disposed but the observable doesn't get cleared.\n if (this.notifyIfTriggered) {\n this._hasNotified = true;\n this._lastNotifiedValue = eventData;\n }\n if (!this._observers.length) {\n return true;\n }\n const state = this._eventState;\n state.mask = mask;\n state.target = target;\n state.currentTarget = currentTarget;\n state.skipNextObservers = false;\n state.lastReturnValue = eventData;\n state.userInfo = userInfo;\n for (const obs of this._observers) {\n if (obs._willBeUnregistered) {\n continue;\n }\n if (obs.mask & mask) {\n if (obs.unregisterOnNextCall) {\n this._deferUnregister(obs);\n }\n if (obs.scope) {\n state.lastReturnValue = obs.callback.apply(obs.scope, [eventData, state]);\n }\n else {\n state.lastReturnValue = obs.callback(eventData, state);\n }\n }\n if (state.skipNextObservers) {\n return false;\n }\n }\n return true;\n }\n /**\n * Notify a specific observer\n * @param observer defines the observer to notify\n * @param eventData defines the data to be sent to each callback\n * @param mask is used to filter observers defaults to -1\n */\n notifyObserver(observer, eventData, mask = -1) {\n // this prevents potential memory leaks - if an object is disposed but the observable doesn't get cleared.\n if (this.notifyIfTriggered) {\n this._hasNotified = true;\n this._lastNotifiedValue = eventData;\n }\n if (observer._willBeUnregistered) {\n return;\n }\n const state = this._eventState;\n state.mask = mask;\n state.skipNextObservers = false;\n if (observer.unregisterOnNextCall) {\n this._deferUnregister(observer);\n }\n observer.callback(eventData, state);\n }\n /**\n * Gets a boolean indicating if the observable has at least one observer\n * @returns true is the Observable has at least one Observer registered\n */\n hasObservers() {\n return this._observers.length - this._numObserversMarkedAsDeleted > 0;\n }\n /**\n * Clear the list of observers\n */\n clear() {\n while (this._observers.length) {\n const o = this._observers.pop();\n if (o) {\n o._remove = null;\n }\n }\n this._onObserverAdded = null;\n this._numObserversMarkedAsDeleted = 0;\n this.cleanLastNotifiedState();\n }\n /**\n * Clean the last notified state - both the internal last value and the has-notified flag\n */\n cleanLastNotifiedState() {\n this._hasNotified = false;\n this._lastNotifiedValue = undefined;\n }\n /**\n * Clone the current observable\n * @returns a new observable\n */\n clone() {\n const result = new Observable();\n result._observers = this._observers.slice(0);\n return result;\n }\n /**\n * Does this observable handles observer registered with a given mask\n * @param mask defines the mask to be tested\n * @returns whether or not one observer registered with the given mask is handled\n **/\n hasSpecificMask(mask = -1) {\n for (const obs of this._observers) {\n if (obs.mask & mask || obs.mask === mask) {\n return true;\n }\n }\n return false;\n }\n}\n//# sourceMappingURL=observable.js.map","import { Observable } from \"../Misc/observable.js\";\n/**\n * The engine store class is responsible to hold all the instances of Engine and Scene created\n * during the life time of the application.\n */\nexport class EngineStore {\n /**\n * Gets the latest created engine\n */\n static get LastCreatedEngine() {\n if (this.Instances.length === 0) {\n return null;\n }\n return this.Instances[this.Instances.length - 1];\n }\n /**\n * Gets the latest created scene\n */\n static get LastCreatedScene() {\n return this._LastCreatedScene;\n }\n}\n/** Gets the list of created engines */\nEngineStore.Instances = new Array();\n/**\n * Notifies when an engine was disposed.\n * Mainly used for static/cache cleanup\n */\nEngineStore.OnEnginesDisposedObservable = new Observable();\n/** @internal */\nEngineStore._LastCreatedScene = null;\n/**\n * Gets or sets a global variable indicating if fallback texture must be used when a texture cannot be loaded\n * @ignorenaming\n */\nEngineStore.UseFallbackTexture = true;\n/**\n * Texture content used if a texture cannot loaded\n * @ignorenaming\n */\nEngineStore.FallbackTexture = \"\";\n//# sourceMappingURL=engineStore.js.map","/* eslint-disable @typescript-eslint/naming-convention */\nimport { Scalar } from \"./math.scalar.js\";\nimport { Epsilon } from \"./math.constants.js\";\nimport { ArrayTools } from \"../Misc/arrayTools.js\";\nimport { RegisterClass } from \"../Misc/typeStore.js\";\nimport { PerformanceConfigurator } from \"../Engines/performanceConfigurator.js\";\nimport { EngineStore } from \"../Engines/engineStore.js\";\n// eslint-disable-next-line @typescript-eslint/naming-convention\nconst _ExtractAsInt = (value) => {\n return parseInt(value.toString().replace(/\\W/g, \"\"));\n};\n/**\n * Class representing a vector containing 2 coordinates\n * Example Playground - Overview - https://playground.babylonjs.com/#QYBWV4#9\n */\nexport class Vector2 {\n /**\n * Creates a new Vector2 from the given x and y coordinates\n * @param x defines the first coordinate\n * @param y defines the second coordinate\n */\n constructor(\n /** defines the first coordinate */\n x = 0, \n /** defines the second coordinate */\n y = 0) {\n this.x = x;\n this.y = y;\n }\n /**\n * Gets a string with the Vector2 coordinates\n * @returns a string with the Vector2 coordinates\n */\n toString() {\n return `{X: ${this.x} Y: ${this.y}}`;\n }\n /**\n * Gets class name\n * @returns the string \"Vector2\"\n */\n getClassName() {\n return \"Vector2\";\n }\n /**\n * Gets current vector hash code\n * @returns the Vector2 hash code as a number\n */\n getHashCode() {\n const x = _ExtractAsInt(this.x);\n const y = _ExtractAsInt(this.y);\n let hash = x;\n hash = (hash * 397) ^ y;\n return hash;\n }\n // Operators\n /**\n * Sets the Vector2 coordinates in the given array or Float32Array from the given index.\n * Example Playground https://playground.babylonjs.com/#QYBWV4#15\n * @param array defines the source array\n * @param index defines the offset in source array\n * @returns the current Vector2\n */\n toArray(array, index = 0) {\n array[index] = this.x;\n array[index + 1] = this.y;\n return this;\n }\n /**\n * Update the current vector from an array\n * Example Playground https://playground.babylonjs.com/#QYBWV4#39\n * @param array defines the destination array\n * @param index defines the offset in the destination array\n * @returns the current Vector2\n */\n fromArray(array, index = 0) {\n Vector2.FromArrayToRef(array, index, this);\n return this;\n }\n /**\n * Copy the current vector to an array\n * Example Playground https://playground.babylonjs.com/#QYBWV4#40\n * @returns a new array with 2 elements: the Vector2 coordinates.\n */\n asArray() {\n const result = new Array();\n this.toArray(result, 0);\n return result;\n }\n /**\n * Sets the Vector2 coordinates with the given Vector2 coordinates\n * Example Playground https://playground.babylonjs.com/#QYBWV4#24\n * @param source defines the source Vector2\n * @returns the current updated Vector2\n */\n copyFrom(source) {\n this.x = source.x;\n this.y = source.y;\n return this;\n }\n /**\n * Sets the Vector2 coordinates with the given floats\n * Example Playground https://playground.babylonjs.com/#QYBWV4#25\n * @param x defines the first coordinate\n * @param y defines the second coordinate\n * @returns the current updated Vector2\n */\n copyFromFloats(x, y) {\n this.x = x;\n this.y = y;\n return this;\n }\n /**\n * Sets the Vector2 coordinates with the given floats\n * Example Playground https://playground.babylonjs.com/#QYBWV4#62\n * @param x defines the first coordinate\n * @param y defines the second coordinate\n * @returns the current updated Vector2\n */\n set(x, y) {\n return this.copyFromFloats(x, y);\n }\n /**\n * Add another vector with the current one\n * Example Playground https://playground.babylonjs.com/#QYBWV4#11\n * @param otherVector defines the other vector\n * @returns a new Vector2 set with the addition of the current Vector2 and the given one coordinates\n */\n add(otherVector) {\n return new this.constructor(this.x + otherVector.x, this.y + otherVector.y);\n }\n /**\n * Sets the \"result\" coordinates with the addition of the current Vector2 and the given one coordinates\n * Example Playground https://playground.babylonjs.com/#QYBWV4#12\n * @param otherVector defines the other vector\n * @param result defines the target vector\n * @returns result input\n */\n addToRef(otherVector, result) {\n result.x = this.x + otherVector.x;\n result.y = this.y + otherVector.y;\n return result;\n }\n /**\n * Set the Vector2 coordinates by adding the given Vector2 coordinates\n * Example Playground https://playground.babylonjs.com/#QYBWV4#13\n * @param otherVector defines the other vector\n * @returns the current updated Vector2\n */\n addInPlace(otherVector) {\n this.x += otherVector.x;\n this.y += otherVector.y;\n return this;\n }\n /**\n * Gets a new Vector2 by adding the current Vector2 coordinates to the given Vector3 x, y coordinates\n * Example Playground https://playground.babylonjs.com/#QYBWV4#14\n * @param otherVector defines the other vector\n * @returns a new Vector2\n */\n addVector3(otherVector) {\n return new this.constructor(this.x + otherVector.x, this.y + otherVector.y);\n }\n /**\n * Gets a new Vector2 set with the subtracted coordinates of the given one from the current Vector2\n * Example Playground https://playground.babylonjs.com/#QYBWV4#61\n * @param otherVector defines the other vector\n * @returns a new Vector2\n */\n subtract(otherVector) {\n return new this.constructor(this.x - otherVector.x, this.y - otherVector.y);\n }\n /**\n * Sets the \"result\" coordinates with the subtraction of the given one from the current Vector2 coordinates.\n * Example Playground https://playground.babylonjs.com/#QYBWV4#63\n * @param otherVector defines the other vector\n * @param result defines the target vector\n * @returns result input\n */\n subtractToRef(otherVector, result) {\n result.x = this.x - otherVector.x;\n result.y = this.y - otherVector.y;\n return result;\n }\n /**\n * Sets the current Vector2 coordinates by subtracting from it the given one coordinates\n * Example Playground https://playground.babylonjs.com/#QYBWV4#88\n * @param otherVector defines the other vector\n * @returns the current updated Vector2\n */\n subtractInPlace(otherVector) {\n this.x -= otherVector.x;\n this.y -= otherVector.y;\n return this;\n }\n /**\n * Multiplies in place the current Vector2 coordinates by the given ones\n * Example Playground https://playground.babylonjs.com/#QYBWV4#43\n * @param otherVector defines the other vector\n * @returns the current updated Vector2\n */\n multiplyInPlace(otherVector) {\n this.x *= otherVector.x;\n this.y *= otherVector.y;\n return this;\n }\n /**\n * Returns a new Vector2 set with the multiplication of the current Vector2 and the given one coordinates\n * Example Playground https://playground.babylonjs.com/#QYBWV4#42\n * @param otherVector defines the other vector\n * @returns a new Vector2\n */\n multiply(otherVector) {\n return new this.constructor(this.x * otherVector.x, this.y * otherVector.y);\n }\n /**\n * Sets \"result\" coordinates with the multiplication of the current Vector2 and the given one coordinates\n * Example Playground https://playground.babylonjs.com/#QYBWV4#44\n * @param otherVector defines the other vector\n * @param result defines the target vector\n * @returns result input\n */\n multiplyToRef(otherVector, result) {\n result.x = this.x * otherVector.x;\n result.y = this.y * otherVector.y;\n return result;\n }\n /**\n * Gets a new Vector2 set with the Vector2 coordinates multiplied by the given floats\n * Example Playground https://playground.babylonjs.com/#QYBWV4#89\n * @param x defines the first coordinate\n * @param y defines the second coordinate\n * @returns a new Vector2\n */\n multiplyByFloats(x, y) {\n return new this.constructor(this.x * x, this.y * y);\n }\n /**\n * Returns a new Vector2 set with the Vector2 coordinates divided by the given one coordinates\n * Example Playground https://playground.babylonjs.com/#QYBWV4#27\n * @param otherVector defines the other vector\n * @returns a new Vector2\n */\n divide(otherVector) {\n return new this.constructor(this.x / otherVector.x, this.y / otherVector.y);\n }\n /**\n * Sets the \"result\" coordinates with the Vector2 divided by the given one coordinates\n * Example Playground https://playground.babylonjs.com/#QYBWV4#30\n * @param otherVector defines the other vector\n * @param result defines the target vector\n * @returns result input\n */\n divideToRef(otherVector, result) {\n result.x = this.x / otherVector.x;\n result.y = this.y / otherVector.y;\n return result;\n }\n /**\n * Divides the current Vector2 coordinates by the given ones\n * Example Playground https://playground.babylonjs.com/#QYBWV4#28\n * @param otherVector defines the other vector\n * @returns the current updated Vector2\n */\n divideInPlace(otherVector) {\n return this.divideToRef(otherVector, this);\n }\n /**\n * Gets a new Vector2 with current Vector2 negated coordinates\n * Example Playground https://playground.babylonjs.com/#QYBWV4#22\n * @returns a new Vector2\n */\n negate() {\n return new this.constructor(-this.x, -this.y);\n }\n /**\n * Negate this vector in place\n * Example Playground https://playground.babylonjs.com/#QYBWV4#23\n * @returns this\n */\n negateInPlace() {\n this.x *= -1;\n this.y *= -1;\n return this;\n }\n /**\n * Negate the current Vector2 and stores the result in the given vector \"result\" coordinates\n * Example Playground https://playground.babylonjs.com/#QYBWV4#41\n * @param result defines the Vector3 object where to store the result\n * @returns the result\n */\n negateToRef(result) {\n return result.copyFromFloats(this.x * -1, this.y * -1);\n }\n /**\n * Multiply the Vector2 coordinates by\n * Example Playground https://playground.babylonjs.com/#QYBWV4#59\n * @param scale defines the scaling factor\n * @returns the current updated Vector2\n */\n scaleInPlace(scale) {\n this.x *= scale;\n this.y *= scale;\n return this;\n }\n /**\n * Returns a new Vector2 scaled by \"scale\" from the current Vector2\n * Example Playground https://playground.babylonjs.com/#QYBWV4#52\n * @param scale defines the scaling factor\n * @returns a new Vector2\n */\n scale(scale) {\n const result = new this.constructor(0, 0);\n this.scaleToRef(scale, result);\n return result;\n }\n /**\n * Scale the current Vector2 values by a factor to a given Vector2\n * Example Playground https://playground.babylonjs.com/#QYBWV4#57\n * @param scale defines the scale factor\n * @param result defines the Vector2 object where to store the result\n * @returns result input\n */\n scaleToRef(scale, result) {\n result.x = this.x * scale;\n result.y = this.y * scale;\n return result;\n }\n /**\n * Scale the current Vector2 values by a factor and add the result to a given Vector2\n * Example Playground https://playground.babylonjs.com/#QYBWV4#58\n * @param scale defines the scale factor\n * @param result defines the Vector2 object where to store the result\n * @returns result input\n */\n scaleAndAddToRef(scale, result) {\n result.x += this.x * scale;\n result.y += this.y * scale;\n return result;\n }\n /**\n * Gets a boolean if two vectors are equals\n * Example Playground https://playground.babylonjs.com/#QYBWV4#31\n * @param otherVector defines the other vector\n * @returns true if the given vector coordinates strictly equal the current Vector2 ones\n */\n equals(otherVector) {\n return otherVector && this.x === otherVector.x && this.y === otherVector.y;\n }\n /**\n * Gets a boolean if two vectors are equals (using an epsilon value)\n * Example Playground https://playground.babylonjs.com/#QYBWV4#32\n * @param otherVector defines the other vector\n * @param epsilon defines the minimal distance to consider equality\n * @returns true if the given vector coordinates are close to the current ones by a distance of epsilon.\n */\n equalsWithEpsilon(otherVector, epsilon = Epsilon) {\n return otherVector && Scalar.WithinEpsilon(this.x, otherVector.x, epsilon) && Scalar.WithinEpsilon(this.y, otherVector.y, epsilon);\n }\n /**\n * Gets a new Vector2 from current Vector2 floored values\n * Example Playground https://playground.babylonjs.com/#QYBWV4#35\n * eg (1.2, 2.31) returns (1, 2)\n * @returns a new Vector2\n */\n floor() {\n return new this.constructor(Math.floor(this.x), Math.floor(this.y));\n }\n /**\n * Gets a new Vector2 from current Vector2 fractional values\n * Example Playground https://playground.babylonjs.com/#QYBWV4#34\n * eg (1.2, 2.31) returns (0.2, 0.31)\n * @returns a new Vector2\n */\n fract() {\n return new this.constructor(this.x - Math.floor(this.x), this.y - Math.floor(this.y));\n }\n /**\n * Rotate the current vector into a given result vector\n * Example Playground https://playground.babylonjs.com/#QYBWV4#49\n * @param angle defines the rotation angle\n * @param result defines the result vector where to store the rotated vector\n * @returns result input\n */\n rotateToRef(angle, result) {\n const cos = Math.cos(angle);\n const sin = Math.sin(angle);\n const x = cos * this.x - sin * this.y;\n const y = sin * this.x + cos * this.y;\n result.x = x;\n result.y = y;\n return result;\n }\n // Properties\n /**\n * Gets the length of the vector\n * @returns the vector length (float)\n */\n length() {\n return Math.sqrt(this.x * this.x + this.y * this.y);\n }\n /**\n * Gets the vector squared length\n * @returns the vector squared length (float)\n */\n lengthSquared() {\n return this.x * this.x + this.y * this.y;\n }\n // Methods\n /**\n * Normalize the vector\n * Example Playground https://playground.babylonjs.com/#QYBWV4#48\n * @returns the current updated Vector2\n */\n normalize() {\n Vector2.NormalizeToRef(this, this);\n return this;\n }\n /**\n * Gets a new Vector2 copied from the Vector2\n * Example Playground https://playground.babylonjs.com/#QYBWV4#20\n * @returns a new Vector2\n */\n clone() {\n return new this.constructor(this.x, this.y);\n }\n // Statics\n /**\n * Gets a new Vector2(0, 0)\n * @returns a new Vector2\n */\n static Zero() {\n return new Vector2(0, 0);\n }\n /**\n * Gets a new Vector2(1, 1)\n * @returns a new Vector2\n */\n static One() {\n return new Vector2(1, 1);\n }\n /**\n * Returns a new Vector2 with random values between min and max\n * @param min the minimum random value\n * @param max the maximum random value\n * @returns a Vector2 with random values between min and max\n */\n static Random(min = 0, max = 1) {\n return new Vector2(Scalar.RandomRange(min, max), Scalar.RandomRange(min, max));\n }\n /**\n * Gets a zero Vector2 that must not be updated\n */\n static get ZeroReadOnly() {\n return Vector2._ZeroReadOnly;\n }\n /**\n * Gets a new Vector2 set from the given index element of the given array\n * Example Playground https://playground.babylonjs.com/#QYBWV4#79\n * @param array defines the data source\n * @param offset defines the offset in the data source\n * @returns a new Vector2\n */\n static FromArray(array, offset = 0) {\n return new Vector2(array[offset], array[offset + 1]);\n }\n /**\n * Sets \"result\" from the given index element of the given array\n * Example Playground https://playground.babylonjs.com/#QYBWV4#80\n * @param array defines the data source\n * @param offset defines the offset in the data source\n * @param result defines the target vector\n * @returns result input\n */\n static FromArrayToRef(array, offset, result) {\n result.x = array[offset];\n result.y = array[offset + 1];\n return result;\n }\n /**\n * Gets a new Vector2 located for \"amount\" (float) on the CatmullRom spline defined by the given four Vector2\n * Example Playground https://playground.babylonjs.com/#QYBWV4#65\n * @param value1 defines 1st point of control\n * @param value2 defines 2nd point of control\n * @param value3 defines 3rd point of control\n * @param value4 defines 4th point of control\n * @param amount defines the interpolation factor\n * @returns a new Vector2\n */\n static CatmullRom(value1, value2, value3, value4, amount) {\n const squared = amount * amount;\n const cubed = amount * squared;\n const x = 0.5 *\n (2.0 * value2.x +\n (-value1.x + value3.x) * amount +\n (2.0 * value1.x - 5.0 * value2.x + 4.0 * value3.x - value4.x) * squared +\n (-value1.x + 3.0 * value2.x - 3.0 * value3.x + value4.x) * cubed);\n const y = 0.5 *\n (2.0 * value2.y +\n (-value1.y + value3.y) * amount +\n (2.0 * value1.y - 5.0 * value2.y + 4.0 * value3.y - value4.y) * squared +\n (-value1.y + 3.0 * value2.y - 3.0 * value3.y + value4.y) * cubed);\n return new value1.constructor(x, y);\n }\n /**\n * Returns a new Vector2 set with same the coordinates than \"value\" ones if the vector \"value\" is in the square defined by \"min\" and \"max\".\n * If a coordinate of \"value\" is lower than \"min\" coordinates, the returned Vector2 is given this \"min\" coordinate.\n * If a coordinate of \"value\" is greater than \"max\" coordinates, the returned Vector2 is given this \"max\" coordinate\n * Example Playground https://playground.babylonjs.com/#QYBWV4#76\n * @param value defines the value to clamp\n * @param min defines the lower limit\n * @param max defines the upper limit\n * @returns a new Vector2\n */\n static Clamp(value, min, max) {\n let x = value.x;\n x = x > max.x ? max.x : x;\n x = x < min.x ? min.x : x;\n let y = value.y;\n y = y > max.y ? max.y : y;\n y = y < min.y ? min.y : y;\n return new value.constructor(x, y);\n }\n /**\n * Returns a new Vector2 located for \"amount\" (float) on the Hermite spline defined by the vectors \"value1\", \"value2\", \"tangent1\", \"tangent2\"\n * Example Playground https://playground.babylonjs.com/#QYBWV4#81\n * @param value1 defines the 1st control point\n * @param tangent1 defines the outgoing tangent\n * @param value2 defines the 2nd control point\n * @param tangent2 defines the incoming tangent\n * @param amount defines the interpolation factor\n * @returns a new Vector2\n */\n static Hermite(value1, tangent1, value2, tangent2, amount) {\n const squared = amount * amount;\n const cubed = amount * squared;\n const part1 = 2.0 * cubed - 3.0 * squared + 1.0;\n const part2 = -2.0 * cubed + 3.0 * squared;\n const part3 = cubed - 2.0 * squared + amount;\n const part4 = cubed - squared;\n const x = value1.x * part1 + value2.x * part2 + tangent1.x * part3 + tangent2.x * part4;\n const y = value1.y * part1 + value2.y * part2 + tangent1.y * part3 + tangent2.y * part4;\n return new value1.constructor(x, y);\n }\n /**\n * Returns a new Vector2 which is the 1st derivative of the Hermite spline defined by the vectors \"value1\", \"value2\", \"tangent1\", \"tangent2\".\n * Example Playground https://playground.babylonjs.com/#QYBWV4#82\n * @param value1 defines the first control point\n * @param tangent1 defines the first tangent\n * @param value2 defines the second control point\n * @param tangent2 defines the second tangent\n * @param time define where the derivative must be done\n * @returns 1st derivative\n */\n static Hermite1stDerivative(value1, tangent1, value2, tangent2, time) {\n const result = new value1.constructor();\n this.Hermite1stDerivativeToRef(value1, tangent1, value2, tangent2, time, result);\n return result;\n }\n /**\n * Returns a new Vector2 which is the 1st derivative of the Hermite spline defined by the vectors \"value1\", \"value2\", \"tangent1\", \"tangent2\".\n * Example Playground https://playground.babylonjs.com/#QYBWV4#83\n * @param value1 defines the first control point\n * @param tangent1 defines the first tangent\n * @param value2 defines the second control point\n * @param tangent2 defines the second tangent\n * @param time define where the derivative must be done\n * @param result define where the derivative will be stored\n * @returns result input\n */\n static Hermite1stDerivativeToRef(value1, tangent1, value2, tangent2, time, result) {\n const t2 = time * time;\n result.x = (t2 - time) * 6 * value1.x + (3 * t2 - 4 * time + 1) * tangent1.x + (-t2 + time) * 6 * value2.x + (3 * t2 - 2 * time) * tangent2.x;\n result.y = (t2 - time) * 6 * value1.y + (3 * t2 - 4 * time + 1) * tangent1.y + (-t2 + time) * 6 * value2.y + (3 * t2 - 2 * time) * tangent2.y;\n return result;\n }\n /**\n * Returns a new Vector2 located for \"amount\" (float) on the linear interpolation between the vector \"start\" adn the vector \"end\".\n * Example Playground https://playground.babylonjs.com/#QYBWV4#84\n * @param start defines the start vector\n * @param end defines the end vector\n * @param amount defines the interpolation factor\n * @returns a new Vector2\n */\n static Lerp(start, end, amount) {\n const x = start.x + (end.x - start.x) * amount;\n const y = start.y + (end.y - start.y) * amount;\n return new start.constructor(x, y);\n }\n /**\n * Gets the dot product of the vector \"left\" and the vector \"right\"\n * Example Playground https://playground.babylonjs.com/#QYBWV4#90\n * @param left defines first vector\n * @param right defines second vector\n * @returns the dot product (float)\n */\n static Dot(left, right) {\n return left.x * right.x + left.y * right.y;\n }\n /**\n * Returns a new Vector2 equal to the normalized given vector\n * Example Playground https://playground.babylonjs.com/#QYBWV4#46\n * @param vector defines the vector to normalize\n * @returns a new Vector2\n */\n static Normalize(vector) {\n const newVector = new vector.constructor();\n this.NormalizeToRef(vector, newVector);\n return newVector;\n }\n /**\n * Normalize a given vector into a second one\n * Example Playground https://playground.babylonjs.com/#QYBWV4#50\n * @param vector defines the vector to normalize\n * @param result defines the vector where to store the result\n * @returns result input\n */\n static NormalizeToRef(vector, result) {\n const len = vector.length();\n if (len === 0) {\n return result;\n }\n result.x = vector.x / len;\n result.y = vector.y / len;\n return result;\n }\n /**\n * Gets a new Vector2 set with the minimal coordinate values from the \"left\" and \"right\" vectors\n * Example Playground https://playground.babylonjs.com/#QYBWV4#86\n * @param left defines 1st vector\n * @param right defines 2nd vector\n * @returns a new Vector2\n */\n static Minimize(left, right) {\n const x = left.x < right.x ? left.x : right.x;\n const y = left.y < right.y ? left.y : right.y;\n return new left.constructor(x, y);\n }\n /**\n * Gets a new Vector2 set with the maximal coordinate values from the \"left\" and \"right\" vectors\n * Example Playground https://playground.babylonjs.com/#QYBWV4#86\n * @param left defines 1st vector\n * @param right defines 2nd vector\n * @returns a new Vector2\n */\n static Maximize(left, right) {\n const x = left.x > right.x ? left.x : right.x;\n const y = left.y > right.y ? left.y : right.y;\n return new left.constructor(x, y);\n }\n /**\n * Gets a new Vector2 set with the transformed coordinates of the given vector by the given transformation matrix\n * Example Playground https://playground.babylonjs.com/#QYBWV4#17\n * @param vector defines the vector to transform\n * @param transformation defines the matrix to apply\n * @returns a new Vector2\n */\n static Transform(vector, transformation) {\n const result = new vector.constructor();\n Vector2.TransformToRef(vector, transformation, result);\n return result;\n }\n /**\n * Transforms the given vector coordinates by the given transformation matrix and stores the result in the vector \"result\" coordinates\n * Example Playground https://playground.babylonjs.com/#QYBWV4#19\n * @param vector defines the vector to transform\n * @param transformation defines the matrix to apply\n * @param result defines the target vector\n * @returns result input\n */\n static TransformToRef(vector, transformation, result) {\n const m = transformation.m;\n const x = vector.x * m[0] + vector.y * m[4] + m[12];\n const y = vector.x * m[1] + vector.y * m[5] + m[13];\n result.x = x;\n result.y = y;\n return result;\n }\n /**\n * Determines if a given vector is included in a triangle\n * Example Playground https://playground.babylonjs.com/#QYBWV4#87\n * @param p defines the vector to test\n * @param p0 defines 1st triangle point\n * @param p1 defines 2nd triangle point\n * @param p2 defines 3rd triangle point\n * @returns true if the point \"p\" is in the triangle defined by the vectors \"p0\", \"p1\", \"p2\"\n */\n static PointInTriangle(p, p0, p1, p2) {\n const a = (1 / 2) * (-p1.y * p2.x + p0.y * (-p1.x + p2.x) + p0.x * (p1.y - p2.y) + p1.x * p2.y);\n const sign = a < 0 ? -1 : 1;\n const s = (p0.y * p2.x - p0.x * p2.y + (p2.y - p0.y) * p.x + (p0.x - p2.x) * p.y) * sign;\n const t = (p0.x * p1.y - p0.y * p1.x + (p0.y - p1.y) * p.x + (p1.x - p0.x) * p.y) * sign;\n return s > 0 && t > 0 && s + t < 2 * a * sign;\n }\n /**\n * Gets the distance between the vectors \"value1\" and \"value2\"\n * Example Playground https://playground.babylonjs.com/#QYBWV4#71\n * @param value1 defines first vector\n * @param value2 defines second vector\n * @returns the distance between vectors\n */\n static Distance(value1, value2) {\n return Math.sqrt(Vector2.DistanceSquared(value1, value2));\n }\n /**\n * Returns the squared distance between the vectors \"value1\" and \"value2\"\n * Example Playground https://playground.babylonjs.com/#QYBWV4#72\n * @param value1 defines first vector\n * @param value2 defines second vector\n * @returns the squared distance between vectors\n */\n static DistanceSquared(value1, value2) {\n const x = value1.x - value2.x;\n const y = value1.y - value2.y;\n return x * x + y * y;\n }\n /**\n * Gets a new Vector2 located at the center of the vectors \"value1\" and \"value2\"\n * Example Playground https://playground.babylonjs.com/#QYBWV4#86\n * Example Playground https://playground.babylonjs.com/#QYBWV4#66\n * @param value1 defines first vector\n * @param value2 defines second vector\n * @returns a new Vector2\n */\n static Center(value1, value2) {\n const result = new value1.constructor();\n return Vector2.CenterToRef(value1, value2, result);\n }\n /**\n * Gets the center of the vectors \"value1\" and \"value2\" and stores the result in the vector \"ref\"\n * Example Playground https://playground.babylonjs.com/#QYBWV4#66\n * @param value1 defines first vector\n * @param value2 defines second vector\n * @param ref defines third vector\n * @returns ref\n */\n static CenterToRef(value1, value2, ref) {\n return ref.copyFromFloats((value1.x + value2.x) / 2, (value1.y + value2.y) / 2);\n }\n /**\n * Gets the shortest distance (float) between the point \"p\" and the segment defined by the two points \"segA\" and \"segB\".\n * Example Playground https://playground.babylonjs.com/#QYBWV4#77\n * @param p defines the middle point\n * @param segA defines one point of the segment\n * @param segB defines the other point of the segment\n * @returns the shortest distance\n */\n static DistanceOfPointFromSegment(p, segA, segB) {\n const l2 = Vector2.DistanceSquared(segA, segB);\n if (l2 === 0.0) {\n return Vector2.Distance(p, segA);\n }\n const v = segB.subtract(segA);\n const t = Math.max(0, Math.min(1, Vector2.Dot(p.subtract(segA), v) / l2));\n const proj = segA.add(v.multiplyByFloats(t, t));\n return Vector2.Distance(p, proj);\n }\n}\nVector2._ZeroReadOnly = Vector2.Zero();\n/**\n * Class used to store (x,y,z) vector representation\n * A Vector3 is the main object used in 3D geometry\n * It can represent either the coordinates of a point the space, either a direction\n * Reminder: js uses a left handed forward facing system\n * Example Playground - Overview - https://playground.babylonjs.com/#R1F8YU\n */\nexport class Vector3 {\n /** Gets or sets the x coordinate */\n get x() {\n return this._x;\n }\n set x(value) {\n this._x = value;\n this._isDirty = true;\n }\n /** Gets or sets the y coordinate */\n get y() {\n return this._y;\n }\n set y(value) {\n this._y = value;\n this._isDirty = true;\n }\n /** Gets or sets the z coordinate */\n get z() {\n return this._z;\n }\n set z(value) {\n this._z = value;\n this._isDirty = true;\n }\n /**\n * Creates a new Vector3 object from the given x, y, z (floats) coordinates.\n * @param x defines the first coordinates (on X axis)\n * @param y defines the second coordinates (on Y axis)\n * @param z defines the third coordinates (on Z axis)\n */\n constructor(x = 0, y = 0, z = 0) {\n /** @internal */\n this._isDirty = true;\n this._x = x;\n this._y = y;\n this._z = z;\n }\n /**\n * Creates a string representation of the Vector3\n * Example Playground https://playground.babylonjs.com/#R1F8YU#67\n * @returns a string with the Vector3 coordinates.\n */\n toString() {\n return `{X: ${this._x} Y: ${this._y} Z: ${this._z}}`;\n }\n /**\n * Gets the class name\n * @returns the string \"Vector3\"\n */\n getClassName() {\n return \"Vector3\";\n }\n /**\n * Creates the Vector3 hash code\n * @returns a number which tends to be unique between Vector3 instances\n */\n getHashCode() {\n const x = _ExtractAsInt(this._x);\n const y = _ExtractAsInt(this._y);\n const z = _ExtractAsInt(this._z);\n let hash = x;\n hash = (hash * 397) ^ y;\n hash = (hash * 397) ^ z;\n return hash;\n }\n // Operators\n /**\n * Creates an array containing three elements : the coordinates of the Vector3\n * Example Playground https://playground.babylonjs.com/#R1F8YU#10\n * @returns a new array of numbers\n */\n asArray() {\n const result = [];\n this.toArray(result, 0);\n return result;\n }\n /**\n * Populates the given array or Float32Array from the given index with the successive coordinates of the Vector3\n * Example Playground https://playground.babylonjs.com/#R1F8YU#65\n * @param array defines the destination array\n * @param index defines the offset in the destination array\n * @returns the current Vector3\n */\n toArray(array, index = 0) {\n array[index] = this._x;\n array[index + 1] = this._y;\n array[index + 2] = this._z;\n return this;\n }\n /**\n * Update the current vector from an array\n * Example Playground https://playground.babylonjs.com/#R1F8YU#24\n * @param array defines the destination array\n * @param index defines the offset in the destination array\n * @returns the current Vector3\n */\n fromArray(array, index = 0) {\n Vector3.FromArrayToRef(array, index, this);\n return this;\n }\n /**\n * Converts the current Vector3 into a quaternion (considering that the Vector3 contains Euler angles representation of a rotation)\n * Example Playground https://playground.babylonjs.com/#R1F8YU#66\n * @returns a new Quaternion object, computed from the Vector3 coordinates\n */\n toQuaternion() {\n return Quaternion.RotationYawPitchRoll(this._y, this._x, this._z);\n }\n /**\n * Adds the given vector to the current Vector3\n * Example Playground https://playground.babylonjs.com/#R1F8YU#4\n * @param otherVector defines the second operand\n * @returns the current updated Vector3\n */\n addInPlace(otherVector) {\n return this.addInPlaceFromFloats(otherVector._x, otherVector._y, otherVector._z);\n }\n /**\n * Adds the given coordinates to the current Vector3\n * Example Playground https://playground.babylonjs.com/#R1F8YU#5\n * @param x defines the x coordinate of the operand\n * @param y defines the y coordinate of the operand\n * @param z defines the z coordinate of the operand\n * @returns the current updated Vector3\n */\n addInPlaceFromFloats(x, y, z) {\n this._x += x;\n this._y += y;\n this._z += z;\n this._isDirty = true;\n return this;\n }\n /**\n * Gets a new Vector3, result of the addition the current Vector3 and the given vector\n * Example Playground https://playground.babylonjs.com/#R1F8YU#3\n * @param otherVector defines the second operand\n * @returns the resulting Vector3\n */\n add(otherVector) {\n return new this.constructor(this._x + otherVector._x, this._y + otherVector._y, this._z + otherVector._z);\n }\n /**\n * Adds the current Vector3 to the given one and stores the result in the vector \"result\"\n * Example Playground https://playground.babylonjs.com/#R1F8YU#6\n * @param otherVector defines the second operand\n * @param result defines the Vector3 object where to store the result\n * @returns the result\n */\n addToRef(otherVector, result) {\n return result.copyFromFloats(this._x + otherVector._x, this._y + otherVector._y, this._z + otherVector._z);\n }\n /**\n * Subtract the given vector from the current Vector3\n * Example Playground https://playground.babylonjs.com/#R1F8YU#61\n * @param otherVector defines the second operand\n * @returns the current updated Vector3\n */\n subtractInPlace(otherVector) {\n this._x -= otherVector._x;\n this._y -= otherVector._y;\n this._z -= otherVector._z;\n this._isDirty = true;\n return this;\n }\n /**\n * Returns a new Vector3, result of the subtraction of the given vector from the current Vector3\n * Example Playground https://playground.babylonjs.com/#R1F8YU#60\n * @param otherVector defines the second operand\n * @returns the resulting Vector3\n */\n subtract(otherVector) {\n return new this.constructor(this._x - otherVector._x, this._y - otherVector._y, this._z - otherVector._z);\n }\n /**\n * Subtracts the given vector from the current Vector3 and stores the result in the vector \"result\".\n * Example Playground https://playground.babylonjs.com/#R1F8YU#63\n * @param otherVector defines the second operand\n * @param result defines the Vector3 object where to store the result\n * @returns the result\n */\n subtractToRef(otherVector, result) {\n return this.subtractFromFloatsToRef(otherVector._x, otherVector._y, otherVector._z, result);\n }\n /**\n * Returns a new Vector3 set with the subtraction of the given floats from the current Vector3 coordinates\n * Example Playground https://playground.babylonjs.com/#R1F8YU#62\n * @param x defines the x coordinate of the operand\n * @param y defines the y coordinate of the operand\n * @param z defines the z coordinate of the operand\n * @returns the resulting Vector3\n */\n subtractFromFloats(x, y, z) {\n return new this.constructor(this._x - x, this._y - y, this._z - z);\n }\n /**\n * Subtracts the given floats from the current Vector3 coordinates and set the given vector \"result\" with this result\n * Example Playground https://playground.babylonjs.com/#R1F8YU#64\n * @param x defines the x coordinate of the operand\n * @param y defines the y coordinate of the operand\n * @param z defines the z coordinate of the operand\n * @param result defines the Vector3 object where to store the result\n * @returns the result\n */\n subtractFromFloatsToRef(x, y, z, result) {\n return result.copyFromFloats(this._x - x, this._y - y, this._z - z);\n }\n /**\n * Gets a new Vector3 set with the current Vector3 negated coordinates\n * Example Playground https://playground.babylonjs.com/#R1F8YU#35\n * @returns a new Vector3\n */\n negate() {\n return new this.constructor(-this._x, -this._y, -this._z);\n }\n /**\n * Negate this vector in place\n * Example Playground https://playground.babylonjs.com/#R1F8YU#36\n * @returns this\n */\n negateInPlace() {\n this._x *= -1;\n this._y *= -1;\n this._z *= -1;\n this._isDirty = true;\n return this;\n }\n /**\n * Negate the current Vector3 and stores the result in the given vector \"result\" coordinates\n * Example Playground https://playground.babylonjs.com/#R1F8YU#37\n * @param result defines the Vector3 object where to store the result\n * @returns the result\n */\n negateToRef(result) {\n return result.copyFromFloats(this._x * -1, this._y * -1, this._z * -1);\n }\n /**\n * Multiplies the Vector3 coordinates by the float \"scale\"\n * Example Playground https://playground.babylonjs.com/#R1F8YU#56\n * @param scale defines the multiplier factor\n * @returns the current updated Vector3\n */\n scaleInPlace(scale) {\n this._x *= scale;\n this._y *= scale;\n this._z *= scale;\n this._isDirty = true;\n return this;\n }\n /**\n * Returns a new Vector3 set with the current Vector3 coordinates multiplied by the float \"scale\"\n * Example Playground https://playground.babylonjs.com/#R1F8YU#53\n * @param scale defines the multiplier factor\n * @returns a new Vector3\n */\n scale(scale) {\n return new this.constructor(this._x * scale, this._y * scale, this._z * scale);\n }\n /**\n * Multiplies the current Vector3 coordinates by the float \"scale\" and stores the result in the given vector \"result\" coordinates\n * Example Playground https://playground.babylonjs.com/#R1F8YU#57\n * @param scale defines the multiplier factor\n * @param result defines the Vector3 object where to store the result\n * @returns the result\n */\n scaleToRef(scale, result) {\n return result.copyFromFloats(this._x * scale, this._y * scale, this._z * scale);\n }\n /**\n * Creates a vector normal (perpendicular) to the current Vector3 and stores the result in the given vector\n * Out of the infinite possibilities the normal chosen is the one formed by rotating the current vector\n * 90 degrees about an axis which lies perpendicular to the current vector\n * and its projection on the xz plane. In the case of a current vector in the xz plane\n * the normal is calculated to be along the y axis.\n * Example Playground https://playground.babylonjs.com/#R1F8YU#230\n * Example Playground https://playground.babylonjs.com/#R1F8YU#231\n * @param result defines the Vector3 object where to store the resultant normal\n * returns the result\n */\n getNormalToRef(result) {\n /**\n * Calculates the spherical coordinates of the current vector\n * so saves on memory rather than importing whole Spherical Class\n */\n const radius = this.length();\n let theta = Math.acos(this.y / radius);\n const phi = Math.atan2(this.z, this.x);\n //makes angle 90 degs to current vector\n if (theta > Math.PI / 2) {\n theta -= Math.PI / 2;\n }\n else {\n theta += Math.PI / 2;\n }\n //Calculates resutant normal vector from spherical coordinate of perpendicular vector\n const x = radius * Math.sin(theta) * Math.cos(phi);\n const y = radius * Math.cos(theta);\n const z = radius * Math.sin(theta) * Math.sin(phi);\n result.set(x, y, z);\n return result;\n }\n /**\n * Rotates the vector using the given unit quaternion and stores the new vector in result\n * Example Playground https://playground.babylonjs.com/#R1F8YU#9\n * @param q the unit quaternion representing the rotation\n * @param result the output vector\n * @returns the result\n */\n applyRotationQuaternionToRef(q, result) {\n // Derived from https://raw.org/proof/vector-rotation-using-quaternions/\n const vx = this._x, vy = this._y, vz = this._z;\n const qx = q._x, qy = q._y, qz = q._z, qw = q._w;\n // t = 2q x v\n const tx = 2 * (qy * vz - qz * vy);\n const ty = 2 * (qz * vx - qx * vz);\n const tz = 2 * (qx * vy - qy * vx);\n // v + w t + q x t\n result._x = vx + qw * tx + qy * tz - qz * ty;\n result._y = vy + qw * ty + qz * tx - qx * tz;\n result._z = vz + qw * tz + qx * ty - qy * tx;\n result._isDirty = true;\n return result;\n }\n /**\n * Rotates the vector in place using the given unit quaternion\n * Example Playground https://playground.babylonjs.com/#R1F8YU#8\n * @param q the unit quaternion representing the rotation\n * @returns the current updated Vector3\n */\n applyRotationQuaternionInPlace(q) {\n return this.applyRotationQuaternionToRef(q, this);\n }\n /**\n * Rotates the vector using the given unit quaternion and returns the new vector\n * Example Playground https://playground.babylonjs.com/#R1F8YU#7\n * @param q the unit quaternion representing the rotation\n * @returns a new Vector3\n */\n applyRotationQuaternion(q) {\n return this.applyRotationQuaternionToRef(q, new this.constructor());\n }\n /**\n * Scale the current Vector3 values by a factor and add the result to a given Vector3\n * Example Playground https://playground.babylonjs.com/#R1F8YU#55\n * @param scale defines the scale factor\n * @param result defines the Vector3 object where to store the result\n * @returns result input\n */\n scaleAndAddToRef(scale, result) {\n return result.addInPlaceFromFloats(this._x * scale, this._y * scale, this._z * scale);\n }\n /**\n * Projects the current point Vector3 to a plane along a ray starting from a specified origin and passing through the current point Vector3.\n * Example Playground https://playground.babylonjs.com/#R1F8YU#48\n * @param plane defines the plane to project to\n * @param origin defines the origin of the projection ray\n * @returns the projected vector3\n */\n projectOnPlane(plane, origin) {\n const result = new this.constructor();\n this.projectOnPlaneToRef(plane, origin, result);\n return result;\n }\n /**\n * Projects the current point Vector3 to a plane along a ray starting from a specified origin and passing through the current point Vector3.\n * Example Playground https://playground.babylonjs.com/#R1F8YU#49\n * @param plane defines the plane to project to\n * @param origin defines the origin of the projection ray\n * @param result defines the Vector3 where to store the result\n * @returns result input\n */\n projectOnPlaneToRef(plane, origin, result) {\n const n = plane.normal;\n const d = plane.d;\n const V = MathTmp.Vector3[0];\n // ray direction\n this.subtractToRef(origin, V);\n V.normalize();\n const denom = Vector3.Dot(V, n);\n //When the ray is close to parallel to the plane return infinity vector\n if (Math.abs(denom) < Math.pow(10, -10)) {\n result.setAll(Infinity);\n }\n else {\n const t = -(Vector3.Dot(origin, n) + d) / denom;\n // P = P0 + t*V\n const scaledV = V.scaleInPlace(t);\n origin.addToRef(scaledV, result);\n }\n return result;\n }\n /**\n * Returns true if the current Vector3 and the given vector coordinates are strictly equal\n * Example Playground https://playground.babylonjs.com/#R1F8YU#19\n * @param otherVector defines the second operand\n * @returns true if both vectors are equals\n */\n equals(otherVector) {\n return otherVector && this._x === otherVector._x && this._y === otherVector._y && this._z === otherVector._z;\n }\n /**\n * Returns true if the current Vector3 and the given vector coordinates are distant less than epsilon\n * Example Playground https://playground.babylonjs.com/#R1F8YU#21\n * @param otherVector defines the second operand\n * @param epsilon defines the minimal distance to define values as equals\n * @returns true if both vectors are distant less than epsilon\n */\n equalsWithEpsilon(otherVector, epsilon = Epsilon) {\n return (otherVector &&\n Scalar.WithinEpsilon(this._x, otherVector._x, epsilon) &&\n Scalar.WithinEpsilon(this._y, otherVector._y, epsilon) &&\n Scalar.WithinEpsilon(this._z, otherVector._z, epsilon));\n }\n /**\n * Returns true if the current Vector3 coordinates equals the given floats\n * Example Playground https://playground.babylonjs.com/#R1F8YU#20\n * @param x defines the x coordinate of the operand\n * @param y defines the y coordinate of the operand\n * @param z defines the z coordinate of the operand\n * @returns true if both vectors are equal\n */\n equalsToFloats(x, y, z) {\n return this._x === x && this._y === y && this._z === z;\n }\n /**\n * Multiplies the current Vector3 coordinates by the given ones\n * Example Playground https://playground.babylonjs.com/#R1F8YU#32\n * @param otherVector defines the second operand\n * @returns the current updated Vector3\n */\n multiplyInPlace(otherVector) {\n this._x *= otherVector._x;\n this._y *= otherVector._y;\n this._z *= otherVector._z;\n this._isDirty = true;\n return this;\n }\n /**\n * Returns a new Vector3, result of the multiplication of the current Vector3 by the given vector\n * Example Playground https://playground.babylonjs.com/#R1F8YU#31\n * @param otherVector defines the second operand\n * @returns the new Vector3\n */\n multiply(otherVector) {\n return this.multiplyByFloats(otherVector._x, otherVector._y, otherVector._z);\n }\n /**\n * Multiplies the current Vector3 by the given one and stores the result in the given vector \"result\"\n * Example Playground https://playground.babylonjs.com/#R1F8YU#33\n * @param otherVector defines the second operand\n * @param result defines the Vector3 object where to store the result\n * @returns the result\n */\n multiplyToRef(otherVector, result) {\n return result.copyFromFloats(this._x * otherVector._x, this._y * otherVector._y, this._z * otherVector._z);\n }\n /**\n * Returns a new Vector3 set with the result of the multiplication of the current Vector3 coordinates by the given floats\n * Example Playground https://playground.babylonjs.com/#R1F8YU#34\n * @param x defines the x coordinate of the operand\n * @param y defines the y coordinate of the operand\n * @param z defines the z coordinate of the operand\n * @returns the new Vector3\n */\n multiplyByFloats(x, y, z) {\n return new this.constructor(this._x * x, this._y * y, this._z * z);\n }\n /**\n * Returns a new Vector3 set with the result of the division of the current Vector3 coordinates by the given ones\n * Example Playground https://playground.babylonjs.com/#R1F8YU#16\n * @param otherVector defines the second operand\n * @returns the new Vector3\n */\n divide(otherVector) {\n return new this.constructor(this._x / otherVector._x, this._y / otherVector._y, this._z / otherVector._z);\n }\n /**\n * Divides the current Vector3 coordinates by the given ones and stores the result in the given vector \"result\"\n * Example Playground https://playground.babylonjs.com/#R1F8YU#18\n * @param otherVector defines the second operand\n * @param result defines the Vector3 object where to store the result\n * @returns the result\n */\n divideToRef(otherVector, result) {\n return result.copyFromFloats(this._x / otherVector._x, this._y / otherVector._y, this._z / otherVector._z);\n }\n /**\n * Divides the current Vector3 coordinates by the given ones.\n * Example Playground https://playground.babylonjs.com/#R1F8YU#17\n * @param otherVector defines the second operand\n * @returns the current updated Vector3\n */\n divideInPlace(otherVector) {\n return this.divideToRef(otherVector, this);\n }\n /**\n * Updates the current Vector3 with the minimal coordinate values between its and the given vector ones\n * Example Playground https://playground.babylonjs.com/#R1F8YU#29\n * @param other defines the second operand\n * @returns the current updated Vector3\n */\n minimizeInPlace(other) {\n return this.minimizeInPlaceFromFloats(other._x, other._y, other._z);\n }\n /**\n * Updates the current Vector3 with the maximal coordinate values between its and the given vector ones.\n * Example Playground https://playground.babylonjs.com/#R1F8YU#27\n * @param other defines the second operand\n * @returns the current updated Vector3\n */\n maximizeInPlace(other) {\n return this.maximizeInPlaceFromFloats(other._x, other._y, other._z);\n }\n /**\n * Updates the current Vector3 with the minimal coordinate values between its and the given coordinates\n * Example Playground https://playground.babylonjs.com/#R1F8YU#30\n * @param x defines the x coordinate of the operand\n * @param y defines the y coordinate of the operand\n * @param z defines the z coordinate of the operand\n * @returns the current updated Vector3\n */\n minimizeInPlaceFromFloats(x, y, z) {\n if (x < this._x) {\n this.x = x;\n }\n if (y < this._y) {\n this.y = y;\n }\n if (z < this._z) {\n this.z = z;\n }\n return this;\n }\n /**\n * Updates the current Vector3 with the maximal coordinate values between its and the given coordinates.\n * Example Playground https://playground.babylonjs.com/#R1F8YU#28\n * @param x defines the x coordinate of the operand\n * @param y defines the y coordinate of the operand\n * @param z defines the z coordinate of the operand\n * @returns the current updated Vector3\n */\n maximizeInPlaceFromFloats(x, y, z) {\n if (x > this._x) {\n this.x = x;\n }\n if (y > this._y) {\n this.y = y;\n }\n if (z > this._z) {\n this.z = z;\n }\n return this;\n }\n /**\n * Due to float precision, scale of a mesh could be uniform but float values are off by a small fraction\n * Check if is non uniform within a certain amount of decimal places to account for this\n * @param epsilon the amount the values can differ\n * @returns if the the vector is non uniform to a certain number of decimal places\n */\n isNonUniformWithinEpsilon(epsilon) {\n const absX = Math.abs(this._x);\n const absY = Math.abs(this._y);\n if (!Scalar.WithinEpsilon(absX, absY, epsilon)) {\n return true;\n }\n const absZ = Math.abs(this._z);\n if (!Scalar.WithinEpsilon(absX, absZ, epsilon)) {\n return true;\n }\n if (!Scalar.WithinEpsilon(absY, absZ, epsilon)) {\n return true;\n }\n return false;\n }\n /**\n * Gets a boolean indicating that the vector is non uniform meaning x, y or z are not all the same\n */\n get isNonUniform() {\n const absX = Math.abs(this._x);\n const absY = Math.abs(this._y);\n if (absX !== absY) {\n return true;\n }\n const absZ = Math.abs(this._z);\n if (absX !== absZ) {\n return true;\n }\n return false;\n }\n /**\n * Gets a new Vector3 from current Vector3 floored values\n * Example Playground https://playground.babylonjs.com/#R1F8YU#22\n * @returns a new Vector3\n */\n floor() {\n return new this.constructor(Math.floor(this._x), Math.floor(this._y), Math.floor(this._z));\n }\n /**\n * Gets a new Vector3 from current Vector3 fractional values\n * Example Playground https://playground.babylonjs.com/#R1F8YU#23\n * @returns a new Vector3\n */\n fract() {\n return new this.constructor(this._x - Math.floor(this._x), this._y - Math.floor(this._y), this._z - Math.floor(this._z));\n }\n // Properties\n /**\n * Gets the length of the Vector3\n * Example Playground https://playground.babylonjs.com/#R1F8YU#25\n * @returns the length of the Vector3\n */\n length() {\n return Math.sqrt(this._x * this._x + this._y * this._y + this._z * this._z);\n }\n /**\n * Gets the squared length of the Vector3\n * Example Playground https://playground.babylonjs.com/#R1F8YU#26\n * @returns squared length of the Vector3\n */\n lengthSquared() {\n return this._x * this._x + this._y * this._y + this._z * this._z;\n }\n /**\n * Gets a boolean indicating if the vector contains a zero in one of its components\n * Example Playground https://playground.babylonjs.com/#R1F8YU#1\n */\n get hasAZeroComponent() {\n return this._x * this._y * this._z === 0;\n }\n /**\n * Normalize the current Vector3.\n * Please note that this is an in place operation.\n * Example Playground https://playground.babylonjs.com/#R1F8YU#122\n * @returns the current updated Vector3\n */\n normalize() {\n return this.normalizeFromLength(this.length());\n }\n /**\n * Reorders the x y z properties of the vector in place\n * Example Playground https://playground.babylonjs.com/#R1F8YU#44\n * @param order new ordering of the properties (eg. for vector 1,2,3 with \"ZYX\" will produce 3,2,1)\n * @returns the current updated vector\n */\n reorderInPlace(order) {\n order = order.toLowerCase();\n if (order === \"xyz\") {\n return this;\n }\n MathTmp.Vector3[0].copyFrom(this);\n [\"x\", \"y\", \"z\"].forEach((val, i) => {\n this[val] = MathTmp.Vector3[0][order[i]];\n });\n return this;\n }\n /**\n * Rotates the vector around 0,0,0 by a quaternion\n * Example Playground https://playground.babylonjs.com/#R1F8YU#47\n * @param quaternion the rotation quaternion\n * @param result vector to store the result\n * @returns the resulting vector\n */\n rotateByQuaternionToRef(quaternion, result) {\n quaternion.toRotationMatrix(MathTmp.Matrix[0]);\n Vector3.TransformCoordinatesToRef(this, MathTmp.Matrix[0], result);\n return result;\n }\n /**\n * Rotates a vector around a given point\n * Example Playground https://playground.babylonjs.com/#R1F8YU#46\n * @param quaternion the rotation quaternion\n * @param point the point to rotate around\n * @param result vector to store the result\n * @returns the resulting vector\n */\n rotateByQuaternionAroundPointToRef(quaternion, point, result) {\n this.subtractToRef(point, MathTmp.Vector3[0]);\n MathTmp.Vector3[0].rotateByQuaternionToRef(quaternion, MathTmp.Vector3[0]);\n point.addToRef(MathTmp.Vector3[0], result);\n return result;\n }\n /**\n * Returns a new Vector3 as the cross product of the current vector and the \"other\" one\n * The cross product is then orthogonal to both current and \"other\"\n * Example Playground https://playground.babylonjs.com/#R1F8YU#14\n * @param other defines the right operand\n * @returns the cross product\n */\n cross(other) {\n const result = new this.constructor();\n return Vector3.CrossToRef(this, other, result);\n }\n /**\n * Normalize the current Vector3 with the given input length.\n * Please note that this is an in place operation.\n * Example Playground https://playground.babylonjs.com/#R1F8YU#123\n * @param len the length of the vector\n * @returns the current updated Vector3\n */\n normalizeFromLength(len) {\n if (len === 0 || len === 1.0) {\n return this;\n }\n return this.scaleInPlace(1.0 / len);\n }\n /**\n * Normalize the current Vector3 to a new vector\n * Example Playground https://playground.babylonjs.com/#R1F8YU#124\n * @returns the new Vector3\n */\n normalizeToNew() {\n const normalized = new this.constructor(0, 0, 0);\n this.normalizeToRef(normalized);\n return normalized;\n }\n /**\n * Normalize the current Vector3 to the reference\n * Example Playground https://playground.babylonjs.com/#R1F8YU#125\n * @param reference define the Vector3 to update\n * @returns the updated Vector3\n */\n normalizeToRef(reference) {\n const len = this.length();\n if (len === 0 || len === 1.0) {\n return reference.copyFromFloats(this._x, this._y, this._z);\n }\n return this.scaleToRef(1.0 / len, reference);\n }\n /**\n * Creates a new Vector3 copied from the current Vector3\n * Example Playground https://playground.babylonjs.com/#R1F8YU#11\n * @returns the new Vector3\n */\n clone() {\n return new this.constructor(this._x, this._y, this._z);\n }\n /**\n * Copies the given vector coordinates to the current Vector3 ones\n * Example Playground https://playground.babylonjs.com/#R1F8YU#12\n * @param source defines the source Vector3\n * @returns the current updated Vector3\n */\n copyFrom(source) {\n return this.copyFromFloats(source._x, source._y, source._z);\n }\n /**\n * Copies the given floats to the current Vector3 coordinates\n * Example Playground https://playground.babylonjs.com/#R1F8YU#13\n * @param x defines the x coordinate of the operand\n * @param y defines the y coordinate of the operand\n * @param z defines the z coordinate of the operand\n * @returns the current updated Vector3\n */\n copyFromFloats(x, y, z) {\n this._x = x;\n this._y = y;\n this._z = z;\n this._isDirty = true;\n return this;\n }\n /**\n * Copies the given floats to the current Vector3 coordinates\n * Example Playground https://playground.babylonjs.com/#R1F8YU#58\n * @param x defines the x coordinate of the operand\n * @param y defines the y coordinate of the operand\n * @param z defines the z coordinate of the operand\n * @returns the current updated Vector3\n */\n set(x, y, z) {\n return this.copyFromFloats(x, y, z);\n }\n /**\n * Copies the given float to the current Vector3 coordinates\n * Example Playground https://playground.babylonjs.com/#R1F8YU#59\n * @param v defines the x, y and z coordinates of the operand\n * @returns the current updated Vector3\n */\n setAll(v) {\n this._x = this._y = this._z = v;\n this._isDirty = true;\n return this;\n }\n // Statics\n /**\n * Get the clip factor between two vectors\n * Example Playground https://playground.babylonjs.com/#R1F8YU#126\n * @param vector0 defines the first operand\n * @param vector1 defines the second operand\n * @param axis defines the axis to use\n * @param size defines the size along the axis\n * @returns the clip factor\n */\n static GetClipFactor(vector0, vector1, axis, size) {\n const d0 = Vector3.Dot(vector0, axis) - size;\n const d1 = Vector3.Dot(vector1, axis) - size;\n const s = d0 / (d0 - d1);\n return s;\n }\n /**\n * Get angle between two vectors\n * Example Playground https://playground.babylonjs.com/#R1F8YU#86\n * @param vector0 the starting point\n * @param vector1 the ending point\n * @param normal direction of the normal\n * @returns the angle between vector0 and vector1\n */\n static GetAngleBetweenVectors(vector0, vector1, normal) {\n const v0 = vector0.normalizeToRef(MathTmp.Vector3[1]);\n const v1 = vector1.normalizeToRef(MathTmp.Vector3[2]);\n let dot = Vector3.Dot(v0, v1);\n // Vectors are normalized so dot will be in [-1, 1] (aside precision issues enough to break the result which explains the below clamp)\n dot = Scalar.Clamp(dot, -1, 1);\n const angle = Math.acos(dot);\n const n = MathTmp.Vector3[3];\n Vector3.CrossToRef(v0, v1, n);\n if (Vector3.Dot(n, normal) > 0) {\n return isNaN(angle) ? 0 : angle;\n }\n return isNaN(angle) ? -Math.PI : -Math.acos(dot);\n }\n /**\n * Get angle between two vectors projected on a plane\n * Example Playground https://playground.babylonjs.com/#R1F8YU#87\n * Expectation compute time: 0.01 ms (median) and 0.02 ms (percentile 95%)\n * @param vector0 angle between vector0 and vector1\n * @param vector1 angle between vector0 and vector1\n * @param normal Normal of the projection plane\n * @returns the angle in radians (float) between vector0 and vector1 projected on the plane with the specified normal\n */\n static GetAngleBetweenVectorsOnPlane(vector0, vector1, normal) {\n MathTmp.Vector3[0].copyFrom(vector0);\n const v0 = MathTmp.Vector3[0];\n MathTmp.Vector3[1].copyFrom(vector1);\n const v1 = MathTmp.Vector3[1];\n MathTmp.Vector3[2].copyFrom(normal);\n const vNormal = MathTmp.Vector3[2];\n const right = MathTmp.Vector3[3];\n const forward = MathTmp.Vector3[4];\n v0.normalize();\n v1.normalize();\n vNormal.normalize();\n Vector3.CrossToRef(vNormal, v0, right);\n Vector3.CrossToRef(right, vNormal, forward);\n const angle = Math.atan2(Vector3.Dot(v1, right), Vector3.Dot(v1, forward));\n return Scalar.NormalizeRadians(angle);\n }\n /**\n * Gets the rotation that aligns the roll axis (Y) to the line joining the start point to the target point and stores it in the ref Vector3\n * Example PG https://playground.babylonjs.com/#R1F8YU#189\n * @param start the starting point\n * @param target the target point\n * @param ref the vector3 to store the result\n * @returns ref in the form (pitch, yaw, 0)\n */\n static PitchYawRollToMoveBetweenPointsToRef(start, target, ref) {\n const diff = TmpVectors.Vector3[0];\n target.subtractToRef(start, diff);\n ref._y = Math.atan2(diff.x, diff.z) || 0;\n ref._x = Math.atan2(Math.sqrt(diff.x ** 2 + diff.z ** 2), diff.y) || 0;\n ref._z = 0;\n ref._isDirty = true;\n return ref;\n }\n /**\n * Gets the rotation that aligns the roll axis (Y) to the line joining the start point to the target point\n * Example PG https://playground.babylonjs.com/#R1F8YU#188\n * @param start the starting point\n * @param target the target point\n * @returns the rotation in the form (pitch, yaw, 0)\n */\n static PitchYawRollToMoveBetweenPoints(start, target) {\n const ref = Vector3.Zero();\n return Vector3.PitchYawRollToMoveBetweenPointsToRef(start, target, ref);\n }\n /**\n * Slerp between two vectors. See also `SmoothToRef`\n * Slerp is a spherical linear interpolation\n * giving a slow in and out effect\n * Example Playground 1 https://playground.babylonjs.com/#R1F8YU#108\n * Example Playground 2 https://playground.babylonjs.com/#R1F8YU#109\n * @param vector0 Start vector\n * @param vector1 End vector\n * @param slerp amount (will be clamped between 0 and 1)\n * @param result The slerped vector\n */\n static SlerpToRef(vector0, vector1, slerp, result) {\n slerp = Scalar.Clamp(slerp, 0, 1);\n const vector0Dir = MathTmp.Vector3[0];\n const vector1Dir = MathTmp.Vector3[1];\n vector0Dir.copyFrom(vector0);\n const vector0Length = vector0Dir.length();\n vector0Dir.normalizeFromLength(vector0Length);\n vector1Dir.copyFrom(vector1);\n const vector1Length = vector1Dir.length();\n vector1Dir.normalizeFromLength(vector1Length);\n const dot = Vector3.Dot(vector0Dir, vector1Dir);\n let scale0;\n let scale1;\n if (dot < 1 - Epsilon) {\n const omega = Math.acos(dot);\n const invSin = 1 / Math.sin(omega);\n scale0 = Math.sin((1 - slerp) * omega) * invSin;\n scale1 = Math.sin(slerp * omega) * invSin;\n }\n else {\n // Use linear interpolation\n scale0 = 1 - slerp;\n scale1 = slerp;\n }\n vector0Dir.scaleInPlace(scale0);\n vector1Dir.scaleInPlace(scale1);\n result.copyFrom(vector0Dir).addInPlace(vector1Dir);\n result.scaleInPlace(Scalar.Lerp(vector0Length, vector1Length, slerp));\n return result;\n }\n /**\n * Smooth interpolation between two vectors using Slerp\n * Example Playground https://playground.babylonjs.com/#R1F8YU#110\n * @param source source vector\n * @param goal goal vector\n * @param deltaTime current interpolation frame\n * @param lerpTime total interpolation time\n * @param result the smoothed vector\n */\n static SmoothToRef(source, goal, deltaTime, lerpTime, result) {\n Vector3.SlerpToRef(source, goal, lerpTime === 0 ? 1 : deltaTime / lerpTime, result);\n return result;\n }\n /**\n * Returns a new Vector3 set from the index \"offset\" of the given array\n * Example Playground https://playground.babylonjs.com/#R1F8YU#83\n * @param array defines the source array\n * @param offset defines the offset in the source array\n * @returns the new Vector3\n */\n static FromArray(array, offset = 0) {\n return new Vector3(array[offset], array[offset + 1], array[offset + 2]);\n }\n /**\n * Returns a new Vector3 set from the index \"offset\" of the given Float32Array\n * @param array defines the source array\n * @param offset defines the offset in the source array\n * @returns the new Vector3\n * @deprecated Please use FromArray instead.\n */\n static FromFloatArray(array, offset) {\n return Vector3.FromArray(array, offset);\n }\n /**\n * Sets the given vector \"result\" with the element values from the index \"offset\" of the given array\n * Example Playground https://playground.babylonjs.com/#R1F8YU#84\n * @param array defines the source array\n * @param offset defines the offset in the source array\n * @param result defines the Vector3 where to store the result\n * @returns result input\n */\n static FromArrayToRef(array, offset, result) {\n result._x = array[offset];\n result._y = array[offset + 1];\n result._z = array[offset + 2];\n result._isDirty = true;\n return result;\n }\n /**\n * Sets the given vector \"result\" with the element values from the index \"offset\" of the given Float32Array\n * @param array defines the source array\n * @param offset defines the offset in the source array\n * @param result defines the Vector3 where to store the result\n * @deprecated Please use FromArrayToRef instead.\n */\n static FromFloatArrayToRef(array, offset, result) {\n return Vector3.FromArrayToRef(array, offset, result);\n }\n /**\n * Sets the given vector \"result\" with the given floats.\n * Example Playground https://playground.babylonjs.com/#R1F8YU#85\n * @param x defines the x coordinate of the source\n * @param y defines the y coordinate of the source\n * @param z defines the z coordinate of the source\n * @param result defines the Vector3 where to store the result\n */\n static FromFloatsToRef(x, y, z, result) {\n result.copyFromFloats(x, y, z);\n return result;\n }\n /**\n * Returns a new Vector3 set to (0.0, 0.0, 0.0)\n * @returns a new empty Vector3\n */\n static Zero() {\n return new Vector3(0.0, 0.0, 0.0);\n }\n /**\n * Returns a new Vector3 set to (1.0, 1.0, 1.0)\n * @returns a new Vector3\n */\n static One() {\n return new Vector3(1.0, 1.0, 1.0);\n }\n /**\n * Returns a new Vector3 set to (0.0, 1.0, 0.0)\n * Example Playground https://playground.babylonjs.com/#R1F8YU#71\n * @returns a new up Vector3\n */\n static Up() {\n return new Vector3(0.0, 1.0, 0.0);\n }\n /**\n * Gets an up Vector3 that must not be updated\n */\n static get UpReadOnly() {\n return Vector3._UpReadOnly;\n }\n /**\n * Gets a down Vector3 that must not be updated\n */\n static get DownReadOnly() {\n return Vector3._DownReadOnly;\n }\n /**\n * Gets a right Vector3 that must not be updated\n */\n static get RightReadOnly() {\n return Vector3._RightReadOnly;\n }\n /**\n * Gets a left Vector3 that must not be updated\n */\n static get LeftReadOnly() {\n return Vector3._LeftReadOnly;\n }\n /**\n * Gets a forward Vector3 that must not be updated\n */\n static get LeftHandedForwardReadOnly() {\n return Vector3._LeftHandedForwardReadOnly;\n }\n /**\n * Gets a forward Vector3 that must not be updated\n */\n static get RightHandedForwardReadOnly() {\n return Vector3._RightHandedForwardReadOnly;\n }\n /**\n * Gets a backward Vector3 that must not be updated\n */\n static get LeftHandedBackwardReadOnly() {\n return Vector3._LeftHandedBackwardReadOnly;\n }\n /**\n * Gets a backward Vector3 that must not be updated\n */\n static get RightHandedBackwardReadOnly() {\n return Vector3._RightHandedBackwardReadOnly;\n }\n /**\n * Gets a zero Vector3 that must not be updated\n */\n static get ZeroReadOnly() {\n return Vector3._ZeroReadOnly;\n }\n /**\n * Gets a one Vector3 that must not be updated\n */\n static get OneReadOnly() {\n return Vector3._OneReadOnly;\n }\n /**\n * Returns a new Vector3 set to (0.0, -1.0, 0.0)\n * Example Playground https://playground.babylonjs.com/#R1F8YU#71\n * @returns a new down Vector3\n */\n static Down() {\n return new Vector3(0.0, -1.0, 0.0);\n }\n /**\n * Returns a new Vector3 set to (0.0, 0.0, 1.0)\n * Example Playground https://playground.babylonjs.com/#R1F8YU#71\n * @param rightHandedSystem is the scene right-handed (negative z)\n * @returns a new forward Vector3\n */\n static Forward(rightHandedSystem = false) {\n return new Vector3(0.0, 0.0, rightHandedSystem ? -1.0 : 1.0);\n }\n /**\n * Returns a new Vector3 set to (0.0, 0.0, -1.0)\n * Example Playground https://playground.babylonjs.com/#R1F8YU#71\n * @param rightHandedSystem is the scene right-handed (negative-z)\n * @returns a new Backward Vector3\n */\n static Backward(rightHandedSystem = false) {\n return new Vector3(0.0, 0.0, rightHandedSystem ? 1.0 : -1.0);\n }\n /**\n * Returns a new Vector3 set to (1.0, 0.0, 0.0)\n * Example Playground https://playground.babylonjs.com/#R1F8YU#71\n * @returns a new right Vector3\n */\n static Right() {\n return new Vector3(1.0, 0.0, 0.0);\n }\n /**\n * Returns a new Vector3 set to (-1.0, 0.0, 0.0)\n * Example Playground https://playground.babylonjs.com/#R1F8YU#71\n * @returns a new left Vector3\n */\n static Left() {\n return new Vector3(-1.0, 0.0, 0.0);\n }\n /**\n * Returns a new Vector3 with random values between min and max\n * @param min the minimum random value\n * @param max the maximum random value\n * @returns a Vector3 with random values between min and max\n */\n static Random(min = 0, max = 1) {\n return new Vector3(Scalar.RandomRange(min, max), Scalar.RandomRange(min, max), Scalar.RandomRange(min, max));\n }\n /**\n * Returns a new Vector3 set with the result of the transformation by the given matrix of the given vector.\n * This method computes transformed coordinates only, not transformed direction vectors (ie. it takes translation in account)\n * Example Playground https://playground.babylonjs.com/#R1F8YU#111\n * @param vector defines the Vector3 to transform\n * @param transformation defines the transformation matrix\n * @returns the transformed Vector3\n */\n static TransformCoordinates(vector, transformation) {\n const result = Vector3.Zero();\n Vector3.TransformCoordinatesToRef(vector, transformation, result);\n return result;\n }\n /**\n * Sets the given vector \"result\" coordinates with the result of the transformation by the given matrix of the given vector\n * This method computes transformed coordinates only, not transformed direction vectors (ie. it takes translation in account)\n * Example Playground https://playground.babylonjs.com/#R1F8YU#113\n * @param vector defines the Vector3 to transform\n * @param transformation defines the transformation matrix\n * @param result defines the Vector3 where to store the result\n * @returns result input\n */\n static TransformCoordinatesToRef(vector, transformation, result) {\n Vector3.TransformCoordinatesFromFloatsToRef(vector._x, vector._y, vector._z, transformation, result);\n return result;\n }\n /**\n * Sets the given vector \"result\" coordinates with the result of the transformation by the given matrix of the given floats (x, y, z)\n * This method computes transformed coordinates only, not transformed direction vectors\n * Example Playground https://playground.babylonjs.com/#R1F8YU#115\n * @param x define the x coordinate of the source vector\n * @param y define the y coordinate of the source vector\n * @param z define the z coordinate of the source vector\n * @param transformation defines the transformation matrix\n * @param result defines the Vector3 where to store the result\n * @returns result input\n */\n static TransformCoordinatesFromFloatsToRef(x, y, z, transformation, result) {\n const m = transformation.m;\n const rx = x * m[0] + y * m[4] + z * m[8] + m[12];\n const ry = x * m[1] + y * m[5] + z * m[9] + m[13];\n const rz = x * m[2] + y * m[6] + z * m[10] + m[14];\n const rw = 1 / (x * m[3] + y * m[7] + z * m[11] + m[15]);\n result._x = rx * rw;\n result._y = ry * rw;\n result._z = rz * rw;\n result._isDirty = true;\n return result;\n }\n /**\n * Returns a new Vector3 set with the result of the normal transformation by the given matrix of the given vector\n * This methods computes transformed normalized direction vectors only (ie. it does not apply translation)\n * Example Playground https://playground.babylonjs.com/#R1F8YU#112\n * @param vector defines the Vector3 to transform\n * @param transformation defines the transformation matrix\n * @returns the new Vector3\n */\n static TransformNormal(vector, transformation) {\n const result = Vector3.Zero();\n Vector3.TransformNormalToRef(vector, transformation, result);\n return result;\n }\n /**\n * Sets the given vector \"result\" with the result of the normal transformation by the given matrix of the given vector\n * This methods computes transformed normalized direction vectors only (ie. it does not apply translation)\n * Example Playground https://playground.babylonjs.com/#R1F8YU#114\n * @param vector defines the Vector3 to transform\n * @param transformation defines the transformation matrix\n * @param result defines the Vector3 where to store the result\n * @returns result input\n */\n static TransformNormalToRef(vector, transformation, result) {\n this.TransformNormalFromFloatsToRef(vector._x, vector._y, vector._z, transformation, result);\n return result;\n }\n /**\n * Sets the given vector \"result\" with the result of the normal transformation by the given matrix of the given floats (x, y, z)\n * This methods computes transformed normalized direction vectors only (ie. it does not apply translation)\n * Example Playground https://playground.babylonjs.com/#R1F8YU#116\n * @param x define the x coordinate of the source vector\n * @param y define the y coordinate of the source vector\n * @param z define the z coordinate of the source vector\n * @param transformation defines the transformation matrix\n * @param result defines the Vector3 where to store the result\n * @returns result input\n */\n static TransformNormalFromFloatsToRef(x, y, z, transformation, result) {\n const m = transformation.m;\n result._x = x * m[0] + y * m[4] + z * m[8];\n result._y = x * m[1] + y * m[5] + z * m[9];\n result._z = x * m[2] + y * m[6] + z * m[10];\n result._isDirty = true;\n return result;\n }\n /**\n * Returns a new Vector3 located for \"amount\" on the CatmullRom interpolation spline defined by the vectors \"value1\", \"value2\", \"value3\", \"value4\"\n * Example Playground https://playground.babylonjs.com/#R1F8YU#69\n * @param value1 defines the first control point\n * @param value2 defines the second control point\n * @param value3 defines the third control point\n * @param value4 defines the fourth control point\n * @param amount defines the amount on the spline to use\n * @returns the new Vector3\n */\n static CatmullRom(value1, value2, value3, value4, amount) {\n const squared = amount * amount;\n const cubed = amount * squared;\n const x = 0.5 *\n (2.0 * value2._x +\n (-value1._x + value3._x) * amount +\n (2.0 * value1._x - 5.0 * value2._x + 4.0 * value3._x - value4._x) * squared +\n (-value1._x + 3.0 * value2._x - 3.0 * value3._x + value4._x) * cubed);\n const y = 0.5 *\n (2.0 * value2._y +\n (-value1._y + value3._y) * amount +\n (2.0 * value1._y - 5.0 * value2._y + 4.0 * value3._y - value4._y) * squared +\n (-value1._y + 3.0 * value2._y - 3.0 * value3._y + value4._y) * cubed);\n const z = 0.5 *\n (2.0 * value2._z +\n (-value1._z + value3._z) * amount +\n (2.0 * value1._z - 5.0 * value2._z + 4.0 * value3._z - value4._z) * squared +\n (-value1._z + 3.0 * value2._z - 3.0 * value3._z + value4._z) * cubed);\n return new value1.constructor(x, y, z);\n }\n /**\n * Returns a new Vector3 set with the coordinates of \"value\", if the vector \"value\" is in the cube defined by the vectors \"min\" and \"max\"\n * If a coordinate value of \"value\" is lower than one of the \"min\" coordinate, then this \"value\" coordinate is set with the \"min\" one\n * If a coordinate value of \"value\" is greater than one of the \"max\" coordinate, then this \"value\" coordinate is set with the \"max\" one\n * Example Playground https://playground.babylonjs.com/#R1F8YU#76\n * @param value defines the current value\n * @param min defines the lower range value\n * @param max defines the upper range value\n * @returns the new Vector3\n */\n static Clamp(value, min, max) {\n const result = new value.constructor();\n Vector3.ClampToRef(value, min, max, result);\n return result;\n }\n /**\n * Sets the given vector \"result\" with the coordinates of \"value\", if the vector \"value\" is in the cube defined by the vectors \"min\" and \"max\"\n * If a coordinate value of \"value\" is lower than one of the \"min\" coordinate, then this \"value\" coordinate is set with the \"min\" one\n * If a coordinate value of \"value\" is greater than one of the \"max\" coordinate, then this \"value\" coordinate is set with the \"max\" one\n * Example Playground https://playground.babylonjs.com/#R1F8YU#77\n * @param value defines the current value\n * @param min defines the lower range value\n * @param max defines the upper range value\n * @param result defines the Vector3 where to store the result\n * @returns result input\n */\n static ClampToRef(value, min, max, result) {\n let x = value._x;\n x = x > max._x ? max._x : x;\n x = x < min._x ? min._x : x;\n let y = value._y;\n y = y > max._y ? max._y : y;\n y = y < min._y ? min._y : y;\n let z = value._z;\n z = z > max._z ? max._z : z;\n z = z < min._z ? min._z : z;\n result.copyFromFloats(x, y, z);\n return result;\n }\n /**\n * Checks if a given vector is inside a specific range\n * Example Playground https://playground.babylonjs.com/#R1F8YU#75\n * @param v defines the vector to test\n * @param min defines the minimum range\n * @param max defines the maximum range\n */\n static CheckExtends(v, min, max) {\n min.minimizeInPlace(v);\n max.maximizeInPlace(v);\n }\n /**\n * Returns a new Vector3 located for \"amount\" (float) on the Hermite interpolation spline defined by the vectors \"value1\", \"tangent1\", \"value2\", \"tangent2\"\n * Example Playground https://playground.babylonjs.com/#R1F8YU#89\n * @param value1 defines the first control point\n * @param tangent1 defines the first tangent vector\n * @param value2 defines the second control point\n * @param tangent2 defines the second tangent vector\n * @param amount defines the amount on the interpolation spline (between 0 and 1)\n * @returns the new Vector3\n */\n static Hermite(value1, tangent1, value2, tangent2, amount) {\n const squared = amount * amount;\n const cubed = amount * squared;\n const part1 = 2.0 * cubed - 3.0 * squared + 1.0;\n const part2 = -2.0 * cubed + 3.0 * squared;\n const part3 = cubed - 2.0 * squared + amount;\n const part4 = cubed - squared;\n const x = value1._x * part1 + value2._x * part2 + tangent1._x * part3 + tangent2._x * part4;\n const y = value1._y * part1 + value2._y * part2 + tangent1._y * part3 + tangent2._y * part4;\n const z = value1._z * part1 + value2._z * part2 + tangent1._z * part3 + tangent2._z * part4;\n return new value1.constructor(x, y, z);\n }\n /**\n * Returns a new Vector3 which is the 1st derivative of the Hermite spline defined by the vectors \"value1\", \"value2\", \"tangent1\", \"tangent2\".\n * Example Playground https://playground.babylonjs.com/#R1F8YU#90\n * @param value1 defines the first control point\n * @param tangent1 defines the first tangent\n * @param value2 defines the second control point\n * @param tangent2 defines the second tangent\n * @param time define where the derivative must be done\n * @returns 1st derivative\n */\n static Hermite1stDerivative(value1, tangent1, value2, tangent2, time) {\n const result = new value1.constructor();\n this.Hermite1stDerivativeToRef(value1, tangent1, value2, tangent2, time, result);\n return result;\n }\n /**\n * Update a Vector3 with the 1st derivative of the Hermite spline defined by the vectors \"value1\", \"value2\", \"tangent1\", \"tangent2\".\n * Example Playground https://playground.babylonjs.com/#R1F8YU#91\n * @param value1 defines the first control point\n * @param tangent1 defines the first tangent\n * @param value2 defines the second control point\n * @param tangent2 defines the second tangent\n * @param time define where the derivative must be done\n * @param result define where to store the derivative\n * @returns result input\n */\n static Hermite1stDerivativeToRef(value1, tangent1, value2, tangent2, time, result) {\n const t2 = time * time;\n result._x = (t2 - time) * 6 * value1._x + (3 * t2 - 4 * time + 1) * tangent1._x + (-t2 + time) * 6 * value2._x + (3 * t2 - 2 * time) * tangent2._x;\n result._y = (t2 - time) * 6 * value1._y + (3 * t2 - 4 * time + 1) * tangent1._y + (-t2 + time) * 6 * value2._y + (3 * t2 - 2 * time) * tangent2._y;\n result._z = (t2 - time) * 6 * value1._z + (3 * t2 - 4 * time + 1) * tangent1._z + (-t2 + time) * 6 * value2._z + (3 * t2 - 2 * time) * tangent2._z;\n result._isDirty = true;\n return result;\n }\n /**\n * Returns a new Vector3 located for \"amount\" (float) on the linear interpolation between the vectors \"start\" and \"end\"\n * Example Playground https://playground.babylonjs.com/#R1F8YU#95\n * @param start defines the start value\n * @param end defines the end value\n * @param amount max defines amount between both (between 0 and 1)\n * @returns the new Vector3\n */\n static Lerp(start, end, amount) {\n const result = new start.constructor(0, 0, 0);\n Vector3.LerpToRef(start, end, amount, result);\n return result;\n }\n /**\n * Sets the given vector \"result\" with the result of the linear interpolation from the vector \"start\" for \"amount\" to the vector \"end\"\n * Example Playground https://playground.babylonjs.com/#R1F8YU#93\n * @param start defines the start value\n * @param end defines the end value\n * @param amount max defines amount between both (between 0 and 1)\n * @param result defines the Vector3 where to store the result\n * @returns result input\n */\n static LerpToRef(start, end, amount, result) {\n result._x = start._x + (end._x - start._x) * amount;\n result._y = start._y + (end._y - start._y) * amount;\n result._z = start._z + (end._z - start._z) * amount;\n result._isDirty = true;\n return result;\n }\n /**\n * Returns the dot product (float) between the vectors \"left\" and \"right\"\n * Example Playground https://playground.babylonjs.com/#R1F8YU#82\n * @param left defines the left operand\n * @param right defines the right operand\n * @returns the dot product\n */\n static Dot(left, right) {\n return left._x * right._x + left._y * right._y + left._z * right._z;\n }\n /**\n * Returns a new Vector3 as the cross product of the vectors \"left\" and \"right\"\n * The cross product is then orthogonal to both \"left\" and \"right\"\n * Example Playground https://playground.babylonjs.com/#R1F8YU#15\n * @param left defines the left operand\n * @param right defines the right operand\n * @returns the cross product\n */\n static Cross(left, right) {\n const result = new left.constructor();\n Vector3.CrossToRef(left, right, result);\n return result;\n }\n /**\n * Sets the given vector \"result\" with the cross product of \"left\" and \"right\"\n * The cross product is then orthogonal to both \"left\" and \"right\"\n * Example Playground https://playground.babylonjs.com/#R1F8YU#78\n * @param left defines the left operand\n * @param right defines the right operand\n * @param result defines the Vector3 where to store the result\n * @returns result input\n */\n static CrossToRef(left, right, result) {\n const x = left._y * right._z - left._z * right._y;\n const y = left._z * right._x - left._x * right._z;\n const z = left._x * right._y - left._y * right._x;\n result.copyFromFloats(x, y, z);\n return result;\n }\n /**\n * Returns a new Vector3 as the normalization of the given vector\n * Example Playground https://playground.babylonjs.com/#R1F8YU#98\n * @param vector defines the Vector3 to normalize\n * @returns the new Vector3\n */\n static Normalize(vector) {\n const result = Vector3.Zero();\n Vector3.NormalizeToRef(vector, result);\n return result;\n }\n /**\n * Sets the given vector \"result\" with the normalization of the given first vector\n * Example Playground https://playground.babylonjs.com/#R1F8YU#98\n * @param vector defines the Vector3 to normalize\n * @param result defines the Vector3 where to store the result\n * @returns result input\n */\n static NormalizeToRef(vector, result) {\n vector.normalizeToRef(result);\n return result;\n }\n /**\n * Project a Vector3 onto screen space\n * Example Playground https://playground.babylonjs.com/#R1F8YU#101\n * @param vector defines the Vector3 to project\n * @param world defines the world matrix to use\n * @param transform defines the transform (view x projection) matrix to use\n * @param viewport defines the screen viewport to use\n * @returns the new Vector3\n */\n static Project(vector, world, transform, viewport) {\n const result = new vector.constructor();\n Vector3.ProjectToRef(vector, world, transform, viewport, result);\n return result;\n }\n /**\n * Project a Vector3 onto screen space to reference\n * Example Playground https://playground.babylonjs.com/#R1F8YU#102\n * @param vector defines the Vector3 to project\n * @param world defines the world matrix to use\n * @param transform defines the transform (view x projection) matrix to use\n * @param viewport defines the screen viewport to use\n * @param result the vector in which the screen space will be stored\n * @returns result input\n */\n static ProjectToRef(vector, world, transform, viewport, result) {\n const cw = viewport.width;\n const ch = viewport.height;\n const cx = viewport.x;\n const cy = viewport.y;\n const viewportMatrix = MathTmp.Matrix[1];\n Matrix.FromValuesToRef(cw / 2.0, 0, 0, 0, 0, -ch / 2.0, 0, 0, 0, 0, 0.5, 0, cx + cw / 2.0, ch / 2.0 + cy, 0.5, 1, viewportMatrix);\n const matrix = MathTmp.Matrix[0];\n world.multiplyToRef(transform, matrix);\n matrix.multiplyToRef(viewportMatrix, matrix);\n Vector3.TransformCoordinatesToRef(vector, matrix, result);\n return result;\n }\n /**\n * Reflects a vector off the plane defined by a normalized normal\n * @param inDirection defines the vector direction\n * @param normal defines the normal - Must be normalized\n * @returns the resulting vector\n */\n static Reflect(inDirection, normal) {\n return this.ReflectToRef(inDirection, normal, new Vector3());\n }\n /**\n * Reflects a vector off the plane defined by a normalized normal to reference\n * @param inDirection defines the vector direction\n * @param normal defines the normal - Must be normalized\n * @param result defines the Vector3 where to store the result\n * @returns the resulting vector\n */\n static ReflectToRef(inDirection, normal, ref) {\n const tmp = TmpVectors.Vector3[0];\n tmp.copyFrom(normal).scaleInPlace(2 * Vector3.Dot(inDirection, normal));\n return ref.copyFrom(inDirection).subtractInPlace(tmp);\n }\n /**\n * @internal\n */\n static _UnprojectFromInvertedMatrixToRef(source, matrix, result) {\n Vector3.TransformCoordinatesToRef(source, matrix, result);\n const m = matrix.m;\n const num = source._x * m[3] + source._y * m[7] + source._z * m[11] + m[15];\n if (Scalar.WithinEpsilon(num, 1.0)) {\n result.scaleInPlace(1.0 / num);\n }\n return result;\n }\n /**\n * Unproject from screen space to object space\n * Example Playground https://playground.babylonjs.com/#R1F8YU#121\n * @param source defines the screen space Vector3 to use\n * @param viewportWidth defines the current width of the viewport\n * @param viewportHeight defines the current height of the viewport\n * @param world defines the world matrix to use (can be set to Identity to go to world space)\n * @param transform defines the transform (view x projection) matrix to use\n * @returns the new Vector3\n */\n static UnprojectFromTransform(source, viewportWidth, viewportHeight, world, transform) {\n return this.Unproject(source, viewportWidth, viewportHeight, world, transform, Matrix.IdentityReadOnly);\n }\n /**\n * Unproject from screen space to object space\n * Example Playground https://playground.babylonjs.com/#R1F8YU#117\n * @param source defines the screen space Vector3 to use\n * @param viewportWidth defines the current width of the viewport\n * @param viewportHeight defines the current height of the viewport\n * @param world defines the world matrix to use (can be set to Identity to go to world space)\n * @param view defines the view matrix to use\n * @param projection defines the projection matrix to use\n * @returns the new Vector3\n */\n static Unproject(source, viewportWidth, viewportHeight, world, view, projection) {\n const result = new source.constructor();\n Vector3.UnprojectToRef(source, viewportWidth, viewportHeight, world, view, projection, result);\n return result;\n }\n /**\n * Unproject from screen space to object space\n * Example Playground https://playground.babylonjs.com/#R1F8YU#119\n * @param source defines the screen space Vector3 to use\n * @param viewportWidth defines the current width of the viewport\n * @param viewportHeight defines the current height of the viewport\n * @param world defines the world matrix to use (can be set to Identity to go to world space)\n * @param view defines the view matrix to use\n * @param projection defines the projection matrix to use\n * @param result defines the Vector3 where to store the result\n * @returns result input\n */\n static UnprojectToRef(source, viewportWidth, viewportHeight, world, view, projection, result) {\n Vector3.UnprojectFloatsToRef(source._x, source._y, source._z, viewportWidth, viewportHeight, world, view, projection, result);\n return result;\n }\n /**\n * Unproject from screen space to object space\n * Example Playground https://playground.babylonjs.com/#R1F8YU#120\n * @param sourceX defines the screen space x coordinate to use\n * @param sourceY defines the screen space y coordinate to use\n * @param sourceZ defines the screen space z coordinate to use\n * @param viewportWidth defines the current width of the viewport\n * @param viewportHeight defines the current height of the viewport\n * @param world defines the world matrix to use (can be set to Identity to go to world space)\n * @param view defines the view matrix to use\n * @param projection defines the projection matrix to use\n * @param result defines the Vector3 where to store the result\n * @returns result input\n */\n static UnprojectFloatsToRef(sourceX, sourceY, sourceZ, viewportWidth, viewportHeight, world, view, projection, result) {\n var _a;\n const matrix = MathTmp.Matrix[0];\n world.multiplyToRef(view, matrix);\n matrix.multiplyToRef(projection, matrix);\n matrix.invert();\n const screenSource = MathTmp.Vector3[0];\n screenSource.x = (sourceX / viewportWidth) * 2 - 1;\n screenSource.y = -((sourceY / viewportHeight) * 2 - 1);\n if ((_a = EngineStore.LastCreatedEngine) === null || _a === void 0 ? void 0 : _a.isNDCHalfZRange) {\n screenSource.z = sourceZ;\n }\n else {\n screenSource.z = 2 * sourceZ - 1.0;\n }\n Vector3._UnprojectFromInvertedMatrixToRef(screenSource, matrix, result);\n return result;\n }\n /**\n * Gets the minimal coordinate values between two Vector3\n * Example Playground https://playground.babylonjs.com/#R1F8YU#97\n * @param left defines the first operand\n * @param right defines the second operand\n * @returns the new Vector3\n */\n static Minimize(left, right) {\n const min = new left.constructor();\n min.copyFrom(left);\n min.minimizeInPlace(right);\n return min;\n }\n /**\n * Gets the maximal coordinate values between two Vector3\n * Example Playground https://playground.babylonjs.com/#R1F8YU#96\n * @param left defines the first operand\n * @param right defines the second operand\n * @returns the new Vector3\n */\n static Maximize(left, right) {\n const max = new left.constructor();\n max.copyFrom(left);\n max.maximizeInPlace(right);\n return max;\n }\n /**\n * Returns the distance between the vectors \"value1\" and \"value2\"\n * Example Playground https://playground.babylonjs.com/#R1F8YU#81\n * @param value1 defines the first operand\n * @param value2 defines the second operand\n * @returns the distance\n */\n static Distance(value1, value2) {\n return Math.sqrt(Vector3.DistanceSquared(value1, value2));\n }\n /**\n * Returns the squared distance between the vectors \"value1\" and \"value2\"\n * Example Playground https://playground.babylonjs.com/#R1F8YU#80\n * @param value1 defines the first operand\n * @param value2 defines the second operand\n * @returns the squared distance\n */\n static DistanceSquared(value1, value2) {\n const x = value1._x - value2._x;\n const y = value1._y - value2._y;\n const z = value1._z - value2._z;\n return x * x + y * y + z * z;\n }\n /**\n * Projects \"vector\" on the triangle determined by its extremities \"p0\", \"p1\" and \"p2\", stores the result in \"ref\"\n * and returns the distance to the projected point.\n * Example Playground https://playground.babylonjs.com/#R1F8YU#104\n * From http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.104.4264&rep=rep1&type=pdf\n *\n * @param vector the vector to get distance from\n * @param p0 extremity of the triangle\n * @param p1 extremity of the triangle\n * @param p2 extremity of the triangle\n * @param ref variable to store the result to\n * @returns The distance between \"ref\" and \"vector\"\n */\n static ProjectOnTriangleToRef(vector, p0, p1, p2, ref) {\n const p1p0 = MathTmp.Vector3[0];\n const p2p0 = MathTmp.Vector3[1];\n const p2p1 = MathTmp.Vector3[2];\n const normal = MathTmp.Vector3[3];\n const vectorp0 = MathTmp.Vector3[4];\n // Triangle vectors\n p1.subtractToRef(p0, p1p0);\n p2.subtractToRef(p0, p2p0);\n p2.subtractToRef(p1, p2p1);\n const p1p0L = p1p0.length();\n const p2p0L = p2p0.length();\n const p2p1L = p2p1.length();\n if (p1p0L < Epsilon || p2p0L < Epsilon || p2p1L < Epsilon) {\n // This is a degenerate triangle. As we assume this is part of a non-degenerate mesh,\n // we will find a better intersection later.\n // Let's just return one of the extremities\n ref.copyFrom(p0);\n return Vector3.Distance(vector, p0);\n }\n // Compute normal and vector to p0\n vector.subtractToRef(p0, vectorp0);\n Vector3.CrossToRef(p1p0, p2p0, normal);\n const nl = normal.length();\n if (nl < Epsilon) {\n // Extremities are aligned, we are back on the case of a degenerate triangle\n ref.copyFrom(p0);\n return Vector3.Distance(vector, p0);\n }\n normal.normalizeFromLength(nl);\n let l = vectorp0.length();\n if (l < Epsilon) {\n // Vector is p0\n ref.copyFrom(p0);\n return 0;\n }\n vectorp0.normalizeFromLength(l);\n // Project to \"proj\" that lies on the triangle plane\n const cosA = Vector3.Dot(normal, vectorp0);\n const projVector = MathTmp.Vector3[5];\n const proj = MathTmp.Vector3[6];\n projVector.copyFrom(normal).scaleInPlace(-l * cosA);\n proj.copyFrom(vector).addInPlace(projVector);\n // Compute barycentric coordinates (v0, v1 and v2 are axis from barycenter to extremities)\n const v0 = MathTmp.Vector3[4];\n const v1 = MathTmp.Vector3[5];\n const v2 = MathTmp.Vector3[7];\n const tmp = MathTmp.Vector3[8];\n v0.copyFrom(p1p0).scaleInPlace(1 / p1p0L);\n tmp.copyFrom(p2p0).scaleInPlace(1 / p2p0L);\n v0.addInPlace(tmp).scaleInPlace(-1);\n v1.copyFrom(p1p0).scaleInPlace(-1 / p1p0L);\n tmp.copyFrom(p2p1).scaleInPlace(1 / p2p1L);\n v1.addInPlace(tmp).scaleInPlace(-1);\n v2.copyFrom(p2p1).scaleInPlace(-1 / p2p1L);\n tmp.copyFrom(p2p0).scaleInPlace(-1 / p2p0L);\n v2.addInPlace(tmp).scaleInPlace(-1);\n // Determines which edge of the triangle is closest to \"proj\"\n const projP = MathTmp.Vector3[9];\n let dot;\n projP.copyFrom(proj).subtractInPlace(p0);\n Vector3.CrossToRef(v0, projP, tmp);\n dot = Vector3.Dot(tmp, normal);\n const s0 = dot;\n projP.copyFrom(proj).subtractInPlace(p1);\n Vector3.CrossToRef(v1, projP, tmp);\n dot = Vector3.Dot(tmp, normal);\n const s1 = dot;\n projP.copyFrom(proj).subtractInPlace(p2);\n Vector3.CrossToRef(v2, projP, tmp);\n dot = Vector3.Dot(tmp, normal);\n const s2 = dot;\n const edge = MathTmp.Vector3[10];\n let e0, e1;\n if (s0 > 0 && s1 < 0) {\n edge.copyFrom(p1p0);\n e0 = p0;\n e1 = p1;\n }\n else if (s1 > 0 && s2 < 0) {\n edge.copyFrom(p2p1);\n e0 = p1;\n e1 = p2;\n }\n else {\n edge.copyFrom(p2p0).scaleInPlace(-1);\n e0 = p2;\n e1 = p0;\n }\n // Determines if \"proj\" lies inside the triangle\n const tmp2 = MathTmp.Vector3[9];\n const tmp3 = MathTmp.Vector3[4];\n e0.subtractToRef(proj, tmp);\n e1.subtractToRef(proj, tmp2);\n Vector3.CrossToRef(tmp, tmp2, tmp3);\n const isOutside = Vector3.Dot(tmp3, normal) < 0;\n // If inside, we already found the projected point, \"proj\"\n if (!isOutside) {\n ref.copyFrom(proj);\n return Math.abs(l * cosA);\n }\n // If outside, we find \"triProj\", the closest point from \"proj\" on the closest edge\n const r = MathTmp.Vector3[5];\n Vector3.CrossToRef(edge, tmp3, r);\n r.normalize();\n const e0proj = MathTmp.Vector3[9];\n e0proj.copyFrom(e0).subtractInPlace(proj);\n const e0projL = e0proj.length();\n if (e0projL < Epsilon) {\n // Proj is e0\n ref.copyFrom(e0);\n return Vector3.Distance(vector, e0);\n }\n e0proj.normalizeFromLength(e0projL);\n const cosG = Vector3.Dot(r, e0proj);\n const triProj = MathTmp.Vector3[7];\n triProj.copyFrom(proj).addInPlace(r.scaleInPlace(e0projL * cosG));\n // Now we clamp \"triProj\" so it lies between e0 and e1\n tmp.copyFrom(triProj).subtractInPlace(e0);\n l = edge.length();\n edge.normalizeFromLength(l);\n let t = Vector3.Dot(tmp, edge) / Math.max(l, Epsilon);\n t = Scalar.Clamp(t, 0, 1);\n triProj.copyFrom(e0).addInPlace(edge.scaleInPlace(t * l));\n ref.copyFrom(triProj);\n return Vector3.Distance(vector, triProj);\n }\n /**\n * Returns a new Vector3 located at the center between \"value1\" and \"value2\"\n * Example Playground https://playground.babylonjs.com/#R1F8YU#72\n * @param value1 defines the first operand\n * @param value2 defines the second operand\n * @returns the new Vector3\n */\n static Center(value1, value2) {\n return Vector3.CenterToRef(value1, value2, Vector3.Zero());\n }\n /**\n * Gets the center of the vectors \"value1\" and \"value2\" and stores the result in the vector \"ref\"\n * Example Playground https://playground.babylonjs.com/#R1F8YU#73\n * @param value1 defines first vector\n * @param value2 defines second vector\n * @param ref defines third vector\n * @returns ref\n */\n static CenterToRef(value1, value2, ref) {\n return ref.copyFromFloats((value1._x + value2._x) / 2, (value1._y + value2._y) / 2, (value1._z + value2._z) / 2);\n }\n /**\n * Given three orthogonal normalized left-handed oriented Vector3 axis in space (target system),\n * RotationFromAxis() returns the rotation Euler angles (ex : rotation.x, rotation.y, rotation.z) to apply\n * to something in order to rotate it from its local system to the given target system\n * Note: axis1, axis2 and axis3 are normalized during this operation\n * Example Playground https://playground.babylonjs.com/#R1F8YU#106\n * @param axis1 defines the first axis\n * @param axis2 defines the second axis\n * @param axis3 defines the third axis\n * @returns a new Vector3\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/transforms/center_origin/target_align\n */\n static RotationFromAxis(axis1, axis2, axis3) {\n const rotation = new axis1.constructor();\n Vector3.RotationFromAxisToRef(axis1, axis2, axis3, rotation);\n return rotation;\n }\n /**\n * The same than RotationFromAxis but updates the given ref Vector3 parameter instead of returning a new Vector3\n * Example Playground https://playground.babylonjs.com/#R1F8YU#107\n * @param axis1 defines the first axis\n * @param axis2 defines the second axis\n * @param axis3 defines the third axis\n * @param ref defines the Vector3 where to store the result\n * @returns result input\n */\n static RotationFromAxisToRef(axis1, axis2, axis3, ref) {\n const quat = MathTmp.Quaternion[0];\n Quaternion.RotationQuaternionFromAxisToRef(axis1, axis2, axis3, quat);\n quat.toEulerAnglesToRef(ref);\n return ref;\n }\n}\nVector3._UpReadOnly = Vector3.Up();\nVector3._DownReadOnly = Vector3.Down();\nVector3._LeftHandedForwardReadOnly = Vector3.Forward(false);\nVector3._RightHandedForwardReadOnly = Vector3.Forward(true);\nVector3._LeftHandedBackwardReadOnly = Vector3.Backward(false);\nVector3._RightHandedBackwardReadOnly = Vector3.Backward(true);\nVector3._RightReadOnly = Vector3.Right();\nVector3._LeftReadOnly = Vector3.Left();\nVector3._ZeroReadOnly = Vector3.Zero();\nVector3._OneReadOnly = Vector3.One();\n/**\n * Vector4 class created for EulerAngle class conversion to Quaternion\n */\nexport class Vector4 {\n /**\n * Creates a Vector4 object from the given floats.\n * @param x x value of the vector\n * @param y y value of the vector\n * @param z z value of the vector\n * @param w w value of the vector\n */\n constructor(\n /** x value of the vector */\n x = 0, \n /** y value of the vector */\n y = 0, \n /** z value of the vector */\n z = 0, \n /** w value of the vector */\n w = 0) {\n this.x = x;\n this.y = y;\n this.z = z;\n this.w = w;\n }\n /**\n * Returns the string with the Vector4 coordinates.\n * @returns a string containing all the vector values\n */\n toString() {\n return `{X: ${this.x} Y: ${this.y} Z: ${this.z} W: ${this.w}}`;\n }\n /**\n * Returns the string \"Vector4\".\n * @returns \"Vector4\"\n */\n getClassName() {\n return \"Vector4\";\n }\n /**\n * Returns the Vector4 hash code.\n * @returns a unique hash code\n */\n getHashCode() {\n const x = _ExtractAsInt(this.x);\n const y = _ExtractAsInt(this.y);\n const z = _ExtractAsInt(this.z);\n const w = _ExtractAsInt(this.w);\n let hash = x;\n hash = (hash * 397) ^ y;\n hash = (hash * 397) ^ z;\n hash = (hash * 397) ^ w;\n return hash;\n }\n // Operators\n /**\n * Returns a new array populated with 4 elements : the Vector4 coordinates.\n * @returns the resulting array\n */\n asArray() {\n const result = new Array();\n this.toArray(result, 0);\n return result;\n }\n /**\n * Populates the given array from the given index with the Vector4 coordinates.\n * @param array array to populate\n * @param index index of the array to start at (default: 0)\n * @returns the Vector4.\n */\n toArray(array, index) {\n if (index === undefined) {\n index = 0;\n }\n array[index] = this.x;\n array[index + 1] = this.y;\n array[index + 2] = this.z;\n array[index + 3] = this.w;\n return this;\n }\n /**\n * Update the current vector from an array\n * @param array defines the destination array\n * @param index defines the offset in the destination array\n * @returns the current Vector3\n */\n fromArray(array, index = 0) {\n Vector4.FromArrayToRef(array, index, this);\n return this;\n }\n /**\n * Adds the given vector to the current Vector4.\n * @param otherVector the vector to add\n * @returns the updated Vector4.\n */\n addInPlace(otherVector) {\n this.x += otherVector.x;\n this.y += otherVector.y;\n this.z += otherVector.z;\n this.w += otherVector.w;\n return this;\n }\n /**\n * Returns a new Vector4 as the result of the addition of the current Vector4 and the given one.\n * @param otherVector the vector to add\n * @returns the resulting vector\n */\n add(otherVector) {\n return new this.constructor(this.x + otherVector.x, this.y + otherVector.y, this.z + otherVector.z, this.w + otherVector.w);\n }\n /**\n * Updates the given vector \"result\" with the result of the addition of the current Vector4 and the given one.\n * @param otherVector the vector to add\n * @param result the vector to store the result\n * @returns result input\n */\n addToRef(otherVector, result) {\n result.x = this.x + otherVector.x;\n result.y = this.y + otherVector.y;\n result.z = this.z + otherVector.z;\n result.w = this.w + otherVector.w;\n return result;\n }\n /**\n * Subtract in place the given vector from the current Vector4.\n * @param otherVector the vector to subtract\n * @returns the updated Vector4.\n */\n subtractInPlace(otherVector) {\n this.x -= otherVector.x;\n this.y -= otherVector.y;\n this.z -= otherVector.z;\n this.w -= otherVector.w;\n return this;\n }\n /**\n * Returns a new Vector4 with the result of the subtraction of the given vector from the current Vector4.\n * @param otherVector the vector to add\n * @returns the new vector with the result\n */\n subtract(otherVector) {\n return new this.constructor(this.x - otherVector.x, this.y - otherVector.y, this.z - otherVector.z, this.w - otherVector.w);\n }\n /**\n * Sets the given vector \"result\" with the result of the subtraction of the given vector from the current Vector4.\n * @param otherVector the vector to subtract\n * @param result the vector to store the result\n * @returns result input\n */\n subtractToRef(otherVector, result) {\n result.x = this.x - otherVector.x;\n result.y = this.y - otherVector.y;\n result.z = this.z - otherVector.z;\n result.w = this.w - otherVector.w;\n return result;\n }\n /**\n * Returns a new Vector4 set with the result of the subtraction of the given floats from the current Vector4 coordinates.\n */\n /**\n * Returns a new Vector4 set with the result of the subtraction of the given floats from the current Vector4 coordinates.\n * @param x value to subtract\n * @param y value to subtract\n * @param z value to subtract\n * @param w value to subtract\n * @returns new vector containing the result\n */\n subtractFromFloats(x, y, z, w) {\n return new this.constructor(this.x - x, this.y - y, this.z - z, this.w - w);\n }\n /**\n * Sets the given vector \"result\" set with the result of the subtraction of the given floats from the current Vector4 coordinates.\n * @param x value to subtract\n * @param y value to subtract\n * @param z value to subtract\n * @param w value to subtract\n * @param result the vector to store the result in\n * @returns result input\n */\n subtractFromFloatsToRef(x, y, z, w, result) {\n result.x = this.x - x;\n result.y = this.y - y;\n result.z = this.z - z;\n result.w = this.w - w;\n return result;\n }\n /**\n * Returns a new Vector4 set with the current Vector4 negated coordinates.\n * @returns a new vector with the negated values\n */\n negate() {\n return new this.constructor(-this.x, -this.y, -this.z, -this.w);\n }\n /**\n * Negate this vector in place\n * @returns this\n */\n negateInPlace() {\n this.x *= -1;\n this.y *= -1;\n this.z *= -1;\n this.w *= -1;\n return this;\n }\n /**\n * Negate the current Vector4 and stores the result in the given vector \"result\" coordinates\n * @param result defines the Vector3 object where to store the result\n * @returns the result\n */\n negateToRef(result) {\n return result.copyFromFloats(this.x * -1, this.y * -1, this.z * -1, this.w * -1);\n }\n /**\n * Multiplies the current Vector4 coordinates by scale (float).\n * @param scale the number to scale with\n * @returns the updated Vector4.\n */\n scaleInPlace(scale) {\n this.x *= scale;\n this.y *= scale;\n this.z *= scale;\n this.w *= scale;\n return this;\n }\n /**\n * Returns a new Vector4 set with the current Vector4 coordinates multiplied by scale (float).\n * @param scale the number to scale with\n * @returns a new vector with the result\n */\n scale(scale) {\n return new this.constructor(this.x * scale, this.y * scale, this.z * scale, this.w * scale);\n }\n /**\n * Sets the given vector \"result\" with the current Vector4 coordinates multiplied by scale (float).\n * @param scale the number to scale with\n * @param result a vector to store the result in\n * @returns result input\n */\n scaleToRef(scale, result) {\n result.x = this.x * scale;\n result.y = this.y * scale;\n result.z = this.z * scale;\n result.w = this.w * scale;\n return result;\n }\n /**\n * Scale the current Vector4 values by a factor and add the result to a given Vector4\n * @param scale defines the scale factor\n * @param result defines the Vector4 object where to store the result\n * @returns result input\n */\n scaleAndAddToRef(scale, result) {\n result.x += this.x * scale;\n result.y += this.y * scale;\n result.z += this.z * scale;\n result.w += this.w * scale;\n return result;\n }\n /**\n * Boolean : True if the current Vector4 coordinates are stricly equal to the given ones.\n * @param otherVector the vector to compare against\n * @returns true if they are equal\n */\n equals(otherVector) {\n return otherVector && this.x === otherVector.x && this.y === otherVector.y && this.z === otherVector.z && this.w === otherVector.w;\n }\n /**\n * Boolean : True if the current Vector4 coordinates are each beneath the distance \"epsilon\" from the given vector ones.\n * @param otherVector vector to compare against\n * @param epsilon (Default: very small number)\n * @returns true if they are equal\n */\n equalsWithEpsilon(otherVector, epsilon = Epsilon) {\n return (otherVector &&\n Scalar.WithinEpsilon(this.x, otherVector.x, epsilon) &&\n Scalar.WithinEpsilon(this.y, otherVector.y, epsilon) &&\n Scalar.WithinEpsilon(this.z, otherVector.z, epsilon) &&\n Scalar.WithinEpsilon(this.w, otherVector.w, epsilon));\n }\n /**\n * Boolean : True if the given floats are strictly equal to the current Vector4 coordinates.\n * @param x x value to compare against\n * @param y y value to compare against\n * @param z z value to compare against\n * @param w w value to compare against\n * @returns true if equal\n */\n equalsToFloats(x, y, z, w) {\n return this.x === x && this.y === y && this.z === z && this.w === w;\n }\n /**\n * Multiplies in place the current Vector4 by the given one.\n * @param otherVector vector to multiple with\n * @returns the updated Vector4.\n */\n multiplyInPlace(otherVector) {\n this.x *= otherVector.x;\n this.y *= otherVector.y;\n this.z *= otherVector.z;\n this.w *= otherVector.w;\n return this;\n }\n /**\n * Returns a new Vector4 set with the multiplication result of the current Vector4 and the given one.\n * @param otherVector vector to multiple with\n * @returns resulting new vector\n */\n multiply(otherVector) {\n return new this.constructor(this.x * otherVector.x, this.y * otherVector.y, this.z * otherVector.z, this.w * otherVector.w);\n }\n /**\n * Updates the given vector \"result\" with the multiplication result of the current Vector4 and the given one.\n * @param otherVector vector to multiple with\n * @param result vector to store the result\n * @returns result input\n */\n multiplyToRef(otherVector, result) {\n result.x = this.x * otherVector.x;\n result.y = this.y * otherVector.y;\n result.z = this.z * otherVector.z;\n result.w = this.w * otherVector.w;\n return result;\n }\n /**\n * Returns a new Vector4 set with the multiplication result of the given floats and the current Vector4 coordinates.\n * @param x x value multiply with\n * @param y y value multiply with\n * @param z z value multiply with\n * @param w w value multiply with\n * @returns resulting new vector\n */\n multiplyByFloats(x, y, z, w) {\n return new this.constructor(this.x * x, this.y * y, this.z * z, this.w * w);\n }\n /**\n * Returns a new Vector4 set with the division result of the current Vector4 by the given one.\n * @param otherVector vector to devide with\n * @returns resulting new vector\n */\n divide(otherVector) {\n return new this.constructor(this.x / otherVector.x, this.y / otherVector.y, this.z / otherVector.z, this.w / otherVector.w);\n }\n /**\n * Updates the given vector \"result\" with the division result of the current Vector4 by the given one.\n * @param otherVector vector to devide with\n * @param result vector to store the result\n * @returns result input\n */\n divideToRef(otherVector, result) {\n result.x = this.x / otherVector.x;\n result.y = this.y / otherVector.y;\n result.z = this.z / otherVector.z;\n result.w = this.w / otherVector.w;\n return result;\n }\n /**\n * Divides the current Vector3 coordinates by the given ones.\n * @param otherVector vector to devide with\n * @returns the updated Vector3.\n */\n divideInPlace(otherVector) {\n return this.divideToRef(otherVector, this);\n }\n /**\n * Updates the Vector4 coordinates with the minimum values between its own and the given vector ones\n * @param other defines the second operand\n * @returns the current updated Vector4\n */\n minimizeInPlace(other) {\n if (other.x < this.x) {\n this.x = other.x;\n }\n if (other.y < this.y) {\n this.y = other.y;\n }\n if (other.z < this.z) {\n this.z = other.z;\n }\n if (other.w < this.w) {\n this.w = other.w;\n }\n return this;\n }\n /**\n * Updates the Vector4 coordinates with the maximum values between its own and the given vector ones\n * @param other defines the second operand\n * @returns the current updated Vector4\n */\n maximizeInPlace(other) {\n if (other.x > this.x) {\n this.x = other.x;\n }\n if (other.y > this.y) {\n this.y = other.y;\n }\n if (other.z > this.z) {\n this.z = other.z;\n }\n if (other.w > this.w) {\n this.w = other.w;\n }\n return this;\n }\n /**\n * Gets a new Vector4 from current Vector4 floored values\n * @returns a new Vector4\n */\n floor() {\n return new this.constructor(Math.floor(this.x), Math.floor(this.y), Math.floor(this.z), Math.floor(this.w));\n }\n /**\n * Gets a new Vector4 from current Vector4 fractional values\n * @returns a new Vector4\n */\n fract() {\n return new this.constructor(this.x - Math.floor(this.x), this.y - Math.floor(this.y), this.z - Math.floor(this.z), this.w - Math.floor(this.w));\n }\n // Properties\n /**\n * Returns the Vector4 length (float).\n * @returns the length\n */\n length() {\n return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w);\n }\n /**\n * Returns the Vector4 squared length (float).\n * @returns the length squared\n */\n lengthSquared() {\n return this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w;\n }\n // Methods\n /**\n * Normalizes in place the Vector4.\n * @returns the updated Vector4.\n */\n normalize() {\n const len = this.length();\n if (len === 0) {\n return this;\n }\n return this.scaleInPlace(1.0 / len);\n }\n /**\n * Returns a new Vector3 from the Vector4 (x, y, z) coordinates.\n * @returns this converted to a new vector3\n */\n toVector3() {\n return new Vector3(this.x, this.y, this.z);\n }\n /**\n * Returns a new Vector4 copied from the current one.\n * @returns the new cloned vector\n */\n clone() {\n return new this.constructor(this.x, this.y, this.z, this.w);\n }\n /**\n * Updates the current Vector4 with the given one coordinates.\n * @param source the source vector to copy from\n * @returns the updated Vector4.\n */\n copyFrom(source) {\n this.x = source.x;\n this.y = source.y;\n this.z = source.z;\n this.w = source.w;\n return this;\n }\n /**\n * Updates the current Vector4 coordinates with the given floats.\n * @param x float to copy from\n * @param y float to copy from\n * @param z float to copy from\n * @param w float to copy from\n * @returns the updated Vector4.\n */\n copyFromFloats(x, y, z, w) {\n this.x = x;\n this.y = y;\n this.z = z;\n this.w = w;\n return this;\n }\n /**\n * Updates the current Vector4 coordinates with the given floats.\n * @param x float to set from\n * @param y float to set from\n * @param z float to set from\n * @param w float to set from\n * @returns the updated Vector4.\n */\n set(x, y, z, w) {\n return this.copyFromFloats(x, y, z, w);\n }\n /**\n * Copies the given float to the current Vector3 coordinates\n * @param v defines the x, y, z and w coordinates of the operand\n * @returns the current updated Vector3\n */\n setAll(v) {\n this.x = this.y = this.z = this.w = v;\n return this;\n }\n // Statics\n /**\n * Returns a new Vector4 set from the starting index of the given array.\n * @param array the array to pull values from\n * @param offset the offset into the array to start at\n * @returns the new vector\n */\n static FromArray(array, offset) {\n if (!offset) {\n offset = 0;\n }\n return new Vector4(array[offset], array[offset + 1], array[offset + 2], array[offset + 3]);\n }\n /**\n * Updates the given vector \"result\" from the starting index of the given array.\n * @param array the array to pull values from\n * @param offset the offset into the array to start at\n * @param result the vector to store the result in\n * @returns result input\n */\n static FromArrayToRef(array, offset, result) {\n result.x = array[offset];\n result.y = array[offset + 1];\n result.z = array[offset + 2];\n result.w = array[offset + 3];\n return result;\n }\n /**\n * Updates the given vector \"result\" from the starting index of the given Float32Array.\n * @param array the array to pull values from\n * @param offset the offset into the array to start at\n * @param result the vector to store the result in\n * @returns result input\n */\n static FromFloatArrayToRef(array, offset, result) {\n Vector4.FromArrayToRef(array, offset, result);\n return result;\n }\n /**\n * Updates the given vector \"result\" coordinates from the given floats.\n * @param x float to set from\n * @param y float to set from\n * @param z float to set from\n * @param w float to set from\n * @param result the vector to the floats in\n * @returns result input\n */\n static FromFloatsToRef(x, y, z, w, result) {\n result.x = x;\n result.y = y;\n result.z = z;\n result.w = w;\n return result;\n }\n /**\n * Returns a new Vector4 set to (0.0, 0.0, 0.0, 0.0)\n * @returns the new vector\n */\n static Zero() {\n return new Vector4(0.0, 0.0, 0.0, 0.0);\n }\n /**\n * Returns a new Vector4 set to (1.0, 1.0, 1.0, 1.0)\n * @returns the new vector\n */\n static One() {\n return new Vector4(1.0, 1.0, 1.0, 1.0);\n }\n /**\n * Returns a new Vector4 with random values between min and max\n * @param min the minimum random value\n * @param max the maximum random value\n * @returns a Vector4 with random values between min and max\n */\n static Random(min = 0, max = 1) {\n return new Vector4(Scalar.RandomRange(min, max), Scalar.RandomRange(min, max), Scalar.RandomRange(min, max), Scalar.RandomRange(min, max));\n }\n /**\n * Gets a zero Vector4 that must not be updated\n */\n static get ZeroReadOnly() {\n return Vector4._ZeroReadOnly;\n }\n /**\n * Returns a new normalized Vector4 from the given one.\n * @param vector the vector to normalize\n * @returns the vector\n */\n static Normalize(vector) {\n const result = Vector4.Zero();\n Vector4.NormalizeToRef(vector, result);\n return result;\n }\n /**\n * Updates the given vector \"result\" from the normalization of the given one.\n * @param vector the vector to normalize\n * @param result the vector to store the result in\n * @returns result input\n */\n static NormalizeToRef(vector, result) {\n result.copyFrom(vector);\n result.normalize();\n return result;\n }\n /**\n * Returns a vector with the minimum values from the left and right vectors\n * @param left left vector to minimize\n * @param right right vector to minimize\n * @returns a new vector with the minimum of the left and right vector values\n */\n static Minimize(left, right) {\n const min = new left.constructor();\n min.copyFrom(left);\n min.minimizeInPlace(right);\n return min;\n }\n /**\n * Returns a vector with the maximum values from the left and right vectors\n * @param left left vector to maximize\n * @param right right vector to maximize\n * @returns a new vector with the maximum of the left and right vector values\n */\n static Maximize(left, right) {\n const max = new left.constructor();\n max.copyFrom(left);\n max.maximizeInPlace(right);\n return max;\n }\n /**\n * Returns the distance (float) between the vectors \"value1\" and \"value2\".\n * @param value1 value to calulate the distance between\n * @param value2 value to calulate the distance between\n * @returns the distance between the two vectors\n */\n static Distance(value1, value2) {\n return Math.sqrt(Vector4.DistanceSquared(value1, value2));\n }\n /**\n * Returns the squared distance (float) between the vectors \"value1\" and \"value2\".\n * @param value1 value to calulate the distance between\n * @param value2 value to calulate the distance between\n * @returns the distance between the two vectors squared\n */\n static DistanceSquared(value1, value2) {\n const x = value1.x - value2.x;\n const y = value1.y - value2.y;\n const z = value1.z - value2.z;\n const w = value1.w - value2.w;\n return x * x + y * y + z * z + w * w;\n }\n /**\n * Returns a new Vector4 located at the center between the vectors \"value1\" and \"value2\".\n * @param value1 value to calulate the center between\n * @param value2 value to calulate the center between\n * @returns the center between the two vectors\n */\n static Center(value1, value2) {\n return Vector4.CenterToRef(value1, value2, Vector4.Zero());\n }\n /**\n * Gets the center of the vectors \"value1\" and \"value2\" and stores the result in the vector \"ref\"\n * @param value1 defines first vector\n * @param value2 defines second vector\n * @param ref defines third vector\n * @returns ref\n */\n static CenterToRef(value1, value2, ref) {\n return ref.copyFromFloats((value1.x + value2.x) / 2, (value1.y + value2.y) / 2, (value1.z + value2.z) / 2, (value1.w + value2.w) / 2);\n }\n /**\n * Returns a new Vector4 set with the result of the transformation by the given matrix of the given vector.\n * This method computes tranformed coordinates only, not transformed direction vectors (ie. it takes translation in account)\n * The difference with Vector3.TransformCoordinates is that the w component is not used to divide the other coordinates but is returned in the w coordinate instead\n * @param vector defines the Vector3 to transform\n * @param transformation defines the transformation matrix\n * @returns the transformed Vector4\n */\n static TransformCoordinates(vector, transformation) {\n const result = Vector4.Zero();\n Vector4.TransformCoordinatesToRef(vector, transformation, result);\n return result;\n }\n /**\n * Sets the given vector \"result\" coordinates with the result of the transformation by the given matrix of the given vector\n * This method computes tranformed coordinates only, not transformed direction vectors (ie. it takes translation in account)\n * The difference with Vector3.TransformCoordinatesToRef is that the w component is not used to divide the other coordinates but is returned in the w coordinate instead\n * @param vector defines the Vector3 to transform\n * @param transformation defines the transformation matrix\n * @param result defines the Vector4 where to store the result\n * @returns result input\n */\n static TransformCoordinatesToRef(vector, transformation, result) {\n Vector4.TransformCoordinatesFromFloatsToRef(vector._x, vector._y, vector._z, transformation, result);\n return result;\n }\n /**\n * Sets the given vector \"result\" coordinates with the result of the transformation by the given matrix of the given floats (x, y, z)\n * This method computes tranformed coordinates only, not transformed direction vectors\n * The difference with Vector3.TransformCoordinatesFromFloatsToRef is that the w component is not used to divide the other coordinates but is returned in the w coordinate instead\n * @param x define the x coordinate of the source vector\n * @param y define the y coordinate of the source vector\n * @param z define the z coordinate of the source vector\n * @param transformation defines the transformation matrix\n * @param result defines the Vector4 where to store the result\n * @returns result input\n */\n static TransformCoordinatesFromFloatsToRef(x, y, z, transformation, result) {\n const m = transformation.m;\n const rx = x * m[0] + y * m[4] + z * m[8] + m[12];\n const ry = x * m[1] + y * m[5] + z * m[9] + m[13];\n const rz = x * m[2] + y * m[6] + z * m[10] + m[14];\n const rw = x * m[3] + y * m[7] + z * m[11] + m[15];\n result.x = rx;\n result.y = ry;\n result.z = rz;\n result.w = rw;\n return result;\n }\n /**\n * Returns a new Vector4 set with the result of the normal transformation by the given matrix of the given vector.\n * This methods computes transformed normalized direction vectors only.\n * @param vector the vector to transform\n * @param transformation the transformation matrix to apply\n * @returns the new vector\n */\n static TransformNormal(vector, transformation) {\n const result = new vector.constructor();\n Vector4.TransformNormalToRef(vector, transformation, result);\n return result;\n }\n /**\n * Sets the given vector \"result\" with the result of the normal transformation by the given matrix of the given vector.\n * This methods computes transformed normalized direction vectors only.\n * @param vector the vector to transform\n * @param transformation the transformation matrix to apply\n * @param result the vector to store the result in\n * @returns result input\n */\n static TransformNormalToRef(vector, transformation, result) {\n const m = transformation.m;\n const x = vector.x * m[0] + vector.y * m[4] + vector.z * m[8];\n const y = vector.x * m[1] + vector.y * m[5] + vector.z * m[9];\n const z = vector.x * m[2] + vector.y * m[6] + vector.z * m[10];\n result.x = x;\n result.y = y;\n result.z = z;\n result.w = vector.w;\n return result;\n }\n /**\n * Sets the given vector \"result\" with the result of the normal transformation by the given matrix of the given floats (x, y, z, w).\n * This methods computes transformed normalized direction vectors only.\n * @param x value to transform\n * @param y value to transform\n * @param z value to transform\n * @param w value to transform\n * @param transformation the transformation matrix to apply\n * @param result the vector to store the results in\n * @returns result input\n */\n static TransformNormalFromFloatsToRef(x, y, z, w, transformation, result) {\n const m = transformation.m;\n result.x = x * m[0] + y * m[4] + z * m[8];\n result.y = x * m[1] + y * m[5] + z * m[9];\n result.z = x * m[2] + y * m[6] + z * m[10];\n result.w = w;\n return result;\n }\n /**\n * Creates a new Vector4 from a Vector3\n * @param source defines the source data\n * @param w defines the 4th component (default is 0)\n * @returns a new Vector4\n */\n static FromVector3(source, w = 0) {\n return new Vector4(source._x, source._y, source._z, w);\n }\n}\nVector4._ZeroReadOnly = Vector4.Zero();\n/**\n * Class used to store quaternion data\n * Example Playground - Overview - https://playground.babylonjs.com/#L49EJ7#100\n * @see https://en.wikipedia.org/wiki/Quaternion\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/transforms\n */\nexport class Quaternion {\n /** Gets or sets the x coordinate */\n get x() {\n return this._x;\n }\n set x(value) {\n this._x = value;\n this._isDirty = true;\n }\n /** Gets or sets the y coordinate */\n get y() {\n return this._y;\n }\n set y(value) {\n this._y = value;\n this._isDirty = true;\n }\n /** Gets or sets the z coordinate */\n get z() {\n return this._z;\n }\n set z(value) {\n this._z = value;\n this._isDirty = true;\n }\n /** Gets or sets the w coordinate */\n get w() {\n return this._w;\n }\n set w(value) {\n this._w = value;\n this._isDirty = true;\n }\n /**\n * Creates a new Quaternion from the given floats\n * @param x defines the first component (0 by default)\n * @param y defines the second component (0 by default)\n * @param z defines the third component (0 by default)\n * @param w defines the fourth component (1.0 by default)\n */\n constructor(x = 0.0, y = 0.0, z = 0.0, w = 1.0) {\n /** @internal */\n this._isDirty = true;\n this._x = x;\n this._y = y;\n this._z = z;\n this._w = w;\n }\n /**\n * Gets a string representation for the current quaternion\n * @returns a string with the Quaternion coordinates\n */\n toString() {\n return `{X: ${this._x} Y: ${this._y} Z: ${this._z} W: ${this._w}}`;\n }\n /**\n * Gets the class name of the quaternion\n * @returns the string \"Quaternion\"\n */\n getClassName() {\n return \"Quaternion\";\n }\n /**\n * Gets a hash code for this quaternion\n * @returns the quaternion hash code\n */\n getHashCode() {\n const x = _ExtractAsInt(this._x);\n const y = _ExtractAsInt(this._y);\n const z = _ExtractAsInt(this._z);\n const w = _ExtractAsInt(this._w);\n let hash = x;\n hash = (hash * 397) ^ y;\n hash = (hash * 397) ^ z;\n hash = (hash * 397) ^ w;\n return hash;\n }\n /**\n * Copy the quaternion to an array\n * Example Playground https://playground.babylonjs.com/#L49EJ7#13\n * @returns a new array populated with 4 elements from the quaternion coordinates\n */\n asArray() {\n return [this._x, this._y, this._z, this._w];\n }\n /**\n * Stores from the starting index in the given array the Quaternion successive values\n * Example Playground https://playground.babylonjs.com/#L49EJ7#59\n * @param array defines the array where to store the x,y,z,w components\n * @param index defines an optional index in the target array to define where to start storing values\n * @returns the current Quaternion object\n */\n toArray(array, index = 0) {\n array[index] = this._x;\n array[index + 1] = this._y;\n array[index + 2] = this._z;\n array[index + 3] = this._w;\n return this;\n }\n /**\n * Check if two quaternions are equals\n * Example Playground https://playground.babylonjs.com/#L49EJ7#38\n * @param otherQuaternion defines the second operand\n * @returns true if the current quaternion and the given one coordinates are strictly equals\n */\n equals(otherQuaternion) {\n return otherQuaternion && this._x === otherQuaternion._x && this._y === otherQuaternion._y && this._z === otherQuaternion._z && this._w === otherQuaternion._w;\n }\n /**\n * Gets a boolean if two quaternions are equals (using an epsilon value)\n * Example Playground https://playground.babylonjs.com/#L49EJ7#37\n * @param otherQuaternion defines the other quaternion\n * @param epsilon defines the minimal distance to consider equality\n * @returns true if the given quaternion coordinates are close to the current ones by a distance of epsilon.\n */\n equalsWithEpsilon(otherQuaternion, epsilon = Epsilon) {\n return (otherQuaternion &&\n Scalar.WithinEpsilon(this._x, otherQuaternion._x, epsilon) &&\n Scalar.WithinEpsilon(this._y, otherQuaternion._y, epsilon) &&\n Scalar.WithinEpsilon(this._z, otherQuaternion._z, epsilon) &&\n Scalar.WithinEpsilon(this._w, otherQuaternion._w, epsilon));\n }\n /**\n * Clone the current quaternion\n * Example Playground https://playground.babylonjs.com/#L49EJ7#12\n * @returns a new quaternion copied from the current one\n */\n clone() {\n return new this.constructor(this._x, this._y, this._z, this._w);\n }\n /**\n * Copy a quaternion to the current one\n * Example Playground https://playground.babylonjs.com/#L49EJ7#86\n * @param other defines the other quaternion\n * @returns the updated current quaternion\n */\n copyFrom(other) {\n this._x = other._x;\n this._y = other._y;\n this._z = other._z;\n this._w = other._w;\n this._isDirty = true;\n return this;\n }\n /**\n * Updates the current quaternion with the given float coordinates\n * Example Playground https://playground.babylonjs.com/#L49EJ7#87\n * @param x defines the x coordinate\n * @param y defines the y coordinate\n * @param z defines the z coordinate\n * @param w defines the w coordinate\n * @returns the updated current quaternion\n */\n copyFromFloats(x, y, z, w) {\n this._x = x;\n this._y = y;\n this._z = z;\n this._w = w;\n this._isDirty = true;\n return this;\n }\n /**\n * Updates the current quaternion from the given float coordinates\n * Example Playground https://playground.babylonjs.com/#L49EJ7#56\n * @param x defines the x coordinate\n * @param y defines the y coordinate\n * @param z defines the z coordinate\n * @param w defines the w coordinate\n * @returns the updated current quaternion\n */\n set(x, y, z, w) {\n return this.copyFromFloats(x, y, z, w);\n }\n /**\n * Adds two quaternions\n * Example Playground https://playground.babylonjs.com/#L49EJ7#10\n * @param other defines the second operand\n * @returns a new quaternion as the addition result of the given one and the current quaternion\n */\n add(other) {\n return new this.constructor(this._x + other._x, this._y + other._y, this._z + other._z, this._w + other._w);\n }\n /**\n * Add a quaternion to the current one\n * Example Playground https://playground.babylonjs.com/#L49EJ7#11\n * @param other defines the quaternion to add\n * @returns the current quaternion\n */\n addInPlace(other) {\n this._x += other._x;\n this._y += other._y;\n this._z += other._z;\n this._w += other._w;\n this._isDirty = true;\n return this;\n }\n /**\n * Subtract two quaternions\n * Example Playground https://playground.babylonjs.com/#L49EJ7#57\n * @param other defines the second operand\n * @returns a new quaternion as the subtraction result of the given one from the current one\n */\n subtract(other) {\n return new this.constructor(this._x - other._x, this._y - other._y, this._z - other._z, this._w - other._w);\n }\n /**\n * Subtract a quaternion to the current one\n * Example Playground https://playground.babylonjs.com/#L49EJ7#58\n * @param other defines the quaternion to subtract\n * @returns the current quaternion\n */\n subtractInPlace(other) {\n this._x -= other._x;\n this._y -= other._y;\n this._z -= other._z;\n this._w -= other._w;\n this._isDirty = true;\n return this;\n }\n /**\n * Multiplies the current quaternion by a scale factor\n * Example Playground https://playground.babylonjs.com/#L49EJ7#88\n * @param value defines the scale factor\n * @returns a new quaternion set by multiplying the current quaternion coordinates by the float \"scale\"\n */\n scale(value) {\n return new this.constructor(this._x * value, this._y * value, this._z * value, this._w * value);\n }\n /**\n * Scale the current quaternion values by a factor and stores the result to a given quaternion\n * Example Playground https://playground.babylonjs.com/#L49EJ7#89\n * @param scale defines the scale factor\n * @param result defines the Quaternion object where to store the result\n * @returns result input\n */\n scaleToRef(scale, result) {\n result._x = this._x * scale;\n result._y = this._y * scale;\n result._z = this._z * scale;\n result._w = this._w * scale;\n result._isDirty = true;\n return result;\n }\n /**\n * Multiplies in place the current quaternion by a scale factor\n * Example Playground https://playground.babylonjs.com/#L49EJ7#90\n * @param value defines the scale factor\n * @returns the current modified quaternion\n */\n scaleInPlace(value) {\n this._x *= value;\n this._y *= value;\n this._z *= value;\n this._w *= value;\n this._isDirty = true;\n return this;\n }\n /**\n * Scale the current quaternion values by a factor and add the result to a given quaternion\n * Example Playground https://playground.babylonjs.com/#L49EJ7#91\n * @param scale defines the scale factor\n * @param result defines the Quaternion object where to store the result\n * @returns result input\n */\n scaleAndAddToRef(scale, result) {\n result._x += this._x * scale;\n result._y += this._y * scale;\n result._z += this._z * scale;\n result._w += this._w * scale;\n result._isDirty = true;\n return result;\n }\n /**\n * Multiplies two quaternions\n * Example Playground https://playground.babylonjs.com/#L49EJ7#43\n * @param q1 defines the second operand\n * @returns a new quaternion set as the multiplication result of the current one with the given one \"q1\"\n */\n multiply(q1) {\n const result = new this.constructor(0, 0, 0, 1.0);\n this.multiplyToRef(q1, result);\n return result;\n }\n /**\n * Sets the given \"result\" as the the multiplication result of the current one with the given one \"q1\"\n * Example Playground https://playground.babylonjs.com/#L49EJ7#45\n * @param q1 defines the second operand\n * @param result defines the target quaternion\n * @returns the current quaternion\n */\n multiplyToRef(q1, result) {\n const x = this._x * q1._w + this._y * q1._z - this._z * q1._y + this._w * q1._x;\n const y = -this._x * q1._z + this._y * q1._w + this._z * q1._x + this._w * q1._y;\n const z = this._x * q1._y - this._y * q1._x + this._z * q1._w + this._w * q1._z;\n const w = -this._x * q1._x - this._y * q1._y - this._z * q1._z + this._w * q1._w;\n result.copyFromFloats(x, y, z, w);\n return result;\n }\n /**\n * Updates the current quaternion with the multiplication of itself with the given one \"q1\"\n * Example Playground https://playground.babylonjs.com/#L49EJ7#46\n * @param q1 defines the second operand\n * @returns the currentupdated quaternion\n */\n multiplyInPlace(q1) {\n this.multiplyToRef(q1, this);\n return this;\n }\n /**\n * Conjugates the current quaternion and stores the result in the given quaternion\n * Example Playground https://playground.babylonjs.com/#L49EJ7#81\n * @param ref defines the target quaternion\n * @returns result input\n */\n conjugateToRef(ref) {\n ref.copyFromFloats(-this._x, -this._y, -this._z, this._w);\n return ref;\n }\n /**\n * Conjugates in place the current quaternion\n * Example Playground https://playground.babylonjs.com/#L49EJ7#82\n * @returns the current updated quaternion\n */\n conjugateInPlace() {\n this._x *= -1;\n this._y *= -1;\n this._z *= -1;\n this._isDirty = true;\n return this;\n }\n /**\n * Conjugates (1-q) the current quaternion\n * Example Playground https://playground.babylonjs.com/#L49EJ7#83\n * @returns a new quaternion\n */\n conjugate() {\n return new this.constructor(-this._x, -this._y, -this._z, this._w);\n }\n /**\n * Returns the inverse of the current quaternion\n * Example Playground https://playground.babylonjs.com/#L49EJ7#84\n * @returns a new quaternion\n */\n invert() {\n const conjugate = this.conjugate();\n const lengthSquared = this.lengthSquared();\n if (lengthSquared == 0 || lengthSquared == 1) {\n return conjugate;\n }\n conjugate.scaleInPlace(1 / lengthSquared);\n return conjugate;\n }\n /**\n * Invert in place the current quaternion\n * Example Playground https://playground.babylonjs.com/#L49EJ7#85\n * @returns this quaternion\n */\n invertInPlace() {\n this.conjugateInPlace();\n const lengthSquared = this.lengthSquared();\n if (lengthSquared == 0 || lengthSquared == 1) {\n return this;\n }\n this.scaleInPlace(1 / lengthSquared);\n return this;\n }\n /**\n * Gets squared length of current quaternion\n * Example Playground https://playground.babylonjs.com/#L49EJ7#29\n * @returns the quaternion length (float)\n */\n lengthSquared() {\n return this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w;\n }\n /**\n * Gets length of current quaternion\n * Example Playground https://playground.babylonjs.com/#L49EJ7#28\n * @returns the quaternion length (float)\n */\n length() {\n return Math.sqrt(this.lengthSquared());\n }\n /**\n * Normalize in place the current quaternion\n * Example Playground https://playground.babylonjs.com/#L49EJ7#54\n * @returns the current updated quaternion\n */\n normalize() {\n const len = this.length();\n if (len === 0) {\n return this;\n }\n const inv = 1.0 / len;\n this.scaleInPlace(inv);\n return this;\n }\n /**\n * Normalize a copy of the current quaternion\n * Example Playground https://playground.babylonjs.com/#L49EJ7#55\n * @returns the normalized quaternion\n */\n normalizeToNew() {\n const len = this.length();\n if (len === 0) {\n return this.clone();\n }\n const inv = 1.0 / len;\n return this.scale(inv);\n }\n /**\n * Returns a new Vector3 set with the Euler angles translated from the current quaternion\n * Example Playground https://playground.babylonjs.com/#L49EJ7#32\n * @returns a new Vector3 containing the Euler angles\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/transforms/center_origin/rotation_conventions\n */\n toEulerAngles() {\n const result = Vector3.Zero();\n this.toEulerAnglesToRef(result);\n return result;\n }\n /**\n * Sets the given vector3 \"result\" with the Euler angles translated from the current quaternion\n * Example Playground https://playground.babylonjs.com/#L49EJ7#31\n * @param result defines the vector which will be filled with the Euler angles\n * @returns result input\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/transforms/center_origin/rotation_conventions\n */\n toEulerAnglesToRef(result) {\n const qz = this._z;\n const qx = this._x;\n const qy = this._y;\n const qw = this._w;\n const zAxisY = qy * qz - qx * qw;\n const limit = 0.4999999;\n if (zAxisY < -limit) {\n result._y = 2 * Math.atan2(qy, qw);\n result._x = Math.PI / 2;\n result._z = 0;\n result._isDirty = true;\n }\n else if (zAxisY > limit) {\n result._y = 2 * Math.atan2(qy, qw);\n result._x = -Math.PI / 2;\n result._z = 0;\n result._isDirty = true;\n }\n else {\n const sqw = qw * qw;\n const sqz = qz * qz;\n const sqx = qx * qx;\n const sqy = qy * qy;\n result._z = Math.atan2(2.0 * (qx * qy + qz * qw), -sqz - sqx + sqy + sqw);\n result._x = Math.asin(-2.0 * zAxisY);\n result._y = Math.atan2(2.0 * (qz * qx + qy * qw), sqz - sqx - sqy + sqw);\n result._isDirty = true;\n }\n return result;\n }\n /**\n * Updates the given rotation matrix with the current quaternion values\n * Example Playground https://playground.babylonjs.com/#L49EJ7#67\n * @param result defines the target matrix\n * @returns the current unchanged quaternion\n */\n toRotationMatrix(result) {\n Matrix.FromQuaternionToRef(this, result);\n return result;\n }\n /**\n * Updates the current quaternion from the given rotation matrix values\n * Example Playground https://playground.babylonjs.com/#L49EJ7#41\n * @param matrix defines the source matrix\n * @returns the current updated quaternion\n */\n fromRotationMatrix(matrix) {\n Quaternion.FromRotationMatrixToRef(matrix, this);\n return this;\n }\n // Statics\n /**\n * Creates a new quaternion from a rotation matrix\n * Example Playground https://playground.babylonjs.com/#L49EJ7#101\n * @param matrix defines the source matrix\n * @returns a new quaternion created from the given rotation matrix values\n */\n static FromRotationMatrix(matrix) {\n const result = new Quaternion();\n Quaternion.FromRotationMatrixToRef(matrix, result);\n return result;\n }\n /**\n * Updates the given quaternion with the given rotation matrix values\n * Example Playground https://playground.babylonjs.com/#L49EJ7#102\n * @param matrix defines the source matrix\n * @param result defines the target quaternion\n * @returns result input\n */\n static FromRotationMatrixToRef(matrix, result) {\n const data = matrix.m;\n const m11 = data[0], m12 = data[4], m13 = data[8];\n const m21 = data[1], m22 = data[5], m23 = data[9];\n const m31 = data[2], m32 = data[6], m33 = data[10];\n const trace = m11 + m22 + m33;\n let s;\n if (trace > 0) {\n s = 0.5 / Math.sqrt(trace + 1.0);\n result._w = 0.25 / s;\n result._x = (m32 - m23) * s;\n result._y = (m13 - m31) * s;\n result._z = (m21 - m12) * s;\n result._isDirty = true;\n }\n else if (m11 > m22 && m11 > m33) {\n s = 2.0 * Math.sqrt(1.0 + m11 - m22 - m33);\n result._w = (m32 - m23) / s;\n result._x = 0.25 * s;\n result._y = (m12 + m21) / s;\n result._z = (m13 + m31) / s;\n result._isDirty = true;\n }\n else if (m22 > m33) {\n s = 2.0 * Math.sqrt(1.0 + m22 - m11 - m33);\n result._w = (m13 - m31) / s;\n result._x = (m12 + m21) / s;\n result._y = 0.25 * s;\n result._z = (m23 + m32) / s;\n result._isDirty = true;\n }\n else {\n s = 2.0 * Math.sqrt(1.0 + m33 - m11 - m22);\n result._w = (m21 - m12) / s;\n result._x = (m13 + m31) / s;\n result._y = (m23 + m32) / s;\n result._z = 0.25 * s;\n result._isDirty = true;\n }\n return result;\n }\n /**\n * Returns the dot product (float) between the quaternions \"left\" and \"right\"\n * Example Playground https://playground.babylonjs.com/#L49EJ7#61\n * @param left defines the left operand\n * @param right defines the right operand\n * @returns the dot product\n */\n static Dot(left, right) {\n return left._x * right._x + left._y * right._y + left._z * right._z + left._w * right._w;\n }\n /**\n * Checks if the orientations of two rotation quaternions are close to each other\n * Example Playground https://playground.babylonjs.com/#L49EJ7#60\n * @param quat0 defines the first quaternion to check\n * @param quat1 defines the second quaternion to check\n * @param epsilon defines closeness, 0 same orientation, 1 PI apart, default 0.1\n * @returns true if the two quaternions are close to each other within epsilon\n */\n static AreClose(quat0, quat1, epsilon = 0.1) {\n const dot = Quaternion.Dot(quat0, quat1);\n return 1 - dot * dot <= epsilon;\n }\n /**\n * Smooth interpolation between two quaternions using Slerp\n * Example Playground https://playground.babylonjs.com/#L49EJ7#93\n * @param source source quaternion\n * @param goal goal quaternion\n * @param deltaTime current interpolation frame\n * @param lerpTime total interpolation time\n * @param result the smoothed quaternion\n */\n static SmoothToRef(source, goal, deltaTime, lerpTime, result) {\n let slerp = lerpTime === 0 ? 1 : deltaTime / lerpTime;\n slerp = Scalar.Clamp(slerp, 0, 1);\n Quaternion.SlerpToRef(source, goal, slerp, result);\n return result;\n }\n /**\n * Creates an empty quaternion\n * @returns a new quaternion set to (0.0, 0.0, 0.0)\n */\n static Zero() {\n return new Quaternion(0.0, 0.0, 0.0, 0.0);\n }\n /**\n * Inverse a given quaternion\n * Example Playground https://playground.babylonjs.com/#L49EJ7#103\n * @param q defines the source quaternion\n * @returns a new quaternion as the inverted current quaternion\n */\n static Inverse(q) {\n return new q.constructor(-q._x, -q._y, -q._z, q._w);\n }\n /**\n * Inverse a given quaternion\n * Example Playground https://playground.babylonjs.com/#L49EJ7#104\n * @param q defines the source quaternion\n * @param result the quaternion the result will be stored in\n * @returns the result quaternion\n */\n static InverseToRef(q, result) {\n result.set(-q._x, -q._y, -q._z, q._w);\n return result;\n }\n /**\n * Creates an identity quaternion\n * @returns the identity quaternion\n */\n static Identity() {\n return new Quaternion(0.0, 0.0, 0.0, 1.0);\n }\n /**\n * Gets a boolean indicating if the given quaternion is identity\n * @param quaternion defines the quaternion to check\n * @returns true if the quaternion is identity\n */\n static IsIdentity(quaternion) {\n return quaternion && quaternion._x === 0 && quaternion._y === 0 && quaternion._z === 0 && quaternion._w === 1;\n }\n /**\n * Creates a quaternion from a rotation around an axis\n * Example Playground https://playground.babylonjs.com/#L49EJ7#72\n * @param axis defines the axis to use\n * @param angle defines the angle to use\n * @returns a new quaternion created from the given axis (Vector3) and angle in radians (float)\n */\n static RotationAxis(axis, angle) {\n return Quaternion.RotationAxisToRef(axis, angle, new Quaternion());\n }\n /**\n * Creates a rotation around an axis and stores it into the given quaternion\n * Example Playground https://playground.babylonjs.com/#L49EJ7#73\n * @param axis defines the axis to use\n * @param angle defines the angle to use\n * @param result defines the target quaternion\n * @returns the target quaternion\n */\n static RotationAxisToRef(axis, angle, result) {\n const sin = Math.sin(angle / 2);\n axis.normalize();\n result._w = Math.cos(angle / 2);\n result._x = axis._x * sin;\n result._y = axis._y * sin;\n result._z = axis._z * sin;\n result._isDirty = true;\n return result;\n }\n /**\n * Creates a new quaternion from data stored into an array\n * Example Playground https://playground.babylonjs.com/#L49EJ7#63\n * @param array defines the data source\n * @param offset defines the offset in the source array where the data starts\n * @returns a new quaternion\n */\n static FromArray(array, offset) {\n if (!offset) {\n offset = 0;\n }\n return new Quaternion(array[offset], array[offset + 1], array[offset + 2], array[offset + 3]);\n }\n /**\n * Updates the given quaternion \"result\" from the starting index of the given array.\n * Example Playground https://playground.babylonjs.com/#L49EJ7#64\n * @param array the array to pull values from\n * @param offset the offset into the array to start at\n * @param result the quaternion to store the result in\n * @returns result input\n */\n static FromArrayToRef(array, offset, result) {\n result._x = array[offset];\n result._y = array[offset + 1];\n result._z = array[offset + 2];\n result._w = array[offset + 3];\n result._isDirty = true;\n return result;\n }\n /**\n * Create a quaternion from Euler rotation angles\n * Example Playground https://playground.babylonjs.com/#L49EJ7#33\n * @param x Pitch\n * @param y Yaw\n * @param z Roll\n * @returns the new Quaternion\n */\n static FromEulerAngles(x, y, z) {\n const q = new Quaternion();\n Quaternion.RotationYawPitchRollToRef(y, x, z, q);\n return q;\n }\n /**\n * Updates a quaternion from Euler rotation angles\n * Example Playground https://playground.babylonjs.com/#L49EJ7#34\n * @param x Pitch\n * @param y Yaw\n * @param z Roll\n * @param result the quaternion to store the result\n * @returns the updated quaternion\n */\n static FromEulerAnglesToRef(x, y, z, result) {\n Quaternion.RotationYawPitchRollToRef(y, x, z, result);\n return result;\n }\n /**\n * Create a quaternion from Euler rotation vector\n * Example Playground https://playground.babylonjs.com/#L49EJ7#35\n * @param vec the Euler vector (x Pitch, y Yaw, z Roll)\n * @returns the new Quaternion\n */\n static FromEulerVector(vec) {\n const q = new Quaternion();\n Quaternion.RotationYawPitchRollToRef(vec._y, vec._x, vec._z, q);\n return q;\n }\n /**\n * Updates a quaternion from Euler rotation vector\n * Example Playground https://playground.babylonjs.com/#L49EJ7#36\n * @param vec the Euler vector (x Pitch, y Yaw, z Roll)\n * @param result the quaternion to store the result\n * @returns the updated quaternion\n */\n static FromEulerVectorToRef(vec, result) {\n Quaternion.RotationYawPitchRollToRef(vec._y, vec._x, vec._z, result);\n return result;\n }\n /**\n * Updates a quaternion so that it rotates vector vecFrom to vector vecTo\n * Example Playground - https://playground.babylonjs.com/#L49EJ7#70\n * @param vecFrom defines the direction vector from which to rotate\n * @param vecTo defines the direction vector to which to rotate\n * @param result the quaternion to store the result\n * @param epsilon defines the minimal dot value to define vecs as opposite. Default: `BABYLON.Epsilon`\n * @returns the updated quaternion\n */\n static FromUnitVectorsToRef(vecFrom, vecTo, result, epsilon = Epsilon) {\n const r = Vector3.Dot(vecFrom, vecTo) + 1;\n if (r < epsilon) {\n if (Math.abs(vecFrom.x) > Math.abs(vecFrom.z)) {\n result.set(-vecFrom.y, vecFrom.x, 0, 0);\n }\n else {\n result.set(0, -vecFrom.z, vecFrom.y, 0);\n }\n }\n else {\n Vector3.CrossToRef(vecFrom, vecTo, TmpVectors.Vector3[0]);\n result.set(TmpVectors.Vector3[0].x, TmpVectors.Vector3[0].y, TmpVectors.Vector3[0].z, r);\n }\n return result.normalize();\n }\n /**\n * Creates a new quaternion from the given Euler float angles (y, x, z)\n * Example Playground https://playground.babylonjs.com/#L49EJ7#77\n * @param yaw defines the rotation around Y axis\n * @param pitch defines the rotation around X axis\n * @param roll defines the rotation around Z axis\n * @returns the new quaternion\n */\n static RotationYawPitchRoll(yaw, pitch, roll) {\n const q = new Quaternion();\n Quaternion.RotationYawPitchRollToRef(yaw, pitch, roll, q);\n return q;\n }\n /**\n * Creates a new rotation from the given Euler float angles (y, x, z) and stores it in the target quaternion\n * Example Playground https://playground.babylonjs.com/#L49EJ7#78\n * @param yaw defines the rotation around Y axis\n * @param pitch defines the rotation around X axis\n * @param roll defines the rotation around Z axis\n * @param result defines the target quaternion\n * @returns result input\n */\n static RotationYawPitchRollToRef(yaw, pitch, roll, result) {\n // Produces a quaternion from Euler angles in the z-y-x orientation (Tait-Bryan angles)\n const halfRoll = roll * 0.5;\n const halfPitch = pitch * 0.5;\n const halfYaw = yaw * 0.5;\n const sinRoll = Math.sin(halfRoll);\n const cosRoll = Math.cos(halfRoll);\n const sinPitch = Math.sin(halfPitch);\n const cosPitch = Math.cos(halfPitch);\n const sinYaw = Math.sin(halfYaw);\n const cosYaw = Math.cos(halfYaw);\n result._x = cosYaw * sinPitch * cosRoll + sinYaw * cosPitch * sinRoll;\n result._y = sinYaw * cosPitch * cosRoll - cosYaw * sinPitch * sinRoll;\n result._z = cosYaw * cosPitch * sinRoll - sinYaw * sinPitch * cosRoll;\n result._w = cosYaw * cosPitch * cosRoll + sinYaw * sinPitch * sinRoll;\n result._isDirty = true;\n return result;\n }\n /**\n * Creates a new quaternion from the given Euler float angles expressed in z-x-z orientation\n * Example Playground https://playground.babylonjs.com/#L49EJ7#68\n * @param alpha defines the rotation around first axis\n * @param beta defines the rotation around second axis\n * @param gamma defines the rotation around third axis\n * @returns the new quaternion\n */\n static RotationAlphaBetaGamma(alpha, beta, gamma) {\n const result = new Quaternion();\n Quaternion.RotationAlphaBetaGammaToRef(alpha, beta, gamma, result);\n return result;\n }\n /**\n * Creates a new quaternion from the given Euler float angles expressed in z-x-z orientation and stores it in the target quaternion\n * Example Playground https://playground.babylonjs.com/#L49EJ7#69\n * @param alpha defines the rotation around first axis\n * @param beta defines the rotation around second axis\n * @param gamma defines the rotation around third axis\n * @param result defines the target quaternion\n * @returns result input\n */\n static RotationAlphaBetaGammaToRef(alpha, beta, gamma, result) {\n // Produces a quaternion from Euler angles in the z-x-z orientation\n const halfGammaPlusAlpha = (gamma + alpha) * 0.5;\n const halfGammaMinusAlpha = (gamma - alpha) * 0.5;\n const halfBeta = beta * 0.5;\n result._x = Math.cos(halfGammaMinusAlpha) * Math.sin(halfBeta);\n result._y = Math.sin(halfGammaMinusAlpha) * Math.sin(halfBeta);\n result._z = Math.sin(halfGammaPlusAlpha) * Math.cos(halfBeta);\n result._w = Math.cos(halfGammaPlusAlpha) * Math.cos(halfBeta);\n result._isDirty = true;\n return result;\n }\n /**\n * Creates a new quaternion containing the rotation value to reach the target (axis1, axis2, axis3) orientation as a rotated XYZ system (axis1, axis2 and axis3 are normalized during this operation)\n * Example Playground https://playground.babylonjs.com/#L49EJ7#75\n * @param axis1 defines the first axis\n * @param axis2 defines the second axis\n * @param axis3 defines the third axis\n * @returns the new quaternion\n */\n static RotationQuaternionFromAxis(axis1, axis2, axis3) {\n const quat = new Quaternion(0.0, 0.0, 0.0, 0.0);\n Quaternion.RotationQuaternionFromAxisToRef(axis1, axis2, axis3, quat);\n return quat;\n }\n /**\n * Creates a rotation value to reach the target (axis1, axis2, axis3) orientation as a rotated XYZ system (axis1, axis2 and axis3 are normalized during this operation) and stores it in the target quaternion\n * Example Playground https://playground.babylonjs.com/#L49EJ7#76\n * @param axis1 defines the first axis\n * @param axis2 defines the second axis\n * @param axis3 defines the third axis\n * @param ref defines the target quaternion\n * @returns result input\n */\n static RotationQuaternionFromAxisToRef(axis1, axis2, axis3, ref) {\n const rotMat = MathTmp.Matrix[0];\n Matrix.FromXYZAxesToRef(axis1.normalize(), axis2.normalize(), axis3.normalize(), rotMat);\n Quaternion.FromRotationMatrixToRef(rotMat, ref);\n return ref;\n }\n /**\n * Creates a new rotation value to orient an object to look towards the given forward direction, the up direction being oriented like \"up\".\n * This function works in left handed mode\n * Example Playground https://playground.babylonjs.com/#L49EJ7#96\n * @param forward defines the forward direction - Must be normalized and orthogonal to up.\n * @param up defines the up vector for the entity - Must be normalized and orthogonal to forward.\n * @returns A new quaternion oriented toward the specified forward and up.\n */\n static FromLookDirectionLH(forward, up) {\n const quat = new Quaternion();\n Quaternion.FromLookDirectionLHToRef(forward, up, quat);\n return quat;\n }\n /**\n * Creates a new rotation value to orient an object to look towards the given forward direction with the up direction being oriented like \"up\", and stores it in the target quaternion.\n * This function works in left handed mode\n * Example Playground https://playground.babylonjs.com/#L49EJ7#97\n * @param forward defines the forward direction - Must be normalized and orthogonal to up.\n * @param up defines the up vector for the entity - Must be normalized and orthogonal to forward.\n * @param ref defines the target quaternion.\n * @returns result input\n */\n static FromLookDirectionLHToRef(forward, up, ref) {\n const rotMat = MathTmp.Matrix[0];\n Matrix.LookDirectionLHToRef(forward, up, rotMat);\n Quaternion.FromRotationMatrixToRef(rotMat, ref);\n return ref;\n }\n /**\n * Creates a new rotation value to orient an object to look towards the given forward direction, the up direction being oriented like \"up\".\n * This function works in right handed mode\n * Example Playground https://playground.babylonjs.com/#L49EJ7#98\n * @param forward defines the forward direction - Must be normalized and orthogonal to up.\n * @param up defines the up vector for the entity - Must be normalized and orthogonal to forward.\n * @returns A new quaternion oriented toward the specified forward and up.\n */\n static FromLookDirectionRH(forward, up) {\n const quat = new Quaternion();\n Quaternion.FromLookDirectionRHToRef(forward, up, quat);\n return quat;\n }\n /**\n * Creates a new rotation value to orient an object to look towards the given forward direction with the up direction being oriented like \"up\", and stores it in the target quaternion.\n * This function works in right handed mode\n * Example Playground https://playground.babylonjs.com/#L49EJ7#105\n * @param forward defines the forward direction - Must be normalized and orthogonal to up.\n * @param up defines the up vector for the entity - Must be normalized and orthogonal to forward.\n * @param ref defines the target quaternion.\n * @returns result input\n */\n static FromLookDirectionRHToRef(forward, up, ref) {\n const rotMat = MathTmp.Matrix[0];\n Matrix.LookDirectionRHToRef(forward, up, rotMat);\n return Quaternion.FromRotationMatrixToRef(rotMat, ref);\n }\n /**\n * Interpolates between two quaternions\n * Example Playground https://playground.babylonjs.com/#L49EJ7#79\n * @param left defines first quaternion\n * @param right defines second quaternion\n * @param amount defines the gradient to use\n * @returns the new interpolated quaternion\n */\n static Slerp(left, right, amount) {\n const result = Quaternion.Identity();\n Quaternion.SlerpToRef(left, right, amount, result);\n return result;\n }\n /**\n * Interpolates between two quaternions and stores it into a target quaternion\n * Example Playground https://playground.babylonjs.com/#L49EJ7#92\n * @param left defines first quaternion\n * @param right defines second quaternion\n * @param amount defines the gradient to use\n * @param result defines the target quaternion\n * @returns result input\n */\n static SlerpToRef(left, right, amount, result) {\n let num2;\n let num3;\n let num4 = left._x * right._x + left._y * right._y + left._z * right._z + left._w * right._w;\n let flag = false;\n if (num4 < 0) {\n flag = true;\n num4 = -num4;\n }\n if (num4 > 0.999999) {\n num3 = 1 - amount;\n num2 = flag ? -amount : amount;\n }\n else {\n const num5 = Math.acos(num4);\n const num6 = 1.0 / Math.sin(num5);\n num3 = Math.sin((1.0 - amount) * num5) * num6;\n num2 = flag ? -Math.sin(amount * num5) * num6 : Math.sin(amount * num5) * num6;\n }\n result._x = num3 * left._x + num2 * right._x;\n result._y = num3 * left._y + num2 * right._y;\n result._z = num3 * left._z + num2 * right._z;\n result._w = num3 * left._w + num2 * right._w;\n result._isDirty = true;\n return result;\n }\n /**\n * Interpolate between two quaternions using Hermite interpolation\n * Example Playground https://playground.babylonjs.com/#L49EJ7#47\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/drawCurves#hermite-quaternion-spline\n * @param value1 defines first quaternion\n * @param tangent1 defines the incoming tangent\n * @param value2 defines second quaternion\n * @param tangent2 defines the outgoing tangent\n * @param amount defines the target quaternion\n * @returns the new interpolated quaternion\n */\n static Hermite(value1, tangent1, value2, tangent2, amount) {\n const squared = amount * amount;\n const cubed = amount * squared;\n const part1 = 2.0 * cubed - 3.0 * squared + 1.0;\n const part2 = -2.0 * cubed + 3.0 * squared;\n const part3 = cubed - 2.0 * squared + amount;\n const part4 = cubed - squared;\n const x = value1._x * part1 + value2._x * part2 + tangent1._x * part3 + tangent2._x * part4;\n const y = value1._y * part1 + value2._y * part2 + tangent1._y * part3 + tangent2._y * part4;\n const z = value1._z * part1 + value2._z * part2 + tangent1._z * part3 + tangent2._z * part4;\n const w = value1._w * part1 + value2._w * part2 + tangent1._w * part3 + tangent2._w * part4;\n return new value1.constructor(x, y, z, w);\n }\n /**\n * Returns a new Quaternion which is the 1st derivative of the Hermite spline defined by the quaternions \"value1\", \"value2\", \"tangent1\", \"tangent2\".\n * Example Playground https://playground.babylonjs.com/#L49EJ7#48\n * @param value1 defines the first control point\n * @param tangent1 defines the first tangent\n * @param value2 defines the second control point\n * @param tangent2 defines the second tangent\n * @param time define where the derivative must be done\n * @returns 1st derivative\n */\n static Hermite1stDerivative(value1, tangent1, value2, tangent2, time) {\n const result = new value1.constructor();\n this.Hermite1stDerivativeToRef(value1, tangent1, value2, tangent2, time, result);\n return result;\n }\n /**\n * Update a Quaternion with the 1st derivative of the Hermite spline defined by the quaternions \"value1\", \"value2\", \"tangent1\", \"tangent2\".\n * Example Playground https://playground.babylonjs.com/#L49EJ7#49\n * @param value1 defines the first control point\n * @param tangent1 defines the first tangent\n * @param value2 defines the second control point\n * @param tangent2 defines the second tangent\n * @param time define where the derivative must be done\n * @param result define where to store the derivative\n * @returns result input\n */\n static Hermite1stDerivativeToRef(value1, tangent1, value2, tangent2, time, result) {\n const t2 = time * time;\n result._x = (t2 - time) * 6 * value1._x + (3 * t2 - 4 * time + 1) * tangent1._x + (-t2 + time) * 6 * value2._x + (3 * t2 - 2 * time) * tangent2._x;\n result._y = (t2 - time) * 6 * value1._y + (3 * t2 - 4 * time + 1) * tangent1._y + (-t2 + time) * 6 * value2._y + (3 * t2 - 2 * time) * tangent2._y;\n result._z = (t2 - time) * 6 * value1._z + (3 * t2 - 4 * time + 1) * tangent1._z + (-t2 + time) * 6 * value2._z + (3 * t2 - 2 * time) * tangent2._z;\n result._w = (t2 - time) * 6 * value1._w + (3 * t2 - 4 * time + 1) * tangent1._w + (-t2 + time) * 6 * value2._w + (3 * t2 - 2 * time) * tangent2._w;\n result._isDirty = true;\n return result;\n }\n}\n/**\n * Class used to store matrix data (4x4)\n * Note on matrix definitions in Babylon.js for setting values directly\n * rather than using one of the methods available.\n * Matrix size is given by rows x columns.\n * A Vector3 is a 1 X 3 matrix [x, y, z].\n *\n * In Babylon.js multiplying a 1 x 3 matrix by a 4 x 4 matrix\n * is done using BABYLON.Vector4.TransformCoordinates(Vector3, Matrix).\n * and extending the passed Vector3 to a Vector4, V = [x, y, z, 1].\n * Let M be a matrix with elements m(row, column), so that\n * m(2, 3) is the element in row 2 column 3 of M.\n *\n * Multiplication is of the form VM and has the resulting Vector4\n * VM = [xm(0, 0) + ym(1, 0) + zm(2, 0) + m(3, 0), xm(0, 1) + ym(1, 1) + zm(2, 1) + m(3, 1), xm(0, 2) + ym(1, 2) + zm(2, 2) + m(3, 2), xm(0, 3) + ym(1, 3) + zm(2, 3) + m(3, 3)].\n * On the web you will find many examples that use the opposite convention of MV,\n * in which case to make use of the examples you will need to transpose the matrix.\n *\n * Example Playground - Overview Linear Algebra - https://playground.babylonjs.com/#AV9X17\n * Example Playground - Overview Transformation - https://playground.babylonjs.com/#AV9X17#1\n * Example Playground - Overview Projection - https://playground.babylonjs.com/#AV9X17#2\n */\nexport class Matrix {\n /**\n * Gets the precision of matrix computations\n */\n static get Use64Bits() {\n return PerformanceConfigurator.MatrixUse64Bits;\n }\n /**\n * Gets the internal data of the matrix\n */\n get m() {\n return this._m;\n }\n /**\n * Update the updateFlag to indicate that the matrix has been updated\n */\n markAsUpdated() {\n this.updateFlag = Matrix._UpdateFlagSeed++;\n this._isIdentity = false;\n this._isIdentity3x2 = false;\n this._isIdentityDirty = true;\n this._isIdentity3x2Dirty = true;\n }\n _updateIdentityStatus(isIdentity, isIdentityDirty = false, isIdentity3x2 = false, isIdentity3x2Dirty = true) {\n this._isIdentity = isIdentity;\n this._isIdentity3x2 = isIdentity || isIdentity3x2;\n this._isIdentityDirty = this._isIdentity ? false : isIdentityDirty;\n this._isIdentity3x2Dirty = this._isIdentity3x2 ? false : isIdentity3x2Dirty;\n }\n /**\n * Creates an empty matrix (filled with zeros)\n */\n constructor() {\n this._isIdentity = false;\n this._isIdentityDirty = true;\n this._isIdentity3x2 = true;\n this._isIdentity3x2Dirty = true;\n /**\n * Gets the update flag of the matrix which is an unique number for the matrix.\n * It will be incremented every time the matrix data change.\n * You can use it to speed the comparison between two versions of the same matrix.\n */\n this.updateFlag = -1;\n if (PerformanceConfigurator.MatrixTrackPrecisionChange) {\n PerformanceConfigurator.MatrixTrackedMatrices.push(this);\n }\n this._m = new PerformanceConfigurator.MatrixCurrentType(16);\n this.markAsUpdated();\n }\n // Properties\n /**\n * Check if the current matrix is identity\n * @returns true is the matrix is the identity matrix\n */\n isIdentity() {\n if (this._isIdentityDirty) {\n this._isIdentityDirty = false;\n const m = this._m;\n this._isIdentity =\n m[0] === 1.0 &&\n m[1] === 0.0 &&\n m[2] === 0.0 &&\n m[3] === 0.0 &&\n m[4] === 0.0 &&\n m[5] === 1.0 &&\n m[6] === 0.0 &&\n m[7] === 0.0 &&\n m[8] === 0.0 &&\n m[9] === 0.0 &&\n m[10] === 1.0 &&\n m[11] === 0.0 &&\n m[12] === 0.0 &&\n m[13] === 0.0 &&\n m[14] === 0.0 &&\n m[15] === 1.0;\n }\n return this._isIdentity;\n }\n /**\n * Check if the current matrix is identity as a texture matrix (3x2 store in 4x4)\n * @returns true is the matrix is the identity matrix\n */\n isIdentityAs3x2() {\n if (this._isIdentity3x2Dirty) {\n this._isIdentity3x2Dirty = false;\n if (this._m[0] !== 1.0 || this._m[5] !== 1.0 || this._m[15] !== 1.0) {\n this._isIdentity3x2 = false;\n }\n else if (this._m[1] !== 0.0 ||\n this._m[2] !== 0.0 ||\n this._m[3] !== 0.0 ||\n this._m[4] !== 0.0 ||\n this._m[6] !== 0.0 ||\n this._m[7] !== 0.0 ||\n this._m[8] !== 0.0 ||\n this._m[9] !== 0.0 ||\n this._m[10] !== 0.0 ||\n this._m[11] !== 0.0 ||\n this._m[12] !== 0.0 ||\n this._m[13] !== 0.0 ||\n this._m[14] !== 0.0) {\n this._isIdentity3x2 = false;\n }\n else {\n this._isIdentity3x2 = true;\n }\n }\n return this._isIdentity3x2;\n }\n /**\n * Gets the determinant of the matrix\n * Example Playground - https://playground.babylonjs.com/#AV9X17#34\n * @returns the matrix determinant\n */\n determinant() {\n if (this._isIdentity === true) {\n return 1;\n }\n const m = this._m;\n const m00 = m[0], m01 = m[1], m02 = m[2], m03 = m[3];\n const m10 = m[4], m11 = m[5], m12 = m[6], m13 = m[7];\n const m20 = m[8], m21 = m[9], m22 = m[10], m23 = m[11];\n const m30 = m[12], m31 = m[13], m32 = m[14], m33 = m[15];\n // https://en.wikipedia.org/wiki/Laplace_expansion\n // to compute the deterrminant of a 4x4 Matrix we compute the cofactors of any row or column,\n // then we multiply each Cofactor by its corresponding matrix value and sum them all to get the determinant\n // Cofactor(i, j) = sign(i,j) * det(Minor(i, j))\n // where\n // - sign(i,j) = (i+j) % 2 === 0 ? 1 : -1\n // - Minor(i, j) is the 3x3 matrix we get by removing row i and column j from current Matrix\n //\n // Here we do that for the 1st row.\n const det_22_33 = m22 * m33 - m32 * m23;\n const det_21_33 = m21 * m33 - m31 * m23;\n const det_21_32 = m21 * m32 - m31 * m22;\n const det_20_33 = m20 * m33 - m30 * m23;\n const det_20_32 = m20 * m32 - m22 * m30;\n const det_20_31 = m20 * m31 - m30 * m21;\n const cofact_00 = +(m11 * det_22_33 - m12 * det_21_33 + m13 * det_21_32);\n const cofact_01 = -(m10 * det_22_33 - m12 * det_20_33 + m13 * det_20_32);\n const cofact_02 = +(m10 * det_21_33 - m11 * det_20_33 + m13 * det_20_31);\n const cofact_03 = -(m10 * det_21_32 - m11 * det_20_32 + m12 * det_20_31);\n return m00 * cofact_00 + m01 * cofact_01 + m02 * cofact_02 + m03 * cofact_03;\n }\n // Methods\n /**\n * Gets a string with the Matrix values\n * @returns a string with the Matrix values\n */\n toString() {\n return `{${this.m[0]}, ${this.m[1]}, ${this.m[2]}, ${this.m[3]}\\n${this.m[4]}, ${this.m[5]}, ${this.m[6]}, ${this.m[7]}\\n${this.m[8]}, ${this.m[9]}, ${this.m[10]}, ${this.m[11]}\\n${this.m[12]}, ${this.m[13]}, ${this.m[14]}, ${this.m[15]}}`;\n }\n /**\n * Returns the matrix as a Float32Array or Array\n * Example Playground - https://playground.babylonjs.com/#AV9X17#49\n * @returns the matrix underlying array\n */\n toArray() {\n return this._m;\n }\n /**\n * Returns the matrix as a Float32Array or Array\n * Example Playground - https://playground.babylonjs.com/#AV9X17#114\n * @returns the matrix underlying array.\n */\n asArray() {\n return this._m;\n }\n /**\n * Inverts the current matrix in place\n * Example Playground - https://playground.babylonjs.com/#AV9X17#118\n * @returns the current inverted matrix\n */\n invert() {\n this.invertToRef(this);\n return this;\n }\n /**\n * Sets all the matrix elements to zero\n * @returns the current matrix\n */\n reset() {\n Matrix.FromValuesToRef(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, this);\n this._updateIdentityStatus(false);\n return this;\n }\n /**\n * Adds the current matrix with a second one\n * Example Playground - https://playground.babylonjs.com/#AV9X17#44\n * @param other defines the matrix to add\n * @returns a new matrix as the addition of the current matrix and the given one\n */\n add(other) {\n const result = new this.constructor();\n this.addToRef(other, result);\n return result;\n }\n /**\n * Sets the given matrix \"result\" to the addition of the current matrix and the given one\n * Example Playground - https://playground.babylonjs.com/#AV9X17#45\n * @param other defines the matrix to add\n * @param result defines the target matrix\n * @returns result input\n */\n addToRef(other, result) {\n const m = this._m;\n const resultM = result._m;\n const otherM = other.m;\n for (let index = 0; index < 16; index++) {\n resultM[index] = m[index] + otherM[index];\n }\n result.markAsUpdated();\n return result;\n }\n /**\n * Adds in place the given matrix to the current matrix\n * Example Playground - https://playground.babylonjs.com/#AV9X17#46\n * @param other defines the second operand\n * @returns the current updated matrix\n */\n addToSelf(other) {\n const m = this._m;\n const otherM = other.m;\n for (let index = 0; index < 16; index++) {\n m[index] += otherM[index];\n }\n this.markAsUpdated();\n return this;\n }\n /**\n * Sets the given matrix to the current inverted Matrix\n * Example Playground - https://playground.babylonjs.com/#AV9X17#119\n * @param other defines the target matrix\n * @returns result input\n */\n invertToRef(other) {\n if (this._isIdentity === true) {\n Matrix.IdentityToRef(other);\n return other;\n }\n // the inverse of a Matrix is the transpose of cofactor matrix divided by the determinant\n const m = this._m;\n const m00 = m[0], m01 = m[1], m02 = m[2], m03 = m[3];\n const m10 = m[4], m11 = m[5], m12 = m[6], m13 = m[7];\n const m20 = m[8], m21 = m[9], m22 = m[10], m23 = m[11];\n const m30 = m[12], m31 = m[13], m32 = m[14], m33 = m[15];\n const det_22_33 = m22 * m33 - m32 * m23;\n const det_21_33 = m21 * m33 - m31 * m23;\n const det_21_32 = m21 * m32 - m31 * m22;\n const det_20_33 = m20 * m33 - m30 * m23;\n const det_20_32 = m20 * m32 - m22 * m30;\n const det_20_31 = m20 * m31 - m30 * m21;\n const cofact_00 = +(m11 * det_22_33 - m12 * det_21_33 + m13 * det_21_32);\n const cofact_01 = -(m10 * det_22_33 - m12 * det_20_33 + m13 * det_20_32);\n const cofact_02 = +(m10 * det_21_33 - m11 * det_20_33 + m13 * det_20_31);\n const cofact_03 = -(m10 * det_21_32 - m11 * det_20_32 + m12 * det_20_31);\n const det = m00 * cofact_00 + m01 * cofact_01 + m02 * cofact_02 + m03 * cofact_03;\n if (det === 0) {\n // not invertible\n other.copyFrom(this);\n return other;\n }\n const detInv = 1 / det;\n const det_12_33 = m12 * m33 - m32 * m13;\n const det_11_33 = m11 * m33 - m31 * m13;\n const det_11_32 = m11 * m32 - m31 * m12;\n const det_10_33 = m10 * m33 - m30 * m13;\n const det_10_32 = m10 * m32 - m30 * m12;\n const det_10_31 = m10 * m31 - m30 * m11;\n const det_12_23 = m12 * m23 - m22 * m13;\n const det_11_23 = m11 * m23 - m21 * m13;\n const det_11_22 = m11 * m22 - m21 * m12;\n const det_10_23 = m10 * m23 - m20 * m13;\n const det_10_22 = m10 * m22 - m20 * m12;\n const det_10_21 = m10 * m21 - m20 * m11;\n const cofact_10 = -(m01 * det_22_33 - m02 * det_21_33 + m03 * det_21_32);\n const cofact_11 = +(m00 * det_22_33 - m02 * det_20_33 + m03 * det_20_32);\n const cofact_12 = -(m00 * det_21_33 - m01 * det_20_33 + m03 * det_20_31);\n const cofact_13 = +(m00 * det_21_32 - m01 * det_20_32 + m02 * det_20_31);\n const cofact_20 = +(m01 * det_12_33 - m02 * det_11_33 + m03 * det_11_32);\n const cofact_21 = -(m00 * det_12_33 - m02 * det_10_33 + m03 * det_10_32);\n const cofact_22 = +(m00 * det_11_33 - m01 * det_10_33 + m03 * det_10_31);\n const cofact_23 = -(m00 * det_11_32 - m01 * det_10_32 + m02 * det_10_31);\n const cofact_30 = -(m01 * det_12_23 - m02 * det_11_23 + m03 * det_11_22);\n const cofact_31 = +(m00 * det_12_23 - m02 * det_10_23 + m03 * det_10_22);\n const cofact_32 = -(m00 * det_11_23 - m01 * det_10_23 + m03 * det_10_21);\n const cofact_33 = +(m00 * det_11_22 - m01 * det_10_22 + m02 * det_10_21);\n Matrix.FromValuesToRef(cofact_00 * detInv, cofact_10 * detInv, cofact_20 * detInv, cofact_30 * detInv, cofact_01 * detInv, cofact_11 * detInv, cofact_21 * detInv, cofact_31 * detInv, cofact_02 * detInv, cofact_12 * detInv, cofact_22 * detInv, cofact_32 * detInv, cofact_03 * detInv, cofact_13 * detInv, cofact_23 * detInv, cofact_33 * detInv, other);\n return other;\n }\n /**\n * add a value at the specified position in the current Matrix\n * Example Playground - https://playground.babylonjs.com/#AV9X17#47\n * @param index the index of the value within the matrix. between 0 and 15.\n * @param value the value to be added\n * @returns the current updated matrix\n */\n addAtIndex(index, value) {\n this._m[index] += value;\n this.markAsUpdated();\n return this;\n }\n /**\n * mutiply the specified position in the current Matrix by a value\n * @param index the index of the value within the matrix. between 0 and 15.\n * @param value the value to be added\n * @returns the current updated matrix\n */\n multiplyAtIndex(index, value) {\n this._m[index] *= value;\n this.markAsUpdated();\n return this;\n }\n /**\n * Inserts the translation vector (using 3 floats) in the current matrix\n * Example Playground - https://playground.babylonjs.com/#AV9X17#120\n * @param x defines the 1st component of the translation\n * @param y defines the 2nd component of the translation\n * @param z defines the 3rd component of the translation\n * @returns the current updated matrix\n */\n setTranslationFromFloats(x, y, z) {\n this._m[12] = x;\n this._m[13] = y;\n this._m[14] = z;\n this.markAsUpdated();\n return this;\n }\n /**\n * Adds the translation vector (using 3 floats) in the current matrix\n * Example Playground - https://playground.babylonjs.com/#AV9X17#20\n * Example Playground - https://playground.babylonjs.com/#AV9X17#48\n * @param x defines the 1st component of the translation\n * @param y defines the 2nd component of the translation\n * @param z defines the 3rd component of the translation\n * @returns the current updated matrix\n */\n addTranslationFromFloats(x, y, z) {\n this._m[12] += x;\n this._m[13] += y;\n this._m[14] += z;\n this.markAsUpdated();\n return this;\n }\n /**\n * Inserts the translation vector in the current matrix\n * Example Playground - https://playground.babylonjs.com/#AV9X17#121\n * @param vector3 defines the translation to insert\n * @returns the current updated matrix\n */\n setTranslation(vector3) {\n return this.setTranslationFromFloats(vector3._x, vector3._y, vector3._z);\n }\n /**\n * Gets the translation value of the current matrix\n * Example Playground - https://playground.babylonjs.com/#AV9X17#122\n * @returns a new Vector3 as the extracted translation from the matrix\n */\n getTranslation() {\n return new Vector3(this._m[12], this._m[13], this._m[14]);\n }\n /**\n * Fill a Vector3 with the extracted translation from the matrix\n * Example Playground - https://playground.babylonjs.com/#AV9X17#123\n * @param result defines the Vector3 where to store the translation\n * @returns the current matrix\n */\n getTranslationToRef(result) {\n result.x = this._m[12];\n result.y = this._m[13];\n result.z = this._m[14];\n return result;\n }\n /**\n * Remove rotation and scaling part from the matrix\n * @returns the updated matrix\n */\n removeRotationAndScaling() {\n const m = this.m;\n Matrix.FromValuesToRef(1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, m[12], m[13], m[14], m[15], this);\n this._updateIdentityStatus(m[12] === 0 && m[13] === 0 && m[14] === 0 && m[15] === 1);\n return this;\n }\n /**\n * Multiply two matrices\n * Example Playground - https://playground.babylonjs.com/#AV9X17#15\n * A.multiply(B) means apply B to A so result is B x A\n * @param other defines the second operand\n * @returns a new matrix set with the multiplication result of the current Matrix and the given one\n */\n multiply(other) {\n const result = new this.constructor();\n this.multiplyToRef(other, result);\n return result;\n }\n /**\n * Copy the current matrix from the given one\n * Example Playground - https://playground.babylonjs.com/#AV9X17#21\n * @param other defines the source matrix\n * @returns the current updated matrix\n */\n copyFrom(other) {\n other.copyToArray(this._m);\n const o = other;\n this.updateFlag = o.updateFlag;\n this._updateIdentityStatus(o._isIdentity, o._isIdentityDirty, o._isIdentity3x2, o._isIdentity3x2Dirty);\n return this;\n }\n /**\n * Populates the given array from the starting index with the current matrix values\n * @param array defines the target array\n * @param offset defines the offset in the target array where to start storing values\n * @returns the current matrix\n */\n copyToArray(array, offset = 0) {\n const source = this._m;\n array[offset] = source[0];\n array[offset + 1] = source[1];\n array[offset + 2] = source[2];\n array[offset + 3] = source[3];\n array[offset + 4] = source[4];\n array[offset + 5] = source[5];\n array[offset + 6] = source[6];\n array[offset + 7] = source[7];\n array[offset + 8] = source[8];\n array[offset + 9] = source[9];\n array[offset + 10] = source[10];\n array[offset + 11] = source[11];\n array[offset + 12] = source[12];\n array[offset + 13] = source[13];\n array[offset + 14] = source[14];\n array[offset + 15] = source[15];\n return this;\n }\n /**\n * Sets the given matrix \"result\" with the multiplication result of the current Matrix and the given one\n * A.multiplyToRef(B, R) means apply B to A and store in R and R = B x A\n * Example Playground - https://playground.babylonjs.com/#AV9X17#16\n * @param other defines the second operand\n * @param result defines the matrix where to store the multiplication\n * @returns result input\n */\n multiplyToRef(other, result) {\n if (this._isIdentity) {\n result.copyFrom(other);\n return result;\n }\n if (other._isIdentity) {\n result.copyFrom(this);\n return result;\n }\n this.multiplyToArray(other, result._m, 0);\n result.markAsUpdated();\n return result;\n }\n /**\n * Sets the Float32Array \"result\" from the given index \"offset\" with the multiplication of the current matrix and the given one\n * @param other defines the second operand\n * @param result defines the array where to store the multiplication\n * @param offset defines the offset in the target array where to start storing values\n * @returns the current matrix\n */\n multiplyToArray(other, result, offset) {\n const m = this._m;\n const otherM = other.m;\n const tm0 = m[0], tm1 = m[1], tm2 = m[2], tm3 = m[3];\n const tm4 = m[4], tm5 = m[5], tm6 = m[6], tm7 = m[7];\n const tm8 = m[8], tm9 = m[9], tm10 = m[10], tm11 = m[11];\n const tm12 = m[12], tm13 = m[13], tm14 = m[14], tm15 = m[15];\n const om0 = otherM[0], om1 = otherM[1], om2 = otherM[2], om3 = otherM[3];\n const om4 = otherM[4], om5 = otherM[5], om6 = otherM[6], om7 = otherM[7];\n const om8 = otherM[8], om9 = otherM[9], om10 = otherM[10], om11 = otherM[11];\n const om12 = otherM[12], om13 = otherM[13], om14 = otherM[14], om15 = otherM[15];\n result[offset] = tm0 * om0 + tm1 * om4 + tm2 * om8 + tm3 * om12;\n result[offset + 1] = tm0 * om1 + tm1 * om5 + tm2 * om9 + tm3 * om13;\n result[offset + 2] = tm0 * om2 + tm1 * om6 + tm2 * om10 + tm3 * om14;\n result[offset + 3] = tm0 * om3 + tm1 * om7 + tm2 * om11 + tm3 * om15;\n result[offset + 4] = tm4 * om0 + tm5 * om4 + tm6 * om8 + tm7 * om12;\n result[offset + 5] = tm4 * om1 + tm5 * om5 + tm6 * om9 + tm7 * om13;\n result[offset + 6] = tm4 * om2 + tm5 * om6 + tm6 * om10 + tm7 * om14;\n result[offset + 7] = tm4 * om3 + tm5 * om7 + tm6 * om11 + tm7 * om15;\n result[offset + 8] = tm8 * om0 + tm9 * om4 + tm10 * om8 + tm11 * om12;\n result[offset + 9] = tm8 * om1 + tm9 * om5 + tm10 * om9 + tm11 * om13;\n result[offset + 10] = tm8 * om2 + tm9 * om6 + tm10 * om10 + tm11 * om14;\n result[offset + 11] = tm8 * om3 + tm9 * om7 + tm10 * om11 + tm11 * om15;\n result[offset + 12] = tm12 * om0 + tm13 * om4 + tm14 * om8 + tm15 * om12;\n result[offset + 13] = tm12 * om1 + tm13 * om5 + tm14 * om9 + tm15 * om13;\n result[offset + 14] = tm12 * om2 + tm13 * om6 + tm14 * om10 + tm15 * om14;\n result[offset + 15] = tm12 * om3 + tm13 * om7 + tm14 * om11 + tm15 * om15;\n return this;\n }\n /**\n * Check equality between this matrix and a second one\n * @param value defines the second matrix to compare\n * @returns true is the current matrix and the given one values are strictly equal\n */\n equals(value) {\n const other = value;\n if (!other) {\n return false;\n }\n if (this._isIdentity || other._isIdentity) {\n if (!this._isIdentityDirty && !other._isIdentityDirty) {\n return this._isIdentity && other._isIdentity;\n }\n }\n const m = this.m;\n const om = other.m;\n return (m[0] === om[0] &&\n m[1] === om[1] &&\n m[2] === om[2] &&\n m[3] === om[3] &&\n m[4] === om[4] &&\n m[5] === om[5] &&\n m[6] === om[6] &&\n m[7] === om[7] &&\n m[8] === om[8] &&\n m[9] === om[9] &&\n m[10] === om[10] &&\n m[11] === om[11] &&\n m[12] === om[12] &&\n m[13] === om[13] &&\n m[14] === om[14] &&\n m[15] === om[15]);\n }\n /**\n * Clone the current matrix\n * Example Playground - https://playground.babylonjs.com/#AV9X17#18\n * @returns a new matrix from the current matrix\n */\n clone() {\n const matrix = new this.constructor();\n matrix.copyFrom(this);\n return matrix;\n }\n /**\n * Returns the name of the current matrix class\n * @returns the string \"Matrix\"\n */\n getClassName() {\n return \"Matrix\";\n }\n /**\n * Gets the hash code of the current matrix\n * @returns the hash code\n */\n getHashCode() {\n let hash = _ExtractAsInt(this._m[0]);\n for (let i = 1; i < 16; i++) {\n hash = (hash * 397) ^ _ExtractAsInt(this._m[i]);\n }\n return hash;\n }\n /**\n * Decomposes the current Matrix into a translation, rotation and scaling components of the provided node\n * Example Playground - https://playground.babylonjs.com/#AV9X17#13\n * @param node the node to decompose the matrix to\n * @returns true if operation was successful\n */\n decomposeToTransformNode(node) {\n node.rotationQuaternion = node.rotationQuaternion || new Quaternion();\n return this.decompose(node.scaling, node.rotationQuaternion, node.position);\n }\n /**\n * Decomposes the current Matrix into a translation, rotation and scaling components\n * Example Playground - https://playground.babylonjs.com/#AV9X17#12\n * @param scale defines the scale vector3 given as a reference to update\n * @param rotation defines the rotation quaternion given as a reference to update\n * @param translation defines the translation vector3 given as a reference to update\n * @param preserveScalingNode Use scaling sign coming from this node. Otherwise scaling sign might change.\n * @returns true if operation was successful\n */\n decompose(scale, rotation, translation, preserveScalingNode) {\n if (this._isIdentity) {\n if (translation) {\n translation.setAll(0);\n }\n if (scale) {\n scale.setAll(1);\n }\n if (rotation) {\n rotation.copyFromFloats(0, 0, 0, 1);\n }\n return true;\n }\n const m = this._m;\n if (translation) {\n translation.copyFromFloats(m[12], m[13], m[14]);\n }\n scale = scale || MathTmp.Vector3[0];\n scale.x = Math.sqrt(m[0] * m[0] + m[1] * m[1] + m[2] * m[2]);\n scale.y = Math.sqrt(m[4] * m[4] + m[5] * m[5] + m[6] * m[6]);\n scale.z = Math.sqrt(m[8] * m[8] + m[9] * m[9] + m[10] * m[10]);\n if (preserveScalingNode) {\n const signX = preserveScalingNode.scaling.x < 0 ? -1 : 1;\n const signY = preserveScalingNode.scaling.y < 0 ? -1 : 1;\n const signZ = preserveScalingNode.scaling.z < 0 ? -1 : 1;\n scale.x *= signX;\n scale.y *= signY;\n scale.z *= signZ;\n }\n else {\n if (this.determinant() <= 0) {\n scale.y *= -1;\n }\n }\n if (scale._x === 0 || scale._y === 0 || scale._z === 0) {\n if (rotation) {\n rotation.copyFromFloats(0.0, 0.0, 0.0, 1.0);\n }\n return false;\n }\n if (rotation) {\n const sx = 1 / scale._x, sy = 1 / scale._y, sz = 1 / scale._z;\n Matrix.FromValuesToRef(m[0] * sx, m[1] * sx, m[2] * sx, 0.0, m[4] * sy, m[5] * sy, m[6] * sy, 0.0, m[8] * sz, m[9] * sz, m[10] * sz, 0.0, 0.0, 0.0, 0.0, 1.0, MathTmp.Matrix[0]);\n Quaternion.FromRotationMatrixToRef(MathTmp.Matrix[0], rotation);\n }\n return true;\n }\n /**\n * Gets specific row of the matrix\n * Example Playground - https://playground.babylonjs.com/#AV9X17#36\n * @param index defines the number of the row to get\n * @returns the index-th row of the current matrix as a new Vector4\n */\n getRow(index) {\n if (index < 0 || index > 3) {\n return null;\n }\n const i = index * 4;\n return new Vector4(this._m[i + 0], this._m[i + 1], this._m[i + 2], this._m[i + 3]);\n }\n /**\n * Gets specific row of the matrix to ref\n * Example Playground - https://playground.babylonjs.com/#AV9X17#36\n * @param index defines the number of the row to get\n * @param rowVector vector to store the index-th row of the current matrix\n * @returns result input\n */\n getRowToRef(index, rowVector) {\n if (index >= 0 && index < 3) {\n const i = index * 4;\n rowVector.x = this._m[i + 0];\n rowVector.y = this._m[i + 1];\n rowVector.z = this._m[i + 2];\n rowVector.w = this._m[i + 3];\n }\n return rowVector;\n }\n /**\n * Sets the index-th row of the current matrix to the vector4 values\n * Example Playground - https://playground.babylonjs.com/#AV9X17#36\n * @param index defines the number of the row to set\n * @param row defines the target vector4\n * @returns the updated current matrix\n */\n setRow(index, row) {\n return this.setRowFromFloats(index, row.x, row.y, row.z, row.w);\n }\n /**\n * Compute the transpose of the matrix\n * Example Playground - https://playground.babylonjs.com/#AV9X17#40\n * @returns the new transposed matrix\n */\n transpose() {\n const result = new this.constructor();\n Matrix.TransposeToRef(this, result);\n return result;\n }\n /**\n * Compute the transpose of the matrix and store it in a given matrix\n * Example Playground - https://playground.babylonjs.com/#AV9X17#41\n * @param result defines the target matrix\n * @returns result input\n */\n transposeToRef(result) {\n Matrix.TransposeToRef(this, result);\n return result;\n }\n /**\n * Sets the index-th row of the current matrix with the given 4 x float values\n * Example Playground - https://playground.babylonjs.com/#AV9X17#36\n * @param index defines the row index\n * @param x defines the x component to set\n * @param y defines the y component to set\n * @param z defines the z component to set\n * @param w defines the w component to set\n * @returns the updated current matrix\n */\n setRowFromFloats(index, x, y, z, w) {\n if (index < 0 || index > 3) {\n return this;\n }\n const i = index * 4;\n this._m[i + 0] = x;\n this._m[i + 1] = y;\n this._m[i + 2] = z;\n this._m[i + 3] = w;\n this.markAsUpdated();\n return this;\n }\n /**\n * Compute a new matrix set with the current matrix values multiplied by scale (float)\n * @param scale defines the scale factor\n * @returns a new matrix\n */\n scale(scale) {\n const result = new this.constructor();\n this.scaleToRef(scale, result);\n return result;\n }\n /**\n * Scale the current matrix values by a factor to a given result matrix\n * @param scale defines the scale factor\n * @param result defines the matrix to store the result\n * @returns result input\n */\n scaleToRef(scale, result) {\n for (let index = 0; index < 16; index++) {\n result._m[index] = this._m[index] * scale;\n }\n result.markAsUpdated();\n return result;\n }\n /**\n * Scale the current matrix values by a factor and add the result to a given matrix\n * @param scale defines the scale factor\n * @param result defines the Matrix to store the result\n * @returns result input\n */\n scaleAndAddToRef(scale, result) {\n for (let index = 0; index < 16; index++) {\n result._m[index] += this._m[index] * scale;\n }\n result.markAsUpdated();\n return result;\n }\n /**\n * Writes to the given matrix a normal matrix, computed from this one (using values from identity matrix for fourth row and column).\n * Example Playground - https://playground.babylonjs.com/#AV9X17#17\n * @param ref matrix to store the result\n */\n toNormalMatrix(ref) {\n const tmp = MathTmp.Matrix[0];\n this.invertToRef(tmp);\n tmp.transposeToRef(ref);\n const m = ref._m;\n Matrix.FromValuesToRef(m[0], m[1], m[2], 0.0, m[4], m[5], m[6], 0.0, m[8], m[9], m[10], 0.0, 0.0, 0.0, 0.0, 1.0, ref);\n return ref;\n }\n /**\n * Gets only rotation part of the current matrix\n * @returns a new matrix sets to the extracted rotation matrix from the current one\n */\n getRotationMatrix() {\n const result = new this.constructor();\n this.getRotationMatrixToRef(result);\n return result;\n }\n /**\n * Extracts the rotation matrix from the current one and sets it as the given \"result\"\n * @param result defines the target matrix to store data to\n * @returns result input\n */\n getRotationMatrixToRef(result) {\n const scale = MathTmp.Vector3[0];\n if (!this.decompose(scale)) {\n Matrix.IdentityToRef(result);\n return result;\n }\n const m = this._m;\n const sx = 1 / scale._x, sy = 1 / scale._y, sz = 1 / scale._z;\n Matrix.FromValuesToRef(m[0] * sx, m[1] * sx, m[2] * sx, 0.0, m[4] * sy, m[5] * sy, m[6] * sy, 0.0, m[8] * sz, m[9] * sz, m[10] * sz, 0.0, 0.0, 0.0, 0.0, 1.0, result);\n return result;\n }\n /**\n * Toggles model matrix from being right handed to left handed in place and vice versa\n */\n toggleModelMatrixHandInPlace() {\n const m = this._m;\n m[2] *= -1;\n m[6] *= -1;\n m[8] *= -1;\n m[9] *= -1;\n m[14] *= -1;\n this.markAsUpdated();\n return this;\n }\n /**\n * Toggles projection matrix from being right handed to left handed in place and vice versa\n */\n toggleProjectionMatrixHandInPlace() {\n const m = this._m;\n m[8] *= -1;\n m[9] *= -1;\n m[10] *= -1;\n m[11] *= -1;\n this.markAsUpdated();\n return this;\n }\n // Statics\n /**\n * Creates a matrix from an array\n * Example Playground - https://playground.babylonjs.com/#AV9X17#42\n * @param array defines the source array\n * @param offset defines an offset in the source array\n * @returns a new Matrix set from the starting index of the given array\n */\n static FromArray(array, offset = 0) {\n const result = new Matrix();\n Matrix.FromArrayToRef(array, offset, result);\n return result;\n }\n /**\n * Copy the content of an array into a given matrix\n * Example Playground - https://playground.babylonjs.com/#AV9X17#43\n * @param array defines the source array\n * @param offset defines an offset in the source array\n * @param result defines the target matrix\n * @returns result input\n */\n static FromArrayToRef(array, offset, result) {\n for (let index = 0; index < 16; index++) {\n result._m[index] = array[index + offset];\n }\n result.markAsUpdated();\n return result;\n }\n /**\n * Stores an array into a matrix after having multiplied each component by a given factor\n * Example Playground - https://playground.babylonjs.com/#AV9X17#50\n * @param array defines the source array\n * @param offset defines the offset in the source array\n * @param scale defines the scaling factor\n * @param result defines the target matrix\n * @returns result input\n */\n static FromFloat32ArrayToRefScaled(array, offset, scale, result) {\n for (let index = 0; index < 16; index++) {\n result._m[index] = array[index + offset] * scale;\n }\n result.markAsUpdated();\n return result;\n }\n /**\n * Gets an identity matrix that must not be updated\n */\n static get IdentityReadOnly() {\n return Matrix._IdentityReadOnly;\n }\n /**\n * Stores a list of values (16) inside a given matrix\n * @param initialM11 defines 1st value of 1st row\n * @param initialM12 defines 2nd value of 1st row\n * @param initialM13 defines 3rd value of 1st row\n * @param initialM14 defines 4th value of 1st row\n * @param initialM21 defines 1st value of 2nd row\n * @param initialM22 defines 2nd value of 2nd row\n * @param initialM23 defines 3rd value of 2nd row\n * @param initialM24 defines 4th value of 2nd row\n * @param initialM31 defines 1st value of 3rd row\n * @param initialM32 defines 2nd value of 3rd row\n * @param initialM33 defines 3rd value of 3rd row\n * @param initialM34 defines 4th value of 3rd row\n * @param initialM41 defines 1st value of 4th row\n * @param initialM42 defines 2nd value of 4th row\n * @param initialM43 defines 3rd value of 4th row\n * @param initialM44 defines 4th value of 4th row\n * @param result defines the target matrix\n * @returns result input\n */\n static FromValuesToRef(initialM11, initialM12, initialM13, initialM14, initialM21, initialM22, initialM23, initialM24, initialM31, initialM32, initialM33, initialM34, initialM41, initialM42, initialM43, initialM44, result) {\n const m = result._m;\n m[0] = initialM11;\n m[1] = initialM12;\n m[2] = initialM13;\n m[3] = initialM14;\n m[4] = initialM21;\n m[5] = initialM22;\n m[6] = initialM23;\n m[7] = initialM24;\n m[8] = initialM31;\n m[9] = initialM32;\n m[10] = initialM33;\n m[11] = initialM34;\n m[12] = initialM41;\n m[13] = initialM42;\n m[14] = initialM43;\n m[15] = initialM44;\n result.markAsUpdated();\n }\n /**\n * Creates new matrix from a list of values (16)\n * @param initialM11 defines 1st value of 1st row\n * @param initialM12 defines 2nd value of 1st row\n * @param initialM13 defines 3rd value of 1st row\n * @param initialM14 defines 4th value of 1st row\n * @param initialM21 defines 1st value of 2nd row\n * @param initialM22 defines 2nd value of 2nd row\n * @param initialM23 defines 3rd value of 2nd row\n * @param initialM24 defines 4th value of 2nd row\n * @param initialM31 defines 1st value of 3rd row\n * @param initialM32 defines 2nd value of 3rd row\n * @param initialM33 defines 3rd value of 3rd row\n * @param initialM34 defines 4th value of 3rd row\n * @param initialM41 defines 1st value of 4th row\n * @param initialM42 defines 2nd value of 4th row\n * @param initialM43 defines 3rd value of 4th row\n * @param initialM44 defines 4th value of 4th row\n * @returns the new matrix\n */\n static FromValues(initialM11, initialM12, initialM13, initialM14, initialM21, initialM22, initialM23, initialM24, initialM31, initialM32, initialM33, initialM34, initialM41, initialM42, initialM43, initialM44) {\n const result = new Matrix();\n const m = result._m;\n m[0] = initialM11;\n m[1] = initialM12;\n m[2] = initialM13;\n m[3] = initialM14;\n m[4] = initialM21;\n m[5] = initialM22;\n m[6] = initialM23;\n m[7] = initialM24;\n m[8] = initialM31;\n m[9] = initialM32;\n m[10] = initialM33;\n m[11] = initialM34;\n m[12] = initialM41;\n m[13] = initialM42;\n m[14] = initialM43;\n m[15] = initialM44;\n result.markAsUpdated();\n return result;\n }\n /**\n * Creates a new matrix composed by merging scale (vector3), rotation (quaternion) and translation (vector3)\n * Example Playground - https://playground.babylonjs.com/#AV9X17#24\n * @param scale defines the scale vector3\n * @param rotation defines the rotation quaternion\n * @param translation defines the translation vector3\n * @returns a new matrix\n */\n static Compose(scale, rotation, translation) {\n const result = new Matrix();\n Matrix.ComposeToRef(scale, rotation, translation, result);\n return result;\n }\n /**\n * Sets a matrix to a value composed by merging scale (vector3), rotation (quaternion) and translation (vector3)\n * Example Playground - https://playground.babylonjs.com/#AV9X17#25\n * @param scale defines the scale vector3\n * @param rotation defines the rotation quaternion\n * @param translation defines the translation vector3\n * @param result defines the target matrix\n * @returns result input\n */\n static ComposeToRef(scale, rotation, translation, result) {\n const m = result._m;\n const x = rotation._x, y = rotation._y, z = rotation._z, w = rotation._w;\n const x2 = x + x, y2 = y + y, z2 = z + z;\n const xx = x * x2, xy = x * y2, xz = x * z2;\n const yy = y * y2, yz = y * z2, zz = z * z2;\n const wx = w * x2, wy = w * y2, wz = w * z2;\n const sx = scale._x, sy = scale._y, sz = scale._z;\n m[0] = (1 - (yy + zz)) * sx;\n m[1] = (xy + wz) * sx;\n m[2] = (xz - wy) * sx;\n m[3] = 0;\n m[4] = (xy - wz) * sy;\n m[5] = (1 - (xx + zz)) * sy;\n m[6] = (yz + wx) * sy;\n m[7] = 0;\n m[8] = (xz + wy) * sz;\n m[9] = (yz - wx) * sz;\n m[10] = (1 - (xx + yy)) * sz;\n m[11] = 0;\n m[12] = translation._x;\n m[13] = translation._y;\n m[14] = translation._z;\n m[15] = 1;\n result.markAsUpdated();\n return result;\n }\n /**\n * Creates a new identity matrix\n * @returns a new identity matrix\n */\n static Identity() {\n const identity = Matrix.FromValues(1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0);\n identity._updateIdentityStatus(true);\n return identity;\n }\n /**\n * Creates a new identity matrix and stores the result in a given matrix\n * @param result defines the target matrix\n * @returns result input\n */\n static IdentityToRef(result) {\n Matrix.FromValuesToRef(1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, result);\n result._updateIdentityStatus(true);\n return result;\n }\n /**\n * Creates a new zero matrix\n * @returns a new zero matrix\n */\n static Zero() {\n const zero = Matrix.FromValues(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);\n zero._updateIdentityStatus(false);\n return zero;\n }\n /**\n * Creates a new rotation matrix for \"angle\" radians around the X axis\n * Example Playground - https://playground.babylonjs.com/#AV9X17#97\n * @param angle defines the angle (in radians) to use\n * @returns the new matrix\n */\n static RotationX(angle) {\n const result = new Matrix();\n Matrix.RotationXToRef(angle, result);\n return result;\n }\n /**\n * Creates a new matrix as the invert of a given matrix\n * Example Playground - https://playground.babylonjs.com/#AV9X17#124\n * @param source defines the source matrix\n * @returns the new matrix\n */\n static Invert(source) {\n const result = new source.constructor();\n source.invertToRef(result);\n return result;\n }\n /**\n * Creates a new rotation matrix for \"angle\" radians around the X axis and stores it in a given matrix\n * Example Playground - https://playground.babylonjs.com/#AV9X17#98\n * @param angle defines the angle (in radians) to use\n * @param result defines the target matrix\n * @returns result input\n */\n static RotationXToRef(angle, result) {\n const s = Math.sin(angle);\n const c = Math.cos(angle);\n Matrix.FromValuesToRef(1.0, 0.0, 0.0, 0.0, 0.0, c, s, 0.0, 0.0, -s, c, 0.0, 0.0, 0.0, 0.0, 1.0, result);\n result._updateIdentityStatus(c === 1 && s === 0);\n return result;\n }\n /**\n * Creates a new rotation matrix for \"angle\" radians around the Y axis\n * Example Playground - https://playground.babylonjs.com/#AV9X17#99\n * @param angle defines the angle (in radians) to use\n * @returns the new matrix\n */\n static RotationY(angle) {\n const result = new Matrix();\n Matrix.RotationYToRef(angle, result);\n return result;\n }\n /**\n * Creates a new rotation matrix for \"angle\" radians around the Y axis and stores it in a given matrix\n * Example Playground - https://playground.babylonjs.com/#AV9X17#100\n * @param angle defines the angle (in radians) to use\n * @param result defines the target matrix\n * @returns result input\n */\n static RotationYToRef(angle, result) {\n const s = Math.sin(angle);\n const c = Math.cos(angle);\n Matrix.FromValuesToRef(c, 0.0, -s, 0.0, 0.0, 1.0, 0.0, 0.0, s, 0.0, c, 0.0, 0.0, 0.0, 0.0, 1.0, result);\n result._updateIdentityStatus(c === 1 && s === 0);\n return result;\n }\n /**\n * Creates a new rotation matrix for \"angle\" radians around the Z axis\n * Example Playground - https://playground.babylonjs.com/#AV9X17#101\n * @param angle defines the angle (in radians) to use\n * @returns the new matrix\n */\n static RotationZ(angle) {\n const result = new Matrix();\n Matrix.RotationZToRef(angle, result);\n return result;\n }\n /**\n * Creates a new rotation matrix for \"angle\" radians around the Z axis and stores it in a given matrix\n * Example Playground - https://playground.babylonjs.com/#AV9X17#102\n * @param angle defines the angle (in radians) to use\n * @param result defines the target matrix\n * @returns result input\n */\n static RotationZToRef(angle, result) {\n const s = Math.sin(angle);\n const c = Math.cos(angle);\n Matrix.FromValuesToRef(c, s, 0.0, 0.0, -s, c, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, result);\n result._updateIdentityStatus(c === 1 && s === 0);\n return result;\n }\n /**\n * Creates a new rotation matrix for \"angle\" radians around the given axis\n * Example Playground - https://playground.babylonjs.com/#AV9X17#96\n * @param axis defines the axis to use\n * @param angle defines the angle (in radians) to use\n * @returns the new matrix\n */\n static RotationAxis(axis, angle) {\n const result = new Matrix();\n Matrix.RotationAxisToRef(axis, angle, result);\n return result;\n }\n /**\n * Creates a new rotation matrix for \"angle\" radians around the given axis and stores it in a given matrix\n * Example Playground - https://playground.babylonjs.com/#AV9X17#94\n * @param axis defines the axis to use\n * @param angle defines the angle (in radians) to use\n * @param result defines the target matrix\n * @returns result input\n */\n static RotationAxisToRef(axis, angle, result) {\n const s = Math.sin(-angle);\n const c = Math.cos(-angle);\n const c1 = 1 - c;\n axis.normalize();\n const m = result._m;\n m[0] = axis._x * axis._x * c1 + c;\n m[1] = axis._x * axis._y * c1 - axis._z * s;\n m[2] = axis._x * axis._z * c1 + axis._y * s;\n m[3] = 0.0;\n m[4] = axis._y * axis._x * c1 + axis._z * s;\n m[5] = axis._y * axis._y * c1 + c;\n m[6] = axis._y * axis._z * c1 - axis._x * s;\n m[7] = 0.0;\n m[8] = axis._z * axis._x * c1 - axis._y * s;\n m[9] = axis._z * axis._y * c1 + axis._x * s;\n m[10] = axis._z * axis._z * c1 + c;\n m[11] = 0.0;\n m[12] = 0.0;\n m[13] = 0.0;\n m[14] = 0.0;\n m[15] = 1.0;\n result.markAsUpdated();\n return result;\n }\n /**\n * Takes normalised vectors and returns a rotation matrix to align \"from\" with \"to\".\n * Taken from http://www.iquilezles.org/www/articles/noacos/noacos.htm\n * Example Playground - https://playground.babylonjs.com/#AV9X17#93\n * @param from defines the vector to align\n * @param to defines the vector to align to\n * @param result defines the target matrix\n * @param useYAxisForCoplanar defines a boolean indicating that we should favor Y axis for coplanar vectors (default is false)\n * @returns result input\n */\n static RotationAlignToRef(from, to, result, useYAxisForCoplanar = false) {\n const c = Vector3.Dot(to, from);\n const m = result._m;\n if (c < -1 + Epsilon) {\n // from and to are colinear and opposite direction.\n // compute a PI rotation on Y axis\n m[0] = -1;\n m[1] = 0;\n m[2] = 0;\n m[3] = 0;\n m[4] = 0;\n m[5] = useYAxisForCoplanar ? 1 : -1;\n m[6] = 0;\n m[7] = 0;\n m[8] = 0;\n m[9] = 0;\n m[10] = useYAxisForCoplanar ? -1 : 1;\n m[11] = 0;\n }\n else {\n const v = Vector3.Cross(to, from);\n const k = 1 / (1 + c);\n m[0] = v._x * v._x * k + c;\n m[1] = v._y * v._x * k - v._z;\n m[2] = v._z * v._x * k + v._y;\n m[3] = 0;\n m[4] = v._x * v._y * k + v._z;\n m[5] = v._y * v._y * k + c;\n m[6] = v._z * v._y * k - v._x;\n m[7] = 0;\n m[8] = v._x * v._z * k - v._y;\n m[9] = v._y * v._z * k + v._x;\n m[10] = v._z * v._z * k + c;\n m[11] = 0;\n }\n m[12] = 0;\n m[13] = 0;\n m[14] = 0;\n m[15] = 1;\n result.markAsUpdated();\n return result;\n }\n /**\n * Creates a rotation matrix\n * Example Playground - https://playground.babylonjs.com/#AV9X17#103\n * Example Playground - https://playground.babylonjs.com/#AV9X17#105\n * @param yaw defines the yaw angle in radians (Y axis)\n * @param pitch defines the pitch angle in radians (X axis)\n * @param roll defines the roll angle in radians (Z axis)\n * @returns the new rotation matrix\n */\n static RotationYawPitchRoll(yaw, pitch, roll) {\n const result = new Matrix();\n Matrix.RotationYawPitchRollToRef(yaw, pitch, roll, result);\n return result;\n }\n /**\n * Creates a rotation matrix and stores it in a given matrix\n * Example Playground - https://playground.babylonjs.com/#AV9X17#104\n * @param yaw defines the yaw angle in radians (Y axis)\n * @param pitch defines the pitch angle in radians (X axis)\n * @param roll defines the roll angle in radians (Z axis)\n * @param result defines the target matrix\n * @returns result input\n */\n static RotationYawPitchRollToRef(yaw, pitch, roll, result) {\n Quaternion.RotationYawPitchRollToRef(yaw, pitch, roll, MathTmp.Quaternion[0]);\n MathTmp.Quaternion[0].toRotationMatrix(result);\n return result;\n }\n /**\n * Creates a scaling matrix\n * Example Playground - https://playground.babylonjs.com/#AV9X17#107\n * @param x defines the scale factor on X axis\n * @param y defines the scale factor on Y axis\n * @param z defines the scale factor on Z axis\n * @returns the new matrix\n */\n static Scaling(x, y, z) {\n const result = new Matrix();\n Matrix.ScalingToRef(x, y, z, result);\n return result;\n }\n /**\n * Creates a scaling matrix and stores it in a given matrix\n * Example Playground - https://playground.babylonjs.com/#AV9X17#108\n * @param x defines the scale factor on X axis\n * @param y defines the scale factor on Y axis\n * @param z defines the scale factor on Z axis\n * @param result defines the target matrix\n * @returns result input\n */\n static ScalingToRef(x, y, z, result) {\n Matrix.FromValuesToRef(x, 0.0, 0.0, 0.0, 0.0, y, 0.0, 0.0, 0.0, 0.0, z, 0.0, 0.0, 0.0, 0.0, 1.0, result);\n result._updateIdentityStatus(x === 1 && y === 1 && z === 1);\n return result;\n }\n /**\n * Creates a translation matrix\n * Example Playground - https://playground.babylonjs.com/#AV9X17#109\n * @param x defines the translation on X axis\n * @param y defines the translation on Y axis\n * @param z defines the translationon Z axis\n * @returns the new matrix\n */\n static Translation(x, y, z) {\n const result = new Matrix();\n Matrix.TranslationToRef(x, y, z, result);\n return result;\n }\n /**\n * Creates a translation matrix and stores it in a given matrix\n * Example Playground - https://playground.babylonjs.com/#AV9X17#110\n * @param x defines the translation on X axis\n * @param y defines the translation on Y axis\n * @param z defines the translationon Z axis\n * @param result defines the target matrix\n * @returns result input\n */\n static TranslationToRef(x, y, z, result) {\n Matrix.FromValuesToRef(1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, x, y, z, 1.0, result);\n result._updateIdentityStatus(x === 0 && y === 0 && z === 0);\n return result;\n }\n /**\n * Returns a new Matrix whose values are the interpolated values for \"gradient\" (float) between the ones of the matrices \"startValue\" and \"endValue\".\n * Example Playground - https://playground.babylonjs.com/#AV9X17#55\n * @param startValue defines the start value\n * @param endValue defines the end value\n * @param gradient defines the gradient factor\n * @returns the new matrix\n */\n static Lerp(startValue, endValue, gradient) {\n const result = new startValue.constructor();\n Matrix.LerpToRef(startValue, endValue, gradient, result);\n return result;\n }\n /**\n * Set the given matrix \"result\" as the interpolated values for \"gradient\" (float) between the ones of the matrices \"startValue\" and \"endValue\".\n * Example Playground - https://playground.babylonjs.com/#AV9X17#54\n * @param startValue defines the start value\n * @param endValue defines the end value\n * @param gradient defines the gradient factor\n * @param result defines the Matrix object where to store data\n * @returns result input\n */\n static LerpToRef(startValue, endValue, gradient, result) {\n const resultM = result._m;\n const startM = startValue.m;\n const endM = endValue.m;\n for (let index = 0; index < 16; index++) {\n resultM[index] = startM[index] * (1.0 - gradient) + endM[index] * gradient;\n }\n result.markAsUpdated();\n return result;\n }\n /**\n * Builds a new matrix whose values are computed by:\n * * decomposing the the \"startValue\" and \"endValue\" matrices into their respective scale, rotation and translation matrices\n * * interpolating for \"gradient\" (float) the values between each of these decomposed matrices between the start and the end\n * * recomposing a new matrix from these 3 interpolated scale, rotation and translation matrices\n * Example Playground - https://playground.babylonjs.com/#AV9X17#22\n * Example Playground - https://playground.babylonjs.com/#AV9X17#51\n * @param startValue defines the first matrix\n * @param endValue defines the second matrix\n * @param gradient defines the gradient between the two matrices\n * @returns the new matrix\n */\n static DecomposeLerp(startValue, endValue, gradient) {\n const result = new startValue.constructor();\n Matrix.DecomposeLerpToRef(startValue, endValue, gradient, result);\n return result;\n }\n /**\n * Update a matrix to values which are computed by:\n * * decomposing the the \"startValue\" and \"endValue\" matrices into their respective scale, rotation and translation matrices\n * * interpolating for \"gradient\" (float) the values between each of these decomposed matrices between the start and the end\n * * recomposing a new matrix from these 3 interpolated scale, rotation and translation matrices\n * Example Playground - https://playground.babylonjs.com/#AV9X17#23\n * Example Playground - https://playground.babylonjs.com/#AV9X17#53\n * @param startValue defines the first matrix\n * @param endValue defines the second matrix\n * @param gradient defines the gradient between the two matrices\n * @param result defines the target matrix\n * @returns result input\n */\n static DecomposeLerpToRef(startValue, endValue, gradient, result) {\n const startScale = MathTmp.Vector3[0];\n const startRotation = MathTmp.Quaternion[0];\n const startTranslation = MathTmp.Vector3[1];\n startValue.decompose(startScale, startRotation, startTranslation);\n const endScale = MathTmp.Vector3[2];\n const endRotation = MathTmp.Quaternion[1];\n const endTranslation = MathTmp.Vector3[3];\n endValue.decompose(endScale, endRotation, endTranslation);\n const resultScale = MathTmp.Vector3[4];\n Vector3.LerpToRef(startScale, endScale, gradient, resultScale);\n const resultRotation = MathTmp.Quaternion[2];\n Quaternion.SlerpToRef(startRotation, endRotation, gradient, resultRotation);\n const resultTranslation = MathTmp.Vector3[5];\n Vector3.LerpToRef(startTranslation, endTranslation, gradient, resultTranslation);\n Matrix.ComposeToRef(resultScale, resultRotation, resultTranslation, result);\n return result;\n }\n /**\n * Creates a new matrix that transforms vertices from world space to camera space. It takes three vectors as arguments that together describe the position and orientation of the camera.\n * This function generates a matrix suitable for a left handed coordinate system\n * Example Playground - https://playground.babylonjs.com/#AV9X17#58\n * Example Playground - https://playground.babylonjs.com/#AV9X17#59\n * @param eye defines the final position of the entity\n * @param target defines where the entity should look at\n * @param up defines the up vector for the entity\n * @returns the new matrix\n */\n static LookAtLH(eye, target, up) {\n const result = new Matrix();\n Matrix.LookAtLHToRef(eye, target, up, result);\n return result;\n }\n /**\n * Sets the given \"result\" Matrix to a matrix that transforms vertices from world space to camera space. It takes three vectors as arguments that together describe the position and orientation of the camera.\n * This function generates a matrix suitable for a left handed coordinate system\n * Example Playground - https://playground.babylonjs.com/#AV9X17#60\n * Example Playground - https://playground.babylonjs.com/#AV9X17#61\n * @param eye defines the final position of the entity\n * @param target defines where the entity should look at\n * @param up defines the up vector for the entity\n * @param result defines the target matrix\n * @returns result input\n */\n static LookAtLHToRef(eye, target, up, result) {\n const xAxis = MathTmp.Vector3[0];\n const yAxis = MathTmp.Vector3[1];\n const zAxis = MathTmp.Vector3[2];\n // Z axis\n target.subtractToRef(eye, zAxis);\n zAxis.normalize();\n // X axis\n Vector3.CrossToRef(up, zAxis, xAxis);\n const xSquareLength = xAxis.lengthSquared();\n if (xSquareLength === 0) {\n xAxis.x = 1.0;\n }\n else {\n xAxis.normalizeFromLength(Math.sqrt(xSquareLength));\n }\n // Y axis\n Vector3.CrossToRef(zAxis, xAxis, yAxis);\n yAxis.normalize();\n // Eye angles\n const ex = -Vector3.Dot(xAxis, eye);\n const ey = -Vector3.Dot(yAxis, eye);\n const ez = -Vector3.Dot(zAxis, eye);\n Matrix.FromValuesToRef(xAxis._x, yAxis._x, zAxis._x, 0.0, xAxis._y, yAxis._y, zAxis._y, 0.0, xAxis._z, yAxis._z, zAxis._z, 0.0, ex, ey, ez, 1.0, result);\n }\n /**\n * Creates a new matrix that transforms vertices from world space to camera space. It takes three vectors as arguments that together describe the position and orientation of the camera.\n * This function generates a matrix suitable for a right handed coordinate system\n * Example Playground - https://playground.babylonjs.com/#AV9X17#62\n * Example Playground - https://playground.babylonjs.com/#AV9X17#63\n * @param eye defines the final position of the entity\n * @param target defines where the entity should look at\n * @param up defines the up vector for the entity\n * @returns the new matrix\n */\n static LookAtRH(eye, target, up) {\n const result = new Matrix();\n Matrix.LookAtRHToRef(eye, target, up, result);\n return result;\n }\n /**\n * Sets the given \"result\" Matrix to a matrix that transforms vertices from world space to camera space. It takes three vectors as arguments that together describe the position and orientation of the camera.\n * This function generates a matrix suitable for a right handed coordinate system\n * Example Playground - https://playground.babylonjs.com/#AV9X17#64\n * Example Playground - https://playground.babylonjs.com/#AV9X17#65\n * @param eye defines the final position of the entity\n * @param target defines where the entity should look at\n * @param up defines the up vector for the entity\n * @param result defines the target matrix\n * @returns result input\n */\n static LookAtRHToRef(eye, target, up, result) {\n const xAxis = MathTmp.Vector3[0];\n const yAxis = MathTmp.Vector3[1];\n const zAxis = MathTmp.Vector3[2];\n // Z axis\n eye.subtractToRef(target, zAxis);\n zAxis.normalize();\n // X axis\n Vector3.CrossToRef(up, zAxis, xAxis);\n const xSquareLength = xAxis.lengthSquared();\n if (xSquareLength === 0) {\n xAxis.x = 1.0;\n }\n else {\n xAxis.normalizeFromLength(Math.sqrt(xSquareLength));\n }\n // Y axis\n Vector3.CrossToRef(zAxis, xAxis, yAxis);\n yAxis.normalize();\n // Eye angles\n const ex = -Vector3.Dot(xAxis, eye);\n const ey = -Vector3.Dot(yAxis, eye);\n const ez = -Vector3.Dot(zAxis, eye);\n Matrix.FromValuesToRef(xAxis._x, yAxis._x, zAxis._x, 0.0, xAxis._y, yAxis._y, zAxis._y, 0.0, xAxis._z, yAxis._z, zAxis._z, 0.0, ex, ey, ez, 1.0, result);\n return result;\n }\n /**\n * Creates a new matrix that transforms vertices from world space to camera space. It takes two vectors as arguments that together describe the orientation of the camera. The position is assumed to be at the origin (0,0,0)\n * This function generates a matrix suitable for a left handed coordinate system\n * Example Playground - https://playground.babylonjs.com/#AV9X17#66\n * @param forward defines the forward direction - Must be normalized and orthogonal to up.\n * @param up defines the up vector for the entity - Must be normalized and orthogonal to forward.\n * @returns the new matrix\n */\n static LookDirectionLH(forward, up) {\n const result = new Matrix();\n Matrix.LookDirectionLHToRef(forward, up, result);\n return result;\n }\n /**\n * Sets the given \"result\" Matrix to a matrix that transforms vertices from world space to camera space. It takes two vectors as arguments that together describe the orientation of the camera. The position is assumed to be at the origin (0,0,0)\n * This function generates a matrix suitable for a left handed coordinate system\n * Example Playground - https://playground.babylonjs.com/#AV9X17#67\n * @param forward defines the forward direction - Must be normalized and orthogonal to up.\n * @param up defines the up vector for the entity - Must be normalized and orthogonal to forward.\n * @param result defines the target matrix\n * @returns result input\n */\n static LookDirectionLHToRef(forward, up, result) {\n const back = MathTmp.Vector3[0];\n back.copyFrom(forward);\n back.scaleInPlace(-1);\n const left = MathTmp.Vector3[1];\n Vector3.CrossToRef(up, back, left);\n // Generate the rotation matrix.\n Matrix.FromValuesToRef(left._x, left._y, left._z, 0.0, up._x, up._y, up._z, 0.0, back._x, back._y, back._z, 0.0, 0, 0, 0, 1.0, result);\n return result;\n }\n /**\n * Creates a new matrix that transforms vertices from world space to camera space. It takes two vectors as arguments that together describe the orientation of the camera. The position is assumed to be at the origin (0,0,0)\n * This function generates a matrix suitable for a right handed coordinate system\n * Example Playground - https://playground.babylonjs.com/#AV9X17#68\n * @param forward defines the forward direction - Must be normalized and orthogonal to up.\n * @param up defines the up vector for the entity - Must be normalized and orthogonal to forward.\n * @returns the new matrix\n */\n static LookDirectionRH(forward, up) {\n const result = new Matrix();\n Matrix.LookDirectionRHToRef(forward, up, result);\n return result;\n }\n /**\n * Sets the given \"result\" Matrix to a matrix that transforms vertices from world space to camera space. It takes two vectors as arguments that together describe the orientation of the camera. The position is assumed to be at the origin (0,0,0)\n * This function generates a matrix suitable for a right handed coordinate system\n * Example Playground - https://playground.babylonjs.com/#AV9X17#69\n * @param forward defines the forward direction - Must be normalized and orthogonal to up.\n * @param up defines the up vector for the entity - Must be normalized and orthogonal to forward.\n * @param result defines the target matrix\n * @returns result input\n */\n static LookDirectionRHToRef(forward, up, result) {\n const right = MathTmp.Vector3[2];\n Vector3.CrossToRef(up, forward, right);\n // Generate the rotation matrix.\n Matrix.FromValuesToRef(right._x, right._y, right._z, 0.0, up._x, up._y, up._z, 0.0, forward._x, forward._y, forward._z, 0.0, 0, 0, 0, 1.0, result);\n return result;\n }\n /**\n * Create a left-handed orthographic projection matrix\n * Example Playground - https://playground.babylonjs.com/#AV9X17#70\n * @param width defines the viewport width\n * @param height defines the viewport height\n * @param znear defines the near clip plane\n * @param zfar defines the far clip plane\n * @param halfZRange true to generate NDC coordinates between 0 and 1 instead of -1 and 1 (default: false)\n * @returns a new matrix as a left-handed orthographic projection matrix\n */\n static OrthoLH(width, height, znear, zfar, halfZRange) {\n const matrix = new Matrix();\n Matrix.OrthoLHToRef(width, height, znear, zfar, matrix, halfZRange);\n return matrix;\n }\n /**\n * Store a left-handed orthographic projection to a given matrix\n * Example Playground - https://playground.babylonjs.com/#AV9X17#71\n * @param width defines the viewport width\n * @param height defines the viewport height\n * @param znear defines the near clip plane\n * @param zfar defines the far clip plane\n * @param result defines the target matrix\n * @param halfZRange true to generate NDC coordinates between 0 and 1 instead of -1 and 1 (default: false)\n * @returns result input\n */\n static OrthoLHToRef(width, height, znear, zfar, result, halfZRange) {\n const n = znear;\n const f = zfar;\n const a = 2.0 / width;\n const b = 2.0 / height;\n const c = 2.0 / (f - n);\n const d = -(f + n) / (f - n);\n Matrix.FromValuesToRef(a, 0.0, 0.0, 0.0, 0.0, b, 0.0, 0.0, 0.0, 0.0, c, 0.0, 0.0, 0.0, d, 1.0, result);\n if (halfZRange) {\n result.multiplyToRef(mtxConvertNDCToHalfZRange, result);\n }\n result._updateIdentityStatus(a === 1 && b === 1 && c === 1 && d === 0);\n return result;\n }\n /**\n * Create a left-handed orthographic projection matrix\n * Example Playground - https://playground.babylonjs.com/#AV9X17#72\n * @param left defines the viewport left coordinate\n * @param right defines the viewport right coordinate\n * @param bottom defines the viewport bottom coordinate\n * @param top defines the viewport top coordinate\n * @param znear defines the near clip plane\n * @param zfar defines the far clip plane\n * @param halfZRange true to generate NDC coordinates between 0 and 1 instead of -1 and 1 (default: false)\n * @returns a new matrix as a left-handed orthographic projection matrix\n */\n static OrthoOffCenterLH(left, right, bottom, top, znear, zfar, halfZRange) {\n const matrix = new Matrix();\n Matrix.OrthoOffCenterLHToRef(left, right, bottom, top, znear, zfar, matrix, halfZRange);\n return matrix;\n }\n /**\n * Stores a left-handed orthographic projection into a given matrix\n * Example Playground - https://playground.babylonjs.com/#AV9X17#73\n * @param left defines the viewport left coordinate\n * @param right defines the viewport right coordinate\n * @param bottom defines the viewport bottom coordinate\n * @param top defines the viewport top coordinate\n * @param znear defines the near clip plane\n * @param zfar defines the far clip plane\n * @param result defines the target matrix\n * @param halfZRange true to generate NDC coordinates between 0 and 1 instead of -1 and 1 (default: false)\n * @returns result input\n */\n static OrthoOffCenterLHToRef(left, right, bottom, top, znear, zfar, result, halfZRange) {\n const n = znear;\n const f = zfar;\n const a = 2.0 / (right - left);\n const b = 2.0 / (top - bottom);\n const c = 2.0 / (f - n);\n const d = -(f + n) / (f - n);\n const i0 = (left + right) / (left - right);\n const i1 = (top + bottom) / (bottom - top);\n Matrix.FromValuesToRef(a, 0.0, 0.0, 0.0, 0.0, b, 0.0, 0.0, 0.0, 0.0, c, 0.0, i0, i1, d, 1.0, result);\n if (halfZRange) {\n result.multiplyToRef(mtxConvertNDCToHalfZRange, result);\n }\n result.markAsUpdated();\n return result;\n }\n /**\n * Creates a right-handed orthographic projection matrix\n * Example Playground - https://playground.babylonjs.com/#AV9X17#76\n * @param left defines the viewport left coordinate\n * @param right defines the viewport right coordinate\n * @param bottom defines the viewport bottom coordinate\n * @param top defines the viewport top coordinate\n * @param znear defines the near clip plane\n * @param zfar defines the far clip plane\n * @param halfZRange true to generate NDC coordinates between 0 and 1 instead of -1 and 1 (default: false)\n * @returns a new matrix as a right-handed orthographic projection matrix\n */\n static OrthoOffCenterRH(left, right, bottom, top, znear, zfar, halfZRange) {\n const matrix = new Matrix();\n Matrix.OrthoOffCenterRHToRef(left, right, bottom, top, znear, zfar, matrix, halfZRange);\n return matrix;\n }\n /**\n * Stores a right-handed orthographic projection into a given matrix\n * Example Playground - https://playground.babylonjs.com/#AV9X17#77\n * @param left defines the viewport left coordinate\n * @param right defines the viewport right coordinate\n * @param bottom defines the viewport bottom coordinate\n * @param top defines the viewport top coordinate\n * @param znear defines the near clip plane\n * @param zfar defines the far clip plane\n * @param result defines the target matrix\n * @param halfZRange true to generate NDC coordinates between 0 and 1 instead of -1 and 1 (default: false)\n * @returns result input\n */\n static OrthoOffCenterRHToRef(left, right, bottom, top, znear, zfar, result, halfZRange) {\n Matrix.OrthoOffCenterLHToRef(left, right, bottom, top, znear, zfar, result, halfZRange);\n result._m[10] *= -1; // No need to call markAsUpdated as previous function already called it and let _isIdentityDirty to true\n return result;\n }\n /**\n * Creates a left-handed perspective projection matrix\n * Example Playground - https://playground.babylonjs.com/#AV9X17#85\n * @param width defines the viewport width\n * @param height defines the viewport height\n * @param znear defines the near clip plane\n * @param zfar defines the far clip plane\n * @param halfZRange true to generate NDC coordinates between 0 and 1 instead of -1 and 1 (default: false)\n * @param projectionPlaneTilt optional tilt angle of the projection plane around the X axis (horizontal)\n * @returns a new matrix as a left-handed perspective projection matrix\n */\n static PerspectiveLH(width, height, znear, zfar, halfZRange, projectionPlaneTilt = 0) {\n const matrix = new Matrix();\n const n = znear;\n const f = zfar;\n const a = (2.0 * n) / width;\n const b = (2.0 * n) / height;\n const c = (f + n) / (f - n);\n const d = (-2.0 * f * n) / (f - n);\n const rot = Math.tan(projectionPlaneTilt);\n Matrix.FromValuesToRef(a, 0.0, 0.0, 0.0, 0.0, b, 0.0, rot, 0.0, 0.0, c, 1.0, 0.0, 0.0, d, 0.0, matrix);\n if (halfZRange) {\n matrix.multiplyToRef(mtxConvertNDCToHalfZRange, matrix);\n }\n matrix._updateIdentityStatus(false);\n return matrix;\n }\n /**\n * Creates a left-handed perspective projection matrix\n * Example Playground - https://playground.babylonjs.com/#AV9X17#78\n * @param fov defines the horizontal field of view\n * @param aspect defines the aspect ratio\n * @param znear defines the near clip plane\n * @param zfar defines the far clip plane. If 0, assume we are in \"infinite zfar\" mode\n * @param halfZRange true to generate NDC coordinates between 0 and 1 instead of -1 and 1 (default: false)\n * @param projectionPlaneTilt optional tilt angle of the projection plane around the X axis (horizontal)\n * @param reverseDepthBufferMode true to indicate that we are in a reverse depth buffer mode (meaning znear and zfar have been inverted when calling the function)\n * @returns a new matrix as a left-handed perspective projection matrix\n */\n static PerspectiveFovLH(fov, aspect, znear, zfar, halfZRange, projectionPlaneTilt = 0, reverseDepthBufferMode = false) {\n const matrix = new Matrix();\n Matrix.PerspectiveFovLHToRef(fov, aspect, znear, zfar, matrix, true, halfZRange, projectionPlaneTilt, reverseDepthBufferMode);\n return matrix;\n }\n /**\n * Stores a left-handed perspective projection into a given matrix\n * Example Playground - https://playground.babylonjs.com/#AV9X17#81\n * @param fov defines the horizontal field of view\n * @param aspect defines the aspect ratio\n * @param znear defines the near clip plane\n * @param zfar defines the far clip plane. If 0, assume we are in \"infinite zfar\" mode\n * @param result defines the target matrix\n * @param isVerticalFovFixed defines it the fov is vertically fixed (default) or horizontally\n * @param halfZRange true to generate NDC coordinates between 0 and 1 instead of -1 and 1 (default: false)\n * @param projectionPlaneTilt optional tilt angle of the projection plane around the X axis (horizontal)\n * @param reverseDepthBufferMode true to indicate that we are in a reverse depth buffer mode (meaning znear and zfar have been inverted when calling the function)\n * @returns result input\n */\n static PerspectiveFovLHToRef(fov, aspect, znear, zfar, result, isVerticalFovFixed = true, halfZRange, projectionPlaneTilt = 0, reverseDepthBufferMode = false) {\n const n = znear;\n const f = zfar;\n const t = 1.0 / Math.tan(fov * 0.5);\n const a = isVerticalFovFixed ? t / aspect : t;\n const b = isVerticalFovFixed ? t : t * aspect;\n const c = reverseDepthBufferMode && n === 0 ? -1 : f !== 0 ? (f + n) / (f - n) : 1;\n const d = reverseDepthBufferMode && n === 0 ? 2 * f : f !== 0 ? (-2.0 * f * n) / (f - n) : -2 * n;\n const rot = Math.tan(projectionPlaneTilt);\n Matrix.FromValuesToRef(a, 0.0, 0.0, 0.0, 0.0, b, 0.0, rot, 0.0, 0.0, c, 1.0, 0.0, 0.0, d, 0.0, result);\n if (halfZRange) {\n result.multiplyToRef(mtxConvertNDCToHalfZRange, result);\n }\n result._updateIdentityStatus(false);\n return result;\n }\n /**\n * Stores a left-handed perspective projection into a given matrix with depth reversed\n * Example Playground - https://playground.babylonjs.com/#AV9X17#89\n * @param fov defines the horizontal field of view\n * @param aspect defines the aspect ratio\n * @param znear defines the near clip plane\n * @param zfar not used as infinity is used as far clip\n * @param result defines the target matrix\n * @param isVerticalFovFixed defines it the fov is vertically fixed (default) or horizontally\n * @param halfZRange true to generate NDC coordinates between 0 and 1 instead of -1 and 1 (default: false)\n * @param projectionPlaneTilt optional tilt angle of the projection plane around the X axis (horizontal)\n * @returns result input\n */\n static PerspectiveFovReverseLHToRef(fov, aspect, znear, zfar, result, isVerticalFovFixed = true, halfZRange, projectionPlaneTilt = 0) {\n const t = 1.0 / Math.tan(fov * 0.5);\n const a = isVerticalFovFixed ? t / aspect : t;\n const b = isVerticalFovFixed ? t : t * aspect;\n const rot = Math.tan(projectionPlaneTilt);\n Matrix.FromValuesToRef(a, 0.0, 0.0, 0.0, 0.0, b, 0.0, rot, 0.0, 0.0, -znear, 1.0, 0.0, 0.0, 1.0, 0.0, result);\n if (halfZRange) {\n result.multiplyToRef(mtxConvertNDCToHalfZRange, result);\n }\n result._updateIdentityStatus(false);\n return result;\n }\n /**\n * Creates a right-handed perspective projection matrix\n * Example Playground - https://playground.babylonjs.com/#AV9X17#83\n * @param fov defines the horizontal field of view\n * @param aspect defines the aspect ratio\n * @param znear defines the near clip plane\n * @param zfar defines the far clip plane. If 0, assume we are in \"infinite zfar\" mode\n * @param halfZRange true to generate NDC coordinates between 0 and 1 instead of -1 and 1 (default: false)\n * @param projectionPlaneTilt optional tilt angle of the projection plane around the X axis (horizontal)\n * @param reverseDepthBufferMode true to indicate that we are in a reverse depth buffer mode (meaning znear and zfar have been inverted when calling the function)\n * @returns a new matrix as a right-handed perspective projection matrix\n */\n static PerspectiveFovRH(fov, aspect, znear, zfar, halfZRange, projectionPlaneTilt = 0, reverseDepthBufferMode = false) {\n const matrix = new Matrix();\n Matrix.PerspectiveFovRHToRef(fov, aspect, znear, zfar, matrix, true, halfZRange, projectionPlaneTilt, reverseDepthBufferMode);\n return matrix;\n }\n /**\n * Stores a right-handed perspective projection into a given matrix\n * Example Playground - https://playground.babylonjs.com/#AV9X17#84\n * @param fov defines the horizontal field of view\n * @param aspect defines the aspect ratio\n * @param znear defines the near clip plane\n * @param zfar defines the far clip plane. If 0, assume we are in \"infinite zfar\" mode\n * @param result defines the target matrix\n * @param isVerticalFovFixed defines it the fov is vertically fixed (default) or horizontally\n * @param halfZRange true to generate NDC coordinates between 0 and 1 instead of -1 and 1 (default: false)\n * @param projectionPlaneTilt optional tilt angle of the projection plane around the X axis (horizontal)\n * @param reverseDepthBufferMode true to indicate that we are in a reverse depth buffer mode (meaning znear and zfar have been inverted when calling the function)\n * @returns result input\n */\n static PerspectiveFovRHToRef(fov, aspect, znear, zfar, result, isVerticalFovFixed = true, halfZRange, projectionPlaneTilt = 0, reverseDepthBufferMode = false) {\n //alternatively this could be expressed as:\n // m = PerspectiveFovLHToRef\n // m[10] *= -1.0;\n // m[11] *= -1.0;\n const n = znear;\n const f = zfar;\n const t = 1.0 / Math.tan(fov * 0.5);\n const a = isVerticalFovFixed ? t / aspect : t;\n const b = isVerticalFovFixed ? t : t * aspect;\n const c = reverseDepthBufferMode && n === 0 ? 1 : f !== 0 ? -(f + n) / (f - n) : -1;\n const d = reverseDepthBufferMode && n === 0 ? 2 * f : f !== 0 ? (-2 * f * n) / (f - n) : -2 * n;\n const rot = Math.tan(projectionPlaneTilt);\n Matrix.FromValuesToRef(a, 0.0, 0.0, 0.0, 0.0, b, 0.0, rot, 0.0, 0.0, c, -1.0, 0.0, 0.0, d, 0.0, result);\n if (halfZRange) {\n result.multiplyToRef(mtxConvertNDCToHalfZRange, result);\n }\n result._updateIdentityStatus(false);\n return result;\n }\n /**\n * Stores a right-handed perspective projection into a given matrix\n * Example Playground - https://playground.babylonjs.com/#AV9X17#90\n * @param fov defines the horizontal field of view\n * @param aspect defines the aspect ratio\n * @param znear defines the near clip plane\n * @param zfar not used as infinity is used as far clip\n * @param result defines the target matrix\n * @param isVerticalFovFixed defines it the fov is vertically fixed (default) or horizontally\n * @param halfZRange true to generate NDC coordinates between 0 and 1 instead of -1 and 1 (default: false)\n * @param projectionPlaneTilt optional tilt angle of the projection plane around the X axis (horizontal)\n * @returns result input\n */\n static PerspectiveFovReverseRHToRef(fov, aspect, znear, zfar, result, isVerticalFovFixed = true, halfZRange, projectionPlaneTilt = 0) {\n const t = 1.0 / Math.tan(fov * 0.5);\n const a = isVerticalFovFixed ? t / aspect : t;\n const b = isVerticalFovFixed ? t : t * aspect;\n const rot = Math.tan(projectionPlaneTilt);\n Matrix.FromValuesToRef(a, 0.0, 0.0, 0.0, 0.0, b, 0.0, rot, 0.0, 0.0, -znear, -1.0, 0.0, 0.0, -1.0, 0.0, result);\n if (halfZRange) {\n result.multiplyToRef(mtxConvertNDCToHalfZRange, result);\n }\n result._updateIdentityStatus(false);\n return result;\n }\n /**\n * Stores a perspective projection for WebVR info a given matrix\n * Example Playground - https://playground.babylonjs.com/#AV9X17#92\n * @param fov defines the field of view\n * @param fov.upDegrees\n * @param fov.downDegrees\n * @param fov.leftDegrees\n * @param fov.rightDegrees\n * @param znear defines the near clip plane\n * @param zfar defines the far clip plane\n * @param result defines the target matrix\n * @param rightHanded defines if the matrix must be in right-handed mode (false by default)\n * @param halfZRange true to generate NDC coordinates between 0 and 1 instead of -1 and 1 (default: false)\n * @param projectionPlaneTilt optional tilt angle of the projection plane around the X axis (horizontal)\n * @returns result input\n */\n static PerspectiveFovWebVRToRef(fov, znear, zfar, result, rightHanded = false, halfZRange, projectionPlaneTilt = 0) {\n const rightHandedFactor = rightHanded ? -1 : 1;\n const upTan = Math.tan((fov.upDegrees * Math.PI) / 180.0);\n const downTan = Math.tan((fov.downDegrees * Math.PI) / 180.0);\n const leftTan = Math.tan((fov.leftDegrees * Math.PI) / 180.0);\n const rightTan = Math.tan((fov.rightDegrees * Math.PI) / 180.0);\n const xScale = 2.0 / (leftTan + rightTan);\n const yScale = 2.0 / (upTan + downTan);\n const rot = Math.tan(projectionPlaneTilt);\n const m = result._m;\n m[0] = xScale;\n m[1] = m[2] = m[3] = m[4] = 0.0;\n m[5] = yScale;\n m[6] = 0.0;\n m[7] = rot;\n m[8] = (leftTan - rightTan) * xScale * 0.5;\n m[9] = -((upTan - downTan) * yScale * 0.5);\n m[10] = -zfar / (znear - zfar);\n m[11] = 1.0 * rightHandedFactor;\n m[12] = m[13] = m[15] = 0.0;\n m[14] = -(2.0 * zfar * znear) / (zfar - znear);\n if (halfZRange) {\n result.multiplyToRef(mtxConvertNDCToHalfZRange, result);\n }\n result.markAsUpdated();\n return result;\n }\n /**\n * Computes a complete transformation matrix\n * Example Playground - https://playground.babylonjs.com/#AV9X17#113\n * @param viewport defines the viewport to use\n * @param world defines the world matrix\n * @param view defines the view matrix\n * @param projection defines the projection matrix\n * @param zmin defines the near clip plane\n * @param zmax defines the far clip plane\n * @returns the transformation matrix\n */\n static GetFinalMatrix(viewport, world, view, projection, zmin, zmax) {\n const cw = viewport.width;\n const ch = viewport.height;\n const cx = viewport.x;\n const cy = viewport.y;\n const viewportMatrix = Matrix.FromValues(cw / 2.0, 0.0, 0.0, 0.0, 0.0, -ch / 2.0, 0.0, 0.0, 0.0, 0.0, zmax - zmin, 0.0, cx + cw / 2.0, ch / 2.0 + cy, zmin, 1.0);\n const matrix = new world.constructor();\n world.multiplyToRef(view, matrix);\n matrix.multiplyToRef(projection, matrix);\n return matrix.multiplyToRef(viewportMatrix, matrix);\n }\n /**\n * Extracts a 2x2 matrix from a given matrix and store the result in a Float32Array\n * @param matrix defines the matrix to use\n * @returns a new Float32Array array with 4 elements : the 2x2 matrix extracted from the given matrix\n */\n static GetAsMatrix2x2(matrix) {\n const m = matrix.m;\n const arr = [m[0], m[1], m[4], m[5]];\n return PerformanceConfigurator.MatrixUse64Bits ? arr : new Float32Array(arr);\n }\n /**\n * Extracts a 3x3 matrix from a given matrix and store the result in a Float32Array\n * @param matrix defines the matrix to use\n * @returns a new Float32Array array with 9 elements : the 3x3 matrix extracted from the given matrix\n */\n static GetAsMatrix3x3(matrix) {\n const m = matrix.m;\n const arr = [m[0], m[1], m[2], m[4], m[5], m[6], m[8], m[9], m[10]];\n return PerformanceConfigurator.MatrixUse64Bits ? arr : new Float32Array(arr);\n }\n /**\n * Compute the transpose of a given matrix\n * Example Playground - https://playground.babylonjs.com/#AV9X17#111\n * @param matrix defines the matrix to transpose\n * @returns the new matrix\n */\n static Transpose(matrix) {\n const result = new matrix.constructor();\n Matrix.TransposeToRef(matrix, result);\n return result;\n }\n /**\n * Compute the transpose of a matrix and store it in a target matrix\n * Example Playground - https://playground.babylonjs.com/#AV9X17#112\n * @param matrix defines the matrix to transpose\n * @param result defines the target matrix\n * @returns result input\n */\n static TransposeToRef(matrix, result) {\n const rm = result._m;\n const mm = matrix.m;\n rm[0] = mm[0];\n rm[1] = mm[4];\n rm[2] = mm[8];\n rm[3] = mm[12];\n rm[4] = mm[1];\n rm[5] = mm[5];\n rm[6] = mm[9];\n rm[7] = mm[13];\n rm[8] = mm[2];\n rm[9] = mm[6];\n rm[10] = mm[10];\n rm[11] = mm[14];\n rm[12] = mm[3];\n rm[13] = mm[7];\n rm[14] = mm[11];\n rm[15] = mm[15];\n result.markAsUpdated();\n // identity-ness does not change when transposing\n result._updateIdentityStatus(matrix._isIdentity, matrix._isIdentityDirty);\n return result;\n }\n /**\n * Computes a reflection matrix from a plane\n * Example Playground - https://playground.babylonjs.com/#AV9X17#87\n * @param plane defines the reflection plane\n * @returns a new matrix\n */\n static Reflection(plane) {\n const matrix = new Matrix();\n Matrix.ReflectionToRef(plane, matrix);\n return matrix;\n }\n /**\n * Computes a reflection matrix from a plane\n * Example Playground - https://playground.babylonjs.com/#AV9X17#88\n * @param plane defines the reflection plane\n * @param result defines the target matrix\n * @returns result input\n */\n static ReflectionToRef(plane, result) {\n plane.normalize();\n const x = plane.normal.x;\n const y = plane.normal.y;\n const z = plane.normal.z;\n const temp = -2 * x;\n const temp2 = -2 * y;\n const temp3 = -2 * z;\n Matrix.FromValuesToRef(temp * x + 1, temp2 * x, temp3 * x, 0.0, temp * y, temp2 * y + 1, temp3 * y, 0.0, temp * z, temp2 * z, temp3 * z + 1, 0.0, temp * plane.d, temp2 * plane.d, temp3 * plane.d, 1.0, result);\n return result;\n }\n /**\n * Sets the given matrix as a rotation matrix composed from the 3 left handed axes\n * @param xaxis defines the value of the 1st axis\n * @param yaxis defines the value of the 2nd axis\n * @param zaxis defines the value of the 3rd axis\n * @param result defines the target matrix\n * @returns result input\n */\n static FromXYZAxesToRef(xaxis, yaxis, zaxis, result) {\n Matrix.FromValuesToRef(xaxis._x, xaxis._y, xaxis._z, 0.0, yaxis._x, yaxis._y, yaxis._z, 0.0, zaxis._x, zaxis._y, zaxis._z, 0.0, 0.0, 0.0, 0.0, 1.0, result);\n return result;\n }\n /**\n * Creates a rotation matrix from a quaternion and stores it in a target matrix\n * @param quat defines the quaternion to use\n * @param result defines the target matrix\n * @returns result input\n */\n static FromQuaternionToRef(quat, result) {\n const xx = quat._x * quat._x;\n const yy = quat._y * quat._y;\n const zz = quat._z * quat._z;\n const xy = quat._x * quat._y;\n const zw = quat._z * quat._w;\n const zx = quat._z * quat._x;\n const yw = quat._y * quat._w;\n const yz = quat._y * quat._z;\n const xw = quat._x * quat._w;\n result._m[0] = 1.0 - 2.0 * (yy + zz);\n result._m[1] = 2.0 * (xy + zw);\n result._m[2] = 2.0 * (zx - yw);\n result._m[3] = 0.0;\n result._m[4] = 2.0 * (xy - zw);\n result._m[5] = 1.0 - 2.0 * (zz + xx);\n result._m[6] = 2.0 * (yz + xw);\n result._m[7] = 0.0;\n result._m[8] = 2.0 * (zx + yw);\n result._m[9] = 2.0 * (yz - xw);\n result._m[10] = 1.0 - 2.0 * (yy + xx);\n result._m[11] = 0.0;\n result._m[12] = 0.0;\n result._m[13] = 0.0;\n result._m[14] = 0.0;\n result._m[15] = 1.0;\n result.markAsUpdated();\n return result;\n }\n}\nMatrix._UpdateFlagSeed = 0;\nMatrix._IdentityReadOnly = Matrix.Identity();\n/**\n * @internal\n * Same as Tmp but not exported to keep it only for math functions to avoid conflicts\n */\nclass MathTmp {\n}\nMathTmp.Vector3 = ArrayTools.BuildTuple(11, Vector3.Zero);\nMathTmp.Matrix = ArrayTools.BuildTuple(2, Matrix.Identity);\nMathTmp.Quaternion = ArrayTools.BuildTuple(3, Quaternion.Zero);\n/**\n * @internal\n */\nexport class TmpVectors {\n}\nTmpVectors.Vector2 = ArrayTools.BuildTuple(3, Vector2.Zero); // 3 temp Vector2 at once should be enough\nTmpVectors.Vector3 = ArrayTools.BuildTuple(13, Vector3.Zero); // 13 temp Vector3 at once should be enough\nTmpVectors.Vector4 = ArrayTools.BuildTuple(3, Vector4.Zero); // 3 temp Vector4 at once should be enough\nTmpVectors.Quaternion = ArrayTools.BuildTuple(2, Quaternion.Zero); // 2 temp Quaternion at once should be enough\nTmpVectors.Matrix = ArrayTools.BuildTuple(8, Matrix.Identity); // 8 temp Matrices at once should be enough\nRegisterClass(\"BABYLON.Vector2\", Vector2);\nRegisterClass(\"BABYLON.Vector3\", Vector3);\nRegisterClass(\"BABYLON.Vector4\", Vector4);\nRegisterClass(\"BABYLON.Matrix\", Matrix);\nconst mtxConvertNDCToHalfZRange = Matrix.FromValues(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 1);\n//# sourceMappingURL=math.vector.js.map","import { Scalar } from \"./math.scalar.js\";\nimport { ToLinearSpace, ToGammaSpace } from \"./math.constants.js\";\nimport { ArrayTools } from \"../Misc/arrayTools.js\";\nimport { RegisterClass } from \"../Misc/typeStore.js\";\nfunction colorChannelToLinearSpace(color) {\n return Math.pow(color, ToLinearSpace);\n}\nfunction colorChannelToLinearSpaceExact(color) {\n if (color <= 0.04045) {\n return 0.0773993808 * color;\n }\n return Math.pow(0.947867299 * (color + 0.055), 2.4);\n}\nfunction colorChannelToGammaSpace(color) {\n return Math.pow(color, ToGammaSpace);\n}\nfunction colorChannelToGammaSpaceExact(color) {\n if (color <= 0.0031308) {\n return 12.92 * color;\n }\n return 1.055 * Math.pow(color, 0.41666) - 0.055;\n}\n/**\n * Class used to hold a RGB color\n */\nexport class Color3 {\n /**\n * Creates a new Color3 object from red, green, blue values, all between 0 and 1\n * @param r defines the red component (between 0 and 1, default is 0)\n * @param g defines the green component (between 0 and 1, default is 0)\n * @param b defines the blue component (between 0 and 1, default is 0)\n */\n constructor(\n /**\n * Defines the red component (between 0 and 1, default is 0)\n */\n r = 0, \n /**\n * Defines the green component (between 0 and 1, default is 0)\n */\n g = 0, \n /**\n * Defines the blue component (between 0 and 1, default is 0)\n */\n b = 0) {\n this.r = r;\n this.g = g;\n this.b = b;\n }\n /**\n * Creates a string with the Color3 current values\n * @returns the string representation of the Color3 object\n */\n toString() {\n return \"{R: \" + this.r + \" G:\" + this.g + \" B:\" + this.b + \"}\";\n }\n /**\n * Returns the string \"Color3\"\n * @returns \"Color3\"\n */\n getClassName() {\n return \"Color3\";\n }\n /**\n * Compute the Color3 hash code\n * @returns an unique number that can be used to hash Color3 objects\n */\n getHashCode() {\n let hash = (this.r * 255) | 0;\n hash = (hash * 397) ^ ((this.g * 255) | 0);\n hash = (hash * 397) ^ ((this.b * 255) | 0);\n return hash;\n }\n // Operators\n /**\n * Stores in the given array from the given starting index the red, green, blue values as successive elements\n * @param array defines the array where to store the r,g,b components\n * @param index defines an optional index in the target array to define where to start storing values\n * @returns the current Color3 object\n */\n toArray(array, index = 0) {\n array[index] = this.r;\n array[index + 1] = this.g;\n array[index + 2] = this.b;\n return this;\n }\n /**\n * Update the current color with values stored in an array from the starting index of the given array\n * @param array defines the source array\n * @param offset defines an offset in the source array\n * @returns the current Color3 object\n */\n fromArray(array, offset = 0) {\n Color3.FromArrayToRef(array, offset, this);\n return this;\n }\n /**\n * Returns a new Color4 object from the current Color3 and the given alpha\n * @param alpha defines the alpha component on the new Color4 object (default is 1)\n * @returns a new Color4 object\n */\n toColor4(alpha = 1) {\n return new Color4(this.r, this.g, this.b, alpha);\n }\n /**\n * Returns a new array populated with 3 numeric elements : red, green and blue values\n * @returns the new array\n */\n asArray() {\n return [this.r, this.g, this.b];\n }\n /**\n * Returns the luminance value\n * @returns a float value\n */\n toLuminance() {\n return this.r * 0.3 + this.g * 0.59 + this.b * 0.11;\n }\n /**\n * Multiply each Color3 rgb values by the given Color3 rgb values in a new Color3 object\n * @param otherColor defines the second operand\n * @returns the new Color3 object\n */\n multiply(otherColor) {\n return new Color3(this.r * otherColor.r, this.g * otherColor.g, this.b * otherColor.b);\n }\n /**\n * Multiply the rgb values of the Color3 and the given Color3 and stores the result in the object \"result\"\n * @param otherColor defines the second operand\n * @param result defines the Color3 object where to store the result\n * @returns the current Color3\n */\n multiplyToRef(otherColor, result) {\n result.r = this.r * otherColor.r;\n result.g = this.g * otherColor.g;\n result.b = this.b * otherColor.b;\n return this;\n }\n /**\n * Determines equality between Color3 objects\n * @param otherColor defines the second operand\n * @returns true if the rgb values are equal to the given ones\n */\n equals(otherColor) {\n return otherColor && this.r === otherColor.r && this.g === otherColor.g && this.b === otherColor.b;\n }\n /**\n * Determines equality between the current Color3 object and a set of r,b,g values\n * @param r defines the red component to check\n * @param g defines the green component to check\n * @param b defines the blue component to check\n * @returns true if the rgb values are equal to the given ones\n */\n equalsFloats(r, g, b) {\n return this.r === r && this.g === g && this.b === b;\n }\n /**\n * Creates a new Color3 with the current Color3 values multiplied by scale\n * @param scale defines the scaling factor to apply\n * @returns a new Color3 object\n */\n scale(scale) {\n return new Color3(this.r * scale, this.g * scale, this.b * scale);\n }\n /**\n * Multiplies the Color3 values by the float \"scale\"\n * @param scale defines the scaling factor to apply\n * @returns the current updated Color3\n */\n scaleInPlace(scale) {\n this.r *= scale;\n this.g *= scale;\n this.b *= scale;\n return this;\n }\n /**\n * Multiplies the rgb values by scale and stores the result into \"result\"\n * @param scale defines the scaling factor\n * @param result defines the Color3 object where to store the result\n * @returns the unmodified current Color3\n */\n scaleToRef(scale, result) {\n result.r = this.r * scale;\n result.g = this.g * scale;\n result.b = this.b * scale;\n return this;\n }\n /**\n * Scale the current Color3 values by a factor and add the result to a given Color3\n * @param scale defines the scale factor\n * @param result defines color to store the result into\n * @returns the unmodified current Color3\n */\n scaleAndAddToRef(scale, result) {\n result.r += this.r * scale;\n result.g += this.g * scale;\n result.b += this.b * scale;\n return this;\n }\n /**\n * Clamps the rgb values by the min and max values and stores the result into \"result\"\n * @param min defines minimum clamping value (default is 0)\n * @param max defines maximum clamping value (default is 1)\n * @param result defines color to store the result into\n * @returns the original Color3\n */\n clampToRef(min = 0, max = 1, result) {\n result.r = Scalar.Clamp(this.r, min, max);\n result.g = Scalar.Clamp(this.g, min, max);\n result.b = Scalar.Clamp(this.b, min, max);\n return this;\n }\n /**\n * Creates a new Color3 set with the added values of the current Color3 and of the given one\n * @param otherColor defines the second operand\n * @returns the new Color3\n */\n add(otherColor) {\n return new Color3(this.r + otherColor.r, this.g + otherColor.g, this.b + otherColor.b);\n }\n /**\n * Stores the result of the addition of the current Color3 and given one rgb values into \"result\"\n * @param otherColor defines the second operand\n * @param result defines Color3 object to store the result into\n * @returns the unmodified current Color3\n */\n addToRef(otherColor, result) {\n result.r = this.r + otherColor.r;\n result.g = this.g + otherColor.g;\n result.b = this.b + otherColor.b;\n return this;\n }\n /**\n * Returns a new Color3 set with the subtracted values of the given one from the current Color3\n * @param otherColor defines the second operand\n * @returns the new Color3\n */\n subtract(otherColor) {\n return new Color3(this.r - otherColor.r, this.g - otherColor.g, this.b - otherColor.b);\n }\n /**\n * Stores the result of the subtraction of given one from the current Color3 rgb values into \"result\"\n * @param otherColor defines the second operand\n * @param result defines Color3 object to store the result into\n * @returns the unmodified current Color3\n */\n subtractToRef(otherColor, result) {\n result.r = this.r - otherColor.r;\n result.g = this.g - otherColor.g;\n result.b = this.b - otherColor.b;\n return this;\n }\n /**\n * Copy the current object\n * @returns a new Color3 copied the current one\n */\n clone() {\n return new Color3(this.r, this.g, this.b);\n }\n /**\n * Copies the rgb values from the source in the current Color3\n * @param source defines the source Color3 object\n * @returns the updated Color3 object\n */\n copyFrom(source) {\n this.r = source.r;\n this.g = source.g;\n this.b = source.b;\n return this;\n }\n /**\n * Updates the Color3 rgb values from the given floats\n * @param r defines the red component to read from\n * @param g defines the green component to read from\n * @param b defines the blue component to read from\n * @returns the current Color3 object\n */\n copyFromFloats(r, g, b) {\n this.r = r;\n this.g = g;\n this.b = b;\n return this;\n }\n /**\n * Updates the Color3 rgb values from the given floats\n * @param r defines the red component to read from\n * @param g defines the green component to read from\n * @param b defines the blue component to read from\n * @returns the current Color3 object\n */\n set(r, g, b) {\n return this.copyFromFloats(r, g, b);\n }\n /**\n * Compute the Color3 hexadecimal code as a string\n * @returns a string containing the hexadecimal representation of the Color3 object\n */\n toHexString() {\n const intR = Math.round(this.r * 255);\n const intG = Math.round(this.g * 255);\n const intB = Math.round(this.b * 255);\n return \"#\" + Scalar.ToHex(intR) + Scalar.ToHex(intG) + Scalar.ToHex(intB);\n }\n /**\n * Converts current color in rgb space to HSV values\n * @returns a new color3 representing the HSV values\n */\n toHSV() {\n const result = new Color3();\n this.toHSVToRef(result);\n return result;\n }\n /**\n * Converts current color in rgb space to HSV values\n * @param result defines the Color3 where to store the HSV values\n */\n toHSVToRef(result) {\n const r = this.r;\n const g = this.g;\n const b = this.b;\n const max = Math.max(r, g, b);\n const min = Math.min(r, g, b);\n let h = 0;\n let s = 0;\n const v = max;\n const dm = max - min;\n if (max !== 0) {\n s = dm / max;\n }\n if (max != min) {\n if (max == r) {\n h = (g - b) / dm;\n if (g < b) {\n h += 6;\n }\n }\n else if (max == g) {\n h = (b - r) / dm + 2;\n }\n else if (max == b) {\n h = (r - g) / dm + 4;\n }\n h *= 60;\n }\n result.r = h;\n result.g = s;\n result.b = v;\n }\n /**\n * Computes a new Color3 converted from the current one to linear space\n * @param exact defines if the conversion will be done in an exact way which is slower but more accurate (default is false)\n * @returns a new Color3 object\n */\n toLinearSpace(exact = false) {\n const convertedColor = new Color3();\n this.toLinearSpaceToRef(convertedColor, exact);\n return convertedColor;\n }\n /**\n * Converts the Color3 values to linear space and stores the result in \"convertedColor\"\n * @param convertedColor defines the Color3 object where to store the linear space version\n * @param exact defines if the conversion will be done in an exact way which is slower but more accurate (default is false)\n * @returns the unmodified Color3\n */\n toLinearSpaceToRef(convertedColor, exact = false) {\n if (exact) {\n convertedColor.r = colorChannelToLinearSpaceExact(this.r);\n convertedColor.g = colorChannelToLinearSpaceExact(this.g);\n convertedColor.b = colorChannelToLinearSpaceExact(this.b);\n }\n else {\n convertedColor.r = colorChannelToLinearSpace(this.r);\n convertedColor.g = colorChannelToLinearSpace(this.g);\n convertedColor.b = colorChannelToLinearSpace(this.b);\n }\n return this;\n }\n /**\n * Computes a new Color3 converted from the current one to gamma space\n * @param exact defines if the conversion will be done in an exact way which is slower but more accurate (default is false)\n * @returns a new Color3 object\n */\n toGammaSpace(exact = false) {\n const convertedColor = new Color3();\n this.toGammaSpaceToRef(convertedColor, exact);\n return convertedColor;\n }\n /**\n * Converts the Color3 values to gamma space and stores the result in \"convertedColor\"\n * @param convertedColor defines the Color3 object where to store the gamma space version\n * @param exact defines if the conversion will be done in an exact way which is slower but more accurate (default is false)\n * @returns the unmodified Color3\n */\n toGammaSpaceToRef(convertedColor, exact = false) {\n if (exact) {\n convertedColor.r = colorChannelToGammaSpaceExact(this.r);\n convertedColor.g = colorChannelToGammaSpaceExact(this.g);\n convertedColor.b = colorChannelToGammaSpaceExact(this.b);\n }\n else {\n convertedColor.r = colorChannelToGammaSpace(this.r);\n convertedColor.g = colorChannelToGammaSpace(this.g);\n convertedColor.b = colorChannelToGammaSpace(this.b);\n }\n return this;\n }\n /**\n * Converts Hue, saturation and value to a Color3 (RGB)\n * @param hue defines the hue (value between 0 and 360)\n * @param saturation defines the saturation (value between 0 and 1)\n * @param value defines the value (value between 0 and 1)\n * @param result defines the Color3 where to store the RGB values\n */\n static HSVtoRGBToRef(hue, saturation, value, result) {\n const chroma = value * saturation;\n const h = hue / 60;\n const x = chroma * (1 - Math.abs((h % 2) - 1));\n let r = 0;\n let g = 0;\n let b = 0;\n if (h >= 0 && h <= 1) {\n r = chroma;\n g = x;\n }\n else if (h >= 1 && h <= 2) {\n r = x;\n g = chroma;\n }\n else if (h >= 2 && h <= 3) {\n g = chroma;\n b = x;\n }\n else if (h >= 3 && h <= 4) {\n g = x;\n b = chroma;\n }\n else if (h >= 4 && h <= 5) {\n r = x;\n b = chroma;\n }\n else if (h >= 5 && h <= 6) {\n r = chroma;\n b = x;\n }\n const m = value - chroma;\n result.set(r + m, g + m, b + m);\n }\n /**\n * Converts Hue, saturation and value to a new Color3 (RGB)\n * @param hue defines the hue (value between 0 and 360)\n * @param saturation defines the saturation (value between 0 and 1)\n * @param value defines the value (value between 0 and 1)\n * @returns a new Color3 object\n */\n static FromHSV(hue, saturation, value) {\n const result = new Color3(0, 0, 0);\n Color3.HSVtoRGBToRef(hue, saturation, value, result);\n return result;\n }\n /**\n * Creates a new Color3 from the string containing valid hexadecimal values\n * @param hex defines a string containing valid hexadecimal values\n * @returns a new Color3 object\n */\n static FromHexString(hex) {\n if (hex.substring(0, 1) !== \"#\" || hex.length !== 7) {\n return new Color3(0, 0, 0);\n }\n const r = parseInt(hex.substring(1, 3), 16);\n const g = parseInt(hex.substring(3, 5), 16);\n const b = parseInt(hex.substring(5, 7), 16);\n return Color3.FromInts(r, g, b);\n }\n /**\n * Creates a new Color3 from the starting index of the given array\n * @param array defines the source array\n * @param offset defines an offset in the source array\n * @returns a new Color3 object\n */\n static FromArray(array, offset = 0) {\n return new Color3(array[offset], array[offset + 1], array[offset + 2]);\n }\n /**\n * Creates a new Color3 from the starting index element of the given array\n * @param array defines the source array to read from\n * @param offset defines the offset in the source array\n * @param result defines the target Color3 object\n */\n static FromArrayToRef(array, offset = 0, result) {\n result.r = array[offset];\n result.g = array[offset + 1];\n result.b = array[offset + 2];\n }\n /**\n * Creates a new Color3 from integer values (< 256)\n * @param r defines the red component to read from (value between 0 and 255)\n * @param g defines the green component to read from (value between 0 and 255)\n * @param b defines the blue component to read from (value between 0 and 255)\n * @returns a new Color3 object\n */\n static FromInts(r, g, b) {\n return new Color3(r / 255.0, g / 255.0, b / 255.0);\n }\n /**\n * Creates a new Color3 with values linearly interpolated of \"amount\" between the start Color3 and the end Color3\n * @param start defines the start Color3 value\n * @param end defines the end Color3 value\n * @param amount defines the gradient value between start and end\n * @returns a new Color3 object\n */\n static Lerp(start, end, amount) {\n const result = new Color3(0.0, 0.0, 0.0);\n Color3.LerpToRef(start, end, amount, result);\n return result;\n }\n /**\n * Creates a new Color3 with values linearly interpolated of \"amount\" between the start Color3 and the end Color3\n * @param left defines the start value\n * @param right defines the end value\n * @param amount defines the gradient factor\n * @param result defines the Color3 object where to store the result\n */\n static LerpToRef(left, right, amount, result) {\n result.r = left.r + (right.r - left.r) * amount;\n result.g = left.g + (right.g - left.g) * amount;\n result.b = left.b + (right.b - left.b) * amount;\n }\n /**\n * Returns a new Color3 located for \"amount\" (float) on the Hermite interpolation spline defined by the vectors \"value1\", \"tangent1\", \"value2\", \"tangent2\"\n * @param value1 defines the first control point\n * @param tangent1 defines the first tangent Color3\n * @param value2 defines the second control point\n * @param tangent2 defines the second tangent Color3\n * @param amount defines the amount on the interpolation spline (between 0 and 1)\n * @returns the new Color3\n */\n static Hermite(value1, tangent1, value2, tangent2, amount) {\n const squared = amount * amount;\n const cubed = amount * squared;\n const part1 = 2.0 * cubed - 3.0 * squared + 1.0;\n const part2 = -2.0 * cubed + 3.0 * squared;\n const part3 = cubed - 2.0 * squared + amount;\n const part4 = cubed - squared;\n const r = value1.r * part1 + value2.r * part2 + tangent1.r * part3 + tangent2.r * part4;\n const g = value1.g * part1 + value2.g * part2 + tangent1.g * part3 + tangent2.g * part4;\n const b = value1.b * part1 + value2.b * part2 + tangent1.b * part3 + tangent2.b * part4;\n return new Color3(r, g, b);\n }\n /**\n * Returns a new Color3 which is the 1st derivative of the Hermite spline defined by the colors \"value1\", \"value2\", \"tangent1\", \"tangent2\".\n * @param value1 defines the first control point\n * @param tangent1 defines the first tangent\n * @param value2 defines the second control point\n * @param tangent2 defines the second tangent\n * @param time define where the derivative must be done\n * @returns 1st derivative\n */\n static Hermite1stDerivative(value1, tangent1, value2, tangent2, time) {\n const result = Color3.Black();\n this.Hermite1stDerivativeToRef(value1, tangent1, value2, tangent2, time, result);\n return result;\n }\n /**\n * Returns a new Color3 which is the 1st derivative of the Hermite spline defined by the colors \"value1\", \"value2\", \"tangent1\", \"tangent2\".\n * @param value1 defines the first control point\n * @param tangent1 defines the first tangent\n * @param value2 defines the second control point\n * @param tangent2 defines the second tangent\n * @param time define where the derivative must be done\n * @param result define where to store the derivative\n */\n static Hermite1stDerivativeToRef(value1, tangent1, value2, tangent2, time, result) {\n const t2 = time * time;\n result.r = (t2 - time) * 6 * value1.r + (3 * t2 - 4 * time + 1) * tangent1.r + (-t2 + time) * 6 * value2.r + (3 * t2 - 2 * time) * tangent2.r;\n result.g = (t2 - time) * 6 * value1.g + (3 * t2 - 4 * time + 1) * tangent1.g + (-t2 + time) * 6 * value2.g + (3 * t2 - 2 * time) * tangent2.g;\n result.b = (t2 - time) * 6 * value1.b + (3 * t2 - 4 * time + 1) * tangent1.b + (-t2 + time) * 6 * value2.b + (3 * t2 - 2 * time) * tangent2.b;\n }\n /**\n * Returns a Color3 value containing a red color\n * @returns a new Color3 object\n */\n static Red() {\n return new Color3(1, 0, 0);\n }\n /**\n * Returns a Color3 value containing a green color\n * @returns a new Color3 object\n */\n static Green() {\n return new Color3(0, 1, 0);\n }\n /**\n * Returns a Color3 value containing a blue color\n * @returns a new Color3 object\n */\n static Blue() {\n return new Color3(0, 0, 1);\n }\n /**\n * Returns a Color3 value containing a black color\n * @returns a new Color3 object\n */\n static Black() {\n return new Color3(0, 0, 0);\n }\n /**\n * Gets a Color3 value containing a black color that must not be updated\n */\n static get BlackReadOnly() {\n return Color3._BlackReadOnly;\n }\n /**\n * Returns a Color3 value containing a white color\n * @returns a new Color3 object\n */\n static White() {\n return new Color3(1, 1, 1);\n }\n /**\n * Returns a Color3 value containing a purple color\n * @returns a new Color3 object\n */\n static Purple() {\n return new Color3(0.5, 0, 0.5);\n }\n /**\n * Returns a Color3 value containing a magenta color\n * @returns a new Color3 object\n */\n static Magenta() {\n return new Color3(1, 0, 1);\n }\n /**\n * Returns a Color3 value containing a yellow color\n * @returns a new Color3 object\n */\n static Yellow() {\n return new Color3(1, 1, 0);\n }\n /**\n * Returns a Color3 value containing a gray color\n * @returns a new Color3 object\n */\n static Gray() {\n return new Color3(0.5, 0.5, 0.5);\n }\n /**\n * Returns a Color3 value containing a teal color\n * @returns a new Color3 object\n */\n static Teal() {\n return new Color3(0, 1.0, 1.0);\n }\n /**\n * Returns a Color3 value containing a random color\n * @returns a new Color3 object\n */\n static Random() {\n return new Color3(Math.random(), Math.random(), Math.random());\n }\n}\n// Statics\nColor3._BlackReadOnly = Color3.Black();\n/**\n * Class used to hold a RBGA color\n */\nexport class Color4 {\n /**\n * Creates a new Color4 object from red, green, blue values, all between 0 and 1\n * @param r defines the red component (between 0 and 1, default is 0)\n * @param g defines the green component (between 0 and 1, default is 0)\n * @param b defines the blue component (between 0 and 1, default is 0)\n * @param a defines the alpha component (between 0 and 1, default is 1)\n */\n constructor(\n /**\n * Defines the red component (between 0 and 1, default is 0)\n */\n r = 0, \n /**\n * Defines the green component (between 0 and 1, default is 0)\n */\n g = 0, \n /**\n * Defines the blue component (between 0 and 1, default is 0)\n */\n b = 0, \n /**\n * Defines the alpha component (between 0 and 1, default is 1)\n */\n a = 1) {\n this.r = r;\n this.g = g;\n this.b = b;\n this.a = a;\n }\n // Operators\n /**\n * Adds in place the given Color4 values to the current Color4 object\n * @param right defines the second operand\n * @returns the current updated Color4 object\n */\n addInPlace(right) {\n this.r += right.r;\n this.g += right.g;\n this.b += right.b;\n this.a += right.a;\n return this;\n }\n /**\n * Creates a new array populated with 4 numeric elements : red, green, blue, alpha values\n * @returns the new array\n */\n asArray() {\n return [this.r, this.g, this.b, this.a];\n }\n /**\n * Stores from the starting index in the given array the Color4 successive values\n * @param array defines the array where to store the r,g,b components\n * @param index defines an optional index in the target array to define where to start storing values\n * @returns the current Color4 object\n */\n toArray(array, index = 0) {\n array[index] = this.r;\n array[index + 1] = this.g;\n array[index + 2] = this.b;\n array[index + 3] = this.a;\n return this;\n }\n /**\n * Update the current color with values stored in an array from the starting index of the given array\n * @param array defines the source array\n * @param offset defines an offset in the source array\n * @returns the current Color4 object\n */\n fromArray(array, offset = 0) {\n Color4.FromArrayToRef(array, offset, this);\n return this;\n }\n /**\n * Determines equality between Color4 objects\n * @param otherColor defines the second operand\n * @returns true if the rgba values are equal to the given ones\n */\n equals(otherColor) {\n return otherColor && this.r === otherColor.r && this.g === otherColor.g && this.b === otherColor.b && this.a === otherColor.a;\n }\n /**\n * Creates a new Color4 set with the added values of the current Color4 and of the given one\n * @param right defines the second operand\n * @returns a new Color4 object\n */\n add(right) {\n return new Color4(this.r + right.r, this.g + right.g, this.b + right.b, this.a + right.a);\n }\n /**\n * Creates a new Color4 set with the subtracted values of the given one from the current Color4\n * @param right defines the second operand\n * @returns a new Color4 object\n */\n subtract(right) {\n return new Color4(this.r - right.r, this.g - right.g, this.b - right.b, this.a - right.a);\n }\n /**\n * Subtracts the given ones from the current Color4 values and stores the results in \"result\"\n * @param right defines the second operand\n * @param result defines the Color4 object where to store the result\n * @returns the current Color4 object\n */\n subtractToRef(right, result) {\n result.r = this.r - right.r;\n result.g = this.g - right.g;\n result.b = this.b - right.b;\n result.a = this.a - right.a;\n return this;\n }\n /**\n * Creates a new Color4 with the current Color4 values multiplied by scale\n * @param scale defines the scaling factor to apply\n * @returns a new Color4 object\n */\n scale(scale) {\n return new Color4(this.r * scale, this.g * scale, this.b * scale, this.a * scale);\n }\n /**\n * Multiplies the Color4 values by the float \"scale\"\n * @param scale defines the scaling factor to apply\n * @returns the current updated Color4\n */\n scaleInPlace(scale) {\n this.r *= scale;\n this.g *= scale;\n this.b *= scale;\n this.a *= scale;\n return this;\n }\n /**\n * Multiplies the current Color4 values by scale and stores the result in \"result\"\n * @param scale defines the scaling factor to apply\n * @param result defines the Color4 object where to store the result\n * @returns the current unmodified Color4\n */\n scaleToRef(scale, result) {\n result.r = this.r * scale;\n result.g = this.g * scale;\n result.b = this.b * scale;\n result.a = this.a * scale;\n return this;\n }\n /**\n * Scale the current Color4 values by a factor and add the result to a given Color4\n * @param scale defines the scale factor\n * @param result defines the Color4 object where to store the result\n * @returns the unmodified current Color4\n */\n scaleAndAddToRef(scale, result) {\n result.r += this.r * scale;\n result.g += this.g * scale;\n result.b += this.b * scale;\n result.a += this.a * scale;\n return this;\n }\n /**\n * Clamps the rgb values by the min and max values and stores the result into \"result\"\n * @param min defines minimum clamping value (default is 0)\n * @param max defines maximum clamping value (default is 1)\n * @param result defines color to store the result into.\n * @returns the current Color4\n */\n clampToRef(min = 0, max = 1, result) {\n result.r = Scalar.Clamp(this.r, min, max);\n result.g = Scalar.Clamp(this.g, min, max);\n result.b = Scalar.Clamp(this.b, min, max);\n result.a = Scalar.Clamp(this.a, min, max);\n return this;\n }\n /**\n * Multiply an Color4 value by another and return a new Color4 object\n * @param color defines the Color4 value to multiply by\n * @returns a new Color4 object\n */\n multiply(color) {\n return new Color4(this.r * color.r, this.g * color.g, this.b * color.b, this.a * color.a);\n }\n /**\n * Multiply a Color4 value by another and push the result in a reference value\n * @param color defines the Color4 value to multiply by\n * @param result defines the Color4 to fill the result in\n * @returns the result Color4\n */\n multiplyToRef(color, result) {\n result.r = this.r * color.r;\n result.g = this.g * color.g;\n result.b = this.b * color.b;\n result.a = this.a * color.a;\n return result;\n }\n /**\n * Creates a string with the Color4 current values\n * @returns the string representation of the Color4 object\n */\n toString() {\n return \"{R: \" + this.r + \" G:\" + this.g + \" B:\" + this.b + \" A:\" + this.a + \"}\";\n }\n /**\n * Returns the string \"Color4\"\n * @returns \"Color4\"\n */\n getClassName() {\n return \"Color4\";\n }\n /**\n * Compute the Color4 hash code\n * @returns an unique number that can be used to hash Color4 objects\n */\n getHashCode() {\n let hash = (this.r * 255) | 0;\n hash = (hash * 397) ^ ((this.g * 255) | 0);\n hash = (hash * 397) ^ ((this.b * 255) | 0);\n hash = (hash * 397) ^ ((this.a * 255) | 0);\n return hash;\n }\n /**\n * Creates a new Color4 copied from the current one\n * @returns a new Color4 object\n */\n clone() {\n return new Color4(this.r, this.g, this.b, this.a);\n }\n /**\n * Copies the given Color4 values into the current one\n * @param source defines the source Color4 object\n * @returns the current updated Color4 object\n */\n copyFrom(source) {\n this.r = source.r;\n this.g = source.g;\n this.b = source.b;\n this.a = source.a;\n return this;\n }\n /**\n * Copies the given float values into the current one\n * @param r defines the red component to read from\n * @param g defines the green component to read from\n * @param b defines the blue component to read from\n * @param a defines the alpha component to read from\n * @returns the current updated Color4 object\n */\n copyFromFloats(r, g, b, a) {\n this.r = r;\n this.g = g;\n this.b = b;\n this.a = a;\n return this;\n }\n /**\n * Copies the given float values into the current one\n * @param r defines the red component to read from\n * @param g defines the green component to read from\n * @param b defines the blue component to read from\n * @param a defines the alpha component to read from\n * @returns the current updated Color4 object\n */\n set(r, g, b, a) {\n return this.copyFromFloats(r, g, b, a);\n }\n /**\n * Compute the Color4 hexadecimal code as a string\n * @param returnAsColor3 defines if the string should only contains RGB values (off by default)\n * @returns a string containing the hexadecimal representation of the Color4 object\n */\n toHexString(returnAsColor3 = false) {\n const intR = Math.round(this.r * 255);\n const intG = Math.round(this.g * 255);\n const intB = Math.round(this.b * 255);\n if (returnAsColor3) {\n return \"#\" + Scalar.ToHex(intR) + Scalar.ToHex(intG) + Scalar.ToHex(intB);\n }\n const intA = Math.round(this.a * 255);\n return \"#\" + Scalar.ToHex(intR) + Scalar.ToHex(intG) + Scalar.ToHex(intB) + Scalar.ToHex(intA);\n }\n /**\n * Computes a new Color4 converted from the current one to linear space\n * @param exact defines if the conversion will be done in an exact way which is slower but more accurate (default is false)\n * @returns a new Color4 object\n */\n toLinearSpace(exact = false) {\n const convertedColor = new Color4();\n this.toLinearSpaceToRef(convertedColor, exact);\n return convertedColor;\n }\n /**\n * Converts the Color4 values to linear space and stores the result in \"convertedColor\"\n * @param convertedColor defines the Color4 object where to store the linear space version\n * @param exact defines if the conversion will be done in an exact way which is slower but more accurate (default is false)\n * @returns the unmodified Color4\n */\n toLinearSpaceToRef(convertedColor, exact = false) {\n if (exact) {\n convertedColor.r = colorChannelToLinearSpaceExact(this.r);\n convertedColor.g = colorChannelToLinearSpaceExact(this.g);\n convertedColor.b = colorChannelToLinearSpaceExact(this.b);\n }\n else {\n convertedColor.r = colorChannelToLinearSpace(this.r);\n convertedColor.g = colorChannelToLinearSpace(this.g);\n convertedColor.b = colorChannelToLinearSpace(this.b);\n }\n convertedColor.a = this.a;\n return this;\n }\n /**\n * Computes a new Color4 converted from the current one to gamma space\n * @param exact defines if the conversion will be done in an exact way which is slower but more accurate (default is false)\n * @returns a new Color4 object\n */\n toGammaSpace(exact = false) {\n const convertedColor = new Color4();\n this.toGammaSpaceToRef(convertedColor, exact);\n return convertedColor;\n }\n /**\n * Converts the Color4 values to gamma space and stores the result in \"convertedColor\"\n * @param convertedColor defines the Color4 object where to store the gamma space version\n * @param exact defines if the conversion will be done in an exact way which is slower but more accurate (default is false)\n * @returns the unmodified Color4\n */\n toGammaSpaceToRef(convertedColor, exact = false) {\n if (exact) {\n convertedColor.r = colorChannelToGammaSpaceExact(this.r);\n convertedColor.g = colorChannelToGammaSpaceExact(this.g);\n convertedColor.b = colorChannelToGammaSpaceExact(this.b);\n }\n else {\n convertedColor.r = colorChannelToGammaSpace(this.r);\n convertedColor.g = colorChannelToGammaSpace(this.g);\n convertedColor.b = colorChannelToGammaSpace(this.b);\n }\n convertedColor.a = this.a;\n return this;\n }\n // Statics\n /**\n * Creates a new Color4 from the string containing valid hexadecimal values.\n *\n * A valid hex string is either in the format #RRGGBB or #RRGGBBAA.\n *\n * When a hex string without alpha is passed, the resulting Color4 has\n * its alpha value set to 1.0.\n *\n * An invalid string results in a Color with all its channels set to 0.0,\n * i.e. \"transparent black\".\n *\n * @param hex defines a string containing valid hexadecimal values\n * @returns a new Color4 object\n */\n static FromHexString(hex) {\n if (hex.substring(0, 1) !== \"#\" || (hex.length !== 9 && hex.length !== 7)) {\n return new Color4(0.0, 0.0, 0.0, 0.0);\n }\n const r = parseInt(hex.substring(1, 3), 16);\n const g = parseInt(hex.substring(3, 5), 16);\n const b = parseInt(hex.substring(5, 7), 16);\n const a = hex.length === 9 ? parseInt(hex.substring(7, 9), 16) : 255;\n return Color4.FromInts(r, g, b, a);\n }\n /**\n * Creates a new Color4 object set with the linearly interpolated values of \"amount\" between the left Color4 object and the right Color4 object\n * @param left defines the start value\n * @param right defines the end value\n * @param amount defines the gradient factor\n * @returns a new Color4 object\n */\n static Lerp(left, right, amount) {\n const result = new Color4(0.0, 0.0, 0.0, 0.0);\n Color4.LerpToRef(left, right, amount, result);\n return result;\n }\n /**\n * Set the given \"result\" with the linearly interpolated values of \"amount\" between the left Color4 object and the right Color4 object\n * @param left defines the start value\n * @param right defines the end value\n * @param amount defines the gradient factor\n * @param result defines the Color4 object where to store data\n */\n static LerpToRef(left, right, amount, result) {\n result.r = left.r + (right.r - left.r) * amount;\n result.g = left.g + (right.g - left.g) * amount;\n result.b = left.b + (right.b - left.b) * amount;\n result.a = left.a + (right.a - left.a) * amount;\n }\n /**\n * Interpolate between two Color4 using Hermite interpolation\n * @param value1 defines first Color4\n * @param tangent1 defines the incoming tangent\n * @param value2 defines second Color4\n * @param tangent2 defines the outgoing tangent\n * @param amount defines the target Color4\n * @returns the new interpolated Color4\n */\n static Hermite(value1, tangent1, value2, tangent2, amount) {\n const squared = amount * amount;\n const cubed = amount * squared;\n const part1 = 2.0 * cubed - 3.0 * squared + 1.0;\n const part2 = -2.0 * cubed + 3.0 * squared;\n const part3 = cubed - 2.0 * squared + amount;\n const part4 = cubed - squared;\n const r = value1.r * part1 + value2.r * part2 + tangent1.r * part3 + tangent2.r * part4;\n const g = value1.g * part1 + value2.g * part2 + tangent1.g * part3 + tangent2.g * part4;\n const b = value1.b * part1 + value2.b * part2 + tangent1.b * part3 + tangent2.b * part4;\n const a = value1.a * part1 + value2.a * part2 + tangent1.a * part3 + tangent2.a * part4;\n return new Color4(r, g, b, a);\n }\n /**\n * Returns a new Color4 which is the 1st derivative of the Hermite spline defined by the colors \"value1\", \"value2\", \"tangent1\", \"tangent2\".\n * @param value1 defines the first control point\n * @param tangent1 defines the first tangent\n * @param value2 defines the second control point\n * @param tangent2 defines the second tangent\n * @param time define where the derivative must be done\n * @returns 1st derivative\n */\n static Hermite1stDerivative(value1, tangent1, value2, tangent2, time) {\n const result = new Color4();\n this.Hermite1stDerivativeToRef(value1, tangent1, value2, tangent2, time, result);\n return result;\n }\n /**\n * Update a Color4 with the 1st derivative of the Hermite spline defined by the colors \"value1\", \"value2\", \"tangent1\", \"tangent2\".\n * @param value1 defines the first control point\n * @param tangent1 defines the first tangent\n * @param value2 defines the second control point\n * @param tangent2 defines the second tangent\n * @param time define where the derivative must be done\n * @param result define where to store the derivative\n */\n static Hermite1stDerivativeToRef(value1, tangent1, value2, tangent2, time, result) {\n const t2 = time * time;\n result.r = (t2 - time) * 6 * value1.r + (3 * t2 - 4 * time + 1) * tangent1.r + (-t2 + time) * 6 * value2.r + (3 * t2 - 2 * time) * tangent2.r;\n result.g = (t2 - time) * 6 * value1.g + (3 * t2 - 4 * time + 1) * tangent1.g + (-t2 + time) * 6 * value2.g + (3 * t2 - 2 * time) * tangent2.g;\n result.b = (t2 - time) * 6 * value1.b + (3 * t2 - 4 * time + 1) * tangent1.b + (-t2 + time) * 6 * value2.b + (3 * t2 - 2 * time) * tangent2.b;\n result.a = (t2 - time) * 6 * value1.a + (3 * t2 - 4 * time + 1) * tangent1.a + (-t2 + time) * 6 * value2.a + (3 * t2 - 2 * time) * tangent2.a;\n }\n /**\n * Creates a new Color4 from a Color3 and an alpha value\n * @param color3 defines the source Color3 to read from\n * @param alpha defines the alpha component (1.0 by default)\n * @returns a new Color4 object\n */\n static FromColor3(color3, alpha = 1.0) {\n return new Color4(color3.r, color3.g, color3.b, alpha);\n }\n /**\n * Creates a new Color4 from the starting index element of the given array\n * @param array defines the source array to read from\n * @param offset defines the offset in the source array\n * @returns a new Color4 object\n */\n static FromArray(array, offset = 0) {\n return new Color4(array[offset], array[offset + 1], array[offset + 2], array[offset + 3]);\n }\n /**\n * Creates a new Color4 from the starting index element of the given array\n * @param array defines the source array to read from\n * @param offset defines the offset in the source array\n * @param result defines the target Color4 object\n */\n static FromArrayToRef(array, offset = 0, result) {\n result.r = array[offset];\n result.g = array[offset + 1];\n result.b = array[offset + 2];\n result.a = array[offset + 3];\n }\n /**\n * Creates a new Color3 from integer values (< 256)\n * @param r defines the red component to read from (value between 0 and 255)\n * @param g defines the green component to read from (value between 0 and 255)\n * @param b defines the blue component to read from (value between 0 and 255)\n * @param a defines the alpha component to read from (value between 0 and 255)\n * @returns a new Color3 object\n */\n static FromInts(r, g, b, a) {\n return new Color4(r / 255.0, g / 255.0, b / 255.0, a / 255.0);\n }\n /**\n * Check the content of a given array and convert it to an array containing RGBA data\n * If the original array was already containing count * 4 values then it is returned directly\n * @param colors defines the array to check\n * @param count defines the number of RGBA data to expect\n * @returns an array containing count * 4 values (RGBA)\n */\n static CheckColors4(colors, count) {\n // Check if color3 was used\n if (colors.length === count * 3) {\n const colors4 = [];\n for (let index = 0; index < colors.length; index += 3) {\n const newIndex = (index / 3) * 4;\n colors4[newIndex] = colors[index];\n colors4[newIndex + 1] = colors[index + 1];\n colors4[newIndex + 2] = colors[index + 2];\n colors4[newIndex + 3] = 1.0;\n }\n return colors4;\n }\n return colors;\n }\n}\n/**\n * @internal\n */\nexport class TmpColors {\n}\nTmpColors.Color3 = ArrayTools.BuildArray(3, Color3.Black);\nTmpColors.Color4 = ArrayTools.BuildArray(3, () => new Color4(0, 0, 0, 0));\nRegisterClass(\"BABYLON.Color3\", Color3);\nRegisterClass(\"BABYLON.Color4\", Color4);\n//# sourceMappingURL=math.color.js.map","/**\n * Class used to evaluate queries containing `and` and `or` operators\n */\nexport class AndOrNotEvaluator {\n /**\n * Evaluate a query\n * @param query defines the query to evaluate\n * @param evaluateCallback defines the callback used to filter result\n * @returns true if the query matches\n */\n static Eval(query, evaluateCallback) {\n if (!query.match(/\\([^()]*\\)/g)) {\n query = AndOrNotEvaluator._HandleParenthesisContent(query, evaluateCallback);\n }\n else {\n query = query.replace(/\\([^()]*\\)/g, (r) => {\n // remove parenthesis\n r = r.slice(1, r.length - 1);\n return AndOrNotEvaluator._HandleParenthesisContent(r, evaluateCallback);\n });\n }\n if (query === \"true\") {\n return true;\n }\n if (query === \"false\") {\n return false;\n }\n return AndOrNotEvaluator.Eval(query, evaluateCallback);\n }\n static _HandleParenthesisContent(parenthesisContent, evaluateCallback) {\n evaluateCallback =\n evaluateCallback ||\n ((r) => {\n return r === \"true\" ? true : false;\n });\n let result;\n const or = parenthesisContent.split(\"||\");\n for (const i in or) {\n if (Object.prototype.hasOwnProperty.call(or, i)) {\n let ori = AndOrNotEvaluator._SimplifyNegation(or[i].trim());\n const and = ori.split(\"&&\");\n if (and.length > 1) {\n for (let j = 0; j < and.length; ++j) {\n const andj = AndOrNotEvaluator._SimplifyNegation(and[j].trim());\n if (andj !== \"true\" && andj !== \"false\") {\n if (andj[0] === \"!\") {\n result = !evaluateCallback(andj.substring(1));\n }\n else {\n result = evaluateCallback(andj);\n }\n }\n else {\n result = andj === \"true\" ? true : false;\n }\n if (!result) {\n // no need to continue since 'false && ... && ...' will always return false\n ori = \"false\";\n break;\n }\n }\n }\n if (result || ori === \"true\") {\n // no need to continue since 'true || ... || ...' will always return true\n result = true;\n break;\n }\n // result equals false (or undefined)\n if (ori !== \"true\" && ori !== \"false\") {\n if (ori[0] === \"!\") {\n result = !evaluateCallback(ori.substring(1));\n }\n else {\n result = evaluateCallback(ori);\n }\n }\n else {\n result = ori === \"true\" ? true : false;\n }\n }\n }\n // the whole parenthesis scope is replaced by 'true' or 'false'\n return result ? \"true\" : \"false\";\n }\n static _SimplifyNegation(booleanString) {\n booleanString = booleanString.replace(/^[\\s!]+/, (r) => {\n // remove whitespaces\n r = r.replace(/[\\s]/g, () => \"\");\n return r.length % 2 ? \"!\" : \"\";\n });\n booleanString = booleanString.trim();\n if (booleanString === \"!true\") {\n booleanString = \"false\";\n }\n else if (booleanString === \"!false\") {\n booleanString = \"true\";\n }\n return booleanString;\n }\n}\n//# sourceMappingURL=andOrNotEvaluator.js.map","import { AndOrNotEvaluator } from \"./andOrNotEvaluator.js\";\n/**\n * Class used to store custom tags\n */\nexport class Tags {\n /**\n * Adds support for tags on the given object\n * @param obj defines the object to use\n */\n static EnableFor(obj) {\n obj._tags = obj._tags || {};\n obj.hasTags = () => {\n return Tags.HasTags(obj);\n };\n obj.addTags = (tagsString) => {\n return Tags.AddTagsTo(obj, tagsString);\n };\n obj.removeTags = (tagsString) => {\n return Tags.RemoveTagsFrom(obj, tagsString);\n };\n obj.matchesTagsQuery = (tagsQuery) => {\n return Tags.MatchesQuery(obj, tagsQuery);\n };\n }\n /**\n * Removes tags support\n * @param obj defines the object to use\n */\n static DisableFor(obj) {\n delete obj._tags;\n delete obj.hasTags;\n delete obj.addTags;\n delete obj.removeTags;\n delete obj.matchesTagsQuery;\n }\n /**\n * Gets a boolean indicating if the given object has tags\n * @param obj defines the object to use\n * @returns a boolean\n */\n static HasTags(obj) {\n if (!obj._tags) {\n return false;\n }\n const tags = obj._tags;\n for (const i in tags) {\n if (Object.prototype.hasOwnProperty.call(tags, i)) {\n return true;\n }\n }\n return false;\n }\n /**\n * Gets the tags available on a given object\n * @param obj defines the object to use\n * @param asString defines if the tags must be returned as a string instead of an array of strings\n * @returns the tags\n */\n static GetTags(obj, asString = true) {\n if (!obj._tags) {\n return null;\n }\n if (asString) {\n const tagsArray = [];\n for (const tag in obj._tags) {\n if (Object.prototype.hasOwnProperty.call(obj._tags, tag) && obj._tags[tag] === true) {\n tagsArray.push(tag);\n }\n }\n return tagsArray.join(\" \");\n }\n else {\n return obj._tags;\n }\n }\n /**\n * Adds tags to an object\n * @param obj defines the object to use\n * @param tagsString defines the tag string. The tags 'true' and 'false' are reserved and cannot be used as tags.\n * A tag cannot start with '||', '&&', and '!'. It cannot contain whitespaces\n */\n static AddTagsTo(obj, tagsString) {\n if (!tagsString) {\n return;\n }\n if (typeof tagsString !== \"string\") {\n return;\n }\n const tags = tagsString.split(\" \");\n tags.forEach(function (tag) {\n Tags._AddTagTo(obj, tag);\n });\n }\n /**\n * @internal\n */\n static _AddTagTo(obj, tag) {\n tag = tag.trim();\n if (tag === \"\" || tag === \"true\" || tag === \"false\") {\n return;\n }\n if (tag.match(/[\\s]/) || tag.match(/^([!]|([|]|[&]){2})/)) {\n return;\n }\n Tags.EnableFor(obj);\n obj._tags[tag] = true;\n }\n /**\n * Removes specific tags from a specific object\n * @param obj defines the object to use\n * @param tagsString defines the tags to remove\n */\n static RemoveTagsFrom(obj, tagsString) {\n if (!Tags.HasTags(obj)) {\n return;\n }\n const tags = tagsString.split(\" \");\n for (const t in tags) {\n Tags._RemoveTagFrom(obj, tags[t]);\n }\n }\n /**\n * @internal\n */\n static _RemoveTagFrom(obj, tag) {\n delete obj._tags[tag];\n }\n /**\n * Defines if tags hosted on an object match a given query\n * @param obj defines the object to use\n * @param tagsQuery defines the tag query\n * @returns a boolean\n */\n static MatchesQuery(obj, tagsQuery) {\n if (tagsQuery === undefined) {\n return true;\n }\n if (tagsQuery === \"\") {\n return Tags.HasTags(obj);\n }\n return AndOrNotEvaluator.Eval(tagsQuery, (r) => Tags.HasTags(obj) && obj._tags[r]);\n }\n}\n//# sourceMappingURL=tags.js.map","/**\n * @internal\n */\nexport function _WarnImport(name) {\n return `${name} needs to be imported before as it contains a side-effect required by your code.`;\n}\n//# sourceMappingURL=devTools.js.map","/* eslint-disable @typescript-eslint/no-unused-vars */\n/* eslint-disable @typescript-eslint/naming-convention */\nimport { Tags } from \"../Misc/tags.js\";\nimport { Quaternion, Vector2, Vector3, Matrix } from \"../Maths/math.vector.js\";\nimport { _WarnImport } from \"./devTools.js\";\nimport { Color4, Color3 } from \"../Maths/math.color.js\";\nconst __decoratorInitialStore = {};\nconst __mergedStore = {};\nconst _copySource = function (creationFunction, source, instanciate, options = {}) {\n const destination = creationFunction();\n // Tags\n if (Tags && Tags.HasTags(source)) {\n Tags.AddTagsTo(destination, Tags.GetTags(source, true));\n }\n const classStore = getMergedStore(destination);\n // Map from source texture uniqueId to destination texture\n const textureMap = {};\n // Properties\n for (const property in classStore) {\n const propertyDescriptor = classStore[property];\n const sourceProperty = source[property];\n const propertyType = propertyDescriptor.type;\n if (sourceProperty !== undefined && sourceProperty !== null && (property !== \"uniqueId\" || SerializationHelper.AllowLoadingUniqueId)) {\n switch (propertyType) {\n case 0: // Value\n case 6: // Mesh reference\n case 11: // Camera reference\n destination[property] = sourceProperty;\n break;\n case 1: // Texture\n if (options.cloneTexturesOnlyOnce && textureMap[sourceProperty.uniqueId]) {\n destination[property] = textureMap[sourceProperty.uniqueId];\n }\n else {\n destination[property] = instanciate || sourceProperty.isRenderTarget ? sourceProperty : sourceProperty.clone();\n textureMap[sourceProperty.uniqueId] = destination[property];\n }\n break;\n case 2: // Color3\n case 3: // FresnelParameters\n case 4: // Vector2\n case 5: // Vector3\n case 7: // Color Curves\n case 10: // Quaternion\n case 12: // Matrix\n destination[property] = instanciate ? sourceProperty : sourceProperty.clone();\n break;\n }\n }\n }\n return destination;\n};\nfunction getDirectStore(target) {\n const classKey = target.getClassName();\n if (!__decoratorInitialStore[classKey]) {\n __decoratorInitialStore[classKey] = {};\n }\n return __decoratorInitialStore[classKey];\n}\n/**\n * Return the list of properties flagged as serializable\n * @param target host object\n */\nfunction getMergedStore(target) {\n const classKey = target.getClassName();\n if (__mergedStore[classKey]) {\n return __mergedStore[classKey];\n }\n __mergedStore[classKey] = {};\n const store = __mergedStore[classKey];\n let currentTarget = target;\n let currentKey = classKey;\n while (currentKey) {\n const initialStore = __decoratorInitialStore[currentKey];\n for (const property in initialStore) {\n store[property] = initialStore[property];\n }\n let parent;\n let done = false;\n do {\n parent = Object.getPrototypeOf(currentTarget);\n if (!parent.getClassName) {\n done = true;\n break;\n }\n if (parent.getClassName() !== currentKey) {\n break;\n }\n currentTarget = parent;\n } while (parent);\n if (done) {\n break;\n }\n currentKey = parent.getClassName();\n currentTarget = parent;\n }\n return store;\n}\nfunction generateSerializableMember(type, sourceName) {\n return (target, propertyKey) => {\n const classStore = getDirectStore(target);\n if (!classStore[propertyKey]) {\n classStore[propertyKey] = { type: type, sourceName: sourceName };\n }\n };\n}\nfunction generateExpandMember(setCallback, targetKey = null) {\n return (target, propertyKey) => {\n const key = targetKey || \"_\" + propertyKey;\n Object.defineProperty(target, propertyKey, {\n get: function () {\n return this[key];\n },\n set: function (value) {\n // does this object (i.e. vector3) has an equals function? use it!\n // Note - not using \"with epsilon\" here, it is expected te behave like the internal cache does.\n if (typeof this.equals === \"function\") {\n if (this.equals(value)) {\n return;\n }\n }\n if (this[key] === value) {\n return;\n }\n this[key] = value;\n target[setCallback].apply(this);\n },\n enumerable: true,\n configurable: true,\n });\n };\n}\nexport function expandToProperty(callback, targetKey = null) {\n return generateExpandMember(callback, targetKey);\n}\nexport function serialize(sourceName) {\n return generateSerializableMember(0, sourceName); // value member\n}\nexport function serializeAsTexture(sourceName) {\n return generateSerializableMember(1, sourceName); // texture member\n}\nexport function serializeAsColor3(sourceName) {\n return generateSerializableMember(2, sourceName); // color3 member\n}\nexport function serializeAsFresnelParameters(sourceName) {\n return generateSerializableMember(3, sourceName); // fresnel parameters member\n}\nexport function serializeAsVector2(sourceName) {\n return generateSerializableMember(4, sourceName); // vector2 member\n}\nexport function serializeAsVector3(sourceName) {\n return generateSerializableMember(5, sourceName); // vector3 member\n}\nexport function serializeAsMeshReference(sourceName) {\n return generateSerializableMember(6, sourceName); // mesh reference member\n}\nexport function serializeAsColorCurves(sourceName) {\n return generateSerializableMember(7, sourceName); // color curves\n}\nexport function serializeAsColor4(sourceName) {\n return generateSerializableMember(8, sourceName); // color 4\n}\nexport function serializeAsImageProcessingConfiguration(sourceName) {\n return generateSerializableMember(9, sourceName); // image processing\n}\nexport function serializeAsQuaternion(sourceName) {\n return generateSerializableMember(10, sourceName); // quaternion member\n}\nexport function serializeAsMatrix(sourceName) {\n return generateSerializableMember(12, sourceName); // matrix member\n}\n/**\n * Decorator used to define property that can be serialized as reference to a camera\n * @param sourceName defines the name of the property to decorate\n */\nexport function serializeAsCameraReference(sourceName) {\n return generateSerializableMember(11, sourceName); // camera reference member\n}\n/**\n * Class used to help serialization objects\n */\nexport class SerializationHelper {\n /**\n * Appends the serialized animations from the source animations\n * @param source Source containing the animations\n * @param destination Target to store the animations\n */\n static AppendSerializedAnimations(source, destination) {\n if (source.animations) {\n destination.animations = [];\n for (let animationIndex = 0; animationIndex < source.animations.length; animationIndex++) {\n const animation = source.animations[animationIndex];\n destination.animations.push(animation.serialize());\n }\n }\n }\n /**\n * Static function used to serialized a specific entity\n * @param entity defines the entity to serialize\n * @param serializationObject defines the optional target object where serialization data will be stored\n * @returns a JSON compatible object representing the serialization of the entity\n */\n static Serialize(entity, serializationObject) {\n if (!serializationObject) {\n serializationObject = {};\n }\n // Tags\n if (Tags) {\n serializationObject.tags = Tags.GetTags(entity);\n }\n const serializedProperties = getMergedStore(entity);\n // Properties\n for (const property in serializedProperties) {\n const propertyDescriptor = serializedProperties[property];\n const targetPropertyName = propertyDescriptor.sourceName || property;\n const propertyType = propertyDescriptor.type;\n const sourceProperty = entity[property];\n if (sourceProperty !== undefined && sourceProperty !== null && (property !== \"uniqueId\" || SerializationHelper.AllowLoadingUniqueId)) {\n switch (propertyType) {\n case 0: // Value\n serializationObject[targetPropertyName] = sourceProperty;\n break;\n case 1: // Texture\n serializationObject[targetPropertyName] = sourceProperty.serialize();\n break;\n case 2: // Color3\n serializationObject[targetPropertyName] = sourceProperty.asArray();\n break;\n case 3: // FresnelParameters\n serializationObject[targetPropertyName] = sourceProperty.serialize();\n break;\n case 4: // Vector2\n serializationObject[targetPropertyName] = sourceProperty.asArray();\n break;\n case 5: // Vector3\n serializationObject[targetPropertyName] = sourceProperty.asArray();\n break;\n case 6: // Mesh reference\n serializationObject[targetPropertyName] = sourceProperty.id;\n break;\n case 7: // Color Curves\n serializationObject[targetPropertyName] = sourceProperty.serialize();\n break;\n case 8: // Color 4\n serializationObject[targetPropertyName] = sourceProperty.asArray();\n break;\n case 9: // Image Processing\n serializationObject[targetPropertyName] = sourceProperty.serialize();\n break;\n case 10: // Quaternion\n serializationObject[targetPropertyName] = sourceProperty.asArray();\n break;\n case 11: // Camera reference\n serializationObject[targetPropertyName] = sourceProperty.id;\n break;\n case 12: // Matrix\n serializationObject[targetPropertyName] = sourceProperty.asArray();\n break;\n }\n }\n }\n return serializationObject;\n }\n /**\n * Given a source json and a destination object in a scene, this function will parse the source and will try to apply its content to the destination object\n * @param source the source json data\n * @param destination the destination object\n * @param scene the scene where the object is\n * @param rootUrl root url to use to load assets\n */\n static ParseProperties(source, destination, scene, rootUrl) {\n if (!rootUrl) {\n rootUrl = \"\";\n }\n const classStore = getMergedStore(destination);\n // Properties\n for (const property in classStore) {\n const propertyDescriptor = classStore[property];\n const sourceProperty = source[propertyDescriptor.sourceName || property];\n const propertyType = propertyDescriptor.type;\n if (sourceProperty !== undefined && sourceProperty !== null && (property !== \"uniqueId\" || SerializationHelper.AllowLoadingUniqueId)) {\n const dest = destination;\n switch (propertyType) {\n case 0: // Value\n dest[property] = sourceProperty;\n break;\n case 1: // Texture\n if (scene) {\n dest[property] = SerializationHelper._TextureParser(sourceProperty, scene, rootUrl);\n }\n break;\n case 2: // Color3\n dest[property] = Color3.FromArray(sourceProperty);\n break;\n case 3: // FresnelParameters\n dest[property] = SerializationHelper._FresnelParametersParser(sourceProperty);\n break;\n case 4: // Vector2\n dest[property] = Vector2.FromArray(sourceProperty);\n break;\n case 5: // Vector3\n dest[property] = Vector3.FromArray(sourceProperty);\n break;\n case 6: // Mesh reference\n if (scene) {\n dest[property] = scene.getLastMeshById(sourceProperty);\n }\n break;\n case 7: // Color Curves\n dest[property] = SerializationHelper._ColorCurvesParser(sourceProperty);\n break;\n case 8: // Color 4\n dest[property] = Color4.FromArray(sourceProperty);\n break;\n case 9: // Image Processing\n dest[property] = SerializationHelper._ImageProcessingConfigurationParser(sourceProperty);\n break;\n case 10: // Quaternion\n dest[property] = Quaternion.FromArray(sourceProperty);\n break;\n case 11: // Camera reference\n if (scene) {\n dest[property] = scene.getCameraById(sourceProperty);\n }\n break;\n case 12: // Matrix\n dest[property] = Matrix.FromArray(sourceProperty);\n break;\n }\n }\n }\n }\n /**\n * Creates a new entity from a serialization data object\n * @param creationFunction defines a function used to instanciated the new entity\n * @param source defines the source serialization data\n * @param scene defines the hosting scene\n * @param rootUrl defines the root url for resources\n * @returns a new entity\n */\n static Parse(creationFunction, source, scene, rootUrl = null) {\n const destination = creationFunction();\n // Tags\n if (Tags) {\n Tags.AddTagsTo(destination, source.tags);\n }\n SerializationHelper.ParseProperties(source, destination, scene, rootUrl);\n return destination;\n }\n /**\n * Clones an object\n * @param creationFunction defines the function used to instanciate the new object\n * @param source defines the source object\n * @returns the cloned object\n */\n static Clone(creationFunction, source, options = {}) {\n return _copySource(creationFunction, source, false, options);\n }\n /**\n * Instanciates a new object based on a source one (some data will be shared between both object)\n * @param creationFunction defines the function used to instanciate the new object\n * @param source defines the source object\n * @returns the new object\n */\n static Instanciate(creationFunction, source) {\n return _copySource(creationFunction, source, true);\n }\n}\n/**\n * Gets or sets a boolean to indicate if the UniqueId property should be serialized\n */\nSerializationHelper.AllowLoadingUniqueId = false;\n/**\n * @internal\n */\nSerializationHelper._ImageProcessingConfigurationParser = (sourceProperty) => {\n throw _WarnImport(\"ImageProcessingConfiguration\");\n};\n/**\n * @internal\n */\nSerializationHelper._FresnelParametersParser = (sourceProperty) => {\n throw _WarnImport(\"FresnelParameters\");\n};\n/**\n * @internal\n */\nSerializationHelper._ColorCurvesParser = (sourceProperty) => {\n throw _WarnImport(\"ColorCurves\");\n};\n/**\n * @internal\n */\nSerializationHelper._TextureParser = (sourceProperty, scene, rootUrl) => {\n throw _WarnImport(\"Texture\");\n};\n/**\n * Decorator used to redirect a function to a native implementation if available.\n * @internal\n */\nexport function nativeOverride(target, propertyKey, descriptor, predicate) {\n // Cache the original JS function for later.\n const jsFunc = descriptor.value;\n // Override the JS function to check for a native override on first invocation. Setting descriptor.value overrides the function at the early stage of code being loaded/imported.\n descriptor.value = (...params) => {\n // Assume the resolved function will be the original JS function, then we will check for the Babylon Native context.\n let func = jsFunc;\n // Check if we are executing in a Babylon Native context (e.g. check the presence of the _native global property) and if so also check if a function override is available.\n if (typeof _native !== \"undefined\" && _native[propertyKey]) {\n const nativeFunc = _native[propertyKey];\n // If a predicate was provided, then we'll need to invoke the predicate on each invocation of the underlying function to determine whether to call the native function or the JS function.\n if (predicate) {\n // The resolved function will execute the predicate and then either execute the native function or the JS function.\n func = (...params) => (predicate(...params) ? nativeFunc(...params) : jsFunc(...params));\n }\n else {\n // The resolved function will directly execute the native function.\n func = nativeFunc;\n }\n }\n // Override the JS function again with the final resolved target function.\n target[propertyKey] = func;\n // The JS function has now been overridden based on whether we're executing in the context of Babylon Native, but we still need to invoke that function.\n // Future invocations of the function will just directly invoke the final overridden function, not any of the decorator setup logic above.\n return func(...params);\n };\n}\n/**\n * Decorator factory that applies the nativeOverride decorator, but determines whether to redirect to the native implementation based on a filter function that evaluates the function arguments.\n * @param predicate\n * @example @nativeOverride.filter((...[arg1]: Parameters) => arg1.length > 20)\n * public someMethod(arg1: string, arg2: number): string {\n * @internal\n */\nnativeOverride.filter = function (predicate) {\n return (target, propertyKey, descriptor) => nativeOverride(target, propertyKey, descriptor, predicate);\n};\n//# sourceMappingURL=decorators.js.map","/**\n * Enum for the animation key frame interpolation type\n */\nexport var AnimationKeyInterpolation;\n(function (AnimationKeyInterpolation) {\n /**\n * Use tangents to interpolate between start and end values.\n */\n AnimationKeyInterpolation[AnimationKeyInterpolation[\"NONE\"] = 0] = \"NONE\";\n /**\n * Do not interpolate between keys and use the start key value only. Tangents are ignored\n */\n AnimationKeyInterpolation[AnimationKeyInterpolation[\"STEP\"] = 1] = \"STEP\";\n})(AnimationKeyInterpolation || (AnimationKeyInterpolation = {}));\n//# sourceMappingURL=animationKey.js.map","/**\n * Represents the range of an animation\n */\nexport class AnimationRange {\n /**\n * Initializes the range of an animation\n * @param name The name of the animation range\n * @param from The starting frame of the animation\n * @param to The ending frame of the animation\n */\n constructor(\n /**The name of the animation range**/\n name, \n /**The starting frame of the animation */\n from, \n /**The ending frame of the animation*/\n to) {\n this.name = name;\n this.from = from;\n this.to = to;\n }\n /**\n * Makes a copy of the animation range\n * @returns A copy of the animation range\n */\n clone() {\n return new AnimationRange(this.name, this.from, this.to);\n }\n}\n//# sourceMappingURL=animationRange.js.map","\n/******************************************************************************\nCopyright (c) Microsoft Corporation.\nPermission to use, copy, modify, and/or distribute this software for any\npurpose with or without fee is hereby granted.\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\nPERFORMANCE OF THIS SOFTWARE.\n***************************************************************************** */\n/* global Reflect, Promise */\n\nvar extendStatics = function(d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n};\n\nexport function __extends(d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n}\n\nexport var __assign = function() {\n __assign = Object.assign || function __assign(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n return t;\n }\n return __assign.apply(this, arguments);\n}\n\nexport function __rest(s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n}\n\nexport function __decorate(decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n}\n\nexport function __param(paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n}\n\nexport function __metadata(metadataKey, metadataValue) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\n}\n\nexport function __awaiter(thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n}\n\nexport function __generator(thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n}\n\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n});\n\nexport function __exportStar(m, o) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\n}\n\nexport function __values(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n}\n\nexport function __read(o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n}\n\n/** @deprecated */\nexport function __spread() {\n for (var ar = [], i = 0; i < arguments.length; i++)\n ar = ar.concat(__read(arguments[i]));\n return ar;\n}\n\n/** @deprecated */\nexport function __spreadArrays() {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\n r[k] = a[j];\n return r;\n}\n\nexport function __spreadArray(to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n}\n\nexport function __await(v) {\n return this instanceof __await ? (this.v = v, this) : new __await(v);\n}\n\nexport function __asyncGenerator(thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\n function fulfill(value) { resume(\"next\", value); }\n function reject(value) { resume(\"throw\", value); }\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\n}\n\nexport function __asyncDelegator(o) {\n var i, p;\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\n}\n\nexport function __asyncValues(o) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var m = o[Symbol.asyncIterator], i;\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\n}\n\nexport function __makeTemplateObject(cooked, raw) {\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\n return cooked;\n};\n\nvar __setModuleDefault = Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n};\n\nexport function __importStar(mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n}\n\nexport function __importDefault(mod) {\n return (mod && mod.__esModule) ? mod : { default: mod };\n}\n\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n}\n\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n}\n\nexport function __classPrivateFieldIn(state, receiver) {\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\n}\n","import { __decorate } from \"./tslib.es6.js\";\nimport { Matrix, Vector3 } from \"./Maths/math.vector.js\";\nimport { SerializationHelper, serialize } from \"./Misc/decorators.js\";\nimport { Observable } from \"./Misc/observable.js\";\nimport { EngineStore } from \"./Engines/engineStore.js\";\nimport { _WarnImport } from \"./Misc/devTools.js\";\n/** @internal */\nclass _InternalNodeDataInfo {\n constructor() {\n this._doNotSerialize = false;\n this._isDisposed = false;\n this._sceneRootNodesIndex = -1;\n this._isEnabled = true;\n this._isParentEnabled = true;\n this._isReady = true;\n this._onEnabledStateChangedObservable = new Observable();\n this._onClonedObservable = new Observable();\n }\n}\n/**\n * Node is the basic class for all scene objects (Mesh, Light, Camera.)\n */\nexport class Node {\n /**\n * Add a new node constructor\n * @param type defines the type name of the node to construct\n * @param constructorFunc defines the constructor function\n */\n static AddNodeConstructor(type, constructorFunc) {\n this._NodeConstructors[type] = constructorFunc;\n }\n /**\n * Returns a node constructor based on type name\n * @param type defines the type name\n * @param name defines the new node name\n * @param scene defines the hosting scene\n * @param options defines optional options to transmit to constructors\n * @returns the new constructor or null\n */\n static Construct(type, name, scene, options) {\n const constructorFunc = this._NodeConstructors[type];\n if (!constructorFunc) {\n return null;\n }\n return constructorFunc(name, scene, options);\n }\n /**\n * Gets or sets the accessibility tag to describe the node for accessibility purpose.\n */\n set accessibilityTag(value) {\n this._accessibilityTag = value;\n this.onAccessibilityTagChangedObservable.notifyObservers(value);\n }\n get accessibilityTag() {\n return this._accessibilityTag;\n }\n /**\n * Gets or sets a boolean used to define if the node must be serialized\n */\n get doNotSerialize() {\n if (this._nodeDataStorage._doNotSerialize) {\n return true;\n }\n if (this._parentNode) {\n return this._parentNode.doNotSerialize;\n }\n return false;\n }\n set doNotSerialize(value) {\n this._nodeDataStorage._doNotSerialize = value;\n }\n /**\n * Gets a boolean indicating if the node has been disposed\n * @returns true if the node was disposed\n */\n isDisposed() {\n return this._nodeDataStorage._isDisposed;\n }\n /**\n * Gets or sets the parent of the node (without keeping the current position in the scene)\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/transforms/parent_pivot/parent\n */\n set parent(parent) {\n if (this._parentNode === parent) {\n return;\n }\n const previousParentNode = this._parentNode;\n // Remove self from list of children of parent\n if (this._parentNode && this._parentNode._children !== undefined && this._parentNode._children !== null) {\n const index = this._parentNode._children.indexOf(this);\n if (index !== -1) {\n this._parentNode._children.splice(index, 1);\n }\n if (!parent && !this._nodeDataStorage._isDisposed) {\n this._addToSceneRootNodes();\n }\n }\n // Store new parent\n this._parentNode = parent;\n // Add as child to new parent\n if (this._parentNode) {\n if (this._parentNode._children === undefined || this._parentNode._children === null) {\n this._parentNode._children = new Array();\n }\n this._parentNode._children.push(this);\n if (!previousParentNode) {\n this._removeFromSceneRootNodes();\n }\n }\n // Enabled state\n this._syncParentEnabledState();\n }\n get parent() {\n return this._parentNode;\n }\n /**\n * @internal\n */\n _serializeAsParent(serializationObject) {\n serializationObject.parentId = this.uniqueId;\n }\n /** @internal */\n _addToSceneRootNodes() {\n if (this._nodeDataStorage._sceneRootNodesIndex === -1) {\n this._nodeDataStorage._sceneRootNodesIndex = this._scene.rootNodes.length;\n this._scene.rootNodes.push(this);\n }\n }\n /** @internal */\n _removeFromSceneRootNodes() {\n if (this._nodeDataStorage._sceneRootNodesIndex !== -1) {\n const rootNodes = this._scene.rootNodes;\n const lastIdx = rootNodes.length - 1;\n rootNodes[this._nodeDataStorage._sceneRootNodesIndex] = rootNodes[lastIdx];\n rootNodes[this._nodeDataStorage._sceneRootNodesIndex]._nodeDataStorage._sceneRootNodesIndex = this._nodeDataStorage._sceneRootNodesIndex;\n this._scene.rootNodes.pop();\n this._nodeDataStorage._sceneRootNodesIndex = -1;\n }\n }\n /**\n * Gets or sets the animation properties override\n */\n get animationPropertiesOverride() {\n if (!this._animationPropertiesOverride) {\n return this._scene.animationPropertiesOverride;\n }\n return this._animationPropertiesOverride;\n }\n set animationPropertiesOverride(value) {\n this._animationPropertiesOverride = value;\n }\n /**\n * Gets a string identifying the name of the class\n * @returns \"Node\" string\n */\n getClassName() {\n return \"Node\";\n }\n /**\n * Sets a callback that will be raised when the node will be disposed\n */\n set onDispose(callback) {\n if (this._onDisposeObserver) {\n this.onDisposeObservable.remove(this._onDisposeObserver);\n }\n this._onDisposeObserver = this.onDisposeObservable.add(callback);\n }\n /**\n * An event triggered when the enabled state of the node changes\n */\n get onEnabledStateChangedObservable() {\n return this._nodeDataStorage._onEnabledStateChangedObservable;\n }\n /**\n * An event triggered when the node is cloned\n */\n get onClonedObservable() {\n return this._nodeDataStorage._onClonedObservable;\n }\n /**\n * Creates a new Node\n * @param name the name and id to be given to this node\n * @param scene the scene this node will be added to\n */\n constructor(name, scene = null) {\n this._isDirty = false;\n this._nodeDataStorage = new _InternalNodeDataInfo();\n /**\n * Gets or sets a string used to store user defined state for the node\n */\n this.state = \"\";\n /**\n * Gets or sets an object used to store user defined information for the node\n */\n this.metadata = null;\n /**\n * For internal use only. Please do not use.\n */\n this.reservedDataStore = null;\n this._accessibilityTag = null;\n this.onAccessibilityTagChangedObservable = new Observable();\n /** @internal */\n this._parentContainer = null;\n /**\n * Gets a list of Animations associated with the node\n */\n this.animations = new Array();\n this._ranges = {};\n /**\n * Callback raised when the node is ready to be used\n */\n this.onReady = null;\n /** @internal */\n this._currentRenderId = -1;\n this._parentUpdateId = -1;\n /** @internal */\n this._childUpdateId = -1;\n /** @internal */\n this._waitingParentId = null;\n /** @internal */\n this._waitingParentInstanceIndex = null;\n /** @internal */\n this._waitingParsedUniqueId = null;\n /** @internal */\n this._cache = {};\n this._parentNode = null;\n /** @internal */\n this._children = null;\n /** @internal */\n this._worldMatrix = Matrix.Identity();\n /** @internal */\n this._worldMatrixDeterminant = 0;\n /** @internal */\n this._worldMatrixDeterminantIsDirty = true;\n this._animationPropertiesOverride = null;\n /** @internal */\n this._isNode = true;\n /**\n * An event triggered when the mesh is disposed\n */\n this.onDisposeObservable = new Observable();\n this._onDisposeObserver = null;\n // Behaviors\n this._behaviors = new Array();\n this.name = name;\n this.id = name;\n this._scene = (scene || EngineStore.LastCreatedScene);\n this.uniqueId = this._scene.getUniqueId();\n this._initCache();\n }\n /**\n * Gets the scene of the node\n * @returns a scene\n */\n getScene() {\n return this._scene;\n }\n /**\n * Gets the engine of the node\n * @returns a Engine\n */\n getEngine() {\n return this._scene.getEngine();\n }\n /**\n * Attach a behavior to the node\n * @see https://doc.babylonjs.com/features/featuresDeepDive/behaviors\n * @param behavior defines the behavior to attach\n * @param attachImmediately defines that the behavior must be attached even if the scene is still loading\n * @returns the current Node\n */\n addBehavior(behavior, attachImmediately = false) {\n const index = this._behaviors.indexOf(behavior);\n if (index !== -1) {\n return this;\n }\n behavior.init();\n if (this._scene.isLoading && !attachImmediately) {\n // We defer the attach when the scene will be loaded\n this._scene.onDataLoadedObservable.addOnce(() => {\n behavior.attach(this);\n });\n }\n else {\n behavior.attach(this);\n }\n this._behaviors.push(behavior);\n return this;\n }\n /**\n * Remove an attached behavior\n * @see https://doc.babylonjs.com/features/featuresDeepDive/behaviors\n * @param behavior defines the behavior to attach\n * @returns the current Node\n */\n removeBehavior(behavior) {\n const index = this._behaviors.indexOf(behavior);\n if (index === -1) {\n return this;\n }\n this._behaviors[index].detach();\n this._behaviors.splice(index, 1);\n return this;\n }\n /**\n * Gets the list of attached behaviors\n * @see https://doc.babylonjs.com/features/featuresDeepDive/behaviors\n */\n get behaviors() {\n return this._behaviors;\n }\n /**\n * Gets an attached behavior by name\n * @param name defines the name of the behavior to look for\n * @see https://doc.babylonjs.com/features/featuresDeepDive/behaviors\n * @returns null if behavior was not found else the requested behavior\n */\n getBehaviorByName(name) {\n for (const behavior of this._behaviors) {\n if (behavior.name === name) {\n return behavior;\n }\n }\n return null;\n }\n /**\n * Returns the latest update of the World matrix\n * @returns a Matrix\n */\n getWorldMatrix() {\n if (this._currentRenderId !== this._scene.getRenderId()) {\n this.computeWorldMatrix();\n }\n return this._worldMatrix;\n }\n /** @internal */\n _getWorldMatrixDeterminant() {\n if (this._worldMatrixDeterminantIsDirty) {\n this._worldMatrixDeterminantIsDirty = false;\n this._worldMatrixDeterminant = this._worldMatrix.determinant();\n }\n return this._worldMatrixDeterminant;\n }\n /**\n * Returns directly the latest state of the mesh World matrix.\n * A Matrix is returned.\n */\n get worldMatrixFromCache() {\n return this._worldMatrix;\n }\n // override it in derived class if you add new variables to the cache\n // and call the parent class method\n /** @internal */\n _initCache() {\n this._cache = {};\n this._cache.parent = undefined;\n }\n /**\n * @internal\n */\n updateCache(force) {\n if (!force && this.isSynchronized()) {\n return;\n }\n this._cache.parent = this.parent;\n this._updateCache();\n }\n /**\n * @internal\n */\n _getActionManagerForTrigger(trigger, _initialCall = true) {\n if (!this.parent) {\n return null;\n }\n return this.parent._getActionManagerForTrigger(trigger, false);\n }\n // override it in derived class if you add new variables to the cache\n // and call the parent class method if !ignoreParentClass\n /**\n * @internal\n */\n _updateCache(_ignoreParentClass) { }\n // override it in derived class if you add new variables to the cache\n /** @internal */\n _isSynchronized() {\n return true;\n }\n /** @internal */\n _markSyncedWithParent() {\n if (this._parentNode) {\n this._parentUpdateId = this._parentNode._childUpdateId;\n }\n }\n /** @internal */\n isSynchronizedWithParent() {\n if (!this._parentNode) {\n return true;\n }\n if (this._parentNode._isDirty || this._parentUpdateId !== this._parentNode._childUpdateId) {\n return false;\n }\n return this._parentNode.isSynchronized();\n }\n /** @internal */\n isSynchronized() {\n if (this._cache.parent !== this._parentNode) {\n this._cache.parent = this._parentNode;\n return false;\n }\n if (this._parentNode && !this.isSynchronizedWithParent()) {\n return false;\n }\n return this._isSynchronized();\n }\n /**\n * Is this node ready to be used/rendered\n * @param _completeCheck defines if a complete check (including materials and lights) has to be done (false by default)\n * @returns true if the node is ready\n */\n isReady(_completeCheck = false) {\n return this._nodeDataStorage._isReady;\n }\n /**\n * Flag the node as dirty (Forcing it to update everything)\n * @param _property helps children apply precise \"dirtyfication\"\n * @returns this node\n */\n markAsDirty(_property) {\n this._currentRenderId = Number.MAX_VALUE;\n this._isDirty = true;\n return this;\n }\n /**\n * Is this node enabled?\n * If the node has a parent, all ancestors will be checked and false will be returned if any are false (not enabled), otherwise will return true\n * @param checkAncestors indicates if this method should check the ancestors. The default is to check the ancestors. If set to false, the method will return the value of this node without checking ancestors\n * @returns whether this node (and its parent) is enabled\n */\n isEnabled(checkAncestors = true) {\n if (checkAncestors === false) {\n return this._nodeDataStorage._isEnabled;\n }\n if (!this._nodeDataStorage._isEnabled) {\n return false;\n }\n return this._nodeDataStorage._isParentEnabled;\n }\n /** @internal */\n _syncParentEnabledState() {\n this._nodeDataStorage._isParentEnabled = this._parentNode ? this._parentNode.isEnabled() : true;\n if (this._children) {\n this._children.forEach((c) => {\n c._syncParentEnabledState(); // Force children to update accordingly\n });\n }\n }\n /**\n * Set the enabled state of this node\n * @param value defines the new enabled state\n */\n setEnabled(value) {\n if (this._nodeDataStorage._isEnabled === value) {\n return;\n }\n this._nodeDataStorage._isEnabled = value;\n this._syncParentEnabledState();\n this._nodeDataStorage._onEnabledStateChangedObservable.notifyObservers(value);\n }\n /**\n * Is this node a descendant of the given node?\n * The function will iterate up the hierarchy until the ancestor was found or no more parents defined\n * @param ancestor defines the parent node to inspect\n * @returns a boolean indicating if this node is a descendant of the given node\n */\n isDescendantOf(ancestor) {\n if (this.parent) {\n if (this.parent === ancestor) {\n return true;\n }\n return this.parent.isDescendantOf(ancestor);\n }\n return false;\n }\n /**\n * @internal\n */\n _getDescendants(results, directDescendantsOnly = false, predicate) {\n if (!this._children) {\n return;\n }\n for (let index = 0; index < this._children.length; index++) {\n const item = this._children[index];\n if (!predicate || predicate(item)) {\n results.push(item);\n }\n if (!directDescendantsOnly) {\n item._getDescendants(results, false, predicate);\n }\n }\n }\n /**\n * Will return all nodes that have this node as ascendant\n * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered\n * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored\n * @returns all children nodes of all types\n */\n getDescendants(directDescendantsOnly, predicate) {\n const results = new Array();\n this._getDescendants(results, directDescendantsOnly, predicate);\n return results;\n }\n /**\n * Get all child-meshes of this node\n * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered (Default: false)\n * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored\n * @returns an array of AbstractMesh\n */\n getChildMeshes(directDescendantsOnly, predicate) {\n const results = [];\n this._getDescendants(results, directDescendantsOnly, (node) => {\n return (!predicate || predicate(node)) && node.cullingStrategy !== undefined;\n });\n return results;\n }\n /**\n * Get all direct children of this node\n * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored\n * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered (Default: true)\n * @returns an array of Node\n */\n getChildren(predicate, directDescendantsOnly = true) {\n return this.getDescendants(directDescendantsOnly, predicate);\n }\n /**\n * @internal\n */\n _setReady(state) {\n if (state === this._nodeDataStorage._isReady) {\n return;\n }\n if (!state) {\n this._nodeDataStorage._isReady = false;\n return;\n }\n if (this.onReady) {\n this.onReady(this);\n }\n this._nodeDataStorage._isReady = true;\n }\n /**\n * Get an animation by name\n * @param name defines the name of the animation to look for\n * @returns null if not found else the requested animation\n */\n getAnimationByName(name) {\n for (let i = 0; i < this.animations.length; i++) {\n const animation = this.animations[i];\n if (animation.name === name) {\n return animation;\n }\n }\n return null;\n }\n /**\n * Creates an animation range for this node\n * @param name defines the name of the range\n * @param from defines the starting key\n * @param to defines the end key\n */\n createAnimationRange(name, from, to) {\n // check name not already in use\n if (!this._ranges[name]) {\n this._ranges[name] = Node._AnimationRangeFactory(name, from, to);\n for (let i = 0, nAnimations = this.animations.length; i < nAnimations; i++) {\n if (this.animations[i]) {\n this.animations[i].createRange(name, from, to);\n }\n }\n }\n }\n /**\n * Delete a specific animation range\n * @param name defines the name of the range to delete\n * @param deleteFrames defines if animation frames from the range must be deleted as well\n */\n deleteAnimationRange(name, deleteFrames = true) {\n for (let i = 0, nAnimations = this.animations.length; i < nAnimations; i++) {\n if (this.animations[i]) {\n this.animations[i].deleteRange(name, deleteFrames);\n }\n }\n this._ranges[name] = null; // said much faster than 'delete this._range[name]'\n }\n /**\n * Get an animation range by name\n * @param name defines the name of the animation range to look for\n * @returns null if not found else the requested animation range\n */\n getAnimationRange(name) {\n return this._ranges[name] || null;\n }\n /**\n * Clone the current node\n * @param name Name of the new clone\n * @param newParent New parent for the clone\n * @param doNotCloneChildren Do not clone children hierarchy\n * @returns the new transform node\n */\n clone(name, newParent, doNotCloneChildren) {\n const result = SerializationHelper.Clone(() => new Node(name, this.getScene()), this);\n if (newParent) {\n result.parent = newParent;\n }\n if (!doNotCloneChildren) {\n // Children\n const directDescendants = this.getDescendants(true);\n for (let index = 0; index < directDescendants.length; index++) {\n const child = directDescendants[index];\n child.clone(name + \".\" + child.name, result);\n }\n }\n return result;\n }\n /**\n * Gets the list of all animation ranges defined on this node\n * @returns an array\n */\n getAnimationRanges() {\n const animationRanges = [];\n let name;\n for (name in this._ranges) {\n animationRanges.push(this._ranges[name]);\n }\n return animationRanges;\n }\n /**\n * Will start the animation sequence\n * @param name defines the range frames for animation sequence\n * @param loop defines if the animation should loop (false by default)\n * @param speedRatio defines the speed factor in which to run the animation (1 by default)\n * @param onAnimationEnd defines a function to be executed when the animation ended (undefined by default)\n * @returns the object created for this animation. If range does not exist, it will return null\n */\n beginAnimation(name, loop, speedRatio, onAnimationEnd) {\n const range = this.getAnimationRange(name);\n if (!range) {\n return null;\n }\n return this._scene.beginAnimation(this, range.from, range.to, loop, speedRatio, onAnimationEnd);\n }\n /**\n * Serialize animation ranges into a JSON compatible object\n * @returns serialization object\n */\n serializeAnimationRanges() {\n const serializationRanges = [];\n for (const name in this._ranges) {\n const localRange = this._ranges[name];\n if (!localRange) {\n continue;\n }\n const range = {};\n range.name = name;\n range.from = localRange.from;\n range.to = localRange.to;\n serializationRanges.push(range);\n }\n return serializationRanges;\n }\n /**\n * Computes the world matrix of the node\n * @param _force defines if the cache version should be invalidated forcing the world matrix to be created from scratch\n * @returns the world matrix\n */\n computeWorldMatrix(_force) {\n if (!this._worldMatrix) {\n this._worldMatrix = Matrix.Identity();\n }\n return this._worldMatrix;\n }\n /**\n * Releases resources associated with this node.\n * @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)\n * @param disposeMaterialAndTextures Set to true to also dispose referenced materials and textures (false by default)\n */\n dispose(doNotRecurse, disposeMaterialAndTextures = false) {\n this._nodeDataStorage._isDisposed = true;\n if (!doNotRecurse) {\n const nodes = this.getDescendants(true);\n for (const node of nodes) {\n node.dispose(doNotRecurse, disposeMaterialAndTextures);\n }\n }\n if (!this.parent) {\n this._removeFromSceneRootNodes();\n }\n else {\n this.parent = null;\n }\n // Callback\n this.onDisposeObservable.notifyObservers(this);\n this.onDisposeObservable.clear();\n this.onEnabledStateChangedObservable.clear();\n this.onClonedObservable.clear();\n // Behaviors\n for (const behavior of this._behaviors) {\n behavior.detach();\n }\n this._behaviors.length = 0;\n this.metadata = null;\n }\n /**\n * Parse animation range data from a serialization object and store them into a given node\n * @param node defines where to store the animation ranges\n * @param parsedNode defines the serialization object to read data from\n * @param _scene defines the hosting scene\n */\n static ParseAnimationRanges(node, parsedNode, _scene) {\n if (parsedNode.ranges) {\n for (let index = 0; index < parsedNode.ranges.length; index++) {\n const data = parsedNode.ranges[index];\n node.createAnimationRange(data.name, data.from, data.to);\n }\n }\n }\n /**\n * Return the minimum and maximum world vectors of the entire hierarchy under current node\n * @param includeDescendants Include bounding info from descendants as well (true by default)\n * @param predicate defines a callback function that can be customize to filter what meshes should be included in the list used to compute the bounding vectors\n * @returns the new bounding vectors\n */\n getHierarchyBoundingVectors(includeDescendants = true, predicate = null) {\n // Ensures that all world matrix will be recomputed.\n this.getScene().incrementRenderId();\n this.computeWorldMatrix(true);\n let min;\n let max;\n const thisAbstractMesh = this;\n if (thisAbstractMesh.getBoundingInfo && thisAbstractMesh.subMeshes) {\n // If this is an abstract mesh get its bounding info\n const boundingInfo = thisAbstractMesh.getBoundingInfo();\n min = boundingInfo.boundingBox.minimumWorld.clone();\n max = boundingInfo.boundingBox.maximumWorld.clone();\n }\n else {\n min = new Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\n max = new Vector3(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);\n }\n if (includeDescendants) {\n const descendants = this.getDescendants(false);\n for (const descendant of descendants) {\n const childMesh = descendant;\n childMesh.computeWorldMatrix(true);\n // Filters meshes based on custom predicate function.\n if (predicate && !predicate(childMesh)) {\n continue;\n }\n //make sure we have the needed params to get mix and max\n if (!childMesh.getBoundingInfo || childMesh.getTotalVertices() === 0) {\n continue;\n }\n const childBoundingInfo = childMesh.getBoundingInfo();\n const boundingBox = childBoundingInfo.boundingBox;\n const minBox = boundingBox.minimumWorld;\n const maxBox = boundingBox.maximumWorld;\n Vector3.CheckExtends(minBox, min, max);\n Vector3.CheckExtends(maxBox, min, max);\n }\n }\n return {\n min: min,\n max: max,\n };\n }\n}\n/**\n * @internal\n */\nNode._AnimationRangeFactory = (_name, _from, _to) => {\n throw _WarnImport(\"AnimationRange\");\n};\nNode._NodeConstructors = {};\n__decorate([\n serialize()\n], Node.prototype, \"name\", void 0);\n__decorate([\n serialize()\n], Node.prototype, \"id\", void 0);\n__decorate([\n serialize()\n], Node.prototype, \"uniqueId\", void 0);\n__decorate([\n serialize()\n], Node.prototype, \"state\", void 0);\n__decorate([\n serialize()\n], Node.prototype, \"metadata\", void 0);\n//# sourceMappingURL=node.js.map","/**\n * Size containing width and height\n */\nexport class Size {\n /**\n * Creates a Size object from the given width and height (floats).\n * @param width width of the new size\n * @param height height of the new size\n */\n constructor(width, height) {\n this.width = width;\n this.height = height;\n }\n /**\n * Returns a string with the Size width and height\n * @returns a string with the Size width and height\n */\n toString() {\n return `{W: ${this.width}, H: ${this.height}}`;\n }\n /**\n * \"Size\"\n * @returns the string \"Size\"\n */\n getClassName() {\n return \"Size\";\n }\n /**\n * Returns the Size hash code.\n * @returns a hash code for a unique width and height\n */\n getHashCode() {\n let hash = this.width | 0;\n hash = (hash * 397) ^ (this.height | 0);\n return hash;\n }\n /**\n * Updates the current size from the given one.\n * @param src the given size\n */\n copyFrom(src) {\n this.width = src.width;\n this.height = src.height;\n }\n /**\n * Updates in place the current Size from the given floats.\n * @param width width of the new size\n * @param height height of the new size\n * @returns the updated Size.\n */\n copyFromFloats(width, height) {\n this.width = width;\n this.height = height;\n return this;\n }\n /**\n * Updates in place the current Size from the given floats.\n * @param width width to set\n * @param height height to set\n * @returns the updated Size.\n */\n set(width, height) {\n return this.copyFromFloats(width, height);\n }\n /**\n * Multiplies the width and height by numbers\n * @param w factor to multiple the width by\n * @param h factor to multiple the height by\n * @returns a new Size set with the multiplication result of the current Size and the given floats.\n */\n multiplyByFloats(w, h) {\n return new Size(this.width * w, this.height * h);\n }\n /**\n * Clones the size\n * @returns a new Size copied from the given one.\n */\n clone() {\n return new Size(this.width, this.height);\n }\n /**\n * True if the current Size and the given one width and height are strictly equal.\n * @param other the other size to compare against\n * @returns True if the current Size and the given one width and height are strictly equal.\n */\n equals(other) {\n if (!other) {\n return false;\n }\n return this.width === other.width && this.height === other.height;\n }\n /**\n * The surface of the Size : width * height (float).\n */\n get surface() {\n return this.width * this.height;\n }\n /**\n * Create a new size of zero\n * @returns a new Size set to (0.0, 0.0)\n */\n static Zero() {\n return new Size(0.0, 0.0);\n }\n /**\n * Sums the width and height of two sizes\n * @param otherSize size to add to this size\n * @returns a new Size set as the addition result of the current Size and the given one.\n */\n add(otherSize) {\n const r = new Size(this.width + otherSize.width, this.height + otherSize.height);\n return r;\n }\n /**\n * Subtracts the width and height of two\n * @param otherSize size to subtract to this size\n * @returns a new Size set as the subtraction result of the given one from the current Size.\n */\n subtract(otherSize) {\n const r = new Size(this.width - otherSize.width, this.height - otherSize.height);\n return r;\n }\n /**\n * Creates a new Size set at the linear interpolation \"amount\" between \"start\" and \"end\"\n * @param start starting size to lerp between\n * @param end end size to lerp between\n * @param amount amount to lerp between the start and end values\n * @returns a new Size set at the linear interpolation \"amount\" between \"start\" and \"end\"\n */\n static Lerp(start, end, amount) {\n const w = start.width + (end.width - start.width) * amount;\n const h = start.height + (end.height - start.height) * amount;\n return new Size(w, h);\n }\n}\n//# sourceMappingURL=math.size.js.map","/** @internal */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction createXMLHttpRequest() {\n // If running in Babylon Native, then defer to the native XMLHttpRequest, which has the same public contract\n if (typeof _native !== \"undefined\" && _native.XMLHttpRequest) {\n return new _native.XMLHttpRequest();\n }\n else {\n return new XMLHttpRequest();\n }\n}\n/**\n * Extended version of XMLHttpRequest with support for customizations (headers, ...)\n */\nexport class WebRequest {\n constructor() {\n this._xhr = createXMLHttpRequest();\n this._requestURL = \"\";\n }\n _injectCustomRequestHeaders() {\n if (this._shouldSkipRequestModifications(this._requestURL)) {\n return;\n }\n for (const key in WebRequest.CustomRequestHeaders) {\n const val = WebRequest.CustomRequestHeaders[key];\n if (val) {\n this._xhr.setRequestHeader(key, val);\n }\n }\n }\n _shouldSkipRequestModifications(url) {\n return WebRequest.SkipRequestModificationForBabylonCDN && (url.includes(\"preview.babylonjs.com\") || url.includes(\"cdn.babylonjs.com\"));\n }\n /**\n * Gets or sets a function to be called when loading progress changes\n */\n get onprogress() {\n return this._xhr.onprogress;\n }\n set onprogress(value) {\n this._xhr.onprogress = value;\n }\n /**\n * Returns client's state\n */\n get readyState() {\n return this._xhr.readyState;\n }\n /**\n * Returns client's status\n */\n get status() {\n return this._xhr.status;\n }\n /**\n * Returns client's status as a text\n */\n get statusText() {\n return this._xhr.statusText;\n }\n /**\n * Returns client's response\n */\n get response() {\n return this._xhr.response;\n }\n /**\n * Returns client's response url\n */\n get responseURL() {\n return this._xhr.responseURL;\n }\n /**\n * Returns client's response as text\n */\n get responseText() {\n return this._xhr.responseText;\n }\n /**\n * Gets or sets the expected response type\n */\n get responseType() {\n return this._xhr.responseType;\n }\n set responseType(value) {\n this._xhr.responseType = value;\n }\n /**\n * Gets or sets the timeout value in milliseconds\n */\n get timeout() {\n return this._xhr.timeout;\n }\n set timeout(value) {\n this._xhr.timeout = value;\n }\n addEventListener(type, listener, options) {\n this._xhr.addEventListener(type, listener, options);\n }\n removeEventListener(type, listener, options) {\n this._xhr.removeEventListener(type, listener, options);\n }\n /**\n * Cancels any network activity\n */\n abort() {\n this._xhr.abort();\n }\n /**\n * Initiates the request. The optional argument provides the request body. The argument is ignored if request method is GET or HEAD\n * @param body defines an optional request body\n */\n send(body) {\n if (WebRequest.CustomRequestHeaders) {\n this._injectCustomRequestHeaders();\n }\n this._xhr.send(body);\n }\n /**\n * Sets the request method, request URL\n * @param method defines the method to use (GET, POST, etc..)\n * @param url defines the url to connect with\n */\n open(method, url) {\n for (const update of WebRequest.CustomRequestModifiers) {\n if (this._shouldSkipRequestModifications(url)) {\n return;\n }\n update(this._xhr, url);\n }\n // Clean url\n url = url.replace(\"file:http:\", \"http:\");\n url = url.replace(\"file:https:\", \"https:\");\n this._requestURL = url;\n return this._xhr.open(method, url, true);\n }\n /**\n * Sets the value of a request header.\n * @param name The name of the header whose value is to be set\n * @param value The value to set as the body of the header\n */\n setRequestHeader(name, value) {\n this._xhr.setRequestHeader(name, value);\n }\n /**\n * Get the string containing the text of a particular header's value.\n * @param name The name of the header\n * @returns The string containing the text of the given header name\n */\n getResponseHeader(name) {\n return this._xhr.getResponseHeader(name);\n }\n}\n/**\n * Custom HTTP Request Headers to be sent with XMLHttpRequests\n * i.e. when loading files, where the server/service expects an Authorization header\n */\nWebRequest.CustomRequestHeaders = {};\n/**\n * Add callback functions in this array to update all the requests before they get sent to the network\n */\nWebRequest.CustomRequestModifiers = new Array();\nWebRequest.SkipRequestModificationForBabylonCDN = true;\n//# sourceMappingURL=webRequest.js.map","import { Vector3, Quaternion, Vector2, Matrix, TmpVectors } from \"../Maths/math.vector.js\";\nimport { Color3, Color4 } from \"../Maths/math.color.js\";\nimport { Scalar } from \"../Maths/math.scalar.js\";\nimport { SerializationHelper } from \"../Misc/decorators.js\";\nimport { RegisterClass } from \"../Misc/typeStore.js\";\nimport { AnimationKeyInterpolation } from \"./animationKey.js\";\nimport { AnimationRange } from \"./animationRange.js\";\nimport { Node } from \"../node.js\";\nimport { Size } from \"../Maths/math.size.js\";\nimport { WebRequest } from \"../Misc/webRequest.js\";\n\n/**\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport class _IAnimationState {\n}\nconst evaluateAnimationState = {\n key: 0,\n repeatCount: 0,\n loopMode: 2 /*Animation.ANIMATIONLOOPMODE_CONSTANT*/,\n};\n/**\n * Class used to store any kind of animation\n */\nexport class Animation {\n /**\n * @internal Internal use\n */\n static _PrepareAnimation(name, targetProperty, framePerSecond, totalFrame, from, to, loopMode, easingFunction) {\n let dataType = undefined;\n if (!isNaN(parseFloat(from)) && isFinite(from)) {\n dataType = Animation.ANIMATIONTYPE_FLOAT;\n }\n else if (from instanceof Quaternion) {\n dataType = Animation.ANIMATIONTYPE_QUATERNION;\n }\n else if (from instanceof Vector3) {\n dataType = Animation.ANIMATIONTYPE_VECTOR3;\n }\n else if (from instanceof Vector2) {\n dataType = Animation.ANIMATIONTYPE_VECTOR2;\n }\n else if (from instanceof Color3) {\n dataType = Animation.ANIMATIONTYPE_COLOR3;\n }\n else if (from instanceof Color4) {\n dataType = Animation.ANIMATIONTYPE_COLOR4;\n }\n else if (from instanceof Size) {\n dataType = Animation.ANIMATIONTYPE_SIZE;\n }\n if (dataType == undefined) {\n return null;\n }\n const animation = new Animation(name, targetProperty, framePerSecond, dataType, loopMode);\n const keys = [\n { frame: 0, value: from },\n { frame: totalFrame, value: to },\n ];\n animation.setKeys(keys);\n if (easingFunction !== undefined) {\n animation.setEasingFunction(easingFunction);\n }\n return animation;\n }\n /**\n * Sets up an animation\n * @param property The property to animate\n * @param animationType The animation type to apply\n * @param framePerSecond The frames per second of the animation\n * @param easingFunction The easing function used in the animation\n * @returns The created animation\n */\n static CreateAnimation(property, animationType, framePerSecond, easingFunction) {\n const animation = new Animation(property + \"Animation\", property, framePerSecond, animationType, Animation.ANIMATIONLOOPMODE_CONSTANT);\n animation.setEasingFunction(easingFunction);\n return animation;\n }\n /**\n * Create and start an animation on a node\n * @param name defines the name of the global animation that will be run on all nodes\n * @param target defines the target where the animation will take place\n * @param targetProperty defines property to animate\n * @param framePerSecond defines the number of frame per second yo use\n * @param totalFrame defines the number of frames in total\n * @param from defines the initial value\n * @param to defines the final value\n * @param loopMode defines which loop mode you want to use (off by default)\n * @param easingFunction defines the easing function to use (linear by default)\n * @param onAnimationEnd defines the callback to call when animation end\n * @param scene defines the hosting scene\n * @returns the animatable created for this animation\n */\n static CreateAndStartAnimation(name, target, targetProperty, framePerSecond, totalFrame, from, to, loopMode, easingFunction, onAnimationEnd, scene) {\n const animation = Animation._PrepareAnimation(name, targetProperty, framePerSecond, totalFrame, from, to, loopMode, easingFunction);\n if (!animation) {\n return null;\n }\n if (target.getScene) {\n scene = target.getScene();\n }\n if (!scene) {\n return null;\n }\n return scene.beginDirectAnimation(target, [animation], 0, totalFrame, animation.loopMode === 1, 1.0, onAnimationEnd);\n }\n /**\n * Create and start an animation on a node and its descendants\n * @param name defines the name of the global animation that will be run on all nodes\n * @param node defines the root node where the animation will take place\n * @param directDescendantsOnly if true only direct descendants will be used, if false direct and also indirect (children of children, an so on in a recursive manner) descendants will be used\n * @param targetProperty defines property to animate\n * @param framePerSecond defines the number of frame per second to use\n * @param totalFrame defines the number of frames in total\n * @param from defines the initial value\n * @param to defines the final value\n * @param loopMode defines which loop mode you want to use (off by default)\n * @param easingFunction defines the easing function to use (linear by default)\n * @param onAnimationEnd defines the callback to call when an animation ends (will be called once per node)\n * @returns the list of animatables created for all nodes\n * @example https://www.babylonjs-playground.com/#MH0VLI\n */\n static CreateAndStartHierarchyAnimation(name, node, directDescendantsOnly, targetProperty, framePerSecond, totalFrame, from, to, loopMode, easingFunction, onAnimationEnd) {\n const animation = Animation._PrepareAnimation(name, targetProperty, framePerSecond, totalFrame, from, to, loopMode, easingFunction);\n if (!animation) {\n return null;\n }\n const scene = node.getScene();\n return scene.beginDirectHierarchyAnimation(node, directDescendantsOnly, [animation], 0, totalFrame, animation.loopMode === 1, 1.0, onAnimationEnd);\n }\n /**\n * Creates a new animation, merges it with the existing animations and starts it\n * @param name Name of the animation\n * @param node Node which contains the scene that begins the animations\n * @param targetProperty Specifies which property to animate\n * @param framePerSecond The frames per second of the animation\n * @param totalFrame The total number of frames\n * @param from The frame at the beginning of the animation\n * @param to The frame at the end of the animation\n * @param loopMode Specifies the loop mode of the animation\n * @param easingFunction (Optional) The easing function of the animation, which allow custom mathematical formulas for animations\n * @param onAnimationEnd Callback to run once the animation is complete\n * @returns Nullable animation\n */\n static CreateMergeAndStartAnimation(name, node, targetProperty, framePerSecond, totalFrame, from, to, loopMode, easingFunction, onAnimationEnd) {\n const animation = Animation._PrepareAnimation(name, targetProperty, framePerSecond, totalFrame, from, to, loopMode, easingFunction);\n if (!animation) {\n return null;\n }\n node.animations.push(animation);\n return node.getScene().beginAnimation(node, 0, totalFrame, animation.loopMode === 1, 1.0, onAnimationEnd);\n }\n /** @internal */\n static MakeAnimationAdditive(sourceAnimation, referenceFrameOrOptions, range, cloneOriginal = false, clonedName) {\n var _a, _b;\n let options;\n if (typeof referenceFrameOrOptions === \"object\") {\n options = referenceFrameOrOptions;\n }\n else {\n options = {\n referenceFrame: referenceFrameOrOptions !== null && referenceFrameOrOptions !== void 0 ? referenceFrameOrOptions : 0,\n range: range,\n cloneOriginalAnimation: cloneOriginal,\n clonedAnimationName: clonedName,\n };\n }\n let animation = sourceAnimation;\n if (options.cloneOriginalAnimation) {\n animation = sourceAnimation.clone();\n animation.name = options.clonedAnimationName || animation.name;\n }\n if (!animation._keys.length) {\n return animation;\n }\n const referenceFrame = options.referenceFrame && options.referenceFrame >= 0 ? options.referenceFrame : 0;\n let startIndex = 0;\n const firstKey = animation._keys[0];\n let endIndex = animation._keys.length - 1;\n const lastKey = animation._keys[endIndex];\n const valueStore = {\n referenceValue: firstKey.value,\n referencePosition: TmpVectors.Vector3[0],\n referenceQuaternion: TmpVectors.Quaternion[0],\n referenceScaling: TmpVectors.Vector3[1],\n keyPosition: TmpVectors.Vector3[2],\n keyQuaternion: TmpVectors.Quaternion[1],\n keyScaling: TmpVectors.Vector3[3],\n };\n let from = firstKey.frame;\n let to = lastKey.frame;\n if (options.range) {\n const rangeValue = animation.getRange(options.range);\n if (rangeValue) {\n from = rangeValue.from;\n to = rangeValue.to;\n }\n }\n else {\n from = (_a = options.fromFrame) !== null && _a !== void 0 ? _a : from;\n to = (_b = options.toFrame) !== null && _b !== void 0 ? _b : to;\n }\n if (from !== firstKey.frame) {\n startIndex = animation.createKeyForFrame(from);\n }\n if (to !== lastKey.frame) {\n endIndex = animation.createKeyForFrame(to);\n }\n // There's only one key, so use it\n if (animation._keys.length === 1) {\n const value = animation._getKeyValue(animation._keys[0]);\n valueStore.referenceValue = value.clone ? value.clone() : value;\n }\n // Reference frame is before the first frame, so just use the first frame\n else if (referenceFrame <= firstKey.frame) {\n const value = animation._getKeyValue(firstKey.value);\n valueStore.referenceValue = value.clone ? value.clone() : value;\n }\n // Reference frame is after the last frame, so just use the last frame\n else if (referenceFrame >= lastKey.frame) {\n const value = animation._getKeyValue(lastKey.value);\n valueStore.referenceValue = value.clone ? value.clone() : value;\n }\n // Interpolate the reference value from the animation\n else {\n evaluateAnimationState.key = 0;\n const value = animation._interpolate(referenceFrame, evaluateAnimationState);\n valueStore.referenceValue = value.clone ? value.clone() : value;\n }\n // Conjugate the quaternion\n if (animation.dataType === Animation.ANIMATIONTYPE_QUATERNION) {\n valueStore.referenceValue.normalize().conjugateInPlace();\n }\n // Decompose matrix and conjugate the quaternion\n else if (animation.dataType === Animation.ANIMATIONTYPE_MATRIX) {\n valueStore.referenceValue.decompose(valueStore.referenceScaling, valueStore.referenceQuaternion, valueStore.referencePosition);\n valueStore.referenceQuaternion.normalize().conjugateInPlace();\n }\n let startFrame = Number.MAX_VALUE;\n const clippedKeys = options.clipKeys ? [] : null;\n // Subtract the reference value from all of the key values\n for (let index = startIndex; index <= endIndex; index++) {\n let key = animation._keys[index];\n if (clippedKeys) {\n key = {\n frame: key.frame,\n value: key.value.clone ? key.value.clone() : key.value,\n inTangent: key.inTangent,\n outTangent: key.outTangent,\n interpolation: key.interpolation,\n lockedTangent: key.lockedTangent,\n };\n if (startFrame === Number.MAX_VALUE) {\n startFrame = key.frame;\n }\n key.frame -= startFrame;\n clippedKeys.push(key);\n }\n // If this key was duplicated to create a frame 0 key, skip it because its value has already been updated\n if (index && animation.dataType !== Animation.ANIMATIONTYPE_FLOAT && key.value === firstKey.value) {\n continue;\n }\n switch (animation.dataType) {\n case Animation.ANIMATIONTYPE_MATRIX:\n key.value.decompose(valueStore.keyScaling, valueStore.keyQuaternion, valueStore.keyPosition);\n valueStore.keyPosition.subtractInPlace(valueStore.referencePosition);\n valueStore.keyScaling.divideInPlace(valueStore.referenceScaling);\n valueStore.referenceQuaternion.multiplyToRef(valueStore.keyQuaternion, valueStore.keyQuaternion);\n Matrix.ComposeToRef(valueStore.keyScaling, valueStore.keyQuaternion, valueStore.keyPosition, key.value);\n break;\n case Animation.ANIMATIONTYPE_QUATERNION:\n valueStore.referenceValue.multiplyToRef(key.value, key.value);\n break;\n case Animation.ANIMATIONTYPE_VECTOR2:\n case Animation.ANIMATIONTYPE_VECTOR3:\n case Animation.ANIMATIONTYPE_COLOR3:\n case Animation.ANIMATIONTYPE_COLOR4:\n key.value.subtractToRef(valueStore.referenceValue, key.value);\n break;\n case Animation.ANIMATIONTYPE_SIZE:\n key.value.width -= valueStore.referenceValue.width;\n key.value.height -= valueStore.referenceValue.height;\n break;\n default:\n key.value -= valueStore.referenceValue;\n }\n }\n if (clippedKeys) {\n animation.setKeys(clippedKeys, true);\n }\n return animation;\n }\n /**\n * Transition property of an host to the target Value\n * @param property The property to transition\n * @param targetValue The target Value of the property\n * @param host The object where the property to animate belongs\n * @param scene Scene used to run the animation\n * @param frameRate Framerate (in frame/s) to use\n * @param transition The transition type we want to use\n * @param duration The duration of the animation, in milliseconds\n * @param onAnimationEnd Callback trigger at the end of the animation\n * @returns Nullable animation\n */\n static TransitionTo(property, targetValue, host, scene, frameRate, transition, duration, onAnimationEnd = null) {\n if (duration <= 0) {\n host[property] = targetValue;\n if (onAnimationEnd) {\n onAnimationEnd();\n }\n return null;\n }\n const endFrame = frameRate * (duration / 1000);\n transition.setKeys([\n {\n frame: 0,\n value: host[property].clone ? host[property].clone() : host[property],\n },\n {\n frame: endFrame,\n value: targetValue,\n },\n ]);\n if (!host.animations) {\n host.animations = [];\n }\n host.animations.push(transition);\n const animation = scene.beginAnimation(host, 0, endFrame, false);\n animation.onAnimationEnd = onAnimationEnd;\n return animation;\n }\n /**\n * Return the array of runtime animations currently using this animation\n */\n get runtimeAnimations() {\n return this._runtimeAnimations;\n }\n /**\n * Specifies if any of the runtime animations are currently running\n */\n get hasRunningRuntimeAnimations() {\n for (const runtimeAnimation of this._runtimeAnimations) {\n if (!runtimeAnimation.isStopped()) {\n return true;\n }\n }\n return false;\n }\n /**\n * Initializes the animation\n * @param name Name of the animation\n * @param targetProperty Property to animate\n * @param framePerSecond The frames per second of the animation\n * @param dataType The data type of the animation\n * @param loopMode The loop mode of the animation\n * @param enableBlending Specifies if blending should be enabled\n */\n constructor(\n /**Name of the animation */\n name, \n /**Property to animate */\n targetProperty, \n /**The frames per second of the animation */\n framePerSecond, \n /**The data type of the animation */\n dataType, \n /**The loop mode of the animation */\n loopMode, \n /**Specifies if blending should be enabled */\n enableBlending) {\n this.name = name;\n this.targetProperty = targetProperty;\n this.framePerSecond = framePerSecond;\n this.dataType = dataType;\n this.loopMode = loopMode;\n this.enableBlending = enableBlending;\n /**\n * Stores the easing function of the animation\n */\n this._easingFunction = null;\n /**\n * @internal Internal use only\n */\n this._runtimeAnimations = new Array();\n /**\n * The set of event that will be linked to this animation\n */\n this._events = new Array();\n /**\n * Stores the blending speed of the animation\n */\n this.blendingSpeed = 0.01;\n /**\n * Stores the animation ranges for the animation\n */\n this._ranges = {};\n this.targetPropertyPath = targetProperty.split(\".\");\n this.dataType = dataType;\n this.loopMode = loopMode === undefined ? Animation.ANIMATIONLOOPMODE_CYCLE : loopMode;\n this.uniqueId = Animation._UniqueIdGenerator++;\n }\n // Methods\n /**\n * Converts the animation to a string\n * @param fullDetails support for multiple levels of logging within scene loading\n * @returns String form of the animation\n */\n toString(fullDetails) {\n let ret = \"Name: \" + this.name + \", property: \" + this.targetProperty;\n ret += \", datatype: \" + [\"Float\", \"Vector3\", \"Quaternion\", \"Matrix\", \"Color3\", \"Vector2\"][this.dataType];\n ret += \", nKeys: \" + (this._keys ? this._keys.length : \"none\");\n ret += \", nRanges: \" + (this._ranges ? Object.keys(this._ranges).length : \"none\");\n if (fullDetails) {\n ret += \", Ranges: {\";\n let first = true;\n for (const name in this._ranges) {\n if (first) {\n ret += \", \";\n first = false;\n }\n ret += name;\n }\n ret += \"}\";\n }\n return ret;\n }\n /**\n * Add an event to this animation\n * @param event Event to add\n */\n addEvent(event) {\n this._events.push(event);\n this._events.sort((a, b) => a.frame - b.frame);\n }\n /**\n * Remove all events found at the given frame\n * @param frame The frame to remove events from\n */\n removeEvents(frame) {\n for (let index = 0; index < this._events.length; index++) {\n if (this._events[index].frame === frame) {\n this._events.splice(index, 1);\n index--;\n }\n }\n }\n /**\n * Retrieves all the events from the animation\n * @returns Events from the animation\n */\n getEvents() {\n return this._events;\n }\n /**\n * Creates an animation range\n * @param name Name of the animation range\n * @param from Starting frame of the animation range\n * @param to Ending frame of the animation\n */\n createRange(name, from, to) {\n // check name not already in use; could happen for bones after serialized\n if (!this._ranges[name]) {\n this._ranges[name] = new AnimationRange(name, from, to);\n }\n }\n /**\n * Deletes an animation range by name\n * @param name Name of the animation range to delete\n * @param deleteFrames Specifies if the key frames for the range should also be deleted (true) or not (false)\n */\n deleteRange(name, deleteFrames = true) {\n const range = this._ranges[name];\n if (!range) {\n return;\n }\n if (deleteFrames) {\n const from = range.from;\n const to = range.to;\n // this loop MUST go high to low for multiple splices to work\n for (let key = this._keys.length - 1; key >= 0; key--) {\n if (this._keys[key].frame >= from && this._keys[key].frame <= to) {\n this._keys.splice(key, 1);\n }\n }\n }\n this._ranges[name] = null; // said much faster than 'delete this._range[name]'\n }\n /**\n * Gets the animation range by name, or null if not defined\n * @param name Name of the animation range\n * @returns Nullable animation range\n */\n getRange(name) {\n return this._ranges[name];\n }\n /**\n * Gets the key frames from the animation\n * @returns The key frames of the animation\n */\n getKeys() {\n return this._keys;\n }\n /**\n * Gets the highest frame rate of the animation\n * @returns Highest frame rate of the animation\n */\n getHighestFrame() {\n let ret = 0;\n for (let key = 0, nKeys = this._keys.length; key < nKeys; key++) {\n if (ret < this._keys[key].frame) {\n ret = this._keys[key].frame;\n }\n }\n return ret;\n }\n /**\n * Gets the easing function of the animation\n * @returns Easing function of the animation\n */\n getEasingFunction() {\n return this._easingFunction;\n }\n /**\n * Sets the easing function of the animation\n * @param easingFunction A custom mathematical formula for animation\n */\n setEasingFunction(easingFunction) {\n this._easingFunction = easingFunction;\n }\n /**\n * Interpolates a scalar linearly\n * @param startValue Start value of the animation curve\n * @param endValue End value of the animation curve\n * @param gradient Scalar amount to interpolate\n * @returns Interpolated scalar value\n */\n floatInterpolateFunction(startValue, endValue, gradient) {\n return Scalar.Lerp(startValue, endValue, gradient);\n }\n /**\n * Interpolates a scalar cubically\n * @param startValue Start value of the animation curve\n * @param outTangent End tangent of the animation\n * @param endValue End value of the animation curve\n * @param inTangent Start tangent of the animation curve\n * @param gradient Scalar amount to interpolate\n * @returns Interpolated scalar value\n */\n floatInterpolateFunctionWithTangents(startValue, outTangent, endValue, inTangent, gradient) {\n return Scalar.Hermite(startValue, outTangent, endValue, inTangent, gradient);\n }\n /**\n * Interpolates a quaternion using a spherical linear interpolation\n * @param startValue Start value of the animation curve\n * @param endValue End value of the animation curve\n * @param gradient Scalar amount to interpolate\n * @returns Interpolated quaternion value\n */\n quaternionInterpolateFunction(startValue, endValue, gradient) {\n return Quaternion.Slerp(startValue, endValue, gradient);\n }\n /**\n * Interpolates a quaternion cubically\n * @param startValue Start value of the animation curve\n * @param outTangent End tangent of the animation curve\n * @param endValue End value of the animation curve\n * @param inTangent Start tangent of the animation curve\n * @param gradient Scalar amount to interpolate\n * @returns Interpolated quaternion value\n */\n quaternionInterpolateFunctionWithTangents(startValue, outTangent, endValue, inTangent, gradient) {\n return Quaternion.Hermite(startValue, outTangent, endValue, inTangent, gradient).normalize();\n }\n /**\n * Interpolates a Vector3 linearly\n * @param startValue Start value of the animation curve\n * @param endValue End value of the animation curve\n * @param gradient Scalar amount to interpolate (value between 0 and 1)\n * @returns Interpolated scalar value\n */\n vector3InterpolateFunction(startValue, endValue, gradient) {\n return Vector3.Lerp(startValue, endValue, gradient);\n }\n /**\n * Interpolates a Vector3 cubically\n * @param startValue Start value of the animation curve\n * @param outTangent End tangent of the animation\n * @param endValue End value of the animation curve\n * @param inTangent Start tangent of the animation curve\n * @param gradient Scalar amount to interpolate (value between 0 and 1)\n * @returns InterpolatedVector3 value\n */\n vector3InterpolateFunctionWithTangents(startValue, outTangent, endValue, inTangent, gradient) {\n return Vector3.Hermite(startValue, outTangent, endValue, inTangent, gradient);\n }\n /**\n * Interpolates a Vector2 linearly\n * @param startValue Start value of the animation curve\n * @param endValue End value of the animation curve\n * @param gradient Scalar amount to interpolate (value between 0 and 1)\n * @returns Interpolated Vector2 value\n */\n vector2InterpolateFunction(startValue, endValue, gradient) {\n return Vector2.Lerp(startValue, endValue, gradient);\n }\n /**\n * Interpolates a Vector2 cubically\n * @param startValue Start value of the animation curve\n * @param outTangent End tangent of the animation\n * @param endValue End value of the animation curve\n * @param inTangent Start tangent of the animation curve\n * @param gradient Scalar amount to interpolate (value between 0 and 1)\n * @returns Interpolated Vector2 value\n */\n vector2InterpolateFunctionWithTangents(startValue, outTangent, endValue, inTangent, gradient) {\n return Vector2.Hermite(startValue, outTangent, endValue, inTangent, gradient);\n }\n /**\n * Interpolates a size linearly\n * @param startValue Start value of the animation curve\n * @param endValue End value of the animation curve\n * @param gradient Scalar amount to interpolate\n * @returns Interpolated Size value\n */\n sizeInterpolateFunction(startValue, endValue, gradient) {\n return Size.Lerp(startValue, endValue, gradient);\n }\n /**\n * Interpolates a Color3 linearly\n * @param startValue Start value of the animation curve\n * @param endValue End value of the animation curve\n * @param gradient Scalar amount to interpolate\n * @returns Interpolated Color3 value\n */\n color3InterpolateFunction(startValue, endValue, gradient) {\n return Color3.Lerp(startValue, endValue, gradient);\n }\n /**\n * Interpolates a Color3 cubically\n * @param startValue Start value of the animation curve\n * @param outTangent End tangent of the animation\n * @param endValue End value of the animation curve\n * @param inTangent Start tangent of the animation curve\n * @param gradient Scalar amount to interpolate\n * @returns interpolated value\n */\n color3InterpolateFunctionWithTangents(startValue, outTangent, endValue, inTangent, gradient) {\n return Color3.Hermite(startValue, outTangent, endValue, inTangent, gradient);\n }\n /**\n * Interpolates a Color4 linearly\n * @param startValue Start value of the animation curve\n * @param endValue End value of the animation curve\n * @param gradient Scalar amount to interpolate\n * @returns Interpolated Color3 value\n */\n color4InterpolateFunction(startValue, endValue, gradient) {\n return Color4.Lerp(startValue, endValue, gradient);\n }\n /**\n * Interpolates a Color4 cubically\n * @param startValue Start value of the animation curve\n * @param outTangent End tangent of the animation\n * @param endValue End value of the animation curve\n * @param inTangent Start tangent of the animation curve\n * @param gradient Scalar amount to interpolate\n * @returns interpolated value\n */\n color4InterpolateFunctionWithTangents(startValue, outTangent, endValue, inTangent, gradient) {\n return Color4.Hermite(startValue, outTangent, endValue, inTangent, gradient);\n }\n /**\n * @internal Internal use only\n */\n _getKeyValue(value) {\n if (typeof value === \"function\") {\n return value();\n }\n return value;\n }\n /**\n * Evaluate the animation value at a given frame\n * @param currentFrame defines the frame where we want to evaluate the animation\n * @returns the animation value\n */\n evaluate(currentFrame) {\n evaluateAnimationState.key = 0;\n return this._interpolate(currentFrame, evaluateAnimationState);\n }\n /**\n * @internal Internal use only\n */\n _interpolate(currentFrame, state, searchClosestKeyOnly = false) {\n if (state.loopMode === Animation.ANIMATIONLOOPMODE_CONSTANT && state.repeatCount > 0) {\n return state.highLimitValue.clone ? state.highLimitValue.clone() : state.highLimitValue;\n }\n const keys = this._keys;\n const keysLength = keys.length;\n let key = state.key;\n while (key >= 0 && currentFrame < keys[key].frame) {\n --key;\n }\n while (key + 1 <= keysLength - 1 && currentFrame >= keys[key + 1].frame) {\n ++key;\n }\n state.key = key;\n if (key < 0) {\n return searchClosestKeyOnly ? undefined : this._getKeyValue(keys[0].value);\n }\n else if (key + 1 > keysLength - 1) {\n return searchClosestKeyOnly ? undefined : this._getKeyValue(keys[keysLength - 1].value);\n }\n const startKey = keys[key];\n const endKey = keys[key + 1];\n if (searchClosestKeyOnly && (currentFrame === startKey.frame || currentFrame === endKey.frame)) {\n return undefined;\n }\n const startValue = this._getKeyValue(startKey.value);\n const endValue = this._getKeyValue(endKey.value);\n if (startKey.interpolation === AnimationKeyInterpolation.STEP) {\n if (endKey.frame > currentFrame) {\n return startValue;\n }\n else {\n return endValue;\n }\n }\n const useTangent = startKey.outTangent !== undefined && endKey.inTangent !== undefined;\n const frameDelta = endKey.frame - startKey.frame;\n // gradient : percent of currentFrame between the frame inf and the frame sup\n let gradient = (currentFrame - startKey.frame) / frameDelta;\n // check for easingFunction and correction of gradient\n const easingFunction = this.getEasingFunction();\n if (easingFunction !== null) {\n gradient = easingFunction.ease(gradient);\n }\n switch (this.dataType) {\n // Float\n case Animation.ANIMATIONTYPE_FLOAT: {\n const floatValue = useTangent\n ? this.floatInterpolateFunctionWithTangents(startValue, startKey.outTangent * frameDelta, endValue, endKey.inTangent * frameDelta, gradient)\n : this.floatInterpolateFunction(startValue, endValue, gradient);\n switch (state.loopMode) {\n case Animation.ANIMATIONLOOPMODE_CYCLE:\n case Animation.ANIMATIONLOOPMODE_CONSTANT:\n case Animation.ANIMATIONLOOPMODE_YOYO:\n return floatValue;\n case Animation.ANIMATIONLOOPMODE_RELATIVE:\n return state.offsetValue * state.repeatCount + floatValue;\n }\n break;\n }\n // Quaternion\n case Animation.ANIMATIONTYPE_QUATERNION: {\n const quatValue = useTangent\n ? this.quaternionInterpolateFunctionWithTangents(startValue, startKey.outTangent.scale(frameDelta), endValue, endKey.inTangent.scale(frameDelta), gradient)\n : this.quaternionInterpolateFunction(startValue, endValue, gradient);\n switch (state.loopMode) {\n case Animation.ANIMATIONLOOPMODE_CYCLE:\n case Animation.ANIMATIONLOOPMODE_CONSTANT:\n case Animation.ANIMATIONLOOPMODE_YOYO:\n return quatValue;\n case Animation.ANIMATIONLOOPMODE_RELATIVE:\n return quatValue.addInPlace(state.offsetValue.scale(state.repeatCount));\n }\n return quatValue;\n }\n // Vector3\n case Animation.ANIMATIONTYPE_VECTOR3: {\n const vec3Value = useTangent\n ? this.vector3InterpolateFunctionWithTangents(startValue, startKey.outTangent.scale(frameDelta), endValue, endKey.inTangent.scale(frameDelta), gradient)\n : this.vector3InterpolateFunction(startValue, endValue, gradient);\n switch (state.loopMode) {\n case Animation.ANIMATIONLOOPMODE_CYCLE:\n case Animation.ANIMATIONLOOPMODE_CONSTANT:\n case Animation.ANIMATIONLOOPMODE_YOYO:\n return vec3Value;\n case Animation.ANIMATIONLOOPMODE_RELATIVE:\n return vec3Value.add(state.offsetValue.scale(state.repeatCount));\n }\n break;\n }\n // Vector2\n case Animation.ANIMATIONTYPE_VECTOR2: {\n const vec2Value = useTangent\n ? this.vector2InterpolateFunctionWithTangents(startValue, startKey.outTangent.scale(frameDelta), endValue, endKey.inTangent.scale(frameDelta), gradient)\n : this.vector2InterpolateFunction(startValue, endValue, gradient);\n switch (state.loopMode) {\n case Animation.ANIMATIONLOOPMODE_CYCLE:\n case Animation.ANIMATIONLOOPMODE_CONSTANT:\n case Animation.ANIMATIONLOOPMODE_YOYO:\n return vec2Value;\n case Animation.ANIMATIONLOOPMODE_RELATIVE:\n return vec2Value.add(state.offsetValue.scale(state.repeatCount));\n }\n break;\n }\n // Size\n case Animation.ANIMATIONTYPE_SIZE: {\n switch (state.loopMode) {\n case Animation.ANIMATIONLOOPMODE_CYCLE:\n case Animation.ANIMATIONLOOPMODE_CONSTANT:\n case Animation.ANIMATIONLOOPMODE_YOYO:\n return this.sizeInterpolateFunction(startValue, endValue, gradient);\n case Animation.ANIMATIONLOOPMODE_RELATIVE:\n return this.sizeInterpolateFunction(startValue, endValue, gradient).add(state.offsetValue.scale(state.repeatCount));\n }\n break;\n }\n // Color3\n case Animation.ANIMATIONTYPE_COLOR3: {\n const color3Value = useTangent\n ? this.color3InterpolateFunctionWithTangents(startValue, startKey.outTangent.scale(frameDelta), endValue, endKey.inTangent.scale(frameDelta), gradient)\n : this.color3InterpolateFunction(startValue, endValue, gradient);\n switch (state.loopMode) {\n case Animation.ANIMATIONLOOPMODE_CYCLE:\n case Animation.ANIMATIONLOOPMODE_CONSTANT:\n case Animation.ANIMATIONLOOPMODE_YOYO:\n return color3Value;\n case Animation.ANIMATIONLOOPMODE_RELATIVE:\n return color3Value.add(state.offsetValue.scale(state.repeatCount));\n }\n break;\n }\n // Color4\n case Animation.ANIMATIONTYPE_COLOR4: {\n const color4Value = useTangent\n ? this.color4InterpolateFunctionWithTangents(startValue, startKey.outTangent.scale(frameDelta), endValue, endKey.inTangent.scale(frameDelta), gradient)\n : this.color4InterpolateFunction(startValue, endValue, gradient);\n switch (state.loopMode) {\n case Animation.ANIMATIONLOOPMODE_CYCLE:\n case Animation.ANIMATIONLOOPMODE_CONSTANT:\n case Animation.ANIMATIONLOOPMODE_YOYO:\n return color4Value;\n case Animation.ANIMATIONLOOPMODE_RELATIVE:\n return color4Value.add(state.offsetValue.scale(state.repeatCount));\n }\n break;\n }\n // Matrix\n case Animation.ANIMATIONTYPE_MATRIX: {\n switch (state.loopMode) {\n case Animation.ANIMATIONLOOPMODE_CYCLE:\n case Animation.ANIMATIONLOOPMODE_CONSTANT:\n case Animation.ANIMATIONLOOPMODE_YOYO: {\n if (Animation.AllowMatricesInterpolation) {\n return this.matrixInterpolateFunction(startValue, endValue, gradient, state.workValue);\n }\n return startValue;\n }\n case Animation.ANIMATIONLOOPMODE_RELATIVE: {\n return startValue;\n }\n }\n break;\n }\n }\n return 0;\n }\n /**\n * Defines the function to use to interpolate matrices\n * @param startValue defines the start matrix\n * @param endValue defines the end matrix\n * @param gradient defines the gradient between both matrices\n * @param result defines an optional target matrix where to store the interpolation\n * @returns the interpolated matrix\n */\n matrixInterpolateFunction(startValue, endValue, gradient, result) {\n if (Animation.AllowMatrixDecomposeForInterpolation) {\n if (result) {\n Matrix.DecomposeLerpToRef(startValue, endValue, gradient, result);\n return result;\n }\n return Matrix.DecomposeLerp(startValue, endValue, gradient);\n }\n if (result) {\n Matrix.LerpToRef(startValue, endValue, gradient, result);\n return result;\n }\n return Matrix.Lerp(startValue, endValue, gradient);\n }\n /**\n * Makes a copy of the animation\n * @returns Cloned animation\n */\n clone() {\n const clone = new Animation(this.name, this.targetPropertyPath.join(\".\"), this.framePerSecond, this.dataType, this.loopMode);\n clone.enableBlending = this.enableBlending;\n clone.blendingSpeed = this.blendingSpeed;\n if (this._keys) {\n clone.setKeys(this._keys);\n }\n if (this._ranges) {\n clone._ranges = {};\n for (const name in this._ranges) {\n const range = this._ranges[name];\n if (!range) {\n continue;\n }\n clone._ranges[name] = range.clone();\n }\n }\n return clone;\n }\n /**\n * Sets the key frames of the animation\n * @param values The animation key frames to set\n * @param dontClone Whether to clone the keys or not (default is false, so the array of keys is cloned)\n */\n setKeys(values, dontClone = false) {\n this._keys = !dontClone ? values.slice(0) : values;\n }\n /**\n * Creates a key for the frame passed as a parameter and adds it to the animation IF a key doesn't already exist for that frame\n * @param frame Frame number\n * @returns The key index if the key was added or the index of the pre existing key if the frame passed as parameter already has a corresponding key\n */\n createKeyForFrame(frame) {\n // Find the key corresponding to frame\n evaluateAnimationState.key = 0;\n const value = this._interpolate(frame, evaluateAnimationState, true);\n if (!value) {\n // A key corresponding to this frame already exists\n return evaluateAnimationState.key === frame ? evaluateAnimationState.key : evaluateAnimationState.key + 1;\n }\n // The frame is between two keys, so create a new key\n const newKey = {\n frame,\n value: value.clone ? value.clone() : value,\n };\n this._keys.splice(evaluateAnimationState.key + 1, 0, newKey);\n return evaluateAnimationState.key + 1;\n }\n /**\n * Serializes the animation to an object\n * @returns Serialized object\n */\n serialize() {\n const serializationObject = {};\n serializationObject.name = this.name;\n serializationObject.property = this.targetProperty;\n serializationObject.framePerSecond = this.framePerSecond;\n serializationObject.dataType = this.dataType;\n serializationObject.loopBehavior = this.loopMode;\n serializationObject.enableBlending = this.enableBlending;\n serializationObject.blendingSpeed = this.blendingSpeed;\n const dataType = this.dataType;\n serializationObject.keys = [];\n const keys = this.getKeys();\n for (let index = 0; index < keys.length; index++) {\n const animationKey = keys[index];\n const key = {};\n key.frame = animationKey.frame;\n switch (dataType) {\n case Animation.ANIMATIONTYPE_FLOAT:\n key.values = [animationKey.value];\n if (animationKey.inTangent !== undefined) {\n key.values.push(animationKey.inTangent);\n }\n if (animationKey.outTangent !== undefined) {\n if (animationKey.inTangent === undefined) {\n key.values.push(undefined);\n }\n key.values.push(animationKey.outTangent);\n }\n if (animationKey.interpolation !== undefined) {\n if (animationKey.inTangent === undefined) {\n key.values.push(undefined);\n }\n if (animationKey.outTangent === undefined) {\n key.values.push(undefined);\n }\n key.values.push(animationKey.interpolation);\n }\n break;\n case Animation.ANIMATIONTYPE_QUATERNION:\n case Animation.ANIMATIONTYPE_MATRIX:\n case Animation.ANIMATIONTYPE_VECTOR3:\n case Animation.ANIMATIONTYPE_COLOR3:\n case Animation.ANIMATIONTYPE_COLOR4:\n key.values = animationKey.value.asArray();\n if (animationKey.inTangent != undefined) {\n key.values.push(animationKey.inTangent.asArray());\n }\n if (animationKey.outTangent != undefined) {\n if (animationKey.inTangent === undefined) {\n key.values.push(undefined);\n }\n key.values.push(animationKey.outTangent.asArray());\n }\n if (animationKey.interpolation !== undefined) {\n if (animationKey.inTangent === undefined) {\n key.values.push(undefined);\n }\n if (animationKey.outTangent === undefined) {\n key.values.push(undefined);\n }\n key.values.push(animationKey.interpolation);\n }\n break;\n }\n serializationObject.keys.push(key);\n }\n serializationObject.ranges = [];\n for (const name in this._ranges) {\n const source = this._ranges[name];\n if (!source) {\n continue;\n }\n const range = {};\n range.name = name;\n range.from = source.from;\n range.to = source.to;\n serializationObject.ranges.push(range);\n }\n return serializationObject;\n }\n /**\n * @internal\n */\n static _UniversalLerp(left, right, amount) {\n const constructor = left.constructor;\n if (constructor.Lerp) {\n // Lerp supported\n return constructor.Lerp(left, right, amount);\n }\n else if (constructor.Slerp) {\n // Slerp supported\n return constructor.Slerp(left, right, amount);\n }\n else if (left.toFixed) {\n // Number\n return left * (1.0 - amount) + amount * right;\n }\n else {\n // Blending not supported\n return right;\n }\n }\n /**\n * Parses an animation object and creates an animation\n * @param parsedAnimation Parsed animation object\n * @returns Animation object\n */\n static Parse(parsedAnimation) {\n const animation = new Animation(parsedAnimation.name, parsedAnimation.property, parsedAnimation.framePerSecond, parsedAnimation.dataType, parsedAnimation.loopBehavior);\n const dataType = parsedAnimation.dataType;\n const keys = [];\n let data;\n let index;\n if (parsedAnimation.enableBlending) {\n animation.enableBlending = parsedAnimation.enableBlending;\n }\n if (parsedAnimation.blendingSpeed) {\n animation.blendingSpeed = parsedAnimation.blendingSpeed;\n }\n for (index = 0; index < parsedAnimation.keys.length; index++) {\n const key = parsedAnimation.keys[index];\n let inTangent = undefined;\n let outTangent = undefined;\n let interpolation = undefined;\n switch (dataType) {\n case Animation.ANIMATIONTYPE_FLOAT:\n data = key.values[0];\n if (key.values.length >= 2) {\n inTangent = key.values[1];\n }\n if (key.values.length >= 3) {\n outTangent = key.values[2];\n }\n if (key.values.length >= 4) {\n interpolation = key.values[3];\n }\n break;\n case Animation.ANIMATIONTYPE_QUATERNION:\n data = Quaternion.FromArray(key.values);\n if (key.values.length >= 8) {\n const _inTangent = Quaternion.FromArray(key.values.slice(4, 8));\n if (!_inTangent.equals(Quaternion.Zero())) {\n inTangent = _inTangent;\n }\n }\n if (key.values.length >= 12) {\n const _outTangent = Quaternion.FromArray(key.values.slice(8, 12));\n if (!_outTangent.equals(Quaternion.Zero())) {\n outTangent = _outTangent;\n }\n }\n if (key.values.length >= 13) {\n interpolation = key.values[12];\n }\n break;\n case Animation.ANIMATIONTYPE_MATRIX:\n data = Matrix.FromArray(key.values);\n if (key.values.length >= 17) {\n interpolation = key.values[16];\n }\n break;\n case Animation.ANIMATIONTYPE_COLOR3:\n data = Color3.FromArray(key.values);\n if (key.values[3]) {\n inTangent = Color3.FromArray(key.values[3]);\n }\n if (key.values[4]) {\n outTangent = Color3.FromArray(key.values[4]);\n }\n if (key.values[5]) {\n interpolation = key.values[5];\n }\n break;\n case Animation.ANIMATIONTYPE_COLOR4:\n data = Color4.FromArray(key.values);\n if (key.values[4]) {\n inTangent = Color4.FromArray(key.values[4]);\n }\n if (key.values[5]) {\n outTangent = Color4.FromArray(key.values[5]);\n }\n if (key.values[6]) {\n interpolation = Color4.FromArray(key.values[6]);\n }\n break;\n case Animation.ANIMATIONTYPE_VECTOR3:\n default:\n data = Vector3.FromArray(key.values);\n if (key.values[3]) {\n inTangent = Vector3.FromArray(key.values[3]);\n }\n if (key.values[4]) {\n outTangent = Vector3.FromArray(key.values[4]);\n }\n if (key.values[5]) {\n interpolation = key.values[5];\n }\n break;\n }\n const keyData = {};\n keyData.frame = key.frame;\n keyData.value = data;\n if (inTangent != undefined) {\n keyData.inTangent = inTangent;\n }\n if (outTangent != undefined) {\n keyData.outTangent = outTangent;\n }\n if (interpolation != undefined) {\n keyData.interpolation = interpolation;\n }\n keys.push(keyData);\n }\n animation.setKeys(keys);\n if (parsedAnimation.ranges) {\n for (index = 0; index < parsedAnimation.ranges.length; index++) {\n data = parsedAnimation.ranges[index];\n animation.createRange(data.name, data.from, data.to);\n }\n }\n return animation;\n }\n /**\n * Appends the serialized animations from the source animations\n * @param source Source containing the animations\n * @param destination Target to store the animations\n */\n static AppendSerializedAnimations(source, destination) {\n SerializationHelper.AppendSerializedAnimations(source, destination);\n }\n /**\n * Creates a new animation or an array of animations from a snippet saved in a remote file\n * @param name defines the name of the animation to create (can be null or empty to use the one from the json data)\n * @param url defines the url to load from\n * @returns a promise that will resolve to the new animation or an array of animations\n */\n static ParseFromFileAsync(name, url) {\n return new Promise((resolve, reject) => {\n const request = new WebRequest();\n request.addEventListener(\"readystatechange\", () => {\n if (request.readyState == 4) {\n if (request.status == 200) {\n let serializationObject = JSON.parse(request.responseText);\n if (serializationObject.animations) {\n serializationObject = serializationObject.animations;\n }\n if (serializationObject.length) {\n const output = new Array();\n for (const serializedAnimation of serializationObject) {\n output.push(this.Parse(serializedAnimation));\n }\n resolve(output);\n }\n else {\n const output = this.Parse(serializationObject);\n if (name) {\n output.name = name;\n }\n resolve(output);\n }\n }\n else {\n reject(\"Unable to load the animation\");\n }\n }\n });\n request.open(\"GET\", url);\n request.send();\n });\n }\n /**\n * Creates an animation or an array of animations from a snippet saved by the Inspector\n * @param snippetId defines the snippet to load\n * @returns a promise that will resolve to the new animation or a new array of animations\n */\n static ParseFromSnippetAsync(snippetId) {\n return new Promise((resolve, reject) => {\n const request = new WebRequest();\n request.addEventListener(\"readystatechange\", () => {\n if (request.readyState == 4) {\n if (request.status == 200) {\n const snippet = JSON.parse(JSON.parse(request.responseText).jsonPayload);\n if (snippet.animations) {\n const serializationObject = JSON.parse(snippet.animations);\n const outputs = new Array();\n for (const serializedAnimation of serializationObject.animations) {\n const output = this.Parse(serializedAnimation);\n output.snippetId = snippetId;\n outputs.push(output);\n }\n resolve(outputs);\n }\n else {\n const serializationObject = JSON.parse(snippet.animation);\n const output = this.Parse(serializationObject);\n output.snippetId = snippetId;\n resolve(output);\n }\n }\n else {\n reject(\"Unable to load the snippet \" + snippetId);\n }\n }\n });\n request.open(\"GET\", this.SnippetUrl + \"/\" + snippetId.replace(/#/g, \"/\"));\n request.send();\n });\n }\n}\nAnimation._UniqueIdGenerator = 0;\n/**\n * Use matrix interpolation instead of using direct key value when animating matrices\n */\nAnimation.AllowMatricesInterpolation = false;\n/**\n * When matrix interpolation is enabled, this boolean forces the system to use Matrix.DecomposeLerp instead of Matrix.Lerp. Interpolation is more precise but slower\n */\nAnimation.AllowMatrixDecomposeForInterpolation = true;\n/** Define the Url to load snippets */\nAnimation.SnippetUrl = `https://snippet.babylonjs.com`;\n// Statics\n/**\n * Float animation type\n */\nAnimation.ANIMATIONTYPE_FLOAT = 0;\n/**\n * Vector3 animation type\n */\nAnimation.ANIMATIONTYPE_VECTOR3 = 1;\n/**\n * Quaternion animation type\n */\nAnimation.ANIMATIONTYPE_QUATERNION = 2;\n/**\n * Matrix animation type\n */\nAnimation.ANIMATIONTYPE_MATRIX = 3;\n/**\n * Color3 animation type\n */\nAnimation.ANIMATIONTYPE_COLOR3 = 4;\n/**\n * Color3 animation type\n */\nAnimation.ANIMATIONTYPE_COLOR4 = 7;\n/**\n * Vector2 animation type\n */\nAnimation.ANIMATIONTYPE_VECTOR2 = 5;\n/**\n * Size animation type\n */\nAnimation.ANIMATIONTYPE_SIZE = 6;\n/**\n * Relative Loop Mode\n */\nAnimation.ANIMATIONLOOPMODE_RELATIVE = 0;\n/**\n * Cycle Loop Mode\n */\nAnimation.ANIMATIONLOOPMODE_CYCLE = 1;\n/**\n * Constant Loop Mode\n */\nAnimation.ANIMATIONLOOPMODE_CONSTANT = 2;\n/**\n * Yoyo Loop Mode\n */\nAnimation.ANIMATIONLOOPMODE_YOYO = 4;\n/**\n * Creates an animation or an array of animations from a snippet saved by the Inspector\n * @deprecated Please use ParseFromSnippetAsync instead\n * @param snippetId defines the snippet to load\n * @returns a promise that will resolve to the new animation or a new array of animations\n */\nAnimation.CreateFromSnippetAsync = Animation.ParseFromSnippetAsync;\nRegisterClass(\"BABYLON.Animation\", Animation);\nNode._AnimationRangeFactory = (name, from, to) => new AnimationRange(name, from, to);\n//# sourceMappingURL=animation.js.map","import { Scalar } from \"./math.scalar.js\";\nimport { Vector2, Vector3, Quaternion, Matrix } from \"./math.vector.js\";\nimport { Epsilon } from \"./math.constants.js\";\n/**\n * Defines potential orientation for back face culling\n */\nexport var Orientation;\n(function (Orientation) {\n /**\n * Clockwise\n */\n Orientation[Orientation[\"CW\"] = 0] = \"CW\";\n /** Counter clockwise */\n Orientation[Orientation[\"CCW\"] = 1] = \"CCW\";\n})(Orientation || (Orientation = {}));\n/** Class used to represent a Bezier curve */\nexport class BezierCurve {\n /**\n * Returns the cubic Bezier interpolated value (float) at \"t\" (float) from the given x1, y1, x2, y2 floats\n * @param t defines the time\n * @param x1 defines the left coordinate on X axis\n * @param y1 defines the left coordinate on Y axis\n * @param x2 defines the right coordinate on X axis\n * @param y2 defines the right coordinate on Y axis\n * @returns the interpolated value\n */\n static Interpolate(t, x1, y1, x2, y2) {\n // Extract X (which is equal to time here)\n const f0 = 1 - 3 * x2 + 3 * x1;\n const f1 = 3 * x2 - 6 * x1;\n const f2 = 3 * x1;\n let refinedT = t;\n for (let i = 0; i < 5; i++) {\n const refinedT2 = refinedT * refinedT;\n const refinedT3 = refinedT2 * refinedT;\n const x = f0 * refinedT3 + f1 * refinedT2 + f2 * refinedT;\n const slope = 1.0 / (3.0 * f0 * refinedT2 + 2.0 * f1 * refinedT + f2);\n refinedT -= (x - t) * slope;\n refinedT = Math.min(1, Math.max(0, refinedT));\n }\n // Resolve cubic bezier for the given x\n return 3 * Math.pow(1 - refinedT, 2) * refinedT * y1 + 3 * (1 - refinedT) * Math.pow(refinedT, 2) * y2 + Math.pow(refinedT, 3);\n }\n}\n/**\n * Defines angle representation\n */\nexport class Angle {\n /**\n * Creates an Angle object of \"radians\" radians (float).\n * @param radians the angle in radians\n */\n constructor(radians) {\n this._radians = radians;\n if (this._radians < 0.0) {\n this._radians += 2.0 * Math.PI;\n }\n }\n /**\n * Get value in degrees\n * @returns the Angle value in degrees (float)\n */\n degrees() {\n return (this._radians * 180.0) / Math.PI;\n }\n /**\n * Get value in radians\n * @returns the Angle value in radians (float)\n */\n radians() {\n return this._radians;\n }\n /**\n * Gets a new Angle object valued with the gradient angle, in radians, of the line joining two points\n * @param a defines first point as the origin\n * @param b defines point\n * @returns a new Angle\n */\n static BetweenTwoPoints(a, b) {\n const delta = b.subtract(a);\n const theta = Math.atan2(delta.y, delta.x);\n return new Angle(theta);\n }\n /**\n * Gets a new Angle object from the given float in radians\n * @param radians defines the angle value in radians\n * @returns a new Angle\n */\n static FromRadians(radians) {\n return new Angle(radians);\n }\n /**\n * Gets a new Angle object from the given float in degrees\n * @param degrees defines the angle value in degrees\n * @returns a new Angle\n */\n static FromDegrees(degrees) {\n return new Angle((degrees * Math.PI) / 180.0);\n }\n}\n/**\n * This represents an arc in a 2d space.\n */\nexport class Arc2 {\n /**\n * Creates an Arc object from the three given points : start, middle and end.\n * @param startPoint Defines the start point of the arc\n * @param midPoint Defines the middle point of the arc\n * @param endPoint Defines the end point of the arc\n */\n constructor(\n /** Defines the start point of the arc */\n startPoint, \n /** Defines the mid point of the arc */\n midPoint, \n /** Defines the end point of the arc */\n endPoint) {\n this.startPoint = startPoint;\n this.midPoint = midPoint;\n this.endPoint = endPoint;\n const temp = Math.pow(midPoint.x, 2) + Math.pow(midPoint.y, 2);\n const startToMid = (Math.pow(startPoint.x, 2) + Math.pow(startPoint.y, 2) - temp) / 2;\n const midToEnd = (temp - Math.pow(endPoint.x, 2) - Math.pow(endPoint.y, 2)) / 2;\n const det = (startPoint.x - midPoint.x) * (midPoint.y - endPoint.y) - (midPoint.x - endPoint.x) * (startPoint.y - midPoint.y);\n this.centerPoint = new Vector2((startToMid * (midPoint.y - endPoint.y) - midToEnd * (startPoint.y - midPoint.y)) / det, ((startPoint.x - midPoint.x) * midToEnd - (midPoint.x - endPoint.x) * startToMid) / det);\n this.radius = this.centerPoint.subtract(this.startPoint).length();\n this.startAngle = Angle.BetweenTwoPoints(this.centerPoint, this.startPoint);\n const a1 = this.startAngle.degrees();\n let a2 = Angle.BetweenTwoPoints(this.centerPoint, this.midPoint).degrees();\n let a3 = Angle.BetweenTwoPoints(this.centerPoint, this.endPoint).degrees();\n // angles correction\n if (a2 - a1 > +180.0) {\n a2 -= 360.0;\n }\n if (a2 - a1 < -180.0) {\n a2 += 360.0;\n }\n if (a3 - a2 > +180.0) {\n a3 -= 360.0;\n }\n if (a3 - a2 < -180.0) {\n a3 += 360.0;\n }\n this.orientation = a2 - a1 < 0 ? Orientation.CW : Orientation.CCW;\n this.angle = Angle.FromDegrees(this.orientation === Orientation.CW ? a1 - a3 : a3 - a1);\n }\n}\n/**\n * Represents a 2D path made up of multiple 2D points\n */\nexport class Path2 {\n /**\n * Creates a Path2 object from the starting 2D coordinates x and y.\n * @param x the starting points x value\n * @param y the starting points y value\n */\n constructor(x, y) {\n this._points = new Array();\n this._length = 0.0;\n /**\n * If the path start and end point are the same\n */\n this.closed = false;\n this._points.push(new Vector2(x, y));\n }\n /**\n * Adds a new segment until the given coordinates (x, y) to the current Path2.\n * @param x the added points x value\n * @param y the added points y value\n * @returns the updated Path2.\n */\n addLineTo(x, y) {\n if (this.closed) {\n return this;\n }\n const newPoint = new Vector2(x, y);\n const previousPoint = this._points[this._points.length - 1];\n this._points.push(newPoint);\n this._length += newPoint.subtract(previousPoint).length();\n return this;\n }\n /**\n * Adds _numberOfSegments_ segments according to the arc definition (middle point coordinates, end point coordinates, the arc start point being the current Path2 last point) to the current Path2.\n * @param midX middle point x value\n * @param midY middle point y value\n * @param endX end point x value\n * @param endY end point y value\n * @param numberOfSegments (default: 36)\n * @returns the updated Path2.\n */\n addArcTo(midX, midY, endX, endY, numberOfSegments = 36) {\n if (this.closed) {\n return this;\n }\n const startPoint = this._points[this._points.length - 1];\n const midPoint = new Vector2(midX, midY);\n const endPoint = new Vector2(endX, endY);\n const arc = new Arc2(startPoint, midPoint, endPoint);\n let increment = arc.angle.radians() / numberOfSegments;\n if (arc.orientation === Orientation.CW) {\n increment *= -1;\n }\n let currentAngle = arc.startAngle.radians() + increment;\n for (let i = 0; i < numberOfSegments; i++) {\n const x = Math.cos(currentAngle) * arc.radius + arc.centerPoint.x;\n const y = Math.sin(currentAngle) * arc.radius + arc.centerPoint.y;\n this.addLineTo(x, y);\n currentAngle += increment;\n }\n return this;\n }\n /**\n * Adds _numberOfSegments_ segments according to the quadratic curve definition to the current Path2.\n * @param controlX control point x value\n * @param controlY control point y value\n * @param endX end point x value\n * @param endY end point y value\n * @param numberOfSegments (default: 36)\n * @returns the updated Path2.\n */\n addQuadraticCurveTo(controlX, controlY, endX, endY, numberOfSegments = 36) {\n if (this.closed) {\n return this;\n }\n const equation = (t, val0, val1, val2) => {\n const res = (1.0 - t) * (1.0 - t) * val0 + 2.0 * t * (1.0 - t) * val1 + t * t * val2;\n return res;\n };\n const startPoint = this._points[this._points.length - 1];\n for (let i = 0; i <= numberOfSegments; i++) {\n const step = i / numberOfSegments;\n const x = equation(step, startPoint.x, controlX, endX);\n const y = equation(step, startPoint.y, controlY, endY);\n this.addLineTo(x, y);\n }\n return this;\n }\n /**\n * Adds _numberOfSegments_ segments according to the bezier curve definition to the current Path2.\n * @param originTangentX tangent vector at the origin point x value\n * @param originTangentY tangent vector at the origin point y value\n * @param destinationTangentX tangent vector at the destination point x value\n * @param destinationTangentY tangent vector at the destination point y value\n * @param endX end point x value\n * @param endY end point y value\n * @param numberOfSegments (default: 36)\n * @returns the updated Path2.\n */\n addBezierCurveTo(originTangentX, originTangentY, destinationTangentX, destinationTangentY, endX, endY, numberOfSegments = 36) {\n if (this.closed) {\n return this;\n }\n const equation = (t, val0, val1, val2, val3) => {\n const res = (1.0 - t) * (1.0 - t) * (1.0 - t) * val0 + 3.0 * t * (1.0 - t) * (1.0 - t) * val1 + 3.0 * t * t * (1.0 - t) * val2 + t * t * t * val3;\n return res;\n };\n const startPoint = this._points[this._points.length - 1];\n for (let i = 0; i <= numberOfSegments; i++) {\n const step = i / numberOfSegments;\n const x = equation(step, startPoint.x, originTangentX, destinationTangentX, endX);\n const y = equation(step, startPoint.y, originTangentY, destinationTangentY, endY);\n this.addLineTo(x, y);\n }\n return this;\n }\n /**\n * Defines if a given point is inside the polygon defines by the path\n * @param point defines the point to test\n * @returns true if the point is inside\n */\n isPointInside(point) {\n let isInside = false;\n const count = this._points.length;\n for (let p = count - 1, q = 0; q < count; p = q++) {\n let edgeLow = this._points[p];\n let edgeHigh = this._points[q];\n let edgeDx = edgeHigh.x - edgeLow.x;\n let edgeDy = edgeHigh.y - edgeLow.y;\n if (Math.abs(edgeDy) > Number.EPSILON) {\n // Not parallel\n if (edgeDy < 0) {\n edgeLow = this._points[q];\n edgeDx = -edgeDx;\n edgeHigh = this._points[p];\n edgeDy = -edgeDy;\n }\n if (point.y < edgeLow.y || point.y > edgeHigh.y) {\n continue;\n }\n if (point.y === edgeLow.y && point.x === edgeLow.x) {\n return true;\n }\n else {\n const perpEdge = edgeDy * (point.x - edgeLow.x) - edgeDx * (point.y - edgeLow.y);\n if (perpEdge === 0) {\n return true;\n }\n if (perpEdge < 0) {\n continue;\n }\n isInside = !isInside;\n }\n }\n else {\n // parallel or collinear\n if (point.y !== edgeLow.y) {\n continue;\n }\n if ((edgeHigh.x <= point.x && point.x <= edgeLow.x) || (edgeLow.x <= point.x && point.x <= edgeHigh.x)) {\n return true;\n }\n }\n }\n return isInside;\n }\n /**\n * Closes the Path2.\n * @returns the Path2.\n */\n close() {\n this.closed = true;\n return this;\n }\n /**\n * Gets the sum of the distance between each sequential point in the path\n * @returns the Path2 total length (float).\n */\n length() {\n let result = this._length;\n if (this.closed) {\n const lastPoint = this._points[this._points.length - 1];\n const firstPoint = this._points[0];\n result += firstPoint.subtract(lastPoint).length();\n }\n return result;\n }\n /**\n * Gets the area of the polygon defined by the path\n * @returns area value\n */\n area() {\n const n = this._points.length;\n let value = 0.0;\n for (let p = n - 1, q = 0; q < n; p = q++) {\n value += this._points[p].x * this._points[q].y - this._points[q].x * this._points[p].y;\n }\n return value * 0.5;\n }\n /**\n * Gets the points which construct the path\n * @returns the Path2 internal array of points.\n */\n getPoints() {\n return this._points;\n }\n /**\n * Retreives the point at the distance aways from the starting point\n * @param normalizedLengthPosition the length along the path to retrieve the point from\n * @returns a new Vector2 located at a percentage of the Path2 total length on this path.\n */\n getPointAtLengthPosition(normalizedLengthPosition) {\n if (normalizedLengthPosition < 0 || normalizedLengthPosition > 1) {\n return Vector2.Zero();\n }\n const lengthPosition = normalizedLengthPosition * this.length();\n let previousOffset = 0;\n for (let i = 0; i < this._points.length; i++) {\n const j = (i + 1) % this._points.length;\n const a = this._points[i];\n const b = this._points[j];\n const bToA = b.subtract(a);\n const nextOffset = bToA.length() + previousOffset;\n if (lengthPosition >= previousOffset && lengthPosition <= nextOffset) {\n const dir = bToA.normalize();\n const localOffset = lengthPosition - previousOffset;\n return new Vector2(a.x + dir.x * localOffset, a.y + dir.y * localOffset);\n }\n previousOffset = nextOffset;\n }\n return Vector2.Zero();\n }\n /**\n * Creates a new path starting from an x and y position\n * @param x starting x value\n * @param y starting y value\n * @returns a new Path2 starting at the coordinates (x, y).\n */\n static StartingAt(x, y) {\n return new Path2(x, y);\n }\n}\n/**\n * Represents a 3D path made up of multiple 3D points\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/path3D\n */\nexport class Path3D {\n /**\n * new Path3D(path, normal, raw)\n * Creates a Path3D. A Path3D is a logical math object, so not a mesh.\n * please read the description in the tutorial : https://doc.babylonjs.com/features/featuresDeepDive/mesh/path3D\n * @param path an array of Vector3, the curve axis of the Path3D\n * @param firstNormal (options) Vector3, the first wanted normal to the curve. Ex (0, 1, 0) for a vertical normal.\n * @param raw (optional, default false) : boolean, if true the returned Path3D isn't normalized. Useful to depict path acceleration or speed.\n * @param alignTangentsWithPath (optional, default false) : boolean, if true the tangents will be aligned with the path.\n */\n constructor(\n /**\n * an array of Vector3, the curve axis of the Path3D\n */\n path, firstNormal = null, raw, alignTangentsWithPath = false) {\n this.path = path;\n this._curve = new Array();\n this._distances = new Array();\n this._tangents = new Array();\n this._normals = new Array();\n this._binormals = new Array();\n // holds interpolated point data\n this._pointAtData = {\n id: 0,\n point: Vector3.Zero(),\n previousPointArrayIndex: 0,\n position: 0,\n subPosition: 0,\n interpolateReady: false,\n interpolationMatrix: Matrix.Identity(),\n };\n for (let p = 0; p < path.length; p++) {\n this._curve[p] = path[p].clone(); // hard copy\n }\n this._raw = raw || false;\n this._alignTangentsWithPath = alignTangentsWithPath;\n this._compute(firstNormal, alignTangentsWithPath);\n }\n /**\n * Returns the Path3D array of successive Vector3 designing its curve.\n * @returns the Path3D array of successive Vector3 designing its curve.\n */\n getCurve() {\n return this._curve;\n }\n /**\n * Returns the Path3D array of successive Vector3 designing its curve.\n * @returns the Path3D array of successive Vector3 designing its curve.\n */\n getPoints() {\n return this._curve;\n }\n /**\n * @returns the computed length (float) of the path.\n */\n length() {\n return this._distances[this._distances.length - 1];\n }\n /**\n * Returns an array populated with tangent vectors on each Path3D curve point.\n * @returns an array populated with tangent vectors on each Path3D curve point.\n */\n getTangents() {\n return this._tangents;\n }\n /**\n * Returns an array populated with normal vectors on each Path3D curve point.\n * @returns an array populated with normal vectors on each Path3D curve point.\n */\n getNormals() {\n return this._normals;\n }\n /**\n * Returns an array populated with binormal vectors on each Path3D curve point.\n * @returns an array populated with binormal vectors on each Path3D curve point.\n */\n getBinormals() {\n return this._binormals;\n }\n /**\n * Returns an array populated with distances (float) of the i-th point from the first curve point.\n * @returns an array populated with distances (float) of the i-th point from the first curve point.\n */\n getDistances() {\n return this._distances;\n }\n /**\n * Returns an interpolated point along this path\n * @param position the position of the point along this path, from 0.0 to 1.0\n * @returns a new Vector3 as the point\n */\n getPointAt(position) {\n return this._updatePointAtData(position).point;\n }\n /**\n * Returns the tangent vector of an interpolated Path3D curve point at the specified position along this path.\n * @param position the position of the point along this path, from 0.0 to 1.0\n * @param interpolated (optional, default false) : boolean, if true returns an interpolated tangent instead of the tangent of the previous path point.\n * @returns a tangent vector corresponding to the interpolated Path3D curve point, if not interpolated, the tangent is taken from the precomputed tangents array.\n */\n getTangentAt(position, interpolated = false) {\n this._updatePointAtData(position, interpolated);\n return interpolated ? Vector3.TransformCoordinates(Vector3.Forward(), this._pointAtData.interpolationMatrix) : this._tangents[this._pointAtData.previousPointArrayIndex];\n }\n /**\n * Returns the tangent vector of an interpolated Path3D curve point at the specified position along this path.\n * @param position the position of the point along this path, from 0.0 to 1.0\n * @param interpolated (optional, default false) : boolean, if true returns an interpolated normal instead of the normal of the previous path point.\n * @returns a normal vector corresponding to the interpolated Path3D curve point, if not interpolated, the normal is taken from the precomputed normals array.\n */\n getNormalAt(position, interpolated = false) {\n this._updatePointAtData(position, interpolated);\n return interpolated ? Vector3.TransformCoordinates(Vector3.Right(), this._pointAtData.interpolationMatrix) : this._normals[this._pointAtData.previousPointArrayIndex];\n }\n /**\n * Returns the binormal vector of an interpolated Path3D curve point at the specified position along this path.\n * @param position the position of the point along this path, from 0.0 to 1.0\n * @param interpolated (optional, default false) : boolean, if true returns an interpolated binormal instead of the binormal of the previous path point.\n * @returns a binormal vector corresponding to the interpolated Path3D curve point, if not interpolated, the binormal is taken from the precomputed binormals array.\n */\n getBinormalAt(position, interpolated = false) {\n this._updatePointAtData(position, interpolated);\n return interpolated ? Vector3.TransformCoordinates(Vector3.UpReadOnly, this._pointAtData.interpolationMatrix) : this._binormals[this._pointAtData.previousPointArrayIndex];\n }\n /**\n * Returns the distance (float) of an interpolated Path3D curve point at the specified position along this path.\n * @param position the position of the point along this path, from 0.0 to 1.0\n * @returns the distance of the interpolated Path3D curve point at the specified position along this path.\n */\n getDistanceAt(position) {\n return this.length() * position;\n }\n /**\n * Returns the array index of the previous point of an interpolated point along this path\n * @param position the position of the point to interpolate along this path, from 0.0 to 1.0\n * @returns the array index\n */\n getPreviousPointIndexAt(position) {\n this._updatePointAtData(position);\n return this._pointAtData.previousPointArrayIndex;\n }\n /**\n * Returns the position of an interpolated point relative to the two path points it lies between, from 0.0 (point A) to 1.0 (point B)\n * @param position the position of the point to interpolate along this path, from 0.0 to 1.0\n * @returns the sub position\n */\n getSubPositionAt(position) {\n this._updatePointAtData(position);\n return this._pointAtData.subPosition;\n }\n /**\n * Returns the position of the closest virtual point on this path to an arbitrary Vector3, from 0.0 to 1.0\n * @param target the vector of which to get the closest position to\n * @returns the position of the closest virtual point on this path to the target vector\n */\n getClosestPositionTo(target) {\n let smallestDistance = Number.MAX_VALUE;\n let closestPosition = 0.0;\n for (let i = 0; i < this._curve.length - 1; i++) {\n const point = this._curve[i + 0];\n const tangent = this._curve[i + 1].subtract(point).normalize();\n const subLength = this._distances[i + 1] - this._distances[i + 0];\n const subPosition = Math.min((Math.max(Vector3.Dot(tangent, target.subtract(point).normalize()), 0.0) * Vector3.Distance(point, target)) / subLength, 1.0);\n const distance = Vector3.Distance(point.add(tangent.scale(subPosition * subLength)), target);\n if (distance < smallestDistance) {\n smallestDistance = distance;\n closestPosition = (this._distances[i + 0] + subLength * subPosition) / this.length();\n }\n }\n return closestPosition;\n }\n /**\n * Returns a sub path (slice) of this path\n * @param start the position of the fist path point, from 0.0 to 1.0, or a negative value, which will get wrapped around from the end of the path to 0.0 to 1.0 values\n * @param end the position of the last path point, from 0.0 to 1.0, or a negative value, which will get wrapped around from the end of the path to 0.0 to 1.0 values\n * @returns a sub path (slice) of this path\n */\n slice(start = 0.0, end = 1.0) {\n if (start < 0.0) {\n start = 1 - ((start * -1.0) % 1.0);\n }\n if (end < 0.0) {\n end = 1 - ((end * -1.0) % 1.0);\n }\n if (start > end) {\n const _start = start;\n start = end;\n end = _start;\n }\n const curvePoints = this.getCurve();\n const startPoint = this.getPointAt(start);\n let startIndex = this.getPreviousPointIndexAt(start);\n const endPoint = this.getPointAt(end);\n const endIndex = this.getPreviousPointIndexAt(end) + 1;\n const slicePoints = [];\n if (start !== 0.0) {\n startIndex++;\n slicePoints.push(startPoint);\n }\n slicePoints.push(...curvePoints.slice(startIndex, endIndex));\n if (end !== 1.0 || start === 1.0) {\n slicePoints.push(endPoint);\n }\n return new Path3D(slicePoints, this.getNormalAt(start), this._raw, this._alignTangentsWithPath);\n }\n /**\n * Forces the Path3D tangent, normal, binormal and distance recomputation.\n * @param path path which all values are copied into the curves points\n * @param firstNormal which should be projected onto the curve\n * @param alignTangentsWithPath (optional, default false) : boolean, if true the tangents will be aligned with the path\n * @returns the same object updated.\n */\n update(path, firstNormal = null, alignTangentsWithPath = false) {\n for (let p = 0; p < path.length; p++) {\n this._curve[p].x = path[p].x;\n this._curve[p].y = path[p].y;\n this._curve[p].z = path[p].z;\n }\n this._compute(firstNormal, alignTangentsWithPath);\n return this;\n }\n // private function compute() : computes tangents, normals and binormals\n _compute(firstNormal, alignTangentsWithPath = false) {\n const l = this._curve.length;\n if (l < 2) {\n return;\n }\n // first and last tangents\n this._tangents[0] = this._getFirstNonNullVector(0);\n if (!this._raw) {\n this._tangents[0].normalize();\n }\n this._tangents[l - 1] = this._curve[l - 1].subtract(this._curve[l - 2]);\n if (!this._raw) {\n this._tangents[l - 1].normalize();\n }\n // normals and binormals at first point : arbitrary vector with _normalVector()\n const tg0 = this._tangents[0];\n const pp0 = this._normalVector(tg0, firstNormal);\n this._normals[0] = pp0;\n if (!this._raw) {\n this._normals[0].normalize();\n }\n this._binormals[0] = Vector3.Cross(tg0, this._normals[0]);\n if (!this._raw) {\n this._binormals[0].normalize();\n }\n this._distances[0] = 0.0;\n // normals and binormals : next points\n let prev; // previous vector (segment)\n let cur; // current vector (segment)\n let curTang; // current tangent\n // previous normal\n let prevNor; // previous normal\n let prevBinor; // previous binormal\n for (let i = 1; i < l; i++) {\n // tangents\n prev = this._getLastNonNullVector(i);\n if (i < l - 1) {\n cur = this._getFirstNonNullVector(i);\n this._tangents[i] = alignTangentsWithPath ? cur : prev.add(cur);\n this._tangents[i].normalize();\n }\n this._distances[i] = this._distances[i - 1] + this._curve[i].subtract(this._curve[i - 1]).length();\n // normals and binormals\n // http://www.cs.cmu.edu/afs/andrew/scs/cs/15-462/web/old/asst2camera.html\n curTang = this._tangents[i];\n prevBinor = this._binormals[i - 1];\n this._normals[i] = Vector3.Cross(prevBinor, curTang);\n if (!this._raw) {\n if (this._normals[i].length() === 0) {\n prevNor = this._normals[i - 1];\n this._normals[i] = prevNor.clone();\n }\n else {\n this._normals[i].normalize();\n }\n }\n this._binormals[i] = Vector3.Cross(curTang, this._normals[i]);\n if (!this._raw) {\n this._binormals[i].normalize();\n }\n }\n this._pointAtData.id = NaN;\n }\n // private function getFirstNonNullVector(index)\n // returns the first non null vector from index : curve[index + N].subtract(curve[index])\n _getFirstNonNullVector(index) {\n let i = 1;\n let nNVector = this._curve[index + i].subtract(this._curve[index]);\n while (nNVector.length() === 0 && index + i + 1 < this._curve.length) {\n i++;\n nNVector = this._curve[index + i].subtract(this._curve[index]);\n }\n return nNVector;\n }\n // private function getLastNonNullVector(index)\n // returns the last non null vector from index : curve[index].subtract(curve[index - N])\n _getLastNonNullVector(index) {\n let i = 1;\n let nLVector = this._curve[index].subtract(this._curve[index - i]);\n while (nLVector.length() === 0 && index > i + 1) {\n i++;\n nLVector = this._curve[index].subtract(this._curve[index - i]);\n }\n return nLVector;\n }\n // private function normalVector(v0, vt, va) :\n // returns an arbitrary point in the plane defined by the point v0 and the vector vt orthogonal to this plane\n // if va is passed, it returns the va projection on the plane orthogonal to vt at the point v0\n _normalVector(vt, va) {\n let normal0;\n let tgl = vt.length();\n if (tgl === 0.0) {\n tgl = 1.0;\n }\n if (va === undefined || va === null) {\n let point;\n if (!Scalar.WithinEpsilon(Math.abs(vt.y) / tgl, 1.0, Epsilon)) {\n // search for a point in the plane\n point = new Vector3(0.0, -1.0, 0.0);\n }\n else if (!Scalar.WithinEpsilon(Math.abs(vt.x) / tgl, 1.0, Epsilon)) {\n point = new Vector3(1.0, 0.0, 0.0);\n }\n else if (!Scalar.WithinEpsilon(Math.abs(vt.z) / tgl, 1.0, Epsilon)) {\n point = new Vector3(0.0, 0.0, 1.0);\n }\n else {\n point = Vector3.Zero();\n }\n normal0 = Vector3.Cross(vt, point);\n }\n else {\n normal0 = Vector3.Cross(vt, va);\n Vector3.CrossToRef(normal0, vt, normal0);\n }\n normal0.normalize();\n return normal0;\n }\n /**\n * Updates the point at data for an interpolated point along this curve\n * @param position the position of the point along this curve, from 0.0 to 1.0\n * @param interpolateTNB\n * @interpolateTNB whether to compute the interpolated tangent, normal and binormal\n * @returns the (updated) point at data\n */\n _updatePointAtData(position, interpolateTNB = false) {\n // set an id for caching the result\n if (this._pointAtData.id === position) {\n if (!this._pointAtData.interpolateReady) {\n this._updateInterpolationMatrix();\n }\n return this._pointAtData;\n }\n else {\n this._pointAtData.id = position;\n }\n const curvePoints = this.getPoints();\n // clamp position between 0.0 and 1.0\n if (position <= 0.0) {\n return this._setPointAtData(0.0, 0.0, curvePoints[0], 0, interpolateTNB);\n }\n else if (position >= 1.0) {\n return this._setPointAtData(1.0, 1.0, curvePoints[curvePoints.length - 1], curvePoints.length - 1, interpolateTNB);\n }\n let previousPoint = curvePoints[0];\n let currentPoint;\n let currentLength = 0.0;\n const targetLength = position * this.length();\n for (let i = 1; i < curvePoints.length; i++) {\n currentPoint = curvePoints[i];\n const distance = Vector3.Distance(previousPoint, currentPoint);\n currentLength += distance;\n if (currentLength === targetLength) {\n return this._setPointAtData(position, 1.0, currentPoint, i, interpolateTNB);\n }\n else if (currentLength > targetLength) {\n const toLength = currentLength - targetLength;\n const diff = toLength / distance;\n const dir = previousPoint.subtract(currentPoint);\n const point = currentPoint.add(dir.scaleInPlace(diff));\n return this._setPointAtData(position, 1 - diff, point, i - 1, interpolateTNB);\n }\n previousPoint = currentPoint;\n }\n return this._pointAtData;\n }\n /**\n * Updates the point at data from the specified parameters\n * @param position where along the path the interpolated point is, from 0.0 to 1.0\n * @param subPosition\n * @param point the interpolated point\n * @param parentIndex the index of an existing curve point that is on, or else positionally the first behind, the interpolated point\n * @param interpolateTNB\n */\n _setPointAtData(position, subPosition, point, parentIndex, interpolateTNB) {\n this._pointAtData.point = point;\n this._pointAtData.position = position;\n this._pointAtData.subPosition = subPosition;\n this._pointAtData.previousPointArrayIndex = parentIndex;\n this._pointAtData.interpolateReady = interpolateTNB;\n if (interpolateTNB) {\n this._updateInterpolationMatrix();\n }\n return this._pointAtData;\n }\n /**\n * Updates the point at interpolation matrix for the tangents, normals and binormals\n */\n _updateInterpolationMatrix() {\n this._pointAtData.interpolationMatrix = Matrix.Identity();\n const parentIndex = this._pointAtData.previousPointArrayIndex;\n if (parentIndex !== this._tangents.length - 1) {\n const index = parentIndex + 1;\n const tangentFrom = this._tangents[parentIndex].clone();\n const normalFrom = this._normals[parentIndex].clone();\n const binormalFrom = this._binormals[parentIndex].clone();\n const tangentTo = this._tangents[index].clone();\n const normalTo = this._normals[index].clone();\n const binormalTo = this._binormals[index].clone();\n const quatFrom = Quaternion.RotationQuaternionFromAxis(normalFrom, binormalFrom, tangentFrom);\n const quatTo = Quaternion.RotationQuaternionFromAxis(normalTo, binormalTo, tangentTo);\n const quatAt = Quaternion.Slerp(quatFrom, quatTo, this._pointAtData.subPosition);\n quatAt.toRotationMatrix(this._pointAtData.interpolationMatrix);\n }\n }\n}\n/**\n * A Curve3 object is a logical object, so not a mesh, to handle curves in the 3D geometric space.\n * A Curve3 is designed from a series of successive Vector3.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/drawCurves\n */\nexport class Curve3 {\n /**\n * Returns a Curve3 object along a Quadratic Bezier curve : https://doc.babylonjs.com/features/featuresDeepDive/mesh/drawCurves#quadratic-bezier-curve\n * @param v0 (Vector3) the origin point of the Quadratic Bezier\n * @param v1 (Vector3) the control point\n * @param v2 (Vector3) the end point of the Quadratic Bezier\n * @param nbPoints (integer) the wanted number of points in the curve\n * @returns the created Curve3\n */\n static CreateQuadraticBezier(v0, v1, v2, nbPoints) {\n nbPoints = nbPoints > 2 ? nbPoints : 3;\n const bez = new Array();\n const equation = (t, val0, val1, val2) => {\n const res = (1.0 - t) * (1.0 - t) * val0 + 2.0 * t * (1.0 - t) * val1 + t * t * val2;\n return res;\n };\n for (let i = 0; i <= nbPoints; i++) {\n bez.push(new Vector3(equation(i / nbPoints, v0.x, v1.x, v2.x), equation(i / nbPoints, v0.y, v1.y, v2.y), equation(i / nbPoints, v0.z, v1.z, v2.z)));\n }\n return new Curve3(bez);\n }\n /**\n * Returns a Curve3 object along a Cubic Bezier curve : https://doc.babylonjs.com/features/featuresDeepDive/mesh/drawCurves#cubic-bezier-curve\n * @param v0 (Vector3) the origin point of the Cubic Bezier\n * @param v1 (Vector3) the first control point\n * @param v2 (Vector3) the second control point\n * @param v3 (Vector3) the end point of the Cubic Bezier\n * @param nbPoints (integer) the wanted number of points in the curve\n * @returns the created Curve3\n */\n static CreateCubicBezier(v0, v1, v2, v3, nbPoints) {\n nbPoints = nbPoints > 3 ? nbPoints : 4;\n const bez = new Array();\n const equation = (t, val0, val1, val2, val3) => {\n const res = (1.0 - t) * (1.0 - t) * (1.0 - t) * val0 + 3.0 * t * (1.0 - t) * (1.0 - t) * val1 + 3.0 * t * t * (1.0 - t) * val2 + t * t * t * val3;\n return res;\n };\n for (let i = 0; i <= nbPoints; i++) {\n bez.push(new Vector3(equation(i / nbPoints, v0.x, v1.x, v2.x, v3.x), equation(i / nbPoints, v0.y, v1.y, v2.y, v3.y), equation(i / nbPoints, v0.z, v1.z, v2.z, v3.z)));\n }\n return new Curve3(bez);\n }\n /**\n * Returns a Curve3 object along a Hermite Spline curve : https://doc.babylonjs.com/features/featuresDeepDive/mesh/drawCurves#hermite-spline\n * @param p1 (Vector3) the origin point of the Hermite Spline\n * @param t1 (Vector3) the tangent vector at the origin point\n * @param p2 (Vector3) the end point of the Hermite Spline\n * @param t2 (Vector3) the tangent vector at the end point\n * @param nSeg (integer) the number of curve segments or nSeg + 1 points in the array\n * @returns the created Curve3\n */\n static CreateHermiteSpline(p1, t1, p2, t2, nSeg) {\n const hermite = new Array();\n const step = 1.0 / nSeg;\n for (let i = 0; i <= nSeg; i++) {\n hermite.push(Vector3.Hermite(p1, t1, p2, t2, i * step));\n }\n return new Curve3(hermite);\n }\n /**\n * Returns a Curve3 object along a CatmullRom Spline curve :\n * @param points (array of Vector3) the points the spline must pass through. At least, four points required\n * @param nbPoints (integer) the wanted number of points between each curve control points\n * @param closed (boolean) optional with default false, when true forms a closed loop from the points\n * @returns the created Curve3\n */\n static CreateCatmullRomSpline(points, nbPoints, closed) {\n const catmullRom = new Array();\n const step = 1.0 / nbPoints;\n let amount = 0.0;\n if (closed) {\n const pointsCount = points.length;\n for (let i = 0; i < pointsCount; i++) {\n amount = 0;\n for (let c = 0; c < nbPoints; c++) {\n catmullRom.push(Vector3.CatmullRom(points[i % pointsCount], points[(i + 1) % pointsCount], points[(i + 2) % pointsCount], points[(i + 3) % pointsCount], amount));\n amount += step;\n }\n }\n catmullRom.push(catmullRom[0]);\n }\n else {\n const totalPoints = new Array();\n totalPoints.push(points[0].clone());\n Array.prototype.push.apply(totalPoints, points);\n totalPoints.push(points[points.length - 1].clone());\n let i = 0;\n for (; i < totalPoints.length - 3; i++) {\n amount = 0;\n for (let c = 0; c < nbPoints; c++) {\n catmullRom.push(Vector3.CatmullRom(totalPoints[i], totalPoints[i + 1], totalPoints[i + 2], totalPoints[i + 3], amount));\n amount += step;\n }\n }\n i--;\n catmullRom.push(Vector3.CatmullRom(totalPoints[i], totalPoints[i + 1], totalPoints[i + 2], totalPoints[i + 3], amount));\n }\n return new Curve3(catmullRom);\n }\n /**\n * Returns a Curve3 object along an arc through three vector3 points:\n * The three points should not be colinear. When they are the Curve3 is empty.\n * @param first (Vector3) the first point the arc must pass through.\n * @param second (Vector3) the second point the arc must pass through.\n * @param third (Vector3) the third point the arc must pass through.\n * @param steps (number) the larger the number of steps the more detailed the arc.\n * @param closed (boolean) optional with default false, when true forms the chord from the first and third point\n * @param fullCircle Circle (boolean) optional with default false, when true forms the complete circle through the three points\n * @returns the created Curve3\n */\n static ArcThru3Points(first, second, third, steps = 32, closed = false, fullCircle = false) {\n const arc = new Array();\n const vec1 = second.subtract(first);\n const vec2 = third.subtract(second);\n const vec3 = first.subtract(third);\n const zAxis = Vector3.Cross(vec1, vec2);\n const len4 = zAxis.length();\n if (len4 < Math.pow(10, -8)) {\n return new Curve3(arc); // colinear points arc is empty\n }\n const len1_sq = vec1.lengthSquared();\n const len2_sq = vec2.lengthSquared();\n const len3_sq = vec3.lengthSquared();\n const len4_sq = zAxis.lengthSquared();\n const len1 = vec1.length();\n const len2 = vec2.length();\n const len3 = vec3.length();\n const radius = (0.5 * len1 * len2 * len3) / len4;\n const dot1 = Vector3.Dot(vec1, vec3);\n const dot2 = Vector3.Dot(vec1, vec2);\n const dot3 = Vector3.Dot(vec2, vec3);\n const a = (-0.5 * len2_sq * dot1) / len4_sq;\n const b = (-0.5 * len3_sq * dot2) / len4_sq;\n const c = (-0.5 * len1_sq * dot3) / len4_sq;\n const center = first.scale(a).add(second.scale(b)).add(third.scale(c));\n const radiusVec = first.subtract(center);\n const xAxis = radiusVec.normalize();\n const yAxis = Vector3.Cross(zAxis, xAxis).normalize();\n if (fullCircle) {\n const dStep = (2 * Math.PI) / steps;\n for (let theta = 0; theta <= 2 * Math.PI; theta += dStep) {\n arc.push(center.add(xAxis.scale(radius * Math.cos(theta)).add(yAxis.scale(radius * Math.sin(theta)))));\n }\n arc.push(first);\n }\n else {\n const dStep = 1 / steps;\n let theta = 0;\n let point = Vector3.Zero();\n do {\n point = center.add(xAxis.scale(radius * Math.cos(theta)).add(yAxis.scale(radius * Math.sin(theta))));\n arc.push(point);\n theta += dStep;\n } while (!point.equalsWithEpsilon(third, radius * dStep * 1.1));\n arc.push(third);\n if (closed) {\n arc.push(first);\n }\n }\n return new Curve3(arc);\n }\n /**\n * A Curve3 object is a logical object, so not a mesh, to handle curves in the 3D geometric space.\n * A Curve3 is designed from a series of successive Vector3.\n * Tuto : https://doc.babylonjs.com/features/featuresDeepDive/mesh/drawCurves#curve3-object\n * @param points points which make up the curve\n */\n constructor(points) {\n this._length = 0.0;\n this._points = points;\n this._length = this._computeLength(points);\n }\n /**\n * @returns the Curve3 stored array of successive Vector3\n */\n getPoints() {\n return this._points;\n }\n /**\n * @returns the computed length (float) of the curve.\n */\n length() {\n return this._length;\n }\n /**\n * Returns a new instance of Curve3 object : var curve = curveA.continue(curveB);\n * This new Curve3 is built by translating and sticking the curveB at the end of the curveA.\n * curveA and curveB keep unchanged.\n * @param curve the curve to continue from this curve\n * @returns the newly constructed curve\n */\n continue(curve) {\n const lastPoint = this._points[this._points.length - 1];\n const continuedPoints = this._points.slice();\n const curvePoints = curve.getPoints();\n for (let i = 1; i < curvePoints.length; i++) {\n continuedPoints.push(curvePoints[i].subtract(curvePoints[0]).add(lastPoint));\n }\n const continuedCurve = new Curve3(continuedPoints);\n return continuedCurve;\n }\n _computeLength(path) {\n let l = 0;\n for (let i = 1; i < path.length; i++) {\n l += path[i].subtract(path[i - 1]).length();\n }\n return l;\n }\n}\n//# sourceMappingURL=math.path.js.map","import { BezierCurve } from \"../Maths/math.path.js\";\n/**\n * Base class used for every default easing function.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#easing-functions\n */\nexport class EasingFunction {\n constructor() {\n this._easingMode = EasingFunction.EASINGMODE_EASEIN;\n }\n /**\n * Sets the easing mode of the current function.\n * @param easingMode Defines the willing mode (EASINGMODE_EASEIN, EASINGMODE_EASEOUT or EASINGMODE_EASEINOUT)\n */\n setEasingMode(easingMode) {\n const n = Math.min(Math.max(easingMode, 0), 2);\n this._easingMode = n;\n }\n /**\n * Gets the current easing mode.\n * @returns the easing mode\n */\n getEasingMode() {\n return this._easingMode;\n }\n /**\n * @internal\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n easeInCore(gradient) {\n throw new Error(\"You must implement this method\");\n }\n /**\n * Given an input gradient between 0 and 1, this returns the corresponding value\n * of the easing function.\n * @param gradient Defines the value between 0 and 1 we want the easing value for\n * @returns the corresponding value on the curve defined by the easing function\n */\n ease(gradient) {\n switch (this._easingMode) {\n case EasingFunction.EASINGMODE_EASEIN:\n return this.easeInCore(gradient);\n case EasingFunction.EASINGMODE_EASEOUT:\n return 1 - this.easeInCore(1 - gradient);\n }\n if (gradient >= 0.5) {\n return (1 - this.easeInCore((1 - gradient) * 2)) * 0.5 + 0.5;\n }\n return this.easeInCore(gradient * 2) * 0.5;\n }\n}\n/**\n * Interpolation follows the mathematical formula associated with the easing function.\n */\nEasingFunction.EASINGMODE_EASEIN = 0;\n/**\n * Interpolation follows 100% interpolation minus the output of the formula associated with the easing function.\n */\nEasingFunction.EASINGMODE_EASEOUT = 1;\n/**\n * Interpolation uses EaseIn for the first half of the animation and EaseOut for the second half.\n */\nEasingFunction.EASINGMODE_EASEINOUT = 2;\n/**\n * Easing function with a circle shape (see link below).\n * @see https://easings.net/#easeInCirc\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#easing-functions\n */\nexport class CircleEase extends EasingFunction {\n /**\n * @internal\n */\n easeInCore(gradient) {\n gradient = Math.max(0, Math.min(1, gradient));\n return 1.0 - Math.sqrt(1.0 - gradient * gradient);\n }\n}\n/**\n * Easing function with a ease back shape (see link below).\n * @see https://easings.net/#easeInBack\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#easing-functions\n */\nexport class BackEase extends EasingFunction {\n /**\n * Instantiates a back ease easing\n * @see https://easings.net/#easeInBack\n * @param amplitude Defines the amplitude of the function\n */\n constructor(\n /** Defines the amplitude of the function */\n amplitude = 1) {\n super();\n this.amplitude = amplitude;\n }\n /**\n * @internal\n */\n easeInCore(gradient) {\n const num = Math.max(0, this.amplitude);\n return Math.pow(gradient, 3.0) - gradient * num * Math.sin(3.1415926535897931 * gradient);\n }\n}\n/**\n * Easing function with a bouncing shape (see link below).\n * @see https://easings.net/#easeInBounce\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#easing-functions\n */\nexport class BounceEase extends EasingFunction {\n /**\n * Instantiates a bounce easing\n * @see https://easings.net/#easeInBounce\n * @param bounces Defines the number of bounces\n * @param bounciness Defines the amplitude of the bounce\n */\n constructor(\n /** Defines the number of bounces */\n bounces = 3, \n /** Defines the amplitude of the bounce */\n bounciness = 2) {\n super();\n this.bounces = bounces;\n this.bounciness = bounciness;\n }\n /**\n * @internal\n */\n easeInCore(gradient) {\n const y = Math.max(0.0, this.bounces);\n let bounciness = this.bounciness;\n if (bounciness <= 1.0) {\n bounciness = 1.001;\n }\n const num9 = Math.pow(bounciness, y);\n const num5 = 1.0 - bounciness;\n const num4 = (1.0 - num9) / num5 + num9 * 0.5;\n const num15 = gradient * num4;\n const num65 = Math.log(-num15 * (1.0 - bounciness) + 1.0) / Math.log(bounciness);\n const num3 = Math.floor(num65);\n const num13 = num3 + 1.0;\n const num8 = (1.0 - Math.pow(bounciness, num3)) / (num5 * num4);\n const num12 = (1.0 - Math.pow(bounciness, num13)) / (num5 * num4);\n const num7 = (num8 + num12) * 0.5;\n const num6 = gradient - num7;\n const num2 = num7 - num8;\n return (-Math.pow(1.0 / bounciness, y - num3) / (num2 * num2)) * (num6 - num2) * (num6 + num2);\n }\n}\n/**\n * Easing function with a power of 3 shape (see link below).\n * @see https://easings.net/#easeInCubic\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#easing-functions\n */\nexport class CubicEase extends EasingFunction {\n /**\n * @internal\n */\n easeInCore(gradient) {\n return gradient * gradient * gradient;\n }\n}\n/**\n * Easing function with an elastic shape (see link below).\n * @see https://easings.net/#easeInElastic\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#easing-functions\n */\nexport class ElasticEase extends EasingFunction {\n /**\n * Instantiates an elastic easing function\n * @see https://easings.net/#easeInElastic\n * @param oscillations Defines the number of oscillations\n * @param springiness Defines the amplitude of the oscillations\n */\n constructor(\n /** Defines the number of oscillations*/\n oscillations = 3, \n /** Defines the amplitude of the oscillations*/\n springiness = 3) {\n super();\n this.oscillations = oscillations;\n this.springiness = springiness;\n }\n /**\n * @internal\n */\n easeInCore(gradient) {\n let num2;\n const num3 = Math.max(0.0, this.oscillations);\n const num = Math.max(0.0, this.springiness);\n if (num == 0) {\n num2 = gradient;\n }\n else {\n num2 = (Math.exp(num * gradient) - 1.0) / (Math.exp(num) - 1.0);\n }\n return num2 * Math.sin((6.2831853071795862 * num3 + 1.5707963267948966) * gradient);\n }\n}\n/**\n * Easing function with an exponential shape (see link below).\n * @see https://easings.net/#easeInExpo\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#easing-functions\n */\nexport class ExponentialEase extends EasingFunction {\n /**\n * Instantiates an exponential easing function\n * @see https://easings.net/#easeInExpo\n * @param exponent Defines the exponent of the function\n */\n constructor(\n /** Defines the exponent of the function */\n exponent = 2) {\n super();\n this.exponent = exponent;\n }\n /**\n * @internal\n */\n easeInCore(gradient) {\n if (this.exponent <= 0) {\n return gradient;\n }\n return (Math.exp(this.exponent * gradient) - 1.0) / (Math.exp(this.exponent) - 1.0);\n }\n}\n/**\n * Easing function with a power shape (see link below).\n * @see https://easings.net/#easeInQuad\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#easing-functions\n */\nexport class PowerEase extends EasingFunction {\n /**\n * Instantiates an power base easing function\n * @see https://easings.net/#easeInQuad\n * @param power Defines the power of the function\n */\n constructor(\n /** Defines the power of the function */\n power = 2) {\n super();\n this.power = power;\n }\n /**\n * @internal\n */\n easeInCore(gradient) {\n const y = Math.max(0.0, this.power);\n return Math.pow(gradient, y);\n }\n}\n/**\n * Easing function with a power of 2 shape (see link below).\n * @see https://easings.net/#easeInQuad\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#easing-functions\n */\nexport class QuadraticEase extends EasingFunction {\n /**\n * @internal\n */\n easeInCore(gradient) {\n return gradient * gradient;\n }\n}\n/**\n * Easing function with a power of 4 shape (see link below).\n * @see https://easings.net/#easeInQuart\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#easing-functions\n */\nexport class QuarticEase extends EasingFunction {\n /**\n * @internal\n */\n easeInCore(gradient) {\n return gradient * gradient * gradient * gradient;\n }\n}\n/**\n * Easing function with a power of 5 shape (see link below).\n * @see https://easings.net/#easeInQuint\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#easing-functions\n */\nexport class QuinticEase extends EasingFunction {\n /**\n * @internal\n */\n easeInCore(gradient) {\n return gradient * gradient * gradient * gradient * gradient;\n }\n}\n/**\n * Easing function with a sin shape (see link below).\n * @see https://easings.net/#easeInSine\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#easing-functions\n */\nexport class SineEase extends EasingFunction {\n /**\n * @internal\n */\n easeInCore(gradient) {\n return 1.0 - Math.sin(1.5707963267948966 * (1.0 - gradient));\n }\n}\n/**\n * Easing function with a bezier shape (see link below).\n * @see http://cubic-bezier.com/#.17,.67,.83,.67\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#easing-functions\n */\nexport class BezierCurveEase extends EasingFunction {\n /**\n * Instantiates a bezier function\n * @see http://cubic-bezier.com/#.17,.67,.83,.67\n * @param x1 Defines the x component of the start tangent in the bezier curve\n * @param y1 Defines the y component of the start tangent in the bezier curve\n * @param x2 Defines the x component of the end tangent in the bezier curve\n * @param y2 Defines the y component of the end tangent in the bezier curve\n */\n constructor(\n /** Defines the x component of the start tangent in the bezier curve */\n x1 = 0, \n /** Defines the y component of the start tangent in the bezier curve */\n y1 = 0, \n /** Defines the x component of the end tangent in the bezier curve */\n x2 = 1, \n /** Defines the y component of the end tangent in the bezier curve */\n y2 = 1) {\n super();\n this.x1 = x1;\n this.y1 = y1;\n this.x2 = x2;\n this.y2 = y2;\n }\n /**\n * @internal\n */\n easeInCore(gradient) {\n return BezierCurve.Interpolate(gradient, this.x1, this.y1, this.x2, this.y2);\n }\n}\n//# sourceMappingURL=easing.js.map","\n\n\n\n","\n\n\n\n","\n\n\n\n","\n\n\n\n","\n\n\n\n","\n/**\n * Class used to store a texture sampler data\n */\nexport class TextureSampler {\n /**\n * | Value | Type | Description |\n * | ----- | ------------------ | ----------- |\n * | 0 | CLAMP_ADDRESSMODE | |\n * | 1 | WRAP_ADDRESSMODE | |\n * | 2 | MIRROR_ADDRESSMODE | |\n */\n get wrapU() {\n return this._cachedWrapU;\n }\n set wrapU(value) {\n this._cachedWrapU = value;\n }\n /**\n * | Value | Type | Description |\n * | ----- | ------------------ | ----------- |\n * | 0 | CLAMP_ADDRESSMODE | |\n * | 1 | WRAP_ADDRESSMODE | |\n * | 2 | MIRROR_ADDRESSMODE | |\n */\n get wrapV() {\n return this._cachedWrapV;\n }\n set wrapV(value) {\n this._cachedWrapV = value;\n }\n /**\n * | Value | Type | Description |\n * | ----- | ------------------ | ----------- |\n * | 0 | CLAMP_ADDRESSMODE | |\n * | 1 | WRAP_ADDRESSMODE | |\n * | 2 | MIRROR_ADDRESSMODE | |\n */\n get wrapR() {\n return this._cachedWrapR;\n }\n set wrapR(value) {\n this._cachedWrapR = value;\n }\n /**\n * With compliant hardware and browser (supporting anisotropic filtering)\n * this defines the level of anisotropic filtering in the texture.\n * The higher the better but the slower.\n */\n get anisotropicFilteringLevel() {\n return this._cachedAnisotropicFilteringLevel;\n }\n set anisotropicFilteringLevel(value) {\n this._cachedAnisotropicFilteringLevel = value;\n }\n /**\n * Gets or sets the comparison function (513, 514, etc). Set 0 to not use a comparison function\n */\n get comparisonFunction() {\n return this._comparisonFunction;\n }\n set comparisonFunction(value) {\n this._comparisonFunction = value;\n }\n /**\n * Indicates to use the mip maps (if available on the texture).\n * Thanks to this flag, you can instruct the sampler to not sample the mipmaps even if they exist (and if the sampling mode is set to a value that normally samples the mipmaps!)\n */\n get useMipMaps() {\n return this._useMipMaps;\n }\n set useMipMaps(value) {\n this._useMipMaps = value;\n }\n /**\n * Creates a Sampler instance\n */\n constructor() {\n /**\n * Gets the sampling mode of the texture\n */\n this.samplingMode = -1;\n this._useMipMaps = true;\n /** @internal */\n this._cachedWrapU = null;\n /** @internal */\n this._cachedWrapV = null;\n /** @internal */\n this._cachedWrapR = null;\n /** @internal */\n this._cachedAnisotropicFilteringLevel = null;\n /** @internal */\n this._comparisonFunction = 0;\n }\n /**\n * Sets all the parameters of the sampler\n * @param wrapU u address mode (default: TEXTURE_WRAP_ADDRESSMODE)\n * @param wrapV v address mode (default: TEXTURE_WRAP_ADDRESSMODE)\n * @param wrapR r address mode (default: TEXTURE_WRAP_ADDRESSMODE)\n * @param anisotropicFilteringLevel anisotropic level (default: 1)\n * @param samplingMode sampling mode (default: 2)\n * @param comparisonFunction comparison function (default: 0 - no comparison function)\n * @returns the current sampler instance\n */\n setParameters(wrapU = 1, wrapV = 1, wrapR = 1, anisotropicFilteringLevel = 1, samplingMode = 2, comparisonFunction = 0) {\n this._cachedWrapU = wrapU;\n this._cachedWrapV = wrapV;\n this._cachedWrapR = wrapR;\n this._cachedAnisotropicFilteringLevel = anisotropicFilteringLevel;\n this.samplingMode = samplingMode;\n this._comparisonFunction = comparisonFunction;\n return this;\n }\n /**\n * Compares this sampler with another one\n * @param other sampler to compare with\n * @returns true if the samplers have the same parametres, else false\n */\n compareSampler(other) {\n return (this._cachedWrapU === other._cachedWrapU &&\n this._cachedWrapV === other._cachedWrapV &&\n this._cachedWrapR === other._cachedWrapR &&\n this._cachedAnisotropicFilteringLevel === other._cachedAnisotropicFilteringLevel &&\n this.samplingMode === other.samplingMode &&\n this._comparisonFunction === other._comparisonFunction &&\n this._useMipMaps === other._useMipMaps);\n }\n}\n//# sourceMappingURL=textureSampler.js.map","import { Observable } from \"../../Misc/observable.js\";\nimport { TextureSampler } from \"./textureSampler.js\";\n/**\n * Defines the source of the internal texture\n */\nexport var InternalTextureSource;\n(function (InternalTextureSource) {\n /**\n * The source of the texture data is unknown\n */\n InternalTextureSource[InternalTextureSource[\"Unknown\"] = 0] = \"Unknown\";\n /**\n * Texture data comes from an URL\n */\n InternalTextureSource[InternalTextureSource[\"Url\"] = 1] = \"Url\";\n /**\n * Texture data is only used for temporary storage\n */\n InternalTextureSource[InternalTextureSource[\"Temp\"] = 2] = \"Temp\";\n /**\n * Texture data comes from raw data (ArrayBuffer)\n */\n InternalTextureSource[InternalTextureSource[\"Raw\"] = 3] = \"Raw\";\n /**\n * Texture content is dynamic (video or dynamic texture)\n */\n InternalTextureSource[InternalTextureSource[\"Dynamic\"] = 4] = \"Dynamic\";\n /**\n * Texture content is generated by rendering to it\n */\n InternalTextureSource[InternalTextureSource[\"RenderTarget\"] = 5] = \"RenderTarget\";\n /**\n * Texture content is part of a multi render target process\n */\n InternalTextureSource[InternalTextureSource[\"MultiRenderTarget\"] = 6] = \"MultiRenderTarget\";\n /**\n * Texture data comes from a cube data file\n */\n InternalTextureSource[InternalTextureSource[\"Cube\"] = 7] = \"Cube\";\n /**\n * Texture data comes from a raw cube data\n */\n InternalTextureSource[InternalTextureSource[\"CubeRaw\"] = 8] = \"CubeRaw\";\n /**\n * Texture data come from a prefiltered cube data file\n */\n InternalTextureSource[InternalTextureSource[\"CubePrefiltered\"] = 9] = \"CubePrefiltered\";\n /**\n * Texture content is raw 3D data\n */\n InternalTextureSource[InternalTextureSource[\"Raw3D\"] = 10] = \"Raw3D\";\n /**\n * Texture content is raw 2D array data\n */\n InternalTextureSource[InternalTextureSource[\"Raw2DArray\"] = 11] = \"Raw2DArray\";\n /**\n * Texture content is a depth/stencil texture\n */\n InternalTextureSource[InternalTextureSource[\"DepthStencil\"] = 12] = \"DepthStencil\";\n /**\n * Texture data comes from a raw cube data encoded with RGBD\n */\n InternalTextureSource[InternalTextureSource[\"CubeRawRGBD\"] = 13] = \"CubeRawRGBD\";\n /**\n * Texture content is a depth texture\n */\n InternalTextureSource[InternalTextureSource[\"Depth\"] = 14] = \"Depth\";\n})(InternalTextureSource || (InternalTextureSource = {}));\n/**\n * Class used to store data associated with WebGL texture data for the engine\n * This class should not be used directly\n */\nexport class InternalTexture extends TextureSampler {\n /**\n * Gets a boolean indicating if the texture uses mipmaps\n * TODO implements useMipMaps as a separate setting from generateMipMaps\n */\n get useMipMaps() {\n return this.generateMipMaps;\n }\n set useMipMaps(value) {\n this.generateMipMaps = value;\n }\n /** Gets the unique id of the internal texture */\n get uniqueId() {\n return this._uniqueId;\n }\n /** @internal */\n _setUniqueId(id) {\n this._uniqueId = id;\n }\n /**\n * Gets the Engine the texture belongs to.\n * @returns The babylon engine\n */\n getEngine() {\n return this._engine;\n }\n /**\n * Gets the data source type of the texture\n */\n get source() {\n return this._source;\n }\n /**\n * Creates a new InternalTexture\n * @param engine defines the engine to use\n * @param source defines the type of data that will be used\n * @param delayAllocation if the texture allocation should be delayed (default: false)\n */\n constructor(engine, source, delayAllocation = false) {\n super();\n /**\n * Defines if the texture is ready\n */\n this.isReady = false;\n /**\n * Defines if the texture is a cube texture\n */\n this.isCube = false;\n /**\n * Defines if the texture contains 3D data\n */\n this.is3D = false;\n /**\n * Defines if the texture contains 2D array data\n */\n this.is2DArray = false;\n /**\n * Defines if the texture contains multiview data\n */\n this.isMultiview = false;\n /**\n * Gets the URL used to load this texture\n */\n this.url = \"\";\n /**\n * Gets a boolean indicating if the texture needs mipmaps generation\n */\n this.generateMipMaps = false;\n /**\n * Gets the number of samples used by the texture (WebGL2+ only)\n */\n this.samples = 0;\n /**\n * Gets the type of the texture (int, float...)\n */\n this.type = -1;\n /**\n * Gets the format of the texture (RGB, RGBA...)\n */\n this.format = -1;\n /**\n * Observable called when the texture is loaded\n */\n this.onLoadedObservable = new Observable();\n /**\n * Observable called when the texture load is raising an error\n */\n this.onErrorObservable = new Observable();\n /**\n * If this callback is defined it will be called instead of the default _rebuild function\n */\n this.onRebuildCallback = null;\n /**\n * Gets the width of the texture\n */\n this.width = 0;\n /**\n * Gets the height of the texture\n */\n this.height = 0;\n /**\n * Gets the depth of the texture\n */\n this.depth = 0;\n /**\n * Gets the initial width of the texture (It could be rescaled if the current system does not support non power of two textures)\n */\n this.baseWidth = 0;\n /**\n * Gets the initial height of the texture (It could be rescaled if the current system does not support non power of two textures)\n */\n this.baseHeight = 0;\n /**\n * Gets the initial depth of the texture (It could be rescaled if the current system does not support non power of two textures)\n */\n this.baseDepth = 0;\n /**\n * Gets a boolean indicating if the texture is inverted on Y axis\n */\n this.invertY = false;\n // Private\n /** @internal */\n this._invertVScale = false;\n /** @internal */\n this._associatedChannel = -1;\n /** @internal */\n this._source = InternalTextureSource.Unknown;\n /** @internal */\n this._buffer = null;\n /** @internal */\n this._bufferView = null;\n /** @internal */\n this._bufferViewArray = null;\n /** @internal */\n this._bufferViewArrayArray = null;\n /** @internal */\n this._size = 0;\n /** @internal */\n this._extension = \"\";\n /** @internal */\n this._files = null;\n /** @internal */\n this._workingCanvas = null;\n /** @internal */\n this._workingContext = null;\n /** @internal */\n this._cachedCoordinatesMode = null;\n /** @internal */\n this._isDisabled = false;\n /** @internal */\n this._compression = null;\n /** @internal */\n this._sphericalPolynomial = null;\n /** @internal */\n this._sphericalPolynomialPromise = null;\n /** @internal */\n this._sphericalPolynomialComputed = false;\n /** @internal */\n this._lodGenerationScale = 0;\n /** @internal */\n this._lodGenerationOffset = 0;\n /** @internal */\n this._useSRGBBuffer = false;\n // The following three fields helps sharing generated fixed LODs for texture filtering\n // In environment not supporting the textureLOD extension like EDGE. They are for internal use only.\n // They are at the level of the gl texture to benefit from the cache.\n /** @internal */\n this._lodTextureHigh = null;\n /** @internal */\n this._lodTextureMid = null;\n /** @internal */\n this._lodTextureLow = null;\n /** @internal */\n this._isRGBD = false;\n /** @internal */\n this._linearSpecularLOD = false;\n /** @internal */\n this._irradianceTexture = null;\n /** @internal */\n this._hardwareTexture = null;\n /** @internal */\n this._maxLodLevel = null;\n /** @internal */\n this._references = 1;\n /** @internal */\n this._gammaSpace = null;\n this._engine = engine;\n this._source = source;\n this._uniqueId = InternalTexture._Counter++;\n if (!delayAllocation) {\n this._hardwareTexture = engine._createHardwareTexture();\n }\n }\n /**\n * Increments the number of references (ie. the number of Texture that point to it)\n */\n incrementReferences() {\n this._references++;\n }\n /**\n * Change the size of the texture (not the size of the content)\n * @param width defines the new width\n * @param height defines the new height\n * @param depth defines the new depth (1 by default)\n */\n updateSize(width, height, depth = 1) {\n this._engine.updateTextureDimensions(this, width, height, depth);\n this.width = width;\n this.height = height;\n this.depth = depth;\n this.baseWidth = width;\n this.baseHeight = height;\n this.baseDepth = depth;\n this._size = width * height * depth;\n }\n /** @internal */\n _rebuild() {\n var _a;\n this.isReady = false;\n this._cachedCoordinatesMode = null;\n this._cachedWrapU = null;\n this._cachedWrapV = null;\n this._cachedWrapR = null;\n this._cachedAnisotropicFilteringLevel = null;\n if (this.onRebuildCallback) {\n const data = this.onRebuildCallback(this);\n const swapAndSetIsReady = (proxyInternalTexture) => {\n proxyInternalTexture._swapAndDie(this, false);\n this.isReady = data.isReady;\n };\n if (data.isAsync) {\n data.proxy.then(swapAndSetIsReady);\n }\n else {\n swapAndSetIsReady(data.proxy);\n }\n return;\n }\n let proxy;\n switch (this.source) {\n case InternalTextureSource.Temp:\n break;\n case InternalTextureSource.Url:\n proxy = this._engine.createTexture((_a = this._originalUrl) !== null && _a !== void 0 ? _a : this.url, !this.generateMipMaps, this.invertY, null, this.samplingMode, \n // Do not use Proxy here as it could be fully synchronous\n // and proxy would be undefined.\n (temp) => {\n temp._swapAndDie(this, false);\n this.isReady = true;\n }, null, this._buffer, undefined, this.format, this._extension, undefined, undefined, undefined, this._useSRGBBuffer);\n return;\n case InternalTextureSource.Raw:\n proxy = this._engine.createRawTexture(this._bufferView, this.baseWidth, this.baseHeight, this.format, this.generateMipMaps, this.invertY, this.samplingMode, this._compression, this.type, undefined, this._useSRGBBuffer);\n proxy._swapAndDie(this, false);\n this.isReady = true;\n break;\n case InternalTextureSource.Raw3D:\n proxy = this._engine.createRawTexture3D(this._bufferView, this.baseWidth, this.baseHeight, this.baseDepth, this.format, this.generateMipMaps, this.invertY, this.samplingMode, this._compression, this.type);\n proxy._swapAndDie(this, false);\n this.isReady = true;\n break;\n case InternalTextureSource.Raw2DArray:\n proxy = this._engine.createRawTexture2DArray(this._bufferView, this.baseWidth, this.baseHeight, this.baseDepth, this.format, this.generateMipMaps, this.invertY, this.samplingMode, this._compression, this.type);\n proxy._swapAndDie(this, false);\n this.isReady = true;\n break;\n case InternalTextureSource.Dynamic:\n proxy = this._engine.createDynamicTexture(this.baseWidth, this.baseHeight, this.generateMipMaps, this.samplingMode);\n proxy._swapAndDie(this, false);\n this._engine.updateDynamicTexture(this, this._engine.getRenderingCanvas(), this.invertY, undefined, undefined, true);\n // The engine will make sure to update content so no need to flag it as isReady = true\n break;\n case InternalTextureSource.Cube:\n proxy = this._engine.createCubeTexture(this.url, null, this._files, !this.generateMipMaps, () => {\n proxy._swapAndDie(this, false);\n this.isReady = true;\n }, null, this.format, this._extension, false, 0, 0, null, undefined, this._useSRGBBuffer);\n return;\n case InternalTextureSource.CubeRaw:\n proxy = this._engine.createRawCubeTexture(this._bufferViewArray, this.width, this.format, this.type, this.generateMipMaps, this.invertY, this.samplingMode, this._compression);\n proxy._swapAndDie(this, false);\n this.isReady = true;\n break;\n case InternalTextureSource.CubeRawRGBD:\n // This case is being handeled by the environment texture tools and is not a part of the rebuild process.\n // To use CubeRawRGBD use updateRGBDAsync on the cube texture.\n return;\n case InternalTextureSource.CubePrefiltered:\n proxy = this._engine.createPrefilteredCubeTexture(this.url, null, this._lodGenerationScale, this._lodGenerationOffset, (proxy) => {\n if (proxy) {\n proxy._swapAndDie(this, false);\n }\n this.isReady = true;\n }, null, this.format, this._extension);\n proxy._sphericalPolynomial = this._sphericalPolynomial;\n return;\n }\n }\n /**\n * @internal\n */\n _swapAndDie(target, swapAll = true) {\n // TODO what about refcount on target?\n var _a;\n (_a = this._hardwareTexture) === null || _a === void 0 ? void 0 : _a.setUsage(target._source, this.generateMipMaps, this.isCube, this.width, this.height);\n target._hardwareTexture = this._hardwareTexture;\n if (swapAll) {\n target._isRGBD = this._isRGBD;\n }\n if (this._lodTextureHigh) {\n if (target._lodTextureHigh) {\n target._lodTextureHigh.dispose();\n }\n target._lodTextureHigh = this._lodTextureHigh;\n }\n if (this._lodTextureMid) {\n if (target._lodTextureMid) {\n target._lodTextureMid.dispose();\n }\n target._lodTextureMid = this._lodTextureMid;\n }\n if (this._lodTextureLow) {\n if (target._lodTextureLow) {\n target._lodTextureLow.dispose();\n }\n target._lodTextureLow = this._lodTextureLow;\n }\n if (this._irradianceTexture) {\n if (target._irradianceTexture) {\n target._irradianceTexture.dispose();\n }\n target._irradianceTexture = this._irradianceTexture;\n }\n const cache = this._engine.getLoadedTexturesCache();\n let index = cache.indexOf(this);\n if (index !== -1) {\n cache.splice(index, 1);\n }\n index = cache.indexOf(target);\n if (index === -1) {\n cache.push(target);\n }\n }\n /**\n * Dispose the current allocated resources\n */\n dispose() {\n this._references--;\n this.onLoadedObservable.clear();\n this.onErrorObservable.clear();\n if (this._references === 0) {\n this._engine._releaseTexture(this);\n this._hardwareTexture = null;\n }\n }\n}\n/** @internal */\nInternalTexture._Counter = 0;\n//# sourceMappingURL=internalTexture.js.map","/* eslint-disable @typescript-eslint/naming-convention */\n/**\n * Checks if the window object exists\n * @returns true if the window object exists\n */\nexport function IsWindowObjectExist() {\n return typeof window !== \"undefined\";\n}\n/**\n * Checks if the navigator object exists\n * @returns true if the navigator object exists\n */\nexport function IsNavigatorAvailable() {\n return typeof navigator !== \"undefined\";\n}\n/**\n * Check if the document object exists\n * @returns true if the document object exists\n */\nexport function IsDocumentAvailable() {\n return typeof document !== \"undefined\";\n}\n/**\n * Extracts text content from a DOM element hierarchy\n * @param element defines the root element\n * @returns a string\n */\nexport function GetDOMTextContent(element) {\n let result = \"\";\n let child = element.firstChild;\n while (child) {\n if (child.nodeType === 3) {\n result += child.textContent;\n }\n child = child.nextSibling;\n }\n return result;\n}\n/**\n * Sets of helpers dealing with the DOM and some of the recurrent functions needed in\n * Babylon.js\n */\nexport const DomManagement = {\n /**\n * Checks if the window object exists\n * @returns true if the window object exists\n */\n IsWindowObjectExist,\n /**\n * Checks if the navigator object exists\n * @returns true if the navigator object exists\n */\n IsNavigatorAvailable,\n /**\n * Check if the document object exists\n * @returns true if the document object exists\n */\n IsDocumentAvailable,\n /**\n * Extracts text content from a DOM element hierarchy\n * @param element defines the root element\n * @returns a string\n */\n GetDOMTextContent,\n};\n//# sourceMappingURL=domManagement.js.map","/**\n * Logger used throughout the application to allow configuration of\n * the log level required for the messages.\n */\nexport class Logger {\n static _CheckLimit(message, limit) {\n let entry = Logger._LogLimitOutputs[message];\n if (!entry) {\n entry = { limit, current: 1 };\n Logger._LogLimitOutputs[message] = entry;\n }\n else {\n entry.current++;\n }\n return entry.current <= entry.limit;\n }\n static _GenerateLimitMessage(message, level = 1) {\n var _a;\n const entry = Logger._LogLimitOutputs[message];\n if (!entry || !Logger.MessageLimitReached) {\n return;\n }\n const type = this._Levels[level];\n if (entry.current === entry.limit) {\n Logger[type.name](Logger.MessageLimitReached.replace(/%LIMIT%/g, \"\" + entry.limit).replace(/%TYPE%/g, (_a = type.name) !== null && _a !== void 0 ? _a : \"\"));\n }\n }\n static _AddLogEntry(entry) {\n Logger._LogCache = entry + Logger._LogCache;\n if (Logger.OnNewCacheEntry) {\n Logger.OnNewCacheEntry(entry);\n }\n }\n static _FormatMessage(message) {\n const padStr = (i) => (i < 10 ? \"0\" + i : \"\" + i);\n const date = new Date();\n return \"[\" + padStr(date.getHours()) + \":\" + padStr(date.getMinutes()) + \":\" + padStr(date.getSeconds()) + \"]: \" + message;\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static _LogDisabled(message, limit) {\n // nothing to do\n }\n static _LogEnabled(level = 1, message, limit) {\n if (limit !== undefined && !Logger._CheckLimit(message, limit)) {\n return;\n }\n const formattedMessage = Logger._FormatMessage(message);\n const type = this._Levels[level];\n type.logFunc && type.logFunc(\"BJS - \" + formattedMessage);\n const entry = `
${formattedMessage}

`;\n Logger._AddLogEntry(entry);\n Logger._GenerateLimitMessage(message, level);\n }\n /**\n * Gets current log cache (list of logs)\n */\n static get LogCache() {\n return Logger._LogCache;\n }\n /**\n * Clears the log cache\n */\n static ClearLogCache() {\n Logger._LogCache = \"\";\n Logger._LogLimitOutputs = {};\n Logger.errorsCount = 0;\n }\n /**\n * Sets the current log level (MessageLogLevel / WarningLogLevel / ErrorLogLevel)\n */\n static set LogLevels(level) {\n Logger.Log = Logger._LogDisabled;\n Logger.Warn = Logger._LogDisabled;\n Logger.Error = Logger._LogDisabled;\n [Logger.MessageLogLevel, Logger.WarningLogLevel, Logger.ErrorLogLevel].forEach((l) => {\n if ((level & l) === l) {\n const type = this._Levels[l];\n Logger[type.name] = Logger._LogEnabled.bind(Logger, l);\n }\n });\n }\n}\n/**\n * No log\n */\nLogger.NoneLogLevel = 0;\n/**\n * Only message logs\n */\nLogger.MessageLogLevel = 1;\n/**\n * Only warning logs\n */\nLogger.WarningLogLevel = 2;\n/**\n * Only error logs\n */\nLogger.ErrorLogLevel = 4;\n/**\n * All logs\n */\nLogger.AllLogLevel = 7;\n/**\n * Message to display when a message has been logged too many times\n */\nLogger.MessageLimitReached = \"Too many %TYPE%s (%LIMIT%), no more %TYPE%s will be reported for this message.\";\nLogger._LogCache = \"\";\nLogger._LogLimitOutputs = {};\n// levels according to the (binary) numbering.\nLogger._Levels = [\n {},\n { color: \"white\", logFunc: console.log, name: \"Log\" },\n { color: \"orange\", logFunc: console.warn, name: \"Warn\" },\n {},\n { color: \"red\", logFunc: console.error, name: \"Error\" },\n];\n/**\n * Gets a value indicating the number of loading errors\n * @ignorenaming\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nLogger.errorsCount = 0;\n/**\n * Log a message to the console\n */\nLogger.Log = Logger._LogEnabled.bind(Logger, Logger.MessageLogLevel);\n/**\n * Write a warning message to the console\n */\nLogger.Warn = Logger._LogEnabled.bind(Logger, Logger.WarningLogLevel);\n/**\n * Write an error message to the console\n */\nLogger.Error = Logger._LogEnabled.bind(Logger, Logger.ErrorLogLevel);\n//# sourceMappingURL=logger.js.map","const defaultAttributeKeywordName = \"attribute\";\nconst defaultVaryingKeywordName = \"varying\";\n/** @internal */\nexport class ShaderCodeNode {\n constructor() {\n this.children = [];\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n isValid(preprocessors) {\n return true;\n }\n process(preprocessors, options) {\n var _a, _b, _c, _d, _e, _f, _g;\n let result = \"\";\n if (this.line) {\n let value = this.line;\n const processor = options.processor;\n if (processor) {\n // This must be done before other replacements to avoid mistakenly changing something that was already changed.\n if (processor.lineProcessor) {\n value = processor.lineProcessor(value, options.isFragment, options.processingContext);\n }\n const attributeKeyword = (_b = (_a = options.processor) === null || _a === void 0 ? void 0 : _a.attributeKeywordName) !== null && _b !== void 0 ? _b : defaultAttributeKeywordName;\n const varyingKeyword = options.isFragment && ((_c = options.processor) === null || _c === void 0 ? void 0 : _c.varyingFragmentKeywordName)\n ? (_d = options.processor) === null || _d === void 0 ? void 0 : _d.varyingFragmentKeywordName\n : !options.isFragment && ((_e = options.processor) === null || _e === void 0 ? void 0 : _e.varyingVertexKeywordName)\n ? (_f = options.processor) === null || _f === void 0 ? void 0 : _f.varyingVertexKeywordName\n : defaultVaryingKeywordName;\n if (!options.isFragment && processor.attributeProcessor && this.line.startsWith(attributeKeyword)) {\n value = processor.attributeProcessor(this.line, preprocessors, options.processingContext);\n }\n else if (processor.varyingProcessor &&\n (((_g = processor.varyingCheck) === null || _g === void 0 ? void 0 : _g.call(processor, this.line, options.isFragment)) || (!processor.varyingCheck && this.line.startsWith(varyingKeyword)))) {\n value = processor.varyingProcessor(this.line, options.isFragment, preprocessors, options.processingContext);\n }\n else if (processor.uniformProcessor && processor.uniformRegexp && processor.uniformRegexp.test(this.line)) {\n if (!options.lookForClosingBracketForUniformBuffer) {\n value = processor.uniformProcessor(this.line, options.isFragment, preprocessors, options.processingContext);\n }\n }\n else if (processor.uniformBufferProcessor && processor.uniformBufferRegexp && processor.uniformBufferRegexp.test(this.line)) {\n if (!options.lookForClosingBracketForUniformBuffer) {\n value = processor.uniformBufferProcessor(this.line, options.isFragment, options.processingContext);\n options.lookForClosingBracketForUniformBuffer = true;\n }\n }\n else if (processor.textureProcessor && processor.textureRegexp && processor.textureRegexp.test(this.line)) {\n value = processor.textureProcessor(this.line, options.isFragment, preprocessors, options.processingContext);\n }\n else if ((processor.uniformProcessor || processor.uniformBufferProcessor) && this.line.startsWith(\"uniform\") && !options.lookForClosingBracketForUniformBuffer) {\n const regex = /uniform\\s+(?:(?:highp)?|(?:lowp)?)\\s*(\\S+)\\s+(\\S+)\\s*;/;\n if (regex.test(this.line)) {\n // uniform\n if (processor.uniformProcessor) {\n value = processor.uniformProcessor(this.line, options.isFragment, preprocessors, options.processingContext);\n }\n }\n else {\n // Uniform buffer\n if (processor.uniformBufferProcessor) {\n value = processor.uniformBufferProcessor(this.line, options.isFragment, options.processingContext);\n options.lookForClosingBracketForUniformBuffer = true;\n }\n }\n }\n if (options.lookForClosingBracketForUniformBuffer && this.line.indexOf(\"}\") !== -1) {\n options.lookForClosingBracketForUniformBuffer = false;\n if (processor.endOfUniformBufferProcessor) {\n value = processor.endOfUniformBufferProcessor(this.line, options.isFragment, options.processingContext);\n }\n }\n }\n result += value + \"\\n\";\n }\n this.children.forEach((child) => {\n result += child.process(preprocessors, options);\n });\n if (this.additionalDefineKey) {\n preprocessors[this.additionalDefineKey] = this.additionalDefineValue || \"true\";\n }\n return result;\n }\n}\n//# sourceMappingURL=shaderCodeNode.js.map","/** @internal */\nexport class ShaderCodeCursor {\n constructor() {\n this._lines = [];\n }\n get currentLine() {\n return this._lines[this.lineIndex];\n }\n get canRead() {\n return this.lineIndex < this._lines.length - 1;\n }\n set lines(value) {\n this._lines.length = 0;\n for (const line of value) {\n // Skip empty lines\n if (!line || line === \"\\r\") {\n continue;\n }\n // Prevent removing line break in macros.\n if (line[0] === \"#\") {\n this._lines.push(line);\n continue;\n }\n // Do not split single line comments\n const trimmedLine = line.trim();\n if (!trimmedLine) {\n continue;\n }\n if (trimmedLine.startsWith(\"//\")) {\n this._lines.push(line);\n continue;\n }\n // Work with semicolon in the line\n const semicolonIndex = trimmedLine.indexOf(\";\");\n if (semicolonIndex === -1) {\n // No semicolon in the line\n this._lines.push(trimmedLine);\n }\n else if (semicolonIndex === trimmedLine.length - 1) {\n // Single semicolon at the end of the line\n // If trimmedLine == \";\", we must not push, to be backward compatible with the old code!\n if (trimmedLine.length > 1) {\n this._lines.push(trimmedLine);\n }\n }\n else {\n // Semicolon in the middle of the line\n const split = line.split(\";\");\n for (let index = 0; index < split.length; index++) {\n let subLine = split[index];\n if (!subLine) {\n continue;\n }\n subLine = subLine.trim();\n if (!subLine) {\n continue;\n }\n this._lines.push(subLine + (index !== split.length - 1 ? \";\" : \"\"));\n }\n }\n }\n }\n}\n//# sourceMappingURL=shaderCodeCursor.js.map","import { ShaderCodeNode } from \"./shaderCodeNode.js\";\n/** @internal */\nexport class ShaderCodeConditionNode extends ShaderCodeNode {\n process(preprocessors, options) {\n for (let index = 0; index < this.children.length; index++) {\n const node = this.children[index];\n if (node.isValid(preprocessors)) {\n return node.process(preprocessors, options);\n }\n }\n return \"\";\n }\n}\n//# sourceMappingURL=shaderCodeConditionNode.js.map","import { ShaderCodeNode } from \"./shaderCodeNode.js\";\n/** @internal */\nexport class ShaderCodeTestNode extends ShaderCodeNode {\n isValid(preprocessors) {\n return this.testExpression.isTrue(preprocessors);\n }\n}\n//# sourceMappingURL=shaderCodeTestNode.js.map","/* eslint-disable @typescript-eslint/naming-convention */\n/** @internal */\nexport class ShaderDefineExpression {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n isTrue(preprocessors) {\n return true;\n }\n static postfixToInfix(postfix) {\n const stack = [];\n for (const c of postfix) {\n if (ShaderDefineExpression._OperatorPriority[c] === undefined) {\n stack.push(c);\n }\n else {\n const v1 = stack[stack.length - 1], v2 = stack[stack.length - 2];\n stack.length -= 2;\n stack.push(`(${v2}${c}${v1})`);\n }\n }\n return stack[stack.length - 1];\n }\n /**\n * Converts an infix expression to a postfix expression.\n *\n * This method is used to transform infix expressions, which are more human-readable,\n * into postfix expressions, also known as Reverse Polish Notation (RPN), that can be\n * evaluated more efficiently by a computer. The conversion is based on the operator\n * priority defined in _OperatorPriority.\n *\n * The function employs a stack-based algorithm for the conversion and caches the result\n * to improve performance. The cache keeps track of each converted expression's access time\n * to manage the cache size and optimize memory usage. When the cache size exceeds a specified\n * limit, the least recently accessed items in the cache are deleted.\n *\n * The cache mechanism is particularly helpful for shader compilation, where the same infix\n * expressions might be encountered repeatedly, hence the caching can speed up the process.\n *\n * @param infix - The infix expression to be converted.\n * @returns The postfix expression as an array of strings.\n */\n static infixToPostfix(infix) {\n // Is infix already in cache\n const cacheItem = ShaderDefineExpression._InfixToPostfixCache.get(infix);\n if (cacheItem) {\n cacheItem.accessTime = Date.now();\n return cacheItem.result;\n }\n // Is infix contain any operator\n if (!infix.includes(\"&&\") && !infix.includes(\"||\") && !infix.includes(\")\") && !infix.includes(\"(\")) {\n return [infix];\n }\n const result = [];\n let stackIdx = -1;\n const pushOperand = () => {\n operand = operand.trim();\n if (operand !== \"\") {\n result.push(operand);\n operand = \"\";\n }\n };\n const push = (s) => {\n if (stackIdx < ShaderDefineExpression._Stack.length - 1) {\n ShaderDefineExpression._Stack[++stackIdx] = s;\n }\n };\n const peek = () => ShaderDefineExpression._Stack[stackIdx];\n const pop = () => (stackIdx === -1 ? \"!!INVALID EXPRESSION!!\" : ShaderDefineExpression._Stack[stackIdx--]);\n let idx = 0, operand = \"\";\n while (idx < infix.length) {\n const c = infix.charAt(idx), token = idx < infix.length - 1 ? infix.substr(idx, 2) : \"\";\n if (c === \"(\") {\n operand = \"\";\n push(c);\n }\n else if (c === \")\") {\n pushOperand();\n while (stackIdx !== -1 && peek() !== \"(\") {\n result.push(pop());\n }\n pop();\n }\n else if (ShaderDefineExpression._OperatorPriority[token] > 1) {\n pushOperand();\n while (stackIdx !== -1 && ShaderDefineExpression._OperatorPriority[peek()] >= ShaderDefineExpression._OperatorPriority[token]) {\n result.push(pop());\n }\n push(token);\n idx++;\n }\n else {\n operand += c;\n }\n idx++;\n }\n pushOperand();\n while (stackIdx !== -1) {\n if (peek() === \"(\") {\n pop();\n }\n else {\n result.push(pop());\n }\n }\n // If the cache is at capacity, clear it before adding a new item\n if (ShaderDefineExpression._InfixToPostfixCache.size >= ShaderDefineExpression.InfixToPostfixCacheLimitSize) {\n ShaderDefineExpression.ClearCache();\n }\n // Add the new item to the cache, including the current time as the last access time\n ShaderDefineExpression._InfixToPostfixCache.set(infix, { result, accessTime: Date.now() });\n return result;\n }\n static ClearCache() {\n // Convert the cache to an array and sort by last access time\n const sortedCache = Array.from(ShaderDefineExpression._InfixToPostfixCache.entries()).sort((a, b) => a[1].accessTime - b[1].accessTime);\n // Remove the least recently accessed half of the cache\n for (let i = 0; i < ShaderDefineExpression.InfixToPostfixCacheCleanupSize; i++) {\n ShaderDefineExpression._InfixToPostfixCache.delete(sortedCache[i][0]);\n }\n }\n}\n/**\n * Cache items count limit for the InfixToPostfix cache.\n * It uses to improve the performance of the shader compilation.\n * For details see PR: https://github.com/BabylonJS/Babylon.js/pull/13936\n */\nShaderDefineExpression.InfixToPostfixCacheLimitSize = 50000;\n/**\n * When the cache size is exceeded, a cache cleanup will be triggered\n * and the cache will be reduced by the size specified\n * in the InfixToPostfixCacheCleanupSize variable, removing entries\n * that have not been accessed the longest.\n */\nShaderDefineExpression.InfixToPostfixCacheCleanupSize = 25000;\nShaderDefineExpression._InfixToPostfixCache = new Map();\nShaderDefineExpression._OperatorPriority = {\n \")\": 0,\n \"(\": 1,\n \"||\": 2,\n \"&&\": 3,\n};\nShaderDefineExpression._Stack = [\"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\"];\n//# sourceMappingURL=shaderDefineExpression.js.map","import { ShaderDefineExpression } from \"../shaderDefineExpression.js\";\n/** @internal */\nexport class ShaderDefineIsDefinedOperator extends ShaderDefineExpression {\n constructor(define, not = false) {\n super();\n this.define = define;\n this.not = not;\n }\n isTrue(preprocessors) {\n let condition = preprocessors[this.define] !== undefined;\n if (this.not) {\n condition = !condition;\n }\n return condition;\n }\n}\n//# sourceMappingURL=shaderDefineIsDefinedOperator.js.map","import { ShaderDefineExpression } from \"../shaderDefineExpression.js\";\n/** @internal */\nexport class ShaderDefineOrOperator extends ShaderDefineExpression {\n isTrue(preprocessors) {\n return this.leftOperand.isTrue(preprocessors) || this.rightOperand.isTrue(preprocessors);\n }\n}\n//# sourceMappingURL=shaderDefineOrOperator.js.map","import { ShaderDefineExpression } from \"../shaderDefineExpression.js\";\n/** @internal */\nexport class ShaderDefineAndOperator extends ShaderDefineExpression {\n isTrue(preprocessors) {\n return this.leftOperand.isTrue(preprocessors) && this.rightOperand.isTrue(preprocessors);\n }\n}\n//# sourceMappingURL=shaderDefineAndOperator.js.map","import { ShaderDefineExpression } from \"../shaderDefineExpression.js\";\n/** @internal */\nexport class ShaderDefineArithmeticOperator extends ShaderDefineExpression {\n constructor(define, operand, testValue) {\n super();\n this.define = define;\n this.operand = operand;\n this.testValue = testValue;\n }\n isTrue(preprocessors) {\n let value = preprocessors[this.define];\n if (value === undefined) {\n value = this.define;\n }\n let condition = false;\n const left = parseInt(value);\n const right = parseInt(this.testValue);\n switch (this.operand) {\n case \">\":\n condition = left > right;\n break;\n case \"<\":\n condition = left < right;\n break;\n case \"<=\":\n condition = left <= right;\n break;\n case \">=\":\n condition = left >= right;\n break;\n case \"==\":\n condition = left === right;\n break;\n case \"!=\":\n condition = left !== right;\n break;\n }\n return condition;\n }\n}\n//# sourceMappingURL=shaderDefineArithmeticOperator.js.map","/**\n * Language of the shader code\n */\nexport var ShaderLanguage;\n(function (ShaderLanguage) {\n /** language is GLSL (used by WebGL) */\n ShaderLanguage[ShaderLanguage[\"GLSL\"] = 0] = \"GLSL\";\n /** language is WGSL (used by WebGPU) */\n ShaderLanguage[ShaderLanguage[\"WGSL\"] = 1] = \"WGSL\";\n})(ShaderLanguage || (ShaderLanguage = {}));\n//# sourceMappingURL=shaderLanguage.js.map","/* eslint-disable @typescript-eslint/no-unused-vars */\nimport { ShaderCodeNode } from \"./shaderCodeNode.js\";\nimport { ShaderCodeCursor } from \"./shaderCodeCursor.js\";\nimport { ShaderCodeConditionNode } from \"./shaderCodeConditionNode.js\";\nimport { ShaderCodeTestNode } from \"./shaderCodeTestNode.js\";\nimport { ShaderDefineIsDefinedOperator } from \"./Expressions/Operators/shaderDefineIsDefinedOperator.js\";\nimport { ShaderDefineOrOperator } from \"./Expressions/Operators/shaderDefineOrOperator.js\";\nimport { ShaderDefineAndOperator } from \"./Expressions/Operators/shaderDefineAndOperator.js\";\nimport { ShaderDefineExpression } from \"./Expressions/shaderDefineExpression.js\";\nimport { ShaderDefineArithmeticOperator } from \"./Expressions/Operators/shaderDefineArithmeticOperator.js\";\nimport { _WarnImport } from \"../../Misc/devTools.js\";\nimport { ShaderLanguage } from \"../../Materials/shaderLanguage.js\";\nconst regexSE = /defined\\s*?\\((.+?)\\)/g;\nconst regexSERevert = /defined\\s*?\\[(.+?)\\]/g;\nconst regexShaderInclude = /#include\\s?<(.+)>(\\((.*)\\))*(\\[(.*)\\])*/g;\nconst regexShaderDecl = /__decl__/;\nconst regexLightX = /light\\{X\\}.(\\w*)/g;\nconst regexX = /\\{X\\}/g;\nconst reusableMatches = [];\n/** @internal */\nexport class ShaderProcessor {\n static Initialize(options) {\n if (options.processor && options.processor.initializeShaders) {\n options.processor.initializeShaders(options.processingContext);\n }\n }\n static Process(sourceCode, options, callback, engine) {\n var _a;\n if ((_a = options.processor) === null || _a === void 0 ? void 0 : _a.preProcessShaderCode) {\n sourceCode = options.processor.preProcessShaderCode(sourceCode, options.isFragment);\n }\n this._ProcessIncludes(sourceCode, options, (codeWithIncludes) => {\n if (options.processCodeAfterIncludes) {\n codeWithIncludes = options.processCodeAfterIncludes(options.isFragment ? \"fragment\" : \"vertex\", codeWithIncludes);\n }\n const migratedCode = this._ProcessShaderConversion(codeWithIncludes, options, engine);\n callback(migratedCode, codeWithIncludes);\n });\n }\n static PreProcess(sourceCode, options, callback, engine) {\n var _a;\n if ((_a = options.processor) === null || _a === void 0 ? void 0 : _a.preProcessShaderCode) {\n sourceCode = options.processor.preProcessShaderCode(sourceCode, options.isFragment);\n }\n this._ProcessIncludes(sourceCode, options, (codeWithIncludes) => {\n if (options.processCodeAfterIncludes) {\n codeWithIncludes = options.processCodeAfterIncludes(options.isFragment ? \"fragment\" : \"vertex\", codeWithIncludes);\n }\n const migratedCode = this._ApplyPreProcessing(codeWithIncludes, options, engine);\n callback(migratedCode, codeWithIncludes);\n });\n }\n static Finalize(vertexCode, fragmentCode, options) {\n if (!options.processor || !options.processor.finalizeShaders) {\n return { vertexCode, fragmentCode };\n }\n return options.processor.finalizeShaders(vertexCode, fragmentCode, options.processingContext);\n }\n static _ProcessPrecision(source, options) {\n var _a;\n if ((_a = options.processor) === null || _a === void 0 ? void 0 : _a.noPrecision) {\n return source;\n }\n const shouldUseHighPrecisionShader = options.shouldUseHighPrecisionShader;\n if (source.indexOf(\"precision highp float\") === -1) {\n if (!shouldUseHighPrecisionShader) {\n source = \"precision mediump float;\\n\" + source;\n }\n else {\n source = \"precision highp float;\\n\" + source;\n }\n }\n else {\n if (!shouldUseHighPrecisionShader) {\n // Moving highp to mediump\n source = source.replace(\"precision highp float\", \"precision mediump float\");\n }\n }\n return source;\n }\n static _ExtractOperation(expression) {\n const regex = /defined\\((.+)\\)/;\n const match = regex.exec(expression);\n if (match && match.length) {\n return new ShaderDefineIsDefinedOperator(match[1].trim(), expression[0] === \"!\");\n }\n const operators = [\"==\", \"!=\", \">=\", \"<=\", \"<\", \">\"];\n let operator = \"\";\n let indexOperator = 0;\n for (operator of operators) {\n indexOperator = expression.indexOf(operator);\n if (indexOperator > -1) {\n break;\n }\n }\n if (indexOperator === -1) {\n return new ShaderDefineIsDefinedOperator(expression);\n }\n const define = expression.substring(0, indexOperator).trim();\n const value = expression.substring(indexOperator + operator.length).trim();\n return new ShaderDefineArithmeticOperator(define, operator, value);\n }\n static _BuildSubExpression(expression) {\n expression = expression.replace(regexSE, \"defined[$1]\");\n const postfix = ShaderDefineExpression.infixToPostfix(expression);\n const stack = [];\n for (const c of postfix) {\n if (c !== \"||\" && c !== \"&&\") {\n stack.push(c);\n }\n else if (stack.length >= 2) {\n let v1 = stack[stack.length - 1], v2 = stack[stack.length - 2];\n stack.length -= 2;\n const operator = c == \"&&\" ? new ShaderDefineAndOperator() : new ShaderDefineOrOperator();\n if (typeof v1 === \"string\") {\n v1 = v1.replace(regexSERevert, \"defined($1)\");\n }\n if (typeof v2 === \"string\") {\n v2 = v2.replace(regexSERevert, \"defined($1)\");\n }\n operator.leftOperand = typeof v2 === \"string\" ? this._ExtractOperation(v2) : v2;\n operator.rightOperand = typeof v1 === \"string\" ? this._ExtractOperation(v1) : v1;\n stack.push(operator);\n }\n }\n let result = stack[stack.length - 1];\n if (typeof result === \"string\") {\n result = result.replace(regexSERevert, \"defined($1)\");\n }\n // note: stack.length !== 1 if there was an error in the parsing\n return typeof result === \"string\" ? this._ExtractOperation(result) : result;\n }\n static _BuildExpression(line, start) {\n const node = new ShaderCodeTestNode();\n const command = line.substring(0, start);\n let expression = line.substring(start);\n expression = expression.substring(0, (expression.indexOf(\"//\") + 1 || expression.length + 1) - 1).trim();\n if (command === \"#ifdef\") {\n node.testExpression = new ShaderDefineIsDefinedOperator(expression);\n }\n else if (command === \"#ifndef\") {\n node.testExpression = new ShaderDefineIsDefinedOperator(expression, true);\n }\n else {\n node.testExpression = this._BuildSubExpression(expression);\n }\n return node;\n }\n static _MoveCursorWithinIf(cursor, rootNode, ifNode) {\n let line = cursor.currentLine;\n while (this._MoveCursor(cursor, ifNode)) {\n line = cursor.currentLine;\n const first5 = line.substring(0, 5).toLowerCase();\n if (first5 === \"#else\") {\n const elseNode = new ShaderCodeNode();\n rootNode.children.push(elseNode);\n this._MoveCursor(cursor, elseNode);\n return;\n }\n else if (first5 === \"#elif\") {\n const elifNode = this._BuildExpression(line, 5);\n rootNode.children.push(elifNode);\n ifNode = elifNode;\n }\n }\n }\n static _MoveCursor(cursor, rootNode) {\n while (cursor.canRead) {\n cursor.lineIndex++;\n const line = cursor.currentLine;\n if (line.indexOf(\"#\") >= 0) {\n const matches = ShaderProcessor._MoveCursorRegex.exec(line);\n if (matches && matches.length) {\n const keyword = matches[0];\n switch (keyword) {\n case \"#ifdef\": {\n const newRootNode = new ShaderCodeConditionNode();\n rootNode.children.push(newRootNode);\n const ifNode = this._BuildExpression(line, 6);\n newRootNode.children.push(ifNode);\n this._MoveCursorWithinIf(cursor, newRootNode, ifNode);\n break;\n }\n case \"#else\":\n case \"#elif\":\n return true;\n case \"#endif\":\n return false;\n case \"#ifndef\": {\n const newRootNode = new ShaderCodeConditionNode();\n rootNode.children.push(newRootNode);\n const ifNode = this._BuildExpression(line, 7);\n newRootNode.children.push(ifNode);\n this._MoveCursorWithinIf(cursor, newRootNode, ifNode);\n break;\n }\n case \"#if\": {\n const newRootNode = new ShaderCodeConditionNode();\n const ifNode = this._BuildExpression(line, 3);\n rootNode.children.push(newRootNode);\n newRootNode.children.push(ifNode);\n this._MoveCursorWithinIf(cursor, newRootNode, ifNode);\n break;\n }\n }\n continue;\n }\n }\n const newNode = new ShaderCodeNode();\n newNode.line = line;\n rootNode.children.push(newNode);\n // Detect additional defines\n if (line[0] === \"#\" && line[1] === \"d\") {\n const split = line.replace(\";\", \"\").split(\" \");\n newNode.additionalDefineKey = split[1];\n if (split.length === 3) {\n newNode.additionalDefineValue = split[2];\n }\n }\n }\n return false;\n }\n static _EvaluatePreProcessors(sourceCode, preprocessors, options) {\n const rootNode = new ShaderCodeNode();\n const cursor = new ShaderCodeCursor();\n cursor.lineIndex = -1;\n cursor.lines = sourceCode.split(\"\\n\");\n // Decompose (We keep it in 2 steps so it is easier to maintain and perf hit is insignificant)\n this._MoveCursor(cursor, rootNode);\n // Recompose\n return rootNode.process(preprocessors, options);\n }\n static _PreparePreProcessors(options, engine) {\n var _a;\n const defines = options.defines;\n const preprocessors = {};\n for (const define of defines) {\n const keyValue = define.replace(\"#define\", \"\").replace(\";\", \"\").trim();\n const split = keyValue.split(\" \");\n preprocessors[split[0]] = split.length > 1 ? split[1] : \"\";\n }\n if (((_a = options.processor) === null || _a === void 0 ? void 0 : _a.shaderLanguage) === ShaderLanguage.GLSL) {\n preprocessors[\"GL_ES\"] = \"true\";\n }\n preprocessors[\"__VERSION__\"] = options.version;\n preprocessors[options.platformName] = \"true\";\n engine._getGlobalDefines(preprocessors);\n return preprocessors;\n }\n static _ProcessShaderConversion(sourceCode, options, engine) {\n let preparedSourceCode = this._ProcessPrecision(sourceCode, options);\n if (!options.processor) {\n return preparedSourceCode;\n }\n // Already converted\n if (options.processor.shaderLanguage === ShaderLanguage.GLSL && preparedSourceCode.indexOf(\"#version 3\") !== -1) {\n preparedSourceCode = preparedSourceCode.replace(\"#version 300 es\", \"\");\n if (!options.processor.parseGLES3) {\n return preparedSourceCode;\n }\n }\n const defines = options.defines;\n const preprocessors = this._PreparePreProcessors(options, engine);\n // General pre processing\n if (options.processor.preProcessor) {\n preparedSourceCode = options.processor.preProcessor(preparedSourceCode, defines, options.isFragment, options.processingContext);\n }\n preparedSourceCode = this._EvaluatePreProcessors(preparedSourceCode, preprocessors, options);\n // Post processing\n if (options.processor.postProcessor) {\n preparedSourceCode = options.processor.postProcessor(preparedSourceCode, defines, options.isFragment, options.processingContext, engine);\n }\n // Inline functions tagged with #define inline\n if (engine._features.needShaderCodeInlining) {\n preparedSourceCode = engine.inlineShaderCode(preparedSourceCode);\n }\n return preparedSourceCode;\n }\n static _ApplyPreProcessing(sourceCode, options, engine) {\n var _a, _b;\n let preparedSourceCode = sourceCode;\n const defines = options.defines;\n const preprocessors = this._PreparePreProcessors(options, engine);\n // General pre processing\n if ((_a = options.processor) === null || _a === void 0 ? void 0 : _a.preProcessor) {\n preparedSourceCode = options.processor.preProcessor(preparedSourceCode, defines, options.isFragment, options.processingContext);\n }\n preparedSourceCode = this._EvaluatePreProcessors(preparedSourceCode, preprocessors, options);\n // Post processing\n if ((_b = options.processor) === null || _b === void 0 ? void 0 : _b.postProcessor) {\n preparedSourceCode = options.processor.postProcessor(preparedSourceCode, defines, options.isFragment, options.processingContext, engine);\n }\n // Inline functions tagged with #define inline\n if (engine._features.needShaderCodeInlining) {\n preparedSourceCode = engine.inlineShaderCode(preparedSourceCode);\n }\n return preparedSourceCode;\n }\n /** @internal */\n static _ProcessIncludes(sourceCode, options, callback) {\n reusableMatches.length = 0;\n let match;\n // stay back-compat to the old matchAll syntax\n while ((match = regexShaderInclude.exec(sourceCode)) !== null) {\n reusableMatches.push(match);\n }\n let returnValue = String(sourceCode);\n let parts = [sourceCode];\n let keepProcessing = false;\n for (const match of reusableMatches) {\n let includeFile = match[1];\n // Uniform declaration\n if (includeFile.indexOf(\"__decl__\") !== -1) {\n includeFile = includeFile.replace(regexShaderDecl, \"\");\n if (options.supportsUniformBuffers) {\n includeFile = includeFile.replace(\"Vertex\", \"Ubo\").replace(\"Fragment\", \"Ubo\");\n }\n includeFile = includeFile + \"Declaration\";\n }\n if (options.includesShadersStore[includeFile]) {\n // Substitution\n let includeContent = options.includesShadersStore[includeFile];\n if (match[2]) {\n const splits = match[3].split(\",\");\n for (let index = 0; index < splits.length; index += 2) {\n const source = new RegExp(splits[index], \"g\");\n const dest = splits[index + 1];\n includeContent = includeContent.replace(source, dest);\n }\n }\n if (match[4]) {\n const indexString = match[5];\n if (indexString.indexOf(\"..\") !== -1) {\n const indexSplits = indexString.split(\"..\");\n const minIndex = parseInt(indexSplits[0]);\n let maxIndex = parseInt(indexSplits[1]);\n let sourceIncludeContent = includeContent.slice(0);\n includeContent = \"\";\n if (isNaN(maxIndex)) {\n maxIndex = options.indexParameters[indexSplits[1]];\n }\n for (let i = minIndex; i < maxIndex; i++) {\n if (!options.supportsUniformBuffers) {\n // Ubo replacement\n sourceIncludeContent = sourceIncludeContent.replace(regexLightX, (str, p1) => {\n return p1 + \"{X}\";\n });\n }\n includeContent += sourceIncludeContent.replace(regexX, i.toString()) + \"\\n\";\n }\n }\n else {\n if (!options.supportsUniformBuffers) {\n // Ubo replacement\n includeContent = includeContent.replace(regexLightX, (str, p1) => {\n return p1 + \"{X}\";\n });\n }\n includeContent = includeContent.replace(regexX, indexString);\n }\n }\n // Replace\n // Split all parts on match[0] and intersperse the parts with the include content\n const newParts = [];\n for (const part of parts) {\n const splitPart = part.split(match[0]);\n for (let i = 0; i < splitPart.length - 1; i++) {\n newParts.push(splitPart[i]);\n newParts.push(includeContent);\n }\n newParts.push(splitPart[splitPart.length - 1]);\n }\n parts = newParts;\n keepProcessing = keepProcessing || includeContent.indexOf(\"#include<\") >= 0 || includeContent.indexOf(\"#include <\") >= 0;\n }\n else {\n const includeShaderUrl = options.shadersRepository + \"ShadersInclude/\" + includeFile + \".fx\";\n ShaderProcessor._FileToolsLoadFile(includeShaderUrl, (fileContent) => {\n options.includesShadersStore[includeFile] = fileContent;\n this._ProcessIncludes(parts.join(\"\"), options, callback);\n });\n return;\n }\n }\n reusableMatches.length = 0;\n returnValue = parts.join(\"\");\n if (keepProcessing) {\n this._ProcessIncludes(returnValue.toString(), options, callback);\n }\n else {\n callback(returnValue);\n }\n }\n /**\n * Loads a file from a url\n * @param url url to load\n * @param onSuccess callback called when the file successfully loads\n * @param onProgress callback called while file is loading (if the server supports this mode)\n * @param offlineProvider defines the offline provider for caching\n * @param useArrayBuffer defines a boolean indicating that date must be returned as ArrayBuffer\n * @param onError callback called when the file fails to load\n * @returns a file request object\n * @internal\n */\n static _FileToolsLoadFile(url, onSuccess, onProgress, offlineProvider, useArrayBuffer, onError) {\n throw _WarnImport(\"FileTools\");\n }\n}\nShaderProcessor._MoveCursorRegex = /(#ifdef)|(#else)|(#elif)|(#endif)|(#ifndef)|(#if)/;\n//# sourceMappingURL=shaderProcessor.js.map","import { ShaderLanguage } from \"../Materials/shaderLanguage.js\";\n/**\n * Defines the shader related stores and directory\n */\nexport class ShaderStore {\n /**\n * Gets the shaders repository path for a given shader language\n * @param shaderLanguage the shader language\n * @returns the path to the shaders repository\n */\n static GetShadersRepository(shaderLanguage = ShaderLanguage.GLSL) {\n return shaderLanguage === ShaderLanguage.GLSL ? ShaderStore.ShadersRepository : ShaderStore.ShadersRepositoryWGSL;\n }\n /**\n * Gets the shaders store of a given shader language\n * @param shaderLanguage the shader language\n * @returns the shaders store\n */\n static GetShadersStore(shaderLanguage = ShaderLanguage.GLSL) {\n return shaderLanguage === ShaderLanguage.GLSL ? ShaderStore.ShadersStore : ShaderStore.ShadersStoreWGSL;\n }\n /**\n * Gets the include shaders store of a given shader language\n * @param shaderLanguage the shader language\n * @returns the include shaders store\n */\n static GetIncludesShadersStore(shaderLanguage = ShaderLanguage.GLSL) {\n return shaderLanguage === ShaderLanguage.GLSL ? ShaderStore.IncludesShadersStore : ShaderStore.IncludesShadersStoreWGSL;\n }\n}\n/**\n * Gets or sets the relative url used to load shaders if using the engine in non-minified mode\n */\nShaderStore.ShadersRepository = \"src/Shaders/\";\n/**\n * Store of each shader (The can be looked up using effect.key)\n */\nShaderStore.ShadersStore = {};\n/**\n * Store of each included file for a shader (The can be looked up using effect.key)\n */\nShaderStore.IncludesShadersStore = {};\n/**\n * Gets or sets the relative url used to load shaders (WGSL) if using the engine in non-minified mode\n */\nShaderStore.ShadersRepositoryWGSL = \"src/ShadersWGSL/\";\n/**\n * Store of each shader (WGSL)\n */\nShaderStore.ShadersStoreWGSL = {};\n/**\n * Store of each included file for a shader (WGSL)\n */\nShaderStore.IncludesShadersStoreWGSL = {};\n//# sourceMappingURL=shaderStore.js.map","import { Observable } from \"../Misc/observable.js\";\n\nimport { GetDOMTextContent, IsWindowObjectExist } from \"../Misc/domManagement.js\";\nimport { Logger } from \"../Misc/logger.js\";\nimport { ShaderProcessor } from \"../Engines/Processors/shaderProcessor.js\";\nimport { ShaderStore as EngineShaderStore } from \"../Engines/shaderStore.js\";\nimport { ShaderLanguage } from \"./shaderLanguage.js\";\n/**\n * Effect containing vertex and fragment shader that can be executed on an object.\n */\nexport class Effect {\n /**\n * Gets or sets the relative url used to load shaders if using the engine in non-minified mode\n */\n static get ShadersRepository() {\n return EngineShaderStore.ShadersRepository;\n }\n static set ShadersRepository(repo) {\n EngineShaderStore.ShadersRepository = repo;\n }\n /**\n * Observable that will be called when effect is bound.\n */\n get onBindObservable() {\n if (!this._onBindObservable) {\n this._onBindObservable = new Observable();\n }\n return this._onBindObservable;\n }\n /**\n * Instantiates an effect.\n * An effect can be used to create/manage/execute vertex and fragment shaders.\n * @param baseName Name of the effect.\n * @param attributesNamesOrOptions List of attribute names that will be passed to the shader or set of all options to create the effect.\n * @param uniformsNamesOrEngine List of uniform variable names that will be passed to the shader or the engine that will be used to render effect.\n * @param samplers List of sampler variables that will be passed to the shader.\n * @param engine Engine to be used to render the effect\n * @param defines Define statements to be added to the shader.\n * @param fallbacks Possible fallbacks for this effect to improve performance when needed.\n * @param onCompiled Callback that will be called when the shader is compiled.\n * @param onError Callback that will be called if an error occurs during shader compilation.\n * @param indexParameters Parameters to be used with Babylons include syntax to iterate over an array (eg. {lights: 10})\n * @param key Effect Key identifying uniquely compiled shader variants\n * @param shaderLanguage the language the shader is written in (default: GLSL)\n */\n constructor(baseName, attributesNamesOrOptions, uniformsNamesOrEngine, samplers = null, engine, defines = null, fallbacks = null, onCompiled = null, onError = null, indexParameters, key = \"\", shaderLanguage = ShaderLanguage.GLSL) {\n var _a, _b, _c;\n /**\n * Name of the effect.\n */\n this.name = null;\n /**\n * String container all the define statements that should be set on the shader.\n */\n this.defines = \"\";\n /**\n * Callback that will be called when the shader is compiled.\n */\n this.onCompiled = null;\n /**\n * Callback that will be called if an error occurs during shader compilation.\n */\n this.onError = null;\n /**\n * Callback that will be called when effect is bound.\n */\n this.onBind = null;\n /**\n * Unique ID of the effect.\n */\n this.uniqueId = 0;\n /**\n * Observable that will be called when the shader is compiled.\n * It is recommended to use executeWhenCompile() or to make sure that scene.isReady() is called to get this observable raised.\n */\n this.onCompileObservable = new Observable();\n /**\n * Observable that will be called if an error occurs during shader compilation.\n */\n this.onErrorObservable = new Observable();\n /** @internal */\n this._onBindObservable = null;\n /**\n * @internal\n * Specifies if the effect was previously ready\n */\n this._wasPreviouslyReady = false;\n /**\n * @internal\n * Forces the code from bindForSubMesh to be fully run the next time it is called\n * It is used in frozen mode to make sure the effect is properly rebound when a new effect is created\n */\n this._forceRebindOnNextCall = false;\n /**\n * @internal\n * Specifies if the effect was previously using instances\n */\n this._wasPreviouslyUsingInstances = null;\n this._isDisposed = false;\n /** @internal */\n this._bonesComputationForcedToCPU = false;\n /** @internal */\n this._uniformBuffersNames = {};\n /** @internal */\n this._multiTarget = false;\n this._samplers = {};\n this._isReady = false;\n this._compilationError = \"\";\n this._allFallbacksProcessed = false;\n this._uniforms = {};\n /**\n * Key for the effect.\n * @internal\n */\n this._key = \"\";\n this._fallbacks = null;\n this._vertexSourceCodeOverride = \"\";\n this._fragmentSourceCodeOverride = \"\";\n this._transformFeedbackVaryings = null;\n /**\n * Compiled shader to webGL program.\n * @internal\n */\n this._pipelineContext = null;\n /** @internal */\n this._vertexSourceCode = \"\";\n /** @internal */\n this._fragmentSourceCode = \"\";\n /** @internal */\n this._vertexSourceCodeBeforeMigration = \"\";\n /** @internal */\n this._fragmentSourceCodeBeforeMigration = \"\";\n /** @internal */\n this._rawVertexSourceCode = \"\";\n /** @internal */\n this._rawFragmentSourceCode = \"\";\n this.name = baseName;\n this._key = key;\n let processCodeAfterIncludes = undefined;\n let processFinalCode = null;\n if (attributesNamesOrOptions.attributes) {\n const options = attributesNamesOrOptions;\n this._engine = uniformsNamesOrEngine;\n this._attributesNames = options.attributes;\n this._uniformsNames = options.uniformsNames.concat(options.samplers);\n this._samplerList = options.samplers.slice();\n this.defines = options.defines;\n this.onError = options.onError;\n this.onCompiled = options.onCompiled;\n this._fallbacks = options.fallbacks;\n this._indexParameters = options.indexParameters;\n this._transformFeedbackVaryings = options.transformFeedbackVaryings || null;\n this._multiTarget = !!options.multiTarget;\n this._shaderLanguage = (_a = options.shaderLanguage) !== null && _a !== void 0 ? _a : ShaderLanguage.GLSL;\n if (options.uniformBuffersNames) {\n this._uniformBuffersNamesList = options.uniformBuffersNames.slice();\n for (let i = 0; i < options.uniformBuffersNames.length; i++) {\n this._uniformBuffersNames[options.uniformBuffersNames[i]] = i;\n }\n }\n processFinalCode = (_b = options.processFinalCode) !== null && _b !== void 0 ? _b : null;\n processCodeAfterIncludes = (_c = options.processCodeAfterIncludes) !== null && _c !== void 0 ? _c : undefined;\n }\n else {\n this._engine = engine;\n this.defines = defines == null ? \"\" : defines;\n this._uniformsNames = uniformsNamesOrEngine.concat(samplers);\n this._samplerList = samplers ? samplers.slice() : [];\n this._attributesNames = attributesNamesOrOptions;\n this._uniformBuffersNamesList = [];\n this._shaderLanguage = shaderLanguage;\n this.onError = onError;\n this.onCompiled = onCompiled;\n this._indexParameters = indexParameters;\n this._fallbacks = fallbacks;\n }\n this._attributeLocationByName = {};\n this.uniqueId = Effect._UniqueIdSeed++;\n let vertexSource;\n let fragmentSource;\n const hostDocument = IsWindowObjectExist() ? this._engine.getHostDocument() : null;\n if (baseName.vertexSource) {\n vertexSource = \"source:\" + baseName.vertexSource;\n }\n else if (baseName.vertexElement) {\n vertexSource = hostDocument ? hostDocument.getElementById(baseName.vertexElement) : null;\n if (!vertexSource) {\n vertexSource = baseName.vertexElement;\n }\n }\n else {\n vertexSource = baseName.vertex || baseName;\n }\n if (baseName.fragmentSource) {\n fragmentSource = \"source:\" + baseName.fragmentSource;\n }\n else if (baseName.fragmentElement) {\n fragmentSource = hostDocument ? hostDocument.getElementById(baseName.fragmentElement) : null;\n if (!fragmentSource) {\n fragmentSource = baseName.fragmentElement;\n }\n }\n else {\n fragmentSource = baseName.fragment || baseName;\n }\n this._processingContext = this._engine._getShaderProcessingContext(this._shaderLanguage);\n let processorOptions = {\n defines: this.defines.split(\"\\n\"),\n indexParameters: this._indexParameters,\n isFragment: false,\n shouldUseHighPrecisionShader: this._engine._shouldUseHighPrecisionShader,\n processor: this._engine._getShaderProcessor(this._shaderLanguage),\n supportsUniformBuffers: this._engine.supportsUniformBuffers,\n shadersRepository: EngineShaderStore.GetShadersRepository(this._shaderLanguage),\n includesShadersStore: EngineShaderStore.GetIncludesShadersStore(this._shaderLanguage),\n version: (this._engine.version * 100).toString(),\n platformName: this._engine.shaderPlatformName,\n processingContext: this._processingContext,\n isNDCHalfZRange: this._engine.isNDCHalfZRange,\n useReverseDepthBuffer: this._engine.useReverseDepthBuffer,\n processCodeAfterIncludes,\n };\n const shaderCodes = [undefined, undefined];\n const shadersLoaded = () => {\n if (shaderCodes[0] && shaderCodes[1]) {\n processorOptions.isFragment = true;\n const [migratedVertexCode, fragmentCode] = shaderCodes;\n ShaderProcessor.Process(fragmentCode, processorOptions, (migratedFragmentCode, codeBeforeMigration) => {\n this._fragmentSourceCodeBeforeMigration = codeBeforeMigration;\n if (processFinalCode) {\n migratedFragmentCode = processFinalCode(\"fragment\", migratedFragmentCode);\n }\n const finalShaders = ShaderProcessor.Finalize(migratedVertexCode, migratedFragmentCode, processorOptions);\n processorOptions = null;\n this._useFinalCode(finalShaders.vertexCode, finalShaders.fragmentCode, baseName);\n }, this._engine);\n }\n };\n this._loadShader(vertexSource, \"Vertex\", \"\", (vertexCode) => {\n ShaderProcessor.Initialize(processorOptions);\n ShaderProcessor.Process(vertexCode, processorOptions, (migratedVertexCode, codeBeforeMigration) => {\n this._rawVertexSourceCode = vertexCode;\n this._vertexSourceCodeBeforeMigration = codeBeforeMigration;\n if (processFinalCode) {\n migratedVertexCode = processFinalCode(\"vertex\", migratedVertexCode);\n }\n shaderCodes[0] = migratedVertexCode;\n shadersLoaded();\n }, this._engine);\n });\n this._loadShader(fragmentSource, \"Fragment\", \"Pixel\", (fragmentCode) => {\n this._rawFragmentSourceCode = fragmentCode;\n shaderCodes[1] = fragmentCode;\n shadersLoaded();\n });\n }\n _useFinalCode(migratedVertexCode, migratedFragmentCode, baseName) {\n if (baseName) {\n const vertex = baseName.vertexElement || baseName.vertex || baseName.spectorName || baseName;\n const fragment = baseName.fragmentElement || baseName.fragment || baseName.spectorName || baseName;\n this._vertexSourceCode = (this._shaderLanguage === ShaderLanguage.WGSL ? \"//\" : \"\") + \"#define SHADER_NAME vertex:\" + vertex + \"\\n\" + migratedVertexCode;\n this._fragmentSourceCode = (this._shaderLanguage === ShaderLanguage.WGSL ? \"//\" : \"\") + \"#define SHADER_NAME fragment:\" + fragment + \"\\n\" + migratedFragmentCode;\n }\n else {\n this._vertexSourceCode = migratedVertexCode;\n this._fragmentSourceCode = migratedFragmentCode;\n }\n this._prepareEffect();\n }\n /**\n * Unique key for this effect\n */\n get key() {\n return this._key;\n }\n /**\n * If the effect has been compiled and prepared.\n * @returns if the effect is compiled and prepared.\n */\n isReady() {\n try {\n return this._isReadyInternal();\n }\n catch (_a) {\n return false;\n }\n }\n _isReadyInternal() {\n if (this._isReady) {\n return true;\n }\n if (this._pipelineContext) {\n return this._pipelineContext.isReady;\n }\n return false;\n }\n /**\n * The engine the effect was initialized with.\n * @returns the engine.\n */\n getEngine() {\n return this._engine;\n }\n /**\n * The pipeline context for this effect\n * @returns the associated pipeline context\n */\n getPipelineContext() {\n return this._pipelineContext;\n }\n /**\n * The set of names of attribute variables for the shader.\n * @returns An array of attribute names.\n */\n getAttributesNames() {\n return this._attributesNames;\n }\n /**\n * Returns the attribute at the given index.\n * @param index The index of the attribute.\n * @returns The location of the attribute.\n */\n getAttributeLocation(index) {\n return this._attributes[index];\n }\n /**\n * Returns the attribute based on the name of the variable.\n * @param name of the attribute to look up.\n * @returns the attribute location.\n */\n getAttributeLocationByName(name) {\n return this._attributeLocationByName[name];\n }\n /**\n * The number of attributes.\n * @returns the number of attributes.\n */\n getAttributesCount() {\n return this._attributes.length;\n }\n /**\n * Gets the index of a uniform variable.\n * @param uniformName of the uniform to look up.\n * @returns the index.\n */\n getUniformIndex(uniformName) {\n return this._uniformsNames.indexOf(uniformName);\n }\n /**\n * Returns the attribute based on the name of the variable.\n * @param uniformName of the uniform to look up.\n * @returns the location of the uniform.\n */\n getUniform(uniformName) {\n return this._uniforms[uniformName];\n }\n /**\n * Returns an array of sampler variable names\n * @returns The array of sampler variable names.\n */\n getSamplers() {\n return this._samplerList;\n }\n /**\n * Returns an array of uniform variable names\n * @returns The array of uniform variable names.\n */\n getUniformNames() {\n return this._uniformsNames;\n }\n /**\n * Returns an array of uniform buffer variable names\n * @returns The array of uniform buffer variable names.\n */\n getUniformBuffersNames() {\n return this._uniformBuffersNamesList;\n }\n /**\n * Returns the index parameters used to create the effect\n * @returns The index parameters object\n */\n getIndexParameters() {\n return this._indexParameters;\n }\n /**\n * The error from the last compilation.\n * @returns the error string.\n */\n getCompilationError() {\n return this._compilationError;\n }\n /**\n * Gets a boolean indicating that all fallbacks were used during compilation\n * @returns true if all fallbacks were used\n */\n allFallbacksProcessed() {\n return this._allFallbacksProcessed;\n }\n /**\n * Adds a callback to the onCompiled observable and call the callback immediately if already ready.\n * @param func The callback to be used.\n */\n executeWhenCompiled(func) {\n if (this.isReady()) {\n func(this);\n return;\n }\n this.onCompileObservable.add((effect) => {\n func(effect);\n });\n if (!this._pipelineContext || this._pipelineContext.isAsync) {\n setTimeout(() => {\n this._checkIsReady(null);\n }, 16);\n }\n }\n _checkIsReady(previousPipelineContext) {\n try {\n if (this._isReadyInternal()) {\n return;\n }\n }\n catch (e) {\n this._processCompilationErrors(e, previousPipelineContext);\n return;\n }\n if (this._isDisposed) {\n return;\n }\n setTimeout(() => {\n this._checkIsReady(previousPipelineContext);\n }, 16);\n }\n _loadShader(shader, key, optionalKey, callback) {\n if (typeof HTMLElement !== \"undefined\") {\n // DOM element ?\n if (shader instanceof HTMLElement) {\n const shaderCode = GetDOMTextContent(shader);\n callback(shaderCode);\n return;\n }\n }\n // Direct source ?\n if (shader.substr(0, 7) === \"source:\") {\n callback(shader.substr(7));\n return;\n }\n // Base64 encoded ?\n if (shader.substr(0, 7) === \"base64:\") {\n const shaderBinary = window.atob(shader.substr(7));\n callback(shaderBinary);\n return;\n }\n const shaderStore = EngineShaderStore.GetShadersStore(this._shaderLanguage);\n // Is in local store ?\n if (shaderStore[shader + key + \"Shader\"]) {\n callback(shaderStore[shader + key + \"Shader\"]);\n return;\n }\n if (optionalKey && shaderStore[shader + optionalKey + \"Shader\"]) {\n callback(shaderStore[shader + optionalKey + \"Shader\"]);\n return;\n }\n let shaderUrl;\n if (shader[0] === \".\" || shader[0] === \"/\" || shader.indexOf(\"http\") > -1) {\n shaderUrl = shader;\n }\n else {\n shaderUrl = EngineShaderStore.GetShadersRepository(this._shaderLanguage) + shader;\n }\n // Vertex shader\n this._engine._loadFile(shaderUrl + \".\" + key.toLowerCase() + \".fx\", callback);\n }\n /**\n * Gets the vertex shader source code of this effect\n * This is the final source code that will be compiled, after all the processing has been done (pre-processing applied, code injection/replacement, etc)\n */\n get vertexSourceCode() {\n var _a, _b;\n return this._vertexSourceCodeOverride && this._fragmentSourceCodeOverride\n ? this._vertexSourceCodeOverride\n : (_b = (_a = this._pipelineContext) === null || _a === void 0 ? void 0 : _a._getVertexShaderCode()) !== null && _b !== void 0 ? _b : this._vertexSourceCode;\n }\n /**\n * Gets the fragment shader source code of this effect\n * This is the final source code that will be compiled, after all the processing has been done (pre-processing applied, code injection/replacement, etc)\n */\n get fragmentSourceCode() {\n var _a, _b;\n return this._vertexSourceCodeOverride && this._fragmentSourceCodeOverride\n ? this._fragmentSourceCodeOverride\n : (_b = (_a = this._pipelineContext) === null || _a === void 0 ? void 0 : _a._getFragmentShaderCode()) !== null && _b !== void 0 ? _b : this._fragmentSourceCode;\n }\n /**\n * Gets the vertex shader source code before migration.\n * This is the source code after the include directives have been replaced by their contents but before the code is migrated, i.e. before ShaderProcess._ProcessShaderConversion is executed.\n * This method is, among other things, responsible for parsing #if/#define directives as well as converting GLES2 syntax to GLES3 (in the case of WebGL).\n */\n get vertexSourceCodeBeforeMigration() {\n return this._vertexSourceCodeBeforeMigration;\n }\n /**\n * Gets the fragment shader source code before migration.\n * This is the source code after the include directives have been replaced by their contents but before the code is migrated, i.e. before ShaderProcess._ProcessShaderConversion is executed.\n * This method is, among other things, responsible for parsing #if/#define directives as well as converting GLES2 syntax to GLES3 (in the case of WebGL).\n */\n get fragmentSourceCodeBeforeMigration() {\n return this._fragmentSourceCodeBeforeMigration;\n }\n /**\n * Gets the vertex shader source code before it has been modified by any processing\n */\n get rawVertexSourceCode() {\n return this._rawVertexSourceCode;\n }\n /**\n * Gets the fragment shader source code before it has been modified by any processing\n */\n get rawFragmentSourceCode() {\n return this._rawFragmentSourceCode;\n }\n /**\n * Recompiles the webGL program\n * @param vertexSourceCode The source code for the vertex shader.\n * @param fragmentSourceCode The source code for the fragment shader.\n * @param onCompiled Callback called when completed.\n * @param onError Callback called on error.\n * @internal\n */\n _rebuildProgram(vertexSourceCode, fragmentSourceCode, onCompiled, onError) {\n this._isReady = false;\n this._vertexSourceCodeOverride = vertexSourceCode;\n this._fragmentSourceCodeOverride = fragmentSourceCode;\n this.onError = (effect, error) => {\n if (onError) {\n onError(error);\n }\n };\n this.onCompiled = () => {\n const scenes = this.getEngine().scenes;\n if (scenes) {\n for (let i = 0; i < scenes.length; i++) {\n scenes[i].markAllMaterialsAsDirty(63);\n }\n }\n this._pipelineContext._handlesSpectorRebuildCallback(onCompiled);\n };\n this._fallbacks = null;\n this._prepareEffect();\n }\n /**\n * Prepares the effect\n * @internal\n */\n _prepareEffect() {\n const attributesNames = this._attributesNames;\n const defines = this.defines;\n const previousPipelineContext = this._pipelineContext;\n this._isReady = false;\n try {\n const engine = this._engine;\n this._pipelineContext = engine.createPipelineContext(this._processingContext);\n this._pipelineContext._name = this._key;\n const rebuildRebind = this._rebuildProgram.bind(this);\n if (this._vertexSourceCodeOverride && this._fragmentSourceCodeOverride) {\n engine._preparePipelineContext(this._pipelineContext, this._vertexSourceCodeOverride, this._fragmentSourceCodeOverride, true, this._rawVertexSourceCode, this._rawFragmentSourceCode, rebuildRebind, null, this._transformFeedbackVaryings, this._key);\n }\n else {\n engine._preparePipelineContext(this._pipelineContext, this._vertexSourceCode, this._fragmentSourceCode, false, this._rawVertexSourceCode, this._rawFragmentSourceCode, rebuildRebind, defines, this._transformFeedbackVaryings, this._key);\n }\n engine._executeWhenRenderingStateIsCompiled(this._pipelineContext, () => {\n this._attributes = [];\n this._pipelineContext._fillEffectInformation(this, this._uniformBuffersNames, this._uniformsNames, this._uniforms, this._samplerList, this._samplers, attributesNames, this._attributes);\n // Caches attribute locations.\n if (attributesNames) {\n for (let i = 0; i < attributesNames.length; i++) {\n const name = attributesNames[i];\n this._attributeLocationByName[name] = this._attributes[i];\n }\n }\n engine.bindSamplers(this);\n this._compilationError = \"\";\n this._isReady = true;\n if (this.onCompiled) {\n this.onCompiled(this);\n }\n this.onCompileObservable.notifyObservers(this);\n this.onCompileObservable.clear();\n // Unbind mesh reference in fallbacks\n if (this._fallbacks) {\n this._fallbacks.unBindMesh();\n }\n if (previousPipelineContext) {\n this.getEngine()._deletePipelineContext(previousPipelineContext);\n }\n });\n if (this._pipelineContext.isAsync) {\n this._checkIsReady(previousPipelineContext);\n }\n }\n catch (e) {\n this._processCompilationErrors(e, previousPipelineContext);\n }\n }\n _getShaderCodeAndErrorLine(code, error, isFragment) {\n const regexp = isFragment ? /FRAGMENT SHADER ERROR: 0:(\\d+?):/ : /VERTEX SHADER ERROR: 0:(\\d+?):/;\n let errorLine = null;\n if (error && code) {\n const res = error.match(regexp);\n if (res && res.length === 2) {\n const lineNumber = parseInt(res[1]);\n const lines = code.split(\"\\n\", -1);\n if (lines.length >= lineNumber) {\n errorLine = `Offending line [${lineNumber}] in ${isFragment ? \"fragment\" : \"vertex\"} code: ${lines[lineNumber - 1]}`;\n }\n }\n }\n return [code, errorLine];\n }\n _processCompilationErrors(e, previousPipelineContext = null) {\n var _a, _b, _c;\n this._compilationError = e.message;\n const attributesNames = this._attributesNames;\n const fallbacks = this._fallbacks;\n // Let's go through fallbacks then\n Logger.Error(\"Unable to compile effect:\");\n Logger.Error(\"Uniforms: \" +\n this._uniformsNames.map(function (uniform) {\n return \" \" + uniform;\n }));\n Logger.Error(\"Attributes: \" +\n attributesNames.map(function (attribute) {\n return \" \" + attribute;\n }));\n Logger.Error(\"Defines:\\n\" + this.defines);\n if (Effect.LogShaderCodeOnCompilationError) {\n let lineErrorVertex = null, lineErrorFragment = null, code = null;\n if ((_a = this._pipelineContext) === null || _a === void 0 ? void 0 : _a._getVertexShaderCode()) {\n [code, lineErrorVertex] = this._getShaderCodeAndErrorLine(this._pipelineContext._getVertexShaderCode(), this._compilationError, false);\n if (code) {\n Logger.Error(\"Vertex code:\");\n Logger.Error(code);\n }\n }\n if ((_b = this._pipelineContext) === null || _b === void 0 ? void 0 : _b._getFragmentShaderCode()) {\n [code, lineErrorFragment] = this._getShaderCodeAndErrorLine((_c = this._pipelineContext) === null || _c === void 0 ? void 0 : _c._getFragmentShaderCode(), this._compilationError, true);\n if (code) {\n Logger.Error(\"Fragment code:\");\n Logger.Error(code);\n }\n }\n if (lineErrorVertex) {\n Logger.Error(lineErrorVertex);\n }\n if (lineErrorFragment) {\n Logger.Error(lineErrorFragment);\n }\n }\n Logger.Error(\"Error: \" + this._compilationError);\n const notifyErrors = () => {\n if (this.onError) {\n this.onError(this, this._compilationError);\n }\n this.onErrorObservable.notifyObservers(this);\n };\n // In case a previous compilation was successful, we need to restore the previous pipeline context\n if (previousPipelineContext) {\n this._pipelineContext = previousPipelineContext;\n this._isReady = true;\n notifyErrors();\n }\n // Lets try to compile fallbacks as long as we have some.\n if (fallbacks) {\n this._pipelineContext = null;\n if (fallbacks.hasMoreFallbacks) {\n this._allFallbacksProcessed = false;\n Logger.Error(\"Trying next fallback.\");\n this.defines = fallbacks.reduce(this.defines, this);\n this._prepareEffect();\n }\n else {\n // Sorry we did everything we can\n this._allFallbacksProcessed = true;\n notifyErrors();\n this.onErrorObservable.clear();\n // Unbind mesh reference in fallbacks\n if (this._fallbacks) {\n this._fallbacks.unBindMesh();\n }\n }\n }\n else {\n this._allFallbacksProcessed = true;\n // In case of error, without any prior successful compilation, let s notify observers\n if (!previousPipelineContext) {\n notifyErrors();\n }\n }\n }\n /**\n * Checks if the effect is supported. (Must be called after compilation)\n */\n get isSupported() {\n return this._compilationError === \"\";\n }\n /**\n * Binds a texture to the engine to be used as output of the shader.\n * @param channel Name of the output variable.\n * @param texture Texture to bind.\n * @internal\n */\n _bindTexture(channel, texture) {\n this._engine._bindTexture(this._samplers[channel], texture, channel);\n }\n /**\n * Sets a texture on the engine to be used in the shader.\n * @param channel Name of the sampler variable.\n * @param texture Texture to set.\n */\n setTexture(channel, texture) {\n this._engine.setTexture(this._samplers[channel], this._uniforms[channel], texture, channel);\n }\n /**\n * Sets a depth stencil texture from a render target on the engine to be used in the shader.\n * @param channel Name of the sampler variable.\n * @param texture Texture to set.\n */\n setDepthStencilTexture(channel, texture) {\n this._engine.setDepthStencilTexture(this._samplers[channel], this._uniforms[channel], texture, channel);\n }\n /**\n * Sets an array of textures on the engine to be used in the shader.\n * @param channel Name of the variable.\n * @param textures Textures to set.\n */\n setTextureArray(channel, textures) {\n const exName = channel + \"Ex\";\n if (this._samplerList.indexOf(exName + \"0\") === -1) {\n const initialPos = this._samplerList.indexOf(channel);\n for (let index = 1; index < textures.length; index++) {\n const currentExName = exName + (index - 1).toString();\n this._samplerList.splice(initialPos + index, 0, currentExName);\n }\n // Reset every channels\n let channelIndex = 0;\n for (const key of this._samplerList) {\n this._samplers[key] = channelIndex;\n channelIndex += 1;\n }\n }\n this._engine.setTextureArray(this._samplers[channel], this._uniforms[channel], textures, channel);\n }\n /**\n * Sets a texture to be the input of the specified post process. (To use the output, pass in the next post process in the pipeline)\n * @param channel Name of the sampler variable.\n * @param postProcess Post process to get the input texture from.\n */\n setTextureFromPostProcess(channel, postProcess) {\n this._engine.setTextureFromPostProcess(this._samplers[channel], postProcess, channel);\n }\n /**\n * (Warning! setTextureFromPostProcessOutput may be desired instead)\n * Sets the input texture of the passed in post process to be input of this effect. (To use the output of the passed in post process use setTextureFromPostProcessOutput)\n * @param channel Name of the sampler variable.\n * @param postProcess Post process to get the output texture from.\n */\n setTextureFromPostProcessOutput(channel, postProcess) {\n this._engine.setTextureFromPostProcessOutput(this._samplers[channel], postProcess, channel);\n }\n /**\n * Binds a buffer to a uniform.\n * @param buffer Buffer to bind.\n * @param name Name of the uniform variable to bind to.\n */\n bindUniformBuffer(buffer, name) {\n const bufferName = this._uniformBuffersNames[name];\n if (bufferName === undefined || (Effect._BaseCache[bufferName] === buffer && this._engine._features.useUBOBindingCache)) {\n return;\n }\n Effect._BaseCache[bufferName] = buffer;\n this._engine.bindUniformBufferBase(buffer, bufferName, name);\n }\n /**\n * Binds block to a uniform.\n * @param blockName Name of the block to bind.\n * @param index Index to bind.\n */\n bindUniformBlock(blockName, index) {\n this._engine.bindUniformBlock(this._pipelineContext, blockName, index);\n }\n /**\n * Sets an integer value on a uniform variable.\n * @param uniformName Name of the variable.\n * @param value Value to be set.\n * @returns this effect.\n */\n setInt(uniformName, value) {\n this._pipelineContext.setInt(uniformName, value);\n return this;\n }\n /**\n * Sets an int2 value on a uniform variable.\n * @param uniformName Name of the variable.\n * @param x First int in int2.\n * @param y Second int in int2.\n * @returns this effect.\n */\n setInt2(uniformName, x, y) {\n this._pipelineContext.setInt2(uniformName, x, y);\n return this;\n }\n /**\n * Sets an int3 value on a uniform variable.\n * @param uniformName Name of the variable.\n * @param x First int in int3.\n * @param y Second int in int3.\n * @param z Third int in int3.\n * @returns this effect.\n */\n setInt3(uniformName, x, y, z) {\n this._pipelineContext.setInt3(uniformName, x, y, z);\n return this;\n }\n /**\n * Sets an int4 value on a uniform variable.\n * @param uniformName Name of the variable.\n * @param x First int in int4.\n * @param y Second int in int4.\n * @param z Third int in int4.\n * @param w Fourth int in int4.\n * @returns this effect.\n */\n setInt4(uniformName, x, y, z, w) {\n this._pipelineContext.setInt4(uniformName, x, y, z, w);\n return this;\n }\n /**\n * Sets an int array on a uniform variable.\n * @param uniformName Name of the variable.\n * @param array array to be set.\n * @returns this effect.\n */\n setIntArray(uniformName, array) {\n this._pipelineContext.setIntArray(uniformName, array);\n return this;\n }\n /**\n * Sets an int array 2 on a uniform variable. (Array is specified as single array eg. [1,2,3,4] will result in [[1,2],[3,4]] in the shader)\n * @param uniformName Name of the variable.\n * @param array array to be set.\n * @returns this effect.\n */\n setIntArray2(uniformName, array) {\n this._pipelineContext.setIntArray2(uniformName, array);\n return this;\n }\n /**\n * Sets an int array 3 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6] will result in [[1,2,3],[4,5,6]] in the shader)\n * @param uniformName Name of the variable.\n * @param array array to be set.\n * @returns this effect.\n */\n setIntArray3(uniformName, array) {\n this._pipelineContext.setIntArray3(uniformName, array);\n return this;\n }\n /**\n * Sets an int array 4 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6,7,8] will result in [[1,2,3,4],[5,6,7,8]] in the shader)\n * @param uniformName Name of the variable.\n * @param array array to be set.\n * @returns this effect.\n */\n setIntArray4(uniformName, array) {\n this._pipelineContext.setIntArray4(uniformName, array);\n return this;\n }\n /**\n * Sets an unsigned integer value on a uniform variable.\n * @param uniformName Name of the variable.\n * @param value Value to be set.\n * @returns this effect.\n */\n setUInt(uniformName, value) {\n this._pipelineContext.setUInt(uniformName, value);\n return this;\n }\n /**\n * Sets an unsigned int2 value on a uniform variable.\n * @param uniformName Name of the variable.\n * @param x First unsigned int in uint2.\n * @param y Second unsigned int in uint2.\n * @returns this effect.\n */\n setUInt2(uniformName, x, y) {\n this._pipelineContext.setUInt2(uniformName, x, y);\n return this;\n }\n /**\n * Sets an unsigned int3 value on a uniform variable.\n * @param uniformName Name of the variable.\n * @param x First unsigned int in uint3.\n * @param y Second unsigned int in uint3.\n * @param z Third unsigned int in uint3.\n * @returns this effect.\n */\n setUInt3(uniformName, x, y, z) {\n this._pipelineContext.setUInt3(uniformName, x, y, z);\n return this;\n }\n /**\n * Sets an unsigned int4 value on a uniform variable.\n * @param uniformName Name of the variable.\n * @param x First unsigned int in uint4.\n * @param y Second unsigned int in uint4.\n * @param z Third unsigned int in uint4.\n * @param w Fourth unsigned int in uint4.\n * @returns this effect.\n */\n setUInt4(uniformName, x, y, z, w) {\n this._pipelineContext.setUInt4(uniformName, x, y, z, w);\n return this;\n }\n /**\n * Sets an unsigned int array on a uniform variable.\n * @param uniformName Name of the variable.\n * @param array array to be set.\n * @returns this effect.\n */\n setUIntArray(uniformName, array) {\n this._pipelineContext.setUIntArray(uniformName, array);\n return this;\n }\n /**\n * Sets an unsigned int array 2 on a uniform variable. (Array is specified as single array eg. [1,2,3,4] will result in [[1,2],[3,4]] in the shader)\n * @param uniformName Name of the variable.\n * @param array array to be set.\n * @returns this effect.\n */\n setUIntArray2(uniformName, array) {\n this._pipelineContext.setUIntArray2(uniformName, array);\n return this;\n }\n /**\n * Sets an unsigned int array 3 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6] will result in [[1,2,3],[4,5,6]] in the shader)\n * @param uniformName Name of the variable.\n * @param array array to be set.\n * @returns this effect.\n */\n setUIntArray3(uniformName, array) {\n this._pipelineContext.setUIntArray3(uniformName, array);\n return this;\n }\n /**\n * Sets an unsigned int array 4 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6,7,8] will result in [[1,2,3,4],[5,6,7,8]] in the shader)\n * @param uniformName Name of the variable.\n * @param array array to be set.\n * @returns this effect.\n */\n setUIntArray4(uniformName, array) {\n this._pipelineContext.setUIntArray4(uniformName, array);\n return this;\n }\n /**\n * Sets an float array on a uniform variable.\n * @param uniformName Name of the variable.\n * @param array array to be set.\n * @returns this effect.\n */\n setFloatArray(uniformName, array) {\n this._pipelineContext.setArray(uniformName, array);\n return this;\n }\n /**\n * Sets an float array 2 on a uniform variable. (Array is specified as single array eg. [1,2,3,4] will result in [[1,2],[3,4]] in the shader)\n * @param uniformName Name of the variable.\n * @param array array to be set.\n * @returns this effect.\n */\n setFloatArray2(uniformName, array) {\n this._pipelineContext.setArray2(uniformName, array);\n return this;\n }\n /**\n * Sets an float array 3 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6] will result in [[1,2,3],[4,5,6]] in the shader)\n * @param uniformName Name of the variable.\n * @param array array to be set.\n * @returns this effect.\n */\n setFloatArray3(uniformName, array) {\n this._pipelineContext.setArray3(uniformName, array);\n return this;\n }\n /**\n * Sets an float array 4 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6,7,8] will result in [[1,2,3,4],[5,6,7,8]] in the shader)\n * @param uniformName Name of the variable.\n * @param array array to be set.\n * @returns this effect.\n */\n setFloatArray4(uniformName, array) {\n this._pipelineContext.setArray4(uniformName, array);\n return this;\n }\n /**\n * Sets an array on a uniform variable.\n * @param uniformName Name of the variable.\n * @param array array to be set.\n * @returns this effect.\n */\n setArray(uniformName, array) {\n this._pipelineContext.setArray(uniformName, array);\n return this;\n }\n /**\n * Sets an array 2 on a uniform variable. (Array is specified as single array eg. [1,2,3,4] will result in [[1,2],[3,4]] in the shader)\n * @param uniformName Name of the variable.\n * @param array array to be set.\n * @returns this effect.\n */\n setArray2(uniformName, array) {\n this._pipelineContext.setArray2(uniformName, array);\n return this;\n }\n /**\n * Sets an array 3 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6] will result in [[1,2,3],[4,5,6]] in the shader)\n * @param uniformName Name of the variable.\n * @param array array to be set.\n * @returns this effect.\n */\n setArray3(uniformName, array) {\n this._pipelineContext.setArray3(uniformName, array);\n return this;\n }\n /**\n * Sets an array 4 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6,7,8] will result in [[1,2,3,4],[5,6,7,8]] in the shader)\n * @param uniformName Name of the variable.\n * @param array array to be set.\n * @returns this effect.\n */\n setArray4(uniformName, array) {\n this._pipelineContext.setArray4(uniformName, array);\n return this;\n }\n /**\n * Sets matrices on a uniform variable.\n * @param uniformName Name of the variable.\n * @param matrices matrices to be set.\n * @returns this effect.\n */\n setMatrices(uniformName, matrices) {\n this._pipelineContext.setMatrices(uniformName, matrices);\n return this;\n }\n /**\n * Sets matrix on a uniform variable.\n * @param uniformName Name of the variable.\n * @param matrix matrix to be set.\n * @returns this effect.\n */\n setMatrix(uniformName, matrix) {\n this._pipelineContext.setMatrix(uniformName, matrix);\n return this;\n }\n /**\n * Sets a 3x3 matrix on a uniform variable. (Specified as [1,2,3,4,5,6,7,8,9] will result in [1,2,3][4,5,6][7,8,9] matrix)\n * @param uniformName Name of the variable.\n * @param matrix matrix to be set.\n * @returns this effect.\n */\n setMatrix3x3(uniformName, matrix) {\n // the cast is ok because it is gl.uniformMatrix3fv() which is called at the end, and this function accepts Float32Array and Array\n this._pipelineContext.setMatrix3x3(uniformName, matrix);\n return this;\n }\n /**\n * Sets a 2x2 matrix on a uniform variable. (Specified as [1,2,3,4] will result in [1,2][3,4] matrix)\n * @param uniformName Name of the variable.\n * @param matrix matrix to be set.\n * @returns this effect.\n */\n setMatrix2x2(uniformName, matrix) {\n // the cast is ok because it is gl.uniformMatrix3fv() which is called at the end, and this function accepts Float32Array and Array\n this._pipelineContext.setMatrix2x2(uniformName, matrix);\n return this;\n }\n /**\n * Sets a float on a uniform variable.\n * @param uniformName Name of the variable.\n * @param value value to be set.\n * @returns this effect.\n */\n setFloat(uniformName, value) {\n this._pipelineContext.setFloat(uniformName, value);\n return this;\n }\n /**\n * Sets a boolean on a uniform variable.\n * @param uniformName Name of the variable.\n * @param bool value to be set.\n * @returns this effect.\n */\n setBool(uniformName, bool) {\n this._pipelineContext.setInt(uniformName, bool ? 1 : 0);\n return this;\n }\n /**\n * Sets a Vector2 on a uniform variable.\n * @param uniformName Name of the variable.\n * @param vector2 vector2 to be set.\n * @returns this effect.\n */\n setVector2(uniformName, vector2) {\n this._pipelineContext.setVector2(uniformName, vector2);\n return this;\n }\n /**\n * Sets a float2 on a uniform variable.\n * @param uniformName Name of the variable.\n * @param x First float in float2.\n * @param y Second float in float2.\n * @returns this effect.\n */\n setFloat2(uniformName, x, y) {\n this._pipelineContext.setFloat2(uniformName, x, y);\n return this;\n }\n /**\n * Sets a Vector3 on a uniform variable.\n * @param uniformName Name of the variable.\n * @param vector3 Value to be set.\n * @returns this effect.\n */\n setVector3(uniformName, vector3) {\n this._pipelineContext.setVector3(uniformName, vector3);\n return this;\n }\n /**\n * Sets a float3 on a uniform variable.\n * @param uniformName Name of the variable.\n * @param x First float in float3.\n * @param y Second float in float3.\n * @param z Third float in float3.\n * @returns this effect.\n */\n setFloat3(uniformName, x, y, z) {\n this._pipelineContext.setFloat3(uniformName, x, y, z);\n return this;\n }\n /**\n * Sets a Vector4 on a uniform variable.\n * @param uniformName Name of the variable.\n * @param vector4 Value to be set.\n * @returns this effect.\n */\n setVector4(uniformName, vector4) {\n this._pipelineContext.setVector4(uniformName, vector4);\n return this;\n }\n /**\n * Sets a Quaternion on a uniform variable.\n * @param uniformName Name of the variable.\n * @param quaternion Value to be set.\n * @returns this effect.\n */\n setQuaternion(uniformName, quaternion) {\n this._pipelineContext.setQuaternion(uniformName, quaternion);\n return this;\n }\n /**\n * Sets a float4 on a uniform variable.\n * @param uniformName Name of the variable.\n * @param x First float in float4.\n * @param y Second float in float4.\n * @param z Third float in float4.\n * @param w Fourth float in float4.\n * @returns this effect.\n */\n setFloat4(uniformName, x, y, z, w) {\n this._pipelineContext.setFloat4(uniformName, x, y, z, w);\n return this;\n }\n /**\n * Sets a Color3 on a uniform variable.\n * @param uniformName Name of the variable.\n * @param color3 Value to be set.\n * @returns this effect.\n */\n setColor3(uniformName, color3) {\n this._pipelineContext.setColor3(uniformName, color3);\n return this;\n }\n /**\n * Sets a Color4 on a uniform variable.\n * @param uniformName Name of the variable.\n * @param color3 Value to be set.\n * @param alpha Alpha value to be set.\n * @returns this effect.\n */\n setColor4(uniformName, color3, alpha) {\n this._pipelineContext.setColor4(uniformName, color3, alpha);\n return this;\n }\n /**\n * Sets a Color4 on a uniform variable\n * @param uniformName defines the name of the variable\n * @param color4 defines the value to be set\n * @returns this effect.\n */\n setDirectColor4(uniformName, color4) {\n this._pipelineContext.setDirectColor4(uniformName, color4);\n return this;\n }\n /**\n * Release all associated resources.\n **/\n dispose() {\n if (this._pipelineContext) {\n this._pipelineContext.dispose();\n }\n this._engine._releaseEffect(this);\n this._isDisposed = true;\n }\n /**\n * This function will add a new shader to the shader store\n * @param name the name of the shader\n * @param pixelShader optional pixel shader content\n * @param vertexShader optional vertex shader content\n * @param shaderLanguage the language the shader is written in (default: GLSL)\n */\n static RegisterShader(name, pixelShader, vertexShader, shaderLanguage = ShaderLanguage.GLSL) {\n if (pixelShader) {\n EngineShaderStore.GetShadersStore(shaderLanguage)[`${name}PixelShader`] = pixelShader;\n }\n if (vertexShader) {\n EngineShaderStore.GetShadersStore(shaderLanguage)[`${name}VertexShader`] = vertexShader;\n }\n }\n /**\n * Resets the cache of effects.\n */\n static ResetCache() {\n Effect._BaseCache = {};\n }\n}\n/**\n * Enable logging of the shader code when a compilation error occurs\n */\nEffect.LogShaderCodeOnCompilationError = true;\nEffect._UniqueIdSeed = 0;\nEffect._BaseCache = {};\n/**\n * Store of each shader (The can be looked up using effect.key)\n */\nEffect.ShadersStore = EngineShaderStore.ShadersStore;\n/**\n * Store of each included file for a shader (The can be looked up using effect.key)\n */\nEffect.IncludesShadersStore = EngineShaderStore.IncludesShadersStore;\n//# sourceMappingURL=effect.js.map","/**\n * @internal\n **/\nexport class DepthCullingState {\n /**\n * Initializes the state.\n * @param reset\n */\n constructor(reset = true) {\n this._isDepthTestDirty = false;\n this._isDepthMaskDirty = false;\n this._isDepthFuncDirty = false;\n this._isCullFaceDirty = false;\n this._isCullDirty = false;\n this._isZOffsetDirty = false;\n this._isFrontFaceDirty = false;\n if (reset) {\n this.reset();\n }\n }\n get isDirty() {\n return (this._isDepthFuncDirty ||\n this._isDepthTestDirty ||\n this._isDepthMaskDirty ||\n this._isCullFaceDirty ||\n this._isCullDirty ||\n this._isZOffsetDirty ||\n this._isFrontFaceDirty);\n }\n get zOffset() {\n return this._zOffset;\n }\n set zOffset(value) {\n if (this._zOffset === value) {\n return;\n }\n this._zOffset = value;\n this._isZOffsetDirty = true;\n }\n get zOffsetUnits() {\n return this._zOffsetUnits;\n }\n set zOffsetUnits(value) {\n if (this._zOffsetUnits === value) {\n return;\n }\n this._zOffsetUnits = value;\n this._isZOffsetDirty = true;\n }\n get cullFace() {\n return this._cullFace;\n }\n set cullFace(value) {\n if (this._cullFace === value) {\n return;\n }\n this._cullFace = value;\n this._isCullFaceDirty = true;\n }\n get cull() {\n return this._cull;\n }\n set cull(value) {\n if (this._cull === value) {\n return;\n }\n this._cull = value;\n this._isCullDirty = true;\n }\n get depthFunc() {\n return this._depthFunc;\n }\n set depthFunc(value) {\n if (this._depthFunc === value) {\n return;\n }\n this._depthFunc = value;\n this._isDepthFuncDirty = true;\n }\n get depthMask() {\n return this._depthMask;\n }\n set depthMask(value) {\n if (this._depthMask === value) {\n return;\n }\n this._depthMask = value;\n this._isDepthMaskDirty = true;\n }\n get depthTest() {\n return this._depthTest;\n }\n set depthTest(value) {\n if (this._depthTest === value) {\n return;\n }\n this._depthTest = value;\n this._isDepthTestDirty = true;\n }\n get frontFace() {\n return this._frontFace;\n }\n set frontFace(value) {\n if (this._frontFace === value) {\n return;\n }\n this._frontFace = value;\n this._isFrontFaceDirty = true;\n }\n reset() {\n this._depthMask = true;\n this._depthTest = true;\n this._depthFunc = null;\n this._cullFace = null;\n this._cull = null;\n this._zOffset = 0;\n this._zOffsetUnits = 0;\n this._frontFace = null;\n this._isDepthTestDirty = true;\n this._isDepthMaskDirty = true;\n this._isDepthFuncDirty = false;\n this._isCullFaceDirty = false;\n this._isCullDirty = false;\n this._isZOffsetDirty = true;\n this._isFrontFaceDirty = false;\n }\n apply(gl) {\n if (!this.isDirty) {\n return;\n }\n // Cull\n if (this._isCullDirty) {\n if (this.cull) {\n gl.enable(gl.CULL_FACE);\n }\n else {\n gl.disable(gl.CULL_FACE);\n }\n this._isCullDirty = false;\n }\n // Cull face\n if (this._isCullFaceDirty) {\n gl.cullFace(this.cullFace);\n this._isCullFaceDirty = false;\n }\n // Depth mask\n if (this._isDepthMaskDirty) {\n gl.depthMask(this.depthMask);\n this._isDepthMaskDirty = false;\n }\n // Depth test\n if (this._isDepthTestDirty) {\n if (this.depthTest) {\n gl.enable(gl.DEPTH_TEST);\n }\n else {\n gl.disable(gl.DEPTH_TEST);\n }\n this._isDepthTestDirty = false;\n }\n // Depth func\n if (this._isDepthFuncDirty) {\n gl.depthFunc(this.depthFunc);\n this._isDepthFuncDirty = false;\n }\n // zOffset\n if (this._isZOffsetDirty) {\n if (this.zOffset || this.zOffsetUnits) {\n gl.enable(gl.POLYGON_OFFSET_FILL);\n gl.polygonOffset(this.zOffset, this.zOffsetUnits);\n }\n else {\n gl.disable(gl.POLYGON_OFFSET_FILL);\n }\n this._isZOffsetDirty = false;\n }\n // Front face\n if (this._isFrontFaceDirty) {\n gl.frontFace(this.frontFace);\n this._isFrontFaceDirty = false;\n }\n }\n}\n//# sourceMappingURL=depthCullingState.js.map","\n/**\n * @internal\n **/\nexport class StencilState {\n constructor() {\n this.reset();\n }\n reset() {\n this.enabled = false;\n this.mask = 0xff;\n this.func = StencilState.ALWAYS;\n this.funcRef = 1;\n this.funcMask = 0xff;\n this.opStencilFail = StencilState.KEEP;\n this.opDepthFail = StencilState.KEEP;\n this.opStencilDepthPass = StencilState.REPLACE;\n }\n get stencilFunc() {\n return this.func;\n }\n set stencilFunc(value) {\n this.func = value;\n }\n get stencilFuncRef() {\n return this.funcRef;\n }\n set stencilFuncRef(value) {\n this.funcRef = value;\n }\n get stencilFuncMask() {\n return this.funcMask;\n }\n set stencilFuncMask(value) {\n this.funcMask = value;\n }\n get stencilOpStencilFail() {\n return this.opStencilFail;\n }\n set stencilOpStencilFail(value) {\n this.opStencilFail = value;\n }\n get stencilOpDepthFail() {\n return this.opDepthFail;\n }\n set stencilOpDepthFail(value) {\n this.opDepthFail = value;\n }\n get stencilOpStencilDepthPass() {\n return this.opStencilDepthPass;\n }\n set stencilOpStencilDepthPass(value) {\n this.opStencilDepthPass = value;\n }\n get stencilMask() {\n return this.mask;\n }\n set stencilMask(value) {\n this.mask = value;\n }\n get stencilTest() {\n return this.enabled;\n }\n set stencilTest(value) {\n this.enabled = value;\n }\n}\n/** Passed to depthFunction or stencilFunction to specify depth or stencil tests will always pass. i.e. Pixels will be drawn in the order they are drawn */\nStencilState.ALWAYS = 519;\n/** Passed to stencilOperation to specify that stencil value must be kept */\nStencilState.KEEP = 7680;\n/** Passed to stencilOperation to specify that stencil value must be replaced */\nStencilState.REPLACE = 7681;\n//# sourceMappingURL=stencilState.js.map","/**\n * @internal\n **/\nexport class AlphaState {\n /**\n * Initializes the state.\n */\n constructor() {\n this._blendFunctionParameters = new Array(4);\n this._blendEquationParameters = new Array(2);\n this._blendConstants = new Array(4);\n this._isBlendConstantsDirty = false;\n this._alphaBlend = false;\n this._isAlphaBlendDirty = false;\n this._isBlendFunctionParametersDirty = false;\n this._isBlendEquationParametersDirty = false;\n this.reset();\n }\n get isDirty() {\n return this._isAlphaBlendDirty || this._isBlendFunctionParametersDirty || this._isBlendEquationParametersDirty;\n }\n get alphaBlend() {\n return this._alphaBlend;\n }\n set alphaBlend(value) {\n if (this._alphaBlend === value) {\n return;\n }\n this._alphaBlend = value;\n this._isAlphaBlendDirty = true;\n }\n setAlphaBlendConstants(r, g, b, a) {\n if (this._blendConstants[0] === r && this._blendConstants[1] === g && this._blendConstants[2] === b && this._blendConstants[3] === a) {\n return;\n }\n this._blendConstants[0] = r;\n this._blendConstants[1] = g;\n this._blendConstants[2] = b;\n this._blendConstants[3] = a;\n this._isBlendConstantsDirty = true;\n }\n setAlphaBlendFunctionParameters(value0, value1, value2, value3) {\n if (this._blendFunctionParameters[0] === value0 &&\n this._blendFunctionParameters[1] === value1 &&\n this._blendFunctionParameters[2] === value2 &&\n this._blendFunctionParameters[3] === value3) {\n return;\n }\n this._blendFunctionParameters[0] = value0;\n this._blendFunctionParameters[1] = value1;\n this._blendFunctionParameters[2] = value2;\n this._blendFunctionParameters[3] = value3;\n this._isBlendFunctionParametersDirty = true;\n }\n setAlphaEquationParameters(rgb, alpha) {\n if (this._blendEquationParameters[0] === rgb && this._blendEquationParameters[1] === alpha) {\n return;\n }\n this._blendEquationParameters[0] = rgb;\n this._blendEquationParameters[1] = alpha;\n this._isBlendEquationParametersDirty = true;\n }\n reset() {\n this._alphaBlend = false;\n this._blendFunctionParameters[0] = null;\n this._blendFunctionParameters[1] = null;\n this._blendFunctionParameters[2] = null;\n this._blendFunctionParameters[3] = null;\n this._blendEquationParameters[0] = null;\n this._blendEquationParameters[1] = null;\n this._blendConstants[0] = null;\n this._blendConstants[1] = null;\n this._blendConstants[2] = null;\n this._blendConstants[3] = null;\n this._isAlphaBlendDirty = true;\n this._isBlendFunctionParametersDirty = false;\n this._isBlendEquationParametersDirty = false;\n this._isBlendConstantsDirty = false;\n }\n apply(gl) {\n if (!this.isDirty) {\n return;\n }\n // Alpha blend\n if (this._isAlphaBlendDirty) {\n if (this._alphaBlend) {\n gl.enable(gl.BLEND);\n }\n else {\n gl.disable(gl.BLEND);\n }\n this._isAlphaBlendDirty = false;\n }\n // Alpha function\n if (this._isBlendFunctionParametersDirty) {\n gl.blendFuncSeparate(this._blendFunctionParameters[0], this._blendFunctionParameters[1], this._blendFunctionParameters[2], this._blendFunctionParameters[3]);\n this._isBlendFunctionParametersDirty = false;\n }\n // Alpha equation\n if (this._isBlendEquationParametersDirty) {\n gl.blendEquationSeparate(this._blendEquationParameters[0], this._blendEquationParameters[1]);\n this._isBlendEquationParametersDirty = false;\n }\n // Constants\n if (this._isBlendConstantsDirty) {\n gl.blendColor(this._blendConstants[0], this._blendConstants[1], this._blendConstants[2], this._blendConstants[3]);\n this._isBlendConstantsDirty = false;\n }\n }\n}\n//# sourceMappingURL=alphaCullingState.js.map","import { ShaderLanguage } from \"../../Materials/shaderLanguage.js\";\n/** @internal */\nexport class WebGLShaderProcessor {\n constructor() {\n this.shaderLanguage = ShaderLanguage.GLSL;\n }\n postProcessor(code, defines, isFragment, processingContext, engine) {\n // Remove extensions\n if (!engine.getCaps().drawBuffersExtension) {\n // even if enclosed in #if/#endif, IE11 does parse the #extension declaration, so we need to remove it altogether\n const regex = /#extension.+GL_EXT_draw_buffers.+(enable|require)/g;\n code = code.replace(regex, \"\");\n }\n return code;\n }\n}\n//# sourceMappingURL=webGLShaderProcessors.js.map","import { ShaderLanguage } from \"../../Materials/shaderLanguage.js\";\nconst varyingRegex = /(flat\\s)?\\s*varying\\s*.*/;\n/** @internal */\nexport class WebGL2ShaderProcessor {\n constructor() {\n this.shaderLanguage = ShaderLanguage.GLSL;\n }\n attributeProcessor(attribute) {\n return attribute.replace(\"attribute\", \"in\");\n }\n varyingCheck(varying, _isFragment) {\n return varyingRegex.test(varying);\n }\n varyingProcessor(varying, isFragment) {\n return varying.replace(\"varying\", isFragment ? \"in\" : \"out\");\n }\n postProcessor(code, defines, isFragment) {\n const hasDrawBuffersExtension = code.search(/#extension.+GL_EXT_draw_buffers.+require/) !== -1;\n // Remove extensions\n const regex = /#extension.+(GL_OVR_multiview2|GL_OES_standard_derivatives|GL_EXT_shader_texture_lod|GL_EXT_frag_depth|GL_EXT_draw_buffers).+(enable|require)/g;\n code = code.replace(regex, \"\");\n // Replace instructions\n code = code.replace(/texture2D\\s*\\(/g, \"texture(\");\n if (isFragment) {\n const hasOutput = code.search(/layout *\\(location *= *0\\) *out/g) !== -1;\n code = code.replace(/texture2DLodEXT\\s*\\(/g, \"textureLod(\");\n code = code.replace(/textureCubeLodEXT\\s*\\(/g, \"textureLod(\");\n code = code.replace(/textureCube\\s*\\(/g, \"texture(\");\n code = code.replace(/gl_FragDepthEXT/g, \"gl_FragDepth\");\n code = code.replace(/gl_FragColor/g, \"glFragColor\");\n code = code.replace(/gl_FragData/g, \"glFragData\");\n code = code.replace(/void\\s+?main\\s*\\(/g, (hasDrawBuffersExtension || hasOutput ? \"\" : \"layout(location = 0) out vec4 glFragColor;\\n\") + \"void main(\");\n }\n else {\n const hasMultiviewExtension = defines.indexOf(\"#define MULTIVIEW\") !== -1;\n if (hasMultiviewExtension) {\n return \"#extension GL_OVR_multiview2 : require\\nlayout (num_views = 2) in;\\n\" + code;\n }\n }\n return code;\n }\n}\n//# sourceMappingURL=webGL2ShaderProcessors.js.map","/**\n * Class used to store gfx data (like WebGLBuffer)\n */\nexport class DataBuffer {\n /**\n * Gets the underlying buffer\n */\n get underlyingResource() {\n return null;\n }\n /**\n * Constructs the buffer\n */\n constructor() {\n /**\n * Gets or sets the number of objects referencing this buffer\n */\n this.references = 0;\n /** Gets or sets the size of the underlying buffer */\n this.capacity = 0;\n /**\n * Gets or sets a boolean indicating if the buffer contains 32bits indices\n */\n this.is32Bits = false;\n this.uniqueId = DataBuffer._Counter++;\n }\n}\nDataBuffer._Counter = 0;\n//# sourceMappingURL=dataBuffer.js.map","import { DataBuffer } from \"../../Buffers/dataBuffer.js\";\n/** @internal */\nexport class WebGLDataBuffer extends DataBuffer {\n constructor(resource) {\n super();\n this._buffer = resource;\n }\n get underlyingResource() {\n return this._buffer;\n }\n}\n//# sourceMappingURL=webGLDataBuffer.js.map","/** @internal */\nexport class WebGLPipelineContext {\n constructor() {\n this._valueCache = {};\n this.vertexCompilationError = null;\n this.fragmentCompilationError = null;\n this.programLinkError = null;\n this.programValidationError = null;\n /** @internal */\n this._isDisposed = false;\n }\n get isAsync() {\n return this.isParallelCompiled;\n }\n get isReady() {\n if (this.program) {\n if (this.isParallelCompiled) {\n return this.engine._isRenderingStateCompiled(this);\n }\n return true;\n }\n return false;\n }\n _handlesSpectorRebuildCallback(onCompiled) {\n if (onCompiled && this.program) {\n onCompiled(this.program);\n }\n }\n _fillEffectInformation(effect, uniformBuffersNames, uniformsNames, uniforms, samplerList, samplers, attributesNames, attributes) {\n const engine = this.engine;\n if (engine.supportsUniformBuffers) {\n for (const name in uniformBuffersNames) {\n effect.bindUniformBlock(name, uniformBuffersNames[name]);\n }\n }\n const effectAvailableUniforms = this.engine.getUniforms(this, uniformsNames);\n effectAvailableUniforms.forEach((uniform, index) => {\n uniforms[uniformsNames[index]] = uniform;\n });\n this._uniforms = uniforms;\n let index;\n for (index = 0; index < samplerList.length; index++) {\n const sampler = effect.getUniform(samplerList[index]);\n if (sampler == null) {\n samplerList.splice(index, 1);\n index--;\n }\n }\n samplerList.forEach((name, index) => {\n samplers[name] = index;\n });\n for (const attr of engine.getAttributes(this, attributesNames)) {\n attributes.push(attr);\n }\n }\n /**\n * Release all associated resources.\n **/\n dispose() {\n this._uniforms = {};\n this._isDisposed = true;\n }\n /**\n * @internal\n */\n _cacheMatrix(uniformName, matrix) {\n const cache = this._valueCache[uniformName];\n const flag = matrix.updateFlag;\n if (cache !== undefined && cache === flag) {\n return false;\n }\n this._valueCache[uniformName] = flag;\n return true;\n }\n /**\n * @internal\n */\n _cacheFloat2(uniformName, x, y) {\n let cache = this._valueCache[uniformName];\n if (!cache || cache.length !== 2) {\n cache = [x, y];\n this._valueCache[uniformName] = cache;\n return true;\n }\n let changed = false;\n if (cache[0] !== x) {\n cache[0] = x;\n changed = true;\n }\n if (cache[1] !== y) {\n cache[1] = y;\n changed = true;\n }\n return changed;\n }\n /**\n * @internal\n */\n _cacheFloat3(uniformName, x, y, z) {\n let cache = this._valueCache[uniformName];\n if (!cache || cache.length !== 3) {\n cache = [x, y, z];\n this._valueCache[uniformName] = cache;\n return true;\n }\n let changed = false;\n if (cache[0] !== x) {\n cache[0] = x;\n changed = true;\n }\n if (cache[1] !== y) {\n cache[1] = y;\n changed = true;\n }\n if (cache[2] !== z) {\n cache[2] = z;\n changed = true;\n }\n return changed;\n }\n /**\n * @internal\n */\n _cacheFloat4(uniformName, x, y, z, w) {\n let cache = this._valueCache[uniformName];\n if (!cache || cache.length !== 4) {\n cache = [x, y, z, w];\n this._valueCache[uniformName] = cache;\n return true;\n }\n let changed = false;\n if (cache[0] !== x) {\n cache[0] = x;\n changed = true;\n }\n if (cache[1] !== y) {\n cache[1] = y;\n changed = true;\n }\n if (cache[2] !== z) {\n cache[2] = z;\n changed = true;\n }\n if (cache[3] !== w) {\n cache[3] = w;\n changed = true;\n }\n return changed;\n }\n /**\n * Sets an integer value on a uniform variable.\n * @param uniformName Name of the variable.\n * @param value Value to be set.\n */\n setInt(uniformName, value) {\n const cache = this._valueCache[uniformName];\n if (cache !== undefined && cache === value) {\n return;\n }\n if (this.engine.setInt(this._uniforms[uniformName], value)) {\n this._valueCache[uniformName] = value;\n }\n }\n /**\n * Sets a int2 on a uniform variable.\n * @param uniformName Name of the variable.\n * @param x First int in int2.\n * @param y Second int in int2.\n */\n setInt2(uniformName, x, y) {\n if (this._cacheFloat2(uniformName, x, y)) {\n if (!this.engine.setInt2(this._uniforms[uniformName], x, y)) {\n this._valueCache[uniformName] = null;\n }\n }\n }\n /**\n * Sets a int3 on a uniform variable.\n * @param uniformName Name of the variable.\n * @param x First int in int3.\n * @param y Second int in int3.\n * @param z Third int in int3.\n */\n setInt3(uniformName, x, y, z) {\n if (this._cacheFloat3(uniformName, x, y, z)) {\n if (!this.engine.setInt3(this._uniforms[uniformName], x, y, z)) {\n this._valueCache[uniformName] = null;\n }\n }\n }\n /**\n * Sets a int4 on a uniform variable.\n * @param uniformName Name of the variable.\n * @param x First int in int4.\n * @param y Second int in int4.\n * @param z Third int in int4.\n * @param w Fourth int in int4.\n */\n setInt4(uniformName, x, y, z, w) {\n if (this._cacheFloat4(uniformName, x, y, z, w)) {\n if (!this.engine.setInt4(this._uniforms[uniformName], x, y, z, w)) {\n this._valueCache[uniformName] = null;\n }\n }\n }\n /**\n * Sets an int array on a uniform variable.\n * @param uniformName Name of the variable.\n * @param array array to be set.\n */\n setIntArray(uniformName, array) {\n this._valueCache[uniformName] = null;\n this.engine.setIntArray(this._uniforms[uniformName], array);\n }\n /**\n * Sets an int array 2 on a uniform variable. (Array is specified as single array eg. [1,2,3,4] will result in [[1,2],[3,4]] in the shader)\n * @param uniformName Name of the variable.\n * @param array array to be set.\n */\n setIntArray2(uniformName, array) {\n this._valueCache[uniformName] = null;\n this.engine.setIntArray2(this._uniforms[uniformName], array);\n }\n /**\n * Sets an int array 3 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6] will result in [[1,2,3],[4,5,6]] in the shader)\n * @param uniformName Name of the variable.\n * @param array array to be set.\n */\n setIntArray3(uniformName, array) {\n this._valueCache[uniformName] = null;\n this.engine.setIntArray3(this._uniforms[uniformName], array);\n }\n /**\n * Sets an int array 4 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6,7,8] will result in [[1,2,3,4],[5,6,7,8]] in the shader)\n * @param uniformName Name of the variable.\n * @param array array to be set.\n */\n setIntArray4(uniformName, array) {\n this._valueCache[uniformName] = null;\n this.engine.setIntArray4(this._uniforms[uniformName], array);\n }\n /**\n * Sets an unsigned integer value on a uniform variable.\n * @param uniformName Name of the variable.\n * @param value Value to be set.\n */\n setUInt(uniformName, value) {\n const cache = this._valueCache[uniformName];\n if (cache !== undefined && cache === value) {\n return;\n }\n if (this.engine.setUInt(this._uniforms[uniformName], value)) {\n this._valueCache[uniformName] = value;\n }\n }\n /**\n * Sets an unsigned int2 value on a uniform variable.\n * @param uniformName Name of the variable.\n * @param x First unsigned int in uint2.\n * @param y Second unsigned int in uint2.\n */\n setUInt2(uniformName, x, y) {\n if (this._cacheFloat2(uniformName, x, y)) {\n if (!this.engine.setUInt2(this._uniforms[uniformName], x, y)) {\n this._valueCache[uniformName] = null;\n }\n }\n }\n /**\n * Sets an unsigned int3 value on a uniform variable.\n * @param uniformName Name of the variable.\n * @param x First unsigned int in uint3.\n * @param y Second unsigned int in uint3.\n * @param z Third unsigned int in uint3.\n */\n setUInt3(uniformName, x, y, z) {\n if (this._cacheFloat3(uniformName, x, y, z)) {\n if (!this.engine.setUInt3(this._uniforms[uniformName], x, y, z)) {\n this._valueCache[uniformName] = null;\n }\n }\n }\n /**\n * Sets an unsigned int4 value on a uniform variable.\n * @param uniformName Name of the variable.\n * @param x First unsigned int in uint4.\n * @param y Second unsigned int in uint4.\n * @param z Third unsigned int in uint4.\n * @param w Fourth unsigned int in uint4.\n */\n setUInt4(uniformName, x, y, z, w) {\n if (this._cacheFloat4(uniformName, x, y, z, w)) {\n if (!this.engine.setUInt4(this._uniforms[uniformName], x, y, z, w)) {\n this._valueCache[uniformName] = null;\n }\n }\n }\n /**\n * Sets an unsigned int array on a uniform variable.\n * @param uniformName Name of the variable.\n * @param array array to be set.\n */\n setUIntArray(uniformName, array) {\n this._valueCache[uniformName] = null;\n this.engine.setUIntArray(this._uniforms[uniformName], array);\n }\n /**\n * Sets an unsigned int array 2 on a uniform variable. (Array is specified as single array eg. [1,2,3,4] will result in [[1,2],[3,4]] in the shader)\n * @param uniformName Name of the variable.\n * @param array array to be set.\n */\n setUIntArray2(uniformName, array) {\n this._valueCache[uniformName] = null;\n this.engine.setUIntArray2(this._uniforms[uniformName], array);\n }\n /**\n * Sets an unsigned int array 3 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6] will result in [[1,2,3],[4,5,6]] in the shader)\n * @param uniformName Name of the variable.\n * @param array array to be set.\n */\n setUIntArray3(uniformName, array) {\n this._valueCache[uniformName] = null;\n this.engine.setUIntArray3(this._uniforms[uniformName], array);\n }\n /**\n * Sets an unsigned int array 4 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6,7,8] will result in [[1,2,3,4],[5,6,7,8]] in the shader)\n * @param uniformName Name of the variable.\n * @param array array to be set.\n */\n setUIntArray4(uniformName, array) {\n this._valueCache[uniformName] = null;\n this.engine.setUIntArray4(this._uniforms[uniformName], array);\n }\n /**\n * Sets an array on a uniform variable.\n * @param uniformName Name of the variable.\n * @param array array to be set.\n */\n setArray(uniformName, array) {\n this._valueCache[uniformName] = null;\n this.engine.setArray(this._uniforms[uniformName], array);\n }\n /**\n * Sets an array 2 on a uniform variable. (Array is specified as single array eg. [1,2,3,4] will result in [[1,2],[3,4]] in the shader)\n * @param uniformName Name of the variable.\n * @param array array to be set.\n */\n setArray2(uniformName, array) {\n this._valueCache[uniformName] = null;\n this.engine.setArray2(this._uniforms[uniformName], array);\n }\n /**\n * Sets an array 3 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6] will result in [[1,2,3],[4,5,6]] in the shader)\n * @param uniformName Name of the variable.\n * @param array array to be set.\n * @returns this effect.\n */\n setArray3(uniformName, array) {\n this._valueCache[uniformName] = null;\n this.engine.setArray3(this._uniforms[uniformName], array);\n }\n /**\n * Sets an array 4 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6,7,8] will result in [[1,2,3,4],[5,6,7,8]] in the shader)\n * @param uniformName Name of the variable.\n * @param array array to be set.\n */\n setArray4(uniformName, array) {\n this._valueCache[uniformName] = null;\n this.engine.setArray4(this._uniforms[uniformName], array);\n }\n /**\n * Sets matrices on a uniform variable.\n * @param uniformName Name of the variable.\n * @param matrices matrices to be set.\n */\n setMatrices(uniformName, matrices) {\n if (!matrices) {\n return;\n }\n this._valueCache[uniformName] = null;\n this.engine.setMatrices(this._uniforms[uniformName], matrices);\n }\n /**\n * Sets matrix on a uniform variable.\n * @param uniformName Name of the variable.\n * @param matrix matrix to be set.\n */\n setMatrix(uniformName, matrix) {\n if (this._cacheMatrix(uniformName, matrix)) {\n if (!this.engine.setMatrices(this._uniforms[uniformName], matrix.toArray())) {\n this._valueCache[uniformName] = null;\n }\n }\n }\n /**\n * Sets a 3x3 matrix on a uniform variable. (Specified as [1,2,3,4,5,6,7,8,9] will result in [1,2,3][4,5,6][7,8,9] matrix)\n * @param uniformName Name of the variable.\n * @param matrix matrix to be set.\n */\n setMatrix3x3(uniformName, matrix) {\n this._valueCache[uniformName] = null;\n this.engine.setMatrix3x3(this._uniforms[uniformName], matrix);\n }\n /**\n * Sets a 2x2 matrix on a uniform variable. (Specified as [1,2,3,4] will result in [1,2][3,4] matrix)\n * @param uniformName Name of the variable.\n * @param matrix matrix to be set.\n */\n setMatrix2x2(uniformName, matrix) {\n this._valueCache[uniformName] = null;\n this.engine.setMatrix2x2(this._uniforms[uniformName], matrix);\n }\n /**\n * Sets a float on a uniform variable.\n * @param uniformName Name of the variable.\n * @param value value to be set.\n * @returns this effect.\n */\n setFloat(uniformName, value) {\n const cache = this._valueCache[uniformName];\n if (cache !== undefined && cache === value) {\n return;\n }\n if (this.engine.setFloat(this._uniforms[uniformName], value)) {\n this._valueCache[uniformName] = value;\n }\n }\n /**\n * Sets a Vector2 on a uniform variable.\n * @param uniformName Name of the variable.\n * @param vector2 vector2 to be set.\n */\n setVector2(uniformName, vector2) {\n if (this._cacheFloat2(uniformName, vector2.x, vector2.y)) {\n if (!this.engine.setFloat2(this._uniforms[uniformName], vector2.x, vector2.y)) {\n this._valueCache[uniformName] = null;\n }\n }\n }\n /**\n * Sets a float2 on a uniform variable.\n * @param uniformName Name of the variable.\n * @param x First float in float2.\n * @param y Second float in float2.\n */\n setFloat2(uniformName, x, y) {\n if (this._cacheFloat2(uniformName, x, y)) {\n if (!this.engine.setFloat2(this._uniforms[uniformName], x, y)) {\n this._valueCache[uniformName] = null;\n }\n }\n }\n /**\n * Sets a Vector3 on a uniform variable.\n * @param uniformName Name of the variable.\n * @param vector3 Value to be set.\n */\n setVector3(uniformName, vector3) {\n if (this._cacheFloat3(uniformName, vector3.x, vector3.y, vector3.z)) {\n if (!this.engine.setFloat3(this._uniforms[uniformName], vector3.x, vector3.y, vector3.z)) {\n this._valueCache[uniformName] = null;\n }\n }\n }\n /**\n * Sets a float3 on a uniform variable.\n * @param uniformName Name of the variable.\n * @param x First float in float3.\n * @param y Second float in float3.\n * @param z Third float in float3.\n */\n setFloat3(uniformName, x, y, z) {\n if (this._cacheFloat3(uniformName, x, y, z)) {\n if (!this.engine.setFloat3(this._uniforms[uniformName], x, y, z)) {\n this._valueCache[uniformName] = null;\n }\n }\n }\n /**\n * Sets a Vector4 on a uniform variable.\n * @param uniformName Name of the variable.\n * @param vector4 Value to be set.\n */\n setVector4(uniformName, vector4) {\n if (this._cacheFloat4(uniformName, vector4.x, vector4.y, vector4.z, vector4.w)) {\n if (!this.engine.setFloat4(this._uniforms[uniformName], vector4.x, vector4.y, vector4.z, vector4.w)) {\n this._valueCache[uniformName] = null;\n }\n }\n }\n /**\n * Sets a Quaternion on a uniform variable.\n * @param uniformName Name of the variable.\n * @param quaternion Value to be set.\n */\n setQuaternion(uniformName, quaternion) {\n if (this._cacheFloat4(uniformName, quaternion.x, quaternion.y, quaternion.z, quaternion.w)) {\n if (!this.engine.setFloat4(this._uniforms[uniformName], quaternion.x, quaternion.y, quaternion.z, quaternion.w)) {\n this._valueCache[uniformName] = null;\n }\n }\n }\n /**\n * Sets a float4 on a uniform variable.\n * @param uniformName Name of the variable.\n * @param x First float in float4.\n * @param y Second float in float4.\n * @param z Third float in float4.\n * @param w Fourth float in float4.\n * @returns this effect.\n */\n setFloat4(uniformName, x, y, z, w) {\n if (this._cacheFloat4(uniformName, x, y, z, w)) {\n if (!this.engine.setFloat4(this._uniforms[uniformName], x, y, z, w)) {\n this._valueCache[uniformName] = null;\n }\n }\n }\n /**\n * Sets a Color3 on a uniform variable.\n * @param uniformName Name of the variable.\n * @param color3 Value to be set.\n */\n setColor3(uniformName, color3) {\n if (this._cacheFloat3(uniformName, color3.r, color3.g, color3.b)) {\n if (!this.engine.setFloat3(this._uniforms[uniformName], color3.r, color3.g, color3.b)) {\n this._valueCache[uniformName] = null;\n }\n }\n }\n /**\n * Sets a Color4 on a uniform variable.\n * @param uniformName Name of the variable.\n * @param color3 Value to be set.\n * @param alpha Alpha value to be set.\n */\n setColor4(uniformName, color3, alpha) {\n if (this._cacheFloat4(uniformName, color3.r, color3.g, color3.b, alpha)) {\n if (!this.engine.setFloat4(this._uniforms[uniformName], color3.r, color3.g, color3.b, alpha)) {\n this._valueCache[uniformName] = null;\n }\n }\n }\n /**\n * Sets a Color4 on a uniform variable\n * @param uniformName defines the name of the variable\n * @param color4 defines the value to be set\n */\n setDirectColor4(uniformName, color4) {\n if (this._cacheFloat4(uniformName, color4.r, color4.g, color4.b, color4.a)) {\n if (!this.engine.setFloat4(this._uniforms[uniformName], color4.r, color4.g, color4.b, color4.a)) {\n this._valueCache[uniformName] = null;\n }\n }\n }\n _getVertexShaderCode() {\n return this.vertexShader ? this.engine._getShaderSource(this.vertexShader) : null;\n }\n _getFragmentShaderCode() {\n return this.fragmentShader ? this.engine._getShaderSource(this.fragmentShader) : null;\n }\n}\n//# sourceMappingURL=webGLPipelineContext.js.map","/** @internal */\nexport class WebGLHardwareTexture {\n get underlyingResource() {\n return this._webGLTexture;\n }\n constructor(existingTexture = null, context) {\n // There can be multiple buffers for a single WebGL texture because different layers of a 2DArrayTexture / 3DTexture\n // or different faces of a cube texture can be bound to different render targets at the same time.\n this._MSAARenderBuffers = null;\n this._context = context;\n if (!existingTexture) {\n existingTexture = context.createTexture();\n if (!existingTexture) {\n throw new Error(\"Unable to create webGL texture\");\n }\n }\n this.set(existingTexture);\n }\n setUsage() { }\n set(hardwareTexture) {\n this._webGLTexture = hardwareTexture;\n }\n reset() {\n this._webGLTexture = null;\n this._MSAARenderBuffers = null;\n }\n addMSAARenderBuffer(buffer) {\n if (!this._MSAARenderBuffers) {\n this._MSAARenderBuffers = [];\n }\n this._MSAARenderBuffers.push(buffer);\n }\n releaseMSAARenderBuffers() {\n if (this._MSAARenderBuffers) {\n for (const buffer of this._MSAARenderBuffers) {\n this._context.deleteRenderbuffer(buffer);\n }\n this._MSAARenderBuffers = null;\n }\n }\n getMSAARenderBuffer(index = 0) {\n var _a, _b;\n return (_b = (_a = this._MSAARenderBuffers) === null || _a === void 0 ? void 0 : _a[index]) !== null && _b !== void 0 ? _b : null;\n }\n release() {\n this.releaseMSAARenderBuffers();\n if (this._webGLTexture) {\n this._context.deleteTexture(this._webGLTexture);\n }\n this.reset();\n }\n}\n//# sourceMappingURL=webGLHardwareTexture.js.map","/** @internal */\nexport class DrawWrapper {\n static IsWrapper(effect) {\n return effect.getPipelineContext === undefined;\n }\n static GetEffect(effect) {\n return effect.getPipelineContext === undefined ? effect.effect : effect;\n }\n constructor(engine, createMaterialContext = true) {\n this.effect = null;\n this.defines = null;\n this.drawContext = engine.createDrawContext();\n if (createMaterialContext) {\n this.materialContext = engine.createMaterialContext();\n }\n }\n setEffect(effect, defines, resetContext = true) {\n var _a;\n this.effect = effect;\n if (defines !== undefined) {\n this.defines = defines;\n }\n if (resetContext) {\n (_a = this.drawContext) === null || _a === void 0 ? void 0 : _a.reset();\n }\n }\n dispose() {\n var _a;\n (_a = this.drawContext) === null || _a === void 0 ? void 0 : _a.dispose();\n }\n}\n//# sourceMappingURL=drawWrapper.js.map","/**\n * @internal\n **/\nexport class StencilStateComposer {\n get isDirty() {\n return this._isStencilTestDirty || this._isStencilMaskDirty || this._isStencilFuncDirty || this._isStencilOpDirty;\n }\n get func() {\n return this._func;\n }\n set func(value) {\n if (this._func === value) {\n return;\n }\n this._func = value;\n this._isStencilFuncDirty = true;\n }\n get funcRef() {\n return this._funcRef;\n }\n set funcRef(value) {\n if (this._funcRef === value) {\n return;\n }\n this._funcRef = value;\n this._isStencilFuncDirty = true;\n }\n get funcMask() {\n return this._funcMask;\n }\n set funcMask(value) {\n if (this._funcMask === value) {\n return;\n }\n this._funcMask = value;\n this._isStencilFuncDirty = true;\n }\n get opStencilFail() {\n return this._opStencilFail;\n }\n set opStencilFail(value) {\n if (this._opStencilFail === value) {\n return;\n }\n this._opStencilFail = value;\n this._isStencilOpDirty = true;\n }\n get opDepthFail() {\n return this._opDepthFail;\n }\n set opDepthFail(value) {\n if (this._opDepthFail === value) {\n return;\n }\n this._opDepthFail = value;\n this._isStencilOpDirty = true;\n }\n get opStencilDepthPass() {\n return this._opStencilDepthPass;\n }\n set opStencilDepthPass(value) {\n if (this._opStencilDepthPass === value) {\n return;\n }\n this._opStencilDepthPass = value;\n this._isStencilOpDirty = true;\n }\n get mask() {\n return this._mask;\n }\n set mask(value) {\n if (this._mask === value) {\n return;\n }\n this._mask = value;\n this._isStencilMaskDirty = true;\n }\n get enabled() {\n return this._enabled;\n }\n set enabled(value) {\n if (this._enabled === value) {\n return;\n }\n this._enabled = value;\n this._isStencilTestDirty = true;\n }\n constructor(reset = true) {\n this._isStencilTestDirty = false;\n this._isStencilMaskDirty = false;\n this._isStencilFuncDirty = false;\n this._isStencilOpDirty = false;\n this.useStencilGlobalOnly = false;\n if (reset) {\n this.reset();\n }\n }\n reset() {\n var _a;\n this.stencilMaterial = undefined;\n (_a = this.stencilGlobal) === null || _a === void 0 ? void 0 : _a.reset();\n this._isStencilTestDirty = true;\n this._isStencilMaskDirty = true;\n this._isStencilFuncDirty = true;\n this._isStencilOpDirty = true;\n }\n apply(gl) {\n var _a;\n if (!gl) {\n return;\n }\n const stencilMaterialEnabled = !this.useStencilGlobalOnly && !!((_a = this.stencilMaterial) === null || _a === void 0 ? void 0 : _a.enabled);\n this.enabled = stencilMaterialEnabled ? this.stencilMaterial.enabled : this.stencilGlobal.enabled;\n this.func = stencilMaterialEnabled ? this.stencilMaterial.func : this.stencilGlobal.func;\n this.funcRef = stencilMaterialEnabled ? this.stencilMaterial.funcRef : this.stencilGlobal.funcRef;\n this.funcMask = stencilMaterialEnabled ? this.stencilMaterial.funcMask : this.stencilGlobal.funcMask;\n this.opStencilFail = stencilMaterialEnabled ? this.stencilMaterial.opStencilFail : this.stencilGlobal.opStencilFail;\n this.opDepthFail = stencilMaterialEnabled ? this.stencilMaterial.opDepthFail : this.stencilGlobal.opDepthFail;\n this.opStencilDepthPass = stencilMaterialEnabled ? this.stencilMaterial.opStencilDepthPass : this.stencilGlobal.opStencilDepthPass;\n this.mask = stencilMaterialEnabled ? this.stencilMaterial.mask : this.stencilGlobal.mask;\n if (!this.isDirty) {\n return;\n }\n // Stencil test\n if (this._isStencilTestDirty) {\n if (this.enabled) {\n gl.enable(gl.STENCIL_TEST);\n }\n else {\n gl.disable(gl.STENCIL_TEST);\n }\n this._isStencilTestDirty = false;\n }\n // Stencil mask\n if (this._isStencilMaskDirty) {\n gl.stencilMask(this.mask);\n this._isStencilMaskDirty = false;\n }\n // Stencil func\n if (this._isStencilFuncDirty) {\n gl.stencilFunc(this.func, this.funcRef, this.funcMask);\n this._isStencilFuncDirty = false;\n }\n // Stencil op\n if (this._isStencilOpDirty) {\n gl.stencilOp(this.opStencilFail, this.opDepthFail, this.opStencilDepthPass);\n this._isStencilOpDirty = false;\n }\n }\n}\n//# sourceMappingURL=stencilStateComposer.js.map","import { IsWindowObjectExist } from \"./domManagement.js\";\n/**\n * Class containing a set of static utilities functions for precision date\n */\nexport class PrecisionDate {\n /**\n * Gets either window.performance.now() if supported or Date.now() else\n */\n static get Now() {\n if (IsWindowObjectExist() && window.performance && window.performance.now) {\n return window.performance.now();\n }\n return Date.now();\n }\n}\n//# sourceMappingURL=precisionDate.js.map","/* eslint-disable @typescript-eslint/no-unused-vars */\nimport { EngineStore } from \"./engineStore.js\";\nimport { Effect } from \"../Materials/effect.js\";\nimport { _WarnImport } from \"../Misc/devTools.js\";\nimport { Observable } from \"../Misc/observable.js\";\nimport { DepthCullingState } from \"../States/depthCullingState.js\";\nimport { StencilState } from \"../States/stencilState.js\";\nimport { AlphaState } from \"../States/alphaCullingState.js\";\n\nimport { InternalTexture, InternalTextureSource } from \"../Materials/Textures/internalTexture.js\";\nimport { Logger } from \"../Misc/logger.js\";\nimport { IsDocumentAvailable, IsWindowObjectExist } from \"../Misc/domManagement.js\";\nimport { WebGLShaderProcessor } from \"./WebGL/webGLShaderProcessors.js\";\nimport { WebGL2ShaderProcessor } from \"./WebGL/webGL2ShaderProcessors.js\";\nimport { WebGLDataBuffer } from \"../Meshes/WebGL/webGLDataBuffer.js\";\nimport { WebGLPipelineContext } from \"./WebGL/webGLPipelineContext.js\";\nimport { PerformanceConfigurator } from \"./performanceConfigurator.js\";\nimport { WebGLHardwareTexture } from \"./WebGL/webGLHardwareTexture.js\";\nimport { DrawWrapper } from \"../Materials/drawWrapper.js\";\nimport { StencilStateComposer } from \"../States/stencilStateComposer.js\";\nimport { ShaderLanguage } from \"../Materials/shaderLanguage.js\";\nimport { PrecisionDate } from \"../Misc/precisionDate.js\";\n/**\n * Keeps track of all the buffer info used in engine.\n */\nclass BufferPointer {\n}\n/**\n * The base engine class (root of all engines)\n */\nexport class ThinEngine {\n /**\n * Returns the current npm package of the sdk\n */\n // Not mixed with Version for tooling purpose.\n static get NpmPackage() {\n return \"babylonjs@6.21.1\";\n }\n /**\n * Returns the current version of the framework\n */\n static get Version() {\n return \"6.21.1\";\n }\n /**\n * Returns a string describing the current engine\n */\n get description() {\n let description = this.name + this.webGLVersion;\n if (this._caps.parallelShaderCompile) {\n description += \" - Parallel shader compilation\";\n }\n return description;\n }\n /**\n * Gets or sets the name of the engine\n */\n get name() {\n return this._name;\n }\n set name(value) {\n this._name = value;\n }\n /**\n * Returns the version of the engine\n */\n get version() {\n return this._webGLVersion;\n }\n get isDisposed() {\n return this._isDisposed;\n }\n /**\n * Gets or sets the relative url used to load shaders if using the engine in non-minified mode\n */\n static get ShadersRepository() {\n return Effect.ShadersRepository;\n }\n static set ShadersRepository(value) {\n Effect.ShadersRepository = value;\n }\n /**\n * @internal\n */\n _getShaderProcessor(shaderLanguage) {\n return this._shaderProcessor;\n }\n /**\n * Gets or sets a boolean indicating if depth buffer should be reverse, going from far to near.\n * This can provide greater z depth for distant objects.\n */\n get useReverseDepthBuffer() {\n return this._useReverseDepthBuffer;\n }\n set useReverseDepthBuffer(useReverse) {\n if (useReverse === this._useReverseDepthBuffer) {\n return;\n }\n this._useReverseDepthBuffer = useReverse;\n if (useReverse) {\n this._depthCullingState.depthFunc = 518;\n }\n else {\n this._depthCullingState.depthFunc = 515;\n }\n }\n /**\n * Gets the current frame id\n */\n get frameId() {\n return this._frameId;\n }\n /**\n * Gets a boolean indicating that the engine supports uniform buffers\n * @see https://doc.babylonjs.com/setup/support/webGL2#uniform-buffer-objets\n */\n get supportsUniformBuffers() {\n return this.webGLVersion > 1 && !this.disableUniformBuffers;\n }\n /**\n * Gets the options used for engine creation\n * @returns EngineOptions object\n */\n getCreationOptions() {\n return this._creationOptions;\n }\n /** @internal */\n get _shouldUseHighPrecisionShader() {\n return !!(this._caps.highPrecisionShaderSupported && this._highPrecisionShadersAllowed);\n }\n /**\n * Gets a boolean indicating that only power of 2 textures are supported\n * Please note that you can still use non power of 2 textures but in this case the engine will forcefully convert them\n */\n get needPOTTextures() {\n return this._webGLVersion < 2 || this.forcePOTTextures;\n }\n /**\n * Gets the list of current active render loop functions\n * @returns an array with the current render loop functions\n */\n get activeRenderLoops() {\n return this._activeRenderLoops;\n }\n /**\n * Gets or sets a boolean indicating if resources should be retained to be able to handle context lost events\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/optimize_your_scene#handling-webgl-context-lost\n */\n get doNotHandleContextLost() {\n return this._doNotHandleContextLost;\n }\n set doNotHandleContextLost(value) {\n this._doNotHandleContextLost = value;\n }\n get _supportsHardwareTextureRescaling() {\n return false;\n }\n /**\n * sets the object from which width and height will be taken from when getting render width and height\n * Will fallback to the gl object\n * @param dimensions the framebuffer width and height that will be used.\n */\n set framebufferDimensionsObject(dimensions) {\n this._framebufferDimensionsObject = dimensions;\n }\n /**\n * Gets the current viewport\n */\n get currentViewport() {\n return this._cachedViewport;\n }\n /**\n * Gets the default empty texture\n */\n get emptyTexture() {\n if (!this._emptyTexture) {\n this._emptyTexture = this.createRawTexture(new Uint8Array(4), 1, 1, 5, false, false, 1);\n }\n return this._emptyTexture;\n }\n /**\n * Gets the default empty 3D texture\n */\n get emptyTexture3D() {\n if (!this._emptyTexture3D) {\n this._emptyTexture3D = this.createRawTexture3D(new Uint8Array(4), 1, 1, 1, 5, false, false, 1);\n }\n return this._emptyTexture3D;\n }\n /**\n * Gets the default empty 2D array texture\n */\n get emptyTexture2DArray() {\n if (!this._emptyTexture2DArray) {\n this._emptyTexture2DArray = this.createRawTexture2DArray(new Uint8Array(4), 1, 1, 1, 5, false, false, 1);\n }\n return this._emptyTexture2DArray;\n }\n /**\n * Gets the default empty cube texture\n */\n get emptyCubeTexture() {\n if (!this._emptyCubeTexture) {\n const faceData = new Uint8Array(4);\n const cubeData = [faceData, faceData, faceData, faceData, faceData, faceData];\n this._emptyCubeTexture = this.createRawCubeTexture(cubeData, 1, 5, 0, false, false, 1);\n }\n return this._emptyCubeTexture;\n }\n /**\n * Gets a boolean indicating if the engine runs in WebGPU or not.\n */\n get isWebGPU() {\n return this._isWebGPU;\n }\n /**\n * Gets the shader platform name used by the effects.\n */\n get shaderPlatformName() {\n return this._shaderPlatformName;\n }\n /**\n * Enables or disables the snapshot rendering mode\n * Note that the WebGL engine does not support snapshot rendering so setting the value won't have any effect for this engine\n */\n get snapshotRendering() {\n return false;\n }\n set snapshotRendering(activate) {\n // WebGL engine does not support snapshot rendering\n }\n /**\n * Gets or sets the snapshot rendering mode\n */\n get snapshotRenderingMode() {\n return this._snapshotRenderingMode;\n }\n set snapshotRenderingMode(mode) {\n this._snapshotRenderingMode = mode;\n }\n /**\n * Creates a new snapshot at the next frame using the current snapshotRenderingMode\n */\n snapshotRenderingReset() {\n this.snapshotRendering = false;\n }\n static _CreateCanvas(width, height) {\n if (typeof document === \"undefined\") {\n return new OffscreenCanvas(width, height);\n }\n const canvas = document.createElement(\"canvas\");\n canvas.width = width;\n canvas.height = height;\n return canvas;\n }\n /**\n * Create a canvas. This method is overridden by other engines\n * @param width width\n * @param height height\n * @returns ICanvas interface\n */\n createCanvas(width, height) {\n return ThinEngine._CreateCanvas(width, height);\n }\n /**\n * Create an image to use with canvas\n * @returns IImage interface\n */\n createCanvasImage() {\n return document.createElement(\"img\");\n }\n /**\n * Creates a new engine\n * @param canvasOrContext defines the canvas or WebGL context to use for rendering. If you provide a WebGL context, Babylon.js will not hook events on the canvas (like pointers, keyboards, etc...) so no event observables will be available. This is mostly used when Babylon.js is used as a plugin on a system which already used the WebGL context\n * @param antialias defines enable antialiasing (default: false)\n * @param options defines further options to be sent to the getContext() function\n * @param adaptToDeviceRatio defines whether to adapt to the device's viewport characteristics (default: false)\n */\n constructor(canvasOrContext, antialias, options, adaptToDeviceRatio) {\n var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;\n /** @internal */\n this._name = \"WebGL\";\n this._isDisposed = false;\n /**\n * Gets or sets a boolean that indicates if textures must be forced to power of 2 size even if not required\n */\n this.forcePOTTextures = false;\n /**\n * Gets a boolean indicating if the engine is currently rendering in fullscreen mode\n */\n this.isFullscreen = false;\n /**\n * Gets or sets a boolean indicating if back faces must be culled. If false, front faces are culled instead (true by default)\n * If non null, this takes precedence over the value from the material\n */\n this.cullBackFaces = null;\n /**\n * Gets or sets a boolean indicating if the engine must keep rendering even if the window is not in foreground\n */\n this.renderEvenInBackground = true;\n /**\n * Gets or sets a boolean indicating that cache can be kept between frames\n */\n this.preventCacheWipeBetweenFrames = false;\n /** Gets or sets a boolean indicating if the engine should validate programs after compilation */\n this.validateShaderPrograms = false;\n this._useReverseDepthBuffer = false;\n /**\n * Indicates if the z range in NDC space is 0..1 (value: true) or -1..1 (value: false)\n */\n this.isNDCHalfZRange = false;\n /**\n * Indicates that the origin of the texture/framebuffer space is the bottom left corner. If false, the origin is top left\n */\n this.hasOriginBottomLeft = true;\n /**\n * Gets or sets a boolean indicating that uniform buffers must be disabled even if they are supported\n */\n this.disableUniformBuffers = false;\n /**\n * An event triggered when the engine is disposed.\n */\n this.onDisposeObservable = new Observable();\n this._frameId = 0;\n /** @internal */\n this._uniformBuffers = new Array();\n /** @internal */\n this._storageBuffers = new Array();\n /** @internal */\n this._webGLVersion = 1.0;\n this._windowIsBackground = false;\n this._highPrecisionShadersAllowed = true;\n /** @internal */\n this._badOS = false;\n /** @internal */\n this._badDesktopOS = false;\n this._renderingQueueLaunched = false;\n this._activeRenderLoops = new Array();\n // Lost context\n /**\n * Observable signaled when a context lost event is raised\n */\n this.onContextLostObservable = new Observable();\n /**\n * Observable signaled when a context restored event is raised\n */\n this.onContextRestoredObservable = new Observable();\n this._contextWasLost = false;\n /** @internal */\n this._doNotHandleContextLost = false;\n /**\n * Gets or sets a boolean indicating that vertex array object must be disabled even if they are supported\n */\n this.disableVertexArrayObjects = false;\n // States\n /** @internal */\n this._colorWrite = true;\n /** @internal */\n this._colorWriteChanged = true;\n /** @internal */\n this._depthCullingState = new DepthCullingState();\n /** @internal */\n this._stencilStateComposer = new StencilStateComposer();\n /** @internal */\n this._stencilState = new StencilState();\n /** @internal */\n this._alphaState = new AlphaState();\n /** @internal */\n this._alphaMode = 1;\n /** @internal */\n this._alphaEquation = 0;\n // Cache\n /** @internal */\n this._internalTexturesCache = new Array();\n /** @internal */\n this._renderTargetWrapperCache = new Array();\n /** @internal */\n this._activeChannel = 0;\n this._currentTextureChannel = -1;\n /** @internal */\n this._boundTexturesCache = {};\n this._compiledEffects = {};\n this._vertexAttribArraysEnabled = [];\n this._uintIndicesCurrentlySet = false;\n this._currentBoundBuffer = new Array();\n /** @internal */\n this._currentFramebuffer = null;\n /** @internal */\n this._dummyFramebuffer = null;\n this._currentBufferPointers = new Array();\n this._currentInstanceLocations = new Array();\n this._currentInstanceBuffers = new Array();\n this._vaoRecordInProgress = false;\n this._mustWipeVertexAttributes = false;\n this._nextFreeTextureSlots = new Array();\n this._maxSimultaneousTextures = 0;\n this._maxMSAASamplesOverride = null;\n this._activeRequests = new Array();\n /**\n * If set to true zooming in and out in the browser will rescale the hardware-scaling correctly.\n */\n this.adaptToDeviceRatio = false;\n /** @internal */\n this._lastDevicePixelRatio = 1.0;\n /** @internal */\n this._transformTextureUrl = null;\n /**\n * Gets information about the current host\n */\n this.hostInformation = {\n isMobile: false,\n };\n /**\n * Defines whether the engine has been created with the premultipliedAlpha option on or not.\n */\n this.premultipliedAlpha = true;\n /**\n * Observable event triggered before each texture is initialized\n */\n this.onBeforeTextureInitObservable = new Observable();\n /** @internal */\n this._isWebGPU = false;\n this._snapshotRenderingMode = 0;\n this._viewportCached = { x: 0, y: 0, z: 0, w: 0 };\n this._unpackFlipYCached = null;\n /**\n * In case you are sharing the context with other applications, it might\n * be interested to not cache the unpack flip y state to ensure a consistent\n * value would be set.\n */\n this.enableUnpackFlipYCached = true;\n this._boundUniforms = {};\n this.startTime = PrecisionDate.Now;\n let canvas = null;\n options = options || {};\n this._creationOptions = options;\n // Save this off for use in resize().\n this.adaptToDeviceRatio = adaptToDeviceRatio !== null && adaptToDeviceRatio !== void 0 ? adaptToDeviceRatio : false;\n this._stencilStateComposer.stencilGlobal = this._stencilState;\n PerformanceConfigurator.SetMatrixPrecision(!!options.useHighPrecisionMatrix);\n options.antialias = antialias !== null && antialias !== void 0 ? antialias : options.antialias;\n options.deterministicLockstep = (_a = options.deterministicLockstep) !== null && _a !== void 0 ? _a : false;\n options.lockstepMaxSteps = (_b = options.lockstepMaxSteps) !== null && _b !== void 0 ? _b : 4;\n options.timeStep = (_c = options.timeStep) !== null && _c !== void 0 ? _c : 1 / 60;\n options.audioEngine = (_d = options.audioEngine) !== null && _d !== void 0 ? _d : true;\n options.stencil = (_e = options.stencil) !== null && _e !== void 0 ? _e : true;\n this._audioContext = (_g = (_f = options.audioEngineOptions) === null || _f === void 0 ? void 0 : _f.audioContext) !== null && _g !== void 0 ? _g : null;\n this._audioDestination = (_j = (_h = options.audioEngineOptions) === null || _h === void 0 ? void 0 : _h.audioDestination) !== null && _j !== void 0 ? _j : null;\n this.premultipliedAlpha = (_k = options.premultipliedAlpha) !== null && _k !== void 0 ? _k : true;\n this.useExactSrgbConversions = (_l = options.useExactSrgbConversions) !== null && _l !== void 0 ? _l : false;\n this._doNotHandleContextLost = !!options.doNotHandleContextLost;\n this._isStencilEnable = options.stencil ? true : false;\n // Viewport\n adaptToDeviceRatio = adaptToDeviceRatio || options.adaptToDeviceRatio || false;\n const devicePixelRatio = IsWindowObjectExist() ? window.devicePixelRatio || 1.0 : 1.0;\n const limitDeviceRatio = options.limitDeviceRatio || devicePixelRatio;\n this._hardwareScalingLevel = adaptToDeviceRatio ? 1.0 / Math.min(limitDeviceRatio, devicePixelRatio) : 1.0;\n this._lastDevicePixelRatio = devicePixelRatio;\n if (!canvasOrContext) {\n return;\n }\n if (canvasOrContext.getContext) {\n canvas = canvasOrContext;\n this._renderingCanvas = canvas;\n if (options.preserveDrawingBuffer === undefined) {\n options.preserveDrawingBuffer = false;\n }\n if (options.xrCompatible === undefined) {\n options.xrCompatible = true;\n }\n // Exceptions\n if (navigator && navigator.userAgent) {\n this._setupMobileChecks();\n const ua = navigator.userAgent;\n for (const exception of ThinEngine.ExceptionList) {\n const key = exception.key;\n const targets = exception.targets;\n const check = new RegExp(key);\n if (check.test(ua)) {\n if (exception.capture && exception.captureConstraint) {\n const capture = exception.capture;\n const constraint = exception.captureConstraint;\n const regex = new RegExp(capture);\n const matches = regex.exec(ua);\n if (matches && matches.length > 0) {\n const capturedValue = parseInt(matches[matches.length - 1]);\n if (capturedValue >= constraint) {\n continue;\n }\n }\n }\n for (const target of targets) {\n switch (target) {\n case \"uniformBuffer\":\n this.disableUniformBuffers = true;\n break;\n case \"vao\":\n this.disableVertexArrayObjects = true;\n break;\n case \"antialias\":\n options.antialias = false;\n break;\n case \"maxMSAASamples\":\n this._maxMSAASamplesOverride = 1;\n break;\n }\n }\n }\n }\n }\n // Context lost\n if (!this._doNotHandleContextLost) {\n this._onContextLost = (evt) => {\n evt.preventDefault();\n this._contextWasLost = true;\n Logger.Warn(\"WebGL context lost.\");\n this.onContextLostObservable.notifyObservers(this);\n };\n this._onContextRestored = () => {\n this._restoreEngineAfterContextLost(this._initGLContext.bind(this));\n };\n canvas.addEventListener(\"webglcontextlost\", this._onContextLost, false);\n canvas.addEventListener(\"webglcontextrestored\", this._onContextRestored, false);\n options.powerPreference = options.powerPreference || \"high-performance\";\n }\n // Detect if we are running on a faulty buggy desktop OS.\n this._badDesktopOS = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\n if (this._badDesktopOS) {\n options.xrCompatible = false;\n }\n // GL\n if (!options.disableWebGL2Support) {\n try {\n this._gl = (canvas.getContext(\"webgl2\", options) || canvas.getContext(\"experimental-webgl2\", options));\n if (this._gl) {\n this._webGLVersion = 2.0;\n this._shaderPlatformName = \"WEBGL2\";\n // Prevent weird browsers to lie (yeah that happens!)\n if (!this._gl.deleteQuery) {\n this._webGLVersion = 1.0;\n this._shaderPlatformName = \"WEBGL1\";\n }\n }\n }\n catch (e) {\n // Do nothing\n }\n }\n if (!this._gl) {\n if (!canvas) {\n throw new Error(\"The provided canvas is null or undefined.\");\n }\n try {\n this._gl = (canvas.getContext(\"webgl\", options) || canvas.getContext(\"experimental-webgl\", options));\n }\n catch (e) {\n throw new Error(\"WebGL not supported\");\n }\n }\n if (!this._gl) {\n throw new Error(\"WebGL not supported\");\n }\n }\n else {\n this._gl = canvasOrContext;\n this._renderingCanvas = this._gl.canvas;\n if (this._gl.renderbufferStorageMultisample) {\n this._webGLVersion = 2.0;\n this._shaderPlatformName = \"WEBGL2\";\n }\n else {\n this._shaderPlatformName = \"WEBGL1\";\n }\n const attributes = this._gl.getContextAttributes();\n if (attributes) {\n options.stencil = attributes.stencil;\n }\n }\n // Ensures a consistent color space unpacking of textures cross browser.\n this._gl.pixelStorei(this._gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, this._gl.NONE);\n if (options.useHighPrecisionFloats !== undefined) {\n this._highPrecisionShadersAllowed = options.useHighPrecisionFloats;\n }\n this.resize();\n this._initGLContext();\n this._initFeatures();\n // Prepare buffer pointers\n for (let i = 0; i < this._caps.maxVertexAttribs; i++) {\n this._currentBufferPointers[i] = new BufferPointer();\n }\n // Shader processor\n this._shaderProcessor = this.webGLVersion > 1 ? new WebGL2ShaderProcessor() : new WebGLShaderProcessor();\n // Detect if we are running on a faulty buggy OS.\n this._badOS = /iPad/i.test(navigator.userAgent) || /iPhone/i.test(navigator.userAgent);\n // Starting with iOS 14, we can trust the browser\n // let matches = navigator.userAgent.match(/Version\\/(\\d+)/);\n // if (matches && matches.length === 2) {\n // if (parseInt(matches[1]) >= 14) {\n // this._badOS = false;\n // }\n // }\n const versionToLog = `Babylon.js v${ThinEngine.Version}`;\n console.log(versionToLog + ` - ${this.description}`);\n // Check setAttribute in case of workers\n if (this._renderingCanvas && this._renderingCanvas.setAttribute) {\n this._renderingCanvas.setAttribute(\"data-engine\", versionToLog);\n }\n }\n _setupMobileChecks() {\n if (!(navigator && navigator.userAgent)) {\n return;\n }\n // Function to check if running on mobile device\n this._checkForMobile = () => {\n const currentUA = navigator.userAgent;\n this.hostInformation.isMobile =\n currentUA.indexOf(\"Mobile\") !== -1 ||\n // Needed for iOS 13+ detection on iPad (inspired by solution from https://stackoverflow.com/questions/9038625/detect-if-device-is-ios)\n (currentUA.indexOf(\"Mac\") !== -1 && IsDocumentAvailable() && \"ontouchend\" in document);\n };\n // Set initial isMobile value\n this._checkForMobile();\n // Set up event listener to check when window is resized (used to get emulator activation to work properly)\n if (IsWindowObjectExist()) {\n window.addEventListener(\"resize\", this._checkForMobile);\n }\n }\n _restoreEngineAfterContextLost(initEngine) {\n // Adding a timeout to avoid race condition at browser level\n setTimeout(async () => {\n var _a;\n this._dummyFramebuffer = null;\n const depthTest = this._depthCullingState.depthTest; // backup those values because the call to initEngine / wipeCaches will reset them\n const depthFunc = this._depthCullingState.depthFunc;\n const depthMask = this._depthCullingState.depthMask;\n const stencilTest = this._stencilState.stencilTest;\n // Rebuild context\n await initEngine();\n // Ensure webgl and engine states are matching\n this.wipeCaches(true);\n // Rebuild effects\n this._rebuildEffects();\n (_a = this._rebuildComputeEffects) === null || _a === void 0 ? void 0 : _a.call(this);\n // Note:\n // The call to _rebuildBuffers must be made before the call to _rebuildInternalTextures because in the process of _rebuildBuffers the buffers used by the post process managers will be rebuilt\n // and we may need to use the post process manager of the scene during _rebuildInternalTextures (in WebGL1, non-POT textures are rescaled using a post process + post process manager of the scene)\n // Rebuild buffers\n this._rebuildBuffers();\n // Rebuild textures\n this._rebuildInternalTextures();\n // Rebuild textures\n this._rebuildRenderTargetWrappers();\n // Reset engine states after all the buffer/textures/... have been rebuilt\n this.wipeCaches(true);\n this._depthCullingState.depthTest = depthTest;\n this._depthCullingState.depthFunc = depthFunc;\n this._depthCullingState.depthMask = depthMask;\n this._stencilState.stencilTest = stencilTest;\n Logger.Warn(this.name + \" context successfully restored.\");\n this.onContextRestoredObservable.notifyObservers(this);\n this._contextWasLost = false;\n }, 0);\n }\n /**\n * Shared initialization across engines types.\n * @param canvas The canvas associated with this instance of the engine.\n */\n _sharedInit(canvas) {\n this._renderingCanvas = canvas;\n }\n /**\n * @internal\n */\n _getShaderProcessingContext(shaderLanguage) {\n return null;\n }\n _rebuildInternalTextures() {\n const currentState = this._internalTexturesCache.slice(); // Do a copy because the rebuild will add proxies\n for (const internalTexture of currentState) {\n internalTexture._rebuild();\n }\n }\n _rebuildRenderTargetWrappers() {\n const currentState = this._renderTargetWrapperCache.slice(); // Do a copy because the rebuild will add proxies\n for (const renderTargetWrapper of currentState) {\n renderTargetWrapper._rebuild();\n }\n }\n _rebuildEffects() {\n for (const key in this._compiledEffects) {\n const effect = this._compiledEffects[key];\n effect._pipelineContext = null; // because _prepareEffect will try to dispose this pipeline before recreating it and that would lead to webgl errors\n effect._wasPreviouslyReady = false;\n effect._prepareEffect();\n }\n Effect.ResetCache();\n }\n /**\n * Gets a boolean indicating if all created effects are ready\n * @returns true if all effects are ready\n */\n areAllEffectsReady() {\n for (const key in this._compiledEffects) {\n const effect = this._compiledEffects[key];\n if (!effect.isReady()) {\n return false;\n }\n }\n return true;\n }\n _rebuildBuffers() {\n // Uniforms\n for (const uniformBuffer of this._uniformBuffers) {\n uniformBuffer._rebuild();\n }\n // Storage buffers\n for (const storageBuffer of this._storageBuffers) {\n storageBuffer._rebuild();\n }\n }\n _initGLContext() {\n var _a;\n // Caps\n this._caps = {\n maxTexturesImageUnits: this._gl.getParameter(this._gl.MAX_TEXTURE_IMAGE_UNITS),\n maxCombinedTexturesImageUnits: this._gl.getParameter(this._gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS),\n maxVertexTextureImageUnits: this._gl.getParameter(this._gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS),\n maxTextureSize: this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),\n maxSamples: this._webGLVersion > 1 ? this._gl.getParameter(this._gl.MAX_SAMPLES) : 1,\n maxCubemapTextureSize: this._gl.getParameter(this._gl.MAX_CUBE_MAP_TEXTURE_SIZE),\n maxRenderTextureSize: this._gl.getParameter(this._gl.MAX_RENDERBUFFER_SIZE),\n maxVertexAttribs: this._gl.getParameter(this._gl.MAX_VERTEX_ATTRIBS),\n maxVaryingVectors: this._gl.getParameter(this._gl.MAX_VARYING_VECTORS),\n maxFragmentUniformVectors: this._gl.getParameter(this._gl.MAX_FRAGMENT_UNIFORM_VECTORS),\n maxVertexUniformVectors: this._gl.getParameter(this._gl.MAX_VERTEX_UNIFORM_VECTORS),\n parallelShaderCompile: this._gl.getExtension(\"KHR_parallel_shader_compile\") || undefined,\n standardDerivatives: this._webGLVersion > 1 || this._gl.getExtension(\"OES_standard_derivatives\") !== null,\n maxAnisotropy: 1,\n astc: this._gl.getExtension(\"WEBGL_compressed_texture_astc\") || this._gl.getExtension(\"WEBKIT_WEBGL_compressed_texture_astc\"),\n bptc: this._gl.getExtension(\"EXT_texture_compression_bptc\") || this._gl.getExtension(\"WEBKIT_EXT_texture_compression_bptc\"),\n s3tc: this._gl.getExtension(\"WEBGL_compressed_texture_s3tc\") || this._gl.getExtension(\"WEBKIT_WEBGL_compressed_texture_s3tc\"),\n // eslint-disable-next-line @typescript-eslint/naming-convention\n s3tc_srgb: this._gl.getExtension(\"WEBGL_compressed_texture_s3tc_srgb\") || this._gl.getExtension(\"WEBKIT_WEBGL_compressed_texture_s3tc_srgb\"),\n pvrtc: this._gl.getExtension(\"WEBGL_compressed_texture_pvrtc\") || this._gl.getExtension(\"WEBKIT_WEBGL_compressed_texture_pvrtc\"),\n etc1: this._gl.getExtension(\"WEBGL_compressed_texture_etc1\") || this._gl.getExtension(\"WEBKIT_WEBGL_compressed_texture_etc1\"),\n etc2: this._gl.getExtension(\"WEBGL_compressed_texture_etc\") ||\n this._gl.getExtension(\"WEBKIT_WEBGL_compressed_texture_etc\") ||\n this._gl.getExtension(\"WEBGL_compressed_texture_es3_0\"),\n textureAnisotropicFilterExtension: this._gl.getExtension(\"EXT_texture_filter_anisotropic\") ||\n this._gl.getExtension(\"WEBKIT_EXT_texture_filter_anisotropic\") ||\n this._gl.getExtension(\"MOZ_EXT_texture_filter_anisotropic\"),\n uintIndices: this._webGLVersion > 1 || this._gl.getExtension(\"OES_element_index_uint\") !== null,\n fragmentDepthSupported: this._webGLVersion > 1 || this._gl.getExtension(\"EXT_frag_depth\") !== null,\n highPrecisionShaderSupported: false,\n timerQuery: this._gl.getExtension(\"EXT_disjoint_timer_query_webgl2\") || this._gl.getExtension(\"EXT_disjoint_timer_query\"),\n supportOcclusionQuery: this._webGLVersion > 1,\n canUseTimestampForTimerQuery: false,\n drawBuffersExtension: false,\n maxMSAASamples: 1,\n colorBufferFloat: !!(this._webGLVersion > 1 && this._gl.getExtension(\"EXT_color_buffer_float\")),\n colorBufferHalfFloat: !!(this._webGLVersion > 1 && this._gl.getExtension(\"EXT_color_buffer_half_float\")),\n textureFloat: this._webGLVersion > 1 || this._gl.getExtension(\"OES_texture_float\") ? true : false,\n textureHalfFloat: this._webGLVersion > 1 || this._gl.getExtension(\"OES_texture_half_float\") ? true : false,\n textureHalfFloatRender: false,\n textureFloatLinearFiltering: false,\n textureFloatRender: false,\n textureHalfFloatLinearFiltering: false,\n vertexArrayObject: false,\n instancedArrays: false,\n textureLOD: this._webGLVersion > 1 || this._gl.getExtension(\"EXT_shader_texture_lod\") ? true : false,\n texelFetch: this._webGLVersion !== 1,\n blendMinMax: false,\n multiview: this._gl.getExtension(\"OVR_multiview2\"),\n oculusMultiview: this._gl.getExtension(\"OCULUS_multiview\"),\n depthTextureExtension: false,\n canUseGLInstanceID: this._webGLVersion > 1,\n canUseGLVertexID: this._webGLVersion > 1,\n supportComputeShaders: false,\n supportSRGBBuffers: false,\n supportTransformFeedbacks: this._webGLVersion > 1,\n textureMaxLevel: this._webGLVersion > 1,\n texture2DArrayMaxLayerCount: this._webGLVersion > 1 ? this._gl.getParameter(this._gl.MAX_ARRAY_TEXTURE_LAYERS) : 128,\n disableMorphTargetTexture: false,\n };\n // Infos\n this._glVersion = this._gl.getParameter(this._gl.VERSION);\n const rendererInfo = this._gl.getExtension(\"WEBGL_debug_renderer_info\");\n if (rendererInfo != null) {\n this._glRenderer = this._gl.getParameter(rendererInfo.UNMASKED_RENDERER_WEBGL);\n this._glVendor = this._gl.getParameter(rendererInfo.UNMASKED_VENDOR_WEBGL);\n }\n if (!this._glVendor) {\n this._glVendor = this._gl.getParameter(this._gl.VENDOR) || \"Unknown vendor\";\n }\n if (!this._glRenderer) {\n this._glRenderer = this._gl.getParameter(this._gl.RENDERER) || \"Unknown renderer\";\n }\n // Constants\n if (this._gl.HALF_FLOAT_OES !== 0x8d61) {\n this._gl.HALF_FLOAT_OES = 0x8d61; // Half floating-point type (16-bit).\n }\n if (this._gl.RGBA16F !== 0x881a) {\n this._gl.RGBA16F = 0x881a; // RGBA 16-bit floating-point color-renderable internal sized format.\n }\n if (this._gl.RGBA32F !== 0x8814) {\n this._gl.RGBA32F = 0x8814; // RGBA 32-bit floating-point color-renderable internal sized format.\n }\n if (this._gl.DEPTH24_STENCIL8 !== 35056) {\n this._gl.DEPTH24_STENCIL8 = 35056;\n }\n // Extensions\n if (this._caps.timerQuery) {\n if (this._webGLVersion === 1) {\n this._gl.getQuery = this._caps.timerQuery.getQueryEXT.bind(this._caps.timerQuery);\n }\n // WebGLQuery casted to number to avoid TS error\n this._caps.canUseTimestampForTimerQuery = ((_a = this._gl.getQuery(this._caps.timerQuery.TIMESTAMP_EXT, this._caps.timerQuery.QUERY_COUNTER_BITS_EXT)) !== null && _a !== void 0 ? _a : 0) > 0;\n }\n this._caps.maxAnisotropy = this._caps.textureAnisotropicFilterExtension\n ? this._gl.getParameter(this._caps.textureAnisotropicFilterExtension.MAX_TEXTURE_MAX_ANISOTROPY_EXT)\n : 0;\n this._caps.textureFloatLinearFiltering = this._caps.textureFloat && this._gl.getExtension(\"OES_texture_float_linear\") ? true : false;\n this._caps.textureFloatRender = this._caps.textureFloat && this._canRenderToFloatFramebuffer() ? true : false;\n this._caps.textureHalfFloatLinearFiltering =\n this._webGLVersion > 1 || (this._caps.textureHalfFloat && this._gl.getExtension(\"OES_texture_half_float_linear\")) ? true : false;\n // Compressed formats\n if (this._caps.astc) {\n this._gl.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR = this._caps.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR;\n }\n if (this._caps.bptc) {\n this._gl.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT = this._caps.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT;\n }\n if (this._caps.s3tc_srgb) {\n this._gl.COMPRESSED_SRGB_S3TC_DXT1_EXT = this._caps.s3tc_srgb.COMPRESSED_SRGB_S3TC_DXT1_EXT;\n this._gl.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT = this._caps.s3tc_srgb.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;\n this._gl.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT = this._caps.s3tc_srgb.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT;\n }\n if (this._caps.etc2) {\n this._gl.COMPRESSED_SRGB8_ETC2 = this._caps.etc2.COMPRESSED_SRGB8_ETC2;\n this._gl.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC = this._caps.etc2.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC;\n }\n // Checks if some of the format renders first to allow the use of webgl inspector.\n if (this._webGLVersion > 1) {\n if (this._gl.HALF_FLOAT_OES !== 0x140b) {\n this._gl.HALF_FLOAT_OES = 0x140b;\n }\n }\n this._caps.textureHalfFloatRender = this._caps.textureHalfFloat && this._canRenderToHalfFloatFramebuffer();\n // Draw buffers\n if (this._webGLVersion > 1) {\n this._caps.drawBuffersExtension = true;\n this._caps.maxMSAASamples = this._maxMSAASamplesOverride !== null ? this._maxMSAASamplesOverride : this._gl.getParameter(this._gl.MAX_SAMPLES);\n }\n else {\n const drawBuffersExtension = this._gl.getExtension(\"WEBGL_draw_buffers\");\n if (drawBuffersExtension !== null) {\n this._caps.drawBuffersExtension = true;\n this._gl.drawBuffers = drawBuffersExtension.drawBuffersWEBGL.bind(drawBuffersExtension);\n this._gl.DRAW_FRAMEBUFFER = this._gl.FRAMEBUFFER;\n for (let i = 0; i < 16; i++) {\n this._gl[\"COLOR_ATTACHMENT\" + i + \"_WEBGL\"] = drawBuffersExtension[\"COLOR_ATTACHMENT\" + i + \"_WEBGL\"];\n }\n }\n }\n // Depth Texture\n if (this._webGLVersion > 1) {\n this._caps.depthTextureExtension = true;\n }\n else {\n const depthTextureExtension = this._gl.getExtension(\"WEBGL_depth_texture\");\n if (depthTextureExtension != null) {\n this._caps.depthTextureExtension = true;\n this._gl.UNSIGNED_INT_24_8 = depthTextureExtension.UNSIGNED_INT_24_8_WEBGL;\n }\n }\n // Vertex array object\n if (this.disableVertexArrayObjects) {\n this._caps.vertexArrayObject = false;\n }\n else if (this._webGLVersion > 1) {\n this._caps.vertexArrayObject = true;\n }\n else {\n const vertexArrayObjectExtension = this._gl.getExtension(\"OES_vertex_array_object\");\n if (vertexArrayObjectExtension != null) {\n this._caps.vertexArrayObject = true;\n this._gl.createVertexArray = vertexArrayObjectExtension.createVertexArrayOES.bind(vertexArrayObjectExtension);\n this._gl.bindVertexArray = vertexArrayObjectExtension.bindVertexArrayOES.bind(vertexArrayObjectExtension);\n this._gl.deleteVertexArray = vertexArrayObjectExtension.deleteVertexArrayOES.bind(vertexArrayObjectExtension);\n }\n }\n // Instances count\n if (this._webGLVersion > 1) {\n this._caps.instancedArrays = true;\n }\n else {\n const instanceExtension = this._gl.getExtension(\"ANGLE_instanced_arrays\");\n if (instanceExtension != null) {\n this._caps.instancedArrays = true;\n this._gl.drawArraysInstanced = instanceExtension.drawArraysInstancedANGLE.bind(instanceExtension);\n this._gl.drawElementsInstanced = instanceExtension.drawElementsInstancedANGLE.bind(instanceExtension);\n this._gl.vertexAttribDivisor = instanceExtension.vertexAttribDivisorANGLE.bind(instanceExtension);\n }\n else {\n this._caps.instancedArrays = false;\n }\n }\n if (this._gl.getShaderPrecisionFormat) {\n const vertexhighp = this._gl.getShaderPrecisionFormat(this._gl.VERTEX_SHADER, this._gl.HIGH_FLOAT);\n const fragmenthighp = this._gl.getShaderPrecisionFormat(this._gl.FRAGMENT_SHADER, this._gl.HIGH_FLOAT);\n if (vertexhighp && fragmenthighp) {\n this._caps.highPrecisionShaderSupported = vertexhighp.precision !== 0 && fragmenthighp.precision !== 0;\n }\n }\n if (this._webGLVersion > 1) {\n this._caps.blendMinMax = true;\n }\n else {\n const blendMinMaxExtension = this._gl.getExtension(\"EXT_blend_minmax\");\n if (blendMinMaxExtension != null) {\n this._caps.blendMinMax = true;\n this._gl.MAX = blendMinMaxExtension.MAX_EXT;\n this._gl.MIN = blendMinMaxExtension.MIN_EXT;\n }\n }\n // sRGB buffers\n // only run this if not already set to true (in the constructor, for example)\n if (!this._caps.supportSRGBBuffers) {\n if (this._webGLVersion > 1) {\n this._caps.supportSRGBBuffers = true;\n this._glSRGBExtensionValues = {\n SRGB: WebGL2RenderingContext.SRGB,\n SRGB8: WebGL2RenderingContext.SRGB8,\n SRGB8_ALPHA8: WebGL2RenderingContext.SRGB8_ALPHA8,\n };\n }\n else {\n const sRGBExtension = this._gl.getExtension(\"EXT_sRGB\");\n if (sRGBExtension != null) {\n this._caps.supportSRGBBuffers = true;\n this._glSRGBExtensionValues = {\n SRGB: sRGBExtension.SRGB_EXT,\n SRGB8: sRGBExtension.SRGB_ALPHA_EXT,\n SRGB8_ALPHA8: sRGBExtension.SRGB_ALPHA_EXT,\n };\n }\n }\n // take into account the forced state that was provided in options\n // When the issue in angle/chrome is fixed the flag should be taken into account only when it is explicitly defined\n this._caps.supportSRGBBuffers = this._caps.supportSRGBBuffers && !!(this._creationOptions && this._creationOptions.forceSRGBBufferSupportState);\n }\n // Depth buffer\n this._depthCullingState.depthTest = true;\n this._depthCullingState.depthFunc = this._gl.LEQUAL;\n this._depthCullingState.depthMask = true;\n // Texture maps\n this._maxSimultaneousTextures = this._caps.maxCombinedTexturesImageUnits;\n for (let slot = 0; slot < this._maxSimultaneousTextures; slot++) {\n this._nextFreeTextureSlots.push(slot);\n }\n if (this._glRenderer === \"Mali-G72\") {\n // Overcome a bug when using a texture to store morph targets on Mali-G72\n this._caps.disableMorphTargetTexture = true;\n }\n }\n _initFeatures() {\n this._features = {\n forceBitmapOverHTMLImageElement: false,\n supportRenderAndCopyToLodForFloatTextures: this._webGLVersion !== 1,\n supportDepthStencilTexture: this._webGLVersion !== 1,\n supportShadowSamplers: this._webGLVersion !== 1,\n uniformBufferHardCheckMatrix: false,\n allowTexturePrefiltering: this._webGLVersion !== 1,\n trackUbosInFrame: false,\n checkUbosContentBeforeUpload: false,\n supportCSM: this._webGLVersion !== 1,\n basisNeedsPOT: this._webGLVersion === 1,\n support3DTextures: this._webGLVersion !== 1,\n needTypeSuffixInShaderConstants: this._webGLVersion !== 1,\n supportMSAA: this._webGLVersion !== 1,\n supportSSAO2: this._webGLVersion !== 1,\n supportExtendedTextureFormats: this._webGLVersion !== 1,\n supportSwitchCaseInShader: this._webGLVersion !== 1,\n supportSyncTextureRead: true,\n needsInvertingBitmap: true,\n useUBOBindingCache: true,\n needShaderCodeInlining: false,\n needToAlwaysBindUniformBuffers: false,\n supportRenderPasses: false,\n supportSpriteInstancing: true,\n _collectUbosUpdatedInFrame: false,\n };\n }\n /**\n * Gets version of the current webGL context\n * Keep it for back compat - use version instead\n */\n get webGLVersion() {\n return this._webGLVersion;\n }\n /**\n * Gets a string identifying the name of the class\n * @returns \"Engine\" string\n */\n getClassName() {\n return \"ThinEngine\";\n }\n /**\n * Returns true if the stencil buffer has been enabled through the creation option of the context.\n */\n get isStencilEnable() {\n return this._isStencilEnable;\n }\n /** @internal */\n _prepareWorkingCanvas() {\n if (this._workingCanvas) {\n return;\n }\n this._workingCanvas = this.createCanvas(1, 1);\n const context = this._workingCanvas.getContext(\"2d\");\n if (context) {\n this._workingContext = context;\n }\n }\n /**\n * Reset the texture cache to empty state\n */\n resetTextureCache() {\n for (const key in this._boundTexturesCache) {\n if (!Object.prototype.hasOwnProperty.call(this._boundTexturesCache, key)) {\n continue;\n }\n this._boundTexturesCache[key] = null;\n }\n this._currentTextureChannel = -1;\n }\n /**\n * Gets an object containing information about the current engine context\n * @returns an object containing the vendor, the renderer and the version of the current engine context\n */\n getInfo() {\n return this.getGlInfo();\n }\n /**\n * Gets an object containing information about the current webGL context\n * @returns an object containing the vendor, the renderer and the version of the current webGL context\n */\n getGlInfo() {\n return {\n vendor: this._glVendor,\n renderer: this._glRenderer,\n version: this._glVersion,\n };\n }\n /**\n * Defines the hardware scaling level.\n * By default the hardware scaling level is computed from the window device ratio.\n * if level = 1 then the engine will render at the exact resolution of the canvas. If level = 0.5 then the engine will render at twice the size of the canvas.\n * @param level defines the level to use\n */\n setHardwareScalingLevel(level) {\n this._hardwareScalingLevel = level;\n this.resize();\n }\n /**\n * Gets the current hardware scaling level.\n * By default the hardware scaling level is computed from the window device ratio.\n * if level = 1 then the engine will render at the exact resolution of the canvas. If level = 0.5 then the engine will render at twice the size of the canvas.\n * @returns a number indicating the current hardware scaling level\n */\n getHardwareScalingLevel() {\n return this._hardwareScalingLevel;\n }\n /**\n * Gets the list of loaded textures\n * @returns an array containing all loaded textures\n */\n getLoadedTexturesCache() {\n return this._internalTexturesCache;\n }\n /**\n * Gets the object containing all engine capabilities\n * @returns the EngineCapabilities object\n */\n getCaps() {\n return this._caps;\n }\n /**\n * stop executing a render loop function and remove it from the execution array\n * @param renderFunction defines the function to be removed. If not provided all functions will be removed.\n */\n stopRenderLoop(renderFunction) {\n if (!renderFunction) {\n this._activeRenderLoops.length = 0;\n this._cancelFrame();\n return;\n }\n const index = this._activeRenderLoops.indexOf(renderFunction);\n if (index >= 0) {\n this._activeRenderLoops.splice(index, 1);\n if (this._activeRenderLoops.length == 0) {\n this._cancelFrame();\n }\n }\n }\n _cancelFrame() {\n if (this._renderingQueueLaunched && this._frameHandler) {\n this._renderingQueueLaunched = false;\n if (!IsWindowObjectExist()) {\n if (typeof cancelAnimationFrame === \"function\") {\n return cancelAnimationFrame(this._frameHandler);\n }\n }\n else {\n const { cancelAnimationFrame } = this.getHostWindow() || window;\n if (typeof cancelAnimationFrame === \"function\") {\n return cancelAnimationFrame(this._frameHandler);\n }\n }\n return clearTimeout(this._frameHandler);\n }\n }\n /** @internal */\n _renderLoop() {\n if (!this._contextWasLost) {\n let shouldRender = true;\n if (this._isDisposed || (!this.renderEvenInBackground && this._windowIsBackground)) {\n shouldRender = false;\n }\n if (shouldRender) {\n // Start new frame\n this.beginFrame();\n for (let index = 0; index < this._activeRenderLoops.length; index++) {\n const renderFunction = this._activeRenderLoops[index];\n renderFunction();\n }\n // Present\n this.endFrame();\n }\n }\n if (this._activeRenderLoops.length > 0) {\n this._frameHandler = this._queueNewFrame(this._boundRenderFunction, this.getHostWindow());\n }\n else {\n this._renderingQueueLaunched = false;\n }\n }\n /**\n * Gets the HTML canvas attached with the current webGL context\n * @returns a HTML canvas\n */\n getRenderingCanvas() {\n return this._renderingCanvas;\n }\n /**\n * Gets the audio context specified in engine initialization options\n * @returns an Audio Context\n */\n getAudioContext() {\n return this._audioContext;\n }\n /**\n * Gets the audio destination specified in engine initialization options\n * @returns an audio destination node\n */\n getAudioDestination() {\n return this._audioDestination;\n }\n /**\n * Gets host window\n * @returns the host window object\n */\n getHostWindow() {\n if (!IsWindowObjectExist()) {\n return null;\n }\n if (this._renderingCanvas && this._renderingCanvas.ownerDocument && this._renderingCanvas.ownerDocument.defaultView) {\n return this._renderingCanvas.ownerDocument.defaultView;\n }\n return window;\n }\n /**\n * Gets the current render width\n * @param useScreen defines if screen size must be used (or the current render target if any)\n * @returns a number defining the current render width\n */\n getRenderWidth(useScreen = false) {\n if (!useScreen && this._currentRenderTarget) {\n return this._currentRenderTarget.width;\n }\n return this._framebufferDimensionsObject ? this._framebufferDimensionsObject.framebufferWidth : this._gl.drawingBufferWidth;\n }\n /**\n * Gets the current render height\n * @param useScreen defines if screen size must be used (or the current render target if any)\n * @returns a number defining the current render height\n */\n getRenderHeight(useScreen = false) {\n if (!useScreen && this._currentRenderTarget) {\n return this._currentRenderTarget.height;\n }\n return this._framebufferDimensionsObject ? this._framebufferDimensionsObject.framebufferHeight : this._gl.drawingBufferHeight;\n }\n /**\n * Can be used to override the current requestAnimationFrame requester.\n * @internal\n */\n _queueNewFrame(bindedRenderFunction, requester) {\n return ThinEngine.QueueNewFrame(bindedRenderFunction, requester);\n }\n /**\n * Register and execute a render loop. The engine can have more than one render function\n * @param renderFunction defines the function to continuously execute\n */\n runRenderLoop(renderFunction) {\n if (this._activeRenderLoops.indexOf(renderFunction) !== -1) {\n return;\n }\n this._activeRenderLoops.push(renderFunction);\n if (!this._renderingQueueLaunched) {\n this._renderingQueueLaunched = true;\n this._boundRenderFunction = this._renderLoop.bind(this);\n this._frameHandler = this._queueNewFrame(this._boundRenderFunction, this.getHostWindow());\n }\n }\n /**\n * Clear the current render buffer or the current render target (if any is set up)\n * @param color defines the color to use\n * @param backBuffer defines if the back buffer must be cleared\n * @param depth defines if the depth buffer must be cleared\n * @param stencil defines if the stencil buffer must be cleared\n */\n clear(color, backBuffer, depth, stencil = false) {\n var _a, _b;\n const useStencilGlobalOnly = this.stencilStateComposer.useStencilGlobalOnly;\n this.stencilStateComposer.useStencilGlobalOnly = true; // make sure the stencil mask is coming from the global stencil and not from a material (effect) which would currently be in effect\n this.applyStates();\n this.stencilStateComposer.useStencilGlobalOnly = useStencilGlobalOnly;\n let mode = 0;\n if (backBuffer && color) {\n let setBackBufferColor = true;\n if (this._currentRenderTarget) {\n const textureFormat = (_a = this._currentRenderTarget.texture) === null || _a === void 0 ? void 0 : _a.format;\n if (textureFormat === 8 ||\n textureFormat === 9 ||\n textureFormat === 10 ||\n textureFormat === 11) {\n const textureType = (_b = this._currentRenderTarget.texture) === null || _b === void 0 ? void 0 : _b.type;\n if (textureType === 7 || textureType === 5) {\n ThinEngine._TempClearColorUint32[0] = color.r * 255;\n ThinEngine._TempClearColorUint32[1] = color.g * 255;\n ThinEngine._TempClearColorUint32[2] = color.b * 255;\n ThinEngine._TempClearColorUint32[3] = color.a * 255;\n this._gl.clearBufferuiv(this._gl.COLOR, 0, ThinEngine._TempClearColorUint32);\n setBackBufferColor = false;\n }\n else {\n ThinEngine._TempClearColorInt32[0] = color.r * 255;\n ThinEngine._TempClearColorInt32[1] = color.g * 255;\n ThinEngine._TempClearColorInt32[2] = color.b * 255;\n ThinEngine._TempClearColorInt32[3] = color.a * 255;\n this._gl.clearBufferiv(this._gl.COLOR, 0, ThinEngine._TempClearColorInt32);\n setBackBufferColor = false;\n }\n }\n }\n if (setBackBufferColor) {\n this._gl.clearColor(color.r, color.g, color.b, color.a !== undefined ? color.a : 1.0);\n mode |= this._gl.COLOR_BUFFER_BIT;\n }\n }\n if (depth) {\n if (this.useReverseDepthBuffer) {\n this._depthCullingState.depthFunc = this._gl.GEQUAL;\n this._gl.clearDepth(0.0);\n }\n else {\n this._gl.clearDepth(1.0);\n }\n mode |= this._gl.DEPTH_BUFFER_BIT;\n }\n if (stencil) {\n this._gl.clearStencil(0);\n mode |= this._gl.STENCIL_BUFFER_BIT;\n }\n this._gl.clear(mode);\n }\n /**\n * @internal\n */\n _viewport(x, y, width, height) {\n if (x !== this._viewportCached.x || y !== this._viewportCached.y || width !== this._viewportCached.z || height !== this._viewportCached.w) {\n this._viewportCached.x = x;\n this._viewportCached.y = y;\n this._viewportCached.z = width;\n this._viewportCached.w = height;\n this._gl.viewport(x, y, width, height);\n }\n }\n /**\n * Set the WebGL's viewport\n * @param viewport defines the viewport element to be used\n * @param requiredWidth defines the width required for rendering. If not provided the rendering canvas' width is used\n * @param requiredHeight defines the height required for rendering. If not provided the rendering canvas' height is used\n */\n setViewport(viewport, requiredWidth, requiredHeight) {\n const width = requiredWidth || this.getRenderWidth();\n const height = requiredHeight || this.getRenderHeight();\n const x = viewport.x || 0;\n const y = viewport.y || 0;\n this._cachedViewport = viewport;\n this._viewport(x * width, y * height, width * viewport.width, height * viewport.height);\n }\n /**\n * Begin a new frame\n */\n beginFrame() { }\n /**\n * Enf the current frame\n */\n endFrame() {\n // Force a flush in case we are using a bad OS.\n if (this._badOS) {\n this.flushFramebuffer();\n }\n this._frameId++;\n }\n /**\n * Resize the view according to the canvas' size\n * @param forceSetSize true to force setting the sizes of the underlying canvas\n */\n resize(forceSetSize = false) {\n let width;\n let height;\n // Re-query hardware scaling level to handle zoomed-in resizing.\n if (this.adaptToDeviceRatio) {\n const devicePixelRatio = IsWindowObjectExist() ? window.devicePixelRatio || 1.0 : 1.0;\n const changeRatio = this._lastDevicePixelRatio / devicePixelRatio;\n this._lastDevicePixelRatio = devicePixelRatio;\n this._hardwareScalingLevel *= changeRatio;\n }\n if (IsWindowObjectExist() && IsDocumentAvailable()) {\n // make sure it is a Node object, and is a part of the document.\n if (this._renderingCanvas) {\n const boundingRect = this._renderingCanvas.getBoundingClientRect\n ? this._renderingCanvas.getBoundingClientRect()\n : {\n // fallback to last solution in case the function doesn't exist\n width: this._renderingCanvas.width * this._hardwareScalingLevel,\n height: this._renderingCanvas.height * this._hardwareScalingLevel,\n };\n width = this._renderingCanvas.clientWidth || boundingRect.width || this._renderingCanvas.width || 100;\n height = this._renderingCanvas.clientHeight || boundingRect.height || this._renderingCanvas.height || 100;\n }\n else {\n width = window.innerWidth;\n height = window.innerHeight;\n }\n }\n else {\n width = this._renderingCanvas ? this._renderingCanvas.width : 100;\n height = this._renderingCanvas ? this._renderingCanvas.height : 100;\n }\n this.setSize(width / this._hardwareScalingLevel, height / this._hardwareScalingLevel, forceSetSize);\n }\n /**\n * Force a specific size of the canvas\n * @param width defines the new canvas' width\n * @param height defines the new canvas' height\n * @param forceSetSize true to force setting the sizes of the underlying canvas\n * @returns true if the size was changed\n */\n setSize(width, height, forceSetSize = false) {\n if (!this._renderingCanvas) {\n return false;\n }\n width = width | 0;\n height = height | 0;\n if (!forceSetSize && this._renderingCanvas.width === width && this._renderingCanvas.height === height) {\n return false;\n }\n this._renderingCanvas.width = width;\n this._renderingCanvas.height = height;\n return true;\n }\n /**\n * Binds the frame buffer to the specified texture.\n * @param rtWrapper The render target wrapper to render to\n * @param faceIndex The face of the texture to render to in case of cube texture and if the render target wrapper is not a multi render target\n * @param requiredWidth The width of the target to render to\n * @param requiredHeight The height of the target to render to\n * @param forceFullscreenViewport Forces the viewport to be the entire texture/screen if true\n * @param lodLevel Defines the lod level to bind to the frame buffer\n * @param layer Defines the 2d array index to bind to the frame buffer if the render target wrapper is not a multi render target\n */\n bindFramebuffer(rtWrapper, faceIndex = 0, requiredWidth, requiredHeight, forceFullscreenViewport, lodLevel = 0, layer = 0) {\n var _a, _b, _c, _d, _e;\n const webglRTWrapper = rtWrapper;\n if (this._currentRenderTarget) {\n this.unBindFramebuffer(this._currentRenderTarget);\n }\n this._currentRenderTarget = rtWrapper;\n this._bindUnboundFramebuffer(webglRTWrapper._MSAAFramebuffer ? webglRTWrapper._MSAAFramebuffer : webglRTWrapper._framebuffer);\n const gl = this._gl;\n if (!rtWrapper.isMulti) {\n if (rtWrapper.is2DArray) {\n gl.framebufferTextureLayer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, (_a = rtWrapper.texture._hardwareTexture) === null || _a === void 0 ? void 0 : _a.underlyingResource, lodLevel, layer);\n }\n else if (rtWrapper.isCube) {\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, (_b = rtWrapper.texture._hardwareTexture) === null || _b === void 0 ? void 0 : _b.underlyingResource, lodLevel);\n }\n }\n const depthStencilTexture = rtWrapper._depthStencilTexture;\n if (depthStencilTexture) {\n const attachment = rtWrapper._depthStencilTextureWithStencil ? gl.DEPTH_STENCIL_ATTACHMENT : gl.DEPTH_ATTACHMENT;\n if (rtWrapper.is2DArray) {\n gl.framebufferTextureLayer(gl.FRAMEBUFFER, attachment, (_c = depthStencilTexture._hardwareTexture) === null || _c === void 0 ? void 0 : _c.underlyingResource, lodLevel, layer);\n }\n else if (rtWrapper.isCube) {\n gl.framebufferTexture2D(gl.FRAMEBUFFER, attachment, gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, (_d = depthStencilTexture._hardwareTexture) === null || _d === void 0 ? void 0 : _d.underlyingResource, lodLevel);\n }\n else {\n gl.framebufferTexture2D(gl.FRAMEBUFFER, attachment, gl.TEXTURE_2D, (_e = depthStencilTexture._hardwareTexture) === null || _e === void 0 ? void 0 : _e.underlyingResource, lodLevel);\n }\n }\n if (this._cachedViewport && !forceFullscreenViewport) {\n this.setViewport(this._cachedViewport, requiredWidth, requiredHeight);\n }\n else {\n if (!requiredWidth) {\n requiredWidth = rtWrapper.width;\n if (lodLevel) {\n requiredWidth = requiredWidth / Math.pow(2, lodLevel);\n }\n }\n if (!requiredHeight) {\n requiredHeight = rtWrapper.height;\n if (lodLevel) {\n requiredHeight = requiredHeight / Math.pow(2, lodLevel);\n }\n }\n this._viewport(0, 0, requiredWidth, requiredHeight);\n }\n this.wipeCaches();\n }\n /**\n * Set various states to the webGL context\n * @param culling defines culling state: true to enable culling, false to disable it\n * @param zOffset defines the value to apply to zOffset (0 by default)\n * @param force defines if states must be applied even if cache is up to date\n * @param reverseSide defines if culling must be reversed (CCW if false, CW if true)\n * @param cullBackFaces true to cull back faces, false to cull front faces (if culling is enabled)\n * @param stencil stencil states to set\n * @param zOffsetUnits defines the value to apply to zOffsetUnits (0 by default)\n */\n setState(culling, zOffset = 0, force, reverseSide = false, cullBackFaces, stencil, zOffsetUnits = 0) {\n var _a, _b;\n // Culling\n if (this._depthCullingState.cull !== culling || force) {\n this._depthCullingState.cull = culling;\n }\n // Cull face\n const cullFace = ((_b = (_a = this.cullBackFaces) !== null && _a !== void 0 ? _a : cullBackFaces) !== null && _b !== void 0 ? _b : true) ? this._gl.BACK : this._gl.FRONT;\n if (this._depthCullingState.cullFace !== cullFace || force) {\n this._depthCullingState.cullFace = cullFace;\n }\n // Z offset\n this.setZOffset(zOffset);\n this.setZOffsetUnits(zOffsetUnits);\n // Front face\n const frontFace = reverseSide ? this._gl.CW : this._gl.CCW;\n if (this._depthCullingState.frontFace !== frontFace || force) {\n this._depthCullingState.frontFace = frontFace;\n }\n this._stencilStateComposer.stencilMaterial = stencil;\n }\n /**\n * Gets a boolean indicating if depth testing is enabled\n * @returns the current state\n */\n getDepthBuffer() {\n return this._depthCullingState.depthTest;\n }\n /**\n * Enable or disable depth buffering\n * @param enable defines the state to set\n */\n setDepthBuffer(enable) {\n this._depthCullingState.depthTest = enable;\n }\n /**\n * Set the z offset Factor to apply to current rendering\n * @param value defines the offset to apply\n */\n setZOffset(value) {\n this._depthCullingState.zOffset = this.useReverseDepthBuffer ? -value : value;\n }\n /**\n * Gets the current value of the zOffset Factor\n * @returns the current zOffset Factor state\n */\n getZOffset() {\n const zOffset = this._depthCullingState.zOffset;\n return this.useReverseDepthBuffer ? -zOffset : zOffset;\n }\n /**\n * Set the z offset Units to apply to current rendering\n * @param value defines the offset to apply\n */\n setZOffsetUnits(value) {\n this._depthCullingState.zOffsetUnits = this.useReverseDepthBuffer ? -value : value;\n }\n /**\n * Gets the current value of the zOffset Units\n * @returns the current zOffset Units state\n */\n getZOffsetUnits() {\n const zOffsetUnits = this._depthCullingState.zOffsetUnits;\n return this.useReverseDepthBuffer ? -zOffsetUnits : zOffsetUnits;\n }\n /**\n * @internal\n */\n _bindUnboundFramebuffer(framebuffer) {\n if (this._currentFramebuffer !== framebuffer) {\n this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, framebuffer);\n this._currentFramebuffer = framebuffer;\n }\n }\n /** @internal */\n _currentFrameBufferIsDefaultFrameBuffer() {\n return this._currentFramebuffer === null;\n }\n /**\n * Generates the mipmaps for a texture\n * @param texture texture to generate the mipmaps for\n */\n generateMipmaps(texture) {\n this._bindTextureDirectly(this._gl.TEXTURE_2D, texture, true);\n this._gl.generateMipmap(this._gl.TEXTURE_2D);\n this._bindTextureDirectly(this._gl.TEXTURE_2D, null);\n }\n /**\n * Unbind the current render target texture from the webGL context\n * @param texture defines the render target wrapper to unbind\n * @param disableGenerateMipMaps defines a boolean indicating that mipmaps must not be generated\n * @param onBeforeUnbind defines a function which will be called before the effective unbind\n */\n unBindFramebuffer(texture, disableGenerateMipMaps = false, onBeforeUnbind) {\n var _a;\n const webglRTWrapper = texture;\n this._currentRenderTarget = null;\n // If MSAA, we need to bitblt back to main texture\n const gl = this._gl;\n if (webglRTWrapper._MSAAFramebuffer) {\n if (texture.isMulti) {\n // This texture is part of a MRT texture, we need to treat all attachments\n this.unBindMultiColorAttachmentFramebuffer(texture, disableGenerateMipMaps, onBeforeUnbind);\n return;\n }\n gl.bindFramebuffer(gl.READ_FRAMEBUFFER, webglRTWrapper._MSAAFramebuffer);\n gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, webglRTWrapper._framebuffer);\n gl.blitFramebuffer(0, 0, texture.width, texture.height, 0, 0, texture.width, texture.height, gl.COLOR_BUFFER_BIT, gl.NEAREST);\n }\n if (((_a = texture.texture) === null || _a === void 0 ? void 0 : _a.generateMipMaps) && !disableGenerateMipMaps && !texture.isCube) {\n this.generateMipmaps(texture.texture);\n }\n if (onBeforeUnbind) {\n if (webglRTWrapper._MSAAFramebuffer) {\n // Bind the correct framebuffer\n this._bindUnboundFramebuffer(webglRTWrapper._framebuffer);\n }\n onBeforeUnbind();\n }\n this._bindUnboundFramebuffer(null);\n }\n /**\n * Force a webGL flush (ie. a flush of all waiting webGL commands)\n */\n flushFramebuffer() {\n this._gl.flush();\n }\n /**\n * Unbind the current render target and bind the default framebuffer\n */\n restoreDefaultFramebuffer() {\n if (this._currentRenderTarget) {\n this.unBindFramebuffer(this._currentRenderTarget);\n }\n else {\n this._bindUnboundFramebuffer(null);\n }\n if (this._cachedViewport) {\n this.setViewport(this._cachedViewport);\n }\n this.wipeCaches();\n }\n // VBOs\n /** @internal */\n _resetVertexBufferBinding() {\n this.bindArrayBuffer(null);\n this._cachedVertexBuffers = null;\n }\n /**\n * Creates a vertex buffer\n * @param data the data for the vertex buffer\n * @returns the new WebGL static buffer\n */\n createVertexBuffer(data) {\n return this._createVertexBuffer(data, this._gl.STATIC_DRAW);\n }\n _createVertexBuffer(data, usage) {\n const vbo = this._gl.createBuffer();\n if (!vbo) {\n throw new Error(\"Unable to create vertex buffer\");\n }\n const dataBuffer = new WebGLDataBuffer(vbo);\n this.bindArrayBuffer(dataBuffer);\n if (data instanceof Array) {\n this._gl.bufferData(this._gl.ARRAY_BUFFER, new Float32Array(data), usage);\n }\n else {\n this._gl.bufferData(this._gl.ARRAY_BUFFER, data, usage);\n }\n this._resetVertexBufferBinding();\n dataBuffer.references = 1;\n return dataBuffer;\n }\n /**\n * Creates a dynamic vertex buffer\n * @param data the data for the dynamic vertex buffer\n * @returns the new WebGL dynamic buffer\n */\n createDynamicVertexBuffer(data) {\n return this._createVertexBuffer(data, this._gl.DYNAMIC_DRAW);\n }\n _resetIndexBufferBinding() {\n this.bindIndexBuffer(null);\n this._cachedIndexBuffer = null;\n }\n /**\n * Creates a new index buffer\n * @param indices defines the content of the index buffer\n * @param updatable defines if the index buffer must be updatable\n * @returns a new webGL buffer\n */\n createIndexBuffer(indices, updatable) {\n const vbo = this._gl.createBuffer();\n const dataBuffer = new WebGLDataBuffer(vbo);\n if (!vbo) {\n throw new Error(\"Unable to create index buffer\");\n }\n this.bindIndexBuffer(dataBuffer);\n const data = this._normalizeIndexData(indices);\n this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, data, updatable ? this._gl.DYNAMIC_DRAW : this._gl.STATIC_DRAW);\n this._resetIndexBufferBinding();\n dataBuffer.references = 1;\n dataBuffer.is32Bits = data.BYTES_PER_ELEMENT === 4;\n return dataBuffer;\n }\n _normalizeIndexData(indices) {\n const bytesPerElement = indices.BYTES_PER_ELEMENT;\n if (bytesPerElement === 2) {\n return indices;\n }\n // Check 32 bit support\n if (this._caps.uintIndices) {\n if (indices instanceof Uint32Array) {\n return indices;\n }\n else {\n // number[] or Int32Array, check if 32 bit is necessary\n for (let index = 0; index < indices.length; index++) {\n if (indices[index] >= 65535) {\n return new Uint32Array(indices);\n }\n }\n return new Uint16Array(indices);\n }\n }\n // No 32 bit support, force conversion to 16 bit (values greater 16 bit are lost)\n return new Uint16Array(indices);\n }\n /**\n * Bind a webGL buffer to the webGL context\n * @param buffer defines the buffer to bind\n */\n bindArrayBuffer(buffer) {\n if (!this._vaoRecordInProgress) {\n this._unbindVertexArrayObject();\n }\n this._bindBuffer(buffer, this._gl.ARRAY_BUFFER);\n }\n /**\n * Bind a specific block at a given index in a specific shader program\n * @param pipelineContext defines the pipeline context to use\n * @param blockName defines the block name\n * @param index defines the index where to bind the block\n */\n bindUniformBlock(pipelineContext, blockName, index) {\n const program = pipelineContext.program;\n const uniformLocation = this._gl.getUniformBlockIndex(program, blockName);\n this._gl.uniformBlockBinding(program, uniformLocation, index);\n }\n // eslint-disable-next-line @typescript-eslint/naming-convention\n bindIndexBuffer(buffer) {\n if (!this._vaoRecordInProgress) {\n this._unbindVertexArrayObject();\n }\n this._bindBuffer(buffer, this._gl.ELEMENT_ARRAY_BUFFER);\n }\n _bindBuffer(buffer, target) {\n if (this._vaoRecordInProgress || this._currentBoundBuffer[target] !== buffer) {\n this._gl.bindBuffer(target, buffer ? buffer.underlyingResource : null);\n this._currentBoundBuffer[target] = buffer;\n }\n }\n /**\n * update the bound buffer with the given data\n * @param data defines the data to update\n */\n updateArrayBuffer(data) {\n this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, data);\n }\n _vertexAttribPointer(buffer, indx, size, type, normalized, stride, offset) {\n const pointer = this._currentBufferPointers[indx];\n if (!pointer) {\n return;\n }\n let changed = false;\n if (!pointer.active) {\n changed = true;\n pointer.active = true;\n pointer.index = indx;\n pointer.size = size;\n pointer.type = type;\n pointer.normalized = normalized;\n pointer.stride = stride;\n pointer.offset = offset;\n pointer.buffer = buffer;\n }\n else {\n if (pointer.buffer !== buffer) {\n pointer.buffer = buffer;\n changed = true;\n }\n if (pointer.size !== size) {\n pointer.size = size;\n changed = true;\n }\n if (pointer.type !== type) {\n pointer.type = type;\n changed = true;\n }\n if (pointer.normalized !== normalized) {\n pointer.normalized = normalized;\n changed = true;\n }\n if (pointer.stride !== stride) {\n pointer.stride = stride;\n changed = true;\n }\n if (pointer.offset !== offset) {\n pointer.offset = offset;\n changed = true;\n }\n }\n if (changed || this._vaoRecordInProgress) {\n this.bindArrayBuffer(buffer);\n if (type === this._gl.UNSIGNED_INT || type === this._gl.INT) {\n this._gl.vertexAttribIPointer(indx, size, type, stride, offset);\n }\n else {\n this._gl.vertexAttribPointer(indx, size, type, normalized, stride, offset);\n }\n }\n }\n /**\n * @internal\n */\n _bindIndexBufferWithCache(indexBuffer) {\n if (indexBuffer == null) {\n return;\n }\n if (this._cachedIndexBuffer !== indexBuffer) {\n this._cachedIndexBuffer = indexBuffer;\n this.bindIndexBuffer(indexBuffer);\n this._uintIndicesCurrentlySet = indexBuffer.is32Bits;\n }\n }\n _bindVertexBuffersAttributes(vertexBuffers, effect, overrideVertexBuffers) {\n const attributes = effect.getAttributesNames();\n if (!this._vaoRecordInProgress) {\n this._unbindVertexArrayObject();\n }\n this.unbindAllAttributes();\n for (let index = 0; index < attributes.length; index++) {\n const order = effect.getAttributeLocation(index);\n if (order >= 0) {\n const ai = attributes[index];\n let vertexBuffer = null;\n if (overrideVertexBuffers) {\n vertexBuffer = overrideVertexBuffers[ai];\n }\n if (!vertexBuffer) {\n vertexBuffer = vertexBuffers[ai];\n }\n if (!vertexBuffer) {\n continue;\n }\n this._gl.enableVertexAttribArray(order);\n if (!this._vaoRecordInProgress) {\n this._vertexAttribArraysEnabled[order] = true;\n }\n const buffer = vertexBuffer.getBuffer();\n if (buffer) {\n this._vertexAttribPointer(buffer, order, vertexBuffer.getSize(), vertexBuffer.type, vertexBuffer.normalized, vertexBuffer.byteStride, vertexBuffer.byteOffset);\n if (vertexBuffer.getIsInstanced()) {\n this._gl.vertexAttribDivisor(order, vertexBuffer.getInstanceDivisor());\n if (!this._vaoRecordInProgress) {\n this._currentInstanceLocations.push(order);\n this._currentInstanceBuffers.push(buffer);\n }\n }\n }\n }\n }\n }\n /**\n * Records a vertex array object\n * @see https://doc.babylonjs.com/setup/support/webGL2#vertex-array-objects\n * @param vertexBuffers defines the list of vertex buffers to store\n * @param indexBuffer defines the index buffer to store\n * @param effect defines the effect to store\n * @param overrideVertexBuffers defines optional list of avertex buffers that overrides the entries in vertexBuffers\n * @returns the new vertex array object\n */\n recordVertexArrayObject(vertexBuffers, indexBuffer, effect, overrideVertexBuffers) {\n const vao = this._gl.createVertexArray();\n if (!vao) {\n throw new Error(\"Unable to create VAO\");\n }\n this._vaoRecordInProgress = true;\n this._gl.bindVertexArray(vao);\n this._mustWipeVertexAttributes = true;\n this._bindVertexBuffersAttributes(vertexBuffers, effect, overrideVertexBuffers);\n this.bindIndexBuffer(indexBuffer);\n this._vaoRecordInProgress = false;\n this._gl.bindVertexArray(null);\n return vao;\n }\n /**\n * Bind a specific vertex array object\n * @see https://doc.babylonjs.com/setup/support/webGL2#vertex-array-objects\n * @param vertexArrayObject defines the vertex array object to bind\n * @param indexBuffer defines the index buffer to bind\n */\n bindVertexArrayObject(vertexArrayObject, indexBuffer) {\n if (this._cachedVertexArrayObject !== vertexArrayObject) {\n this._cachedVertexArrayObject = vertexArrayObject;\n this._gl.bindVertexArray(vertexArrayObject);\n this._cachedVertexBuffers = null;\n this._cachedIndexBuffer = null;\n this._uintIndicesCurrentlySet = indexBuffer != null && indexBuffer.is32Bits;\n this._mustWipeVertexAttributes = true;\n }\n }\n /**\n * Bind webGl buffers directly to the webGL context\n * @param vertexBuffer defines the vertex buffer to bind\n * @param indexBuffer defines the index buffer to bind\n * @param vertexDeclaration defines the vertex declaration to use with the vertex buffer\n * @param vertexStrideSize defines the vertex stride of the vertex buffer\n * @param effect defines the effect associated with the vertex buffer\n */\n bindBuffersDirectly(vertexBuffer, indexBuffer, vertexDeclaration, vertexStrideSize, effect) {\n if (this._cachedVertexBuffers !== vertexBuffer || this._cachedEffectForVertexBuffers !== effect) {\n this._cachedVertexBuffers = vertexBuffer;\n this._cachedEffectForVertexBuffers = effect;\n const attributesCount = effect.getAttributesCount();\n this._unbindVertexArrayObject();\n this.unbindAllAttributes();\n let offset = 0;\n for (let index = 0; index < attributesCount; index++) {\n if (index < vertexDeclaration.length) {\n const order = effect.getAttributeLocation(index);\n if (order >= 0) {\n this._gl.enableVertexAttribArray(order);\n this._vertexAttribArraysEnabled[order] = true;\n this._vertexAttribPointer(vertexBuffer, order, vertexDeclaration[index], this._gl.FLOAT, false, vertexStrideSize, offset);\n }\n offset += vertexDeclaration[index] * 4;\n }\n }\n }\n this._bindIndexBufferWithCache(indexBuffer);\n }\n _unbindVertexArrayObject() {\n if (!this._cachedVertexArrayObject) {\n return;\n }\n this._cachedVertexArrayObject = null;\n this._gl.bindVertexArray(null);\n }\n /**\n * Bind a list of vertex buffers to the webGL context\n * @param vertexBuffers defines the list of vertex buffers to bind\n * @param indexBuffer defines the index buffer to bind\n * @param effect defines the effect associated with the vertex buffers\n * @param overrideVertexBuffers defines optional list of avertex buffers that overrides the entries in vertexBuffers\n */\n bindBuffers(vertexBuffers, indexBuffer, effect, overrideVertexBuffers) {\n if (this._cachedVertexBuffers !== vertexBuffers || this._cachedEffectForVertexBuffers !== effect) {\n this._cachedVertexBuffers = vertexBuffers;\n this._cachedEffectForVertexBuffers = effect;\n this._bindVertexBuffersAttributes(vertexBuffers, effect, overrideVertexBuffers);\n }\n this._bindIndexBufferWithCache(indexBuffer);\n }\n /**\n * Unbind all instance attributes\n */\n unbindInstanceAttributes() {\n let boundBuffer;\n for (let i = 0, ul = this._currentInstanceLocations.length; i < ul; i++) {\n const instancesBuffer = this._currentInstanceBuffers[i];\n if (boundBuffer != instancesBuffer && instancesBuffer.references) {\n boundBuffer = instancesBuffer;\n this.bindArrayBuffer(instancesBuffer);\n }\n const offsetLocation = this._currentInstanceLocations[i];\n this._gl.vertexAttribDivisor(offsetLocation, 0);\n }\n this._currentInstanceBuffers.length = 0;\n this._currentInstanceLocations.length = 0;\n }\n /**\n * Release and free the memory of a vertex array object\n * @param vao defines the vertex array object to delete\n */\n releaseVertexArrayObject(vao) {\n this._gl.deleteVertexArray(vao);\n }\n /**\n * @internal\n */\n _releaseBuffer(buffer) {\n buffer.references--;\n if (buffer.references === 0) {\n this._deleteBuffer(buffer);\n return true;\n }\n return false;\n }\n _deleteBuffer(buffer) {\n this._gl.deleteBuffer(buffer.underlyingResource);\n }\n /**\n * Update the content of a webGL buffer used with instantiation and bind it to the webGL context\n * @param instancesBuffer defines the webGL buffer to update and bind\n * @param data defines the data to store in the buffer\n * @param offsetLocations defines the offsets or attributes information used to determine where data must be stored in the buffer\n */\n updateAndBindInstancesBuffer(instancesBuffer, data, offsetLocations) {\n this.bindArrayBuffer(instancesBuffer);\n if (data) {\n this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, data);\n }\n if (offsetLocations[0].index !== undefined) {\n this.bindInstancesBuffer(instancesBuffer, offsetLocations, true);\n }\n else {\n for (let index = 0; index < 4; index++) {\n const offsetLocation = offsetLocations[index];\n if (!this._vertexAttribArraysEnabled[offsetLocation]) {\n this._gl.enableVertexAttribArray(offsetLocation);\n this._vertexAttribArraysEnabled[offsetLocation] = true;\n }\n this._vertexAttribPointer(instancesBuffer, offsetLocation, 4, this._gl.FLOAT, false, 64, index * 16);\n this._gl.vertexAttribDivisor(offsetLocation, 1);\n this._currentInstanceLocations.push(offsetLocation);\n this._currentInstanceBuffers.push(instancesBuffer);\n }\n }\n }\n /**\n * Bind the content of a webGL buffer used with instantiation\n * @param instancesBuffer defines the webGL buffer to bind\n * @param attributesInfo defines the offsets or attributes information used to determine where data must be stored in the buffer\n * @param computeStride defines Whether to compute the strides from the info or use the default 0\n */\n bindInstancesBuffer(instancesBuffer, attributesInfo, computeStride = true) {\n this.bindArrayBuffer(instancesBuffer);\n let stride = 0;\n if (computeStride) {\n for (let i = 0; i < attributesInfo.length; i++) {\n const ai = attributesInfo[i];\n stride += ai.attributeSize * 4;\n }\n }\n for (let i = 0; i < attributesInfo.length; i++) {\n const ai = attributesInfo[i];\n if (ai.index === undefined) {\n ai.index = this._currentEffect.getAttributeLocationByName(ai.attributeName);\n }\n if (ai.index < 0) {\n continue;\n }\n if (!this._vertexAttribArraysEnabled[ai.index]) {\n this._gl.enableVertexAttribArray(ai.index);\n this._vertexAttribArraysEnabled[ai.index] = true;\n }\n this._vertexAttribPointer(instancesBuffer, ai.index, ai.attributeSize, ai.attributeType || this._gl.FLOAT, ai.normalized || false, stride, ai.offset);\n this._gl.vertexAttribDivisor(ai.index, ai.divisor === undefined ? 1 : ai.divisor);\n this._currentInstanceLocations.push(ai.index);\n this._currentInstanceBuffers.push(instancesBuffer);\n }\n }\n /**\n * Disable the instance attribute corresponding to the name in parameter\n * @param name defines the name of the attribute to disable\n */\n disableInstanceAttributeByName(name) {\n if (!this._currentEffect) {\n return;\n }\n const attributeLocation = this._currentEffect.getAttributeLocationByName(name);\n this.disableInstanceAttribute(attributeLocation);\n }\n /**\n * Disable the instance attribute corresponding to the location in parameter\n * @param attributeLocation defines the attribute location of the attribute to disable\n */\n disableInstanceAttribute(attributeLocation) {\n let shouldClean = false;\n let index;\n while ((index = this._currentInstanceLocations.indexOf(attributeLocation)) !== -1) {\n this._currentInstanceLocations.splice(index, 1);\n this._currentInstanceBuffers.splice(index, 1);\n shouldClean = true;\n index = this._currentInstanceLocations.indexOf(attributeLocation);\n }\n if (shouldClean) {\n this._gl.vertexAttribDivisor(attributeLocation, 0);\n this.disableAttributeByIndex(attributeLocation);\n }\n }\n /**\n * Disable the attribute corresponding to the location in parameter\n * @param attributeLocation defines the attribute location of the attribute to disable\n */\n disableAttributeByIndex(attributeLocation) {\n this._gl.disableVertexAttribArray(attributeLocation);\n this._vertexAttribArraysEnabled[attributeLocation] = false;\n this._currentBufferPointers[attributeLocation].active = false;\n }\n /**\n * Send a draw order\n * @param useTriangles defines if triangles must be used to draw (else wireframe will be used)\n * @param indexStart defines the starting index\n * @param indexCount defines the number of index to draw\n * @param instancesCount defines the number of instances to draw (if instantiation is enabled)\n */\n draw(useTriangles, indexStart, indexCount, instancesCount) {\n this.drawElementsType(useTriangles ? 0 : 1, indexStart, indexCount, instancesCount);\n }\n /**\n * Draw a list of points\n * @param verticesStart defines the index of first vertex to draw\n * @param verticesCount defines the count of vertices to draw\n * @param instancesCount defines the number of instances to draw (if instantiation is enabled)\n */\n drawPointClouds(verticesStart, verticesCount, instancesCount) {\n this.drawArraysType(2, verticesStart, verticesCount, instancesCount);\n }\n /**\n * Draw a list of unindexed primitives\n * @param useTriangles defines if triangles must be used to draw (else wireframe will be used)\n * @param verticesStart defines the index of first vertex to draw\n * @param verticesCount defines the count of vertices to draw\n * @param instancesCount defines the number of instances to draw (if instantiation is enabled)\n */\n drawUnIndexed(useTriangles, verticesStart, verticesCount, instancesCount) {\n this.drawArraysType(useTriangles ? 0 : 1, verticesStart, verticesCount, instancesCount);\n }\n /**\n * Draw a list of indexed primitives\n * @param fillMode defines the primitive to use\n * @param indexStart defines the starting index\n * @param indexCount defines the number of index to draw\n * @param instancesCount defines the number of instances to draw (if instantiation is enabled)\n */\n drawElementsType(fillMode, indexStart, indexCount, instancesCount) {\n // Apply states\n this.applyStates();\n this._reportDrawCall();\n // Render\n const drawMode = this._drawMode(fillMode);\n const indexFormat = this._uintIndicesCurrentlySet ? this._gl.UNSIGNED_INT : this._gl.UNSIGNED_SHORT;\n const mult = this._uintIndicesCurrentlySet ? 4 : 2;\n if (instancesCount) {\n this._gl.drawElementsInstanced(drawMode, indexCount, indexFormat, indexStart * mult, instancesCount);\n }\n else {\n this._gl.drawElements(drawMode, indexCount, indexFormat, indexStart * mult);\n }\n }\n /**\n * Draw a list of unindexed primitives\n * @param fillMode defines the primitive to use\n * @param verticesStart defines the index of first vertex to draw\n * @param verticesCount defines the count of vertices to draw\n * @param instancesCount defines the number of instances to draw (if instantiation is enabled)\n */\n drawArraysType(fillMode, verticesStart, verticesCount, instancesCount) {\n // Apply states\n this.applyStates();\n this._reportDrawCall();\n const drawMode = this._drawMode(fillMode);\n if (instancesCount) {\n this._gl.drawArraysInstanced(drawMode, verticesStart, verticesCount, instancesCount);\n }\n else {\n this._gl.drawArrays(drawMode, verticesStart, verticesCount);\n }\n }\n _drawMode(fillMode) {\n switch (fillMode) {\n // Triangle views\n case 0:\n return this._gl.TRIANGLES;\n case 2:\n return this._gl.POINTS;\n case 1:\n return this._gl.LINES;\n // Draw modes\n case 3:\n return this._gl.POINTS;\n case 4:\n return this._gl.LINES;\n case 5:\n return this._gl.LINE_LOOP;\n case 6:\n return this._gl.LINE_STRIP;\n case 7:\n return this._gl.TRIANGLE_STRIP;\n case 8:\n return this._gl.TRIANGLE_FAN;\n default:\n return this._gl.TRIANGLES;\n }\n }\n /** @internal */\n _reportDrawCall() {\n // Will be implemented by children\n }\n // Shaders\n /**\n * @internal\n */\n _releaseEffect(effect) {\n if (this._compiledEffects[effect._key]) {\n delete this._compiledEffects[effect._key];\n }\n const pipelineContext = effect.getPipelineContext();\n if (pipelineContext) {\n this._deletePipelineContext(pipelineContext);\n }\n }\n /**\n * @internal\n */\n _deletePipelineContext(pipelineContext) {\n const webGLPipelineContext = pipelineContext;\n if (webGLPipelineContext && webGLPipelineContext.program) {\n webGLPipelineContext.program.__SPECTOR_rebuildProgram = null;\n this._gl.deleteProgram(webGLPipelineContext.program);\n }\n }\n /** @internal */\n _getGlobalDefines(defines) {\n if (defines) {\n if (this.isNDCHalfZRange) {\n defines[\"IS_NDC_HALF_ZRANGE\"] = \"\";\n }\n else {\n delete defines[\"IS_NDC_HALF_ZRANGE\"];\n }\n if (this.useReverseDepthBuffer) {\n defines[\"USE_REVERSE_DEPTHBUFFER\"] = \"\";\n }\n else {\n delete defines[\"USE_REVERSE_DEPTHBUFFER\"];\n }\n if (this.useExactSrgbConversions) {\n defines[\"USE_EXACT_SRGB_CONVERSIONS\"] = \"\";\n }\n else {\n delete defines[\"USE_EXACT_SRGB_CONVERSIONS\"];\n }\n return;\n }\n else {\n let s = \"\";\n if (this.isNDCHalfZRange) {\n s += \"#define IS_NDC_HALF_ZRANGE\";\n }\n if (this.useReverseDepthBuffer) {\n if (s) {\n s += \"\\n\";\n }\n s += \"#define USE_REVERSE_DEPTHBUFFER\";\n }\n if (this.useExactSrgbConversions) {\n if (s) {\n s += \"\\n\";\n }\n s += \"#define USE_EXACT_SRGB_CONVERSIONS\";\n }\n return s;\n }\n }\n /**\n * Create a new effect (used to store vertex/fragment shaders)\n * @param baseName defines the base name of the effect (The name of file without .fragment.fx or .vertex.fx)\n * @param attributesNamesOrOptions defines either a list of attribute names or an IEffectCreationOptions object\n * @param uniformsNamesOrEngine defines either a list of uniform names or the engine to use\n * @param samplers defines an array of string used to represent textures\n * @param defines defines the string containing the defines to use to compile the shaders\n * @param fallbacks defines the list of potential fallbacks to use if shader compilation fails\n * @param onCompiled defines a function to call when the effect creation is successful\n * @param onError defines a function to call when the effect creation has failed\n * @param indexParameters defines an object containing the index values to use to compile shaders (like the maximum number of simultaneous lights)\n * @param shaderLanguage the language the shader is written in (default: GLSL)\n * @returns the new Effect\n */\n createEffect(baseName, attributesNamesOrOptions, uniformsNamesOrEngine, samplers, defines, fallbacks, onCompiled, onError, indexParameters, shaderLanguage = ShaderLanguage.GLSL) {\n var _a;\n const vertex = baseName.vertexElement || baseName.vertex || baseName.vertexToken || baseName.vertexSource || baseName;\n const fragment = baseName.fragmentElement || baseName.fragment || baseName.fragmentToken || baseName.fragmentSource || baseName;\n const globalDefines = this._getGlobalDefines();\n let fullDefines = (_a = defines !== null && defines !== void 0 ? defines : attributesNamesOrOptions.defines) !== null && _a !== void 0 ? _a : \"\";\n if (globalDefines) {\n fullDefines += globalDefines;\n }\n const name = vertex + \"+\" + fragment + \"@\" + fullDefines;\n if (this._compiledEffects[name]) {\n const compiledEffect = this._compiledEffects[name];\n if (onCompiled && compiledEffect.isReady()) {\n onCompiled(compiledEffect);\n }\n return compiledEffect;\n }\n const effect = new Effect(baseName, attributesNamesOrOptions, uniformsNamesOrEngine, samplers, this, defines, fallbacks, onCompiled, onError, indexParameters, name, shaderLanguage);\n this._compiledEffects[name] = effect;\n return effect;\n }\n // eslint-disable-next-line @typescript-eslint/naming-convention\n static _ConcatenateShader(source, defines, shaderVersion = \"\") {\n return shaderVersion + (defines ? defines + \"\\n\" : \"\") + source;\n }\n _compileShader(source, type, defines, shaderVersion) {\n return this._compileRawShader(ThinEngine._ConcatenateShader(source, defines, shaderVersion), type);\n }\n _compileRawShader(source, type) {\n const gl = this._gl;\n const shader = gl.createShader(type === \"vertex\" ? gl.VERTEX_SHADER : gl.FRAGMENT_SHADER);\n if (!shader) {\n let error = gl.NO_ERROR;\n let tempError = gl.NO_ERROR;\n while ((tempError = gl.getError()) !== gl.NO_ERROR) {\n error = tempError;\n }\n throw new Error(`Something went wrong while creating a gl ${type} shader object. gl error=${error}, gl isContextLost=${gl.isContextLost()}, _contextWasLost=${this._contextWasLost}`);\n }\n gl.shaderSource(shader, source);\n gl.compileShader(shader);\n return shader;\n }\n /**\n * @internal\n */\n _getShaderSource(shader) {\n return this._gl.getShaderSource(shader);\n }\n /**\n * Directly creates a webGL program\n * @param pipelineContext defines the pipeline context to attach to\n * @param vertexCode defines the vertex shader code to use\n * @param fragmentCode defines the fragment shader code to use\n * @param context defines the webGL context to use (if not set, the current one will be used)\n * @param transformFeedbackVaryings defines the list of transform feedback varyings to use\n * @returns the new webGL program\n */\n createRawShaderProgram(pipelineContext, vertexCode, fragmentCode, context, transformFeedbackVaryings = null) {\n context = context || this._gl;\n const vertexShader = this._compileRawShader(vertexCode, \"vertex\");\n const fragmentShader = this._compileRawShader(fragmentCode, \"fragment\");\n return this._createShaderProgram(pipelineContext, vertexShader, fragmentShader, context, transformFeedbackVaryings);\n }\n /**\n * Creates a webGL program\n * @param pipelineContext defines the pipeline context to attach to\n * @param vertexCode defines the vertex shader code to use\n * @param fragmentCode defines the fragment shader code to use\n * @param defines defines the string containing the defines to use to compile the shaders\n * @param context defines the webGL context to use (if not set, the current one will be used)\n * @param transformFeedbackVaryings defines the list of transform feedback varyings to use\n * @returns the new webGL program\n */\n createShaderProgram(pipelineContext, vertexCode, fragmentCode, defines, context, transformFeedbackVaryings = null) {\n context = context || this._gl;\n const shaderVersion = this._webGLVersion > 1 ? \"#version 300 es\\n#define WEBGL2 \\n\" : \"\";\n const vertexShader = this._compileShader(vertexCode, \"vertex\", defines, shaderVersion);\n const fragmentShader = this._compileShader(fragmentCode, \"fragment\", defines, shaderVersion);\n return this._createShaderProgram(pipelineContext, vertexShader, fragmentShader, context, transformFeedbackVaryings);\n }\n /**\n * Inline functions in shader code that are marked to be inlined\n * @param code code to inline\n * @returns inlined code\n */\n inlineShaderCode(code) {\n // no inlining needed in the WebGL engine\n return code;\n }\n /**\n * Creates a new pipeline context\n * @param shaderProcessingContext defines the shader processing context used during the processing if available\n * @returns the new pipeline\n */\n createPipelineContext(shaderProcessingContext) {\n const pipelineContext = new WebGLPipelineContext();\n pipelineContext.engine = this;\n if (this._caps.parallelShaderCompile) {\n pipelineContext.isParallelCompiled = true;\n }\n return pipelineContext;\n }\n /**\n * Creates a new material context\n * @returns the new context\n */\n createMaterialContext() {\n return undefined;\n }\n /**\n * Creates a new draw context\n * @returns the new context\n */\n createDrawContext() {\n return undefined;\n }\n _createShaderProgram(pipelineContext, vertexShader, fragmentShader, context, transformFeedbackVaryings = null) {\n const shaderProgram = context.createProgram();\n pipelineContext.program = shaderProgram;\n if (!shaderProgram) {\n throw new Error(\"Unable to create program\");\n }\n context.attachShader(shaderProgram, vertexShader);\n context.attachShader(shaderProgram, fragmentShader);\n context.linkProgram(shaderProgram);\n pipelineContext.context = context;\n pipelineContext.vertexShader = vertexShader;\n pipelineContext.fragmentShader = fragmentShader;\n if (!pipelineContext.isParallelCompiled) {\n this._finalizePipelineContext(pipelineContext);\n }\n return shaderProgram;\n }\n _finalizePipelineContext(pipelineContext) {\n const context = pipelineContext.context;\n const vertexShader = pipelineContext.vertexShader;\n const fragmentShader = pipelineContext.fragmentShader;\n const program = pipelineContext.program;\n const linked = context.getProgramParameter(program, context.LINK_STATUS);\n if (!linked) {\n // Get more info\n // Vertex\n if (!this._gl.getShaderParameter(vertexShader, this._gl.COMPILE_STATUS)) {\n const log = this._gl.getShaderInfoLog(vertexShader);\n if (log) {\n pipelineContext.vertexCompilationError = log;\n throw new Error(\"VERTEX SHADER \" + log);\n }\n }\n // Fragment\n if (!this._gl.getShaderParameter(fragmentShader, this._gl.COMPILE_STATUS)) {\n const log = this._gl.getShaderInfoLog(fragmentShader);\n if (log) {\n pipelineContext.fragmentCompilationError = log;\n throw new Error(\"FRAGMENT SHADER \" + log);\n }\n }\n const error = context.getProgramInfoLog(program);\n if (error) {\n pipelineContext.programLinkError = error;\n throw new Error(error);\n }\n }\n if (this.validateShaderPrograms) {\n context.validateProgram(program);\n const validated = context.getProgramParameter(program, context.VALIDATE_STATUS);\n if (!validated) {\n const error = context.getProgramInfoLog(program);\n if (error) {\n pipelineContext.programValidationError = error;\n throw new Error(error);\n }\n }\n }\n context.deleteShader(vertexShader);\n context.deleteShader(fragmentShader);\n pipelineContext.vertexShader = undefined;\n pipelineContext.fragmentShader = undefined;\n if (pipelineContext.onCompiled) {\n pipelineContext.onCompiled();\n pipelineContext.onCompiled = undefined;\n }\n }\n /**\n * @internal\n */\n _preparePipelineContext(pipelineContext, vertexSourceCode, fragmentSourceCode, createAsRaw, rawVertexSourceCode, rawFragmentSourceCode, rebuildRebind, defines, transformFeedbackVaryings, key) {\n const webGLRenderingState = pipelineContext;\n if (createAsRaw) {\n webGLRenderingState.program = this.createRawShaderProgram(webGLRenderingState, vertexSourceCode, fragmentSourceCode, undefined, transformFeedbackVaryings);\n }\n else {\n webGLRenderingState.program = this.createShaderProgram(webGLRenderingState, vertexSourceCode, fragmentSourceCode, defines, undefined, transformFeedbackVaryings);\n }\n webGLRenderingState.program.__SPECTOR_rebuildProgram = rebuildRebind;\n }\n /**\n * @internal\n */\n _isRenderingStateCompiled(pipelineContext) {\n const webGLPipelineContext = pipelineContext;\n if (this._isDisposed || webGLPipelineContext._isDisposed) {\n return false;\n }\n if (this._gl.getProgramParameter(webGLPipelineContext.program, this._caps.parallelShaderCompile.COMPLETION_STATUS_KHR)) {\n this._finalizePipelineContext(webGLPipelineContext);\n return true;\n }\n return false;\n }\n /**\n * @internal\n */\n _executeWhenRenderingStateIsCompiled(pipelineContext, action) {\n const webGLPipelineContext = pipelineContext;\n if (!webGLPipelineContext.isParallelCompiled) {\n action();\n return;\n }\n const oldHandler = webGLPipelineContext.onCompiled;\n if (oldHandler) {\n webGLPipelineContext.onCompiled = () => {\n oldHandler();\n action();\n };\n }\n else {\n webGLPipelineContext.onCompiled = action;\n }\n }\n /**\n * Gets the list of webGL uniform locations associated with a specific program based on a list of uniform names\n * @param pipelineContext defines the pipeline context to use\n * @param uniformsNames defines the list of uniform names\n * @returns an array of webGL uniform locations\n */\n getUniforms(pipelineContext, uniformsNames) {\n const results = new Array();\n const webGLPipelineContext = pipelineContext;\n for (let index = 0; index < uniformsNames.length; index++) {\n results.push(this._gl.getUniformLocation(webGLPipelineContext.program, uniformsNames[index]));\n }\n return results;\n }\n /**\n * Gets the list of active attributes for a given webGL program\n * @param pipelineContext defines the pipeline context to use\n * @param attributesNames defines the list of attribute names to get\n * @returns an array of indices indicating the offset of each attribute\n */\n getAttributes(pipelineContext, attributesNames) {\n const results = [];\n const webGLPipelineContext = pipelineContext;\n for (let index = 0; index < attributesNames.length; index++) {\n try {\n results.push(this._gl.getAttribLocation(webGLPipelineContext.program, attributesNames[index]));\n }\n catch (e) {\n results.push(-1);\n }\n }\n return results;\n }\n /**\n * Activates an effect, making it the current one (ie. the one used for rendering)\n * @param effect defines the effect to activate\n */\n enableEffect(effect) {\n effect = effect !== null && DrawWrapper.IsWrapper(effect) ? effect.effect : effect; // get only the effect, we don't need a Wrapper in the WebGL engine\n if (!effect || effect === this._currentEffect) {\n return;\n }\n this._stencilStateComposer.stencilMaterial = undefined;\n effect = effect;\n // Use program\n this.bindSamplers(effect);\n this._currentEffect = effect;\n if (effect.onBind) {\n effect.onBind(effect);\n }\n if (effect._onBindObservable) {\n effect._onBindObservable.notifyObservers(effect);\n }\n }\n /**\n * Set the value of an uniform to a number (int)\n * @param uniform defines the webGL uniform location where to store the value\n * @param value defines the int number to store\n * @returns true if the value was set\n */\n setInt(uniform, value) {\n if (!uniform) {\n return false;\n }\n this._gl.uniform1i(uniform, value);\n return true;\n }\n /**\n * Set the value of an uniform to a int2\n * @param uniform defines the webGL uniform location where to store the value\n * @param x defines the 1st component of the value\n * @param y defines the 2nd component of the value\n * @returns true if the value was set\n */\n setInt2(uniform, x, y) {\n if (!uniform) {\n return false;\n }\n this._gl.uniform2i(uniform, x, y);\n return true;\n }\n /**\n * Set the value of an uniform to a int3\n * @param uniform defines the webGL uniform location where to store the value\n * @param x defines the 1st component of the value\n * @param y defines the 2nd component of the value\n * @param z defines the 3rd component of the value\n * @returns true if the value was set\n */\n setInt3(uniform, x, y, z) {\n if (!uniform) {\n return false;\n }\n this._gl.uniform3i(uniform, x, y, z);\n return true;\n }\n /**\n * Set the value of an uniform to a int4\n * @param uniform defines the webGL uniform location where to store the value\n * @param x defines the 1st component of the value\n * @param y defines the 2nd component of the value\n * @param z defines the 3rd component of the value\n * @param w defines the 4th component of the value\n * @returns true if the value was set\n */\n setInt4(uniform, x, y, z, w) {\n if (!uniform) {\n return false;\n }\n this._gl.uniform4i(uniform, x, y, z, w);\n return true;\n }\n /**\n * Set the value of an uniform to an array of int32\n * @param uniform defines the webGL uniform location where to store the value\n * @param array defines the array of int32 to store\n * @returns true if the value was set\n */\n setIntArray(uniform, array) {\n if (!uniform) {\n return false;\n }\n this._gl.uniform1iv(uniform, array);\n return true;\n }\n /**\n * Set the value of an uniform to an array of int32 (stored as vec2)\n * @param uniform defines the webGL uniform location where to store the value\n * @param array defines the array of int32 to store\n * @returns true if the value was set\n */\n setIntArray2(uniform, array) {\n if (!uniform || array.length % 2 !== 0) {\n return false;\n }\n this._gl.uniform2iv(uniform, array);\n return true;\n }\n /**\n * Set the value of an uniform to an array of int32 (stored as vec3)\n * @param uniform defines the webGL uniform location where to store the value\n * @param array defines the array of int32 to store\n * @returns true if the value was set\n */\n setIntArray3(uniform, array) {\n if (!uniform || array.length % 3 !== 0) {\n return false;\n }\n this._gl.uniform3iv(uniform, array);\n return true;\n }\n /**\n * Set the value of an uniform to an array of int32 (stored as vec4)\n * @param uniform defines the webGL uniform location where to store the value\n * @param array defines the array of int32 to store\n * @returns true if the value was set\n */\n setIntArray4(uniform, array) {\n if (!uniform || array.length % 4 !== 0) {\n return false;\n }\n this._gl.uniform4iv(uniform, array);\n return true;\n }\n /**\n * Set the value of an uniform to a number (unsigned int)\n * @param uniform defines the webGL uniform location where to store the value\n * @param value defines the unsigned int number to store\n * @returns true if the value was set\n */\n setUInt(uniform, value) {\n if (!uniform) {\n return false;\n }\n this._gl.uniform1ui(uniform, value);\n return true;\n }\n /**\n * Set the value of an uniform to a unsigned int2\n * @param uniform defines the webGL uniform location where to store the value\n * @param x defines the 1st component of the value\n * @param y defines the 2nd component of the value\n * @returns true if the value was set\n */\n setUInt2(uniform, x, y) {\n if (!uniform) {\n return false;\n }\n this._gl.uniform2ui(uniform, x, y);\n return true;\n }\n /**\n * Set the value of an uniform to a unsigned int3\n * @param uniform defines the webGL uniform location where to store the value\n * @param x defines the 1st component of the value\n * @param y defines the 2nd component of the value\n * @param z defines the 3rd component of the value\n * @returns true if the value was set\n */\n setUInt3(uniform, x, y, z) {\n if (!uniform) {\n return false;\n }\n this._gl.uniform3ui(uniform, x, y, z);\n return true;\n }\n /**\n * Set the value of an uniform to a unsigned int4\n * @param uniform defines the webGL uniform location where to store the value\n * @param x defines the 1st component of the value\n * @param y defines the 2nd component of the value\n * @param z defines the 3rd component of the value\n * @param w defines the 4th component of the value\n * @returns true if the value was set\n */\n setUInt4(uniform, x, y, z, w) {\n if (!uniform) {\n return false;\n }\n this._gl.uniform4ui(uniform, x, y, z, w);\n return true;\n }\n /**\n * Set the value of an uniform to an array of unsigned int32\n * @param uniform defines the webGL uniform location where to store the value\n * @param array defines the array of unsigned int32 to store\n * @returns true if the value was set\n */\n setUIntArray(uniform, array) {\n if (!uniform) {\n return false;\n }\n this._gl.uniform1uiv(uniform, array);\n return true;\n }\n /**\n * Set the value of an uniform to an array of unsigned int32 (stored as vec2)\n * @param uniform defines the webGL uniform location where to store the value\n * @param array defines the array of unsigned int32 to store\n * @returns true if the value was set\n */\n setUIntArray2(uniform, array) {\n if (!uniform || array.length % 2 !== 0) {\n return false;\n }\n this._gl.uniform2uiv(uniform, array);\n return true;\n }\n /**\n * Set the value of an uniform to an array of unsigned int32 (stored as vec3)\n * @param uniform defines the webGL uniform location where to store the value\n * @param array defines the array of unsigned int32 to store\n * @returns true if the value was set\n */\n setUIntArray3(uniform, array) {\n if (!uniform || array.length % 3 !== 0) {\n return false;\n }\n this._gl.uniform3uiv(uniform, array);\n return true;\n }\n /**\n * Set the value of an uniform to an array of unsigned int32 (stored as vec4)\n * @param uniform defines the webGL uniform location where to store the value\n * @param array defines the array of unsigned int32 to store\n * @returns true if the value was set\n */\n setUIntArray4(uniform, array) {\n if (!uniform || array.length % 4 !== 0) {\n return false;\n }\n this._gl.uniform4uiv(uniform, array);\n return true;\n }\n /**\n * Set the value of an uniform to an array of number\n * @param uniform defines the webGL uniform location where to store the value\n * @param array defines the array of number to store\n * @returns true if the value was set\n */\n setArray(uniform, array) {\n if (!uniform) {\n return false;\n }\n if (array.length < 1) {\n return false;\n }\n this._gl.uniform1fv(uniform, array);\n return true;\n }\n /**\n * Set the value of an uniform to an array of number (stored as vec2)\n * @param uniform defines the webGL uniform location where to store the value\n * @param array defines the array of number to store\n * @returns true if the value was set\n */\n setArray2(uniform, array) {\n if (!uniform || array.length % 2 !== 0) {\n return false;\n }\n this._gl.uniform2fv(uniform, array);\n return true;\n }\n /**\n * Set the value of an uniform to an array of number (stored as vec3)\n * @param uniform defines the webGL uniform location where to store the value\n * @param array defines the array of number to store\n * @returns true if the value was set\n */\n setArray3(uniform, array) {\n if (!uniform || array.length % 3 !== 0) {\n return false;\n }\n this._gl.uniform3fv(uniform, array);\n return true;\n }\n /**\n * Set the value of an uniform to an array of number (stored as vec4)\n * @param uniform defines the webGL uniform location where to store the value\n * @param array defines the array of number to store\n * @returns true if the value was set\n */\n setArray4(uniform, array) {\n if (!uniform || array.length % 4 !== 0) {\n return false;\n }\n this._gl.uniform4fv(uniform, array);\n return true;\n }\n /**\n * Set the value of an uniform to an array of float32 (stored as matrices)\n * @param uniform defines the webGL uniform location where to store the value\n * @param matrices defines the array of float32 to store\n * @returns true if the value was set\n */\n setMatrices(uniform, matrices) {\n if (!uniform) {\n return false;\n }\n this._gl.uniformMatrix4fv(uniform, false, matrices);\n return true;\n }\n /**\n * Set the value of an uniform to a matrix (3x3)\n * @param uniform defines the webGL uniform location where to store the value\n * @param matrix defines the Float32Array representing the 3x3 matrix to store\n * @returns true if the value was set\n */\n setMatrix3x3(uniform, matrix) {\n if (!uniform) {\n return false;\n }\n this._gl.uniformMatrix3fv(uniform, false, matrix);\n return true;\n }\n /**\n * Set the value of an uniform to a matrix (2x2)\n * @param uniform defines the webGL uniform location where to store the value\n * @param matrix defines the Float32Array representing the 2x2 matrix to store\n * @returns true if the value was set\n */\n setMatrix2x2(uniform, matrix) {\n if (!uniform) {\n return false;\n }\n this._gl.uniformMatrix2fv(uniform, false, matrix);\n return true;\n }\n /**\n * Set the value of an uniform to a number (float)\n * @param uniform defines the webGL uniform location where to store the value\n * @param value defines the float number to store\n * @returns true if the value was transferred\n */\n setFloat(uniform, value) {\n if (!uniform) {\n return false;\n }\n this._gl.uniform1f(uniform, value);\n return true;\n }\n /**\n * Set the value of an uniform to a vec2\n * @param uniform defines the webGL uniform location where to store the value\n * @param x defines the 1st component of the value\n * @param y defines the 2nd component of the value\n * @returns true if the value was set\n */\n setFloat2(uniform, x, y) {\n if (!uniform) {\n return false;\n }\n this._gl.uniform2f(uniform, x, y);\n return true;\n }\n /**\n * Set the value of an uniform to a vec3\n * @param uniform defines the webGL uniform location where to store the value\n * @param x defines the 1st component of the value\n * @param y defines the 2nd component of the value\n * @param z defines the 3rd component of the value\n * @returns true if the value was set\n */\n setFloat3(uniform, x, y, z) {\n if (!uniform) {\n return false;\n }\n this._gl.uniform3f(uniform, x, y, z);\n return true;\n }\n /**\n * Set the value of an uniform to a vec4\n * @param uniform defines the webGL uniform location where to store the value\n * @param x defines the 1st component of the value\n * @param y defines the 2nd component of the value\n * @param z defines the 3rd component of the value\n * @param w defines the 4th component of the value\n * @returns true if the value was set\n */\n setFloat4(uniform, x, y, z, w) {\n if (!uniform) {\n return false;\n }\n this._gl.uniform4f(uniform, x, y, z, w);\n return true;\n }\n // States\n /**\n * Apply all cached states (depth, culling, stencil and alpha)\n */\n applyStates() {\n this._depthCullingState.apply(this._gl);\n this._stencilStateComposer.apply(this._gl);\n this._alphaState.apply(this._gl);\n if (this._colorWriteChanged) {\n this._colorWriteChanged = false;\n const enable = this._colorWrite;\n this._gl.colorMask(enable, enable, enable, enable);\n }\n }\n /**\n * Enable or disable color writing\n * @param enable defines the state to set\n */\n setColorWrite(enable) {\n if (enable !== this._colorWrite) {\n this._colorWriteChanged = true;\n this._colorWrite = enable;\n }\n }\n /**\n * Gets a boolean indicating if color writing is enabled\n * @returns the current color writing state\n */\n getColorWrite() {\n return this._colorWrite;\n }\n /**\n * Gets the depth culling state manager\n */\n get depthCullingState() {\n return this._depthCullingState;\n }\n /**\n * Gets the alpha state manager\n */\n get alphaState() {\n return this._alphaState;\n }\n /**\n * Gets the stencil state manager\n */\n get stencilState() {\n return this._stencilState;\n }\n /**\n * Gets the stencil state composer\n */\n get stencilStateComposer() {\n return this._stencilStateComposer;\n }\n // Textures\n /**\n * Clears the list of texture accessible through engine.\n * This can help preventing texture load conflict due to name collision.\n */\n clearInternalTexturesCache() {\n this._internalTexturesCache.length = 0;\n }\n /**\n * Force the entire cache to be cleared\n * You should not have to use this function unless your engine needs to share the webGL context with another engine\n * @param bruteForce defines a boolean to force clearing ALL caches (including stencil, detoh and alpha states)\n */\n wipeCaches(bruteForce) {\n if (this.preventCacheWipeBetweenFrames && !bruteForce) {\n return;\n }\n this._currentEffect = null;\n this._viewportCached.x = 0;\n this._viewportCached.y = 0;\n this._viewportCached.z = 0;\n this._viewportCached.w = 0;\n // Done before in case we clean the attributes\n this._unbindVertexArrayObject();\n if (bruteForce) {\n this._currentProgram = null;\n this.resetTextureCache();\n this._stencilStateComposer.reset();\n this._depthCullingState.reset();\n this._depthCullingState.depthFunc = this._gl.LEQUAL;\n this._alphaState.reset();\n this._alphaMode = 1;\n this._alphaEquation = 0;\n this._colorWrite = true;\n this._colorWriteChanged = true;\n this._unpackFlipYCached = null;\n this._gl.pixelStorei(this._gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, this._gl.NONE);\n this._gl.pixelStorei(this._gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 0);\n this._mustWipeVertexAttributes = true;\n this.unbindAllAttributes();\n }\n this._resetVertexBufferBinding();\n this._cachedIndexBuffer = null;\n this._cachedEffectForVertexBuffers = null;\n this.bindIndexBuffer(null);\n }\n /**\n * @internal\n */\n _getSamplingParameters(samplingMode, generateMipMaps) {\n const gl = this._gl;\n let magFilter = gl.NEAREST;\n let minFilter = gl.NEAREST;\n switch (samplingMode) {\n case 11:\n magFilter = gl.LINEAR;\n if (generateMipMaps) {\n minFilter = gl.LINEAR_MIPMAP_NEAREST;\n }\n else {\n minFilter = gl.LINEAR;\n }\n break;\n case 3:\n magFilter = gl.LINEAR;\n if (generateMipMaps) {\n minFilter = gl.LINEAR_MIPMAP_LINEAR;\n }\n else {\n minFilter = gl.LINEAR;\n }\n break;\n case 8:\n magFilter = gl.NEAREST;\n if (generateMipMaps) {\n minFilter = gl.NEAREST_MIPMAP_LINEAR;\n }\n else {\n minFilter = gl.NEAREST;\n }\n break;\n case 4:\n magFilter = gl.NEAREST;\n if (generateMipMaps) {\n minFilter = gl.NEAREST_MIPMAP_NEAREST;\n }\n else {\n minFilter = gl.NEAREST;\n }\n break;\n case 5:\n magFilter = gl.NEAREST;\n if (generateMipMaps) {\n minFilter = gl.LINEAR_MIPMAP_NEAREST;\n }\n else {\n minFilter = gl.LINEAR;\n }\n break;\n case 6:\n magFilter = gl.NEAREST;\n if (generateMipMaps) {\n minFilter = gl.LINEAR_MIPMAP_LINEAR;\n }\n else {\n minFilter = gl.LINEAR;\n }\n break;\n case 7:\n magFilter = gl.NEAREST;\n minFilter = gl.LINEAR;\n break;\n case 1:\n magFilter = gl.NEAREST;\n minFilter = gl.NEAREST;\n break;\n case 9:\n magFilter = gl.LINEAR;\n if (generateMipMaps) {\n minFilter = gl.NEAREST_MIPMAP_NEAREST;\n }\n else {\n minFilter = gl.NEAREST;\n }\n break;\n case 10:\n magFilter = gl.LINEAR;\n if (generateMipMaps) {\n minFilter = gl.NEAREST_MIPMAP_LINEAR;\n }\n else {\n minFilter = gl.NEAREST;\n }\n break;\n case 2:\n magFilter = gl.LINEAR;\n minFilter = gl.LINEAR;\n break;\n case 12:\n magFilter = gl.LINEAR;\n minFilter = gl.NEAREST;\n break;\n }\n return {\n min: minFilter,\n mag: magFilter,\n };\n }\n /** @internal */\n _createTexture() {\n const texture = this._gl.createTexture();\n if (!texture) {\n throw new Error(\"Unable to create texture\");\n }\n return texture;\n }\n /** @internal */\n _createHardwareTexture() {\n return new WebGLHardwareTexture(this._createTexture(), this._gl);\n }\n /**\n * Creates an internal texture without binding it to a framebuffer\n * @internal\n * @param size defines the size of the texture\n * @param options defines the options used to create the texture\n * @param delayGPUTextureCreation true to delay the texture creation the first time it is really needed. false to create it right away\n * @param source source type of the texture\n * @returns a new internal texture\n */\n _createInternalTexture(size, options, delayGPUTextureCreation = true, source = InternalTextureSource.Unknown) {\n var _a;\n let generateMipMaps = false;\n let type = 0;\n let samplingMode = 3;\n let format = 5;\n let useSRGBBuffer = false;\n let samples = 1;\n let label;\n if (options !== undefined && typeof options === \"object\") {\n generateMipMaps = !!options.generateMipMaps;\n type = options.type === undefined ? 0 : options.type;\n samplingMode = options.samplingMode === undefined ? 3 : options.samplingMode;\n format = options.format === undefined ? 5 : options.format;\n useSRGBBuffer = options.useSRGBBuffer === undefined ? false : options.useSRGBBuffer;\n samples = (_a = options.samples) !== null && _a !== void 0 ? _a : 1;\n label = options.label;\n }\n else {\n generateMipMaps = !!options;\n }\n useSRGBBuffer && (useSRGBBuffer = this._caps.supportSRGBBuffers && (this.webGLVersion > 1 || this.isWebGPU));\n if (type === 1 && !this._caps.textureFloatLinearFiltering) {\n // if floating point linear (gl.FLOAT) then force to NEAREST_SAMPLINGMODE\n samplingMode = 1;\n }\n else if (type === 2 && !this._caps.textureHalfFloatLinearFiltering) {\n // if floating point linear (HALF_FLOAT) then force to NEAREST_SAMPLINGMODE\n samplingMode = 1;\n }\n if (type === 1 && !this._caps.textureFloat) {\n type = 0;\n Logger.Warn(\"Float textures are not supported. Type forced to TEXTURETYPE_UNSIGNED_BYTE\");\n }\n const gl = this._gl;\n const texture = new InternalTexture(this, source);\n const width = size.width || size;\n const height = size.height || size;\n const layers = size.layers || 0;\n const filters = this._getSamplingParameters(samplingMode, generateMipMaps);\n const target = layers !== 0 ? gl.TEXTURE_2D_ARRAY : gl.TEXTURE_2D;\n const sizedFormat = this._getRGBABufferInternalSizedFormat(type, format, useSRGBBuffer);\n const internalFormat = this._getInternalFormat(format);\n const textureType = this._getWebGLTextureType(type);\n // Bind\n this._bindTextureDirectly(target, texture);\n if (layers !== 0) {\n texture.is2DArray = true;\n gl.texImage3D(target, 0, sizedFormat, width, height, layers, 0, internalFormat, textureType, null);\n }\n else {\n gl.texImage2D(target, 0, sizedFormat, width, height, 0, internalFormat, textureType, null);\n }\n gl.texParameteri(target, gl.TEXTURE_MAG_FILTER, filters.mag);\n gl.texParameteri(target, gl.TEXTURE_MIN_FILTER, filters.min);\n gl.texParameteri(target, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(target, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n // MipMaps\n if (generateMipMaps) {\n this._gl.generateMipmap(target);\n }\n this._bindTextureDirectly(target, null);\n texture._useSRGBBuffer = useSRGBBuffer;\n texture.baseWidth = width;\n texture.baseHeight = height;\n texture.width = width;\n texture.height = height;\n texture.depth = layers;\n texture.isReady = true;\n texture.samples = samples;\n texture.generateMipMaps = generateMipMaps;\n texture.samplingMode = samplingMode;\n texture.type = type;\n texture.format = format;\n texture.label = label;\n this._internalTexturesCache.push(texture);\n return texture;\n }\n /**\n * @internal\n */\n _getUseSRGBBuffer(useSRGBBuffer, noMipmap) {\n // Generating mipmaps for sRGB textures is not supported in WebGL1 so we must disable the support if mipmaps is enabled\n return useSRGBBuffer && this._caps.supportSRGBBuffers && (this.webGLVersion > 1 || this.isWebGPU || noMipmap);\n }\n _createTextureBase(url, noMipmap, invertY, scene, samplingMode = 3, onLoad = null, onError = null, prepareTexture, prepareTextureProcessFunction, buffer = null, fallback = null, format = null, forcedExtension = null, mimeType, loaderOptions, useSRGBBuffer) {\n url = url || \"\";\n const fromData = url.substr(0, 5) === \"data:\";\n const fromBlob = url.substr(0, 5) === \"blob:\";\n const isBase64 = fromData && url.indexOf(\";base64,\") !== -1;\n const texture = fallback ? fallback : new InternalTexture(this, InternalTextureSource.Url);\n if (texture !== fallback) {\n texture.label = url.substring(0, 60); // default label, can be overriden by the caller\n }\n const originalUrl = url;\n if (this._transformTextureUrl && !isBase64 && !fallback && !buffer) {\n url = this._transformTextureUrl(url);\n }\n if (originalUrl !== url) {\n texture._originalUrl = originalUrl;\n }\n // establish the file extension, if possible\n const lastDot = url.lastIndexOf(\".\");\n let extension = forcedExtension ? forcedExtension : lastDot > -1 ? url.substring(lastDot).toLowerCase() : \"\";\n let loader = null;\n // Remove query string\n const queryStringIndex = extension.indexOf(\"?\");\n if (queryStringIndex > -1) {\n extension = extension.split(\"?\")[0];\n }\n for (const availableLoader of ThinEngine._TextureLoaders) {\n if (availableLoader.canLoad(extension, mimeType)) {\n loader = availableLoader;\n break;\n }\n }\n if (scene) {\n scene.addPendingData(texture);\n }\n texture.url = url;\n texture.generateMipMaps = !noMipmap;\n texture.samplingMode = samplingMode;\n texture.invertY = invertY;\n texture._useSRGBBuffer = this._getUseSRGBBuffer(!!useSRGBBuffer, noMipmap);\n if (!this._doNotHandleContextLost) {\n // Keep a link to the buffer only if we plan to handle context lost\n texture._buffer = buffer;\n }\n let onLoadObserver = null;\n if (onLoad && !fallback) {\n onLoadObserver = texture.onLoadedObservable.add(onLoad);\n }\n if (!fallback) {\n this._internalTexturesCache.push(texture);\n }\n const onInternalError = (message, exception) => {\n if (scene) {\n scene.removePendingData(texture);\n }\n if (url === originalUrl) {\n if (onLoadObserver) {\n texture.onLoadedObservable.remove(onLoadObserver);\n }\n if (EngineStore.UseFallbackTexture) {\n this._createTextureBase(EngineStore.FallbackTexture, noMipmap, texture.invertY, scene, samplingMode, null, onError, prepareTexture, prepareTextureProcessFunction, buffer, texture);\n }\n message = (message || \"Unknown error\") + (EngineStore.UseFallbackTexture ? \" - Fallback texture was used\" : \"\");\n texture.onErrorObservable.notifyObservers({ message, exception });\n if (onError) {\n onError(message, exception);\n }\n }\n else {\n // fall back to the original url if the transformed url fails to load\n Logger.Warn(`Failed to load ${url}, falling back to ${originalUrl}`);\n this._createTextureBase(originalUrl, noMipmap, texture.invertY, scene, samplingMode, onLoad, onError, prepareTexture, prepareTextureProcessFunction, buffer, texture, format, forcedExtension, mimeType, loaderOptions, useSRGBBuffer);\n }\n };\n // processing for non-image formats\n if (loader) {\n const callback = (data) => {\n loader.loadData(data, texture, (width, height, loadMipmap, isCompressed, done, loadFailed) => {\n if (loadFailed) {\n onInternalError(\"TextureLoader failed to load data\");\n }\n else {\n prepareTexture(texture, extension, scene, { width, height }, texture.invertY, !loadMipmap, isCompressed, () => {\n done();\n return false;\n }, samplingMode);\n }\n }, loaderOptions);\n };\n if (!buffer) {\n this._loadFile(url, (data) => callback(new Uint8Array(data)), undefined, scene ? scene.offlineProvider : undefined, true, (request, exception) => {\n onInternalError(\"Unable to load \" + (request ? request.responseURL : url, exception));\n });\n }\n else {\n if (buffer instanceof ArrayBuffer) {\n callback(new Uint8Array(buffer));\n }\n else if (ArrayBuffer.isView(buffer)) {\n callback(buffer);\n }\n else {\n if (onError) {\n onError(\"Unable to load: only ArrayBuffer or ArrayBufferView is supported\", null);\n }\n }\n }\n }\n else {\n const onload = (img) => {\n if (fromBlob && !this._doNotHandleContextLost) {\n // We need to store the image if we need to rebuild the texture\n // in case of a webgl context lost\n texture._buffer = img;\n }\n prepareTexture(texture, extension, scene, img, texture.invertY, noMipmap, false, prepareTextureProcessFunction, samplingMode);\n };\n // According to the WebGL spec section 6.10, ImageBitmaps must be inverted on creation.\n // So, we pass imageOrientation to _FileToolsLoadImage() as it may create an ImageBitmap.\n if (!fromData || isBase64) {\n if (buffer && (typeof buffer.decoding === \"string\" || buffer.close)) {\n onload(buffer);\n }\n else {\n ThinEngine._FileToolsLoadImage(url, onload, onInternalError, scene ? scene.offlineProvider : null, mimeType, texture.invertY && this._features.needsInvertingBitmap ? { imageOrientation: \"flipY\" } : undefined);\n }\n }\n else if (typeof buffer === \"string\" || buffer instanceof ArrayBuffer || ArrayBuffer.isView(buffer) || buffer instanceof Blob) {\n ThinEngine._FileToolsLoadImage(buffer, onload, onInternalError, scene ? scene.offlineProvider : null, mimeType, texture.invertY && this._features.needsInvertingBitmap ? { imageOrientation: \"flipY\" } : undefined);\n }\n else if (buffer) {\n onload(buffer);\n }\n }\n return texture;\n }\n /**\n * Usually called from Texture.ts.\n * Passed information to create a WebGLTexture\n * @param url defines a value which contains one of the following:\n * * A conventional http URL, e.g. 'http://...' or 'file://...'\n * * A base64 string of in-line texture data, e.g. 'data:image/jpg;base64,/...'\n * * An indicator that data being passed using the buffer parameter, e.g. 'data:mytexture.jpg'\n * @param noMipmap defines a boolean indicating that no mipmaps shall be generated. Ignored for compressed textures. They must be in the file\n * @param invertY when true, image is flipped when loaded. You probably want true. Certain compressed textures may invert this if their default is inverted (eg. ktx)\n * @param scene needed for loading to the correct scene\n * @param samplingMode mode with should be used sample / access the texture (Default: Texture.TRILINEAR_SAMPLINGMODE)\n * @param onLoad optional callback to be called upon successful completion\n * @param onError optional callback to be called upon failure\n * @param buffer a source of a file previously fetched as either a base64 string, an ArrayBuffer (compressed or image format), HTMLImageElement (image format), or a Blob\n * @param fallback an internal argument in case the function must be called again, due to etc1 not having alpha capabilities\n * @param format internal format. Default: RGB when extension is '.jpg' else RGBA. Ignored for compressed textures\n * @param forcedExtension defines the extension to use to pick the right loader\n * @param mimeType defines an optional mime type\n * @param loaderOptions options to be passed to the loader\n * @param creationFlags specific flags to use when creating the texture (1 for storage textures, for eg)\n * @param useSRGBBuffer defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU).\n * @returns a InternalTexture for assignment back into BABYLON.Texture\n */\n createTexture(url, noMipmap, invertY, scene, samplingMode = 3, onLoad = null, onError = null, buffer = null, fallback = null, format = null, forcedExtension = null, mimeType, loaderOptions, creationFlags, useSRGBBuffer) {\n return this._createTextureBase(url, noMipmap, invertY, scene, samplingMode, onLoad, onError, this._prepareWebGLTexture.bind(this), (potWidth, potHeight, img, extension, texture, continuationCallback) => {\n const gl = this._gl;\n const isPot = img.width === potWidth && img.height === potHeight;\n const internalFormat = format\n ? this._getInternalFormat(format, texture._useSRGBBuffer)\n : extension === \".jpg\" && !texture._useSRGBBuffer\n ? gl.RGB\n : texture._useSRGBBuffer\n ? this._glSRGBExtensionValues.SRGB8_ALPHA8\n : gl.RGBA;\n let texelFormat = format ? this._getInternalFormat(format) : extension === \".jpg\" && !texture._useSRGBBuffer ? gl.RGB : gl.RGBA;\n if (texture._useSRGBBuffer && this.webGLVersion === 1) {\n texelFormat = internalFormat;\n }\n if (isPot) {\n gl.texImage2D(gl.TEXTURE_2D, 0, internalFormat, texelFormat, gl.UNSIGNED_BYTE, img);\n return false;\n }\n const maxTextureSize = this._caps.maxTextureSize;\n if (img.width > maxTextureSize || img.height > maxTextureSize || !this._supportsHardwareTextureRescaling) {\n this._prepareWorkingCanvas();\n if (!this._workingCanvas || !this._workingContext) {\n return false;\n }\n this._workingCanvas.width = potWidth;\n this._workingCanvas.height = potHeight;\n this._workingContext.drawImage(img, 0, 0, img.width, img.height, 0, 0, potWidth, potHeight);\n gl.texImage2D(gl.TEXTURE_2D, 0, internalFormat, texelFormat, gl.UNSIGNED_BYTE, this._workingCanvas);\n texture.width = potWidth;\n texture.height = potHeight;\n return false;\n }\n else {\n // Using shaders when possible to rescale because canvas.drawImage is lossy\n const source = new InternalTexture(this, InternalTextureSource.Temp);\n this._bindTextureDirectly(gl.TEXTURE_2D, source, true);\n gl.texImage2D(gl.TEXTURE_2D, 0, internalFormat, texelFormat, gl.UNSIGNED_BYTE, img);\n this._rescaleTexture(source, texture, scene, internalFormat, () => {\n this._releaseTexture(source);\n this._bindTextureDirectly(gl.TEXTURE_2D, texture, true);\n continuationCallback();\n });\n }\n return true;\n }, buffer, fallback, format, forcedExtension, mimeType, loaderOptions, useSRGBBuffer);\n }\n /**\n * Loads an image as an HTMLImageElement.\n * @param input url string, ArrayBuffer, or Blob to load\n * @param onLoad callback called when the image successfully loads\n * @param onError callback called when the image fails to load\n * @param offlineProvider offline provider for caching\n * @param mimeType optional mime type\n * @param imageBitmapOptions optional the options to use when creating an ImageBitmap\n * @returns the HTMLImageElement of the loaded image\n * @internal\n */\n static _FileToolsLoadImage(input, onLoad, onError, offlineProvider, mimeType, imageBitmapOptions) {\n throw _WarnImport(\"FileTools\");\n }\n /**\n * @internal\n */\n _rescaleTexture(source, destination, scene, internalFormat, onComplete) { }\n /**\n * Creates a raw texture\n * @param data defines the data to store in the texture\n * @param width defines the width of the texture\n * @param height defines the height of the texture\n * @param format defines the format of the data\n * @param generateMipMaps defines if the engine should generate the mip levels\n * @param invertY defines if data must be stored with Y axis inverted\n * @param samplingMode defines the required sampling mode (Texture.NEAREST_SAMPLINGMODE by default)\n * @param compression defines the compression used (null by default)\n * @param type defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_INT by default)\n * @param creationFlags specific flags to use when creating the texture (1 for storage textures, for eg)\n * @param useSRGBBuffer defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU).\n * @returns the raw texture inside an InternalTexture\n */\n createRawTexture(data, width, height, format, generateMipMaps, invertY, samplingMode, compression = null, type = 0, creationFlags = 0, useSRGBBuffer = false) {\n throw _WarnImport(\"Engine.RawTexture\");\n }\n /**\n * Creates a new raw cube texture\n * @param data defines the array of data to use to create each face\n * @param size defines the size of the textures\n * @param format defines the format of the data\n * @param type defines the type of the data (like Engine.TEXTURETYPE_UNSIGNED_INT)\n * @param generateMipMaps defines if the engine should generate the mip levels\n * @param invertY defines if data must be stored with Y axis inverted\n * @param samplingMode defines the required sampling mode (like Texture.NEAREST_SAMPLINGMODE)\n * @param compression defines the compression used (null by default)\n * @returns the cube texture as an InternalTexture\n */\n createRawCubeTexture(data, size, format, type, generateMipMaps, invertY, samplingMode, compression = null) {\n throw _WarnImport(\"Engine.RawTexture\");\n }\n /**\n * Creates a new raw 3D texture\n * @param data defines the data used to create the texture\n * @param width defines the width of the texture\n * @param height defines the height of the texture\n * @param depth defines the depth of the texture\n * @param format defines the format of the texture\n * @param generateMipMaps defines if the engine must generate mip levels\n * @param invertY defines if data must be stored with Y axis inverted\n * @param samplingMode defines the required sampling mode (like Texture.NEAREST_SAMPLINGMODE)\n * @param compression defines the compressed used (can be null)\n * @param textureType defines the compressed used (can be null)\n * @returns a new raw 3D texture (stored in an InternalTexture)\n */\n createRawTexture3D(data, width, height, depth, format, generateMipMaps, invertY, samplingMode, compression = null, textureType = 0) {\n throw _WarnImport(\"Engine.RawTexture\");\n }\n /**\n * Creates a new raw 2D array texture\n * @param data defines the data used to create the texture\n * @param width defines the width of the texture\n * @param height defines the height of the texture\n * @param depth defines the number of layers of the texture\n * @param format defines the format of the texture\n * @param generateMipMaps defines if the engine must generate mip levels\n * @param invertY defines if data must be stored with Y axis inverted\n * @param samplingMode defines the required sampling mode (like Texture.NEAREST_SAMPLINGMODE)\n * @param compression defines the compressed used (can be null)\n * @param textureType defines the compressed used (can be null)\n * @returns a new raw 2D array texture (stored in an InternalTexture)\n */\n createRawTexture2DArray(data, width, height, depth, format, generateMipMaps, invertY, samplingMode, compression = null, textureType = 0) {\n throw _WarnImport(\"Engine.RawTexture\");\n }\n /**\n * @internal\n */\n _unpackFlipY(value) {\n if (this._unpackFlipYCached !== value) {\n this._gl.pixelStorei(this._gl.UNPACK_FLIP_Y_WEBGL, value ? 1 : 0);\n if (this.enableUnpackFlipYCached) {\n this._unpackFlipYCached = value;\n }\n }\n }\n /** @internal */\n _getUnpackAlignement() {\n return this._gl.getParameter(this._gl.UNPACK_ALIGNMENT);\n }\n _getTextureTarget(texture) {\n if (texture.isCube) {\n return this._gl.TEXTURE_CUBE_MAP;\n }\n else if (texture.is3D) {\n return this._gl.TEXTURE_3D;\n }\n else if (texture.is2DArray || texture.isMultiview) {\n return this._gl.TEXTURE_2D_ARRAY;\n }\n return this._gl.TEXTURE_2D;\n }\n /**\n * Update the sampling mode of a given texture\n * @param samplingMode defines the required sampling mode\n * @param texture defines the texture to update\n * @param generateMipMaps defines whether to generate mipmaps for the texture\n */\n updateTextureSamplingMode(samplingMode, texture, generateMipMaps = false) {\n const target = this._getTextureTarget(texture);\n const filters = this._getSamplingParameters(samplingMode, texture.useMipMaps || generateMipMaps);\n this._setTextureParameterInteger(target, this._gl.TEXTURE_MAG_FILTER, filters.mag, texture);\n this._setTextureParameterInteger(target, this._gl.TEXTURE_MIN_FILTER, filters.min);\n if (generateMipMaps) {\n texture.generateMipMaps = true;\n this._gl.generateMipmap(target);\n }\n this._bindTextureDirectly(target, null);\n texture.samplingMode = samplingMode;\n }\n /**\n * Update the dimensions of a texture\n * @param texture texture to update\n * @param width new width of the texture\n * @param height new height of the texture\n * @param depth new depth of the texture\n */\n updateTextureDimensions(texture, width, height, depth = 1) { }\n /**\n * Update the sampling mode of a given texture\n * @param texture defines the texture to update\n * @param wrapU defines the texture wrap mode of the u coordinates\n * @param wrapV defines the texture wrap mode of the v coordinates\n * @param wrapR defines the texture wrap mode of the r coordinates\n */\n updateTextureWrappingMode(texture, wrapU, wrapV = null, wrapR = null) {\n const target = this._getTextureTarget(texture);\n if (wrapU !== null) {\n this._setTextureParameterInteger(target, this._gl.TEXTURE_WRAP_S, this._getTextureWrapMode(wrapU), texture);\n texture._cachedWrapU = wrapU;\n }\n if (wrapV !== null) {\n this._setTextureParameterInteger(target, this._gl.TEXTURE_WRAP_T, this._getTextureWrapMode(wrapV), texture);\n texture._cachedWrapV = wrapV;\n }\n if ((texture.is2DArray || texture.is3D) && wrapR !== null) {\n this._setTextureParameterInteger(target, this._gl.TEXTURE_WRAP_R, this._getTextureWrapMode(wrapR), texture);\n texture._cachedWrapR = wrapR;\n }\n this._bindTextureDirectly(target, null);\n }\n /**\n * @internal\n */\n _setupDepthStencilTexture(internalTexture, size, generateStencil, bilinearFiltering, comparisonFunction, samples = 1) {\n const width = size.width || size;\n const height = size.height || size;\n const layers = size.layers || 0;\n internalTexture.baseWidth = width;\n internalTexture.baseHeight = height;\n internalTexture.width = width;\n internalTexture.height = height;\n internalTexture.is2DArray = layers > 0;\n internalTexture.depth = layers;\n internalTexture.isReady = true;\n internalTexture.samples = samples;\n internalTexture.generateMipMaps = false;\n internalTexture.samplingMode = bilinearFiltering ? 2 : 1;\n internalTexture.type = 0;\n internalTexture._comparisonFunction = comparisonFunction;\n const gl = this._gl;\n const target = this._getTextureTarget(internalTexture);\n const samplingParameters = this._getSamplingParameters(internalTexture.samplingMode, false);\n gl.texParameteri(target, gl.TEXTURE_MAG_FILTER, samplingParameters.mag);\n gl.texParameteri(target, gl.TEXTURE_MIN_FILTER, samplingParameters.min);\n gl.texParameteri(target, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(target, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n // TEXTURE_COMPARE_FUNC/MODE are only availble in WebGL2.\n if (this.webGLVersion > 1) {\n if (comparisonFunction === 0) {\n gl.texParameteri(target, gl.TEXTURE_COMPARE_FUNC, 515);\n gl.texParameteri(target, gl.TEXTURE_COMPARE_MODE, gl.NONE);\n }\n else {\n gl.texParameteri(target, gl.TEXTURE_COMPARE_FUNC, comparisonFunction);\n gl.texParameteri(target, gl.TEXTURE_COMPARE_MODE, gl.COMPARE_REF_TO_TEXTURE);\n }\n }\n }\n /**\n * @internal\n */\n _uploadCompressedDataToTextureDirectly(texture, internalFormat, width, height, data, faceIndex = 0, lod = 0) {\n const gl = this._gl;\n let target = gl.TEXTURE_2D;\n if (texture.isCube) {\n target = gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex;\n }\n if (texture._useSRGBBuffer) {\n switch (internalFormat) {\n case 37492:\n case 36196:\n // Note, if using ETC1 and sRGB is requested, this will use ETC2 if available.\n if (this._caps.etc2) {\n internalFormat = gl.COMPRESSED_SRGB8_ETC2;\n }\n else {\n texture._useSRGBBuffer = false;\n }\n break;\n case 37496:\n if (this._caps.etc2) {\n internalFormat = gl.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC;\n }\n else {\n texture._useSRGBBuffer = false;\n }\n break;\n case 36492:\n internalFormat = gl.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT;\n break;\n case 37808:\n internalFormat = gl.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR;\n break;\n case 33776:\n if (this._caps.s3tc_srgb) {\n internalFormat = gl.COMPRESSED_SRGB_S3TC_DXT1_EXT;\n }\n else {\n // S3TC sRGB extension not supported\n texture._useSRGBBuffer = false;\n }\n break;\n case 33777:\n if (this._caps.s3tc_srgb) {\n internalFormat = gl.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;\n }\n else {\n // S3TC sRGB extension not supported\n texture._useSRGBBuffer = false;\n }\n break;\n case 33779:\n if (this._caps.s3tc_srgb) {\n internalFormat = gl.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT;\n }\n else {\n // S3TC sRGB extension not supported\n texture._useSRGBBuffer = false;\n }\n break;\n default:\n // We don't support a sRGB format corresponding to internalFormat, so revert to non sRGB format\n texture._useSRGBBuffer = false;\n break;\n }\n }\n this._gl.compressedTexImage2D(target, lod, internalFormat, width, height, 0, data);\n }\n /**\n * @internal\n */\n _uploadDataToTextureDirectly(texture, imageData, faceIndex = 0, lod = 0, babylonInternalFormat, useTextureWidthAndHeight = false) {\n const gl = this._gl;\n const textureType = this._getWebGLTextureType(texture.type);\n const format = this._getInternalFormat(texture.format);\n const internalFormat = babylonInternalFormat === undefined\n ? this._getRGBABufferInternalSizedFormat(texture.type, texture.format, texture._useSRGBBuffer)\n : this._getInternalFormat(babylonInternalFormat, texture._useSRGBBuffer);\n this._unpackFlipY(texture.invertY);\n let target = gl.TEXTURE_2D;\n if (texture.isCube) {\n target = gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex;\n }\n const lodMaxWidth = Math.round(Math.log(texture.width) * Math.LOG2E);\n const lodMaxHeight = Math.round(Math.log(texture.height) * Math.LOG2E);\n const width = useTextureWidthAndHeight ? texture.width : Math.pow(2, Math.max(lodMaxWidth - lod, 0));\n const height = useTextureWidthAndHeight ? texture.height : Math.pow(2, Math.max(lodMaxHeight - lod, 0));\n gl.texImage2D(target, lod, internalFormat, width, height, 0, format, textureType, imageData);\n }\n /**\n * Update a portion of an internal texture\n * @param texture defines the texture to update\n * @param imageData defines the data to store into the texture\n * @param xOffset defines the x coordinates of the update rectangle\n * @param yOffset defines the y coordinates of the update rectangle\n * @param width defines the width of the update rectangle\n * @param height defines the height of the update rectangle\n * @param faceIndex defines the face index if texture is a cube (0 by default)\n * @param lod defines the lod level to update (0 by default)\n * @param generateMipMaps defines whether to generate mipmaps or not\n */\n updateTextureData(texture, imageData, xOffset, yOffset, width, height, faceIndex = 0, lod = 0, generateMipMaps = false) {\n const gl = this._gl;\n const textureType = this._getWebGLTextureType(texture.type);\n const format = this._getInternalFormat(texture.format);\n this._unpackFlipY(texture.invertY);\n let targetForBinding = gl.TEXTURE_2D;\n let target = gl.TEXTURE_2D;\n if (texture.isCube) {\n target = gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex;\n targetForBinding = gl.TEXTURE_CUBE_MAP;\n }\n this._bindTextureDirectly(targetForBinding, texture, true);\n gl.texSubImage2D(target, lod, xOffset, yOffset, width, height, format, textureType, imageData);\n if (generateMipMaps) {\n this._gl.generateMipmap(target);\n }\n this._bindTextureDirectly(targetForBinding, null);\n }\n /**\n * @internal\n */\n _uploadArrayBufferViewToTexture(texture, imageData, faceIndex = 0, lod = 0) {\n const gl = this._gl;\n const bindTarget = texture.isCube ? gl.TEXTURE_CUBE_MAP : gl.TEXTURE_2D;\n this._bindTextureDirectly(bindTarget, texture, true);\n this._uploadDataToTextureDirectly(texture, imageData, faceIndex, lod);\n this._bindTextureDirectly(bindTarget, null, true);\n }\n _prepareWebGLTextureContinuation(texture, scene, noMipmap, isCompressed, samplingMode) {\n const gl = this._gl;\n if (!gl) {\n return;\n }\n const filters = this._getSamplingParameters(samplingMode, !noMipmap);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, filters.mag);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, filters.min);\n if (!noMipmap && !isCompressed) {\n gl.generateMipmap(gl.TEXTURE_2D);\n }\n this._bindTextureDirectly(gl.TEXTURE_2D, null);\n // this.resetTextureCache();\n if (scene) {\n scene.removePendingData(texture);\n }\n texture.onLoadedObservable.notifyObservers(texture);\n texture.onLoadedObservable.clear();\n }\n _prepareWebGLTexture(texture, extension, scene, img, invertY, noMipmap, isCompressed, processFunction, samplingMode = 3) {\n const maxTextureSize = this.getCaps().maxTextureSize;\n const potWidth = Math.min(maxTextureSize, this.needPOTTextures ? ThinEngine.GetExponentOfTwo(img.width, maxTextureSize) : img.width);\n const potHeight = Math.min(maxTextureSize, this.needPOTTextures ? ThinEngine.GetExponentOfTwo(img.height, maxTextureSize) : img.height);\n const gl = this._gl;\n if (!gl) {\n return;\n }\n if (!texture._hardwareTexture) {\n // this.resetTextureCache();\n if (scene) {\n scene.removePendingData(texture);\n }\n return;\n }\n this._bindTextureDirectly(gl.TEXTURE_2D, texture, true);\n this._unpackFlipY(invertY === undefined ? true : invertY ? true : false);\n texture.baseWidth = img.width;\n texture.baseHeight = img.height;\n texture.width = potWidth;\n texture.height = potHeight;\n texture.isReady = true;\n texture.type = 0;\n texture.format = extension === \".jpg\" && !texture._useSRGBBuffer ? 4 : 5;\n if (processFunction(potWidth, potHeight, img, extension, texture, () => {\n this._prepareWebGLTextureContinuation(texture, scene, noMipmap, isCompressed, samplingMode);\n })) {\n // Returning as texture needs extra async steps\n return;\n }\n this._prepareWebGLTextureContinuation(texture, scene, noMipmap, isCompressed, samplingMode);\n }\n /**\n * @internal\n */\n _setupFramebufferDepthAttachments(generateStencilBuffer, generateDepthBuffer, width, height, samples = 1) {\n const gl = this._gl;\n // Create the depth/stencil buffer\n if (generateStencilBuffer && generateDepthBuffer) {\n return this._createRenderBuffer(width, height, samples, gl.DEPTH_STENCIL, gl.DEPTH24_STENCIL8, gl.DEPTH_STENCIL_ATTACHMENT);\n }\n if (generateDepthBuffer) {\n let depthFormat = gl.DEPTH_COMPONENT16;\n if (this._webGLVersion > 1) {\n depthFormat = gl.DEPTH_COMPONENT32F;\n }\n return this._createRenderBuffer(width, height, samples, depthFormat, depthFormat, gl.DEPTH_ATTACHMENT);\n }\n if (generateStencilBuffer) {\n return this._createRenderBuffer(width, height, samples, gl.STENCIL_INDEX8, gl.STENCIL_INDEX8, gl.STENCIL_ATTACHMENT);\n }\n return null;\n }\n /**\n * @internal\n */\n _createRenderBuffer(width, height, samples, internalFormat, msInternalFormat, attachment, unbindBuffer = true) {\n const gl = this._gl;\n const renderBuffer = gl.createRenderbuffer();\n return this._updateRenderBuffer(renderBuffer, width, height, samples, internalFormat, msInternalFormat, attachment, unbindBuffer);\n }\n _updateRenderBuffer(renderBuffer, width, height, samples, internalFormat, msInternalFormat, attachment, unbindBuffer = true) {\n const gl = this._gl;\n gl.bindRenderbuffer(gl.RENDERBUFFER, renderBuffer);\n if (samples > 1 && gl.renderbufferStorageMultisample) {\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, samples, msInternalFormat, width, height);\n }\n else {\n gl.renderbufferStorage(gl.RENDERBUFFER, internalFormat, width, height);\n }\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, attachment, gl.RENDERBUFFER, renderBuffer);\n if (unbindBuffer) {\n gl.bindRenderbuffer(gl.RENDERBUFFER, null);\n }\n return renderBuffer;\n }\n /**\n * @internal\n */\n _releaseTexture(texture) {\n var _a;\n this._deleteTexture((_a = texture._hardwareTexture) === null || _a === void 0 ? void 0 : _a.underlyingResource);\n // Unbind channels\n this.unbindAllTextures();\n const index = this._internalTexturesCache.indexOf(texture);\n if (index !== -1) {\n this._internalTexturesCache.splice(index, 1);\n }\n // Integrated fixed lod samplers.\n if (texture._lodTextureHigh) {\n texture._lodTextureHigh.dispose();\n }\n if (texture._lodTextureMid) {\n texture._lodTextureMid.dispose();\n }\n if (texture._lodTextureLow) {\n texture._lodTextureLow.dispose();\n }\n // Integrated irradiance map.\n if (texture._irradianceTexture) {\n texture._irradianceTexture.dispose();\n }\n }\n /**\n * @internal\n */\n _releaseRenderTargetWrapper(rtWrapper) {\n const index = this._renderTargetWrapperCache.indexOf(rtWrapper);\n if (index !== -1) {\n this._renderTargetWrapperCache.splice(index, 1);\n }\n }\n _deleteTexture(texture) {\n if (texture) {\n this._gl.deleteTexture(texture);\n }\n }\n _setProgram(program) {\n if (this._currentProgram !== program) {\n this._gl.useProgram(program);\n this._currentProgram = program;\n }\n }\n /**\n * Binds an effect to the webGL context\n * @param effect defines the effect to bind\n */\n bindSamplers(effect) {\n const webGLPipelineContext = effect.getPipelineContext();\n this._setProgram(webGLPipelineContext.program);\n const samplers = effect.getSamplers();\n for (let index = 0; index < samplers.length; index++) {\n const uniform = effect.getUniform(samplers[index]);\n if (uniform) {\n this._boundUniforms[index] = uniform;\n }\n }\n this._currentEffect = null;\n }\n _activateCurrentTexture() {\n if (this._currentTextureChannel !== this._activeChannel) {\n this._gl.activeTexture(this._gl.TEXTURE0 + this._activeChannel);\n this._currentTextureChannel = this._activeChannel;\n }\n }\n /**\n * @internal\n */\n _bindTextureDirectly(target, texture, forTextureDataUpdate = false, force = false) {\n var _a, _b;\n let wasPreviouslyBound = false;\n const isTextureForRendering = texture && texture._associatedChannel > -1;\n if (forTextureDataUpdate && isTextureForRendering) {\n this._activeChannel = texture._associatedChannel;\n }\n const currentTextureBound = this._boundTexturesCache[this._activeChannel];\n if (currentTextureBound !== texture || force) {\n this._activateCurrentTexture();\n if (texture && texture.isMultiview) {\n //this._gl.bindTexture(target, texture ? texture._colorTextureArray : null);\n console.error(target, texture);\n throw \"_bindTextureDirectly called with a multiview texture!\";\n }\n else {\n this._gl.bindTexture(target, (_b = (_a = texture === null || texture === void 0 ? void 0 : texture._hardwareTexture) === null || _a === void 0 ? void 0 : _a.underlyingResource) !== null && _b !== void 0 ? _b : null);\n }\n this._boundTexturesCache[this._activeChannel] = texture;\n if (texture) {\n texture._associatedChannel = this._activeChannel;\n }\n }\n else if (forTextureDataUpdate) {\n wasPreviouslyBound = true;\n this._activateCurrentTexture();\n }\n if (isTextureForRendering && !forTextureDataUpdate) {\n this._bindSamplerUniformToChannel(texture._associatedChannel, this._activeChannel);\n }\n return wasPreviouslyBound;\n }\n /**\n * @internal\n */\n _bindTexture(channel, texture, name) {\n if (channel === undefined) {\n return;\n }\n if (texture) {\n texture._associatedChannel = channel;\n }\n this._activeChannel = channel;\n const target = texture ? this._getTextureTarget(texture) : this._gl.TEXTURE_2D;\n this._bindTextureDirectly(target, texture);\n }\n /**\n * Unbind all textures from the webGL context\n */\n unbindAllTextures() {\n for (let channel = 0; channel < this._maxSimultaneousTextures; channel++) {\n this._activeChannel = channel;\n this._bindTextureDirectly(this._gl.TEXTURE_2D, null);\n this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null);\n if (this.webGLVersion > 1) {\n this._bindTextureDirectly(this._gl.TEXTURE_3D, null);\n this._bindTextureDirectly(this._gl.TEXTURE_2D_ARRAY, null);\n }\n }\n }\n /**\n * Sets a texture to the according uniform.\n * @param channel The texture channel\n * @param uniform The uniform to set\n * @param texture The texture to apply\n * @param name The name of the uniform in the effect\n */\n setTexture(channel, uniform, texture, name) {\n if (channel === undefined) {\n return;\n }\n if (uniform) {\n this._boundUniforms[channel] = uniform;\n }\n this._setTexture(channel, texture);\n }\n _bindSamplerUniformToChannel(sourceSlot, destination) {\n const uniform = this._boundUniforms[sourceSlot];\n if (!uniform || uniform._currentState === destination) {\n return;\n }\n this._gl.uniform1i(uniform, destination);\n uniform._currentState = destination;\n }\n _getTextureWrapMode(mode) {\n switch (mode) {\n case 1:\n return this._gl.REPEAT;\n case 0:\n return this._gl.CLAMP_TO_EDGE;\n case 2:\n return this._gl.MIRRORED_REPEAT;\n }\n return this._gl.REPEAT;\n }\n _setTexture(channel, texture, isPartOfTextureArray = false, depthStencilTexture = false, name = \"\") {\n // Not ready?\n if (!texture) {\n if (this._boundTexturesCache[channel] != null) {\n this._activeChannel = channel;\n this._bindTextureDirectly(this._gl.TEXTURE_2D, null);\n this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null);\n if (this.webGLVersion > 1) {\n this._bindTextureDirectly(this._gl.TEXTURE_3D, null);\n this._bindTextureDirectly(this._gl.TEXTURE_2D_ARRAY, null);\n }\n }\n return false;\n }\n // Video\n if (texture.video) {\n this._activeChannel = channel;\n const videoInternalTexture = texture.getInternalTexture();\n if (videoInternalTexture) {\n videoInternalTexture._associatedChannel = channel;\n }\n texture.update();\n }\n else if (texture.delayLoadState === 4) {\n // Delay loading\n texture.delayLoad();\n return false;\n }\n let internalTexture;\n if (depthStencilTexture) {\n internalTexture = texture.depthStencilTexture;\n }\n else if (texture.isReady()) {\n internalTexture = texture.getInternalTexture();\n }\n else if (texture.isCube) {\n internalTexture = this.emptyCubeTexture;\n }\n else if (texture.is3D) {\n internalTexture = this.emptyTexture3D;\n }\n else if (texture.is2DArray) {\n internalTexture = this.emptyTexture2DArray;\n }\n else {\n internalTexture = this.emptyTexture;\n }\n if (!isPartOfTextureArray && internalTexture) {\n internalTexture._associatedChannel = channel;\n }\n let needToBind = true;\n if (this._boundTexturesCache[channel] === internalTexture) {\n if (!isPartOfTextureArray) {\n this._bindSamplerUniformToChannel(internalTexture._associatedChannel, channel);\n }\n needToBind = false;\n }\n this._activeChannel = channel;\n const target = this._getTextureTarget(internalTexture);\n if (needToBind) {\n this._bindTextureDirectly(target, internalTexture, isPartOfTextureArray);\n }\n if (internalTexture && !internalTexture.isMultiview) {\n // CUBIC_MODE and SKYBOX_MODE both require CLAMP_TO_EDGE. All other modes use REPEAT.\n if (internalTexture.isCube && internalTexture._cachedCoordinatesMode !== texture.coordinatesMode) {\n internalTexture._cachedCoordinatesMode = texture.coordinatesMode;\n const textureWrapMode = texture.coordinatesMode !== 3 && texture.coordinatesMode !== 5\n ? 1\n : 0;\n texture.wrapU = textureWrapMode;\n texture.wrapV = textureWrapMode;\n }\n if (internalTexture._cachedWrapU !== texture.wrapU) {\n internalTexture._cachedWrapU = texture.wrapU;\n this._setTextureParameterInteger(target, this._gl.TEXTURE_WRAP_S, this._getTextureWrapMode(texture.wrapU), internalTexture);\n }\n if (internalTexture._cachedWrapV !== texture.wrapV) {\n internalTexture._cachedWrapV = texture.wrapV;\n this._setTextureParameterInteger(target, this._gl.TEXTURE_WRAP_T, this._getTextureWrapMode(texture.wrapV), internalTexture);\n }\n if (internalTexture.is3D && internalTexture._cachedWrapR !== texture.wrapR) {\n internalTexture._cachedWrapR = texture.wrapR;\n this._setTextureParameterInteger(target, this._gl.TEXTURE_WRAP_R, this._getTextureWrapMode(texture.wrapR), internalTexture);\n }\n this._setAnisotropicLevel(target, internalTexture, texture.anisotropicFilteringLevel);\n }\n return true;\n }\n /**\n * Sets an array of texture to the webGL context\n * @param channel defines the channel where the texture array must be set\n * @param uniform defines the associated uniform location\n * @param textures defines the array of textures to bind\n * @param name name of the channel\n */\n setTextureArray(channel, uniform, textures, name) {\n if (channel === undefined || !uniform) {\n return;\n }\n if (!this._textureUnits || this._textureUnits.length !== textures.length) {\n this._textureUnits = new Int32Array(textures.length);\n }\n for (let i = 0; i < textures.length; i++) {\n const texture = textures[i].getInternalTexture();\n if (texture) {\n this._textureUnits[i] = channel + i;\n texture._associatedChannel = channel + i;\n }\n else {\n this._textureUnits[i] = -1;\n }\n }\n this._gl.uniform1iv(uniform, this._textureUnits);\n for (let index = 0; index < textures.length; index++) {\n this._setTexture(this._textureUnits[index], textures[index], true);\n }\n }\n /**\n * @internal\n */\n _setAnisotropicLevel(target, internalTexture, anisotropicFilteringLevel) {\n const anisotropicFilterExtension = this._caps.textureAnisotropicFilterExtension;\n if (internalTexture.samplingMode !== 11 &&\n internalTexture.samplingMode !== 3 &&\n internalTexture.samplingMode !== 2) {\n anisotropicFilteringLevel = 1; // Forcing the anisotropic to 1 because else webgl will force filters to linear\n }\n if (anisotropicFilterExtension && internalTexture._cachedAnisotropicFilteringLevel !== anisotropicFilteringLevel) {\n this._setTextureParameterFloat(target, anisotropicFilterExtension.TEXTURE_MAX_ANISOTROPY_EXT, Math.min(anisotropicFilteringLevel, this._caps.maxAnisotropy), internalTexture);\n internalTexture._cachedAnisotropicFilteringLevel = anisotropicFilteringLevel;\n }\n }\n _setTextureParameterFloat(target, parameter, value, texture) {\n this._bindTextureDirectly(target, texture, true, true);\n this._gl.texParameterf(target, parameter, value);\n }\n _setTextureParameterInteger(target, parameter, value, texture) {\n if (texture) {\n this._bindTextureDirectly(target, texture, true, true);\n }\n this._gl.texParameteri(target, parameter, value);\n }\n /**\n * Unbind all vertex attributes from the webGL context\n */\n unbindAllAttributes() {\n if (this._mustWipeVertexAttributes) {\n this._mustWipeVertexAttributes = false;\n for (let i = 0; i < this._caps.maxVertexAttribs; i++) {\n this.disableAttributeByIndex(i);\n }\n return;\n }\n for (let i = 0, ul = this._vertexAttribArraysEnabled.length; i < ul; i++) {\n if (i >= this._caps.maxVertexAttribs || !this._vertexAttribArraysEnabled[i]) {\n continue;\n }\n this.disableAttributeByIndex(i);\n }\n }\n /**\n * Force the engine to release all cached effects. This means that next effect compilation will have to be done completely even if a similar effect was already compiled\n */\n releaseEffects() {\n for (const name in this._compiledEffects) {\n const webGLPipelineContext = this._compiledEffects[name].getPipelineContext();\n this._deletePipelineContext(webGLPipelineContext);\n }\n this._compiledEffects = {};\n }\n /**\n * Dispose and release all associated resources\n */\n dispose() {\n var _a;\n this._isDisposed = true;\n this.stopRenderLoop();\n // Clear observables\n if (this.onBeforeTextureInitObservable) {\n this.onBeforeTextureInitObservable.clear();\n }\n // Empty texture\n if (this._emptyTexture) {\n this._releaseTexture(this._emptyTexture);\n this._emptyTexture = null;\n }\n if (this._emptyCubeTexture) {\n this._releaseTexture(this._emptyCubeTexture);\n this._emptyCubeTexture = null;\n }\n if (this._dummyFramebuffer) {\n this._gl.deleteFramebuffer(this._dummyFramebuffer);\n }\n // Release effects\n this.releaseEffects();\n (_a = this.releaseComputeEffects) === null || _a === void 0 ? void 0 : _a.call(this);\n // Unbind\n this.unbindAllAttributes();\n this._boundUniforms = {};\n // Events\n if (IsWindowObjectExist()) {\n if (this._renderingCanvas) {\n if (!this._doNotHandleContextLost) {\n this._renderingCanvas.removeEventListener(\"webglcontextlost\", this._onContextLost);\n this._renderingCanvas.removeEventListener(\"webglcontextrestored\", this._onContextRestored);\n }\n window.removeEventListener(\"resize\", this._checkForMobile);\n }\n }\n this._workingCanvas = null;\n this._workingContext = null;\n this._currentBufferPointers.length = 0;\n this._renderingCanvas = null;\n this._currentProgram = null;\n this._boundRenderFunction = null;\n Effect.ResetCache();\n // Abort active requests\n for (const request of this._activeRequests) {\n request.abort();\n }\n this.onDisposeObservable.notifyObservers(this);\n this.onDisposeObservable.clear();\n }\n /**\n * Attach a new callback raised when context lost event is fired\n * @param callback defines the callback to call\n */\n attachContextLostEvent(callback) {\n if (this._renderingCanvas) {\n this._renderingCanvas.addEventListener(\"webglcontextlost\", callback, false);\n }\n }\n /**\n * Attach a new callback raised when context restored event is fired\n * @param callback defines the callback to call\n */\n attachContextRestoredEvent(callback) {\n if (this._renderingCanvas) {\n this._renderingCanvas.addEventListener(\"webglcontextrestored\", callback, false);\n }\n }\n /**\n * Get the current error code of the webGL context\n * @returns the error code\n * @see https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/getError\n */\n getError() {\n return this._gl.getError();\n }\n _canRenderToFloatFramebuffer() {\n if (this._webGLVersion > 1) {\n return this._caps.colorBufferFloat;\n }\n return this._canRenderToFramebuffer(1);\n }\n _canRenderToHalfFloatFramebuffer() {\n if (this._webGLVersion > 1) {\n return this._caps.colorBufferFloat;\n }\n return this._canRenderToFramebuffer(2);\n }\n // Thank you : http://stackoverflow.com/questions/28827511/webgl-ios-render-to-floating-point-texture\n _canRenderToFramebuffer(type) {\n const gl = this._gl;\n //clear existing errors\n // eslint-disable-next-line no-empty\n while (gl.getError() !== gl.NO_ERROR) { }\n let successful = true;\n const texture = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, texture);\n gl.texImage2D(gl.TEXTURE_2D, 0, this._getRGBABufferInternalSizedFormat(type), 1, 1, 0, gl.RGBA, this._getWebGLTextureType(type), null);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);\n const fb = gl.createFramebuffer();\n gl.bindFramebuffer(gl.FRAMEBUFFER, fb);\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0);\n const status = gl.checkFramebufferStatus(gl.FRAMEBUFFER);\n successful = successful && status === gl.FRAMEBUFFER_COMPLETE;\n successful = successful && gl.getError() === gl.NO_ERROR;\n //try render by clearing frame buffer's color buffer\n if (successful) {\n gl.clear(gl.COLOR_BUFFER_BIT);\n successful = successful && gl.getError() === gl.NO_ERROR;\n }\n //try reading from frame to ensure render occurs (just creating the FBO is not sufficient to determine if rendering is supported)\n if (successful) {\n //in practice it's sufficient to just read from the backbuffer rather than handle potentially issues reading from the texture\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n const readFormat = gl.RGBA;\n const readType = gl.UNSIGNED_BYTE;\n const buffer = new Uint8Array(4);\n gl.readPixels(0, 0, 1, 1, readFormat, readType, buffer);\n successful = successful && gl.getError() === gl.NO_ERROR;\n }\n //clean up\n gl.deleteTexture(texture);\n gl.deleteFramebuffer(fb);\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n //clear accumulated errors\n // eslint-disable-next-line no-empty\n while (!successful && gl.getError() !== gl.NO_ERROR) { }\n return successful;\n }\n /**\n * @internal\n */\n _getWebGLTextureType(type) {\n if (this._webGLVersion === 1) {\n switch (type) {\n case 1:\n return this._gl.FLOAT;\n case 2:\n return this._gl.HALF_FLOAT_OES;\n case 0:\n return this._gl.UNSIGNED_BYTE;\n case 8:\n return this._gl.UNSIGNED_SHORT_4_4_4_4;\n case 9:\n return this._gl.UNSIGNED_SHORT_5_5_5_1;\n case 10:\n return this._gl.UNSIGNED_SHORT_5_6_5;\n }\n return this._gl.UNSIGNED_BYTE;\n }\n switch (type) {\n case 3:\n return this._gl.BYTE;\n case 0:\n return this._gl.UNSIGNED_BYTE;\n case 4:\n return this._gl.SHORT;\n case 5:\n return this._gl.UNSIGNED_SHORT;\n case 6:\n return this._gl.INT;\n case 7: // Refers to UNSIGNED_INT\n return this._gl.UNSIGNED_INT;\n case 1:\n return this._gl.FLOAT;\n case 2:\n return this._gl.HALF_FLOAT;\n case 8:\n return this._gl.UNSIGNED_SHORT_4_4_4_4;\n case 9:\n return this._gl.UNSIGNED_SHORT_5_5_5_1;\n case 10:\n return this._gl.UNSIGNED_SHORT_5_6_5;\n case 11:\n return this._gl.UNSIGNED_INT_2_10_10_10_REV;\n case 12:\n return this._gl.UNSIGNED_INT_24_8;\n case 13:\n return this._gl.UNSIGNED_INT_10F_11F_11F_REV;\n case 14:\n return this._gl.UNSIGNED_INT_5_9_9_9_REV;\n case 15:\n return this._gl.FLOAT_32_UNSIGNED_INT_24_8_REV;\n }\n return this._gl.UNSIGNED_BYTE;\n }\n /**\n * @internal\n */\n _getInternalFormat(format, useSRGBBuffer = false) {\n let internalFormat = useSRGBBuffer ? this._glSRGBExtensionValues.SRGB8_ALPHA8 : this._gl.RGBA;\n switch (format) {\n case 0:\n internalFormat = this._gl.ALPHA;\n break;\n case 1:\n internalFormat = this._gl.LUMINANCE;\n break;\n case 2:\n internalFormat = this._gl.LUMINANCE_ALPHA;\n break;\n case 6:\n internalFormat = this._gl.RED;\n break;\n case 7:\n internalFormat = this._gl.RG;\n break;\n case 4:\n internalFormat = useSRGBBuffer ? this._glSRGBExtensionValues.SRGB : this._gl.RGB;\n break;\n case 5:\n internalFormat = useSRGBBuffer ? this._glSRGBExtensionValues.SRGB8_ALPHA8 : this._gl.RGBA;\n break;\n }\n if (this._webGLVersion > 1) {\n switch (format) {\n case 8:\n internalFormat = this._gl.RED_INTEGER;\n break;\n case 9:\n internalFormat = this._gl.RG_INTEGER;\n break;\n case 10:\n internalFormat = this._gl.RGB_INTEGER;\n break;\n case 11:\n internalFormat = this._gl.RGBA_INTEGER;\n break;\n }\n }\n return internalFormat;\n }\n /**\n * @internal\n */\n _getRGBABufferInternalSizedFormat(type, format, useSRGBBuffer = false) {\n if (this._webGLVersion === 1) {\n if (format !== undefined) {\n switch (format) {\n case 0:\n return this._gl.ALPHA;\n case 1:\n return this._gl.LUMINANCE;\n case 2:\n return this._gl.LUMINANCE_ALPHA;\n case 4:\n return useSRGBBuffer ? this._glSRGBExtensionValues.SRGB : this._gl.RGB;\n }\n }\n return this._gl.RGBA;\n }\n switch (type) {\n case 3:\n switch (format) {\n case 6:\n return this._gl.R8_SNORM;\n case 7:\n return this._gl.RG8_SNORM;\n case 4:\n return this._gl.RGB8_SNORM;\n case 8:\n return this._gl.R8I;\n case 9:\n return this._gl.RG8I;\n case 10:\n return this._gl.RGB8I;\n case 11:\n return this._gl.RGBA8I;\n default:\n return this._gl.RGBA8_SNORM;\n }\n case 0:\n switch (format) {\n case 6:\n return this._gl.R8;\n case 7:\n return this._gl.RG8;\n case 4:\n return useSRGBBuffer ? this._glSRGBExtensionValues.SRGB8 : this._gl.RGB8; // By default. Other possibilities are RGB565, SRGB8.\n case 5:\n return useSRGBBuffer ? this._glSRGBExtensionValues.SRGB8_ALPHA8 : this._gl.RGBA8; // By default. Other possibilities are RGB5_A1, RGBA4, SRGB8_ALPHA8.\n case 8:\n return this._gl.R8UI;\n case 9:\n return this._gl.RG8UI;\n case 10:\n return this._gl.RGB8UI;\n case 11:\n return this._gl.RGBA8UI;\n case 0:\n return this._gl.ALPHA;\n case 1:\n return this._gl.LUMINANCE;\n case 2:\n return this._gl.LUMINANCE_ALPHA;\n default:\n return this._gl.RGBA8;\n }\n case 4:\n switch (format) {\n case 8:\n return this._gl.R16I;\n case 9:\n return this._gl.RG16I;\n case 10:\n return this._gl.RGB16I;\n case 11:\n return this._gl.RGBA16I;\n default:\n return this._gl.RGBA16I;\n }\n case 5:\n switch (format) {\n case 8:\n return this._gl.R16UI;\n case 9:\n return this._gl.RG16UI;\n case 10:\n return this._gl.RGB16UI;\n case 11:\n return this._gl.RGBA16UI;\n default:\n return this._gl.RGBA16UI;\n }\n case 6:\n switch (format) {\n case 8:\n return this._gl.R32I;\n case 9:\n return this._gl.RG32I;\n case 10:\n return this._gl.RGB32I;\n case 11:\n return this._gl.RGBA32I;\n default:\n return this._gl.RGBA32I;\n }\n case 7: // Refers to UNSIGNED_INT\n switch (format) {\n case 8:\n return this._gl.R32UI;\n case 9:\n return this._gl.RG32UI;\n case 10:\n return this._gl.RGB32UI;\n case 11:\n return this._gl.RGBA32UI;\n default:\n return this._gl.RGBA32UI;\n }\n case 1:\n switch (format) {\n case 6:\n return this._gl.R32F; // By default. Other possibility is R16F.\n case 7:\n return this._gl.RG32F; // By default. Other possibility is RG16F.\n case 4:\n return this._gl.RGB32F; // By default. Other possibilities are RGB16F, R11F_G11F_B10F, RGB9_E5.\n case 5:\n return this._gl.RGBA32F; // By default. Other possibility is RGBA16F.\n default:\n return this._gl.RGBA32F;\n }\n case 2:\n switch (format) {\n case 6:\n return this._gl.R16F;\n case 7:\n return this._gl.RG16F;\n case 4:\n return this._gl.RGB16F; // By default. Other possibilities are R11F_G11F_B10F, RGB9_E5.\n case 5:\n return this._gl.RGBA16F;\n default:\n return this._gl.RGBA16F;\n }\n case 10:\n return this._gl.RGB565;\n case 13:\n return this._gl.R11F_G11F_B10F;\n case 14:\n return this._gl.RGB9_E5;\n case 8:\n return this._gl.RGBA4;\n case 9:\n return this._gl.RGB5_A1;\n case 11:\n switch (format) {\n case 5:\n return this._gl.RGB10_A2; // By default. Other possibility is RGB5_A1.\n case 11:\n return this._gl.RGB10_A2UI;\n default:\n return this._gl.RGB10_A2;\n }\n }\n return useSRGBBuffer ? this._glSRGBExtensionValues.SRGB8_ALPHA8 : this._gl.RGBA8;\n }\n /**\n * @internal\n */\n _getRGBAMultiSampleBufferFormat(type, format = 5) {\n switch (type) {\n case 1:\n switch (format) {\n case 6:\n return this._gl.R32F;\n default:\n return this._gl.RGBA32F;\n }\n case 2:\n switch (format) {\n case 6:\n return this._gl.R16F;\n default:\n return this._gl.RGBA16F;\n }\n }\n return this._gl.RGBA8;\n }\n /**\n * @internal\n */\n _loadFile(url, onSuccess, onProgress, offlineProvider, useArrayBuffer, onError) {\n const request = ThinEngine._FileToolsLoadFile(url, onSuccess, onProgress, offlineProvider, useArrayBuffer, onError);\n this._activeRequests.push(request);\n request.onCompleteObservable.add((request) => {\n this._activeRequests.splice(this._activeRequests.indexOf(request), 1);\n });\n return request;\n }\n /**\n * Loads a file from a url\n * @param url url to load\n * @param onSuccess callback called when the file successfully loads\n * @param onProgress callback called while file is loading (if the server supports this mode)\n * @param offlineProvider defines the offline provider for caching\n * @param useArrayBuffer defines a boolean indicating that date must be returned as ArrayBuffer\n * @param onError callback called when the file fails to load\n * @returns a file request object\n * @internal\n */\n static _FileToolsLoadFile(url, onSuccess, onProgress, offlineProvider, useArrayBuffer, onError) {\n throw _WarnImport(\"FileTools\");\n }\n /**\n * Reads pixels from the current frame buffer. Please note that this function can be slow\n * @param x defines the x coordinate of the rectangle where pixels must be read\n * @param y defines the y coordinate of the rectangle where pixels must be read\n * @param width defines the width of the rectangle where pixels must be read\n * @param height defines the height of the rectangle where pixels must be read\n * @param hasAlpha defines whether the output should have alpha or not (defaults to true)\n * @param flushRenderer true to flush the renderer from the pending commands before reading the pixels\n * @returns a ArrayBufferView promise (Uint8Array) containing RGBA colors\n */\n readPixels(x, y, width, height, hasAlpha = true, flushRenderer = true) {\n const numChannels = hasAlpha ? 4 : 3;\n const format = hasAlpha ? this._gl.RGBA : this._gl.RGB;\n const data = new Uint8Array(height * width * numChannels);\n if (flushRenderer) {\n this.flushFramebuffer();\n }\n this._gl.readPixels(x, y, width, height, format, this._gl.UNSIGNED_BYTE, data);\n return Promise.resolve(data);\n }\n /**\n * Gets a Promise indicating if the engine can be instantiated (ie. if a webGL context can be found)\n */\n static get IsSupportedAsync() {\n return Promise.resolve(this.isSupported());\n }\n /**\n * Gets a boolean indicating if the engine can be instantiated (ie. if a webGL context can be found)\n */\n static get IsSupported() {\n return this.isSupported(); // Backward compat\n }\n /**\n * Gets a boolean indicating if the engine can be instantiated (ie. if a webGL context can be found)\n * @returns true if the engine can be created\n * @ignorenaming\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n static isSupported() {\n if (this._HasMajorPerformanceCaveat !== null) {\n return !this._HasMajorPerformanceCaveat; // We know it is performant so WebGL is supported\n }\n if (this._IsSupported === null) {\n try {\n const tempcanvas = this._CreateCanvas(1, 1);\n const gl = tempcanvas.getContext(\"webgl\") || tempcanvas.getContext(\"experimental-webgl\");\n this._IsSupported = gl != null && !!window.WebGLRenderingContext;\n }\n catch (e) {\n this._IsSupported = false;\n }\n }\n return this._IsSupported;\n }\n /**\n * Gets a boolean indicating if the engine can be instantiated on a performant device (ie. if a webGL context can be found and it does not use a slow implementation)\n */\n static get HasMajorPerformanceCaveat() {\n if (this._HasMajorPerformanceCaveat === null) {\n try {\n const tempcanvas = this._CreateCanvas(1, 1);\n const gl = tempcanvas.getContext(\"webgl\", { failIfMajorPerformanceCaveat: true }) ||\n tempcanvas.getContext(\"experimental-webgl\", { failIfMajorPerformanceCaveat: true });\n this._HasMajorPerformanceCaveat = !gl;\n }\n catch (e) {\n this._HasMajorPerformanceCaveat = false;\n }\n }\n return this._HasMajorPerformanceCaveat;\n }\n /**\n * Find the next highest power of two.\n * @param x Number to start search from.\n * @returns Next highest power of two.\n */\n static CeilingPOT(x) {\n x--;\n x |= x >> 1;\n x |= x >> 2;\n x |= x >> 4;\n x |= x >> 8;\n x |= x >> 16;\n x++;\n return x;\n }\n /**\n * Find the next lowest power of two.\n * @param x Number to start search from.\n * @returns Next lowest power of two.\n */\n static FloorPOT(x) {\n x = x | (x >> 1);\n x = x | (x >> 2);\n x = x | (x >> 4);\n x = x | (x >> 8);\n x = x | (x >> 16);\n return x - (x >> 1);\n }\n /**\n * Find the nearest power of two.\n * @param x Number to start search from.\n * @returns Next nearest power of two.\n */\n static NearestPOT(x) {\n const c = ThinEngine.CeilingPOT(x);\n const f = ThinEngine.FloorPOT(x);\n return c - x > x - f ? f : c;\n }\n /**\n * Get the closest exponent of two\n * @param value defines the value to approximate\n * @param max defines the maximum value to return\n * @param mode defines how to define the closest value\n * @returns closest exponent of two of the given value\n */\n static GetExponentOfTwo(value, max, mode = 2) {\n let pot;\n switch (mode) {\n case 1:\n pot = ThinEngine.FloorPOT(value);\n break;\n case 2:\n pot = ThinEngine.NearestPOT(value);\n break;\n case 3:\n default:\n pot = ThinEngine.CeilingPOT(value);\n break;\n }\n return Math.min(pot, max);\n }\n /**\n * Queue a new function into the requested animation frame pool (ie. this function will be executed by the browser (or the javascript engine) for the next frame)\n * @param func - the function to be called\n * @param requester - the object that will request the next frame. Falls back to window.\n * @returns frame number\n */\n static QueueNewFrame(func, requester) {\n // Note that there is kind of a typing issue here, as `setTimeout` might return something else than a number (NodeJs returns a NodeJS.Timeout object).\n // Also if the global `requestAnimationFrame`'s returnType is number, `requester.requestPostAnimationFrame` and `requester.requestAnimationFrame` types\n // are `any`.\n if (!IsWindowObjectExist()) {\n if (typeof requestAnimationFrame === \"function\") {\n return requestAnimationFrame(func);\n }\n }\n else {\n const { requestAnimationFrame } = requester || window;\n if (typeof requestAnimationFrame === \"function\") {\n return requestAnimationFrame(func);\n }\n }\n // fallback to the global `setTimeout`.\n // In most cases (aka in the browser), `window` is the global object, so instead of calling `window.setTimeout` we could call the global `setTimeout`.\n return setTimeout(func, 16);\n }\n /**\n * Gets host document\n * @returns the host document object\n */\n getHostDocument() {\n if (this._renderingCanvas && this._renderingCanvas.ownerDocument) {\n return this._renderingCanvas.ownerDocument;\n }\n return IsDocumentAvailable() ? document : null;\n }\n}\nThinEngine._TempClearColorUint32 = new Uint32Array(4);\nThinEngine._TempClearColorInt32 = new Int32Array(4);\n/** Use this array to turn off some WebGL2 features on known buggy browsers version */\nThinEngine.ExceptionList = [\n { key: \"Chrome/63.0\", capture: \"63\\\\.0\\\\.3239\\\\.(\\\\d+)\", captureConstraint: 108, targets: [\"uniformBuffer\"] },\n { key: \"Firefox/58\", capture: null, captureConstraint: null, targets: [\"uniformBuffer\"] },\n { key: \"Firefox/59\", capture: null, captureConstraint: null, targets: [\"uniformBuffer\"] },\n { key: \"Chrome/72.+?Mobile\", capture: null, captureConstraint: null, targets: [\"vao\"] },\n { key: \"Chrome/73.+?Mobile\", capture: null, captureConstraint: null, targets: [\"vao\"] },\n { key: \"Chrome/74.+?Mobile\", capture: null, captureConstraint: null, targets: [\"vao\"] },\n { key: \"Mac OS.+Chrome/71\", capture: null, captureConstraint: null, targets: [\"vao\"] },\n { key: \"Mac OS.+Chrome/72\", capture: null, captureConstraint: null, targets: [\"vao\"] },\n { key: \"Mac OS.+Chrome\", capture: null, captureConstraint: null, targets: [\"uniformBuffer\"] },\n // desktop osx safari 15.4\n { key: \".*AppleWebKit.*(15.4).*Safari\", capture: null, captureConstraint: null, targets: [\"antialias\", \"maxMSAASamples\"] },\n // mobile browsers using safari 15.4 on ios\n { key: \".*(15.4).*AppleWebKit.*Safari\", capture: null, captureConstraint: null, targets: [\"antialias\", \"maxMSAASamples\"] },\n];\n/** @internal */\nThinEngine._TextureLoaders = [];\n// Updatable statics so stick with vars here\n/**\n * Gets or sets the epsilon value used by collision engine\n */\nThinEngine.CollisionsEpsilon = 0.001;\n// Statics\nThinEngine._IsSupported = null;\nThinEngine._HasMajorPerformanceCaveat = null;\n//# sourceMappingURL=thinEngine.js.map","import { PrecisionDate } from \"./precisionDate.js\";\n/**\n * Performance monitor tracks rolling average frame-time and frame-time variance over a user defined sliding-window\n */\nexport class PerformanceMonitor {\n /**\n * constructor\n * @param frameSampleSize The number of samples required to saturate the sliding window\n */\n constructor(frameSampleSize = 30) {\n this._enabled = true;\n this._rollingFrameTime = new RollingAverage(frameSampleSize);\n }\n /**\n * Samples current frame\n * @param timeMs A timestamp in milliseconds of the current frame to compare with other frames\n */\n sampleFrame(timeMs = PrecisionDate.Now) {\n if (!this._enabled) {\n return;\n }\n if (this._lastFrameTimeMs != null) {\n const dt = timeMs - this._lastFrameTimeMs;\n this._rollingFrameTime.add(dt);\n }\n this._lastFrameTimeMs = timeMs;\n }\n /**\n * Returns the average frame time in milliseconds over the sliding window (or the subset of frames sampled so far)\n */\n get averageFrameTime() {\n return this._rollingFrameTime.average;\n }\n /**\n * Returns the variance frame time in milliseconds over the sliding window (or the subset of frames sampled so far)\n */\n get averageFrameTimeVariance() {\n return this._rollingFrameTime.variance;\n }\n /**\n * Returns the frame time of the most recent frame\n */\n get instantaneousFrameTime() {\n return this._rollingFrameTime.history(0);\n }\n /**\n * Returns the average framerate in frames per second over the sliding window (or the subset of frames sampled so far)\n */\n get averageFPS() {\n return 1000.0 / this._rollingFrameTime.average;\n }\n /**\n * Returns the average framerate in frames per second using the most recent frame time\n */\n get instantaneousFPS() {\n const history = this._rollingFrameTime.history(0);\n if (history === 0) {\n return 0;\n }\n return 1000.0 / history;\n }\n /**\n * Returns true if enough samples have been taken to completely fill the sliding window\n */\n get isSaturated() {\n return this._rollingFrameTime.isSaturated();\n }\n /**\n * Enables contributions to the sliding window sample set\n */\n enable() {\n this._enabled = true;\n }\n /**\n * Disables contributions to the sliding window sample set\n * Samples will not be interpolated over the disabled period\n */\n disable() {\n this._enabled = false;\n //clear last sample to avoid interpolating over the disabled period when next enabled\n this._lastFrameTimeMs = null;\n }\n /**\n * Returns true if sampling is enabled\n */\n get isEnabled() {\n return this._enabled;\n }\n /**\n * Resets performance monitor\n */\n reset() {\n //clear last sample to avoid interpolating over the disabled period when next enabled\n this._lastFrameTimeMs = null;\n //wipe record\n this._rollingFrameTime.reset();\n }\n}\n/**\n * RollingAverage\n *\n * Utility to efficiently compute the rolling average and variance over a sliding window of samples\n */\nexport class RollingAverage {\n /**\n * constructor\n * @param length The number of samples required to saturate the sliding window\n */\n constructor(length) {\n this._samples = new Array(length);\n this.reset();\n }\n /**\n * Adds a sample to the sample set\n * @param v The sample value\n */\n add(v) {\n //http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance\n let delta;\n //we need to check if we've already wrapped round\n if (this.isSaturated()) {\n //remove bottom of stack from mean\n const bottomValue = this._samples[this._pos];\n delta = bottomValue - this.average;\n this.average -= delta / (this._sampleCount - 1);\n this._m2 -= delta * (bottomValue - this.average);\n }\n else {\n this._sampleCount++;\n }\n //add new value to mean\n delta = v - this.average;\n this.average += delta / this._sampleCount;\n this._m2 += delta * (v - this.average);\n //set the new variance\n this.variance = this._m2 / (this._sampleCount - 1);\n this._samples[this._pos] = v;\n this._pos++;\n this._pos %= this._samples.length; //positive wrap around\n }\n /**\n * Returns previously added values or null if outside of history or outside the sliding window domain\n * @param i Index in history. For example, pass 0 for the most recent value and 1 for the value before that\n * @returns Value previously recorded with add() or null if outside of range\n */\n history(i) {\n if (i >= this._sampleCount || i >= this._samples.length) {\n return 0;\n }\n const i0 = this._wrapPosition(this._pos - 1.0);\n return this._samples[this._wrapPosition(i0 - i)];\n }\n /**\n * Returns true if enough samples have been taken to completely fill the sliding window\n * @returns true if sample-set saturated\n */\n isSaturated() {\n return this._sampleCount >= this._samples.length;\n }\n /**\n * Resets the rolling average (equivalent to 0 samples taken so far)\n */\n reset() {\n this.average = 0;\n this.variance = 0;\n this._sampleCount = 0;\n this._pos = 0;\n this._m2 = 0;\n }\n /**\n * Wraps a value around the sample range boundaries\n * @param i Position in sample range, for example if the sample length is 5, and i is -3, then 2 will be returned.\n * @returns Wrapped position in sample range\n */\n _wrapPosition(i) {\n const max = this._samples.length;\n return ((i % max) + max) % max;\n }\n}\n//# sourceMappingURL=performanceMonitor.js.map","import { PrecisionDate } from \"./precisionDate.js\";\n/**\n * This class is used to track a performance counter which is number based.\n * The user has access to many properties which give statistics of different nature.\n *\n * The implementer can track two kinds of Performance Counter: time and count.\n * For time you can optionally call fetchNewFrame() to notify the start of a new frame to monitor, then call beginMonitoring() to start and endMonitoring() to record the lapsed time. endMonitoring takes a newFrame parameter for you to specify if the monitored time should be set for a new frame or accumulated to the current frame being monitored.\n * For count you first have to call fetchNewFrame() to notify the start of a new frame to monitor, then call addCount() how many time required to increment the count value you monitor.\n */\nexport class PerfCounter {\n /**\n * Returns the smallest value ever\n */\n get min() {\n return this._min;\n }\n /**\n * Returns the biggest value ever\n */\n get max() {\n return this._max;\n }\n /**\n * Returns the average value since the performance counter is running\n */\n get average() {\n return this._average;\n }\n /**\n * Returns the average value of the last second the counter was monitored\n */\n get lastSecAverage() {\n return this._lastSecAverage;\n }\n /**\n * Returns the current value\n */\n get current() {\n return this._current;\n }\n /**\n * Gets the accumulated total\n */\n get total() {\n return this._totalAccumulated;\n }\n /**\n * Gets the total value count\n */\n get count() {\n return this._totalValueCount;\n }\n /**\n * Creates a new counter\n */\n constructor() {\n this._startMonitoringTime = 0;\n this._min = 0;\n this._max = 0;\n this._average = 0;\n this._lastSecAverage = 0;\n this._current = 0;\n this._totalValueCount = 0;\n this._totalAccumulated = 0;\n this._lastSecAccumulated = 0;\n this._lastSecTime = 0;\n this._lastSecValueCount = 0;\n }\n /**\n * Call this method to start monitoring a new frame.\n * This scenario is typically used when you accumulate monitoring time many times for a single frame, you call this method at the start of the frame, then beginMonitoring to start recording and endMonitoring(false) to accumulated the recorded time to the PerfCounter or addCount() to accumulate a monitored count.\n */\n fetchNewFrame() {\n this._totalValueCount++;\n this._current = 0;\n this._lastSecValueCount++;\n }\n /**\n * Call this method to monitor a count of something (e.g. mesh drawn in viewport count)\n * @param newCount the count value to add to the monitored count\n * @param fetchResult true when it's the last time in the frame you add to the counter and you wish to update the statistics properties (min/max/average), false if you only want to update statistics.\n */\n addCount(newCount, fetchResult) {\n if (!PerfCounter.Enabled) {\n return;\n }\n this._current += newCount;\n if (fetchResult) {\n this._fetchResult();\n }\n }\n /**\n * Start monitoring this performance counter\n */\n beginMonitoring() {\n if (!PerfCounter.Enabled) {\n return;\n }\n this._startMonitoringTime = PrecisionDate.Now;\n }\n /**\n * Compute the time lapsed since the previous beginMonitoring() call.\n * @param newFrame true by default to fetch the result and monitor a new frame, if false the time monitored will be added to the current frame counter\n */\n endMonitoring(newFrame = true) {\n if (!PerfCounter.Enabled) {\n return;\n }\n if (newFrame) {\n this.fetchNewFrame();\n }\n const currentTime = PrecisionDate.Now;\n this._current = currentTime - this._startMonitoringTime;\n if (newFrame) {\n this._fetchResult();\n }\n }\n /**\n * Call this method to end the monitoring of a frame.\n * This scenario is typically used when you accumulate monitoring time many times for a single frame, you call this method at the end of the frame, after beginMonitoring to start recording and endMonitoring(false) to accumulated the recorded time to the PerfCounter or addCount() to accumulate a monitored count.\n */\n endFrame() {\n this._fetchResult();\n }\n _fetchResult() {\n this._totalAccumulated += this._current;\n this._lastSecAccumulated += this._current;\n // Min/Max update\n this._min = Math.min(this._min, this._current);\n this._max = Math.max(this._max, this._current);\n this._average = this._totalAccumulated / this._totalValueCount;\n // Reset last sec?\n const now = PrecisionDate.Now;\n if (now - this._lastSecTime > 1000) {\n this._lastSecAverage = this._lastSecAccumulated / this._lastSecValueCount;\n this._lastSecTime = now;\n this._lastSecAccumulated = 0;\n this._lastSecValueCount = 0;\n }\n }\n}\n/**\n * Gets or sets a global boolean to turn on and off all the counters\n */\nPerfCounter.Enabled = true;\n//# sourceMappingURL=perfCounter.js.map","import { ThinEngine } from \"../../Engines/thinEngine.js\";\n\nThinEngine.prototype.setAlphaConstants = function (r, g, b, a) {\n this._alphaState.setAlphaBlendConstants(r, g, b, a);\n};\nThinEngine.prototype.setAlphaMode = function (mode, noDepthWriteChange = false) {\n if (this._alphaMode === mode) {\n if (!noDepthWriteChange) {\n // Make sure we still have the correct depth mask according to the alpha mode (a transparent material could have forced writting to the depth buffer, for instance)\n const depthMask = mode === 0;\n if (this.depthCullingState.depthMask !== depthMask) {\n this.depthCullingState.depthMask = depthMask;\n }\n }\n return;\n }\n switch (mode) {\n case 0:\n this._alphaState.alphaBlend = false;\n break;\n case 7:\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE);\n this._alphaState.alphaBlend = true;\n break;\n case 8:\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA);\n this._alphaState.alphaBlend = true;\n break;\n case 2:\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE);\n this._alphaState.alphaBlend = true;\n break;\n case 6:\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE, this._gl.ZERO, this._gl.ONE);\n this._alphaState.alphaBlend = true;\n break;\n case 1:\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA, this._gl.ONE, this._gl.ZERO, this._gl.ONE);\n this._alphaState.alphaBlend = true;\n break;\n case 3:\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.ZERO, this._gl.ONE_MINUS_SRC_COLOR, this._gl.ONE, this._gl.ONE);\n this._alphaState.alphaBlend = true;\n break;\n case 4:\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.DST_COLOR, this._gl.ZERO, this._gl.ONE, this._gl.ONE);\n this._alphaState.alphaBlend = true;\n break;\n case 5:\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA, this._gl.ONE_MINUS_SRC_COLOR, this._gl.ONE, this._gl.ONE);\n this._alphaState.alphaBlend = true;\n break;\n case 9:\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.CONSTANT_COLOR, this._gl.ONE_MINUS_CONSTANT_COLOR, this._gl.CONSTANT_ALPHA, this._gl.ONE_MINUS_CONSTANT_ALPHA);\n this._alphaState.alphaBlend = true;\n break;\n case 10:\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE_MINUS_SRC_COLOR, this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA);\n this._alphaState.alphaBlend = true;\n break;\n case 11:\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE, this._gl.ONE, this._gl.ONE);\n this._alphaState.alphaBlend = true;\n break;\n case 12:\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.DST_ALPHA, this._gl.ONE, this._gl.ZERO, this._gl.ZERO);\n this._alphaState.alphaBlend = true;\n break;\n case 13:\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE_MINUS_DST_COLOR, this._gl.ONE_MINUS_SRC_COLOR, this._gl.ONE_MINUS_DST_ALPHA, this._gl.ONE_MINUS_SRC_ALPHA);\n this._alphaState.alphaBlend = true;\n break;\n case 14:\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA);\n this._alphaState.alphaBlend = true;\n break;\n case 15:\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE, this._gl.ONE, this._gl.ZERO);\n this._alphaState.alphaBlend = true;\n break;\n case 16:\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE_MINUS_DST_COLOR, this._gl.ONE_MINUS_SRC_COLOR, this._gl.ZERO, this._gl.ONE);\n this._alphaState.alphaBlend = true;\n break;\n case 17:\n // Same as ALPHA_COMBINE but accumulates (1 - alpha) values in the alpha channel for a later readout in order independant transparency\n this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA);\n this._alphaState.alphaBlend = true;\n break;\n }\n if (!noDepthWriteChange) {\n this.depthCullingState.depthMask = mode === 0;\n }\n this._alphaMode = mode;\n};\nThinEngine.prototype.getAlphaMode = function () {\n return this._alphaMode;\n};\nThinEngine.prototype.setAlphaEquation = function (equation) {\n if (this._alphaEquation === equation) {\n return;\n }\n switch (equation) {\n case 0:\n this._alphaState.setAlphaEquationParameters(32774, 32774);\n break;\n case 1:\n this._alphaState.setAlphaEquationParameters(32778, 32778);\n break;\n case 2:\n this._alphaState.setAlphaEquationParameters(32779, 32779);\n break;\n case 3:\n this._alphaState.setAlphaEquationParameters(32776, 32776);\n break;\n case 4:\n this._alphaState.setAlphaEquationParameters(32775, 32775);\n break;\n case 5:\n this._alphaState.setAlphaEquationParameters(32775, 32774);\n break;\n }\n this._alphaEquation = equation;\n};\nThinEngine.prototype.getAlphaEquation = function () {\n return this._alphaEquation;\n};\n//# sourceMappingURL=engine.alpha.js.map","import { ThinEngine } from \"../../Engines/thinEngine.js\";\n\n/**\n * Allocate a typed array depending on a texture type. Optionally can copy existing data in the buffer.\n * @param type type of the texture\n * @param sizeOrDstBuffer size of the array OR an existing buffer that will be used as the destination of the copy (if copyBuffer is provided)\n * @param sizeInBytes true if the size of the array is given in bytes, false if it is the number of elements of the array\n * @param copyBuffer if provided, buffer to copy into the destination buffer (either a newly allocated buffer if sizeOrDstBuffer is a number or use sizeOrDstBuffer as the destination buffer otherwise)\n * @returns the allocated buffer or sizeOrDstBuffer if the latter is an ArrayBuffer\n */\nexport function allocateAndCopyTypedBuffer(type, sizeOrDstBuffer, sizeInBytes = false, copyBuffer) {\n switch (type) {\n case 3: {\n const buffer = sizeOrDstBuffer instanceof ArrayBuffer ? new Int8Array(sizeOrDstBuffer) : new Int8Array(sizeOrDstBuffer);\n if (copyBuffer) {\n buffer.set(new Int8Array(copyBuffer));\n }\n return buffer;\n }\n case 0: {\n const buffer = sizeOrDstBuffer instanceof ArrayBuffer ? new Uint8Array(sizeOrDstBuffer) : new Uint8Array(sizeOrDstBuffer);\n if (copyBuffer) {\n buffer.set(new Uint8Array(copyBuffer));\n }\n return buffer;\n }\n case 4: {\n const buffer = sizeOrDstBuffer instanceof ArrayBuffer ? new Int16Array(sizeOrDstBuffer) : new Int16Array(sizeInBytes ? sizeOrDstBuffer / 2 : sizeOrDstBuffer);\n if (copyBuffer) {\n buffer.set(new Int16Array(copyBuffer));\n }\n return buffer;\n }\n case 5:\n case 8:\n case 9:\n case 10:\n case 2: {\n const buffer = sizeOrDstBuffer instanceof ArrayBuffer ? new Uint16Array(sizeOrDstBuffer) : new Uint16Array(sizeInBytes ? sizeOrDstBuffer / 2 : sizeOrDstBuffer);\n if (copyBuffer) {\n buffer.set(new Uint16Array(copyBuffer));\n }\n return buffer;\n }\n case 6: {\n const buffer = sizeOrDstBuffer instanceof ArrayBuffer ? new Int32Array(sizeOrDstBuffer) : new Int32Array(sizeInBytes ? sizeOrDstBuffer / 4 : sizeOrDstBuffer);\n if (copyBuffer) {\n buffer.set(new Int32Array(copyBuffer));\n }\n return buffer;\n }\n case 7:\n case 11:\n case 12:\n case 13:\n case 14:\n case 15: {\n const buffer = sizeOrDstBuffer instanceof ArrayBuffer ? new Uint32Array(sizeOrDstBuffer) : new Uint32Array(sizeInBytes ? sizeOrDstBuffer / 4 : sizeOrDstBuffer);\n if (copyBuffer) {\n buffer.set(new Uint32Array(copyBuffer));\n }\n return buffer;\n }\n case 1: {\n const buffer = sizeOrDstBuffer instanceof ArrayBuffer ? new Float32Array(sizeOrDstBuffer) : new Float32Array(sizeInBytes ? sizeOrDstBuffer / 4 : sizeOrDstBuffer);\n if (copyBuffer) {\n buffer.set(new Float32Array(copyBuffer));\n }\n return buffer;\n }\n }\n const buffer = sizeOrDstBuffer instanceof ArrayBuffer ? new Uint8Array(sizeOrDstBuffer) : new Uint8Array(sizeOrDstBuffer);\n if (copyBuffer) {\n buffer.set(new Uint8Array(copyBuffer));\n }\n return buffer;\n}\nThinEngine.prototype._readTexturePixelsSync = function (texture, width, height, faceIndex = -1, level = 0, buffer = null, flushRenderer = true, noDataConversion = false, x = 0, y = 0) {\n var _a, _b;\n const gl = this._gl;\n if (!gl) {\n throw new Error(\"Engine does not have gl rendering context.\");\n }\n if (!this._dummyFramebuffer) {\n const dummy = gl.createFramebuffer();\n if (!dummy) {\n throw new Error(\"Unable to create dummy framebuffer\");\n }\n this._dummyFramebuffer = dummy;\n }\n gl.bindFramebuffer(gl.FRAMEBUFFER, this._dummyFramebuffer);\n if (faceIndex > -1) {\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, (_a = texture._hardwareTexture) === null || _a === void 0 ? void 0 : _a.underlyingResource, level);\n }\n else {\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, (_b = texture._hardwareTexture) === null || _b === void 0 ? void 0 : _b.underlyingResource, level);\n }\n let readType = texture.type !== undefined ? this._getWebGLTextureType(texture.type) : gl.UNSIGNED_BYTE;\n if (!noDataConversion) {\n switch (readType) {\n case gl.UNSIGNED_BYTE:\n if (!buffer) {\n buffer = new Uint8Array(4 * width * height);\n }\n readType = gl.UNSIGNED_BYTE;\n break;\n default:\n if (!buffer) {\n buffer = new Float32Array(4 * width * height);\n }\n readType = gl.FLOAT;\n break;\n }\n }\n else if (!buffer) {\n buffer = allocateAndCopyTypedBuffer(texture.type, 4 * width * height);\n }\n if (flushRenderer) {\n this.flushFramebuffer();\n }\n gl.readPixels(x, y, width, height, gl.RGBA, readType, buffer);\n gl.bindFramebuffer(gl.FRAMEBUFFER, this._currentFramebuffer);\n return buffer;\n};\nThinEngine.prototype._readTexturePixels = function (texture, width, height, faceIndex = -1, level = 0, buffer = null, flushRenderer = true, noDataConversion = false, x = 0, y = 0) {\n return Promise.resolve(this._readTexturePixelsSync(texture, width, height, faceIndex, level, buffer, flushRenderer, noDataConversion, x, y));\n};\n//# sourceMappingURL=engine.readTexture.js.map","import { ThinEngine } from \"../../Engines/thinEngine.js\";\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nThinEngine.prototype.updateDynamicIndexBuffer = function (indexBuffer, indices, offset = 0) {\n // Force cache update\n this._currentBoundBuffer[this._gl.ELEMENT_ARRAY_BUFFER] = null;\n this.bindIndexBuffer(indexBuffer);\n let view;\n if (indexBuffer.is32Bits) {\n // anything else than Uint32Array needs to be converted to Uint32Array\n view = indices instanceof Uint32Array ? indices : new Uint32Array(indices);\n }\n else {\n // anything else than Uint16Array needs to be converted to Uint16Array\n view = indices instanceof Uint16Array ? indices : new Uint16Array(indices);\n }\n this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, view, this._gl.DYNAMIC_DRAW);\n this._resetIndexBufferBinding();\n};\nThinEngine.prototype.updateDynamicVertexBuffer = function (vertexBuffer, data, byteOffset, byteLength) {\n this.bindArrayBuffer(vertexBuffer);\n if (byteOffset === undefined) {\n byteOffset = 0;\n }\n const dataLength = data.byteLength || data.length;\n if (byteLength === undefined || (byteLength >= dataLength && byteOffset === 0)) {\n if (data instanceof Array) {\n this._gl.bufferSubData(this._gl.ARRAY_BUFFER, byteOffset, new Float32Array(data));\n }\n else {\n this._gl.bufferSubData(this._gl.ARRAY_BUFFER, byteOffset, data);\n }\n }\n else {\n if (data instanceof Array) {\n this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, new Float32Array(data).subarray(byteOffset, byteOffset + byteLength));\n }\n else {\n if (data instanceof ArrayBuffer) {\n data = new Uint8Array(data, byteOffset, byteLength);\n }\n else {\n data = new Uint8Array(data.buffer, data.byteOffset + byteOffset, byteLength);\n }\n this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, data);\n }\n }\n this._resetVertexBufferBinding();\n};\n//# sourceMappingURL=engine.dynamicBuffer.js.map","import { Observable } from \"../Misc/observable.js\";\nimport { InternalTexture, InternalTextureSource } from \"../Materials/Textures/internalTexture.js\";\nimport { IsDocumentAvailable, IsWindowObjectExist } from \"../Misc/domManagement.js\";\nimport { EngineStore } from \"./engineStore.js\";\nimport { _WarnImport } from \"../Misc/devTools.js\";\nimport { ThinEngine } from \"./thinEngine.js\";\n\nimport { PerformanceMonitor } from \"../Misc/performanceMonitor.js\";\nimport { PerfCounter } from \"../Misc/perfCounter.js\";\nimport { WebGLDataBuffer } from \"../Meshes/WebGL/webGLDataBuffer.js\";\nimport { Logger } from \"../Misc/logger.js\";\nimport { WebGLHardwareTexture } from \"./WebGL/webGLHardwareTexture.js\";\nimport \"./Extensions/engine.alpha.js\";\nimport \"./Extensions/engine.readTexture.js\";\nimport \"./Extensions/engine.dynamicBuffer.js\";\n/**\n * The engine class is responsible for interfacing with all lower-level APIs such as WebGL and Audio\n */\nexport class Engine extends ThinEngine {\n /**\n * Returns the current npm package of the sdk\n */\n // Not mixed with Version for tooling purpose.\n static get NpmPackage() {\n return ThinEngine.NpmPackage;\n }\n /**\n * Returns the current version of the framework\n */\n static get Version() {\n return ThinEngine.Version;\n }\n /** Gets the list of created engines */\n static get Instances() {\n return EngineStore.Instances;\n }\n /**\n * Gets the latest created engine\n */\n static get LastCreatedEngine() {\n return EngineStore.LastCreatedEngine;\n }\n /**\n * Gets the latest created scene\n */\n static get LastCreatedScene() {\n return EngineStore.LastCreatedScene;\n }\n /** @internal */\n /**\n * Engine abstraction for loading and creating an image bitmap from a given source string.\n * @param imageSource source to load the image from.\n * @param options An object that sets options for the image's extraction.\n * @returns ImageBitmap.\n */\n _createImageBitmapFromSource(imageSource, options) {\n const promise = new Promise((resolve, reject) => {\n const image = new Image();\n image.onload = () => {\n image.decode().then(() => {\n this.createImageBitmap(image, options).then((imageBitmap) => {\n resolve(imageBitmap);\n });\n });\n };\n image.onerror = () => {\n reject(`Error loading image ${image.src}`);\n };\n image.src = imageSource;\n });\n return promise;\n }\n /**\n * Engine abstraction for createImageBitmap\n * @param image source for image\n * @param options An object that sets options for the image's extraction.\n * @returns ImageBitmap\n */\n createImageBitmap(image, options) {\n return createImageBitmap(image, options);\n }\n /**\n * Resize an image and returns the image data as an uint8array\n * @param image image to resize\n * @param bufferWidth destination buffer width\n * @param bufferHeight destination buffer height\n * @returns an uint8array containing RGBA values of bufferWidth * bufferHeight size\n */\n resizeImageBitmap(image, bufferWidth, bufferHeight) {\n const canvas = this.createCanvas(bufferWidth, bufferHeight);\n const context = canvas.getContext(\"2d\");\n if (!context) {\n throw new Error(\"Unable to get 2d context for resizeImageBitmap\");\n }\n context.drawImage(image, 0, 0);\n // Create VertexData from map data\n // Cast is due to wrong definition in lib.d.ts from ts 1.3 - https://github.com/Microsoft/TypeScript/issues/949\n const buffer = context.getImageData(0, 0, bufferWidth, bufferHeight).data;\n return buffer;\n }\n /**\n * Will flag all materials in all scenes in all engines as dirty to trigger new shader compilation\n * @param flag defines which part of the materials must be marked as dirty\n * @param predicate defines a predicate used to filter which materials should be affected\n */\n static MarkAllMaterialsAsDirty(flag, predicate) {\n for (let engineIndex = 0; engineIndex < Engine.Instances.length; engineIndex++) {\n const engine = Engine.Instances[engineIndex];\n for (let sceneIndex = 0; sceneIndex < engine.scenes.length; sceneIndex++) {\n engine.scenes[sceneIndex].markAllMaterialsAsDirty(flag, predicate);\n }\n }\n }\n /**\n * Method called to create the default loading screen.\n * This can be overridden in your own app.\n * @param canvas The rendering canvas element\n * @returns The loading screen\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static DefaultLoadingScreenFactory(canvas) {\n throw _WarnImport(\"LoadingScreen\");\n }\n get _supportsHardwareTextureRescaling() {\n return !!Engine._RescalePostProcessFactory;\n }\n /**\n * Gets the performance monitor attached to this engine\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/optimize_your_scene#engineinstrumentation\n */\n get performanceMonitor() {\n return this._performanceMonitor;\n }\n /**\n * (WebGPU only) True (default) to be in compatibility mode, meaning rendering all existing scenes without artifacts (same rendering than WebGL).\n * Setting the property to false will improve performances but may not work in some scenes if some precautions are not taken.\n * See https://doc.babylonjs.com/setup/support/webGPU/webGPUOptimization/webGPUNonCompatibilityMode for more details\n */\n get compatibilityMode() {\n return this._compatibilityMode;\n }\n set compatibilityMode(mode) {\n // not supported in WebGL\n this._compatibilityMode = true;\n }\n // Events\n /**\n * Gets the HTML element used to attach event listeners\n * @returns a HTML element\n */\n getInputElement() {\n return this._renderingCanvas;\n }\n /**\n * Creates a new engine\n * @param canvasOrContext defines the canvas or WebGL context to use for rendering. If you provide a WebGL context, Babylon.js will not hook events on the canvas (like pointers, keyboards, etc...) so no event observables will be available. This is mostly used when Babylon.js is used as a plugin on a system which already used the WebGL context\n * @param antialias defines enable antialiasing (default: false)\n * @param options defines further options to be sent to the getContext() function\n * @param adaptToDeviceRatio defines whether to adapt to the device's viewport characteristics (default: false)\n */\n constructor(canvasOrContext, antialias, options, adaptToDeviceRatio = false) {\n super(canvasOrContext, antialias, options, adaptToDeviceRatio);\n // Members\n /**\n * Gets or sets a boolean to enable/disable IndexedDB support and avoid XHR on .manifest\n **/\n this.enableOfflineSupport = false;\n /**\n * Gets or sets a boolean to enable/disable checking manifest if IndexedDB support is enabled (js will always consider the database is up to date)\n **/\n this.disableManifestCheck = false;\n /**\n * Gets or sets a boolean to enable/disable the context menu (right-click) from appearing on the main canvas\n */\n this.disableContextMenu = true;\n /**\n * Gets the list of created scenes\n */\n this.scenes = new Array();\n /** @internal */\n this._virtualScenes = new Array();\n /**\n * Event raised when a new scene is created\n */\n this.onNewSceneAddedObservable = new Observable();\n /**\n * Gets the list of created postprocesses\n */\n this.postProcesses = new Array();\n /**\n * Gets a boolean indicating if the pointer is currently locked\n */\n this.isPointerLock = false;\n // Observables\n /**\n * Observable event triggered each time the rendering canvas is resized\n */\n this.onResizeObservable = new Observable();\n /**\n * Observable event triggered each time the canvas loses focus\n */\n this.onCanvasBlurObservable = new Observable();\n /**\n * Observable event triggered each time the canvas gains focus\n */\n this.onCanvasFocusObservable = new Observable();\n /**\n * Observable event triggered each time the canvas receives pointerout event\n */\n this.onCanvasPointerOutObservable = new Observable();\n /**\n * Observable raised when the engine begins a new frame\n */\n this.onBeginFrameObservable = new Observable();\n /**\n * If set, will be used to request the next animation frame for the render loop\n */\n this.customAnimationFrameRequester = null;\n /**\n * Observable raised when the engine ends the current frame\n */\n this.onEndFrameObservable = new Observable();\n /**\n * Observable raised when the engine is about to compile a shader\n */\n this.onBeforeShaderCompilationObservable = new Observable();\n /**\n * Observable raised when the engine has just compiled a shader\n */\n this.onAfterShaderCompilationObservable = new Observable();\n // Deterministic lockstepMaxSteps\n this._deterministicLockstep = false;\n this._lockstepMaxSteps = 4;\n this._timeStep = 1 / 60;\n // FPS\n this._fps = 60;\n this._deltaTime = 0;\n /** @internal */\n this._drawCalls = new PerfCounter();\n /** Gets or sets the tab index to set to the rendering canvas. 1 is the minimum value to set to be able to capture keyboard events */\n this.canvasTabIndex = 1;\n /**\n * Turn this value on if you want to pause FPS computation when in background\n */\n this.disablePerformanceMonitorInBackground = false;\n this._performanceMonitor = new PerformanceMonitor();\n this._compatibilityMode = true;\n /**\n * Gets or sets the current render pass id\n */\n this.currentRenderPassId = 0;\n this._renderPassNames = [\"main\"];\n Engine.Instances.push(this);\n if (!canvasOrContext) {\n return;\n }\n this._features.supportRenderPasses = true;\n options = this._creationOptions;\n if (canvasOrContext.getContext) {\n const canvas = canvasOrContext;\n this._sharedInit(canvas);\n this._connectVREvents();\n }\n // Load WebVR Devices\n this._prepareVRComponent();\n if (options.autoEnableWebVR) {\n this.initWebVR();\n }\n }\n _initGLContext() {\n super._initGLContext();\n this._rescalePostProcess = null;\n }\n /**\n * Shared initialization across engines types.\n * @param canvas The canvas associated with this instance of the engine.\n */\n _sharedInit(canvas) {\n super._sharedInit(canvas);\n this._onCanvasFocus = () => {\n this.onCanvasFocusObservable.notifyObservers(this);\n };\n this._onCanvasBlur = () => {\n this.onCanvasBlurObservable.notifyObservers(this);\n };\n this._onCanvasContextMenu = (evt) => {\n if (this.disableContextMenu) {\n evt.preventDefault();\n }\n };\n canvas.addEventListener(\"focus\", this._onCanvasFocus);\n canvas.addEventListener(\"blur\", this._onCanvasBlur);\n canvas.addEventListener(\"contextmenu\", this._onCanvasContextMenu);\n this._onBlur = () => {\n if (this.disablePerformanceMonitorInBackground) {\n this._performanceMonitor.disable();\n }\n this._windowIsBackground = true;\n };\n this._onFocus = () => {\n if (this.disablePerformanceMonitorInBackground) {\n this._performanceMonitor.enable();\n }\n this._windowIsBackground = false;\n };\n this._onCanvasPointerOut = (ev) => {\n // Check that the element at the point of the pointer out isn't the canvas and if it isn't, notify observers\n // Note: This is a workaround for a bug with Safari\n if (document.elementFromPoint(ev.clientX, ev.clientY) !== canvas) {\n this.onCanvasPointerOutObservable.notifyObservers(ev);\n }\n };\n const hostWindow = this.getHostWindow(); // it calls IsWindowObjectExist()\n if (hostWindow && typeof hostWindow.addEventListener === \"function\") {\n hostWindow.addEventListener(\"blur\", this._onBlur);\n hostWindow.addEventListener(\"focus\", this._onFocus);\n }\n canvas.addEventListener(\"pointerout\", this._onCanvasPointerOut);\n if (!this._creationOptions.doNotHandleTouchAction) {\n this._disableTouchAction();\n }\n // Create Audio Engine if needed.\n if (!Engine.audioEngine && this._creationOptions.audioEngine && Engine.AudioEngineFactory) {\n Engine.audioEngine = Engine.AudioEngineFactory(this.getRenderingCanvas(), this.getAudioContext(), this.getAudioDestination());\n }\n if (IsDocumentAvailable()) {\n // Fullscreen\n this._onFullscreenChange = () => {\n this.isFullscreen = !!document.fullscreenElement;\n // Pointer lock\n if (this.isFullscreen && this._pointerLockRequested && canvas) {\n Engine._RequestPointerlock(canvas);\n }\n };\n document.addEventListener(\"fullscreenchange\", this._onFullscreenChange, false);\n document.addEventListener(\"webkitfullscreenchange\", this._onFullscreenChange, false);\n // Pointer lock\n this._onPointerLockChange = () => {\n this.isPointerLock = document.pointerLockElement === canvas;\n };\n document.addEventListener(\"pointerlockchange\", this._onPointerLockChange, false);\n document.addEventListener(\"webkitpointerlockchange\", this._onPointerLockChange, false);\n }\n this.enableOfflineSupport = Engine.OfflineProviderFactory !== undefined;\n this._deterministicLockstep = !!this._creationOptions.deterministicLockstep;\n this._lockstepMaxSteps = this._creationOptions.lockstepMaxSteps || 0;\n this._timeStep = this._creationOptions.timeStep || 1 / 60;\n }\n /** @internal */\n _verifyPointerLock() {\n var _a;\n (_a = this._onPointerLockChange) === null || _a === void 0 ? void 0 : _a.call(this);\n }\n /**\n * Gets current aspect ratio\n * @param viewportOwner defines the camera to use to get the aspect ratio\n * @param useScreen defines if screen size must be used (or the current render target if any)\n * @returns a number defining the aspect ratio\n */\n getAspectRatio(viewportOwner, useScreen = false) {\n const viewport = viewportOwner.viewport;\n return (this.getRenderWidth(useScreen) * viewport.width) / (this.getRenderHeight(useScreen) * viewport.height);\n }\n /**\n * Gets current screen aspect ratio\n * @returns a number defining the aspect ratio\n */\n getScreenAspectRatio() {\n return this.getRenderWidth(true) / this.getRenderHeight(true);\n }\n /**\n * Gets the client rect of the HTML canvas attached with the current webGL context\n * @returns a client rectangle\n */\n getRenderingCanvasClientRect() {\n if (!this._renderingCanvas) {\n return null;\n }\n return this._renderingCanvas.getBoundingClientRect();\n }\n /**\n * Gets the client rect of the HTML element used for events\n * @returns a client rectangle\n */\n getInputElementClientRect() {\n if (!this._renderingCanvas) {\n return null;\n }\n return this.getInputElement().getBoundingClientRect();\n }\n /**\n * Gets a boolean indicating that the engine is running in deterministic lock step mode\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#deterministic-lockstep\n * @returns true if engine is in deterministic lock step mode\n */\n isDeterministicLockStep() {\n return this._deterministicLockstep;\n }\n /**\n * Gets the max steps when engine is running in deterministic lock step\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#deterministic-lockstep\n * @returns the max steps\n */\n getLockstepMaxSteps() {\n return this._lockstepMaxSteps;\n }\n /**\n * Returns the time in ms between steps when using deterministic lock step.\n * @returns time step in (ms)\n */\n getTimeStep() {\n return this._timeStep * 1000;\n }\n /**\n * Force the mipmap generation for the given render target texture\n * @param texture defines the render target texture to use\n * @param unbind defines whether or not to unbind the texture after generation. Defaults to true.\n */\n generateMipMapsForCubemap(texture, unbind = true) {\n if (texture.generateMipMaps) {\n const gl = this._gl;\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true);\n gl.generateMipmap(gl.TEXTURE_CUBE_MAP);\n if (unbind) {\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, null);\n }\n }\n }\n /** States */\n /**\n * Gets a boolean indicating if depth writing is enabled\n * @returns the current depth writing state\n */\n getDepthWrite() {\n return this._depthCullingState.depthMask;\n }\n /**\n * Enable or disable depth writing\n * @param enable defines the state to set\n */\n setDepthWrite(enable) {\n this._depthCullingState.depthMask = enable;\n }\n /**\n * Gets a boolean indicating if stencil buffer is enabled\n * @returns the current stencil buffer state\n */\n getStencilBuffer() {\n return this._stencilState.stencilTest;\n }\n /**\n * Enable or disable the stencil buffer\n * @param enable defines if the stencil buffer must be enabled or disabled\n */\n setStencilBuffer(enable) {\n this._stencilState.stencilTest = enable;\n }\n /**\n * Gets the current stencil mask\n * @returns a number defining the new stencil mask to use\n */\n getStencilMask() {\n return this._stencilState.stencilMask;\n }\n /**\n * Sets the current stencil mask\n * @param mask defines the new stencil mask to use\n */\n setStencilMask(mask) {\n this._stencilState.stencilMask = mask;\n }\n /**\n * Gets the current stencil function\n * @returns a number defining the stencil function to use\n */\n getStencilFunction() {\n return this._stencilState.stencilFunc;\n }\n /**\n * Gets the current stencil reference value\n * @returns a number defining the stencil reference value to use\n */\n getStencilFunctionReference() {\n return this._stencilState.stencilFuncRef;\n }\n /**\n * Gets the current stencil mask\n * @returns a number defining the stencil mask to use\n */\n getStencilFunctionMask() {\n return this._stencilState.stencilFuncMask;\n }\n /**\n * Sets the current stencil function\n * @param stencilFunc defines the new stencil function to use\n */\n setStencilFunction(stencilFunc) {\n this._stencilState.stencilFunc = stencilFunc;\n }\n /**\n * Sets the current stencil reference\n * @param reference defines the new stencil reference to use\n */\n setStencilFunctionReference(reference) {\n this._stencilState.stencilFuncRef = reference;\n }\n /**\n * Sets the current stencil mask\n * @param mask defines the new stencil mask to use\n */\n setStencilFunctionMask(mask) {\n this._stencilState.stencilFuncMask = mask;\n }\n /**\n * Gets the current stencil operation when stencil fails\n * @returns a number defining stencil operation to use when stencil fails\n */\n getStencilOperationFail() {\n return this._stencilState.stencilOpStencilFail;\n }\n /**\n * Gets the current stencil operation when depth fails\n * @returns a number defining stencil operation to use when depth fails\n */\n getStencilOperationDepthFail() {\n return this._stencilState.stencilOpDepthFail;\n }\n /**\n * Gets the current stencil operation when stencil passes\n * @returns a number defining stencil operation to use when stencil passes\n */\n getStencilOperationPass() {\n return this._stencilState.stencilOpStencilDepthPass;\n }\n /**\n * Sets the stencil operation to use when stencil fails\n * @param operation defines the stencil operation to use when stencil fails\n */\n setStencilOperationFail(operation) {\n this._stencilState.stencilOpStencilFail = operation;\n }\n /**\n * Sets the stencil operation to use when depth fails\n * @param operation defines the stencil operation to use when depth fails\n */\n setStencilOperationDepthFail(operation) {\n this._stencilState.stencilOpDepthFail = operation;\n }\n /**\n * Sets the stencil operation to use when stencil passes\n * @param operation defines the stencil operation to use when stencil passes\n */\n setStencilOperationPass(operation) {\n this._stencilState.stencilOpStencilDepthPass = operation;\n }\n /**\n * Sets a boolean indicating if the dithering state is enabled or disabled\n * @param value defines the dithering state\n */\n setDitheringState(value) {\n if (value) {\n this._gl.enable(this._gl.DITHER);\n }\n else {\n this._gl.disable(this._gl.DITHER);\n }\n }\n /**\n * Sets a boolean indicating if the rasterizer state is enabled or disabled\n * @param value defines the rasterizer state\n */\n setRasterizerState(value) {\n if (value) {\n this._gl.disable(this._gl.RASTERIZER_DISCARD);\n }\n else {\n this._gl.enable(this._gl.RASTERIZER_DISCARD);\n }\n }\n /**\n * Gets the current depth function\n * @returns a number defining the depth function\n */\n getDepthFunction() {\n return this._depthCullingState.depthFunc;\n }\n /**\n * Sets the current depth function\n * @param depthFunc defines the function to use\n */\n setDepthFunction(depthFunc) {\n this._depthCullingState.depthFunc = depthFunc;\n }\n /**\n * Sets the current depth function to GREATER\n */\n setDepthFunctionToGreater() {\n this.setDepthFunction(516);\n }\n /**\n * Sets the current depth function to GEQUAL\n */\n setDepthFunctionToGreaterOrEqual() {\n this.setDepthFunction(518);\n }\n /**\n * Sets the current depth function to LESS\n */\n setDepthFunctionToLess() {\n this.setDepthFunction(513);\n }\n /**\n * Sets the current depth function to LEQUAL\n */\n setDepthFunctionToLessOrEqual() {\n this.setDepthFunction(515);\n }\n /**\n * Caches the the state of the stencil buffer\n */\n cacheStencilState() {\n this._cachedStencilBuffer = this.getStencilBuffer();\n this._cachedStencilFunction = this.getStencilFunction();\n this._cachedStencilMask = this.getStencilMask();\n this._cachedStencilOperationPass = this.getStencilOperationPass();\n this._cachedStencilOperationFail = this.getStencilOperationFail();\n this._cachedStencilOperationDepthFail = this.getStencilOperationDepthFail();\n this._cachedStencilReference = this.getStencilFunctionReference();\n }\n /**\n * Restores the state of the stencil buffer\n */\n restoreStencilState() {\n this.setStencilFunction(this._cachedStencilFunction);\n this.setStencilMask(this._cachedStencilMask);\n this.setStencilBuffer(this._cachedStencilBuffer);\n this.setStencilOperationPass(this._cachedStencilOperationPass);\n this.setStencilOperationFail(this._cachedStencilOperationFail);\n this.setStencilOperationDepthFail(this._cachedStencilOperationDepthFail);\n this.setStencilFunctionReference(this._cachedStencilReference);\n }\n /**\n * Directly set the WebGL Viewport\n * @param x defines the x coordinate of the viewport (in screen space)\n * @param y defines the y coordinate of the viewport (in screen space)\n * @param width defines the width of the viewport (in screen space)\n * @param height defines the height of the viewport (in screen space)\n * @returns the current viewport Object (if any) that is being replaced by this call. You can restore this viewport later on to go back to the original state\n */\n setDirectViewport(x, y, width, height) {\n const currentViewport = this._cachedViewport;\n this._cachedViewport = null;\n this._viewport(x, y, width, height);\n return currentViewport;\n }\n /**\n * Executes a scissor clear (ie. a clear on a specific portion of the screen)\n * @param x defines the x-coordinate of the bottom left corner of the clear rectangle\n * @param y defines the y-coordinate of the corner of the clear rectangle\n * @param width defines the width of the clear rectangle\n * @param height defines the height of the clear rectangle\n * @param clearColor defines the clear color\n */\n scissorClear(x, y, width, height, clearColor) {\n this.enableScissor(x, y, width, height);\n this.clear(clearColor, true, true, true);\n this.disableScissor();\n }\n /**\n * Enable scissor test on a specific rectangle (ie. render will only be executed on a specific portion of the screen)\n * @param x defines the x-coordinate of the bottom left corner of the clear rectangle\n * @param y defines the y-coordinate of the corner of the clear rectangle\n * @param width defines the width of the clear rectangle\n * @param height defines the height of the clear rectangle\n */\n enableScissor(x, y, width, height) {\n const gl = this._gl;\n // Change state\n gl.enable(gl.SCISSOR_TEST);\n gl.scissor(x, y, width, height);\n }\n /**\n * Disable previously set scissor test rectangle\n */\n disableScissor() {\n const gl = this._gl;\n gl.disable(gl.SCISSOR_TEST);\n }\n /**\n * @internal\n */\n _reportDrawCall(numDrawCalls = 1) {\n this._drawCalls.addCount(numDrawCalls, false);\n }\n /**\n * Initializes a webVR display and starts listening to display change events\n * The onVRDisplayChangedObservable will be notified upon these changes\n * @returns The onVRDisplayChangedObservable\n */\n initWebVR() {\n throw _WarnImport(\"WebVRCamera\");\n }\n /** @internal */\n _prepareVRComponent() {\n // Do nothing as the engine side effect will overload it\n }\n /**\n * @internal\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _connectVREvents(canvas, document) {\n // Do nothing as the engine side effect will overload it\n }\n /** @internal */\n _submitVRFrame() {\n // Do nothing as the engine side effect will overload it\n }\n /**\n * Call this function to leave webVR mode\n * Will do nothing if webVR is not supported or if there is no webVR device\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/webVRCamera\n */\n disableVR() {\n // Do nothing as the engine side effect will overload it\n }\n /**\n * Gets a boolean indicating that the system is in VR mode and is presenting\n * @returns true if VR mode is engaged\n */\n isVRPresenting() {\n return false;\n }\n /** @internal */\n _requestVRFrame() {\n // Do nothing as the engine side effect will overload it\n }\n /**\n * @internal\n */\n _loadFileAsync(url, offlineProvider, useArrayBuffer) {\n return new Promise((resolve, reject) => {\n this._loadFile(url, (data) => {\n resolve(data);\n }, undefined, offlineProvider, useArrayBuffer, (request, exception) => {\n reject(exception);\n });\n });\n }\n /**\n * Gets the source code of the vertex shader associated with a specific webGL program\n * @param program defines the program to use\n * @returns a string containing the source code of the vertex shader associated with the program\n */\n getVertexShaderSource(program) {\n const shaders = this._gl.getAttachedShaders(program);\n if (!shaders) {\n return null;\n }\n return this._gl.getShaderSource(shaders[0]);\n }\n /**\n * Gets the source code of the fragment shader associated with a specific webGL program\n * @param program defines the program to use\n * @returns a string containing the source code of the fragment shader associated with the program\n */\n getFragmentShaderSource(program) {\n const shaders = this._gl.getAttachedShaders(program);\n if (!shaders) {\n return null;\n }\n return this._gl.getShaderSource(shaders[1]);\n }\n /**\n * Sets a depth stencil texture from a render target to the according uniform.\n * @param channel The texture channel\n * @param uniform The uniform to set\n * @param texture The render target texture containing the depth stencil texture to apply\n * @param name The texture name\n */\n setDepthStencilTexture(channel, uniform, texture, name) {\n if (channel === undefined) {\n return;\n }\n if (uniform) {\n this._boundUniforms[channel] = uniform;\n }\n if (!texture || !texture.depthStencilTexture) {\n this._setTexture(channel, null, undefined, undefined, name);\n }\n else {\n this._setTexture(channel, texture, false, true, name);\n }\n }\n /**\n * Sets a texture to the webGL context from a postprocess\n * @param channel defines the channel to use\n * @param postProcess defines the source postprocess\n * @param name name of the channel\n */\n setTextureFromPostProcess(channel, postProcess, name) {\n var _a;\n let postProcessInput = null;\n if (postProcess) {\n if (postProcess._forcedOutputTexture) {\n postProcessInput = postProcess._forcedOutputTexture;\n }\n else if (postProcess._textures.data[postProcess._currentRenderTextureInd]) {\n postProcessInput = postProcess._textures.data[postProcess._currentRenderTextureInd];\n }\n }\n this._bindTexture(channel, (_a = postProcessInput === null || postProcessInput === void 0 ? void 0 : postProcessInput.texture) !== null && _a !== void 0 ? _a : null, name);\n }\n /**\n * Binds the output of the passed in post process to the texture channel specified\n * @param channel The channel the texture should be bound to\n * @param postProcess The post process which's output should be bound\n * @param name name of the channel\n */\n setTextureFromPostProcessOutput(channel, postProcess, name) {\n var _a, _b;\n this._bindTexture(channel, (_b = (_a = postProcess === null || postProcess === void 0 ? void 0 : postProcess._outputTexture) === null || _a === void 0 ? void 0 : _a.texture) !== null && _b !== void 0 ? _b : null, name);\n }\n _rebuildBuffers() {\n // Index / Vertex\n for (const scene of this.scenes) {\n scene.resetCachedMaterial();\n scene._rebuildGeometries();\n scene._rebuildTextures();\n }\n for (const scene of this._virtualScenes) {\n scene.resetCachedMaterial();\n scene._rebuildGeometries();\n scene._rebuildTextures();\n }\n super._rebuildBuffers();\n }\n /** @internal */\n _renderFrame() {\n for (let index = 0; index < this._activeRenderLoops.length; index++) {\n const renderFunction = this._activeRenderLoops[index];\n renderFunction();\n }\n }\n _cancelFrame() {\n if (this._renderingQueueLaunched && this.customAnimationFrameRequester) {\n this._renderingQueueLaunched = false;\n const { cancelAnimationFrame } = this.customAnimationFrameRequester;\n if (cancelAnimationFrame) {\n cancelAnimationFrame(this.customAnimationFrameRequester.requestID);\n }\n }\n else {\n super._cancelFrame();\n }\n }\n _renderLoop() {\n if (!this._contextWasLost) {\n let shouldRender = true;\n if (this.isDisposed || (!this.renderEvenInBackground && this._windowIsBackground)) {\n shouldRender = false;\n }\n if (shouldRender) {\n // Start new frame\n this.beginFrame();\n // Child canvases\n if (!this._renderViews()) {\n // Main frame\n this._renderFrame();\n }\n // Present\n this.endFrame();\n }\n }\n if (this._activeRenderLoops.length > 0) {\n // Register new frame\n if (this.customAnimationFrameRequester) {\n this.customAnimationFrameRequester.requestID = this._queueNewFrame(this.customAnimationFrameRequester.renderFunction || this._boundRenderFunction, this.customAnimationFrameRequester);\n this._frameHandler = this.customAnimationFrameRequester.requestID;\n }\n else if (this.isVRPresenting()) {\n this._requestVRFrame();\n }\n else {\n this._frameHandler = this._queueNewFrame(this._boundRenderFunction, this.getHostWindow());\n }\n }\n else {\n this._renderingQueueLaunched = false;\n }\n }\n /** @internal */\n _renderViews() {\n return false;\n }\n /**\n * Toggle full screen mode\n * @param requestPointerLock defines if a pointer lock should be requested from the user\n */\n switchFullscreen(requestPointerLock) {\n if (this.isFullscreen) {\n this.exitFullscreen();\n }\n else {\n this.enterFullscreen(requestPointerLock);\n }\n }\n /**\n * Enters full screen mode\n * @param requestPointerLock defines if a pointer lock should be requested from the user\n */\n enterFullscreen(requestPointerLock) {\n if (!this.isFullscreen) {\n this._pointerLockRequested = requestPointerLock;\n if (this._renderingCanvas) {\n Engine._RequestFullscreen(this._renderingCanvas);\n }\n }\n }\n /**\n * Exits full screen mode\n */\n exitFullscreen() {\n if (this.isFullscreen) {\n Engine._ExitFullscreen();\n }\n }\n /**\n * Enters Pointerlock mode\n */\n enterPointerlock() {\n if (this._renderingCanvas) {\n Engine._RequestPointerlock(this._renderingCanvas);\n }\n }\n /**\n * Exits Pointerlock mode\n */\n exitPointerlock() {\n Engine._ExitPointerlock();\n }\n /**\n * Begin a new frame\n */\n beginFrame() {\n this._measureFps();\n this.onBeginFrameObservable.notifyObservers(this);\n super.beginFrame();\n }\n /**\n * End the current frame\n */\n endFrame() {\n super.endFrame();\n this._submitVRFrame();\n this.onEndFrameObservable.notifyObservers(this);\n }\n /**\n * Resize the view according to the canvas' size\n * @param forceSetSize true to force setting the sizes of the underlying canvas\n */\n resize(forceSetSize = false) {\n // We're not resizing the size of the canvas while in VR mode & presenting\n if (this.isVRPresenting()) {\n return;\n }\n super.resize(forceSetSize);\n }\n /**\n * Force a specific size of the canvas\n * @param width defines the new canvas' width\n * @param height defines the new canvas' height\n * @param forceSetSize true to force setting the sizes of the underlying canvas\n * @returns true if the size was changed\n */\n setSize(width, height, forceSetSize = false) {\n if (!this._renderingCanvas) {\n return false;\n }\n if (!super.setSize(width, height, forceSetSize)) {\n return false;\n }\n if (this.scenes) {\n for (let index = 0; index < this.scenes.length; index++) {\n const scene = this.scenes[index];\n for (let camIndex = 0; camIndex < scene.cameras.length; camIndex++) {\n const cam = scene.cameras[camIndex];\n cam._currentRenderId = 0;\n }\n }\n if (this.onResizeObservable.hasObservers()) {\n this.onResizeObservable.notifyObservers(this);\n }\n }\n return true;\n }\n _deletePipelineContext(pipelineContext) {\n const webGLPipelineContext = pipelineContext;\n if (webGLPipelineContext && webGLPipelineContext.program) {\n if (webGLPipelineContext.transformFeedback) {\n this.deleteTransformFeedback(webGLPipelineContext.transformFeedback);\n webGLPipelineContext.transformFeedback = null;\n }\n }\n super._deletePipelineContext(pipelineContext);\n }\n createShaderProgram(pipelineContext, vertexCode, fragmentCode, defines, context, transformFeedbackVaryings = null) {\n context = context || this._gl;\n this.onBeforeShaderCompilationObservable.notifyObservers(this);\n const program = super.createShaderProgram(pipelineContext, vertexCode, fragmentCode, defines, context, transformFeedbackVaryings);\n this.onAfterShaderCompilationObservable.notifyObservers(this);\n return program;\n }\n _createShaderProgram(pipelineContext, vertexShader, fragmentShader, context, transformFeedbackVaryings = null) {\n const shaderProgram = context.createProgram();\n pipelineContext.program = shaderProgram;\n if (!shaderProgram) {\n throw new Error(\"Unable to create program\");\n }\n context.attachShader(shaderProgram, vertexShader);\n context.attachShader(shaderProgram, fragmentShader);\n if (this.webGLVersion > 1 && transformFeedbackVaryings) {\n const transformFeedback = this.createTransformFeedback();\n this.bindTransformFeedback(transformFeedback);\n this.setTranformFeedbackVaryings(shaderProgram, transformFeedbackVaryings);\n pipelineContext.transformFeedback = transformFeedback;\n }\n context.linkProgram(shaderProgram);\n if (this.webGLVersion > 1 && transformFeedbackVaryings) {\n this.bindTransformFeedback(null);\n }\n pipelineContext.context = context;\n pipelineContext.vertexShader = vertexShader;\n pipelineContext.fragmentShader = fragmentShader;\n if (!pipelineContext.isParallelCompiled) {\n this._finalizePipelineContext(pipelineContext);\n }\n return shaderProgram;\n }\n /**\n * @internal\n */\n _releaseTexture(texture) {\n super._releaseTexture(texture);\n }\n /**\n * @internal\n */\n _releaseRenderTargetWrapper(rtWrapper) {\n super._releaseRenderTargetWrapper(rtWrapper);\n // Set output texture of post process to null if the framebuffer has been released/disposed\n this.scenes.forEach((scene) => {\n scene.postProcesses.forEach((postProcess) => {\n if (postProcess._outputTexture === rtWrapper) {\n postProcess._outputTexture = null;\n }\n });\n scene.cameras.forEach((camera) => {\n camera._postProcesses.forEach((postProcess) => {\n if (postProcess) {\n if (postProcess._outputTexture === rtWrapper) {\n postProcess._outputTexture = null;\n }\n }\n });\n });\n });\n }\n /**\n * Gets the names of the render passes that are currently created\n * @returns list of the render pass names\n */\n getRenderPassNames() {\n return this._renderPassNames;\n }\n /**\n * Gets the name of the current render pass\n * @returns name of the current render pass\n */\n getCurrentRenderPassName() {\n return this._renderPassNames[this.currentRenderPassId];\n }\n /**\n * Creates a render pass id\n * @param name Name of the render pass (for debug purpose only)\n * @returns the id of the new render pass\n */\n createRenderPassId(name) {\n // Note: render pass id == 0 is always for the main render pass\n const id = ++Engine._RenderPassIdCounter;\n this._renderPassNames[id] = name !== null && name !== void 0 ? name : \"NONAME\";\n return id;\n }\n /**\n * Releases a render pass id\n * @param id id of the render pass to release\n */\n releaseRenderPassId(id) {\n this._renderPassNames[id] = undefined;\n for (let s = 0; s < this.scenes.length; ++s) {\n const scene = this.scenes[s];\n for (let m = 0; m < scene.meshes.length; ++m) {\n const mesh = scene.meshes[m];\n if (mesh.subMeshes) {\n for (let b = 0; b < mesh.subMeshes.length; ++b) {\n const subMesh = mesh.subMeshes[b];\n subMesh._removeDrawWrapper(id);\n }\n }\n }\n }\n }\n /**\n * @internal\n * Rescales a texture\n * @param source input texture\n * @param destination destination texture\n * @param scene scene to use to render the resize\n * @param internalFormat format to use when resizing\n * @param onComplete callback to be called when resize has completed\n */\n _rescaleTexture(source, destination, scene, internalFormat, onComplete) {\n this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MAG_FILTER, this._gl.LINEAR);\n this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MIN_FILTER, this._gl.LINEAR);\n this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_S, this._gl.CLAMP_TO_EDGE);\n this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_T, this._gl.CLAMP_TO_EDGE);\n const rtt = this.createRenderTargetTexture({\n width: destination.width,\n height: destination.height,\n }, {\n generateMipMaps: false,\n type: 0,\n samplingMode: 2,\n generateDepthBuffer: false,\n generateStencilBuffer: false,\n });\n if (!this._rescalePostProcess && Engine._RescalePostProcessFactory) {\n this._rescalePostProcess = Engine._RescalePostProcessFactory(this);\n }\n if (this._rescalePostProcess) {\n this._rescalePostProcess.externalTextureSamplerBinding = true;\n this._rescalePostProcess.getEffect().executeWhenCompiled(() => {\n this._rescalePostProcess.onApply = function (effect) {\n effect._bindTexture(\"textureSampler\", source);\n };\n let hostingScene = scene;\n if (!hostingScene) {\n hostingScene = this.scenes[this.scenes.length - 1];\n }\n hostingScene.postProcessManager.directRender([this._rescalePostProcess], rtt, true);\n this._bindTextureDirectly(this._gl.TEXTURE_2D, destination, true);\n this._gl.copyTexImage2D(this._gl.TEXTURE_2D, 0, internalFormat, 0, 0, destination.width, destination.height, 0);\n this.unBindFramebuffer(rtt);\n rtt.dispose();\n if (onComplete) {\n onComplete();\n }\n });\n }\n }\n // FPS\n /**\n * Gets the current framerate\n * @returns a number representing the framerate\n */\n getFps() {\n return this._fps;\n }\n /**\n * Gets the time spent between current and previous frame\n * @returns a number representing the delta time in ms\n */\n getDeltaTime() {\n return this._deltaTime;\n }\n _measureFps() {\n this._performanceMonitor.sampleFrame();\n this._fps = this._performanceMonitor.averageFPS;\n this._deltaTime = this._performanceMonitor.instantaneousFrameTime || 0;\n }\n /**\n * Wraps an external web gl texture in a Babylon texture.\n * @param texture defines the external texture\n * @param hasMipMaps defines whether the external texture has mip maps (default: false)\n * @param samplingMode defines the sampling mode for the external texture (default: 3)\n * @returns the babylon internal texture\n */\n wrapWebGLTexture(texture, hasMipMaps = false, samplingMode = 3) {\n const hardwareTexture = new WebGLHardwareTexture(texture, this._gl);\n const internalTexture = new InternalTexture(this, InternalTextureSource.Unknown, true);\n internalTexture._hardwareTexture = hardwareTexture;\n internalTexture.isReady = true;\n internalTexture.useMipMaps = hasMipMaps;\n this.updateTextureSamplingMode(samplingMode, internalTexture);\n return internalTexture;\n }\n /**\n * @internal\n */\n _uploadImageToTexture(texture, image, faceIndex = 0, lod = 0) {\n const gl = this._gl;\n const textureType = this._getWebGLTextureType(texture.type);\n const format = this._getInternalFormat(texture.format);\n const internalFormat = this._getRGBABufferInternalSizedFormat(texture.type, format);\n const bindTarget = texture.isCube ? gl.TEXTURE_CUBE_MAP : gl.TEXTURE_2D;\n this._bindTextureDirectly(bindTarget, texture, true);\n this._unpackFlipY(texture.invertY);\n let target = gl.TEXTURE_2D;\n if (texture.isCube) {\n target = gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex;\n }\n gl.texImage2D(target, lod, internalFormat, format, textureType, image);\n this._bindTextureDirectly(bindTarget, null, true);\n }\n /**\n * Updates a depth texture Comparison Mode and Function.\n * If the comparison Function is equal to 0, the mode will be set to none.\n * Otherwise, this only works in webgl 2 and requires a shadow sampler in the shader.\n * @param texture The texture to set the comparison function for\n * @param comparisonFunction The comparison function to set, 0 if no comparison required\n */\n updateTextureComparisonFunction(texture, comparisonFunction) {\n if (this.webGLVersion === 1) {\n Logger.Error(\"WebGL 1 does not support texture comparison.\");\n return;\n }\n const gl = this._gl;\n if (texture.isCube) {\n this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, texture, true);\n if (comparisonFunction === 0) {\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_COMPARE_FUNC, 515);\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_COMPARE_MODE, gl.NONE);\n }\n else {\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_COMPARE_FUNC, comparisonFunction);\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_COMPARE_MODE, gl.COMPARE_REF_TO_TEXTURE);\n }\n this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null);\n }\n else {\n this._bindTextureDirectly(this._gl.TEXTURE_2D, texture, true);\n if (comparisonFunction === 0) {\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_COMPARE_FUNC, 515);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_COMPARE_MODE, gl.NONE);\n }\n else {\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_COMPARE_FUNC, comparisonFunction);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_COMPARE_MODE, gl.COMPARE_REF_TO_TEXTURE);\n }\n this._bindTextureDirectly(this._gl.TEXTURE_2D, null);\n }\n texture._comparisonFunction = comparisonFunction;\n }\n /**\n * Creates a webGL buffer to use with instantiation\n * @param capacity defines the size of the buffer\n * @returns the webGL buffer\n */\n createInstancesBuffer(capacity) {\n const buffer = this._gl.createBuffer();\n if (!buffer) {\n throw new Error(\"Unable to create instance buffer\");\n }\n const result = new WebGLDataBuffer(buffer);\n result.capacity = capacity;\n this.bindArrayBuffer(result);\n this._gl.bufferData(this._gl.ARRAY_BUFFER, capacity, this._gl.DYNAMIC_DRAW);\n result.references = 1;\n return result;\n }\n /**\n * Delete a webGL buffer used with instantiation\n * @param buffer defines the webGL buffer to delete\n */\n deleteInstancesBuffer(buffer) {\n this._gl.deleteBuffer(buffer);\n }\n _clientWaitAsync(sync, flags = 0, intervalms = 10) {\n const gl = this._gl;\n return new Promise((resolve, reject) => {\n const check = () => {\n const res = gl.clientWaitSync(sync, flags, 0);\n if (res == gl.WAIT_FAILED) {\n reject();\n return;\n }\n if (res == gl.TIMEOUT_EXPIRED) {\n setTimeout(check, intervalms);\n return;\n }\n resolve();\n };\n check();\n });\n }\n /**\n * @internal\n */\n _readPixelsAsync(x, y, w, h, format, type, outputBuffer) {\n if (this._webGLVersion < 2) {\n throw new Error(\"_readPixelsAsync only work on WebGL2+\");\n }\n const gl = this._gl;\n const buf = gl.createBuffer();\n gl.bindBuffer(gl.PIXEL_PACK_BUFFER, buf);\n gl.bufferData(gl.PIXEL_PACK_BUFFER, outputBuffer.byteLength, gl.STREAM_READ);\n gl.readPixels(x, y, w, h, format, type, 0);\n gl.bindBuffer(gl.PIXEL_PACK_BUFFER, null);\n const sync = gl.fenceSync(gl.SYNC_GPU_COMMANDS_COMPLETE, 0);\n if (!sync) {\n return null;\n }\n gl.flush();\n return this._clientWaitAsync(sync, 0, 10).then(() => {\n gl.deleteSync(sync);\n gl.bindBuffer(gl.PIXEL_PACK_BUFFER, buf);\n gl.getBufferSubData(gl.PIXEL_PACK_BUFFER, 0, outputBuffer);\n gl.bindBuffer(gl.PIXEL_PACK_BUFFER, null);\n gl.deleteBuffer(buf);\n return outputBuffer;\n });\n }\n dispose() {\n this.hideLoadingUI();\n this.onNewSceneAddedObservable.clear();\n // Release postProcesses\n while (this.postProcesses.length) {\n this.postProcesses[0].dispose();\n }\n // Rescale PP\n if (this._rescalePostProcess) {\n this._rescalePostProcess.dispose();\n }\n // Release scenes\n while (this.scenes.length) {\n this.scenes[0].dispose();\n }\n while (this._virtualScenes.length) {\n this._virtualScenes[0].dispose();\n }\n // Release audio engine\n if (EngineStore.Instances.length === 1 && Engine.audioEngine) {\n Engine.audioEngine.dispose();\n Engine.audioEngine = null;\n }\n //WebVR\n this.disableVR();\n // Events\n const hostWindow = this.getHostWindow(); // it calls IsWindowObjectExist()\n if (hostWindow && typeof hostWindow.removeEventListener === \"function\") {\n hostWindow.removeEventListener(\"blur\", this._onBlur);\n hostWindow.removeEventListener(\"focus\", this._onFocus);\n }\n if (this._renderingCanvas) {\n this._renderingCanvas.removeEventListener(\"focus\", this._onCanvasFocus);\n this._renderingCanvas.removeEventListener(\"blur\", this._onCanvasBlur);\n this._renderingCanvas.removeEventListener(\"pointerout\", this._onCanvasPointerOut);\n this._renderingCanvas.removeEventListener(\"contextmenu\", this._onCanvasContextMenu);\n }\n if (IsDocumentAvailable()) {\n document.removeEventListener(\"fullscreenchange\", this._onFullscreenChange);\n document.removeEventListener(\"mozfullscreenchange\", this._onFullscreenChange);\n document.removeEventListener(\"webkitfullscreenchange\", this._onFullscreenChange);\n document.removeEventListener(\"msfullscreenchange\", this._onFullscreenChange);\n document.removeEventListener(\"pointerlockchange\", this._onPointerLockChange);\n document.removeEventListener(\"mspointerlockchange\", this._onPointerLockChange);\n document.removeEventListener(\"mozpointerlockchange\", this._onPointerLockChange);\n document.removeEventListener(\"webkitpointerlockchange\", this._onPointerLockChange);\n }\n super.dispose();\n // Remove from Instances\n const index = EngineStore.Instances.indexOf(this);\n if (index >= 0) {\n EngineStore.Instances.splice(index, 1);\n }\n // no more engines left in the engine store? Notify!\n if (!Engine.Instances.length) {\n EngineStore.OnEnginesDisposedObservable.notifyObservers(this);\n }\n // Observables\n this.onResizeObservable.clear();\n this.onCanvasBlurObservable.clear();\n this.onCanvasFocusObservable.clear();\n this.onCanvasPointerOutObservable.clear();\n this.onBeginFrameObservable.clear();\n this.onEndFrameObservable.clear();\n }\n _disableTouchAction() {\n if (!this._renderingCanvas || !this._renderingCanvas.setAttribute) {\n return;\n }\n this._renderingCanvas.setAttribute(\"touch-action\", \"none\");\n this._renderingCanvas.style.touchAction = \"none\";\n this._renderingCanvas.style.webkitTapHighlightColor = \"transparent\";\n }\n // Loading screen\n /**\n * Display the loading screen\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/customLoadingScreen\n */\n displayLoadingUI() {\n if (!IsWindowObjectExist()) {\n return;\n }\n const loadingScreen = this.loadingScreen;\n if (loadingScreen) {\n loadingScreen.displayLoadingUI();\n }\n }\n /**\n * Hide the loading screen\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/customLoadingScreen\n */\n hideLoadingUI() {\n if (!IsWindowObjectExist()) {\n return;\n }\n const loadingScreen = this._loadingScreen;\n if (loadingScreen) {\n loadingScreen.hideLoadingUI();\n }\n }\n /**\n * Gets the current loading screen object\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/customLoadingScreen\n */\n get loadingScreen() {\n if (!this._loadingScreen && this._renderingCanvas) {\n this._loadingScreen = Engine.DefaultLoadingScreenFactory(this._renderingCanvas);\n }\n return this._loadingScreen;\n }\n /**\n * Sets the current loading screen object\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/customLoadingScreen\n */\n set loadingScreen(loadingScreen) {\n this._loadingScreen = loadingScreen;\n }\n /**\n * Sets the current loading screen text\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/customLoadingScreen\n */\n set loadingUIText(text) {\n this.loadingScreen.loadingUIText = text;\n }\n /**\n * Sets the current loading screen background color\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/customLoadingScreen\n */\n set loadingUIBackgroundColor(color) {\n this.loadingScreen.loadingUIBackgroundColor = color;\n }\n /**\n * creates and returns a new video element\n * @param constraints video constraints\n * @returns video element\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n createVideoElement(constraints) {\n return document.createElement(\"video\");\n }\n /** Pointerlock and fullscreen */\n /**\n * Ask the browser to promote the current element to pointerlock mode\n * @param element defines the DOM element to promote\n */\n static _RequestPointerlock(element) {\n if (element.requestPointerLock) {\n // In some browsers, requestPointerLock returns a promise.\n // Handle possible rejections to avoid an unhandled top-level exception.\n const promise = element.requestPointerLock();\n if (promise instanceof Promise)\n promise\n .then(() => {\n element.focus();\n })\n .catch(() => { });\n else\n element.focus();\n }\n }\n /**\n * Asks the browser to exit pointerlock mode\n */\n static _ExitPointerlock() {\n if (document.exitPointerLock) {\n document.exitPointerLock();\n }\n }\n /**\n * Ask the browser to promote the current element to fullscreen rendering mode\n * @param element defines the DOM element to promote\n */\n static _RequestFullscreen(element) {\n const requestFunction = element.requestFullscreen || element.webkitRequestFullscreen;\n if (!requestFunction) {\n return;\n }\n requestFunction.call(element);\n }\n /**\n * Asks the browser to exit fullscreen mode\n */\n static _ExitFullscreen() {\n const anyDoc = document;\n if (document.exitFullscreen) {\n document.exitFullscreen();\n }\n else if (anyDoc.webkitCancelFullScreen) {\n anyDoc.webkitCancelFullScreen();\n }\n }\n /**\n * Get Font size information\n * @param font font name\n * @returns an object containing ascent, height and descent\n */\n getFontOffset(font) {\n const text = document.createElement(\"span\");\n text.innerHTML = \"Hg\";\n text.setAttribute(\"style\", `font: ${font} !important`);\n const block = document.createElement(\"div\");\n block.style.display = \"inline-block\";\n block.style.width = \"1px\";\n block.style.height = \"0px\";\n block.style.verticalAlign = \"bottom\";\n const div = document.createElement(\"div\");\n div.style.whiteSpace = \"nowrap\";\n div.appendChild(text);\n div.appendChild(block);\n document.body.appendChild(div);\n let fontAscent = 0;\n let fontHeight = 0;\n try {\n fontHeight = block.getBoundingClientRect().top - text.getBoundingClientRect().top;\n block.style.verticalAlign = \"baseline\";\n fontAscent = block.getBoundingClientRect().top - text.getBoundingClientRect().top;\n }\n finally {\n document.body.removeChild(div);\n }\n return { ascent: fontAscent, height: fontHeight, descent: fontHeight - fontAscent };\n }\n}\n// Const statics\n/** Defines that alpha blending is disabled */\nEngine.ALPHA_DISABLE = 0;\n/** Defines that alpha blending to SRC ALPHA * SRC + DEST */\nEngine.ALPHA_ADD = 1;\n/** Defines that alpha blending to SRC ALPHA * SRC + (1 - SRC ALPHA) * DEST */\nEngine.ALPHA_COMBINE = 2;\n/** Defines that alpha blending to DEST - SRC * DEST */\nEngine.ALPHA_SUBTRACT = 3;\n/** Defines that alpha blending to SRC * DEST */\nEngine.ALPHA_MULTIPLY = 4;\n/** Defines that alpha blending to SRC ALPHA * SRC + (1 - SRC) * DEST */\nEngine.ALPHA_MAXIMIZED = 5;\n/** Defines that alpha blending to SRC + DEST */\nEngine.ALPHA_ONEONE = 6;\n/** Defines that alpha blending to SRC + (1 - SRC ALPHA) * DEST */\nEngine.ALPHA_PREMULTIPLIED = 7;\n/**\n * Defines that alpha blending to SRC + (1 - SRC ALPHA) * DEST\n * Alpha will be set to (1 - SRC ALPHA) * DEST ALPHA\n */\nEngine.ALPHA_PREMULTIPLIED_PORTERDUFF = 8;\n/** Defines that alpha blending to CST * SRC + (1 - CST) * DEST */\nEngine.ALPHA_INTERPOLATE = 9;\n/**\n * Defines that alpha blending to SRC + (1 - SRC) * DEST\n * Alpha will be set to SRC ALPHA + (1 - SRC ALPHA) * DEST ALPHA\n */\nEngine.ALPHA_SCREENMODE = 10;\n/** Defines that the resource is not delayed*/\nEngine.DELAYLOADSTATE_NONE = 0;\n/** Defines that the resource was successfully delay loaded */\nEngine.DELAYLOADSTATE_LOADED = 1;\n/** Defines that the resource is currently delay loading */\nEngine.DELAYLOADSTATE_LOADING = 2;\n/** Defines that the resource is delayed and has not started loading */\nEngine.DELAYLOADSTATE_NOTLOADED = 4;\n// Depht or Stencil test Constants.\n/** Passed to depthFunction or stencilFunction to specify depth or stencil tests will never pass. i.e. Nothing will be drawn */\nEngine.NEVER = 512;\n/** Passed to depthFunction or stencilFunction to specify depth or stencil tests will always pass. i.e. Pixels will be drawn in the order they are drawn */\nEngine.ALWAYS = 519;\n/** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is less than the stored value */\nEngine.LESS = 513;\n/** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is equals to the stored value */\nEngine.EQUAL = 514;\n/** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is less than or equal to the stored value */\nEngine.LEQUAL = 515;\n/** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is greater than the stored value */\nEngine.GREATER = 516;\n/** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is greater than or equal to the stored value */\nEngine.GEQUAL = 518;\n/** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is not equal to the stored value */\nEngine.NOTEQUAL = 517;\n// Stencil Actions Constants.\n/** Passed to stencilOperation to specify that stencil value must be kept */\nEngine.KEEP = 7680;\n/** Passed to stencilOperation to specify that stencil value must be replaced */\nEngine.REPLACE = 7681;\n/** Passed to stencilOperation to specify that stencil value must be incremented */\nEngine.INCR = 7682;\n/** Passed to stencilOperation to specify that stencil value must be decremented */\nEngine.DECR = 7683;\n/** Passed to stencilOperation to specify that stencil value must be inverted */\nEngine.INVERT = 5386;\n/** Passed to stencilOperation to specify that stencil value must be incremented with wrapping */\nEngine.INCR_WRAP = 34055;\n/** Passed to stencilOperation to specify that stencil value must be decremented with wrapping */\nEngine.DECR_WRAP = 34056;\n/** Texture is not repeating outside of 0..1 UVs */\nEngine.TEXTURE_CLAMP_ADDRESSMODE = 0;\n/** Texture is repeating outside of 0..1 UVs */\nEngine.TEXTURE_WRAP_ADDRESSMODE = 1;\n/** Texture is repeating and mirrored */\nEngine.TEXTURE_MIRROR_ADDRESSMODE = 2;\n/** ALPHA */\nEngine.TEXTUREFORMAT_ALPHA = 0;\n/** LUMINANCE */\nEngine.TEXTUREFORMAT_LUMINANCE = 1;\n/** LUMINANCE_ALPHA */\nEngine.TEXTUREFORMAT_LUMINANCE_ALPHA = 2;\n/** RGB */\nEngine.TEXTUREFORMAT_RGB = 4;\n/** RGBA */\nEngine.TEXTUREFORMAT_RGBA = 5;\n/** RED */\nEngine.TEXTUREFORMAT_RED = 6;\n/** RED (2nd reference) */\nEngine.TEXTUREFORMAT_R = 6;\n/** RG */\nEngine.TEXTUREFORMAT_RG = 7;\n/** RED_INTEGER */\nEngine.TEXTUREFORMAT_RED_INTEGER = 8;\n/** RED_INTEGER (2nd reference) */\nEngine.TEXTUREFORMAT_R_INTEGER = 8;\n/** RG_INTEGER */\nEngine.TEXTUREFORMAT_RG_INTEGER = 9;\n/** RGB_INTEGER */\nEngine.TEXTUREFORMAT_RGB_INTEGER = 10;\n/** RGBA_INTEGER */\nEngine.TEXTUREFORMAT_RGBA_INTEGER = 11;\n/** UNSIGNED_BYTE */\nEngine.TEXTURETYPE_UNSIGNED_BYTE = 0;\n/** UNSIGNED_BYTE (2nd reference) */\nEngine.TEXTURETYPE_UNSIGNED_INT = 0;\n/** FLOAT */\nEngine.TEXTURETYPE_FLOAT = 1;\n/** HALF_FLOAT */\nEngine.TEXTURETYPE_HALF_FLOAT = 2;\n/** BYTE */\nEngine.TEXTURETYPE_BYTE = 3;\n/** SHORT */\nEngine.TEXTURETYPE_SHORT = 4;\n/** UNSIGNED_SHORT */\nEngine.TEXTURETYPE_UNSIGNED_SHORT = 5;\n/** INT */\nEngine.TEXTURETYPE_INT = 6;\n/** UNSIGNED_INT */\nEngine.TEXTURETYPE_UNSIGNED_INTEGER = 7;\n/** UNSIGNED_SHORT_4_4_4_4 */\nEngine.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4 = 8;\n/** UNSIGNED_SHORT_5_5_5_1 */\nEngine.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1 = 9;\n/** UNSIGNED_SHORT_5_6_5 */\nEngine.TEXTURETYPE_UNSIGNED_SHORT_5_6_5 = 10;\n/** UNSIGNED_INT_2_10_10_10_REV */\nEngine.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV = 11;\n/** UNSIGNED_INT_24_8 */\nEngine.TEXTURETYPE_UNSIGNED_INT_24_8 = 12;\n/** UNSIGNED_INT_10F_11F_11F_REV */\nEngine.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV = 13;\n/** UNSIGNED_INT_5_9_9_9_REV */\nEngine.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV = 14;\n/** FLOAT_32_UNSIGNED_INT_24_8_REV */\nEngine.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV = 15;\n/** nearest is mag = nearest and min = nearest and mip = none */\nEngine.TEXTURE_NEAREST_SAMPLINGMODE = 1;\n/** Bilinear is mag = linear and min = linear and mip = nearest */\nEngine.TEXTURE_BILINEAR_SAMPLINGMODE = 2;\n/** Trilinear is mag = linear and min = linear and mip = linear */\nEngine.TEXTURE_TRILINEAR_SAMPLINGMODE = 3;\n/** nearest is mag = nearest and min = nearest and mip = linear */\nEngine.TEXTURE_NEAREST_NEAREST_MIPLINEAR = 8;\n/** Bilinear is mag = linear and min = linear and mip = nearest */\nEngine.TEXTURE_LINEAR_LINEAR_MIPNEAREST = 11;\n/** Trilinear is mag = linear and min = linear and mip = linear */\nEngine.TEXTURE_LINEAR_LINEAR_MIPLINEAR = 3;\n/** mag = nearest and min = nearest and mip = nearest */\nEngine.TEXTURE_NEAREST_NEAREST_MIPNEAREST = 4;\n/** mag = nearest and min = linear and mip = nearest */\nEngine.TEXTURE_NEAREST_LINEAR_MIPNEAREST = 5;\n/** mag = nearest and min = linear and mip = linear */\nEngine.TEXTURE_NEAREST_LINEAR_MIPLINEAR = 6;\n/** mag = nearest and min = linear and mip = none */\nEngine.TEXTURE_NEAREST_LINEAR = 7;\n/** mag = nearest and min = nearest and mip = none */\nEngine.TEXTURE_NEAREST_NEAREST = 1;\n/** mag = linear and min = nearest and mip = nearest */\nEngine.TEXTURE_LINEAR_NEAREST_MIPNEAREST = 9;\n/** mag = linear and min = nearest and mip = linear */\nEngine.TEXTURE_LINEAR_NEAREST_MIPLINEAR = 10;\n/** mag = linear and min = linear and mip = none */\nEngine.TEXTURE_LINEAR_LINEAR = 2;\n/** mag = linear and min = nearest and mip = none */\nEngine.TEXTURE_LINEAR_NEAREST = 12;\n/** Explicit coordinates mode */\nEngine.TEXTURE_EXPLICIT_MODE = 0;\n/** Spherical coordinates mode */\nEngine.TEXTURE_SPHERICAL_MODE = 1;\n/** Planar coordinates mode */\nEngine.TEXTURE_PLANAR_MODE = 2;\n/** Cubic coordinates mode */\nEngine.TEXTURE_CUBIC_MODE = 3;\n/** Projection coordinates mode */\nEngine.TEXTURE_PROJECTION_MODE = 4;\n/** Skybox coordinates mode */\nEngine.TEXTURE_SKYBOX_MODE = 5;\n/** Inverse Cubic coordinates mode */\nEngine.TEXTURE_INVCUBIC_MODE = 6;\n/** Equirectangular coordinates mode */\nEngine.TEXTURE_EQUIRECTANGULAR_MODE = 7;\n/** Equirectangular Fixed coordinates mode */\nEngine.TEXTURE_FIXED_EQUIRECTANGULAR_MODE = 8;\n/** Equirectangular Fixed Mirrored coordinates mode */\nEngine.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE = 9;\n// Texture rescaling mode\n/** Defines that texture rescaling will use a floor to find the closer power of 2 size */\nEngine.SCALEMODE_FLOOR = 1;\n/** Defines that texture rescaling will look for the nearest power of 2 size */\nEngine.SCALEMODE_NEAREST = 2;\n/** Defines that texture rescaling will use a ceil to find the closer power of 2 size */\nEngine.SCALEMODE_CEILING = 3;\n/**\n * Method called to create the default rescale post process on each engine.\n */\nEngine._RescalePostProcessFactory = null;\n// eslint-disable-next-line @typescript-eslint/naming-convention\nEngine._RenderPassIdCounter = 0;\n//# sourceMappingURL=engine.js.map","import { Logger } from \"./logger.js\";\nconst CloneValue = (source, destinationObject) => {\n if (!source) {\n return null;\n }\n if (source.getClassName && source.getClassName() === \"Mesh\") {\n return null;\n }\n if (source.getClassName && (source.getClassName() === \"SubMesh\" || source.getClassName() === \"PhysicsBody\")) {\n return source.clone(destinationObject);\n }\n else if (source.clone) {\n return source.clone();\n }\n else if (Array.isArray(source)) {\n return source.slice();\n }\n return null;\n};\nfunction GetAllPropertyNames(obj) {\n const props = [];\n do {\n Object.getOwnPropertyNames(obj).forEach(function (prop) {\n if (props.indexOf(prop) === -1) {\n props.push(prop);\n }\n });\n } while ((obj = Object.getPrototypeOf(obj)));\n return props;\n}\n/**\n * Class containing a set of static utilities functions for deep copy.\n */\nexport class DeepCopier {\n /**\n * Tries to copy an object by duplicating every property\n * @param source defines the source object\n * @param destination defines the target object\n * @param doNotCopyList defines a list of properties to avoid\n * @param mustCopyList defines a list of properties to copy (even if they start with _)\n */\n static DeepCopy(source, destination, doNotCopyList, mustCopyList) {\n const properties = GetAllPropertyNames(source);\n for (const prop of properties) {\n if (prop[0] === \"_\" && (!mustCopyList || mustCopyList.indexOf(prop) === -1)) {\n continue;\n }\n if (prop.endsWith(\"Observable\")) {\n continue;\n }\n if (doNotCopyList && doNotCopyList.indexOf(prop) !== -1) {\n continue;\n }\n const sourceValue = source[prop];\n const typeOfSourceValue = typeof sourceValue;\n if (typeOfSourceValue === \"function\") {\n continue;\n }\n try {\n if (typeOfSourceValue === \"object\") {\n if (sourceValue instanceof Uint8Array) {\n destination[prop] = Uint8Array.from(sourceValue);\n }\n else if (sourceValue instanceof Array) {\n destination[prop] = [];\n if (sourceValue.length > 0) {\n if (typeof sourceValue[0] == \"object\") {\n for (let index = 0; index < sourceValue.length; index++) {\n const clonedValue = CloneValue(sourceValue[index], destination);\n if (destination[prop].indexOf(clonedValue) === -1) {\n // Test if auto inject was not done\n destination[prop].push(clonedValue);\n }\n }\n }\n else {\n destination[prop] = sourceValue.slice(0);\n }\n }\n }\n else {\n destination[prop] = CloneValue(sourceValue, destination);\n }\n }\n else {\n destination[prop] = sourceValue;\n }\n }\n catch (e) {\n // Log a warning (it could be because of a read-only property)\n Logger.Warn(e.message);\n }\n }\n }\n}\n//# sourceMappingURL=deepCopier.js.map","/**\n * Class used to help managing file picking and drag'n'drop\n * File Storage\n */\nexport class FilesInputStore {\n}\n/**\n * List of files ready to be loaded\n */\nFilesInputStore.FilesToLoad = {};\n//# sourceMappingURL=filesInputStore.js.map","/**\n * Class used to define a retry strategy when error happens while loading assets\n */\nexport class RetryStrategy {\n /**\n * Function used to defines an exponential back off strategy\n * @param maxRetries defines the maximum number of retries (3 by default)\n * @param baseInterval defines the interval between retries\n * @returns the strategy function to use\n */\n static ExponentialBackoff(maxRetries = 3, baseInterval = 500) {\n return (url, request, retryIndex) => {\n if (request.status !== 0 || retryIndex >= maxRetries || url.indexOf(\"file:\") !== -1) {\n return -1;\n }\n return Math.pow(2, retryIndex) * baseInterval;\n };\n }\n}\n//# sourceMappingURL=retryStrategy.js.map","/* eslint-disable @typescript-eslint/naming-convention */\n/**\n * Base error. Due to limitations of typedoc-check and missing documentation\n * in lib.es5.d.ts, cannot extend Error directly for RuntimeError.\n * @ignore\n */\nexport class BaseError extends Error {\n}\n// See https://stackoverflow.com/questions/12915412/how-do-i-extend-a-host-object-e-g-error-in-typescript\n// and https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work\n// Polyfill for Object.setPrototypeOf if necessary.\nBaseError._setPrototypeOf = Object.setPrototypeOf ||\n ((o, proto) => {\n o.__proto__ = proto;\n return o;\n });\n/* IMP! DO NOT CHANGE THE NUMBERING OF EXISTING ERROR CODES */\n/**\n * Error codes for BaseError\n */\nexport const ErrorCodes = {\n // Mesh errors 0-999\n /** Invalid or empty mesh vertex positions. */\n MeshInvalidPositionsError: 0,\n // Texture errors 1000-1999\n /** Unsupported texture found. */\n UnsupportedTextureError: 1000,\n // GLTFLoader errors 2000-2999\n /** Unexpected magic number found in GLTF file header. */\n GLTFLoaderUnexpectedMagicError: 2000,\n // SceneLoader errors 3000-3999\n /** SceneLoader generic error code. Ideally wraps the inner exception. */\n SceneLoaderError: 3000,\n // File related errors 4000-4999\n /** Load file error */\n LoadFileError: 4000,\n /** Request file error */\n RequestFileError: 4001,\n /** Read file error */\n ReadFileError: 4002,\n};\n/**\n * Application runtime error\n */\nexport class RuntimeError extends BaseError {\n /**\n * Creates a new RuntimeError\n * @param message defines the message of the error\n * @param errorCode the error code\n * @param innerError the error that caused the outer error\n */\n constructor(message, errorCode, innerError) {\n super(message);\n this.errorCode = errorCode;\n this.innerError = innerError;\n this.name = \"RuntimeError\";\n BaseError._setPrototypeOf(this, RuntimeError.prototype);\n }\n}\n//# sourceMappingURL=error.js.map","/* eslint-disable @typescript-eslint/naming-convention */\n/**\n * Checks for a matching suffix at the end of a string (for ES5 and lower)\n * @param str Source string\n * @param suffix Suffix to search for in the source string\n * @returns Boolean indicating whether the suffix was found (true) or not (false)\n * @deprecated Please use native string function instead\n */\nexport const EndsWith = (str, suffix) => {\n return str.endsWith(suffix);\n};\n/**\n * Checks for a matching suffix at the beginning of a string (for ES5 and lower)\n * @param str Source string\n * @param suffix Suffix to search for in the source string\n * @returns Boolean indicating whether the suffix was found (true) or not (false)\n * @deprecated Please use native string function instead\n */\nexport const StartsWith = (str, suffix) => {\n if (!str) {\n return false;\n }\n return str.startsWith(suffix);\n};\n/**\n * Decodes a buffer into a string\n * @param buffer The buffer to decode\n * @returns The decoded string\n */\nexport const Decode = (buffer) => {\n if (typeof TextDecoder !== \"undefined\") {\n return new TextDecoder().decode(buffer);\n }\n let result = \"\";\n for (let i = 0; i < buffer.byteLength; i++) {\n result += String.fromCharCode(buffer[i]);\n }\n return result;\n};\n/**\n * Encode a buffer to a base64 string\n * @param buffer defines the buffer to encode\n * @returns the encoded string\n */\nexport const EncodeArrayBufferToBase64 = (buffer) => {\n const keyStr = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\n let output = \"\";\n let chr1, chr2, chr3, enc1, enc2, enc3, enc4;\n let i = 0;\n const bytes = ArrayBuffer.isView(buffer) ? new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength) : new Uint8Array(buffer);\n while (i < bytes.length) {\n chr1 = bytes[i++];\n chr2 = i < bytes.length ? bytes[i++] : Number.NaN;\n chr3 = i < bytes.length ? bytes[i++] : Number.NaN;\n enc1 = chr1 >> 2;\n enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);\n enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);\n enc4 = chr3 & 63;\n if (isNaN(chr2)) {\n enc3 = enc4 = 64;\n }\n else if (isNaN(chr3)) {\n enc4 = 64;\n }\n output += keyStr.charAt(enc1) + keyStr.charAt(enc2) + keyStr.charAt(enc3) + keyStr.charAt(enc4);\n }\n return output;\n};\n/**\n * Converts a given base64 string as an ASCII encoded stream of data\n * @param base64Data The base64 encoded string to decode\n * @returns Decoded ASCII string\n */\nexport const DecodeBase64ToString = (base64Data) => {\n return atob(base64Data);\n};\n/**\n * Converts a given base64 string into an ArrayBuffer of raw byte data\n * @param base64Data The base64 encoded string to decode\n * @returns ArrayBuffer of byte data\n */\nexport const DecodeBase64ToBinary = (base64Data) => {\n const decodedString = DecodeBase64ToString(base64Data);\n const bufferLength = decodedString.length;\n const bufferView = new Uint8Array(new ArrayBuffer(bufferLength));\n for (let i = 0; i < bufferLength; i++) {\n bufferView[i] = decodedString.charCodeAt(i);\n }\n return bufferView.buffer;\n};\n/**\n * Converts a number to string and pads with preceding zeroes until it is of specified length.\n * @param num the number to convert and pad\n * @param length the expected length of the string\n * @returns the padded string\n */\nexport const PadNumber = (num, length) => {\n let str = String(num);\n while (str.length < length) {\n str = \"0\" + str;\n }\n return str;\n};\n/**\n * Helper to manipulate strings\n */\nexport const StringTools = {\n EndsWith,\n StartsWith,\n Decode,\n EncodeArrayBufferToBase64,\n DecodeBase64ToString,\n DecodeBase64ToBinary,\n PadNumber,\n};\n//# sourceMappingURL=stringTools.js.map","import { IsWindowObjectExist } from \"./domManagement.js\";\n/**\n * Class used to provide helper for timing\n */\nexport class TimingTools {\n /**\n * Polyfill for setImmediate\n * @param action defines the action to execute after the current execution block\n */\n static SetImmediate(action) {\n if (IsWindowObjectExist() && window.setImmediate) {\n window.setImmediate(action);\n }\n else {\n setTimeout(action, 1);\n }\n }\n}\n//# sourceMappingURL=timingTools.js.map","/* eslint-disable @typescript-eslint/naming-convention */\nimport { WebRequest } from \"./webRequest.js\";\nimport { IsWindowObjectExist } from \"./domManagement.js\";\nimport { Observable } from \"./observable.js\";\nimport { FilesInputStore } from \"./filesInputStore.js\";\nimport { RetryStrategy } from \"./retryStrategy.js\";\nimport { BaseError, ErrorCodes, RuntimeError } from \"./error.js\";\nimport { DecodeBase64ToBinary, DecodeBase64ToString, EncodeArrayBufferToBase64 } from \"./stringTools.js\";\nimport { ShaderProcessor } from \"../Engines/Processors/shaderProcessor.js\";\nimport { ThinEngine } from \"../Engines/thinEngine.js\";\nimport { EngineStore } from \"../Engines/engineStore.js\";\nimport { Logger } from \"./logger.js\";\nimport { TimingTools } from \"./timingTools.js\";\nconst Base64DataUrlRegEx = new RegExp(/^data:([^,]+\\/[^,]+)?;base64,/i);\n/** @ignore */\nexport class LoadFileError extends RuntimeError {\n /**\n * Creates a new LoadFileError\n * @param message defines the message of the error\n * @param object defines the optional web request\n */\n constructor(message, object) {\n super(message, ErrorCodes.LoadFileError);\n this.name = \"LoadFileError\";\n BaseError._setPrototypeOf(this, LoadFileError.prototype);\n if (object instanceof WebRequest) {\n this.request = object;\n }\n else {\n this.file = object;\n }\n }\n}\n/** @ignore */\nexport class RequestFileError extends RuntimeError {\n /**\n * Creates a new LoadFileError\n * @param message defines the message of the error\n * @param request defines the optional web request\n */\n constructor(message, request) {\n super(message, ErrorCodes.RequestFileError);\n this.request = request;\n this.name = \"RequestFileError\";\n BaseError._setPrototypeOf(this, RequestFileError.prototype);\n }\n}\n/** @ignore */\nexport class ReadFileError extends RuntimeError {\n /**\n * Creates a new ReadFileError\n * @param message defines the message of the error\n * @param file defines the optional file\n */\n constructor(message, file) {\n super(message, ErrorCodes.ReadFileError);\n this.file = file;\n this.name = \"ReadFileError\";\n BaseError._setPrototypeOf(this, ReadFileError.prototype);\n }\n}\n/**\n * @internal\n */\nexport const FileToolsOptions = {\n /**\n * Gets or sets the retry strategy to apply when an error happens while loading an asset.\n * When defining this function, return the wait time before trying again or return -1 to\n * stop retrying and error out.\n */\n DefaultRetryStrategy: RetryStrategy.ExponentialBackoff(),\n /**\n * Gets or sets the base URL to use to load assets\n */\n BaseUrl: \"\",\n /**\n * Default behaviour for cors in the application.\n * It can be a string if the expected behavior is identical in the entire app.\n * Or a callback to be able to set it per url or on a group of them (in case of Video source for instance)\n */\n CorsBehavior: \"anonymous\",\n /**\n * Gets or sets a function used to pre-process url before using them to load assets\n * @param url\n */\n PreprocessUrl: (url) => {\n return url;\n },\n};\n/**\n * Removes unwanted characters from an url\n * @param url defines the url to clean\n * @returns the cleaned url\n */\nconst _CleanUrl = (url) => {\n url = url.replace(/#/gm, \"%23\");\n return url;\n};\n/**\n * Sets the cors behavior on a dom element. This will add the required Tools.CorsBehavior to the element.\n * @param url define the url we are trying\n * @param element define the dom element where to configure the cors policy\n * @internal\n */\nexport const SetCorsBehavior = (url, element) => {\n if (url && url.indexOf(\"data:\") === 0) {\n return;\n }\n if (FileToolsOptions.CorsBehavior) {\n if (typeof FileToolsOptions.CorsBehavior === \"string\" || FileToolsOptions.CorsBehavior instanceof String) {\n element.crossOrigin = FileToolsOptions.CorsBehavior;\n }\n else {\n const result = FileToolsOptions.CorsBehavior(url);\n if (result) {\n element.crossOrigin = result;\n }\n }\n }\n};\n/**\n * Loads an image as an HTMLImageElement.\n * @param input url string, ArrayBuffer, or Blob to load\n * @param onLoad callback called when the image successfully loads\n * @param onError callback called when the image fails to load\n * @param offlineProvider offline provider for caching\n * @param mimeType optional mime type\n * @param imageBitmapOptions\n * @returns the HTMLImageElement of the loaded image\n * @internal\n */\nexport const LoadImage = (input, onLoad, onError, offlineProvider, mimeType = \"\", imageBitmapOptions) => {\n var _a;\n let url;\n let usingObjectURL = false;\n if (input instanceof ArrayBuffer || ArrayBuffer.isView(input)) {\n if (typeof Blob !== \"undefined\" && typeof URL !== \"undefined\") {\n url = URL.createObjectURL(new Blob([input], { type: mimeType }));\n usingObjectURL = true;\n }\n else {\n url = `data:${mimeType};base64,` + EncodeArrayBufferToBase64(input);\n }\n }\n else if (input instanceof Blob) {\n url = URL.createObjectURL(input);\n usingObjectURL = true;\n }\n else {\n url = _CleanUrl(input);\n url = FileToolsOptions.PreprocessUrl(input);\n }\n const engine = EngineStore.LastCreatedEngine;\n const onErrorHandler = (exception) => {\n if (onError) {\n const inputText = url || input.toString();\n onError(`Error while trying to load image: ${inputText.indexOf(\"http\") === 0 || inputText.length <= 128 ? inputText : inputText.slice(0, 128) + \"...\"}`, exception);\n }\n };\n if (typeof Image === \"undefined\" || ((_a = engine === null || engine === void 0 ? void 0 : engine._features.forceBitmapOverHTMLImageElement) !== null && _a !== void 0 ? _a : false)) {\n LoadFile(url, (data) => {\n engine\n .createImageBitmap(new Blob([data], { type: mimeType }), Object.assign({ premultiplyAlpha: \"none\" }, imageBitmapOptions))\n .then((imgBmp) => {\n onLoad(imgBmp);\n if (usingObjectURL) {\n URL.revokeObjectURL(url);\n }\n })\n .catch((reason) => {\n if (onError) {\n onError(\"Error while trying to load image: \" + input, reason);\n }\n });\n }, undefined, offlineProvider || undefined, true, (request, exception) => {\n onErrorHandler(exception);\n });\n return null;\n }\n const img = new Image();\n SetCorsBehavior(url, img);\n const handlersList = [];\n const loadHandlersList = () => {\n handlersList.forEach((handler) => {\n handler.target.addEventListener(handler.name, handler.handler);\n });\n };\n const unloadHandlersList = () => {\n handlersList.forEach((handler) => {\n handler.target.removeEventListener(handler.name, handler.handler);\n });\n handlersList.length = 0;\n };\n const loadHandler = () => {\n unloadHandlersList();\n onLoad(img);\n // Must revoke the URL after calling onLoad to avoid security exceptions in\n // certain scenarios (e.g. when hosted in vscode).\n if (usingObjectURL && img.src) {\n URL.revokeObjectURL(img.src);\n }\n };\n const errorHandler = (err) => {\n unloadHandlersList();\n onErrorHandler(err);\n if (usingObjectURL && img.src) {\n URL.revokeObjectURL(img.src);\n }\n };\n const cspHandler = (err) => {\n if (err.blockedURI !== img.src) {\n return;\n }\n unloadHandlersList();\n const cspException = new Error(`CSP violation of policy ${err.effectiveDirective} ${err.blockedURI}. Current policy is ${err.originalPolicy}`);\n EngineStore.UseFallbackTexture = false;\n onErrorHandler(cspException);\n if (usingObjectURL && img.src) {\n URL.revokeObjectURL(img.src);\n }\n img.src = \"\";\n };\n handlersList.push({ target: img, name: \"load\", handler: loadHandler });\n handlersList.push({ target: img, name: \"error\", handler: errorHandler });\n handlersList.push({ target: document, name: \"securitypolicyviolation\", handler: cspHandler });\n loadHandlersList();\n const fromBlob = url.substring(0, 5) === \"blob:\";\n const fromData = url.substring(0, 5) === \"data:\";\n const noOfflineSupport = () => {\n if (fromBlob || fromData) {\n img.src = url;\n }\n else {\n LoadFile(url, (data, _, contentType) => {\n const type = !mimeType && contentType ? contentType : mimeType;\n const blob = new Blob([data], { type });\n const url = URL.createObjectURL(blob);\n usingObjectURL = true;\n img.src = url;\n }, undefined, offlineProvider || undefined, true, (request, exception) => {\n onErrorHandler(exception);\n });\n }\n };\n const loadFromOfflineSupport = () => {\n if (offlineProvider) {\n offlineProvider.loadImage(url, img);\n }\n };\n if (!fromBlob && !fromData && offlineProvider && offlineProvider.enableTexturesOffline) {\n offlineProvider.open(loadFromOfflineSupport, noOfflineSupport);\n }\n else {\n if (url.indexOf(\"file:\") !== -1) {\n const textureName = decodeURIComponent(url.substring(5).toLowerCase());\n if (FilesInputStore.FilesToLoad[textureName] && typeof URL !== \"undefined\") {\n try {\n let blobURL;\n try {\n blobURL = URL.createObjectURL(FilesInputStore.FilesToLoad[textureName]);\n }\n catch (ex) {\n // Chrome doesn't support oneTimeOnly parameter\n blobURL = URL.createObjectURL(FilesInputStore.FilesToLoad[textureName]);\n }\n img.src = blobURL;\n usingObjectURL = true;\n }\n catch (e) {\n img.src = \"\";\n }\n return img;\n }\n }\n noOfflineSupport();\n }\n return img;\n};\n/**\n * Reads a file from a File object\n * @param file defines the file to load\n * @param onSuccess defines the callback to call when data is loaded\n * @param onProgress defines the callback to call during loading process\n * @param useArrayBuffer defines a boolean indicating that data must be returned as an ArrayBuffer\n * @param onError defines the callback to call when an error occurs\n * @returns a file request object\n * @internal\n */\nexport const ReadFile = (file, onSuccess, onProgress, useArrayBuffer, onError) => {\n const reader = new FileReader();\n const fileRequest = {\n onCompleteObservable: new Observable(),\n abort: () => reader.abort(),\n };\n reader.onloadend = () => fileRequest.onCompleteObservable.notifyObservers(fileRequest);\n if (onError) {\n reader.onerror = () => {\n onError(new ReadFileError(`Unable to read ${file.name}`, file));\n };\n }\n reader.onload = (e) => {\n //target doesn't have result from ts 1.3\n onSuccess(e.target[\"result\"]);\n };\n if (onProgress) {\n reader.onprogress = onProgress;\n }\n if (!useArrayBuffer) {\n // Asynchronous read\n reader.readAsText(file);\n }\n else {\n reader.readAsArrayBuffer(file);\n }\n return fileRequest;\n};\n/**\n * Loads a file from a url, a data url, or a file url\n * @param fileOrUrl file, url, data url, or file url to load\n * @param onSuccess callback called when the file successfully loads\n * @param onProgress callback called while file is loading (if the server supports this mode)\n * @param offlineProvider defines the offline provider for caching\n * @param useArrayBuffer defines a boolean indicating that date must be returned as ArrayBuffer\n * @param onError callback called when the file fails to load\n * @param onOpened\n * @returns a file request object\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const LoadFile = (fileOrUrl, onSuccess, onProgress, offlineProvider, useArrayBuffer, onError, onOpened) => {\n if (fileOrUrl.name) {\n return ReadFile(fileOrUrl, onSuccess, onProgress, useArrayBuffer, onError\n ? (error) => {\n onError(undefined, error);\n }\n : undefined);\n }\n const url = fileOrUrl;\n // If file and file input are set\n if (url.indexOf(\"file:\") !== -1) {\n let fileName = decodeURIComponent(url.substring(5).toLowerCase());\n if (fileName.indexOf(\"./\") === 0) {\n fileName = fileName.substring(2);\n }\n const file = FilesInputStore.FilesToLoad[fileName];\n if (file) {\n return ReadFile(file, onSuccess, onProgress, useArrayBuffer, onError ? (error) => onError(undefined, new LoadFileError(error.message, error.file)) : undefined);\n }\n }\n // For a Base64 Data URL\n const { match, type } = TestBase64DataUrl(url);\n if (match) {\n const fileRequest = {\n onCompleteObservable: new Observable(),\n abort: () => () => { },\n };\n try {\n const data = useArrayBuffer ? DecodeBase64UrlToBinary(url) : DecodeBase64UrlToString(url);\n onSuccess(data, undefined, type);\n }\n catch (error) {\n if (onError) {\n onError(undefined, error);\n }\n else {\n Logger.Error(error.message || \"Failed to parse the Data URL\");\n }\n }\n TimingTools.SetImmediate(() => {\n fileRequest.onCompleteObservable.notifyObservers(fileRequest);\n });\n return fileRequest;\n }\n return RequestFile(url, (data, request) => {\n onSuccess(data, request === null || request === void 0 ? void 0 : request.responseURL, request === null || request === void 0 ? void 0 : request.getResponseHeader(\"content-type\"));\n }, onProgress, offlineProvider, useArrayBuffer, onError\n ? (error) => {\n onError(error.request, new LoadFileError(error.message, error.request));\n }\n : undefined, onOpened);\n};\n/**\n * Loads a file from a url\n * @param url url to load\n * @param onSuccess callback called when the file successfully loads\n * @param onProgress callback called while file is loading (if the server supports this mode)\n * @param offlineProvider defines the offline provider for caching\n * @param useArrayBuffer defines a boolean indicating that date must be returned as ArrayBuffer\n * @param onError callback called when the file fails to load\n * @param onOpened callback called when the web request is opened\n * @returns a file request object\n * @internal\n */\nexport const RequestFile = (url, onSuccess, onProgress, offlineProvider, useArrayBuffer, onError, onOpened) => {\n url = _CleanUrl(url);\n url = FileToolsOptions.PreprocessUrl(url);\n const loadUrl = FileToolsOptions.BaseUrl + url;\n let aborted = false;\n const fileRequest = {\n onCompleteObservable: new Observable(),\n abort: () => (aborted = true),\n };\n const requestFile = () => {\n let request = new WebRequest();\n let retryHandle = null;\n let onReadyStateChange;\n const unbindEvents = () => {\n if (!request) {\n return;\n }\n if (onProgress) {\n request.removeEventListener(\"progress\", onProgress);\n }\n if (onReadyStateChange) {\n request.removeEventListener(\"readystatechange\", onReadyStateChange);\n }\n request.removeEventListener(\"loadend\", onLoadEnd);\n };\n let onLoadEnd = () => {\n unbindEvents();\n fileRequest.onCompleteObservable.notifyObservers(fileRequest);\n fileRequest.onCompleteObservable.clear();\n onProgress = undefined;\n onReadyStateChange = null;\n onLoadEnd = null;\n onError = undefined;\n onOpened = undefined;\n onSuccess = undefined;\n };\n fileRequest.abort = () => {\n aborted = true;\n if (onLoadEnd) {\n onLoadEnd();\n }\n if (request && request.readyState !== (XMLHttpRequest.DONE || 4)) {\n request.abort();\n }\n if (retryHandle !== null) {\n clearTimeout(retryHandle);\n retryHandle = null;\n }\n request = null;\n };\n const handleError = (error) => {\n const message = error.message || \"Unknown error\";\n if (onError && request) {\n onError(new RequestFileError(message, request));\n }\n else {\n Logger.Error(message);\n }\n };\n const retryLoop = (retryIndex) => {\n if (!request) {\n return;\n }\n request.open(\"GET\", loadUrl);\n if (onOpened) {\n try {\n onOpened(request);\n }\n catch (e) {\n handleError(e);\n return;\n }\n }\n if (useArrayBuffer) {\n request.responseType = \"arraybuffer\";\n }\n if (onProgress) {\n request.addEventListener(\"progress\", onProgress);\n }\n if (onLoadEnd) {\n request.addEventListener(\"loadend\", onLoadEnd);\n }\n onReadyStateChange = () => {\n if (aborted || !request) {\n return;\n }\n // In case of undefined state in some browsers.\n if (request.readyState === (XMLHttpRequest.DONE || 4)) {\n // Some browsers have issues where onreadystatechange can be called multiple times with the same value.\n if (onReadyStateChange) {\n request.removeEventListener(\"readystatechange\", onReadyStateChange);\n }\n if ((request.status >= 200 && request.status < 300) || (request.status === 0 && (!IsWindowObjectExist() || IsFileURL()))) {\n try {\n if (onSuccess) {\n onSuccess(useArrayBuffer ? request.response : request.responseText, request);\n }\n }\n catch (e) {\n handleError(e);\n }\n return;\n }\n const retryStrategy = FileToolsOptions.DefaultRetryStrategy;\n if (retryStrategy) {\n const waitTime = retryStrategy(loadUrl, request, retryIndex);\n if (waitTime !== -1) {\n // Prevent the request from completing for retry.\n unbindEvents();\n request = new WebRequest();\n retryHandle = setTimeout(() => retryLoop(retryIndex + 1), waitTime);\n return;\n }\n }\n const error = new RequestFileError(\"Error status: \" + request.status + \" \" + request.statusText + \" - Unable to load \" + loadUrl, request);\n if (onError) {\n onError(error);\n }\n }\n };\n request.addEventListener(\"readystatechange\", onReadyStateChange);\n request.send();\n };\n retryLoop(0);\n };\n // Caching all files\n if (offlineProvider && offlineProvider.enableSceneOffline) {\n const noOfflineSupport = (request) => {\n if (request && request.status > 400) {\n if (onError) {\n onError(request);\n }\n }\n else {\n requestFile();\n }\n };\n const loadFromOfflineSupport = () => {\n // TODO: database needs to support aborting and should return a IFileRequest\n if (offlineProvider) {\n offlineProvider.loadFile(FileToolsOptions.BaseUrl + url, (data) => {\n if (!aborted && onSuccess) {\n onSuccess(data);\n }\n fileRequest.onCompleteObservable.notifyObservers(fileRequest);\n }, onProgress\n ? (event) => {\n if (!aborted && onProgress) {\n onProgress(event);\n }\n }\n : undefined, noOfflineSupport, useArrayBuffer);\n }\n };\n offlineProvider.open(loadFromOfflineSupport, noOfflineSupport);\n }\n else {\n requestFile();\n }\n return fileRequest;\n};\n/**\n * Checks if the loaded document was accessed via `file:`-Protocol.\n * @returns boolean\n * @internal\n */\nexport const IsFileURL = () => {\n return typeof location !== \"undefined\" && location.protocol === \"file:\";\n};\n/**\n * Test if the given uri is a valid base64 data url\n * @param uri The uri to test\n * @returns True if the uri is a base64 data url or false otherwise\n * @internal\n */\nexport const IsBase64DataUrl = (uri) => {\n return Base64DataUrlRegEx.test(uri);\n};\nexport const TestBase64DataUrl = (uri) => {\n const results = Base64DataUrlRegEx.exec(uri);\n if (results === null || results.length === 0) {\n return { match: false, type: \"\" };\n }\n else {\n const type = results[0].replace(\"data:\", \"\").replace(\"base64,\", \"\");\n return { match: true, type };\n }\n};\n/**\n * Decode the given base64 uri.\n * @param uri The uri to decode\n * @returns The decoded base64 data.\n * @internal\n */\nexport function DecodeBase64UrlToBinary(uri) {\n return DecodeBase64ToBinary(uri.split(\",\")[1]);\n}\n/**\n * Decode the given base64 uri into a UTF-8 encoded string.\n * @param uri The uri to decode\n * @returns The decoded base64 data.\n * @internal\n */\nexport const DecodeBase64UrlToString = (uri) => {\n return DecodeBase64ToString(uri.split(\",\")[1]);\n};\n/**\n * This will be executed automatically for UMD and es5.\n * If esm dev wants the side effects to execute they will have to run it manually\n * Once we build native modules those need to be exported.\n * @internal\n */\nconst initSideEffects = () => {\n ThinEngine._FileToolsLoadImage = LoadImage;\n ThinEngine._FileToolsLoadFile = LoadFile;\n ShaderProcessor._FileToolsLoadFile = LoadFile;\n};\ninitSideEffects();\n// deprecated\n/**\n * FileTools defined as any.\n * This should not be imported or used in future releases or in any module in the framework\n * @internal\n * @deprecated import the needed function from fileTools.ts\n */\nexport let FileTools;\n/**\n * @param DecodeBase64UrlToBinary\n * @param DecodeBase64UrlToString\n * @param FileToolsOptions\n * @internal\n */\nexport const _injectLTSFileTools = (DecodeBase64UrlToBinary, DecodeBase64UrlToString, FileToolsOptions, IsBase64DataUrl, IsFileURL, LoadFile, LoadImage, ReadFile, RequestFile, SetCorsBehavior) => {\n /**\n * Backwards compatibility.\n * @internal\n * @deprecated\n */\n FileTools = {\n DecodeBase64UrlToBinary,\n DecodeBase64UrlToString,\n DefaultRetryStrategy: FileToolsOptions.DefaultRetryStrategy,\n BaseUrl: FileToolsOptions.BaseUrl,\n CorsBehavior: FileToolsOptions.CorsBehavior,\n PreprocessUrl: FileToolsOptions.PreprocessUrl,\n IsBase64DataUrl,\n IsFileURL,\n LoadFile,\n LoadImage,\n ReadFile,\n RequestFile,\n SetCorsBehavior,\n };\n Object.defineProperty(FileTools, \"DefaultRetryStrategy\", {\n get: function () {\n return FileToolsOptions.DefaultRetryStrategy;\n },\n set: function (value) {\n FileToolsOptions.DefaultRetryStrategy = value;\n },\n });\n Object.defineProperty(FileTools, \"BaseUrl\", {\n get: function () {\n return FileToolsOptions.BaseUrl;\n },\n set: function (value) {\n FileToolsOptions.BaseUrl = value;\n },\n });\n Object.defineProperty(FileTools, \"PreprocessUrl\", {\n get: function () {\n return FileToolsOptions.PreprocessUrl;\n },\n set: function (value) {\n FileToolsOptions.PreprocessUrl = value;\n },\n });\n Object.defineProperty(FileTools, \"CorsBehavior\", {\n get: function () {\n return FileToolsOptions.CorsBehavior;\n },\n set: function (value) {\n FileToolsOptions.CorsBehavior = value;\n },\n });\n};\n_injectLTSFileTools(DecodeBase64UrlToBinary, DecodeBase64UrlToString, FileToolsOptions, IsBase64DataUrl, IsFileURL, LoadFile, LoadImage, ReadFile, RequestFile, SetCorsBehavior);\n//# sourceMappingURL=fileTools.js.map","import { Logger } from \"./logger.js\";\nimport { GetClass } from \"./typeStore.js\";\n/**\n * Class used to enable instantiation of objects by class name\n */\nexport class InstantiationTools {\n /**\n * Tries to instantiate a new object from a given class name\n * @param className defines the class name to instantiate\n * @returns the new object or null if the system was not able to do the instantiation\n */\n static Instantiate(className) {\n if (this.RegisteredExternalClasses && this.RegisteredExternalClasses[className]) {\n return this.RegisteredExternalClasses[className];\n }\n const internalClass = GetClass(className);\n if (internalClass) {\n return internalClass;\n }\n Logger.Warn(className + \" not found, you may have missed an import.\");\n const arr = className.split(\".\");\n let fn = window || this;\n for (let i = 0, len = arr.length; i < len; i++) {\n fn = fn[arr[i]];\n }\n if (typeof fn !== \"function\") {\n return null;\n }\n return fn;\n }\n}\n/**\n * Use this object to register external classes like custom textures or material\n * to allow the loaders to instantiate them\n */\nInstantiationTools.RegisteredExternalClasses = {};\n//# sourceMappingURL=instantiationTools.js.map","/**\n * Implementation from http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#answer-2117523\n * Be aware Math.random() could cause collisions, but:\n * \"All but 6 of the 128 bits of the ID are randomly generated, which means that for any two ids, there's a 1 in 2^^122 (or 5.3x10^^36) chance they'll collide\"\n * @returns a pseudo random id\n */\nexport function RandomGUID() {\n return \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\".replace(/[xy]/g, (c) => {\n const r = (Math.random() * 16) | 0, v = c === \"x\" ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n });\n}\n/**\n * Class used to manipulate GUIDs\n */\nexport const GUID = {\n /**\n * Implementation from http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#answer-2117523\n * Be aware Math.random() could cause collisions, but:\n * \"All but 6 of the 128 bits of the ID are randomly generated, which means that for any two ids, there's a 1 in 2^^122 (or 5.3x10^^36) chance they'll collide\"\n * @returns a pseudo random id\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n RandomId: RandomGUID,\n};\n//# sourceMappingURL=guid.js.map","import { Observable } from \"./observable.js\";\nimport { GetDOMTextContent, IsNavigatorAvailable, IsWindowObjectExist } from \"./domManagement.js\";\nimport { Logger } from \"./logger.js\";\nimport { DeepCopier } from \"./deepCopier.js\";\nimport { PrecisionDate } from \"./precisionDate.js\";\nimport { _WarnImport } from \"./devTools.js\";\nimport { WebRequest } from \"./webRequest.js\";\nimport { EngineStore } from \"../Engines/engineStore.js\";\nimport { FileToolsOptions, DecodeBase64UrlToBinary, IsBase64DataUrl, LoadFile as FileToolsLoadFile, LoadImage as FileToolLoadImage, ReadFile as FileToolsReadFile, SetCorsBehavior, } from \"./fileTools.js\";\nimport { TimingTools } from \"./timingTools.js\";\nimport { InstantiationTools } from \"./instantiationTools.js\";\nimport { RandomGUID } from \"./guid.js\";\n/**\n * Class containing a set of static utilities functions\n */\nexport class Tools {\n /**\n * Gets or sets the base URL to use to load assets\n */\n static get BaseUrl() {\n return FileToolsOptions.BaseUrl;\n }\n static set BaseUrl(value) {\n FileToolsOptions.BaseUrl = value;\n }\n /**\n * Gets or sets the retry strategy to apply when an error happens while loading an asset\n */\n static get DefaultRetryStrategy() {\n return FileToolsOptions.DefaultRetryStrategy;\n }\n static set DefaultRetryStrategy(strategy) {\n FileToolsOptions.DefaultRetryStrategy = strategy;\n }\n /**\n * Default behaviour for cors in the application.\n * It can be a string if the expected behavior is identical in the entire app.\n * Or a callback to be able to set it per url or on a group of them (in case of Video source for instance)\n */\n static get CorsBehavior() {\n return FileToolsOptions.CorsBehavior;\n }\n static set CorsBehavior(value) {\n FileToolsOptions.CorsBehavior = value;\n }\n /**\n * Gets or sets a global variable indicating if fallback texture must be used when a texture cannot be loaded\n * @ignorenaming\n */\n static get UseFallbackTexture() {\n return EngineStore.UseFallbackTexture;\n }\n static set UseFallbackTexture(value) {\n EngineStore.UseFallbackTexture = value;\n }\n /**\n * Use this object to register external classes like custom textures or material\n * to allow the loaders to instantiate them\n */\n static get RegisteredExternalClasses() {\n return InstantiationTools.RegisteredExternalClasses;\n }\n static set RegisteredExternalClasses(classes) {\n InstantiationTools.RegisteredExternalClasses = classes;\n }\n /**\n * Texture content used if a texture cannot loaded\n * @ignorenaming\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n static get fallbackTexture() {\n return EngineStore.FallbackTexture;\n }\n // eslint-disable-next-line @typescript-eslint/naming-convention\n static set fallbackTexture(value) {\n EngineStore.FallbackTexture = value;\n }\n /**\n * Read the content of a byte array at a specified coordinates (taking in account wrapping)\n * @param u defines the coordinate on X axis\n * @param v defines the coordinate on Y axis\n * @param width defines the width of the source data\n * @param height defines the height of the source data\n * @param pixels defines the source byte array\n * @param color defines the output color\n */\n static FetchToRef(u, v, width, height, pixels, color) {\n const wrappedU = (Math.abs(u) * width) % width | 0;\n const wrappedV = (Math.abs(v) * height) % height | 0;\n const position = (wrappedU + wrappedV * width) * 4;\n color.r = pixels[position] / 255;\n color.g = pixels[position + 1] / 255;\n color.b = pixels[position + 2] / 255;\n color.a = pixels[position + 3] / 255;\n }\n /**\n * Interpolates between a and b via alpha\n * @param a The lower value (returned when alpha = 0)\n * @param b The upper value (returned when alpha = 1)\n * @param alpha The interpolation-factor\n * @returns The mixed value\n */\n static Mix(a, b, alpha) {\n return a * (1 - alpha) + b * alpha;\n }\n /**\n * Tries to instantiate a new object from a given class name\n * @param className defines the class name to instantiate\n * @returns the new object or null if the system was not able to do the instantiation\n */\n static Instantiate(className) {\n return InstantiationTools.Instantiate(className);\n }\n /**\n * Polyfill for setImmediate\n * @param action defines the action to execute after the current execution block\n */\n static SetImmediate(action) {\n TimingTools.SetImmediate(action);\n }\n /**\n * Function indicating if a number is an exponent of 2\n * @param value defines the value to test\n * @returns true if the value is an exponent of 2\n */\n static IsExponentOfTwo(value) {\n let count = 1;\n do {\n count *= 2;\n } while (count < value);\n return count === value;\n }\n /**\n * Returns the nearest 32-bit single precision float representation of a Number\n * @param value A Number. If the parameter is of a different type, it will get converted\n * to a number or to NaN if it cannot be converted\n * @returns number\n */\n static FloatRound(value) {\n if (Math.fround) {\n return Math.fround(value);\n }\n return (Tools._TmpFloatArray[0] = value), Tools._TmpFloatArray[0];\n }\n /**\n * Extracts the filename from a path\n * @param path defines the path to use\n * @returns the filename\n */\n static GetFilename(path) {\n const index = path.lastIndexOf(\"/\");\n if (index < 0) {\n return path;\n }\n return path.substring(index + 1);\n }\n /**\n * Extracts the \"folder\" part of a path (everything before the filename).\n * @param uri The URI to extract the info from\n * @param returnUnchangedIfNoSlash Do not touch the URI if no slashes are present\n * @returns The \"folder\" part of the path\n */\n static GetFolderPath(uri, returnUnchangedIfNoSlash = false) {\n const index = uri.lastIndexOf(\"/\");\n if (index < 0) {\n if (returnUnchangedIfNoSlash) {\n return uri;\n }\n return \"\";\n }\n return uri.substring(0, index + 1);\n }\n /**\n * Convert an angle in radians to degrees\n * @param angle defines the angle to convert\n * @returns the angle in degrees\n */\n static ToDegrees(angle) {\n return (angle * 180) / Math.PI;\n }\n /**\n * Convert an angle in degrees to radians\n * @param angle defines the angle to convert\n * @returns the angle in radians\n */\n static ToRadians(angle) {\n return (angle * Math.PI) / 180;\n }\n /**\n * Smooth angle changes (kind of low-pass filter), in particular for device orientation \"shaking\"\n * Use trigonometric functions to avoid discontinuity (0/360, -180/180)\n * @param previousAngle defines last angle value, in degrees\n * @param newAngle defines new angle value, in degrees\n * @param smoothFactor defines smoothing sensitivity; min 0: no smoothing, max 1: new data ignored\n * @returns the angle in degrees\n */\n static SmoothAngleChange(previousAngle, newAngle, smoothFactor = 0.9) {\n const previousAngleRad = this.ToRadians(previousAngle);\n const newAngleRad = this.ToRadians(newAngle);\n return this.ToDegrees(Math.atan2((1 - smoothFactor) * Math.sin(newAngleRad) + smoothFactor * Math.sin(previousAngleRad), (1 - smoothFactor) * Math.cos(newAngleRad) + smoothFactor * Math.cos(previousAngleRad)));\n }\n /**\n * Returns an array if obj is not an array\n * @param obj defines the object to evaluate as an array\n * @param allowsNullUndefined defines a boolean indicating if obj is allowed to be null or undefined\n * @returns either obj directly if obj is an array or a new array containing obj\n */\n static MakeArray(obj, allowsNullUndefined) {\n if (allowsNullUndefined !== true && (obj === undefined || obj == null)) {\n return null;\n }\n return Array.isArray(obj) ? obj : [obj];\n }\n /**\n * Gets the pointer prefix to use\n * @param engine defines the engine we are finding the prefix for\n * @returns \"pointer\" if touch is enabled. Else returns \"mouse\"\n */\n static GetPointerPrefix(engine) {\n let eventPrefix = \"pointer\";\n // Check if pointer events are supported\n if (IsWindowObjectExist() && !window.PointerEvent) {\n eventPrefix = \"mouse\";\n }\n // Special Fallback MacOS Safari...\n if (engine._badDesktopOS &&\n !engine._badOS &&\n // And not ipad pros who claim to be macs...\n !(document && \"ontouchend\" in document)) {\n eventPrefix = \"mouse\";\n }\n return eventPrefix;\n }\n /**\n * Sets the cors behavior on a dom element. This will add the required Tools.CorsBehavior to the element.\n * @param url define the url we are trying\n * @param element define the dom element where to configure the cors policy\n * @param element.crossOrigin\n */\n static SetCorsBehavior(url, element) {\n SetCorsBehavior(url, element);\n }\n /**\n * Sets the referrerPolicy behavior on a dom element.\n * @param referrerPolicy define the referrer policy to use\n * @param element define the dom element where to configure the referrer policy\n * @param element.referrerPolicy\n */\n static SetReferrerPolicyBehavior(referrerPolicy, element) {\n element.referrerPolicy = referrerPolicy;\n }\n // External files\n /**\n * Removes unwanted characters from an url\n * @param url defines the url to clean\n * @returns the cleaned url\n */\n static CleanUrl(url) {\n url = url.replace(/#/gm, \"%23\");\n return url;\n }\n /**\n * Gets or sets a function used to pre-process url before using them to load assets\n */\n static get PreprocessUrl() {\n return FileToolsOptions.PreprocessUrl;\n }\n static set PreprocessUrl(processor) {\n FileToolsOptions.PreprocessUrl = processor;\n }\n /**\n * Loads an image as an HTMLImageElement.\n * @param input url string, ArrayBuffer, or Blob to load\n * @param onLoad callback called when the image successfully loads\n * @param onError callback called when the image fails to load\n * @param offlineProvider offline provider for caching\n * @param mimeType optional mime type\n * @param imageBitmapOptions optional the options to use when creating an ImageBitmap\n * @returns the HTMLImageElement of the loaded image\n */\n static LoadImage(input, onLoad, onError, offlineProvider, mimeType, imageBitmapOptions) {\n return FileToolLoadImage(input, onLoad, onError, offlineProvider, mimeType, imageBitmapOptions);\n }\n /**\n * Loads a file from a url\n * @param url url string, ArrayBuffer, or Blob to load\n * @param onSuccess callback called when the file successfully loads\n * @param onProgress callback called while file is loading (if the server supports this mode)\n * @param offlineProvider defines the offline provider for caching\n * @param useArrayBuffer defines a boolean indicating that date must be returned as ArrayBuffer\n * @param onError callback called when the file fails to load\n * @returns a file request object\n */\n static LoadFile(url, onSuccess, onProgress, offlineProvider, useArrayBuffer, onError) {\n return FileToolsLoadFile(url, onSuccess, onProgress, offlineProvider, useArrayBuffer, onError);\n }\n /**\n * Loads a file from a url\n * @param url the file url to load\n * @param useArrayBuffer defines a boolean indicating that date must be returned as ArrayBuffer\n * @returns a promise containing an ArrayBuffer corresponding to the loaded file\n */\n static LoadFileAsync(url, useArrayBuffer = true) {\n return new Promise((resolve, reject) => {\n FileToolsLoadFile(url, (data) => {\n resolve(data);\n }, undefined, undefined, useArrayBuffer, (request, exception) => {\n reject(exception);\n });\n });\n }\n /**\n * Load a script (identified by an url). When the url returns, the\n * content of this file is added into a new script element, attached to the DOM (body element)\n * @param scriptUrl defines the url of the script to laod\n * @param onSuccess defines the callback called when the script is loaded\n * @param onError defines the callback to call if an error occurs\n * @param scriptId defines the id of the script element\n */\n static LoadScript(scriptUrl, onSuccess, onError, scriptId) {\n if (typeof importScripts === \"function\") {\n try {\n importScripts(scriptUrl);\n onSuccess();\n }\n catch (e) {\n onError === null || onError === void 0 ? void 0 : onError(`Unable to load script '${scriptUrl}' in worker`, e);\n }\n return;\n }\n else if (!IsWindowObjectExist()) {\n onError === null || onError === void 0 ? void 0 : onError(`Cannot load script '${scriptUrl}' outside of a window or a worker`);\n return;\n }\n const head = document.getElementsByTagName(\"head\")[0];\n const script = document.createElement(\"script\");\n script.setAttribute(\"type\", \"text/javascript\");\n script.setAttribute(\"src\", scriptUrl);\n if (scriptId) {\n script.id = scriptId;\n }\n script.onload = () => {\n if (onSuccess) {\n onSuccess();\n }\n };\n script.onerror = (e) => {\n if (onError) {\n onError(`Unable to load script '${scriptUrl}'`, e);\n }\n };\n head.appendChild(script);\n }\n /**\n * Load an asynchronous script (identified by an url). When the url returns, the\n * content of this file is added into a new script element, attached to the DOM (body element)\n * @param scriptUrl defines the url of the script to laod\n * @returns a promise request object\n */\n static LoadScriptAsync(scriptUrl) {\n return new Promise((resolve, reject) => {\n this.LoadScript(scriptUrl, () => {\n resolve();\n }, (message, exception) => {\n reject(exception || new Error(message));\n });\n });\n }\n /**\n * Loads a file from a blob\n * @param fileToLoad defines the blob to use\n * @param callback defines the callback to call when data is loaded\n * @param progressCallback defines the callback to call during loading process\n * @returns a file request object\n */\n static ReadFileAsDataURL(fileToLoad, callback, progressCallback) {\n const reader = new FileReader();\n const request = {\n onCompleteObservable: new Observable(),\n abort: () => reader.abort(),\n };\n reader.onloadend = () => {\n request.onCompleteObservable.notifyObservers(request);\n };\n reader.onload = (e) => {\n //target doesn't have result from ts 1.3\n callback(e.target[\"result\"]);\n };\n reader.onprogress = progressCallback;\n reader.readAsDataURL(fileToLoad);\n return request;\n }\n /**\n * Reads a file from a File object\n * @param file defines the file to load\n * @param onSuccess defines the callback to call when data is loaded\n * @param onProgress defines the callback to call during loading process\n * @param useArrayBuffer defines a boolean indicating that data must be returned as an ArrayBuffer\n * @param onError defines the callback to call when an error occurs\n * @returns a file request object\n */\n static ReadFile(file, onSuccess, onProgress, useArrayBuffer, onError) {\n return FileToolsReadFile(file, onSuccess, onProgress, useArrayBuffer, onError);\n }\n /**\n * Creates a data url from a given string content\n * @param content defines the content to convert\n * @returns the new data url link\n */\n static FileAsURL(content) {\n const fileBlob = new Blob([content]);\n const url = window.URL;\n const link = url.createObjectURL(fileBlob);\n return link;\n }\n /**\n * Format the given number to a specific decimal format\n * @param value defines the number to format\n * @param decimals defines the number of decimals to use\n * @returns the formatted string\n */\n static Format(value, decimals = 2) {\n return value.toFixed(decimals);\n }\n /**\n * Tries to copy an object by duplicating every property\n * @param source defines the source object\n * @param destination defines the target object\n * @param doNotCopyList defines a list of properties to avoid\n * @param mustCopyList defines a list of properties to copy (even if they start with _)\n */\n static DeepCopy(source, destination, doNotCopyList, mustCopyList) {\n DeepCopier.DeepCopy(source, destination, doNotCopyList, mustCopyList);\n }\n /**\n * Gets a boolean indicating if the given object has no own property\n * @param obj defines the object to test\n * @returns true if object has no own property\n */\n static IsEmpty(obj) {\n for (const i in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, i)) {\n return false;\n }\n }\n return true;\n }\n /**\n * Function used to register events at window level\n * @param windowElement defines the Window object to use\n * @param events defines the events to register\n */\n static RegisterTopRootEvents(windowElement, events) {\n for (let index = 0; index < events.length; index++) {\n const event = events[index];\n windowElement.addEventListener(event.name, event.handler, false);\n try {\n if (window.parent) {\n window.parent.addEventListener(event.name, event.handler, false);\n }\n }\n catch (e) {\n // Silently fails...\n }\n }\n }\n /**\n * Function used to unregister events from window level\n * @param windowElement defines the Window object to use\n * @param events defines the events to unregister\n */\n static UnregisterTopRootEvents(windowElement, events) {\n for (let index = 0; index < events.length; index++) {\n const event = events[index];\n windowElement.removeEventListener(event.name, event.handler);\n try {\n if (windowElement.parent) {\n windowElement.parent.removeEventListener(event.name, event.handler);\n }\n }\n catch (e) {\n // Silently fails...\n }\n }\n }\n /**\n * Dumps the current bound framebuffer\n * @param width defines the rendering width\n * @param height defines the rendering height\n * @param engine defines the hosting engine\n * @param successCallback defines the callback triggered once the data are available\n * @param mimeType defines the mime type of the result\n * @param fileName defines the filename to download. If present, the result will automatically be downloaded\n * @param quality The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob | HTMLCanvasElement.toBlob()}'s `quality` parameter.\n * @returns a void promise\n */\n static async DumpFramebuffer(width, height, engine, successCallback, mimeType = \"image/png\", fileName, quality) {\n throw _WarnImport(\"DumpTools\");\n }\n /**\n * Dumps an array buffer\n * @param width defines the rendering width\n * @param height defines the rendering height\n * @param data the data array\n * @param successCallback defines the callback triggered once the data are available\n * @param mimeType defines the mime type of the result\n * @param fileName defines the filename to download. If present, the result will automatically be downloaded\n * @param invertY true to invert the picture in the Y dimension\n * @param toArrayBuffer true to convert the data to an ArrayBuffer (encoded as `mimeType`) instead of a base64 string\n * @param quality The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob | HTMLCanvasElement.toBlob()}'s `quality` parameter.\n */\n static DumpData(width, height, data, successCallback, mimeType = \"image/png\", fileName, invertY = false, toArrayBuffer = false, quality) {\n throw _WarnImport(\"DumpTools\");\n }\n /**\n * Dumps an array buffer\n * @param width defines the rendering width\n * @param height defines the rendering height\n * @param data the data array\n * @param mimeType defines the mime type of the result\n * @param fileName defines the filename to download. If present, the result will automatically be downloaded\n * @param invertY true to invert the picture in the Y dimension\n * @param toArrayBuffer true to convert the data to an ArrayBuffer (encoded as `mimeType`) instead of a base64 string\n * @param quality The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob | HTMLCanvasElement.toBlob()}'s `quality` parameter.\n * @returns a promise that resolve to the final data\n */\n static DumpDataAsync(width, height, data, mimeType = \"image/png\", fileName, invertY = false, toArrayBuffer = false, quality) {\n throw _WarnImport(\"DumpTools\");\n }\n static _IsOffScreenCanvas(canvas) {\n return canvas.convertToBlob !== undefined;\n }\n /**\n * Converts the canvas data to blob.\n * This acts as a polyfill for browsers not supporting the to blob function.\n * @param canvas Defines the canvas to extract the data from (can be an offscreen canvas)\n * @param successCallback Defines the callback triggered once the data are available\n * @param mimeType Defines the mime type of the result\n * @param quality The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob | HTMLCanvasElement.toBlob()}'s `quality` parameter.\n */\n static ToBlob(canvas, successCallback, mimeType = \"image/png\", quality) {\n // We need HTMLCanvasElement.toBlob for HD screenshots\n if (!Tools._IsOffScreenCanvas(canvas) && !canvas.toBlob) {\n // low performance polyfill based on toDataURL (https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob)\n canvas.toBlob = function (callback, type, quality) {\n setTimeout(() => {\n const binStr = atob(this.toDataURL(type, quality).split(\",\")[1]), len = binStr.length, arr = new Uint8Array(len);\n for (let i = 0; i < len; i++) {\n arr[i] = binStr.charCodeAt(i);\n }\n callback(new Blob([arr]));\n });\n };\n }\n if (Tools._IsOffScreenCanvas(canvas)) {\n canvas\n .convertToBlob({\n type: mimeType,\n quality,\n })\n .then((blob) => successCallback(blob));\n }\n else {\n canvas.toBlob(function (blob) {\n successCallback(blob);\n }, mimeType, quality);\n }\n }\n /**\n * Download a Blob object\n * @param blob the Blob object\n * @param fileName the file name to download\n * @returns\n */\n static DownloadBlob(blob, fileName) {\n //Creating a link if the browser have the download attribute on the a tag, to automatically start download generated image.\n if (\"download\" in document.createElement(\"a\")) {\n if (!fileName) {\n const date = new Date();\n const stringDate = (date.getFullYear() + \"-\" + (date.getMonth() + 1)).slice(2) + \"-\" + date.getDate() + \"_\" + date.getHours() + \"-\" + (\"0\" + date.getMinutes()).slice(-2);\n fileName = \"screenshot_\" + stringDate + \".png\";\n }\n Tools.Download(blob, fileName);\n }\n else {\n if (blob && typeof URL !== \"undefined\") {\n const url = URL.createObjectURL(blob);\n const newWindow = window.open(\"\");\n if (!newWindow) {\n return;\n }\n const img = newWindow.document.createElement(\"img\");\n img.onload = function () {\n // no longer need to read the blob so it's revoked\n URL.revokeObjectURL(url);\n };\n img.src = url;\n newWindow.document.body.appendChild(img);\n }\n }\n }\n /**\n * Encodes the canvas data to base 64, or automatically downloads the result if `fileName` is defined.\n * @param canvas The canvas to get the data from, which can be an offscreen canvas.\n * @param successCallback The callback which is triggered once the data is available. If `fileName` is defined, the callback will be invoked after the download occurs, and the `data` argument will be an empty string.\n * @param mimeType The mime type of the result.\n * @param fileName The name of the file to download. If defined, the result will automatically be downloaded. If not defined, and `successCallback` is also not defined, the result will automatically be downloaded with an auto-generated file name.\n * @param quality The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob | HTMLCanvasElement.toBlob()}'s `quality` parameter.\n */\n static EncodeScreenshotCanvasData(canvas, successCallback, mimeType = \"image/png\", fileName, quality) {\n if (typeof fileName === \"string\" || !successCallback) {\n this.ToBlob(canvas, function (blob) {\n if (blob) {\n Tools.DownloadBlob(blob, fileName);\n }\n if (successCallback) {\n successCallback(\"\");\n }\n }, mimeType, quality);\n }\n else if (successCallback) {\n if (Tools._IsOffScreenCanvas(canvas)) {\n canvas\n .convertToBlob({\n type: mimeType,\n quality,\n })\n .then((blob) => {\n const reader = new FileReader();\n reader.readAsDataURL(blob);\n reader.onloadend = () => {\n const base64data = reader.result;\n successCallback(base64data);\n };\n });\n return;\n }\n const base64Image = canvas.toDataURL(mimeType, quality);\n successCallback(base64Image);\n }\n }\n /**\n * Downloads a blob in the browser\n * @param blob defines the blob to download\n * @param fileName defines the name of the downloaded file\n */\n static Download(blob, fileName) {\n if (typeof URL === \"undefined\") {\n return;\n }\n const url = window.URL.createObjectURL(blob);\n const a = document.createElement(\"a\");\n document.body.appendChild(a);\n a.style.display = \"none\";\n a.href = url;\n a.download = fileName;\n a.addEventListener(\"click\", () => {\n if (a.parentElement) {\n a.parentElement.removeChild(a);\n }\n });\n a.click();\n window.URL.revokeObjectURL(url);\n }\n /**\n * Will return the right value of the noPreventDefault variable\n * Needed to keep backwards compatibility to the old API.\n *\n * @param args arguments passed to the attachControl function\n * @returns the correct value for noPreventDefault\n */\n static BackCompatCameraNoPreventDefault(args) {\n // is it used correctly?\n if (typeof args[0] === \"boolean\") {\n return args[0];\n }\n else if (typeof args[1] === \"boolean\") {\n return args[1];\n }\n return false;\n }\n /**\n * Captures a screenshot of the current rendering\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/renderToPNG\n * @param engine defines the rendering engine\n * @param camera defines the source camera\n * @param size This parameter can be set to a single number or to an object with the\n * following (optional) properties: precision, width, height. If a single number is passed,\n * it will be used for both width and height. If an object is passed, the screenshot size\n * will be derived from the parameters. The precision property is a multiplier allowing\n * rendering at a higher or lower resolution\n * @param successCallback defines the callback receives a single parameter which contains the\n * screenshot as a string of base64-encoded characters. This string can be assigned to the\n * src parameter of an to display it\n * @param mimeType defines the MIME type of the screenshot image (default: image/png).\n * Check your browser for supported MIME types\n * @param forceDownload force the system to download the image even if a successCallback is provided\n * @param quality The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob | HTMLCanvasElement.toBlob()}'s `quality` parameter.\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static CreateScreenshot(engine, camera, size, successCallback, mimeType = \"image/png\", forceDownload = false, quality) {\n throw _WarnImport(\"ScreenshotTools\");\n }\n /**\n * Captures a screenshot of the current rendering\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/renderToPNG\n * @param engine defines the rendering engine\n * @param camera defines the source camera\n * @param size This parameter can be set to a single number or to an object with the\n * following (optional) properties: precision, width, height. If a single number is passed,\n * it will be used for both width and height. If an object is passed, the screenshot size\n * will be derived from the parameters. The precision property is a multiplier allowing\n * rendering at a higher or lower resolution\n * @param mimeType defines the MIME type of the screenshot image (default: image/png).\n * Check your browser for supported MIME types\n * @param quality The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob | HTMLCanvasElement.toBlob()}'s `quality` parameter.\n * @returns screenshot as a string of base64-encoded characters. This string can be assigned\n * to the src parameter of an to display it\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static CreateScreenshotAsync(engine, camera, size, mimeType = \"image/png\", quality) {\n throw _WarnImport(\"ScreenshotTools\");\n }\n /**\n * Generates an image screenshot from the specified camera.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/renderToPNG\n * @param engine The engine to use for rendering\n * @param camera The camera to use for rendering\n * @param size This parameter can be set to a single number or to an object with the\n * following (optional) properties: precision, width, height. If a single number is passed,\n * it will be used for both width and height. If an object is passed, the screenshot size\n * will be derived from the parameters. The precision property is a multiplier allowing\n * rendering at a higher or lower resolution\n * @param successCallback The callback receives a single parameter which contains the\n * screenshot as a string of base64-encoded characters. This string can be assigned to the\n * src parameter of an to display it\n * @param mimeType The MIME type of the screenshot image (default: image/png).\n * Check your browser for supported MIME types\n * @param samples Texture samples (default: 1)\n * @param antialiasing Whether antialiasing should be turned on or not (default: false)\n * @param fileName A name for for the downloaded file.\n * @param renderSprites Whether the sprites should be rendered or not (default: false)\n * @param enableStencilBuffer Whether the stencil buffer should be enabled or not (default: false)\n * @param useLayerMask if the camera's layer mask should be used to filter what should be rendered (default: true)\n * @param quality The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob | HTMLCanvasElement.toBlob()}'s `quality` parameter.\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static CreateScreenshotUsingRenderTarget(engine, camera, size, successCallback, mimeType = \"image/png\", samples = 1, antialiasing = false, fileName, renderSprites = false, enableStencilBuffer = false, useLayerMask = true, quality) {\n throw _WarnImport(\"ScreenshotTools\");\n }\n /**\n * Generates an image screenshot from the specified camera.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/renderToPNG\n * @param engine The engine to use for rendering\n * @param camera The camera to use for rendering\n * @param size This parameter can be set to a single number or to an object with the\n * following (optional) properties: precision, width, height. If a single number is passed,\n * it will be used for both width and height. If an object is passed, the screenshot size\n * will be derived from the parameters. The precision property is a multiplier allowing\n * rendering at a higher or lower resolution\n * @param mimeType The MIME type of the screenshot image (default: image/png).\n * Check your browser for supported MIME types\n * @param samples Texture samples (default: 1)\n * @param antialiasing Whether antialiasing should be turned on or not (default: false)\n * @param fileName A name for for the downloaded file.\n * @returns screenshot as a string of base64-encoded characters. This string can be assigned\n * @param renderSprites Whether the sprites should be rendered or not (default: false)\n * @param enableStencilBuffer Whether the stencil buffer should be enabled or not (default: false)\n * @param useLayerMask if the camera's layer mask should be used to filter what should be rendered (default: true)\n * @param quality The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob | HTMLCanvasElement.toBlob()}'s `quality` parameter.\n * to the src parameter of an to display it\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static CreateScreenshotUsingRenderTargetAsync(engine, camera, size, mimeType = \"image/png\", samples = 1, antialiasing = false, fileName, renderSprites = false, enableStencilBuffer = false, useLayerMask = true, quality) {\n throw _WarnImport(\"ScreenshotTools\");\n }\n /**\n * Implementation from http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#answer-2117523\n * Be aware Math.random() could cause collisions, but:\n * \"All but 6 of the 128 bits of the ID are randomly generated, which means that for any two ids, there's a 1 in 2^^122 (or 5.3x10^^36) chance they'll collide\"\n * @returns a pseudo random id\n */\n static RandomId() {\n return RandomGUID();\n }\n /**\n * Test if the given uri is a base64 string\n * @deprecated Please use FileTools.IsBase64DataUrl instead.\n * @param uri The uri to test\n * @returns True if the uri is a base64 string or false otherwise\n */\n static IsBase64(uri) {\n return IsBase64DataUrl(uri);\n }\n /**\n * Decode the given base64 uri.\n * @deprecated Please use FileTools.DecodeBase64UrlToBinary instead.\n * @param uri The uri to decode\n * @returns The decoded base64 data.\n */\n static DecodeBase64(uri) {\n return DecodeBase64UrlToBinary(uri);\n }\n /**\n * Gets a value indicating the number of loading errors\n * @ignorenaming\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n static get errorsCount() {\n return Logger.errorsCount;\n }\n /**\n * Log a message to the console\n * @param message defines the message to log\n */\n static Log(message) {\n Logger.Log(message);\n }\n /**\n * Write a warning message to the console\n * @param message defines the message to log\n */\n static Warn(message) {\n Logger.Warn(message);\n }\n /**\n * Write an error message to the console\n * @param message defines the message to log\n */\n static Error(message) {\n Logger.Error(message);\n }\n /**\n * Gets current log cache (list of logs)\n */\n static get LogCache() {\n return Logger.LogCache;\n }\n /**\n * Clears the log cache\n */\n static ClearLogCache() {\n Logger.ClearLogCache();\n }\n /**\n * Sets the current log level (MessageLogLevel / WarningLogLevel / ErrorLogLevel)\n */\n static set LogLevels(level) {\n Logger.LogLevels = level;\n }\n /**\n * Sets the current performance log level\n */\n static set PerformanceLogLevel(level) {\n if ((level & Tools.PerformanceUserMarkLogLevel) === Tools.PerformanceUserMarkLogLevel) {\n Tools.StartPerformanceCounter = Tools._StartUserMark;\n Tools.EndPerformanceCounter = Tools._EndUserMark;\n return;\n }\n if ((level & Tools.PerformanceConsoleLogLevel) === Tools.PerformanceConsoleLogLevel) {\n Tools.StartPerformanceCounter = Tools._StartPerformanceConsole;\n Tools.EndPerformanceCounter = Tools._EndPerformanceConsole;\n return;\n }\n Tools.StartPerformanceCounter = Tools._StartPerformanceCounterDisabled;\n Tools.EndPerformanceCounter = Tools._EndPerformanceCounterDisabled;\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static _StartPerformanceCounterDisabled(counterName, condition) { }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static _EndPerformanceCounterDisabled(counterName, condition) { }\n static _StartUserMark(counterName, condition = true) {\n if (!Tools._Performance) {\n if (!IsWindowObjectExist()) {\n return;\n }\n Tools._Performance = window.performance;\n }\n if (!condition || !Tools._Performance.mark) {\n return;\n }\n Tools._Performance.mark(counterName + \"-Begin\");\n }\n static _EndUserMark(counterName, condition = true) {\n if (!condition || !Tools._Performance.mark) {\n return;\n }\n Tools._Performance.mark(counterName + \"-End\");\n Tools._Performance.measure(counterName, counterName + \"-Begin\", counterName + \"-End\");\n }\n static _StartPerformanceConsole(counterName, condition = true) {\n if (!condition) {\n return;\n }\n Tools._StartUserMark(counterName, condition);\n if (console.time) {\n console.time(counterName);\n }\n }\n static _EndPerformanceConsole(counterName, condition = true) {\n if (!condition) {\n return;\n }\n Tools._EndUserMark(counterName, condition);\n console.timeEnd(counterName);\n }\n /**\n * Gets either window.performance.now() if supported or Date.now() else\n */\n static get Now() {\n return PrecisionDate.Now;\n }\n /**\n * This method will return the name of the class used to create the instance of the given object.\n * It will works only on Javascript basic data types (number, string, ...) and instance of class declared with the @className decorator.\n * @param object the object to get the class name from\n * @param isType defines if the object is actually a type\n * @returns the name of the class, will be \"object\" for a custom data type not using the @className decorator\n */\n static GetClassName(object, isType = false) {\n let name = null;\n if (!isType && object.getClassName) {\n name = object.getClassName();\n }\n else {\n if (object instanceof Object) {\n const classObj = isType ? object : Object.getPrototypeOf(object);\n name = classObj.constructor[\"__bjsclassName__\"];\n }\n if (!name) {\n name = typeof object;\n }\n }\n return name;\n }\n /**\n * Gets the first element of an array satisfying a given predicate\n * @param array defines the array to browse\n * @param predicate defines the predicate to use\n * @returns null if not found or the element\n */\n static First(array, predicate) {\n for (const el of array) {\n if (predicate(el)) {\n return el;\n }\n }\n return null;\n }\n /**\n * This method will return the name of the full name of the class, including its owning module (if any).\n * It will works only on Javascript basic data types (number, string, ...) and instance of class declared with the @className decorator or implementing a method getClassName():string (in which case the module won't be specified).\n * @param object the object to get the class name from\n * @param isType defines if the object is actually a type\n * @returns a string that can have two forms: \"moduleName.className\" if module was specified when the class' Name was registered or \"className\" if there was not module specified.\n * @ignorenaming\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n static getFullClassName(object, isType = false) {\n let className = null;\n let moduleName = null;\n if (!isType && object.getClassName) {\n className = object.getClassName();\n }\n else {\n if (object instanceof Object) {\n const classObj = isType ? object : Object.getPrototypeOf(object);\n className = classObj.constructor[\"__bjsclassName__\"];\n moduleName = classObj.constructor[\"__bjsmoduleName__\"];\n }\n if (!className) {\n className = typeof object;\n }\n }\n if (!className) {\n return null;\n }\n return (moduleName != null ? moduleName + \".\" : \"\") + className;\n }\n /**\n * Returns a promise that resolves after the given amount of time.\n * @param delay Number of milliseconds to delay\n * @returns Promise that resolves after the given amount of time\n */\n static DelayAsync(delay) {\n return new Promise((resolve) => {\n setTimeout(() => {\n resolve();\n }, delay);\n });\n }\n /**\n * Utility function to detect if the current user agent is Safari\n * @returns whether or not the current user agent is safari\n */\n static IsSafari() {\n if (!IsNavigatorAvailable()) {\n return false;\n }\n return /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\n }\n}\n/**\n * Enable/Disable Custom HTTP Request Headers globally.\n * default = false\n * @see CustomRequestHeaders\n */\nTools.UseCustomRequestHeaders = false;\n/**\n * Custom HTTP Request Headers to be sent with XMLHttpRequests\n * i.e. when loading files, where the server/service expects an Authorization header\n */\nTools.CustomRequestHeaders = WebRequest.CustomRequestHeaders;\nTools._TmpFloatArray = new Float32Array(1);\n/**\n * Extracts text content from a DOM element hierarchy\n * Back Compat only, please use GetDOMTextContent instead.\n */\nTools.GetDOMTextContent = GetDOMTextContent;\nTools.GetAbsoluteUrl = typeof document === \"object\"\n ? (url) => {\n const a = document.createElement(\"a\");\n a.href = url;\n return a.href;\n }\n : typeof URL === \"function\" && typeof location === \"object\"\n ? (url) => new URL(url, location.origin).href\n : () => {\n throw new Error(\"Unable to get absolute URL. Override BABYLON.Tools.GetAbsoluteUrl to a custom implementation for the current context.\");\n };\n// Logs\n/**\n * No log\n */\nTools.NoneLogLevel = Logger.NoneLogLevel;\n/**\n * Only message logs\n */\nTools.MessageLogLevel = Logger.MessageLogLevel;\n/**\n * Only warning logs\n */\nTools.WarningLogLevel = Logger.WarningLogLevel;\n/**\n * Only error logs\n */\nTools.ErrorLogLevel = Logger.ErrorLogLevel;\n/**\n * All logs\n */\nTools.AllLogLevel = Logger.AllLogLevel;\n/**\n * Checks if the window object exists\n * Back Compat only, please use IsWindowObjectExist instead.\n */\nTools.IsWindowObjectExist = IsWindowObjectExist;\n// Performances\n/**\n * No performance log\n */\nTools.PerformanceNoneLogLevel = 0;\n/**\n * Use user marks to log performance\n */\nTools.PerformanceUserMarkLogLevel = 1;\n/**\n * Log performance to the console\n */\nTools.PerformanceConsoleLogLevel = 2;\n/**\n * Starts a performance counter\n */\nTools.StartPerformanceCounter = Tools._StartPerformanceCounterDisabled;\n/**\n * Ends a specific performance counter\n */\nTools.EndPerformanceCounter = Tools._EndPerformanceCounterDisabled;\n/**\n * Use this className as a decorator on a given class definition to add it a name and optionally its module.\n * You can then use the Tools.getClassName(obj) on an instance to retrieve its class name.\n * This method is the only way to get it done in all cases, even if the .js file declaring the class is minified\n * @param name The name of the class, case should be preserved\n * @param module The name of the Module hosting the class, optional, but strongly recommended to specify if possible. Case should be preserved.\n */\nexport function className(name, module) {\n return (target) => {\n target[\"__bjsclassName__\"] = name;\n target[\"__bjsmoduleName__\"] = module != null ? module : null;\n };\n}\n/**\n * An implementation of a loop for asynchronous functions.\n */\nexport class AsyncLoop {\n /**\n * Constructor.\n * @param iterations the number of iterations.\n * @param func the function to run each iteration\n * @param successCallback the callback that will be called upon successful execution\n * @param offset starting offset.\n */\n constructor(\n /**\n * Defines the number of iterations for the loop\n */\n iterations, func, successCallback, offset = 0) {\n this.iterations = iterations;\n this.index = offset - 1;\n this._done = false;\n this._fn = func;\n this._successCallback = successCallback;\n }\n /**\n * Execute the next iteration. Must be called after the last iteration was finished.\n */\n executeNext() {\n if (!this._done) {\n if (this.index + 1 < this.iterations) {\n ++this.index;\n this._fn(this);\n }\n else {\n this.breakLoop();\n }\n }\n }\n /**\n * Break the loop and run the success callback.\n */\n breakLoop() {\n this._done = true;\n this._successCallback();\n }\n /**\n * Create and run an async loop.\n * @param iterations the number of iterations.\n * @param fn the function to run each iteration\n * @param successCallback the callback that will be called upon successful execution\n * @param offset starting offset.\n * @returns the created async loop object\n */\n static Run(iterations, fn, successCallback, offset = 0) {\n const loop = new AsyncLoop(iterations, fn, successCallback, offset);\n loop.executeNext();\n return loop;\n }\n /**\n * A for-loop that will run a given number of iterations synchronous and the rest async.\n * @param iterations total number of iterations\n * @param syncedIterations number of synchronous iterations in each async iteration.\n * @param fn the function to call each iteration.\n * @param callback a success call back that will be called when iterating stops.\n * @param breakFunction a break condition (optional)\n * @param timeout timeout settings for the setTimeout function. default - 0.\n * @returns the created async loop object\n */\n static SyncAsyncForLoop(iterations, syncedIterations, fn, callback, breakFunction, timeout = 0) {\n return AsyncLoop.Run(Math.ceil(iterations / syncedIterations), (loop) => {\n if (breakFunction && breakFunction()) {\n loop.breakLoop();\n }\n else {\n setTimeout(() => {\n for (let i = 0; i < syncedIterations; ++i) {\n const iteration = loop.index * syncedIterations + i;\n if (iteration >= iterations) {\n break;\n }\n fn(iteration);\n if (breakFunction && breakFunction()) {\n loop.breakLoop();\n break;\n }\n }\n loop.executeNext();\n }, timeout);\n }\n }, callback);\n }\n}\n// Will only be define if Tools is imported freeing up some space when only engine is required\nEngineStore.FallbackTexture =\n \"data:image/jpg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD/4QBmRXhpZgAATU0AKgAAAAgABAEaAAUAAAABAAAAPgEbAAUAAAABAAAARgEoAAMAAAABAAIAAAExAAIAAAAQAAAATgAAAAAAAABgAAAAAQAAAGAAAAABcGFpbnQubmV0IDQuMC41AP/bAEMABAIDAwMCBAMDAwQEBAQFCQYFBQUFCwgIBgkNCw0NDQsMDA4QFBEODxMPDAwSGBITFRYXFxcOERkbGRYaFBYXFv/bAEMBBAQEBQUFCgYGChYPDA8WFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFv/AABEIAQABAAMBIgACEQEDEQH/xAAfAAABBQEBAQEBAQAAAAAAAAAAAQIDBAUGBwgJCgv/xAC1EAACAQMDAgQDBQUEBAAAAX0BAgMABBEFEiExQQYTUWEHInEUMoGRoQgjQrHBFVLR8CQzYnKCCQoWFxgZGiUmJygpKjQ1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4eLj5OXm5+jp6vHy8/T19vf4+fr/xAAfAQADAQEBAQEBAQEBAAAAAAAAAQIDBAUGBwgJCgv/xAC1EQACAQIEBAMEBwUEBAABAncAAQIDEQQFITEGEkFRB2FxEyIygQgUQpGhscEJIzNS8BVictEKFiQ04SXxFxgZGiYnKCkqNTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqCg4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2dri4+Tl5ufo6ery8/T19vf4+fr/2gAMAwEAAhEDEQA/APH6KKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FCiiigD6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++gooooA+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gUKKKKAPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76CiiigD5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BQooooA+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/voKKKKAPl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FCiiigD6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++gooooA+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gUKKKKAPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76CiiigD5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BQooooA+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/voKKKKAPl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FCiiigD6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++gooooA+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gUKKKKAPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76P//Z\";\n//# sourceMappingURL=tools.js.map","/**\n * Defines an GC Friendly array where the backfield array do not shrink to prevent over allocations.\n */\nexport class SmartArray {\n /**\n * Instantiates a Smart Array.\n * @param capacity defines the default capacity of the array.\n */\n constructor(capacity) {\n /**\n * The active length of the array.\n */\n this.length = 0;\n this.data = new Array(capacity);\n this._id = SmartArray._GlobalId++;\n }\n /**\n * Pushes a value at the end of the active data.\n * @param value defines the object to push in the array.\n */\n push(value) {\n this.data[this.length++] = value;\n if (this.length > this.data.length) {\n this.data.length *= 2;\n }\n }\n /**\n * Iterates over the active data and apply the lambda to them.\n * @param func defines the action to apply on each value.\n */\n forEach(func) {\n for (let index = 0; index < this.length; index++) {\n func(this.data[index]);\n }\n }\n /**\n * Sorts the full sets of data.\n * @param compareFn defines the comparison function to apply.\n */\n sort(compareFn) {\n this.data.sort(compareFn);\n }\n /**\n * Resets the active data to an empty array.\n */\n reset() {\n this.length = 0;\n }\n /**\n * Releases all the data from the array as well as the array.\n */\n dispose() {\n this.reset();\n if (this.data) {\n this.data.length = 0;\n }\n }\n /**\n * Concats the active data with a given array.\n * @param array defines the data to concatenate with.\n */\n concat(array) {\n if (array.length === 0) {\n return;\n }\n if (this.length + array.length > this.data.length) {\n this.data.length = (this.length + array.length) * 2;\n }\n for (let index = 0; index < array.length; index++) {\n this.data[this.length++] = (array.data || array)[index];\n }\n }\n /**\n * Returns the position of a value in the active data.\n * @param value defines the value to find the index for\n * @returns the index if found in the active data otherwise -1\n */\n indexOf(value) {\n const position = this.data.indexOf(value);\n if (position >= this.length) {\n return -1;\n }\n return position;\n }\n /**\n * Returns whether an element is part of the active data.\n * @param value defines the value to look for\n * @returns true if found in the active data otherwise false\n */\n contains(value) {\n return this.indexOf(value) !== -1;\n }\n}\n// Statics\nSmartArray._GlobalId = 0;\n/**\n * Defines an GC Friendly array where the backfield array do not shrink to prevent over allocations.\n * The data in this array can only be present once\n */\nexport class SmartArrayNoDuplicate extends SmartArray {\n constructor() {\n super(...arguments);\n this._duplicateId = 0;\n }\n /**\n * Pushes a value at the end of the active data.\n * THIS DOES NOT PREVENT DUPPLICATE DATA\n * @param value defines the object to push in the array.\n */\n push(value) {\n super.push(value);\n if (!value.__smartArrayFlags) {\n value.__smartArrayFlags = {};\n }\n value.__smartArrayFlags[this._id] = this._duplicateId;\n }\n /**\n * Pushes a value at the end of the active data.\n * If the data is already present, it won t be added again\n * @param value defines the object to push in the array.\n * @returns true if added false if it was already present\n */\n pushNoDuplicate(value) {\n if (value.__smartArrayFlags && value.__smartArrayFlags[this._id] === this._duplicateId) {\n return false;\n }\n this.push(value);\n return true;\n }\n /**\n * Resets the active data to an empty array.\n */\n reset() {\n super.reset();\n this._duplicateId++;\n }\n /**\n * Concats the active data with a given array.\n * This ensures no duplicate will be present in the result.\n * @param array defines the data to concatenate with.\n */\n concatWithNoDuplicate(array) {\n if (array.length === 0) {\n return;\n }\n if (this.length + array.length > this.data.length) {\n this.data.length = (this.length + array.length) * 2;\n }\n for (let index = 0; index < array.length; index++) {\n const item = (array.data || array)[index];\n this.pushNoDuplicate(item);\n }\n }\n}\n//# sourceMappingURL=smartArray.js.map","/**\n * This class implement a typical dictionary using a string as key and the generic type T as value.\n * The underlying implementation relies on an associative array to ensure the best performances.\n * The value can be anything including 'null' but except 'undefined'\n */\nexport class StringDictionary {\n constructor() {\n this._count = 0;\n this._data = {};\n }\n /**\n * This will clear this dictionary and copy the content from the 'source' one.\n * If the T value is a custom object, it won't be copied/cloned, the same object will be used\n * @param source the dictionary to take the content from and copy to this dictionary\n */\n copyFrom(source) {\n this.clear();\n source.forEach((t, v) => this.add(t, v));\n }\n /**\n * Get a value based from its key\n * @param key the given key to get the matching value from\n * @returns the value if found, otherwise undefined is returned\n */\n get(key) {\n const val = this._data[key];\n if (val !== undefined) {\n return val;\n }\n return undefined;\n }\n /**\n * Get a value from its key or add it if it doesn't exist.\n * This method will ensure you that a given key/data will be present in the dictionary.\n * @param key the given key to get the matching value from\n * @param factory the factory that will create the value if the key is not present in the dictionary.\n * The factory will only be invoked if there's no data for the given key.\n * @returns the value corresponding to the key.\n */\n getOrAddWithFactory(key, factory) {\n let val = this.get(key);\n if (val !== undefined) {\n return val;\n }\n val = factory(key);\n if (val) {\n this.add(key, val);\n }\n return val;\n }\n /**\n * Get a value from its key if present in the dictionary otherwise add it\n * @param key the key to get the value from\n * @param val if there's no such key/value pair in the dictionary add it with this value\n * @returns the value corresponding to the key\n */\n getOrAdd(key, val) {\n const curVal = this.get(key);\n if (curVal !== undefined) {\n return curVal;\n }\n this.add(key, val);\n return val;\n }\n /**\n * Check if there's a given key in the dictionary\n * @param key the key to check for\n * @returns true if the key is present, false otherwise\n */\n contains(key) {\n return this._data[key] !== undefined;\n }\n /**\n * Add a new key and its corresponding value\n * @param key the key to add\n * @param value the value corresponding to the key\n * @returns true if the operation completed successfully, false if we couldn't insert the key/value because there was already this key in the dictionary\n */\n add(key, value) {\n if (this._data[key] !== undefined) {\n return false;\n }\n this._data[key] = value;\n ++this._count;\n return true;\n }\n /**\n * Update a specific value associated to a key\n * @param key defines the key to use\n * @param value defines the value to store\n * @returns true if the value was updated (or false if the key was not found)\n */\n set(key, value) {\n if (this._data[key] === undefined) {\n return false;\n }\n this._data[key] = value;\n return true;\n }\n /**\n * Get the element of the given key and remove it from the dictionary\n * @param key defines the key to search\n * @returns the value associated with the key or null if not found\n */\n getAndRemove(key) {\n const val = this.get(key);\n if (val !== undefined) {\n delete this._data[key];\n --this._count;\n return val;\n }\n return null;\n }\n /**\n * Remove a key/value from the dictionary.\n * @param key the key to remove\n * @returns true if the item was successfully deleted, false if no item with such key exist in the dictionary\n */\n remove(key) {\n if (this.contains(key)) {\n delete this._data[key];\n --this._count;\n return true;\n }\n return false;\n }\n /**\n * Clear the whole content of the dictionary\n */\n clear() {\n this._data = {};\n this._count = 0;\n }\n /**\n * Gets the current count\n */\n get count() {\n return this._count;\n }\n /**\n * Execute a callback on each key/val of the dictionary.\n * Note that you can remove any element in this dictionary in the callback implementation\n * @param callback the callback to execute on a given key/value pair\n */\n forEach(callback) {\n for (const cur in this._data) {\n const val = this._data[cur];\n callback(cur, val);\n }\n }\n /**\n * Execute a callback on every occurrence of the dictionary until it returns a valid TRes object.\n * If the callback returns null or undefined the method will iterate to the next key/value pair\n * Note that you can remove any element in this dictionary in the callback implementation\n * @param callback the callback to execute, if it return a valid T instanced object the enumeration will stop and the object will be returned\n * @returns the first item\n */\n first(callback) {\n for (const cur in this._data) {\n const val = this._data[cur];\n const res = callback(cur, val);\n if (res) {\n return res;\n }\n }\n return null;\n }\n}\n//# sourceMappingURL=stringDictionary.js.map","/**\n * Base class of the scene acting as a container for the different elements composing a scene.\n * This class is dynamically extended by the different components of the scene increasing\n * flexibility and reducing coupling\n */\nexport class AbstractScene {\n constructor() {\n /**\n * Gets the list of root nodes (ie. nodes with no parent)\n */\n this.rootNodes = new Array();\n /** All of the cameras added to this scene\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras\n */\n this.cameras = new Array();\n /**\n * All of the lights added to this scene\n * @see https://doc.babylonjs.com/features/featuresDeepDive/lights/lights_introduction\n */\n this.lights = new Array();\n /**\n * All of the (abstract) meshes added to this scene\n */\n this.meshes = new Array();\n /**\n * The list of skeletons added to the scene\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/bonesSkeletons\n */\n this.skeletons = new Array();\n /**\n * All of the particle systems added to this scene\n * @see https://doc.babylonjs.com/features/featuresDeepDive/particles/particle_system/particle_system_intro\n */\n this.particleSystems = new Array();\n /**\n * Gets a list of Animations associated with the scene\n */\n this.animations = [];\n /**\n * All of the animation groups added to this scene\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/groupAnimations\n */\n this.animationGroups = new Array();\n /**\n * All of the multi-materials added to this scene\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/multiMaterials\n */\n this.multiMaterials = new Array();\n /**\n * All of the materials added to this scene\n * In the context of a Scene, it is not supposed to be modified manually.\n * Any addition or removal should be done using the addMaterial and removeMaterial Scene methods.\n * Note also that the order of the Material within the array is not significant and might change.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/materials_introduction\n */\n this.materials = new Array();\n /**\n * The list of morph target managers added to the scene\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/dynamicMeshMorph\n */\n this.morphTargetManagers = new Array();\n /**\n * The list of geometries used in the scene.\n */\n this.geometries = new Array();\n /**\n * All of the transform nodes added to this scene\n * In the context of a Scene, it is not supposed to be modified manually.\n * Any addition or removal should be done using the addTransformNode and removeTransformNode Scene methods.\n * Note also that the order of the TransformNode within the array is not significant and might change.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/transforms/parent_pivot/transform_node\n */\n this.transformNodes = new Array();\n /**\n * ActionManagers available on the scene.\n * @deprecated\n */\n this.actionManagers = new Array();\n /**\n * Textures to keep.\n */\n this.textures = new Array();\n /** @internal */\n this._environmentTexture = null;\n /**\n * The list of postprocesses added to the scene\n */\n this.postProcesses = new Array();\n }\n /**\n * Adds a parser in the list of available ones\n * @param name Defines the name of the parser\n * @param parser Defines the parser to add\n */\n static AddParser(name, parser) {\n this._BabylonFileParsers[name] = parser;\n }\n /**\n * Gets a general parser from the list of available ones\n * @param name Defines the name of the parser\n * @returns the requested parser or null\n */\n static GetParser(name) {\n if (this._BabylonFileParsers[name]) {\n return this._BabylonFileParsers[name];\n }\n return null;\n }\n /**\n * Adds n individual parser in the list of available ones\n * @param name Defines the name of the parser\n * @param parser Defines the parser to add\n */\n static AddIndividualParser(name, parser) {\n this._IndividualBabylonFileParsers[name] = parser;\n }\n /**\n * Gets an individual parser from the list of available ones\n * @param name Defines the name of the parser\n * @returns the requested parser or null\n */\n static GetIndividualParser(name) {\n if (this._IndividualBabylonFileParsers[name]) {\n return this._IndividualBabylonFileParsers[name];\n }\n return null;\n }\n /**\n * Parser json data and populate both a scene and its associated container object\n * @param jsonData Defines the data to parse\n * @param scene Defines the scene to parse the data for\n * @param container Defines the container attached to the parsing sequence\n * @param rootUrl Defines the root url of the data\n */\n static Parse(jsonData, scene, container, rootUrl) {\n for (const parserName in this._BabylonFileParsers) {\n if (Object.prototype.hasOwnProperty.call(this._BabylonFileParsers, parserName)) {\n this._BabylonFileParsers[parserName](jsonData, scene, container, rootUrl);\n }\n }\n }\n /**\n * Texture used in all pbr material as the reflection texture.\n * As in the majority of the scene they are the same (exception for multi room and so on),\n * this is easier to reference from here than from all the materials.\n */\n get environmentTexture() {\n return this._environmentTexture;\n }\n set environmentTexture(value) {\n this._environmentTexture = value;\n }\n /**\n * @returns all meshes, lights, cameras, transformNodes and bones\n */\n getNodes() {\n let nodes = new Array();\n nodes = nodes.concat(this.meshes);\n nodes = nodes.concat(this.lights);\n nodes = nodes.concat(this.cameras);\n nodes = nodes.concat(this.transformNodes); // dummies\n this.skeletons.forEach((skeleton) => (nodes = nodes.concat(skeleton.bones)));\n return nodes;\n }\n}\n/**\n * Stores the list of available parsers in the application.\n */\nAbstractScene._BabylonFileParsers = {};\n/**\n * Stores the list of available individual parsers in the application.\n */\nAbstractScene._IndividualBabylonFileParsers = {};\n//# sourceMappingURL=abstractScene.js.map","/**\n * Manages the defines for the Material\n */\nexport class MaterialDefines {\n /**\n * Creates a new instance\n * @param externalProperties list of external properties to inject into the object\n */\n constructor(externalProperties) {\n /** @internal */\n this._keys = [];\n this._isDirty = true;\n /** @internal */\n this._areLightsDirty = true;\n /** @internal */\n this._areLightsDisposed = false;\n /** @internal */\n this._areAttributesDirty = true;\n /** @internal */\n this._areTexturesDirty = true;\n /** @internal */\n this._areFresnelDirty = true;\n /** @internal */\n this._areMiscDirty = true;\n /** @internal */\n this._arePrePassDirty = true;\n /** @internal */\n this._areImageProcessingDirty = true;\n /** @internal */\n this._normals = false;\n /** @internal */\n this._uvs = false;\n /** @internal */\n this._needNormals = false;\n /** @internal */\n this._needUVs = false;\n this._externalProperties = externalProperties;\n // Initialize External Properties\n if (externalProperties) {\n for (const prop in externalProperties) {\n if (Object.prototype.hasOwnProperty.call(externalProperties, prop)) {\n this._setDefaultValue(prop);\n }\n }\n }\n }\n /**\n * Specifies if the material needs to be re-calculated\n */\n get isDirty() {\n return this._isDirty;\n }\n /**\n * Marks the material to indicate that it has been re-calculated\n */\n markAsProcessed() {\n this._isDirty = false;\n this._areAttributesDirty = false;\n this._areTexturesDirty = false;\n this._areFresnelDirty = false;\n this._areLightsDirty = false;\n this._areLightsDisposed = false;\n this._areMiscDirty = false;\n this._arePrePassDirty = false;\n this._areImageProcessingDirty = false;\n }\n /**\n * Marks the material to indicate that it needs to be re-calculated\n */\n markAsUnprocessed() {\n this._isDirty = true;\n }\n /**\n * Marks the material to indicate all of its defines need to be re-calculated\n */\n markAllAsDirty() {\n this._areTexturesDirty = true;\n this._areAttributesDirty = true;\n this._areLightsDirty = true;\n this._areFresnelDirty = true;\n this._areMiscDirty = true;\n this._arePrePassDirty = false;\n this._areImageProcessingDirty = true;\n this._isDirty = true;\n }\n /**\n * Marks the material to indicate that image processing needs to be re-calculated\n */\n markAsImageProcessingDirty() {\n this._areImageProcessingDirty = true;\n this._isDirty = true;\n }\n /**\n * Marks the material to indicate the lights need to be re-calculated\n * @param disposed Defines whether the light is dirty due to dispose or not\n */\n markAsLightDirty(disposed = false) {\n this._areLightsDirty = true;\n this._areLightsDisposed = this._areLightsDisposed || disposed;\n this._isDirty = true;\n }\n /**\n * Marks the attribute state as changed\n */\n markAsAttributesDirty() {\n this._areAttributesDirty = true;\n this._isDirty = true;\n }\n /**\n * Marks the texture state as changed\n */\n markAsTexturesDirty() {\n this._areTexturesDirty = true;\n this._isDirty = true;\n }\n /**\n * Marks the fresnel state as changed\n */\n markAsFresnelDirty() {\n this._areFresnelDirty = true;\n this._isDirty = true;\n }\n /**\n * Marks the misc state as changed\n */\n markAsMiscDirty() {\n this._areMiscDirty = true;\n this._isDirty = true;\n }\n /**\n * Marks the prepass state as changed\n */\n markAsPrePassDirty() {\n this._arePrePassDirty = true;\n this._isDirty = true;\n }\n /**\n * Rebuilds the material defines\n */\n rebuild() {\n this._keys.length = 0;\n for (const key of Object.keys(this)) {\n if (key[0] === \"_\") {\n continue;\n }\n this._keys.push(key);\n }\n if (this._externalProperties) {\n for (const name in this._externalProperties) {\n if (this._keys.indexOf(name) === -1) {\n this._keys.push(name);\n }\n }\n }\n }\n /**\n * Specifies if two material defines are equal\n * @param other - A material define instance to compare to\n * @returns - Boolean indicating if the material defines are equal (true) or not (false)\n */\n isEqual(other) {\n if (this._keys.length !== other._keys.length) {\n return false;\n }\n for (let index = 0; index < this._keys.length; index++) {\n const prop = this._keys[index];\n if (this[prop] !== other[prop]) {\n return false;\n }\n }\n return true;\n }\n /**\n * Clones this instance's defines to another instance\n * @param other - material defines to clone values to\n */\n cloneTo(other) {\n if (this._keys.length !== other._keys.length) {\n other._keys = this._keys.slice(0);\n }\n for (let index = 0; index < this._keys.length; index++) {\n const prop = this._keys[index];\n other[prop] = this[prop];\n }\n }\n /**\n * Resets the material define values\n */\n reset() {\n this._keys.forEach((prop) => this._setDefaultValue(prop));\n }\n _setDefaultValue(prop) {\n var _a, _b, _c, _d, _e;\n const type = (_c = (_b = (_a = this._externalProperties) === null || _a === void 0 ? void 0 : _a[prop]) === null || _b === void 0 ? void 0 : _b.type) !== null && _c !== void 0 ? _c : typeof this[prop];\n const defValue = (_e = (_d = this._externalProperties) === null || _d === void 0 ? void 0 : _d[prop]) === null || _e === void 0 ? void 0 : _e.default;\n switch (type) {\n case \"number\":\n this[prop] = defValue !== null && defValue !== void 0 ? defValue : 0;\n break;\n case \"string\":\n this[prop] = defValue !== null && defValue !== void 0 ? defValue : \"\";\n break;\n default:\n this[prop] = defValue !== null && defValue !== void 0 ? defValue : false;\n break;\n }\n }\n /**\n * Converts the material define values to a string\n * @returns - String of material define information\n */\n toString() {\n let result = \"\";\n for (let index = 0; index < this._keys.length; index++) {\n const prop = this._keys[index];\n const value = this[prop];\n const type = typeof value;\n switch (type) {\n case \"number\":\n case \"string\":\n result += \"#define \" + prop + \" \" + value + \"\\n\";\n break;\n default:\n if (value) {\n result += \"#define \" + prop + \"\\n\";\n }\n break;\n }\n }\n return result;\n }\n}\n//# sourceMappingURL=materialDefines.js.map","import { __decorate } from \"../tslib.es6.js\";\nimport { SerializationHelper, serialize } from \"../Misc/decorators.js\";\nimport { Color4 } from \"../Maths/math.color.js\";\n/**\n * The color grading curves provide additional color adjustment that is applied after any color grading transform (3D LUT).\n * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.\n * These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image;\n * corresponding to low luminance, medium luminance, and high luminance areas respectively.\n */\nexport class ColorCurves {\n constructor() {\n this._dirty = true;\n this._tempColor = new Color4(0, 0, 0, 0);\n this._globalCurve = new Color4(0, 0, 0, 0);\n this._highlightsCurve = new Color4(0, 0, 0, 0);\n this._midtonesCurve = new Color4(0, 0, 0, 0);\n this._shadowsCurve = new Color4(0, 0, 0, 0);\n this._positiveCurve = new Color4(0, 0, 0, 0);\n this._negativeCurve = new Color4(0, 0, 0, 0);\n this._globalHue = 30;\n this._globalDensity = 0;\n this._globalSaturation = 0;\n this._globalExposure = 0;\n this._highlightsHue = 30;\n this._highlightsDensity = 0;\n this._highlightsSaturation = 0;\n this._highlightsExposure = 0;\n this._midtonesHue = 30;\n this._midtonesDensity = 0;\n this._midtonesSaturation = 0;\n this._midtonesExposure = 0;\n this._shadowsHue = 30;\n this._shadowsDensity = 0;\n this._shadowsSaturation = 0;\n this._shadowsExposure = 0;\n }\n /**\n * Gets the global Hue value.\n * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).\n */\n get globalHue() {\n return this._globalHue;\n }\n /**\n * Sets the global Hue value.\n * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).\n */\n set globalHue(value) {\n this._globalHue = value;\n this._dirty = true;\n }\n /**\n * Gets the global Density value.\n * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.\n * Values less than zero provide a filter of opposite hue.\n */\n get globalDensity() {\n return this._globalDensity;\n }\n /**\n * Sets the global Density value.\n * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.\n * Values less than zero provide a filter of opposite hue.\n */\n set globalDensity(value) {\n this._globalDensity = value;\n this._dirty = true;\n }\n /**\n * Gets the global Saturation value.\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.\n */\n get globalSaturation() {\n return this._globalSaturation;\n }\n /**\n * Sets the global Saturation value.\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.\n */\n set globalSaturation(value) {\n this._globalSaturation = value;\n this._dirty = true;\n }\n /**\n * Gets the global Exposure value.\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.\n */\n get globalExposure() {\n return this._globalExposure;\n }\n /**\n * Sets the global Exposure value.\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.\n */\n set globalExposure(value) {\n this._globalExposure = value;\n this._dirty = true;\n }\n /**\n * Gets the highlights Hue value.\n * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).\n */\n get highlightsHue() {\n return this._highlightsHue;\n }\n /**\n * Sets the highlights Hue value.\n * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).\n */\n set highlightsHue(value) {\n this._highlightsHue = value;\n this._dirty = true;\n }\n /**\n * Gets the highlights Density value.\n * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.\n * Values less than zero provide a filter of opposite hue.\n */\n get highlightsDensity() {\n return this._highlightsDensity;\n }\n /**\n * Sets the highlights Density value.\n * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.\n * Values less than zero provide a filter of opposite hue.\n */\n set highlightsDensity(value) {\n this._highlightsDensity = value;\n this._dirty = true;\n }\n /**\n * Gets the highlights Saturation value.\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.\n */\n get highlightsSaturation() {\n return this._highlightsSaturation;\n }\n /**\n * Sets the highlights Saturation value.\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.\n */\n set highlightsSaturation(value) {\n this._highlightsSaturation = value;\n this._dirty = true;\n }\n /**\n * Gets the highlights Exposure value.\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.\n */\n get highlightsExposure() {\n return this._highlightsExposure;\n }\n /**\n * Sets the highlights Exposure value.\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.\n */\n set highlightsExposure(value) {\n this._highlightsExposure = value;\n this._dirty = true;\n }\n /**\n * Gets the midtones Hue value.\n * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).\n */\n get midtonesHue() {\n return this._midtonesHue;\n }\n /**\n * Sets the midtones Hue value.\n * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).\n */\n set midtonesHue(value) {\n this._midtonesHue = value;\n this._dirty = true;\n }\n /**\n * Gets the midtones Density value.\n * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.\n * Values less than zero provide a filter of opposite hue.\n */\n get midtonesDensity() {\n return this._midtonesDensity;\n }\n /**\n * Sets the midtones Density value.\n * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.\n * Values less than zero provide a filter of opposite hue.\n */\n set midtonesDensity(value) {\n this._midtonesDensity = value;\n this._dirty = true;\n }\n /**\n * Gets the midtones Saturation value.\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.\n */\n get midtonesSaturation() {\n return this._midtonesSaturation;\n }\n /**\n * Sets the midtones Saturation value.\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.\n */\n set midtonesSaturation(value) {\n this._midtonesSaturation = value;\n this._dirty = true;\n }\n /**\n * Gets the midtones Exposure value.\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.\n */\n get midtonesExposure() {\n return this._midtonesExposure;\n }\n /**\n * Sets the midtones Exposure value.\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.\n */\n set midtonesExposure(value) {\n this._midtonesExposure = value;\n this._dirty = true;\n }\n /**\n * Gets the shadows Hue value.\n * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).\n */\n get shadowsHue() {\n return this._shadowsHue;\n }\n /**\n * Sets the shadows Hue value.\n * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).\n */\n set shadowsHue(value) {\n this._shadowsHue = value;\n this._dirty = true;\n }\n /**\n * Gets the shadows Density value.\n * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.\n * Values less than zero provide a filter of opposite hue.\n */\n get shadowsDensity() {\n return this._shadowsDensity;\n }\n /**\n * Sets the shadows Density value.\n * The density value is in range [-100,+100] where 0 means the color filter has no effect and +100 means the color filter has maximum effect.\n * Values less than zero provide a filter of opposite hue.\n */\n set shadowsDensity(value) {\n this._shadowsDensity = value;\n this._dirty = true;\n }\n /**\n * Gets the shadows Saturation value.\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.\n */\n get shadowsSaturation() {\n return this._shadowsSaturation;\n }\n /**\n * Sets the shadows Saturation value.\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase saturation and negative values decrease saturation.\n */\n set shadowsSaturation(value) {\n this._shadowsSaturation = value;\n this._dirty = true;\n }\n /**\n * Gets the shadows Exposure value.\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.\n */\n get shadowsExposure() {\n return this._shadowsExposure;\n }\n /**\n * Sets the shadows Exposure value.\n * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.\n */\n set shadowsExposure(value) {\n this._shadowsExposure = value;\n this._dirty = true;\n }\n /**\n * Returns the class name\n * @returns The class name\n */\n getClassName() {\n return \"ColorCurves\";\n }\n /**\n * Binds the color curves to the shader.\n * @param colorCurves The color curve to bind\n * @param effect The effect to bind to\n * @param positiveUniform The positive uniform shader parameter\n * @param neutralUniform The neutral uniform shader parameter\n * @param negativeUniform The negative uniform shader parameter\n */\n static Bind(colorCurves, effect, positiveUniform = \"vCameraColorCurvePositive\", neutralUniform = \"vCameraColorCurveNeutral\", negativeUniform = \"vCameraColorCurveNegative\") {\n if (colorCurves._dirty) {\n colorCurves._dirty = false;\n // Fill in global info.\n colorCurves._getColorGradingDataToRef(colorCurves._globalHue, colorCurves._globalDensity, colorCurves._globalSaturation, colorCurves._globalExposure, colorCurves._globalCurve);\n // Compute highlights info.\n colorCurves._getColorGradingDataToRef(colorCurves._highlightsHue, colorCurves._highlightsDensity, colorCurves._highlightsSaturation, colorCurves._highlightsExposure, colorCurves._tempColor);\n colorCurves._tempColor.multiplyToRef(colorCurves._globalCurve, colorCurves._highlightsCurve);\n // Compute midtones info.\n colorCurves._getColorGradingDataToRef(colorCurves._midtonesHue, colorCurves._midtonesDensity, colorCurves._midtonesSaturation, colorCurves._midtonesExposure, colorCurves._tempColor);\n colorCurves._tempColor.multiplyToRef(colorCurves._globalCurve, colorCurves._midtonesCurve);\n // Compute shadows info.\n colorCurves._getColorGradingDataToRef(colorCurves._shadowsHue, colorCurves._shadowsDensity, colorCurves._shadowsSaturation, colorCurves._shadowsExposure, colorCurves._tempColor);\n colorCurves._tempColor.multiplyToRef(colorCurves._globalCurve, colorCurves._shadowsCurve);\n // Compute deltas (neutral is midtones).\n colorCurves._highlightsCurve.subtractToRef(colorCurves._midtonesCurve, colorCurves._positiveCurve);\n colorCurves._midtonesCurve.subtractToRef(colorCurves._shadowsCurve, colorCurves._negativeCurve);\n }\n if (effect) {\n effect.setFloat4(positiveUniform, colorCurves._positiveCurve.r, colorCurves._positiveCurve.g, colorCurves._positiveCurve.b, colorCurves._positiveCurve.a);\n effect.setFloat4(neutralUniform, colorCurves._midtonesCurve.r, colorCurves._midtonesCurve.g, colorCurves._midtonesCurve.b, colorCurves._midtonesCurve.a);\n effect.setFloat4(negativeUniform, colorCurves._negativeCurve.r, colorCurves._negativeCurve.g, colorCurves._negativeCurve.b, colorCurves._negativeCurve.a);\n }\n }\n /**\n * Prepare the list of uniforms associated with the ColorCurves effects.\n * @param uniformsList The list of uniforms used in the effect\n */\n static PrepareUniforms(uniformsList) {\n uniformsList.push(\"vCameraColorCurveNeutral\", \"vCameraColorCurvePositive\", \"vCameraColorCurveNegative\");\n }\n /**\n * Returns color grading data based on a hue, density, saturation and exposure value.\n * @param hue\n * @param density\n * @param saturation The saturation.\n * @param exposure The exposure.\n * @param result The result data container.\n */\n _getColorGradingDataToRef(hue, density, saturation, exposure, result) {\n if (hue == null) {\n return;\n }\n hue = ColorCurves._Clamp(hue, 0, 360);\n density = ColorCurves._Clamp(density, -100, 100);\n saturation = ColorCurves._Clamp(saturation, -100, 100);\n exposure = ColorCurves._Clamp(exposure, -100, 100);\n // Remap the slider/config filter density with non-linear mapping and also scale by half\n // so that the maximum filter density is only 50% control. This provides fine control\n // for small values and reasonable range.\n density = ColorCurves._ApplyColorGradingSliderNonlinear(density);\n density *= 0.5;\n exposure = ColorCurves._ApplyColorGradingSliderNonlinear(exposure);\n if (density < 0) {\n density *= -1;\n hue = (hue + 180) % 360;\n }\n ColorCurves._FromHSBToRef(hue, density, 50 + 0.25 * exposure, result);\n result.scaleToRef(2, result);\n result.a = 1 + 0.01 * saturation;\n }\n /**\n * Takes an input slider value and returns an adjusted value that provides extra control near the centre.\n * @param value The input slider value in range [-100,100].\n * @returns Adjusted value.\n */\n static _ApplyColorGradingSliderNonlinear(value) {\n value /= 100;\n let x = Math.abs(value);\n x = Math.pow(x, 2);\n if (value < 0) {\n x *= -1;\n }\n x *= 100;\n return x;\n }\n /**\n * Returns an RGBA Color4 based on Hue, Saturation and Brightness (also referred to as value, HSV).\n * @param hue The hue (H) input.\n * @param saturation The saturation (S) input.\n * @param brightness The brightness (B) input.\n * @param result\n * @result An RGBA color represented as Vector4.\n */\n static _FromHSBToRef(hue, saturation, brightness, result) {\n let h = ColorCurves._Clamp(hue, 0, 360);\n const s = ColorCurves._Clamp(saturation / 100, 0, 1);\n const v = ColorCurves._Clamp(brightness / 100, 0, 1);\n if (s === 0) {\n result.r = v;\n result.g = v;\n result.b = v;\n }\n else {\n // sector 0 to 5\n h /= 60;\n const i = Math.floor(h);\n // fractional part of h\n const f = h - i;\n const p = v * (1 - s);\n const q = v * (1 - s * f);\n const t = v * (1 - s * (1 - f));\n switch (i) {\n case 0:\n result.r = v;\n result.g = t;\n result.b = p;\n break;\n case 1:\n result.r = q;\n result.g = v;\n result.b = p;\n break;\n case 2:\n result.r = p;\n result.g = v;\n result.b = t;\n break;\n case 3:\n result.r = p;\n result.g = q;\n result.b = v;\n break;\n case 4:\n result.r = t;\n result.g = p;\n result.b = v;\n break;\n default:\n // case 5:\n result.r = v;\n result.g = p;\n result.b = q;\n break;\n }\n }\n result.a = 1;\n }\n /**\n * Returns a value clamped between min and max\n * @param value The value to clamp\n * @param min The minimum of value\n * @param max The maximum of value\n * @returns The clamped value.\n */\n static _Clamp(value, min, max) {\n return Math.min(Math.max(value, min), max);\n }\n /**\n * Clones the current color curve instance.\n * @returns The cloned curves\n */\n clone() {\n return SerializationHelper.Clone(() => new ColorCurves(), this);\n }\n /**\n * Serializes the current color curve instance to a json representation.\n * @returns a JSON representation\n */\n serialize() {\n return SerializationHelper.Serialize(this);\n }\n /**\n * Parses the color curve from a json representation.\n * @param source the JSON source to parse\n * @returns The parsed curves\n */\n static Parse(source) {\n return SerializationHelper.Parse(() => new ColorCurves(), source, null, null);\n }\n}\n__decorate([\n serialize()\n], ColorCurves.prototype, \"_globalHue\", void 0);\n__decorate([\n serialize()\n], ColorCurves.prototype, \"_globalDensity\", void 0);\n__decorate([\n serialize()\n], ColorCurves.prototype, \"_globalSaturation\", void 0);\n__decorate([\n serialize()\n], ColorCurves.prototype, \"_globalExposure\", void 0);\n__decorate([\n serialize()\n], ColorCurves.prototype, \"_highlightsHue\", void 0);\n__decorate([\n serialize()\n], ColorCurves.prototype, \"_highlightsDensity\", void 0);\n__decorate([\n serialize()\n], ColorCurves.prototype, \"_highlightsSaturation\", void 0);\n__decorate([\n serialize()\n], ColorCurves.prototype, \"_highlightsExposure\", void 0);\n__decorate([\n serialize()\n], ColorCurves.prototype, \"_midtonesHue\", void 0);\n__decorate([\n serialize()\n], ColorCurves.prototype, \"_midtonesDensity\", void 0);\n__decorate([\n serialize()\n], ColorCurves.prototype, \"_midtonesSaturation\", void 0);\n__decorate([\n serialize()\n], ColorCurves.prototype, \"_midtonesExposure\", void 0);\n// References the dependencies.\nSerializationHelper._ColorCurvesParser = ColorCurves.Parse;\n//# sourceMappingURL=colorCurves.js.map","import { __decorate } from \"../tslib.es6.js\";\n/* eslint-disable @typescript-eslint/naming-convention */\nimport { serialize, SerializationHelper, serializeAsTexture, serializeAsColorCurves, serializeAsColor4 } from \"../Misc/decorators.js\";\nimport { Observable } from \"../Misc/observable.js\";\nimport { Tools } from \"../Misc/tools.js\";\nimport { Color4 } from \"../Maths/math.color.js\";\nimport { MaterialDefines } from \"../Materials/materialDefines.js\";\nimport { ColorCurves } from \"../Materials/colorCurves.js\";\n/**\n * @internal\n */\nexport class ImageProcessingConfigurationDefines extends MaterialDefines {\n constructor() {\n super();\n this.IMAGEPROCESSING = false;\n this.VIGNETTE = false;\n this.VIGNETTEBLENDMODEMULTIPLY = false;\n this.VIGNETTEBLENDMODEOPAQUE = false;\n this.TONEMAPPING = false;\n this.TONEMAPPING_ACES = false;\n this.CONTRAST = false;\n this.COLORCURVES = false;\n this.COLORGRADING = false;\n this.COLORGRADING3D = false;\n this.SAMPLER3DGREENDEPTH = false;\n this.SAMPLER3DBGRMAP = false;\n this.DITHER = false;\n this.IMAGEPROCESSINGPOSTPROCESS = false;\n this.EXPOSURE = false;\n this.SKIPFINALCOLORCLAMP = false;\n this.rebuild();\n }\n}\n/**\n * This groups together the common properties used for image processing either in direct forward pass\n * or through post processing effect depending on the use of the image processing pipeline in your scene\n * or not.\n */\nexport class ImageProcessingConfiguration {\n constructor() {\n /**\n * Color curves setup used in the effect if colorCurvesEnabled is set to true\n */\n this.colorCurves = new ColorCurves();\n this._colorCurvesEnabled = false;\n this._colorGradingEnabled = false;\n this._colorGradingWithGreenDepth = true;\n this._colorGradingBGR = true;\n /** @internal */\n this._exposure = 1.0;\n this._toneMappingEnabled = false;\n this._toneMappingType = ImageProcessingConfiguration.TONEMAPPING_STANDARD;\n this._contrast = 1.0;\n /**\n * Vignette stretch size.\n */\n this.vignetteStretch = 0;\n /**\n * Vignette center X Offset.\n */\n this.vignetteCenterX = 0;\n /**\n * Vignette center Y Offset.\n */\n this.vignetteCenterY = 0;\n /**\n * Vignette weight or intensity of the vignette effect.\n */\n this.vignetteWeight = 1.5;\n /**\n * Color of the vignette applied on the screen through the chosen blend mode (vignetteBlendMode)\n * if vignetteEnabled is set to true.\n */\n this.vignetteColor = new Color4(0, 0, 0, 0);\n /**\n * Camera field of view used by the Vignette effect.\n */\n this.vignetteCameraFov = 0.5;\n this._vignetteBlendMode = ImageProcessingConfiguration.VIGNETTEMODE_MULTIPLY;\n this._vignetteEnabled = false;\n this._ditheringEnabled = false;\n this._ditheringIntensity = 1.0 / 255.0;\n /** @internal */\n this._skipFinalColorClamp = false;\n /** @internal */\n this._applyByPostProcess = false;\n this._isEnabled = true;\n /**\n * An event triggered when the configuration changes and requires Shader to Update some parameters.\n */\n this.onUpdateParameters = new Observable();\n }\n /**\n * Gets whether the color curves effect is enabled.\n */\n get colorCurvesEnabled() {\n return this._colorCurvesEnabled;\n }\n /**\n * Sets whether the color curves effect is enabled.\n */\n set colorCurvesEnabled(value) {\n if (this._colorCurvesEnabled === value) {\n return;\n }\n this._colorCurvesEnabled = value;\n this._updateParameters();\n }\n /**\n * Color grading LUT texture used in the effect if colorGradingEnabled is set to true\n */\n get colorGradingTexture() {\n return this._colorGradingTexture;\n }\n /**\n * Color grading LUT texture used in the effect if colorGradingEnabled is set to true\n */\n set colorGradingTexture(value) {\n if (this._colorGradingTexture === value) {\n return;\n }\n this._colorGradingTexture = value;\n this._updateParameters();\n }\n /**\n * Gets whether the color grading effect is enabled.\n */\n get colorGradingEnabled() {\n return this._colorGradingEnabled;\n }\n /**\n * Sets whether the color grading effect is enabled.\n */\n set colorGradingEnabled(value) {\n if (this._colorGradingEnabled === value) {\n return;\n }\n this._colorGradingEnabled = value;\n this._updateParameters();\n }\n /**\n * Gets whether the color grading effect is using a green depth for the 3d Texture.\n */\n get colorGradingWithGreenDepth() {\n return this._colorGradingWithGreenDepth;\n }\n /**\n * Sets whether the color grading effect is using a green depth for the 3d Texture.\n */\n set colorGradingWithGreenDepth(value) {\n if (this._colorGradingWithGreenDepth === value) {\n return;\n }\n this._colorGradingWithGreenDepth = value;\n this._updateParameters();\n }\n /**\n * Gets whether the color grading texture contains BGR values.\n */\n get colorGradingBGR() {\n return this._colorGradingBGR;\n }\n /**\n * Sets whether the color grading texture contains BGR values.\n */\n set colorGradingBGR(value) {\n if (this._colorGradingBGR === value) {\n return;\n }\n this._colorGradingBGR = value;\n this._updateParameters();\n }\n /**\n * Gets the Exposure used in the effect.\n */\n get exposure() {\n return this._exposure;\n }\n /**\n * Sets the Exposure used in the effect.\n */\n set exposure(value) {\n if (this._exposure === value) {\n return;\n }\n this._exposure = value;\n this._updateParameters();\n }\n /**\n * Gets whether the tone mapping effect is enabled.\n */\n get toneMappingEnabled() {\n return this._toneMappingEnabled;\n }\n /**\n * Sets whether the tone mapping effect is enabled.\n */\n set toneMappingEnabled(value) {\n if (this._toneMappingEnabled === value) {\n return;\n }\n this._toneMappingEnabled = value;\n this._updateParameters();\n }\n /**\n * Gets the type of tone mapping effect.\n */\n get toneMappingType() {\n return this._toneMappingType;\n }\n /**\n * Sets the type of tone mapping effect used in BabylonJS.\n */\n set toneMappingType(value) {\n if (this._toneMappingType === value) {\n return;\n }\n this._toneMappingType = value;\n this._updateParameters();\n }\n /**\n * Gets the contrast used in the effect.\n */\n get contrast() {\n return this._contrast;\n }\n /**\n * Sets the contrast used in the effect.\n */\n set contrast(value) {\n if (this._contrast === value) {\n return;\n }\n this._contrast = value;\n this._updateParameters();\n }\n /**\n * Back Compat: Vignette center Y Offset.\n * @deprecated use vignetteCenterY instead\n */\n get vignetteCentreY() {\n return this.vignetteCenterY;\n }\n set vignetteCentreY(value) {\n this.vignetteCenterY = value;\n }\n /**\n * Back Compat: Vignette center X Offset.\n * @deprecated use vignetteCenterX instead\n */\n get vignetteCentreX() {\n return this.vignetteCenterX;\n }\n set vignetteCentreX(value) {\n this.vignetteCenterX = value;\n }\n /**\n * Gets the vignette blend mode allowing different kind of effect.\n */\n get vignetteBlendMode() {\n return this._vignetteBlendMode;\n }\n /**\n * Sets the vignette blend mode allowing different kind of effect.\n */\n set vignetteBlendMode(value) {\n if (this._vignetteBlendMode === value) {\n return;\n }\n this._vignetteBlendMode = value;\n this._updateParameters();\n }\n /**\n * Gets whether the vignette effect is enabled.\n */\n get vignetteEnabled() {\n return this._vignetteEnabled;\n }\n /**\n * Sets whether the vignette effect is enabled.\n */\n set vignetteEnabled(value) {\n if (this._vignetteEnabled === value) {\n return;\n }\n this._vignetteEnabled = value;\n this._updateParameters();\n }\n /**\n * Gets whether the dithering effect is enabled.\n * The dithering effect can be used to reduce banding.\n */\n get ditheringEnabled() {\n return this._ditheringEnabled;\n }\n /**\n * Sets whether the dithering effect is enabled.\n * The dithering effect can be used to reduce banding.\n */\n set ditheringEnabled(value) {\n if (this._ditheringEnabled === value) {\n return;\n }\n this._ditheringEnabled = value;\n this._updateParameters();\n }\n /**\n * Gets the dithering intensity. 0 is no dithering. Default is 1.0 / 255.0.\n */\n get ditheringIntensity() {\n return this._ditheringIntensity;\n }\n /**\n * Sets the dithering intensity. 0 is no dithering. Default is 1.0 / 255.0.\n */\n set ditheringIntensity(value) {\n if (this._ditheringIntensity === value) {\n return;\n }\n this._ditheringIntensity = value;\n this._updateParameters();\n }\n /**\n * If apply by post process is set to true, setting this to true will skip the the final color clamp step in the fragment shader\n * Applies to PBR materials.\n */\n get skipFinalColorClamp() {\n return this._skipFinalColorClamp;\n }\n /**\n * If apply by post process is set to true, setting this to true will skip the the final color clamp step in the fragment shader\n * Applies to PBR materials.\n */\n set skipFinalColorClamp(value) {\n if (this._skipFinalColorClamp === value) {\n return;\n }\n this._skipFinalColorClamp = value;\n this._updateParameters();\n }\n /**\n * Gets whether the image processing is applied through a post process or not.\n */\n get applyByPostProcess() {\n return this._applyByPostProcess;\n }\n /**\n * Sets whether the image processing is applied through a post process or not.\n */\n set applyByPostProcess(value) {\n if (this._applyByPostProcess === value) {\n return;\n }\n this._applyByPostProcess = value;\n this._updateParameters();\n }\n /**\n * Gets whether the image processing is enabled or not.\n */\n get isEnabled() {\n return this._isEnabled;\n }\n /**\n * Sets whether the image processing is enabled or not.\n */\n set isEnabled(value) {\n if (this._isEnabled === value) {\n return;\n }\n this._isEnabled = value;\n this._updateParameters();\n }\n /**\n * Method called each time the image processing information changes requires to recompile the effect.\n */\n _updateParameters() {\n this.onUpdateParameters.notifyObservers(this);\n }\n /**\n * Gets the current class name.\n * @returns \"ImageProcessingConfiguration\"\n */\n getClassName() {\n return \"ImageProcessingConfiguration\";\n }\n /**\n * Prepare the list of uniforms associated with the Image Processing effects.\n * @param uniforms The list of uniforms used in the effect\n * @param defines the list of defines currently in use\n */\n static PrepareUniforms(uniforms, defines) {\n if (defines.EXPOSURE) {\n uniforms.push(\"exposureLinear\");\n }\n if (defines.CONTRAST) {\n uniforms.push(\"contrast\");\n }\n if (defines.COLORGRADING) {\n uniforms.push(\"colorTransformSettings\");\n }\n if (defines.VIGNETTE || defines.DITHER) {\n uniforms.push(\"vInverseScreenSize\");\n }\n if (defines.VIGNETTE) {\n uniforms.push(\"vignetteSettings1\");\n uniforms.push(\"vignetteSettings2\");\n }\n if (defines.COLORCURVES) {\n ColorCurves.PrepareUniforms(uniforms);\n }\n if (defines.DITHER) {\n uniforms.push(\"ditherIntensity\");\n }\n }\n /**\n * Prepare the list of samplers associated with the Image Processing effects.\n * @param samplersList The list of uniforms used in the effect\n * @param defines the list of defines currently in use\n */\n static PrepareSamplers(samplersList, defines) {\n if (defines.COLORGRADING) {\n samplersList.push(\"txColorTransform\");\n }\n }\n /**\n * Prepare the list of defines associated to the shader.\n * @param defines the list of defines to complete\n * @param forPostProcess Define if we are currently in post process mode or not\n */\n prepareDefines(defines, forPostProcess = false) {\n if (forPostProcess !== this.applyByPostProcess || !this._isEnabled) {\n defines.VIGNETTE = false;\n defines.TONEMAPPING = false;\n defines.TONEMAPPING_ACES = false;\n defines.CONTRAST = false;\n defines.EXPOSURE = false;\n defines.COLORCURVES = false;\n defines.COLORGRADING = false;\n defines.COLORGRADING3D = false;\n defines.DITHER = false;\n defines.IMAGEPROCESSING = false;\n defines.SKIPFINALCOLORCLAMP = this.skipFinalColorClamp;\n defines.IMAGEPROCESSINGPOSTPROCESS = this.applyByPostProcess && this._isEnabled;\n return;\n }\n defines.VIGNETTE = this.vignetteEnabled;\n defines.VIGNETTEBLENDMODEMULTIPLY = this.vignetteBlendMode === ImageProcessingConfiguration._VIGNETTEMODE_MULTIPLY;\n defines.VIGNETTEBLENDMODEOPAQUE = !defines.VIGNETTEBLENDMODEMULTIPLY;\n defines.TONEMAPPING = this.toneMappingEnabled;\n switch (this._toneMappingType) {\n case ImageProcessingConfiguration.TONEMAPPING_ACES:\n defines.TONEMAPPING_ACES = true;\n break;\n default:\n defines.TONEMAPPING_ACES = false;\n break;\n }\n defines.CONTRAST = this.contrast !== 1.0;\n defines.EXPOSURE = this.exposure !== 1.0;\n defines.COLORCURVES = this.colorCurvesEnabled && !!this.colorCurves;\n defines.COLORGRADING = this.colorGradingEnabled && !!this.colorGradingTexture;\n if (defines.COLORGRADING) {\n defines.COLORGRADING3D = this.colorGradingTexture.is3D;\n }\n else {\n defines.COLORGRADING3D = false;\n }\n defines.SAMPLER3DGREENDEPTH = this.colorGradingWithGreenDepth;\n defines.SAMPLER3DBGRMAP = this.colorGradingBGR;\n defines.DITHER = this._ditheringEnabled;\n defines.IMAGEPROCESSINGPOSTPROCESS = this.applyByPostProcess;\n defines.SKIPFINALCOLORCLAMP = this.skipFinalColorClamp;\n defines.IMAGEPROCESSING = defines.VIGNETTE || defines.TONEMAPPING || defines.CONTRAST || defines.EXPOSURE || defines.COLORCURVES || defines.COLORGRADING || defines.DITHER;\n }\n /**\n * Returns true if all the image processing information are ready.\n * @returns True if ready, otherwise, false\n */\n isReady() {\n // Color Grading texture can not be none blocking.\n return !this.colorGradingEnabled || !this.colorGradingTexture || this.colorGradingTexture.isReady();\n }\n /**\n * Binds the image processing to the shader.\n * @param effect The effect to bind to\n * @param overrideAspectRatio Override the aspect ratio of the effect\n */\n bind(effect, overrideAspectRatio) {\n // Color Curves\n if (this._colorCurvesEnabled && this.colorCurves) {\n ColorCurves.Bind(this.colorCurves, effect);\n }\n // Vignette and dither handled together due to common uniform.\n if (this._vignetteEnabled || this._ditheringEnabled) {\n const inverseWidth = 1 / effect.getEngine().getRenderWidth();\n const inverseHeight = 1 / effect.getEngine().getRenderHeight();\n effect.setFloat2(\"vInverseScreenSize\", inverseWidth, inverseHeight);\n if (this._ditheringEnabled) {\n effect.setFloat(\"ditherIntensity\", 0.5 * this._ditheringIntensity);\n }\n if (this._vignetteEnabled) {\n const aspectRatio = overrideAspectRatio != null ? overrideAspectRatio : inverseHeight / inverseWidth;\n let vignetteScaleY = Math.tan(this.vignetteCameraFov * 0.5);\n let vignetteScaleX = vignetteScaleY * aspectRatio;\n const vignetteScaleGeometricMean = Math.sqrt(vignetteScaleX * vignetteScaleY);\n vignetteScaleX = Tools.Mix(vignetteScaleX, vignetteScaleGeometricMean, this.vignetteStretch);\n vignetteScaleY = Tools.Mix(vignetteScaleY, vignetteScaleGeometricMean, this.vignetteStretch);\n effect.setFloat4(\"vignetteSettings1\", vignetteScaleX, vignetteScaleY, -vignetteScaleX * this.vignetteCenterX, -vignetteScaleY * this.vignetteCenterY);\n const vignettePower = -2.0 * this.vignetteWeight;\n effect.setFloat4(\"vignetteSettings2\", this.vignetteColor.r, this.vignetteColor.g, this.vignetteColor.b, vignettePower);\n }\n }\n // Exposure\n effect.setFloat(\"exposureLinear\", this.exposure);\n // Contrast\n effect.setFloat(\"contrast\", this.contrast);\n // Color transform settings\n if (this.colorGradingTexture) {\n effect.setTexture(\"txColorTransform\", this.colorGradingTexture);\n const textureSize = this.colorGradingTexture.getSize().height;\n effect.setFloat4(\"colorTransformSettings\", (textureSize - 1) / textureSize, // textureScale\n 0.5 / textureSize, // textureOffset\n textureSize, // textureSize\n this.colorGradingTexture.level // weight\n );\n }\n }\n /**\n * Clones the current image processing instance.\n * @returns The cloned image processing\n */\n clone() {\n return SerializationHelper.Clone(() => new ImageProcessingConfiguration(), this);\n }\n /**\n * Serializes the current image processing instance to a json representation.\n * @returns a JSON representation\n */\n serialize() {\n return SerializationHelper.Serialize(this);\n }\n /**\n * Parses the image processing from a json representation.\n * @param source the JSON source to parse\n * @returns The parsed image processing\n */\n static Parse(source) {\n const parsed = SerializationHelper.Parse(() => new ImageProcessingConfiguration(), source, null, null);\n // Backward compatibility\n if (source.vignetteCentreX !== undefined) {\n parsed.vignetteCenterX = source.vignetteCentreX;\n }\n if (source.vignetteCentreY !== undefined) {\n parsed.vignetteCenterY = source.vignetteCentreY;\n }\n return parsed;\n }\n /**\n * Used to apply the vignette as a mix with the pixel color.\n */\n static get VIGNETTEMODE_MULTIPLY() {\n return this._VIGNETTEMODE_MULTIPLY;\n }\n /**\n * Used to apply the vignette as a replacement of the pixel color.\n */\n static get VIGNETTEMODE_OPAQUE() {\n return this._VIGNETTEMODE_OPAQUE;\n }\n}\n/**\n * Default tone mapping applied in BabylonJS.\n */\nImageProcessingConfiguration.TONEMAPPING_STANDARD = 0;\n/**\n * ACES Tone mapping (used by default in unreal and unity). This can help getting closer\n * to other engines rendering to increase portability.\n */\nImageProcessingConfiguration.TONEMAPPING_ACES = 1;\n// Static constants associated to the image processing.\nImageProcessingConfiguration._VIGNETTEMODE_MULTIPLY = 0;\nImageProcessingConfiguration._VIGNETTEMODE_OPAQUE = 1;\n__decorate([\n serializeAsColorCurves()\n], ImageProcessingConfiguration.prototype, \"colorCurves\", void 0);\n__decorate([\n serialize()\n], ImageProcessingConfiguration.prototype, \"_colorCurvesEnabled\", void 0);\n__decorate([\n serializeAsTexture(\"colorGradingTexture\")\n], ImageProcessingConfiguration.prototype, \"_colorGradingTexture\", void 0);\n__decorate([\n serialize()\n], ImageProcessingConfiguration.prototype, \"_colorGradingEnabled\", void 0);\n__decorate([\n serialize()\n], ImageProcessingConfiguration.prototype, \"_colorGradingWithGreenDepth\", void 0);\n__decorate([\n serialize()\n], ImageProcessingConfiguration.prototype, \"_colorGradingBGR\", void 0);\n__decorate([\n serialize()\n], ImageProcessingConfiguration.prototype, \"_exposure\", void 0);\n__decorate([\n serialize()\n], ImageProcessingConfiguration.prototype, \"_toneMappingEnabled\", void 0);\n__decorate([\n serialize()\n], ImageProcessingConfiguration.prototype, \"_toneMappingType\", void 0);\n__decorate([\n serialize()\n], ImageProcessingConfiguration.prototype, \"_contrast\", void 0);\n__decorate([\n serialize()\n], ImageProcessingConfiguration.prototype, \"vignetteStretch\", void 0);\n__decorate([\n serialize()\n], ImageProcessingConfiguration.prototype, \"vignetteCenterX\", void 0);\n__decorate([\n serialize()\n], ImageProcessingConfiguration.prototype, \"vignetteCenterY\", void 0);\n__decorate([\n serialize()\n], ImageProcessingConfiguration.prototype, \"vignetteWeight\", void 0);\n__decorate([\n serializeAsColor4()\n], ImageProcessingConfiguration.prototype, \"vignetteColor\", void 0);\n__decorate([\n serialize()\n], ImageProcessingConfiguration.prototype, \"vignetteCameraFov\", void 0);\n__decorate([\n serialize()\n], ImageProcessingConfiguration.prototype, \"_vignetteBlendMode\", void 0);\n__decorate([\n serialize()\n], ImageProcessingConfiguration.prototype, \"_vignetteEnabled\", void 0);\n__decorate([\n serialize()\n], ImageProcessingConfiguration.prototype, \"_ditheringEnabled\", void 0);\n__decorate([\n serialize()\n], ImageProcessingConfiguration.prototype, \"_ditheringIntensity\", void 0);\n__decorate([\n serialize()\n], ImageProcessingConfiguration.prototype, \"_skipFinalColorClamp\", void 0);\n__decorate([\n serialize()\n], ImageProcessingConfiguration.prototype, \"_applyByPostProcess\", void 0);\n__decorate([\n serialize()\n], ImageProcessingConfiguration.prototype, \"_isEnabled\", void 0);\n// References the dependencies.\nSerializationHelper._ImageProcessingConfigurationParser = ImageProcessingConfiguration.Parse;\n//# sourceMappingURL=imageProcessingConfiguration.js.map","import { ThinEngine } from \"../../Engines/thinEngine.js\";\nimport { WebGLDataBuffer } from \"../../Meshes/WebGL/webGLDataBuffer.js\";\nThinEngine.prototype.createUniformBuffer = function (elements) {\n const ubo = this._gl.createBuffer();\n if (!ubo) {\n throw new Error(\"Unable to create uniform buffer\");\n }\n const result = new WebGLDataBuffer(ubo);\n this.bindUniformBuffer(result);\n if (elements instanceof Float32Array) {\n this._gl.bufferData(this._gl.UNIFORM_BUFFER, elements, this._gl.STATIC_DRAW);\n }\n else {\n this._gl.bufferData(this._gl.UNIFORM_BUFFER, new Float32Array(elements), this._gl.STATIC_DRAW);\n }\n this.bindUniformBuffer(null);\n result.references = 1;\n return result;\n};\nThinEngine.prototype.createDynamicUniformBuffer = function (elements) {\n const ubo = this._gl.createBuffer();\n if (!ubo) {\n throw new Error(\"Unable to create dynamic uniform buffer\");\n }\n const result = new WebGLDataBuffer(ubo);\n this.bindUniformBuffer(result);\n if (elements instanceof Float32Array) {\n this._gl.bufferData(this._gl.UNIFORM_BUFFER, elements, this._gl.DYNAMIC_DRAW);\n }\n else {\n this._gl.bufferData(this._gl.UNIFORM_BUFFER, new Float32Array(elements), this._gl.DYNAMIC_DRAW);\n }\n this.bindUniformBuffer(null);\n result.references = 1;\n return result;\n};\nThinEngine.prototype.updateUniformBuffer = function (uniformBuffer, elements, offset, count) {\n this.bindUniformBuffer(uniformBuffer);\n if (offset === undefined) {\n offset = 0;\n }\n if (count === undefined) {\n if (elements instanceof Float32Array) {\n this._gl.bufferSubData(this._gl.UNIFORM_BUFFER, offset, elements);\n }\n else {\n this._gl.bufferSubData(this._gl.UNIFORM_BUFFER, offset, new Float32Array(elements));\n }\n }\n else {\n if (elements instanceof Float32Array) {\n this._gl.bufferSubData(this._gl.UNIFORM_BUFFER, 0, elements.subarray(offset, offset + count));\n }\n else {\n this._gl.bufferSubData(this._gl.UNIFORM_BUFFER, 0, new Float32Array(elements).subarray(offset, offset + count));\n }\n }\n this.bindUniformBuffer(null);\n};\nThinEngine.prototype.bindUniformBuffer = function (buffer) {\n this._gl.bindBuffer(this._gl.UNIFORM_BUFFER, buffer ? buffer.underlyingResource : null);\n};\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nThinEngine.prototype.bindUniformBufferBase = function (buffer, location, name) {\n this._gl.bindBufferBase(this._gl.UNIFORM_BUFFER, location, buffer ? buffer.underlyingResource : null);\n};\nThinEngine.prototype.bindUniformBlock = function (pipelineContext, blockName, index) {\n const program = pipelineContext.program;\n const uniformLocation = this._gl.getUniformBlockIndex(program, blockName);\n if (uniformLocation !== 0xffffffff) {\n this._gl.uniformBlockBinding(program, uniformLocation, index);\n }\n};\n//# sourceMappingURL=engine.uniformBuffer.js.map","import { Logger } from \"../Misc/logger.js\";\nimport { Tools } from \"../Misc/tools.js\";\nimport \"../Engines/Extensions/engine.uniformBuffer.js\";\n/**\n * Uniform buffer objects.\n *\n * Handles blocks of uniform on the GPU.\n *\n * If WebGL 2 is not available, this class falls back on traditional setUniformXXX calls.\n *\n * For more information, please refer to :\n * https://www.khronos.org/opengl/wiki/Uniform_Buffer_Object\n */\nexport class UniformBuffer {\n /**\n * Instantiates a new Uniform buffer objects.\n *\n * Handles blocks of uniform on the GPU.\n *\n * If WebGL 2 is not available, this class falls back on traditional setUniformXXX calls.\n *\n * For more information, please refer to :\n * @see https://www.khronos.org/opengl/wiki/Uniform_Buffer_Object\n * @param engine Define the engine the buffer is associated with\n * @param data Define the data contained in the buffer\n * @param dynamic Define if the buffer is updatable\n * @param name to assign to the buffer (debugging purpose)\n * @param forceNoUniformBuffer define that this object must not rely on UBO objects\n */\n constructor(engine, data, dynamic, name, forceNoUniformBuffer = false) {\n // Matrix cache\n this._valueCache = {};\n this._engine = engine;\n this._noUBO = !engine.supportsUniformBuffers || forceNoUniformBuffer;\n this._dynamic = dynamic;\n this._name = name !== null && name !== void 0 ? name : \"no-name\";\n this._data = data || [];\n this._uniformLocations = {};\n this._uniformSizes = {};\n this._uniformArraySizes = {};\n this._uniformLocationPointer = 0;\n this._needSync = false;\n if (this._engine._features.trackUbosInFrame) {\n this._buffers = [];\n this._bufferIndex = -1;\n this._createBufferOnWrite = false;\n this._currentFrameId = 0;\n }\n if (this._noUBO) {\n this.updateMatrix3x3 = this._updateMatrix3x3ForEffect;\n this.updateMatrix2x2 = this._updateMatrix2x2ForEffect;\n this.updateFloat = this._updateFloatForEffect;\n this.updateFloat2 = this._updateFloat2ForEffect;\n this.updateFloat3 = this._updateFloat3ForEffect;\n this.updateFloat4 = this._updateFloat4ForEffect;\n this.updateFloatArray = this._updateFloatArrayForEffect;\n this.updateArray = this._updateArrayForEffect;\n this.updateIntArray = this._updateIntArrayForEffect;\n this.updateUIntArray = this._updateUIntArrayForEffect;\n this.updateMatrix = this._updateMatrixForEffect;\n this.updateMatrices = this._updateMatricesForEffect;\n this.updateVector3 = this._updateVector3ForEffect;\n this.updateVector4 = this._updateVector4ForEffect;\n this.updateColor3 = this._updateColor3ForEffect;\n this.updateColor4 = this._updateColor4ForEffect;\n this.updateDirectColor4 = this._updateDirectColor4ForEffect;\n this.updateInt = this._updateIntForEffect;\n this.updateInt2 = this._updateInt2ForEffect;\n this.updateInt3 = this._updateInt3ForEffect;\n this.updateInt4 = this._updateInt4ForEffect;\n this.updateUInt = this._updateUIntForEffect;\n this.updateUInt2 = this._updateUInt2ForEffect;\n this.updateUInt3 = this._updateUInt3ForEffect;\n this.updateUInt4 = this._updateUInt4ForEffect;\n }\n else {\n this._engine._uniformBuffers.push(this);\n this.updateMatrix3x3 = this._updateMatrix3x3ForUniform;\n this.updateMatrix2x2 = this._updateMatrix2x2ForUniform;\n this.updateFloat = this._updateFloatForUniform;\n this.updateFloat2 = this._updateFloat2ForUniform;\n this.updateFloat3 = this._updateFloat3ForUniform;\n this.updateFloat4 = this._updateFloat4ForUniform;\n this.updateFloatArray = this._updateFloatArrayForUniform;\n this.updateArray = this._updateArrayForUniform;\n this.updateIntArray = this._updateIntArrayForUniform;\n this.updateUIntArray = this._updateUIntArrayForUniform;\n this.updateMatrix = this._updateMatrixForUniform;\n this.updateMatrices = this._updateMatricesForUniform;\n this.updateVector3 = this._updateVector3ForUniform;\n this.updateVector4 = this._updateVector4ForUniform;\n this.updateColor3 = this._updateColor3ForUniform;\n this.updateColor4 = this._updateColor4ForUniform;\n this.updateDirectColor4 = this._updateDirectColor4ForUniform;\n this.updateInt = this._updateIntForUniform;\n this.updateInt2 = this._updateInt2ForUniform;\n this.updateInt3 = this._updateInt3ForUniform;\n this.updateInt4 = this._updateInt4ForUniform;\n this.updateUInt = this._updateUIntForUniform;\n this.updateUInt2 = this._updateUInt2ForUniform;\n this.updateUInt3 = this._updateUInt3ForUniform;\n this.updateUInt4 = this._updateUInt4ForUniform;\n }\n }\n /**\n * Indicates if the buffer is using the WebGL2 UBO implementation,\n * or just falling back on setUniformXXX calls.\n */\n get useUbo() {\n return !this._noUBO;\n }\n /**\n * Indicates if the WebGL underlying uniform buffer is in sync\n * with the javascript cache data.\n */\n get isSync() {\n return !this._needSync;\n }\n /**\n * Indicates if the WebGL underlying uniform buffer is dynamic.\n * Also, a dynamic UniformBuffer will disable cache verification and always\n * update the underlying WebGL uniform buffer to the GPU.\n * @returns if Dynamic, otherwise false\n */\n isDynamic() {\n return this._dynamic !== undefined;\n }\n /**\n * The data cache on JS side.\n * @returns the underlying data as a float array\n */\n getData() {\n return this._bufferData;\n }\n /**\n * The underlying WebGL Uniform buffer.\n * @returns the webgl buffer\n */\n getBuffer() {\n return this._buffer;\n }\n /**\n * std140 layout specifies how to align data within an UBO structure.\n * See https://khronos.org/registry/OpenGL/specs/gl/glspec45.core.pdf#page=159\n * for specs.\n * @param size\n */\n _fillAlignment(size) {\n // This code has been simplified because we only use floats, vectors of 1, 2, 3, 4 components\n // and 4x4 matrices\n // TODO : change if other types are used\n let alignment;\n if (size <= 2) {\n alignment = size;\n }\n else {\n alignment = 4;\n }\n if (this._uniformLocationPointer % alignment !== 0) {\n const oldPointer = this._uniformLocationPointer;\n this._uniformLocationPointer += alignment - (this._uniformLocationPointer % alignment);\n const diff = this._uniformLocationPointer - oldPointer;\n for (let i = 0; i < diff; i++) {\n this._data.push(0);\n }\n }\n }\n /**\n * Adds an uniform in the buffer.\n * Warning : the subsequents calls of this function must be in the same order as declared in the shader\n * for the layout to be correct ! The addUniform function only handles types like float, vec2, vec3, vec4, mat4,\n * meaning size=1,2,3,4 or 16. It does not handle struct types.\n * @param name Name of the uniform, as used in the uniform block in the shader.\n * @param size Data size, or data directly.\n * @param arraySize The number of elements in the array, 0 if not an array.\n */\n addUniform(name, size, arraySize = 0) {\n if (this._noUBO) {\n return;\n }\n if (this._uniformLocations[name] !== undefined) {\n // Already existing uniform\n return;\n }\n // This function must be called in the order of the shader layout !\n // size can be the size of the uniform, or data directly\n let data;\n // std140 FTW...\n if (arraySize > 0) {\n if (size instanceof Array) {\n throw \"addUniform should not be use with Array in UBO: \" + name;\n }\n this._fillAlignment(4);\n this._uniformArraySizes[name] = { strideSize: size, arraySize };\n if (size == 16) {\n size = size * arraySize;\n }\n else {\n const perElementPadding = 4 - size;\n const totalPadding = perElementPadding * arraySize;\n size = size * arraySize + totalPadding;\n }\n data = [];\n // Fill with zeros\n for (let i = 0; i < size; i++) {\n data.push(0);\n }\n }\n else {\n if (size instanceof Array) {\n data = size;\n size = data.length;\n }\n else {\n size = size;\n data = [];\n // Fill with zeros\n for (let i = 0; i < size; i++) {\n data.push(0);\n }\n }\n this._fillAlignment(size);\n }\n this._uniformSizes[name] = size;\n this._uniformLocations[name] = this._uniformLocationPointer;\n this._uniformLocationPointer += size;\n for (let i = 0; i < size; i++) {\n this._data.push(data[i]);\n }\n this._needSync = true;\n }\n /**\n * Adds a Matrix 4x4 to the uniform buffer.\n * @param name Name of the uniform, as used in the uniform block in the shader.\n * @param mat A 4x4 matrix.\n */\n addMatrix(name, mat) {\n this.addUniform(name, Array.prototype.slice.call(mat.toArray()));\n }\n /**\n * Adds a vec2 to the uniform buffer.\n * @param name Name of the uniform, as used in the uniform block in the shader.\n * @param x Define the x component value of the vec2\n * @param y Define the y component value of the vec2\n */\n addFloat2(name, x, y) {\n const temp = [x, y];\n this.addUniform(name, temp);\n }\n /**\n * Adds a vec3 to the uniform buffer.\n * @param name Name of the uniform, as used in the uniform block in the shader.\n * @param x Define the x component value of the vec3\n * @param y Define the y component value of the vec3\n * @param z Define the z component value of the vec3\n */\n addFloat3(name, x, y, z) {\n const temp = [x, y, z];\n this.addUniform(name, temp);\n }\n /**\n * Adds a vec3 to the uniform buffer.\n * @param name Name of the uniform, as used in the uniform block in the shader.\n * @param color Define the vec3 from a Color\n */\n addColor3(name, color) {\n const temp = [color.r, color.g, color.b];\n this.addUniform(name, temp);\n }\n /**\n * Adds a vec4 to the uniform buffer.\n * @param name Name of the uniform, as used in the uniform block in the shader.\n * @param color Define the rgb components from a Color\n * @param alpha Define the a component of the vec4\n */\n addColor4(name, color, alpha) {\n const temp = [color.r, color.g, color.b, alpha];\n this.addUniform(name, temp);\n }\n /**\n * Adds a vec3 to the uniform buffer.\n * @param name Name of the uniform, as used in the uniform block in the shader.\n * @param vector Define the vec3 components from a Vector\n */\n addVector3(name, vector) {\n const temp = [vector.x, vector.y, vector.z];\n this.addUniform(name, temp);\n }\n /**\n * Adds a Matrix 3x3 to the uniform buffer.\n * @param name Name of the uniform, as used in the uniform block in the shader.\n */\n addMatrix3x3(name) {\n this.addUniform(name, 12);\n }\n /**\n * Adds a Matrix 2x2 to the uniform buffer.\n * @param name Name of the uniform, as used in the uniform block in the shader.\n */\n addMatrix2x2(name) {\n this.addUniform(name, 8);\n }\n /**\n * Effectively creates the WebGL Uniform Buffer, once layout is completed with `addUniform`.\n */\n create() {\n if (this._noUBO) {\n return;\n }\n if (this._buffer) {\n return; // nothing to do\n }\n // See spec, alignment must be filled as a vec4\n this._fillAlignment(4);\n this._bufferData = new Float32Array(this._data);\n this._rebuild();\n this._needSync = true;\n }\n /** @internal */\n _rebuild() {\n if (this._noUBO || !this._bufferData) {\n return;\n }\n if (this._dynamic) {\n this._buffer = this._engine.createDynamicUniformBuffer(this._bufferData);\n }\n else {\n this._buffer = this._engine.createUniformBuffer(this._bufferData);\n }\n if (this._engine._features.trackUbosInFrame) {\n this._buffers.push([this._buffer, this._engine._features.checkUbosContentBeforeUpload ? this._bufferData.slice() : undefined]);\n this._bufferIndex = this._buffers.length - 1;\n this._createBufferOnWrite = false;\n }\n }\n /** @internal */\n get _numBuffers() {\n return this._buffers.length;\n }\n /** @internal */\n get _indexBuffer() {\n return this._bufferIndex;\n }\n /** Gets the name of this buffer */\n get name() {\n return this._name;\n }\n /** Gets the current effect */\n get currentEffect() {\n return this._currentEffect;\n }\n _buffersEqual(buf1, buf2) {\n for (let i = 0; i < buf1.length; ++i) {\n if (buf1[i] !== buf2[i]) {\n return false;\n }\n }\n return true;\n }\n _copyBuffer(src, dst) {\n for (let i = 0; i < src.length; ++i) {\n dst[i] = src[i];\n }\n }\n /**\n * Updates the WebGL Uniform Buffer on the GPU.\n * If the `dynamic` flag is set to true, no cache comparison is done.\n * Otherwise, the buffer will be updated only if the cache differs.\n */\n update() {\n if (this._noUBO) {\n return;\n }\n this.bindUniformBuffer();\n if (!this._buffer) {\n this.create();\n return;\n }\n if (!this._dynamic && !this._needSync) {\n this._createBufferOnWrite = this._engine._features.trackUbosInFrame;\n return;\n }\n if (this._buffers && this._buffers.length > 1 && this._buffers[this._bufferIndex][1]) {\n if (this._buffersEqual(this._bufferData, this._buffers[this._bufferIndex][1])) {\n this._needSync = false;\n this._createBufferOnWrite = this._engine._features.trackUbosInFrame;\n return;\n }\n else {\n this._copyBuffer(this._bufferData, this._buffers[this._bufferIndex][1]);\n }\n }\n this._engine.updateUniformBuffer(this._buffer, this._bufferData);\n if (this._engine._features._collectUbosUpdatedInFrame) {\n if (!UniformBuffer._UpdatedUbosInFrame[this._name]) {\n UniformBuffer._UpdatedUbosInFrame[this._name] = 0;\n }\n UniformBuffer._UpdatedUbosInFrame[this._name]++;\n }\n this._needSync = false;\n this._createBufferOnWrite = this._engine._features.trackUbosInFrame;\n }\n _createNewBuffer() {\n if (this._bufferIndex + 1 < this._buffers.length) {\n this._bufferIndex++;\n this._buffer = this._buffers[this._bufferIndex][0];\n this._createBufferOnWrite = false;\n this._needSync = true;\n }\n else {\n this._rebuild();\n }\n }\n _checkNewFrame() {\n if (this._engine._features.trackUbosInFrame && this._currentFrameId !== this._engine.frameId) {\n this._currentFrameId = this._engine.frameId;\n this._createBufferOnWrite = false;\n if (this._buffers && this._buffers.length > 0) {\n this._needSync = this._bufferIndex !== 0;\n this._bufferIndex = 0;\n this._buffer = this._buffers[this._bufferIndex][0];\n }\n else {\n this._bufferIndex = -1;\n }\n }\n }\n /**\n * Updates the value of an uniform. The `update` method must be called afterwards to make it effective in the GPU.\n * @param uniformName Define the name of the uniform, as used in the uniform block in the shader.\n * @param data Define the flattened data\n * @param size Define the size of the data.\n */\n updateUniform(uniformName, data, size) {\n this._checkNewFrame();\n let location = this._uniformLocations[uniformName];\n if (location === undefined) {\n if (this._buffer) {\n // Cannot add an uniform if the buffer is already created\n Logger.Error(\"Cannot add an uniform after UBO has been created.\");\n return;\n }\n this.addUniform(uniformName, size);\n location = this._uniformLocations[uniformName];\n }\n if (!this._buffer) {\n this.create();\n }\n if (!this._dynamic) {\n // Cache for static uniform buffers\n let changed = false;\n for (let i = 0; i < size; i++) {\n // We are checking the matrix cache before calling updateUniform so we do not need to check it here\n // Hence the test for size === 16 to simply commit the matrix values\n if ((size === 16 && !this._engine._features.uniformBufferHardCheckMatrix) || this._bufferData[location + i] !== Tools.FloatRound(data[i])) {\n changed = true;\n if (this._createBufferOnWrite) {\n this._createNewBuffer();\n }\n this._bufferData[location + i] = data[i];\n }\n }\n this._needSync = this._needSync || changed;\n }\n else {\n // No cache for dynamic\n for (let i = 0; i < size; i++) {\n this._bufferData[location + i] = data[i];\n }\n }\n }\n /**\n * Updates the value of an uniform. The `update` method must be called afterwards to make it effective in the GPU.\n * @param uniformName Define the name of the uniform, as used in the uniform block in the shader.\n * @param data Define the flattened data\n * @param size Define the size of the data.\n */\n updateUniformArray(uniformName, data, size) {\n this._checkNewFrame();\n const location = this._uniformLocations[uniformName];\n if (location === undefined) {\n Logger.Error(\"Cannot add an uniform Array dynamically. Please, add it using addUniform and make sure that uniform buffers are supported by the current engine.\");\n return;\n }\n if (!this._buffer) {\n this.create();\n }\n const arraySizes = this._uniformArraySizes[uniformName];\n if (!this._dynamic) {\n // Cache for static uniform buffers\n let changed = false;\n let countToFour = 0;\n let baseStride = 0;\n for (let i = 0; i < size; i++) {\n if (this._bufferData[location + baseStride * 4 + countToFour] !== Tools.FloatRound(data[i])) {\n changed = true;\n if (this._createBufferOnWrite) {\n this._createNewBuffer();\n }\n this._bufferData[location + baseStride * 4 + countToFour] = data[i];\n }\n countToFour++;\n if (countToFour === arraySizes.strideSize) {\n for (; countToFour < 4; countToFour++) {\n this._bufferData[location + baseStride * 4 + countToFour] = 0;\n }\n countToFour = 0;\n baseStride++;\n }\n }\n this._needSync = this._needSync || changed;\n }\n else {\n // No cache for dynamic\n for (let i = 0; i < size; i++) {\n this._bufferData[location + i] = data[i];\n }\n }\n }\n _cacheMatrix(name, matrix) {\n this._checkNewFrame();\n const cache = this._valueCache[name];\n const flag = matrix.updateFlag;\n if (cache !== undefined && cache === flag) {\n return false;\n }\n this._valueCache[name] = flag;\n return true;\n }\n // Update methods\n _updateMatrix3x3ForUniform(name, matrix) {\n // To match std140, matrix must be realigned\n for (let i = 0; i < 3; i++) {\n UniformBuffer._TempBuffer[i * 4] = matrix[i * 3];\n UniformBuffer._TempBuffer[i * 4 + 1] = matrix[i * 3 + 1];\n UniformBuffer._TempBuffer[i * 4 + 2] = matrix[i * 3 + 2];\n UniformBuffer._TempBuffer[i * 4 + 3] = 0.0;\n }\n this.updateUniform(name, UniformBuffer._TempBuffer, 12);\n }\n _updateMatrix3x3ForEffect(name, matrix) {\n this._currentEffect.setMatrix3x3(name, matrix);\n }\n _updateMatrix2x2ForEffect(name, matrix) {\n this._currentEffect.setMatrix2x2(name, matrix);\n }\n _updateMatrix2x2ForUniform(name, matrix) {\n // To match std140, matrix must be realigned\n for (let i = 0; i < 2; i++) {\n UniformBuffer._TempBuffer[i * 4] = matrix[i * 2];\n UniformBuffer._TempBuffer[i * 4 + 1] = matrix[i * 2 + 1];\n UniformBuffer._TempBuffer[i * 4 + 2] = 0.0;\n UniformBuffer._TempBuffer[i * 4 + 3] = 0.0;\n }\n this.updateUniform(name, UniformBuffer._TempBuffer, 8);\n }\n _updateFloatForEffect(name, x) {\n this._currentEffect.setFloat(name, x);\n }\n _updateFloatForUniform(name, x) {\n UniformBuffer._TempBuffer[0] = x;\n this.updateUniform(name, UniformBuffer._TempBuffer, 1);\n }\n _updateFloat2ForEffect(name, x, y, suffix = \"\") {\n this._currentEffect.setFloat2(name + suffix, x, y);\n }\n _updateFloat2ForUniform(name, x, y) {\n UniformBuffer._TempBuffer[0] = x;\n UniformBuffer._TempBuffer[1] = y;\n this.updateUniform(name, UniformBuffer._TempBuffer, 2);\n }\n _updateFloat3ForEffect(name, x, y, z, suffix = \"\") {\n this._currentEffect.setFloat3(name + suffix, x, y, z);\n }\n _updateFloat3ForUniform(name, x, y, z) {\n UniformBuffer._TempBuffer[0] = x;\n UniformBuffer._TempBuffer[1] = y;\n UniformBuffer._TempBuffer[2] = z;\n this.updateUniform(name, UniformBuffer._TempBuffer, 3);\n }\n _updateFloat4ForEffect(name, x, y, z, w, suffix = \"\") {\n this._currentEffect.setFloat4(name + suffix, x, y, z, w);\n }\n _updateFloat4ForUniform(name, x, y, z, w) {\n UniformBuffer._TempBuffer[0] = x;\n UniformBuffer._TempBuffer[1] = y;\n UniformBuffer._TempBuffer[2] = z;\n UniformBuffer._TempBuffer[3] = w;\n this.updateUniform(name, UniformBuffer._TempBuffer, 4);\n }\n _updateFloatArrayForEffect(name, array) {\n this._currentEffect.setFloatArray(name, array);\n }\n _updateFloatArrayForUniform(name, array) {\n this.updateUniformArray(name, array, array.length);\n }\n _updateArrayForEffect(name, array) {\n this._currentEffect.setArray(name, array);\n }\n _updateArrayForUniform(name, array) {\n this.updateUniformArray(name, array, array.length);\n }\n _updateIntArrayForEffect(name, array) {\n this._currentEffect.setIntArray(name, array);\n }\n _updateIntArrayForUniform(name, array) {\n UniformBuffer._TempBufferInt32View.set(array);\n this.updateUniformArray(name, UniformBuffer._TempBuffer, array.length);\n }\n _updateUIntArrayForEffect(name, array) {\n this._currentEffect.setUIntArray(name, array);\n }\n _updateUIntArrayForUniform(name, array) {\n UniformBuffer._TempBufferUInt32View.set(array);\n this.updateUniformArray(name, UniformBuffer._TempBuffer, array.length);\n }\n _updateMatrixForEffect(name, mat) {\n this._currentEffect.setMatrix(name, mat);\n }\n _updateMatrixForUniform(name, mat) {\n if (this._cacheMatrix(name, mat)) {\n this.updateUniform(name, mat.toArray(), 16);\n }\n }\n _updateMatricesForEffect(name, mat) {\n this._currentEffect.setMatrices(name, mat);\n }\n _updateMatricesForUniform(name, mat) {\n this.updateUniform(name, mat, mat.length);\n }\n _updateVector3ForEffect(name, vector) {\n this._currentEffect.setVector3(name, vector);\n }\n _updateVector3ForUniform(name, vector) {\n UniformBuffer._TempBuffer[0] = vector.x;\n UniformBuffer._TempBuffer[1] = vector.y;\n UniformBuffer._TempBuffer[2] = vector.z;\n this.updateUniform(name, UniformBuffer._TempBuffer, 3);\n }\n _updateVector4ForEffect(name, vector) {\n this._currentEffect.setVector4(name, vector);\n }\n _updateVector4ForUniform(name, vector) {\n UniformBuffer._TempBuffer[0] = vector.x;\n UniformBuffer._TempBuffer[1] = vector.y;\n UniformBuffer._TempBuffer[2] = vector.z;\n UniformBuffer._TempBuffer[3] = vector.w;\n this.updateUniform(name, UniformBuffer._TempBuffer, 4);\n }\n _updateColor3ForEffect(name, color, suffix = \"\") {\n this._currentEffect.setColor3(name + suffix, color);\n }\n _updateColor3ForUniform(name, color) {\n UniformBuffer._TempBuffer[0] = color.r;\n UniformBuffer._TempBuffer[1] = color.g;\n UniformBuffer._TempBuffer[2] = color.b;\n this.updateUniform(name, UniformBuffer._TempBuffer, 3);\n }\n _updateColor4ForEffect(name, color, alpha, suffix = \"\") {\n this._currentEffect.setColor4(name + suffix, color, alpha);\n }\n _updateDirectColor4ForEffect(name, color, suffix = \"\") {\n this._currentEffect.setDirectColor4(name + suffix, color);\n }\n _updateColor4ForUniform(name, color, alpha) {\n UniformBuffer._TempBuffer[0] = color.r;\n UniformBuffer._TempBuffer[1] = color.g;\n UniformBuffer._TempBuffer[2] = color.b;\n UniformBuffer._TempBuffer[3] = alpha;\n this.updateUniform(name, UniformBuffer._TempBuffer, 4);\n }\n _updateDirectColor4ForUniform(name, color) {\n UniformBuffer._TempBuffer[0] = color.r;\n UniformBuffer._TempBuffer[1] = color.g;\n UniformBuffer._TempBuffer[2] = color.b;\n UniformBuffer._TempBuffer[3] = color.a;\n this.updateUniform(name, UniformBuffer._TempBuffer, 4);\n }\n _updateIntForEffect(name, x, suffix = \"\") {\n this._currentEffect.setInt(name + suffix, x);\n }\n _updateIntForUniform(name, x) {\n UniformBuffer._TempBufferInt32View[0] = x;\n this.updateUniform(name, UniformBuffer._TempBuffer, 1);\n }\n _updateInt2ForEffect(name, x, y, suffix = \"\") {\n this._currentEffect.setInt2(name + suffix, x, y);\n }\n _updateInt2ForUniform(name, x, y) {\n UniformBuffer._TempBufferInt32View[0] = x;\n UniformBuffer._TempBufferInt32View[1] = y;\n this.updateUniform(name, UniformBuffer._TempBuffer, 2);\n }\n _updateInt3ForEffect(name, x, y, z, suffix = \"\") {\n this._currentEffect.setInt3(name + suffix, x, y, z);\n }\n _updateInt3ForUniform(name, x, y, z) {\n UniformBuffer._TempBufferInt32View[0] = x;\n UniformBuffer._TempBufferInt32View[1] = y;\n UniformBuffer._TempBufferInt32View[2] = z;\n this.updateUniform(name, UniformBuffer._TempBuffer, 3);\n }\n _updateInt4ForEffect(name, x, y, z, w, suffix = \"\") {\n this._currentEffect.setInt4(name + suffix, x, y, z, w);\n }\n _updateInt4ForUniform(name, x, y, z, w) {\n UniformBuffer._TempBufferInt32View[0] = x;\n UniformBuffer._TempBufferInt32View[1] = y;\n UniformBuffer._TempBufferInt32View[2] = z;\n UniformBuffer._TempBufferInt32View[3] = w;\n this.updateUniform(name, UniformBuffer._TempBuffer, 4);\n }\n _updateUIntForEffect(name, x, suffix = \"\") {\n this._currentEffect.setUInt(name + suffix, x);\n }\n _updateUIntForUniform(name, x) {\n UniformBuffer._TempBufferUInt32View[0] = x;\n this.updateUniform(name, UniformBuffer._TempBuffer, 1);\n }\n _updateUInt2ForEffect(name, x, y, suffix = \"\") {\n this._currentEffect.setUInt2(name + suffix, x, y);\n }\n _updateUInt2ForUniform(name, x, y) {\n UniformBuffer._TempBufferUInt32View[0] = x;\n UniformBuffer._TempBufferUInt32View[1] = y;\n this.updateUniform(name, UniformBuffer._TempBuffer, 2);\n }\n _updateUInt3ForEffect(name, x, y, z, suffix = \"\") {\n this._currentEffect.setUInt3(name + suffix, x, y, z);\n }\n _updateUInt3ForUniform(name, x, y, z) {\n UniformBuffer._TempBufferUInt32View[0] = x;\n UniformBuffer._TempBufferUInt32View[1] = y;\n UniformBuffer._TempBufferUInt32View[2] = z;\n this.updateUniform(name, UniformBuffer._TempBuffer, 3);\n }\n _updateUInt4ForEffect(name, x, y, z, w, suffix = \"\") {\n this._currentEffect.setUInt4(name + suffix, x, y, z, w);\n }\n _updateUInt4ForUniform(name, x, y, z, w) {\n UniformBuffer._TempBufferUInt32View[0] = x;\n UniformBuffer._TempBufferUInt32View[1] = y;\n UniformBuffer._TempBufferUInt32View[2] = z;\n UniformBuffer._TempBufferUInt32View[3] = w;\n this.updateUniform(name, UniformBuffer._TempBuffer, 4);\n }\n /**\n * Sets a sampler uniform on the effect.\n * @param name Define the name of the sampler.\n * @param texture Define the texture to set in the sampler\n */\n setTexture(name, texture) {\n this._currentEffect.setTexture(name, texture);\n }\n /**\n * Sets a sampler uniform on the effect.\n * @param name Define the name of the sampler.\n * @param texture Define the (internal) texture to set in the sampler\n */\n bindTexture(name, texture) {\n this._currentEffect._bindTexture(name, texture);\n }\n /**\n * Directly updates the value of the uniform in the cache AND on the GPU.\n * @param uniformName Define the name of the uniform, as used in the uniform block in the shader.\n * @param data Define the flattened data\n */\n updateUniformDirectly(uniformName, data) {\n this.updateUniform(uniformName, data, data.length);\n this.update();\n }\n /**\n * Associates an effect to this uniform buffer\n * @param effect Define the effect to associate the buffer to\n * @param name Name of the uniform block in the shader.\n */\n bindToEffect(effect, name) {\n this._currentEffect = effect;\n this._currentEffectName = name;\n }\n /**\n * Binds the current (GPU) buffer to the effect\n */\n bindUniformBuffer() {\n if (!this._noUBO && this._buffer && this._currentEffect) {\n this._currentEffect.bindUniformBuffer(this._buffer, this._currentEffectName);\n }\n }\n /**\n * Dissociates the current effect from this uniform buffer\n */\n unbindEffect() {\n this._currentEffect = undefined;\n this._currentEffectName = undefined;\n }\n /**\n * Sets the current state of the class (_bufferIndex, _buffer) to point to the data buffer passed in parameter if this buffer is one of the buffers handled by the class (meaning if it can be found in the _buffers array)\n * This method is meant to be able to update a buffer at any time: just call setDataBuffer to set the class in the right state, call some updateXXX methods and then call udpate() => that will update the GPU buffer on the graphic card\n * @param dataBuffer buffer to look for\n * @returns true if the buffer has been found and the class internal state points to it, else false\n */\n setDataBuffer(dataBuffer) {\n if (!this._buffers) {\n return this._buffer === dataBuffer;\n }\n for (let b = 0; b < this._buffers.length; ++b) {\n const buffer = this._buffers[b];\n if (buffer[0] === dataBuffer) {\n this._bufferIndex = b;\n this._buffer = dataBuffer;\n this._createBufferOnWrite = false;\n this._currentEffect = undefined;\n return true;\n }\n }\n return false;\n }\n /**\n * Disposes the uniform buffer.\n */\n dispose() {\n if (this._noUBO) {\n return;\n }\n const uniformBuffers = this._engine._uniformBuffers;\n const index = uniformBuffers.indexOf(this);\n if (index !== -1) {\n uniformBuffers[index] = uniformBuffers[uniformBuffers.length - 1];\n uniformBuffers.pop();\n }\n if (this._engine._features.trackUbosInFrame && this._buffers) {\n for (let i = 0; i < this._buffers.length; ++i) {\n const buffer = this._buffers[i][0];\n this._engine._releaseBuffer(buffer);\n }\n }\n else if (this._buffer && this._engine._releaseBuffer(this._buffer)) {\n this._buffer = null;\n }\n }\n}\n/** @internal */\nUniformBuffer._UpdatedUbosInFrame = {};\n// Pool for avoiding memory leaks\nUniformBuffer._MAX_UNIFORM_SIZE = 256;\nUniformBuffer._TempBuffer = new Float32Array(UniformBuffer._MAX_UNIFORM_SIZE);\nUniformBuffer._TempBufferInt32View = new Int32Array(UniformBuffer._TempBuffer.buffer);\nUniformBuffer._TempBufferUInt32View = new Uint32Array(UniformBuffer._TempBuffer.buffer);\n//# sourceMappingURL=uniformBuffer.js.map","import { DataBuffer } from \"./dataBuffer.js\";\n/**\n * Class used to store data that will be store in GPU memory\n */\nexport class Buffer {\n /**\n * Constructor\n * @param engine the engine\n * @param data the data to use for this buffer\n * @param updatable whether the data is updatable\n * @param stride the stride (optional)\n * @param postponeInternalCreation whether to postpone creating the internal WebGL buffer (optional)\n * @param instanced whether the buffer is instanced (optional)\n * @param useBytes set to true if the stride in in bytes (optional)\n * @param divisor sets an optional divisor for instances (1 by default)\n */\n constructor(engine, data, updatable, stride = 0, postponeInternalCreation = !engine, instanced = false, useBytes = false, divisor) {\n this._isAlreadyOwned = false;\n if (engine && engine.getScene) {\n // old versions of VertexBuffer accepted 'mesh' instead of 'engine'\n this._engine = engine.getScene().getEngine();\n }\n else {\n this._engine = engine;\n }\n this._updatable = updatable;\n this._instanced = instanced;\n this._divisor = divisor || 1;\n if (data instanceof DataBuffer) {\n this._data = null;\n this._buffer = data;\n }\n else {\n this._data = data;\n this._buffer = null;\n }\n this.byteStride = useBytes ? stride : stride * Float32Array.BYTES_PER_ELEMENT;\n if (!postponeInternalCreation) {\n // by default\n this.create();\n }\n }\n /**\n * Create a new VertexBuffer based on the current buffer\n * @param kind defines the vertex buffer kind (position, normal, etc.)\n * @param offset defines offset in the buffer (0 by default)\n * @param size defines the size in floats of attributes (position is 3 for instance)\n * @param stride defines the stride size in floats in the buffer (the offset to apply to reach next value when data is interleaved)\n * @param instanced defines if the vertex buffer contains indexed data\n * @param useBytes defines if the offset and stride are in bytes *\n * @param divisor sets an optional divisor for instances (1 by default)\n * @returns the new vertex buffer\n */\n createVertexBuffer(kind, offset, size, stride, instanced, useBytes = false, divisor) {\n const byteOffset = useBytes ? offset : offset * Float32Array.BYTES_PER_ELEMENT;\n const byteStride = stride ? (useBytes ? stride : stride * Float32Array.BYTES_PER_ELEMENT) : this.byteStride;\n // a lot of these parameters are ignored as they are overridden by the buffer\n return new VertexBuffer(this._engine, this, kind, this._updatable, true, byteStride, instanced === undefined ? this._instanced : instanced, byteOffset, size, undefined, undefined, true, this._divisor || divisor);\n }\n // Properties\n /**\n * Gets a boolean indicating if the Buffer is updatable?\n * @returns true if the buffer is updatable\n */\n isUpdatable() {\n return this._updatable;\n }\n /**\n * Gets current buffer's data\n * @returns a DataArray or null\n */\n getData() {\n return this._data;\n }\n /**\n * Gets underlying native buffer\n * @returns underlying native buffer\n */\n getBuffer() {\n return this._buffer;\n }\n /**\n * Gets the stride in float32 units (i.e. byte stride / 4).\n * May not be an integer if the byte stride is not divisible by 4.\n * @returns the stride in float32 units\n * @deprecated Please use byteStride instead.\n */\n getStrideSize() {\n return this.byteStride / Float32Array.BYTES_PER_ELEMENT;\n }\n // Methods\n /**\n * Store data into the buffer. Creates the buffer if not used already.\n * If the buffer was already used, it will be updated only if it is updatable, otherwise it will do nothing.\n * @param data defines the data to store\n */\n create(data = null) {\n if (!data && this._buffer) {\n return; // nothing to do\n }\n data = data || this._data;\n if (!data) {\n return;\n }\n if (!this._engine) {\n throw new Error(\"Engine must be provided in the buffer constructor in order to create\");\n }\n if (!this._buffer) {\n // create buffer\n if (this._updatable) {\n this._buffer = this._engine.createDynamicVertexBuffer(data);\n this._data = data;\n }\n else {\n this._buffer = this._engine.createVertexBuffer(data);\n }\n }\n else if (this._updatable) {\n // update buffer\n this._engine.updateDynamicVertexBuffer(this._buffer, data);\n this._data = data;\n }\n }\n /** @internal */\n _rebuild() {\n this._buffer = null;\n this.create(this._data);\n }\n /**\n * Update current buffer data\n * @param data defines the data to store\n */\n update(data) {\n this.create(data);\n }\n /**\n * Updates the data directly.\n * @param data the new data\n * @param offset the new offset\n * @param vertexCount the vertex count (optional)\n * @param useBytes set to true if the offset is in bytes\n */\n updateDirectly(data, offset, vertexCount, useBytes = false) {\n if (!this._buffer) {\n return;\n }\n if (this._updatable) {\n if (!this._engine) {\n throw new Error(\"Engine must be provided in the buffer constructor in order to update directly\");\n }\n // update buffer\n this._engine.updateDynamicVertexBuffer(this._buffer, data, useBytes ? offset : offset * Float32Array.BYTES_PER_ELEMENT, vertexCount ? vertexCount * this.byteStride : undefined);\n if (offset === 0 && vertexCount === undefined) {\n // Keep the data if we easily can\n this._data = data;\n }\n else {\n this._data = null;\n }\n }\n }\n /** @internal */\n _increaseReferences() {\n if (!this._buffer) {\n return;\n }\n if (!this._isAlreadyOwned) {\n this._isAlreadyOwned = true;\n return;\n }\n this._buffer.references++;\n }\n /**\n * Release all resources\n */\n dispose() {\n if (!this._buffer) {\n return;\n }\n if (this._engine) {\n this._engine._releaseBuffer(this._buffer);\n }\n this._buffer = null;\n this._data = null;\n }\n}\n/**\n * Specialized buffer used to store vertex data\n */\nexport class VertexBuffer {\n /**\n * Gets or sets the instance divisor when in instanced mode\n */\n get instanceDivisor() {\n return this._instanceDivisor;\n }\n set instanceDivisor(value) {\n const isInstanced = value != 0;\n this._instanceDivisor = value;\n if (isInstanced !== this._instanced) {\n this._instanced = isInstanced;\n this._computeHashCode();\n }\n }\n /**\n * Constructor\n * @param engine the engine\n * @param data the data to use for this vertex buffer\n * @param kind the vertex buffer kind\n * @param updatable whether the data is updatable\n * @param postponeInternalCreation whether to postpone creating the internal WebGL buffer (optional)\n * @param stride the stride (optional)\n * @param instanced whether the buffer is instanced (optional)\n * @param offset the offset of the data (optional)\n * @param size the number of components (optional)\n * @param type the type of the component (optional)\n * @param normalized whether the data contains normalized data (optional)\n * @param useBytes set to true if stride and offset are in bytes (optional)\n * @param divisor defines the instance divisor to use (1 by default)\n * @param takeBufferOwnership defines if the buffer should be released when the vertex buffer is disposed\n */\n constructor(engine, data, kind, updatable, postponeInternalCreation, stride, instanced, offset, size, type, normalized = false, useBytes = false, divisor = 1, takeBufferOwnership = false) {\n if (data instanceof Buffer) {\n this._buffer = data;\n this._ownsBuffer = takeBufferOwnership;\n }\n else {\n this._buffer = new Buffer(engine, data, updatable, stride, postponeInternalCreation, instanced, useBytes);\n this._ownsBuffer = true;\n }\n this.uniqueId = VertexBuffer._Counter++;\n this._kind = kind;\n if (type == undefined) {\n const vertexData = this.getData();\n this.type = VertexBuffer.FLOAT;\n if (vertexData instanceof Int8Array) {\n this.type = VertexBuffer.BYTE;\n }\n else if (vertexData instanceof Uint8Array) {\n this.type = VertexBuffer.UNSIGNED_BYTE;\n }\n else if (vertexData instanceof Int16Array) {\n this.type = VertexBuffer.SHORT;\n }\n else if (vertexData instanceof Uint16Array) {\n this.type = VertexBuffer.UNSIGNED_SHORT;\n }\n else if (vertexData instanceof Int32Array) {\n this.type = VertexBuffer.INT;\n }\n else if (vertexData instanceof Uint32Array) {\n this.type = VertexBuffer.UNSIGNED_INT;\n }\n }\n else {\n this.type = type;\n }\n const typeByteLength = VertexBuffer.GetTypeByteLength(this.type);\n if (useBytes) {\n this._size = size || (stride ? stride / typeByteLength : VertexBuffer.DeduceStride(kind));\n this.byteStride = stride || this._buffer.byteStride || this._size * typeByteLength;\n this.byteOffset = offset || 0;\n }\n else {\n this._size = size || stride || VertexBuffer.DeduceStride(kind);\n this.byteStride = stride ? stride * typeByteLength : this._buffer.byteStride || this._size * typeByteLength;\n this.byteOffset = (offset || 0) * typeByteLength;\n }\n this.normalized = normalized;\n this._instanced = instanced !== undefined ? instanced : false;\n this._instanceDivisor = instanced ? divisor : 0;\n this._computeHashCode();\n }\n _computeHashCode() {\n // note: cast to any because the property is declared readonly\n this.hashCode =\n ((this.type - 5120) << 0) +\n ((this.normalized ? 1 : 0) << 3) +\n (this._size << 4) +\n ((this._instanced ? 1 : 0) << 6) +\n /* keep 5 bits free */\n (this.byteStride << 12);\n }\n /** @internal */\n _rebuild() {\n if (!this._buffer) {\n return;\n }\n this._buffer._rebuild();\n }\n /**\n * Returns the kind of the VertexBuffer (string)\n * @returns a string\n */\n getKind() {\n return this._kind;\n }\n // Properties\n /**\n * Gets a boolean indicating if the VertexBuffer is updatable?\n * @returns true if the buffer is updatable\n */\n isUpdatable() {\n return this._buffer.isUpdatable();\n }\n /**\n * Gets current buffer's data\n * @returns a DataArray or null\n */\n getData() {\n return this._buffer.getData();\n }\n /**\n * Gets current buffer's data as a float array. Float data is constructed if the vertex buffer data cannot be returned directly.\n * @param totalVertices number of vertices in the buffer to take into account\n * @param forceCopy defines a boolean indicating that the returned array must be cloned upon returning it\n * @returns a float array containing vertex data\n */\n getFloatData(totalVertices, forceCopy) {\n const data = this.getData();\n if (!data) {\n return null;\n }\n const tightlyPackedByteStride = this.getSize() * VertexBuffer.GetTypeByteLength(this.type);\n const count = totalVertices * this.getSize();\n if (this.type !== VertexBuffer.FLOAT || this.byteStride !== tightlyPackedByteStride) {\n const copy = new Float32Array(count);\n this.forEach(count, (value, index) => (copy[index] = value));\n return copy;\n }\n if (!(data instanceof Array || data instanceof Float32Array) || this.byteOffset !== 0 || data.length !== count) {\n if (data instanceof Array) {\n const offset = this.byteOffset / 4;\n return data.slice(offset, offset + count);\n }\n else if (data instanceof ArrayBuffer) {\n return new Float32Array(data, this.byteOffset, count);\n }\n else {\n let offset = data.byteOffset + this.byteOffset;\n if (forceCopy) {\n const result = new Float32Array(count);\n const source = new Float32Array(data.buffer, offset, count);\n result.set(source);\n return result;\n }\n // Protect against bad data\n const remainder = offset % 4;\n if (remainder) {\n offset = Math.max(0, offset - remainder);\n }\n return new Float32Array(data.buffer, offset, count);\n }\n }\n if (forceCopy) {\n return data.slice();\n }\n return data;\n }\n /**\n * Gets underlying native buffer\n * @returns underlying native buffer\n */\n getBuffer() {\n return this._buffer.getBuffer();\n }\n /**\n * Gets the stride in float32 units (i.e. byte stride / 4).\n * May not be an integer if the byte stride is not divisible by 4.\n * @returns the stride in float32 units\n * @deprecated Please use byteStride instead.\n */\n getStrideSize() {\n return this.byteStride / VertexBuffer.GetTypeByteLength(this.type);\n }\n /**\n * Returns the offset as a multiple of the type byte length.\n * @returns the offset in bytes\n * @deprecated Please use byteOffset instead.\n */\n getOffset() {\n return this.byteOffset / VertexBuffer.GetTypeByteLength(this.type);\n }\n /**\n * Returns the number of components or the byte size per vertex attribute\n * @param sizeInBytes If true, returns the size in bytes or else the size in number of components of the vertex attribute (default: false)\n * @returns the number of components\n */\n getSize(sizeInBytes = false) {\n return sizeInBytes ? this._size * VertexBuffer.GetTypeByteLength(this.type) : this._size;\n }\n /**\n * Gets a boolean indicating is the internal buffer of the VertexBuffer is instanced\n * @returns true if this buffer is instanced\n */\n getIsInstanced() {\n return this._instanced;\n }\n /**\n * Returns the instancing divisor, zero for non-instanced (integer).\n * @returns a number\n */\n getInstanceDivisor() {\n return this._instanceDivisor;\n }\n // Methods\n /**\n * Store data into the buffer. If the buffer was already used it will be either recreated or updated depending on isUpdatable property\n * @param data defines the data to store\n */\n create(data) {\n this._buffer.create(data);\n }\n /**\n * Updates the underlying buffer according to the passed numeric array or Float32Array.\n * This function will create a new buffer if the current one is not updatable\n * @param data defines the data to store\n */\n update(data) {\n this._buffer.update(data);\n }\n /**\n * Updates directly the underlying WebGLBuffer according to the passed numeric array or Float32Array.\n * Returns the directly updated WebGLBuffer.\n * @param data the new data\n * @param offset the new offset\n * @param useBytes set to true if the offset is in bytes\n */\n updateDirectly(data, offset, useBytes = false) {\n this._buffer.updateDirectly(data, offset, undefined, useBytes);\n }\n /**\n * Disposes the VertexBuffer and the underlying WebGLBuffer.\n */\n dispose() {\n if (this._ownsBuffer) {\n this._buffer.dispose();\n }\n }\n /**\n * Enumerates each value of this vertex buffer as numbers.\n * @param count the number of values to enumerate\n * @param callback the callback function called for each value\n */\n forEach(count, callback) {\n VertexBuffer.ForEach(this._buffer.getData(), this.byteOffset, this.byteStride, this._size, this.type, count, this.normalized, callback);\n }\n /**\n * Deduces the stride given a kind.\n * @param kind The kind string to deduce\n * @returns The deduced stride\n */\n static DeduceStride(kind) {\n switch (kind) {\n case VertexBuffer.UVKind:\n case VertexBuffer.UV2Kind:\n case VertexBuffer.UV3Kind:\n case VertexBuffer.UV4Kind:\n case VertexBuffer.UV5Kind:\n case VertexBuffer.UV6Kind:\n return 2;\n case VertexBuffer.NormalKind:\n case VertexBuffer.PositionKind:\n return 3;\n case VertexBuffer.ColorKind:\n case VertexBuffer.MatricesIndicesKind:\n case VertexBuffer.MatricesIndicesExtraKind:\n case VertexBuffer.MatricesWeightsKind:\n case VertexBuffer.MatricesWeightsExtraKind:\n case VertexBuffer.TangentKind:\n return 4;\n default:\n throw new Error(\"Invalid kind '\" + kind + \"'\");\n }\n }\n /**\n * Gets the byte length of the given type.\n * @param type the type\n * @returns the number of bytes\n */\n static GetTypeByteLength(type) {\n switch (type) {\n case VertexBuffer.BYTE:\n case VertexBuffer.UNSIGNED_BYTE:\n return 1;\n case VertexBuffer.SHORT:\n case VertexBuffer.UNSIGNED_SHORT:\n return 2;\n case VertexBuffer.INT:\n case VertexBuffer.UNSIGNED_INT:\n case VertexBuffer.FLOAT:\n return 4;\n default:\n throw new Error(`Invalid type '${type}'`);\n }\n }\n /**\n * Enumerates each value of the given parameters as numbers.\n * @param data the data to enumerate\n * @param byteOffset the byte offset of the data\n * @param byteStride the byte stride of the data\n * @param componentCount the number of components per element\n * @param componentType the type of the component\n * @param count the number of values to enumerate\n * @param normalized whether the data is normalized\n * @param callback the callback function called for each value\n */\n static ForEach(data, byteOffset, byteStride, componentCount, componentType, count, normalized, callback) {\n if (data instanceof Array) {\n let offset = byteOffset / 4;\n const stride = byteStride / 4;\n for (let index = 0; index < count; index += componentCount) {\n for (let componentIndex = 0; componentIndex < componentCount; componentIndex++) {\n callback(data[offset + componentIndex], index + componentIndex);\n }\n offset += stride;\n }\n }\n else {\n const dataView = data instanceof ArrayBuffer ? new DataView(data) : new DataView(data.buffer, data.byteOffset, data.byteLength);\n const componentByteLength = VertexBuffer.GetTypeByteLength(componentType);\n for (let index = 0; index < count; index += componentCount) {\n let componentByteOffset = byteOffset;\n for (let componentIndex = 0; componentIndex < componentCount; componentIndex++) {\n const value = VertexBuffer._GetFloatValue(dataView, componentType, componentByteOffset, normalized);\n callback(value, index + componentIndex);\n componentByteOffset += componentByteLength;\n }\n byteOffset += byteStride;\n }\n }\n }\n static _GetFloatValue(dataView, type, byteOffset, normalized) {\n switch (type) {\n case VertexBuffer.BYTE: {\n let value = dataView.getInt8(byteOffset);\n if (normalized) {\n value = Math.max(value / 127, -1);\n }\n return value;\n }\n case VertexBuffer.UNSIGNED_BYTE: {\n let value = dataView.getUint8(byteOffset);\n if (normalized) {\n value = value / 255;\n }\n return value;\n }\n case VertexBuffer.SHORT: {\n let value = dataView.getInt16(byteOffset, true);\n if (normalized) {\n value = Math.max(value / 32767, -1);\n }\n return value;\n }\n case VertexBuffer.UNSIGNED_SHORT: {\n let value = dataView.getUint16(byteOffset, true);\n if (normalized) {\n value = value / 65535;\n }\n return value;\n }\n case VertexBuffer.INT: {\n return dataView.getInt32(byteOffset, true);\n }\n case VertexBuffer.UNSIGNED_INT: {\n return dataView.getUint32(byteOffset, true);\n }\n case VertexBuffer.FLOAT: {\n return dataView.getFloat32(byteOffset, true);\n }\n default: {\n throw new Error(`Invalid component type ${type}`);\n }\n }\n }\n}\nVertexBuffer._Counter = 0;\n/**\n * The byte type.\n */\nVertexBuffer.BYTE = 5120;\n/**\n * The unsigned byte type.\n */\nVertexBuffer.UNSIGNED_BYTE = 5121;\n/**\n * The short type.\n */\nVertexBuffer.SHORT = 5122;\n/**\n * The unsigned short type.\n */\nVertexBuffer.UNSIGNED_SHORT = 5123;\n/**\n * The integer type.\n */\nVertexBuffer.INT = 5124;\n/**\n * The unsigned integer type.\n */\nVertexBuffer.UNSIGNED_INT = 5125;\n/**\n * The float type.\n */\nVertexBuffer.FLOAT = 5126;\n// Enums\n/**\n * Positions\n */\nVertexBuffer.PositionKind = \"position\";\n/**\n * Normals\n */\nVertexBuffer.NormalKind = \"normal\";\n/**\n * Tangents\n */\nVertexBuffer.TangentKind = \"tangent\";\n/**\n * Texture coordinates\n */\nVertexBuffer.UVKind = \"uv\";\n/**\n * Texture coordinates 2\n */\nVertexBuffer.UV2Kind = \"uv2\";\n/**\n * Texture coordinates 3\n */\nVertexBuffer.UV3Kind = \"uv3\";\n/**\n * Texture coordinates 4\n */\nVertexBuffer.UV4Kind = \"uv4\";\n/**\n * Texture coordinates 5\n */\nVertexBuffer.UV5Kind = \"uv5\";\n/**\n * Texture coordinates 6\n */\nVertexBuffer.UV6Kind = \"uv6\";\n/**\n * Colors\n */\nVertexBuffer.ColorKind = \"color\";\n/**\n * Instance Colors\n */\nVertexBuffer.ColorInstanceKind = \"instanceColor\";\n/**\n * Matrix indices (for bones)\n */\nVertexBuffer.MatricesIndicesKind = \"matricesIndices\";\n/**\n * Matrix weights (for bones)\n */\nVertexBuffer.MatricesWeightsKind = \"matricesWeights\";\n/**\n * Additional matrix indices (for bones)\n */\nVertexBuffer.MatricesIndicesExtraKind = \"matricesIndicesExtra\";\n/**\n * Additional matrix weights (for bones)\n */\nVertexBuffer.MatricesWeightsExtraKind = \"matricesWeightsExtra\";\n//# sourceMappingURL=buffer.js.map","import { Vector3, Vector2, TmpVectors } from \"../Maths/math.vector.js\";\nimport { VertexBuffer } from \"../Buffers/buffer.js\";\n/**\n * Information about the result of picking within a scene\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/interactions/picking_collisions\n */\nexport class PickingInfo {\n constructor() {\n /**\n * If the pick collided with an object\n */\n this.hit = false;\n /**\n * Distance away where the pick collided\n */\n this.distance = 0;\n /**\n * The location of pick collision\n */\n this.pickedPoint = null;\n /**\n * The mesh corresponding the pick collision\n */\n this.pickedMesh = null;\n /** (See getTextureCoordinates) The barycentric U coordinate that is used when calculating the texture coordinates of the collision.*/\n this.bu = 0;\n /** (See getTextureCoordinates) The barycentric V coordinate that is used when calculating the texture coordinates of the collision.*/\n this.bv = 0;\n /** The index of the face on the mesh that was picked, or the index of the Line if the picked Mesh is a LinesMesh */\n this.faceId = -1;\n /** The index of the face on the subMesh that was picked, or the index of the Line if the picked Mesh is a LinesMesh */\n this.subMeshFaceId = -1;\n /** Id of the submesh that was picked */\n this.subMeshId = 0;\n /** If a sprite was picked, this will be the sprite the pick collided with */\n this.pickedSprite = null;\n /** If we are picking a mesh with thin instance, this will give you the picked thin instance */\n this.thinInstanceIndex = -1;\n /**\n * The ray that was used to perform the picking.\n */\n this.ray = null;\n /**\n * If a mesh was used to do the picking (eg. 6dof controller) as a \"near interaction\", this will be populated.\n */\n this.originMesh = null;\n /**\n * The aim-space transform of the input used for picking, if it is an XR input source.\n */\n this.aimTransform = null;\n /**\n * The grip-space transform of the input used for picking, if it is an XR input source.\n * Some XR sources, such as input coming from head mounted displays, do not have this.\n */\n this.gripTransform = null;\n }\n /**\n * Gets the normal corresponding to the face the pick collided with\n * @param useWorldCoordinates If the resulting normal should be relative to the world (default: false)\n * @param useVerticesNormals If the vertices normals should be used to calculate the normal instead of the normal map (default: true)\n * @returns The normal corresponding to the face the pick collided with\n * @remarks Note that the returned normal will always point towards the picking ray.\n */\n getNormal(useWorldCoordinates = false, useVerticesNormals = true) {\n if (!this.pickedMesh || (useVerticesNormals && !this.pickedMesh.isVerticesDataPresent(VertexBuffer.NormalKind))) {\n return null;\n }\n let indices = this.pickedMesh.getIndices();\n if ((indices === null || indices === void 0 ? void 0 : indices.length) === 0) {\n indices = null;\n }\n let result;\n const tmp0 = TmpVectors.Vector3[0];\n const tmp1 = TmpVectors.Vector3[1];\n const tmp2 = TmpVectors.Vector3[2];\n if (useVerticesNormals) {\n const normals = this.pickedMesh.getVerticesData(VertexBuffer.NormalKind);\n let normal0 = indices\n ? Vector3.FromArrayToRef(normals, indices[this.faceId * 3] * 3, tmp0)\n : tmp0.copyFromFloats(normals[this.faceId * 3 * 3], normals[this.faceId * 3 * 3 + 1], normals[this.faceId * 3 * 3 + 2]);\n let normal1 = indices\n ? Vector3.FromArrayToRef(normals, indices[this.faceId * 3 + 1] * 3, tmp1)\n : tmp1.copyFromFloats(normals[(this.faceId * 3 + 1) * 3], normals[(this.faceId * 3 + 1) * 3 + 1], normals[(this.faceId * 3 + 1) * 3 + 2]);\n let normal2 = indices\n ? Vector3.FromArrayToRef(normals, indices[this.faceId * 3 + 2] * 3, tmp2)\n : tmp2.copyFromFloats(normals[(this.faceId * 3 + 2) * 3], normals[(this.faceId * 3 + 2) * 3 + 1], normals[(this.faceId * 3 + 2) * 3 + 2]);\n normal0 = normal0.scale(this.bu);\n normal1 = normal1.scale(this.bv);\n normal2 = normal2.scale(1.0 - this.bu - this.bv);\n result = new Vector3(normal0.x + normal1.x + normal2.x, normal0.y + normal1.y + normal2.y, normal0.z + normal1.z + normal2.z);\n }\n else {\n const positions = this.pickedMesh.getVerticesData(VertexBuffer.PositionKind);\n const vertex1 = indices\n ? Vector3.FromArrayToRef(positions, indices[this.faceId * 3] * 3, tmp0)\n : tmp0.copyFromFloats(positions[this.faceId * 3 * 3], positions[this.faceId * 3 * 3 + 1], positions[this.faceId * 3 * 3 + 2]);\n const vertex2 = indices\n ? Vector3.FromArrayToRef(positions, indices[this.faceId * 3 + 1] * 3, tmp1)\n : tmp1.copyFromFloats(positions[(this.faceId * 3 + 1) * 3], positions[(this.faceId * 3 + 1) * 3 + 1], positions[(this.faceId * 3 + 1) * 3 + 2]);\n const vertex3 = indices\n ? Vector3.FromArrayToRef(positions, indices[this.faceId * 3 + 2] * 3, tmp2)\n : tmp2.copyFromFloats(positions[(this.faceId * 3 + 2) * 3], positions[(this.faceId * 3 + 2) * 3 + 1], positions[(this.faceId * 3 + 2) * 3 + 2]);\n const p1p2 = vertex1.subtract(vertex2);\n const p3p2 = vertex3.subtract(vertex2);\n result = Vector3.Cross(p1p2, p3p2);\n }\n const transformNormalToWorld = (pickedMesh, n) => {\n let wm = pickedMesh.getWorldMatrix();\n if (pickedMesh.nonUniformScaling) {\n TmpVectors.Matrix[0].copyFrom(wm);\n wm = TmpVectors.Matrix[0];\n wm.setTranslationFromFloats(0, 0, 0);\n wm.invert();\n wm.transposeToRef(TmpVectors.Matrix[1]);\n wm = TmpVectors.Matrix[1];\n }\n Vector3.TransformNormalToRef(n, wm, n);\n };\n if (useWorldCoordinates) {\n transformNormalToWorld(this.pickedMesh, result);\n }\n if (this.ray) {\n const normalForDirectionChecking = TmpVectors.Vector3[0].copyFrom(result);\n if (!useWorldCoordinates) {\n // the normal has not been transformed to world space as part as the normal processing, so we must do it now\n transformNormalToWorld(this.pickedMesh, normalForDirectionChecking);\n }\n // Flip the normal if the picking ray is in the same direction.\n if (Vector3.Dot(normalForDirectionChecking, this.ray.direction) > 0) {\n result.negateInPlace();\n }\n }\n result.normalize();\n return result;\n }\n /**\n * Gets the texture coordinates of where the pick occurred\n * @param uvSet The UV set to use to calculate the texture coordinates (default: VertexBuffer.UVKind)\n * @returns The vector containing the coordinates of the texture\n */\n getTextureCoordinates(uvSet = VertexBuffer.UVKind) {\n if (!this.pickedMesh || !this.pickedMesh.isVerticesDataPresent(uvSet)) {\n return null;\n }\n const indices = this.pickedMesh.getIndices();\n if (!indices) {\n return null;\n }\n const uvs = this.pickedMesh.getVerticesData(uvSet);\n if (!uvs) {\n return null;\n }\n let uv0 = Vector2.FromArray(uvs, indices[this.faceId * 3] * 2);\n let uv1 = Vector2.FromArray(uvs, indices[this.faceId * 3 + 1] * 2);\n let uv2 = Vector2.FromArray(uvs, indices[this.faceId * 3 + 2] * 2);\n uv0 = uv0.scale(this.bu);\n uv1 = uv1.scale(this.bv);\n uv2 = uv2.scale(1.0 - this.bu - this.bv);\n return new Vector2(uv0.x + uv1.x + uv2.x, uv0.y + uv1.y + uv2.y);\n }\n}\n//# sourceMappingURL=pickingInfo.js.map","/**\n * ActionEvent is the event being sent when an action is triggered.\n */\nexport class ActionEvent {\n /**\n * Creates a new ActionEvent\n * @param source The mesh or sprite that triggered the action\n * @param pointerX The X mouse cursor position at the time of the event\n * @param pointerY The Y mouse cursor position at the time of the event\n * @param meshUnderPointer The mesh that is currently pointed at (can be null)\n * @param sourceEvent the original (browser) event that triggered the ActionEvent\n * @param additionalData additional data for the event\n */\n constructor(\n /** The mesh or sprite that triggered the action */\n source, \n /** The X mouse cursor position at the time of the event */\n pointerX, \n /** The Y mouse cursor position at the time of the event */\n pointerY, \n /** The mesh that is currently pointed at (can be null) */\n meshUnderPointer, \n /** the original (browser) event that triggered the ActionEvent */\n sourceEvent, \n /** additional data for the event */\n additionalData) {\n this.source = source;\n this.pointerX = pointerX;\n this.pointerY = pointerY;\n this.meshUnderPointer = meshUnderPointer;\n this.sourceEvent = sourceEvent;\n this.additionalData = additionalData;\n }\n /**\n * Helper function to auto-create an ActionEvent from a source mesh.\n * @param source The source mesh that triggered the event\n * @param evt The original (browser) event\n * @param additionalData additional data for the event\n * @returns the new ActionEvent\n */\n static CreateNew(source, evt, additionalData) {\n const scene = source.getScene();\n return new ActionEvent(source, scene.pointerX, scene.pointerY, scene.meshUnderPointer || source, evt, additionalData);\n }\n /**\n * Helper function to auto-create an ActionEvent from a source sprite\n * @param source The source sprite that triggered the event\n * @param scene Scene associated with the sprite\n * @param evt The original (browser) event\n * @param additionalData additional data for the event\n * @returns the new ActionEvent\n */\n static CreateNewFromSprite(source, scene, evt, additionalData) {\n return new ActionEvent(source, scene.pointerX, scene.pointerY, scene.meshUnderPointer, evt, additionalData);\n }\n /**\n * Helper function to auto-create an ActionEvent from a scene. If triggered by a mesh use ActionEvent.CreateNew\n * @param scene the scene where the event occurred\n * @param evt The original (browser) event\n * @returns the new ActionEvent\n */\n static CreateNewFromScene(scene, evt) {\n return new ActionEvent(null, scene.pointerX, scene.pointerY, scene.meshUnderPointer, evt);\n }\n /**\n * Helper function to auto-create an ActionEvent from a primitive\n * @param prim defines the target primitive\n * @param pointerPos defines the pointer position\n * @param evt The original (browser) event\n * @param additionalData additional data for the event\n * @returns the new ActionEvent\n */\n static CreateNewFromPrimitive(prim, pointerPos, evt, additionalData) {\n return new ActionEvent(prim, pointerPos.x, pointerPos.y, null, evt, additionalData);\n }\n}\n//# sourceMappingURL=actionEvent.js.map","import { VertexBuffer } from \"../Buffers/buffer.js\";\n\n/**\n * PostProcessManager is used to manage one or more post processes or post process pipelines\n * See https://doc.babylonjs.com/features/featuresDeepDive/postProcesses/usePostProcesses\n */\nexport class PostProcessManager {\n /**\n * Creates a new instance PostProcess\n * @param scene The scene that the post process is associated with.\n */\n constructor(scene) {\n this._vertexBuffers = {};\n this._scene = scene;\n }\n _prepareBuffers() {\n if (this._vertexBuffers[VertexBuffer.PositionKind]) {\n return;\n }\n // VBO\n const vertices = [];\n vertices.push(1, 1);\n vertices.push(-1, 1);\n vertices.push(-1, -1);\n vertices.push(1, -1);\n this._vertexBuffers[VertexBuffer.PositionKind] = new VertexBuffer(this._scene.getEngine(), vertices, VertexBuffer.PositionKind, false, false, 2);\n this._buildIndexBuffer();\n }\n _buildIndexBuffer() {\n // Indices\n const indices = [];\n indices.push(0);\n indices.push(1);\n indices.push(2);\n indices.push(0);\n indices.push(2);\n indices.push(3);\n this._indexBuffer = this._scene.getEngine().createIndexBuffer(indices);\n }\n /**\n * Rebuilds the vertex buffers of the manager.\n * @internal\n */\n _rebuild() {\n const vb = this._vertexBuffers[VertexBuffer.PositionKind];\n if (!vb) {\n return;\n }\n vb._rebuild();\n this._buildIndexBuffer();\n }\n // Methods\n /**\n * Prepares a frame to be run through a post process.\n * @param sourceTexture The input texture to the post processes. (default: null)\n * @param postProcesses An array of post processes to be run. (default: null)\n * @returns True if the post processes were able to be run.\n * @internal\n */\n _prepareFrame(sourceTexture = null, postProcesses = null) {\n const camera = this._scene.activeCamera;\n if (!camera) {\n return false;\n }\n postProcesses = postProcesses || camera._postProcesses.filter((pp) => {\n return pp != null;\n });\n if (!postProcesses || postProcesses.length === 0 || !this._scene.postProcessesEnabled) {\n return false;\n }\n postProcesses[0].activate(camera, sourceTexture, postProcesses !== null && postProcesses !== undefined);\n return true;\n }\n /**\n * Manually render a set of post processes to a texture.\n * Please note, the frame buffer won't be unbound after the call in case you have more render to do.\n * @param postProcesses An array of post processes to be run.\n * @param targetTexture The render target wrapper to render to.\n * @param forceFullscreenViewport force gl.viewport to be full screen eg. 0,0,textureWidth,textureHeight\n * @param faceIndex defines the face to render to if a cubemap is defined as the target\n * @param lodLevel defines which lod of the texture to render to\n * @param doNotBindFrambuffer If set to true, assumes that the framebuffer has been bound previously\n */\n directRender(postProcesses, targetTexture = null, forceFullscreenViewport = false, faceIndex = 0, lodLevel = 0, doNotBindFrambuffer = false) {\n var _a;\n const engine = this._scene.getEngine();\n for (let index = 0; index < postProcesses.length; index++) {\n if (index < postProcesses.length - 1) {\n postProcesses[index + 1].activate(this._scene.activeCamera, targetTexture === null || targetTexture === void 0 ? void 0 : targetTexture.texture);\n }\n else {\n if (targetTexture) {\n engine.bindFramebuffer(targetTexture, faceIndex, undefined, undefined, forceFullscreenViewport, lodLevel);\n }\n else if (!doNotBindFrambuffer) {\n engine.restoreDefaultFramebuffer();\n }\n (_a = engine._debugInsertMarker) === null || _a === void 0 ? void 0 : _a.call(engine, `post process ${postProcesses[index].name} output`);\n }\n const pp = postProcesses[index];\n const effect = pp.apply();\n if (effect) {\n pp.onBeforeRenderObservable.notifyObservers(effect);\n // VBOs\n this._prepareBuffers();\n engine.bindBuffers(this._vertexBuffers, this._indexBuffer, effect);\n // Draw order\n engine.drawElementsType(0, 0, 6);\n pp.onAfterRenderObservable.notifyObservers(effect);\n }\n }\n // Restore depth buffer\n engine.setDepthBuffer(true);\n engine.setDepthWrite(true);\n }\n /**\n * Finalize the result of the output of the postprocesses.\n * @param doNotPresent If true the result will not be displayed to the screen.\n * @param targetTexture The render target wrapper to render to.\n * @param faceIndex The index of the face to bind the target texture to.\n * @param postProcesses The array of post processes to render.\n * @param forceFullscreenViewport force gl.viewport to be full screen eg. 0,0,textureWidth,textureHeight (default: false)\n * @internal\n */\n _finalizeFrame(doNotPresent, targetTexture, faceIndex, postProcesses, forceFullscreenViewport = false) {\n var _a;\n const camera = this._scene.activeCamera;\n if (!camera) {\n return;\n }\n postProcesses = postProcesses || camera._postProcesses.filter((pp) => {\n return pp != null;\n });\n if (postProcesses.length === 0 || !this._scene.postProcessesEnabled) {\n return;\n }\n const engine = this._scene.getEngine();\n for (let index = 0, len = postProcesses.length; index < len; index++) {\n const pp = postProcesses[index];\n if (index < len - 1) {\n pp._outputTexture = postProcesses[index + 1].activate(camera, targetTexture === null || targetTexture === void 0 ? void 0 : targetTexture.texture);\n }\n else {\n if (targetTexture) {\n engine.bindFramebuffer(targetTexture, faceIndex, undefined, undefined, forceFullscreenViewport);\n pp._outputTexture = targetTexture;\n }\n else {\n engine.restoreDefaultFramebuffer();\n pp._outputTexture = null;\n }\n (_a = engine._debugInsertMarker) === null || _a === void 0 ? void 0 : _a.call(engine, `post process ${postProcesses[index].name} output`);\n }\n if (doNotPresent) {\n break;\n }\n const effect = pp.apply();\n if (effect) {\n pp.onBeforeRenderObservable.notifyObservers(effect);\n // VBOs\n this._prepareBuffers();\n engine.bindBuffers(this._vertexBuffers, this._indexBuffer, effect);\n // Draw order\n engine.drawElementsType(0, 0, 6);\n pp.onAfterRenderObservable.notifyObservers(effect);\n }\n }\n // Restore states\n engine.setDepthBuffer(true);\n engine.setDepthWrite(true);\n engine.setAlphaMode(0);\n }\n /**\n * Disposes of the post process manager.\n */\n dispose() {\n const buffer = this._vertexBuffers[VertexBuffer.PositionKind];\n if (buffer) {\n buffer.dispose();\n this._vertexBuffers[VertexBuffer.PositionKind] = null;\n }\n if (this._indexBuffer) {\n this._scene.getEngine()._releaseBuffer(this._indexBuffer);\n this._indexBuffer = null;\n }\n }\n}\n//# sourceMappingURL=postProcessManager.js.map","import { SmartArray, SmartArrayNoDuplicate } from \"../Misc/smartArray.js\";\nimport { Vector3 } from \"../Maths/math.vector.js\";\n\n/**\n * This represents the object necessary to create a rendering group.\n * This is exclusively used and created by the rendering manager.\n * To modify the behavior, you use the available helpers in your scene or meshes.\n * @internal\n */\nexport class RenderingGroup {\n /**\n * Set the opaque sort comparison function.\n * If null the sub meshes will be render in the order they were created\n */\n set opaqueSortCompareFn(value) {\n if (value) {\n this._opaqueSortCompareFn = value;\n }\n else {\n this._opaqueSortCompareFn = RenderingGroup.PainterSortCompare;\n }\n this._renderOpaque = this._renderOpaqueSorted;\n }\n /**\n * Set the alpha test sort comparison function.\n * If null the sub meshes will be render in the order they were created\n */\n set alphaTestSortCompareFn(value) {\n if (value) {\n this._alphaTestSortCompareFn = value;\n }\n else {\n this._alphaTestSortCompareFn = RenderingGroup.PainterSortCompare;\n }\n this._renderAlphaTest = this._renderAlphaTestSorted;\n }\n /**\n * Set the transparent sort comparison function.\n * If null the sub meshes will be render in the order they were created\n */\n set transparentSortCompareFn(value) {\n if (value) {\n this._transparentSortCompareFn = value;\n }\n else {\n this._transparentSortCompareFn = RenderingGroup.defaultTransparentSortCompare;\n }\n this._renderTransparent = this._renderTransparentSorted;\n }\n /**\n * Creates a new rendering group.\n * @param index The rendering group index\n * @param scene\n * @param opaqueSortCompareFn The opaque sort comparison function. If null no order is applied\n * @param alphaTestSortCompareFn The alpha test sort comparison function. If null no order is applied\n * @param transparentSortCompareFn The transparent sort comparison function. If null back to front + alpha index sort is applied\n */\n constructor(index, scene, opaqueSortCompareFn = null, alphaTestSortCompareFn = null, transparentSortCompareFn = null) {\n this.index = index;\n this._opaqueSubMeshes = new SmartArray(256);\n this._transparentSubMeshes = new SmartArray(256);\n this._alphaTestSubMeshes = new SmartArray(256);\n this._depthOnlySubMeshes = new SmartArray(256);\n this._particleSystems = new SmartArray(256);\n this._spriteManagers = new SmartArray(256);\n /** @internal */\n this._empty = true;\n /** @internal */\n this._edgesRenderers = new SmartArrayNoDuplicate(16);\n this._scene = scene;\n this.opaqueSortCompareFn = opaqueSortCompareFn;\n this.alphaTestSortCompareFn = alphaTestSortCompareFn;\n this.transparentSortCompareFn = transparentSortCompareFn;\n }\n /**\n * Render all the sub meshes contained in the group.\n * @param customRenderFunction Used to override the default render behaviour of the group.\n * @param renderSprites\n * @param renderParticles\n * @param activeMeshes\n * @returns true if rendered some submeshes.\n */\n render(customRenderFunction, renderSprites, renderParticles, activeMeshes) {\n if (customRenderFunction) {\n customRenderFunction(this._opaqueSubMeshes, this._alphaTestSubMeshes, this._transparentSubMeshes, this._depthOnlySubMeshes);\n return;\n }\n const engine = this._scene.getEngine();\n // Depth only\n if (this._depthOnlySubMeshes.length !== 0) {\n engine.setColorWrite(false);\n this._renderAlphaTest(this._depthOnlySubMeshes);\n engine.setColorWrite(true);\n }\n // Opaque\n if (this._opaqueSubMeshes.length !== 0) {\n this._renderOpaque(this._opaqueSubMeshes);\n }\n // Alpha test\n if (this._alphaTestSubMeshes.length !== 0) {\n this._renderAlphaTest(this._alphaTestSubMeshes);\n }\n const stencilState = engine.getStencilBuffer();\n engine.setStencilBuffer(false);\n // Sprites\n if (renderSprites) {\n this._renderSprites();\n }\n // Particles\n if (renderParticles) {\n this._renderParticles(activeMeshes);\n }\n if (this.onBeforeTransparentRendering) {\n this.onBeforeTransparentRendering();\n }\n // Transparent\n if (this._transparentSubMeshes.length !== 0 || this._scene.useOrderIndependentTransparency) {\n engine.setStencilBuffer(stencilState);\n if (this._scene.useOrderIndependentTransparency) {\n const excludedMeshes = this._scene.depthPeelingRenderer.render(this._transparentSubMeshes);\n if (excludedMeshes.length) {\n // Render leftover meshes that could not be processed by depth peeling\n this._renderTransparent(excludedMeshes);\n }\n }\n else {\n this._renderTransparent(this._transparentSubMeshes);\n }\n engine.setAlphaMode(0);\n }\n // Set back stencil to false in case it changes before the edge renderer.\n engine.setStencilBuffer(false);\n // Edges\n if (this._edgesRenderers.length) {\n for (let edgesRendererIndex = 0; edgesRendererIndex < this._edgesRenderers.length; edgesRendererIndex++) {\n this._edgesRenderers.data[edgesRendererIndex].render();\n }\n engine.setAlphaMode(0);\n }\n // Restore Stencil state.\n engine.setStencilBuffer(stencilState);\n }\n /**\n * Renders the opaque submeshes in the order from the opaqueSortCompareFn.\n * @param subMeshes The submeshes to render\n */\n _renderOpaqueSorted(subMeshes) {\n return RenderingGroup._RenderSorted(subMeshes, this._opaqueSortCompareFn, this._scene.activeCamera, false);\n }\n /**\n * Renders the opaque submeshes in the order from the alphatestSortCompareFn.\n * @param subMeshes The submeshes to render\n */\n _renderAlphaTestSorted(subMeshes) {\n return RenderingGroup._RenderSorted(subMeshes, this._alphaTestSortCompareFn, this._scene.activeCamera, false);\n }\n /**\n * Renders the opaque submeshes in the order from the transparentSortCompareFn.\n * @param subMeshes The submeshes to render\n */\n _renderTransparentSorted(subMeshes) {\n return RenderingGroup._RenderSorted(subMeshes, this._transparentSortCompareFn, this._scene.activeCamera, true);\n }\n /**\n * Renders the submeshes in a specified order.\n * @param subMeshes The submeshes to sort before render\n * @param sortCompareFn The comparison function use to sort\n * @param camera The camera position use to preprocess the submeshes to help sorting\n * @param transparent Specifies to activate blending if true\n */\n static _RenderSorted(subMeshes, sortCompareFn, camera, transparent) {\n let subIndex = 0;\n let subMesh;\n const cameraPosition = camera ? camera.globalPosition : RenderingGroup._ZeroVector;\n if (transparent) {\n for (; subIndex < subMeshes.length; subIndex++) {\n subMesh = subMeshes.data[subIndex];\n subMesh._alphaIndex = subMesh.getMesh().alphaIndex;\n subMesh._distanceToCamera = Vector3.Distance(subMesh.getBoundingInfo().boundingSphere.centerWorld, cameraPosition);\n }\n }\n const sortedArray = subMeshes.length === subMeshes.data.length ? subMeshes.data : subMeshes.data.slice(0, subMeshes.length);\n if (sortCompareFn) {\n sortedArray.sort(sortCompareFn);\n }\n const scene = sortedArray[0].getMesh().getScene();\n for (subIndex = 0; subIndex < sortedArray.length; subIndex++) {\n subMesh = sortedArray[subIndex];\n if (scene._activeMeshesFrozenButKeepClipping && !subMesh.isInFrustum(scene._frustumPlanes)) {\n continue;\n }\n if (transparent) {\n const material = subMesh.getMaterial();\n if (material && material.needDepthPrePass) {\n const engine = material.getScene().getEngine();\n engine.setColorWrite(false);\n engine.setAlphaMode(0);\n subMesh.render(false);\n engine.setColorWrite(true);\n }\n }\n subMesh.render(transparent);\n }\n }\n /**\n * Build in function which can be applied to ensure meshes of a special queue (opaque, alpha test, transparent)\n * are rendered back to front if in the same alpha index.\n *\n * @param a The first submesh\n * @param b The second submesh\n * @returns The result of the comparison\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n static defaultTransparentSortCompare(a, b) {\n // Alpha index first\n if (a._alphaIndex > b._alphaIndex) {\n return 1;\n }\n if (a._alphaIndex < b._alphaIndex) {\n return -1;\n }\n // Then distance to camera\n return RenderingGroup.backToFrontSortCompare(a, b);\n }\n /**\n * Build in function which can be applied to ensure meshes of a special queue (opaque, alpha test, transparent)\n * are rendered back to front.\n *\n * @param a The first submesh\n * @param b The second submesh\n * @returns The result of the comparison\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n static backToFrontSortCompare(a, b) {\n // Then distance to camera\n if (a._distanceToCamera < b._distanceToCamera) {\n return 1;\n }\n if (a._distanceToCamera > b._distanceToCamera) {\n return -1;\n }\n return 0;\n }\n /**\n * Build in function which can be applied to ensure meshes of a special queue (opaque, alpha test, transparent)\n * are rendered front to back (prevent overdraw).\n *\n * @param a The first submesh\n * @param b The second submesh\n * @returns The result of the comparison\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n static frontToBackSortCompare(a, b) {\n // Then distance to camera\n if (a._distanceToCamera < b._distanceToCamera) {\n return -1;\n }\n if (a._distanceToCamera > b._distanceToCamera) {\n return 1;\n }\n return 0;\n }\n /**\n * Build in function which can be applied to ensure meshes of a special queue (opaque, alpha test, transparent)\n * are grouped by material then geometry.\n *\n * @param a The first submesh\n * @param b The second submesh\n * @returns The result of the comparison\n */\n static PainterSortCompare(a, b) {\n const meshA = a.getMesh();\n const meshB = b.getMesh();\n if (meshA.material && meshB.material) {\n return meshA.material.uniqueId - meshB.material.uniqueId;\n }\n return meshA.uniqueId - meshB.uniqueId;\n }\n /**\n * Resets the different lists of submeshes to prepare a new frame.\n */\n prepare() {\n this._opaqueSubMeshes.reset();\n this._transparentSubMeshes.reset();\n this._alphaTestSubMeshes.reset();\n this._depthOnlySubMeshes.reset();\n this._particleSystems.reset();\n this.prepareSprites();\n this._edgesRenderers.reset();\n this._empty = true;\n }\n /**\n * Resets the different lists of sprites to prepare a new frame.\n */\n prepareSprites() {\n this._spriteManagers.reset();\n }\n dispose() {\n this._opaqueSubMeshes.dispose();\n this._transparentSubMeshes.dispose();\n this._alphaTestSubMeshes.dispose();\n this._depthOnlySubMeshes.dispose();\n this._particleSystems.dispose();\n this._spriteManagers.dispose();\n this._edgesRenderers.dispose();\n }\n /**\n * Inserts the submesh in its correct queue depending on its material.\n * @param subMesh The submesh to dispatch\n * @param [mesh] Optional reference to the submeshes's mesh. Provide if you have an exiting reference to improve performance.\n * @param [material] Optional reference to the submeshes's material. Provide if you have an exiting reference to improve performance.\n */\n dispatch(subMesh, mesh, material) {\n // Get mesh and materials if not provided\n if (mesh === undefined) {\n mesh = subMesh.getMesh();\n }\n if (material === undefined) {\n material = subMesh.getMaterial();\n }\n if (material === null || material === undefined) {\n return;\n }\n if (material.needAlphaBlendingForMesh(mesh)) {\n // Transparent\n this._transparentSubMeshes.push(subMesh);\n }\n else if (material.needAlphaTesting()) {\n // Alpha test\n if (material.needDepthPrePass) {\n this._depthOnlySubMeshes.push(subMesh);\n }\n this._alphaTestSubMeshes.push(subMesh);\n }\n else {\n if (material.needDepthPrePass) {\n this._depthOnlySubMeshes.push(subMesh);\n }\n this._opaqueSubMeshes.push(subMesh); // Opaque\n }\n mesh._renderingGroup = this;\n if (mesh._edgesRenderer && mesh._edgesRenderer.isEnabled) {\n this._edgesRenderers.pushNoDuplicate(mesh._edgesRenderer);\n }\n this._empty = false;\n }\n dispatchSprites(spriteManager) {\n this._spriteManagers.push(spriteManager);\n this._empty = false;\n }\n dispatchParticles(particleSystem) {\n this._particleSystems.push(particleSystem);\n this._empty = false;\n }\n _renderParticles(activeMeshes) {\n if (this._particleSystems.length === 0) {\n return;\n }\n // Particles\n const activeCamera = this._scene.activeCamera;\n this._scene.onBeforeParticlesRenderingObservable.notifyObservers(this._scene);\n for (let particleIndex = 0; particleIndex < this._particleSystems.length; particleIndex++) {\n const particleSystem = this._particleSystems.data[particleIndex];\n if ((activeCamera && activeCamera.layerMask & particleSystem.layerMask) === 0) {\n continue;\n }\n const emitter = particleSystem.emitter;\n if (!emitter.position || !activeMeshes || activeMeshes.indexOf(emitter) !== -1) {\n this._scene._activeParticles.addCount(particleSystem.render(), false);\n }\n }\n this._scene.onAfterParticlesRenderingObservable.notifyObservers(this._scene);\n }\n _renderSprites() {\n if (!this._scene.spritesEnabled || this._spriteManagers.length === 0) {\n return;\n }\n // Sprites\n const activeCamera = this._scene.activeCamera;\n this._scene.onBeforeSpritesRenderingObservable.notifyObservers(this._scene);\n for (let id = 0; id < this._spriteManagers.length; id++) {\n const spriteManager = this._spriteManagers.data[id];\n if ((activeCamera && activeCamera.layerMask & spriteManager.layerMask) !== 0) {\n spriteManager.render();\n }\n }\n this._scene.onAfterSpritesRenderingObservable.notifyObservers(this._scene);\n }\n}\nRenderingGroup._ZeroVector = Vector3.Zero();\n//# sourceMappingURL=renderingGroup.js.map","import { RenderingGroup } from \"./renderingGroup.js\";\n/**\n * This class is used by the onRenderingGroupObservable\n */\nexport class RenderingGroupInfo {\n}\n/**\n * This is the manager responsible of all the rendering for meshes sprites and particles.\n * It is enable to manage the different groups as well as the different necessary sort functions.\n * This should not be used directly aside of the few static configurations\n */\nexport class RenderingManager {\n /**\n * Gets or sets a boolean indicating that the manager will not reset between frames.\n * This means that if a mesh becomes invisible or transparent it will not be visible until this boolean is set to false again.\n * By default, the rendering manager will dispatch all active meshes per frame (moving them to the transparent, opaque or alpha testing lists).\n * By turning this property on, you will accelerate the rendering by keeping all these lists unchanged between frames.\n */\n get maintainStateBetweenFrames() {\n return this._maintainStateBetweenFrames;\n }\n set maintainStateBetweenFrames(value) {\n if (value === this._maintainStateBetweenFrames) {\n return;\n }\n this._maintainStateBetweenFrames = value;\n // Restore wasDispatched flags when switching to maintainStateBetweenFrames to false\n if (!this._maintainStateBetweenFrames) {\n for (const mesh of this._scene.meshes) {\n if (mesh.subMeshes) {\n for (const subMesh of mesh.subMeshes) {\n subMesh._wasDispatched = false;\n }\n }\n }\n if (this._scene.spriteManagers) {\n for (const spriteManager of this._scene.spriteManagers) {\n spriteManager._wasDispatched = false;\n }\n }\n for (const particleSystem of this._scene.particleSystems) {\n particleSystem._wasDispatched = false;\n }\n }\n }\n /**\n * Instantiates a new rendering group for a particular scene\n * @param scene Defines the scene the groups belongs to\n */\n constructor(scene) {\n /**\n * @internal\n */\n this._useSceneAutoClearSetup = false;\n this._renderingGroups = new Array();\n this._autoClearDepthStencil = {};\n this._customOpaqueSortCompareFn = {};\n this._customAlphaTestSortCompareFn = {};\n this._customTransparentSortCompareFn = {};\n this._renderingGroupInfo = new RenderingGroupInfo();\n this._maintainStateBetweenFrames = false;\n this._scene = scene;\n for (let i = RenderingManager.MIN_RENDERINGGROUPS; i < RenderingManager.MAX_RENDERINGGROUPS; i++) {\n this._autoClearDepthStencil[i] = { autoClear: true, depth: true, stencil: true };\n }\n }\n /**\n * Gets the rendering group with the specified id.\n */\n getRenderingGroup(id) {\n const renderingGroupId = id || 0;\n this._prepareRenderingGroup(renderingGroupId);\n return this._renderingGroups[renderingGroupId];\n }\n _clearDepthStencilBuffer(depth = true, stencil = true) {\n if (this._depthStencilBufferAlreadyCleaned) {\n return;\n }\n this._scene.getEngine().clear(null, false, depth, stencil);\n this._depthStencilBufferAlreadyCleaned = true;\n }\n /**\n * Renders the entire managed groups. This is used by the scene or the different render targets.\n * @internal\n */\n render(customRenderFunction, activeMeshes, renderParticles, renderSprites) {\n // Update the observable context (not null as it only goes away on dispose)\n const info = this._renderingGroupInfo;\n info.scene = this._scene;\n info.camera = this._scene.activeCamera;\n // Dispatch sprites\n if (this._scene.spriteManagers && renderSprites) {\n for (let index = 0; index < this._scene.spriteManagers.length; index++) {\n const manager = this._scene.spriteManagers[index];\n this.dispatchSprites(manager);\n }\n }\n // Render\n for (let index = RenderingManager.MIN_RENDERINGGROUPS; index < RenderingManager.MAX_RENDERINGGROUPS; index++) {\n this._depthStencilBufferAlreadyCleaned = index === RenderingManager.MIN_RENDERINGGROUPS;\n const renderingGroup = this._renderingGroups[index];\n if (!renderingGroup || renderingGroup._empty) {\n continue;\n }\n const renderingGroupMask = Math.pow(2, index);\n info.renderingGroupId = index;\n // Before Observable\n this._scene.onBeforeRenderingGroupObservable.notifyObservers(info, renderingGroupMask);\n // Clear depth/stencil if needed\n if (RenderingManager.AUTOCLEAR) {\n const autoClear = this._useSceneAutoClearSetup ? this._scene.getAutoClearDepthStencilSetup(index) : this._autoClearDepthStencil[index];\n if (autoClear && autoClear.autoClear) {\n this._clearDepthStencilBuffer(autoClear.depth, autoClear.stencil);\n }\n }\n // Render\n for (const step of this._scene._beforeRenderingGroupDrawStage) {\n step.action(index);\n }\n renderingGroup.render(customRenderFunction, renderSprites, renderParticles, activeMeshes);\n for (const step of this._scene._afterRenderingGroupDrawStage) {\n step.action(index);\n }\n // After Observable\n this._scene.onAfterRenderingGroupObservable.notifyObservers(info, renderingGroupMask);\n }\n }\n /**\n * Resets the different information of the group to prepare a new frame\n * @internal\n */\n reset() {\n if (this.maintainStateBetweenFrames) {\n return;\n }\n for (let index = RenderingManager.MIN_RENDERINGGROUPS; index < RenderingManager.MAX_RENDERINGGROUPS; index++) {\n const renderingGroup = this._renderingGroups[index];\n if (renderingGroup) {\n renderingGroup.prepare();\n }\n }\n }\n /**\n * Resets the sprites information of the group to prepare a new frame\n * @internal\n */\n resetSprites() {\n if (this.maintainStateBetweenFrames) {\n return;\n }\n for (let index = RenderingManager.MIN_RENDERINGGROUPS; index < RenderingManager.MAX_RENDERINGGROUPS; index++) {\n const renderingGroup = this._renderingGroups[index];\n if (renderingGroup) {\n renderingGroup.prepareSprites();\n }\n }\n }\n /**\n * Dispose and release the group and its associated resources.\n * @internal\n */\n dispose() {\n this.freeRenderingGroups();\n this._renderingGroups.length = 0;\n this._renderingGroupInfo = null;\n }\n /**\n * Clear the info related to rendering groups preventing retention points during dispose.\n */\n freeRenderingGroups() {\n for (let index = RenderingManager.MIN_RENDERINGGROUPS; index < RenderingManager.MAX_RENDERINGGROUPS; index++) {\n const renderingGroup = this._renderingGroups[index];\n if (renderingGroup) {\n renderingGroup.dispose();\n }\n }\n }\n _prepareRenderingGroup(renderingGroupId) {\n if (this._renderingGroups[renderingGroupId] === undefined) {\n this._renderingGroups[renderingGroupId] = new RenderingGroup(renderingGroupId, this._scene, this._customOpaqueSortCompareFn[renderingGroupId], this._customAlphaTestSortCompareFn[renderingGroupId], this._customTransparentSortCompareFn[renderingGroupId]);\n }\n }\n /**\n * Add a sprite manager to the rendering manager in order to render it this frame.\n * @param spriteManager Define the sprite manager to render\n */\n dispatchSprites(spriteManager) {\n if (this.maintainStateBetweenFrames && spriteManager._wasDispatched) {\n return;\n }\n spriteManager._wasDispatched = true;\n this.getRenderingGroup(spriteManager.renderingGroupId).dispatchSprites(spriteManager);\n }\n /**\n * Add a particle system to the rendering manager in order to render it this frame.\n * @param particleSystem Define the particle system to render\n */\n dispatchParticles(particleSystem) {\n if (this.maintainStateBetweenFrames && particleSystem._wasDispatched) {\n return;\n }\n particleSystem._wasDispatched = true;\n this.getRenderingGroup(particleSystem.renderingGroupId).dispatchParticles(particleSystem);\n }\n /**\n * Add a submesh to the manager in order to render it this frame\n * @param subMesh The submesh to dispatch\n * @param mesh Optional reference to the submeshes's mesh. Provide if you have an exiting reference to improve performance.\n * @param material Optional reference to the submeshes's material. Provide if you have an exiting reference to improve performance.\n */\n dispatch(subMesh, mesh, material) {\n if (mesh === undefined) {\n mesh = subMesh.getMesh();\n }\n if (this.maintainStateBetweenFrames && subMesh._wasDispatched) {\n return;\n }\n subMesh._wasDispatched = true;\n this.getRenderingGroup(mesh.renderingGroupId).dispatch(subMesh, mesh, material);\n }\n /**\n * Overrides the default sort function applied in the rendering group to prepare the meshes.\n * This allowed control for front to back rendering or reversely depending of the special needs.\n *\n * @param renderingGroupId The rendering group id corresponding to its index\n * @param opaqueSortCompareFn The opaque queue comparison function use to sort.\n * @param alphaTestSortCompareFn The alpha test queue comparison function use to sort.\n * @param transparentSortCompareFn The transparent queue comparison function use to sort.\n */\n setRenderingOrder(renderingGroupId, opaqueSortCompareFn = null, alphaTestSortCompareFn = null, transparentSortCompareFn = null) {\n this._customOpaqueSortCompareFn[renderingGroupId] = opaqueSortCompareFn;\n this._customAlphaTestSortCompareFn[renderingGroupId] = alphaTestSortCompareFn;\n this._customTransparentSortCompareFn[renderingGroupId] = transparentSortCompareFn;\n if (this._renderingGroups[renderingGroupId]) {\n const group = this._renderingGroups[renderingGroupId];\n group.opaqueSortCompareFn = this._customOpaqueSortCompareFn[renderingGroupId];\n group.alphaTestSortCompareFn = this._customAlphaTestSortCompareFn[renderingGroupId];\n group.transparentSortCompareFn = this._customTransparentSortCompareFn[renderingGroupId];\n }\n }\n /**\n * Specifies whether or not the stencil and depth buffer are cleared between two rendering groups.\n *\n * @param renderingGroupId The rendering group id corresponding to its index\n * @param autoClearDepthStencil Automatically clears depth and stencil between groups if true.\n * @param depth Automatically clears depth between groups if true and autoClear is true.\n * @param stencil Automatically clears stencil between groups if true and autoClear is true.\n */\n setRenderingAutoClearDepthStencil(renderingGroupId, autoClearDepthStencil, depth = true, stencil = true) {\n this._autoClearDepthStencil[renderingGroupId] = {\n autoClear: autoClearDepthStencil,\n depth: depth,\n stencil: stencil,\n };\n }\n /**\n * Gets the current auto clear configuration for one rendering group of the rendering\n * manager.\n * @param index the rendering group index to get the information for\n * @returns The auto clear setup for the requested rendering group\n */\n getAutoClearDepthStencilSetup(index) {\n return this._autoClearDepthStencil[index];\n }\n}\n/**\n * The max id used for rendering groups (not included)\n */\nRenderingManager.MAX_RENDERINGGROUPS = 4;\n/**\n * The min id used for rendering groups (included)\n */\nRenderingManager.MIN_RENDERINGGROUPS = 0;\n/**\n * Used to globally prevent autoclearing scenes.\n */\nRenderingManager.AUTOCLEAR = true;\n//# sourceMappingURL=renderingManager.js.map","/**\n * Groups all the scene component constants in one place to ease maintenance.\n * @internal\n */\nexport class SceneComponentConstants {\n}\nSceneComponentConstants.NAME_EFFECTLAYER = \"EffectLayer\";\nSceneComponentConstants.NAME_LAYER = \"Layer\";\nSceneComponentConstants.NAME_LENSFLARESYSTEM = \"LensFlareSystem\";\nSceneComponentConstants.NAME_BOUNDINGBOXRENDERER = \"BoundingBoxRenderer\";\nSceneComponentConstants.NAME_PARTICLESYSTEM = \"ParticleSystem\";\nSceneComponentConstants.NAME_GAMEPAD = \"Gamepad\";\nSceneComponentConstants.NAME_SIMPLIFICATIONQUEUE = \"SimplificationQueue\";\nSceneComponentConstants.NAME_GEOMETRYBUFFERRENDERER = \"GeometryBufferRenderer\";\nSceneComponentConstants.NAME_PREPASSRENDERER = \"PrePassRenderer\";\nSceneComponentConstants.NAME_DEPTHRENDERER = \"DepthRenderer\";\nSceneComponentConstants.NAME_DEPTHPEELINGRENDERER = \"DepthPeelingRenderer\";\nSceneComponentConstants.NAME_POSTPROCESSRENDERPIPELINEMANAGER = \"PostProcessRenderPipelineManager\";\nSceneComponentConstants.NAME_SPRITE = \"Sprite\";\nSceneComponentConstants.NAME_SUBSURFACE = \"SubSurface\";\nSceneComponentConstants.NAME_OUTLINERENDERER = \"Outline\";\nSceneComponentConstants.NAME_PROCEDURALTEXTURE = \"ProceduralTexture\";\nSceneComponentConstants.NAME_SHADOWGENERATOR = \"ShadowGenerator\";\nSceneComponentConstants.NAME_OCTREE = \"Octree\";\nSceneComponentConstants.NAME_PHYSICSENGINE = \"PhysicsEngine\";\nSceneComponentConstants.NAME_AUDIO = \"Audio\";\nSceneComponentConstants.NAME_FLUIDRENDERER = \"FluidRenderer\";\nSceneComponentConstants.STEP_ISREADYFORMESH_EFFECTLAYER = 0;\nSceneComponentConstants.STEP_BEFOREEVALUATEACTIVEMESH_BOUNDINGBOXRENDERER = 0;\nSceneComponentConstants.STEP_EVALUATESUBMESH_BOUNDINGBOXRENDERER = 0;\nSceneComponentConstants.STEP_PREACTIVEMESH_BOUNDINGBOXRENDERER = 0;\nSceneComponentConstants.STEP_CAMERADRAWRENDERTARGET_EFFECTLAYER = 1;\nSceneComponentConstants.STEP_BEFORECAMERADRAW_PREPASS = 0;\nSceneComponentConstants.STEP_BEFORECAMERADRAW_EFFECTLAYER = 1;\nSceneComponentConstants.STEP_BEFORECAMERADRAW_LAYER = 2;\nSceneComponentConstants.STEP_BEFORERENDERTARGETDRAW_PREPASS = 0;\nSceneComponentConstants.STEP_BEFORERENDERTARGETDRAW_LAYER = 1;\nSceneComponentConstants.STEP_BEFORERENDERINGMESH_PREPASS = 0;\nSceneComponentConstants.STEP_BEFORERENDERINGMESH_OUTLINE = 1;\nSceneComponentConstants.STEP_AFTERRENDERINGMESH_PREPASS = 0;\nSceneComponentConstants.STEP_AFTERRENDERINGMESH_OUTLINE = 1;\nSceneComponentConstants.STEP_AFTERRENDERINGGROUPDRAW_EFFECTLAYER_DRAW = 0;\nSceneComponentConstants.STEP_AFTERRENDERINGGROUPDRAW_BOUNDINGBOXRENDERER = 1;\nSceneComponentConstants.STEP_BEFORECAMERAUPDATE_SIMPLIFICATIONQUEUE = 0;\nSceneComponentConstants.STEP_BEFORECAMERAUPDATE_GAMEPAD = 1;\nSceneComponentConstants.STEP_BEFORECLEAR_PROCEDURALTEXTURE = 0;\nSceneComponentConstants.STEP_BEFORECLEAR_PREPASS = 1;\nSceneComponentConstants.STEP_BEFORERENDERTARGETCLEAR_PREPASS = 0;\nSceneComponentConstants.STEP_AFTERRENDERTARGETDRAW_PREPASS = 0;\nSceneComponentConstants.STEP_AFTERRENDERTARGETDRAW_LAYER = 1;\nSceneComponentConstants.STEP_AFTERCAMERADRAW_PREPASS = 0;\nSceneComponentConstants.STEP_AFTERCAMERADRAW_EFFECTLAYER = 1;\nSceneComponentConstants.STEP_AFTERCAMERADRAW_LENSFLARESYSTEM = 2;\nSceneComponentConstants.STEP_AFTERCAMERADRAW_EFFECTLAYER_DRAW = 3;\nSceneComponentConstants.STEP_AFTERCAMERADRAW_LAYER = 4;\nSceneComponentConstants.STEP_AFTERCAMERADRAW_FLUIDRENDERER = 5;\nSceneComponentConstants.STEP_AFTERCAMERAPOSTPROCESS_LAYER = 0;\nSceneComponentConstants.STEP_AFTERRENDERTARGETPOSTPROCESS_LAYER = 0;\nSceneComponentConstants.STEP_AFTERRENDER_AUDIO = 0;\nSceneComponentConstants.STEP_GATHERRENDERTARGETS_DEPTHRENDERER = 0;\nSceneComponentConstants.STEP_GATHERRENDERTARGETS_GEOMETRYBUFFERRENDERER = 1;\nSceneComponentConstants.STEP_GATHERRENDERTARGETS_SHADOWGENERATOR = 2;\nSceneComponentConstants.STEP_GATHERRENDERTARGETS_POSTPROCESSRENDERPIPELINEMANAGER = 3;\nSceneComponentConstants.STEP_GATHERACTIVECAMERARENDERTARGETS_DEPTHRENDERER = 0;\nSceneComponentConstants.STEP_GATHERACTIVECAMERARENDERTARGETS_FLUIDRENDERER = 1;\nSceneComponentConstants.STEP_POINTERMOVE_SPRITE = 0;\nSceneComponentConstants.STEP_POINTERDOWN_SPRITE = 0;\nSceneComponentConstants.STEP_POINTERUP_SPRITE = 0;\n/**\n * Representation of a stage in the scene (Basically a list of ordered steps)\n * @internal\n */\nexport class Stage extends Array {\n /**\n * Hide ctor from the rest of the world.\n * @param items The items to add.\n */\n constructor(items) {\n super(...items);\n }\n /**\n * Creates a new Stage.\n * @returns A new instance of a Stage\n */\n static Create() {\n return Object.create(Stage.prototype);\n }\n /**\n * Registers a step in an ordered way in the targeted stage.\n * @param index Defines the position to register the step in\n * @param component Defines the component attached to the step\n * @param action Defines the action to launch during the step\n */\n registerStep(index, component, action) {\n let i = 0;\n let maxIndex = Number.MAX_VALUE;\n for (; i < this.length; i++) {\n const step = this[i];\n maxIndex = step.index;\n if (index < maxIndex) {\n break;\n }\n }\n this.splice(i, 0, { index, component, action: action.bind(component) });\n }\n /**\n * Clears all the steps from the stage.\n */\n clear() {\n this.length = 0;\n }\n}\n//# sourceMappingURL=sceneComponent.js.map","import { Vector2 } from \"../Maths/math.vector.js\";\n/**\n * Gather the list of pointer event types as constants.\n */\nexport class PointerEventTypes {\n}\n/**\n * The pointerdown event is fired when a pointer becomes active. For mouse, it is fired when the device transitions from no buttons depressed to at least one button depressed. For touch, it is fired when physical contact is made with the digitizer. For pen, it is fired when the stylus makes physical contact with the digitizer.\n */\nPointerEventTypes.POINTERDOWN = 0x01;\n/**\n * The pointerup event is fired when a pointer is no longer active.\n */\nPointerEventTypes.POINTERUP = 0x02;\n/**\n * The pointermove event is fired when a pointer changes coordinates.\n */\nPointerEventTypes.POINTERMOVE = 0x04;\n/**\n * The pointerwheel event is fired when a mouse wheel has been rotated.\n */\nPointerEventTypes.POINTERWHEEL = 0x08;\n/**\n * The pointerpick event is fired when a mesh or sprite has been picked by the pointer.\n */\nPointerEventTypes.POINTERPICK = 0x10;\n/**\n * The pointertap event is fired when a the object has been touched and released without drag.\n */\nPointerEventTypes.POINTERTAP = 0x20;\n/**\n * The pointerdoubletap event is fired when a the object has been touched and released twice without drag.\n */\nPointerEventTypes.POINTERDOUBLETAP = 0x40;\n/**\n * Base class of pointer info types.\n */\nexport class PointerInfoBase {\n /**\n * Instantiates the base class of pointers info.\n * @param type Defines the type of event (PointerEventTypes)\n * @param event Defines the related dom event\n */\n constructor(\n /**\n * Defines the type of event (PointerEventTypes)\n */\n type, \n /**\n * Defines the related dom event\n */\n event) {\n this.type = type;\n this.event = event;\n }\n}\n/**\n * This class is used to store pointer related info for the onPrePointerObservable event.\n * Set the skipOnPointerObservable property to true if you want the engine to stop any process after this event is triggered, even not calling onPointerObservable\n */\nexport class PointerInfoPre extends PointerInfoBase {\n /**\n * Instantiates a PointerInfoPre to store pointer related info to the onPrePointerObservable event.\n * @param type Defines the type of event (PointerEventTypes)\n * @param event Defines the related dom event\n * @param localX Defines the local x coordinates of the pointer when the event occured\n * @param localY Defines the local y coordinates of the pointer when the event occured\n */\n constructor(type, event, localX, localY) {\n super(type, event);\n /**\n * Ray from a pointer if available (eg. 6dof controller)\n */\n this.ray = null;\n /**\n * The original picking info that was used to trigger the pointer event\n */\n this.originalPickingInfo = null;\n this.skipOnPointerObservable = false;\n this.localPosition = new Vector2(localX, localY);\n }\n}\n/**\n * This type contains all the data related to a pointer event in Babylon.js.\n * The event member is an instance of PointerEvent for all types except PointerWheel and is of type MouseWheelEvent when type equals PointerWheel. The different event types can be found in the PointerEventTypes class.\n */\nexport class PointerInfo extends PointerInfoBase {\n /**\n * Defines the picking info associated with this PointerInfo object (if applicable)\n */\n get pickInfo() {\n if (!this._pickInfo) {\n this._generatePickInfo();\n }\n return this._pickInfo;\n }\n /**\n * Instantiates a PointerInfo to store pointer related info to the onPointerObservable event.\n * @param type Defines the type of event (PointerEventTypes)\n * @param event Defines the related dom event\n * @param pickInfo Defines the picking info associated to the info (if any)\n * @param inputManager Defines the InputManager to use if there is no pickInfo\n */\n constructor(type, event, pickInfo, inputManager = null) {\n super(type, event);\n this._pickInfo = pickInfo;\n this._inputManager = inputManager;\n }\n /**\n * Generates the picking info if needed\n */\n /** @internal */\n _generatePickInfo() {\n if (this._inputManager) {\n this._pickInfo = this._inputManager._pickMove(this.event);\n this._inputManager._setRayOnPointerInfo(this._pickInfo, this.event);\n this._inputManager = null;\n }\n }\n}\n//# sourceMappingURL=pointerEvents.js.map","\n/**\n * Abstract class used to decouple action Manager from scene and meshes.\n * Do not instantiate.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/events/actions\n */\nexport class AbstractActionManager {\n constructor() {\n /** Gets the cursor to use when hovering items */\n this.hoverCursor = \"\";\n /** Gets the list of actions */\n this.actions = new Array();\n /**\n * Gets or sets a boolean indicating that the manager is recursive meaning that it can trigger action from children\n */\n this.isRecursive = false;\n }\n /**\n * Does exist one action manager with at least one trigger\n **/\n static get HasTriggers() {\n for (const t in AbstractActionManager.Triggers) {\n if (Object.prototype.hasOwnProperty.call(AbstractActionManager.Triggers, t)) {\n return true;\n }\n }\n return false;\n }\n /**\n * Does exist one action manager with at least one pick trigger\n **/\n static get HasPickTriggers() {\n for (const t in AbstractActionManager.Triggers) {\n if (Object.prototype.hasOwnProperty.call(AbstractActionManager.Triggers, t)) {\n const tAsInt = parseInt(t);\n if (tAsInt >= 1 && tAsInt <= 7) {\n return true;\n }\n }\n }\n return false;\n }\n /**\n * Does exist one action manager that handles actions of a given trigger\n * @param trigger defines the trigger to be tested\n * @returns a boolean indicating whether the trigger is handled by at least one action manager\n **/\n static HasSpecificTrigger(trigger) {\n for (const t in AbstractActionManager.Triggers) {\n if (Object.prototype.hasOwnProperty.call(AbstractActionManager.Triggers, t)) {\n const tAsInt = parseInt(t);\n if (tAsInt === trigger) {\n return true;\n }\n }\n }\n return false;\n }\n}\n/** Gets the list of active triggers */\nAbstractActionManager.Triggers = {};\n//# sourceMappingURL=abstractActionManager.js.map","/**\n * Gather the list of keyboard event types as constants.\n */\nexport class KeyboardEventTypes {\n}\n/**\n * The keydown event is fired when a key becomes active (pressed).\n */\nKeyboardEventTypes.KEYDOWN = 0x01;\n/**\n * The keyup event is fired when a key has been released.\n */\nKeyboardEventTypes.KEYUP = 0x02;\n/**\n * This class is used to store keyboard related info for the onKeyboardObservable event.\n */\nexport class KeyboardInfo {\n /**\n * Instantiates a new keyboard info.\n * This class is used to store keyboard related info for the onKeyboardObservable event.\n * @param type Defines the type of event (KeyboardEventTypes)\n * @param event Defines the related dom event\n */\n constructor(\n /**\n * Defines the type of event (KeyboardEventTypes)\n */\n type, \n /**\n * Defines the related dom event\n */\n event) {\n this.type = type;\n this.event = event;\n }\n}\n/**\n * This class is used to store keyboard related info for the onPreKeyboardObservable event.\n * Set the skipOnKeyboardObservable property to true if you want the engine to stop any process after this event is triggered, even not calling onKeyboardObservable\n */\nexport class KeyboardInfoPre extends KeyboardInfo {\n /**\n * Defines whether the engine should skip the next onKeyboardObservable associated to this pre.\n * @deprecated use skipOnKeyboardObservable property instead\n */\n get skipOnPointerObservable() {\n return this.skipOnKeyboardObservable;\n }\n set skipOnPointerObservable(value) {\n this.skipOnKeyboardObservable = value;\n }\n /**\n * Instantiates a new keyboard pre info.\n * This class is used to store keyboard related info for the onPreKeyboardObservable event.\n * @param type Defines the type of event (KeyboardEventTypes)\n * @param event Defines the related dom event\n */\n constructor(\n /**\n * Defines the type of event (KeyboardEventTypes)\n */\n type, \n /**\n * Defines the related dom event\n */\n event) {\n super(type, event);\n this.type = type;\n this.event = event;\n this.skipOnKeyboardObservable = false;\n }\n}\n//# sourceMappingURL=keyboardEvents.js.map","/**\n * Enum for Device Types\n */\nexport var DeviceType;\n(function (DeviceType) {\n /** Generic */\n DeviceType[DeviceType[\"Generic\"] = 0] = \"Generic\";\n /** Keyboard */\n DeviceType[DeviceType[\"Keyboard\"] = 1] = \"Keyboard\";\n /** Mouse */\n DeviceType[DeviceType[\"Mouse\"] = 2] = \"Mouse\";\n /** Touch Pointers */\n DeviceType[DeviceType[\"Touch\"] = 3] = \"Touch\";\n /** PS4 Dual Shock */\n DeviceType[DeviceType[\"DualShock\"] = 4] = \"DualShock\";\n /** Xbox */\n DeviceType[DeviceType[\"Xbox\"] = 5] = \"Xbox\";\n /** Switch Controller */\n DeviceType[DeviceType[\"Switch\"] = 6] = \"Switch\";\n /** PS5 DualSense */\n DeviceType[DeviceType[\"DualSense\"] = 7] = \"DualSense\";\n})(DeviceType || (DeviceType = {}));\n// Device Enums\n/**\n * Enum for All Pointers (Touch/Mouse)\n */\nexport var PointerInput;\n(function (PointerInput) {\n /** Horizontal Axis (Not used in events/observables; only in polling) */\n PointerInput[PointerInput[\"Horizontal\"] = 0] = \"Horizontal\";\n /** Vertical Axis (Not used in events/observables; only in polling) */\n PointerInput[PointerInput[\"Vertical\"] = 1] = \"Vertical\";\n /** Left Click or Touch */\n PointerInput[PointerInput[\"LeftClick\"] = 2] = \"LeftClick\";\n /** Middle Click */\n PointerInput[PointerInput[\"MiddleClick\"] = 3] = \"MiddleClick\";\n /** Right Click */\n PointerInput[PointerInput[\"RightClick\"] = 4] = \"RightClick\";\n /** Browser Back */\n PointerInput[PointerInput[\"BrowserBack\"] = 5] = \"BrowserBack\";\n /** Browser Forward */\n PointerInput[PointerInput[\"BrowserForward\"] = 6] = \"BrowserForward\";\n /** Mouse Wheel X */\n PointerInput[PointerInput[\"MouseWheelX\"] = 7] = \"MouseWheelX\";\n /** Mouse Wheel Y */\n PointerInput[PointerInput[\"MouseWheelY\"] = 8] = \"MouseWheelY\";\n /** Mouse Wheel Z */\n PointerInput[PointerInput[\"MouseWheelZ\"] = 9] = \"MouseWheelZ\";\n /** Used in events/observables to identify if x/y changes occurred */\n PointerInput[PointerInput[\"Move\"] = 12] = \"Move\";\n})(PointerInput || (PointerInput = {}));\n/** @internal */\nexport var NativePointerInput;\n(function (NativePointerInput) {\n /** Horizontal Axis */\n NativePointerInput[NativePointerInput[\"Horizontal\"] = 0] = \"Horizontal\";\n /** Vertical Axis */\n NativePointerInput[NativePointerInput[\"Vertical\"] = 1] = \"Vertical\";\n /** Left Click or Touch */\n NativePointerInput[NativePointerInput[\"LeftClick\"] = 2] = \"LeftClick\";\n /** Middle Click */\n NativePointerInput[NativePointerInput[\"MiddleClick\"] = 3] = \"MiddleClick\";\n /** Right Click */\n NativePointerInput[NativePointerInput[\"RightClick\"] = 4] = \"RightClick\";\n /** Browser Back */\n NativePointerInput[NativePointerInput[\"BrowserBack\"] = 5] = \"BrowserBack\";\n /** Browser Forward */\n NativePointerInput[NativePointerInput[\"BrowserForward\"] = 6] = \"BrowserForward\";\n /** Mouse Wheel X */\n NativePointerInput[NativePointerInput[\"MouseWheelX\"] = 7] = \"MouseWheelX\";\n /** Mouse Wheel Y */\n NativePointerInput[NativePointerInput[\"MouseWheelY\"] = 8] = \"MouseWheelY\";\n /** Mouse Wheel Z */\n NativePointerInput[NativePointerInput[\"MouseWheelZ\"] = 9] = \"MouseWheelZ\";\n /** Delta X */\n NativePointerInput[NativePointerInput[\"DeltaHorizontal\"] = 10] = \"DeltaHorizontal\";\n /** Delta Y */\n NativePointerInput[NativePointerInput[\"DeltaVertical\"] = 11] = \"DeltaVertical\";\n})(NativePointerInput || (NativePointerInput = {}));\n/**\n * Enum for Dual Shock Gamepad\n */\nexport var DualShockInput;\n(function (DualShockInput) {\n /** Cross */\n DualShockInput[DualShockInput[\"Cross\"] = 0] = \"Cross\";\n /** Circle */\n DualShockInput[DualShockInput[\"Circle\"] = 1] = \"Circle\";\n /** Square */\n DualShockInput[DualShockInput[\"Square\"] = 2] = \"Square\";\n /** Triangle */\n DualShockInput[DualShockInput[\"Triangle\"] = 3] = \"Triangle\";\n /** L1 */\n DualShockInput[DualShockInput[\"L1\"] = 4] = \"L1\";\n /** R1 */\n DualShockInput[DualShockInput[\"R1\"] = 5] = \"R1\";\n /** L2 */\n DualShockInput[DualShockInput[\"L2\"] = 6] = \"L2\";\n /** R2 */\n DualShockInput[DualShockInput[\"R2\"] = 7] = \"R2\";\n /** Share */\n DualShockInput[DualShockInput[\"Share\"] = 8] = \"Share\";\n /** Options */\n DualShockInput[DualShockInput[\"Options\"] = 9] = \"Options\";\n /** L3 */\n DualShockInput[DualShockInput[\"L3\"] = 10] = \"L3\";\n /** R3 */\n DualShockInput[DualShockInput[\"R3\"] = 11] = \"R3\";\n /** DPadUp */\n DualShockInput[DualShockInput[\"DPadUp\"] = 12] = \"DPadUp\";\n /** DPadDown */\n DualShockInput[DualShockInput[\"DPadDown\"] = 13] = \"DPadDown\";\n /** DPadLeft */\n DualShockInput[DualShockInput[\"DPadLeft\"] = 14] = \"DPadLeft\";\n /** DRight */\n DualShockInput[DualShockInput[\"DPadRight\"] = 15] = \"DPadRight\";\n /** Home */\n DualShockInput[DualShockInput[\"Home\"] = 16] = \"Home\";\n /** TouchPad */\n DualShockInput[DualShockInput[\"TouchPad\"] = 17] = \"TouchPad\";\n /** LStickXAxis */\n DualShockInput[DualShockInput[\"LStickXAxis\"] = 18] = \"LStickXAxis\";\n /** LStickYAxis */\n DualShockInput[DualShockInput[\"LStickYAxis\"] = 19] = \"LStickYAxis\";\n /** RStickXAxis */\n DualShockInput[DualShockInput[\"RStickXAxis\"] = 20] = \"RStickXAxis\";\n /** RStickYAxis */\n DualShockInput[DualShockInput[\"RStickYAxis\"] = 21] = \"RStickYAxis\";\n})(DualShockInput || (DualShockInput = {}));\n/**\n * Enum for Dual Sense Gamepad\n */\nexport var DualSenseInput;\n(function (DualSenseInput) {\n /** Cross */\n DualSenseInput[DualSenseInput[\"Cross\"] = 0] = \"Cross\";\n /** Circle */\n DualSenseInput[DualSenseInput[\"Circle\"] = 1] = \"Circle\";\n /** Square */\n DualSenseInput[DualSenseInput[\"Square\"] = 2] = \"Square\";\n /** Triangle */\n DualSenseInput[DualSenseInput[\"Triangle\"] = 3] = \"Triangle\";\n /** L1 */\n DualSenseInput[DualSenseInput[\"L1\"] = 4] = \"L1\";\n /** R1 */\n DualSenseInput[DualSenseInput[\"R1\"] = 5] = \"R1\";\n /** L2 */\n DualSenseInput[DualSenseInput[\"L2\"] = 6] = \"L2\";\n /** R2 */\n DualSenseInput[DualSenseInput[\"R2\"] = 7] = \"R2\";\n /** Create */\n DualSenseInput[DualSenseInput[\"Create\"] = 8] = \"Create\";\n /** Options */\n DualSenseInput[DualSenseInput[\"Options\"] = 9] = \"Options\";\n /** L3 */\n DualSenseInput[DualSenseInput[\"L3\"] = 10] = \"L3\";\n /** R3 */\n DualSenseInput[DualSenseInput[\"R3\"] = 11] = \"R3\";\n /** DPadUp */\n DualSenseInput[DualSenseInput[\"DPadUp\"] = 12] = \"DPadUp\";\n /** DPadDown */\n DualSenseInput[DualSenseInput[\"DPadDown\"] = 13] = \"DPadDown\";\n /** DPadLeft */\n DualSenseInput[DualSenseInput[\"DPadLeft\"] = 14] = \"DPadLeft\";\n /** DRight */\n DualSenseInput[DualSenseInput[\"DPadRight\"] = 15] = \"DPadRight\";\n /** Home */\n DualSenseInput[DualSenseInput[\"Home\"] = 16] = \"Home\";\n /** TouchPad */\n DualSenseInput[DualSenseInput[\"TouchPad\"] = 17] = \"TouchPad\";\n /** LStickXAxis */\n DualSenseInput[DualSenseInput[\"LStickXAxis\"] = 18] = \"LStickXAxis\";\n /** LStickYAxis */\n DualSenseInput[DualSenseInput[\"LStickYAxis\"] = 19] = \"LStickYAxis\";\n /** RStickXAxis */\n DualSenseInput[DualSenseInput[\"RStickXAxis\"] = 20] = \"RStickXAxis\";\n /** RStickYAxis */\n DualSenseInput[DualSenseInput[\"RStickYAxis\"] = 21] = \"RStickYAxis\";\n})(DualSenseInput || (DualSenseInput = {}));\n/**\n * Enum for Xbox Gamepad\n */\nexport var XboxInput;\n(function (XboxInput) {\n /** A */\n XboxInput[XboxInput[\"A\"] = 0] = \"A\";\n /** B */\n XboxInput[XboxInput[\"B\"] = 1] = \"B\";\n /** X */\n XboxInput[XboxInput[\"X\"] = 2] = \"X\";\n /** Y */\n XboxInput[XboxInput[\"Y\"] = 3] = \"Y\";\n /** LB */\n XboxInput[XboxInput[\"LB\"] = 4] = \"LB\";\n /** RB */\n XboxInput[XboxInput[\"RB\"] = 5] = \"RB\";\n /** LT */\n XboxInput[XboxInput[\"LT\"] = 6] = \"LT\";\n /** RT */\n XboxInput[XboxInput[\"RT\"] = 7] = \"RT\";\n /** Back */\n XboxInput[XboxInput[\"Back\"] = 8] = \"Back\";\n /** Start */\n XboxInput[XboxInput[\"Start\"] = 9] = \"Start\";\n /** LS */\n XboxInput[XboxInput[\"LS\"] = 10] = \"LS\";\n /** RS */\n XboxInput[XboxInput[\"RS\"] = 11] = \"RS\";\n /** DPadUp */\n XboxInput[XboxInput[\"DPadUp\"] = 12] = \"DPadUp\";\n /** DPadDown */\n XboxInput[XboxInput[\"DPadDown\"] = 13] = \"DPadDown\";\n /** DPadLeft */\n XboxInput[XboxInput[\"DPadLeft\"] = 14] = \"DPadLeft\";\n /** DRight */\n XboxInput[XboxInput[\"DPadRight\"] = 15] = \"DPadRight\";\n /** Home */\n XboxInput[XboxInput[\"Home\"] = 16] = \"Home\";\n /** LStickXAxis */\n XboxInput[XboxInput[\"LStickXAxis\"] = 17] = \"LStickXAxis\";\n /** LStickYAxis */\n XboxInput[XboxInput[\"LStickYAxis\"] = 18] = \"LStickYAxis\";\n /** RStickXAxis */\n XboxInput[XboxInput[\"RStickXAxis\"] = 19] = \"RStickXAxis\";\n /** RStickYAxis */\n XboxInput[XboxInput[\"RStickYAxis\"] = 20] = \"RStickYAxis\";\n})(XboxInput || (XboxInput = {}));\n/**\n * Enum for Switch (Pro/JoyCon L+R) Gamepad\n */\nexport var SwitchInput;\n(function (SwitchInput) {\n /** B */\n SwitchInput[SwitchInput[\"B\"] = 0] = \"B\";\n /** A */\n SwitchInput[SwitchInput[\"A\"] = 1] = \"A\";\n /** Y */\n SwitchInput[SwitchInput[\"Y\"] = 2] = \"Y\";\n /** X */\n SwitchInput[SwitchInput[\"X\"] = 3] = \"X\";\n /** L */\n SwitchInput[SwitchInput[\"L\"] = 4] = \"L\";\n /** R */\n SwitchInput[SwitchInput[\"R\"] = 5] = \"R\";\n /** ZL */\n SwitchInput[SwitchInput[\"ZL\"] = 6] = \"ZL\";\n /** ZR */\n SwitchInput[SwitchInput[\"ZR\"] = 7] = \"ZR\";\n /** Minus */\n SwitchInput[SwitchInput[\"Minus\"] = 8] = \"Minus\";\n /** Plus */\n SwitchInput[SwitchInput[\"Plus\"] = 9] = \"Plus\";\n /** LS */\n SwitchInput[SwitchInput[\"LS\"] = 10] = \"LS\";\n /** RS */\n SwitchInput[SwitchInput[\"RS\"] = 11] = \"RS\";\n /** DPadUp */\n SwitchInput[SwitchInput[\"DPadUp\"] = 12] = \"DPadUp\";\n /** DPadDown */\n SwitchInput[SwitchInput[\"DPadDown\"] = 13] = \"DPadDown\";\n /** DPadLeft */\n SwitchInput[SwitchInput[\"DPadLeft\"] = 14] = \"DPadLeft\";\n /** DRight */\n SwitchInput[SwitchInput[\"DPadRight\"] = 15] = \"DPadRight\";\n /** Home */\n SwitchInput[SwitchInput[\"Home\"] = 16] = \"Home\";\n /** Capture */\n SwitchInput[SwitchInput[\"Capture\"] = 17] = \"Capture\";\n /** LStickXAxis */\n SwitchInput[SwitchInput[\"LStickXAxis\"] = 18] = \"LStickXAxis\";\n /** LStickYAxis */\n SwitchInput[SwitchInput[\"LStickYAxis\"] = 19] = \"LStickYAxis\";\n /** RStickXAxis */\n SwitchInput[SwitchInput[\"RStickXAxis\"] = 20] = \"RStickXAxis\";\n /** RStickYAxis */\n SwitchInput[SwitchInput[\"RStickYAxis\"] = 21] = \"RStickYAxis\";\n})(SwitchInput || (SwitchInput = {}));\n//# sourceMappingURL=deviceEnums.js.map","/**\n * Event Types\n */\nexport var DeviceInputEventType;\n(function (DeviceInputEventType) {\n // Pointers\n /** PointerMove */\n DeviceInputEventType[DeviceInputEventType[\"PointerMove\"] = 0] = \"PointerMove\";\n /** PointerDown */\n DeviceInputEventType[DeviceInputEventType[\"PointerDown\"] = 1] = \"PointerDown\";\n /** PointerUp */\n DeviceInputEventType[DeviceInputEventType[\"PointerUp\"] = 2] = \"PointerUp\";\n})(DeviceInputEventType || (DeviceInputEventType = {}));\n/**\n * Constants used for Events\n */\nexport class EventConstants {\n}\n/**\n * Pixel delta for Wheel Events (Default)\n */\nEventConstants.DOM_DELTA_PIXEL = 0x00;\n/**\n * Line delta for Wheel Events\n */\nEventConstants.DOM_DELTA_LINE = 0x01;\n/**\n * Page delta for Wheel Events\n */\nEventConstants.DOM_DELTA_PAGE = 0x02;\n//# sourceMappingURL=deviceInputEvents.js.map","\nimport { EventConstants } from \"../Events/deviceInputEvents.js\";\nimport { DeviceType, NativePointerInput, PointerInput } from \"./InputDevices/deviceEnums.js\";\n/**\n * Class to wrap DeviceInputSystem data into an event object\n */\nexport class DeviceEventFactory {\n /**\n * Create device input events based on provided type and slot\n *\n * @param deviceType Type of device\n * @param deviceSlot \"Slot\" or index that device is referenced in\n * @param inputIndex Id of input to be checked\n * @param currentState Current value for given input\n * @param deviceInputSystem Reference to DeviceInputSystem\n * @param elementToAttachTo HTMLElement to reference as target for inputs\n * @returns IUIEvent object\n */\n static CreateDeviceEvent(deviceType, deviceSlot, inputIndex, currentState, deviceInputSystem, elementToAttachTo, pointerId) {\n switch (deviceType) {\n case DeviceType.Keyboard:\n return this._CreateKeyboardEvent(inputIndex, currentState, deviceInputSystem, elementToAttachTo);\n case DeviceType.Mouse:\n if (inputIndex === PointerInput.MouseWheelX || inputIndex === PointerInput.MouseWheelY || inputIndex === PointerInput.MouseWheelZ) {\n return this._CreateWheelEvent(deviceType, deviceSlot, inputIndex, currentState, deviceInputSystem, elementToAttachTo);\n }\n // eslint-disable-next-line no-fallthrough\n case DeviceType.Touch:\n return this._CreatePointerEvent(deviceType, deviceSlot, inputIndex, currentState, deviceInputSystem, elementToAttachTo, pointerId);\n default:\n throw `Unable to generate event for device ${DeviceType[deviceType]}`;\n }\n }\n /**\n * Creates pointer event\n *\n * @param deviceType Type of device\n * @param deviceSlot \"Slot\" or index that device is referenced in\n * @param inputIndex Id of input to be checked\n * @param currentState Current value for given input\n * @param deviceInputSystem Reference to DeviceInputSystem\n * @param elementToAttachTo HTMLElement to reference as target for inputs\n * @returns IUIEvent object (Pointer)\n */\n static _CreatePointerEvent(deviceType, deviceSlot, inputIndex, currentState, deviceInputSystem, elementToAttachTo, pointerId) {\n const evt = this._CreateMouseEvent(deviceType, deviceSlot, inputIndex, currentState, deviceInputSystem, elementToAttachTo);\n if (deviceType === DeviceType.Mouse) {\n evt.deviceType = DeviceType.Mouse;\n evt.pointerId = 1;\n evt.pointerType = \"mouse\";\n }\n else {\n evt.deviceType = DeviceType.Touch;\n evt.pointerId = pointerId !== null && pointerId !== void 0 ? pointerId : deviceSlot;\n evt.pointerType = \"touch\";\n }\n let buttons = 0;\n // Populate buttons property with current state of all mouse buttons\n // Uses values found on: https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons\n buttons += deviceInputSystem.pollInput(deviceType, deviceSlot, PointerInput.LeftClick);\n buttons += deviceInputSystem.pollInput(deviceType, deviceSlot, PointerInput.RightClick) * 2;\n buttons += deviceInputSystem.pollInput(deviceType, deviceSlot, PointerInput.MiddleClick) * 4;\n evt.buttons = buttons;\n if (inputIndex === PointerInput.Move) {\n evt.type = \"pointermove\";\n }\n else if (inputIndex >= PointerInput.LeftClick && inputIndex <= PointerInput.RightClick) {\n evt.type = currentState === 1 ? \"pointerdown\" : \"pointerup\";\n evt.button = inputIndex - 2;\n }\n return evt;\n }\n /**\n * Create Mouse Wheel Event\n * @param deviceType Type of device\n * @param deviceSlot \"Slot\" or index that device is referenced in\n * @param inputIndex Id of input to be checked\n * @param currentState Current value for given input\n * @param deviceInputSystem Reference to DeviceInputSystem\n * @param elementToAttachTo HTMLElement to reference as target for inputs\n * @returns IUIEvent object (Wheel)\n */\n static _CreateWheelEvent(deviceType, deviceSlot, inputIndex, currentState, deviceInputSystem, elementToAttachTo) {\n const evt = this._CreateMouseEvent(deviceType, deviceSlot, inputIndex, currentState, deviceInputSystem, elementToAttachTo);\n // While WheelEvents don't generally have a pointerId, we used to add one in the InputManager\n // This line has been added to make the InputManager more platform-agnostic\n // Similar code exists in the WebDeviceInputSystem to handle browser created events\n evt.pointerId = 1;\n evt.type = \"wheel\";\n evt.deltaMode = EventConstants.DOM_DELTA_PIXEL;\n evt.deltaX = 0;\n evt.deltaY = 0;\n evt.deltaZ = 0;\n switch (inputIndex) {\n case PointerInput.MouseWheelX:\n evt.deltaX = currentState;\n break;\n case PointerInput.MouseWheelY:\n evt.deltaY = currentState;\n break;\n case PointerInput.MouseWheelZ:\n evt.deltaZ = currentState;\n break;\n }\n return evt;\n }\n /**\n * Create Mouse Event\n * @param deviceType Type of device\n * @param deviceSlot \"Slot\" or index that device is referenced in\n * @param inputIndex Id of input to be checked\n * @param currentState Current value for given input\n * @param deviceInputSystem Reference to DeviceInputSystem\n * @param elementToAttachTo HTMLElement to reference as target for inputs\n * @returns IUIEvent object (Mouse)\n */\n static _CreateMouseEvent(deviceType, deviceSlot, inputIndex, currentState, deviceInputSystem, elementToAttachTo) {\n const evt = this._CreateEvent(elementToAttachTo);\n const pointerX = deviceInputSystem.pollInput(deviceType, deviceSlot, PointerInput.Horizontal);\n const pointerY = deviceInputSystem.pollInput(deviceType, deviceSlot, PointerInput.Vertical);\n // Handle offsets/deltas based on existence of HTMLElement\n if (elementToAttachTo) {\n evt.movementX = 0;\n evt.movementY = 0;\n evt.offsetX = evt.movementX - elementToAttachTo.getBoundingClientRect().x;\n evt.offsetY = evt.movementY - elementToAttachTo.getBoundingClientRect().y;\n }\n else {\n evt.movementX = deviceInputSystem.pollInput(deviceType, deviceSlot, NativePointerInput.DeltaHorizontal); // DeltaHorizontal\n evt.movementY = deviceInputSystem.pollInput(deviceType, deviceSlot, NativePointerInput.DeltaVertical); // DeltaVertical\n evt.offsetX = 0;\n evt.offsetY = 0;\n }\n this._CheckNonCharacterKeys(evt, deviceInputSystem);\n evt.clientX = pointerX;\n evt.clientY = pointerY;\n evt.x = pointerX;\n evt.y = pointerY;\n evt.deviceType = deviceType;\n evt.deviceSlot = deviceSlot;\n evt.inputIndex = inputIndex;\n return evt;\n }\n /**\n * Create Keyboard Event\n * @param inputIndex Id of input to be checked\n * @param currentState Current value for given input\n * @param deviceInputSystem Reference to DeviceInputSystem\n * @param elementToAttachTo HTMLElement to reference as target for inputs\n * @returns IEvent object (Keyboard)\n */\n static _CreateKeyboardEvent(inputIndex, currentState, deviceInputSystem, elementToAttachTo) {\n const evt = this._CreateEvent(elementToAttachTo);\n this._CheckNonCharacterKeys(evt, deviceInputSystem);\n evt.deviceType = DeviceType.Keyboard;\n evt.deviceSlot = 0;\n evt.inputIndex = inputIndex;\n evt.type = currentState === 1 ? \"keydown\" : \"keyup\";\n evt.key = String.fromCharCode(inputIndex);\n evt.keyCode = inputIndex;\n return evt;\n }\n /**\n * Add parameters for non-character keys (Ctrl, Alt, Meta, Shift)\n * @param evt Event object to add parameters to\n * @param deviceInputSystem DeviceInputSystem to pull values from\n */\n static _CheckNonCharacterKeys(evt, deviceInputSystem) {\n const isKeyboardActive = deviceInputSystem.isDeviceAvailable(DeviceType.Keyboard);\n const altKey = isKeyboardActive && deviceInputSystem.pollInput(DeviceType.Keyboard, 0, 18) === 1;\n const ctrlKey = isKeyboardActive && deviceInputSystem.pollInput(DeviceType.Keyboard, 0, 17) === 1;\n const metaKey = isKeyboardActive &&\n (deviceInputSystem.pollInput(DeviceType.Keyboard, 0, 91) === 1 ||\n deviceInputSystem.pollInput(DeviceType.Keyboard, 0, 92) === 1 ||\n deviceInputSystem.pollInput(DeviceType.Keyboard, 0, 93) === 1);\n const shiftKey = isKeyboardActive && deviceInputSystem.pollInput(DeviceType.Keyboard, 0, 16) === 1;\n evt.altKey = altKey;\n evt.ctrlKey = ctrlKey;\n evt.metaKey = metaKey;\n evt.shiftKey = shiftKey;\n }\n /**\n * Create base event object\n * @param elementToAttachTo Value to use as event target\n * @returns\n */\n static _CreateEvent(elementToAttachTo) {\n const evt = {};\n evt.preventDefault = () => { };\n evt.target = elementToAttachTo;\n return evt;\n }\n}\n//# sourceMappingURL=eventFactory.js.map","import { DeviceEventFactory } from \"./eventFactory.js\";\nimport { DeviceType } from \"./InputDevices/deviceEnums.js\";\n/** @internal */\nexport class NativeDeviceInputSystem {\n constructor(onDeviceConnected, onDeviceDisconnected, onInputChanged) {\n this._nativeInput = _native.DeviceInputSystem\n ? new _native.DeviceInputSystem(onDeviceConnected, onDeviceDisconnected, (deviceType, deviceSlot, inputIndex, currentState) => {\n const evt = DeviceEventFactory.CreateDeviceEvent(deviceType, deviceSlot, inputIndex, currentState, this);\n onInputChanged(deviceType, deviceSlot, evt);\n })\n : this._createDummyNativeInput();\n }\n // Public functions\n /**\n * Checks for current device input value, given an id and input index. Throws exception if requested device not initialized.\n * @param deviceType Enum specifying device type\n * @param deviceSlot \"Slot\" or index that device is referenced in\n * @param inputIndex Id of input to be checked\n * @returns Current value of input\n */\n pollInput(deviceType, deviceSlot, inputIndex) {\n return this._nativeInput.pollInput(deviceType, deviceSlot, inputIndex);\n }\n /**\n * Check for a specific device in the DeviceInputSystem\n * @param deviceType Type of device to check for\n * @returns bool with status of device's existence\n */\n isDeviceAvailable(deviceType) {\n //TODO: FIx native side first\n return deviceType === DeviceType.Mouse || deviceType === DeviceType.Touch;\n }\n /**\n * Dispose of all the observables\n */\n dispose() {\n this._nativeInput.dispose();\n }\n /**\n * For versions of BabylonNative that don't have the NativeInput plugin initialized, create a dummy version\n * @returns Object with dummy functions\n */\n _createDummyNativeInput() {\n const nativeInput = {\n pollInput: () => {\n return 0;\n },\n isDeviceAvailable: () => {\n return false;\n },\n dispose: () => { },\n };\n return nativeInput;\n }\n}\n//# sourceMappingURL=nativeDeviceInputSystem.js.map","import { IsNavigatorAvailable } from \"../Misc/domManagement.js\";\nimport { Tools } from \"../Misc/tools.js\";\nimport { DeviceEventFactory } from \"./eventFactory.js\";\nimport { DeviceType, PointerInput } from \"./InputDevices/deviceEnums.js\";\n// eslint-disable-next-line @typescript-eslint/naming-convention\nconst MAX_KEYCODES = 255;\n// eslint-disable-next-line @typescript-eslint/naming-convention\nconst MAX_POINTER_INPUTS = Object.keys(PointerInput).length / 2;\n/** @internal */\nexport class WebDeviceInputSystem {\n /**\n * Constructor for the WebDeviceInputSystem\n * @param engine Engine to reference\n * @param onDeviceConnected Callback to execute when device is connected\n * @param onDeviceDisconnected Callback to execute when device is disconnected\n * @param onInputChanged Callback to execute when input changes on device\n */\n constructor(engine, onDeviceConnected, onDeviceDisconnected, onInputChanged) {\n // Private Members\n this._inputs = [];\n this._keyboardActive = false;\n this._pointerActive = false;\n this._usingSafari = Tools.IsSafari();\n // Found solution for determining if MacOS is being used here:\n // https://stackoverflow.com/questions/10527983/best-way-to-detect-mac-os-x-or-windows-computers-with-javascript-or-jquery\n this._usingMacOS = IsNavigatorAvailable() && /(Mac|iPhone|iPod|iPad)/i.test(navigator.platform);\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n this._keyboardDownEvent = (evt) => { };\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n this._keyboardUpEvent = (evt) => { };\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n this._keyboardBlurEvent = (evt) => { };\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n this._pointerMoveEvent = (evt) => { };\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n this._pointerDownEvent = (evt) => { };\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n this._pointerUpEvent = (evt) => { };\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n this._pointerCancelEvent = (evt) => { };\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n this._pointerWheelEvent = (evt) => { };\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n this._pointerBlurEvent = (evt) => { };\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n this._pointerMacOSChromeOutEvent = (evt) => { };\n this._eventsAttached = false;\n this._mouseId = -1;\n this._isUsingFirefox = IsNavigatorAvailable() && navigator.userAgent && navigator.userAgent.indexOf(\"Firefox\") !== -1;\n this._isUsingChromium = IsNavigatorAvailable() && navigator.userAgent && navigator.userAgent.indexOf(\"Chrome\") !== -1;\n this._maxTouchPoints = 0;\n this._pointerInputClearObserver = null;\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n this._gamepadConnectedEvent = (evt) => { };\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n this._gamepadDisconnectedEvent = (evt) => { };\n this._eventPrefix = Tools.GetPointerPrefix(engine);\n this._engine = engine;\n this._onDeviceConnected = onDeviceConnected;\n this._onDeviceDisconnected = onDeviceDisconnected;\n this._onInputChanged = onInputChanged;\n // If we need a pointerId, set one for future use\n this._mouseId = this._isUsingFirefox ? 0 : 1;\n this._enableEvents();\n if (this._usingMacOS) {\n this._metaKeys = [];\n }\n // Set callback to enable event handler switching when inputElement changes\n if (!this._engine._onEngineViewChanged) {\n this._engine._onEngineViewChanged = () => {\n this._enableEvents();\n };\n }\n }\n // Public functions\n /**\n * Checks for current device input value, given an id and input index. Throws exception if requested device not initialized.\n * @param deviceType Enum specifying device type\n * @param deviceSlot \"Slot\" or index that device is referenced in\n * @param inputIndex Id of input to be checked\n * @returns Current value of input\n */\n pollInput(deviceType, deviceSlot, inputIndex) {\n const device = this._inputs[deviceType][deviceSlot];\n if (!device) {\n throw `Unable to find device ${DeviceType[deviceType]}`;\n }\n if (deviceType >= DeviceType.DualShock && deviceType <= DeviceType.DualSense) {\n this._updateDevice(deviceType, deviceSlot, inputIndex);\n }\n const currentValue = device[inputIndex];\n if (currentValue === undefined) {\n throw `Unable to find input ${inputIndex} for device ${DeviceType[deviceType]} in slot ${deviceSlot}`;\n }\n if (inputIndex === PointerInput.Move) {\n Tools.Warn(`Unable to provide information for PointerInput.Move. Try using PointerInput.Horizontal or PointerInput.Vertical for move data.`);\n }\n return currentValue;\n }\n /**\n * Check for a specific device in the DeviceInputSystem\n * @param deviceType Type of device to check for\n * @returns bool with status of device's existence\n */\n isDeviceAvailable(deviceType) {\n return this._inputs[deviceType] !== undefined;\n }\n /**\n * Dispose of all the eventlisteners\n */\n dispose() {\n // Callbacks\n this._onDeviceConnected = () => { };\n this._onDeviceDisconnected = () => { };\n this._onInputChanged = () => { };\n delete this._engine._onEngineViewChanged;\n if (this._elementToAttachTo) {\n this._disableEvents();\n }\n }\n /**\n * Enable listening for user input events\n */\n _enableEvents() {\n const inputElement = this === null || this === void 0 ? void 0 : this._engine.getInputElement();\n if (inputElement && (!this._eventsAttached || this._elementToAttachTo !== inputElement)) {\n // Remove events before adding to avoid double events or simultaneous events on multiple canvases\n this._disableEvents();\n // If the inputs array has already been created, zero it out to before setting up events\n if (this._inputs) {\n for (const inputs of this._inputs) {\n if (inputs) {\n for (const deviceSlotKey in inputs) {\n const deviceSlot = +deviceSlotKey;\n const device = inputs[deviceSlot];\n if (device) {\n for (let inputIndex = 0; inputIndex < device.length; inputIndex++) {\n device[inputIndex] = 0;\n }\n }\n }\n }\n }\n }\n this._elementToAttachTo = inputElement;\n // Set tab index for the inputElement to the engine's canvasTabIndex, if and only if the element's tab index is -1\n this._elementToAttachTo.tabIndex = this._elementToAttachTo.tabIndex !== -1 ? this._elementToAttachTo.tabIndex : this._engine.canvasTabIndex;\n this._handleKeyActions();\n this._handlePointerActions();\n this._handleGamepadActions();\n this._eventsAttached = true;\n // Check for devices that are already connected but aren't registered. Currently, only checks for gamepads and mouse\n this._checkForConnectedDevices();\n }\n }\n /**\n * Disable listening for user input events\n */\n _disableEvents() {\n if (this._elementToAttachTo) {\n // Blur Events\n this._elementToAttachTo.removeEventListener(\"blur\", this._keyboardBlurEvent);\n this._elementToAttachTo.removeEventListener(\"blur\", this._pointerBlurEvent);\n // Keyboard Events\n this._elementToAttachTo.removeEventListener(\"keydown\", this._keyboardDownEvent);\n this._elementToAttachTo.removeEventListener(\"keyup\", this._keyboardUpEvent);\n // Pointer Events\n this._elementToAttachTo.removeEventListener(this._eventPrefix + \"move\", this._pointerMoveEvent);\n this._elementToAttachTo.removeEventListener(this._eventPrefix + \"down\", this._pointerDownEvent);\n this._elementToAttachTo.removeEventListener(this._eventPrefix + \"up\", this._pointerUpEvent);\n this._elementToAttachTo.removeEventListener(this._eventPrefix + \"cancel\", this._pointerCancelEvent);\n this._elementToAttachTo.removeEventListener(this._wheelEventName, this._pointerWheelEvent);\n if (this._usingMacOS && this._isUsingChromium) {\n this._elementToAttachTo.removeEventListener(\"lostpointercapture\", this._pointerMacOSChromeOutEvent);\n }\n // Gamepad Events\n window.removeEventListener(\"gamepadconnected\", this._gamepadConnectedEvent);\n window.removeEventListener(\"gamepaddisconnected\", this._gamepadDisconnectedEvent);\n }\n if (this._pointerInputClearObserver) {\n this._engine.onEndFrameObservable.remove(this._pointerInputClearObserver);\n }\n this._eventsAttached = false;\n }\n /**\n * Checks for existing connections to devices and register them, if necessary\n * Currently handles gamepads and mouse\n */\n _checkForConnectedDevices() {\n if (navigator.getGamepads) {\n const gamepads = navigator.getGamepads();\n for (const gamepad of gamepads) {\n if (gamepad) {\n this._addGamePad(gamepad);\n }\n }\n }\n // If the device in use has mouse capabilities, pre-register mouse\n if (typeof matchMedia === \"function\" && matchMedia(\"(pointer:fine)\").matches) {\n // This will provide a dummy value for the cursor position and is expected to be overridden when the first mouse event happens.\n // There isn't any good way to get the current position outside of a pointer event so that's why this was done.\n this._addPointerDevice(DeviceType.Mouse, 0, 0, 0);\n }\n }\n // Private functions\n /**\n * Add a gamepad to the DeviceInputSystem\n * @param gamepad A single DOM Gamepad object\n */\n _addGamePad(gamepad) {\n const deviceType = this._getGamepadDeviceType(gamepad.id);\n const deviceSlot = gamepad.index;\n this._gamepads = this._gamepads || new Array(gamepad.index + 1);\n this._registerDevice(deviceType, deviceSlot, gamepad.buttons.length + gamepad.axes.length);\n this._gamepads[deviceSlot] = deviceType;\n }\n /**\n * Add pointer device to DeviceInputSystem\n * @param deviceType Type of Pointer to add\n * @param deviceSlot Pointer ID (0 for mouse, pointerId for Touch)\n * @param currentX Current X at point of adding\n * @param currentY Current Y at point of adding\n */\n _addPointerDevice(deviceType, deviceSlot, currentX, currentY) {\n if (!this._pointerActive) {\n this._pointerActive = true;\n }\n this._registerDevice(deviceType, deviceSlot, MAX_POINTER_INPUTS);\n const pointer = this._inputs[deviceType][deviceSlot]; /* initialize our pointer position immediately after registration */\n pointer[0] = currentX;\n pointer[1] = currentY;\n }\n /**\n * Add device and inputs to device array\n * @param deviceType Enum specifying device type\n * @param deviceSlot \"Slot\" or index that device is referenced in\n * @param numberOfInputs Number of input entries to create for given device\n */\n _registerDevice(deviceType, deviceSlot, numberOfInputs) {\n if (deviceSlot === undefined) {\n throw `Unable to register device ${DeviceType[deviceType]} to undefined slot.`;\n }\n if (!this._inputs[deviceType]) {\n this._inputs[deviceType] = {};\n }\n if (!this._inputs[deviceType][deviceSlot]) {\n const device = new Array(numberOfInputs);\n device.fill(0);\n this._inputs[deviceType][deviceSlot] = device;\n this._onDeviceConnected(deviceType, deviceSlot);\n }\n }\n /**\n * Given a specific device name, remove that device from the device map\n * @param deviceType Enum specifying device type\n * @param deviceSlot \"Slot\" or index that device is referenced in\n */\n _unregisterDevice(deviceType, deviceSlot) {\n if (this._inputs[deviceType][deviceSlot]) {\n delete this._inputs[deviceType][deviceSlot];\n this._onDeviceDisconnected(deviceType, deviceSlot);\n }\n }\n /**\n * Handle all actions that come from keyboard interaction\n */\n _handleKeyActions() {\n this._keyboardDownEvent = (evt) => {\n if (!this._keyboardActive) {\n this._keyboardActive = true;\n this._registerDevice(DeviceType.Keyboard, 0, MAX_KEYCODES);\n }\n const kbKey = this._inputs[DeviceType.Keyboard][0];\n if (kbKey) {\n kbKey[evt.keyCode] = 1;\n const deviceEvent = evt;\n deviceEvent.inputIndex = evt.keyCode;\n if (this._usingMacOS && evt.metaKey && evt.key !== \"Meta\") {\n if (!this._metaKeys.includes(evt.keyCode)) {\n this._metaKeys.push(evt.keyCode);\n }\n }\n this._onInputChanged(DeviceType.Keyboard, 0, deviceEvent);\n }\n };\n this._keyboardUpEvent = (evt) => {\n if (!this._keyboardActive) {\n this._keyboardActive = true;\n this._registerDevice(DeviceType.Keyboard, 0, MAX_KEYCODES);\n }\n const kbKey = this._inputs[DeviceType.Keyboard][0];\n if (kbKey) {\n kbKey[evt.keyCode] = 0;\n const deviceEvent = evt;\n deviceEvent.inputIndex = evt.keyCode;\n if (this._usingMacOS && evt.key === \"Meta\" && this._metaKeys.length > 0) {\n for (const keyCode of this._metaKeys) {\n const deviceEvent = DeviceEventFactory.CreateDeviceEvent(DeviceType.Keyboard, 0, keyCode, 0, this, this._elementToAttachTo);\n kbKey[keyCode] = 0;\n this._onInputChanged(DeviceType.Keyboard, 0, deviceEvent);\n }\n this._metaKeys.splice(0, this._metaKeys.length);\n }\n this._onInputChanged(DeviceType.Keyboard, 0, deviceEvent);\n }\n };\n this._keyboardBlurEvent = () => {\n if (this._keyboardActive) {\n const kbKey = this._inputs[DeviceType.Keyboard][0];\n for (let i = 0; i < kbKey.length; i++) {\n if (kbKey[i] !== 0) {\n kbKey[i] = 0;\n const deviceEvent = DeviceEventFactory.CreateDeviceEvent(DeviceType.Keyboard, 0, i, 0, this, this._elementToAttachTo);\n this._onInputChanged(DeviceType.Keyboard, 0, deviceEvent);\n }\n }\n if (this._usingMacOS) {\n this._metaKeys.splice(0, this._metaKeys.length);\n }\n }\n };\n this._elementToAttachTo.addEventListener(\"keydown\", this._keyboardDownEvent);\n this._elementToAttachTo.addEventListener(\"keyup\", this._keyboardUpEvent);\n this._elementToAttachTo.addEventListener(\"blur\", this._keyboardBlurEvent);\n }\n /**\n * Handle all actions that come from pointer interaction\n */\n _handlePointerActions() {\n // If maxTouchPoints is defined, use that value. Otherwise, allow for a minimum for supported gestures like pinch\n this._maxTouchPoints = (IsNavigatorAvailable() && navigator.maxTouchPoints) || 2;\n if (!this._activeTouchIds) {\n this._activeTouchIds = new Array(this._maxTouchPoints);\n }\n for (let i = 0; i < this._maxTouchPoints; i++) {\n this._activeTouchIds[i] = -1;\n }\n this._pointerMoveEvent = (evt) => {\n const deviceType = this._getPointerType(evt);\n let deviceSlot = deviceType === DeviceType.Mouse ? 0 : this._activeTouchIds.indexOf(evt.pointerId);\n // In the event that we're gettting pointermove events from touch inputs that we aren't tracking,\n // look for an available slot and retroactively connect it.\n if (deviceType === DeviceType.Touch && deviceSlot === -1) {\n const idx = this._activeTouchIds.indexOf(-1);\n if (idx >= 0) {\n deviceSlot = idx;\n this._activeTouchIds[idx] = evt.pointerId;\n // Because this is a \"new\" input, inform the connected callback\n this._onDeviceConnected(deviceType, deviceSlot);\n }\n else {\n // We can't find an open slot to store new pointer so just return (can only support max number of touches)\n Tools.Warn(`Max number of touches exceeded. Ignoring touches in excess of ${this._maxTouchPoints}`);\n return;\n }\n }\n if (!this._inputs[deviceType]) {\n this._inputs[deviceType] = {};\n }\n if (!this._inputs[deviceType][deviceSlot]) {\n this._addPointerDevice(deviceType, deviceSlot, evt.clientX, evt.clientY);\n }\n const pointer = this._inputs[deviceType][deviceSlot];\n if (pointer) {\n const deviceEvent = evt;\n deviceEvent.inputIndex = PointerInput.Move;\n pointer[PointerInput.Horizontal] = evt.clientX;\n pointer[PointerInput.Vertical] = evt.clientY;\n // For touches that aren't started with a down, we need to set the button state to 1\n if (deviceType === DeviceType.Touch && pointer[PointerInput.LeftClick] === 0) {\n pointer[PointerInput.LeftClick] = 1;\n }\n if (evt.pointerId === undefined) {\n evt.pointerId = this._mouseId;\n }\n this._onInputChanged(deviceType, deviceSlot, deviceEvent);\n // Lets Propagate the event for move with same position.\n if (!this._usingSafari && evt.button !== -1) {\n deviceEvent.inputIndex = evt.button + 2;\n pointer[evt.button + 2] = pointer[evt.button + 2] ? 0 : 1; // Reverse state of button if evt.button has value\n this._onInputChanged(deviceType, deviceSlot, deviceEvent);\n }\n }\n };\n this._pointerDownEvent = (evt) => {\n const deviceType = this._getPointerType(evt);\n let deviceSlot = deviceType === DeviceType.Mouse ? 0 : evt.pointerId;\n if (deviceType === DeviceType.Touch) {\n const idx = this._activeTouchIds.indexOf(-1);\n if (idx >= 0) {\n deviceSlot = idx;\n this._activeTouchIds[idx] = evt.pointerId;\n }\n else {\n // We can't find an open slot to store new pointer so just return (can only support max number of touches)\n Tools.Warn(`Max number of touches exceeded. Ignoring touches in excess of ${this._maxTouchPoints}`);\n return;\n }\n }\n if (!this._inputs[deviceType]) {\n this._inputs[deviceType] = {};\n }\n if (!this._inputs[deviceType][deviceSlot]) {\n this._addPointerDevice(deviceType, deviceSlot, evt.clientX, evt.clientY);\n }\n else if (deviceType === DeviceType.Touch) {\n this._onDeviceConnected(deviceType, deviceSlot);\n }\n const pointer = this._inputs[deviceType][deviceSlot];\n if (pointer) {\n const previousHorizontal = pointer[PointerInput.Horizontal];\n const previousVertical = pointer[PointerInput.Vertical];\n if (deviceType === DeviceType.Mouse) {\n // Mouse; Set pointerId if undefined\n if (evt.pointerId === undefined) {\n evt.pointerId = this._mouseId;\n }\n if (!document.pointerLockElement) {\n try {\n this._elementToAttachTo.setPointerCapture(this._mouseId);\n }\n catch (e) {\n // DO NOTHING\n }\n }\n }\n else {\n // Touch; Since touches are dynamically assigned, only set capture if we have an id\n if (evt.pointerId && !document.pointerLockElement) {\n try {\n this._elementToAttachTo.setPointerCapture(evt.pointerId);\n }\n catch (e) {\n // DO NOTHING\n }\n }\n }\n pointer[PointerInput.Horizontal] = evt.clientX;\n pointer[PointerInput.Vertical] = evt.clientY;\n pointer[evt.button + 2] = 1;\n const deviceEvent = evt;\n // NOTE: The +2 used here to is because PointerInput has the same value progression for its mouse buttons as PointerEvent.button\n // However, we have our X and Y values front-loaded to group together the touch inputs but not break this progression\n // EG. ([X, Y, Left-click], Middle-click, etc...)\n deviceEvent.inputIndex = evt.button + 2;\n this._onInputChanged(deviceType, deviceSlot, deviceEvent);\n if (previousHorizontal !== evt.clientX || previousVertical !== evt.clientY) {\n deviceEvent.inputIndex = PointerInput.Move;\n this._onInputChanged(deviceType, deviceSlot, deviceEvent);\n }\n }\n };\n this._pointerUpEvent = (evt) => {\n var _a, _b, _c, _d, _e;\n const deviceType = this._getPointerType(evt);\n const deviceSlot = deviceType === DeviceType.Mouse ? 0 : this._activeTouchIds.indexOf(evt.pointerId);\n if (deviceType === DeviceType.Touch) {\n // If we're getting a pointerup event for a touch that isn't active, just return.\n if (deviceSlot === -1) {\n return;\n }\n else {\n this._activeTouchIds[deviceSlot] = -1;\n }\n }\n const pointer = (_a = this._inputs[deviceType]) === null || _a === void 0 ? void 0 : _a[deviceSlot];\n if (pointer && pointer[evt.button + 2] !== 0) {\n const previousHorizontal = pointer[PointerInput.Horizontal];\n const previousVertical = pointer[PointerInput.Vertical];\n pointer[PointerInput.Horizontal] = evt.clientX;\n pointer[PointerInput.Vertical] = evt.clientY;\n pointer[evt.button + 2] = 0;\n const deviceEvent = evt;\n if (evt.pointerId === undefined) {\n evt.pointerId = this._mouseId;\n }\n if (previousHorizontal !== evt.clientX || previousVertical !== evt.clientY) {\n deviceEvent.inputIndex = PointerInput.Move;\n this._onInputChanged(deviceType, deviceSlot, deviceEvent);\n }\n // NOTE: The +2 used here to is because PointerInput has the same value progression for its mouse buttons as PointerEvent.button\n // However, we have our X and Y values front-loaded to group together the touch inputs but not break this progression\n // EG. ([X, Y, Left-click], Middle-click, etc...)\n deviceEvent.inputIndex = evt.button + 2;\n if (deviceType === DeviceType.Mouse && this._mouseId >= 0 && ((_c = (_b = this._elementToAttachTo).hasPointerCapture) === null || _c === void 0 ? void 0 : _c.call(_b, this._mouseId))) {\n this._elementToAttachTo.releasePointerCapture(this._mouseId);\n }\n else if (evt.pointerId && ((_e = (_d = this._elementToAttachTo).hasPointerCapture) === null || _e === void 0 ? void 0 : _e.call(_d, evt.pointerId))) {\n this._elementToAttachTo.releasePointerCapture(evt.pointerId);\n }\n this._onInputChanged(deviceType, deviceSlot, deviceEvent);\n if (deviceType === DeviceType.Touch) {\n this._onDeviceDisconnected(deviceType, deviceSlot);\n }\n }\n };\n this._pointerCancelEvent = (evt) => {\n var _a, _b, _c, _d;\n if (evt.pointerType === \"mouse\") {\n const pointer = this._inputs[DeviceType.Mouse][0];\n if (this._mouseId >= 0 && ((_b = (_a = this._elementToAttachTo).hasPointerCapture) === null || _b === void 0 ? void 0 : _b.call(_a, this._mouseId))) {\n this._elementToAttachTo.releasePointerCapture(this._mouseId);\n }\n for (let inputIndex = PointerInput.LeftClick; inputIndex <= PointerInput.BrowserForward; inputIndex++) {\n if (pointer[inputIndex] === 1) {\n pointer[inputIndex] = 0;\n const deviceEvent = DeviceEventFactory.CreateDeviceEvent(DeviceType.Mouse, 0, inputIndex, 0, this, this._elementToAttachTo);\n this._onInputChanged(DeviceType.Mouse, 0, deviceEvent);\n }\n }\n }\n else {\n const deviceSlot = this._activeTouchIds.indexOf(evt.pointerId);\n // If we're getting a pointercancel event for a touch that isn't active, just return\n if (deviceSlot === -1) {\n return;\n }\n if ((_d = (_c = this._elementToAttachTo).hasPointerCapture) === null || _d === void 0 ? void 0 : _d.call(_c, evt.pointerId)) {\n this._elementToAttachTo.releasePointerCapture(evt.pointerId);\n }\n this._inputs[DeviceType.Touch][deviceSlot][PointerInput.LeftClick] = 0;\n const deviceEvent = DeviceEventFactory.CreateDeviceEvent(DeviceType.Touch, deviceSlot, PointerInput.LeftClick, 0, this, this._elementToAttachTo, evt.pointerId);\n this._onInputChanged(DeviceType.Touch, deviceSlot, deviceEvent);\n this._activeTouchIds[deviceSlot] = -1;\n this._onDeviceDisconnected(DeviceType.Touch, deviceSlot);\n }\n };\n // Set Wheel Event Name, code originally from scene.inputManager\n this._wheelEventName =\n \"onwheel\" in document.createElement(\"div\")\n ? \"wheel\" // Modern browsers support \"wheel\"\n : document.onmousewheel !== undefined\n ? \"mousewheel\" // Webkit and IE support at least \"mousewheel\"\n : \"DOMMouseScroll\"; // let's assume that remaining browsers are older Firefox\n // Code originally in scene.inputManager.ts\n // Chrome reports warning in console if wheel listener doesn't set an explicit passive option.\n // IE11 only supports captureEvent:boolean, not options:object, and it defaults to false.\n // Feature detection technique copied from: https://github.com/github/eventlistener-polyfill (MIT license)\n let passiveSupported = false;\n const noop = function () { };\n try {\n const options = Object.defineProperty({}, \"passive\", {\n get: function () {\n passiveSupported = true;\n },\n });\n this._elementToAttachTo.addEventListener(\"test\", noop, options);\n this._elementToAttachTo.removeEventListener(\"test\", noop, options);\n }\n catch (e) {\n /* */\n }\n this._pointerBlurEvent = () => {\n var _a, _b, _c, _d, _e;\n // Handle mouse buttons\n if (this.isDeviceAvailable(DeviceType.Mouse)) {\n const pointer = this._inputs[DeviceType.Mouse][0];\n if (this._mouseId >= 0 && ((_b = (_a = this._elementToAttachTo).hasPointerCapture) === null || _b === void 0 ? void 0 : _b.call(_a, this._mouseId))) {\n this._elementToAttachTo.releasePointerCapture(this._mouseId);\n }\n for (let inputIndex = PointerInput.LeftClick; inputIndex <= PointerInput.BrowserForward; inputIndex++) {\n if (pointer[inputIndex] === 1) {\n pointer[inputIndex] = 0;\n const deviceEvent = DeviceEventFactory.CreateDeviceEvent(DeviceType.Mouse, 0, inputIndex, 0, this, this._elementToAttachTo);\n this._onInputChanged(DeviceType.Mouse, 0, deviceEvent);\n }\n }\n }\n // Handle Active Touches\n if (this.isDeviceAvailable(DeviceType.Touch)) {\n const pointer = this._inputs[DeviceType.Touch];\n for (let deviceSlot = 0; deviceSlot < this._activeTouchIds.length; deviceSlot++) {\n const pointerId = this._activeTouchIds[deviceSlot];\n if ((_d = (_c = this._elementToAttachTo).hasPointerCapture) === null || _d === void 0 ? void 0 : _d.call(_c, pointerId)) {\n this._elementToAttachTo.releasePointerCapture(pointerId);\n }\n if (pointerId !== -1 && ((_e = pointer[deviceSlot]) === null || _e === void 0 ? void 0 : _e[PointerInput.LeftClick]) === 1) {\n pointer[deviceSlot][PointerInput.LeftClick] = 0;\n const deviceEvent = DeviceEventFactory.CreateDeviceEvent(DeviceType.Touch, deviceSlot, PointerInput.LeftClick, 0, this, this._elementToAttachTo, pointerId);\n this._onInputChanged(DeviceType.Touch, deviceSlot, deviceEvent);\n this._activeTouchIds[deviceSlot] = -1;\n this._onDeviceDisconnected(DeviceType.Touch, deviceSlot);\n }\n }\n }\n };\n this._pointerWheelEvent = (evt) => {\n const deviceType = DeviceType.Mouse;\n const deviceSlot = 0;\n if (!this._inputs[deviceType]) {\n this._inputs[deviceType] = [];\n }\n if (!this._inputs[deviceType][deviceSlot]) {\n this._pointerActive = true;\n this._registerDevice(deviceType, deviceSlot, MAX_POINTER_INPUTS);\n }\n const pointer = this._inputs[deviceType][deviceSlot];\n if (pointer) {\n pointer[PointerInput.MouseWheelX] = evt.deltaX || 0;\n pointer[PointerInput.MouseWheelY] = evt.deltaY || evt.wheelDelta || 0;\n pointer[PointerInput.MouseWheelZ] = evt.deltaZ || 0;\n const deviceEvent = evt;\n // By default, there is no pointerId for mouse wheel events so we'll add one here\n // This logic was originally in the InputManager but was added here to make the\n // InputManager more platform-agnostic\n if (evt.pointerId === undefined) {\n evt.pointerId = this._mouseId;\n }\n if (pointer[PointerInput.MouseWheelX] !== 0) {\n deviceEvent.inputIndex = PointerInput.MouseWheelX;\n this._onInputChanged(deviceType, deviceSlot, deviceEvent);\n }\n if (pointer[PointerInput.MouseWheelY] !== 0) {\n deviceEvent.inputIndex = PointerInput.MouseWheelY;\n this._onInputChanged(deviceType, deviceSlot, deviceEvent);\n }\n if (pointer[PointerInput.MouseWheelZ] !== 0) {\n deviceEvent.inputIndex = PointerInput.MouseWheelZ;\n this._onInputChanged(deviceType, deviceSlot, deviceEvent);\n }\n }\n };\n // Workaround for MacOS Chromium Browsers for lost pointer capture bug\n if (this._usingMacOS && this._isUsingChromium) {\n this._pointerMacOSChromeOutEvent = (evt) => {\n if (evt.buttons > 1) {\n this._pointerCancelEvent(evt);\n }\n };\n this._elementToAttachTo.addEventListener(\"lostpointercapture\", this._pointerMacOSChromeOutEvent);\n }\n this._elementToAttachTo.addEventListener(this._eventPrefix + \"move\", this._pointerMoveEvent);\n this._elementToAttachTo.addEventListener(this._eventPrefix + \"down\", this._pointerDownEvent);\n this._elementToAttachTo.addEventListener(this._eventPrefix + \"up\", this._pointerUpEvent);\n this._elementToAttachTo.addEventListener(this._eventPrefix + \"cancel\", this._pointerCancelEvent);\n this._elementToAttachTo.addEventListener(\"blur\", this._pointerBlurEvent);\n this._elementToAttachTo.addEventListener(this._wheelEventName, this._pointerWheelEvent, passiveSupported ? { passive: false } : false);\n // Since there's no up or down event for mouse wheel or delta x/y, clear mouse values at end of frame\n this._pointerInputClearObserver = this._engine.onEndFrameObservable.add(() => {\n if (this.isDeviceAvailable(DeviceType.Mouse)) {\n const pointer = this._inputs[DeviceType.Mouse][0];\n pointer[PointerInput.MouseWheelX] = 0;\n pointer[PointerInput.MouseWheelY] = 0;\n pointer[PointerInput.MouseWheelZ] = 0;\n }\n });\n }\n /**\n * Handle all actions that come from gamepad interaction\n */\n _handleGamepadActions() {\n this._gamepadConnectedEvent = (evt) => {\n this._addGamePad(evt.gamepad);\n };\n this._gamepadDisconnectedEvent = (evt) => {\n if (this._gamepads) {\n const deviceType = this._getGamepadDeviceType(evt.gamepad.id);\n const deviceSlot = evt.gamepad.index;\n this._unregisterDevice(deviceType, deviceSlot);\n delete this._gamepads[deviceSlot];\n }\n };\n window.addEventListener(\"gamepadconnected\", this._gamepadConnectedEvent);\n window.addEventListener(\"gamepaddisconnected\", this._gamepadDisconnectedEvent);\n }\n /**\n * Update all non-event based devices with each frame\n * @param deviceType Enum specifying device type\n * @param deviceSlot \"Slot\" or index that device is referenced in\n * @param inputIndex Id of input to be checked\n */\n _updateDevice(deviceType, deviceSlot, inputIndex) {\n // Gamepads\n const gp = navigator.getGamepads()[deviceSlot];\n if (gp && deviceType === this._gamepads[deviceSlot]) {\n const device = this._inputs[deviceType][deviceSlot];\n if (inputIndex >= gp.buttons.length) {\n device[inputIndex] = gp.axes[inputIndex - gp.buttons.length].valueOf();\n }\n else {\n device[inputIndex] = gp.buttons[inputIndex].value;\n }\n }\n }\n /**\n * Gets DeviceType from the device name\n * @param deviceName Name of Device from DeviceInputSystem\n * @returns DeviceType enum value\n */\n _getGamepadDeviceType(deviceName) {\n if (deviceName.indexOf(\"054c\") !== -1) {\n // DualShock 4 Gamepad\n return deviceName.indexOf(\"0ce6\") !== -1 ? DeviceType.DualSense : DeviceType.DualShock;\n }\n else if (deviceName.indexOf(\"Xbox One\") !== -1 || deviceName.search(\"Xbox 360\") !== -1 || deviceName.search(\"xinput\") !== -1) {\n // Xbox Gamepad\n return DeviceType.Xbox;\n }\n else if (deviceName.indexOf(\"057e\") !== -1) {\n // Switch Gamepad\n return DeviceType.Switch;\n }\n return DeviceType.Generic;\n }\n /**\n * Get DeviceType from a given pointer/mouse/touch event.\n * @param evt PointerEvent to evaluate\n * @returns DeviceType interpreted from event\n */\n _getPointerType(evt) {\n let deviceType = DeviceType.Mouse;\n if (evt.pointerType === \"touch\" || evt.pointerType === \"pen\" || evt.touches) {\n deviceType = DeviceType.Touch;\n }\n return deviceType;\n }\n}\n//# sourceMappingURL=webDeviceInputSystem.js.map","import { Observable } from \"../../Misc/observable.js\";\n/**\n * Class that handles all input for a specific device\n */\nexport class DeviceSource {\n /**\n * Default Constructor\n * @param deviceInputSystem - Reference to DeviceInputSystem\n * @param deviceType - Type of device\n * @param deviceSlot - \"Slot\" or index that device is referenced in\n */\n constructor(deviceInputSystem, \n /** Type of device */\n deviceType, \n /** \"Slot\" or index that device is referenced in */\n deviceSlot = 0) {\n this.deviceType = deviceType;\n this.deviceSlot = deviceSlot;\n // Public Members\n /**\n * Observable to handle device input changes per device\n */\n this.onInputChangedObservable = new Observable();\n this._deviceInputSystem = deviceInputSystem;\n }\n /**\n * Get input for specific input\n * @param inputIndex - index of specific input on device\n * @returns Input value from DeviceInputSystem\n */\n getInput(inputIndex) {\n return this._deviceInputSystem.pollInput(this.deviceType, this.deviceSlot, inputIndex);\n }\n}\n//# sourceMappingURL=deviceSource.js.map","import { DeviceType } from \"./InputDevices/deviceEnums.js\";\nimport { NativeDeviceInputSystem } from \"./nativeDeviceInputSystem.js\";\nimport { WebDeviceInputSystem } from \"./webDeviceInputSystem.js\";\nimport { DeviceSource } from \"./InputDevices/deviceSource.js\";\n/** @internal */\nexport class InternalDeviceSourceManager {\n constructor(engine) {\n this._registeredManagers = new Array();\n this._refCount = 0;\n // Public Functions\n this.registerManager = (manager) => {\n for (let deviceType = 0; deviceType < this._devices.length; deviceType++) {\n const device = this._devices[deviceType];\n for (const deviceSlotKey in device) {\n const deviceSlot = +deviceSlotKey;\n manager._addDevice(new DeviceSource(this._deviceInputSystem, deviceType, deviceSlot));\n }\n }\n this._registeredManagers.push(manager);\n };\n this.unregisterManager = (manager) => {\n const idx = this._registeredManagers.indexOf(manager);\n if (idx > -1) {\n this._registeredManagers.splice(idx, 1);\n }\n };\n const numberOfDeviceTypes = Object.keys(DeviceType).length / 2;\n this._devices = new Array(numberOfDeviceTypes);\n const onDeviceConnected = (deviceType, deviceSlot) => {\n if (!this._devices[deviceType]) {\n this._devices[deviceType] = new Array();\n }\n if (!this._devices[deviceType][deviceSlot]) {\n this._devices[deviceType][deviceSlot] = deviceSlot;\n }\n for (const manager of this._registeredManagers) {\n const deviceSource = new DeviceSource(this._deviceInputSystem, deviceType, deviceSlot);\n manager._addDevice(deviceSource);\n }\n };\n const onDeviceDisconnected = (deviceType, deviceSlot) => {\n var _a;\n if ((_a = this._devices[deviceType]) === null || _a === void 0 ? void 0 : _a[deviceSlot]) {\n delete this._devices[deviceType][deviceSlot];\n }\n for (const manager of this._registeredManagers) {\n manager._removeDevice(deviceType, deviceSlot);\n }\n };\n const onInputChanged = (deviceType, deviceSlot, eventData) => {\n if (eventData) {\n for (const manager of this._registeredManagers) {\n manager._onInputChanged(deviceType, deviceSlot, eventData);\n }\n }\n };\n if (typeof _native !== \"undefined\") {\n this._deviceInputSystem = new NativeDeviceInputSystem(onDeviceConnected, onDeviceDisconnected, onInputChanged);\n }\n else {\n this._deviceInputSystem = new WebDeviceInputSystem(engine, onDeviceConnected, onDeviceDisconnected, onInputChanged);\n }\n }\n dispose() {\n this._deviceInputSystem.dispose();\n }\n}\n//# sourceMappingURL=internalDeviceSourceManager.js.map","import { DeviceType } from \"./deviceEnums.js\";\nimport { Observable } from \"../../Misc/observable.js\";\nimport { InternalDeviceSourceManager } from \"../internalDeviceSourceManager.js\";\n/**\n * Class to keep track of devices\n */\nexport class DeviceSourceManager {\n // Public Functions\n /**\n * Gets a DeviceSource, given a type and slot\n * @param deviceType - Type of Device\n * @param deviceSlot - Slot or ID of device\n * @returns DeviceSource\n */\n getDeviceSource(deviceType, deviceSlot) {\n if (deviceSlot === undefined) {\n if (this._firstDevice[deviceType] === undefined) {\n return null;\n }\n deviceSlot = this._firstDevice[deviceType];\n }\n if (!this._devices[deviceType] || this._devices[deviceType][deviceSlot] === undefined) {\n return null;\n }\n return this._devices[deviceType][deviceSlot];\n }\n /**\n * Gets an array of DeviceSource objects for a given device type\n * @param deviceType - Type of Device\n * @returns All available DeviceSources of a given type\n */\n getDeviceSources(deviceType) {\n // If device type hasn't had any devices connected yet, return empty array.\n if (!this._devices[deviceType]) {\n return [];\n }\n return this._devices[deviceType].filter((source) => {\n return !!source;\n });\n }\n /**\n * Default constructor\n * @param engine - Used to get canvas (if applicable)\n */\n constructor(engine) {\n const numberOfDeviceTypes = Object.keys(DeviceType).length / 2;\n this._devices = new Array(numberOfDeviceTypes);\n this._firstDevice = new Array(numberOfDeviceTypes);\n this._engine = engine;\n if (!this._engine._deviceSourceManager) {\n this._engine._deviceSourceManager = new InternalDeviceSourceManager(engine);\n }\n this._engine._deviceSourceManager._refCount++;\n // Observables\n this.onDeviceConnectedObservable = new Observable((observer) => {\n for (const devices of this._devices) {\n if (devices) {\n for (const device of devices) {\n if (device) {\n this.onDeviceConnectedObservable.notifyObserver(observer, device);\n }\n }\n }\n }\n });\n this.onDeviceDisconnectedObservable = new Observable();\n this._engine._deviceSourceManager.registerManager(this);\n this._onDisposeObserver = engine.onDisposeObservable.add(() => {\n this.dispose();\n });\n }\n /**\n * Dispose of DeviceSourceManager\n */\n dispose() {\n // Null out observable refs\n this.onDeviceConnectedObservable.clear();\n this.onDeviceDisconnectedObservable.clear();\n if (this._engine._deviceSourceManager) {\n this._engine._deviceSourceManager.unregisterManager(this);\n if (--this._engine._deviceSourceManager._refCount < 1) {\n this._engine._deviceSourceManager.dispose();\n delete this._engine._deviceSourceManager;\n }\n }\n this._engine.onDisposeObservable.remove(this._onDisposeObserver);\n }\n // Hidden Functions\n /**\n * @param deviceSource - Source to add\n * @internal\n */\n _addDevice(deviceSource) {\n if (!this._devices[deviceSource.deviceType]) {\n this._devices[deviceSource.deviceType] = new Array();\n }\n if (!this._devices[deviceSource.deviceType][deviceSource.deviceSlot]) {\n this._devices[deviceSource.deviceType][deviceSource.deviceSlot] = deviceSource;\n this._updateFirstDevices(deviceSource.deviceType);\n }\n this.onDeviceConnectedObservable.notifyObservers(deviceSource);\n }\n /**\n * @param deviceType - DeviceType\n * @param deviceSlot - DeviceSlot\n * @internal\n */\n _removeDevice(deviceType, deviceSlot) {\n var _a, _b;\n const deviceSource = (_a = this._devices[deviceType]) === null || _a === void 0 ? void 0 : _a[deviceSlot]; // Grab local reference to use before removing from devices\n this.onDeviceDisconnectedObservable.notifyObservers(deviceSource);\n if ((_b = this._devices[deviceType]) === null || _b === void 0 ? void 0 : _b[deviceSlot]) {\n delete this._devices[deviceType][deviceSlot];\n }\n // Even if we don't delete a device, we should still check for the first device as things may have gotten out of sync.\n this._updateFirstDevices(deviceType);\n }\n /**\n * @param deviceType - DeviceType\n * @param deviceSlot - DeviceSlot\n * @param eventData - Event\n * @internal\n */\n _onInputChanged(deviceType, deviceSlot, eventData) {\n var _a, _b;\n (_b = (_a = this._devices[deviceType]) === null || _a === void 0 ? void 0 : _a[deviceSlot]) === null || _b === void 0 ? void 0 : _b.onInputChangedObservable.notifyObservers(eventData);\n }\n // Private Functions\n _updateFirstDevices(type) {\n switch (type) {\n case DeviceType.Keyboard:\n case DeviceType.Mouse:\n this._firstDevice[type] = 0;\n break;\n case DeviceType.Touch:\n case DeviceType.DualSense:\n case DeviceType.DualShock:\n case DeviceType.Xbox:\n case DeviceType.Switch:\n case DeviceType.Generic: {\n delete this._firstDevice[type];\n // eslint-disable-next-line no-case-declarations\n const devices = this._devices[type];\n if (devices) {\n for (let i = 0; i < devices.length; i++) {\n if (devices[i]) {\n this._firstDevice[type] = i;\n break;\n }\n }\n }\n break;\n }\n }\n }\n}\n//# sourceMappingURL=deviceSourceManager.js.map","import { PointerInfoPre, PointerInfo, PointerEventTypes } from \"../Events/pointerEvents.js\";\nimport { AbstractActionManager } from \"../Actions/abstractActionManager.js\";\nimport { PickingInfo } from \"../Collisions/pickingInfo.js\";\nimport { Vector2, Matrix } from \"../Maths/math.vector.js\";\n\nimport { ActionEvent } from \"../Actions/actionEvent.js\";\nimport { KeyboardEventTypes, KeyboardInfoPre, KeyboardInfo } from \"../Events/keyboardEvents.js\";\nimport { DeviceType, PointerInput } from \"../DeviceInput/InputDevices/deviceEnums.js\";\nimport { DeviceSourceManager } from \"../DeviceInput/InputDevices/deviceSourceManager.js\";\nimport { EngineStore } from \"../Engines/engineStore.js\";\n/** @internal */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nclass _ClickInfo {\n constructor() {\n this._singleClick = false;\n this._doubleClick = false;\n this._hasSwiped = false;\n this._ignore = false;\n }\n get singleClick() {\n return this._singleClick;\n }\n get doubleClick() {\n return this._doubleClick;\n }\n get hasSwiped() {\n return this._hasSwiped;\n }\n get ignore() {\n return this._ignore;\n }\n set singleClick(b) {\n this._singleClick = b;\n }\n set doubleClick(b) {\n this._doubleClick = b;\n }\n set hasSwiped(b) {\n this._hasSwiped = b;\n }\n set ignore(b) {\n this._ignore = b;\n }\n}\n/**\n * Class used to manage all inputs for the scene.\n */\nexport class InputManager {\n /**\n * Creates a new InputManager\n * @param scene - defines the hosting scene\n */\n constructor(scene) {\n /** This is a defensive check to not allow control attachment prior to an already active one. If already attached, previous control is unattached before attaching the new one. */\n this._alreadyAttached = false;\n this._meshPickProceed = false;\n this._currentPickResult = null;\n this._previousPickResult = null;\n this._totalPointersPressed = 0;\n this._doubleClickOccured = false;\n this._isSwiping = false;\n this._swipeButtonPressed = -1;\n this._skipPointerTap = false;\n this._isMultiTouchGesture = false;\n this._pointerX = 0;\n this._pointerY = 0;\n this._startingPointerPosition = new Vector2(0, 0);\n this._previousStartingPointerPosition = new Vector2(0, 0);\n this._startingPointerTime = 0;\n this._previousStartingPointerTime = 0;\n this._pointerCaptures = {};\n this._meshUnderPointerId = {};\n this._movePointerInfo = null;\n this._cameraObserverCount = 0;\n this._delayedClicks = [null, null, null, null, null];\n this._deviceSourceManager = null;\n this._scene = scene || EngineStore.LastCreatedScene;\n if (!this._scene) {\n return;\n }\n }\n /**\n * Gets the mesh that is currently under the pointer\n * @returns Mesh that the pointer is pointer is hovering over\n */\n get meshUnderPointer() {\n if (this._movePointerInfo) {\n // Because _pointerOverMesh is populated as part of _pickMove, we need to force a pick to update it.\n // Calling _pickMove calls _setCursorAndPointerOverMesh which calls setPointerOverMesh\n this._movePointerInfo._generatePickInfo();\n // Once we have what we need, we can clear _movePointerInfo because we don't need it anymore\n this._movePointerInfo = null;\n }\n return this._pointerOverMesh;\n }\n /**\n * When using more than one pointer (for example in XR) you can get the mesh under the specific pointer\n * @param pointerId - the pointer id to use\n * @returns The mesh under this pointer id or null if not found\n */\n getMeshUnderPointerByPointerId(pointerId) {\n return this._meshUnderPointerId[pointerId] || null;\n }\n /**\n * Gets the pointer coordinates in 2D without any translation (ie. straight out of the pointer event)\n * @returns Vector with X/Y values directly from pointer event\n */\n get unTranslatedPointer() {\n return new Vector2(this._unTranslatedPointerX, this._unTranslatedPointerY);\n }\n /**\n * Gets or sets the current on-screen X position of the pointer\n * @returns Translated X with respect to screen\n */\n get pointerX() {\n return this._pointerX;\n }\n set pointerX(value) {\n this._pointerX = value;\n }\n /**\n * Gets or sets the current on-screen Y position of the pointer\n * @returns Translated Y with respect to screen\n */\n get pointerY() {\n return this._pointerY;\n }\n set pointerY(value) {\n this._pointerY = value;\n }\n _updatePointerPosition(evt) {\n const canvasRect = this._scene.getEngine().getInputElementClientRect();\n if (!canvasRect) {\n return;\n }\n this._pointerX = evt.clientX - canvasRect.left;\n this._pointerY = evt.clientY - canvasRect.top;\n this._unTranslatedPointerX = this._pointerX;\n this._unTranslatedPointerY = this._pointerY;\n }\n _processPointerMove(pickResult, evt) {\n const scene = this._scene;\n const engine = scene.getEngine();\n const canvas = engine.getInputElement();\n if (canvas) {\n canvas.tabIndex = engine.canvasTabIndex;\n // Restore pointer\n if (!scene.doNotHandleCursors) {\n canvas.style.cursor = scene.defaultCursor;\n }\n }\n this._setCursorAndPointerOverMesh(pickResult, evt, scene);\n for (const step of scene._pointerMoveStage) {\n // If _pointerMoveState is defined, we have an active spriteManager and can't use Lazy Picking\n // Therefore, we need to force a pick to update the pickResult\n pickResult = pickResult || this._pickMove(evt);\n const isMeshPicked = (pickResult === null || pickResult === void 0 ? void 0 : pickResult.pickedMesh) ? true : false;\n pickResult = step.action(this._unTranslatedPointerX, this._unTranslatedPointerY, pickResult, isMeshPicked, canvas);\n }\n const type = evt.inputIndex >= PointerInput.MouseWheelX && evt.inputIndex <= PointerInput.MouseWheelZ ? PointerEventTypes.POINTERWHEEL : PointerEventTypes.POINTERMOVE;\n if (scene.onPointerMove) {\n // Because of lazy picking, we need to force a pick to update the pickResult\n pickResult = pickResult || this._pickMove(evt);\n scene.onPointerMove(evt, pickResult, type);\n }\n let pointerInfo;\n if (pickResult) {\n pointerInfo = new PointerInfo(type, evt, pickResult);\n this._setRayOnPointerInfo(pickResult, evt);\n }\n else {\n pointerInfo = new PointerInfo(type, evt, null, this);\n this._movePointerInfo = pointerInfo;\n }\n if (scene.onPointerObservable.hasObservers()) {\n scene.onPointerObservable.notifyObservers(pointerInfo, type);\n }\n }\n // Pointers handling\n /** @internal */\n _setRayOnPointerInfo(pickInfo, event) {\n const scene = this._scene;\n if (pickInfo && scene._pickingAvailable) {\n if (!pickInfo.ray) {\n pickInfo.ray = scene.createPickingRay(event.offsetX, event.offsetY, Matrix.Identity(), scene.activeCamera);\n }\n }\n }\n /** @internal */\n _addCameraPointerObserver(observer, mask) {\n this._cameraObserverCount++;\n return this._scene.onPointerObservable.add(observer, mask);\n }\n /** @internal */\n _removeCameraPointerObserver(observer) {\n this._cameraObserverCount--;\n return this._scene.onPointerObservable.remove(observer);\n }\n _checkForPicking() {\n return !!(this._scene.onPointerObservable.observers.length > this._cameraObserverCount || this._scene.onPointerPick);\n }\n _checkPrePointerObservable(pickResult, evt, type) {\n const scene = this._scene;\n const pi = new PointerInfoPre(type, evt, this._unTranslatedPointerX, this._unTranslatedPointerY);\n if (pickResult) {\n pi.originalPickingInfo = pickResult;\n pi.ray = pickResult.ray;\n if (pickResult.originMesh) {\n pi.nearInteractionPickingInfo = pickResult;\n }\n }\n scene.onPrePointerObservable.notifyObservers(pi, type);\n if (pi.skipOnPointerObservable) {\n return true;\n }\n else {\n return false;\n }\n }\n /** @internal */\n _pickMove(evt) {\n const scene = this._scene;\n const pickResult = scene.pick(this._unTranslatedPointerX, this._unTranslatedPointerY, scene.pointerMovePredicate, scene.pointerMoveFastCheck, scene.cameraToUseForPointers, scene.pointerMoveTrianglePredicate);\n this._setCursorAndPointerOverMesh(pickResult, evt, scene);\n return pickResult;\n }\n _setCursorAndPointerOverMesh(pickResult, evt, scene) {\n const engine = scene.getEngine();\n const canvas = engine.getInputElement();\n if (pickResult === null || pickResult === void 0 ? void 0 : pickResult.pickedMesh) {\n this.setPointerOverMesh(pickResult.pickedMesh, evt.pointerId, pickResult, evt);\n if (!scene.doNotHandleCursors && canvas && this._pointerOverMesh) {\n const actionManager = this._pointerOverMesh._getActionManagerForTrigger();\n if (actionManager && actionManager.hasPointerTriggers) {\n canvas.style.cursor = actionManager.hoverCursor || scene.hoverCursor;\n }\n }\n }\n else {\n this.setPointerOverMesh(null, evt.pointerId, pickResult, evt);\n }\n }\n /**\n * Use this method to simulate a pointer move on a mesh\n * The pickResult parameter can be obtained from a scene.pick or scene.pickWithRay\n * @param pickResult - pickingInfo of the object wished to simulate pointer event on\n * @param pointerEventInit - pointer event state to be used when simulating the pointer event (eg. pointer id for multitouch)\n */\n simulatePointerMove(pickResult, pointerEventInit) {\n const evt = new PointerEvent(\"pointermove\", pointerEventInit);\n evt.inputIndex = PointerInput.Move;\n if (this._checkPrePointerObservable(pickResult, evt, PointerEventTypes.POINTERMOVE)) {\n return;\n }\n this._processPointerMove(pickResult, evt);\n }\n /**\n * Use this method to simulate a pointer down on a mesh\n * The pickResult parameter can be obtained from a scene.pick or scene.pickWithRay\n * @param pickResult - pickingInfo of the object wished to simulate pointer event on\n * @param pointerEventInit - pointer event state to be used when simulating the pointer event (eg. pointer id for multitouch)\n */\n simulatePointerDown(pickResult, pointerEventInit) {\n const evt = new PointerEvent(\"pointerdown\", pointerEventInit);\n evt.inputIndex = evt.button + 2;\n if (this._checkPrePointerObservable(pickResult, evt, PointerEventTypes.POINTERDOWN)) {\n return;\n }\n this._processPointerDown(pickResult, evt);\n }\n _processPointerDown(pickResult, evt) {\n const scene = this._scene;\n if (pickResult === null || pickResult === void 0 ? void 0 : pickResult.pickedMesh) {\n this._pickedDownMesh = pickResult.pickedMesh;\n const actionManager = pickResult.pickedMesh._getActionManagerForTrigger();\n if (actionManager) {\n if (actionManager.hasPickTriggers) {\n actionManager.processTrigger(5, ActionEvent.CreateNew(pickResult.pickedMesh, evt, pickResult));\n switch (evt.button) {\n case 0:\n actionManager.processTrigger(2, ActionEvent.CreateNew(pickResult.pickedMesh, evt, pickResult));\n break;\n case 1:\n actionManager.processTrigger(4, ActionEvent.CreateNew(pickResult.pickedMesh, evt, pickResult));\n break;\n case 2:\n actionManager.processTrigger(3, ActionEvent.CreateNew(pickResult.pickedMesh, evt, pickResult));\n break;\n }\n }\n if (actionManager.hasSpecificTrigger(8)) {\n window.setTimeout(() => {\n const pickResult = scene.pick(this._unTranslatedPointerX, this._unTranslatedPointerY, (mesh) => ((mesh.isPickable &&\n mesh.isVisible &&\n mesh.isReady() &&\n mesh.actionManager &&\n mesh.actionManager.hasSpecificTrigger(8) &&\n mesh === this._pickedDownMesh)), false, scene.cameraToUseForPointers);\n if ((pickResult === null || pickResult === void 0 ? void 0 : pickResult.pickedMesh) && actionManager) {\n if (this._totalPointersPressed !== 0 && Date.now() - this._startingPointerTime > InputManager.LongPressDelay && !this._isPointerSwiping()) {\n this._startingPointerTime = 0;\n actionManager.processTrigger(8, ActionEvent.CreateNew(pickResult.pickedMesh, evt));\n }\n }\n }, InputManager.LongPressDelay);\n }\n }\n }\n else {\n for (const step of scene._pointerDownStage) {\n pickResult = step.action(this._unTranslatedPointerX, this._unTranslatedPointerY, pickResult, evt, false);\n }\n }\n let pointerInfo;\n const type = PointerEventTypes.POINTERDOWN;\n if (pickResult) {\n if (scene.onPointerDown) {\n scene.onPointerDown(evt, pickResult, type);\n }\n pointerInfo = new PointerInfo(type, evt, pickResult);\n this._setRayOnPointerInfo(pickResult, evt);\n }\n else {\n pointerInfo = new PointerInfo(type, evt, null, this);\n }\n if (scene.onPointerObservable.hasObservers()) {\n scene.onPointerObservable.notifyObservers(pointerInfo, type);\n }\n }\n /**\n * @internal\n * @internals Boolean if delta for pointer exceeds drag movement threshold\n */\n _isPointerSwiping() {\n return this._isSwiping;\n }\n /**\n * Use this method to simulate a pointer up on a mesh\n * The pickResult parameter can be obtained from a scene.pick or scene.pickWithRay\n * @param pickResult - pickingInfo of the object wished to simulate pointer event on\n * @param pointerEventInit - pointer event state to be used when simulating the pointer event (eg. pointer id for multitouch)\n * @param doubleTap - indicates that the pointer up event should be considered as part of a double click (false by default)\n */\n simulatePointerUp(pickResult, pointerEventInit, doubleTap) {\n const evt = new PointerEvent(\"pointerup\", pointerEventInit);\n evt.inputIndex = PointerInput.Move;\n const clickInfo = new _ClickInfo();\n if (doubleTap) {\n clickInfo.doubleClick = true;\n }\n else {\n clickInfo.singleClick = true;\n }\n if (this._checkPrePointerObservable(pickResult, evt, PointerEventTypes.POINTERUP)) {\n return;\n }\n this._processPointerUp(pickResult, evt, clickInfo);\n }\n _processPointerUp(pickResult, evt, clickInfo) {\n const scene = this._scene;\n if (pickResult === null || pickResult === void 0 ? void 0 : pickResult.pickedMesh) {\n this._pickedUpMesh = pickResult.pickedMesh;\n if (this._pickedDownMesh === this._pickedUpMesh) {\n if (scene.onPointerPick) {\n scene.onPointerPick(evt, pickResult);\n }\n if (clickInfo.singleClick && !clickInfo.ignore && scene.onPointerObservable.observers.length > this._cameraObserverCount) {\n const type = PointerEventTypes.POINTERPICK;\n const pi = new PointerInfo(type, evt, pickResult);\n this._setRayOnPointerInfo(pickResult, evt);\n scene.onPointerObservable.notifyObservers(pi, type);\n }\n }\n const actionManager = pickResult.pickedMesh._getActionManagerForTrigger();\n if (actionManager && !clickInfo.ignore) {\n actionManager.processTrigger(7, ActionEvent.CreateNew(pickResult.pickedMesh, evt, pickResult));\n if (!clickInfo.hasSwiped && clickInfo.singleClick) {\n actionManager.processTrigger(1, ActionEvent.CreateNew(pickResult.pickedMesh, evt, pickResult));\n }\n const doubleClickActionManager = pickResult.pickedMesh._getActionManagerForTrigger(6);\n if (clickInfo.doubleClick && doubleClickActionManager) {\n doubleClickActionManager.processTrigger(6, ActionEvent.CreateNew(pickResult.pickedMesh, evt, pickResult));\n }\n }\n }\n else {\n if (!clickInfo.ignore) {\n for (const step of scene._pointerUpStage) {\n pickResult = step.action(this._unTranslatedPointerX, this._unTranslatedPointerY, pickResult, evt, clickInfo.doubleClick);\n }\n }\n }\n if (this._pickedDownMesh && this._pickedDownMesh !== this._pickedUpMesh) {\n const pickedDownActionManager = this._pickedDownMesh._getActionManagerForTrigger(16);\n if (pickedDownActionManager) {\n pickedDownActionManager.processTrigger(16, ActionEvent.CreateNew(this._pickedDownMesh, evt));\n }\n }\n if (!clickInfo.ignore) {\n const pi = new PointerInfo(PointerEventTypes.POINTERUP, evt, pickResult);\n // Set ray on picking info. Note that this info will also be reused for the tap notification.\n this._setRayOnPointerInfo(pickResult, evt);\n scene.onPointerObservable.notifyObservers(pi, PointerEventTypes.POINTERUP);\n if (scene.onPointerUp) {\n scene.onPointerUp(evt, pickResult, PointerEventTypes.POINTERUP);\n }\n if (!clickInfo.hasSwiped && !this._skipPointerTap && !this._isMultiTouchGesture) {\n let type = 0;\n if (clickInfo.singleClick) {\n type = PointerEventTypes.POINTERTAP;\n }\n else if (clickInfo.doubleClick) {\n type = PointerEventTypes.POINTERDOUBLETAP;\n }\n if (type) {\n const pi = new PointerInfo(type, evt, pickResult);\n if (scene.onPointerObservable.hasObservers() && scene.onPointerObservable.hasSpecificMask(type)) {\n scene.onPointerObservable.notifyObservers(pi, type);\n }\n }\n }\n }\n }\n /**\n * Gets a boolean indicating if the current pointer event is captured (meaning that the scene has already handled the pointer down)\n * @param pointerId - defines the pointer id to use in a multi-touch scenario (0 by default)\n * @returns true if the pointer was captured\n */\n isPointerCaptured(pointerId = 0) {\n return this._pointerCaptures[pointerId];\n }\n /**\n * Attach events to the canvas (To handle actionManagers triggers and raise onPointerMove, onPointerDown and onPointerUp\n * @param attachUp - defines if you want to attach events to pointerup\n * @param attachDown - defines if you want to attach events to pointerdown\n * @param attachMove - defines if you want to attach events to pointermove\n * @param elementToAttachTo - defines the target DOM element to attach to (will use the canvas by default)\n */\n attachControl(attachUp = true, attachDown = true, attachMove = true, elementToAttachTo = null) {\n const scene = this._scene;\n const engine = scene.getEngine();\n if (!elementToAttachTo) {\n elementToAttachTo = engine.getInputElement();\n }\n if (this._alreadyAttached) {\n this.detachControl();\n }\n if (elementToAttachTo) {\n this._alreadyAttachedTo = elementToAttachTo;\n }\n this._deviceSourceManager = new DeviceSourceManager(engine);\n // Because this is only called from _initClickEvent, which is called in _onPointerUp, we'll use the pointerUpPredicate for the pick call\n this._initActionManager = (act) => {\n if (!this._meshPickProceed) {\n const pickResult = scene.skipPointerUpPicking || (scene._registeredActions === 0 && !this._checkForPicking() && !scene.onPointerUp)\n ? null\n : scene.pick(this._unTranslatedPointerX, this._unTranslatedPointerY, scene.pointerUpPredicate, scene.pointerUpFastCheck, scene.cameraToUseForPointers);\n this._currentPickResult = pickResult;\n if (pickResult) {\n act = pickResult.hit && pickResult.pickedMesh ? pickResult.pickedMesh._getActionManagerForTrigger() : null;\n }\n this._meshPickProceed = true;\n }\n return act;\n };\n this._delayedSimpleClick = (btn, clickInfo, cb) => {\n // double click delay is over and that no double click has been raised since, or the 2 consecutive keys pressed are different\n if ((Date.now() - this._previousStartingPointerTime > InputManager.DoubleClickDelay && !this._doubleClickOccured) || btn !== this._previousButtonPressed) {\n this._doubleClickOccured = false;\n clickInfo.singleClick = true;\n clickInfo.ignore = false;\n // If we have a delayed click, we need to resolve the TAP event\n if (this._delayedClicks[btn]) {\n const evt = this._delayedClicks[btn].evt;\n const type = PointerEventTypes.POINTERTAP;\n const pi = new PointerInfo(type, evt, this._currentPickResult);\n if (scene.onPointerObservable.hasObservers() && scene.onPointerObservable.hasSpecificMask(type)) {\n scene.onPointerObservable.notifyObservers(pi, type);\n }\n // Clear the delayed click\n this._delayedClicks[btn] = null;\n }\n }\n };\n this._initClickEvent = (obs1, obs2, evt, cb) => {\n var _a, _b;\n const clickInfo = new _ClickInfo();\n this._currentPickResult = null;\n let act = null;\n let checkPicking = obs1.hasSpecificMask(PointerEventTypes.POINTERPICK) ||\n obs2.hasSpecificMask(PointerEventTypes.POINTERPICK) ||\n obs1.hasSpecificMask(PointerEventTypes.POINTERTAP) ||\n obs2.hasSpecificMask(PointerEventTypes.POINTERTAP) ||\n obs1.hasSpecificMask(PointerEventTypes.POINTERDOUBLETAP) ||\n obs2.hasSpecificMask(PointerEventTypes.POINTERDOUBLETAP);\n if (!checkPicking && AbstractActionManager) {\n act = this._initActionManager(act, clickInfo);\n if (act) {\n checkPicking = act.hasPickTriggers;\n }\n }\n let needToIgnoreNext = false;\n if (checkPicking) {\n const btn = evt.button;\n clickInfo.hasSwiped = this._isPointerSwiping();\n if (!clickInfo.hasSwiped) {\n let checkSingleClickImmediately = !InputManager.ExclusiveDoubleClickMode;\n if (!checkSingleClickImmediately) {\n checkSingleClickImmediately = !obs1.hasSpecificMask(PointerEventTypes.POINTERDOUBLETAP) && !obs2.hasSpecificMask(PointerEventTypes.POINTERDOUBLETAP);\n if (checkSingleClickImmediately && !AbstractActionManager.HasSpecificTrigger(6)) {\n act = this._initActionManager(act, clickInfo);\n if (act) {\n checkSingleClickImmediately = !act.hasSpecificTrigger(6);\n }\n }\n }\n if (checkSingleClickImmediately) {\n // single click detected if double click delay is over or two different successive keys pressed without exclusive double click or no double click required\n if (Date.now() - this._previousStartingPointerTime > InputManager.DoubleClickDelay || btn !== this._previousButtonPressed) {\n clickInfo.singleClick = true;\n cb(clickInfo, this._currentPickResult);\n needToIgnoreNext = true;\n }\n }\n // at least one double click is required to be check and exclusive double click is enabled\n else {\n // Queue up a delayed click, just in case this isn't a double click\n // It should be noted that while this delayed event happens\n // because of user input, it shouldn't be considered as a direct,\n // timing-dependent result of that input. It's meant to just fire the TAP event\n const delayedClick = {\n evt: evt,\n clickInfo: clickInfo,\n timeoutId: window.setTimeout(this._delayedSimpleClick.bind(this, btn, clickInfo, cb), InputManager.DoubleClickDelay),\n };\n this._delayedClicks[btn] = delayedClick;\n }\n let checkDoubleClick = obs1.hasSpecificMask(PointerEventTypes.POINTERDOUBLETAP) || obs2.hasSpecificMask(PointerEventTypes.POINTERDOUBLETAP);\n if (!checkDoubleClick && AbstractActionManager.HasSpecificTrigger(6)) {\n act = this._initActionManager(act, clickInfo);\n if (act) {\n checkDoubleClick = act.hasSpecificTrigger(6);\n }\n }\n if (checkDoubleClick) {\n // two successive keys pressed are equal, double click delay is not over and double click has not just occurred\n if (btn === this._previousButtonPressed && Date.now() - this._previousStartingPointerTime < InputManager.DoubleClickDelay && !this._doubleClickOccured) {\n // pointer has not moved for 2 clicks, it's a double click\n if (!clickInfo.hasSwiped && !this._isPointerSwiping()) {\n this._previousStartingPointerTime = 0;\n this._doubleClickOccured = true;\n clickInfo.doubleClick = true;\n clickInfo.ignore = false;\n // If we have a pending click, we need to cancel it\n if (InputManager.ExclusiveDoubleClickMode && this._delayedClicks[btn]) {\n clearTimeout((_a = this._delayedClicks[btn]) === null || _a === void 0 ? void 0 : _a.timeoutId);\n this._delayedClicks[btn] = null;\n }\n cb(clickInfo, this._currentPickResult);\n }\n // if the two successive clicks are too far, it's just two simple clicks\n else {\n this._doubleClickOccured = false;\n this._previousStartingPointerTime = this._startingPointerTime;\n this._previousStartingPointerPosition.x = this._startingPointerPosition.x;\n this._previousStartingPointerPosition.y = this._startingPointerPosition.y;\n this._previousButtonPressed = btn;\n if (InputManager.ExclusiveDoubleClickMode) {\n // If we have a delayed click, we need to cancel it\n if (this._delayedClicks[btn]) {\n clearTimeout((_b = this._delayedClicks[btn]) === null || _b === void 0 ? void 0 : _b.timeoutId);\n this._delayedClicks[btn] = null;\n }\n cb(clickInfo, this._previousPickResult);\n }\n else {\n cb(clickInfo, this._currentPickResult);\n }\n }\n needToIgnoreNext = true;\n }\n // just the first click of the double has been raised\n else {\n this._doubleClickOccured = false;\n this._previousStartingPointerTime = this._startingPointerTime;\n this._previousStartingPointerPosition.x = this._startingPointerPosition.x;\n this._previousStartingPointerPosition.y = this._startingPointerPosition.y;\n this._previousButtonPressed = btn;\n }\n }\n }\n }\n // Even if ExclusiveDoubleClickMode is true, we need to always handle\n // up events at time of execution, unless we're explicitly ignoring them.\n if (!needToIgnoreNext) {\n cb(clickInfo, this._currentPickResult);\n }\n };\n this._onPointerMove = (evt) => {\n this._updatePointerPosition(evt);\n // Check if pointer leaves DragMovementThreshold range to determine if swipe is occurring\n if (!this._isSwiping && this._swipeButtonPressed !== -1) {\n this._isSwiping =\n Math.abs(this._startingPointerPosition.x - this._pointerX) > InputManager.DragMovementThreshold ||\n Math.abs(this._startingPointerPosition.y - this._pointerY) > InputManager.DragMovementThreshold;\n }\n // Because there's a race condition between pointermove and pointerlockchange events, we need to\n // verify that the pointer is still locked after each pointermove event.\n if (engine.isPointerLock) {\n engine._verifyPointerLock();\n }\n // PreObservable support\n if (this._checkPrePointerObservable(null, evt, evt.inputIndex >= PointerInput.MouseWheelX && evt.inputIndex <= PointerInput.MouseWheelZ ? PointerEventTypes.POINTERWHEEL : PointerEventTypes.POINTERMOVE)) {\n return;\n }\n if (!scene.cameraToUseForPointers && !scene.activeCamera) {\n return;\n }\n if (scene.skipPointerMovePicking) {\n this._processPointerMove(new PickingInfo(), evt);\n return;\n }\n if (!scene.pointerMovePredicate) {\n scene.pointerMovePredicate = (mesh) => mesh.isPickable &&\n mesh.isVisible &&\n mesh.isReady() &&\n mesh.isEnabled() &&\n (mesh.enablePointerMoveEvents || scene.constantlyUpdateMeshUnderPointer || mesh._getActionManagerForTrigger() !== null) &&\n (!scene.cameraToUseForPointers || (scene.cameraToUseForPointers.layerMask & mesh.layerMask) !== 0);\n }\n const pickResult = scene._registeredActions > 0 || scene.constantlyUpdateMeshUnderPointer ? this._pickMove(evt) : null;\n this._processPointerMove(pickResult, evt);\n };\n this._onPointerDown = (evt) => {\n var _a;\n this._totalPointersPressed++;\n this._pickedDownMesh = null;\n this._meshPickProceed = false;\n // If ExclusiveDoubleClickMode is true, we need to resolve any pending delayed clicks\n if (InputManager.ExclusiveDoubleClickMode) {\n for (let i = 0; i < this._delayedClicks.length; i++) {\n if (this._delayedClicks[i]) {\n // If the button that was pressed is the same as the one that was released,\n // just clear the timer. This will be resolved in the up event.\n if (evt.button === i) {\n clearTimeout((_a = this._delayedClicks[i]) === null || _a === void 0 ? void 0 : _a.timeoutId);\n }\n else {\n // Otherwise, we need to resolve the click\n const clickInfo = this._delayedClicks[i].clickInfo;\n this._doubleClickOccured = false;\n clickInfo.singleClick = true;\n clickInfo.ignore = false;\n const prevEvt = this._delayedClicks[i].evt;\n const type = PointerEventTypes.POINTERTAP;\n const pi = new PointerInfo(type, prevEvt, this._currentPickResult);\n if (scene.onPointerObservable.hasObservers() && scene.onPointerObservable.hasSpecificMask(type)) {\n scene.onPointerObservable.notifyObservers(pi, type);\n }\n // Clear the delayed click\n this._delayedClicks[i] = null;\n }\n }\n }\n }\n this._updatePointerPosition(evt);\n if (this._swipeButtonPressed === -1) {\n this._swipeButtonPressed = evt.button;\n }\n if (scene.preventDefaultOnPointerDown && elementToAttachTo) {\n evt.preventDefault();\n elementToAttachTo.focus();\n }\n this._startingPointerPosition.x = this._pointerX;\n this._startingPointerPosition.y = this._pointerY;\n this._startingPointerTime = Date.now();\n // PreObservable support\n if (this._checkPrePointerObservable(null, evt, PointerEventTypes.POINTERDOWN)) {\n return;\n }\n if (!scene.cameraToUseForPointers && !scene.activeCamera) {\n return;\n }\n this._pointerCaptures[evt.pointerId] = true;\n if (!scene.pointerDownPredicate) {\n scene.pointerDownPredicate = (mesh) => {\n return (mesh.isPickable &&\n mesh.isVisible &&\n mesh.isReady() &&\n mesh.isEnabled() &&\n (!scene.cameraToUseForPointers || (scene.cameraToUseForPointers.layerMask & mesh.layerMask) !== 0));\n };\n }\n // Meshes\n this._pickedDownMesh = null;\n let pickResult;\n if (scene.skipPointerDownPicking || (scene._registeredActions === 0 && !this._checkForPicking() && !scene.onPointerDown)) {\n pickResult = new PickingInfo();\n }\n else {\n pickResult = scene.pick(this._unTranslatedPointerX, this._unTranslatedPointerY, scene.pointerDownPredicate, scene.pointerDownFastCheck, scene.cameraToUseForPointers);\n }\n this._processPointerDown(pickResult, evt);\n };\n this._onPointerUp = (evt) => {\n if (this._totalPointersPressed === 0) {\n // We are attaching the pointer up to windows because of a bug in FF\n return; // So we need to test it the pointer down was pressed before.\n }\n this._totalPointersPressed--;\n this._pickedUpMesh = null;\n this._meshPickProceed = false;\n this._updatePointerPosition(evt);\n if (scene.preventDefaultOnPointerUp && elementToAttachTo) {\n evt.preventDefault();\n elementToAttachTo.focus();\n }\n this._initClickEvent(scene.onPrePointerObservable, scene.onPointerObservable, evt, (clickInfo, pickResult) => {\n // PreObservable support\n if (scene.onPrePointerObservable.hasObservers()) {\n this._skipPointerTap = false;\n if (!clickInfo.ignore) {\n if (this._checkPrePointerObservable(null, evt, PointerEventTypes.POINTERUP)) {\n // If we're skipping the next observable, we need to reset the swipe state before returning\n if (this._swipeButtonPressed === evt.button) {\n this._isSwiping = false;\n this._swipeButtonPressed = -1;\n }\n // If we're going to skip the POINTERUP, we need to reset the pointer capture\n if (evt.buttons === 0) {\n this._pointerCaptures[evt.pointerId] = false;\n }\n return;\n }\n if (!clickInfo.hasSwiped) {\n if (clickInfo.singleClick && scene.onPrePointerObservable.hasSpecificMask(PointerEventTypes.POINTERTAP)) {\n if (this._checkPrePointerObservable(null, evt, PointerEventTypes.POINTERTAP)) {\n this._skipPointerTap = true;\n }\n }\n if (clickInfo.doubleClick && scene.onPrePointerObservable.hasSpecificMask(PointerEventTypes.POINTERDOUBLETAP)) {\n if (this._checkPrePointerObservable(null, evt, PointerEventTypes.POINTERDOUBLETAP)) {\n this._skipPointerTap = true;\n }\n }\n }\n }\n }\n // There should be a pointer captured at this point so if there isn't we should reset and return\n if (!this._pointerCaptures[evt.pointerId]) {\n if (this._swipeButtonPressed === evt.button) {\n this._isSwiping = false;\n this._swipeButtonPressed = -1;\n }\n return;\n }\n // Only release capture if all buttons are released\n if (evt.buttons === 0) {\n this._pointerCaptures[evt.pointerId] = false;\n }\n if (!scene.cameraToUseForPointers && !scene.activeCamera) {\n return;\n }\n if (!scene.pointerUpPredicate) {\n scene.pointerUpPredicate = (mesh) => {\n return (mesh.isPickable &&\n mesh.isVisible &&\n mesh.isReady() &&\n mesh.isEnabled() &&\n (!scene.cameraToUseForPointers || (scene.cameraToUseForPointers.layerMask & mesh.layerMask) !== 0));\n };\n }\n // Meshes\n if (!this._meshPickProceed && ((AbstractActionManager && AbstractActionManager.HasTriggers) || this._checkForPicking() || scene.onPointerUp)) {\n this._initActionManager(null, clickInfo);\n }\n if (!pickResult) {\n pickResult = this._currentPickResult;\n }\n this._processPointerUp(pickResult, evt, clickInfo);\n this._previousPickResult = this._currentPickResult;\n if (this._swipeButtonPressed === evt.button) {\n this._isSwiping = false;\n this._swipeButtonPressed = -1;\n }\n });\n };\n this._onKeyDown = (evt) => {\n const type = KeyboardEventTypes.KEYDOWN;\n if (scene.onPreKeyboardObservable.hasObservers()) {\n const pi = new KeyboardInfoPre(type, evt);\n scene.onPreKeyboardObservable.notifyObservers(pi, type);\n if (pi.skipOnKeyboardObservable) {\n return;\n }\n }\n if (scene.onKeyboardObservable.hasObservers()) {\n const pi = new KeyboardInfo(type, evt);\n scene.onKeyboardObservable.notifyObservers(pi, type);\n }\n if (scene.actionManager) {\n scene.actionManager.processTrigger(14, ActionEvent.CreateNewFromScene(scene, evt));\n }\n };\n this._onKeyUp = (evt) => {\n const type = KeyboardEventTypes.KEYUP;\n if (scene.onPreKeyboardObservable.hasObservers()) {\n const pi = new KeyboardInfoPre(type, evt);\n scene.onPreKeyboardObservable.notifyObservers(pi, type);\n if (pi.skipOnKeyboardObservable) {\n return;\n }\n }\n if (scene.onKeyboardObservable.hasObservers()) {\n const pi = new KeyboardInfo(type, evt);\n scene.onKeyboardObservable.notifyObservers(pi, type);\n }\n if (scene.actionManager) {\n scene.actionManager.processTrigger(15, ActionEvent.CreateNewFromScene(scene, evt));\n }\n };\n // If a device connects that we can handle, wire up the observable\n this._deviceSourceManager.onDeviceConnectedObservable.add((deviceSource) => {\n if (deviceSource.deviceType === DeviceType.Mouse) {\n deviceSource.onInputChangedObservable.add((eventData) => {\n if (eventData.inputIndex === PointerInput.LeftClick ||\n eventData.inputIndex === PointerInput.MiddleClick ||\n eventData.inputIndex === PointerInput.RightClick ||\n eventData.inputIndex === PointerInput.BrowserBack ||\n eventData.inputIndex === PointerInput.BrowserForward) {\n if (attachDown && deviceSource.getInput(eventData.inputIndex) === 1) {\n this._onPointerDown(eventData);\n }\n else if (attachUp && deviceSource.getInput(eventData.inputIndex) === 0) {\n this._onPointerUp(eventData);\n }\n }\n else if (attachMove) {\n if (eventData.inputIndex === PointerInput.Move) {\n this._onPointerMove(eventData);\n }\n else if (eventData.inputIndex === PointerInput.MouseWheelX ||\n eventData.inputIndex === PointerInput.MouseWheelY ||\n eventData.inputIndex === PointerInput.MouseWheelZ) {\n this._onPointerMove(eventData);\n }\n }\n });\n }\n else if (deviceSource.deviceType === DeviceType.Touch) {\n deviceSource.onInputChangedObservable.add((eventData) => {\n if (eventData.inputIndex === PointerInput.LeftClick) {\n if (attachDown && deviceSource.getInput(eventData.inputIndex) === 1) {\n this._onPointerDown(eventData);\n if (this._totalPointersPressed > 1) {\n this._isMultiTouchGesture = true;\n }\n }\n else if (attachUp && deviceSource.getInput(eventData.inputIndex) === 0) {\n this._onPointerUp(eventData);\n if (this._totalPointersPressed === 0) {\n this._isMultiTouchGesture = false;\n }\n }\n }\n if (attachMove && eventData.inputIndex === PointerInput.Move) {\n this._onPointerMove(eventData);\n }\n });\n }\n else if (deviceSource.deviceType === DeviceType.Keyboard) {\n deviceSource.onInputChangedObservable.add((eventData) => {\n if (eventData.type === \"keydown\") {\n this._onKeyDown(eventData);\n }\n else if (eventData.type === \"keyup\") {\n this._onKeyUp(eventData);\n }\n });\n }\n });\n this._alreadyAttached = true;\n }\n /**\n * Detaches all event handlers\n */\n detachControl() {\n if (this._alreadyAttached) {\n this._deviceSourceManager.dispose();\n this._deviceSourceManager = null;\n // Cursor\n if (this._alreadyAttachedTo && !this._scene.doNotHandleCursors) {\n this._alreadyAttachedTo.style.cursor = this._scene.defaultCursor;\n }\n this._alreadyAttached = false;\n this._alreadyAttachedTo = null;\n }\n }\n /**\n * Force the value of meshUnderPointer\n * @param mesh - defines the mesh to use\n * @param pointerId - optional pointer id when using more than one pointer. Defaults to 0\n * @param pickResult - optional pickingInfo data used to find mesh\n * @param evt - optional pointer event\n */\n setPointerOverMesh(mesh, pointerId = 0, pickResult, evt) {\n if (this._meshUnderPointerId[pointerId] === mesh && (!mesh || !mesh._internalAbstractMeshDataInfo._pointerOverDisableMeshTesting)) {\n return;\n }\n const underPointerMesh = this._meshUnderPointerId[pointerId];\n let actionManager;\n if (underPointerMesh) {\n actionManager = underPointerMesh._getActionManagerForTrigger(10);\n if (actionManager) {\n actionManager.processTrigger(10, ActionEvent.CreateNew(underPointerMesh, evt, { pointerId }));\n }\n }\n if (mesh) {\n this._meshUnderPointerId[pointerId] = mesh;\n this._pointerOverMesh = mesh;\n actionManager = mesh._getActionManagerForTrigger(9);\n if (actionManager) {\n actionManager.processTrigger(9, ActionEvent.CreateNew(mesh, evt, { pointerId, pickResult }));\n }\n }\n else {\n delete this._meshUnderPointerId[pointerId];\n this._pointerOverMesh = null;\n }\n }\n /**\n * Gets the mesh under the pointer\n * @returns a Mesh or null if no mesh is under the pointer\n */\n getPointerOverMesh() {\n return this.meshUnderPointer;\n }\n /**\n * @param mesh - Mesh to invalidate\n * @internal\n */\n _invalidateMesh(mesh) {\n if (this._pointerOverMesh === mesh) {\n this._pointerOverMesh = null;\n }\n if (this._pickedDownMesh === mesh) {\n this._pickedDownMesh = null;\n }\n if (this._pickedUpMesh === mesh) {\n this._pickedUpMesh = null;\n }\n for (const pointerId in this._meshUnderPointerId) {\n if (this._meshUnderPointerId[pointerId] === mesh) {\n delete this._meshUnderPointerId[pointerId];\n }\n }\n }\n}\n/** The distance in pixel that you have to move to prevent some events */\nInputManager.DragMovementThreshold = 10; // in pixels\n/** Time in milliseconds to wait to raise long press events if button is still pressed */\nInputManager.LongPressDelay = 500; // in milliseconds\n/** Time in milliseconds with two consecutive clicks will be considered as a double click */\nInputManager.DoubleClickDelay = 300; // in milliseconds\n/**\n * This flag will modify the behavior so that, when true, a click will happen if and only if\n * another click DOES NOT happen within the DoubleClickDelay time frame. If another click does\n * happen within that time frame, the first click will not fire an event and and a double click will occur.\n */\nInputManager.ExclusiveDoubleClickMode = false;\n//# sourceMappingURL=scene.inputManager.js.map","import { Vector3, Matrix } from \"./math.vector.js\";\n/**\n * Represents a plane by the equation ax + by + cz + d = 0\n */\nexport class Plane {\n /**\n * Creates a Plane object according to the given floats a, b, c, d and the plane equation : ax + by + cz + d = 0\n * @param a a component of the plane\n * @param b b component of the plane\n * @param c c component of the plane\n * @param d d component of the plane\n */\n constructor(a, b, c, d) {\n this.normal = new Vector3(a, b, c);\n this.d = d;\n }\n /**\n * @returns the plane coordinates as a new array of 4 elements [a, b, c, d].\n */\n asArray() {\n return [this.normal.x, this.normal.y, this.normal.z, this.d];\n }\n // Methods\n /**\n * @returns a new plane copied from the current Plane.\n */\n clone() {\n return new Plane(this.normal.x, this.normal.y, this.normal.z, this.d);\n }\n /**\n * @returns the string \"Plane\".\n */\n getClassName() {\n return \"Plane\";\n }\n /**\n * @returns the Plane hash code.\n */\n getHashCode() {\n let hash = this.normal.getHashCode();\n hash = (hash * 397) ^ (this.d | 0);\n return hash;\n }\n /**\n * Normalize the current Plane in place.\n * @returns the updated Plane.\n */\n normalize() {\n const norm = Math.sqrt(this.normal.x * this.normal.x + this.normal.y * this.normal.y + this.normal.z * this.normal.z);\n let magnitude = 0.0;\n if (norm !== 0) {\n magnitude = 1.0 / norm;\n }\n this.normal.x *= magnitude;\n this.normal.y *= magnitude;\n this.normal.z *= magnitude;\n this.d *= magnitude;\n return this;\n }\n /**\n * Applies a transformation the plane and returns the result\n * @param transformation the transformation matrix to be applied to the plane\n * @returns a new Plane as the result of the transformation of the current Plane by the given matrix.\n */\n transform(transformation) {\n const invertedMatrix = Plane._TmpMatrix;\n transformation.invertToRef(invertedMatrix);\n const m = invertedMatrix.m;\n const x = this.normal.x;\n const y = this.normal.y;\n const z = this.normal.z;\n const d = this.d;\n const normalX = x * m[0] + y * m[1] + z * m[2] + d * m[3];\n const normalY = x * m[4] + y * m[5] + z * m[6] + d * m[7];\n const normalZ = x * m[8] + y * m[9] + z * m[10] + d * m[11];\n const finalD = x * m[12] + y * m[13] + z * m[14] + d * m[15];\n return new Plane(normalX, normalY, normalZ, finalD);\n }\n /**\n * Compute the dot product between the point and the plane normal\n * @param point point to calculate the dot product with\n * @returns the dot product (float) of the point coordinates and the plane normal.\n */\n dotCoordinate(point) {\n return this.normal.x * point.x + this.normal.y * point.y + this.normal.z * point.z + this.d;\n }\n /**\n * Updates the current Plane from the plane defined by the three given points.\n * @param point1 one of the points used to construct the plane\n * @param point2 one of the points used to construct the plane\n * @param point3 one of the points used to construct the plane\n * @returns the updated Plane.\n */\n copyFromPoints(point1, point2, point3) {\n const x1 = point2.x - point1.x;\n const y1 = point2.y - point1.y;\n const z1 = point2.z - point1.z;\n const x2 = point3.x - point1.x;\n const y2 = point3.y - point1.y;\n const z2 = point3.z - point1.z;\n const yz = y1 * z2 - z1 * y2;\n const xz = z1 * x2 - x1 * z2;\n const xy = x1 * y2 - y1 * x2;\n const pyth = Math.sqrt(yz * yz + xz * xz + xy * xy);\n let invPyth;\n if (pyth !== 0) {\n invPyth = 1.0 / pyth;\n }\n else {\n invPyth = 0.0;\n }\n this.normal.x = yz * invPyth;\n this.normal.y = xz * invPyth;\n this.normal.z = xy * invPyth;\n this.d = -(this.normal.x * point1.x + this.normal.y * point1.y + this.normal.z * point1.z);\n return this;\n }\n /**\n * Checks if the plane is facing a given direction (meaning if the plane's normal is pointing in the opposite direction of the given vector).\n * Note that for this function to work as expected you should make sure that:\n * - direction and the plane normal are normalized\n * - epsilon is a number just bigger than -1, something like -0.99 for eg\n * @param direction the direction to check if the plane is facing\n * @param epsilon value the dot product is compared against (returns true if dot <= epsilon)\n * @returns True if the plane is facing the given direction\n */\n isFrontFacingTo(direction, epsilon) {\n const dot = Vector3.Dot(this.normal, direction);\n return dot <= epsilon;\n }\n /**\n * Calculates the distance to a point\n * @param point point to calculate distance to\n * @returns the signed distance (float) from the given point to the Plane.\n */\n signedDistanceTo(point) {\n return Vector3.Dot(point, this.normal) + this.d;\n }\n // Statics\n /**\n * Creates a plane from an array\n * @param array the array to create a plane from\n * @returns a new Plane from the given array.\n */\n static FromArray(array) {\n return new Plane(array[0], array[1], array[2], array[3]);\n }\n /**\n * Creates a plane from three points\n * @param point1 point used to create the plane\n * @param point2 point used to create the plane\n * @param point3 point used to create the plane\n * @returns a new Plane defined by the three given points.\n */\n static FromPoints(point1, point2, point3) {\n const result = new Plane(0.0, 0.0, 0.0, 0.0);\n result.copyFromPoints(point1, point2, point3);\n return result;\n }\n /**\n * Creates a plane from an origin point and a normal\n * @param origin origin of the plane to be constructed\n * @param normal normal of the plane to be constructed\n * @returns a new Plane the normal vector to this plane at the given origin point.\n * Note : the vector \"normal\" is updated because normalized.\n */\n static FromPositionAndNormal(origin, normal) {\n const result = new Plane(0.0, 0.0, 0.0, 0.0);\n normal.normalize();\n result.normal = normal;\n result.d = -(normal.x * origin.x + normal.y * origin.y + normal.z * origin.z);\n return result;\n }\n /**\n * Calculates the distance from a plane and a point\n * @param origin origin of the plane to be constructed\n * @param normal normal of the plane to be constructed\n * @param point point to calculate distance to\n * @returns the signed distance between the plane defined by the normal vector at the \"origin\"\" point and the given other point.\n */\n static SignedDistanceToPlaneFromPositionAndNormal(origin, normal, point) {\n const d = -(normal.x * origin.x + normal.y * origin.y + normal.z * origin.z);\n return Vector3.Dot(point, normal) + d;\n }\n}\nPlane._TmpMatrix = Matrix.Identity();\n//# sourceMappingURL=math.plane.js.map","import { Plane } from \"./math.plane.js\";\n/**\n * Represents a camera frustum\n */\nexport class Frustum {\n /**\n * Gets the planes representing the frustum\n * @param transform matrix to be applied to the returned planes\n * @returns a new array of 6 Frustum planes computed by the given transformation matrix.\n */\n static GetPlanes(transform) {\n const frustumPlanes = [];\n for (let index = 0; index < 6; index++) {\n frustumPlanes.push(new Plane(0.0, 0.0, 0.0, 0.0));\n }\n Frustum.GetPlanesToRef(transform, frustumPlanes);\n return frustumPlanes;\n }\n /**\n * Gets the near frustum plane transformed by the transform matrix\n * @param transform transformation matrix to be applied to the resulting frustum plane\n * @param frustumPlane the resulting frustum plane\n */\n static GetNearPlaneToRef(transform, frustumPlane) {\n const m = transform.m;\n frustumPlane.normal.x = m[3] + m[2];\n frustumPlane.normal.y = m[7] + m[6];\n frustumPlane.normal.z = m[11] + m[10];\n frustumPlane.d = m[15] + m[14];\n frustumPlane.normalize();\n }\n /**\n * Gets the far frustum plane transformed by the transform matrix\n * @param transform transformation matrix to be applied to the resulting frustum plane\n * @param frustumPlane the resulting frustum plane\n */\n static GetFarPlaneToRef(transform, frustumPlane) {\n const m = transform.m;\n frustumPlane.normal.x = m[3] - m[2];\n frustumPlane.normal.y = m[7] - m[6];\n frustumPlane.normal.z = m[11] - m[10];\n frustumPlane.d = m[15] - m[14];\n frustumPlane.normalize();\n }\n /**\n * Gets the left frustum plane transformed by the transform matrix\n * @param transform transformation matrix to be applied to the resulting frustum plane\n * @param frustumPlane the resulting frustum plane\n */\n static GetLeftPlaneToRef(transform, frustumPlane) {\n const m = transform.m;\n frustumPlane.normal.x = m[3] + m[0];\n frustumPlane.normal.y = m[7] + m[4];\n frustumPlane.normal.z = m[11] + m[8];\n frustumPlane.d = m[15] + m[12];\n frustumPlane.normalize();\n }\n /**\n * Gets the right frustum plane transformed by the transform matrix\n * @param transform transformation matrix to be applied to the resulting frustum plane\n * @param frustumPlane the resulting frustum plane\n */\n static GetRightPlaneToRef(transform, frustumPlane) {\n const m = transform.m;\n frustumPlane.normal.x = m[3] - m[0];\n frustumPlane.normal.y = m[7] - m[4];\n frustumPlane.normal.z = m[11] - m[8];\n frustumPlane.d = m[15] - m[12];\n frustumPlane.normalize();\n }\n /**\n * Gets the top frustum plane transformed by the transform matrix\n * @param transform transformation matrix to be applied to the resulting frustum plane\n * @param frustumPlane the resulting frustum plane\n */\n static GetTopPlaneToRef(transform, frustumPlane) {\n const m = transform.m;\n frustumPlane.normal.x = m[3] - m[1];\n frustumPlane.normal.y = m[7] - m[5];\n frustumPlane.normal.z = m[11] - m[9];\n frustumPlane.d = m[15] - m[13];\n frustumPlane.normalize();\n }\n /**\n * Gets the bottom frustum plane transformed by the transform matrix\n * @param transform transformation matrix to be applied to the resulting frustum plane\n * @param frustumPlane the resulting frustum plane\n */\n static GetBottomPlaneToRef(transform, frustumPlane) {\n const m = transform.m;\n frustumPlane.normal.x = m[3] + m[1];\n frustumPlane.normal.y = m[7] + m[5];\n frustumPlane.normal.z = m[11] + m[9];\n frustumPlane.d = m[15] + m[13];\n frustumPlane.normalize();\n }\n /**\n * Sets the given array \"frustumPlanes\" with the 6 Frustum planes computed by the given transformation matrix.\n * @param transform transformation matrix to be applied to the resulting frustum planes\n * @param frustumPlanes the resulting frustum planes\n */\n static GetPlanesToRef(transform, frustumPlanes) {\n // Near\n Frustum.GetNearPlaneToRef(transform, frustumPlanes[0]);\n // Far\n Frustum.GetFarPlaneToRef(transform, frustumPlanes[1]);\n // Left\n Frustum.GetLeftPlaneToRef(transform, frustumPlanes[2]);\n // Right\n Frustum.GetRightPlaneToRef(transform, frustumPlanes[3]);\n // Top\n Frustum.GetTopPlaneToRef(transform, frustumPlanes[4]);\n // Bottom\n Frustum.GetBottomPlaneToRef(transform, frustumPlanes[5]);\n }\n /**\n * Tests if a point is located between the frustum planes.\n * @param point defines the point to test\n * @param frustumPlanes defines the frustum planes to test\n * @returns true if the point is located between the frustum planes\n */\n static IsPointInFrustum(point, frustumPlanes) {\n for (let i = 0; i < 6; i++) {\n if (frustumPlanes[i].dotCoordinate(point) < 0) {\n return false;\n }\n }\n return true;\n }\n}\n//# sourceMappingURL=math.frustum.js.map","/**\n * Helper class used to generate session unique ID\n */\nexport class UniqueIdGenerator {\n /**\n * Gets an unique (relatively to the current scene) Id\n */\n static get UniqueId() {\n const result = this._UniqueIdCounter;\n this._UniqueIdCounter++;\n return result;\n }\n}\n// Statics\nUniqueIdGenerator._UniqueIdCounter = 1;\n//# sourceMappingURL=uniqueIdGenerator.js.map","/** Defines the cross module constantsused by lights to avoid circular dependencies */\nexport class LightConstants {\n /**\n * Sort function to order lights for rendering.\n * @param a First Light object to compare to second.\n * @param b Second Light object to compare first.\n * @returns -1 to reduce's a's index relative to be, 0 for no change, 1 to increase a's index relative to b.\n */\n static CompareLightsPriority(a, b) {\n //shadow-casting lights have priority over non-shadow-casting lights\n //the renderPriority is a secondary sort criterion\n if (a.shadowEnabled !== b.shadowEnabled) {\n return (b.shadowEnabled ? 1 : 0) - (a.shadowEnabled ? 1 : 0);\n }\n return b.renderPriority - a.renderPriority;\n }\n}\n/**\n * Falloff Default: light is falling off following the material specification:\n * standard material is using standard falloff whereas pbr material can request special falloff per materials.\n */\nLightConstants.FALLOFF_DEFAULT = 0;\n/**\n * Falloff Physical: light is falling off following the inverse squared distance law.\n */\nLightConstants.FALLOFF_PHYSICAL = 1;\n/**\n * Falloff gltf: light is falling off as described in the gltf moving to PBR document\n * to enhance interoperability with other engines.\n */\nLightConstants.FALLOFF_GLTF = 2;\n/**\n * Falloff Standard: light is falling off like in the standard material\n * to enhance interoperability with other materials.\n */\nLightConstants.FALLOFF_STANDARD = 3;\n//lightmapMode Consts\n/**\n * If every light affecting the material is in this lightmapMode,\n * material.lightmapTexture adds or multiplies\n * (depends on material.useLightmapAsShadowmap)\n * after every other light calculations.\n */\nLightConstants.LIGHTMAP_DEFAULT = 0;\n/**\n * material.lightmapTexture as only diffuse lighting from this light\n * adds only specular lighting from this light\n * adds dynamic shadows\n */\nLightConstants.LIGHTMAP_SPECULAR = 1;\n/**\n * material.lightmapTexture as only lighting\n * no light calculation from this light\n * only adds dynamic shadows from this light\n */\nLightConstants.LIGHTMAP_SHADOWSONLY = 2;\n// Intensity Mode Consts\n/**\n * Each light type uses the default quantity according to its type:\n * point/spot lights use luminous intensity\n * directional lights use illuminance\n */\nLightConstants.INTENSITYMODE_AUTOMATIC = 0;\n/**\n * lumen (lm)\n */\nLightConstants.INTENSITYMODE_LUMINOUSPOWER = 1;\n/**\n * candela (lm/sr)\n */\nLightConstants.INTENSITYMODE_LUMINOUSINTENSITY = 2;\n/**\n * lux (lm/m^2)\n */\nLightConstants.INTENSITYMODE_ILLUMINANCE = 3;\n/**\n * nit (cd/m^2)\n */\nLightConstants.INTENSITYMODE_LUMINANCE = 4;\n// Light types ids const.\n/**\n * Light type const id of the point light.\n */\nLightConstants.LIGHTTYPEID_POINTLIGHT = 0;\n/**\n * Light type const id of the directional light.\n */\nLightConstants.LIGHTTYPEID_DIRECTIONALLIGHT = 1;\n/**\n * Light type const id of the spot light.\n */\nLightConstants.LIGHTTYPEID_SPOTLIGHT = 2;\n/**\n * Light type const id of the hemispheric light.\n */\nLightConstants.LIGHTTYPEID_HEMISPHERICLIGHT = 3;\n//# sourceMappingURL=lightConstants.js.map","/**\n * Class used to store configuration data associated with pointer picking\n */\nexport class PointerPickingConfiguration {\n constructor() {\n /**\n * Gets or sets a predicate used to select candidate meshes for a pointer down event\n */\n this.pointerDownFastCheck = false;\n /**\n * Gets or sets a predicate used to select candidate meshes for a pointer up event\n */\n this.pointerUpFastCheck = false;\n /**\n * Gets or sets a predicate used to select candidate meshes for a pointer move event\n */\n this.pointerMoveFastCheck = false;\n /**\n * Gets or sets a boolean indicating if the user want to entirely skip the picking phase when a pointer move event occurs.\n */\n this.skipPointerMovePicking = false;\n /**\n * Gets or sets a boolean indicating if the user want to entirely skip the picking phase when a pointer down event occurs.\n */\n this.skipPointerDownPicking = false;\n /**\n * Gets or sets a boolean indicating if the user want to entirely skip the picking phase when a pointer up event occurs. Off by default.\n */\n this.skipPointerUpPicking = false;\n }\n}\n//# sourceMappingURL=pointerPickingConfiguration.js.map","import { Tools } from \"./Misc/tools.js\";\nimport { PrecisionDate } from \"./Misc/precisionDate.js\";\nimport { Observable } from \"./Misc/observable.js\";\nimport { SmartArrayNoDuplicate, SmartArray } from \"./Misc/smartArray.js\";\nimport { StringDictionary } from \"./Misc/stringDictionary.js\";\nimport { Tags } from \"./Misc/tags.js\";\nimport { Vector3, Matrix, TmpVectors } from \"./Maths/math.vector.js\";\nimport { AbstractScene } from \"./abstractScene.js\";\nimport { ImageProcessingConfiguration } from \"./Materials/imageProcessingConfiguration.js\";\nimport { UniformBuffer } from \"./Materials/uniformBuffer.js\";\nimport { PickingInfo } from \"./Collisions/pickingInfo.js\";\nimport { ActionEvent } from \"./Actions/actionEvent.js\";\nimport { PostProcessManager } from \"./PostProcesses/postProcessManager.js\";\nimport { RenderingManager } from \"./Rendering/renderingManager.js\";\nimport { Stage } from \"./sceneComponent.js\";\n\nimport { IsWindowObjectExist } from \"./Misc/domManagement.js\";\nimport { EngineStore } from \"./Engines/engineStore.js\";\nimport { _WarnImport } from \"./Misc/devTools.js\";\nimport { InputManager } from \"./Inputs/scene.inputManager.js\";\nimport { PerfCounter } from \"./Misc/perfCounter.js\";\nimport { Color4, Color3 } from \"./Maths/math.color.js\";\nimport { Frustum } from \"./Maths/math.frustum.js\";\nimport { UniqueIdGenerator } from \"./Misc/uniqueIdGenerator.js\";\nimport { ReadFile, RequestFile, LoadFile } from \"./Misc/fileTools.js\";\nimport { LightConstants } from \"./Lights/lightConstants.js\";\nimport { _ObserveArray } from \"./Misc/arrayTools.js\";\nimport { PointerPickingConfiguration } from \"./Inputs/pointerPickingConfiguration.js\";\n/**\n * Define how the scene should favor performance over ease of use\n */\nexport var ScenePerformancePriority;\n(function (ScenePerformancePriority) {\n /** Default mode. No change. Performance will be treated as less important than backward compatibility */\n ScenePerformancePriority[ScenePerformancePriority[\"BackwardCompatible\"] = 0] = \"BackwardCompatible\";\n /** Some performance options will be turned on trying to strike a balance between perf and ease of use */\n ScenePerformancePriority[ScenePerformancePriority[\"Intermediate\"] = 1] = \"Intermediate\";\n /** Performance will be top priority */\n ScenePerformancePriority[ScenePerformancePriority[\"Aggressive\"] = 2] = \"Aggressive\";\n})(ScenePerformancePriority || (ScenePerformancePriority = {}));\n/**\n * Represents a scene to be rendered by the engine.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene\n */\nexport class Scene extends AbstractScene {\n /**\n * Factory used to create the default material.\n * @param scene The scene to create the material for\n * @returns The default material\n */\n static DefaultMaterialFactory(scene) {\n throw _WarnImport(\"StandardMaterial\");\n }\n /**\n * Factory used to create the a collision coordinator.\n * @returns The collision coordinator\n */\n static CollisionCoordinatorFactory() {\n throw _WarnImport(\"DefaultCollisionCoordinator\");\n }\n /**\n * Texture used in all pbr material as the reflection texture.\n * As in the majority of the scene they are the same (exception for multi room and so on),\n * this is easier to reference from here than from all the materials.\n */\n get environmentTexture() {\n return this._environmentTexture;\n }\n /**\n * Texture used in all pbr material as the reflection texture.\n * As in the majority of the scene they are the same (exception for multi room and so on),\n * this is easier to set here than in all the materials.\n */\n set environmentTexture(value) {\n if (this._environmentTexture === value) {\n return;\n }\n this._environmentTexture = value;\n this.markAllMaterialsAsDirty(1);\n }\n /**\n * Default image processing configuration used either in the rendering\n * Forward main pass or through the imageProcessingPostProcess if present.\n * As in the majority of the scene they are the same (exception for multi camera),\n * this is easier to reference from here than from all the materials and post process.\n *\n * No setter as we it is a shared configuration, you can set the values instead.\n */\n get imageProcessingConfiguration() {\n return this._imageProcessingConfiguration;\n }\n /**\n * Gets or sets a value indicating how to treat performance relatively to ease of use and backward compatibility\n */\n get performancePriority() {\n return this._performancePriority;\n }\n set performancePriority(value) {\n if (value === this._performancePriority) {\n return;\n }\n this._performancePriority = value;\n switch (value) {\n case ScenePerformancePriority.BackwardCompatible:\n this.skipFrustumClipping = false;\n this._renderingManager.maintainStateBetweenFrames = false;\n this.skipPointerMovePicking = false;\n this.autoClear = true;\n break;\n case ScenePerformancePriority.Intermediate:\n this.skipFrustumClipping = false;\n this._renderingManager.maintainStateBetweenFrames = false;\n this.skipPointerMovePicking = true;\n this.autoClear = false;\n break;\n case ScenePerformancePriority.Aggressive:\n this.skipFrustumClipping = true;\n this._renderingManager.maintainStateBetweenFrames = true;\n this.skipPointerMovePicking = true;\n this.autoClear = false;\n break;\n }\n this.onScenePerformancePriorityChangedObservable.notifyObservers(value);\n }\n /**\n * Gets or sets a boolean indicating if all rendering must be done in wireframe\n */\n set forceWireframe(value) {\n if (this._forceWireframe === value) {\n return;\n }\n this._forceWireframe = value;\n this.markAllMaterialsAsDirty(16);\n }\n get forceWireframe() {\n return this._forceWireframe;\n }\n /**\n * Gets or sets a boolean indicating if we should skip the frustum clipping part of the active meshes selection\n */\n set skipFrustumClipping(value) {\n if (this._skipFrustumClipping === value) {\n return;\n }\n this._skipFrustumClipping = value;\n }\n get skipFrustumClipping() {\n return this._skipFrustumClipping;\n }\n /**\n * Gets or sets a boolean indicating if all rendering must be done in point cloud\n */\n set forcePointsCloud(value) {\n if (this._forcePointsCloud === value) {\n return;\n }\n this._forcePointsCloud = value;\n this.markAllMaterialsAsDirty(16);\n }\n get forcePointsCloud() {\n return this._forcePointsCloud;\n }\n /**\n * Gets or sets the animation properties override\n */\n get animationPropertiesOverride() {\n return this._animationPropertiesOverride;\n }\n set animationPropertiesOverride(value) {\n this._animationPropertiesOverride = value;\n }\n /** Sets a function to be executed when this scene is disposed. */\n set onDispose(callback) {\n if (this._onDisposeObserver) {\n this.onDisposeObservable.remove(this._onDisposeObserver);\n }\n this._onDisposeObserver = this.onDisposeObservable.add(callback);\n }\n /** Sets a function to be executed before rendering this scene */\n set beforeRender(callback) {\n if (this._onBeforeRenderObserver) {\n this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver);\n }\n if (callback) {\n this._onBeforeRenderObserver = this.onBeforeRenderObservable.add(callback);\n }\n }\n /** Sets a function to be executed after rendering this scene */\n set afterRender(callback) {\n if (this._onAfterRenderObserver) {\n this.onAfterRenderObservable.remove(this._onAfterRenderObserver);\n }\n if (callback) {\n this._onAfterRenderObserver = this.onAfterRenderObservable.add(callback);\n }\n }\n /** Sets a function to be executed before rendering a camera*/\n set beforeCameraRender(callback) {\n if (this._onBeforeCameraRenderObserver) {\n this.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver);\n }\n this._onBeforeCameraRenderObserver = this.onBeforeCameraRenderObservable.add(callback);\n }\n /** Sets a function to be executed after rendering a camera*/\n set afterCameraRender(callback) {\n if (this._onAfterCameraRenderObserver) {\n this.onAfterCameraRenderObservable.remove(this._onAfterCameraRenderObserver);\n }\n this._onAfterCameraRenderObserver = this.onAfterCameraRenderObservable.add(callback);\n }\n /**\n * Gets or sets a predicate used to select candidate meshes for a pointer down event\n */\n get pointerDownPredicate() {\n return this._pointerPickingConfiguration.pointerDownPredicate;\n }\n set pointerDownPredicate(value) {\n this._pointerPickingConfiguration.pointerDownPredicate = value;\n }\n /**\n * Gets or sets a predicate used to select candidate meshes for a pointer up event\n */\n get pointerUpPredicate() {\n return this._pointerPickingConfiguration.pointerUpPredicate;\n }\n set pointerUpPredicate(value) {\n this._pointerPickingConfiguration.pointerUpPredicate = value;\n }\n /**\n * Gets or sets a predicate used to select candidate meshes for a pointer move event\n */\n get pointerMovePredicate() {\n return this._pointerPickingConfiguration.pointerMovePredicate;\n }\n set pointerMovePredicate(value) {\n this._pointerPickingConfiguration.pointerMovePredicate = value;\n }\n /**\n * Gets or sets a predicate used to select candidate meshes for a pointer down event\n */\n get pointerDownFastCheck() {\n return this._pointerPickingConfiguration.pointerDownFastCheck;\n }\n set pointerDownFastCheck(value) {\n this._pointerPickingConfiguration.pointerDownFastCheck = value;\n }\n /**\n * Gets or sets a predicate used to select candidate meshes for a pointer up event\n */\n get pointerUpFastCheck() {\n return this._pointerPickingConfiguration.pointerUpFastCheck;\n }\n set pointerUpFastCheck(value) {\n this._pointerPickingConfiguration.pointerUpFastCheck = value;\n }\n /**\n * Gets or sets a predicate used to select candidate meshes for a pointer move event\n */\n get pointerMoveFastCheck() {\n return this._pointerPickingConfiguration.pointerMoveFastCheck;\n }\n set pointerMoveFastCheck(value) {\n this._pointerPickingConfiguration.pointerMoveFastCheck = value;\n }\n /**\n * Gets or sets a boolean indicating if the user want to entirely skip the picking phase when a pointer move event occurs.\n */\n get skipPointerMovePicking() {\n return this._pointerPickingConfiguration.skipPointerMovePicking;\n }\n set skipPointerMovePicking(value) {\n this._pointerPickingConfiguration.skipPointerMovePicking = value;\n }\n /**\n * Gets or sets a boolean indicating if the user want to entirely skip the picking phase when a pointer down event occurs.\n */\n get skipPointerDownPicking() {\n return this._pointerPickingConfiguration.skipPointerDownPicking;\n }\n set skipPointerDownPicking(value) {\n this._pointerPickingConfiguration.skipPointerDownPicking = value;\n }\n /**\n * Gets or sets a boolean indicating if the user want to entirely skip the picking phase when a pointer up event occurs. Off by default.\n */\n get skipPointerUpPicking() {\n return this._pointerPickingConfiguration.skipPointerUpPicking;\n }\n set skipPointerUpPicking(value) {\n this._pointerPickingConfiguration.skipPointerUpPicking = value;\n }\n /**\n * Gets the pointer coordinates without any translation (ie. straight out of the pointer event)\n */\n get unTranslatedPointer() {\n return this._inputManager.unTranslatedPointer;\n }\n /**\n * Gets or sets the distance in pixel that you have to move to prevent some events. Default is 10 pixels\n */\n static get DragMovementThreshold() {\n return InputManager.DragMovementThreshold;\n }\n static set DragMovementThreshold(value) {\n InputManager.DragMovementThreshold = value;\n }\n /**\n * Time in milliseconds to wait to raise long press events if button is still pressed. Default is 500 ms\n */\n static get LongPressDelay() {\n return InputManager.LongPressDelay;\n }\n static set LongPressDelay(value) {\n InputManager.LongPressDelay = value;\n }\n /**\n * Time in milliseconds to wait to raise long press events if button is still pressed. Default is 300 ms\n */\n static get DoubleClickDelay() {\n return InputManager.DoubleClickDelay;\n }\n static set DoubleClickDelay(value) {\n InputManager.DoubleClickDelay = value;\n }\n /** If you need to check double click without raising a single click at first click, enable this flag */\n static get ExclusiveDoubleClickMode() {\n return InputManager.ExclusiveDoubleClickMode;\n }\n static set ExclusiveDoubleClickMode(value) {\n InputManager.ExclusiveDoubleClickMode = value;\n }\n /**\n * Bind the current view position to an effect.\n * @param effect The effect to be bound\n * @param variableName name of the shader variable that will hold the eye position\n * @param isVector3 true to indicates that variableName is a Vector3 and not a Vector4\n * @returns the computed eye position\n */\n bindEyePosition(effect, variableName = \"vEyePosition\", isVector3 = false) {\n var _a;\n const eyePosition = this._forcedViewPosition\n ? this._forcedViewPosition\n : this._mirroredCameraPosition\n ? this._mirroredCameraPosition\n : (_a = this.activeCamera.globalPosition) !== null && _a !== void 0 ? _a : this.activeCamera.devicePosition;\n const invertNormal = this.useRightHandedSystem === (this._mirroredCameraPosition != null);\n TmpVectors.Vector4[0].set(eyePosition.x, eyePosition.y, eyePosition.z, invertNormal ? -1 : 1);\n if (effect) {\n if (isVector3) {\n effect.setFloat3(variableName, TmpVectors.Vector4[0].x, TmpVectors.Vector4[0].y, TmpVectors.Vector4[0].z);\n }\n else {\n effect.setVector4(variableName, TmpVectors.Vector4[0]);\n }\n }\n return TmpVectors.Vector4[0];\n }\n /**\n * Update the scene ubo before it can be used in rendering processing\n * @returns the scene UniformBuffer\n */\n finalizeSceneUbo() {\n const ubo = this.getSceneUniformBuffer();\n const eyePosition = this.bindEyePosition(null);\n ubo.updateFloat4(\"vEyePosition\", eyePosition.x, eyePosition.y, eyePosition.z, eyePosition.w);\n ubo.update();\n return ubo;\n }\n /**\n * Gets or sets a boolean indicating if the scene must use right-handed coordinates system\n */\n set useRightHandedSystem(value) {\n if (this._useRightHandedSystem === value) {\n return;\n }\n this._useRightHandedSystem = value;\n this.markAllMaterialsAsDirty(16);\n }\n get useRightHandedSystem() {\n return this._useRightHandedSystem;\n }\n /**\n * Sets the step Id used by deterministic lock step\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#deterministic-lockstep\n * @param newStepId defines the step Id\n */\n setStepId(newStepId) {\n this._currentStepId = newStepId;\n }\n /**\n * Gets the step Id used by deterministic lock step\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#deterministic-lockstep\n * @returns the step Id\n */\n getStepId() {\n return this._currentStepId;\n }\n /**\n * Gets the internal step used by deterministic lock step\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#deterministic-lockstep\n * @returns the internal step\n */\n getInternalStep() {\n return this._currentInternalStep;\n }\n /**\n * Gets or sets a boolean indicating if fog is enabled on this scene\n * @see https://doc.babylonjs.com/features/featuresDeepDive/environment/environment_introduction#fog\n * (Default is true)\n */\n set fogEnabled(value) {\n if (this._fogEnabled === value) {\n return;\n }\n this._fogEnabled = value;\n this.markAllMaterialsAsDirty(16);\n }\n get fogEnabled() {\n return this._fogEnabled;\n }\n /**\n * Gets or sets the fog mode to use\n * @see https://doc.babylonjs.com/features/featuresDeepDive/environment/environment_introduction#fog\n * | mode | value |\n * | --- | --- |\n * | FOGMODE_NONE | 0 |\n * | FOGMODE_EXP | 1 |\n * | FOGMODE_EXP2 | 2 |\n * | FOGMODE_LINEAR | 3 |\n */\n set fogMode(value) {\n if (this._fogMode === value) {\n return;\n }\n this._fogMode = value;\n this.markAllMaterialsAsDirty(16);\n }\n get fogMode() {\n return this._fogMode;\n }\n /**\n * Flag indicating that the frame buffer binding is handled by another component\n */\n get prePass() {\n return !!this.prePassRenderer && this.prePassRenderer.defaultRT.enabled;\n }\n /**\n * Gets or sets a boolean indicating if shadows are enabled on this scene\n */\n set shadowsEnabled(value) {\n if (this._shadowsEnabled === value) {\n return;\n }\n this._shadowsEnabled = value;\n this.markAllMaterialsAsDirty(2);\n }\n get shadowsEnabled() {\n return this._shadowsEnabled;\n }\n /**\n * Gets or sets a boolean indicating if lights are enabled on this scene\n */\n set lightsEnabled(value) {\n if (this._lightsEnabled === value) {\n return;\n }\n this._lightsEnabled = value;\n this.markAllMaterialsAsDirty(2);\n }\n get lightsEnabled() {\n return this._lightsEnabled;\n }\n /** All of the active cameras added to this scene. */\n get activeCameras() {\n return this._activeCameras;\n }\n set activeCameras(cameras) {\n if (this._unObserveActiveCameras) {\n this._unObserveActiveCameras();\n this._unObserveActiveCameras = null;\n }\n if (cameras) {\n this._unObserveActiveCameras = _ObserveArray(cameras, () => {\n this.onActiveCamerasChanged.notifyObservers(this);\n });\n }\n this._activeCameras = cameras;\n }\n /** Gets or sets the current active camera */\n get activeCamera() {\n return this._activeCamera;\n }\n set activeCamera(value) {\n if (value === this._activeCamera) {\n return;\n }\n this._activeCamera = value;\n this.onActiveCameraChanged.notifyObservers(this);\n }\n /** The default material used on meshes when no material is affected */\n get defaultMaterial() {\n if (!this._defaultMaterial) {\n this._defaultMaterial = Scene.DefaultMaterialFactory(this);\n }\n return this._defaultMaterial;\n }\n /** The default material used on meshes when no material is affected */\n set defaultMaterial(value) {\n this._defaultMaterial = value;\n }\n /**\n * Gets or sets a boolean indicating if textures are enabled on this scene\n */\n set texturesEnabled(value) {\n if (this._texturesEnabled === value) {\n return;\n }\n this._texturesEnabled = value;\n this.markAllMaterialsAsDirty(1);\n }\n get texturesEnabled() {\n return this._texturesEnabled;\n }\n /**\n * Gets or sets a boolean indicating if skeletons are enabled on this scene\n */\n set skeletonsEnabled(value) {\n if (this._skeletonsEnabled === value) {\n return;\n }\n this._skeletonsEnabled = value;\n this.markAllMaterialsAsDirty(8);\n }\n get skeletonsEnabled() {\n return this._skeletonsEnabled;\n }\n /** @internal */\n get collisionCoordinator() {\n if (!this._collisionCoordinator) {\n this._collisionCoordinator = Scene.CollisionCoordinatorFactory();\n this._collisionCoordinator.init(this);\n }\n return this._collisionCoordinator;\n }\n /**\n * Gets the scene's rendering manager\n */\n get renderingManager() {\n return this._renderingManager;\n }\n /**\n * Gets the list of frustum planes (built from the active camera)\n */\n get frustumPlanes() {\n return this._frustumPlanes;\n }\n /**\n * Registers the transient components if needed.\n */\n _registerTransientComponents() {\n // Register components that have been associated lately to the scene.\n if (this._transientComponents.length > 0) {\n for (const component of this._transientComponents) {\n component.register();\n }\n this._transientComponents.length = 0;\n }\n }\n /**\n * @internal\n * Add a component to the scene.\n * Note that the ccomponent could be registered on th next frame if this is called after\n * the register component stage.\n * @param component Defines the component to add to the scene\n */\n _addComponent(component) {\n this._components.push(component);\n this._transientComponents.push(component);\n const serializableComponent = component;\n if (serializableComponent.addFromContainer && serializableComponent.serialize) {\n this._serializableComponents.push(serializableComponent);\n }\n }\n /**\n * @internal\n * Gets a component from the scene.\n * @param name defines the name of the component to retrieve\n * @returns the component or null if not present\n */\n _getComponent(name) {\n for (const component of this._components) {\n if (component.name === name) {\n return component;\n }\n }\n return null;\n }\n /**\n * Creates a new Scene\n * @param engine defines the engine to use to render this scene\n * @param options defines the scene options\n */\n constructor(engine, options) {\n super();\n // Members\n /** @internal */\n this._inputManager = new InputManager(this);\n /** Define this parameter if you are using multiple cameras and you want to specify which one should be used for pointer position */\n this.cameraToUseForPointers = null;\n /** @internal */\n this._isScene = true;\n /** @internal */\n this._blockEntityCollection = false;\n /**\n * Gets or sets a boolean that indicates if the scene must clear the render buffer before rendering a frame\n */\n this.autoClear = true;\n /**\n * Gets or sets a boolean that indicates if the scene must clear the depth and stencil buffers before rendering a frame\n */\n this.autoClearDepthAndStencil = true;\n /**\n * Defines the color used to clear the render buffer (Default is (0.2, 0.2, 0.3, 1.0))\n */\n this.clearColor = new Color4(0.2, 0.2, 0.3, 1.0);\n /**\n * Defines the color used to simulate the ambient color (Default is (0, 0, 0))\n */\n this.ambientColor = new Color3(0, 0, 0);\n /**\n * Intensity of the environment in all pbr material.\n * This dims or reinforces the IBL lighting overall (reflection and diffuse).\n * As in the majority of the scene they are the same (exception for multi room and so on),\n * this is easier to reference from here than from all the materials.\n */\n this.environmentIntensity = 1;\n this._performancePriority = ScenePerformancePriority.BackwardCompatible;\n /**\n * Observable triggered when the performance priority is changed\n */\n this.onScenePerformancePriorityChangedObservable = new Observable();\n this._forceWireframe = false;\n this._skipFrustumClipping = false;\n this._forcePointsCloud = false;\n /**\n * Gets or sets a boolean indicating if animations are enabled\n */\n this.animationsEnabled = true;\n this._animationPropertiesOverride = null;\n /**\n * Gets or sets a boolean indicating if a constant deltatime has to be used\n * This is mostly useful for testing purposes when you do not want the animations to scale with the framerate\n */\n this.useConstantAnimationDeltaTime = false;\n /**\n * Gets or sets a boolean indicating if the scene must keep the meshUnderPointer property updated\n * Please note that it requires to run a ray cast through the scene on every frame\n */\n this.constantlyUpdateMeshUnderPointer = false;\n /**\n * Defines the HTML cursor to use when hovering over interactive elements\n */\n this.hoverCursor = \"pointer\";\n /**\n * Defines the HTML default cursor to use (empty by default)\n */\n this.defaultCursor = \"\";\n /**\n * Defines whether cursors are handled by the scene.\n */\n this.doNotHandleCursors = false;\n /**\n * This is used to call preventDefault() on pointer down\n * in order to block unwanted artifacts like system double clicks\n */\n this.preventDefaultOnPointerDown = true;\n /**\n * This is used to call preventDefault() on pointer up\n * in order to block unwanted artifacts like system double clicks\n */\n this.preventDefaultOnPointerUp = true;\n // Metadata\n /**\n * Gets or sets user defined metadata\n */\n this.metadata = null;\n /**\n * For internal use only. Please do not use.\n */\n this.reservedDataStore = null;\n /**\n * Use this array to add regular expressions used to disable offline support for specific urls\n */\n this.disableOfflineSupportExceptionRules = new Array();\n /**\n * An event triggered when the scene is disposed.\n */\n this.onDisposeObservable = new Observable();\n this._onDisposeObserver = null;\n /**\n * An event triggered before rendering the scene (right after animations and physics)\n */\n this.onBeforeRenderObservable = new Observable();\n this._onBeforeRenderObserver = null;\n /**\n * An event triggered after rendering the scene\n */\n this.onAfterRenderObservable = new Observable();\n /**\n * An event triggered after rendering the scene for an active camera (When scene.render is called this will be called after each camera)\n * This is triggered for each \"sub\" camera in a Camera Rig unlike onAfterCameraRenderObservable\n */\n this.onAfterRenderCameraObservable = new Observable();\n this._onAfterRenderObserver = null;\n /**\n * An event triggered before animating the scene\n */\n this.onBeforeAnimationsObservable = new Observable();\n /**\n * An event triggered after animations processing\n */\n this.onAfterAnimationsObservable = new Observable();\n /**\n * An event triggered before draw calls are ready to be sent\n */\n this.onBeforeDrawPhaseObservable = new Observable();\n /**\n * An event triggered after draw calls have been sent\n */\n this.onAfterDrawPhaseObservable = new Observable();\n /**\n * An event triggered when the scene is ready\n */\n this.onReadyObservable = new Observable();\n /**\n * An event triggered before rendering a camera\n */\n this.onBeforeCameraRenderObservable = new Observable();\n this._onBeforeCameraRenderObserver = null;\n /**\n * An event triggered after rendering a camera\n * This is triggered for the full rig Camera only unlike onAfterRenderCameraObservable\n */\n this.onAfterCameraRenderObservable = new Observable();\n this._onAfterCameraRenderObserver = null;\n /**\n * An event triggered when active meshes evaluation is about to start\n */\n this.onBeforeActiveMeshesEvaluationObservable = new Observable();\n /**\n * An event triggered when active meshes evaluation is done\n */\n this.onAfterActiveMeshesEvaluationObservable = new Observable();\n /**\n * An event triggered when particles rendering is about to start\n * Note: This event can be trigger more than once per frame (because particles can be rendered by render target textures as well)\n */\n this.onBeforeParticlesRenderingObservable = new Observable();\n /**\n * An event triggered when particles rendering is done\n * Note: This event can be trigger more than once per frame (because particles can be rendered by render target textures as well)\n */\n this.onAfterParticlesRenderingObservable = new Observable();\n /**\n * An event triggered when SceneLoader.Append or SceneLoader.Load or SceneLoader.ImportMesh were successfully executed\n */\n this.onDataLoadedObservable = new Observable();\n /**\n * An event triggered when a camera is created\n */\n this.onNewCameraAddedObservable = new Observable();\n /**\n * An event triggered when a camera is removed\n */\n this.onCameraRemovedObservable = new Observable();\n /**\n * An event triggered when a light is created\n */\n this.onNewLightAddedObservable = new Observable();\n /**\n * An event triggered when a light is removed\n */\n this.onLightRemovedObservable = new Observable();\n /**\n * An event triggered when a geometry is created\n */\n this.onNewGeometryAddedObservable = new Observable();\n /**\n * An event triggered when a geometry is removed\n */\n this.onGeometryRemovedObservable = new Observable();\n /**\n * An event triggered when a transform node is created\n */\n this.onNewTransformNodeAddedObservable = new Observable();\n /**\n * An event triggered when a transform node is removed\n */\n this.onTransformNodeRemovedObservable = new Observable();\n /**\n * An event triggered when a mesh is created\n */\n this.onNewMeshAddedObservable = new Observable();\n /**\n * An event triggered when a mesh is removed\n */\n this.onMeshRemovedObservable = new Observable();\n /**\n * An event triggered when a skeleton is created\n */\n this.onNewSkeletonAddedObservable = new Observable();\n /**\n * An event triggered when a skeleton is removed\n */\n this.onSkeletonRemovedObservable = new Observable();\n /**\n * An event triggered when a material is created\n */\n this.onNewMaterialAddedObservable = new Observable();\n /**\n * An event triggered when a multi material is created\n */\n this.onNewMultiMaterialAddedObservable = new Observable();\n /**\n * An event triggered when a material is removed\n */\n this.onMaterialRemovedObservable = new Observable();\n /**\n * An event triggered when a multi material is removed\n */\n this.onMultiMaterialRemovedObservable = new Observable();\n /**\n * An event triggered when a texture is created\n */\n this.onNewTextureAddedObservable = new Observable();\n /**\n * An event triggered when a texture is removed\n */\n this.onTextureRemovedObservable = new Observable();\n /**\n * An event triggered when render targets are about to be rendered\n * Can happen multiple times per frame.\n */\n this.onBeforeRenderTargetsRenderObservable = new Observable();\n /**\n * An event triggered when render targets were rendered.\n * Can happen multiple times per frame.\n */\n this.onAfterRenderTargetsRenderObservable = new Observable();\n /**\n * An event triggered before calculating deterministic simulation step\n */\n this.onBeforeStepObservable = new Observable();\n /**\n * An event triggered after calculating deterministic simulation step\n */\n this.onAfterStepObservable = new Observable();\n /**\n * An event triggered when the activeCamera property is updated\n */\n this.onActiveCameraChanged = new Observable();\n /**\n * An event triggered when the activeCameras property is updated\n */\n this.onActiveCamerasChanged = new Observable();\n /**\n * This Observable will be triggered before rendering each renderingGroup of each rendered camera.\n * The RenderingGroupInfo class contains all the information about the context in which the observable is called\n * If you wish to register an Observer only for a given set of renderingGroup, use the mask with a combination of the renderingGroup index elevated to the power of two (1 for renderingGroup 0, 2 for renderingrOup1, 4 for 2 and 8 for 3)\n */\n this.onBeforeRenderingGroupObservable = new Observable();\n /**\n * This Observable will be triggered after rendering each renderingGroup of each rendered camera.\n * The RenderingGroupInfo class contains all the information about the context in which the observable is called\n * If you wish to register an Observer only for a given set of renderingGroup, use the mask with a combination of the renderingGroup index elevated to the power of two (1 for renderingGroup 0, 2 for renderingrOup1, 4 for 2 and 8 for 3)\n */\n this.onAfterRenderingGroupObservable = new Observable();\n /**\n * This Observable will when a mesh has been imported into the scene.\n */\n this.onMeshImportedObservable = new Observable();\n /**\n * This Observable will when an animation file has been imported into the scene.\n */\n this.onAnimationFileImportedObservable = new Observable();\n // Animations\n /** @internal */\n this._registeredForLateAnimationBindings = new SmartArrayNoDuplicate(256);\n // Pointers\n this._pointerPickingConfiguration = new PointerPickingConfiguration();\n /**\n * This observable event is triggered when any ponter event is triggered. It is registered during Scene.attachControl() and it is called BEFORE the 3D engine process anything (mesh/sprite picking for instance).\n * You have the possibility to skip the process and the call to onPointerObservable by setting PointerInfoPre.skipOnPointerObservable to true\n */\n this.onPrePointerObservable = new Observable();\n /**\n * Observable event triggered each time an input event is received from the rendering canvas\n */\n this.onPointerObservable = new Observable();\n // Keyboard\n /**\n * This observable event is triggered when any keyboard event si raised and registered during Scene.attachControl()\n * You have the possibility to skip the process and the call to onKeyboardObservable by setting KeyboardInfoPre.skipOnPointerObservable to true\n */\n this.onPreKeyboardObservable = new Observable();\n /**\n * Observable event triggered each time an keyboard event is received from the hosting window\n */\n this.onKeyboardObservable = new Observable();\n // Coordinates system\n this._useRightHandedSystem = false;\n // Deterministic lockstep\n this._timeAccumulator = 0;\n this._currentStepId = 0;\n this._currentInternalStep = 0;\n // Fog\n this._fogEnabled = true;\n this._fogMode = Scene.FOGMODE_NONE;\n /**\n * Gets or sets the fog color to use\n * @see https://doc.babylonjs.com/features/featuresDeepDive/environment/environment_introduction#fog\n * (Default is Color3(0.2, 0.2, 0.3))\n */\n this.fogColor = new Color3(0.2, 0.2, 0.3);\n /**\n * Gets or sets the fog density to use\n * @see https://doc.babylonjs.com/features/featuresDeepDive/environment/environment_introduction#fog\n * (Default is 0.1)\n */\n this.fogDensity = 0.1;\n /**\n * Gets or sets the fog start distance to use\n * @see https://doc.babylonjs.com/features/featuresDeepDive/environment/environment_introduction#fog\n * (Default is 0)\n */\n this.fogStart = 0;\n /**\n * Gets or sets the fog end distance to use\n * @see https://doc.babylonjs.com/features/featuresDeepDive/environment/environment_introduction#fog\n * (Default is 1000)\n */\n this.fogEnd = 1000.0;\n /**\n * Flag indicating if we need to store previous matrices when rendering\n */\n this.needsPreviousWorldMatrices = false;\n // Lights\n this._shadowsEnabled = true;\n this._lightsEnabled = true;\n this._unObserveActiveCameras = null;\n // Textures\n this._texturesEnabled = true;\n // Physics\n /**\n * Gets or sets a boolean indicating if physic engines are enabled on this scene\n */\n this.physicsEnabled = true;\n // Particles\n /**\n * Gets or sets a boolean indicating if particles are enabled on this scene\n */\n this.particlesEnabled = true;\n // Sprites\n /**\n * Gets or sets a boolean indicating if sprites are enabled on this scene\n */\n this.spritesEnabled = true;\n // Skeletons\n this._skeletonsEnabled = true;\n // Lens flares\n /**\n * Gets or sets a boolean indicating if lens flares are enabled on this scene\n */\n this.lensFlaresEnabled = true;\n // Collisions\n /**\n * Gets or sets a boolean indicating if collisions are enabled on this scene\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/camera_collisions\n */\n this.collisionsEnabled = true;\n /**\n * Defines the gravity applied to this scene (used only for collisions)\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/camera_collisions\n */\n this.gravity = new Vector3(0, -9.807, 0);\n // Postprocesses\n /**\n * Gets or sets a boolean indicating if postprocesses are enabled on this scene\n */\n this.postProcessesEnabled = true;\n // Customs render targets\n /**\n * Gets or sets a boolean indicating if render targets are enabled on this scene\n */\n this.renderTargetsEnabled = true;\n /**\n * Gets or sets a boolean indicating if next render targets must be dumped as image for debugging purposes\n * We recommend not using it and instead rely on Spector.js: http://spector.babylonjs.com\n */\n this.dumpNextRenderTargets = false;\n /**\n * The list of user defined render targets added to the scene\n */\n this.customRenderTargets = new Array();\n /**\n * Gets the list of meshes imported to the scene through SceneLoader\n */\n this.importedMeshesFiles = new Array();\n // Probes\n /**\n * Gets or sets a boolean indicating if probes are enabled on this scene\n */\n this.probesEnabled = true;\n this._meshesForIntersections = new SmartArrayNoDuplicate(256);\n // Procedural textures\n /**\n * Gets or sets a boolean indicating if procedural textures are enabled on this scene\n */\n this.proceduralTexturesEnabled = true;\n // Performance counters\n this._totalVertices = new PerfCounter();\n /** @internal */\n this._activeIndices = new PerfCounter();\n /** @internal */\n this._activeParticles = new PerfCounter();\n /** @internal */\n this._activeBones = new PerfCounter();\n /** @internal */\n this._animationTime = 0;\n /**\n * Gets or sets a general scale for animation speed\n * @see https://www.babylonjs-playground.com/#IBU2W7#3\n */\n this.animationTimeScale = 1;\n this._renderId = 0;\n this._frameId = 0;\n this._executeWhenReadyTimeoutId = null;\n this._intermediateRendering = false;\n this._defaultFrameBufferCleared = false;\n this._viewUpdateFlag = -1;\n this._projectionUpdateFlag = -1;\n /** @internal */\n this._toBeDisposed = new Array(256);\n this._activeRequests = new Array();\n /** @internal */\n this._pendingData = new Array();\n this._isDisposed = false;\n /**\n * Gets or sets a boolean indicating that all submeshes of active meshes must be rendered\n * Use this boolean to avoid computing frustum clipping on submeshes (This could help when you are CPU bound)\n */\n this.dispatchAllSubMeshesOfActiveMeshes = false;\n this._activeMeshes = new SmartArray(256);\n this._processedMaterials = new SmartArray(256);\n this._renderTargets = new SmartArrayNoDuplicate(256);\n this._materialsRenderTargets = new SmartArrayNoDuplicate(256);\n /** @internal */\n this._activeParticleSystems = new SmartArray(256);\n this._activeSkeletons = new SmartArrayNoDuplicate(32);\n this._softwareSkinnedMeshes = new SmartArrayNoDuplicate(32);\n /** @internal */\n this._activeAnimatables = new Array();\n this._transformMatrix = Matrix.Zero();\n /**\n * Gets or sets a boolean indicating if lights must be sorted by priority (off by default)\n * This is useful if there are more lights that the maximum simulteanous authorized\n */\n this.requireLightSorting = false;\n /**\n * @internal\n * Backing store of defined scene components.\n */\n this._components = [];\n /**\n * @internal\n * Backing store of defined scene components.\n */\n this._serializableComponents = [];\n /**\n * List of components to register on the next registration step.\n */\n this._transientComponents = [];\n /**\n * @internal\n * Defines the actions happening before camera updates.\n */\n this._beforeCameraUpdateStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening before clear the canvas.\n */\n this._beforeClearStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening before clear the canvas.\n */\n this._beforeRenderTargetClearStage = Stage.Create();\n /**\n * @internal\n * Defines the actions when collecting render targets for the frame.\n */\n this._gatherRenderTargetsStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening for one camera in the frame.\n */\n this._gatherActiveCameraRenderTargetsStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening during the per mesh ready checks.\n */\n this._isReadyForMeshStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening before evaluate active mesh checks.\n */\n this._beforeEvaluateActiveMeshStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening during the evaluate sub mesh checks.\n */\n this._evaluateSubMeshStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening during the active mesh stage.\n */\n this._preActiveMeshStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening during the per camera render target step.\n */\n this._cameraDrawRenderTargetStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening just before the active camera is drawing.\n */\n this._beforeCameraDrawStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening just before a render target is drawing.\n */\n this._beforeRenderTargetDrawStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening just before a rendering group is drawing.\n */\n this._beforeRenderingGroupDrawStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening just before a mesh is drawing.\n */\n this._beforeRenderingMeshStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening just after a mesh has been drawn.\n */\n this._afterRenderingMeshStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening just after a rendering group has been drawn.\n */\n this._afterRenderingGroupDrawStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening just after the active camera has been drawn.\n */\n this._afterCameraDrawStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening just after the post processing\n */\n this._afterCameraPostProcessStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening just after a render target has been drawn.\n */\n this._afterRenderTargetDrawStage = Stage.Create();\n /**\n * Defines the actions happening just after the post processing on a render target\n */\n this._afterRenderTargetPostProcessStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening just after rendering all cameras and computing intersections.\n */\n this._afterRenderStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening when a pointer move event happens.\n */\n this._pointerMoveStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening when a pointer down event happens.\n */\n this._pointerDownStage = Stage.Create();\n /**\n * @internal\n * Defines the actions happening when a pointer up event happens.\n */\n this._pointerUpStage = Stage.Create();\n /**\n * an optional map from Geometry Id to Geometry index in the 'geometries' array\n */\n this._geometriesByUniqueId = null;\n this._defaultMeshCandidates = {\n data: [],\n length: 0,\n };\n this._defaultSubMeshCandidates = {\n data: [],\n length: 0,\n };\n this._preventFreeActiveMeshesAndRenderingGroups = false;\n /** @internal */\n this._activeMeshesFrozen = false;\n /** @internal */\n this._activeMeshesFrozenButKeepClipping = false;\n this._skipEvaluateActiveMeshesCompletely = false;\n /** @internal */\n this._allowPostProcessClearColor = true;\n /**\n * User updatable function that will return a deterministic frame time when engine is in deterministic lock step mode\n */\n this.getDeterministicFrameTime = () => {\n return this._engine.getTimeStep();\n };\n /** @internal */\n this._registeredActions = 0;\n this._blockMaterialDirtyMechanism = false;\n /**\n * Internal perfCollector instance used for sharing between inspector and playground.\n * Marked as protected to allow sharing between prototype extensions, but disallow access at toplevel.\n */\n this._perfCollector = null;\n this.activeCameras = new Array();\n const fullOptions = Object.assign({ useGeometryUniqueIdsMap: true, useMaterialMeshMap: true, useClonedMeshMap: true, virtual: false }, options);\n this._engine = engine || EngineStore.LastCreatedEngine;\n if (!fullOptions.virtual) {\n EngineStore._LastCreatedScene = this;\n this._engine.scenes.push(this);\n }\n else {\n this._engine._virtualScenes.push(this);\n }\n this._uid = null;\n this._renderingManager = new RenderingManager(this);\n if (PostProcessManager) {\n this.postProcessManager = new PostProcessManager(this);\n }\n if (IsWindowObjectExist()) {\n this.attachControl();\n }\n // Uniform Buffer\n this._createUbo();\n // Default Image processing definition\n if (ImageProcessingConfiguration) {\n this._imageProcessingConfiguration = new ImageProcessingConfiguration();\n }\n this.setDefaultCandidateProviders();\n if (fullOptions.useGeometryUniqueIdsMap) {\n this._geometriesByUniqueId = {};\n }\n this.useMaterialMeshMap = fullOptions.useMaterialMeshMap;\n this.useClonedMeshMap = fullOptions.useClonedMeshMap;\n if (!options || !options.virtual) {\n this._engine.onNewSceneAddedObservable.notifyObservers(this);\n }\n }\n /**\n * Gets a string identifying the name of the class\n * @returns \"Scene\" string\n */\n getClassName() {\n return \"Scene\";\n }\n /**\n * @internal\n */\n _getDefaultMeshCandidates() {\n this._defaultMeshCandidates.data = this.meshes;\n this._defaultMeshCandidates.length = this.meshes.length;\n return this._defaultMeshCandidates;\n }\n /**\n * @internal\n */\n _getDefaultSubMeshCandidates(mesh) {\n this._defaultSubMeshCandidates.data = mesh.subMeshes;\n this._defaultSubMeshCandidates.length = mesh.subMeshes.length;\n return this._defaultSubMeshCandidates;\n }\n /**\n * Sets the default candidate providers for the scene.\n * This sets the getActiveMeshCandidates, getActiveSubMeshCandidates, getIntersectingSubMeshCandidates\n * and getCollidingSubMeshCandidates to their default function\n */\n setDefaultCandidateProviders() {\n this.getActiveMeshCandidates = this._getDefaultMeshCandidates.bind(this);\n this.getActiveSubMeshCandidates = this._getDefaultSubMeshCandidates.bind(this);\n this.getIntersectingSubMeshCandidates = this._getDefaultSubMeshCandidates.bind(this);\n this.getCollidingSubMeshCandidates = this._getDefaultSubMeshCandidates.bind(this);\n }\n /**\n * Gets the mesh that is currently under the pointer\n */\n get meshUnderPointer() {\n return this._inputManager.meshUnderPointer;\n }\n /**\n * Gets or sets the current on-screen X position of the pointer\n */\n get pointerX() {\n return this._inputManager.pointerX;\n }\n set pointerX(value) {\n this._inputManager.pointerX = value;\n }\n /**\n * Gets or sets the current on-screen Y position of the pointer\n */\n get pointerY() {\n return this._inputManager.pointerY;\n }\n set pointerY(value) {\n this._inputManager.pointerY = value;\n }\n /**\n * Gets the cached material (ie. the latest rendered one)\n * @returns the cached material\n */\n getCachedMaterial() {\n return this._cachedMaterial;\n }\n /**\n * Gets the cached effect (ie. the latest rendered one)\n * @returns the cached effect\n */\n getCachedEffect() {\n return this._cachedEffect;\n }\n /**\n * Gets the cached visibility state (ie. the latest rendered one)\n * @returns the cached visibility state\n */\n getCachedVisibility() {\n return this._cachedVisibility;\n }\n /**\n * Gets a boolean indicating if the current material / effect / visibility must be bind again\n * @param material defines the current material\n * @param effect defines the current effect\n * @param visibility defines the current visibility state\n * @returns true if one parameter is not cached\n */\n isCachedMaterialInvalid(material, effect, visibility = 1) {\n return this._cachedEffect !== effect || this._cachedMaterial !== material || this._cachedVisibility !== visibility;\n }\n /**\n * Gets the engine associated with the scene\n * @returns an Engine\n */\n getEngine() {\n return this._engine;\n }\n /**\n * Gets the total number of vertices rendered per frame\n * @returns the total number of vertices rendered per frame\n */\n getTotalVertices() {\n return this._totalVertices.current;\n }\n /**\n * Gets the performance counter for total vertices\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/optimize_your_scene#instrumentation\n */\n get totalVerticesPerfCounter() {\n return this._totalVertices;\n }\n /**\n * Gets the total number of active indices rendered per frame (You can deduce the number of rendered triangles by dividing this number by 3)\n * @returns the total number of active indices rendered per frame\n */\n getActiveIndices() {\n return this._activeIndices.current;\n }\n /**\n * Gets the performance counter for active indices\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/optimize_your_scene#instrumentation\n */\n get totalActiveIndicesPerfCounter() {\n return this._activeIndices;\n }\n /**\n * Gets the total number of active particles rendered per frame\n * @returns the total number of active particles rendered per frame\n */\n getActiveParticles() {\n return this._activeParticles.current;\n }\n /**\n * Gets the performance counter for active particles\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/optimize_your_scene#instrumentation\n */\n get activeParticlesPerfCounter() {\n return this._activeParticles;\n }\n /**\n * Gets the total number of active bones rendered per frame\n * @returns the total number of active bones rendered per frame\n */\n getActiveBones() {\n return this._activeBones.current;\n }\n /**\n * Gets the performance counter for active bones\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/optimize_your_scene#instrumentation\n */\n get activeBonesPerfCounter() {\n return this._activeBones;\n }\n /**\n * Gets the array of active meshes\n * @returns an array of AbstractMesh\n */\n getActiveMeshes() {\n return this._activeMeshes;\n }\n /**\n * Gets the animation ratio (which is 1.0 is the scene renders at 60fps and 2 if the scene renders at 30fps, etc.)\n * @returns a number\n */\n getAnimationRatio() {\n return this._animationRatio !== undefined ? this._animationRatio : 1;\n }\n /**\n * Gets an unique Id for the current render phase\n * @returns a number\n */\n getRenderId() {\n return this._renderId;\n }\n /**\n * Gets an unique Id for the current frame\n * @returns a number\n */\n getFrameId() {\n return this._frameId;\n }\n /** Call this function if you want to manually increment the render Id*/\n incrementRenderId() {\n this._renderId++;\n }\n _createUbo() {\n this.setSceneUniformBuffer(this.createSceneUniformBuffer());\n }\n /**\n * Use this method to simulate a pointer move on a mesh\n * The pickResult parameter can be obtained from a scene.pick or scene.pickWithRay\n * @param pickResult pickingInfo of the object wished to simulate pointer event on\n * @param pointerEventInit pointer event state to be used when simulating the pointer event (eg. pointer id for multitouch)\n * @returns the current scene\n */\n simulatePointerMove(pickResult, pointerEventInit) {\n this._inputManager.simulatePointerMove(pickResult, pointerEventInit);\n return this;\n }\n /**\n * Use this method to simulate a pointer down on a mesh\n * The pickResult parameter can be obtained from a scene.pick or scene.pickWithRay\n * @param pickResult pickingInfo of the object wished to simulate pointer event on\n * @param pointerEventInit pointer event state to be used when simulating the pointer event (eg. pointer id for multitouch)\n * @returns the current scene\n */\n simulatePointerDown(pickResult, pointerEventInit) {\n this._inputManager.simulatePointerDown(pickResult, pointerEventInit);\n return this;\n }\n /**\n * Use this method to simulate a pointer up on a mesh\n * The pickResult parameter can be obtained from a scene.pick or scene.pickWithRay\n * @param pickResult pickingInfo of the object wished to simulate pointer event on\n * @param pointerEventInit pointer event state to be used when simulating the pointer event (eg. pointer id for multitouch)\n * @param doubleTap indicates that the pointer up event should be considered as part of a double click (false by default)\n * @returns the current scene\n */\n simulatePointerUp(pickResult, pointerEventInit, doubleTap) {\n this._inputManager.simulatePointerUp(pickResult, pointerEventInit, doubleTap);\n return this;\n }\n /**\n * Gets a boolean indicating if the current pointer event is captured (meaning that the scene has already handled the pointer down)\n * @param pointerId defines the pointer id to use in a multi-touch scenario (0 by default)\n * @returns true if the pointer was captured\n */\n isPointerCaptured(pointerId = 0) {\n return this._inputManager.isPointerCaptured(pointerId);\n }\n /**\n * Attach events to the canvas (To handle actionManagers triggers and raise onPointerMove, onPointerDown and onPointerUp\n * @param attachUp defines if you want to attach events to pointerup\n * @param attachDown defines if you want to attach events to pointerdown\n * @param attachMove defines if you want to attach events to pointermove\n */\n attachControl(attachUp = true, attachDown = true, attachMove = true) {\n this._inputManager.attachControl(attachUp, attachDown, attachMove);\n }\n /** Detaches all event handlers*/\n detachControl() {\n this._inputManager.detachControl();\n }\n /**\n * This function will check if the scene can be rendered (textures are loaded, shaders are compiled)\n * Delay loaded resources are not taking in account\n * @param checkRenderTargets true to also check that the meshes rendered as part of a render target are ready (default: true)\n * @returns true if all required resources are ready\n */\n isReady(checkRenderTargets = true) {\n var _a, _b, _c;\n if (this._isDisposed) {\n return false;\n }\n let index;\n const engine = this.getEngine();\n const currentRenderPassId = engine.currentRenderPassId;\n engine.currentRenderPassId = (_b = (_a = this.activeCamera) === null || _a === void 0 ? void 0 : _a.renderPassId) !== null && _b !== void 0 ? _b : currentRenderPassId;\n let isReady = true;\n // Pending data\n if (this._pendingData.length > 0) {\n isReady = false;\n }\n // Ensures that the pre-pass renderer is enabled if it is to be enabled.\n (_c = this.prePassRenderer) === null || _c === void 0 ? void 0 : _c.update();\n // Meshes\n if (checkRenderTargets) {\n this._processedMaterials.reset();\n this._materialsRenderTargets.reset();\n }\n for (index = 0; index < this.meshes.length; index++) {\n const mesh = this.meshes[index];\n if (!mesh.subMeshes || mesh.subMeshes.length === 0) {\n continue;\n }\n // Do not stop at the first encountered \"unready\" object as we want to ensure\n // all materials are starting off their compilation in parallel.\n if (!mesh.isReady(true)) {\n isReady = false;\n continue;\n }\n const hardwareInstancedRendering = mesh.hasThinInstances ||\n mesh.getClassName() === \"InstancedMesh\" ||\n mesh.getClassName() === \"InstancedLinesMesh\" ||\n (engine.getCaps().instancedArrays && mesh.instances.length > 0);\n // Is Ready For Mesh\n for (const step of this._isReadyForMeshStage) {\n if (!step.action(mesh, hardwareInstancedRendering)) {\n isReady = false;\n }\n }\n if (!checkRenderTargets) {\n continue;\n }\n const mat = mesh.material || this.defaultMaterial;\n if (mat) {\n if (mat._storeEffectOnSubMeshes) {\n for (const subMesh of mesh.subMeshes) {\n const material = subMesh.getMaterial();\n if (material && material.hasRenderTargetTextures && material.getRenderTargetTextures != null) {\n if (this._processedMaterials.indexOf(material) === -1) {\n this._processedMaterials.push(material);\n this._materialsRenderTargets.concatWithNoDuplicate(material.getRenderTargetTextures());\n }\n }\n }\n }\n else {\n if (mat.hasRenderTargetTextures && mat.getRenderTargetTextures != null) {\n if (this._processedMaterials.indexOf(mat) === -1) {\n this._processedMaterials.push(mat);\n this._materialsRenderTargets.concatWithNoDuplicate(mat.getRenderTargetTextures());\n }\n }\n }\n }\n }\n // Render targets\n if (checkRenderTargets) {\n for (index = 0; index < this._materialsRenderTargets.length; ++index) {\n const rtt = this._materialsRenderTargets.data[index];\n if (!rtt.isReadyForRendering()) {\n isReady = false;\n }\n }\n }\n // Geometries\n for (index = 0; index < this.geometries.length; index++) {\n const geometry = this.geometries[index];\n if (geometry.delayLoadState === 2) {\n isReady = false;\n }\n }\n // Post-processes\n if (this.activeCameras && this.activeCameras.length > 0) {\n for (const camera of this.activeCameras) {\n if (!camera.isReady(true)) {\n isReady = false;\n }\n }\n }\n else if (this.activeCamera) {\n if (!this.activeCamera.isReady(true)) {\n isReady = false;\n }\n }\n // Particles\n for (const particleSystem of this.particleSystems) {\n if (!particleSystem.isReady()) {\n isReady = false;\n }\n }\n // Layers\n if (this.layers) {\n for (const layer of this.layers) {\n if (!layer.isReady()) {\n isReady = false;\n }\n }\n }\n // Effects\n if (!engine.areAllEffectsReady()) {\n isReady = false;\n }\n engine.currentRenderPassId = currentRenderPassId;\n return isReady;\n }\n /** Resets all cached information relative to material (including effect and visibility) */\n resetCachedMaterial() {\n this._cachedMaterial = null;\n this._cachedEffect = null;\n this._cachedVisibility = null;\n }\n /**\n * Registers a function to be called before every frame render\n * @param func defines the function to register\n */\n registerBeforeRender(func) {\n this.onBeforeRenderObservable.add(func);\n }\n /**\n * Unregisters a function called before every frame render\n * @param func defines the function to unregister\n */\n unregisterBeforeRender(func) {\n this.onBeforeRenderObservable.removeCallback(func);\n }\n /**\n * Registers a function to be called after every frame render\n * @param func defines the function to register\n */\n registerAfterRender(func) {\n this.onAfterRenderObservable.add(func);\n }\n /**\n * Unregisters a function called after every frame render\n * @param func defines the function to unregister\n */\n unregisterAfterRender(func) {\n this.onAfterRenderObservable.removeCallback(func);\n }\n _executeOnceBeforeRender(func) {\n const execFunc = () => {\n func();\n setTimeout(() => {\n this.unregisterBeforeRender(execFunc);\n });\n };\n this.registerBeforeRender(execFunc);\n }\n /**\n * The provided function will run before render once and will be disposed afterwards.\n * A timeout delay can be provided so that the function will be executed in N ms.\n * The timeout is using the browser's native setTimeout so time percision cannot be guaranteed.\n * @param func The function to be executed.\n * @param timeout optional delay in ms\n */\n executeOnceBeforeRender(func, timeout) {\n if (timeout !== undefined) {\n setTimeout(() => {\n this._executeOnceBeforeRender(func);\n }, timeout);\n }\n else {\n this._executeOnceBeforeRender(func);\n }\n }\n /**\n * This function can help adding any object to the list of data awaited to be ready in order to check for a complete scene loading.\n * @param data defines the object to wait for\n */\n addPendingData(data) {\n this._pendingData.push(data);\n }\n /**\n * Remove a pending data from the loading list which has previously been added with addPendingData.\n * @param data defines the object to remove from the pending list\n */\n removePendingData(data) {\n const wasLoading = this.isLoading;\n const index = this._pendingData.indexOf(data);\n if (index !== -1) {\n this._pendingData.splice(index, 1);\n }\n if (wasLoading && !this.isLoading) {\n this.onDataLoadedObservable.notifyObservers(this);\n }\n }\n /**\n * Returns the number of items waiting to be loaded\n * @returns the number of items waiting to be loaded\n */\n getWaitingItemsCount() {\n return this._pendingData.length;\n }\n /**\n * Returns a boolean indicating if the scene is still loading data\n */\n get isLoading() {\n return this._pendingData.length > 0;\n }\n /**\n * Registers a function to be executed when the scene is ready\n * @param func - the function to be executed\n * @param checkRenderTargets true to also check that the meshes rendered as part of a render target are ready (default: false)\n */\n executeWhenReady(func, checkRenderTargets = false) {\n this.onReadyObservable.addOnce(func);\n if (this._executeWhenReadyTimeoutId !== null) {\n return;\n }\n this._checkIsReady(checkRenderTargets);\n }\n /**\n * Returns a promise that resolves when the scene is ready\n * @param checkRenderTargets true to also check that the meshes rendered as part of a render target are ready (default: false)\n * @returns A promise that resolves when the scene is ready\n */\n whenReadyAsync(checkRenderTargets = false) {\n return new Promise((resolve) => {\n this.executeWhenReady(() => {\n resolve();\n }, checkRenderTargets);\n });\n }\n /**\n * @internal\n */\n _checkIsReady(checkRenderTargets = false) {\n this._registerTransientComponents();\n if (this.isReady(checkRenderTargets)) {\n this.onReadyObservable.notifyObservers(this);\n this.onReadyObservable.clear();\n this._executeWhenReadyTimeoutId = null;\n return;\n }\n if (this._isDisposed) {\n this.onReadyObservable.clear();\n this._executeWhenReadyTimeoutId = null;\n return;\n }\n this._executeWhenReadyTimeoutId = setTimeout(() => {\n // Ensure materials effects are checked outside render loops\n this.incrementRenderId();\n this._checkIsReady(checkRenderTargets);\n }, 100);\n }\n /**\n * Gets all animatable attached to the scene\n */\n get animatables() {\n return this._activeAnimatables;\n }\n /**\n * Resets the last animation time frame.\n * Useful to override when animations start running when loading a scene for the first time.\n */\n resetLastAnimationTimeFrame() {\n this._animationTimeLast = PrecisionDate.Now;\n }\n // Matrix\n /**\n * Gets the current view matrix\n * @returns a Matrix\n */\n getViewMatrix() {\n return this._viewMatrix;\n }\n /**\n * Gets the current projection matrix\n * @returns a Matrix\n */\n getProjectionMatrix() {\n return this._projectionMatrix;\n }\n /**\n * Gets the current transform matrix\n * @returns a Matrix made of View * Projection\n */\n getTransformMatrix() {\n return this._transformMatrix;\n }\n /**\n * Sets the current transform matrix\n * @param viewL defines the View matrix to use\n * @param projectionL defines the Projection matrix to use\n * @param viewR defines the right View matrix to use (if provided)\n * @param projectionR defines the right Projection matrix to use (if provided)\n */\n setTransformMatrix(viewL, projectionL, viewR, projectionR) {\n // clear the multiviewSceneUbo if no viewR and projectionR are defined\n if (!viewR && !projectionR && this._multiviewSceneUbo) {\n this._multiviewSceneUbo.dispose();\n this._multiviewSceneUbo = null;\n }\n if (this._viewUpdateFlag === viewL.updateFlag && this._projectionUpdateFlag === projectionL.updateFlag) {\n return;\n }\n this._viewUpdateFlag = viewL.updateFlag;\n this._projectionUpdateFlag = projectionL.updateFlag;\n this._viewMatrix = viewL;\n this._projectionMatrix = projectionL;\n this._viewMatrix.multiplyToRef(this._projectionMatrix, this._transformMatrix);\n // Update frustum\n if (!this._frustumPlanes) {\n this._frustumPlanes = Frustum.GetPlanes(this._transformMatrix);\n }\n else {\n Frustum.GetPlanesToRef(this._transformMatrix, this._frustumPlanes);\n }\n if (this._multiviewSceneUbo && this._multiviewSceneUbo.useUbo) {\n this._updateMultiviewUbo(viewR, projectionR);\n }\n else if (this._sceneUbo.useUbo) {\n this._sceneUbo.updateMatrix(\"viewProjection\", this._transformMatrix);\n this._sceneUbo.updateMatrix(\"view\", this._viewMatrix);\n this._sceneUbo.updateMatrix(\"projection\", this._projectionMatrix);\n }\n }\n /**\n * Gets the uniform buffer used to store scene data\n * @returns a UniformBuffer\n */\n getSceneUniformBuffer() {\n return this._multiviewSceneUbo ? this._multiviewSceneUbo : this._sceneUbo;\n }\n /**\n * Creates a scene UBO\n * @param name name of the uniform buffer (optional, for debugging purpose only)\n * @returns a new ubo\n */\n createSceneUniformBuffer(name) {\n const sceneUbo = new UniformBuffer(this._engine, undefined, false, name !== null && name !== void 0 ? name : \"scene\");\n sceneUbo.addUniform(\"viewProjection\", 16);\n sceneUbo.addUniform(\"view\", 16);\n sceneUbo.addUniform(\"projection\", 16);\n sceneUbo.addUniform(\"vEyePosition\", 4);\n return sceneUbo;\n }\n /**\n * Sets the scene ubo\n * @param ubo the ubo to set for the scene\n */\n setSceneUniformBuffer(ubo) {\n this._sceneUbo = ubo;\n this._viewUpdateFlag = -1;\n this._projectionUpdateFlag = -1;\n }\n /**\n * Gets an unique (relatively to the current scene) Id\n * @returns an unique number for the scene\n */\n getUniqueId() {\n return UniqueIdGenerator.UniqueId;\n }\n /**\n * Add a mesh to the list of scene's meshes\n * @param newMesh defines the mesh to add\n * @param recursive if all child meshes should also be added to the scene\n */\n addMesh(newMesh, recursive = false) {\n if (this._blockEntityCollection) {\n return;\n }\n this.meshes.push(newMesh);\n newMesh._resyncLightSources();\n if (!newMesh.parent) {\n newMesh._addToSceneRootNodes();\n }\n this.onNewMeshAddedObservable.notifyObservers(newMesh);\n if (recursive) {\n newMesh.getChildMeshes().forEach((m) => {\n this.addMesh(m);\n });\n }\n }\n /**\n * Remove a mesh for the list of scene's meshes\n * @param toRemove defines the mesh to remove\n * @param recursive if all child meshes should also be removed from the scene\n * @returns the index where the mesh was in the mesh list\n */\n removeMesh(toRemove, recursive = false) {\n const index = this.meshes.indexOf(toRemove);\n if (index !== -1) {\n // Remove from the scene if mesh found\n this.meshes[index] = this.meshes[this.meshes.length - 1];\n this.meshes.pop();\n if (!toRemove.parent) {\n toRemove._removeFromSceneRootNodes();\n }\n }\n this._inputManager._invalidateMesh(toRemove);\n this.onMeshRemovedObservable.notifyObservers(toRemove);\n if (recursive) {\n toRemove.getChildMeshes().forEach((m) => {\n this.removeMesh(m);\n });\n }\n return index;\n }\n /**\n * Add a transform node to the list of scene's transform nodes\n * @param newTransformNode defines the transform node to add\n */\n addTransformNode(newTransformNode) {\n if (this._blockEntityCollection) {\n return;\n }\n if (newTransformNode.getScene() === this && newTransformNode._indexInSceneTransformNodesArray !== -1) {\n // Already there?\n return;\n }\n newTransformNode._indexInSceneTransformNodesArray = this.transformNodes.length;\n this.transformNodes.push(newTransformNode);\n if (!newTransformNode.parent) {\n newTransformNode._addToSceneRootNodes();\n }\n this.onNewTransformNodeAddedObservable.notifyObservers(newTransformNode);\n }\n /**\n * Remove a transform node for the list of scene's transform nodes\n * @param toRemove defines the transform node to remove\n * @returns the index where the transform node was in the transform node list\n */\n removeTransformNode(toRemove) {\n const index = toRemove._indexInSceneTransformNodesArray;\n if (index !== -1) {\n if (index !== this.transformNodes.length - 1) {\n const lastNode = this.transformNodes[this.transformNodes.length - 1];\n this.transformNodes[index] = lastNode;\n lastNode._indexInSceneTransformNodesArray = index;\n }\n toRemove._indexInSceneTransformNodesArray = -1;\n this.transformNodes.pop();\n if (!toRemove.parent) {\n toRemove._removeFromSceneRootNodes();\n }\n }\n this.onTransformNodeRemovedObservable.notifyObservers(toRemove);\n return index;\n }\n /**\n * Remove a skeleton for the list of scene's skeletons\n * @param toRemove defines the skeleton to remove\n * @returns the index where the skeleton was in the skeleton list\n */\n removeSkeleton(toRemove) {\n const index = this.skeletons.indexOf(toRemove);\n if (index !== -1) {\n // Remove from the scene if found\n this.skeletons.splice(index, 1);\n this.onSkeletonRemovedObservable.notifyObservers(toRemove);\n // Clean active container\n this._executeActiveContainerCleanup(this._activeSkeletons);\n }\n return index;\n }\n /**\n * Remove a morph target for the list of scene's morph targets\n * @param toRemove defines the morph target to remove\n * @returns the index where the morph target was in the morph target list\n */\n removeMorphTargetManager(toRemove) {\n const index = this.morphTargetManagers.indexOf(toRemove);\n if (index !== -1) {\n // Remove from the scene if found\n this.morphTargetManagers.splice(index, 1);\n }\n return index;\n }\n /**\n * Remove a light for the list of scene's lights\n * @param toRemove defines the light to remove\n * @returns the index where the light was in the light list\n */\n removeLight(toRemove) {\n const index = this.lights.indexOf(toRemove);\n if (index !== -1) {\n // Remove from meshes\n for (const mesh of this.meshes) {\n mesh._removeLightSource(toRemove, false);\n }\n // Remove from the scene if mesh found\n this.lights.splice(index, 1);\n this.sortLightsByPriority();\n if (!toRemove.parent) {\n toRemove._removeFromSceneRootNodes();\n }\n }\n this.onLightRemovedObservable.notifyObservers(toRemove);\n return index;\n }\n /**\n * Remove a camera for the list of scene's cameras\n * @param toRemove defines the camera to remove\n * @returns the index where the camera was in the camera list\n */\n removeCamera(toRemove) {\n const index = this.cameras.indexOf(toRemove);\n if (index !== -1) {\n // Remove from the scene if mesh found\n this.cameras.splice(index, 1);\n if (!toRemove.parent) {\n toRemove._removeFromSceneRootNodes();\n }\n }\n // Remove from activeCameras\n if (this.activeCameras) {\n const index2 = this.activeCameras.indexOf(toRemove);\n if (index2 !== -1) {\n // Remove from the scene if mesh found\n this.activeCameras.splice(index2, 1);\n }\n }\n // Reset the activeCamera\n if (this.activeCamera === toRemove) {\n if (this.cameras.length > 0) {\n this.activeCamera = this.cameras[0];\n }\n else {\n this.activeCamera = null;\n }\n }\n this.onCameraRemovedObservable.notifyObservers(toRemove);\n return index;\n }\n /**\n * Remove a particle system for the list of scene's particle systems\n * @param toRemove defines the particle system to remove\n * @returns the index where the particle system was in the particle system list\n */\n removeParticleSystem(toRemove) {\n const index = this.particleSystems.indexOf(toRemove);\n if (index !== -1) {\n this.particleSystems.splice(index, 1);\n // Clean active container\n this._executeActiveContainerCleanup(this._activeParticleSystems);\n }\n return index;\n }\n /**\n * Remove a animation for the list of scene's animations\n * @param toRemove defines the animation to remove\n * @returns the index where the animation was in the animation list\n */\n removeAnimation(toRemove) {\n const index = this.animations.indexOf(toRemove);\n if (index !== -1) {\n this.animations.splice(index, 1);\n }\n return index;\n }\n /**\n * Will stop the animation of the given target\n * @param target - the target\n * @param animationName - the name of the animation to stop (all animations will be stopped if both this and targetMask are empty)\n * @param targetMask - a function that determines if the animation should be stopped based on its target (all animations will be stopped if both this and animationName are empty)\n */\n stopAnimation(target, animationName, targetMask) {\n // Do nothing as code will be provided by animation component\n }\n /**\n * Removes the given animation group from this scene.\n * @param toRemove The animation group to remove\n * @returns The index of the removed animation group\n */\n removeAnimationGroup(toRemove) {\n const index = this.animationGroups.indexOf(toRemove);\n if (index !== -1) {\n this.animationGroups.splice(index, 1);\n }\n return index;\n }\n /**\n * Removes the given multi-material from this scene.\n * @param toRemove The multi-material to remove\n * @returns The index of the removed multi-material\n */\n removeMultiMaterial(toRemove) {\n const index = this.multiMaterials.indexOf(toRemove);\n if (index !== -1) {\n this.multiMaterials.splice(index, 1);\n }\n this.onMultiMaterialRemovedObservable.notifyObservers(toRemove);\n return index;\n }\n /**\n * Removes the given material from this scene.\n * @param toRemove The material to remove\n * @returns The index of the removed material\n */\n removeMaterial(toRemove) {\n const index = toRemove._indexInSceneMaterialArray;\n if (index !== -1 && index < this.materials.length) {\n if (index !== this.materials.length - 1) {\n const lastMaterial = this.materials[this.materials.length - 1];\n this.materials[index] = lastMaterial;\n lastMaterial._indexInSceneMaterialArray = index;\n }\n toRemove._indexInSceneMaterialArray = -1;\n this.materials.pop();\n }\n this.onMaterialRemovedObservable.notifyObservers(toRemove);\n return index;\n }\n /**\n * Removes the given action manager from this scene.\n * @deprecated\n * @param toRemove The action manager to remove\n * @returns The index of the removed action manager\n */\n removeActionManager(toRemove) {\n const index = this.actionManagers.indexOf(toRemove);\n if (index !== -1) {\n this.actionManagers.splice(index, 1);\n }\n return index;\n }\n /**\n * Removes the given texture from this scene.\n * @param toRemove The texture to remove\n * @returns The index of the removed texture\n */\n removeTexture(toRemove) {\n const index = this.textures.indexOf(toRemove);\n if (index !== -1) {\n this.textures.splice(index, 1);\n }\n this.onTextureRemovedObservable.notifyObservers(toRemove);\n return index;\n }\n /**\n * Adds the given light to this scene\n * @param newLight The light to add\n */\n addLight(newLight) {\n if (this._blockEntityCollection) {\n return;\n }\n this.lights.push(newLight);\n this.sortLightsByPriority();\n if (!newLight.parent) {\n newLight._addToSceneRootNodes();\n }\n // Add light to all meshes (To support if the light is removed and then re-added)\n for (const mesh of this.meshes) {\n if (mesh.lightSources.indexOf(newLight) === -1) {\n mesh.lightSources.push(newLight);\n mesh._resyncLightSources();\n }\n }\n this.onNewLightAddedObservable.notifyObservers(newLight);\n }\n /**\n * Sorts the list list based on light priorities\n */\n sortLightsByPriority() {\n if (this.requireLightSorting) {\n this.lights.sort(LightConstants.CompareLightsPriority);\n }\n }\n /**\n * Adds the given camera to this scene\n * @param newCamera The camera to add\n */\n addCamera(newCamera) {\n if (this._blockEntityCollection) {\n return;\n }\n this.cameras.push(newCamera);\n this.onNewCameraAddedObservable.notifyObservers(newCamera);\n if (!newCamera.parent) {\n newCamera._addToSceneRootNodes();\n }\n }\n /**\n * Adds the given skeleton to this scene\n * @param newSkeleton The skeleton to add\n */\n addSkeleton(newSkeleton) {\n if (this._blockEntityCollection) {\n return;\n }\n this.skeletons.push(newSkeleton);\n this.onNewSkeletonAddedObservable.notifyObservers(newSkeleton);\n }\n /**\n * Adds the given particle system to this scene\n * @param newParticleSystem The particle system to add\n */\n addParticleSystem(newParticleSystem) {\n if (this._blockEntityCollection) {\n return;\n }\n this.particleSystems.push(newParticleSystem);\n }\n /**\n * Adds the given animation to this scene\n * @param newAnimation The animation to add\n */\n addAnimation(newAnimation) {\n if (this._blockEntityCollection) {\n return;\n }\n this.animations.push(newAnimation);\n }\n /**\n * Adds the given animation group to this scene.\n * @param newAnimationGroup The animation group to add\n */\n addAnimationGroup(newAnimationGroup) {\n if (this._blockEntityCollection) {\n return;\n }\n this.animationGroups.push(newAnimationGroup);\n }\n /**\n * Adds the given multi-material to this scene\n * @param newMultiMaterial The multi-material to add\n */\n addMultiMaterial(newMultiMaterial) {\n if (this._blockEntityCollection) {\n return;\n }\n this.multiMaterials.push(newMultiMaterial);\n this.onNewMultiMaterialAddedObservable.notifyObservers(newMultiMaterial);\n }\n /**\n * Adds the given material to this scene\n * @param newMaterial The material to add\n */\n addMaterial(newMaterial) {\n if (this._blockEntityCollection) {\n return;\n }\n if (newMaterial.getScene() === this && newMaterial._indexInSceneMaterialArray !== -1) {\n // Already there??\n return;\n }\n newMaterial._indexInSceneMaterialArray = this.materials.length;\n this.materials.push(newMaterial);\n this.onNewMaterialAddedObservable.notifyObservers(newMaterial);\n }\n /**\n * Adds the given morph target to this scene\n * @param newMorphTargetManager The morph target to add\n */\n addMorphTargetManager(newMorphTargetManager) {\n if (this._blockEntityCollection) {\n return;\n }\n this.morphTargetManagers.push(newMorphTargetManager);\n }\n /**\n * Adds the given geometry to this scene\n * @param newGeometry The geometry to add\n */\n addGeometry(newGeometry) {\n if (this._blockEntityCollection) {\n return;\n }\n if (this._geometriesByUniqueId) {\n this._geometriesByUniqueId[newGeometry.uniqueId] = this.geometries.length;\n }\n this.geometries.push(newGeometry);\n }\n /**\n * Adds the given action manager to this scene\n * @deprecated\n * @param newActionManager The action manager to add\n */\n addActionManager(newActionManager) {\n this.actionManagers.push(newActionManager);\n }\n /**\n * Adds the given texture to this scene.\n * @param newTexture The texture to add\n */\n addTexture(newTexture) {\n if (this._blockEntityCollection) {\n return;\n }\n this.textures.push(newTexture);\n this.onNewTextureAddedObservable.notifyObservers(newTexture);\n }\n /**\n * Switch active camera\n * @param newCamera defines the new active camera\n * @param attachControl defines if attachControl must be called for the new active camera (default: true)\n */\n switchActiveCamera(newCamera, attachControl = true) {\n const canvas = this._engine.getInputElement();\n if (!canvas) {\n return;\n }\n if (this.activeCamera) {\n this.activeCamera.detachControl();\n }\n this.activeCamera = newCamera;\n if (attachControl) {\n newCamera.attachControl();\n }\n }\n /**\n * sets the active camera of the scene using its Id\n * @param id defines the camera's Id\n * @returns the new active camera or null if none found.\n */\n setActiveCameraById(id) {\n const camera = this.getCameraById(id);\n if (camera) {\n this.activeCamera = camera;\n return camera;\n }\n return null;\n }\n /**\n * sets the active camera of the scene using its name\n * @param name defines the camera's name\n * @returns the new active camera or null if none found.\n */\n setActiveCameraByName(name) {\n const camera = this.getCameraByName(name);\n if (camera) {\n this.activeCamera = camera;\n return camera;\n }\n return null;\n }\n /**\n * get an animation group using its name\n * @param name defines the material's name\n * @returns the animation group or null if none found.\n */\n getAnimationGroupByName(name) {\n for (let index = 0; index < this.animationGroups.length; index++) {\n if (this.animationGroups[index].name === name) {\n return this.animationGroups[index];\n }\n }\n return null;\n }\n _getMaterial(allowMultiMaterials, predicate) {\n for (let index = 0; index < this.materials.length; index++) {\n const material = this.materials[index];\n if (predicate(material)) {\n return material;\n }\n }\n if (allowMultiMaterials) {\n for (let index = 0; index < this.multiMaterials.length; index++) {\n const material = this.multiMaterials[index];\n if (predicate(material)) {\n return material;\n }\n }\n }\n return null;\n }\n /**\n * Get a material using its unique id\n * @param uniqueId defines the material's unique id\n * @param allowMultiMaterials determines whether multimaterials should be considered\n * @returns the material or null if none found.\n */\n getMaterialByUniqueID(uniqueId, allowMultiMaterials = false) {\n return this._getMaterial(allowMultiMaterials, (m) => m.uniqueId === uniqueId);\n }\n /**\n * get a material using its id\n * @param id defines the material's Id\n * @param allowMultiMaterials determines whether multimaterials should be considered\n * @returns the material or null if none found.\n */\n getMaterialById(id, allowMultiMaterials = false) {\n return this._getMaterial(allowMultiMaterials, (m) => m.id === id);\n }\n /**\n * Gets a material using its name\n * @param name defines the material's name\n * @param allowMultiMaterials determines whether multimaterials should be considered\n * @returns the material or null if none found.\n */\n getMaterialByName(name, allowMultiMaterials = false) {\n return this._getMaterial(allowMultiMaterials, (m) => m.name === name);\n }\n /**\n * Gets a last added material using a given id\n * @param id defines the material's id\n * @param allowMultiMaterials determines whether multimaterials should be considered\n * @returns the last material with the given id or null if none found.\n */\n getLastMaterialById(id, allowMultiMaterials = false) {\n for (let index = this.materials.length - 1; index >= 0; index--) {\n if (this.materials[index].id === id) {\n return this.materials[index];\n }\n }\n if (allowMultiMaterials) {\n for (let index = this.multiMaterials.length - 1; index >= 0; index--) {\n if (this.multiMaterials[index].id === id) {\n return this.multiMaterials[index];\n }\n }\n }\n return null;\n }\n /**\n * Get a texture using its unique id\n * @param uniqueId defines the texture's unique id\n * @returns the texture or null if none found.\n */\n getTextureByUniqueId(uniqueId) {\n for (let index = 0; index < this.textures.length; index++) {\n if (this.textures[index].uniqueId === uniqueId) {\n return this.textures[index];\n }\n }\n return null;\n }\n /**\n * Gets a texture using its name\n * @param name defines the texture's name\n * @returns the texture or null if none found.\n */\n getTextureByName(name) {\n for (let index = 0; index < this.textures.length; index++) {\n if (this.textures[index].name === name) {\n return this.textures[index];\n }\n }\n return null;\n }\n /**\n * Gets a camera using its Id\n * @param id defines the Id to look for\n * @returns the camera or null if not found\n */\n getCameraById(id) {\n for (let index = 0; index < this.cameras.length; index++) {\n if (this.cameras[index].id === id) {\n return this.cameras[index];\n }\n }\n return null;\n }\n /**\n * Gets a camera using its unique Id\n * @param uniqueId defines the unique Id to look for\n * @returns the camera or null if not found\n */\n getCameraByUniqueId(uniqueId) {\n for (let index = 0; index < this.cameras.length; index++) {\n if (this.cameras[index].uniqueId === uniqueId) {\n return this.cameras[index];\n }\n }\n return null;\n }\n /**\n * Gets a camera using its name\n * @param name defines the camera's name\n * @returns the camera or null if none found.\n */\n getCameraByName(name) {\n for (let index = 0; index < this.cameras.length; index++) {\n if (this.cameras[index].name === name) {\n return this.cameras[index];\n }\n }\n return null;\n }\n /**\n * Gets a bone using its Id\n * @param id defines the bone's Id\n * @returns the bone or null if not found\n */\n getBoneById(id) {\n for (let skeletonIndex = 0; skeletonIndex < this.skeletons.length; skeletonIndex++) {\n const skeleton = this.skeletons[skeletonIndex];\n for (let boneIndex = 0; boneIndex < skeleton.bones.length; boneIndex++) {\n if (skeleton.bones[boneIndex].id === id) {\n return skeleton.bones[boneIndex];\n }\n }\n }\n return null;\n }\n /**\n * Gets a bone using its id\n * @param name defines the bone's name\n * @returns the bone or null if not found\n */\n getBoneByName(name) {\n for (let skeletonIndex = 0; skeletonIndex < this.skeletons.length; skeletonIndex++) {\n const skeleton = this.skeletons[skeletonIndex];\n for (let boneIndex = 0; boneIndex < skeleton.bones.length; boneIndex++) {\n if (skeleton.bones[boneIndex].name === name) {\n return skeleton.bones[boneIndex];\n }\n }\n }\n return null;\n }\n /**\n * Gets a light node using its name\n * @param name defines the the light's name\n * @returns the light or null if none found.\n */\n getLightByName(name) {\n for (let index = 0; index < this.lights.length; index++) {\n if (this.lights[index].name === name) {\n return this.lights[index];\n }\n }\n return null;\n }\n /**\n * Gets a light node using its Id\n * @param id defines the light's Id\n * @returns the light or null if none found.\n */\n getLightById(id) {\n for (let index = 0; index < this.lights.length; index++) {\n if (this.lights[index].id === id) {\n return this.lights[index];\n }\n }\n return null;\n }\n /**\n * Gets a light node using its scene-generated unique Id\n * @param uniqueId defines the light's unique Id\n * @returns the light or null if none found.\n */\n getLightByUniqueId(uniqueId) {\n for (let index = 0; index < this.lights.length; index++) {\n if (this.lights[index].uniqueId === uniqueId) {\n return this.lights[index];\n }\n }\n return null;\n }\n /**\n * Gets a particle system by Id\n * @param id defines the particle system Id\n * @returns the corresponding system or null if none found\n */\n getParticleSystemById(id) {\n for (let index = 0; index < this.particleSystems.length; index++) {\n if (this.particleSystems[index].id === id) {\n return this.particleSystems[index];\n }\n }\n return null;\n }\n /**\n * Gets a geometry using its Id\n * @param id defines the geometry's Id\n * @returns the geometry or null if none found.\n */\n getGeometryById(id) {\n for (let index = 0; index < this.geometries.length; index++) {\n if (this.geometries[index].id === id) {\n return this.geometries[index];\n }\n }\n return null;\n }\n _getGeometryByUniqueId(uniqueId) {\n if (this._geometriesByUniqueId) {\n const index = this._geometriesByUniqueId[uniqueId];\n if (index !== undefined) {\n return this.geometries[index];\n }\n }\n else {\n for (let index = 0; index < this.geometries.length; index++) {\n if (this.geometries[index].uniqueId === uniqueId) {\n return this.geometries[index];\n }\n }\n }\n return null;\n }\n /**\n * Add a new geometry to this scene\n * @param geometry defines the geometry to be added to the scene.\n * @param force defines if the geometry must be pushed even if a geometry with this id already exists\n * @returns a boolean defining if the geometry was added or not\n */\n pushGeometry(geometry, force) {\n if (!force && this._getGeometryByUniqueId(geometry.uniqueId)) {\n return false;\n }\n this.addGeometry(geometry);\n this.onNewGeometryAddedObservable.notifyObservers(geometry);\n return true;\n }\n /**\n * Removes an existing geometry\n * @param geometry defines the geometry to be removed from the scene\n * @returns a boolean defining if the geometry was removed or not\n */\n removeGeometry(geometry) {\n let index;\n if (this._geometriesByUniqueId) {\n index = this._geometriesByUniqueId[geometry.uniqueId];\n if (index === undefined) {\n return false;\n }\n }\n else {\n index = this.geometries.indexOf(geometry);\n if (index < 0) {\n return false;\n }\n }\n if (index !== this.geometries.length - 1) {\n const lastGeometry = this.geometries[this.geometries.length - 1];\n if (lastGeometry) {\n this.geometries[index] = lastGeometry;\n if (this._geometriesByUniqueId) {\n this._geometriesByUniqueId[lastGeometry.uniqueId] = index;\n }\n }\n }\n if (this._geometriesByUniqueId) {\n this._geometriesByUniqueId[geometry.uniqueId] = undefined;\n }\n this.geometries.pop();\n this.onGeometryRemovedObservable.notifyObservers(geometry);\n return true;\n }\n /**\n * Gets the list of geometries attached to the scene\n * @returns an array of Geometry\n */\n getGeometries() {\n return this.geometries;\n }\n /**\n * Gets the first added mesh found of a given Id\n * @param id defines the Id to search for\n * @returns the mesh found or null if not found at all\n */\n getMeshById(id) {\n for (let index = 0; index < this.meshes.length; index++) {\n if (this.meshes[index].id === id) {\n return this.meshes[index];\n }\n }\n return null;\n }\n /**\n * Gets a list of meshes using their Id\n * @param id defines the Id to search for\n * @returns a list of meshes\n */\n getMeshesById(id) {\n return this.meshes.filter(function (m) {\n return m.id === id;\n });\n }\n /**\n * Gets the first added transform node found of a given Id\n * @param id defines the Id to search for\n * @returns the found transform node or null if not found at all.\n */\n getTransformNodeById(id) {\n for (let index = 0; index < this.transformNodes.length; index++) {\n if (this.transformNodes[index].id === id) {\n return this.transformNodes[index];\n }\n }\n return null;\n }\n /**\n * Gets a transform node with its auto-generated unique Id\n * @param uniqueId defines the unique Id to search for\n * @returns the found transform node or null if not found at all.\n */\n getTransformNodeByUniqueId(uniqueId) {\n for (let index = 0; index < this.transformNodes.length; index++) {\n if (this.transformNodes[index].uniqueId === uniqueId) {\n return this.transformNodes[index];\n }\n }\n return null;\n }\n /**\n * Gets a list of transform nodes using their Id\n * @param id defines the Id to search for\n * @returns a list of transform nodes\n */\n getTransformNodesById(id) {\n return this.transformNodes.filter(function (m) {\n return m.id === id;\n });\n }\n /**\n * Gets a mesh with its auto-generated unique Id\n * @param uniqueId defines the unique Id to search for\n * @returns the found mesh or null if not found at all.\n */\n getMeshByUniqueId(uniqueId) {\n for (let index = 0; index < this.meshes.length; index++) {\n if (this.meshes[index].uniqueId === uniqueId) {\n return this.meshes[index];\n }\n }\n return null;\n }\n /**\n * Gets a the last added mesh using a given Id\n * @param id defines the Id to search for\n * @returns the found mesh or null if not found at all.\n */\n getLastMeshById(id) {\n for (let index = this.meshes.length - 1; index >= 0; index--) {\n if (this.meshes[index].id === id) {\n return this.meshes[index];\n }\n }\n return null;\n }\n /**\n * Gets a the last transform node using a given Id\n * @param id defines the Id to search for\n * @returns the found mesh or null if not found at all.\n */\n getLastTransformNodeById(id) {\n for (let index = this.transformNodes.length - 1; index >= 0; index--) {\n if (this.transformNodes[index].id === id) {\n return this.transformNodes[index];\n }\n }\n return null;\n }\n /**\n * Gets a the last added node (Mesh, Camera, Light) using a given Id\n * @param id defines the Id to search for\n * @returns the found node or null if not found at all\n */\n getLastEntryById(id) {\n let index;\n for (index = this.meshes.length - 1; index >= 0; index--) {\n if (this.meshes[index].id === id) {\n return this.meshes[index];\n }\n }\n for (index = this.transformNodes.length - 1; index >= 0; index--) {\n if (this.transformNodes[index].id === id) {\n return this.transformNodes[index];\n }\n }\n for (index = this.cameras.length - 1; index >= 0; index--) {\n if (this.cameras[index].id === id) {\n return this.cameras[index];\n }\n }\n for (index = this.lights.length - 1; index >= 0; index--) {\n if (this.lights[index].id === id) {\n return this.lights[index];\n }\n }\n return null;\n }\n /**\n * Gets a node (Mesh, Camera, Light) using a given Id\n * @param id defines the Id to search for\n * @returns the found node or null if not found at all\n */\n getNodeById(id) {\n const mesh = this.getMeshById(id);\n if (mesh) {\n return mesh;\n }\n const transformNode = this.getTransformNodeById(id);\n if (transformNode) {\n return transformNode;\n }\n const light = this.getLightById(id);\n if (light) {\n return light;\n }\n const camera = this.getCameraById(id);\n if (camera) {\n return camera;\n }\n const bone = this.getBoneById(id);\n if (bone) {\n return bone;\n }\n return null;\n }\n /**\n * Gets a node (Mesh, Camera, Light) using a given name\n * @param name defines the name to search for\n * @returns the found node or null if not found at all.\n */\n getNodeByName(name) {\n const mesh = this.getMeshByName(name);\n if (mesh) {\n return mesh;\n }\n const transformNode = this.getTransformNodeByName(name);\n if (transformNode) {\n return transformNode;\n }\n const light = this.getLightByName(name);\n if (light) {\n return light;\n }\n const camera = this.getCameraByName(name);\n if (camera) {\n return camera;\n }\n const bone = this.getBoneByName(name);\n if (bone) {\n return bone;\n }\n return null;\n }\n /**\n * Gets a mesh using a given name\n * @param name defines the name to search for\n * @returns the found mesh or null if not found at all.\n */\n getMeshByName(name) {\n for (let index = 0; index < this.meshes.length; index++) {\n if (this.meshes[index].name === name) {\n return this.meshes[index];\n }\n }\n return null;\n }\n /**\n * Gets a transform node using a given name\n * @param name defines the name to search for\n * @returns the found transform node or null if not found at all.\n */\n getTransformNodeByName(name) {\n for (let index = 0; index < this.transformNodes.length; index++) {\n if (this.transformNodes[index].name === name) {\n return this.transformNodes[index];\n }\n }\n return null;\n }\n /**\n * Gets a skeleton using a given Id (if many are found, this function will pick the last one)\n * @param id defines the Id to search for\n * @returns the found skeleton or null if not found at all.\n */\n getLastSkeletonById(id) {\n for (let index = this.skeletons.length - 1; index >= 0; index--) {\n if (this.skeletons[index].id === id) {\n return this.skeletons[index];\n }\n }\n return null;\n }\n /**\n * Gets a skeleton using a given auto generated unique id\n * @param uniqueId defines the unique id to search for\n * @returns the found skeleton or null if not found at all.\n */\n getSkeletonByUniqueId(uniqueId) {\n for (let index = 0; index < this.skeletons.length; index++) {\n if (this.skeletons[index].uniqueId === uniqueId) {\n return this.skeletons[index];\n }\n }\n return null;\n }\n /**\n * Gets a skeleton using a given id (if many are found, this function will pick the first one)\n * @param id defines the id to search for\n * @returns the found skeleton or null if not found at all.\n */\n getSkeletonById(id) {\n for (let index = 0; index < this.skeletons.length; index++) {\n if (this.skeletons[index].id === id) {\n return this.skeletons[index];\n }\n }\n return null;\n }\n /**\n * Gets a skeleton using a given name\n * @param name defines the name to search for\n * @returns the found skeleton or null if not found at all.\n */\n getSkeletonByName(name) {\n for (let index = 0; index < this.skeletons.length; index++) {\n if (this.skeletons[index].name === name) {\n return this.skeletons[index];\n }\n }\n return null;\n }\n /**\n * Gets a morph target manager using a given id (if many are found, this function will pick the last one)\n * @param id defines the id to search for\n * @returns the found morph target manager or null if not found at all.\n */\n getMorphTargetManagerById(id) {\n for (let index = 0; index < this.morphTargetManagers.length; index++) {\n if (this.morphTargetManagers[index].uniqueId === id) {\n return this.morphTargetManagers[index];\n }\n }\n return null;\n }\n /**\n * Gets a morph target using a given id (if many are found, this function will pick the first one)\n * @param id defines the id to search for\n * @returns the found morph target or null if not found at all.\n */\n getMorphTargetById(id) {\n for (let managerIndex = 0; managerIndex < this.morphTargetManagers.length; ++managerIndex) {\n const morphTargetManager = this.morphTargetManagers[managerIndex];\n for (let index = 0; index < morphTargetManager.numTargets; ++index) {\n const target = morphTargetManager.getTarget(index);\n if (target.id === id) {\n return target;\n }\n }\n }\n return null;\n }\n /**\n * Gets a morph target using a given name (if many are found, this function will pick the first one)\n * @param name defines the name to search for\n * @returns the found morph target or null if not found at all.\n */\n getMorphTargetByName(name) {\n for (let managerIndex = 0; managerIndex < this.morphTargetManagers.length; ++managerIndex) {\n const morphTargetManager = this.morphTargetManagers[managerIndex];\n for (let index = 0; index < morphTargetManager.numTargets; ++index) {\n const target = morphTargetManager.getTarget(index);\n if (target.name === name) {\n return target;\n }\n }\n }\n return null;\n }\n /**\n * Gets a post process using a given name (if many are found, this function will pick the first one)\n * @param name defines the name to search for\n * @returns the found post process or null if not found at all.\n */\n getPostProcessByName(name) {\n for (let postProcessIndex = 0; postProcessIndex < this.postProcesses.length; ++postProcessIndex) {\n const postProcess = this.postProcesses[postProcessIndex];\n if (postProcess.name === name) {\n return postProcess;\n }\n }\n return null;\n }\n /**\n * Gets a boolean indicating if the given mesh is active\n * @param mesh defines the mesh to look for\n * @returns true if the mesh is in the active list\n */\n isActiveMesh(mesh) {\n return this._activeMeshes.indexOf(mesh) !== -1;\n }\n /**\n * Return a unique id as a string which can serve as an identifier for the scene\n */\n get uid() {\n if (!this._uid) {\n this._uid = Tools.RandomId();\n }\n return this._uid;\n }\n /**\n * Add an externally attached data from its key.\n * This method call will fail and return false, if such key already exists.\n * If you don't care and just want to get the data no matter what, use the more convenient getOrAddExternalDataWithFactory() method.\n * @param key the unique key that identifies the data\n * @param data the data object to associate to the key for this Engine instance\n * @returns true if no such key were already present and the data was added successfully, false otherwise\n */\n addExternalData(key, data) {\n if (!this._externalData) {\n this._externalData = new StringDictionary();\n }\n return this._externalData.add(key, data);\n }\n /**\n * Get an externally attached data from its key\n * @param key the unique key that identifies the data\n * @returns the associated data, if present (can be null), or undefined if not present\n */\n getExternalData(key) {\n if (!this._externalData) {\n return null;\n }\n return this._externalData.get(key);\n }\n /**\n * Get an externally attached data from its key, create it using a factory if it's not already present\n * @param key the unique key that identifies the data\n * @param factory the factory that will be called to create the instance if and only if it doesn't exists\n * @returns the associated data, can be null if the factory returned null.\n */\n getOrAddExternalDataWithFactory(key, factory) {\n if (!this._externalData) {\n this._externalData = new StringDictionary();\n }\n return this._externalData.getOrAddWithFactory(key, factory);\n }\n /**\n * Remove an externally attached data from the Engine instance\n * @param key the unique key that identifies the data\n * @returns true if the data was successfully removed, false if it doesn't exist\n */\n removeExternalData(key) {\n return this._externalData.remove(key);\n }\n _evaluateSubMesh(subMesh, mesh, initialMesh, forcePush) {\n if (forcePush || subMesh.isInFrustum(this._frustumPlanes)) {\n for (const step of this._evaluateSubMeshStage) {\n step.action(mesh, subMesh);\n }\n const material = subMesh.getMaterial();\n if (material !== null && material !== undefined) {\n // Render targets\n if (material.hasRenderTargetTextures && material.getRenderTargetTextures != null) {\n if (this._processedMaterials.indexOf(material) === -1) {\n this._processedMaterials.push(material);\n this._materialsRenderTargets.concatWithNoDuplicate(material.getRenderTargetTextures());\n }\n }\n // Dispatch\n this._renderingManager.dispatch(subMesh, mesh, material);\n }\n }\n }\n /**\n * Clear the processed materials smart array preventing retention point in material dispose.\n */\n freeProcessedMaterials() {\n this._processedMaterials.dispose();\n }\n /** Gets or sets a boolean blocking all the calls to freeActiveMeshes and freeRenderingGroups\n * It can be used in order to prevent going through methods freeRenderingGroups and freeActiveMeshes several times to improve performance\n * when disposing several meshes in a row or a hierarchy of meshes.\n * When used, it is the responsibility of the user to blockfreeActiveMeshesAndRenderingGroups back to false.\n */\n get blockfreeActiveMeshesAndRenderingGroups() {\n return this._preventFreeActiveMeshesAndRenderingGroups;\n }\n set blockfreeActiveMeshesAndRenderingGroups(value) {\n if (this._preventFreeActiveMeshesAndRenderingGroups === value) {\n return;\n }\n if (value) {\n this.freeActiveMeshes();\n this.freeRenderingGroups();\n }\n this._preventFreeActiveMeshesAndRenderingGroups = value;\n }\n /**\n * Clear the active meshes smart array preventing retention point in mesh dispose.\n */\n freeActiveMeshes() {\n if (this.blockfreeActiveMeshesAndRenderingGroups) {\n return;\n }\n this._activeMeshes.dispose();\n if (this.activeCamera && this.activeCamera._activeMeshes) {\n this.activeCamera._activeMeshes.dispose();\n }\n if (this.activeCameras) {\n for (let i = 0; i < this.activeCameras.length; i++) {\n const activeCamera = this.activeCameras[i];\n if (activeCamera && activeCamera._activeMeshes) {\n activeCamera._activeMeshes.dispose();\n }\n }\n }\n }\n /**\n * Clear the info related to rendering groups preventing retention points during dispose.\n */\n freeRenderingGroups() {\n if (this.blockfreeActiveMeshesAndRenderingGroups) {\n return;\n }\n if (this._renderingManager) {\n this._renderingManager.freeRenderingGroups();\n }\n if (this.textures) {\n for (let i = 0; i < this.textures.length; i++) {\n const texture = this.textures[i];\n if (texture && texture.renderList) {\n texture.freeRenderingGroups();\n }\n }\n }\n }\n /** @internal */\n _isInIntermediateRendering() {\n return this._intermediateRendering;\n }\n /**\n * Use this function to stop evaluating active meshes. The current list will be keep alive between frames\n * @param skipEvaluateActiveMeshes defines an optional boolean indicating that the evaluate active meshes step must be completely skipped\n * @param onSuccess optional success callback\n * @param onError optional error callback\n * @param freezeMeshes defines if meshes should be frozen (true by default)\n * @param keepFrustumCulling defines if you want to keep running the frustum clipping (false by default)\n * @returns the current scene\n */\n freezeActiveMeshes(skipEvaluateActiveMeshes = false, onSuccess, onError, freezeMeshes = true, keepFrustumCulling = false) {\n this.executeWhenReady(() => {\n if (!this.activeCamera) {\n onError && onError(\"No active camera found\");\n return;\n }\n if (!this._frustumPlanes) {\n this.updateTransformMatrix();\n }\n this._evaluateActiveMeshes();\n this._activeMeshesFrozen = true;\n this._activeMeshesFrozenButKeepClipping = keepFrustumCulling;\n this._skipEvaluateActiveMeshesCompletely = skipEvaluateActiveMeshes;\n if (freezeMeshes) {\n for (let index = 0; index < this._activeMeshes.length; index++) {\n this._activeMeshes.data[index]._freeze();\n }\n }\n onSuccess && onSuccess();\n });\n return this;\n }\n /**\n * Use this function to restart evaluating active meshes on every frame\n * @returns the current scene\n */\n unfreezeActiveMeshes() {\n for (let index = 0; index < this.meshes.length; index++) {\n const mesh = this.meshes[index];\n if (mesh._internalAbstractMeshDataInfo) {\n mesh._internalAbstractMeshDataInfo._isActive = false;\n }\n }\n for (let index = 0; index < this._activeMeshes.length; index++) {\n this._activeMeshes.data[index]._unFreeze();\n }\n this._activeMeshesFrozen = false;\n return this;\n }\n _executeActiveContainerCleanup(container) {\n const isInFastMode = this._engine.snapshotRendering && this._engine.snapshotRenderingMode === 1;\n if (!isInFastMode && this._activeMeshesFrozen && this._activeMeshes.length) {\n return; // Do not execute in frozen mode\n }\n // We need to ensure we are not in the rendering loop\n this.onBeforeRenderObservable.addOnce(() => container.dispose());\n }\n _evaluateActiveMeshes() {\n var _a;\n if (this._engine.snapshotRendering && this._engine.snapshotRenderingMode === 1) {\n if (this._activeMeshes.length > 0) {\n (_a = this.activeCamera) === null || _a === void 0 ? void 0 : _a._activeMeshes.reset();\n this._activeMeshes.reset();\n this._renderingManager.reset();\n this._processedMaterials.reset();\n this._activeParticleSystems.reset();\n this._activeSkeletons.reset();\n this._softwareSkinnedMeshes.reset();\n }\n return;\n }\n if (this._activeMeshesFrozen && this._activeMeshes.length) {\n if (!this._skipEvaluateActiveMeshesCompletely) {\n const len = this._activeMeshes.length;\n for (let i = 0; i < len; i++) {\n const mesh = this._activeMeshes.data[i];\n mesh.computeWorldMatrix();\n }\n }\n if (this._activeParticleSystems) {\n const psLength = this._activeParticleSystems.length;\n for (let i = 0; i < psLength; i++) {\n this._activeParticleSystems.data[i].animate();\n }\n }\n this._renderingManager.resetSprites();\n return;\n }\n if (!this.activeCamera) {\n return;\n }\n this.onBeforeActiveMeshesEvaluationObservable.notifyObservers(this);\n this.activeCamera._activeMeshes.reset();\n this._activeMeshes.reset();\n this._renderingManager.reset();\n this._processedMaterials.reset();\n this._activeParticleSystems.reset();\n this._activeSkeletons.reset();\n this._softwareSkinnedMeshes.reset();\n this._materialsRenderTargets.reset();\n for (const step of this._beforeEvaluateActiveMeshStage) {\n step.action();\n }\n // Determine mesh candidates\n const meshes = this.getActiveMeshCandidates();\n // Check each mesh\n const len = meshes.length;\n for (let i = 0; i < len; i++) {\n const mesh = meshes.data[i];\n mesh._internalAbstractMeshDataInfo._currentLODIsUpToDate = false;\n if (mesh.isBlocked) {\n continue;\n }\n this._totalVertices.addCount(mesh.getTotalVertices(), false);\n if (!mesh.isReady() || !mesh.isEnabled() || mesh.scaling.hasAZeroComponent) {\n continue;\n }\n mesh.computeWorldMatrix();\n // Intersections\n if (mesh.actionManager && mesh.actionManager.hasSpecificTriggers2(12, 13)) {\n this._meshesForIntersections.pushNoDuplicate(mesh);\n }\n // Switch to current LOD\n let meshToRender = this.customLODSelector ? this.customLODSelector(mesh, this.activeCamera) : mesh.getLOD(this.activeCamera);\n mesh._internalAbstractMeshDataInfo._currentLOD = meshToRender;\n mesh._internalAbstractMeshDataInfo._currentLODIsUpToDate = true;\n if (meshToRender === undefined || meshToRender === null) {\n continue;\n }\n // Compute world matrix if LOD is billboard\n if (meshToRender !== mesh && meshToRender.billboardMode !== 0) {\n meshToRender.computeWorldMatrix();\n }\n mesh._preActivate();\n if (mesh.isVisible &&\n mesh.visibility > 0 &&\n (mesh.layerMask & this.activeCamera.layerMask) !== 0 &&\n (this._skipFrustumClipping || mesh.alwaysSelectAsActiveMesh || mesh.isInFrustum(this._frustumPlanes))) {\n this._activeMeshes.push(mesh);\n this.activeCamera._activeMeshes.push(mesh);\n if (meshToRender !== mesh) {\n meshToRender._activate(this._renderId, false);\n }\n for (const step of this._preActiveMeshStage) {\n step.action(mesh);\n }\n if (mesh._activate(this._renderId, false)) {\n if (!mesh.isAnInstance) {\n meshToRender._internalAbstractMeshDataInfo._onlyForInstances = false;\n }\n else {\n if (mesh._internalAbstractMeshDataInfo._actAsRegularMesh) {\n meshToRender = mesh;\n }\n }\n meshToRender._internalAbstractMeshDataInfo._isActive = true;\n this._activeMesh(mesh, meshToRender);\n }\n mesh._postActivate();\n }\n }\n this.onAfterActiveMeshesEvaluationObservable.notifyObservers(this);\n // Particle systems\n if (this.particlesEnabled) {\n this.onBeforeParticlesRenderingObservable.notifyObservers(this);\n for (let particleIndex = 0; particleIndex < this.particleSystems.length; particleIndex++) {\n const particleSystem = this.particleSystems[particleIndex];\n if (!particleSystem.isStarted() || !particleSystem.emitter) {\n continue;\n }\n const emitter = particleSystem.emitter;\n if (!emitter.position || emitter.isEnabled()) {\n this._activeParticleSystems.push(particleSystem);\n particleSystem.animate();\n this._renderingManager.dispatchParticles(particleSystem);\n }\n }\n this.onAfterParticlesRenderingObservable.notifyObservers(this);\n }\n }\n _activeMesh(sourceMesh, mesh) {\n if (this._skeletonsEnabled && mesh.skeleton !== null && mesh.skeleton !== undefined) {\n if (this._activeSkeletons.pushNoDuplicate(mesh.skeleton)) {\n mesh.skeleton.prepare();\n this._activeBones.addCount(mesh.skeleton.bones.length, false);\n }\n if (!mesh.computeBonesUsingShaders) {\n this._softwareSkinnedMeshes.pushNoDuplicate(mesh);\n }\n }\n let forcePush = sourceMesh.hasInstances || sourceMesh.isAnInstance || this.dispatchAllSubMeshesOfActiveMeshes || this._skipFrustumClipping || mesh.alwaysSelectAsActiveMesh;\n if (mesh && mesh.subMeshes && mesh.subMeshes.length > 0) {\n const subMeshes = this.getActiveSubMeshCandidates(mesh);\n const len = subMeshes.length;\n forcePush = forcePush || len === 1;\n for (let i = 0; i < len; i++) {\n const subMesh = subMeshes.data[i];\n this._evaluateSubMesh(subMesh, mesh, sourceMesh, forcePush);\n }\n }\n }\n /**\n * Update the transform matrix to update from the current active camera\n * @param force defines a boolean used to force the update even if cache is up to date\n */\n updateTransformMatrix(force) {\n if (!this.activeCamera) {\n return;\n }\n if (this.activeCamera._renderingMultiview) {\n const leftCamera = this.activeCamera._rigCameras[0];\n const rightCamera = this.activeCamera._rigCameras[1];\n this.setTransformMatrix(leftCamera.getViewMatrix(), leftCamera.getProjectionMatrix(force), rightCamera.getViewMatrix(), rightCamera.getProjectionMatrix(force));\n }\n else {\n this.setTransformMatrix(this.activeCamera.getViewMatrix(), this.activeCamera.getProjectionMatrix(force));\n }\n }\n _bindFrameBuffer(camera, clear = true) {\n if (camera && camera._multiviewTexture) {\n camera._multiviewTexture._bindFrameBuffer();\n }\n else if (camera && camera.outputRenderTarget) {\n camera.outputRenderTarget._bindFrameBuffer();\n }\n else {\n if (!this._engine._currentFrameBufferIsDefaultFrameBuffer()) {\n this._engine.restoreDefaultFramebuffer();\n }\n }\n if (clear) {\n this._clearFrameBuffer(camera);\n }\n }\n _clearFrameBuffer(camera) {\n // we assume the framebuffer currently bound is the right one\n if (camera && camera._multiviewTexture) {\n // no clearing?\n }\n else if (camera && camera.outputRenderTarget && !camera._renderingMultiview) {\n const rtt = camera.outputRenderTarget;\n if (rtt.onClearObservable.hasObservers()) {\n rtt.onClearObservable.notifyObservers(this._engine);\n }\n else if (!rtt.skipInitialClear) {\n if (this.autoClear) {\n this._engine.clear(rtt.clearColor || this.clearColor, !rtt._cleared, true, true);\n }\n rtt._cleared = true;\n }\n }\n else {\n if (!this._defaultFrameBufferCleared) {\n this._defaultFrameBufferCleared = true;\n this._clear();\n }\n else {\n this._engine.clear(null, false, true, true);\n }\n }\n }\n /**\n * @internal\n */\n _renderForCamera(camera, rigParent, bindFrameBuffer = true) {\n var _a, _b, _c;\n if (camera && camera._skipRendering) {\n return;\n }\n const engine = this._engine;\n // Use _activeCamera instead of activeCamera to avoid onActiveCameraChanged\n this._activeCamera = camera;\n if (!this.activeCamera) {\n throw new Error(\"Active camera not set\");\n }\n // Viewport\n engine.setViewport(this.activeCamera.viewport);\n // Camera\n this.resetCachedMaterial();\n this._renderId++;\n if (!this.prePass && bindFrameBuffer) {\n let skipInitialClear = true;\n if (camera._renderingMultiview && camera.outputRenderTarget) {\n skipInitialClear = camera.outputRenderTarget.skipInitialClear;\n if (this.autoClear) {\n this._defaultFrameBufferCleared = false;\n camera.outputRenderTarget.skipInitialClear = false;\n }\n }\n this._bindFrameBuffer(this._activeCamera);\n if (camera._renderingMultiview && camera.outputRenderTarget) {\n camera.outputRenderTarget.skipInitialClear = skipInitialClear;\n }\n }\n this.updateTransformMatrix();\n this.onBeforeCameraRenderObservable.notifyObservers(this.activeCamera);\n // Meshes\n this._evaluateActiveMeshes();\n // Software skinning\n for (let softwareSkinnedMeshIndex = 0; softwareSkinnedMeshIndex < this._softwareSkinnedMeshes.length; softwareSkinnedMeshIndex++) {\n const mesh = this._softwareSkinnedMeshes.data[softwareSkinnedMeshIndex];\n mesh.applySkeleton(mesh.skeleton);\n }\n // Render targets\n this.onBeforeRenderTargetsRenderObservable.notifyObservers(this);\n this._renderTargets.concatWithNoDuplicate(this._materialsRenderTargets);\n if (camera.customRenderTargets && camera.customRenderTargets.length > 0) {\n this._renderTargets.concatWithNoDuplicate(camera.customRenderTargets);\n }\n if (rigParent && rigParent.customRenderTargets && rigParent.customRenderTargets.length > 0) {\n this._renderTargets.concatWithNoDuplicate(rigParent.customRenderTargets);\n }\n if (this.environmentTexture && this.environmentTexture.isRenderTarget) {\n this._renderTargets.pushNoDuplicate(this.environmentTexture);\n }\n // Collects render targets from external components.\n for (const step of this._gatherActiveCameraRenderTargetsStage) {\n step.action(this._renderTargets);\n }\n let needRebind = false;\n if (this.renderTargetsEnabled) {\n this._intermediateRendering = true;\n if (this._renderTargets.length > 0) {\n Tools.StartPerformanceCounter(\"Render targets\", this._renderTargets.length > 0);\n for (let renderIndex = 0; renderIndex < this._renderTargets.length; renderIndex++) {\n const renderTarget = this._renderTargets.data[renderIndex];\n if (renderTarget._shouldRender()) {\n this._renderId++;\n const hasSpecialRenderTargetCamera = renderTarget.activeCamera && renderTarget.activeCamera !== this.activeCamera;\n renderTarget.render(hasSpecialRenderTargetCamera, this.dumpNextRenderTargets);\n needRebind = true;\n }\n }\n Tools.EndPerformanceCounter(\"Render targets\", this._renderTargets.length > 0);\n this._renderId++;\n }\n for (const step of this._cameraDrawRenderTargetStage) {\n needRebind = step.action(this.activeCamera) || needRebind;\n }\n this._intermediateRendering = false;\n }\n this._engine.currentRenderPassId = (_c = (_b = (_a = camera.outputRenderTarget) === null || _a === void 0 ? void 0 : _a.renderPassId) !== null && _b !== void 0 ? _b : camera.renderPassId) !== null && _c !== void 0 ? _c : 0;\n // Restore framebuffer after rendering to targets\n if (needRebind && !this.prePass) {\n this._bindFrameBuffer(this._activeCamera, false);\n }\n this.onAfterRenderTargetsRenderObservable.notifyObservers(this);\n // Prepare Frame\n if (this.postProcessManager && !camera._multiviewTexture && !this.prePass) {\n this.postProcessManager._prepareFrame();\n }\n // Before Camera Draw\n for (const step of this._beforeCameraDrawStage) {\n step.action(this.activeCamera);\n }\n // Render\n this.onBeforeDrawPhaseObservable.notifyObservers(this);\n if (engine.snapshotRendering && engine.snapshotRenderingMode === 1) {\n this.finalizeSceneUbo();\n }\n this._renderingManager.render(null, null, true, true);\n this.onAfterDrawPhaseObservable.notifyObservers(this);\n // After Camera Draw\n for (const step of this._afterCameraDrawStage) {\n step.action(this.activeCamera);\n }\n // Finalize frame\n if (this.postProcessManager && !camera._multiviewTexture) {\n // if the camera has an output render target, render the post process to the render target\n const texture = camera.outputRenderTarget ? camera.outputRenderTarget.renderTarget : undefined;\n this.postProcessManager._finalizeFrame(camera.isIntermediate, texture);\n }\n // After post process\n for (const step of this._afterCameraPostProcessStage) {\n step.action(this.activeCamera);\n }\n // Reset some special arrays\n this._renderTargets.reset();\n this.onAfterCameraRenderObservable.notifyObservers(this.activeCamera);\n }\n _processSubCameras(camera, bindFrameBuffer = true) {\n if (camera.cameraRigMode === 0 || camera._renderingMultiview) {\n if (camera._renderingMultiview && !this._multiviewSceneUbo) {\n this._createMultiviewUbo();\n }\n this._renderForCamera(camera, undefined, bindFrameBuffer);\n this.onAfterRenderCameraObservable.notifyObservers(camera);\n return;\n }\n if (camera._useMultiviewToSingleView) {\n this._renderMultiviewToSingleView(camera);\n }\n else {\n // rig cameras\n this.onBeforeCameraRenderObservable.notifyObservers(camera);\n for (let index = 0; index < camera._rigCameras.length; index++) {\n this._renderForCamera(camera._rigCameras[index], camera);\n }\n }\n // Use _activeCamera instead of activeCamera to avoid onActiveCameraChanged\n this._activeCamera = camera;\n this.updateTransformMatrix();\n this.onAfterRenderCameraObservable.notifyObservers(camera);\n }\n _checkIntersections() {\n for (let index = 0; index < this._meshesForIntersections.length; index++) {\n const sourceMesh = this._meshesForIntersections.data[index];\n if (!sourceMesh.actionManager) {\n continue;\n }\n for (let actionIndex = 0; sourceMesh.actionManager && actionIndex < sourceMesh.actionManager.actions.length; actionIndex++) {\n const action = sourceMesh.actionManager.actions[actionIndex];\n if (action.trigger === 12 || action.trigger === 13) {\n const parameters = action.getTriggerParameter();\n const otherMesh = parameters.mesh ? parameters.mesh : parameters;\n const areIntersecting = otherMesh.intersectsMesh(sourceMesh, parameters.usePreciseIntersection);\n const currentIntersectionInProgress = sourceMesh._intersectionsInProgress.indexOf(otherMesh);\n if (areIntersecting && currentIntersectionInProgress === -1) {\n if (action.trigger === 12) {\n action._executeCurrent(ActionEvent.CreateNew(sourceMesh, undefined, otherMesh));\n sourceMesh._intersectionsInProgress.push(otherMesh);\n }\n else if (action.trigger === 13) {\n sourceMesh._intersectionsInProgress.push(otherMesh);\n }\n }\n else if (!areIntersecting && currentIntersectionInProgress > -1) {\n //They intersected, and now they don't.\n //is this trigger an exit trigger? execute an event.\n if (action.trigger === 13) {\n action._executeCurrent(ActionEvent.CreateNew(sourceMesh, undefined, otherMesh));\n }\n //if this is an exit trigger, or no exit trigger exists, remove the id from the intersection in progress array.\n if (!sourceMesh.actionManager.hasSpecificTrigger(13, (parameter) => {\n const parameterMesh = parameter.mesh ? parameter.mesh : parameter;\n return otherMesh === parameterMesh;\n }) ||\n action.trigger === 13) {\n sourceMesh._intersectionsInProgress.splice(currentIntersectionInProgress, 1);\n }\n }\n }\n }\n }\n }\n /**\n * @internal\n */\n _advancePhysicsEngineStep(step) {\n // Do nothing. Code will be replaced if physics engine component is referenced\n }\n /** @internal */\n _animate() {\n // Nothing to do as long as Animatable have not been imported.\n }\n /** Execute all animations (for a frame) */\n animate() {\n if (this._engine.isDeterministicLockStep()) {\n let deltaTime = Math.max(Scene.MinDeltaTime, Math.min(this._engine.getDeltaTime(), Scene.MaxDeltaTime)) + this._timeAccumulator;\n const defaultFrameTime = this._engine.getTimeStep();\n const defaultFPS = 1000.0 / defaultFrameTime / 1000.0;\n let stepsTaken = 0;\n const maxSubSteps = this._engine.getLockstepMaxSteps();\n let internalSteps = Math.floor(deltaTime / defaultFrameTime);\n internalSteps = Math.min(internalSteps, maxSubSteps);\n while (deltaTime > 0 && stepsTaken < internalSteps) {\n this.onBeforeStepObservable.notifyObservers(this);\n // Animations\n this._animationRatio = defaultFrameTime * defaultFPS;\n this._animate();\n this.onAfterAnimationsObservable.notifyObservers(this);\n // Physics\n if (this.physicsEnabled) {\n this._advancePhysicsEngineStep(defaultFrameTime);\n }\n this.onAfterStepObservable.notifyObservers(this);\n this._currentStepId++;\n stepsTaken++;\n deltaTime -= defaultFrameTime;\n }\n this._timeAccumulator = deltaTime < 0 ? 0 : deltaTime;\n }\n else {\n // Animations\n const deltaTime = this.useConstantAnimationDeltaTime ? 16 : Math.max(Scene.MinDeltaTime, Math.min(this._engine.getDeltaTime(), Scene.MaxDeltaTime));\n this._animationRatio = deltaTime * (60.0 / 1000.0);\n this._animate();\n this.onAfterAnimationsObservable.notifyObservers(this);\n // Physics\n if (this.physicsEnabled) {\n this._advancePhysicsEngineStep(deltaTime);\n }\n }\n }\n _clear() {\n if (this.autoClearDepthAndStencil || this.autoClear) {\n this._engine.clear(this.clearColor, this.autoClear || this.forceWireframe || this.forcePointsCloud, this.autoClearDepthAndStencil, this.autoClearDepthAndStencil);\n }\n }\n _checkCameraRenderTarget(camera) {\n var _a;\n if ((camera === null || camera === void 0 ? void 0 : camera.outputRenderTarget) && !(camera === null || camera === void 0 ? void 0 : camera.isRigCamera)) {\n camera.outputRenderTarget._cleared = false;\n }\n if ((_a = camera === null || camera === void 0 ? void 0 : camera.rigCameras) === null || _a === void 0 ? void 0 : _a.length) {\n for (let i = 0; i < camera.rigCameras.length; ++i) {\n const rtt = camera.rigCameras[i].outputRenderTarget;\n if (rtt) {\n rtt._cleared = false;\n }\n }\n }\n }\n /**\n * Resets the draw wrappers cache of all meshes\n * @param passId If provided, releases only the draw wrapper corresponding to this render pass id\n */\n resetDrawCache(passId) {\n if (!this.meshes) {\n return;\n }\n for (const mesh of this.meshes) {\n mesh.resetDrawCache(passId);\n }\n }\n /**\n * Render the scene\n * @param updateCameras defines a boolean indicating if cameras must update according to their inputs (true by default)\n * @param ignoreAnimations defines a boolean indicating if animations should not be executed (false by default)\n */\n render(updateCameras = true, ignoreAnimations = false) {\n var _a, _b, _c;\n if (this.isDisposed) {\n return;\n }\n if (this.onReadyObservable.hasObservers() && this._executeWhenReadyTimeoutId === null) {\n this._checkIsReady();\n }\n this._frameId++;\n this._defaultFrameBufferCleared = false;\n this._checkCameraRenderTarget(this.activeCamera);\n if ((_a = this.activeCameras) === null || _a === void 0 ? void 0 : _a.length) {\n this.activeCameras.forEach(this._checkCameraRenderTarget);\n }\n // Register components that have been associated lately to the scene.\n this._registerTransientComponents();\n this._activeParticles.fetchNewFrame();\n this._totalVertices.fetchNewFrame();\n this._activeIndices.fetchNewFrame();\n this._activeBones.fetchNewFrame();\n this._meshesForIntersections.reset();\n this.resetCachedMaterial();\n this.onBeforeAnimationsObservable.notifyObservers(this);\n // Actions\n if (this.actionManager) {\n this.actionManager.processTrigger(11);\n }\n // Animations\n if (!ignoreAnimations) {\n this.animate();\n }\n // Before camera update steps\n for (const step of this._beforeCameraUpdateStage) {\n step.action();\n }\n // Update Cameras\n if (updateCameras) {\n if (this.activeCameras && this.activeCameras.length > 0) {\n for (let cameraIndex = 0; cameraIndex < this.activeCameras.length; cameraIndex++) {\n const camera = this.activeCameras[cameraIndex];\n camera.update();\n if (camera.cameraRigMode !== 0) {\n // rig cameras\n for (let index = 0; index < camera._rigCameras.length; index++) {\n camera._rigCameras[index].update();\n }\n }\n }\n }\n else if (this.activeCamera) {\n this.activeCamera.update();\n if (this.activeCamera.cameraRigMode !== 0) {\n // rig cameras\n for (let index = 0; index < this.activeCamera._rigCameras.length; index++) {\n this.activeCamera._rigCameras[index].update();\n }\n }\n }\n }\n // Before render\n this.onBeforeRenderObservable.notifyObservers(this);\n const engine = this.getEngine();\n // Customs render targets\n this.onBeforeRenderTargetsRenderObservable.notifyObservers(this);\n const currentActiveCamera = ((_b = this.activeCameras) === null || _b === void 0 ? void 0 : _b.length) ? this.activeCameras[0] : this.activeCamera;\n if (this.renderTargetsEnabled) {\n Tools.StartPerformanceCounter(\"Custom render targets\", this.customRenderTargets.length > 0);\n this._intermediateRendering = true;\n for (let customIndex = 0; customIndex < this.customRenderTargets.length; customIndex++) {\n const renderTarget = this.customRenderTargets[customIndex];\n if (renderTarget._shouldRender()) {\n this._renderId++;\n this.activeCamera = renderTarget.activeCamera || this.activeCamera;\n if (!this.activeCamera) {\n throw new Error(\"Active camera not set\");\n }\n // Viewport\n engine.setViewport(this.activeCamera.viewport);\n // Camera\n this.updateTransformMatrix();\n renderTarget.render(currentActiveCamera !== this.activeCamera, this.dumpNextRenderTargets);\n }\n }\n Tools.EndPerformanceCounter(\"Custom render targets\", this.customRenderTargets.length > 0);\n this._intermediateRendering = false;\n this._renderId++;\n }\n this._engine.currentRenderPassId = (_c = currentActiveCamera === null || currentActiveCamera === void 0 ? void 0 : currentActiveCamera.renderPassId) !== null && _c !== void 0 ? _c : 0;\n // Restore back buffer\n this.activeCamera = currentActiveCamera;\n if (this._activeCamera && this._activeCamera.cameraRigMode !== 22 && !this.prePass) {\n this._bindFrameBuffer(this._activeCamera, false);\n }\n this.onAfterRenderTargetsRenderObservable.notifyObservers(this);\n for (const step of this._beforeClearStage) {\n step.action();\n }\n // Clear\n this._clearFrameBuffer(this.activeCamera);\n // Collects render targets from external components.\n for (const step of this._gatherRenderTargetsStage) {\n step.action(this._renderTargets);\n }\n // Multi-cameras?\n if (this.activeCameras && this.activeCameras.length > 0) {\n for (let cameraIndex = 0; cameraIndex < this.activeCameras.length; cameraIndex++) {\n this._processSubCameras(this.activeCameras[cameraIndex], cameraIndex > 0);\n }\n }\n else {\n if (!this.activeCamera) {\n throw new Error(\"No camera defined\");\n }\n this._processSubCameras(this.activeCamera, !!this.activeCamera.outputRenderTarget);\n }\n // Intersection checks\n this._checkIntersections();\n // Executes the after render stage actions.\n for (const step of this._afterRenderStage) {\n step.action();\n }\n // After render\n if (this.afterRender) {\n this.afterRender();\n }\n this.onAfterRenderObservable.notifyObservers(this);\n // Cleaning\n if (this._toBeDisposed.length) {\n for (let index = 0; index < this._toBeDisposed.length; index++) {\n const data = this._toBeDisposed[index];\n if (data) {\n data.dispose();\n }\n }\n this._toBeDisposed.length = 0;\n }\n if (this.dumpNextRenderTargets) {\n this.dumpNextRenderTargets = false;\n }\n this._activeBones.addCount(0, true);\n this._activeIndices.addCount(0, true);\n this._activeParticles.addCount(0, true);\n this._engine.restoreDefaultFramebuffer();\n }\n /**\n * Freeze all materials\n * A frozen material will not be updatable but should be faster to render\n * Note: multimaterials will not be frozen, but their submaterials will\n */\n freezeMaterials() {\n for (let i = 0; i < this.materials.length; i++) {\n this.materials[i].freeze();\n }\n }\n /**\n * Unfreeze all materials\n * A frozen material will not be updatable but should be faster to render\n */\n unfreezeMaterials() {\n for (let i = 0; i < this.materials.length; i++) {\n this.materials[i].unfreeze();\n }\n }\n /**\n * Releases all held resources\n */\n dispose() {\n if (this.isDisposed) {\n return;\n }\n this.beforeRender = null;\n this.afterRender = null;\n this.metadata = null;\n this.skeletons.length = 0;\n this.morphTargetManagers.length = 0;\n this._transientComponents.length = 0;\n this._isReadyForMeshStage.clear();\n this._beforeEvaluateActiveMeshStage.clear();\n this._evaluateSubMeshStage.clear();\n this._preActiveMeshStage.clear();\n this._cameraDrawRenderTargetStage.clear();\n this._beforeCameraDrawStage.clear();\n this._beforeRenderTargetDrawStage.clear();\n this._beforeRenderingGroupDrawStage.clear();\n this._beforeRenderingMeshStage.clear();\n this._afterRenderingMeshStage.clear();\n this._afterRenderingGroupDrawStage.clear();\n this._afterCameraDrawStage.clear();\n this._afterRenderTargetDrawStage.clear();\n this._afterRenderStage.clear();\n this._beforeCameraUpdateStage.clear();\n this._beforeClearStage.clear();\n this._gatherRenderTargetsStage.clear();\n this._gatherActiveCameraRenderTargetsStage.clear();\n this._pointerMoveStage.clear();\n this._pointerDownStage.clear();\n this._pointerUpStage.clear();\n this.importedMeshesFiles = new Array();\n if (this.stopAllAnimations) {\n // Ensures that no animatable notifies a callback that could start a new animation group, constantly adding new animatables to the active list...\n this._activeAnimatables.forEach((animatable) => {\n animatable.onAnimationEndObservable.clear();\n animatable.onAnimationEnd = null;\n });\n this.stopAllAnimations();\n }\n this.resetCachedMaterial();\n // Smart arrays\n if (this.activeCamera) {\n this.activeCamera._activeMeshes.dispose();\n this.activeCamera = null;\n }\n this.activeCameras = null;\n this._activeMeshes.dispose();\n this._renderingManager.dispose();\n this._processedMaterials.dispose();\n this._activeParticleSystems.dispose();\n this._activeSkeletons.dispose();\n this._softwareSkinnedMeshes.dispose();\n this._renderTargets.dispose();\n this._materialsRenderTargets.dispose();\n this._registeredForLateAnimationBindings.dispose();\n this._meshesForIntersections.dispose();\n this._toBeDisposed.length = 0;\n // Abort active requests\n const activeRequests = this._activeRequests.slice();\n for (const request of activeRequests) {\n request.abort();\n }\n this._activeRequests.length = 0;\n // Events\n try {\n this.onDisposeObservable.notifyObservers(this);\n }\n catch (e) {\n console.error(\"An error occurred while calling onDisposeObservable!\", e);\n }\n this.detachControl();\n // Detach cameras\n const canvas = this._engine.getInputElement();\n if (canvas) {\n for (let index = 0; index < this.cameras.length; index++) {\n this.cameras[index].detachControl();\n }\n }\n // Release animation groups\n this._disposeList(this.animationGroups);\n // Release lights\n this._disposeList(this.lights);\n // Release meshes\n this._disposeList(this.meshes, (item) => item.dispose(true));\n this._disposeList(this.transformNodes, (item) => item.dispose(true));\n // Release cameras\n const cameras = this.cameras;\n this._disposeList(cameras);\n // Release materials\n if (this._defaultMaterial) {\n this._defaultMaterial.dispose();\n }\n this._disposeList(this.multiMaterials);\n this._disposeList(this.materials);\n // Release particles\n this._disposeList(this.particleSystems);\n // Release postProcesses\n this._disposeList(this.postProcesses);\n // Release textures\n this._disposeList(this.textures);\n // Release morph targets\n this._disposeList(this.morphTargetManagers);\n // Release UBO\n this._sceneUbo.dispose();\n if (this._multiviewSceneUbo) {\n this._multiviewSceneUbo.dispose();\n }\n // Post-processes\n this.postProcessManager.dispose();\n // Components\n this._disposeList(this._components);\n // Remove from engine\n let index = this._engine.scenes.indexOf(this);\n if (index > -1) {\n this._engine.scenes.splice(index, 1);\n }\n if (EngineStore._LastCreatedScene === this) {\n if (this._engine.scenes.length > 0) {\n EngineStore._LastCreatedScene = this._engine.scenes[this._engine.scenes.length - 1];\n }\n else {\n EngineStore._LastCreatedScene = null;\n }\n }\n index = this._engine._virtualScenes.indexOf(this);\n if (index > -1) {\n this._engine._virtualScenes.splice(index, 1);\n }\n this._engine.wipeCaches(true);\n this.onDisposeObservable.clear();\n this.onBeforeRenderObservable.clear();\n this.onAfterRenderObservable.clear();\n this.onBeforeRenderTargetsRenderObservable.clear();\n this.onAfterRenderTargetsRenderObservable.clear();\n this.onAfterStepObservable.clear();\n this.onBeforeStepObservable.clear();\n this.onBeforeActiveMeshesEvaluationObservable.clear();\n this.onAfterActiveMeshesEvaluationObservable.clear();\n this.onBeforeParticlesRenderingObservable.clear();\n this.onAfterParticlesRenderingObservable.clear();\n this.onBeforeDrawPhaseObservable.clear();\n this.onAfterDrawPhaseObservable.clear();\n this.onBeforeAnimationsObservable.clear();\n this.onAfterAnimationsObservable.clear();\n this.onDataLoadedObservable.clear();\n this.onBeforeRenderingGroupObservable.clear();\n this.onAfterRenderingGroupObservable.clear();\n this.onMeshImportedObservable.clear();\n this.onBeforeCameraRenderObservable.clear();\n this.onAfterCameraRenderObservable.clear();\n this.onAfterRenderCameraObservable.clear();\n this.onReadyObservable.clear();\n this.onNewCameraAddedObservable.clear();\n this.onCameraRemovedObservable.clear();\n this.onNewLightAddedObservable.clear();\n this.onLightRemovedObservable.clear();\n this.onNewGeometryAddedObservable.clear();\n this.onGeometryRemovedObservable.clear();\n this.onNewTransformNodeAddedObservable.clear();\n this.onTransformNodeRemovedObservable.clear();\n this.onNewMeshAddedObservable.clear();\n this.onMeshRemovedObservable.clear();\n this.onNewSkeletonAddedObservable.clear();\n this.onSkeletonRemovedObservable.clear();\n this.onNewMaterialAddedObservable.clear();\n this.onNewMultiMaterialAddedObservable.clear();\n this.onMaterialRemovedObservable.clear();\n this.onMultiMaterialRemovedObservable.clear();\n this.onNewTextureAddedObservable.clear();\n this.onTextureRemovedObservable.clear();\n this.onPrePointerObservable.clear();\n this.onPointerObservable.clear();\n this.onPreKeyboardObservable.clear();\n this.onKeyboardObservable.clear();\n this.onActiveCameraChanged.clear();\n this.onScenePerformancePriorityChangedObservable.clear();\n this._isDisposed = true;\n }\n _disposeList(items, callback) {\n const itemsCopy = items.slice(0);\n callback = callback !== null && callback !== void 0 ? callback : ((item) => item.dispose());\n for (const item of itemsCopy) {\n callback(item);\n }\n items.length = 0;\n }\n /**\n * Gets if the scene is already disposed\n */\n get isDisposed() {\n return this._isDisposed;\n }\n /**\n * Call this function to reduce memory footprint of the scene.\n * Vertex buffers will not store CPU data anymore (this will prevent picking, collisions or physics to work correctly)\n */\n clearCachedVertexData() {\n for (let meshIndex = 0; meshIndex < this.meshes.length; meshIndex++) {\n const mesh = this.meshes[meshIndex];\n const geometry = mesh.geometry;\n if (geometry) {\n geometry.clearCachedData();\n }\n }\n }\n /**\n * This function will remove the local cached buffer data from texture.\n * It will save memory but will prevent the texture from being rebuilt\n */\n cleanCachedTextureBuffer() {\n for (const baseTexture of this.textures) {\n const buffer = baseTexture._buffer;\n if (buffer) {\n baseTexture._buffer = null;\n }\n }\n }\n /**\n * Get the world extend vectors with an optional filter\n *\n * @param filterPredicate the predicate - which meshes should be included when calculating the world size\n * @returns {{ min: Vector3; max: Vector3 }} min and max vectors\n */\n getWorldExtends(filterPredicate) {\n const min = new Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\n const max = new Vector3(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);\n filterPredicate = filterPredicate || (() => true);\n this.meshes.filter(filterPredicate).forEach((mesh) => {\n mesh.computeWorldMatrix(true);\n if (!mesh.subMeshes || mesh.subMeshes.length === 0 || mesh.infiniteDistance) {\n return;\n }\n const boundingInfo = mesh.getBoundingInfo();\n const minBox = boundingInfo.boundingBox.minimumWorld;\n const maxBox = boundingInfo.boundingBox.maximumWorld;\n Vector3.CheckExtends(minBox, min, max);\n Vector3.CheckExtends(maxBox, min, max);\n });\n return {\n min: min,\n max: max,\n };\n }\n // Picking\n /**\n * Creates a ray that can be used to pick in the scene\n * @param x defines the x coordinate of the origin (on-screen)\n * @param y defines the y coordinate of the origin (on-screen)\n * @param world defines the world matrix to use if you want to pick in object space (instead of world space)\n * @param camera defines the camera to use for the picking\n * @param cameraViewSpace defines if picking will be done in view space (false by default)\n * @returns a Ray\n */\n createPickingRay(x, y, world, camera, cameraViewSpace = false) {\n throw _WarnImport(\"Ray\");\n }\n /**\n * Creates a ray that can be used to pick in the scene\n * @param x defines the x coordinate of the origin (on-screen)\n * @param y defines the y coordinate of the origin (on-screen)\n * @param world defines the world matrix to use if you want to pick in object space (instead of world space)\n * @param result defines the ray where to store the picking ray\n * @param camera defines the camera to use for the picking\n * @param cameraViewSpace defines if picking will be done in view space (false by default)\n * @param enableDistantPicking defines if picking should handle large values for mesh position/scaling (false by default)\n * @returns the current scene\n */\n createPickingRayToRef(x, y, world, result, camera, cameraViewSpace = false, enableDistantPicking = false) {\n throw _WarnImport(\"Ray\");\n }\n /**\n * Creates a ray that can be used to pick in the scene\n * @param x defines the x coordinate of the origin (on-screen)\n * @param y defines the y coordinate of the origin (on-screen)\n * @param camera defines the camera to use for the picking\n * @returns a Ray\n */\n createPickingRayInCameraSpace(x, y, camera) {\n throw _WarnImport(\"Ray\");\n }\n /**\n * Creates a ray that can be used to pick in the scene\n * @param x defines the x coordinate of the origin (on-screen)\n * @param y defines the y coordinate of the origin (on-screen)\n * @param result defines the ray where to store the picking ray\n * @param camera defines the camera to use for the picking\n * @returns the current scene\n */\n createPickingRayInCameraSpaceToRef(x, y, result, camera) {\n throw _WarnImport(\"Ray\");\n }\n /** @internal */\n get _pickingAvailable() {\n return false;\n }\n /** Launch a ray to try to pick a mesh in the scene\n * @param x position on screen\n * @param y position on screen\n * @param predicate Predicate function used to determine eligible meshes. Can be set to null. In this case, a mesh must be enabled, visible and with isPickable set to true\n * @param fastCheck defines if the first intersection will be used (and not the closest)\n * @param camera to use for computing the picking ray. Can be set to null. In this case, the scene.activeCamera will be used\n * @param trianglePredicate defines an optional predicate used to select faces when a mesh intersection is detected\n * @returns a PickingInfo\n */\n pick(x, y, predicate, fastCheck, camera, trianglePredicate) {\n // Dummy info if picking as not been imported\n return new PickingInfo();\n }\n /** Launch a ray to try to pick a mesh in the scene using only bounding information of the main mesh (not using submeshes)\n * @param x position on screen\n * @param y position on screen\n * @param predicate Predicate function used to determine eligible meshes. Can be set to null. In this case, a mesh must be enabled, visible and with isPickable set to true\n * @param fastCheck defines if the first intersection will be used (and not the closest)\n * @param camera to use for computing the picking ray. Can be set to null. In this case, the scene.activeCamera will be used\n * @returns a PickingInfo (Please note that some info will not be set like distance, bv, bu and everything that cannot be capture by only using bounding infos)\n */\n pickWithBoundingInfo(x, y, predicate, fastCheck, camera) {\n // Dummy info if picking as not been imported\n return new PickingInfo();\n }\n /**\n * Use the given ray to pick a mesh in the scene. A mesh triangle can be picked both from its front and back sides,\n * irrespective of orientation.\n * @param ray The ray to use to pick meshes\n * @param predicate Predicate function used to determine eligible meshes. Can be set to null. In this case, a mesh must have isPickable set to true\n * @param fastCheck defines if the first intersection will be used (and not the closest)\n * @param trianglePredicate defines an optional predicate used to select faces when a mesh intersection is detected\n * @returns a PickingInfo\n */\n pickWithRay(ray, predicate, fastCheck, trianglePredicate) {\n throw _WarnImport(\"Ray\");\n }\n /**\n * Launch a ray to try to pick a mesh in the scene. A mesh triangle can be picked both from its front and back sides,\n * irrespective of orientation.\n * @param x X position on screen\n * @param y Y position on screen\n * @param predicate Predicate function used to determine eligible meshes. Can be set to null. In this case, a mesh must be enabled, visible and with isPickable set to true\n * @param camera camera to use for computing the picking ray. Can be set to null. In this case, the scene.activeCamera will be used\n * @param trianglePredicate defines an optional predicate used to select faces when a mesh intersection is detected\n * @returns an array of PickingInfo\n */\n multiPick(x, y, predicate, camera, trianglePredicate) {\n throw _WarnImport(\"Ray\");\n }\n /**\n * Launch a ray to try to pick a mesh in the scene\n * @param ray Ray to use\n * @param predicate Predicate function used to determine eligible meshes. Can be set to null. In this case, a mesh must be enabled, visible and with isPickable set to true\n * @param trianglePredicate defines an optional predicate used to select faces when a mesh intersection is detected\n * @returns an array of PickingInfo\n */\n multiPickWithRay(ray, predicate, trianglePredicate) {\n throw _WarnImport(\"Ray\");\n }\n /**\n * Force the value of meshUnderPointer\n * @param mesh defines the mesh to use\n * @param pointerId optional pointer id when using more than one pointer\n * @param pickResult optional pickingInfo data used to find mesh\n */\n setPointerOverMesh(mesh, pointerId, pickResult) {\n this._inputManager.setPointerOverMesh(mesh, pointerId, pickResult);\n }\n /**\n * Gets the mesh under the pointer\n * @returns a Mesh or null if no mesh is under the pointer\n */\n getPointerOverMesh() {\n return this._inputManager.getPointerOverMesh();\n }\n // Misc.\n /** @internal */\n _rebuildGeometries() {\n for (const geometry of this.geometries) {\n geometry._rebuild();\n }\n for (const mesh of this.meshes) {\n mesh._rebuild();\n }\n if (this.postProcessManager) {\n this.postProcessManager._rebuild();\n }\n for (const component of this._components) {\n component.rebuild();\n }\n for (const system of this.particleSystems) {\n system.rebuild();\n }\n if (this.spriteManagers) {\n for (const spriteMgr of this.spriteManagers) {\n spriteMgr.rebuild();\n }\n }\n }\n /** @internal */\n _rebuildTextures() {\n for (const texture of this.textures) {\n texture._rebuild();\n }\n this.markAllMaterialsAsDirty(1);\n }\n // Tags\n _getByTags(list, tagsQuery, forEach) {\n if (tagsQuery === undefined) {\n // returns the complete list (could be done with Tags.MatchesQuery but no need to have a for-loop here)\n return list;\n }\n const listByTags = [];\n forEach =\n forEach ||\n ((item) => {\n return;\n });\n for (const i in list) {\n const item = list[i];\n if (Tags && Tags.MatchesQuery(item, tagsQuery)) {\n listByTags.push(item);\n forEach(item);\n }\n }\n return listByTags;\n }\n /**\n * Get a list of meshes by tags\n * @param tagsQuery defines the tags query to use\n * @param forEach defines a predicate used to filter results\n * @returns an array of Mesh\n */\n getMeshesByTags(tagsQuery, forEach) {\n return this._getByTags(this.meshes, tagsQuery, forEach);\n }\n /**\n * Get a list of cameras by tags\n * @param tagsQuery defines the tags query to use\n * @param forEach defines a predicate used to filter results\n * @returns an array of Camera\n */\n getCamerasByTags(tagsQuery, forEach) {\n return this._getByTags(this.cameras, tagsQuery, forEach);\n }\n /**\n * Get a list of lights by tags\n * @param tagsQuery defines the tags query to use\n * @param forEach defines a predicate used to filter results\n * @returns an array of Light\n */\n getLightsByTags(tagsQuery, forEach) {\n return this._getByTags(this.lights, tagsQuery, forEach);\n }\n /**\n * Get a list of materials by tags\n * @param tagsQuery defines the tags query to use\n * @param forEach defines a predicate used to filter results\n * @returns an array of Material\n */\n getMaterialByTags(tagsQuery, forEach) {\n return this._getByTags(this.materials, tagsQuery, forEach).concat(this._getByTags(this.multiMaterials, tagsQuery, forEach));\n }\n /**\n * Get a list of transform nodes by tags\n * @param tagsQuery defines the tags query to use\n * @param forEach defines a predicate used to filter results\n * @returns an array of TransformNode\n */\n getTransformNodesByTags(tagsQuery, forEach) {\n return this._getByTags(this.transformNodes, tagsQuery, forEach);\n }\n /**\n * Overrides the default sort function applied in the rendering group to prepare the meshes.\n * This allowed control for front to back rendering or reversly depending of the special needs.\n *\n * @param renderingGroupId The rendering group id corresponding to its index\n * @param opaqueSortCompareFn The opaque queue comparison function use to sort.\n * @param alphaTestSortCompareFn The alpha test queue comparison function use to sort.\n * @param transparentSortCompareFn The transparent queue comparison function use to sort.\n */\n setRenderingOrder(renderingGroupId, opaqueSortCompareFn = null, alphaTestSortCompareFn = null, transparentSortCompareFn = null) {\n this._renderingManager.setRenderingOrder(renderingGroupId, opaqueSortCompareFn, alphaTestSortCompareFn, transparentSortCompareFn);\n }\n /**\n * Specifies whether or not the stencil and depth buffer are cleared between two rendering groups.\n *\n * @param renderingGroupId The rendering group id corresponding to its index\n * @param autoClearDepthStencil Automatically clears depth and stencil between groups if true.\n * @param depth Automatically clears depth between groups if true and autoClear is true.\n * @param stencil Automatically clears stencil between groups if true and autoClear is true.\n */\n setRenderingAutoClearDepthStencil(renderingGroupId, autoClearDepthStencil, depth = true, stencil = true) {\n this._renderingManager.setRenderingAutoClearDepthStencil(renderingGroupId, autoClearDepthStencil, depth, stencil);\n }\n /**\n * Gets the current auto clear configuration for one rendering group of the rendering\n * manager.\n * @param index the rendering group index to get the information for\n * @returns The auto clear setup for the requested rendering group\n */\n getAutoClearDepthStencilSetup(index) {\n return this._renderingManager.getAutoClearDepthStencilSetup(index);\n }\n /** Gets or sets a boolean blocking all the calls to markAllMaterialsAsDirty (ie. the materials won't be updated if they are out of sync) */\n get blockMaterialDirtyMechanism() {\n return this._blockMaterialDirtyMechanism;\n }\n set blockMaterialDirtyMechanism(value) {\n if (this._blockMaterialDirtyMechanism === value) {\n return;\n }\n this._blockMaterialDirtyMechanism = value;\n if (!value) {\n // Do a complete update\n this.markAllMaterialsAsDirty(63);\n }\n }\n /**\n * Will flag all materials as dirty to trigger new shader compilation\n * @param flag defines the flag used to specify which material part must be marked as dirty\n * @param predicate If not null, it will be used to specify if a material has to be marked as dirty\n */\n markAllMaterialsAsDirty(flag, predicate) {\n if (this._blockMaterialDirtyMechanism) {\n return;\n }\n for (const material of this.materials) {\n if (predicate && !predicate(material)) {\n continue;\n }\n material.markAsDirty(flag);\n }\n }\n /**\n * @internal\n */\n _loadFile(fileOrUrl, onSuccess, onProgress, useOfflineSupport, useArrayBuffer, onError, onOpened) {\n const request = LoadFile(fileOrUrl, onSuccess, onProgress, useOfflineSupport ? this.offlineProvider : undefined, useArrayBuffer, onError, onOpened);\n this._activeRequests.push(request);\n request.onCompleteObservable.add((request) => {\n this._activeRequests.splice(this._activeRequests.indexOf(request), 1);\n });\n return request;\n }\n /**\n * @internal\n */\n _loadFileAsync(fileOrUrl, onProgress, useOfflineSupport, useArrayBuffer, onOpened) {\n return new Promise((resolve, reject) => {\n this._loadFile(fileOrUrl, (data) => {\n resolve(data);\n }, onProgress, useOfflineSupport, useArrayBuffer, (request, exception) => {\n reject(exception);\n }, onOpened);\n });\n }\n /**\n * @internal\n */\n _requestFile(url, onSuccess, onProgress, useOfflineSupport, useArrayBuffer, onError, onOpened) {\n const request = RequestFile(url, onSuccess, onProgress, useOfflineSupport ? this.offlineProvider : undefined, useArrayBuffer, onError, onOpened);\n this._activeRequests.push(request);\n request.onCompleteObservable.add((request) => {\n this._activeRequests.splice(this._activeRequests.indexOf(request), 1);\n });\n return request;\n }\n /**\n * @internal\n */\n _requestFileAsync(url, onProgress, useOfflineSupport, useArrayBuffer, onOpened) {\n return new Promise((resolve, reject) => {\n this._requestFile(url, (data) => {\n resolve(data);\n }, onProgress, useOfflineSupport, useArrayBuffer, (error) => {\n reject(error);\n }, onOpened);\n });\n }\n /**\n * @internal\n */\n _readFile(file, onSuccess, onProgress, useArrayBuffer, onError) {\n const request = ReadFile(file, onSuccess, onProgress, useArrayBuffer, onError);\n this._activeRequests.push(request);\n request.onCompleteObservable.add((request) => {\n this._activeRequests.splice(this._activeRequests.indexOf(request), 1);\n });\n return request;\n }\n /**\n * @internal\n */\n _readFileAsync(file, onProgress, useArrayBuffer) {\n return new Promise((resolve, reject) => {\n this._readFile(file, (data) => {\n resolve(data);\n }, onProgress, useArrayBuffer, (error) => {\n reject(error);\n });\n });\n }\n /**\n * This method gets the performance collector belonging to the scene, which is generally shared with the inspector.\n * @returns the perf collector belonging to the scene.\n */\n getPerfCollector() {\n throw _WarnImport(\"performanceViewerSceneExtension\");\n }\n // deprecated\n /**\n * Sets the active camera of the scene using its Id\n * @param id defines the camera's Id\n * @returns the new active camera or null if none found.\n * @deprecated Please use setActiveCameraById instead\n */\n setActiveCameraByID(id) {\n return this.setActiveCameraById(id);\n }\n /**\n * Get a material using its id\n * @param id defines the material's Id\n * @returns the material or null if none found.\n * @deprecated Please use getMaterialById instead\n */\n getMaterialByID(id) {\n return this.getMaterialById(id);\n }\n /**\n * Gets a the last added material using a given id\n * @param id defines the material's Id\n * @returns the last material with the given id or null if none found.\n * @deprecated Please use getLastMaterialById instead\n */\n getLastMaterialByID(id) {\n return this.getLastMaterialById(id);\n }\n /**\n * Get a texture using its unique id\n * @param uniqueId defines the texture's unique id\n * @returns the texture or null if none found.\n * @deprecated Please use getTextureByUniqueId instead\n */\n getTextureByUniqueID(uniqueId) {\n return this.getTextureByUniqueId(uniqueId);\n }\n /**\n * Gets a camera using its Id\n * @param id defines the Id to look for\n * @returns the camera or null if not found\n * @deprecated Please use getCameraById instead\n */\n getCameraByID(id) {\n return this.getCameraById(id);\n }\n /**\n * Gets a camera using its unique Id\n * @param uniqueId defines the unique Id to look for\n * @returns the camera or null if not found\n * @deprecated Please use getCameraByUniqueId instead\n */\n getCameraByUniqueID(uniqueId) {\n return this.getCameraByUniqueId(uniqueId);\n }\n /**\n * Gets a bone using its Id\n * @param id defines the bone's Id\n * @returns the bone or null if not found\n * @deprecated Please use getBoneById instead\n */\n getBoneByID(id) {\n return this.getBoneById(id);\n }\n /**\n * Gets a light node using its Id\n * @param id defines the light's Id\n * @returns the light or null if none found.\n * @deprecated Please use getLightById instead\n */\n getLightByID(id) {\n return this.getLightById(id);\n }\n /**\n * Gets a light node using its scene-generated unique Id\n * @param uniqueId defines the light's unique Id\n * @returns the light or null if none found.\n * @deprecated Please use getLightByUniqueId instead\n */\n getLightByUniqueID(uniqueId) {\n return this.getLightByUniqueId(uniqueId);\n }\n /**\n * Gets a particle system by Id\n * @param id defines the particle system Id\n * @returns the corresponding system or null if none found\n * @deprecated Please use getParticleSystemById instead\n */\n getParticleSystemByID(id) {\n return this.getParticleSystemById(id);\n }\n /**\n * Gets a geometry using its Id\n * @param id defines the geometry's Id\n * @returns the geometry or null if none found.\n * @deprecated Please use getGeometryById instead\n */\n getGeometryByID(id) {\n return this.getGeometryById(id);\n }\n /**\n * Gets the first added mesh found of a given Id\n * @param id defines the Id to search for\n * @returns the mesh found or null if not found at all\n * @deprecated Please use getMeshById instead\n */\n getMeshByID(id) {\n return this.getMeshById(id);\n }\n /**\n * Gets a mesh with its auto-generated unique Id\n * @param uniqueId defines the unique Id to search for\n * @returns the found mesh or null if not found at all.\n * @deprecated Please use getMeshByUniqueId instead\n */\n getMeshByUniqueID(uniqueId) {\n return this.getMeshByUniqueId(uniqueId);\n }\n /**\n * Gets a the last added mesh using a given Id\n * @param id defines the Id to search for\n * @returns the found mesh or null if not found at all.\n * @deprecated Please use getLastMeshById instead\n */\n getLastMeshByID(id) {\n return this.getLastMeshById(id);\n }\n /**\n * Gets a list of meshes using their Id\n * @param id defines the Id to search for\n * @returns a list of meshes\n * @deprecated Please use getMeshesById instead\n */\n getMeshesByID(id) {\n return this.getMeshesById(id);\n }\n /**\n * Gets the first added transform node found of a given Id\n * @param id defines the Id to search for\n * @returns the found transform node or null if not found at all.\n * @deprecated Please use getTransformNodeById instead\n */\n getTransformNodeByID(id) {\n return this.getTransformNodeById(id);\n }\n /**\n * Gets a transform node with its auto-generated unique Id\n * @param uniqueId defines the unique Id to search for\n * @returns the found transform node or null if not found at all.\n * @deprecated Please use getTransformNodeByUniqueId instead\n */\n getTransformNodeByUniqueID(uniqueId) {\n return this.getTransformNodeByUniqueId(uniqueId);\n }\n /**\n * Gets a list of transform nodes using their Id\n * @param id defines the Id to search for\n * @returns a list of transform nodes\n * @deprecated Please use getTransformNodesById instead\n */\n getTransformNodesByID(id) {\n return this.getTransformNodesById(id);\n }\n /**\n * Gets a node (Mesh, Camera, Light) using a given Id\n * @param id defines the Id to search for\n * @returns the found node or null if not found at all\n * @deprecated Please use getNodeById instead\n */\n getNodeByID(id) {\n return this.getNodeById(id);\n }\n /**\n * Gets a the last added node (Mesh, Camera, Light) using a given Id\n * @param id defines the Id to search for\n * @returns the found node or null if not found at all\n * @deprecated Please use getLastEntryById instead\n */\n getLastEntryByID(id) {\n return this.getLastEntryById(id);\n }\n /**\n * Gets a skeleton using a given Id (if many are found, this function will pick the last one)\n * @param id defines the Id to search for\n * @returns the found skeleton or null if not found at all.\n * @deprecated Please use getLastSkeletonById instead\n */\n getLastSkeletonByID(id) {\n return this.getLastSkeletonById(id);\n }\n}\n/** The fog is deactivated */\nScene.FOGMODE_NONE = 0;\n/** The fog density is following an exponential function */\nScene.FOGMODE_EXP = 1;\n/** The fog density is following an exponential function faster than FOGMODE_EXP */\nScene.FOGMODE_EXP2 = 2;\n/** The fog density is following a linear function. */\nScene.FOGMODE_LINEAR = 3;\n/**\n * Gets or sets the minimum deltatime when deterministic lock step is enabled\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#deterministic-lockstep\n */\nScene.MinDeltaTime = 1.0;\n/**\n * Gets or sets the maximum deltatime when deterministic lock step is enabled\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#deterministic-lockstep\n */\nScene.MaxDeltaTime = 1000.0;\n//# sourceMappingURL=scene.js.map","import { Vector3 } from \"./math.vector.js\";\n/** Defines supported spaces */\nexport var Space;\n(function (Space) {\n /** Local (object) space */\n Space[Space[\"LOCAL\"] = 0] = \"LOCAL\";\n /** World space */\n Space[Space[\"WORLD\"] = 1] = \"WORLD\";\n /** Bone space */\n Space[Space[\"BONE\"] = 2] = \"BONE\";\n})(Space || (Space = {}));\n/** Defines the 3 main axes */\nexport class Axis {\n}\n/** X axis */\nAxis.X = new Vector3(1.0, 0.0, 0.0);\n/** Y axis */\nAxis.Y = new Vector3(0.0, 1.0, 0.0);\n/** Z axis */\nAxis.Z = new Vector3(0.0, 0.0, 1.0);\n/**\n * Defines cartesian components.\n */\nexport var Coordinate;\n(function (Coordinate) {\n /** X axis */\n Coordinate[Coordinate[\"X\"] = 0] = \"X\";\n /** Y axis */\n Coordinate[Coordinate[\"Y\"] = 1] = \"Y\";\n /** Z axis */\n Coordinate[Coordinate[\"Z\"] = 2] = \"Z\";\n})(Coordinate || (Coordinate = {}));\n//# sourceMappingURL=math.axis.js.map","/**\n * Class used to represent a viewport on screen\n */\nexport class Viewport {\n /**\n * Creates a Viewport object located at (x, y) and sized (width, height)\n * @param x defines viewport left coordinate\n * @param y defines viewport top coordinate\n * @param width defines the viewport width\n * @param height defines the viewport height\n */\n constructor(\n /** viewport left coordinate */\n x, \n /** viewport top coordinate */\n y, \n /**viewport width */\n width, \n /** viewport height */\n height) {\n this.x = x;\n this.y = y;\n this.width = width;\n this.height = height;\n }\n /**\n * Creates a new viewport using absolute sizing (from 0-> width, 0-> height instead of 0->1)\n * @param renderWidth defines the rendering width\n * @param renderHeight defines the rendering height\n * @returns a new Viewport\n */\n toGlobal(renderWidth, renderHeight) {\n return new Viewport(this.x * renderWidth, this.y * renderHeight, this.width * renderWidth, this.height * renderHeight);\n }\n /**\n * Stores absolute viewport value into a target viewport (from 0-> width, 0-> height instead of 0->1)\n * @param renderWidth defines the rendering width\n * @param renderHeight defines the rendering height\n * @param ref defines the target viewport\n * @returns the current viewport\n */\n toGlobalToRef(renderWidth, renderHeight, ref) {\n ref.x = this.x * renderWidth;\n ref.y = this.y * renderHeight;\n ref.width = this.width * renderWidth;\n ref.height = this.height * renderHeight;\n return this;\n }\n /**\n * Returns a new Viewport copied from the current one\n * @returns a new Viewport\n */\n clone() {\n return new Viewport(this.x, this.y, this.width, this.height);\n }\n}\n//# sourceMappingURL=math.viewport.js.map","/* eslint-disable @typescript-eslint/naming-convention */\n// \"Coroutines are computer program components that generalize subroutines for non-preemptive multitasking, by allowing execution to be suspended and resumed.\"\n// https://en.wikipedia.org/wiki/Coroutine\n// The inline scheduler simply steps the coroutine synchronously. This is useful for running a coroutine synchronously, and also as a helper function for other schedulers.\n/**\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function inlineScheduler(coroutine, onStep, onError) {\n try {\n const step = coroutine.next();\n if (step.done) {\n onStep(step);\n }\n else if (!step.value) {\n // NOTE: The properties of step have been narrowed, but the type of step itself is not narrowed, so the cast below is the most type safe way to deal with this without instantiating a new object to hold the values.\n onStep(step);\n }\n else {\n step.value.then(() => {\n step.value = undefined;\n onStep(step);\n }, onError);\n }\n }\n catch (error) {\n onError(error);\n }\n}\n// The yielding scheduler steps the coroutine synchronously until the specified time interval has elapsed, then yields control so other operations can be performed.\n// A single instance of a yielding scheduler could be shared across multiple coroutines to yield when their collective work exceeds the threshold.\n/**\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function createYieldingScheduler(yieldAfterMS = 25) {\n let startTime;\n return (coroutine, onStep, onError) => {\n const currentTime = performance.now();\n if (startTime === undefined || currentTime - startTime > yieldAfterMS) {\n // If this is the first coroutine step, or if the time interval has elapsed, record a new start time, and schedule the coroutine step to happen later, effectively yielding control of the execution context.\n startTime = currentTime;\n setTimeout(() => {\n inlineScheduler(coroutine, onStep, onError);\n }, 0);\n }\n else {\n // Otherwise it is not time to yield yet, so step the coroutine synchronously.\n inlineScheduler(coroutine, onStep, onError);\n }\n };\n}\n// Runs the specified coroutine with the specified scheduler. The success or error callback will be invoked when the coroutine finishes.\n/**\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function runCoroutine(coroutine, scheduler, onSuccess, onError, abortSignal) {\n const resume = () => {\n let reschedule;\n const onStep = (stepResult) => {\n if (stepResult.done) {\n // If the coroutine is done, report success.\n onSuccess(stepResult.value);\n }\n else {\n // If the coroutine is not done, resume the coroutine (via the scheduler).\n if (reschedule === undefined) {\n // If reschedule is undefined at this point, then the coroutine must have stepped synchronously, so just flag another loop iteration.\n reschedule = true;\n }\n else {\n // If reschedule is defined at this point, then the coroutine must have stepped asynchronously, so call resume to restart the step loop.\n resume();\n }\n }\n };\n do {\n reschedule = undefined;\n if (!abortSignal || !abortSignal.aborted) {\n scheduler(coroutine, onStep, onError);\n }\n else {\n onError(new Error(\"Aborted\"));\n }\n if (reschedule === undefined) {\n // If reschedule is undefined at this point, then the coroutine must have stepped asynchronously, so stop looping and let the coroutine be resumed later.\n reschedule = false;\n }\n } while (reschedule);\n };\n resume();\n}\n// Runs the specified coroutine synchronously.\n/**\n * @internal\n */\nexport function runCoroutineSync(coroutine, abortSignal) {\n // Run the coroutine with the inline scheduler, storing the returned value, or re-throwing the error (since the error callback will be called synchronously by the inline scheduler).\n let result;\n runCoroutine(coroutine, inlineScheduler, (r) => (result = r), (e) => {\n throw e;\n }, abortSignal);\n // Synchronously return the result of the coroutine.\n return result;\n}\n// Runs the specified coroutine asynchronously with the specified scheduler.\n/**\n * @internal\n */\nexport function runCoroutineAsync(coroutine, scheduler, abortSignal) {\n // Run the coroutine with a yielding scheduler, resolving or rejecting the result promise when the coroutine finishes.\n return new Promise((resolve, reject) => {\n runCoroutine(coroutine, scheduler, resolve, reject, abortSignal);\n });\n}\n/**\n * Given a function that returns a Coroutine, produce a function with the same parameters that returns a T.\n * The returned function runs the coroutine synchronously.\n * @param coroutineFactory A function that returns a Coroutine.\n * @param abortSignal\n * @returns A function that runs the coroutine synchronously.\n * @internal\n */\nexport function makeSyncFunction(coroutineFactory, abortSignal) {\n return (...params) => {\n // Run the coroutine synchronously.\n return runCoroutineSync(coroutineFactory(...params), abortSignal);\n };\n}\n/**\n * Given a function that returns a Coroutine, product a function with the same parameters that returns a Promise.\n * The returned function runs the coroutine asynchronously, yield control of the execution context occasionally to enable a more responsive experience.\n * @param coroutineFactory A function that returns a Coroutine.\n * @param scheduler\n * @param abortSignal\n * @returns A function that runs the coroutine asynchronously.\n * @internal\n */\nexport function makeAsyncFunction(coroutineFactory, scheduler, abortSignal) {\n return (...params) => {\n // Run the coroutine asynchronously.\n return runCoroutineAsync(coroutineFactory(...params), scheduler, abortSignal);\n };\n}\n//# sourceMappingURL=coroutine.js.map","import { __decorate } from \"../tslib.es6.js\";\nimport { serialize, SerializationHelper, serializeAsVector3 } from \"../Misc/decorators.js\";\nimport { SmartArray } from \"../Misc/smartArray.js\";\nimport { Tools } from \"../Misc/tools.js\";\nimport { Observable } from \"../Misc/observable.js\";\nimport { Matrix, Vector3, Quaternion } from \"../Maths/math.vector.js\";\nimport { Node } from \"../node.js\";\nimport { Logger } from \"../Misc/logger.js\";\nimport { GetClass } from \"../Misc/typeStore.js\";\nimport { _WarnImport } from \"../Misc/devTools.js\";\nimport { Viewport } from \"../Maths/math.viewport.js\";\nimport { Frustum } from \"../Maths/math.frustum.js\";\n\n/**\n * This is the base class of all the camera used in the application.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras\n */\nexport class Camera extends Node {\n /**\n * Define the current local position of the camera in the scene\n */\n get position() {\n return this._position;\n }\n set position(newPosition) {\n this._position = newPosition;\n }\n /**\n * The vector the camera should consider as up.\n * (default is Vector3(0, 1, 0) aka Vector3.Up())\n */\n set upVector(vec) {\n this._upVector = vec;\n }\n get upVector() {\n return this._upVector;\n }\n /**\n * The screen area in scene units squared\n */\n get screenArea() {\n var _a, _b, _c, _d;\n let x = 0;\n let y = 0;\n if (this.mode === Camera.PERSPECTIVE_CAMERA) {\n if (this.fovMode === Camera.FOVMODE_VERTICAL_FIXED) {\n y = this.minZ * 2 * Math.tan(this.fov / 2);\n x = this.getEngine().getAspectRatio(this) * y;\n }\n else {\n x = this.minZ * 2 * Math.tan(this.fov / 2);\n y = x / this.getEngine().getAspectRatio(this);\n }\n }\n else {\n const halfWidth = this.getEngine().getRenderWidth() / 2.0;\n const halfHeight = this.getEngine().getRenderHeight() / 2.0;\n x = ((_a = this.orthoRight) !== null && _a !== void 0 ? _a : halfWidth) - ((_b = this.orthoLeft) !== null && _b !== void 0 ? _b : -halfWidth);\n y = ((_c = this.orthoTop) !== null && _c !== void 0 ? _c : halfHeight) - ((_d = this.orthoBottom) !== null && _d !== void 0 ? _d : -halfHeight);\n }\n return x * y;\n }\n set orthoLeft(value) {\n this._orthoLeft = value;\n for (const rigCamera of this._rigCameras) {\n rigCamera.orthoLeft = value;\n }\n }\n get orthoLeft() {\n return this._orthoLeft;\n }\n set orthoRight(value) {\n this._orthoRight = value;\n for (const rigCamera of this._rigCameras) {\n rigCamera.orthoRight = value;\n }\n }\n get orthoRight() {\n return this._orthoRight;\n }\n set orthoBottom(value) {\n this._orthoBottom = value;\n for (const rigCamera of this._rigCameras) {\n rigCamera.orthoBottom = value;\n }\n }\n get orthoBottom() {\n return this._orthoBottom;\n }\n set orthoTop(value) {\n this._orthoTop = value;\n for (const rigCamera of this._rigCameras) {\n rigCamera.orthoTop = value;\n }\n }\n get orthoTop() {\n return this._orthoTop;\n }\n set mode(mode) {\n this._mode = mode;\n // Pass the mode down to the rig cameras\n for (const rigCamera of this._rigCameras) {\n rigCamera.mode = mode;\n }\n }\n get mode() {\n return this._mode;\n }\n /**\n * Instantiates a new camera object.\n * This should not be used directly but through the inherited cameras: ArcRotate, Free...\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras\n * @param name Defines the name of the camera in the scene\n * @param position Defines the position of the camera\n * @param scene Defines the scene the camera belongs too\n * @param setActiveOnSceneIfNoneActive Defines if the camera should be set as active after creation if no other camera have been defined in the scene\n */\n constructor(name, position, scene, setActiveOnSceneIfNoneActive = true) {\n super(name, scene);\n /** @internal */\n this._position = Vector3.Zero();\n this._upVector = Vector3.Up();\n /**\n * Define the current limit on the left side for an orthographic camera\n * In scene unit\n */\n this._orthoLeft = null;\n /**\n * Define the current limit on the right side for an orthographic camera\n * In scene unit\n */\n this._orthoRight = null;\n /**\n * Define the current limit on the bottom side for an orthographic camera\n * In scene unit\n */\n this._orthoBottom = null;\n /**\n * Define the current limit on the top side for an orthographic camera\n * In scene unit\n */\n this._orthoTop = null;\n /**\n * Field Of View is set in Radians. (default is 0.8)\n */\n this.fov = 0.8;\n /**\n * Projection plane tilt around the X axis (horizontal), set in Radians. (default is 0)\n * Can be used to make vertical lines in world space actually vertical on the screen.\n * See https://forum.babylonjs.com/t/add-vertical-shift-to-3ds-max-exporter-babylon-cameras/17480\n */\n this.projectionPlaneTilt = 0;\n /**\n * Define the minimum distance the camera can see from.\n * This is important to note that the depth buffer are not infinite and the closer it starts\n * the more your scene might encounter depth fighting issue.\n */\n this.minZ = 1;\n /**\n * Define the maximum distance the camera can see to.\n * This is important to note that the depth buffer are not infinite and the further it end\n * the more your scene might encounter depth fighting issue.\n */\n this.maxZ = 10000.0;\n /**\n * Define the default inertia of the camera.\n * This helps giving a smooth feeling to the camera movement.\n */\n this.inertia = 0.9;\n /**\n * Define the mode of the camera (Camera.PERSPECTIVE_CAMERA or Camera.ORTHOGRAPHIC_CAMERA)\n */\n this._mode = Camera.PERSPECTIVE_CAMERA;\n /**\n * Define whether the camera is intermediate.\n * This is useful to not present the output directly to the screen in case of rig without post process for instance\n */\n this.isIntermediate = false;\n /**\n * Define the viewport of the camera.\n * This correspond to the portion of the screen the camera will render to in normalized 0 to 1 unit.\n */\n this.viewport = new Viewport(0, 0, 1.0, 1.0);\n /**\n * Restricts the camera to viewing objects with the same layerMask.\n * A camera with a layerMask of 1 will render mesh.layerMask & camera.layerMask!== 0\n */\n this.layerMask = 0x0fffffff;\n /**\n * fovMode sets the camera frustum bounds to the viewport bounds. (default is FOVMODE_VERTICAL_FIXED)\n */\n this.fovMode = Camera.FOVMODE_VERTICAL_FIXED;\n /**\n * Rig mode of the camera.\n * This is useful to create the camera with two \"eyes\" instead of one to create VR or stereoscopic scenes.\n * This is normally controlled byt the camera themselves as internal use.\n */\n this.cameraRigMode = Camera.RIG_MODE_NONE;\n /**\n * Defines the list of custom render target which are rendered to and then used as the input to this camera's render. Eg. display another camera view on a TV in the main scene\n * This is pretty helpful if you wish to make a camera render to a texture you could reuse somewhere\n * else in the scene. (Eg. security camera)\n *\n * To change the final output target of the camera, camera.outputRenderTarget should be used instead (eg. webXR renders to a render target corresponding to an HMD)\n */\n this.customRenderTargets = new Array();\n /**\n * When set, the camera will render to this render target instead of the default canvas\n *\n * If the desire is to use the output of a camera as a texture in the scene consider using camera.customRenderTargets instead\n */\n this.outputRenderTarget = null;\n /**\n * Observable triggered when the camera view matrix has changed.\n */\n this.onViewMatrixChangedObservable = new Observable();\n /**\n * Observable triggered when the camera Projection matrix has changed.\n */\n this.onProjectionMatrixChangedObservable = new Observable();\n /**\n * Observable triggered when the inputs have been processed.\n */\n this.onAfterCheckInputsObservable = new Observable();\n /**\n * Observable triggered when reset has been called and applied to the camera.\n */\n this.onRestoreStateObservable = new Observable();\n /**\n * Is this camera a part of a rig system?\n */\n this.isRigCamera = false;\n /** @internal */\n this._rigCameras = new Array();\n this._webvrViewMatrix = Matrix.Identity();\n /** @internal */\n this._skipRendering = false;\n /** @internal */\n this._projectionMatrix = new Matrix();\n /** @internal */\n this._postProcesses = new Array();\n /** @internal */\n this._activeMeshes = new SmartArray(256);\n this._globalPosition = Vector3.Zero();\n /** @internal */\n this._computedViewMatrix = Matrix.Identity();\n this._doNotComputeProjectionMatrix = false;\n this._transformMatrix = Matrix.Zero();\n this._refreshFrustumPlanes = true;\n this._absoluteRotation = Quaternion.Identity();\n /** @internal */\n this._isCamera = true;\n /** @internal */\n this._isLeftCamera = false;\n /** @internal */\n this._isRightCamera = false;\n this.getScene().addCamera(this);\n if (setActiveOnSceneIfNoneActive && !this.getScene().activeCamera) {\n this.getScene().activeCamera = this;\n }\n this.position = position;\n this.renderPassId = this.getScene().getEngine().createRenderPassId(`Camera ${name}`);\n }\n /**\n * Store current camera state (fov, position, etc..)\n * @returns the camera\n */\n storeState() {\n this._stateStored = true;\n this._storedFov = this.fov;\n return this;\n }\n /**\n * Restores the camera state values if it has been stored. You must call storeState() first\n */\n _restoreStateValues() {\n if (!this._stateStored) {\n return false;\n }\n this.fov = this._storedFov;\n return true;\n }\n /**\n * Restored camera state. You must call storeState() first.\n * @returns true if restored and false otherwise\n */\n restoreState() {\n if (this._restoreStateValues()) {\n this.onRestoreStateObservable.notifyObservers(this);\n return true;\n }\n return false;\n }\n /**\n * Gets the class name of the camera.\n * @returns the class name\n */\n getClassName() {\n return \"Camera\";\n }\n /**\n * Gets a string representation of the camera useful for debug purpose.\n * @param fullDetails Defines that a more verbose level of logging is required\n * @returns the string representation\n */\n toString(fullDetails) {\n let ret = \"Name: \" + this.name;\n ret += \", type: \" + this.getClassName();\n if (this.animations) {\n for (let i = 0; i < this.animations.length; i++) {\n ret += \", animation[0]: \" + this.animations[i].toString(fullDetails);\n }\n }\n return ret;\n }\n /**\n * Automatically tilts the projection plane, using `projectionPlaneTilt`, to correct the perspective effect on vertical lines.\n */\n applyVerticalCorrection() {\n const rot = this.absoluteRotation.toEulerAngles();\n this.projectionPlaneTilt = this._scene.useRightHandedSystem ? -rot.x : rot.x;\n }\n /**\n * Gets the current world space position of the camera.\n */\n get globalPosition() {\n return this._globalPosition;\n }\n /**\n * Gets the list of active meshes this frame (meshes no culled or excluded by lod s in the frame)\n * @returns the active meshe list\n */\n getActiveMeshes() {\n return this._activeMeshes;\n }\n /**\n * Check whether a mesh is part of the current active mesh list of the camera\n * @param mesh Defines the mesh to check\n * @returns true if active, false otherwise\n */\n isActiveMesh(mesh) {\n return this._activeMeshes.indexOf(mesh) !== -1;\n }\n /**\n * Is this camera ready to be used/rendered\n * @param completeCheck defines if a complete check (including post processes) has to be done (false by default)\n * @returns true if the camera is ready\n */\n isReady(completeCheck = false) {\n if (completeCheck) {\n for (const pp of this._postProcesses) {\n if (pp && !pp.isReady()) {\n return false;\n }\n }\n }\n return super.isReady(completeCheck);\n }\n /** @internal */\n _initCache() {\n super._initCache();\n this._cache.position = new Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\n this._cache.upVector = new Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\n this._cache.mode = undefined;\n this._cache.minZ = undefined;\n this._cache.maxZ = undefined;\n this._cache.fov = undefined;\n this._cache.fovMode = undefined;\n this._cache.aspectRatio = undefined;\n this._cache.orthoLeft = undefined;\n this._cache.orthoRight = undefined;\n this._cache.orthoBottom = undefined;\n this._cache.orthoTop = undefined;\n this._cache.renderWidth = undefined;\n this._cache.renderHeight = undefined;\n }\n /**\n * @internal\n */\n _updateCache(ignoreParentClass) {\n if (!ignoreParentClass) {\n super._updateCache();\n }\n this._cache.position.copyFrom(this.position);\n this._cache.upVector.copyFrom(this.upVector);\n }\n /** @internal */\n _isSynchronized() {\n return this._isSynchronizedViewMatrix() && this._isSynchronizedProjectionMatrix();\n }\n /** @internal */\n _isSynchronizedViewMatrix() {\n if (!super._isSynchronized()) {\n return false;\n }\n return this._cache.position.equals(this.position) && this._cache.upVector.equals(this.upVector) && this.isSynchronizedWithParent();\n }\n /** @internal */\n _isSynchronizedProjectionMatrix() {\n let check = this._cache.mode === this.mode && this._cache.minZ === this.minZ && this._cache.maxZ === this.maxZ;\n if (!check) {\n return false;\n }\n const engine = this.getEngine();\n if (this.mode === Camera.PERSPECTIVE_CAMERA) {\n check =\n this._cache.fov === this.fov &&\n this._cache.fovMode === this.fovMode &&\n this._cache.aspectRatio === engine.getAspectRatio(this) &&\n this._cache.projectionPlaneTilt === this.projectionPlaneTilt;\n }\n else {\n check =\n this._cache.orthoLeft === this.orthoLeft &&\n this._cache.orthoRight === this.orthoRight &&\n this._cache.orthoBottom === this.orthoBottom &&\n this._cache.orthoTop === this.orthoTop &&\n this._cache.renderWidth === engine.getRenderWidth() &&\n this._cache.renderHeight === engine.getRenderHeight();\n }\n return check;\n }\n /**\n * Attach the input controls to a specific dom element to get the input from.\n * This function is here because typescript removes the typing of the last function.\n * @param _ignored defines an ignored parameter kept for backward compatibility.\n * @param _noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\n */\n attachControl(_ignored, _noPreventDefault) { }\n /**\n * Detach the current controls from the specified dom element.\n * This function is here because typescript removes the typing of the last function.\n * @param _ignored defines an ignored parameter kept for backward compatibility.\n */\n detachControl(_ignored) { }\n /**\n * Update the camera state according to the different inputs gathered during the frame.\n */\n update() {\n this._checkInputs();\n if (this.cameraRigMode !== Camera.RIG_MODE_NONE) {\n this._updateRigCameras();\n }\n // Attempt to update the camera's view and projection matrices.\n // This call is being made because these matrices are no longer being updated\n // as a part of the picking ray process (in addition to scene.render).\n this.getViewMatrix();\n this.getProjectionMatrix();\n }\n /** @internal */\n _checkInputs() {\n this.onAfterCheckInputsObservable.notifyObservers(this);\n }\n /** @internal */\n get rigCameras() {\n return this._rigCameras;\n }\n /**\n * Gets the post process used by the rig cameras\n */\n get rigPostProcess() {\n return this._rigPostProcess;\n }\n /**\n * Internal, gets the first post process.\n * @returns the first post process to be run on this camera.\n */\n _getFirstPostProcess() {\n for (let ppIndex = 0; ppIndex < this._postProcesses.length; ppIndex++) {\n if (this._postProcesses[ppIndex] !== null) {\n return this._postProcesses[ppIndex];\n }\n }\n return null;\n }\n _cascadePostProcessesToRigCams() {\n // invalidate framebuffer\n const firstPostProcess = this._getFirstPostProcess();\n if (firstPostProcess) {\n firstPostProcess.markTextureDirty();\n }\n // glue the rigPostProcess to the end of the user postprocesses & assign to each sub-camera\n for (let i = 0, len = this._rigCameras.length; i < len; i++) {\n const cam = this._rigCameras[i];\n const rigPostProcess = cam._rigPostProcess;\n // for VR rig, there does not have to be a post process\n if (rigPostProcess) {\n const isPass = rigPostProcess.getEffectName() === \"pass\";\n if (isPass) {\n // any rig which has a PassPostProcess for rig[0], cannot be isIntermediate when there are also user postProcesses\n cam.isIntermediate = this._postProcesses.length === 0;\n }\n cam._postProcesses = this._postProcesses.slice(0).concat(rigPostProcess);\n rigPostProcess.markTextureDirty();\n }\n else {\n cam._postProcesses = this._postProcesses.slice(0);\n }\n }\n }\n /**\n * Attach a post process to the camera.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/postProcesses/usePostProcesses#attach-postprocess\n * @param postProcess The post process to attach to the camera\n * @param insertAt The position of the post process in case several of them are in use in the scene\n * @returns the position the post process has been inserted at\n */\n attachPostProcess(postProcess, insertAt = null) {\n if (!postProcess.isReusable() && this._postProcesses.indexOf(postProcess) > -1) {\n Logger.Error(\"You're trying to reuse a post process not defined as reusable.\");\n return 0;\n }\n if (insertAt == null || insertAt < 0) {\n this._postProcesses.push(postProcess);\n }\n else if (this._postProcesses[insertAt] === null) {\n this._postProcesses[insertAt] = postProcess;\n }\n else {\n this._postProcesses.splice(insertAt, 0, postProcess);\n }\n this._cascadePostProcessesToRigCams(); // also ensures framebuffer invalidated\n // Update prePass\n if (this._scene.prePassRenderer) {\n this._scene.prePassRenderer.markAsDirty();\n }\n return this._postProcesses.indexOf(postProcess);\n }\n /**\n * Detach a post process to the camera.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/postProcesses/usePostProcesses#attach-postprocess\n * @param postProcess The post process to detach from the camera\n */\n detachPostProcess(postProcess) {\n const idx = this._postProcesses.indexOf(postProcess);\n if (idx !== -1) {\n this._postProcesses[idx] = null;\n }\n // Update prePass\n if (this._scene.prePassRenderer) {\n this._scene.prePassRenderer.markAsDirty();\n }\n this._cascadePostProcessesToRigCams(); // also ensures framebuffer invalidated\n }\n /**\n * Gets the current world matrix of the camera\n */\n getWorldMatrix() {\n if (this._isSynchronizedViewMatrix()) {\n return this._worldMatrix;\n }\n // Getting the the view matrix will also compute the world matrix.\n this.getViewMatrix();\n return this._worldMatrix;\n }\n /** @internal */\n _getViewMatrix() {\n return Matrix.Identity();\n }\n /**\n * Gets the current view matrix of the camera.\n * @param force forces the camera to recompute the matrix without looking at the cached state\n * @returns the view matrix\n */\n getViewMatrix(force) {\n if (!force && this._isSynchronizedViewMatrix()) {\n return this._computedViewMatrix;\n }\n this.updateCache();\n this._computedViewMatrix = this._getViewMatrix();\n this._currentRenderId = this.getScene().getRenderId();\n this._childUpdateId++;\n this._refreshFrustumPlanes = true;\n if (this._cameraRigParams && this._cameraRigParams.vrPreViewMatrix) {\n this._computedViewMatrix.multiplyToRef(this._cameraRigParams.vrPreViewMatrix, this._computedViewMatrix);\n }\n // Notify parent camera if rig camera is changed\n if (this.parent && this.parent.onViewMatrixChangedObservable) {\n this.parent.onViewMatrixChangedObservable.notifyObservers(this.parent);\n }\n this.onViewMatrixChangedObservable.notifyObservers(this);\n this._computedViewMatrix.invertToRef(this._worldMatrix);\n return this._computedViewMatrix;\n }\n /**\n * Freeze the projection matrix.\n * It will prevent the cache check of the camera projection compute and can speed up perf\n * if no parameter of the camera are meant to change\n * @param projection Defines manually a projection if necessary\n */\n freezeProjectionMatrix(projection) {\n this._doNotComputeProjectionMatrix = true;\n if (projection !== undefined) {\n this._projectionMatrix = projection;\n }\n }\n /**\n * Unfreeze the projection matrix if it has previously been freezed by freezeProjectionMatrix.\n */\n unfreezeProjectionMatrix() {\n this._doNotComputeProjectionMatrix = false;\n }\n /**\n * Gets the current projection matrix of the camera.\n * @param force forces the camera to recompute the matrix without looking at the cached state\n * @returns the projection matrix\n */\n getProjectionMatrix(force) {\n var _a, _b, _c, _d, _e, _f, _g, _h;\n if (this._doNotComputeProjectionMatrix || (!force && this._isSynchronizedProjectionMatrix())) {\n return this._projectionMatrix;\n }\n // Cache\n this._cache.mode = this.mode;\n this._cache.minZ = this.minZ;\n this._cache.maxZ = this.maxZ;\n // Matrix\n this._refreshFrustumPlanes = true;\n const engine = this.getEngine();\n const scene = this.getScene();\n const reverseDepth = engine.useReverseDepthBuffer;\n if (this.mode === Camera.PERSPECTIVE_CAMERA) {\n this._cache.fov = this.fov;\n this._cache.fovMode = this.fovMode;\n this._cache.aspectRatio = engine.getAspectRatio(this);\n this._cache.projectionPlaneTilt = this.projectionPlaneTilt;\n if (this.minZ <= 0) {\n this.minZ = 0.1;\n }\n let getProjectionMatrix;\n if (scene.useRightHandedSystem) {\n getProjectionMatrix = Matrix.PerspectiveFovRHToRef;\n }\n else {\n getProjectionMatrix = Matrix.PerspectiveFovLHToRef;\n }\n getProjectionMatrix(this.fov, engine.getAspectRatio(this), reverseDepth ? this.maxZ : this.minZ, reverseDepth ? this.minZ : this.maxZ, this._projectionMatrix, this.fovMode === Camera.FOVMODE_VERTICAL_FIXED, engine.isNDCHalfZRange, this.projectionPlaneTilt, reverseDepth);\n }\n else {\n const halfWidth = engine.getRenderWidth() / 2.0;\n const halfHeight = engine.getRenderHeight() / 2.0;\n if (scene.useRightHandedSystem) {\n Matrix.OrthoOffCenterRHToRef((_a = this.orthoLeft) !== null && _a !== void 0 ? _a : -halfWidth, (_b = this.orthoRight) !== null && _b !== void 0 ? _b : halfWidth, (_c = this.orthoBottom) !== null && _c !== void 0 ? _c : -halfHeight, (_d = this.orthoTop) !== null && _d !== void 0 ? _d : halfHeight, reverseDepth ? this.maxZ : this.minZ, reverseDepth ? this.minZ : this.maxZ, this._projectionMatrix, engine.isNDCHalfZRange);\n }\n else {\n Matrix.OrthoOffCenterLHToRef((_e = this.orthoLeft) !== null && _e !== void 0 ? _e : -halfWidth, (_f = this.orthoRight) !== null && _f !== void 0 ? _f : halfWidth, (_g = this.orthoBottom) !== null && _g !== void 0 ? _g : -halfHeight, (_h = this.orthoTop) !== null && _h !== void 0 ? _h : halfHeight, reverseDepth ? this.maxZ : this.minZ, reverseDepth ? this.minZ : this.maxZ, this._projectionMatrix, engine.isNDCHalfZRange);\n }\n this._cache.orthoLeft = this.orthoLeft;\n this._cache.orthoRight = this.orthoRight;\n this._cache.orthoBottom = this.orthoBottom;\n this._cache.orthoTop = this.orthoTop;\n this._cache.renderWidth = engine.getRenderWidth();\n this._cache.renderHeight = engine.getRenderHeight();\n }\n this.onProjectionMatrixChangedObservable.notifyObservers(this);\n return this._projectionMatrix;\n }\n /**\n * Gets the transformation matrix (ie. the multiplication of view by projection matrices)\n * @returns a Matrix\n */\n getTransformationMatrix() {\n this._computedViewMatrix.multiplyToRef(this._projectionMatrix, this._transformMatrix);\n return this._transformMatrix;\n }\n _updateFrustumPlanes() {\n if (!this._refreshFrustumPlanes) {\n return;\n }\n this.getTransformationMatrix();\n if (!this._frustumPlanes) {\n this._frustumPlanes = Frustum.GetPlanes(this._transformMatrix);\n }\n else {\n Frustum.GetPlanesToRef(this._transformMatrix, this._frustumPlanes);\n }\n this._refreshFrustumPlanes = false;\n }\n /**\n * Checks if a cullable object (mesh...) is in the camera frustum\n * This checks the bounding box center. See isCompletelyInFrustum for a full bounding check\n * @param target The object to check\n * @param checkRigCameras If the rig cameras should be checked (eg. with webVR camera both eyes should be checked) (Default: false)\n * @returns true if the object is in frustum otherwise false\n */\n isInFrustum(target, checkRigCameras = false) {\n this._updateFrustumPlanes();\n if (checkRigCameras && this.rigCameras.length > 0) {\n let result = false;\n this.rigCameras.forEach((cam) => {\n cam._updateFrustumPlanes();\n result = result || target.isInFrustum(cam._frustumPlanes);\n });\n return result;\n }\n else {\n return target.isInFrustum(this._frustumPlanes);\n }\n }\n /**\n * Checks if a cullable object (mesh...) is in the camera frustum\n * Unlike isInFrustum this checks the full bounding box\n * @param target The object to check\n * @returns true if the object is in frustum otherwise false\n */\n isCompletelyInFrustum(target) {\n this._updateFrustumPlanes();\n return target.isCompletelyInFrustum(this._frustumPlanes);\n }\n /**\n * Gets a ray in the forward direction from the camera.\n * @param length Defines the length of the ray to create\n * @param transform Defines the transform to apply to the ray, by default the world matrix is used to create a workd space ray\n * @param origin Defines the start point of the ray which defaults to the camera position\n * @returns the forward ray\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n getForwardRay(length = 100, transform, origin) {\n throw _WarnImport(\"Ray\");\n }\n /**\n * Gets a ray in the forward direction from the camera.\n * @param refRay the ray to (re)use when setting the values\n * @param length Defines the length of the ray to create\n * @param transform Defines the transform to apply to the ray, by default the world matrx is used to create a workd space ray\n * @param origin Defines the start point of the ray which defaults to the camera position\n * @returns the forward ray\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n getForwardRayToRef(refRay, length = 100, transform, origin) {\n throw _WarnImport(\"Ray\");\n }\n /**\n * Releases resources associated with this node.\n * @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)\n * @param disposeMaterialAndTextures Set to true to also dispose referenced materials and textures (false by default)\n */\n dispose(doNotRecurse, disposeMaterialAndTextures = false) {\n // Observables\n this.onViewMatrixChangedObservable.clear();\n this.onProjectionMatrixChangedObservable.clear();\n this.onAfterCheckInputsObservable.clear();\n this.onRestoreStateObservable.clear();\n // Inputs\n if (this.inputs) {\n this.inputs.clear();\n }\n // Animations\n this.getScene().stopAnimation(this);\n // Remove from scene\n this.getScene().removeCamera(this);\n while (this._rigCameras.length > 0) {\n const camera = this._rigCameras.pop();\n if (camera) {\n camera.dispose();\n }\n }\n if (this._parentContainer) {\n const index = this._parentContainer.cameras.indexOf(this);\n if (index > -1) {\n this._parentContainer.cameras.splice(index, 1);\n }\n this._parentContainer = null;\n }\n // Postprocesses\n if (this._rigPostProcess) {\n this._rigPostProcess.dispose(this);\n this._rigPostProcess = null;\n this._postProcesses.length = 0;\n }\n else if (this.cameraRigMode !== Camera.RIG_MODE_NONE) {\n this._rigPostProcess = null;\n this._postProcesses.length = 0;\n }\n else {\n let i = this._postProcesses.length;\n while (--i >= 0) {\n const postProcess = this._postProcesses[i];\n if (postProcess) {\n postProcess.dispose(this);\n }\n }\n }\n // Render targets\n let i = this.customRenderTargets.length;\n while (--i >= 0) {\n this.customRenderTargets[i].dispose();\n }\n this.customRenderTargets.length = 0;\n // Active Meshes\n this._activeMeshes.dispose();\n this.getScene().getEngine().releaseRenderPassId(this.renderPassId);\n super.dispose(doNotRecurse, disposeMaterialAndTextures);\n }\n /**\n * Gets the left camera of a rig setup in case of Rigged Camera\n */\n get isLeftCamera() {\n return this._isLeftCamera;\n }\n /**\n * Gets the right camera of a rig setup in case of Rigged Camera\n */\n get isRightCamera() {\n return this._isRightCamera;\n }\n /**\n * Gets the left camera of a rig setup in case of Rigged Camera\n */\n get leftCamera() {\n if (this._rigCameras.length < 1) {\n return null;\n }\n return this._rigCameras[0];\n }\n /**\n * Gets the right camera of a rig setup in case of Rigged Camera\n */\n get rightCamera() {\n if (this._rigCameras.length < 2) {\n return null;\n }\n return this._rigCameras[1];\n }\n /**\n * Gets the left camera target of a rig setup in case of Rigged Camera\n * @returns the target position\n */\n getLeftTarget() {\n if (this._rigCameras.length < 1) {\n return null;\n }\n return this._rigCameras[0].getTarget();\n }\n /**\n * Gets the right camera target of a rig setup in case of Rigged Camera\n * @returns the target position\n */\n getRightTarget() {\n if (this._rigCameras.length < 2) {\n return null;\n }\n return this._rigCameras[1].getTarget();\n }\n /**\n * @internal\n */\n setCameraRigMode(mode, rigParams) {\n if (this.cameraRigMode === mode) {\n return;\n }\n while (this._rigCameras.length > 0) {\n const camera = this._rigCameras.pop();\n if (camera) {\n camera.dispose();\n }\n }\n this.cameraRigMode = mode;\n this._cameraRigParams = {};\n //we have to implement stereo camera calcultating left and right viewpoints from interaxialDistance and target,\n //not from a given angle as it is now, but until that complete code rewriting provisional stereoHalfAngle value is introduced\n this._cameraRigParams.interaxialDistance = rigParams.interaxialDistance || 0.0637;\n this._cameraRigParams.stereoHalfAngle = Tools.ToRadians(this._cameraRigParams.interaxialDistance / 0.0637);\n // create the rig cameras, unless none\n if (this.cameraRigMode !== Camera.RIG_MODE_NONE) {\n const leftCamera = this.createRigCamera(this.name + \"_L\", 0);\n if (leftCamera) {\n leftCamera._isLeftCamera = true;\n }\n const rightCamera = this.createRigCamera(this.name + \"_R\", 1);\n if (rightCamera) {\n rightCamera._isRightCamera = true;\n }\n if (leftCamera && rightCamera) {\n this._rigCameras.push(leftCamera);\n this._rigCameras.push(rightCamera);\n }\n }\n this._setRigMode(rigParams);\n this._cascadePostProcessesToRigCams();\n this.update();\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _setRigMode(rigParams) {\n // no-op\n }\n /** @internal */\n _getVRProjectionMatrix() {\n Matrix.PerspectiveFovLHToRef(this._cameraRigParams.vrMetrics.aspectRatioFov, this._cameraRigParams.vrMetrics.aspectRatio, this.minZ, this.maxZ, this._cameraRigParams.vrWorkMatrix, true, this.getEngine().isNDCHalfZRange);\n this._cameraRigParams.vrWorkMatrix.multiplyToRef(this._cameraRigParams.vrHMatrix, this._projectionMatrix);\n return this._projectionMatrix;\n }\n _updateCameraRotationMatrix() {\n //Here for WebVR\n }\n _updateWebVRCameraRotationMatrix() {\n //Here for WebVR\n }\n /**\n * This function MUST be overwritten by the different WebVR cameras available.\n * The context in which it is running is the RIG camera. So 'this' is the TargetCamera, left or right.\n * @internal\n */\n _getWebVRProjectionMatrix() {\n return Matrix.Identity();\n }\n /**\n * This function MUST be overwritten by the different WebVR cameras available.\n * The context in which it is running is the RIG camera. So 'this' is the TargetCamera, left or right.\n * @internal\n */\n _getWebVRViewMatrix() {\n return Matrix.Identity();\n }\n /**\n * @internal\n */\n setCameraRigParameter(name, value) {\n if (!this._cameraRigParams) {\n this._cameraRigParams = {};\n }\n this._cameraRigParams[name] = value;\n //provisionnally:\n if (name === \"interaxialDistance\") {\n this._cameraRigParams.stereoHalfAngle = Tools.ToRadians(value / 0.0637);\n }\n }\n /**\n * needs to be overridden by children so sub has required properties to be copied\n * @internal\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n createRigCamera(name, cameraIndex) {\n return null;\n }\n /**\n * May need to be overridden by children\n * @internal\n */\n _updateRigCameras() {\n for (let i = 0; i < this._rigCameras.length; i++) {\n this._rigCameras[i].minZ = this.minZ;\n this._rigCameras[i].maxZ = this.maxZ;\n this._rigCameras[i].fov = this.fov;\n this._rigCameras[i].upVector.copyFrom(this.upVector);\n }\n // only update viewport when ANAGLYPH\n if (this.cameraRigMode === Camera.RIG_MODE_STEREOSCOPIC_ANAGLYPH) {\n this._rigCameras[0].viewport = this._rigCameras[1].viewport = this.viewport;\n }\n }\n /** @internal */\n _setupInputs() { }\n /**\n * Serialiaze the camera setup to a json representation\n * @returns the JSON representation\n */\n serialize() {\n const serializationObject = SerializationHelper.Serialize(this);\n serializationObject.uniqueId = this.uniqueId;\n // Type\n serializationObject.type = this.getClassName();\n // Parent\n if (this.parent) {\n this.parent._serializeAsParent(serializationObject);\n }\n if (this.inputs) {\n this.inputs.serialize(serializationObject);\n }\n // Animations\n SerializationHelper.AppendSerializedAnimations(this, serializationObject);\n serializationObject.ranges = this.serializeAnimationRanges();\n serializationObject.isEnabled = this.isEnabled();\n return serializationObject;\n }\n /**\n * Clones the current camera.\n * @param name The cloned camera name\n * @param newParent The cloned camera's new parent (none by default)\n * @returns the cloned camera\n */\n clone(name, newParent = null) {\n const camera = SerializationHelper.Clone(Camera.GetConstructorFromName(this.getClassName(), name, this.getScene(), this.interaxialDistance, this.isStereoscopicSideBySide), this);\n camera.name = name;\n camera.parent = newParent;\n this.onClonedObservable.notifyObservers(camera);\n return camera;\n }\n /**\n * Gets the direction of the camera relative to a given local axis.\n * @param localAxis Defines the reference axis to provide a relative direction.\n * @returns the direction\n */\n getDirection(localAxis) {\n const result = Vector3.Zero();\n this.getDirectionToRef(localAxis, result);\n return result;\n }\n /**\n * Returns the current camera absolute rotation\n */\n get absoluteRotation() {\n this.getWorldMatrix().decompose(undefined, this._absoluteRotation);\n return this._absoluteRotation;\n }\n /**\n * Gets the direction of the camera relative to a given local axis into a passed vector.\n * @param localAxis Defines the reference axis to provide a relative direction.\n * @param result Defines the vector to store the result in\n */\n getDirectionToRef(localAxis, result) {\n Vector3.TransformNormalToRef(localAxis, this.getWorldMatrix(), result);\n }\n /**\n * Gets a camera constructor for a given camera type\n * @param type The type of the camera to construct (should be equal to one of the camera class name)\n * @param name The name of the camera the result will be able to instantiate\n * @param scene The scene the result will construct the camera in\n * @param interaxial_distance In case of stereoscopic setup, the distance between both eyes\n * @param isStereoscopicSideBySide In case of stereoscopic setup, should the sereo be side b side\n * @returns a factory method to construct the camera\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n static GetConstructorFromName(type, name, scene, interaxial_distance = 0, isStereoscopicSideBySide = true) {\n const constructorFunc = Node.Construct(type, name, scene, {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n interaxial_distance: interaxial_distance,\n isStereoscopicSideBySide: isStereoscopicSideBySide,\n });\n if (constructorFunc) {\n return constructorFunc;\n }\n // Default to universal camera\n return () => Camera._CreateDefaultParsedCamera(name, scene);\n }\n /**\n * Compute the world matrix of the camera.\n * @returns the camera world matrix\n */\n computeWorldMatrix() {\n return this.getWorldMatrix();\n }\n /**\n * Parse a JSON and creates the camera from the parsed information\n * @param parsedCamera The JSON to parse\n * @param scene The scene to instantiate the camera in\n * @returns the newly constructed camera\n */\n static Parse(parsedCamera, scene) {\n const type = parsedCamera.type;\n const construct = Camera.GetConstructorFromName(type, parsedCamera.name, scene, parsedCamera.interaxial_distance, parsedCamera.isStereoscopicSideBySide);\n const camera = SerializationHelper.Parse(construct, parsedCamera, scene);\n // Parent\n if (parsedCamera.parentId !== undefined) {\n camera._waitingParentId = parsedCamera.parentId;\n }\n // Parent instance index\n if (parsedCamera.parentInstanceIndex !== undefined) {\n camera._waitingParentInstanceIndex = parsedCamera.parentInstanceIndex;\n }\n //If camera has an input manager, let it parse inputs settings\n if (camera.inputs) {\n camera.inputs.parse(parsedCamera);\n camera._setupInputs();\n }\n if (parsedCamera.upVector) {\n camera.upVector = Vector3.FromArray(parsedCamera.upVector); // need to force the upVector\n }\n if (camera.setPosition) {\n // need to force position\n camera.position.copyFromFloats(0, 0, 0);\n camera.setPosition(Vector3.FromArray(parsedCamera.position));\n }\n // Target\n if (parsedCamera.target) {\n if (camera.setTarget) {\n camera.setTarget(Vector3.FromArray(parsedCamera.target));\n }\n }\n // Apply 3d rig, when found\n if (parsedCamera.cameraRigMode) {\n const rigParams = parsedCamera.interaxial_distance ? { interaxialDistance: parsedCamera.interaxial_distance } : {};\n camera.setCameraRigMode(parsedCamera.cameraRigMode, rigParams);\n }\n // Animations\n if (parsedCamera.animations) {\n for (let animationIndex = 0; animationIndex < parsedCamera.animations.length; animationIndex++) {\n const parsedAnimation = parsedCamera.animations[animationIndex];\n const internalClass = GetClass(\"BABYLON.Animation\");\n if (internalClass) {\n camera.animations.push(internalClass.Parse(parsedAnimation));\n }\n }\n Node.ParseAnimationRanges(camera, parsedCamera, scene);\n }\n if (parsedCamera.autoAnimate) {\n scene.beginAnimation(camera, parsedCamera.autoAnimateFrom, parsedCamera.autoAnimateTo, parsedCamera.autoAnimateLoop, parsedCamera.autoAnimateSpeed || 1.0);\n }\n // Check if isEnabled is defined to be back compatible with prior serialized versions.\n if (parsedCamera.isEnabled !== undefined) {\n camera.setEnabled(parsedCamera.isEnabled);\n }\n return camera;\n }\n /** @internal */\n _calculateHandednessMultiplier() {\n let handednessMultiplier = this.getScene().useRightHandedSystem ? -1 : 1;\n if (this.parent && this.parent._getWorldMatrixDeterminant() < 0) {\n handednessMultiplier *= -1;\n }\n return handednessMultiplier;\n }\n}\n/**\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nCamera._CreateDefaultParsedCamera = (name, scene) => {\n throw _WarnImport(\"UniversalCamera\");\n};\n/**\n * This is the default projection mode used by the cameras.\n * It helps recreating a feeling of perspective and better appreciate depth.\n * This is the best way to simulate real life cameras.\n */\nCamera.PERSPECTIVE_CAMERA = 0;\n/**\n * This helps creating camera with an orthographic mode.\n * Orthographic is commonly used in engineering as a means to produce object specifications that communicate dimensions unambiguously, each line of 1 unit length (cm, meter..whatever) will appear to have the same length everywhere on the drawing. This allows the drafter to dimension only a subset of lines and let the reader know that other lines of that length on the drawing are also that length in reality. Every parallel line in the drawing is also parallel in the object.\n */\nCamera.ORTHOGRAPHIC_CAMERA = 1;\n/**\n * This is the default FOV mode for perspective cameras.\n * This setting aligns the upper and lower bounds of the viewport to the upper and lower bounds of the camera frustum.\n */\nCamera.FOVMODE_VERTICAL_FIXED = 0;\n/**\n * This setting aligns the left and right bounds of the viewport to the left and right bounds of the camera frustum.\n */\nCamera.FOVMODE_HORIZONTAL_FIXED = 1;\n/**\n * This specifies there is no need for a camera rig.\n * Basically only one eye is rendered corresponding to the camera.\n */\nCamera.RIG_MODE_NONE = 0;\n/**\n * Simulates a camera Rig with one blue eye and one red eye.\n * This can be use with 3d blue and red glasses.\n */\nCamera.RIG_MODE_STEREOSCOPIC_ANAGLYPH = 10;\n/**\n * Defines that both eyes of the camera will be rendered side by side with a parallel target.\n */\nCamera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL = 11;\n/**\n * Defines that both eyes of the camera will be rendered side by side with a none parallel target.\n */\nCamera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED = 12;\n/**\n * Defines that both eyes of the camera will be rendered over under each other.\n */\nCamera.RIG_MODE_STEREOSCOPIC_OVERUNDER = 13;\n/**\n * Defines that both eyes of the camera will be rendered on successive lines interlaced for passive 3d monitors.\n */\nCamera.RIG_MODE_STEREOSCOPIC_INTERLACED = 14;\n/**\n * Defines that both eyes of the camera should be renderered in a VR mode (carbox).\n */\nCamera.RIG_MODE_VR = 20;\n/**\n * Defines that both eyes of the camera should be renderered in a VR mode (webVR).\n */\nCamera.RIG_MODE_WEBVR = 21;\n/**\n * Custom rig mode allowing rig cameras to be populated manually with any number of cameras\n */\nCamera.RIG_MODE_CUSTOM = 22;\n/**\n * Defines if by default attaching controls should prevent the default javascript event to continue.\n */\nCamera.ForceAttachControlToAlwaysPreventDefault = false;\n__decorate([\n serializeAsVector3(\"position\")\n], Camera.prototype, \"_position\", void 0);\n__decorate([\n serializeAsVector3(\"upVector\")\n], Camera.prototype, \"_upVector\", void 0);\n__decorate([\n serialize()\n], Camera.prototype, \"orthoLeft\", null);\n__decorate([\n serialize()\n], Camera.prototype, \"orthoRight\", null);\n__decorate([\n serialize()\n], Camera.prototype, \"orthoBottom\", null);\n__decorate([\n serialize()\n], Camera.prototype, \"orthoTop\", null);\n__decorate([\n serialize()\n], Camera.prototype, \"fov\", void 0);\n__decorate([\n serialize()\n], Camera.prototype, \"projectionPlaneTilt\", void 0);\n__decorate([\n serialize()\n], Camera.prototype, \"minZ\", void 0);\n__decorate([\n serialize()\n], Camera.prototype, \"maxZ\", void 0);\n__decorate([\n serialize()\n], Camera.prototype, \"inertia\", void 0);\n__decorate([\n serialize()\n], Camera.prototype, \"mode\", null);\n__decorate([\n serialize()\n], Camera.prototype, \"layerMask\", void 0);\n__decorate([\n serialize()\n], Camera.prototype, \"fovMode\", void 0);\n__decorate([\n serialize()\n], Camera.prototype, \"cameraRigMode\", void 0);\n__decorate([\n serialize()\n], Camera.prototype, \"interaxialDistance\", void 0);\n__decorate([\n serialize()\n], Camera.prototype, \"isStereoscopicSideBySide\", void 0);\n//# sourceMappingURL=camera.js.map","/**\n * @internal\n */\nexport class IntersectionInfo {\n constructor(bu, bv, distance) {\n this.bu = bu;\n this.bv = bv;\n this.distance = distance;\n this.faceId = 0;\n this.subMeshId = 0;\n }\n}\n//# sourceMappingURL=intersectionInfo.js.map","import { ArrayTools } from \"../Misc/arrayTools.js\";\nimport { Matrix, Vector3 } from \"../Maths/math.vector.js\";\nimport { Epsilon } from \"../Maths/math.constants.js\";\n/**\n * Class used to store bounding box information\n */\nexport class BoundingBox {\n /**\n * Creates a new bounding box\n * @param min defines the minimum vector (in local space)\n * @param max defines the maximum vector (in local space)\n * @param worldMatrix defines the new world matrix\n */\n constructor(min, max, worldMatrix) {\n /**\n * Gets the 8 vectors representing the bounding box in local space\n */\n this.vectors = ArrayTools.BuildArray(8, Vector3.Zero);\n /**\n * Gets the center of the bounding box in local space\n */\n this.center = Vector3.Zero();\n /**\n * Gets the center of the bounding box in world space\n */\n this.centerWorld = Vector3.Zero();\n /**\n * Gets the extend size in local space\n */\n this.extendSize = Vector3.Zero();\n /**\n * Gets the extend size in world space\n */\n this.extendSizeWorld = Vector3.Zero();\n /**\n * Gets the OBB (object bounding box) directions\n */\n this.directions = ArrayTools.BuildArray(3, Vector3.Zero);\n /**\n * Gets the 8 vectors representing the bounding box in world space\n */\n this.vectorsWorld = ArrayTools.BuildArray(8, Vector3.Zero);\n /**\n * Gets the minimum vector in world space\n */\n this.minimumWorld = Vector3.Zero();\n /**\n * Gets the maximum vector in world space\n */\n this.maximumWorld = Vector3.Zero();\n /**\n * Gets the minimum vector in local space\n */\n this.minimum = Vector3.Zero();\n /**\n * Gets the maximum vector in local space\n */\n this.maximum = Vector3.Zero();\n /** @internal */\n this._drawWrapperFront = null;\n /** @internal */\n this._drawWrapperBack = null;\n this.reConstruct(min, max, worldMatrix);\n }\n // Methods\n /**\n * Recreates the entire bounding box from scratch as if we call the constructor in place\n * @param min defines the new minimum vector (in local space)\n * @param max defines the new maximum vector (in local space)\n * @param worldMatrix defines the new world matrix\n */\n reConstruct(min, max, worldMatrix) {\n const minX = min.x, minY = min.y, minZ = min.z, maxX = max.x, maxY = max.y, maxZ = max.z;\n const vectors = this.vectors;\n this.minimum.copyFromFloats(minX, minY, minZ);\n this.maximum.copyFromFloats(maxX, maxY, maxZ);\n vectors[0].copyFromFloats(minX, minY, minZ);\n vectors[1].copyFromFloats(maxX, maxY, maxZ);\n vectors[2].copyFromFloats(maxX, minY, minZ);\n vectors[3].copyFromFloats(minX, maxY, minZ);\n vectors[4].copyFromFloats(minX, minY, maxZ);\n vectors[5].copyFromFloats(maxX, maxY, minZ);\n vectors[6].copyFromFloats(minX, maxY, maxZ);\n vectors[7].copyFromFloats(maxX, minY, maxZ);\n // OBB\n max.addToRef(min, this.center).scaleInPlace(0.5);\n max.subtractToRef(min, this.extendSize).scaleInPlace(0.5);\n this._worldMatrix = worldMatrix || Matrix.IdentityReadOnly;\n this._update(this._worldMatrix);\n }\n /**\n * Scale the current bounding box by applying a scale factor\n * @param factor defines the scale factor to apply\n * @returns the current bounding box\n */\n scale(factor) {\n const tmpVectors = BoundingBox._TmpVector3;\n const diff = this.maximum.subtractToRef(this.minimum, tmpVectors[0]);\n const len = diff.length();\n diff.normalizeFromLength(len);\n const distance = len * factor;\n const newRadius = diff.scaleInPlace(distance * 0.5);\n const min = this.center.subtractToRef(newRadius, tmpVectors[1]);\n const max = this.center.addToRef(newRadius, tmpVectors[2]);\n this.reConstruct(min, max, this._worldMatrix);\n return this;\n }\n /**\n * Gets the world matrix of the bounding box\n * @returns a matrix\n */\n getWorldMatrix() {\n return this._worldMatrix;\n }\n /**\n * @internal\n */\n _update(world) {\n const minWorld = this.minimumWorld;\n const maxWorld = this.maximumWorld;\n const directions = this.directions;\n const vectorsWorld = this.vectorsWorld;\n const vectors = this.vectors;\n if (!world.isIdentity()) {\n minWorld.setAll(Number.MAX_VALUE);\n maxWorld.setAll(-Number.MAX_VALUE);\n for (let index = 0; index < 8; ++index) {\n const v = vectorsWorld[index];\n Vector3.TransformCoordinatesToRef(vectors[index], world, v);\n minWorld.minimizeInPlace(v);\n maxWorld.maximizeInPlace(v);\n }\n // Extend\n maxWorld.subtractToRef(minWorld, this.extendSizeWorld).scaleInPlace(0.5);\n maxWorld.addToRef(minWorld, this.centerWorld).scaleInPlace(0.5);\n }\n else {\n minWorld.copyFrom(this.minimum);\n maxWorld.copyFrom(this.maximum);\n for (let index = 0; index < 8; ++index) {\n vectorsWorld[index].copyFrom(vectors[index]);\n }\n // Extend\n this.extendSizeWorld.copyFrom(this.extendSize);\n this.centerWorld.copyFrom(this.center);\n }\n Vector3.FromArrayToRef(world.m, 0, directions[0]);\n Vector3.FromArrayToRef(world.m, 4, directions[1]);\n Vector3.FromArrayToRef(world.m, 8, directions[2]);\n this._worldMatrix = world;\n }\n /**\n * Tests if the bounding box is intersecting the frustum planes\n * @param frustumPlanes defines the frustum planes to test\n * @returns true if there is an intersection\n */\n isInFrustum(frustumPlanes) {\n return BoundingBox.IsInFrustum(this.vectorsWorld, frustumPlanes);\n }\n /**\n * Tests if the bounding box is entirely inside the frustum planes\n * @param frustumPlanes defines the frustum planes to test\n * @returns true if there is an inclusion\n */\n isCompletelyInFrustum(frustumPlanes) {\n return BoundingBox.IsCompletelyInFrustum(this.vectorsWorld, frustumPlanes);\n }\n /**\n * Tests if a point is inside the bounding box\n * @param point defines the point to test\n * @returns true if the point is inside the bounding box\n */\n intersectsPoint(point) {\n const min = this.minimumWorld;\n const max = this.maximumWorld;\n const minX = min.x, minY = min.y, minZ = min.z, maxX = max.x, maxY = max.y, maxZ = max.z;\n const pointX = point.x, pointY = point.y, pointZ = point.z;\n const delta = -Epsilon;\n if (maxX - pointX < delta || delta > pointX - minX) {\n return false;\n }\n if (maxY - pointY < delta || delta > pointY - minY) {\n return false;\n }\n if (maxZ - pointZ < delta || delta > pointZ - minZ) {\n return false;\n }\n return true;\n }\n /**\n * Tests if the bounding box intersects with a bounding sphere\n * @param sphere defines the sphere to test\n * @returns true if there is an intersection\n */\n intersectsSphere(sphere) {\n return BoundingBox.IntersectsSphere(this.minimumWorld, this.maximumWorld, sphere.centerWorld, sphere.radiusWorld);\n }\n /**\n * Tests if the bounding box intersects with a box defined by a min and max vectors\n * @param min defines the min vector to use\n * @param max defines the max vector to use\n * @returns true if there is an intersection\n */\n intersectsMinMax(min, max) {\n const myMin = this.minimumWorld;\n const myMax = this.maximumWorld;\n const myMinX = myMin.x, myMinY = myMin.y, myMinZ = myMin.z, myMaxX = myMax.x, myMaxY = myMax.y, myMaxZ = myMax.z;\n const minX = min.x, minY = min.y, minZ = min.z, maxX = max.x, maxY = max.y, maxZ = max.z;\n if (myMaxX < minX || myMinX > maxX) {\n return false;\n }\n if (myMaxY < minY || myMinY > maxY) {\n return false;\n }\n if (myMaxZ < minZ || myMinZ > maxZ) {\n return false;\n }\n return true;\n }\n /**\n * Disposes the resources of the class\n */\n dispose() {\n var _a, _b;\n (_a = this._drawWrapperFront) === null || _a === void 0 ? void 0 : _a.dispose();\n (_b = this._drawWrapperBack) === null || _b === void 0 ? void 0 : _b.dispose();\n }\n // Statics\n /**\n * Tests if two bounding boxes are intersections\n * @param box0 defines the first box to test\n * @param box1 defines the second box to test\n * @returns true if there is an intersection\n */\n static Intersects(box0, box1) {\n return box0.intersectsMinMax(box1.minimumWorld, box1.maximumWorld);\n }\n /**\n * Tests if a bounding box defines by a min/max vectors intersects a sphere\n * @param minPoint defines the minimum vector of the bounding box\n * @param maxPoint defines the maximum vector of the bounding box\n * @param sphereCenter defines the sphere center\n * @param sphereRadius defines the sphere radius\n * @returns true if there is an intersection\n */\n static IntersectsSphere(minPoint, maxPoint, sphereCenter, sphereRadius) {\n const vector = BoundingBox._TmpVector3[0];\n Vector3.ClampToRef(sphereCenter, minPoint, maxPoint, vector);\n const num = Vector3.DistanceSquared(sphereCenter, vector);\n return num <= sphereRadius * sphereRadius;\n }\n /**\n * Tests if a bounding box defined with 8 vectors is entirely inside frustum planes\n * @param boundingVectors defines an array of 8 vectors representing a bounding box\n * @param frustumPlanes defines the frustum planes to test\n * @returns true if there is an inclusion\n */\n static IsCompletelyInFrustum(boundingVectors, frustumPlanes) {\n for (let p = 0; p < 6; ++p) {\n const frustumPlane = frustumPlanes[p];\n for (let i = 0; i < 8; ++i) {\n if (frustumPlane.dotCoordinate(boundingVectors[i]) < 0) {\n return false;\n }\n }\n }\n return true;\n }\n /**\n * Tests if a bounding box defined with 8 vectors intersects frustum planes\n * @param boundingVectors defines an array of 8 vectors representing a bounding box\n * @param frustumPlanes defines the frustum planes to test\n * @returns true if there is an intersection\n */\n static IsInFrustum(boundingVectors, frustumPlanes) {\n for (let p = 0; p < 6; ++p) {\n let canReturnFalse = true;\n const frustumPlane = frustumPlanes[p];\n for (let i = 0; i < 8; ++i) {\n if (frustumPlane.dotCoordinate(boundingVectors[i]) >= 0) {\n canReturnFalse = false;\n break;\n }\n }\n if (canReturnFalse) {\n return false;\n }\n }\n return true;\n }\n}\nBoundingBox._TmpVector3 = ArrayTools.BuildArray(3, Vector3.Zero);\n//# sourceMappingURL=boundingBox.js.map","import { ArrayTools } from \"../Misc/arrayTools.js\";\nimport { Matrix, Vector3 } from \"../Maths/math.vector.js\";\n/**\n * Class used to store bounding sphere information\n */\nexport class BoundingSphere {\n /**\n * Creates a new bounding sphere\n * @param min defines the minimum vector (in local space)\n * @param max defines the maximum vector (in local space)\n * @param worldMatrix defines the new world matrix\n */\n constructor(min, max, worldMatrix) {\n /**\n * Gets the center of the bounding sphere in local space\n */\n this.center = Vector3.Zero();\n /**\n * Gets the center of the bounding sphere in world space\n */\n this.centerWorld = Vector3.Zero();\n /**\n * Gets the minimum vector in local space\n */\n this.minimum = Vector3.Zero();\n /**\n * Gets the maximum vector in local space\n */\n this.maximum = Vector3.Zero();\n this.reConstruct(min, max, worldMatrix);\n }\n /**\n * Recreates the entire bounding sphere from scratch as if we call the constructor in place\n * @param min defines the new minimum vector (in local space)\n * @param max defines the new maximum vector (in local space)\n * @param worldMatrix defines the new world matrix\n */\n reConstruct(min, max, worldMatrix) {\n this.minimum.copyFrom(min);\n this.maximum.copyFrom(max);\n const distance = Vector3.Distance(min, max);\n max.addToRef(min, this.center).scaleInPlace(0.5);\n this.radius = distance * 0.5;\n this._update(worldMatrix || Matrix.IdentityReadOnly);\n }\n /**\n * Scale the current bounding sphere by applying a scale factor\n * @param factor defines the scale factor to apply\n * @returns the current bounding box\n */\n scale(factor) {\n const newRadius = this.radius * factor;\n const tmpVectors = BoundingSphere._TmpVector3;\n const tempRadiusVector = tmpVectors[0].setAll(newRadius);\n const min = this.center.subtractToRef(tempRadiusVector, tmpVectors[1]);\n const max = this.center.addToRef(tempRadiusVector, tmpVectors[2]);\n this.reConstruct(min, max, this._worldMatrix);\n return this;\n }\n /**\n * Gets the world matrix of the bounding box\n * @returns a matrix\n */\n getWorldMatrix() {\n return this._worldMatrix;\n }\n // Methods\n /**\n * @internal\n */\n _update(worldMatrix) {\n if (!worldMatrix.isIdentity()) {\n Vector3.TransformCoordinatesToRef(this.center, worldMatrix, this.centerWorld);\n const tempVector = BoundingSphere._TmpVector3[0];\n Vector3.TransformNormalFromFloatsToRef(1.0, 1.0, 1.0, worldMatrix, tempVector);\n this.radiusWorld = Math.max(Math.abs(tempVector.x), Math.abs(tempVector.y), Math.abs(tempVector.z)) * this.radius;\n }\n else {\n this.centerWorld.copyFrom(this.center);\n this.radiusWorld = this.radius;\n }\n }\n /**\n * Tests if the bounding sphere is intersecting the frustum planes\n * @param frustumPlanes defines the frustum planes to test\n * @returns true if there is an intersection\n */\n isInFrustum(frustumPlanes) {\n const center = this.centerWorld;\n const radius = this.radiusWorld;\n for (let i = 0; i < 6; i++) {\n if (frustumPlanes[i].dotCoordinate(center) <= -radius) {\n return false;\n }\n }\n return true;\n }\n /**\n * Tests if the bounding sphere center is in between the frustum planes.\n * Used for optimistic fast inclusion.\n * @param frustumPlanes defines the frustum planes to test\n * @returns true if the sphere center is in between the frustum planes\n */\n isCenterInFrustum(frustumPlanes) {\n const center = this.centerWorld;\n for (let i = 0; i < 6; i++) {\n if (frustumPlanes[i].dotCoordinate(center) < 0) {\n return false;\n }\n }\n return true;\n }\n /**\n * Tests if a point is inside the bounding sphere\n * @param point defines the point to test\n * @returns true if the point is inside the bounding sphere\n */\n intersectsPoint(point) {\n const squareDistance = Vector3.DistanceSquared(this.centerWorld, point);\n if (this.radiusWorld * this.radiusWorld < squareDistance) {\n return false;\n }\n return true;\n }\n // Statics\n /**\n * Checks if two sphere intersect\n * @param sphere0 sphere 0\n * @param sphere1 sphere 1\n * @returns true if the spheres intersect\n */\n static Intersects(sphere0, sphere1) {\n const squareDistance = Vector3.DistanceSquared(sphere0.centerWorld, sphere1.centerWorld);\n const radiusSum = sphere0.radiusWorld + sphere1.radiusWorld;\n if (radiusSum * radiusSum < squareDistance) {\n return false;\n }\n return true;\n }\n /**\n * Creates a sphere from a center and a radius\n * @param center The center\n * @param radius radius\n * @param matrix Optional worldMatrix\n * @returns The sphere\n */\n static CreateFromCenterAndRadius(center, radius, matrix) {\n this._TmpVector3[0].copyFrom(center);\n this._TmpVector3[1].copyFromFloats(0, 0, radius);\n this._TmpVector3[2].copyFrom(center);\n this._TmpVector3[0].addInPlace(this._TmpVector3[1]);\n this._TmpVector3[2].subtractInPlace(this._TmpVector3[1]);\n const sphere = new BoundingSphere(this._TmpVector3[0], this._TmpVector3[2]);\n if (matrix) {\n sphere._worldMatrix = matrix;\n }\n else {\n sphere._worldMatrix = Matrix.Identity();\n }\n return sphere;\n }\n}\nBoundingSphere._TmpVector3 = ArrayTools.BuildArray(3, Vector3.Zero);\n//# sourceMappingURL=boundingSphere.js.map","import { ArrayTools } from \"../Misc/arrayTools.js\";\nimport { TmpVectors } from \"../Maths/math.vector.js\";\nimport { Vector3 } from \"../Maths/math.vector.js\";\n\nimport { BoundingBox } from \"./boundingBox.js\";\nimport { BoundingSphere } from \"./boundingSphere.js\";\nconst _result0 = { min: 0, max: 0 };\nconst _result1 = { min: 0, max: 0 };\nconst computeBoxExtents = (axis, box, result) => {\n const p = Vector3.Dot(box.centerWorld, axis);\n const r0 = Math.abs(Vector3.Dot(box.directions[0], axis)) * box.extendSize.x;\n const r1 = Math.abs(Vector3.Dot(box.directions[1], axis)) * box.extendSize.y;\n const r2 = Math.abs(Vector3.Dot(box.directions[2], axis)) * box.extendSize.z;\n const r = r0 + r1 + r2;\n result.min = p - r;\n result.max = p + r;\n};\nconst axisOverlap = (axis, box0, box1) => {\n computeBoxExtents(axis, box0, _result0);\n computeBoxExtents(axis, box1, _result1);\n return !(_result0.min > _result1.max || _result1.min > _result0.max);\n};\n/**\n * Info for a bounding data of a mesh\n */\nexport class BoundingInfo {\n /**\n * Constructs bounding info\n * @param minimum min vector of the bounding box/sphere\n * @param maximum max vector of the bounding box/sphere\n * @param worldMatrix defines the new world matrix\n */\n constructor(minimum, maximum, worldMatrix) {\n this._isLocked = false;\n this.boundingBox = new BoundingBox(minimum, maximum, worldMatrix);\n this.boundingSphere = new BoundingSphere(minimum, maximum, worldMatrix);\n }\n /**\n * Recreates the entire bounding info from scratch as if we call the constructor in place\n * @param min defines the new minimum vector (in local space)\n * @param max defines the new maximum vector (in local space)\n * @param worldMatrix defines the new world matrix\n */\n reConstruct(min, max, worldMatrix) {\n this.boundingBox.reConstruct(min, max, worldMatrix);\n this.boundingSphere.reConstruct(min, max, worldMatrix);\n }\n /**\n * min vector of the bounding box/sphere\n */\n get minimum() {\n return this.boundingBox.minimum;\n }\n /**\n * max vector of the bounding box/sphere\n */\n get maximum() {\n return this.boundingBox.maximum;\n }\n /**\n * If the info is locked and won't be updated to avoid perf overhead\n */\n get isLocked() {\n return this._isLocked;\n }\n set isLocked(value) {\n this._isLocked = value;\n }\n // Methods\n /**\n * Updates the bounding sphere and box\n * @param world world matrix to be used to update\n */\n update(world) {\n if (this._isLocked) {\n return;\n }\n this.boundingBox._update(world);\n this.boundingSphere._update(world);\n }\n /**\n * Recreate the bounding info to be centered around a specific point given a specific extend.\n * @param center New center of the bounding info\n * @param extend New extend of the bounding info\n * @returns the current bounding info\n */\n centerOn(center, extend) {\n const minimum = BoundingInfo._TmpVector3[0].copyFrom(center).subtractInPlace(extend);\n const maximum = BoundingInfo._TmpVector3[1].copyFrom(center).addInPlace(extend);\n this.boundingBox.reConstruct(minimum, maximum, this.boundingBox.getWorldMatrix());\n this.boundingSphere.reConstruct(minimum, maximum, this.boundingBox.getWorldMatrix());\n return this;\n }\n /**\n * Grows the bounding info to include the given point.\n * @param point The point that will be included in the current bounding info (in local space)\n * @returns the current bounding info\n */\n encapsulate(point) {\n const minimum = Vector3.Minimize(this.minimum, point);\n const maximum = Vector3.Maximize(this.maximum, point);\n this.reConstruct(minimum, maximum, this.boundingBox.getWorldMatrix());\n return this;\n }\n /**\n * Grows the bounding info to encapsulate the given bounding info.\n * @param toEncapsulate The bounding info that will be encapsulated in the current bounding info\n * @returns the current bounding info\n */\n encapsulateBoundingInfo(toEncapsulate) {\n const invw = TmpVectors.Matrix[0];\n this.boundingBox.getWorldMatrix().invertToRef(invw);\n const v = TmpVectors.Vector3[0];\n Vector3.TransformCoordinatesToRef(toEncapsulate.boundingBox.minimumWorld, invw, v);\n this.encapsulate(v);\n Vector3.TransformCoordinatesToRef(toEncapsulate.boundingBox.maximumWorld, invw, v);\n this.encapsulate(v);\n return this;\n }\n /**\n * Scale the current bounding info by applying a scale factor\n * @param factor defines the scale factor to apply\n * @returns the current bounding info\n */\n scale(factor) {\n this.boundingBox.scale(factor);\n this.boundingSphere.scale(factor);\n return this;\n }\n /**\n * Returns `true` if the bounding info is within the frustum defined by the passed array of planes.\n * @param frustumPlanes defines the frustum to test\n * @param strategy defines the strategy to use for the culling (default is BABYLON.AbstractMesh.CULLINGSTRATEGY_STANDARD)\n * The different strategies available are:\n * * BABYLON.AbstractMesh.CULLINGSTRATEGY_STANDARD most accurate but slower @see https://doc.babylonjs.com/typedoc/classes/BABYLON.AbstractMesh#CULLINGSTRATEGY_STANDARD\n * * BABYLON.AbstractMesh.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY faster but less accurate @see https://doc.babylonjs.com/typedoc/classes/BABYLON.AbstractMesh#CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY\n * * BABYLON.AbstractMesh.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION can be faster if always visible @see https://doc.babylonjs.com/typedoc/classes/BABYLON.AbstractMesh#CULLINGSTRATEGY_OPTIMISTIC_INCLUSION\n * * BABYLON.AbstractMesh.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY can be faster if always visible @see https://doc.babylonjs.com/typedoc/classes/BABYLON.AbstractMesh#CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY\n * @returns true if the bounding info is in the frustum planes\n */\n isInFrustum(frustumPlanes, strategy = 0) {\n const inclusionTest = strategy === 2 || strategy === 3;\n if (inclusionTest) {\n if (this.boundingSphere.isCenterInFrustum(frustumPlanes)) {\n return true;\n }\n }\n if (!this.boundingSphere.isInFrustum(frustumPlanes)) {\n return false;\n }\n const bSphereOnlyTest = strategy === 1 || strategy === 3;\n if (bSphereOnlyTest) {\n return true;\n }\n return this.boundingBox.isInFrustum(frustumPlanes);\n }\n /**\n * Gets the world distance between the min and max points of the bounding box\n */\n get diagonalLength() {\n const boundingBox = this.boundingBox;\n const diag = boundingBox.maximumWorld.subtractToRef(boundingBox.minimumWorld, BoundingInfo._TmpVector3[0]);\n return diag.length();\n }\n /**\n * Checks if a cullable object (mesh...) is in the camera frustum\n * Unlike isInFrustum this checks the full bounding box\n * @param frustumPlanes Camera near/planes\n * @returns true if the object is in frustum otherwise false\n */\n isCompletelyInFrustum(frustumPlanes) {\n return this.boundingBox.isCompletelyInFrustum(frustumPlanes);\n }\n /**\n * @internal\n */\n _checkCollision(collider) {\n return collider._canDoCollision(this.boundingSphere.centerWorld, this.boundingSphere.radiusWorld, this.boundingBox.minimumWorld, this.boundingBox.maximumWorld);\n }\n /**\n * Checks if a point is inside the bounding box and bounding sphere or the mesh\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/interactions/mesh_intersect\n * @param point the point to check intersection with\n * @returns if the point intersects\n */\n intersectsPoint(point) {\n if (!this.boundingSphere.centerWorld) {\n return false;\n }\n if (!this.boundingSphere.intersectsPoint(point)) {\n return false;\n }\n if (!this.boundingBox.intersectsPoint(point)) {\n return false;\n }\n return true;\n }\n /**\n * Checks if another bounding info intersects the bounding box and bounding sphere or the mesh\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/interactions/mesh_intersect\n * @param boundingInfo the bounding info to check intersection with\n * @param precise if the intersection should be done using OBB\n * @returns if the bounding info intersects\n */\n intersects(boundingInfo, precise) {\n if (!BoundingSphere.Intersects(this.boundingSphere, boundingInfo.boundingSphere)) {\n return false;\n }\n if (!BoundingBox.Intersects(this.boundingBox, boundingInfo.boundingBox)) {\n return false;\n }\n if (!precise) {\n return true;\n }\n const box0 = this.boundingBox;\n const box1 = boundingInfo.boundingBox;\n if (!axisOverlap(box0.directions[0], box0, box1)) {\n return false;\n }\n if (!axisOverlap(box0.directions[1], box0, box1)) {\n return false;\n }\n if (!axisOverlap(box0.directions[2], box0, box1)) {\n return false;\n }\n if (!axisOverlap(box1.directions[0], box0, box1)) {\n return false;\n }\n if (!axisOverlap(box1.directions[1], box0, box1)) {\n return false;\n }\n if (!axisOverlap(box1.directions[2], box0, box1)) {\n return false;\n }\n if (!axisOverlap(Vector3.Cross(box0.directions[0], box1.directions[0]), box0, box1)) {\n return false;\n }\n if (!axisOverlap(Vector3.Cross(box0.directions[0], box1.directions[1]), box0, box1)) {\n return false;\n }\n if (!axisOverlap(Vector3.Cross(box0.directions[0], box1.directions[2]), box0, box1)) {\n return false;\n }\n if (!axisOverlap(Vector3.Cross(box0.directions[1], box1.directions[0]), box0, box1)) {\n return false;\n }\n if (!axisOverlap(Vector3.Cross(box0.directions[1], box1.directions[1]), box0, box1)) {\n return false;\n }\n if (!axisOverlap(Vector3.Cross(box0.directions[1], box1.directions[2]), box0, box1)) {\n return false;\n }\n if (!axisOverlap(Vector3.Cross(box0.directions[2], box1.directions[0]), box0, box1)) {\n return false;\n }\n if (!axisOverlap(Vector3.Cross(box0.directions[2], box1.directions[1]), box0, box1)) {\n return false;\n }\n if (!axisOverlap(Vector3.Cross(box0.directions[2], box1.directions[2]), box0, box1)) {\n return false;\n }\n return true;\n }\n}\nBoundingInfo._TmpVector3 = ArrayTools.BuildArray(2, Vector3.Zero);\n//# sourceMappingURL=boundingInfo.js.map","import { __decorate } from \"../tslib.es6.js\";\nimport { Vector3 } from \"./math.vector.js\";\nimport { nativeOverride } from \"../Misc/decorators.js\";\n// This helper class is only here so we can apply the nativeOverride decorator to functions.\nclass MathHelpers {\n static extractMinAndMaxIndexed(positions, indices, indexStart, indexCount, minimum, maximum) {\n for (let index = indexStart; index < indexStart + indexCount; index++) {\n const offset = indices[index] * 3;\n const x = positions[offset];\n const y = positions[offset + 1];\n const z = positions[offset + 2];\n minimum.minimizeInPlaceFromFloats(x, y, z);\n maximum.maximizeInPlaceFromFloats(x, y, z);\n }\n }\n static extractMinAndMax(positions, start, count, stride, minimum, maximum) {\n for (let index = start, offset = start * stride; index < start + count; index++, offset += stride) {\n const x = positions[offset];\n const y = positions[offset + 1];\n const z = positions[offset + 2];\n minimum.minimizeInPlaceFromFloats(x, y, z);\n maximum.maximizeInPlaceFromFloats(x, y, z);\n }\n }\n}\n__decorate([\n nativeOverride.filter((...[positions, indices]) => !Array.isArray(positions) && !Array.isArray(indices))\n // eslint-disable-next-line @typescript-eslint/naming-convention\n], MathHelpers, \"extractMinAndMaxIndexed\", null);\n__decorate([\n nativeOverride.filter((...[positions]) => !Array.isArray(positions))\n // eslint-disable-next-line @typescript-eslint/naming-convention\n], MathHelpers, \"extractMinAndMax\", null);\n/**\n * Extracts minimum and maximum values from a list of indexed positions\n * @param positions defines the positions to use\n * @param indices defines the indices to the positions\n * @param indexStart defines the start index\n * @param indexCount defines the end index\n * @param bias defines bias value to add to the result\n * @returns minimum and maximum values\n */\nexport function extractMinAndMaxIndexed(positions, indices, indexStart, indexCount, bias = null) {\n const minimum = new Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\n const maximum = new Vector3(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);\n MathHelpers.extractMinAndMaxIndexed(positions, indices, indexStart, indexCount, minimum, maximum);\n if (bias) {\n minimum.x -= minimum.x * bias.x + bias.y;\n minimum.y -= minimum.y * bias.x + bias.y;\n minimum.z -= minimum.z * bias.x + bias.y;\n maximum.x += maximum.x * bias.x + bias.y;\n maximum.y += maximum.y * bias.x + bias.y;\n maximum.z += maximum.z * bias.x + bias.y;\n }\n return {\n minimum: minimum,\n maximum: maximum,\n };\n}\n/**\n * Extracts minimum and maximum values from a list of positions\n * @param positions defines the positions to use\n * @param start defines the start index in the positions array\n * @param count defines the number of positions to handle\n * @param bias defines bias value to add to the result\n * @param stride defines the stride size to use (distance between two positions in the positions array)\n * @returns minimum and maximum values\n */\nexport function extractMinAndMax(positions, start, count, bias = null, stride) {\n const minimum = new Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\n const maximum = new Vector3(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);\n if (!stride) {\n stride = 3;\n }\n MathHelpers.extractMinAndMax(positions, start, count, stride, minimum, maximum);\n if (bias) {\n minimum.x -= minimum.x * bias.x + bias.y;\n minimum.y -= minimum.y * bias.x + bias.y;\n minimum.z -= minimum.z * bias.x + bias.y;\n maximum.x += maximum.x * bias.x + bias.y;\n maximum.y += maximum.y * bias.x + bias.y;\n maximum.z += maximum.z * bias.x + bias.y;\n }\n return {\n minimum: minimum,\n maximum: maximum,\n };\n}\n//# sourceMappingURL=math.functions.js.map","import { VertexBuffer } from \"../Buffers/buffer.js\";\nimport { IntersectionInfo } from \"../Collisions/intersectionInfo.js\";\nimport { BoundingInfo } from \"../Culling/boundingInfo.js\";\n\nimport { extractMinAndMaxIndexed } from \"../Maths/math.functions.js\";\nimport { DrawWrapper } from \"../Materials/drawWrapper.js\";\n/**\n * Defines a subdivision inside a mesh\n */\nexport class SubMesh {\n /**\n * Gets material defines used by the effect associated to the sub mesh\n */\n get materialDefines() {\n var _a;\n return this._mainDrawWrapperOverride ? this._mainDrawWrapperOverride.defines : (_a = this._getDrawWrapper()) === null || _a === void 0 ? void 0 : _a.defines;\n }\n /**\n * Sets material defines used by the effect associated to the sub mesh\n */\n set materialDefines(defines) {\n var _a;\n const drawWrapper = (_a = this._mainDrawWrapperOverride) !== null && _a !== void 0 ? _a : this._getDrawWrapper(undefined, true);\n drawWrapper.defines = defines;\n }\n /**\n * @internal\n */\n _getDrawWrapper(passId, createIfNotExisting = false) {\n passId = passId !== null && passId !== void 0 ? passId : this._engine.currentRenderPassId;\n let drawWrapper = this._drawWrappers[passId];\n if (!drawWrapper && createIfNotExisting) {\n this._drawWrappers[passId] = drawWrapper = new DrawWrapper(this._mesh.getScene().getEngine());\n }\n return drawWrapper;\n }\n /**\n * @internal\n */\n _removeDrawWrapper(passId, disposeWrapper = true) {\n var _a;\n if (disposeWrapper) {\n (_a = this._drawWrappers[passId]) === null || _a === void 0 ? void 0 : _a.dispose();\n }\n this._drawWrappers[passId] = undefined;\n }\n /**\n * Gets associated (main) effect (possibly the effect override if defined)\n */\n get effect() {\n var _a, _b;\n return this._mainDrawWrapperOverride ? this._mainDrawWrapperOverride.effect : (_b = (_a = this._getDrawWrapper()) === null || _a === void 0 ? void 0 : _a.effect) !== null && _b !== void 0 ? _b : null;\n }\n /** @internal */\n get _drawWrapper() {\n var _a;\n return (_a = this._mainDrawWrapperOverride) !== null && _a !== void 0 ? _a : this._getDrawWrapper(undefined, true);\n }\n /** @internal */\n get _drawWrapperOverride() {\n return this._mainDrawWrapperOverride;\n }\n /**\n * @internal\n */\n _setMainDrawWrapperOverride(wrapper) {\n this._mainDrawWrapperOverride = wrapper;\n }\n /**\n * Sets associated effect (effect used to render this submesh)\n * @param effect defines the effect to associate with\n * @param defines defines the set of defines used to compile this effect\n * @param materialContext material context associated to the effect\n * @param resetContext true to reset the draw context\n */\n setEffect(effect, defines = null, materialContext, resetContext = true) {\n const drawWrapper = this._drawWrapper;\n drawWrapper.setEffect(effect, defines, resetContext);\n if (materialContext !== undefined) {\n drawWrapper.materialContext = materialContext;\n }\n if (!effect) {\n drawWrapper.defines = null;\n drawWrapper.materialContext = undefined;\n }\n }\n /**\n * Resets the draw wrappers cache\n * @param passId If provided, releases only the draw wrapper corresponding to this render pass id\n */\n resetDrawCache(passId) {\n if (this._drawWrappers) {\n if (passId !== undefined) {\n this._removeDrawWrapper(passId);\n return;\n }\n else {\n for (const drawWrapper of this._drawWrappers) {\n drawWrapper === null || drawWrapper === void 0 ? void 0 : drawWrapper.dispose();\n }\n }\n }\n this._drawWrappers = [];\n }\n /**\n * Add a new submesh to a mesh\n * @param materialIndex defines the material index to use\n * @param verticesStart defines vertex index start\n * @param verticesCount defines vertices count\n * @param indexStart defines index start\n * @param indexCount defines indices count\n * @param mesh defines the parent mesh\n * @param renderingMesh defines an optional rendering mesh\n * @param createBoundingBox defines if bounding box should be created for this submesh\n * @returns the new submesh\n */\n static AddToMesh(materialIndex, verticesStart, verticesCount, indexStart, indexCount, mesh, renderingMesh, createBoundingBox = true) {\n return new SubMesh(materialIndex, verticesStart, verticesCount, indexStart, indexCount, mesh, renderingMesh, createBoundingBox);\n }\n /**\n * Creates a new submesh\n * @param materialIndex defines the material index to use\n * @param verticesStart defines vertex index start\n * @param verticesCount defines vertices count\n * @param indexStart defines index start\n * @param indexCount defines indices count\n * @param mesh defines the parent mesh\n * @param renderingMesh defines an optional rendering mesh\n * @param createBoundingBox defines if bounding box should be created for this submesh\n * @param addToMesh defines a boolean indicating that the submesh must be added to the mesh.subMeshes array (true by default)\n */\n constructor(\n /** the material index to use */\n materialIndex, \n /** vertex index start */\n verticesStart, \n /** vertices count */\n verticesCount, \n /** index start */\n indexStart, \n /** indices count */\n indexCount, mesh, renderingMesh, createBoundingBox = true, addToMesh = true) {\n this.materialIndex = materialIndex;\n this.verticesStart = verticesStart;\n this.verticesCount = verticesCount;\n this.indexStart = indexStart;\n this.indexCount = indexCount;\n this._mainDrawWrapperOverride = null;\n /** @internal */\n this._linesIndexCount = 0;\n this._linesIndexBuffer = null;\n /** @internal */\n this._lastColliderWorldVertices = null;\n /** @internal */\n this._lastColliderTransformMatrix = null;\n /** @internal */\n this._wasDispatched = false;\n /** @internal */\n this._renderId = 0;\n /** @internal */\n this._alphaIndex = 0;\n /** @internal */\n this._distanceToCamera = 0;\n this._currentMaterial = null;\n this._mesh = mesh;\n this._renderingMesh = renderingMesh || mesh;\n if (addToMesh) {\n mesh.subMeshes.push(this);\n }\n this._engine = this._mesh.getScene().getEngine();\n this.resetDrawCache();\n this._trianglePlanes = [];\n this._id = mesh.subMeshes.length - 1;\n if (createBoundingBox) {\n this.refreshBoundingInfo();\n mesh.computeWorldMatrix(true);\n }\n }\n /**\n * Returns true if this submesh covers the entire parent mesh\n * @ignorenaming\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n get IsGlobal() {\n return this.verticesStart === 0 && this.verticesCount === this._mesh.getTotalVertices() && this.indexStart === 0 && this.indexCount === this._mesh.getTotalIndices();\n }\n /**\n * Returns the submesh BoundingInfo object\n * @returns current bounding info (or mesh's one if the submesh is global)\n */\n getBoundingInfo() {\n if (this.IsGlobal || this._mesh.hasThinInstances) {\n return this._mesh.getBoundingInfo();\n }\n return this._boundingInfo;\n }\n /**\n * Sets the submesh BoundingInfo\n * @param boundingInfo defines the new bounding info to use\n * @returns the SubMesh\n */\n setBoundingInfo(boundingInfo) {\n this._boundingInfo = boundingInfo;\n return this;\n }\n /**\n * Returns the mesh of the current submesh\n * @returns the parent mesh\n */\n getMesh() {\n return this._mesh;\n }\n /**\n * Returns the rendering mesh of the submesh\n * @returns the rendering mesh (could be different from parent mesh)\n */\n getRenderingMesh() {\n return this._renderingMesh;\n }\n /**\n * Returns the replacement mesh of the submesh\n * @returns the replacement mesh (could be different from parent mesh)\n */\n getReplacementMesh() {\n return this._mesh._internalAbstractMeshDataInfo._actAsRegularMesh ? this._mesh : null;\n }\n /**\n * Returns the effective mesh of the submesh\n * @returns the effective mesh (could be different from parent mesh)\n */\n getEffectiveMesh() {\n const replacementMesh = this._mesh._internalAbstractMeshDataInfo._actAsRegularMesh ? this._mesh : null;\n return replacementMesh ? replacementMesh : this._renderingMesh;\n }\n /**\n * Returns the submesh material\n * @param getDefaultMaterial Defines whether or not to get the default material if nothing has been defined.\n * @returns null or the current material\n */\n getMaterial(getDefaultMaterial = true) {\n var _a;\n const rootMaterial = (_a = this._renderingMesh.getMaterialForRenderPass(this._engine.currentRenderPassId)) !== null && _a !== void 0 ? _a : this._renderingMesh.material;\n if (!rootMaterial) {\n return getDefaultMaterial ? this._mesh.getScene().defaultMaterial : null;\n }\n else if (this._isMultiMaterial(rootMaterial)) {\n const effectiveMaterial = rootMaterial.getSubMaterial(this.materialIndex);\n if (this._currentMaterial !== effectiveMaterial) {\n this._currentMaterial = effectiveMaterial;\n this.resetDrawCache();\n }\n return effectiveMaterial;\n }\n return rootMaterial;\n }\n _isMultiMaterial(material) {\n return material.getSubMaterial !== undefined;\n }\n // Methods\n /**\n * Sets a new updated BoundingInfo object to the submesh\n * @param data defines an optional position array to use to determine the bounding info\n * @returns the SubMesh\n */\n refreshBoundingInfo(data = null) {\n this._lastColliderWorldVertices = null;\n if (this.IsGlobal || !this._renderingMesh || !this._renderingMesh.geometry) {\n return this;\n }\n if (!data) {\n data = this._renderingMesh.getVerticesData(VertexBuffer.PositionKind);\n }\n if (!data) {\n this._boundingInfo = this._mesh.getBoundingInfo();\n return this;\n }\n const indices = this._renderingMesh.getIndices();\n let extend;\n //is this the only submesh?\n if (this.indexStart === 0 && this.indexCount === indices.length) {\n const boundingInfo = this._renderingMesh.getBoundingInfo();\n //the rendering mesh's bounding info can be used, it is the standard submesh for all indices.\n extend = { minimum: boundingInfo.minimum.clone(), maximum: boundingInfo.maximum.clone() };\n }\n else {\n extend = extractMinAndMaxIndexed(data, indices, this.indexStart, this.indexCount, this._renderingMesh.geometry.boundingBias);\n }\n if (this._boundingInfo) {\n this._boundingInfo.reConstruct(extend.minimum, extend.maximum);\n }\n else {\n this._boundingInfo = new BoundingInfo(extend.minimum, extend.maximum);\n }\n return this;\n }\n /**\n * @internal\n */\n _checkCollision(collider) {\n const boundingInfo = this.getBoundingInfo();\n return boundingInfo._checkCollision(collider);\n }\n /**\n * Updates the submesh BoundingInfo\n * @param world defines the world matrix to use to update the bounding info\n * @returns the submesh\n */\n updateBoundingInfo(world) {\n let boundingInfo = this.getBoundingInfo();\n if (!boundingInfo) {\n this.refreshBoundingInfo();\n boundingInfo = this.getBoundingInfo();\n }\n if (boundingInfo) {\n boundingInfo.update(world);\n }\n return this;\n }\n /**\n * True is the submesh bounding box intersects the frustum defined by the passed array of planes.\n * @param frustumPlanes defines the frustum planes\n * @returns true if the submesh is intersecting with the frustum\n */\n isInFrustum(frustumPlanes) {\n const boundingInfo = this.getBoundingInfo();\n if (!boundingInfo) {\n return false;\n }\n return boundingInfo.isInFrustum(frustumPlanes, this._mesh.cullingStrategy);\n }\n /**\n * True is the submesh bounding box is completely inside the frustum defined by the passed array of planes\n * @param frustumPlanes defines the frustum planes\n * @returns true if the submesh is inside the frustum\n */\n isCompletelyInFrustum(frustumPlanes) {\n const boundingInfo = this.getBoundingInfo();\n if (!boundingInfo) {\n return false;\n }\n return boundingInfo.isCompletelyInFrustum(frustumPlanes);\n }\n /**\n * Renders the submesh\n * @param enableAlphaMode defines if alpha needs to be used\n * @returns the submesh\n */\n render(enableAlphaMode) {\n this._renderingMesh.render(this, enableAlphaMode, this._mesh._internalAbstractMeshDataInfo._actAsRegularMesh ? this._mesh : undefined);\n return this;\n }\n /**\n * @internal\n */\n _getLinesIndexBuffer(indices, engine) {\n if (!this._linesIndexBuffer) {\n const linesIndices = [];\n for (let index = this.indexStart; index < this.indexStart + this.indexCount; index += 3) {\n linesIndices.push(indices[index], indices[index + 1], indices[index + 1], indices[index + 2], indices[index + 2], indices[index]);\n }\n this._linesIndexBuffer = engine.createIndexBuffer(linesIndices);\n this._linesIndexCount = linesIndices.length;\n }\n return this._linesIndexBuffer;\n }\n /**\n * Checks if the submesh intersects with a ray\n * @param ray defines the ray to test\n * @returns true is the passed ray intersects the submesh bounding box\n */\n canIntersects(ray) {\n const boundingInfo = this.getBoundingInfo();\n if (!boundingInfo) {\n return false;\n }\n return ray.intersectsBox(boundingInfo.boundingBox);\n }\n /**\n * Intersects current submesh with a ray\n * @param ray defines the ray to test\n * @param positions defines mesh's positions array\n * @param indices defines mesh's indices array\n * @param fastCheck defines if the first intersection will be used (and not the closest)\n * @param trianglePredicate defines an optional predicate used to select faces when a mesh intersection is detected\n * @returns intersection info or null if no intersection\n */\n intersects(ray, positions, indices, fastCheck, trianglePredicate) {\n const material = this.getMaterial();\n if (!material) {\n return null;\n }\n let step = 3;\n let checkStopper = false;\n switch (material.fillMode) {\n case 3:\n case 5:\n case 6:\n case 8:\n return null;\n case 7:\n step = 1;\n checkStopper = true;\n break;\n default:\n break;\n }\n // LineMesh first as it's also a Mesh...\n if (material.fillMode === 4) {\n // Check if mesh is unindexed\n if (!indices.length) {\n return this._intersectUnIndexedLines(ray, positions, indices, this._mesh.intersectionThreshold, fastCheck);\n }\n return this._intersectLines(ray, positions, indices, this._mesh.intersectionThreshold, fastCheck);\n }\n else {\n // Check if mesh is unindexed\n if (!indices.length && this._mesh._unIndexed) {\n return this._intersectUnIndexedTriangles(ray, positions, indices, fastCheck, trianglePredicate);\n }\n return this._intersectTriangles(ray, positions, indices, step, checkStopper, fastCheck, trianglePredicate);\n }\n }\n /**\n * @internal\n */\n _intersectLines(ray, positions, indices, intersectionThreshold, fastCheck) {\n let intersectInfo = null;\n // Line test\n for (let index = this.indexStart; index < this.indexStart + this.indexCount; index += 2) {\n const p0 = positions[indices[index]];\n const p1 = positions[indices[index + 1]];\n const length = ray.intersectionSegment(p0, p1, intersectionThreshold);\n if (length < 0) {\n continue;\n }\n if (fastCheck || !intersectInfo || length < intersectInfo.distance) {\n intersectInfo = new IntersectionInfo(null, null, length);\n intersectInfo.faceId = index / 2;\n if (fastCheck) {\n break;\n }\n }\n }\n return intersectInfo;\n }\n /**\n * @internal\n */\n _intersectUnIndexedLines(ray, positions, indices, intersectionThreshold, fastCheck) {\n let intersectInfo = null;\n // Line test\n for (let index = this.verticesStart; index < this.verticesStart + this.verticesCount; index += 2) {\n const p0 = positions[index];\n const p1 = positions[index + 1];\n const length = ray.intersectionSegment(p0, p1, intersectionThreshold);\n if (length < 0) {\n continue;\n }\n if (fastCheck || !intersectInfo || length < intersectInfo.distance) {\n intersectInfo = new IntersectionInfo(null, null, length);\n intersectInfo.faceId = index / 2;\n if (fastCheck) {\n break;\n }\n }\n }\n return intersectInfo;\n }\n /**\n * @internal\n */\n _intersectTriangles(ray, positions, indices, step, checkStopper, fastCheck, trianglePredicate) {\n let intersectInfo = null;\n // Triangles test\n let faceId = -1;\n for (let index = this.indexStart; index < this.indexStart + this.indexCount - (3 - step); index += step) {\n faceId++;\n const indexA = indices[index];\n const indexB = indices[index + 1];\n const indexC = indices[index + 2];\n if (checkStopper && indexC === 0xffffffff) {\n index += 2;\n continue;\n }\n const p0 = positions[indexA];\n const p1 = positions[indexB];\n const p2 = positions[indexC];\n // stay defensive and don't check against undefined positions.\n if (!p0 || !p1 || !p2) {\n continue;\n }\n if (trianglePredicate && !trianglePredicate(p0, p1, p2, ray, indexA, indexB, indexC)) {\n continue;\n }\n const currentIntersectInfo = ray.intersectsTriangle(p0, p1, p2);\n if (currentIntersectInfo) {\n if (currentIntersectInfo.distance < 0) {\n continue;\n }\n if (fastCheck || !intersectInfo || currentIntersectInfo.distance < intersectInfo.distance) {\n intersectInfo = currentIntersectInfo;\n intersectInfo.faceId = faceId;\n if (fastCheck) {\n break;\n }\n }\n }\n }\n return intersectInfo;\n }\n /**\n * @internal\n */\n _intersectUnIndexedTriangles(ray, positions, indices, fastCheck, trianglePredicate) {\n let intersectInfo = null;\n // Triangles test\n for (let index = this.verticesStart; index < this.verticesStart + this.verticesCount; index += 3) {\n const p0 = positions[index];\n const p1 = positions[index + 1];\n const p2 = positions[index + 2];\n if (trianglePredicate && !trianglePredicate(p0, p1, p2, ray, -1, -1, -1)) {\n continue;\n }\n const currentIntersectInfo = ray.intersectsTriangle(p0, p1, p2);\n if (currentIntersectInfo) {\n if (currentIntersectInfo.distance < 0) {\n continue;\n }\n if (fastCheck || !intersectInfo || currentIntersectInfo.distance < intersectInfo.distance) {\n intersectInfo = currentIntersectInfo;\n intersectInfo.faceId = index / 3;\n if (fastCheck) {\n break;\n }\n }\n }\n }\n return intersectInfo;\n }\n /** @internal */\n _rebuild() {\n if (this._linesIndexBuffer) {\n this._linesIndexBuffer = null;\n }\n }\n // Clone\n /**\n * Creates a new submesh from the passed mesh\n * @param newMesh defines the new hosting mesh\n * @param newRenderingMesh defines an optional rendering mesh\n * @returns the new submesh\n */\n clone(newMesh, newRenderingMesh) {\n const result = new SubMesh(this.materialIndex, this.verticesStart, this.verticesCount, this.indexStart, this.indexCount, newMesh, newRenderingMesh, false);\n if (!this.IsGlobal) {\n const boundingInfo = this.getBoundingInfo();\n if (!boundingInfo) {\n return result;\n }\n result._boundingInfo = new BoundingInfo(boundingInfo.minimum, boundingInfo.maximum);\n }\n return result;\n }\n // Dispose\n /**\n * Release associated resources\n */\n dispose() {\n if (this._linesIndexBuffer) {\n this._mesh.getScene().getEngine()._releaseBuffer(this._linesIndexBuffer);\n this._linesIndexBuffer = null;\n }\n // Remove from mesh\n const index = this._mesh.subMeshes.indexOf(this);\n this._mesh.subMeshes.splice(index, 1);\n this.resetDrawCache();\n }\n /**\n * Gets the class name\n * @returns the string \"SubMesh\".\n */\n getClassName() {\n return \"SubMesh\";\n }\n // Statics\n /**\n * Creates a new submesh from indices data\n * @param materialIndex the index of the main mesh material\n * @param startIndex the index where to start the copy in the mesh indices array\n * @param indexCount the number of indices to copy then from the startIndex\n * @param mesh the main mesh to create the submesh from\n * @param renderingMesh the optional rendering mesh\n * @param createBoundingBox defines if bounding box should be created for this submesh\n * @returns a new submesh\n */\n static CreateFromIndices(materialIndex, startIndex, indexCount, mesh, renderingMesh, createBoundingBox = true) {\n let minVertexIndex = Number.MAX_VALUE;\n let maxVertexIndex = -Number.MAX_VALUE;\n const whatWillRender = renderingMesh || mesh;\n const indices = whatWillRender.getIndices();\n for (let index = startIndex; index < startIndex + indexCount; index++) {\n const vertexIndex = indices[index];\n if (vertexIndex < minVertexIndex) {\n minVertexIndex = vertexIndex;\n }\n if (vertexIndex > maxVertexIndex) {\n maxVertexIndex = vertexIndex;\n }\n }\n return new SubMesh(materialIndex, minVertexIndex, maxVertexIndex - minVertexIndex + 1, startIndex, indexCount, mesh, renderingMesh, createBoundingBox);\n }\n}\n//# sourceMappingURL=subMesh.js.map","import { __decorate } from \"../tslib.es6.js\";\nimport { Vector3, Vector4, TmpVectors } from \"../Maths/math.vector.js\";\nimport { VertexBuffer } from \"../Buffers/buffer.js\";\nimport { _WarnImport } from \"../Misc/devTools.js\";\nimport { Color4 } from \"../Maths/math.color.js\";\nimport { Logger } from \"../Misc/logger.js\";\nimport { nativeOverride } from \"../Misc/decorators.js\";\nimport { makeSyncFunction, runCoroutineSync } from \"../Misc/coroutine.js\";\nimport { RuntimeError, ErrorCodes } from \"../Misc/error.js\";\nimport { SubMesh } from \"./subMesh.js\";\n/** Class used to attach material info to sub section of a vertex data class */\nexport class VertexDataMaterialInfo {\n}\n/**\n * This class contains the various kinds of data on every vertex of a mesh used in determining its shape and appearance\n */\nexport class VertexData {\n /**\n * Creates a new VertexData\n */\n constructor() {\n /**\n * Gets the unique ID of this vertex Data\n */\n this.uniqueId = 0;\n /**\n * Metadata used to store contextual values\n */\n this.metadata = {};\n this._applyTo = makeSyncFunction(this._applyToCoroutine.bind(this));\n this.uniqueId = VertexData._UniqueIDGenerator;\n VertexData._UniqueIDGenerator++;\n }\n /**\n * Uses the passed data array to set the set the values for the specified kind of data\n * @param data a linear array of floating numbers\n * @param kind the type of data that is being set, eg positions, colors etc\n */\n set(data, kind) {\n if (!data.length) {\n Logger.Warn(`Setting vertex data kind '${kind}' with an empty array`);\n }\n switch (kind) {\n case VertexBuffer.PositionKind:\n this.positions = data;\n break;\n case VertexBuffer.NormalKind:\n this.normals = data;\n break;\n case VertexBuffer.TangentKind:\n this.tangents = data;\n break;\n case VertexBuffer.UVKind:\n this.uvs = data;\n break;\n case VertexBuffer.UV2Kind:\n this.uvs2 = data;\n break;\n case VertexBuffer.UV3Kind:\n this.uvs3 = data;\n break;\n case VertexBuffer.UV4Kind:\n this.uvs4 = data;\n break;\n case VertexBuffer.UV5Kind:\n this.uvs5 = data;\n break;\n case VertexBuffer.UV6Kind:\n this.uvs6 = data;\n break;\n case VertexBuffer.ColorKind:\n this.colors = data;\n break;\n case VertexBuffer.MatricesIndicesKind:\n this.matricesIndices = data;\n break;\n case VertexBuffer.MatricesWeightsKind:\n this.matricesWeights = data;\n break;\n case VertexBuffer.MatricesIndicesExtraKind:\n this.matricesIndicesExtra = data;\n break;\n case VertexBuffer.MatricesWeightsExtraKind:\n this.matricesWeightsExtra = data;\n break;\n }\n }\n /**\n * Associates the vertexData to the passed Mesh.\n * Sets it as updatable or not (default `false`)\n * @param mesh the mesh the vertexData is applied to\n * @param updatable when used and having the value true allows new data to update the vertexData\n * @returns the VertexData\n */\n applyToMesh(mesh, updatable) {\n this._applyTo(mesh, updatable, false);\n return this;\n }\n /**\n * Associates the vertexData to the passed Geometry.\n * Sets it as updatable or not (default `false`)\n * @param geometry the geometry the vertexData is applied to\n * @param updatable when used and having the value true allows new data to update the vertexData\n * @returns VertexData\n */\n applyToGeometry(geometry, updatable) {\n this._applyTo(geometry, updatable, false);\n return this;\n }\n /**\n * Updates the associated mesh\n * @param mesh the mesh to be updated\n * @returns VertexData\n */\n updateMesh(mesh) {\n this._update(mesh);\n return this;\n }\n /**\n * Updates the associated geometry\n * @param geometry the geometry to be updated\n * @returns VertexData.\n */\n updateGeometry(geometry) {\n this._update(geometry);\n return this;\n }\n /**\n * @internal\n */\n *_applyToCoroutine(meshOrGeometry, updatable = false, isAsync) {\n if (this.positions) {\n meshOrGeometry.setVerticesData(VertexBuffer.PositionKind, this.positions, updatable);\n if (isAsync) {\n yield;\n }\n }\n if (this.normals) {\n meshOrGeometry.setVerticesData(VertexBuffer.NormalKind, this.normals, updatable);\n if (isAsync) {\n yield;\n }\n }\n if (this.tangents) {\n meshOrGeometry.setVerticesData(VertexBuffer.TangentKind, this.tangents, updatable);\n if (isAsync) {\n yield;\n }\n }\n if (this.uvs) {\n meshOrGeometry.setVerticesData(VertexBuffer.UVKind, this.uvs, updatable);\n if (isAsync) {\n yield;\n }\n }\n if (this.uvs2) {\n meshOrGeometry.setVerticesData(VertexBuffer.UV2Kind, this.uvs2, updatable);\n if (isAsync) {\n yield;\n }\n }\n if (this.uvs3) {\n meshOrGeometry.setVerticesData(VertexBuffer.UV3Kind, this.uvs3, updatable);\n if (isAsync) {\n yield;\n }\n }\n if (this.uvs4) {\n meshOrGeometry.setVerticesData(VertexBuffer.UV4Kind, this.uvs4, updatable);\n if (isAsync) {\n yield;\n }\n }\n if (this.uvs5) {\n meshOrGeometry.setVerticesData(VertexBuffer.UV5Kind, this.uvs5, updatable);\n if (isAsync) {\n yield;\n }\n }\n if (this.uvs6) {\n meshOrGeometry.setVerticesData(VertexBuffer.UV6Kind, this.uvs6, updatable);\n if (isAsync) {\n yield;\n }\n }\n if (this.colors) {\n meshOrGeometry.setVerticesData(VertexBuffer.ColorKind, this.colors, updatable);\n if (isAsync) {\n yield;\n }\n }\n if (this.matricesIndices) {\n meshOrGeometry.setVerticesData(VertexBuffer.MatricesIndicesKind, this.matricesIndices, updatable);\n if (isAsync) {\n yield;\n }\n }\n if (this.matricesWeights) {\n meshOrGeometry.setVerticesData(VertexBuffer.MatricesWeightsKind, this.matricesWeights, updatable);\n if (isAsync) {\n yield;\n }\n }\n if (this.matricesIndicesExtra) {\n meshOrGeometry.setVerticesData(VertexBuffer.MatricesIndicesExtraKind, this.matricesIndicesExtra, updatable);\n if (isAsync) {\n yield;\n }\n }\n if (this.matricesWeightsExtra) {\n meshOrGeometry.setVerticesData(VertexBuffer.MatricesWeightsExtraKind, this.matricesWeightsExtra, updatable);\n if (isAsync) {\n yield;\n }\n }\n if (this.indices) {\n meshOrGeometry.setIndices(this.indices, null, updatable);\n if (isAsync) {\n yield;\n }\n }\n else {\n meshOrGeometry.setIndices([], null);\n }\n if (meshOrGeometry.subMeshes && this.materialInfos && this.materialInfos.length > 1) {\n const mesh = meshOrGeometry;\n mesh.subMeshes = [];\n for (const matInfo of this.materialInfos) {\n new SubMesh(matInfo.materialIndex, matInfo.verticesStart, matInfo.verticesCount, matInfo.indexStart, matInfo.indexCount, mesh);\n }\n }\n return this;\n }\n _update(meshOrGeometry, updateExtends, makeItUnique) {\n if (this.positions) {\n meshOrGeometry.updateVerticesData(VertexBuffer.PositionKind, this.positions, updateExtends, makeItUnique);\n }\n if (this.normals) {\n meshOrGeometry.updateVerticesData(VertexBuffer.NormalKind, this.normals, updateExtends, makeItUnique);\n }\n if (this.tangents) {\n meshOrGeometry.updateVerticesData(VertexBuffer.TangentKind, this.tangents, updateExtends, makeItUnique);\n }\n if (this.uvs) {\n meshOrGeometry.updateVerticesData(VertexBuffer.UVKind, this.uvs, updateExtends, makeItUnique);\n }\n if (this.uvs2) {\n meshOrGeometry.updateVerticesData(VertexBuffer.UV2Kind, this.uvs2, updateExtends, makeItUnique);\n }\n if (this.uvs3) {\n meshOrGeometry.updateVerticesData(VertexBuffer.UV3Kind, this.uvs3, updateExtends, makeItUnique);\n }\n if (this.uvs4) {\n meshOrGeometry.updateVerticesData(VertexBuffer.UV4Kind, this.uvs4, updateExtends, makeItUnique);\n }\n if (this.uvs5) {\n meshOrGeometry.updateVerticesData(VertexBuffer.UV5Kind, this.uvs5, updateExtends, makeItUnique);\n }\n if (this.uvs6) {\n meshOrGeometry.updateVerticesData(VertexBuffer.UV6Kind, this.uvs6, updateExtends, makeItUnique);\n }\n if (this.colors) {\n meshOrGeometry.updateVerticesData(VertexBuffer.ColorKind, this.colors, updateExtends, makeItUnique);\n }\n if (this.matricesIndices) {\n meshOrGeometry.updateVerticesData(VertexBuffer.MatricesIndicesKind, this.matricesIndices, updateExtends, makeItUnique);\n }\n if (this.matricesWeights) {\n meshOrGeometry.updateVerticesData(VertexBuffer.MatricesWeightsKind, this.matricesWeights, updateExtends, makeItUnique);\n }\n if (this.matricesIndicesExtra) {\n meshOrGeometry.updateVerticesData(VertexBuffer.MatricesIndicesExtraKind, this.matricesIndicesExtra, updateExtends, makeItUnique);\n }\n if (this.matricesWeightsExtra) {\n meshOrGeometry.updateVerticesData(VertexBuffer.MatricesWeightsExtraKind, this.matricesWeightsExtra, updateExtends, makeItUnique);\n }\n if (this.indices) {\n meshOrGeometry.setIndices(this.indices, null);\n }\n return this;\n }\n static _TransformVector3Coordinates(coordinates, transformation, offset = 0, length = coordinates.length) {\n const coordinate = TmpVectors.Vector3[0];\n const transformedCoordinate = TmpVectors.Vector3[1];\n for (let index = offset; index < offset + length; index += 3) {\n Vector3.FromArrayToRef(coordinates, index, coordinate);\n Vector3.TransformCoordinatesToRef(coordinate, transformation, transformedCoordinate);\n coordinates[index] = transformedCoordinate.x;\n coordinates[index + 1] = transformedCoordinate.y;\n coordinates[index + 2] = transformedCoordinate.z;\n }\n }\n static _TransformVector3Normals(normals, transformation, offset = 0, length = normals.length) {\n const normal = TmpVectors.Vector3[0];\n const transformedNormal = TmpVectors.Vector3[1];\n for (let index = offset; index < offset + length; index += 3) {\n Vector3.FromArrayToRef(normals, index, normal);\n Vector3.TransformNormalToRef(normal, transformation, transformedNormal);\n normals[index] = transformedNormal.x;\n normals[index + 1] = transformedNormal.y;\n normals[index + 2] = transformedNormal.z;\n }\n }\n static _TransformVector4Normals(normals, transformation, offset = 0, length = normals.length) {\n const normal = TmpVectors.Vector4[0];\n const transformedNormal = TmpVectors.Vector4[1];\n for (let index = offset; index < offset + length; index += 4) {\n Vector4.FromArrayToRef(normals, index, normal);\n Vector4.TransformNormalToRef(normal, transformation, transformedNormal);\n normals[index] = transformedNormal.x;\n normals[index + 1] = transformedNormal.y;\n normals[index + 2] = transformedNormal.z;\n normals[index + 3] = transformedNormal.w;\n }\n }\n static _FlipFaces(indices, offset = 0, length = indices.length) {\n for (let index = offset; index < offset + length; index += 3) {\n const tmp = indices[index + 1];\n indices[index + 1] = indices[index + 2];\n indices[index + 2] = tmp;\n }\n }\n /**\n * Transforms each position and each normal of the vertexData according to the passed Matrix\n * @param matrix the transforming matrix\n * @returns the VertexData\n */\n transform(matrix) {\n const flip = matrix.determinant() < 0;\n if (this.positions) {\n VertexData._TransformVector3Coordinates(this.positions, matrix);\n }\n if (this.normals) {\n VertexData._TransformVector3Normals(this.normals, matrix);\n }\n if (this.tangents) {\n VertexData._TransformVector4Normals(this.tangents, matrix);\n }\n if (flip && this.indices) {\n VertexData._FlipFaces(this.indices);\n }\n return this;\n }\n /**\n * Generates an array of vertex data where each vertex data only has one material info\n * @returns An array of VertexData\n */\n splitBasedOnMaterialID() {\n if (!this.materialInfos || this.materialInfos.length < 2) {\n return [this];\n }\n const result = new Array();\n for (const materialInfo of this.materialInfos) {\n const vertexData = new VertexData();\n if (this.positions) {\n vertexData.positions = this.positions.slice(materialInfo.verticesStart * 3, (materialInfo.verticesCount + materialInfo.verticesStart) * 3);\n }\n if (this.normals) {\n vertexData.normals = this.normals.slice(materialInfo.verticesStart * 3, (materialInfo.verticesCount + materialInfo.verticesStart) * 3);\n }\n if (this.tangents) {\n vertexData.tangents = this.tangents.slice(materialInfo.verticesStart * 4, (materialInfo.verticesCount + materialInfo.verticesStart) * 4);\n }\n if (this.colors) {\n vertexData.colors = this.colors.slice(materialInfo.verticesStart * 4, (materialInfo.verticesCount + materialInfo.verticesStart) * 4);\n }\n if (this.uvs) {\n vertexData.uvs = this.uvs.slice(materialInfo.verticesStart * 2, (materialInfo.verticesCount + materialInfo.verticesStart) * 2);\n }\n if (this.uvs2) {\n vertexData.uvs2 = this.uvs2.slice(materialInfo.verticesStart * 2, (materialInfo.verticesCount + materialInfo.verticesStart) * 2);\n }\n if (this.uvs3) {\n vertexData.uvs3 = this.uvs3.slice(materialInfo.verticesStart * 2, (materialInfo.verticesCount + materialInfo.verticesStart) * 2);\n }\n if (this.uvs4) {\n vertexData.uvs4 = this.uvs4.slice(materialInfo.verticesStart * 2, (materialInfo.verticesCount + materialInfo.verticesStart) * 2);\n }\n if (this.uvs5) {\n vertexData.uvs5 = this.uvs5.slice(materialInfo.verticesStart * 2, (materialInfo.verticesCount + materialInfo.verticesStart) * 2);\n }\n if (this.uvs6) {\n vertexData.uvs6 = this.uvs6.slice(materialInfo.verticesStart * 2, (materialInfo.verticesCount + materialInfo.verticesStart) * 2);\n }\n if (this.matricesIndices) {\n vertexData.matricesIndices = this.matricesIndices.slice(materialInfo.verticesStart * 4, (materialInfo.verticesCount + materialInfo.verticesStart) * 4);\n }\n if (this.matricesIndicesExtra) {\n vertexData.matricesIndicesExtra = this.matricesIndicesExtra.slice(materialInfo.verticesStart * 4, (materialInfo.verticesCount + materialInfo.verticesStart) * 4);\n }\n if (this.matricesWeights) {\n vertexData.matricesWeights = this.matricesWeights.slice(materialInfo.verticesStart * 4, (materialInfo.verticesCount + materialInfo.verticesStart) * 4);\n }\n if (this.matricesWeightsExtra) {\n vertexData.matricesWeightsExtra = this.matricesWeightsExtra.slice(materialInfo.verticesStart * 4, (materialInfo.verticesCount + materialInfo.verticesStart) * 4);\n }\n if (this.indices) {\n vertexData.indices = [];\n for (let index = materialInfo.indexStart; index < materialInfo.indexStart + materialInfo.indexCount; index++) {\n vertexData.indices.push(this.indices[index] - materialInfo.verticesStart);\n }\n }\n const newMaterialInfo = new VertexDataMaterialInfo();\n newMaterialInfo.indexStart = 0;\n newMaterialInfo.indexCount = vertexData.indices ? vertexData.indices.length : 0;\n newMaterialInfo.materialIndex = materialInfo.materialIndex;\n newMaterialInfo.verticesStart = 0;\n newMaterialInfo.verticesCount = (vertexData.positions ? vertexData.positions.length : 0) / 3;\n vertexData.materialInfos = [newMaterialInfo];\n result.push(vertexData);\n }\n return result;\n }\n /**\n * Merges the passed VertexData into the current one\n * @param others the VertexData to be merged into the current one\n * @param use32BitsIndices defines a boolean indicating if indices must be store in a 32 bits array\n * @param forceCloneIndices defines a boolean indicating if indices are forced to be cloned\n * @param mergeMaterialIds defines a boolean indicating if we need to merge the material infos\n * @param enableCompletion defines a boolean indicating if the vertex data should be completed to be compatible\n * @returns the modified VertexData\n */\n merge(others, use32BitsIndices = false, forceCloneIndices = false, mergeMaterialIds = false, enableCompletion = false) {\n const vertexDatas = Array.isArray(others)\n ? others.map((other) => {\n return { vertexData: other };\n })\n : [{ vertexData: others }];\n return runCoroutineSync(this._mergeCoroutine(undefined, vertexDatas, use32BitsIndices, false, forceCloneIndices, mergeMaterialIds, enableCompletion));\n }\n /**\n * @internal\n */\n *_mergeCoroutine(transform, vertexDatas, use32BitsIndices = false, isAsync, forceCloneIndices, mergeMaterialIds = false, enableCompletion = false) {\n var _a, _b, _c, _d;\n this._validate();\n let others = vertexDatas.map((vertexData) => vertexData.vertexData);\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n let root = this;\n for (const other of others) {\n if (!other) {\n continue;\n }\n other._validate();\n if (!enableCompletion) {\n if (!this.normals !== !other.normals ||\n !this.tangents !== !other.tangents ||\n !this.uvs !== !other.uvs ||\n !this.uvs2 !== !other.uvs2 ||\n !this.uvs3 !== !other.uvs3 ||\n !this.uvs4 !== !other.uvs4 ||\n !this.uvs5 !== !other.uvs5 ||\n !this.uvs6 !== !other.uvs6 ||\n !this.colors !== !other.colors ||\n !this.matricesIndices !== !other.matricesIndices ||\n !this.matricesWeights !== !other.matricesWeights ||\n !this.matricesIndicesExtra !== !other.matricesIndicesExtra ||\n !this.matricesWeightsExtra !== !other.matricesWeightsExtra) {\n throw new Error(\"Cannot merge vertex data that do not have the same set of attributes\");\n }\n }\n else {\n if (!this.normals !== !other.normals) {\n if (!this.normals) {\n this.normals = new Float32Array(this.positions.length);\n }\n else {\n other.normals = new Float32Array(other.positions.length);\n }\n }\n if (!this.tangents !== !other.tangents) {\n if (!this.tangents) {\n this.tangents = new Float32Array((this.positions.length / 3) * 4);\n }\n else {\n other.tangents = new Float32Array((other.positions.length / 3) * 4);\n }\n }\n if (!this.uvs !== !other.uvs) {\n if (!this.uvs) {\n this.uvs = new Float32Array((this.positions.length / 3) * 2);\n }\n else {\n other.uvs = new Float32Array((other.positions.length / 3) * 2);\n }\n }\n if (!this.uvs2 !== !other.uvs2) {\n if (!this.uvs2) {\n this.uvs2 = new Float32Array((this.positions.length / 3) * 2);\n }\n else {\n other.uvs2 = new Float32Array((other.positions.length / 3) * 2);\n }\n }\n if (!this.uvs3 !== !other.uvs3) {\n if (!this.uvs3) {\n this.uvs3 = new Float32Array((this.positions.length / 3) * 2);\n }\n else {\n other.uvs3 = new Float32Array((other.positions.length / 3) * 2);\n }\n }\n if (!this.uvs4 !== !other.uvs4) {\n if (!this.uvs4) {\n this.uvs4 = new Float32Array((this.positions.length / 3) * 2);\n }\n else {\n other.uvs4 = new Float32Array((other.positions.length / 3) * 2);\n }\n }\n if (!this.uvs5 !== !other.uvs5) {\n if (!this.uvs5) {\n this.uvs5 = new Float32Array((this.positions.length / 3) * 2);\n }\n else {\n other.uvs5 = new Float32Array((other.positions.length / 3) * 2);\n }\n }\n if (!this.uvs6 !== !other.uvs6) {\n if (!this.uvs6) {\n this.uvs6 = new Float32Array((this.positions.length / 3) * 2);\n }\n else {\n other.uvs6 = new Float32Array((other.positions.length / 3) * 2);\n }\n }\n if (!this.colors !== !other.colors) {\n if (!this.colors) {\n this.colors = new Float32Array((this.positions.length / 3) * 4);\n this.colors.fill(1); // Set to white by default\n }\n else {\n other.colors = new Float32Array((other.positions.length / 3) * 4);\n other.colors.fill(1); // Set to white by default\n }\n }\n if (!this.matricesIndices !== !other.matricesIndices) {\n if (!this.matricesIndices) {\n this.matricesIndices = new Float32Array((this.positions.length / 3) * 4);\n }\n else {\n other.matricesIndices = new Float32Array((other.positions.length / 3) * 4);\n }\n }\n if (!this.matricesWeights !== !other.matricesWeights) {\n if (!this.matricesWeights) {\n this.matricesWeights = new Float32Array((this.positions.length / 3) * 4);\n }\n else {\n other.matricesWeights = new Float32Array((other.positions.length / 3) * 4);\n }\n }\n if (!this.matricesIndicesExtra !== !other.matricesIndicesExtra) {\n if (!this.matricesIndicesExtra) {\n this.matricesIndicesExtra = new Float32Array((this.positions.length / 3) * 4);\n }\n else {\n other.matricesIndicesExtra = new Float32Array((other.positions.length / 3) * 4);\n }\n }\n if (!this.matricesWeightsExtra !== !other.matricesWeightsExtra) {\n if (!this.matricesWeightsExtra) {\n this.matricesWeightsExtra = new Float32Array((this.positions.length / 3) * 4);\n }\n else {\n other.matricesWeightsExtra = new Float32Array((other.positions.length / 3) * 4);\n }\n }\n }\n }\n if (mergeMaterialIds) {\n // Merge material infos\n let materialIndex = 0;\n let indexOffset = 0;\n let vertexOffset = 0;\n const materialInfos = [];\n let currentMaterialInfo = null;\n const vertexDataList = [];\n // We need to split vertexData with more than one materialInfo\n for (const split of this.splitBasedOnMaterialID()) {\n vertexDataList.push({ vertexData: split, transform: transform });\n }\n for (const data of vertexDatas) {\n if (!data.vertexData) {\n continue;\n }\n for (const split of data.vertexData.splitBasedOnMaterialID()) {\n vertexDataList.push({ vertexData: split, transform: data.transform });\n }\n }\n // Sort by material IDs\n vertexDataList.sort((a, b) => {\n const matInfoA = a.vertexData.materialInfos ? a.vertexData.materialInfos[0].materialIndex : 0;\n const matInfoB = b.vertexData.materialInfos ? b.vertexData.materialInfos[0].materialIndex : 0;\n if (matInfoA > matInfoB) {\n return 1;\n }\n if (matInfoA === matInfoB) {\n return 0;\n }\n return -1;\n });\n // Build the new material info\n for (const vertexDataSource of vertexDataList) {\n const vertexData = vertexDataSource.vertexData;\n if (vertexData.materialInfos) {\n materialIndex = vertexData.materialInfos[0].materialIndex;\n }\n else {\n materialIndex = 0;\n }\n if (currentMaterialInfo && currentMaterialInfo.materialIndex === materialIndex) {\n currentMaterialInfo.indexCount += vertexData.indices.length;\n currentMaterialInfo.verticesCount += vertexData.positions.length / 3;\n }\n else {\n const materialInfo = new VertexDataMaterialInfo();\n materialInfo.materialIndex = materialIndex;\n materialInfo.indexStart = indexOffset;\n materialInfo.indexCount = vertexData.indices.length;\n materialInfo.verticesStart = vertexOffset;\n materialInfo.verticesCount = vertexData.positions.length / 3;\n materialInfos.push(materialInfo);\n currentMaterialInfo = materialInfo;\n }\n indexOffset += vertexData.indices.length;\n vertexOffset += vertexData.positions.length / 3;\n }\n // Extract sorted values\n const first = vertexDataList.splice(0, 1)[0];\n root = first.vertexData;\n transform = first.transform;\n others = vertexDataList.map((v) => v.vertexData);\n vertexDatas = vertexDataList;\n this.materialInfos = materialInfos;\n }\n // Merge geometries\n const totalIndices = others.reduce((indexSum, vertexData) => { var _a, _b; return indexSum + ((_b = (_a = vertexData.indices) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0); }, (_b = (_a = root.indices) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0);\n const sliceIndices = forceCloneIndices || others.some((vertexData) => vertexData.indices === root.indices);\n let indices = sliceIndices ? (_c = root.indices) === null || _c === void 0 ? void 0 : _c.slice() : root.indices;\n if (totalIndices > 0) {\n let indicesOffset = (_d = indices === null || indices === void 0 ? void 0 : indices.length) !== null && _d !== void 0 ? _d : 0;\n if (!indices) {\n indices = new Array(totalIndices);\n }\n if (indices.length !== totalIndices) {\n if (Array.isArray(indices)) {\n indices.length = totalIndices;\n }\n else {\n const temp = use32BitsIndices || indices instanceof Uint32Array ? new Uint32Array(totalIndices) : new Uint16Array(totalIndices);\n temp.set(indices);\n indices = temp;\n }\n if (transform && transform.determinant() < 0) {\n VertexData._FlipFaces(indices, 0, indicesOffset);\n }\n }\n let positionsOffset = root.positions ? root.positions.length / 3 : 0;\n for (const { vertexData: other, transform } of vertexDatas) {\n if (other.indices) {\n for (let index = 0; index < other.indices.length; index++) {\n indices[indicesOffset + index] = other.indices[index] + positionsOffset;\n }\n if (transform && transform.determinant() < 0) {\n VertexData._FlipFaces(indices, indicesOffset, other.indices.length);\n }\n // The call to _validate already checked for positions\n positionsOffset += other.positions.length / 3;\n indicesOffset += other.indices.length;\n if (isAsync) {\n yield;\n }\n }\n }\n }\n this.indices = indices;\n this.positions = VertexData._MergeElement(VertexBuffer.PositionKind, root.positions, transform, vertexDatas.map((other) => [other.vertexData.positions, other.transform]));\n if (isAsync) {\n yield;\n }\n if (root.normals) {\n this.normals = VertexData._MergeElement(VertexBuffer.NormalKind, root.normals, transform, vertexDatas.map((other) => [other.vertexData.normals, other.transform]));\n if (isAsync) {\n yield;\n }\n }\n if (root.tangents) {\n this.tangents = VertexData._MergeElement(VertexBuffer.TangentKind, root.tangents, transform, vertexDatas.map((other) => [other.vertexData.tangents, other.transform]));\n if (isAsync) {\n yield;\n }\n }\n if (root.uvs) {\n this.uvs = VertexData._MergeElement(VertexBuffer.UVKind, root.uvs, transform, vertexDatas.map((other) => [other.vertexData.uvs, other.transform]));\n if (isAsync) {\n yield;\n }\n }\n if (root.uvs2) {\n this.uvs2 = VertexData._MergeElement(VertexBuffer.UV2Kind, root.uvs2, transform, vertexDatas.map((other) => [other.vertexData.uvs2, other.transform]));\n if (isAsync) {\n yield;\n }\n }\n if (root.uvs3) {\n this.uvs3 = VertexData._MergeElement(VertexBuffer.UV3Kind, root.uvs3, transform, vertexDatas.map((other) => [other.vertexData.uvs3, other.transform]));\n if (isAsync) {\n yield;\n }\n }\n if (root.uvs4) {\n this.uvs4 = VertexData._MergeElement(VertexBuffer.UV4Kind, root.uvs4, transform, vertexDatas.map((other) => [other.vertexData.uvs4, other.transform]));\n if (isAsync) {\n yield;\n }\n }\n if (root.uvs5) {\n this.uvs5 = VertexData._MergeElement(VertexBuffer.UV5Kind, root.uvs5, transform, vertexDatas.map((other) => [other.vertexData.uvs5, other.transform]));\n if (isAsync) {\n yield;\n }\n }\n if (root.uvs6) {\n this.uvs6 = VertexData._MergeElement(VertexBuffer.UV6Kind, root.uvs6, transform, vertexDatas.map((other) => [other.vertexData.uvs6, other.transform]));\n if (isAsync) {\n yield;\n }\n }\n if (root.colors) {\n this.colors = VertexData._MergeElement(VertexBuffer.ColorKind, root.colors, transform, vertexDatas.map((other) => [other.vertexData.colors, other.transform]));\n if (isAsync) {\n yield;\n }\n }\n if (root.matricesIndices) {\n this.matricesIndices = VertexData._MergeElement(VertexBuffer.MatricesIndicesKind, root.matricesIndices, transform, vertexDatas.map((other) => [other.vertexData.matricesIndices, other.transform]));\n if (isAsync) {\n yield;\n }\n }\n if (root.matricesWeights) {\n this.matricesWeights = VertexData._MergeElement(VertexBuffer.MatricesWeightsKind, root.matricesWeights, transform, vertexDatas.map((other) => [other.vertexData.matricesWeights, other.transform]));\n if (isAsync) {\n yield;\n }\n }\n if (root.matricesIndicesExtra) {\n this.matricesIndicesExtra = VertexData._MergeElement(VertexBuffer.MatricesIndicesExtraKind, root.matricesIndicesExtra, transform, vertexDatas.map((other) => [other.vertexData.matricesIndicesExtra, other.transform]));\n if (isAsync) {\n yield;\n }\n }\n if (root.matricesWeightsExtra) {\n this.matricesWeightsExtra = VertexData._MergeElement(VertexBuffer.MatricesWeightsExtraKind, root.matricesWeightsExtra, transform, vertexDatas.map((other) => [other.vertexData.matricesWeightsExtra, other.transform]));\n }\n return this;\n }\n static _MergeElement(kind, source, transform, others) {\n const nonNullOthers = others.filter((other) => other[0] !== null && other[0] !== undefined);\n // If there is no source to copy and no other non-null sources then skip this element.\n if (!source && nonNullOthers.length == 0) {\n return source;\n }\n if (!source) {\n return this._MergeElement(kind, nonNullOthers[0][0], nonNullOthers[0][1], nonNullOthers.slice(1));\n }\n const len = nonNullOthers.reduce((sumLen, elements) => sumLen + elements[0].length, source.length);\n const transformRange = kind === VertexBuffer.PositionKind\n ? VertexData._TransformVector3Coordinates\n : kind === VertexBuffer.NormalKind\n ? VertexData._TransformVector3Normals\n : kind === VertexBuffer.TangentKind\n ? VertexData._TransformVector4Normals\n : () => { };\n if (source instanceof Float32Array) {\n // use non-loop method when the source is Float32Array\n const ret32 = new Float32Array(len);\n ret32.set(source);\n transform && transformRange(ret32, transform, 0, source.length);\n let offset = source.length;\n for (const [vertexData, transform] of nonNullOthers) {\n ret32.set(vertexData, offset);\n transform && transformRange(ret32, transform, offset, vertexData.length);\n offset += vertexData.length;\n }\n return ret32;\n }\n else {\n // don't use concat as it is super slow, just loop for other cases\n const ret = new Array(len);\n for (let i = 0; i < source.length; i++) {\n ret[i] = source[i];\n }\n transform && transformRange(ret, transform, 0, source.length);\n let offset = source.length;\n for (const [vertexData, transform] of nonNullOthers) {\n for (let i = 0; i < vertexData.length; i++) {\n ret[offset + i] = vertexData[i];\n }\n transform && transformRange(ret, transform, offset, vertexData.length);\n offset += vertexData.length;\n }\n return ret;\n }\n }\n _validate() {\n if (!this.positions) {\n throw new RuntimeError(\"Positions are required\", ErrorCodes.MeshInvalidPositionsError);\n }\n const getElementCount = (kind, values) => {\n const stride = VertexBuffer.DeduceStride(kind);\n if (values.length % stride !== 0) {\n throw new Error(\"The \" + kind + \"s array count must be a multiple of \" + stride);\n }\n return values.length / stride;\n };\n const positionsElementCount = getElementCount(VertexBuffer.PositionKind, this.positions);\n const validateElementCount = (kind, values) => {\n const elementCount = getElementCount(kind, values);\n if (elementCount !== positionsElementCount) {\n throw new Error(\"The \" + kind + \"s element count (\" + elementCount + \") does not match the positions count (\" + positionsElementCount + \")\");\n }\n };\n if (this.normals) {\n validateElementCount(VertexBuffer.NormalKind, this.normals);\n }\n if (this.tangents) {\n validateElementCount(VertexBuffer.TangentKind, this.tangents);\n }\n if (this.uvs) {\n validateElementCount(VertexBuffer.UVKind, this.uvs);\n }\n if (this.uvs2) {\n validateElementCount(VertexBuffer.UV2Kind, this.uvs2);\n }\n if (this.uvs3) {\n validateElementCount(VertexBuffer.UV3Kind, this.uvs3);\n }\n if (this.uvs4) {\n validateElementCount(VertexBuffer.UV4Kind, this.uvs4);\n }\n if (this.uvs5) {\n validateElementCount(VertexBuffer.UV5Kind, this.uvs5);\n }\n if (this.uvs6) {\n validateElementCount(VertexBuffer.UV6Kind, this.uvs6);\n }\n if (this.colors) {\n validateElementCount(VertexBuffer.ColorKind, this.colors);\n }\n if (this.matricesIndices) {\n validateElementCount(VertexBuffer.MatricesIndicesKind, this.matricesIndices);\n }\n if (this.matricesWeights) {\n validateElementCount(VertexBuffer.MatricesWeightsKind, this.matricesWeights);\n }\n if (this.matricesIndicesExtra) {\n validateElementCount(VertexBuffer.MatricesIndicesExtraKind, this.matricesIndicesExtra);\n }\n if (this.matricesWeightsExtra) {\n validateElementCount(VertexBuffer.MatricesWeightsExtraKind, this.matricesWeightsExtra);\n }\n }\n /**\n * Clone the current vertex data\n * @returns a copy of the current data\n */\n clone() {\n const serializationObject = this.serialize();\n return VertexData.Parse(serializationObject);\n }\n /**\n * Serializes the VertexData\n * @returns a serialized object\n */\n serialize() {\n const serializationObject = {};\n if (this.positions) {\n serializationObject.positions = Array.from(this.positions);\n }\n if (this.normals) {\n serializationObject.normals = Array.from(this.normals);\n }\n if (this.tangents) {\n serializationObject.tangents = Array.from(this.tangents);\n }\n if (this.uvs) {\n serializationObject.uvs = Array.from(this.uvs);\n }\n if (this.uvs2) {\n serializationObject.uvs2 = Array.from(this.uvs2);\n }\n if (this.uvs3) {\n serializationObject.uvs3 = Array.from(this.uvs3);\n }\n if (this.uvs4) {\n serializationObject.uvs4 = Array.from(this.uvs4);\n }\n if (this.uvs5) {\n serializationObject.uvs5 = Array.from(this.uvs5);\n }\n if (this.uvs6) {\n serializationObject.uvs6 = Array.from(this.uvs6);\n }\n if (this.colors) {\n serializationObject.colors = Array.from(this.colors);\n }\n if (this.matricesIndices) {\n serializationObject.matricesIndices = Array.from(this.matricesIndices);\n serializationObject.matricesIndices._isExpanded = true;\n }\n if (this.matricesWeights) {\n serializationObject.matricesWeights = Array.from(this.matricesWeights);\n }\n if (this.matricesIndicesExtra) {\n serializationObject.matricesIndicesExtra = Array.from(this.matricesIndicesExtra);\n serializationObject.matricesIndicesExtra._isExpanded = true;\n }\n if (this.matricesWeightsExtra) {\n serializationObject.matricesWeightsExtra = Array.from(this.matricesWeightsExtra);\n }\n serializationObject.indices = Array.from(this.indices);\n if (this.materialInfos) {\n serializationObject.materialInfos = [];\n for (const materialInfo of this.materialInfos) {\n const materialInfoSerializationObject = {\n indexStart: materialInfo.indexStart,\n indexCount: materialInfo.indexCount,\n materialIndex: materialInfo.materialIndex,\n verticesStart: materialInfo.verticesStart,\n verticesCount: materialInfo.verticesCount,\n };\n serializationObject.materialInfos.push(materialInfoSerializationObject);\n }\n }\n return serializationObject;\n }\n // Statics\n /**\n * Extracts the vertexData from a mesh\n * @param mesh the mesh from which to extract the VertexData\n * @param copyWhenShared defines if the VertexData must be cloned when shared between multiple meshes, optional, default false\n * @param forceCopy indicating that the VertexData must be cloned, optional, default false\n * @returns the object VertexData associated to the passed mesh\n */\n static ExtractFromMesh(mesh, copyWhenShared, forceCopy) {\n return VertexData._ExtractFrom(mesh, copyWhenShared, forceCopy);\n }\n /**\n * Extracts the vertexData from the geometry\n * @param geometry the geometry from which to extract the VertexData\n * @param copyWhenShared defines if the VertexData must be cloned when the geometry is shared between multiple meshes, optional, default false\n * @param forceCopy indicating that the VertexData must be cloned, optional, default false\n * @returns the object VertexData associated to the passed mesh\n */\n static ExtractFromGeometry(geometry, copyWhenShared, forceCopy) {\n return VertexData._ExtractFrom(geometry, copyWhenShared, forceCopy);\n }\n static _ExtractFrom(meshOrGeometry, copyWhenShared, forceCopy) {\n const result = new VertexData();\n if (meshOrGeometry.isVerticesDataPresent(VertexBuffer.PositionKind)) {\n result.positions = meshOrGeometry.getVerticesData(VertexBuffer.PositionKind, copyWhenShared, forceCopy);\n }\n if (meshOrGeometry.isVerticesDataPresent(VertexBuffer.NormalKind)) {\n result.normals = meshOrGeometry.getVerticesData(VertexBuffer.NormalKind, copyWhenShared, forceCopy);\n }\n if (meshOrGeometry.isVerticesDataPresent(VertexBuffer.TangentKind)) {\n result.tangents = meshOrGeometry.getVerticesData(VertexBuffer.TangentKind, copyWhenShared, forceCopy);\n }\n if (meshOrGeometry.isVerticesDataPresent(VertexBuffer.UVKind)) {\n result.uvs = meshOrGeometry.getVerticesData(VertexBuffer.UVKind, copyWhenShared, forceCopy);\n }\n if (meshOrGeometry.isVerticesDataPresent(VertexBuffer.UV2Kind)) {\n result.uvs2 = meshOrGeometry.getVerticesData(VertexBuffer.UV2Kind, copyWhenShared, forceCopy);\n }\n if (meshOrGeometry.isVerticesDataPresent(VertexBuffer.UV3Kind)) {\n result.uvs3 = meshOrGeometry.getVerticesData(VertexBuffer.UV3Kind, copyWhenShared, forceCopy);\n }\n if (meshOrGeometry.isVerticesDataPresent(VertexBuffer.UV4Kind)) {\n result.uvs4 = meshOrGeometry.getVerticesData(VertexBuffer.UV4Kind, copyWhenShared, forceCopy);\n }\n if (meshOrGeometry.isVerticesDataPresent(VertexBuffer.UV5Kind)) {\n result.uvs5 = meshOrGeometry.getVerticesData(VertexBuffer.UV5Kind, copyWhenShared, forceCopy);\n }\n if (meshOrGeometry.isVerticesDataPresent(VertexBuffer.UV6Kind)) {\n result.uvs6 = meshOrGeometry.getVerticesData(VertexBuffer.UV6Kind, copyWhenShared, forceCopy);\n }\n if (meshOrGeometry.isVerticesDataPresent(VertexBuffer.ColorKind)) {\n result.colors = meshOrGeometry.getVerticesData(VertexBuffer.ColorKind, copyWhenShared, forceCopy);\n }\n if (meshOrGeometry.isVerticesDataPresent(VertexBuffer.MatricesIndicesKind)) {\n result.matricesIndices = meshOrGeometry.getVerticesData(VertexBuffer.MatricesIndicesKind, copyWhenShared, forceCopy);\n }\n if (meshOrGeometry.isVerticesDataPresent(VertexBuffer.MatricesWeightsKind)) {\n result.matricesWeights = meshOrGeometry.getVerticesData(VertexBuffer.MatricesWeightsKind, copyWhenShared, forceCopy);\n }\n if (meshOrGeometry.isVerticesDataPresent(VertexBuffer.MatricesIndicesExtraKind)) {\n result.matricesIndicesExtra = meshOrGeometry.getVerticesData(VertexBuffer.MatricesIndicesExtraKind, copyWhenShared, forceCopy);\n }\n if (meshOrGeometry.isVerticesDataPresent(VertexBuffer.MatricesWeightsExtraKind)) {\n result.matricesWeightsExtra = meshOrGeometry.getVerticesData(VertexBuffer.MatricesWeightsExtraKind, copyWhenShared, forceCopy);\n }\n result.indices = meshOrGeometry.getIndices(copyWhenShared, forceCopy);\n return result;\n }\n /**\n * Creates the VertexData for a Ribbon\n * @param options an object used to set the following optional parameters for the ribbon, required but can be empty\n * * pathArray array of paths, each of which an array of successive Vector3\n * * closeArray creates a seam between the first and the last paths of the pathArray, optional, default false\n * * closePath creates a seam between the first and the last points of each path of the path array, optional, default false\n * * offset a positive integer, only used when pathArray contains a single path (offset = 10 means the point 1 is joined to the point 11), default rounded half size of the pathArray length\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\n * * invertUV swaps in the U and V coordinates when applying a texture, optional, default false\n * * uvs a linear array, of length 2 * number of vertices, of custom UV values, optional\n * * colors a linear array, of length 4 * number of vertices, of custom color values, optional\n * @param options.pathArray\n * @param options.closeArray\n * @param options.closePath\n * @param options.offset\n * @param options.sideOrientation\n * @param options.frontUVs\n * @param options.backUVs\n * @param options.invertUV\n * @param options.uvs\n * @param options.colors\n * @returns the VertexData of the ribbon\n * @deprecated use CreateRibbonVertexData instead\n */\n static CreateRibbon(options) {\n throw _WarnImport(\"ribbonBuilder\");\n }\n /**\n * Creates the VertexData for a box\n * @param options an object used to set the following optional parameters for the box, required but can be empty\n * * size sets the width, height and depth of the box to the value of size, optional default 1\n * * width sets the width (x direction) of the box, overwrites the width set by size, optional, default size\n * * height sets the height (y direction) of the box, overwrites the height set by size, optional, default size\n * * depth sets the depth (z direction) of the box, overwrites the depth set by size, optional, default size\n * * faceUV an array of 6 Vector4 elements used to set different images to each box side\n * * faceColors an array of 6 Color3 elements used to set different colors to each box side\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\n * @param options.size\n * @param options.width\n * @param options.height\n * @param options.depth\n * @param options.faceUV\n * @param options.faceColors\n * @param options.sideOrientation\n * @param options.frontUVs\n * @param options.backUVs\n * @returns the VertexData of the box\n * @deprecated Please use CreateBoxVertexData from the BoxBuilder file instead\n */\n static CreateBox(options) {\n throw _WarnImport(\"boxBuilder\");\n }\n /**\n * Creates the VertexData for a tiled box\n * @param options an object used to set the following optional parameters for the box, required but can be empty\n * * faceTiles sets the pattern, tile size and number of tiles for a face\n * * faceUV an array of 6 Vector4 elements used to set different images to each box side\n * * faceColors an array of 6 Color3 elements used to set different colors to each box side\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\n * @param options.pattern\n * @param options.width\n * @param options.height\n * @param options.depth\n * @param options.tileSize\n * @param options.tileWidth\n * @param options.tileHeight\n * @param options.alignHorizontal\n * @param options.alignVertical\n * @param options.faceUV\n * @param options.faceColors\n * @param options.sideOrientation\n * @returns the VertexData of the box\n * @deprecated Please use CreateTiledBoxVertexData instead\n */\n static CreateTiledBox(options) {\n throw _WarnImport(\"tiledBoxBuilder\");\n }\n /**\n * Creates the VertexData for a tiled plane\n * @param options an object used to set the following optional parameters for the box, required but can be empty\n * * pattern a limited pattern arrangement depending on the number\n * * tileSize sets the width, height and depth of the tile to the value of size, optional default 1\n * * tileWidth sets the width (x direction) of the tile, overwrites the width set by size, optional, default size\n * * tileHeight sets the height (y direction) of the tile, overwrites the height set by size, optional, default size\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\n * @param options.pattern\n * @param options.tileSize\n * @param options.tileWidth\n * @param options.tileHeight\n * @param options.size\n * @param options.width\n * @param options.height\n * @param options.alignHorizontal\n * @param options.alignVertical\n * @param options.sideOrientation\n * @param options.frontUVs\n * @param options.backUVs\n * @returns the VertexData of the tiled plane\n * @deprecated use CreateTiledPlaneVertexData instead\n */\n static CreateTiledPlane(options) {\n throw _WarnImport(\"tiledPlaneBuilder\");\n }\n /**\n * Creates the VertexData for an ellipsoid, defaults to a sphere\n * @param options an object used to set the following optional parameters for the box, required but can be empty\n * * segments sets the number of horizontal strips optional, default 32\n * * diameter sets the axes dimensions, diameterX, diameterY and diameterZ to the value of diameter, optional default 1\n * * diameterX sets the diameterX (x direction) of the ellipsoid, overwrites the diameterX set by diameter, optional, default diameter\n * * diameterY sets the diameterY (y direction) of the ellipsoid, overwrites the diameterY set by diameter, optional, default diameter\n * * diameterZ sets the diameterZ (z direction) of the ellipsoid, overwrites the diameterZ set by diameter, optional, default diameter\n * * arc a number from 0 to 1, to create an unclosed ellipsoid based on the fraction of the circumference (latitude) given by the arc value, optional, default 1\n * * slice a number from 0 to 1, to create an unclosed ellipsoid based on the fraction of the height (latitude) given by the arc value, optional, default 1\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\n * @param options.segments\n * @param options.diameter\n * @param options.diameterX\n * @param options.diameterY\n * @param options.diameterZ\n * @param options.arc\n * @param options.slice\n * @param options.sideOrientation\n * @param options.frontUVs\n * @param options.backUVs\n * @returns the VertexData of the ellipsoid\n * @deprecated use CreateSphereVertexData instead\n */\n static CreateSphere(options) {\n throw _WarnImport(\"sphereBuilder\");\n }\n /**\n * Creates the VertexData for a cylinder, cone or prism\n * @param options an object used to set the following optional parameters for the box, required but can be empty\n * * height sets the height (y direction) of the cylinder, optional, default 2\n * * diameterTop sets the diameter of the top of the cone, overwrites diameter, optional, default diameter\n * * diameterBottom sets the diameter of the bottom of the cone, overwrites diameter, optional, default diameter\n * * diameter sets the diameter of the top and bottom of the cone, optional default 1\n * * tessellation the number of prism sides, 3 for a triangular prism, optional, default 24\n * * subdivisions` the number of rings along the cylinder height, optional, default 1\n * * arc a number from 0 to 1, to create an unclosed cylinder based on the fraction of the circumference given by the arc value, optional, default 1\n * * faceColors an array of Color3 elements used to set different colors to the top, rings and bottom respectively\n * * faceUV an array of Vector4 elements used to set different images to the top, rings and bottom respectively\n * * hasRings when true makes each subdivision independently treated as a face for faceUV and faceColors, optional, default false\n * * enclose when true closes an open cylinder by adding extra flat faces between the height axis and vertical edges, think cut cake\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\n * @param options.height\n * @param options.diameterTop\n * @param options.diameterBottom\n * @param options.diameter\n * @param options.tessellation\n * @param options.subdivisions\n * @param options.arc\n * @param options.faceColors\n * @param options.faceUV\n * @param options.hasRings\n * @param options.enclose\n * @param options.sideOrientation\n * @param options.frontUVs\n * @param options.backUVs\n * @returns the VertexData of the cylinder, cone or prism\n * @deprecated please use CreateCylinderVertexData instead\n */\n static CreateCylinder(options) {\n throw _WarnImport(\"cylinderBuilder\");\n }\n /**\n * Creates the VertexData for a torus\n * @param options an object used to set the following optional parameters for the box, required but can be empty\n * * diameter the diameter of the torus, optional default 1\n * * thickness the diameter of the tube forming the torus, optional default 0.5\n * * tessellation the number of prism sides, 3 for a triangular prism, optional, default 24\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\n * @param options.diameter\n * @param options.thickness\n * @param options.tessellation\n * @param options.sideOrientation\n * @param options.frontUVs\n * @param options.backUVs\n * @returns the VertexData of the torus\n * @deprecated use CreateTorusVertexData instead\n */\n static CreateTorus(options) {\n throw _WarnImport(\"torusBuilder\");\n }\n /**\n * Creates the VertexData of the LineSystem\n * @param options an object used to set the following optional parameters for the LineSystem, required but can be empty\n * - lines an array of lines, each line being an array of successive Vector3\n * - colors an array of line colors, each of the line colors being an array of successive Color4, one per line point\n * @param options.lines\n * @param options.colors\n * @returns the VertexData of the LineSystem\n * @deprecated use CreateLineSystemVertexData instead\n */\n static CreateLineSystem(options) {\n throw _WarnImport(\"linesBuilder\");\n }\n /**\n * Create the VertexData for a DashedLines\n * @param options an object used to set the following optional parameters for the DashedLines, required but can be empty\n * - points an array successive Vector3\n * - dashSize the size of the dashes relative to the dash number, optional, default 3\n * - gapSize the size of the gap between two successive dashes relative to the dash number, optional, default 1\n * - dashNb the intended total number of dashes, optional, default 200\n * @param options.points\n * @param options.dashSize\n * @param options.gapSize\n * @param options.dashNb\n * @returns the VertexData for the DashedLines\n * @deprecated use CreateDashedLinesVertexData instead\n */\n static CreateDashedLines(options) {\n throw _WarnImport(\"linesBuilder\");\n }\n /**\n * Creates the VertexData for a Ground\n * @param options an object used to set the following optional parameters for the Ground, required but can be empty\n * - width the width (x direction) of the ground, optional, default 1\n * - height the height (z direction) of the ground, optional, default 1\n * - subdivisions the number of subdivisions per side, optional, default 1\n * @param options.width\n * @param options.height\n * @param options.subdivisions\n * @param options.subdivisionsX\n * @param options.subdivisionsY\n * @returns the VertexData of the Ground\n * @deprecated Please use CreateGroundVertexData instead\n */\n static CreateGround(options) {\n throw _WarnImport(\"groundBuilder\");\n }\n /**\n * Creates the VertexData for a TiledGround by subdividing the ground into tiles\n * @param options an object used to set the following optional parameters for the Ground, required but can be empty\n * * xmin the ground minimum X coordinate, optional, default -1\n * * zmin the ground minimum Z coordinate, optional, default -1\n * * xmax the ground maximum X coordinate, optional, default 1\n * * zmax the ground maximum Z coordinate, optional, default 1\n * * subdivisions a javascript object {w: positive integer, h: positive integer}, `w` and `h` are the numbers of subdivisions on the ground width and height creating 'tiles', default {w: 6, h: 6}\n * * precision a javascript object {w: positive integer, h: positive integer}, `w` and `h` are the numbers of subdivisions on the tile width and height, default {w: 2, h: 2}\n * @param options.xmin\n * @param options.zmin\n * @param options.xmax\n * @param options.zmax\n * @param options.subdivisions\n * @param options.subdivisions.w\n * @param options.subdivisions.h\n * @param options.precision\n * @param options.precision.w\n * @param options.precision.h\n * @returns the VertexData of the TiledGround\n * @deprecated use CreateTiledGroundVertexData instead\n */\n static CreateTiledGround(options) {\n throw _WarnImport(\"groundBuilder\");\n }\n /**\n * Creates the VertexData of the Ground designed from a heightmap\n * @param options an object used to set the following parameters for the Ground, required and provided by CreateGroundFromHeightMap\n * * width the width (x direction) of the ground\n * * height the height (z direction) of the ground\n * * subdivisions the number of subdivisions per side\n * * minHeight the minimum altitude on the ground, optional, default 0\n * * maxHeight the maximum altitude on the ground, optional default 1\n * * colorFilter the filter to apply to the image pixel colors to compute the height, optional Color3, default (0.3, 0.59, 0.11)\n * * buffer the array holding the image color data\n * * bufferWidth the width of image\n * * bufferHeight the height of image\n * * alphaFilter Remove any data where the alpha channel is below this value, defaults 0 (all data visible)\n * @param options.width\n * @param options.height\n * @param options.subdivisions\n * @param options.minHeight\n * @param options.maxHeight\n * @param options.colorFilter\n * @param options.buffer\n * @param options.bufferWidth\n * @param options.bufferHeight\n * @param options.alphaFilter\n * @returns the VertexData of the Ground designed from a heightmap\n * @deprecated use CreateGroundFromHeightMapVertexData instead\n */\n static CreateGroundFromHeightMap(options) {\n throw _WarnImport(\"groundBuilder\");\n }\n /**\n * Creates the VertexData for a Plane\n * @param options an object used to set the following optional parameters for the plane, required but can be empty\n * * size sets the width and height of the plane to the value of size, optional default 1\n * * width sets the width (x direction) of the plane, overwrites the width set by size, optional, default size\n * * height sets the height (y direction) of the plane, overwrites the height set by size, optional, default size\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\n * @param options.size\n * @param options.width\n * @param options.height\n * @param options.sideOrientation\n * @param options.frontUVs\n * @param options.backUVs\n * @returns the VertexData of the box\n * @deprecated use CreatePlaneVertexData instead\n */\n static CreatePlane(options) {\n throw _WarnImport(\"planeBuilder\");\n }\n /**\n * Creates the VertexData of the Disc or regular Polygon\n * @param options an object used to set the following optional parameters for the disc, required but can be empty\n * * radius the radius of the disc, optional default 0.5\n * * tessellation the number of polygon sides, optional, default 64\n * * arc a number from 0 to 1, to create an unclosed polygon based on the fraction of the circumference given by the arc value, optional, default 1\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\n * @param options.radius\n * @param options.tessellation\n * @param options.arc\n * @param options.sideOrientation\n * @param options.frontUVs\n * @param options.backUVs\n * @returns the VertexData of the box\n * @deprecated use CreateDiscVertexData instead\n */\n static CreateDisc(options) {\n throw _WarnImport(\"discBuilder\");\n }\n /**\n * Creates the VertexData for an irregular Polygon in the XoZ plane using a mesh built by polygonTriangulation.build()\n * All parameters are provided by CreatePolygon as needed\n * @param polygon a mesh built from polygonTriangulation.build()\n * @param sideOrientation takes the values Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\n * @param fUV an array of Vector4 elements used to set different images to the top, rings and bottom respectively\n * @param fColors an array of Color3 elements used to set different colors to the top, rings and bottom respectively\n * @param frontUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\n * @param backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\n * @param wrap a boolean, default false, when true and fUVs used texture is wrapped around all sides, when false texture is applied side\n * @returns the VertexData of the Polygon\n * @deprecated use CreatePolygonVertexData instead\n */\n static CreatePolygon(polygon, sideOrientation, fUV, fColors, frontUVs, backUVs, wrap) {\n throw _WarnImport(\"polygonBuilder\");\n }\n /**\n * Creates the VertexData of the IcoSphere\n * @param options an object used to set the following optional parameters for the IcoSphere, required but can be empty\n * * radius the radius of the IcoSphere, optional default 1\n * * radiusX allows stretching in the x direction, optional, default radius\n * * radiusY allows stretching in the y direction, optional, default radius\n * * radiusZ allows stretching in the z direction, optional, default radius\n * * flat when true creates a flat shaded mesh, optional, default true\n * * subdivisions increasing the subdivisions increases the number of faces, optional, default 4\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\n * @param options.radius\n * @param options.radiusX\n * @param options.radiusY\n * @param options.radiusZ\n * @param options.flat\n * @param options.subdivisions\n * @param options.sideOrientation\n * @param options.frontUVs\n * @param options.backUVs\n * @returns the VertexData of the IcoSphere\n * @deprecated use CreateIcoSphereVertexData instead\n */\n static CreateIcoSphere(options) {\n throw _WarnImport(\"icoSphereBuilder\");\n }\n // inspired from // http://stemkoski.github.io/Three.js/Polyhedra.html\n /**\n * Creates the VertexData for a Polyhedron\n * @param options an object used to set the following optional parameters for the polyhedron, required but can be empty\n * * type provided types are:\n * * 0 : Tetrahedron, 1 : Octahedron, 2 : Dodecahedron, 3 : Icosahedron, 4 : Rhombicuboctahedron, 5 : Triangular Prism, 6 : Pentagonal Prism, 7 : Hexagonal Prism, 8 : Square Pyramid (J1)\n * * 9 : Pentagonal Pyramid (J2), 10 : Triangular Dipyramid (J12), 11 : Pentagonal Dipyramid (J13), 12 : Elongated Square Dipyramid (J15), 13 : Elongated Pentagonal Dipyramid (J16), 14 : Elongated Pentagonal Cupola (J20)\n * * size the size of the IcoSphere, optional default 1\n * * sizeX allows stretching in the x direction, optional, default size\n * * sizeY allows stretching in the y direction, optional, default size\n * * sizeZ allows stretching in the z direction, optional, default size\n * * custom a number that overwrites the type to create from an extended set of polyhedron from https://www.babylonjs-playground.com/#21QRSK#15 with minimised editor\n * * faceUV an array of Vector4 elements used to set different images to the top, rings and bottom respectively\n * * faceColors an array of Color3 elements used to set different colors to the top, rings and bottom respectively\n * * flat when true creates a flat shaded mesh, optional, default true\n * * subdivisions increasing the subdivisions increases the number of faces, optional, default 4\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\n * @param options.type\n * @param options.size\n * @param options.sizeX\n * @param options.sizeY\n * @param options.sizeZ\n * @param options.custom\n * @param options.faceUV\n * @param options.faceColors\n * @param options.flat\n * @param options.sideOrientation\n * @param options.frontUVs\n * @param options.backUVs\n * @returns the VertexData of the Polyhedron\n * @deprecated use CreatePolyhedronVertexData instead\n */\n static CreatePolyhedron(options) {\n throw _WarnImport(\"polyhedronBuilder\");\n }\n /**\n * Creates the VertexData for a Capsule, inspired from https://github.com/maximeq/three-js-capsule-geometry/blob/master/src/CapsuleBufferGeometry.js\n * @param options an object used to set the following optional parameters for the capsule, required but can be empty\n * @returns the VertexData of the Capsule\n * @deprecated Please use CreateCapsuleVertexData from the capsuleBuilder file instead\n */\n static CreateCapsule(options = {\n orientation: Vector3.Up(),\n subdivisions: 2,\n tessellation: 16,\n height: 1,\n radius: 0.25,\n capSubdivisions: 6,\n }) {\n throw _WarnImport(\"capsuleBuilder\");\n }\n // based on http://code.google.com/p/away3d/source/browse/trunk/fp10/Away3D/src/away3d/primitives/TorusKnot.as?spec=svn2473&r=2473\n /**\n * Creates the VertexData for a TorusKnot\n * @param options an object used to set the following optional parameters for the TorusKnot, required but can be empty\n * * radius the radius of the torus knot, optional, default 2\n * * tube the thickness of the tube, optional, default 0.5\n * * radialSegments the number of sides on each tube segments, optional, default 32\n * * tubularSegments the number of tubes to decompose the knot into, optional, default 32\n * * p the number of windings around the z axis, optional, default 2\n * * q the number of windings around the x axis, optional, default 3\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\n * @param options.radius\n * @param options.tube\n * @param options.radialSegments\n * @param options.tubularSegments\n * @param options.p\n * @param options.q\n * @param options.sideOrientation\n * @param options.frontUVs\n * @param options.backUVs\n * @returns the VertexData of the Torus Knot\n * @deprecated use CreateTorusKnotVertexData instead\n */\n static CreateTorusKnot(options) {\n throw _WarnImport(\"torusKnotBuilder\");\n }\n // Tools\n /**\n * Compute normals for given positions and indices\n * @param positions an array of vertex positions, [...., x, y, z, ......]\n * @param indices an array of indices in groups of three for each triangular facet, [...., i, j, k, ......]\n * @param normals an array of vertex normals, [...., x, y, z, ......]\n * @param options an object used to set the following optional parameters for the TorusKnot, optional\n * * facetNormals : optional array of facet normals (vector3)\n * * facetPositions : optional array of facet positions (vector3)\n * * facetPartitioning : optional partitioning array. facetPositions is required for facetPartitioning computation\n * * ratio : optional partitioning ratio / bounding box, required for facetPartitioning computation\n * * bInfo : optional bounding info, required for facetPartitioning computation\n * * bbSize : optional bounding box size data, required for facetPartitioning computation\n * * subDiv : optional partitioning data about subdivisions on each axis (int), required for facetPartitioning computation\n * * useRightHandedSystem: optional boolean to for right handed system computation\n * * depthSort : optional boolean to enable the facet depth sort computation\n * * distanceTo : optional Vector3 to compute the facet depth from this location\n * * depthSortedFacets : optional array of depthSortedFacets to store the facet distances from the reference location\n * @param options.facetNormals\n * @param options.facetPositions\n * @param options.facetPartitioning\n * @param options.ratio\n * @param options.bInfo\n * @param options.bbSize\n * @param options.subDiv\n * @param options.useRightHandedSystem\n * @param options.depthSort\n * @param options.distanceTo\n * @param options.depthSortedFacets\n */\n static ComputeNormals(positions, indices, normals, options) {\n // temporary scalar variables\n let index = 0; // facet index\n let p1p2x = 0.0; // p1p2 vector x coordinate\n let p1p2y = 0.0; // p1p2 vector y coordinate\n let p1p2z = 0.0; // p1p2 vector z coordinate\n let p3p2x = 0.0; // p3p2 vector x coordinate\n let p3p2y = 0.0; // p3p2 vector y coordinate\n let p3p2z = 0.0; // p3p2 vector z coordinate\n let faceNormalx = 0.0; // facet normal x coordinate\n let faceNormaly = 0.0; // facet normal y coordinate\n let faceNormalz = 0.0; // facet normal z coordinate\n let length = 0.0; // facet normal length before normalization\n let v1x = 0; // vector1 x index in the positions array\n let v1y = 0; // vector1 y index in the positions array\n let v1z = 0; // vector1 z index in the positions array\n let v2x = 0; // vector2 x index in the positions array\n let v2y = 0; // vector2 y index in the positions array\n let v2z = 0; // vector2 z index in the positions array\n let v3x = 0; // vector3 x index in the positions array\n let v3y = 0; // vector3 y index in the positions array\n let v3z = 0; // vector3 z index in the positions array\n let computeFacetNormals = false;\n let computeFacetPositions = false;\n let computeFacetPartitioning = false;\n let computeDepthSort = false;\n let faceNormalSign = 1;\n let ratio = 0;\n let distanceTo = null;\n if (options) {\n computeFacetNormals = options.facetNormals ? true : false;\n computeFacetPositions = options.facetPositions ? true : false;\n computeFacetPartitioning = options.facetPartitioning ? true : false;\n faceNormalSign = options.useRightHandedSystem === true ? -1 : 1;\n ratio = options.ratio || 0;\n computeDepthSort = options.depthSort ? true : false;\n distanceTo = options.distanceTo;\n if (computeDepthSort) {\n if (distanceTo === undefined) {\n distanceTo = Vector3.Zero();\n }\n }\n }\n // facetPartitioning reinit if needed\n let xSubRatio = 0;\n let ySubRatio = 0;\n let zSubRatio = 0;\n let subSq = 0;\n if (computeFacetPartitioning && options && options.bbSize) {\n //let bbSizeMax = options.bbSize.x > options.bbSize.y ? options.bbSize.x : options.bbSize.y;\n //bbSizeMax = bbSizeMax > options.bbSize.z ? bbSizeMax : options.bbSize.z;\n xSubRatio = (options.subDiv.X * ratio) / options.bbSize.x;\n ySubRatio = (options.subDiv.Y * ratio) / options.bbSize.y;\n zSubRatio = (options.subDiv.Z * ratio) / options.bbSize.z;\n subSq = options.subDiv.max * options.subDiv.max;\n options.facetPartitioning.length = 0;\n }\n // reset the normals\n for (index = 0; index < positions.length; index++) {\n normals[index] = 0.0;\n }\n // Loop : 1 indice triplet = 1 facet\n const nbFaces = (indices.length / 3) | 0;\n for (index = 0; index < nbFaces; index++) {\n // get the indexes of the coordinates of each vertex of the facet\n v1x = indices[index * 3] * 3;\n v1y = v1x + 1;\n v1z = v1x + 2;\n v2x = indices[index * 3 + 1] * 3;\n v2y = v2x + 1;\n v2z = v2x + 2;\n v3x = indices[index * 3 + 2] * 3;\n v3y = v3x + 1;\n v3z = v3x + 2;\n p1p2x = positions[v1x] - positions[v2x]; // compute two vectors per facet : p1p2 and p3p2\n p1p2y = positions[v1y] - positions[v2y];\n p1p2z = positions[v1z] - positions[v2z];\n p3p2x = positions[v3x] - positions[v2x];\n p3p2y = positions[v3y] - positions[v2y];\n p3p2z = positions[v3z] - positions[v2z];\n // compute the face normal with the cross product\n faceNormalx = faceNormalSign * (p1p2y * p3p2z - p1p2z * p3p2y);\n faceNormaly = faceNormalSign * (p1p2z * p3p2x - p1p2x * p3p2z);\n faceNormalz = faceNormalSign * (p1p2x * p3p2y - p1p2y * p3p2x);\n // normalize this normal and store it in the array facetData\n length = Math.sqrt(faceNormalx * faceNormalx + faceNormaly * faceNormaly + faceNormalz * faceNormalz);\n length = length === 0 ? 1.0 : length;\n faceNormalx /= length;\n faceNormaly /= length;\n faceNormalz /= length;\n if (computeFacetNormals && options) {\n options.facetNormals[index].x = faceNormalx;\n options.facetNormals[index].y = faceNormaly;\n options.facetNormals[index].z = faceNormalz;\n }\n if (computeFacetPositions && options) {\n // compute and the facet barycenter coordinates in the array facetPositions\n options.facetPositions[index].x = (positions[v1x] + positions[v2x] + positions[v3x]) / 3.0;\n options.facetPositions[index].y = (positions[v1y] + positions[v2y] + positions[v3y]) / 3.0;\n options.facetPositions[index].z = (positions[v1z] + positions[v2z] + positions[v3z]) / 3.0;\n }\n if (computeFacetPartitioning && options) {\n // store the facet indexes in arrays in the main facetPartitioning array :\n // compute each facet vertex (+ facet barycenter) index in the partiniong array\n const ox = Math.floor((options.facetPositions[index].x - options.bInfo.minimum.x * ratio) * xSubRatio);\n const oy = Math.floor((options.facetPositions[index].y - options.bInfo.minimum.y * ratio) * ySubRatio);\n const oz = Math.floor((options.facetPositions[index].z - options.bInfo.minimum.z * ratio) * zSubRatio);\n const b1x = Math.floor((positions[v1x] - options.bInfo.minimum.x * ratio) * xSubRatio);\n const b1y = Math.floor((positions[v1y] - options.bInfo.minimum.y * ratio) * ySubRatio);\n const b1z = Math.floor((positions[v1z] - options.bInfo.minimum.z * ratio) * zSubRatio);\n const b2x = Math.floor((positions[v2x] - options.bInfo.minimum.x * ratio) * xSubRatio);\n const b2y = Math.floor((positions[v2y] - options.bInfo.minimum.y * ratio) * ySubRatio);\n const b2z = Math.floor((positions[v2z] - options.bInfo.minimum.z * ratio) * zSubRatio);\n const b3x = Math.floor((positions[v3x] - options.bInfo.minimum.x * ratio) * xSubRatio);\n const b3y = Math.floor((positions[v3y] - options.bInfo.minimum.y * ratio) * ySubRatio);\n const b3z = Math.floor((positions[v3z] - options.bInfo.minimum.z * ratio) * zSubRatio);\n const block_idx_v1 = b1x + options.subDiv.max * b1y + subSq * b1z;\n const block_idx_v2 = b2x + options.subDiv.max * b2y + subSq * b2z;\n const block_idx_v3 = b3x + options.subDiv.max * b3y + subSq * b3z;\n const block_idx_o = ox + options.subDiv.max * oy + subSq * oz;\n options.facetPartitioning[block_idx_o] = options.facetPartitioning[block_idx_o] ? options.facetPartitioning[block_idx_o] : new Array();\n options.facetPartitioning[block_idx_v1] = options.facetPartitioning[block_idx_v1] ? options.facetPartitioning[block_idx_v1] : new Array();\n options.facetPartitioning[block_idx_v2] = options.facetPartitioning[block_idx_v2] ? options.facetPartitioning[block_idx_v2] : new Array();\n options.facetPartitioning[block_idx_v3] = options.facetPartitioning[block_idx_v3] ? options.facetPartitioning[block_idx_v3] : new Array();\n // push each facet index in each block containing the vertex\n options.facetPartitioning[block_idx_v1].push(index);\n if (block_idx_v2 != block_idx_v1) {\n options.facetPartitioning[block_idx_v2].push(index);\n }\n if (!(block_idx_v3 == block_idx_v2 || block_idx_v3 == block_idx_v1)) {\n options.facetPartitioning[block_idx_v3].push(index);\n }\n if (!(block_idx_o == block_idx_v1 || block_idx_o == block_idx_v2 || block_idx_o == block_idx_v3)) {\n options.facetPartitioning[block_idx_o].push(index);\n }\n }\n if (computeDepthSort && options && options.facetPositions) {\n const dsf = options.depthSortedFacets[index];\n dsf.ind = index * 3;\n dsf.sqDistance = Vector3.DistanceSquared(options.facetPositions[index], distanceTo);\n }\n // compute the normals anyway\n normals[v1x] += faceNormalx; // accumulate all the normals per face\n normals[v1y] += faceNormaly;\n normals[v1z] += faceNormalz;\n normals[v2x] += faceNormalx;\n normals[v2y] += faceNormaly;\n normals[v2z] += faceNormalz;\n normals[v3x] += faceNormalx;\n normals[v3y] += faceNormaly;\n normals[v3z] += faceNormalz;\n }\n // last normalization of each normal\n for (index = 0; index < normals.length / 3; index++) {\n faceNormalx = normals[index * 3];\n faceNormaly = normals[index * 3 + 1];\n faceNormalz = normals[index * 3 + 2];\n length = Math.sqrt(faceNormalx * faceNormalx + faceNormaly * faceNormaly + faceNormalz * faceNormalz);\n length = length === 0 ? 1.0 : length;\n faceNormalx /= length;\n faceNormaly /= length;\n faceNormalz /= length;\n normals[index * 3] = faceNormalx;\n normals[index * 3 + 1] = faceNormaly;\n normals[index * 3 + 2] = faceNormalz;\n }\n }\n /**\n * @internal\n */\n static _ComputeSides(sideOrientation, positions, indices, normals, uvs, frontUVs, backUVs) {\n const li = indices.length;\n const ln = normals.length;\n let i;\n let n;\n sideOrientation = sideOrientation || VertexData.DEFAULTSIDE;\n switch (sideOrientation) {\n case VertexData.FRONTSIDE:\n // nothing changed\n break;\n case VertexData.BACKSIDE:\n // indices\n for (i = 0; i < li; i += 3) {\n const tmp = indices[i];\n indices[i] = indices[i + 2];\n indices[i + 2] = tmp;\n }\n // normals\n for (n = 0; n < ln; n++) {\n normals[n] = -normals[n];\n }\n break;\n case VertexData.DOUBLESIDE: {\n // positions\n const lp = positions.length;\n const l = lp / 3;\n for (let p = 0; p < lp; p++) {\n positions[lp + p] = positions[p];\n }\n // indices\n for (i = 0; i < li; i += 3) {\n indices[i + li] = indices[i + 2] + l;\n indices[i + 1 + li] = indices[i + 1] + l;\n indices[i + 2 + li] = indices[i] + l;\n }\n // normals\n for (n = 0; n < ln; n++) {\n normals[ln + n] = -normals[n];\n }\n // uvs\n const lu = uvs.length;\n let u = 0;\n for (u = 0; u < lu; u++) {\n uvs[u + lu] = uvs[u];\n }\n frontUVs = frontUVs ? frontUVs : new Vector4(0.0, 0.0, 1.0, 1.0);\n backUVs = backUVs ? backUVs : new Vector4(0.0, 0.0, 1.0, 1.0);\n u = 0;\n for (i = 0; i < lu / 2; i++) {\n uvs[u] = frontUVs.x + (frontUVs.z - frontUVs.x) * uvs[u];\n uvs[u + 1] = frontUVs.y + (frontUVs.w - frontUVs.y) * uvs[u + 1];\n uvs[u + lu] = backUVs.x + (backUVs.z - backUVs.x) * uvs[u + lu];\n uvs[u + lu + 1] = backUVs.y + (backUVs.w - backUVs.y) * uvs[u + lu + 1];\n u += 2;\n }\n break;\n }\n }\n }\n /**\n * Creates a VertexData from serialized data\n * @param parsedVertexData the parsed data from an imported file\n * @returns a VertexData\n */\n static Parse(parsedVertexData) {\n const vertexData = new VertexData();\n // positions\n const positions = parsedVertexData.positions;\n if (positions) {\n vertexData.set(positions, VertexBuffer.PositionKind);\n }\n // normals\n const normals = parsedVertexData.normals;\n if (normals) {\n vertexData.set(normals, VertexBuffer.NormalKind);\n }\n // tangents\n const tangents = parsedVertexData.tangents;\n if (tangents) {\n vertexData.set(tangents, VertexBuffer.TangentKind);\n }\n // uvs\n const uvs = parsedVertexData.uvs;\n if (uvs) {\n vertexData.set(uvs, VertexBuffer.UVKind);\n }\n // uv2s\n const uvs2 = parsedVertexData.uvs2;\n if (uvs2) {\n vertexData.set(uvs2, VertexBuffer.UV2Kind);\n }\n // uv3s\n const uvs3 = parsedVertexData.uvs3;\n if (uvs3) {\n vertexData.set(uvs3, VertexBuffer.UV3Kind);\n }\n // uv4s\n const uvs4 = parsedVertexData.uvs4;\n if (uvs4) {\n vertexData.set(uvs4, VertexBuffer.UV4Kind);\n }\n // uv5s\n const uvs5 = parsedVertexData.uvs5;\n if (uvs5) {\n vertexData.set(uvs5, VertexBuffer.UV5Kind);\n }\n // uv6s\n const uvs6 = parsedVertexData.uvs6;\n if (uvs6) {\n vertexData.set(uvs6, VertexBuffer.UV6Kind);\n }\n // colors\n const colors = parsedVertexData.colors;\n if (colors) {\n vertexData.set(Color4.CheckColors4(colors, positions.length / 3), VertexBuffer.ColorKind);\n }\n // matricesIndices\n const matricesIndices = parsedVertexData.matricesIndices;\n if (matricesIndices) {\n vertexData.set(matricesIndices, VertexBuffer.MatricesIndicesKind);\n }\n // matricesWeights\n const matricesWeights = parsedVertexData.matricesWeights;\n if (matricesWeights) {\n vertexData.set(matricesWeights, VertexBuffer.MatricesWeightsKind);\n }\n // indices\n const indices = parsedVertexData.indices;\n if (indices) {\n vertexData.indices = indices;\n }\n // MaterialInfos\n const materialInfos = parsedVertexData.materialInfos;\n if (materialInfos) {\n vertexData.materialInfos = [];\n for (const materialInfoFromJSON of materialInfos) {\n const materialInfo = new VertexDataMaterialInfo();\n materialInfo.indexCount = materialInfoFromJSON.indexCount;\n materialInfo.indexStart = materialInfoFromJSON.indexStart;\n materialInfo.verticesCount = materialInfoFromJSON.verticesCount;\n materialInfo.verticesStart = materialInfoFromJSON.verticesStart;\n materialInfo.materialIndex = materialInfoFromJSON.materialIndex;\n vertexData.materialInfos.push(materialInfo);\n }\n }\n return vertexData;\n }\n /**\n * Applies VertexData created from the imported parameters to the geometry\n * @param parsedVertexData the parsed data from an imported file\n * @param geometry the geometry to apply the VertexData to\n */\n static ImportVertexData(parsedVertexData, geometry) {\n const vertexData = VertexData.Parse(parsedVertexData);\n geometry.setAllVerticesData(vertexData, parsedVertexData.updatable);\n }\n}\n/**\n * Mesh side orientation : usually the external or front surface\n */\nVertexData.FRONTSIDE = 0;\n/**\n * Mesh side orientation : usually the internal or back surface\n */\nVertexData.BACKSIDE = 1;\n/**\n * Mesh side orientation : both internal and external or front and back surfaces\n */\nVertexData.DOUBLESIDE = 2;\n/**\n * Mesh side orientation : by default, `FRONTSIDE`\n */\nVertexData.DEFAULTSIDE = 0;\nVertexData._UniqueIDGenerator = 0;\n__decorate([\n nativeOverride.filter((...[coordinates]) => !Array.isArray(coordinates))\n], VertexData, \"_TransformVector3Coordinates\", null);\n__decorate([\n nativeOverride.filter((...[normals]) => !Array.isArray(normals))\n], VertexData, \"_TransformVector3Normals\", null);\n__decorate([\n nativeOverride.filter((...[normals]) => !Array.isArray(normals))\n], VertexData, \"_TransformVector4Normals\", null);\n__decorate([\n nativeOverride.filter((...[indices]) => !Array.isArray(indices))\n], VertexData, \"_FlipFaces\", null);\n//# sourceMappingURL=mesh.vertexData.js.map","\n/**\n * Class used to represent data loading progression\n */\nexport class SceneLoaderFlags {\n /**\n * Gets or sets a boolean indicating if entire scene must be loaded even if scene contains incremental data\n */\n static get ForceFullSceneLoadingForIncremental() {\n return SceneLoaderFlags._ForceFullSceneLoadingForIncremental;\n }\n static set ForceFullSceneLoadingForIncremental(value) {\n SceneLoaderFlags._ForceFullSceneLoadingForIncremental = value;\n }\n /**\n * Gets or sets a boolean indicating if loading screen must be displayed while loading a scene\n */\n static get ShowLoadingScreen() {\n return SceneLoaderFlags._ShowLoadingScreen;\n }\n static set ShowLoadingScreen(value) {\n SceneLoaderFlags._ShowLoadingScreen = value;\n }\n /**\n * Defines the current logging level (while loading the scene)\n * @ignorenaming\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n static get loggingLevel() {\n return SceneLoaderFlags._LoggingLevel;\n }\n // eslint-disable-next-line @typescript-eslint/naming-convention\n static set loggingLevel(value) {\n SceneLoaderFlags._LoggingLevel = value;\n }\n /**\n * Gets or set a boolean indicating if matrix weights must be cleaned upon loading\n */\n static get CleanBoneMatrixWeights() {\n return SceneLoaderFlags._CleanBoneMatrixWeights;\n }\n static set CleanBoneMatrixWeights(value) {\n SceneLoaderFlags._CleanBoneMatrixWeights = value;\n }\n}\n// Flags\nSceneLoaderFlags._ForceFullSceneLoadingForIncremental = false;\nSceneLoaderFlags._ShowLoadingScreen = true;\nSceneLoaderFlags._CleanBoneMatrixWeights = false;\nSceneLoaderFlags._LoggingLevel = 0;\n//# sourceMappingURL=sceneLoaderFlags.js.map","/**\n * Options used to control default behaviors regarding compatibility support\n */\nexport class CompatibilityOptions {\n}\n/**\n * Defines if the system should use OpenGL convention for UVs when creating geometry or loading .babylon files (false by default)\n */\nCompatibilityOptions.UseOpenGLOrientationForUV = false;\n//# sourceMappingURL=compatibilityOptions.js.map","import { Vector3 } from \"../Maths/math.vector.js\";\nimport { Color4 } from \"../Maths/math.color.js\";\nimport { VertexData } from \"../Meshes/mesh.vertexData.js\";\nimport { VertexBuffer } from \"../Buffers/buffer.js\";\nimport { SubMesh } from \"../Meshes/subMesh.js\";\nimport { SceneLoaderFlags } from \"../Loading/sceneLoaderFlags.js\";\nimport { BoundingInfo } from \"../Culling/boundingInfo.js\";\n\nimport { Tools } from \"../Misc/tools.js\";\nimport { Tags } from \"../Misc/tags.js\";\nimport { extractMinAndMax } from \"../Maths/math.functions.js\";\nimport { EngineStore } from \"../Engines/engineStore.js\";\nimport { CompatibilityOptions } from \"../Compat/compatibilityOptions.js\";\n/**\n * Class used to store geometry data (vertex buffers + index buffer)\n */\nexport class Geometry {\n /**\n * Gets or sets the Bias Vector to apply on the bounding elements (box/sphere), the max extend is computed as v += v * bias.x + bias.y, the min is computed as v -= v * bias.x + bias.y\n */\n get boundingBias() {\n return this._boundingBias;\n }\n /**\n * Gets or sets the Bias Vector to apply on the bounding elements (box/sphere), the max extend is computed as v += v * bias.x + bias.y, the min is computed as v -= v * bias.x + bias.y\n */\n set boundingBias(value) {\n if (this._boundingBias) {\n this._boundingBias.copyFrom(value);\n }\n else {\n this._boundingBias = value.clone();\n }\n this._updateBoundingInfo(true, null);\n }\n /**\n * Static function used to attach a new empty geometry to a mesh\n * @param mesh defines the mesh to attach the geometry to\n * @returns the new Geometry\n */\n static CreateGeometryForMesh(mesh) {\n const geometry = new Geometry(Geometry.RandomId(), mesh.getScene());\n geometry.applyToMesh(mesh);\n return geometry;\n }\n /** Get the list of meshes using this geometry */\n get meshes() {\n return this._meshes;\n }\n /**\n * Creates a new geometry\n * @param id defines the unique ID\n * @param scene defines the hosting scene\n * @param vertexData defines the VertexData used to get geometry data\n * @param updatable defines if geometry must be updatable (false by default)\n * @param mesh defines the mesh that will be associated with the geometry\n */\n constructor(id, scene, vertexData, updatable = false, mesh = null) {\n /**\n * Gets the delay loading state of the geometry (none by default which means not delayed)\n */\n this.delayLoadState = 0;\n this._totalVertices = 0;\n this._isDisposed = false;\n this._indexBufferIsUpdatable = false;\n this._positionsCache = [];\n /** @internal */\n this._parentContainer = null;\n /**\n * If set to true (false by default), the bounding info applied to the meshes sharing this geometry will be the bounding info defined at the class level\n * and won't be computed based on the vertex positions (which is what we get when useBoundingInfoFromGeometry = false)\n */\n this.useBoundingInfoFromGeometry = false;\n this._scene = scene || EngineStore.LastCreatedScene;\n if (!this._scene) {\n return;\n }\n this.id = id;\n this.uniqueId = this._scene.getUniqueId();\n this._engine = this._scene.getEngine();\n this._meshes = [];\n //Init vertex buffer cache\n this._vertexBuffers = {};\n this._indices = [];\n this._updatable = updatable;\n // vertexData\n if (vertexData) {\n this.setAllVerticesData(vertexData, updatable);\n }\n else {\n this._totalVertices = 0;\n }\n if (this._engine.getCaps().vertexArrayObject) {\n this._vertexArrayObjects = {};\n }\n // applyToMesh\n if (mesh) {\n this.applyToMesh(mesh);\n mesh.computeWorldMatrix(true);\n }\n }\n /**\n * Gets the current extend of the geometry\n */\n get extend() {\n return this._extend;\n }\n /**\n * Gets the hosting scene\n * @returns the hosting Scene\n */\n getScene() {\n return this._scene;\n }\n /**\n * Gets the hosting engine\n * @returns the hosting Engine\n */\n getEngine() {\n return this._engine;\n }\n /**\n * Defines if the geometry is ready to use\n * @returns true if the geometry is ready to be used\n */\n isReady() {\n return this.delayLoadState === 1 || this.delayLoadState === 0;\n }\n /**\n * Gets a value indicating that the geometry should not be serialized\n */\n get doNotSerialize() {\n for (let index = 0; index < this._meshes.length; index++) {\n if (!this._meshes[index].doNotSerialize) {\n return false;\n }\n }\n return true;\n }\n /** @internal */\n _rebuild() {\n if (this._vertexArrayObjects) {\n this._vertexArrayObjects = {};\n }\n // Index buffer\n if (this._meshes.length !== 0 && this._indices) {\n this._indexBuffer = this._engine.createIndexBuffer(this._indices, this._updatable);\n }\n // Vertex buffers\n for (const key in this._vertexBuffers) {\n const vertexBuffer = this._vertexBuffers[key];\n vertexBuffer._rebuild();\n }\n }\n /**\n * Affects all geometry data in one call\n * @param vertexData defines the geometry data\n * @param updatable defines if the geometry must be flagged as updatable (false as default)\n */\n setAllVerticesData(vertexData, updatable) {\n vertexData.applyToGeometry(this, updatable);\n this._notifyUpdate();\n }\n /**\n * Set specific vertex data\n * @param kind defines the data kind (Position, normal, etc...)\n * @param data defines the vertex data to use\n * @param updatable defines if the vertex must be flagged as updatable (false as default)\n * @param stride defines the stride to use (0 by default). This value is deduced from the kind value if not specified\n */\n setVerticesData(kind, data, updatable = false, stride) {\n if (updatable && Array.isArray(data)) {\n // to avoid converting to Float32Array at each draw call in engine.updateDynamicVertexBuffer, we make the conversion a single time here\n data = new Float32Array(data);\n }\n const buffer = new VertexBuffer(this._engine, data, kind, updatable, this._meshes.length === 0, stride);\n this.setVerticesBuffer(buffer);\n }\n /**\n * Removes a specific vertex data\n * @param kind defines the data kind (Position, normal, etc...)\n */\n removeVerticesData(kind) {\n if (this._vertexBuffers[kind]) {\n this._vertexBuffers[kind].dispose();\n delete this._vertexBuffers[kind];\n }\n if (this._vertexArrayObjects) {\n this._disposeVertexArrayObjects();\n }\n }\n /**\n * Affect a vertex buffer to the geometry. the vertexBuffer.getKind() function is used to determine where to store the data\n * @param buffer defines the vertex buffer to use\n * @param totalVertices defines the total number of vertices for position kind (could be null)\n * @param disposeExistingBuffer disposes the existing buffer, if any (default: true)\n */\n setVerticesBuffer(buffer, totalVertices = null, disposeExistingBuffer = true) {\n const kind = buffer.getKind();\n if (this._vertexBuffers[kind] && disposeExistingBuffer) {\n this._vertexBuffers[kind].dispose();\n }\n if (buffer._buffer) {\n buffer._buffer._increaseReferences();\n }\n this._vertexBuffers[kind] = buffer;\n const meshes = this._meshes;\n const numOfMeshes = meshes.length;\n if (kind === VertexBuffer.PositionKind) {\n const data = buffer.getData();\n if (totalVertices != null) {\n this._totalVertices = totalVertices;\n }\n else {\n if (data != null) {\n this._totalVertices = data.length / (buffer.type === VertexBuffer.BYTE ? buffer.byteStride : buffer.byteStride / 4);\n }\n }\n this._updateExtend(data);\n this._resetPointsArrayCache();\n for (let index = 0; index < numOfMeshes; index++) {\n const mesh = meshes[index];\n mesh.buildBoundingInfo(this._extend.minimum, this._extend.maximum);\n mesh._createGlobalSubMesh(mesh.isUnIndexed);\n mesh.computeWorldMatrix(true);\n mesh.synchronizeInstances();\n }\n }\n this._notifyUpdate(kind);\n }\n /**\n * Update a specific vertex buffer\n * This function will directly update the underlying DataBuffer according to the passed numeric array or Float32Array\n * It will do nothing if the buffer is not updatable\n * @param kind defines the data kind (Position, normal, etc...)\n * @param data defines the data to use\n * @param offset defines the offset in the target buffer where to store the data\n * @param useBytes set to true if the offset is in bytes\n */\n updateVerticesDataDirectly(kind, data, offset, useBytes = false) {\n const vertexBuffer = this.getVertexBuffer(kind);\n if (!vertexBuffer) {\n return;\n }\n vertexBuffer.updateDirectly(data, offset, useBytes);\n this._notifyUpdate(kind);\n }\n /**\n * Update a specific vertex buffer\n * This function will create a new buffer if the current one is not updatable\n * @param kind defines the data kind (Position, normal, etc...)\n * @param data defines the data to use\n * @param updateExtends defines if the geometry extends must be recomputed (false by default)\n */\n updateVerticesData(kind, data, updateExtends = false) {\n const vertexBuffer = this.getVertexBuffer(kind);\n if (!vertexBuffer) {\n return;\n }\n vertexBuffer.update(data);\n if (kind === VertexBuffer.PositionKind) {\n this._updateBoundingInfo(updateExtends, data);\n }\n this._notifyUpdate(kind);\n }\n _updateBoundingInfo(updateExtends, data) {\n if (updateExtends) {\n this._updateExtend(data);\n }\n this._resetPointsArrayCache();\n if (updateExtends) {\n const meshes = this._meshes;\n for (const mesh of meshes) {\n if (mesh.hasBoundingInfo) {\n mesh.getBoundingInfo().reConstruct(this._extend.minimum, this._extend.maximum);\n }\n else {\n mesh.buildBoundingInfo(this._extend.minimum, this._extend.maximum);\n }\n const subMeshes = mesh.subMeshes;\n for (const subMesh of subMeshes) {\n subMesh.refreshBoundingInfo();\n }\n }\n }\n }\n /**\n * @internal\n */\n _bind(effect, indexToBind, overrideVertexBuffers, overrideVertexArrayObjects) {\n if (!effect) {\n return;\n }\n if (indexToBind === undefined) {\n indexToBind = this._indexBuffer;\n }\n const vbs = this.getVertexBuffers();\n if (!vbs) {\n return;\n }\n if (indexToBind != this._indexBuffer || (!this._vertexArrayObjects && !overrideVertexArrayObjects)) {\n this._engine.bindBuffers(vbs, indexToBind, effect, overrideVertexBuffers);\n return;\n }\n const vaos = overrideVertexArrayObjects ? overrideVertexArrayObjects : this._vertexArrayObjects;\n // Using VAO\n if (!vaos[effect.key]) {\n vaos[effect.key] = this._engine.recordVertexArrayObject(vbs, indexToBind, effect, overrideVertexBuffers);\n }\n this._engine.bindVertexArrayObject(vaos[effect.key], indexToBind);\n }\n /**\n * Gets total number of vertices\n * @returns the total number of vertices\n */\n getTotalVertices() {\n if (!this.isReady()) {\n return 0;\n }\n return this._totalVertices;\n }\n /**\n * Gets a specific vertex data attached to this geometry. Float data is constructed if the vertex buffer data cannot be returned directly.\n * @param kind defines the data kind (Position, normal, etc...)\n * @param copyWhenShared defines if the returned array must be cloned upon returning it if the current geometry is shared between multiple meshes\n * @param forceCopy defines a boolean indicating that the returned array must be cloned upon returning it\n * @returns a float array containing vertex data\n */\n getVerticesData(kind, copyWhenShared, forceCopy) {\n const vertexBuffer = this.getVertexBuffer(kind);\n if (!vertexBuffer) {\n return null;\n }\n return vertexBuffer.getFloatData(this._totalVertices, forceCopy || (copyWhenShared && this._meshes.length !== 1));\n }\n /**\n * Returns a boolean defining if the vertex data for the requested `kind` is updatable\n * @param kind defines the data kind (Position, normal, etc...)\n * @returns true if the vertex buffer with the specified kind is updatable\n */\n isVertexBufferUpdatable(kind) {\n const vb = this._vertexBuffers[kind];\n if (!vb) {\n return false;\n }\n return vb.isUpdatable();\n }\n /**\n * Gets a specific vertex buffer\n * @param kind defines the data kind (Position, normal, etc...)\n * @returns a VertexBuffer\n */\n getVertexBuffer(kind) {\n if (!this.isReady()) {\n return null;\n }\n return this._vertexBuffers[kind];\n }\n /**\n * Returns all vertex buffers\n * @returns an object holding all vertex buffers indexed by kind\n */\n getVertexBuffers() {\n if (!this.isReady()) {\n return null;\n }\n return this._vertexBuffers;\n }\n /**\n * Gets a boolean indicating if specific vertex buffer is present\n * @param kind defines the data kind (Position, normal, etc...)\n * @returns true if data is present\n */\n isVerticesDataPresent(kind) {\n if (!this._vertexBuffers) {\n if (this._delayInfo) {\n return this._delayInfo.indexOf(kind) !== -1;\n }\n return false;\n }\n return this._vertexBuffers[kind] !== undefined;\n }\n /**\n * Gets a list of all attached data kinds (Position, normal, etc...)\n * @returns a list of string containing all kinds\n */\n getVerticesDataKinds() {\n const result = [];\n let kind;\n if (!this._vertexBuffers && this._delayInfo) {\n for (kind in this._delayInfo) {\n result.push(kind);\n }\n }\n else {\n for (kind in this._vertexBuffers) {\n result.push(kind);\n }\n }\n return result;\n }\n /**\n * Update index buffer\n * @param indices defines the indices to store in the index buffer\n * @param offset defines the offset in the target buffer where to store the data\n * @param gpuMemoryOnly defines a boolean indicating that only the GPU memory must be updated leaving the CPU version of the indices unchanged (false by default)\n */\n updateIndices(indices, offset, gpuMemoryOnly = false) {\n if (!this._indexBuffer) {\n return;\n }\n if (!this._indexBufferIsUpdatable) {\n this.setIndices(indices, null, true);\n }\n else {\n const needToUpdateSubMeshes = indices.length !== this._indices.length;\n if (!gpuMemoryOnly) {\n this._indices = indices.slice();\n }\n this._engine.updateDynamicIndexBuffer(this._indexBuffer, indices, offset);\n if (needToUpdateSubMeshes) {\n for (const mesh of this._meshes) {\n mesh._createGlobalSubMesh(true);\n }\n }\n }\n }\n /**\n * Creates a new index buffer\n * @param indices defines the indices to store in the index buffer\n * @param totalVertices defines the total number of vertices (could be null)\n * @param updatable defines if the index buffer must be flagged as updatable (false by default)\n */\n setIndices(indices, totalVertices = null, updatable = false) {\n if (this._indexBuffer) {\n this._engine._releaseBuffer(this._indexBuffer);\n }\n this._indices = indices;\n this._indexBufferIsUpdatable = updatable;\n if (this._meshes.length !== 0 && this._indices) {\n this._indexBuffer = this._engine.createIndexBuffer(this._indices, updatable);\n }\n if (totalVertices != undefined) {\n // including null and undefined\n this._totalVertices = totalVertices;\n }\n for (const mesh of this._meshes) {\n mesh._createGlobalSubMesh(true);\n mesh.synchronizeInstances();\n }\n this._notifyUpdate();\n }\n /**\n * Return the total number of indices\n * @returns the total number of indices\n */\n getTotalIndices() {\n if (!this.isReady()) {\n return 0;\n }\n return this._indices.length;\n }\n /**\n * Gets the index buffer array\n * @param copyWhenShared defines if the returned array must be cloned upon returning it if the current geometry is shared between multiple meshes\n * @param forceCopy defines a boolean indicating that the returned array must be cloned upon returning it\n * @returns the index buffer array\n */\n getIndices(copyWhenShared, forceCopy) {\n if (!this.isReady()) {\n return null;\n }\n const orig = this._indices;\n if (!forceCopy && (!copyWhenShared || this._meshes.length === 1)) {\n return orig;\n }\n else {\n return orig.slice();\n }\n }\n /**\n * Gets the index buffer\n * @returns the index buffer\n */\n getIndexBuffer() {\n if (!this.isReady()) {\n return null;\n }\n return this._indexBuffer;\n }\n /**\n * @internal\n */\n _releaseVertexArrayObject(effect = null) {\n if (!effect || !this._vertexArrayObjects) {\n return;\n }\n if (this._vertexArrayObjects[effect.key]) {\n this._engine.releaseVertexArrayObject(this._vertexArrayObjects[effect.key]);\n delete this._vertexArrayObjects[effect.key];\n }\n }\n /**\n * Release the associated resources for a specific mesh\n * @param mesh defines the source mesh\n * @param shouldDispose defines if the geometry must be disposed if there is no more mesh pointing to it\n */\n releaseForMesh(mesh, shouldDispose) {\n const meshes = this._meshes;\n const index = meshes.indexOf(mesh);\n if (index === -1) {\n return;\n }\n meshes.splice(index, 1);\n if (this._vertexArrayObjects) {\n mesh._invalidateInstanceVertexArrayObject();\n }\n mesh._geometry = null;\n if (meshes.length === 0 && shouldDispose) {\n this.dispose();\n }\n }\n /**\n * Apply current geometry to a given mesh\n * @param mesh defines the mesh to apply geometry to\n */\n applyToMesh(mesh) {\n if (mesh._geometry === this) {\n return;\n }\n const previousGeometry = mesh._geometry;\n if (previousGeometry) {\n previousGeometry.releaseForMesh(mesh);\n }\n if (this._vertexArrayObjects) {\n mesh._invalidateInstanceVertexArrayObject();\n }\n const meshes = this._meshes;\n // must be done before setting vertexBuffers because of mesh._createGlobalSubMesh()\n mesh._geometry = this;\n mesh._internalAbstractMeshDataInfo._positions = null;\n this._scene.pushGeometry(this);\n meshes.push(mesh);\n if (this.isReady()) {\n this._applyToMesh(mesh);\n }\n else if (this._boundingInfo) {\n mesh.setBoundingInfo(this._boundingInfo);\n }\n }\n _updateExtend(data = null) {\n if (this.useBoundingInfoFromGeometry && this._boundingInfo) {\n this._extend = {\n minimum: this._boundingInfo.minimum.clone(),\n maximum: this._boundingInfo.maximum.clone(),\n };\n }\n else {\n if (!data) {\n data = this.getVerticesData(VertexBuffer.PositionKind);\n // This can happen if the buffer comes from a Hardware Buffer where\n // The data have not been uploaded by Babylon. (ex: Compute Shaders and Storage Buffers)\n if (!data) {\n return;\n }\n }\n this._extend = extractMinAndMax(data, 0, this._totalVertices, this.boundingBias, 3);\n }\n }\n _applyToMesh(mesh) {\n const numOfMeshes = this._meshes.length;\n // vertexBuffers\n for (const kind in this._vertexBuffers) {\n if (numOfMeshes === 1) {\n this._vertexBuffers[kind].create();\n }\n if (kind === VertexBuffer.PositionKind) {\n if (!this._extend) {\n this._updateExtend();\n }\n mesh.buildBoundingInfo(this._extend.minimum, this._extend.maximum);\n mesh._createGlobalSubMesh(mesh.isUnIndexed);\n //bounding info was just created again, world matrix should be applied again.\n mesh._updateBoundingInfo();\n }\n }\n // indexBuffer\n if (numOfMeshes === 1 && this._indices && this._indices.length > 0) {\n this._indexBuffer = this._engine.createIndexBuffer(this._indices, this._updatable);\n }\n // morphTargets\n mesh._syncGeometryWithMorphTargetManager();\n // instances\n mesh.synchronizeInstances();\n }\n _notifyUpdate(kind) {\n if (this.onGeometryUpdated) {\n this.onGeometryUpdated(this, kind);\n }\n if (this._vertexArrayObjects) {\n this._disposeVertexArrayObjects();\n }\n for (const mesh of this._meshes) {\n mesh._markSubMeshesAsAttributesDirty();\n }\n }\n /**\n * Load the geometry if it was flagged as delay loaded\n * @param scene defines the hosting scene\n * @param onLoaded defines a callback called when the geometry is loaded\n */\n load(scene, onLoaded) {\n if (this.delayLoadState === 2) {\n return;\n }\n if (this.isReady()) {\n if (onLoaded) {\n onLoaded();\n }\n return;\n }\n this.delayLoadState = 2;\n this._queueLoad(scene, onLoaded);\n }\n _queueLoad(scene, onLoaded) {\n if (!this.delayLoadingFile) {\n return;\n }\n scene.addPendingData(this);\n scene._loadFile(this.delayLoadingFile, (data) => {\n if (!this._delayLoadingFunction) {\n return;\n }\n this._delayLoadingFunction(JSON.parse(data), this);\n this.delayLoadState = 1;\n this._delayInfo = [];\n scene.removePendingData(this);\n const meshes = this._meshes;\n const numOfMeshes = meshes.length;\n for (let index = 0; index < numOfMeshes; index++) {\n this._applyToMesh(meshes[index]);\n }\n if (onLoaded) {\n onLoaded();\n }\n }, undefined, true);\n }\n /**\n * Invert the geometry to move from a right handed system to a left handed one.\n */\n toLeftHanded() {\n // Flip faces\n const tIndices = this.getIndices(false);\n if (tIndices != null && tIndices.length > 0) {\n for (let i = 0; i < tIndices.length; i += 3) {\n const tTemp = tIndices[i + 0];\n tIndices[i + 0] = tIndices[i + 2];\n tIndices[i + 2] = tTemp;\n }\n this.setIndices(tIndices);\n }\n // Negate position.z\n const tPositions = this.getVerticesData(VertexBuffer.PositionKind, false);\n if (tPositions != null && tPositions.length > 0) {\n for (let i = 0; i < tPositions.length; i += 3) {\n tPositions[i + 2] = -tPositions[i + 2];\n }\n this.setVerticesData(VertexBuffer.PositionKind, tPositions, false);\n }\n // Negate normal.z\n const tNormals = this.getVerticesData(VertexBuffer.NormalKind, false);\n if (tNormals != null && tNormals.length > 0) {\n for (let i = 0; i < tNormals.length; i += 3) {\n tNormals[i + 2] = -tNormals[i + 2];\n }\n this.setVerticesData(VertexBuffer.NormalKind, tNormals, false);\n }\n }\n // Cache\n /** @internal */\n _resetPointsArrayCache() {\n this._positions = null;\n }\n /** @internal */\n _generatePointsArray() {\n if (this._positions) {\n return true;\n }\n const data = this.getVerticesData(VertexBuffer.PositionKind);\n if (!data || data.length === 0) {\n return false;\n }\n for (let index = this._positionsCache.length * 3, arrayIdx = this._positionsCache.length; index < data.length; index += 3, ++arrayIdx) {\n this._positionsCache[arrayIdx] = Vector3.FromArray(data, index);\n }\n for (let index = 0, arrayIdx = 0; index < data.length; index += 3, ++arrayIdx) {\n this._positionsCache[arrayIdx].set(data[0 + index], data[1 + index], data[2 + index]);\n }\n // just in case the number of positions was reduced, splice the array\n this._positionsCache.length = data.length / 3;\n this._positions = this._positionsCache;\n return true;\n }\n /**\n * Gets a value indicating if the geometry is disposed\n * @returns true if the geometry was disposed\n */\n isDisposed() {\n return this._isDisposed;\n }\n _disposeVertexArrayObjects() {\n if (this._vertexArrayObjects) {\n for (const kind in this._vertexArrayObjects) {\n this._engine.releaseVertexArrayObject(this._vertexArrayObjects[kind]);\n }\n this._vertexArrayObjects = {}; // Will trigger a rebuild of the VAO if supported\n const meshes = this._meshes;\n const numOfMeshes = meshes.length;\n for (let index = 0; index < numOfMeshes; index++) {\n meshes[index]._invalidateInstanceVertexArrayObject();\n }\n }\n }\n /**\n * Free all associated resources\n */\n dispose() {\n const meshes = this._meshes;\n const numOfMeshes = meshes.length;\n let index;\n for (index = 0; index < numOfMeshes; index++) {\n this.releaseForMesh(meshes[index]);\n }\n this._meshes.length = 0;\n this._disposeVertexArrayObjects();\n for (const kind in this._vertexBuffers) {\n this._vertexBuffers[kind].dispose();\n }\n this._vertexBuffers = {};\n this._totalVertices = 0;\n if (this._indexBuffer) {\n this._engine._releaseBuffer(this._indexBuffer);\n }\n this._indexBuffer = null;\n this._indices = [];\n this.delayLoadState = 0;\n this.delayLoadingFile = null;\n this._delayLoadingFunction = null;\n this._delayInfo = [];\n this._boundingInfo = null;\n this._scene.removeGeometry(this);\n if (this._parentContainer) {\n const index = this._parentContainer.geometries.indexOf(this);\n if (index > -1) {\n this._parentContainer.geometries.splice(index, 1);\n }\n this._parentContainer = null;\n }\n this._isDisposed = true;\n }\n /**\n * Clone the current geometry into a new geometry\n * @param id defines the unique ID of the new geometry\n * @returns a new geometry object\n */\n copy(id) {\n const vertexData = new VertexData();\n vertexData.indices = [];\n const indices = this.getIndices();\n if (indices) {\n for (let index = 0; index < indices.length; index++) {\n vertexData.indices.push(indices[index]);\n }\n }\n let updatable = false;\n let stopChecking = false;\n let kind;\n for (kind in this._vertexBuffers) {\n // using slice() to make a copy of the array and not just reference it\n const data = this.getVerticesData(kind);\n if (data) {\n if (data instanceof Float32Array) {\n vertexData.set(new Float32Array(data), kind);\n }\n else {\n vertexData.set(data.slice(0), kind);\n }\n if (!stopChecking) {\n const vb = this.getVertexBuffer(kind);\n if (vb) {\n updatable = vb.isUpdatable();\n stopChecking = !updatable;\n }\n }\n }\n }\n const geometry = new Geometry(id, this._scene, vertexData, updatable);\n geometry.delayLoadState = this.delayLoadState;\n geometry.delayLoadingFile = this.delayLoadingFile;\n geometry._delayLoadingFunction = this._delayLoadingFunction;\n for (kind in this._delayInfo) {\n geometry._delayInfo = geometry._delayInfo || [];\n geometry._delayInfo.push(kind);\n }\n // Bounding info\n geometry._boundingInfo = new BoundingInfo(this._extend.minimum, this._extend.maximum);\n return geometry;\n }\n /**\n * Serialize the current geometry info (and not the vertices data) into a JSON object\n * @returns a JSON representation of the current geometry data (without the vertices data)\n */\n serialize() {\n const serializationObject = {};\n serializationObject.id = this.id;\n serializationObject.uniqueId = this.uniqueId;\n serializationObject.updatable = this._updatable;\n if (Tags && Tags.HasTags(this)) {\n serializationObject.tags = Tags.GetTags(this);\n }\n return serializationObject;\n }\n _toNumberArray(origin) {\n if (Array.isArray(origin)) {\n return origin;\n }\n else {\n return Array.prototype.slice.call(origin);\n }\n }\n /**\n * Release any memory retained by the cached data on the Geometry.\n *\n * Call this function to reduce memory footprint of the mesh.\n * Vertex buffers will not store CPU data anymore (this will prevent picking, collisions or physics to work correctly)\n */\n clearCachedData() {\n this._indices = [];\n this._resetPointsArrayCache();\n for (const vbName in this._vertexBuffers) {\n if (!Object.prototype.hasOwnProperty.call(this._vertexBuffers, vbName)) {\n continue;\n }\n this._vertexBuffers[vbName]._buffer._data = null;\n }\n }\n /**\n * Serialize all vertices data into a JSON object\n * @returns a JSON representation of the current geometry data\n */\n serializeVerticeData() {\n const serializationObject = this.serialize();\n if (this.isVerticesDataPresent(VertexBuffer.PositionKind)) {\n serializationObject.positions = this._toNumberArray(this.getVerticesData(VertexBuffer.PositionKind));\n if (this.isVertexBufferUpdatable(VertexBuffer.PositionKind)) {\n serializationObject.positions._updatable = true;\n }\n }\n if (this.isVerticesDataPresent(VertexBuffer.NormalKind)) {\n serializationObject.normals = this._toNumberArray(this.getVerticesData(VertexBuffer.NormalKind));\n if (this.isVertexBufferUpdatable(VertexBuffer.NormalKind)) {\n serializationObject.normals._updatable = true;\n }\n }\n if (this.isVerticesDataPresent(VertexBuffer.TangentKind)) {\n serializationObject.tangents = this._toNumberArray(this.getVerticesData(VertexBuffer.TangentKind));\n if (this.isVertexBufferUpdatable(VertexBuffer.TangentKind)) {\n serializationObject.tangents._updatable = true;\n }\n }\n if (this.isVerticesDataPresent(VertexBuffer.UVKind)) {\n serializationObject.uvs = this._toNumberArray(this.getVerticesData(VertexBuffer.UVKind));\n if (this.isVertexBufferUpdatable(VertexBuffer.UVKind)) {\n serializationObject.uvs._updatable = true;\n }\n }\n if (this.isVerticesDataPresent(VertexBuffer.UV2Kind)) {\n serializationObject.uvs2 = this._toNumberArray(this.getVerticesData(VertexBuffer.UV2Kind));\n if (this.isVertexBufferUpdatable(VertexBuffer.UV2Kind)) {\n serializationObject.uvs2._updatable = true;\n }\n }\n if (this.isVerticesDataPresent(VertexBuffer.UV3Kind)) {\n serializationObject.uvs3 = this._toNumberArray(this.getVerticesData(VertexBuffer.UV3Kind));\n if (this.isVertexBufferUpdatable(VertexBuffer.UV3Kind)) {\n serializationObject.uvs3._updatable = true;\n }\n }\n if (this.isVerticesDataPresent(VertexBuffer.UV4Kind)) {\n serializationObject.uvs4 = this._toNumberArray(this.getVerticesData(VertexBuffer.UV4Kind));\n if (this.isVertexBufferUpdatable(VertexBuffer.UV4Kind)) {\n serializationObject.uvs4._updatable = true;\n }\n }\n if (this.isVerticesDataPresent(VertexBuffer.UV5Kind)) {\n serializationObject.uvs5 = this._toNumberArray(this.getVerticesData(VertexBuffer.UV5Kind));\n if (this.isVertexBufferUpdatable(VertexBuffer.UV5Kind)) {\n serializationObject.uvs5._updatable = true;\n }\n }\n if (this.isVerticesDataPresent(VertexBuffer.UV6Kind)) {\n serializationObject.uvs6 = this._toNumberArray(this.getVerticesData(VertexBuffer.UV6Kind));\n if (this.isVertexBufferUpdatable(VertexBuffer.UV6Kind)) {\n serializationObject.uvs6._updatable = true;\n }\n }\n if (this.isVerticesDataPresent(VertexBuffer.ColorKind)) {\n serializationObject.colors = this._toNumberArray(this.getVerticesData(VertexBuffer.ColorKind));\n if (this.isVertexBufferUpdatable(VertexBuffer.ColorKind)) {\n serializationObject.colors._updatable = true;\n }\n }\n if (this.isVerticesDataPresent(VertexBuffer.MatricesIndicesKind)) {\n serializationObject.matricesIndices = this._toNumberArray(this.getVerticesData(VertexBuffer.MatricesIndicesKind));\n serializationObject.matricesIndices._isExpanded = true;\n if (this.isVertexBufferUpdatable(VertexBuffer.MatricesIndicesKind)) {\n serializationObject.matricesIndices._updatable = true;\n }\n }\n if (this.isVerticesDataPresent(VertexBuffer.MatricesWeightsKind)) {\n serializationObject.matricesWeights = this._toNumberArray(this.getVerticesData(VertexBuffer.MatricesWeightsKind));\n if (this.isVertexBufferUpdatable(VertexBuffer.MatricesWeightsKind)) {\n serializationObject.matricesWeights._updatable = true;\n }\n }\n serializationObject.indices = this._toNumberArray(this.getIndices());\n return serializationObject;\n }\n // Statics\n /**\n * Extracts a clone of a mesh geometry\n * @param mesh defines the source mesh\n * @param id defines the unique ID of the new geometry object\n * @returns the new geometry object\n */\n static ExtractFromMesh(mesh, id) {\n const geometry = mesh._geometry;\n if (!geometry) {\n return null;\n }\n return geometry.copy(id);\n }\n /**\n * You should now use Tools.RandomId(), this method is still here for legacy reasons.\n * Implementation from http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#answer-2117523\n * Be aware Math.random() could cause collisions, but:\n * \"All but 6 of the 128 bits of the ID are randomly generated, which means that for any two ids, there's a 1 in 2^^122 (or 5.3x10^^36) chance they'll collide\"\n * @returns a string containing a new GUID\n */\n static RandomId() {\n return Tools.RandomId();\n }\n static _GetGeometryByLoadedUniqueId(uniqueId, scene) {\n for (let index = 0; index < scene.geometries.length; index++) {\n if (scene.geometries[index]._loadedUniqueId === uniqueId) {\n return scene.geometries[index];\n }\n }\n return null;\n }\n /**\n * @internal\n */\n static _ImportGeometry(parsedGeometry, mesh) {\n const scene = mesh.getScene();\n // Geometry\n const geometryUniqueId = parsedGeometry.geometryUniqueId;\n const geometryId = parsedGeometry.geometryId;\n if (geometryUniqueId || geometryId) {\n const geometry = geometryUniqueId ? this._GetGeometryByLoadedUniqueId(geometryUniqueId, scene) : scene.getGeometryById(geometryId);\n if (geometry) {\n geometry.applyToMesh(mesh);\n }\n }\n else if (parsedGeometry instanceof ArrayBuffer) {\n const binaryInfo = mesh._binaryInfo;\n if (binaryInfo.positionsAttrDesc && binaryInfo.positionsAttrDesc.count > 0) {\n const positionsData = new Float32Array(parsedGeometry, binaryInfo.positionsAttrDesc.offset, binaryInfo.positionsAttrDesc.count);\n mesh.setVerticesData(VertexBuffer.PositionKind, positionsData, false);\n }\n if (binaryInfo.normalsAttrDesc && binaryInfo.normalsAttrDesc.count > 0) {\n const normalsData = new Float32Array(parsedGeometry, binaryInfo.normalsAttrDesc.offset, binaryInfo.normalsAttrDesc.count);\n mesh.setVerticesData(VertexBuffer.NormalKind, normalsData, false);\n }\n if (binaryInfo.tangetsAttrDesc && binaryInfo.tangetsAttrDesc.count > 0) {\n const tangentsData = new Float32Array(parsedGeometry, binaryInfo.tangetsAttrDesc.offset, binaryInfo.tangetsAttrDesc.count);\n mesh.setVerticesData(VertexBuffer.TangentKind, tangentsData, false);\n }\n if (binaryInfo.uvsAttrDesc && binaryInfo.uvsAttrDesc.count > 0) {\n const uvsData = new Float32Array(parsedGeometry, binaryInfo.uvsAttrDesc.offset, binaryInfo.uvsAttrDesc.count);\n if (CompatibilityOptions.UseOpenGLOrientationForUV) {\n for (let index = 1; index < uvsData.length; index += 2) {\n uvsData[index] = 1 - uvsData[index];\n }\n }\n mesh.setVerticesData(VertexBuffer.UVKind, uvsData, false);\n }\n if (binaryInfo.uvs2AttrDesc && binaryInfo.uvs2AttrDesc.count > 0) {\n const uvs2Data = new Float32Array(parsedGeometry, binaryInfo.uvs2AttrDesc.offset, binaryInfo.uvs2AttrDesc.count);\n if (CompatibilityOptions.UseOpenGLOrientationForUV) {\n for (let index = 1; index < uvs2Data.length; index += 2) {\n uvs2Data[index] = 1 - uvs2Data[index];\n }\n }\n mesh.setVerticesData(VertexBuffer.UV2Kind, uvs2Data, false);\n }\n if (binaryInfo.uvs3AttrDesc && binaryInfo.uvs3AttrDesc.count > 0) {\n const uvs3Data = new Float32Array(parsedGeometry, binaryInfo.uvs3AttrDesc.offset, binaryInfo.uvs3AttrDesc.count);\n if (CompatibilityOptions.UseOpenGLOrientationForUV) {\n for (let index = 1; index < uvs3Data.length; index += 2) {\n uvs3Data[index] = 1 - uvs3Data[index];\n }\n }\n mesh.setVerticesData(VertexBuffer.UV3Kind, uvs3Data, false);\n }\n if (binaryInfo.uvs4AttrDesc && binaryInfo.uvs4AttrDesc.count > 0) {\n const uvs4Data = new Float32Array(parsedGeometry, binaryInfo.uvs4AttrDesc.offset, binaryInfo.uvs4AttrDesc.count);\n if (CompatibilityOptions.UseOpenGLOrientationForUV) {\n for (let index = 1; index < uvs4Data.length; index += 2) {\n uvs4Data[index] = 1 - uvs4Data[index];\n }\n }\n mesh.setVerticesData(VertexBuffer.UV4Kind, uvs4Data, false);\n }\n if (binaryInfo.uvs5AttrDesc && binaryInfo.uvs5AttrDesc.count > 0) {\n const uvs5Data = new Float32Array(parsedGeometry, binaryInfo.uvs5AttrDesc.offset, binaryInfo.uvs5AttrDesc.count);\n if (CompatibilityOptions.UseOpenGLOrientationForUV) {\n for (let index = 1; index < uvs5Data.length; index += 2) {\n uvs5Data[index] = 1 - uvs5Data[index];\n }\n }\n mesh.setVerticesData(VertexBuffer.UV5Kind, uvs5Data, false);\n }\n if (binaryInfo.uvs6AttrDesc && binaryInfo.uvs6AttrDesc.count > 0) {\n const uvs6Data = new Float32Array(parsedGeometry, binaryInfo.uvs6AttrDesc.offset, binaryInfo.uvs6AttrDesc.count);\n if (CompatibilityOptions.UseOpenGLOrientationForUV) {\n for (let index = 1; index < uvs6Data.length; index += 2) {\n uvs6Data[index] = 1 - uvs6Data[index];\n }\n }\n mesh.setVerticesData(VertexBuffer.UV6Kind, uvs6Data, false);\n }\n if (binaryInfo.colorsAttrDesc && binaryInfo.colorsAttrDesc.count > 0) {\n const colorsData = new Float32Array(parsedGeometry, binaryInfo.colorsAttrDesc.offset, binaryInfo.colorsAttrDesc.count);\n mesh.setVerticesData(VertexBuffer.ColorKind, colorsData, false, binaryInfo.colorsAttrDesc.stride);\n }\n if (binaryInfo.matricesIndicesAttrDesc && binaryInfo.matricesIndicesAttrDesc.count > 0) {\n const matricesIndicesData = new Int32Array(parsedGeometry, binaryInfo.matricesIndicesAttrDesc.offset, binaryInfo.matricesIndicesAttrDesc.count);\n const floatIndices = [];\n for (let i = 0; i < matricesIndicesData.length; i++) {\n const index = matricesIndicesData[i];\n floatIndices.push(index & 0x000000ff);\n floatIndices.push((index & 0x0000ff00) >> 8);\n floatIndices.push((index & 0x00ff0000) >> 16);\n floatIndices.push((index >> 24) & 0xff); // & 0xFF to convert to v + 256 if v < 0\n }\n mesh.setVerticesData(VertexBuffer.MatricesIndicesKind, floatIndices, false);\n }\n if (binaryInfo.matricesIndicesExtraAttrDesc && binaryInfo.matricesIndicesExtraAttrDesc.count > 0) {\n const matricesIndicesData = new Int32Array(parsedGeometry, binaryInfo.matricesIndicesExtraAttrDesc.offset, binaryInfo.matricesIndicesExtraAttrDesc.count);\n const floatIndices = [];\n for (let i = 0; i < matricesIndicesData.length; i++) {\n const index = matricesIndicesData[i];\n floatIndices.push(index & 0x000000ff);\n floatIndices.push((index & 0x0000ff00) >> 8);\n floatIndices.push((index & 0x00ff0000) >> 16);\n floatIndices.push((index >> 24) & 0xff); // & 0xFF to convert to v + 256 if v < 0\n }\n mesh.setVerticesData(VertexBuffer.MatricesIndicesExtraKind, floatIndices, false);\n }\n if (binaryInfo.matricesWeightsAttrDesc && binaryInfo.matricesWeightsAttrDesc.count > 0) {\n const matricesWeightsData = new Float32Array(parsedGeometry, binaryInfo.matricesWeightsAttrDesc.offset, binaryInfo.matricesWeightsAttrDesc.count);\n mesh.setVerticesData(VertexBuffer.MatricesWeightsKind, matricesWeightsData, false);\n }\n if (binaryInfo.indicesAttrDesc && binaryInfo.indicesAttrDesc.count > 0) {\n const indicesData = new Int32Array(parsedGeometry, binaryInfo.indicesAttrDesc.offset, binaryInfo.indicesAttrDesc.count);\n mesh.setIndices(indicesData, null);\n }\n if (binaryInfo.subMeshesAttrDesc && binaryInfo.subMeshesAttrDesc.count > 0) {\n const subMeshesData = new Int32Array(parsedGeometry, binaryInfo.subMeshesAttrDesc.offset, binaryInfo.subMeshesAttrDesc.count * 5);\n mesh.subMeshes = [];\n for (let i = 0; i < binaryInfo.subMeshesAttrDesc.count; i++) {\n const materialIndex = subMeshesData[i * 5 + 0];\n const verticesStart = subMeshesData[i * 5 + 1];\n const verticesCount = subMeshesData[i * 5 + 2];\n const indexStart = subMeshesData[i * 5 + 3];\n const indexCount = subMeshesData[i * 5 + 4];\n SubMesh.AddToMesh(materialIndex, verticesStart, verticesCount, indexStart, indexCount, mesh);\n }\n }\n }\n else if (parsedGeometry.positions && parsedGeometry.normals && parsedGeometry.indices) {\n mesh.setVerticesData(VertexBuffer.PositionKind, parsedGeometry.positions, parsedGeometry.positions._updatable);\n mesh.setVerticesData(VertexBuffer.NormalKind, parsedGeometry.normals, parsedGeometry.normals._updatable);\n if (parsedGeometry.tangents) {\n mesh.setVerticesData(VertexBuffer.TangentKind, parsedGeometry.tangents, parsedGeometry.tangents._updatable);\n }\n if (parsedGeometry.uvs) {\n mesh.setVerticesData(VertexBuffer.UVKind, parsedGeometry.uvs, parsedGeometry.uvs._updatable);\n }\n if (parsedGeometry.uvs2) {\n mesh.setVerticesData(VertexBuffer.UV2Kind, parsedGeometry.uvs2, parsedGeometry.uvs2._updatable);\n }\n if (parsedGeometry.uvs3) {\n mesh.setVerticesData(VertexBuffer.UV3Kind, parsedGeometry.uvs3, parsedGeometry.uvs3._updatable);\n }\n if (parsedGeometry.uvs4) {\n mesh.setVerticesData(VertexBuffer.UV4Kind, parsedGeometry.uvs4, parsedGeometry.uvs4._updatable);\n }\n if (parsedGeometry.uvs5) {\n mesh.setVerticesData(VertexBuffer.UV5Kind, parsedGeometry.uvs5, parsedGeometry.uvs5._updatable);\n }\n if (parsedGeometry.uvs6) {\n mesh.setVerticesData(VertexBuffer.UV6Kind, parsedGeometry.uvs6, parsedGeometry.uvs6._updatable);\n }\n if (parsedGeometry.colors) {\n mesh.setVerticesData(VertexBuffer.ColorKind, Color4.CheckColors4(parsedGeometry.colors, parsedGeometry.positions.length / 3), parsedGeometry.colors._updatable);\n }\n if (parsedGeometry.matricesIndices) {\n if (!parsedGeometry.matricesIndices._isExpanded) {\n const floatIndices = [];\n for (let i = 0; i < parsedGeometry.matricesIndices.length; i++) {\n const matricesIndex = parsedGeometry.matricesIndices[i];\n floatIndices.push(matricesIndex & 0x000000ff);\n floatIndices.push((matricesIndex & 0x0000ff00) >> 8);\n floatIndices.push((matricesIndex & 0x00ff0000) >> 16);\n floatIndices.push((matricesIndex >> 24) & 0xff); // & 0xFF to convert to v + 256 if v < 0\n }\n mesh.setVerticesData(VertexBuffer.MatricesIndicesKind, floatIndices, parsedGeometry.matricesIndices._updatable);\n }\n else {\n delete parsedGeometry.matricesIndices._isExpanded;\n mesh.setVerticesData(VertexBuffer.MatricesIndicesKind, parsedGeometry.matricesIndices, parsedGeometry.matricesIndices._updatable);\n }\n }\n if (parsedGeometry.matricesIndicesExtra) {\n if (!parsedGeometry.matricesIndicesExtra._isExpanded) {\n const floatIndices = [];\n for (let i = 0; i < parsedGeometry.matricesIndicesExtra.length; i++) {\n const matricesIndex = parsedGeometry.matricesIndicesExtra[i];\n floatIndices.push(matricesIndex & 0x000000ff);\n floatIndices.push((matricesIndex & 0x0000ff00) >> 8);\n floatIndices.push((matricesIndex & 0x00ff0000) >> 16);\n floatIndices.push((matricesIndex >> 24) & 0xff); // & 0xFF to convert to v + 256 if v < 0\n }\n mesh.setVerticesData(VertexBuffer.MatricesIndicesExtraKind, floatIndices, parsedGeometry.matricesIndicesExtra._updatable);\n }\n else {\n delete parsedGeometry.matricesIndices._isExpanded;\n mesh.setVerticesData(VertexBuffer.MatricesIndicesExtraKind, parsedGeometry.matricesIndicesExtra, parsedGeometry.matricesIndicesExtra._updatable);\n }\n }\n if (parsedGeometry.matricesWeights) {\n Geometry._CleanMatricesWeights(parsedGeometry, mesh);\n mesh.setVerticesData(VertexBuffer.MatricesWeightsKind, parsedGeometry.matricesWeights, parsedGeometry.matricesWeights._updatable);\n }\n if (parsedGeometry.matricesWeightsExtra) {\n mesh.setVerticesData(VertexBuffer.MatricesWeightsExtraKind, parsedGeometry.matricesWeightsExtra, parsedGeometry.matricesWeights._updatable);\n }\n mesh.setIndices(parsedGeometry.indices, null);\n }\n // SubMeshes\n if (parsedGeometry.subMeshes) {\n mesh.subMeshes = [];\n for (let subIndex = 0; subIndex < parsedGeometry.subMeshes.length; subIndex++) {\n const parsedSubMesh = parsedGeometry.subMeshes[subIndex];\n SubMesh.AddToMesh(parsedSubMesh.materialIndex, parsedSubMesh.verticesStart, parsedSubMesh.verticesCount, parsedSubMesh.indexStart, parsedSubMesh.indexCount, mesh);\n }\n }\n // Flat shading\n if (mesh._shouldGenerateFlatShading) {\n mesh.convertToFlatShadedMesh();\n mesh._shouldGenerateFlatShading = false;\n }\n // Update\n mesh.computeWorldMatrix(true);\n scene.onMeshImportedObservable.notifyObservers(mesh);\n }\n static _CleanMatricesWeights(parsedGeometry, mesh) {\n const epsilon = 1e-3;\n if (!SceneLoaderFlags.CleanBoneMatrixWeights) {\n return;\n }\n let noInfluenceBoneIndex = 0.0;\n if (parsedGeometry.skeletonId > -1) {\n const skeleton = mesh.getScene().getLastSkeletonById(parsedGeometry.skeletonId);\n if (!skeleton) {\n return;\n }\n noInfluenceBoneIndex = skeleton.bones.length;\n }\n else {\n return;\n }\n const matricesIndices = mesh.getVerticesData(VertexBuffer.MatricesIndicesKind);\n const matricesIndicesExtra = mesh.getVerticesData(VertexBuffer.MatricesIndicesExtraKind);\n const matricesWeights = parsedGeometry.matricesWeights;\n const matricesWeightsExtra = parsedGeometry.matricesWeightsExtra;\n const influencers = parsedGeometry.numBoneInfluencer;\n const size = matricesWeights.length;\n for (let i = 0; i < size; i += 4) {\n let weight = 0.0;\n let firstZeroWeight = -1;\n for (let j = 0; j < 4; j++) {\n const w = matricesWeights[i + j];\n weight += w;\n if (w < epsilon && firstZeroWeight < 0) {\n firstZeroWeight = j;\n }\n }\n if (matricesWeightsExtra) {\n for (let j = 0; j < 4; j++) {\n const w = matricesWeightsExtra[i + j];\n weight += w;\n if (w < epsilon && firstZeroWeight < 0) {\n firstZeroWeight = j + 4;\n }\n }\n }\n if (firstZeroWeight < 0 || firstZeroWeight > influencers - 1) {\n firstZeroWeight = influencers - 1;\n }\n if (weight > epsilon) {\n const mweight = 1.0 / weight;\n for (let j = 0; j < 4; j++) {\n matricesWeights[i + j] *= mweight;\n }\n if (matricesWeightsExtra) {\n for (let j = 0; j < 4; j++) {\n matricesWeightsExtra[i + j] *= mweight;\n }\n }\n }\n else {\n if (firstZeroWeight >= 4) {\n matricesWeightsExtra[i + firstZeroWeight - 4] = 1.0 - weight;\n matricesIndicesExtra[i + firstZeroWeight - 4] = noInfluenceBoneIndex;\n }\n else {\n matricesWeights[i + firstZeroWeight] = 1.0 - weight;\n matricesIndices[i + firstZeroWeight] = noInfluenceBoneIndex;\n }\n }\n }\n mesh.setVerticesData(VertexBuffer.MatricesIndicesKind, matricesIndices);\n if (parsedGeometry.matricesWeightsExtra) {\n mesh.setVerticesData(VertexBuffer.MatricesIndicesExtraKind, matricesIndicesExtra);\n }\n }\n /**\n * Create a new geometry from persisted data (Using .babylon file format)\n * @param parsedVertexData defines the persisted data\n * @param scene defines the hosting scene\n * @param rootUrl defines the root url to use to load assets (like delayed data)\n * @returns the new geometry object\n */\n static Parse(parsedVertexData, scene, rootUrl) {\n const geometry = new Geometry(parsedVertexData.id, scene, undefined, parsedVertexData.updatable);\n geometry._loadedUniqueId = parsedVertexData.uniqueId;\n if (Tags) {\n Tags.AddTagsTo(geometry, parsedVertexData.tags);\n }\n if (parsedVertexData.delayLoadingFile) {\n geometry.delayLoadState = 4;\n geometry.delayLoadingFile = rootUrl + parsedVertexData.delayLoadingFile;\n geometry._boundingInfo = new BoundingInfo(Vector3.FromArray(parsedVertexData.boundingBoxMinimum), Vector3.FromArray(parsedVertexData.boundingBoxMaximum));\n geometry._delayInfo = [];\n if (parsedVertexData.hasUVs) {\n geometry._delayInfo.push(VertexBuffer.UVKind);\n }\n if (parsedVertexData.hasUVs2) {\n geometry._delayInfo.push(VertexBuffer.UV2Kind);\n }\n if (parsedVertexData.hasUVs3) {\n geometry._delayInfo.push(VertexBuffer.UV3Kind);\n }\n if (parsedVertexData.hasUVs4) {\n geometry._delayInfo.push(VertexBuffer.UV4Kind);\n }\n if (parsedVertexData.hasUVs5) {\n geometry._delayInfo.push(VertexBuffer.UV5Kind);\n }\n if (parsedVertexData.hasUVs6) {\n geometry._delayInfo.push(VertexBuffer.UV6Kind);\n }\n if (parsedVertexData.hasColors) {\n geometry._delayInfo.push(VertexBuffer.ColorKind);\n }\n if (parsedVertexData.hasMatricesIndices) {\n geometry._delayInfo.push(VertexBuffer.MatricesIndicesKind);\n }\n if (parsedVertexData.hasMatricesWeights) {\n geometry._delayInfo.push(VertexBuffer.MatricesWeightsKind);\n }\n geometry._delayLoadingFunction = VertexData.ImportVertexData;\n }\n else {\n VertexData.ImportVertexData(parsedVertexData, geometry);\n }\n scene.pushGeometry(geometry, true);\n return geometry;\n }\n}\n//# sourceMappingURL=geometry.js.map","import { __decorate } from \"../tslib.es6.js\";\nimport { serialize, serializeAsVector3, serializeAsQuaternion, SerializationHelper } from \"../Misc/decorators.js\";\nimport { Observable } from \"../Misc/observable.js\";\nimport { Quaternion, Matrix, Vector3, TmpVectors } from \"../Maths/math.vector.js\";\nimport { Node } from \"../node.js\";\nimport { Space } from \"../Maths/math.axis.js\";\nconst convertRHSToLHS = Matrix.Compose(Vector3.One(), Quaternion.FromEulerAngles(0, Math.PI, 0), Vector3.Zero());\n/**\n * A TransformNode is an object that is not rendered but can be used as a center of transformation. This can decrease memory usage and increase rendering speed compared to using an empty mesh as a parent and is less complicated than using a pivot matrix.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/transforms/parent_pivot/transform_node\n */\nexport class TransformNode extends Node {\n /**\n * Gets or sets the billboard mode. Default is 0.\n *\n * | Value | Type | Description |\n * | --- | --- | --- |\n * | 0 | BILLBOARDMODE_NONE | |\n * | 1 | BILLBOARDMODE_X | |\n * | 2 | BILLBOARDMODE_Y | |\n * | 4 | BILLBOARDMODE_Z | |\n * | 7 | BILLBOARDMODE_ALL | |\n *\n */\n get billboardMode() {\n return this._billboardMode;\n }\n set billboardMode(value) {\n if (this._billboardMode === value) {\n return;\n }\n this._billboardMode = value;\n this._cache.useBillboardPosition = (this._billboardMode & TransformNode.BILLBOARDMODE_USE_POSITION) !== 0;\n this._computeUseBillboardPath();\n }\n /**\n * Gets or sets a boolean indicating that parent rotation should be preserved when using billboards.\n * This could be useful for glTF objects where parent rotation helps converting from right handed to left handed\n */\n get preserveParentRotationForBillboard() {\n return this._preserveParentRotationForBillboard;\n }\n set preserveParentRotationForBillboard(value) {\n if (value === this._preserveParentRotationForBillboard) {\n return;\n }\n this._preserveParentRotationForBillboard = value;\n this._computeUseBillboardPath();\n }\n _computeUseBillboardPath() {\n this._cache.useBillboardPath = this._billboardMode !== TransformNode.BILLBOARDMODE_NONE && !this.preserveParentRotationForBillboard;\n }\n /**\n * Gets or sets the distance of the object to max, often used by skybox\n */\n get infiniteDistance() {\n return this._infiniteDistance;\n }\n set infiniteDistance(value) {\n if (this._infiniteDistance === value) {\n return;\n }\n this._infiniteDistance = value;\n }\n constructor(name, scene = null, isPure = true) {\n super(name, scene);\n this._forward = new Vector3(0, 0, 1);\n this._up = new Vector3(0, 1, 0);\n this._right = new Vector3(1, 0, 0);\n // Properties\n this._position = Vector3.Zero();\n this._rotation = Vector3.Zero();\n this._rotationQuaternion = null;\n this._scaling = Vector3.One();\n this._transformToBoneReferal = null;\n this._isAbsoluteSynced = false;\n this._billboardMode = TransformNode.BILLBOARDMODE_NONE;\n this._preserveParentRotationForBillboard = false;\n /**\n * Multiplication factor on scale x/y/z when computing the world matrix. Eg. for a 1x1x1 cube setting this to 2 will make it a 2x2x2 cube\n */\n this.scalingDeterminant = 1;\n this._infiniteDistance = false;\n /**\n * Gets or sets a boolean indicating that non uniform scaling (when at least one component is different from others) should be ignored.\n * By default the system will update normals to compensate\n */\n this.ignoreNonUniformScaling = false;\n /**\n * Gets or sets a boolean indicating that even if rotationQuaternion is defined, you can keep updating rotation property and Babylon.js will just mix both\n */\n this.reIntegrateRotationIntoRotationQuaternion = false;\n // Cache\n /** @internal */\n this._poseMatrix = null;\n /** @internal */\n this._localMatrix = Matrix.Zero();\n this._usePivotMatrix = false;\n this._absolutePosition = Vector3.Zero();\n this._absoluteScaling = Vector3.Zero();\n this._absoluteRotationQuaternion = Quaternion.Identity();\n this._pivotMatrix = Matrix.Identity();\n /** @internal */\n this._postMultiplyPivotMatrix = false;\n this._isWorldMatrixFrozen = false;\n /** @internal */\n this._indexInSceneTransformNodesArray = -1;\n /**\n * An event triggered after the world matrix is updated\n */\n this.onAfterWorldMatrixUpdateObservable = new Observable();\n this._nonUniformScaling = false;\n if (isPure) {\n this.getScene().addTransformNode(this);\n }\n }\n /**\n * Gets a string identifying the name of the class\n * @returns \"TransformNode\" string\n */\n getClassName() {\n return \"TransformNode\";\n }\n /**\n * Gets or set the node position (default is (0.0, 0.0, 0.0))\n */\n get position() {\n return this._position;\n }\n set position(newPosition) {\n this._position = newPosition;\n this._isDirty = true;\n }\n /**\n * return true if a pivot has been set\n * @returns true if a pivot matrix is used\n */\n isUsingPivotMatrix() {\n return this._usePivotMatrix;\n }\n /**\n * Gets or sets the rotation property : a Vector3 defining the rotation value in radians around each local axis X, Y, Z (default is (0.0, 0.0, 0.0)).\n * If rotation quaternion is set, this Vector3 will be ignored and copy from the quaternion\n */\n get rotation() {\n return this._rotation;\n }\n set rotation(newRotation) {\n this._rotation = newRotation;\n this._rotationQuaternion = null;\n this._isDirty = true;\n }\n /**\n * Gets or sets the scaling property : a Vector3 defining the node scaling along each local axis X, Y, Z (default is (1.0, 1.0, 1.0)).\n */\n get scaling() {\n return this._scaling;\n }\n set scaling(newScaling) {\n this._scaling = newScaling;\n this._isDirty = true;\n }\n /**\n * Gets or sets the rotation Quaternion property : this a Quaternion object defining the node rotation by using a unit quaternion (undefined by default, but can be null).\n * If set, only the rotationQuaternion is then used to compute the node rotation (ie. node.rotation will be ignored)\n */\n get rotationQuaternion() {\n return this._rotationQuaternion;\n }\n set rotationQuaternion(quaternion) {\n this._rotationQuaternion = quaternion;\n //reset the rotation vector.\n if (quaternion) {\n this._rotation.setAll(0.0);\n }\n this._isDirty = true;\n }\n /**\n * The forward direction of that transform in world space.\n */\n get forward() {\n Vector3.TransformNormalFromFloatsToRef(0, 0, this.getScene().useRightHandedSystem ? -1.0 : 1.0, this.getWorldMatrix(), this._forward);\n return this._forward.normalize();\n }\n /**\n * The up direction of that transform in world space.\n */\n get up() {\n Vector3.TransformNormalFromFloatsToRef(0, 1, 0, this.getWorldMatrix(), this._up);\n return this._up.normalize();\n }\n /**\n * The right direction of that transform in world space.\n */\n get right() {\n Vector3.TransformNormalFromFloatsToRef(this.getScene().useRightHandedSystem ? -1.0 : 1.0, 0, 0, this.getWorldMatrix(), this._right);\n return this._right.normalize();\n }\n /**\n * Copies the parameter passed Matrix into the mesh Pose matrix.\n * @param matrix the matrix to copy the pose from\n * @returns this TransformNode.\n */\n updatePoseMatrix(matrix) {\n if (!this._poseMatrix) {\n this._poseMatrix = matrix.clone();\n return this;\n }\n this._poseMatrix.copyFrom(matrix);\n return this;\n }\n /**\n * Returns the mesh Pose matrix.\n * @returns the pose matrix\n */\n getPoseMatrix() {\n if (!this._poseMatrix) {\n this._poseMatrix = Matrix.Identity();\n }\n return this._poseMatrix;\n }\n /** @internal */\n _isSynchronized() {\n const cache = this._cache;\n if (this._billboardMode !== cache.billboardMode || this._billboardMode !== TransformNode.BILLBOARDMODE_NONE) {\n return false;\n }\n if (cache.pivotMatrixUpdated) {\n return false;\n }\n if (this._infiniteDistance) {\n return false;\n }\n if (this._position._isDirty) {\n return false;\n }\n if (this._scaling._isDirty) {\n return false;\n }\n if ((this._rotationQuaternion && this._rotationQuaternion._isDirty) || this._rotation._isDirty) {\n return false;\n }\n return true;\n }\n /** @internal */\n _initCache() {\n super._initCache();\n const cache = this._cache;\n cache.localMatrixUpdated = false;\n cache.billboardMode = -1;\n cache.infiniteDistance = false;\n cache.useBillboardPosition = false;\n cache.useBillboardPath = false;\n }\n /**\n * Returns the current mesh absolute position.\n * Returns a Vector3.\n */\n get absolutePosition() {\n return this.getAbsolutePosition();\n }\n /**\n * Returns the current mesh absolute scaling.\n * Returns a Vector3.\n */\n get absoluteScaling() {\n this._syncAbsoluteScalingAndRotation();\n return this._absoluteScaling;\n }\n /**\n * Returns the current mesh absolute rotation.\n * Returns a Quaternion.\n */\n get absoluteRotationQuaternion() {\n this._syncAbsoluteScalingAndRotation();\n return this._absoluteRotationQuaternion;\n }\n /**\n * Sets a new matrix to apply before all other transformation\n * @param matrix defines the transform matrix\n * @returns the current TransformNode\n */\n setPreTransformMatrix(matrix) {\n return this.setPivotMatrix(matrix, false);\n }\n /**\n * Sets a new pivot matrix to the current node\n * @param matrix defines the new pivot matrix to use\n * @param postMultiplyPivotMatrix defines if the pivot matrix must be cancelled in the world matrix. When this parameter is set to true (default), the inverse of the pivot matrix is also applied at the end to cancel the transformation effect\n * @returns the current TransformNode\n */\n setPivotMatrix(matrix, postMultiplyPivotMatrix = true) {\n this._pivotMatrix.copyFrom(matrix);\n this._usePivotMatrix = !this._pivotMatrix.isIdentity();\n this._cache.pivotMatrixUpdated = true;\n this._postMultiplyPivotMatrix = postMultiplyPivotMatrix;\n if (this._postMultiplyPivotMatrix) {\n if (!this._pivotMatrixInverse) {\n this._pivotMatrixInverse = Matrix.Invert(this._pivotMatrix);\n }\n else {\n this._pivotMatrix.invertToRef(this._pivotMatrixInverse);\n }\n }\n return this;\n }\n /**\n * Returns the mesh pivot matrix.\n * Default : Identity.\n * @returns the matrix\n */\n getPivotMatrix() {\n return this._pivotMatrix;\n }\n /**\n * Instantiate (when possible) or clone that node with its hierarchy\n * @param newParent defines the new parent to use for the instance (or clone)\n * @param options defines options to configure how copy is done\n * @param options.doNotInstantiate defines if the model must be instantiated or just cloned\n * @param onNewNodeCreated defines an option callback to call when a clone or an instance is created\n * @returns an instance (or a clone) of the current node with its hierarchy\n */\n instantiateHierarchy(newParent = null, options, onNewNodeCreated) {\n const clone = this.clone(\"Clone of \" + (this.name || this.id), newParent || this.parent, true);\n if (clone) {\n if (onNewNodeCreated) {\n onNewNodeCreated(this, clone);\n }\n }\n for (const child of this.getChildTransformNodes(true)) {\n child.instantiateHierarchy(clone, options, onNewNodeCreated);\n }\n return clone;\n }\n /**\n * Prevents the World matrix to be computed any longer\n * @param newWorldMatrix defines an optional matrix to use as world matrix\n * @param decompose defines whether to decompose the given newWorldMatrix or directly assign\n * @returns the TransformNode.\n */\n freezeWorldMatrix(newWorldMatrix = null, decompose = false) {\n if (newWorldMatrix) {\n if (decompose) {\n this._rotation.setAll(0);\n this._rotationQuaternion = this._rotationQuaternion || Quaternion.Identity();\n newWorldMatrix.decompose(this._scaling, this._rotationQuaternion, this._position);\n this.computeWorldMatrix(true);\n }\n else {\n this._worldMatrix = newWorldMatrix;\n this._absolutePosition.copyFromFloats(this._worldMatrix.m[12], this._worldMatrix.m[13], this._worldMatrix.m[14]);\n this._afterComputeWorldMatrix();\n }\n }\n else {\n this._isWorldMatrixFrozen = false; // no guarantee world is not already frozen, switch off temporarily\n this.computeWorldMatrix(true);\n }\n this._isDirty = false;\n this._isWorldMatrixFrozen = true;\n return this;\n }\n /**\n * Allows back the World matrix computation.\n * @returns the TransformNode.\n */\n unfreezeWorldMatrix() {\n this._isWorldMatrixFrozen = false;\n this.computeWorldMatrix(true);\n return this;\n }\n /**\n * True if the World matrix has been frozen.\n */\n get isWorldMatrixFrozen() {\n return this._isWorldMatrixFrozen;\n }\n /**\n * Returns the mesh absolute position in the World.\n * @returns a Vector3.\n */\n getAbsolutePosition() {\n this.computeWorldMatrix();\n return this._absolutePosition;\n }\n /**\n * Sets the mesh absolute position in the World from a Vector3 or an Array(3).\n * @param absolutePosition the absolute position to set\n * @returns the TransformNode.\n */\n setAbsolutePosition(absolutePosition) {\n if (!absolutePosition) {\n return this;\n }\n let absolutePositionX;\n let absolutePositionY;\n let absolutePositionZ;\n if (absolutePosition.x === undefined) {\n if (arguments.length < 3) {\n return this;\n }\n absolutePositionX = arguments[0];\n absolutePositionY = arguments[1];\n absolutePositionZ = arguments[2];\n }\n else {\n absolutePositionX = absolutePosition.x;\n absolutePositionY = absolutePosition.y;\n absolutePositionZ = absolutePosition.z;\n }\n if (this.parent) {\n const invertParentWorldMatrix = TmpVectors.Matrix[0];\n this.parent.getWorldMatrix().invertToRef(invertParentWorldMatrix);\n Vector3.TransformCoordinatesFromFloatsToRef(absolutePositionX, absolutePositionY, absolutePositionZ, invertParentWorldMatrix, this.position);\n }\n else {\n this.position.x = absolutePositionX;\n this.position.y = absolutePositionY;\n this.position.z = absolutePositionZ;\n }\n this._absolutePosition.copyFrom(absolutePosition);\n return this;\n }\n /**\n * Sets the mesh position in its local space.\n * @param vector3 the position to set in localspace\n * @returns the TransformNode.\n */\n setPositionWithLocalVector(vector3) {\n this.computeWorldMatrix();\n this.position = Vector3.TransformNormal(vector3, this._localMatrix);\n return this;\n }\n /**\n * Returns the mesh position in the local space from the current World matrix values.\n * @returns a new Vector3.\n */\n getPositionExpressedInLocalSpace() {\n this.computeWorldMatrix();\n const invLocalWorldMatrix = TmpVectors.Matrix[0];\n this._localMatrix.invertToRef(invLocalWorldMatrix);\n return Vector3.TransformNormal(this.position, invLocalWorldMatrix);\n }\n /**\n * Translates the mesh along the passed Vector3 in its local space.\n * @param vector3 the distance to translate in localspace\n * @returns the TransformNode.\n */\n locallyTranslate(vector3) {\n this.computeWorldMatrix(true);\n this.position = Vector3.TransformCoordinates(vector3, this._localMatrix);\n return this;\n }\n /**\n * Orients a mesh towards a target point. Mesh must be drawn facing user.\n * @param targetPoint the position (must be in same space as current mesh) to look at\n * @param yawCor optional yaw (y-axis) correction in radians\n * @param pitchCor optional pitch (x-axis) correction in radians\n * @param rollCor optional roll (z-axis) correction in radians\n * @param space the chosen space of the target\n * @returns the TransformNode.\n */\n lookAt(targetPoint, yawCor = 0, pitchCor = 0, rollCor = 0, space = Space.LOCAL) {\n const dv = TransformNode._LookAtVectorCache;\n const pos = space === Space.LOCAL ? this.position : this.getAbsolutePosition();\n targetPoint.subtractToRef(pos, dv);\n this.setDirection(dv, yawCor, pitchCor, rollCor);\n // Correct for parent's rotation offset\n if (space === Space.WORLD && this.parent) {\n if (this.rotationQuaternion) {\n // Get local rotation matrix of the looking object\n const rotationMatrix = TmpVectors.Matrix[0];\n this.rotationQuaternion.toRotationMatrix(rotationMatrix);\n // Offset rotation by parent's inverted rotation matrix to correct in world space\n const parentRotationMatrix = TmpVectors.Matrix[1];\n this.parent.getWorldMatrix().getRotationMatrixToRef(parentRotationMatrix);\n parentRotationMatrix.invert();\n rotationMatrix.multiplyToRef(parentRotationMatrix, rotationMatrix);\n this.rotationQuaternion.fromRotationMatrix(rotationMatrix);\n }\n else {\n // Get local rotation matrix of the looking object\n const quaternionRotation = TmpVectors.Quaternion[0];\n Quaternion.FromEulerVectorToRef(this.rotation, quaternionRotation);\n const rotationMatrix = TmpVectors.Matrix[0];\n quaternionRotation.toRotationMatrix(rotationMatrix);\n // Offset rotation by parent's inverted rotation matrix to correct in world space\n const parentRotationMatrix = TmpVectors.Matrix[1];\n this.parent.getWorldMatrix().getRotationMatrixToRef(parentRotationMatrix);\n parentRotationMatrix.invert();\n rotationMatrix.multiplyToRef(parentRotationMatrix, rotationMatrix);\n quaternionRotation.fromRotationMatrix(rotationMatrix);\n quaternionRotation.toEulerAnglesToRef(this.rotation);\n }\n }\n return this;\n }\n /**\n * Returns a new Vector3 that is the localAxis, expressed in the mesh local space, rotated like the mesh.\n * This Vector3 is expressed in the World space.\n * @param localAxis axis to rotate\n * @returns a new Vector3 that is the localAxis, expressed in the mesh local space, rotated like the mesh.\n */\n getDirection(localAxis) {\n const result = Vector3.Zero();\n this.getDirectionToRef(localAxis, result);\n return result;\n }\n /**\n * Sets the Vector3 \"result\" as the rotated Vector3 \"localAxis\" in the same rotation than the mesh.\n * localAxis is expressed in the mesh local space.\n * result is computed in the World space from the mesh World matrix.\n * @param localAxis axis to rotate\n * @param result the resulting transformnode\n * @returns this TransformNode.\n */\n getDirectionToRef(localAxis, result) {\n Vector3.TransformNormalToRef(localAxis, this.getWorldMatrix(), result);\n return this;\n }\n /**\n * Sets this transform node rotation to the given local axis.\n * @param localAxis the axis in local space\n * @param yawCor optional yaw (y-axis) correction in radians\n * @param pitchCor optional pitch (x-axis) correction in radians\n * @param rollCor optional roll (z-axis) correction in radians\n * @returns this TransformNode\n */\n setDirection(localAxis, yawCor = 0, pitchCor = 0, rollCor = 0) {\n const yaw = -Math.atan2(localAxis.z, localAxis.x) + Math.PI / 2;\n const len = Math.sqrt(localAxis.x * localAxis.x + localAxis.z * localAxis.z);\n const pitch = -Math.atan2(localAxis.y, len);\n if (this.rotationQuaternion) {\n Quaternion.RotationYawPitchRollToRef(yaw + yawCor, pitch + pitchCor, rollCor, this.rotationQuaternion);\n }\n else {\n this.rotation.x = pitch + pitchCor;\n this.rotation.y = yaw + yawCor;\n this.rotation.z = rollCor;\n }\n return this;\n }\n /**\n * Sets a new pivot point to the current node\n * @param point defines the new pivot point to use\n * @param space defines if the point is in world or local space (local by default)\n * @returns the current TransformNode\n */\n setPivotPoint(point, space = Space.LOCAL) {\n if (this.getScene().getRenderId() == 0) {\n this.computeWorldMatrix(true);\n }\n const wm = this.getWorldMatrix();\n if (space == Space.WORLD) {\n const tmat = TmpVectors.Matrix[0];\n wm.invertToRef(tmat);\n point = Vector3.TransformCoordinates(point, tmat);\n }\n return this.setPivotMatrix(Matrix.Translation(-point.x, -point.y, -point.z), true);\n }\n /**\n * Returns a new Vector3 set with the mesh pivot point coordinates in the local space.\n * @returns the pivot point\n */\n getPivotPoint() {\n const point = Vector3.Zero();\n this.getPivotPointToRef(point);\n return point;\n }\n /**\n * Sets the passed Vector3 \"result\" with the coordinates of the mesh pivot point in the local space.\n * @param result the vector3 to store the result\n * @returns this TransformNode.\n */\n getPivotPointToRef(result) {\n result.x = -this._pivotMatrix.m[12];\n result.y = -this._pivotMatrix.m[13];\n result.z = -this._pivotMatrix.m[14];\n return this;\n }\n /**\n * Returns a new Vector3 set with the mesh pivot point World coordinates.\n * @returns a new Vector3 set with the mesh pivot point World coordinates.\n */\n getAbsolutePivotPoint() {\n const point = Vector3.Zero();\n this.getAbsolutePivotPointToRef(point);\n return point;\n }\n /**\n * Sets the Vector3 \"result\" coordinates with the mesh pivot point World coordinates.\n * @param result vector3 to store the result\n * @returns this TransformNode.\n */\n getAbsolutePivotPointToRef(result) {\n this.getPivotPointToRef(result);\n Vector3.TransformCoordinatesToRef(result, this.getWorldMatrix(), result);\n return this;\n }\n /**\n * Flag the transform node as dirty (Forcing it to update everything)\n * @param property if set to \"rotation\" the objects rotationQuaternion will be set to null\n * @returns this node\n */\n markAsDirty(property) {\n if (this._isDirty) {\n return this;\n }\n // We need to explicitly update the children\n // as the scene.evaluateActiveMeshes will not poll the transform nodes\n if (this._children) {\n for (const child of this._children) {\n child.markAsDirty(property);\n }\n }\n return super.markAsDirty(property);\n }\n /**\n * Defines the passed node as the parent of the current node.\n * The node will remain exactly where it is and its position / rotation will be updated accordingly.\n * Note that if the mesh has a pivot matrix / point defined it will be applied after the parent was updated.\n * In that case the node will not remain in the same space as it is, as the pivot will be applied.\n * To avoid this, you can set updatePivot to true and the pivot will be updated to identity\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/transforms/parent_pivot/parent\n * @param node the node ot set as the parent\n * @param preserveScalingSign if true, keep scaling sign of child. Otherwise, scaling sign might change.\n * @param updatePivot if true, update the pivot matrix to keep the node in the same space as before\n * @returns this TransformNode.\n */\n setParent(node, preserveScalingSign = false, updatePivot = false) {\n if (!node && !this.parent) {\n return this;\n }\n const quatRotation = TmpVectors.Quaternion[0];\n const position = TmpVectors.Vector3[0];\n const scale = TmpVectors.Vector3[1];\n const invParentMatrix = TmpVectors.Matrix[1];\n Matrix.IdentityToRef(invParentMatrix);\n const composedMatrix = TmpVectors.Matrix[0];\n this.computeWorldMatrix(true);\n let currentRotation = this.rotationQuaternion;\n if (!currentRotation) {\n currentRotation = TransformNode._TmpRotation;\n Quaternion.RotationYawPitchRollToRef(this._rotation.y, this._rotation.x, this._rotation.z, currentRotation);\n }\n // current global transformation without pivot\n Matrix.ComposeToRef(this.scaling, currentRotation, this.position, composedMatrix);\n if (this.parent) {\n composedMatrix.multiplyToRef(this.parent.computeWorldMatrix(true), composedMatrix);\n }\n // is a node was set, calculate the difference between this and the node\n if (node) {\n node.computeWorldMatrix(true).invertToRef(invParentMatrix);\n composedMatrix.multiplyToRef(invParentMatrix, composedMatrix);\n }\n composedMatrix.decompose(scale, quatRotation, position, preserveScalingSign ? this : undefined);\n if (this.rotationQuaternion) {\n this.rotationQuaternion.copyFrom(quatRotation);\n }\n else {\n quatRotation.toEulerAnglesToRef(this.rotation);\n }\n this.scaling.copyFrom(scale);\n this.position.copyFrom(position);\n this.parent = node;\n if (updatePivot) {\n this.setPivotMatrix(Matrix.Identity());\n }\n return this;\n }\n /**\n * True if the scaling property of this object is non uniform eg. (1,2,1)\n */\n get nonUniformScaling() {\n return this._nonUniformScaling;\n }\n /**\n * @internal\n */\n _updateNonUniformScalingState(value) {\n if (this._nonUniformScaling === value) {\n return false;\n }\n this._nonUniformScaling = value;\n return true;\n }\n /**\n * Attach the current TransformNode to another TransformNode associated with a bone\n * @param bone Bone affecting the TransformNode\n * @param affectedTransformNode TransformNode associated with the bone\n * @returns this object\n */\n attachToBone(bone, affectedTransformNode) {\n this._currentParentWhenAttachingToBone = this.parent;\n this._transformToBoneReferal = affectedTransformNode;\n this.parent = bone;\n bone.getSkeleton().prepare(true); // make sure bone.getFinalMatrix() is up to date\n if (bone.getFinalMatrix().determinant() < 0) {\n this.scalingDeterminant *= -1;\n }\n return this;\n }\n /**\n * Detach the transform node if its associated with a bone\n * @param resetToPreviousParent Indicates if the parent that was in effect when attachToBone was called should be set back or if we should set parent to null instead (defaults to the latter)\n * @returns this object\n */\n detachFromBone(resetToPreviousParent = false) {\n if (!this.parent) {\n if (resetToPreviousParent) {\n this.parent = this._currentParentWhenAttachingToBone;\n }\n return this;\n }\n if (this.parent.getWorldMatrix().determinant() < 0) {\n this.scalingDeterminant *= -1;\n }\n this._transformToBoneReferal = null;\n if (resetToPreviousParent) {\n this.parent = this._currentParentWhenAttachingToBone;\n }\n else {\n this.parent = null;\n }\n return this;\n }\n /**\n * Rotates the mesh around the axis vector for the passed angle (amount) expressed in radians, in the given space.\n * space (default LOCAL) can be either Space.LOCAL, either Space.WORLD.\n * Note that the property `rotationQuaternion` is then automatically updated and the property `rotation` is set to (0,0,0) and no longer used.\n * The passed axis is also normalized.\n * @param axis the axis to rotate around\n * @param amount the amount to rotate in radians\n * @param space Space to rotate in (Default: local)\n * @returns the TransformNode.\n */\n rotate(axis, amount, space) {\n axis.normalize();\n if (!this.rotationQuaternion) {\n this.rotationQuaternion = this.rotation.toQuaternion();\n this.rotation.setAll(0);\n }\n let rotationQuaternion;\n if (!space || space === Space.LOCAL) {\n rotationQuaternion = Quaternion.RotationAxisToRef(axis, amount, TransformNode._RotationAxisCache);\n this.rotationQuaternion.multiplyToRef(rotationQuaternion, this.rotationQuaternion);\n }\n else {\n if (this.parent) {\n const invertParentWorldMatrix = TmpVectors.Matrix[0];\n this.parent.getWorldMatrix().invertToRef(invertParentWorldMatrix);\n axis = Vector3.TransformNormal(axis, invertParentWorldMatrix);\n }\n rotationQuaternion = Quaternion.RotationAxisToRef(axis, amount, TransformNode._RotationAxisCache);\n rotationQuaternion.multiplyToRef(this.rotationQuaternion, this.rotationQuaternion);\n }\n return this;\n }\n /**\n * Rotates the mesh around the axis vector for the passed angle (amount) expressed in radians, in world space.\n * Note that the property `rotationQuaternion` is then automatically updated and the property `rotation` is set to (0,0,0) and no longer used.\n * The passed axis is also normalized. .\n * Method is based on http://www.euclideanspace.com/maths/geometry/affine/aroundPoint/index.htm\n * @param point the point to rotate around\n * @param axis the axis to rotate around\n * @param amount the amount to rotate in radians\n * @returns the TransformNode\n */\n rotateAround(point, axis, amount) {\n axis.normalize();\n if (!this.rotationQuaternion) {\n this.rotationQuaternion = Quaternion.RotationYawPitchRoll(this.rotation.y, this.rotation.x, this.rotation.z);\n this.rotation.setAll(0);\n }\n const tmpVector = TmpVectors.Vector3[0];\n const finalScale = TmpVectors.Vector3[1];\n const finalTranslation = TmpVectors.Vector3[2];\n const finalRotation = TmpVectors.Quaternion[0];\n const translationMatrix = TmpVectors.Matrix[0]; // T\n const translationMatrixInv = TmpVectors.Matrix[1]; // T'\n const rotationMatrix = TmpVectors.Matrix[2]; // R\n const finalMatrix = TmpVectors.Matrix[3]; // T' x R x T\n point.subtractToRef(this.position, tmpVector);\n Matrix.TranslationToRef(tmpVector.x, tmpVector.y, tmpVector.z, translationMatrix); // T\n Matrix.TranslationToRef(-tmpVector.x, -tmpVector.y, -tmpVector.z, translationMatrixInv); // T'\n Matrix.RotationAxisToRef(axis, amount, rotationMatrix); // R\n translationMatrixInv.multiplyToRef(rotationMatrix, finalMatrix); // T' x R\n finalMatrix.multiplyToRef(translationMatrix, finalMatrix); // T' x R x T\n finalMatrix.decompose(finalScale, finalRotation, finalTranslation);\n this.position.addInPlace(finalTranslation);\n finalRotation.multiplyToRef(this.rotationQuaternion, this.rotationQuaternion);\n return this;\n }\n /**\n * Translates the mesh along the axis vector for the passed distance in the given space.\n * space (default LOCAL) can be either Space.LOCAL, either Space.WORLD.\n * @param axis the axis to translate in\n * @param distance the distance to translate\n * @param space Space to rotate in (Default: local)\n * @returns the TransformNode.\n */\n translate(axis, distance, space) {\n const displacementVector = axis.scale(distance);\n if (!space || space === Space.LOCAL) {\n const tempV3 = this.getPositionExpressedInLocalSpace().add(displacementVector);\n this.setPositionWithLocalVector(tempV3);\n }\n else {\n this.setAbsolutePosition(this.getAbsolutePosition().add(displacementVector));\n }\n return this;\n }\n /**\n * Adds a rotation step to the mesh current rotation.\n * x, y, z are Euler angles expressed in radians.\n * This methods updates the current mesh rotation, either mesh.rotation, either mesh.rotationQuaternion if it's set.\n * This means this rotation is made in the mesh local space only.\n * It's useful to set a custom rotation order different from the BJS standard one YXZ.\n * Example : this rotates the mesh first around its local X axis, then around its local Z axis, finally around its local Y axis.\n * ```javascript\n * mesh.addRotation(x1, 0, 0).addRotation(0, 0, z2).addRotation(0, 0, y3);\n * ```\n * Note that `addRotation()` accumulates the passed rotation values to the current ones and computes the .rotation or .rotationQuaternion updated values.\n * Under the hood, only quaternions are used. So it's a little faster is you use .rotationQuaternion because it doesn't need to translate them back to Euler angles.\n * @param x Rotation to add\n * @param y Rotation to add\n * @param z Rotation to add\n * @returns the TransformNode.\n */\n addRotation(x, y, z) {\n let rotationQuaternion;\n if (this.rotationQuaternion) {\n rotationQuaternion = this.rotationQuaternion;\n }\n else {\n rotationQuaternion = TmpVectors.Quaternion[1];\n Quaternion.RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, this.rotation.z, rotationQuaternion);\n }\n const accumulation = TmpVectors.Quaternion[0];\n Quaternion.RotationYawPitchRollToRef(y, x, z, accumulation);\n rotationQuaternion.multiplyInPlace(accumulation);\n if (!this.rotationQuaternion) {\n rotationQuaternion.toEulerAnglesToRef(this.rotation);\n }\n return this;\n }\n /**\n * @internal\n */\n _getEffectiveParent() {\n return this.parent;\n }\n /**\n * Returns whether the transform node world matrix computation needs the camera information to be computed.\n * This is the case when the node is a billboard or has an infinite distance for instance.\n * @returns true if the world matrix computation needs the camera information to be computed\n */\n isWorldMatrixCameraDependent() {\n return (this._infiniteDistance && !this.parent) || (this._billboardMode !== TransformNode.BILLBOARDMODE_NONE && !this.preserveParentRotationForBillboard);\n }\n /**\n * Computes the world matrix of the node\n * @param force defines if the cache version should be invalidated forcing the world matrix to be created from scratch\n * @param camera defines the camera used if different from the scene active camera (This is used with modes like Billboard or infinite distance)\n * @returns the world matrix\n */\n computeWorldMatrix(force = false, camera = null) {\n if (this._isWorldMatrixFrozen && !this._isDirty) {\n return this._worldMatrix;\n }\n const currentRenderId = this.getScene().getRenderId();\n if (!this._isDirty && !force && (this._currentRenderId === currentRenderId || this.isSynchronized())) {\n this._currentRenderId = currentRenderId;\n return this._worldMatrix;\n }\n camera = camera || this.getScene().activeCamera;\n this._updateCache();\n const cache = this._cache;\n cache.pivotMatrixUpdated = false;\n cache.billboardMode = this.billboardMode;\n cache.infiniteDistance = this.infiniteDistance;\n cache.parent = this._parentNode;\n this._currentRenderId = currentRenderId;\n this._childUpdateId += 1;\n this._isDirty = false;\n this._position._isDirty = false;\n this._rotation._isDirty = false;\n this._scaling._isDirty = false;\n const parent = this._getEffectiveParent();\n // Scaling\n const scaling = TransformNode._TmpScaling;\n let translation = this._position;\n // Translation\n if (this._infiniteDistance) {\n if (!this.parent && camera) {\n const cameraWorldMatrix = camera.getWorldMatrix();\n const cameraGlobalPosition = new Vector3(cameraWorldMatrix.m[12], cameraWorldMatrix.m[13], cameraWorldMatrix.m[14]);\n translation = TransformNode._TmpTranslation;\n translation.copyFromFloats(this._position.x + cameraGlobalPosition.x, this._position.y + cameraGlobalPosition.y, this._position.z + cameraGlobalPosition.z);\n }\n }\n // Scaling\n scaling.copyFromFloats(this._scaling.x * this.scalingDeterminant, this._scaling.y * this.scalingDeterminant, this._scaling.z * this.scalingDeterminant);\n // Rotation\n let rotation;\n if (this._rotationQuaternion) {\n this._rotationQuaternion._isDirty = false;\n rotation = this._rotationQuaternion;\n if (this.reIntegrateRotationIntoRotationQuaternion) {\n const len = this.rotation.lengthSquared();\n if (len) {\n this._rotationQuaternion.multiplyInPlace(Quaternion.RotationYawPitchRoll(this._rotation.y, this._rotation.x, this._rotation.z));\n this._rotation.copyFromFloats(0, 0, 0);\n }\n }\n }\n else {\n rotation = TransformNode._TmpRotation;\n Quaternion.RotationYawPitchRollToRef(this._rotation.y, this._rotation.x, this._rotation.z, rotation);\n }\n // Compose\n if (this._usePivotMatrix) {\n const scaleMatrix = TmpVectors.Matrix[1];\n Matrix.ScalingToRef(scaling.x, scaling.y, scaling.z, scaleMatrix);\n // Rotation\n const rotationMatrix = TmpVectors.Matrix[0];\n rotation.toRotationMatrix(rotationMatrix);\n // Composing transformations\n this._pivotMatrix.multiplyToRef(scaleMatrix, TmpVectors.Matrix[4]);\n TmpVectors.Matrix[4].multiplyToRef(rotationMatrix, this._localMatrix);\n // Post multiply inverse of pivotMatrix\n if (this._postMultiplyPivotMatrix) {\n this._localMatrix.multiplyToRef(this._pivotMatrixInverse, this._localMatrix);\n }\n this._localMatrix.addTranslationFromFloats(translation.x, translation.y, translation.z);\n }\n else {\n Matrix.ComposeToRef(scaling, rotation, translation, this._localMatrix);\n }\n // Parent\n if (parent && parent.getWorldMatrix) {\n if (force) {\n parent.computeWorldMatrix(force);\n }\n if (cache.useBillboardPath) {\n if (this._transformToBoneReferal) {\n const bone = this.parent;\n bone.getSkeleton().prepare();\n bone.getFinalMatrix().multiplyToRef(this._transformToBoneReferal.getWorldMatrix(), TmpVectors.Matrix[7]);\n }\n else {\n TmpVectors.Matrix[7].copyFrom(parent.getWorldMatrix());\n }\n // Extract scaling and translation from parent\n const translation = TmpVectors.Vector3[5];\n const scale = TmpVectors.Vector3[6];\n const orientation = TmpVectors.Quaternion[0];\n TmpVectors.Matrix[7].decompose(scale, orientation, translation);\n Matrix.ScalingToRef(scale.x, scale.y, scale.z, TmpVectors.Matrix[7]);\n TmpVectors.Matrix[7].setTranslation(translation);\n if (TransformNode.BillboardUseParentOrientation) {\n // set localMatrix translation to be transformed against parent's orientation.\n this._position.applyRotationQuaternionToRef(orientation, translation);\n this._localMatrix.setTranslation(translation);\n }\n this._localMatrix.multiplyToRef(TmpVectors.Matrix[7], this._worldMatrix);\n }\n else {\n if (this._transformToBoneReferal) {\n const bone = this.parent;\n bone.getSkeleton().prepare();\n this._localMatrix.multiplyToRef(bone.getFinalMatrix(), TmpVectors.Matrix[6]);\n TmpVectors.Matrix[6].multiplyToRef(this._transformToBoneReferal.getWorldMatrix(), this._worldMatrix);\n }\n else {\n this._localMatrix.multiplyToRef(parent.getWorldMatrix(), this._worldMatrix);\n }\n }\n this._markSyncedWithParent();\n }\n else {\n this._worldMatrix.copyFrom(this._localMatrix);\n }\n // Billboarding based on camera orientation (testing PG:http://www.babylonjs-playground.com/#UJEIL#13)\n if (cache.useBillboardPath && camera && this.billboardMode && !cache.useBillboardPosition) {\n const storedTranslation = TmpVectors.Vector3[0];\n this._worldMatrix.getTranslationToRef(storedTranslation); // Save translation\n // Cancel camera rotation\n TmpVectors.Matrix[1].copyFrom(camera.getViewMatrix());\n if (this._scene.useRightHandedSystem) {\n TmpVectors.Matrix[1].multiplyToRef(convertRHSToLHS, TmpVectors.Matrix[1]);\n }\n TmpVectors.Matrix[1].setTranslationFromFloats(0, 0, 0);\n TmpVectors.Matrix[1].invertToRef(TmpVectors.Matrix[0]);\n if ((this.billboardMode & TransformNode.BILLBOARDMODE_ALL) !== TransformNode.BILLBOARDMODE_ALL) {\n TmpVectors.Matrix[0].decompose(undefined, TmpVectors.Quaternion[0], undefined);\n const eulerAngles = TmpVectors.Vector3[1];\n TmpVectors.Quaternion[0].toEulerAnglesToRef(eulerAngles);\n if ((this.billboardMode & TransformNode.BILLBOARDMODE_X) !== TransformNode.BILLBOARDMODE_X) {\n eulerAngles.x = 0;\n }\n if ((this.billboardMode & TransformNode.BILLBOARDMODE_Y) !== TransformNode.BILLBOARDMODE_Y) {\n eulerAngles.y = 0;\n }\n if ((this.billboardMode & TransformNode.BILLBOARDMODE_Z) !== TransformNode.BILLBOARDMODE_Z) {\n eulerAngles.z = 0;\n }\n Matrix.RotationYawPitchRollToRef(eulerAngles.y, eulerAngles.x, eulerAngles.z, TmpVectors.Matrix[0]);\n }\n this._worldMatrix.setTranslationFromFloats(0, 0, 0);\n this._worldMatrix.multiplyToRef(TmpVectors.Matrix[0], this._worldMatrix);\n // Restore translation\n this._worldMatrix.setTranslation(TmpVectors.Vector3[0]);\n }\n // Billboarding based on camera position\n else if (cache.useBillboardPath && camera && cache.useBillboardPosition) {\n const storedTranslation = TmpVectors.Vector3[0];\n // Save translation\n this._worldMatrix.getTranslationToRef(storedTranslation);\n // Compute camera position in local space\n const cameraPosition = camera.globalPosition;\n this._worldMatrix.invertToRef(TmpVectors.Matrix[1]);\n const camInObjSpace = TmpVectors.Vector3[1];\n Vector3.TransformCoordinatesToRef(cameraPosition, TmpVectors.Matrix[1], camInObjSpace);\n camInObjSpace.normalize();\n // Find the lookAt info in local space\n const yaw = -Math.atan2(camInObjSpace.z, camInObjSpace.x) + Math.PI / 2;\n const len = Math.sqrt(camInObjSpace.x * camInObjSpace.x + camInObjSpace.z * camInObjSpace.z);\n const pitch = -Math.atan2(camInObjSpace.y, len);\n Quaternion.RotationYawPitchRollToRef(yaw, pitch, 0, TmpVectors.Quaternion[0]);\n if ((this.billboardMode & TransformNode.BILLBOARDMODE_ALL) !== TransformNode.BILLBOARDMODE_ALL) {\n const eulerAngles = TmpVectors.Vector3[1];\n TmpVectors.Quaternion[0].toEulerAnglesToRef(eulerAngles);\n if ((this.billboardMode & TransformNode.BILLBOARDMODE_X) !== TransformNode.BILLBOARDMODE_X) {\n eulerAngles.x = 0;\n }\n if ((this.billboardMode & TransformNode.BILLBOARDMODE_Y) !== TransformNode.BILLBOARDMODE_Y) {\n eulerAngles.y = 0;\n }\n if ((this.billboardMode & TransformNode.BILLBOARDMODE_Z) !== TransformNode.BILLBOARDMODE_Z) {\n eulerAngles.z = 0;\n }\n Matrix.RotationYawPitchRollToRef(eulerAngles.y, eulerAngles.x, eulerAngles.z, TmpVectors.Matrix[0]);\n }\n else {\n Matrix.FromQuaternionToRef(TmpVectors.Quaternion[0], TmpVectors.Matrix[0]);\n }\n // Cancel translation\n this._worldMatrix.setTranslationFromFloats(0, 0, 0);\n // Rotate according to lookat (diff from local to lookat)\n this._worldMatrix.multiplyToRef(TmpVectors.Matrix[0], this._worldMatrix);\n // Restore translation\n this._worldMatrix.setTranslation(TmpVectors.Vector3[0]);\n }\n // Normal matrix\n if (!this.ignoreNonUniformScaling) {\n if (this._scaling.isNonUniformWithinEpsilon(0.000001)) {\n this._updateNonUniformScalingState(true);\n }\n else if (parent && parent._nonUniformScaling) {\n this._updateNonUniformScalingState(parent._nonUniformScaling);\n }\n else {\n this._updateNonUniformScalingState(false);\n }\n }\n else {\n this._updateNonUniformScalingState(false);\n }\n this._afterComputeWorldMatrix();\n // Absolute position\n this._absolutePosition.copyFromFloats(this._worldMatrix.m[12], this._worldMatrix.m[13], this._worldMatrix.m[14]);\n this._isAbsoluteSynced = false;\n // Callbacks\n this.onAfterWorldMatrixUpdateObservable.notifyObservers(this);\n if (!this._poseMatrix) {\n this._poseMatrix = Matrix.Invert(this._worldMatrix);\n }\n // Cache the determinant\n this._worldMatrixDeterminantIsDirty = true;\n return this._worldMatrix;\n }\n /**\n * Resets this nodeTransform's local matrix to Matrix.Identity().\n * @param independentOfChildren indicates if all child nodeTransform's world-space transform should be preserved.\n */\n resetLocalMatrix(independentOfChildren = true) {\n this.computeWorldMatrix();\n if (independentOfChildren) {\n const children = this.getChildren();\n for (let i = 0; i < children.length; ++i) {\n const child = children[i];\n if (child) {\n child.computeWorldMatrix();\n const bakedMatrix = TmpVectors.Matrix[0];\n child._localMatrix.multiplyToRef(this._localMatrix, bakedMatrix);\n const tmpRotationQuaternion = TmpVectors.Quaternion[0];\n bakedMatrix.decompose(child.scaling, tmpRotationQuaternion, child.position);\n if (child.rotationQuaternion) {\n child.rotationQuaternion.copyFrom(tmpRotationQuaternion);\n }\n else {\n tmpRotationQuaternion.toEulerAnglesToRef(child.rotation);\n }\n }\n }\n }\n this.scaling.copyFromFloats(1, 1, 1);\n this.position.copyFromFloats(0, 0, 0);\n this.rotation.copyFromFloats(0, 0, 0);\n //only if quaternion is already set\n if (this.rotationQuaternion) {\n this.rotationQuaternion = Quaternion.Identity();\n }\n this._worldMatrix = Matrix.Identity();\n }\n _afterComputeWorldMatrix() { }\n /**\n * If you'd like to be called back after the mesh position, rotation or scaling has been updated.\n * @param func callback function to add\n *\n * @returns the TransformNode.\n */\n registerAfterWorldMatrixUpdate(func) {\n this.onAfterWorldMatrixUpdateObservable.add(func);\n return this;\n }\n /**\n * Removes a registered callback function.\n * @param func callback function to remove\n * @returns the TransformNode.\n */\n unregisterAfterWorldMatrixUpdate(func) {\n this.onAfterWorldMatrixUpdateObservable.removeCallback(func);\n return this;\n }\n /**\n * Gets the position of the current mesh in camera space\n * @param camera defines the camera to use\n * @returns a position\n */\n getPositionInCameraSpace(camera = null) {\n if (!camera) {\n camera = this.getScene().activeCamera;\n }\n return Vector3.TransformCoordinates(this.getAbsolutePosition(), camera.getViewMatrix());\n }\n /**\n * Returns the distance from the mesh to the active camera\n * @param camera defines the camera to use\n * @returns the distance\n */\n getDistanceToCamera(camera = null) {\n if (!camera) {\n camera = this.getScene().activeCamera;\n }\n return this.getAbsolutePosition().subtract(camera.globalPosition).length();\n }\n /**\n * Clone the current transform node\n * @param name Name of the new clone\n * @param newParent New parent for the clone\n * @param doNotCloneChildren Do not clone children hierarchy\n * @returns the new transform node\n */\n clone(name, newParent, doNotCloneChildren) {\n const result = SerializationHelper.Clone(() => new TransformNode(name, this.getScene()), this);\n result.name = name;\n result.id = name;\n if (newParent) {\n result.parent = newParent;\n }\n if (!doNotCloneChildren) {\n // Children\n const directDescendants = this.getDescendants(true);\n for (let index = 0; index < directDescendants.length; index++) {\n const child = directDescendants[index];\n if (child.clone) {\n child.clone(name + \".\" + child.name, result);\n }\n }\n }\n return result;\n }\n /**\n * Serializes the objects information.\n * @param currentSerializationObject defines the object to serialize in\n * @returns the serialized object\n */\n serialize(currentSerializationObject) {\n const serializationObject = SerializationHelper.Serialize(this, currentSerializationObject);\n serializationObject.type = this.getClassName();\n serializationObject.uniqueId = this.uniqueId;\n // Parent\n if (this.parent) {\n this.parent._serializeAsParent(serializationObject);\n }\n serializationObject.localMatrix = this.getPivotMatrix().asArray();\n serializationObject.isEnabled = this.isEnabled();\n return serializationObject;\n }\n // Statics\n /**\n * Returns a new TransformNode object parsed from the source provided.\n * @param parsedTransformNode is the source.\n * @param scene the scene the object belongs to\n * @param rootUrl is a string, it's the root URL to prefix the `delayLoadingFile` property with\n * @returns a new TransformNode object parsed from the source provided.\n */\n static Parse(parsedTransformNode, scene, rootUrl) {\n const transformNode = SerializationHelper.Parse(() => new TransformNode(parsedTransformNode.name, scene), parsedTransformNode, scene, rootUrl);\n if (parsedTransformNode.localMatrix) {\n transformNode.setPreTransformMatrix(Matrix.FromArray(parsedTransformNode.localMatrix));\n }\n else if (parsedTransformNode.pivotMatrix) {\n transformNode.setPivotMatrix(Matrix.FromArray(parsedTransformNode.pivotMatrix));\n }\n transformNode.setEnabled(parsedTransformNode.isEnabled);\n transformNode._waitingParsedUniqueId = parsedTransformNode.uniqueId;\n // Parent\n if (parsedTransformNode.parentId !== undefined) {\n transformNode._waitingParentId = parsedTransformNode.parentId;\n }\n if (parsedTransformNode.parentInstanceIndex !== undefined) {\n transformNode._waitingParentInstanceIndex = parsedTransformNode.parentInstanceIndex;\n }\n return transformNode;\n }\n /**\n * Get all child-transformNodes of this node\n * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered\n * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored\n * @returns an array of TransformNode\n */\n getChildTransformNodes(directDescendantsOnly, predicate) {\n const results = [];\n this._getDescendants(results, directDescendantsOnly, (node) => {\n return (!predicate || predicate(node)) && node instanceof TransformNode;\n });\n return results;\n }\n /**\n * Releases resources associated with this transform node.\n * @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)\n * @param disposeMaterialAndTextures Set to true to also dispose referenced materials and textures (false by default)\n */\n dispose(doNotRecurse, disposeMaterialAndTextures = false) {\n // Animations\n this.getScene().stopAnimation(this);\n // Remove from scene\n this.getScene().removeTransformNode(this);\n if (this._parentContainer) {\n const index = this._parentContainer.transformNodes.indexOf(this);\n if (index > -1) {\n this._parentContainer.transformNodes.splice(index, 1);\n }\n this._parentContainer = null;\n }\n this.onAfterWorldMatrixUpdateObservable.clear();\n if (doNotRecurse) {\n const transformNodes = this.getChildTransformNodes(true);\n for (const transformNode of transformNodes) {\n transformNode.parent = null;\n transformNode.computeWorldMatrix(true);\n }\n }\n super.dispose(doNotRecurse, disposeMaterialAndTextures);\n }\n /**\n * Uniformly scales the mesh to fit inside of a unit cube (1 X 1 X 1 units)\n * @param includeDescendants Use the hierarchy's bounding box instead of the mesh's bounding box. Default is false\n * @param ignoreRotation ignore rotation when computing the scale (ie. object will be axis aligned). Default is false\n * @param predicate predicate that is passed in to getHierarchyBoundingVectors when selecting which object should be included when scaling\n * @returns the current mesh\n */\n normalizeToUnitCube(includeDescendants = true, ignoreRotation = false, predicate) {\n let storedRotation = null;\n let storedRotationQuaternion = null;\n if (ignoreRotation) {\n if (this.rotationQuaternion) {\n storedRotationQuaternion = this.rotationQuaternion.clone();\n this.rotationQuaternion.copyFromFloats(0, 0, 0, 1);\n }\n else if (this.rotation) {\n storedRotation = this.rotation.clone();\n this.rotation.copyFromFloats(0, 0, 0);\n }\n }\n const boundingVectors = this.getHierarchyBoundingVectors(includeDescendants, predicate);\n const sizeVec = boundingVectors.max.subtract(boundingVectors.min);\n const maxDimension = Math.max(sizeVec.x, sizeVec.y, sizeVec.z);\n if (maxDimension === 0) {\n return this;\n }\n const scale = 1 / maxDimension;\n this.scaling.scaleInPlace(scale);\n if (ignoreRotation) {\n if (this.rotationQuaternion && storedRotationQuaternion) {\n this.rotationQuaternion.copyFrom(storedRotationQuaternion);\n }\n else if (this.rotation && storedRotation) {\n this.rotation.copyFrom(storedRotation);\n }\n }\n return this;\n }\n _syncAbsoluteScalingAndRotation() {\n if (!this._isAbsoluteSynced) {\n this._worldMatrix.decompose(this._absoluteScaling, this._absoluteRotationQuaternion);\n this._isAbsoluteSynced = true;\n }\n }\n}\n// Statics\n/**\n * Object will not rotate to face the camera\n */\nTransformNode.BILLBOARDMODE_NONE = 0;\n/**\n * Object will rotate to face the camera but only on the x axis\n */\nTransformNode.BILLBOARDMODE_X = 1;\n/**\n * Object will rotate to face the camera but only on the y axis\n */\nTransformNode.BILLBOARDMODE_Y = 2;\n/**\n * Object will rotate to face the camera but only on the z axis\n */\nTransformNode.BILLBOARDMODE_Z = 4;\n/**\n * Object will rotate to face the camera\n */\nTransformNode.BILLBOARDMODE_ALL = 7;\n/**\n * Object will rotate to face the camera's position instead of orientation\n */\nTransformNode.BILLBOARDMODE_USE_POSITION = 128;\n/**\n * Child transform with Billboard flags should or should not apply parent rotation (default if off)\n */\nTransformNode.BillboardUseParentOrientation = false;\nTransformNode._TmpRotation = Quaternion.Zero();\nTransformNode._TmpScaling = Vector3.Zero();\nTransformNode._TmpTranslation = Vector3.Zero();\nTransformNode._LookAtVectorCache = new Vector3(0, 0, 0);\nTransformNode._RotationAxisCache = new Quaternion();\n__decorate([\n serializeAsVector3(\"position\")\n], TransformNode.prototype, \"_position\", void 0);\n__decorate([\n serializeAsVector3(\"rotation\")\n], TransformNode.prototype, \"_rotation\", void 0);\n__decorate([\n serializeAsQuaternion(\"rotationQuaternion\")\n], TransformNode.prototype, \"_rotationQuaternion\", void 0);\n__decorate([\n serializeAsVector3(\"scaling\")\n], TransformNode.prototype, \"_scaling\", void 0);\n__decorate([\n serialize(\"billboardMode\")\n], TransformNode.prototype, \"_billboardMode\", void 0);\n__decorate([\n serialize()\n], TransformNode.prototype, \"scalingDeterminant\", void 0);\n__decorate([\n serialize(\"infiniteDistance\")\n], TransformNode.prototype, \"_infiniteDistance\", void 0);\n__decorate([\n serialize()\n], TransformNode.prototype, \"ignoreNonUniformScaling\", void 0);\n__decorate([\n serialize()\n], TransformNode.prototype, \"reIntegrateRotationIntoRotationQuaternion\", void 0);\n//# sourceMappingURL=transformNode.js.map","import { Vector3 } from \"../Maths/math.vector.js\";\n/**\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport class _MeshCollisionData {\n constructor() {\n this._checkCollisions = false;\n this._collisionMask = -1;\n this._collisionGroup = -1;\n this._surroundingMeshes = null;\n this._collider = null;\n this._oldPositionForCollisions = new Vector3(0, 0, 0);\n this._diffPositionForCollisions = new Vector3(0, 0, 0);\n this._collisionResponse = true;\n }\n}\n//# sourceMappingURL=meshCollisionData.js.map","import { Observable } from \"../Misc/observable.js\";\nimport { ScenePerformancePriority } from \"../scene.js\";\nimport { Quaternion, Matrix, Vector3, TmpVectors } from \"../Maths/math.vector.js\";\nimport { Engine } from \"../Engines/engine.js\";\nimport { VertexBuffer } from \"../Buffers/buffer.js\";\nimport { VertexData } from \"../Meshes/mesh.vertexData.js\";\nimport { TransformNode } from \"../Meshes/transformNode.js\";\nimport { PickingInfo } from \"../Collisions/pickingInfo.js\";\nimport { BoundingInfo } from \"../Culling/boundingInfo.js\";\n\nimport { UniformBuffer } from \"../Materials/uniformBuffer.js\";\nimport { _MeshCollisionData } from \"../Collisions/meshCollisionData.js\";\nimport { _WarnImport } from \"../Misc/devTools.js\";\nimport { extractMinAndMax } from \"../Maths/math.functions.js\";\nimport { Color3, Color4 } from \"../Maths/math.color.js\";\nimport { Epsilon } from \"../Maths/math.constants.js\";\nimport { Axis } from \"../Maths/math.axis.js\";\nimport { RegisterClass } from \"../Misc/typeStore.js\";\n/** @internal */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nclass _FacetDataStorage {\n constructor() {\n this.facetNb = 0; // facet number\n this.partitioningSubdivisions = 10; // number of subdivisions per axis in the partitioning space\n this.partitioningBBoxRatio = 1.01; // the partitioning array space is by default 1% bigger than the bounding box\n this.facetDataEnabled = false; // is the facet data feature enabled on this mesh ?\n this.facetParameters = {}; // keep a reference to the object parameters to avoid memory re-allocation\n this.bbSize = Vector3.Zero(); // bbox size approximated for facet data\n this.subDiv = {\n // actual number of subdivisions per axis for ComputeNormals()\n max: 1,\n // eslint-disable-next-line @typescript-eslint/naming-convention\n X: 1,\n // eslint-disable-next-line @typescript-eslint/naming-convention\n Y: 1,\n // eslint-disable-next-line @typescript-eslint/naming-convention\n Z: 1,\n };\n this.facetDepthSort = false; // is the facet depth sort to be computed\n this.facetDepthSortEnabled = false; // is the facet depth sort initialized\n }\n}\n/**\n * @internal\n **/\n// eslint-disable-next-line @typescript-eslint/naming-convention\nclass _InternalAbstractMeshDataInfo {\n constructor() {\n this._hasVertexAlpha = false;\n this._useVertexColors = true;\n this._numBoneInfluencers = 4;\n this._applyFog = true;\n this._receiveShadows = false;\n this._facetData = new _FacetDataStorage();\n this._visibility = 1.0;\n this._skeleton = null;\n this._layerMask = 0x0fffffff;\n this._computeBonesUsingShaders = true;\n this._isActive = false;\n this._onlyForInstances = false;\n this._isActiveIntermediate = false;\n this._onlyForInstancesIntermediate = false;\n this._actAsRegularMesh = false;\n this._currentLOD = null;\n this._currentLODIsUpToDate = false;\n this._collisionRetryCount = 3;\n this._morphTargetManager = null;\n this._renderingGroupId = 0;\n this._bakedVertexAnimationManager = null;\n this._material = null;\n this._positions = null;\n this._pointerOverDisableMeshTesting = false;\n // Collisions\n this._meshCollisionData = new _MeshCollisionData();\n this._enableDistantPicking = false;\n /** @internal\n * Bounding info that is unnafected by the addition of thin instances\n */\n this._rawBoundingInfo = null;\n }\n}\n/**\n * Class used to store all common mesh properties\n */\nexport class AbstractMesh extends TransformNode {\n /**\n * No billboard\n */\n static get BILLBOARDMODE_NONE() {\n return TransformNode.BILLBOARDMODE_NONE;\n }\n /** Billboard on X axis */\n static get BILLBOARDMODE_X() {\n return TransformNode.BILLBOARDMODE_X;\n }\n /** Billboard on Y axis */\n static get BILLBOARDMODE_Y() {\n return TransformNode.BILLBOARDMODE_Y;\n }\n /** Billboard on Z axis */\n static get BILLBOARDMODE_Z() {\n return TransformNode.BILLBOARDMODE_Z;\n }\n /** Billboard on all axes */\n static get BILLBOARDMODE_ALL() {\n return TransformNode.BILLBOARDMODE_ALL;\n }\n /** Billboard on using position instead of orientation */\n static get BILLBOARDMODE_USE_POSITION() {\n return TransformNode.BILLBOARDMODE_USE_POSITION;\n }\n /**\n * Gets the number of facets in the mesh\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/facetData#what-is-a-mesh-facet\n */\n get facetNb() {\n return this._internalAbstractMeshDataInfo._facetData.facetNb;\n }\n /**\n * Gets or set the number (integer) of subdivisions per axis in the partitioning space\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/facetData#tweaking-the-partitioning\n */\n get partitioningSubdivisions() {\n return this._internalAbstractMeshDataInfo._facetData.partitioningSubdivisions;\n }\n set partitioningSubdivisions(nb) {\n this._internalAbstractMeshDataInfo._facetData.partitioningSubdivisions = nb;\n }\n /**\n * The ratio (float) to apply to the bounding box size to set to the partitioning space.\n * Ex : 1.01 (default) the partitioning space is 1% bigger than the bounding box\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/facetData#tweaking-the-partitioning\n */\n get partitioningBBoxRatio() {\n return this._internalAbstractMeshDataInfo._facetData.partitioningBBoxRatio;\n }\n set partitioningBBoxRatio(ratio) {\n this._internalAbstractMeshDataInfo._facetData.partitioningBBoxRatio = ratio;\n }\n /**\n * Gets or sets a boolean indicating that the facets must be depth sorted on next call to `updateFacetData()`.\n * Works only for updatable meshes.\n * Doesn't work with multi-materials\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/facetData#facet-depth-sort\n */\n get mustDepthSortFacets() {\n return this._internalAbstractMeshDataInfo._facetData.facetDepthSort;\n }\n set mustDepthSortFacets(sort) {\n this._internalAbstractMeshDataInfo._facetData.facetDepthSort = sort;\n }\n /**\n * The location (Vector3) where the facet depth sort must be computed from.\n * By default, the active camera position.\n * Used only when facet depth sort is enabled\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/facetData#facet-depth-sort\n */\n get facetDepthSortFrom() {\n return this._internalAbstractMeshDataInfo._facetData.facetDepthSortFrom;\n }\n set facetDepthSortFrom(location) {\n this._internalAbstractMeshDataInfo._facetData.facetDepthSortFrom = location;\n }\n /** number of collision detection tries. Change this value if not all collisions are detected and handled properly */\n get collisionRetryCount() {\n return this._internalAbstractMeshDataInfo._collisionRetryCount;\n }\n set collisionRetryCount(retryCount) {\n this._internalAbstractMeshDataInfo._collisionRetryCount = retryCount;\n }\n /**\n * gets a boolean indicating if facetData is enabled\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/facetData#what-is-a-mesh-facet\n */\n get isFacetDataEnabled() {\n return this._internalAbstractMeshDataInfo._facetData.facetDataEnabled;\n }\n /**\n * Gets or sets the morph target manager\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/morphTargets\n */\n get morphTargetManager() {\n return this._internalAbstractMeshDataInfo._morphTargetManager;\n }\n set morphTargetManager(value) {\n if (this._internalAbstractMeshDataInfo._morphTargetManager === value) {\n return;\n }\n this._internalAbstractMeshDataInfo._morphTargetManager = value;\n this._syncGeometryWithMorphTargetManager();\n }\n /**\n * Gets or sets the baked vertex animation manager\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/baked_texture_animations\n */\n get bakedVertexAnimationManager() {\n return this._internalAbstractMeshDataInfo._bakedVertexAnimationManager;\n }\n set bakedVertexAnimationManager(value) {\n if (this._internalAbstractMeshDataInfo._bakedVertexAnimationManager === value) {\n return;\n }\n this._internalAbstractMeshDataInfo._bakedVertexAnimationManager = value;\n this._markSubMeshesAsAttributesDirty();\n }\n /** @internal */\n _syncGeometryWithMorphTargetManager() { }\n /**\n * @internal\n */\n _updateNonUniformScalingState(value) {\n if (!super._updateNonUniformScalingState(value)) {\n return false;\n }\n this._markSubMeshesAsMiscDirty();\n return true;\n }\n /** @internal */\n get rawBoundingInfo() {\n return this._internalAbstractMeshDataInfo._rawBoundingInfo;\n }\n set rawBoundingInfo(boundingInfo) {\n this._internalAbstractMeshDataInfo._rawBoundingInfo = boundingInfo;\n }\n /** Set a function to call when this mesh collides with another one */\n set onCollide(callback) {\n if (this._internalAbstractMeshDataInfo._meshCollisionData._onCollideObserver) {\n this.onCollideObservable.remove(this._internalAbstractMeshDataInfo._meshCollisionData._onCollideObserver);\n }\n this._internalAbstractMeshDataInfo._meshCollisionData._onCollideObserver = this.onCollideObservable.add(callback);\n }\n /** Set a function to call when the collision's position changes */\n set onCollisionPositionChange(callback) {\n if (this._internalAbstractMeshDataInfo._meshCollisionData._onCollisionPositionChangeObserver) {\n this.onCollisionPositionChangeObservable.remove(this._internalAbstractMeshDataInfo._meshCollisionData._onCollisionPositionChangeObserver);\n }\n this._internalAbstractMeshDataInfo._meshCollisionData._onCollisionPositionChangeObserver = this.onCollisionPositionChangeObservable.add(callback);\n }\n /**\n * Gets or sets mesh visibility between 0 and 1 (default is 1)\n */\n get visibility() {\n return this._internalAbstractMeshDataInfo._visibility;\n }\n /**\n * Gets or sets mesh visibility between 0 and 1 (default is 1)\n */\n set visibility(value) {\n if (this._internalAbstractMeshDataInfo._visibility === value) {\n return;\n }\n const oldValue = this._internalAbstractMeshDataInfo._visibility;\n this._internalAbstractMeshDataInfo._visibility = value;\n if ((oldValue === 1 && value !== 1) || (oldValue !== 1 && value === 1)) {\n this._markSubMeshesAsDirty((defines) => {\n defines.markAsMiscDirty();\n defines.markAsPrePassDirty();\n });\n }\n }\n /**\n * Gets or sets the property which disables the test that is checking that the mesh under the pointer is the same than the previous time we tested for it (default: false).\n * Set this property to true if you want thin instances picking to be reported accurately when moving over the mesh.\n * Note that setting this property to true will incur some performance penalties when dealing with pointer events for this mesh so use it sparingly.\n */\n get pointerOverDisableMeshTesting() {\n return this._internalAbstractMeshDataInfo._pointerOverDisableMeshTesting;\n }\n set pointerOverDisableMeshTesting(disable) {\n this._internalAbstractMeshDataInfo._pointerOverDisableMeshTesting = disable;\n }\n /**\n * Specifies the rendering group id for this mesh (0 by default)\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/advanced/transparent_rendering#rendering-groups\n */\n get renderingGroupId() {\n return this._internalAbstractMeshDataInfo._renderingGroupId;\n }\n set renderingGroupId(value) {\n this._internalAbstractMeshDataInfo._renderingGroupId = value;\n }\n /** Gets or sets current material */\n get material() {\n return this._internalAbstractMeshDataInfo._material;\n }\n set material(value) {\n if (this._internalAbstractMeshDataInfo._material === value) {\n return;\n }\n // remove from material mesh map id needed\n if (this._internalAbstractMeshDataInfo._material && this._internalAbstractMeshDataInfo._material.meshMap) {\n this._internalAbstractMeshDataInfo._material.meshMap[this.uniqueId] = undefined;\n }\n this._internalAbstractMeshDataInfo._material = value;\n if (value && value.meshMap) {\n value.meshMap[this.uniqueId] = this;\n }\n if (this.onMaterialChangedObservable.hasObservers()) {\n this.onMaterialChangedObservable.notifyObservers(this);\n }\n if (!this.subMeshes) {\n return;\n }\n this.resetDrawCache();\n this._unBindEffect();\n }\n /**\n * Gets the material used to render the mesh in a specific render pass\n * @param renderPassId render pass id\n * @returns material used for the render pass. If no specific material is used for this render pass, undefined is returned (meaning mesh.material is used for this pass)\n */\n getMaterialForRenderPass(renderPassId) {\n var _a;\n return (_a = this._internalAbstractMeshDataInfo._materialForRenderPass) === null || _a === void 0 ? void 0 : _a[renderPassId];\n }\n /**\n * Sets the material to be used to render the mesh in a specific render pass\n * @param renderPassId render pass id\n * @param material material to use for this render pass. If undefined is passed, no specific material will be used for this render pass but the regular material will be used instead (mesh.material)\n */\n setMaterialForRenderPass(renderPassId, material) {\n this.resetDrawCache(renderPassId);\n if (!this._internalAbstractMeshDataInfo._materialForRenderPass) {\n this._internalAbstractMeshDataInfo._materialForRenderPass = [];\n }\n this._internalAbstractMeshDataInfo._materialForRenderPass[renderPassId] = material;\n }\n /**\n * Gets or sets a boolean indicating that this mesh can receive realtime shadows\n * @see https://doc.babylonjs.com/features/featuresDeepDive/lights/shadows\n */\n get receiveShadows() {\n return this._internalAbstractMeshDataInfo._receiveShadows;\n }\n set receiveShadows(value) {\n if (this._internalAbstractMeshDataInfo._receiveShadows === value) {\n return;\n }\n this._internalAbstractMeshDataInfo._receiveShadows = value;\n this._markSubMeshesAsLightDirty();\n }\n /** Gets or sets a boolean indicating that this mesh contains vertex color data with alpha values */\n get hasVertexAlpha() {\n return this._internalAbstractMeshDataInfo._hasVertexAlpha;\n }\n set hasVertexAlpha(value) {\n if (this._internalAbstractMeshDataInfo._hasVertexAlpha === value) {\n return;\n }\n this._internalAbstractMeshDataInfo._hasVertexAlpha = value;\n this._markSubMeshesAsAttributesDirty();\n this._markSubMeshesAsMiscDirty();\n }\n /** Gets or sets a boolean indicating that this mesh needs to use vertex color data to render (if this kind of vertex data is available in the geometry) */\n get useVertexColors() {\n return this._internalAbstractMeshDataInfo._useVertexColors;\n }\n set useVertexColors(value) {\n if (this._internalAbstractMeshDataInfo._useVertexColors === value) {\n return;\n }\n this._internalAbstractMeshDataInfo._useVertexColors = value;\n this._markSubMeshesAsAttributesDirty();\n }\n /**\n * Gets or sets a boolean indicating that bone animations must be computed by the GPU (true by default)\n */\n get computeBonesUsingShaders() {\n return this._internalAbstractMeshDataInfo._computeBonesUsingShaders;\n }\n set computeBonesUsingShaders(value) {\n if (this._internalAbstractMeshDataInfo._computeBonesUsingShaders === value) {\n return;\n }\n this._internalAbstractMeshDataInfo._computeBonesUsingShaders = value;\n this._markSubMeshesAsAttributesDirty();\n }\n /** Gets or sets the number of allowed bone influences per vertex (4 by default) */\n get numBoneInfluencers() {\n return this._internalAbstractMeshDataInfo._numBoneInfluencers;\n }\n set numBoneInfluencers(value) {\n if (this._internalAbstractMeshDataInfo._numBoneInfluencers === value) {\n return;\n }\n this._internalAbstractMeshDataInfo._numBoneInfluencers = value;\n this._markSubMeshesAsAttributesDirty();\n }\n /** Gets or sets a boolean indicating that this mesh will allow fog to be rendered on it (true by default) */\n get applyFog() {\n return this._internalAbstractMeshDataInfo._applyFog;\n }\n set applyFog(value) {\n if (this._internalAbstractMeshDataInfo._applyFog === value) {\n return;\n }\n this._internalAbstractMeshDataInfo._applyFog = value;\n this._markSubMeshesAsMiscDirty();\n }\n /** When enabled, decompose picking matrices for better precision with large values for mesh position and scling */\n get enableDistantPicking() {\n return this._internalAbstractMeshDataInfo._enableDistantPicking;\n }\n set enableDistantPicking(value) {\n this._internalAbstractMeshDataInfo._enableDistantPicking = value;\n }\n /**\n * Gets or sets the current layer mask (default is 0x0FFFFFFF)\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/layerMasksAndMultiCam\n */\n get layerMask() {\n return this._internalAbstractMeshDataInfo._layerMask;\n }\n set layerMask(value) {\n if (value === this._internalAbstractMeshDataInfo._layerMask) {\n return;\n }\n this._internalAbstractMeshDataInfo._layerMask = value;\n this._resyncLightSources();\n }\n /**\n * Gets or sets a collision mask used to mask collisions (default is -1).\n * A collision between A and B will happen if A.collisionGroup & b.collisionMask !== 0\n */\n get collisionMask() {\n return this._internalAbstractMeshDataInfo._meshCollisionData._collisionMask;\n }\n set collisionMask(mask) {\n this._internalAbstractMeshDataInfo._meshCollisionData._collisionMask = !isNaN(mask) ? mask : -1;\n }\n /**\n * Gets or sets a collision response flag (default is true).\n * when collisionResponse is false, events are still triggered but colliding entity has no response\n * This helps creating trigger volume when user wants collision feedback events but not position/velocity\n * to respond to the collision.\n */\n get collisionResponse() {\n return this._internalAbstractMeshDataInfo._meshCollisionData._collisionResponse;\n }\n set collisionResponse(response) {\n this._internalAbstractMeshDataInfo._meshCollisionData._collisionResponse = response;\n }\n /**\n * Gets or sets the current collision group mask (-1 by default).\n * A collision between A and B will happen if A.collisionGroup & b.collisionMask !== 0\n */\n get collisionGroup() {\n return this._internalAbstractMeshDataInfo._meshCollisionData._collisionGroup;\n }\n set collisionGroup(mask) {\n this._internalAbstractMeshDataInfo._meshCollisionData._collisionGroup = !isNaN(mask) ? mask : -1;\n }\n /**\n * Gets or sets current surrounding meshes (null by default).\n *\n * By default collision detection is tested against every mesh in the scene.\n * It is possible to set surroundingMeshes to a defined list of meshes and then only these specified\n * meshes will be tested for the collision.\n *\n * Note: if set to an empty array no collision will happen when this mesh is moved.\n */\n get surroundingMeshes() {\n return this._internalAbstractMeshDataInfo._meshCollisionData._surroundingMeshes;\n }\n set surroundingMeshes(meshes) {\n this._internalAbstractMeshDataInfo._meshCollisionData._surroundingMeshes = meshes;\n }\n /** Gets the list of lights affecting that mesh */\n get lightSources() {\n return this._lightSources;\n }\n /** @internal */\n get _positions() {\n return null;\n }\n /**\n * Gets or sets a skeleton to apply skinning transformations\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/bonesSkeletons\n */\n set skeleton(value) {\n const skeleton = this._internalAbstractMeshDataInfo._skeleton;\n if (skeleton && skeleton.needInitialSkinMatrix) {\n skeleton._unregisterMeshWithPoseMatrix(this);\n }\n if (value && value.needInitialSkinMatrix) {\n value._registerMeshWithPoseMatrix(this);\n }\n this._internalAbstractMeshDataInfo._skeleton = value;\n if (!this._internalAbstractMeshDataInfo._skeleton) {\n this._bonesTransformMatrices = null;\n }\n this._markSubMeshesAsAttributesDirty();\n }\n get skeleton() {\n return this._internalAbstractMeshDataInfo._skeleton;\n }\n // Constructor\n /**\n * Creates a new AbstractMesh\n * @param name defines the name of the mesh\n * @param scene defines the hosting scene\n */\n constructor(name, scene = null) {\n super(name, scene, false);\n // Internal data\n /** @internal */\n this._internalAbstractMeshDataInfo = new _InternalAbstractMeshDataInfo();\n /** @internal */\n this._waitingMaterialId = null;\n /**\n * The culling strategy to use to check whether the mesh must be rendered or not.\n * This value can be changed at any time and will be used on the next render mesh selection.\n * The possible values are :\n * - AbstractMesh.CULLINGSTRATEGY_STANDARD\n * - AbstractMesh.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY\n * - AbstractMesh.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION\n * - AbstractMesh.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY\n * Please read each static variable documentation to get details about the culling process.\n * */\n this.cullingStrategy = AbstractMesh.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY;\n // Events\n /**\n * An event triggered when this mesh collides with another one\n */\n this.onCollideObservable = new Observable();\n /**\n * An event triggered when the collision's position changes\n */\n this.onCollisionPositionChangeObservable = new Observable();\n /**\n * An event triggered when material is changed\n */\n this.onMaterialChangedObservable = new Observable();\n // Properties\n /**\n * Gets or sets the orientation for POV movement & rotation\n */\n this.definedFacingForward = true;\n /** @internal */\n this._occlusionQuery = null;\n /** @internal */\n this._renderingGroup = null;\n /** Gets or sets the alpha index used to sort transparent meshes\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/advanced/transparent_rendering#alpha-index\n */\n this.alphaIndex = Number.MAX_VALUE;\n /**\n * Gets or sets a boolean indicating if the mesh is visible (renderable). Default is true\n */\n this.isVisible = true;\n /**\n * Gets or sets a boolean indicating if the mesh can be picked (by scene.pick for instance or through actions). Default is true\n */\n this.isPickable = true;\n /**\n * Gets or sets a boolean indicating if the mesh can be near picked. Default is false\n */\n this.isNearPickable = false;\n /**\n * Gets or sets a boolean indicating if the mesh can be near grabbed. Default is false\n */\n this.isNearGrabbable = false;\n /** Gets or sets a boolean indicating that bounding boxes of subMeshes must be rendered as well (false by default) */\n this.showSubMeshesBoundingBox = false;\n /** Gets or sets a boolean indicating if the mesh must be considered as a ray blocker for lens flares (false by default)\n * @see https://doc.babylonjs.com/features/featuresDeepDive/environment/lenseFlare\n */\n this.isBlocker = false;\n /**\n * Gets or sets a boolean indicating that pointer move events must be supported on this mesh (false by default)\n */\n this.enablePointerMoveEvents = false;\n /** Defines color to use when rendering outline */\n this.outlineColor = Color3.Red();\n /** Define width to use when rendering outline */\n this.outlineWidth = 0.02;\n /** Defines color to use when rendering overlay */\n this.overlayColor = Color3.Red();\n /** Defines alpha to use when rendering overlay */\n this.overlayAlpha = 0.5;\n /** Gets or sets a boolean indicating that internal octree (if available) can be used to boost submeshes selection (true by default) */\n this.useOctreeForRenderingSelection = true;\n /** Gets or sets a boolean indicating that internal octree (if available) can be used to boost submeshes picking (true by default) */\n this.useOctreeForPicking = true;\n /** Gets or sets a boolean indicating that internal octree (if available) can be used to boost submeshes collision (true by default) */\n this.useOctreeForCollisions = true;\n /**\n * True if the mesh must be rendered in any case (this will shortcut the frustum clipping phase)\n */\n this.alwaysSelectAsActiveMesh = false;\n /**\n * Gets or sets a boolean indicating that the bounding info does not need to be kept in sync (for performance reason)\n */\n this.doNotSyncBoundingInfo = false;\n /**\n * Gets or sets the current action manager\n * @see https://doc.babylonjs.com/features/featuresDeepDive/events/actions\n */\n this.actionManager = null;\n /**\n * Gets or sets the ellipsoid used to impersonate this mesh when using collision engine (default is (0.5, 1, 0.5))\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/camera_collisions\n */\n this.ellipsoid = new Vector3(0.5, 1, 0.5);\n /**\n * Gets or sets the ellipsoid offset used to impersonate this mesh when using collision engine (default is (0, 0, 0))\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/camera_collisions\n */\n this.ellipsoidOffset = new Vector3(0, 0, 0);\n // Edges\n /**\n * Defines edge width used when edgesRenderer is enabled\n * @see https://www.babylonjs-playground.com/#10OJSG#13\n */\n this.edgesWidth = 1;\n /**\n * Defines edge color used when edgesRenderer is enabled\n * @see https://www.babylonjs-playground.com/#10OJSG#13\n */\n this.edgesColor = new Color4(1, 0, 0, 1);\n /** @internal */\n this._edgesRenderer = null;\n /** @internal */\n this._masterMesh = null;\n this._boundingInfo = null;\n this._boundingInfoIsDirty = true;\n /** @internal */\n this._renderId = 0;\n /** @internal */\n this._intersectionsInProgress = new Array();\n /** @internal */\n this._unIndexed = false;\n /** @internal */\n this._lightSources = new Array();\n // Loading properties\n /** @internal */\n this._waitingData = {\n lods: null,\n actions: null,\n freezeWorldMatrix: null,\n };\n /** @internal */\n this._bonesTransformMatrices = null;\n /** @internal */\n this._transformMatrixTexture = null;\n /**\n * An event triggered when the mesh is rebuilt.\n */\n this.onRebuildObservable = new Observable();\n this._onCollisionPositionChange = (collisionId, newPosition, collidedMesh = null) => {\n newPosition.subtractToRef(this._internalAbstractMeshDataInfo._meshCollisionData._oldPositionForCollisions, this._internalAbstractMeshDataInfo._meshCollisionData._diffPositionForCollisions);\n if (this._internalAbstractMeshDataInfo._meshCollisionData._diffPositionForCollisions.length() > Engine.CollisionsEpsilon) {\n this.position.addInPlace(this._internalAbstractMeshDataInfo._meshCollisionData._diffPositionForCollisions);\n }\n if (collidedMesh) {\n this.onCollideObservable.notifyObservers(collidedMesh);\n }\n this.onCollisionPositionChangeObservable.notifyObservers(this.position);\n };\n scene = this.getScene();\n scene.addMesh(this);\n this._resyncLightSources();\n // Mesh Uniform Buffer.\n this._uniformBuffer = new UniformBuffer(this.getScene().getEngine(), undefined, undefined, name, !this.getScene().getEngine().isWebGPU);\n this._buildUniformLayout();\n switch (scene.performancePriority) {\n case ScenePerformancePriority.Aggressive:\n this.doNotSyncBoundingInfo = true;\n // eslint-disable-next-line no-fallthrough\n case ScenePerformancePriority.Intermediate:\n this.alwaysSelectAsActiveMesh = true;\n this.isPickable = false;\n break;\n }\n }\n _buildUniformLayout() {\n this._uniformBuffer.addUniform(\"world\", 16);\n this._uniformBuffer.addUniform(\"visibility\", 1);\n this._uniformBuffer.create();\n }\n /**\n * Transfer the mesh values to its UBO.\n * @param world The world matrix associated with the mesh\n */\n transferToEffect(world) {\n const ubo = this._uniformBuffer;\n ubo.updateMatrix(\"world\", world);\n ubo.updateFloat(\"visibility\", this._internalAbstractMeshDataInfo._visibility);\n ubo.update();\n }\n /**\n * Gets the mesh uniform buffer.\n * @returns the uniform buffer of the mesh.\n */\n getMeshUniformBuffer() {\n return this._uniformBuffer;\n }\n /**\n * Returns the string \"AbstractMesh\"\n * @returns \"AbstractMesh\"\n */\n getClassName() {\n return \"AbstractMesh\";\n }\n /**\n * Gets a string representation of the current mesh\n * @param fullDetails defines a boolean indicating if full details must be included\n * @returns a string representation of the current mesh\n */\n toString(fullDetails) {\n let ret = \"Name: \" + this.name + \", isInstance: \" + (this.getClassName() !== \"InstancedMesh\" ? \"YES\" : \"NO\");\n ret += \", # of submeshes: \" + (this.subMeshes ? this.subMeshes.length : 0);\n const skeleton = this._internalAbstractMeshDataInfo._skeleton;\n if (skeleton) {\n ret += \", skeleton: \" + skeleton.name;\n }\n if (fullDetails) {\n ret += \", billboard mode: \" + [\"NONE\", \"X\", \"Y\", null, \"Z\", null, null, \"ALL\"][this.billboardMode];\n ret += \", freeze wrld mat: \" + (this._isWorldMatrixFrozen || this._waitingData.freezeWorldMatrix ? \"YES\" : \"NO\");\n }\n return ret;\n }\n /**\n * @internal\n */\n _getEffectiveParent() {\n if (this._masterMesh && this.billboardMode !== TransformNode.BILLBOARDMODE_NONE) {\n return this._masterMesh;\n }\n return super._getEffectiveParent();\n }\n /**\n * @internal\n */\n _getActionManagerForTrigger(trigger, initialCall = true) {\n if (this.actionManager && (initialCall || this.actionManager.isRecursive)) {\n if (trigger) {\n if (this.actionManager.hasSpecificTrigger(trigger)) {\n return this.actionManager;\n }\n }\n else {\n return this.actionManager;\n }\n }\n if (!this.parent) {\n return null;\n }\n return this.parent._getActionManagerForTrigger(trigger, false);\n }\n /**\n * @internal\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _rebuild(dispose = false) {\n this.onRebuildObservable.notifyObservers(this);\n if (this._occlusionQuery !== null) {\n this._occlusionQuery = null;\n }\n if (!this.subMeshes) {\n return;\n }\n for (const subMesh of this.subMeshes) {\n subMesh._rebuild();\n }\n }\n /** @internal */\n _resyncLightSources() {\n this._lightSources.length = 0;\n for (const light of this.getScene().lights) {\n if (!light.isEnabled()) {\n continue;\n }\n if (light.canAffectMesh(this)) {\n this._lightSources.push(light);\n }\n }\n this._markSubMeshesAsLightDirty();\n }\n /**\n * @internal\n */\n _resyncLightSource(light) {\n const isIn = light.isEnabled() && light.canAffectMesh(this);\n const index = this._lightSources.indexOf(light);\n let removed = false;\n if (index === -1) {\n if (!isIn) {\n return;\n }\n this._lightSources.push(light);\n }\n else {\n if (isIn) {\n return;\n }\n removed = true;\n this._lightSources.splice(index, 1);\n }\n this._markSubMeshesAsLightDirty(removed);\n }\n /** @internal */\n _unBindEffect() {\n for (const subMesh of this.subMeshes) {\n subMesh.setEffect(null);\n }\n }\n /**\n * @internal\n */\n _removeLightSource(light, dispose) {\n const index = this._lightSources.indexOf(light);\n if (index === -1) {\n return;\n }\n this._lightSources.splice(index, 1);\n this._markSubMeshesAsLightDirty(dispose);\n }\n _markSubMeshesAsDirty(func) {\n if (!this.subMeshes) {\n return;\n }\n for (const subMesh of this.subMeshes) {\n for (let i = 0; i < subMesh._drawWrappers.length; ++i) {\n const drawWrapper = subMesh._drawWrappers[i];\n if (!drawWrapper || !drawWrapper.defines || !drawWrapper.defines.markAllAsDirty) {\n continue;\n }\n func(drawWrapper.defines);\n }\n }\n }\n /**\n * @internal\n */\n _markSubMeshesAsLightDirty(dispose = false) {\n this._markSubMeshesAsDirty((defines) => defines.markAsLightDirty(dispose));\n }\n /** @internal */\n _markSubMeshesAsAttributesDirty() {\n this._markSubMeshesAsDirty((defines) => defines.markAsAttributesDirty());\n }\n /** @internal */\n _markSubMeshesAsMiscDirty() {\n this._markSubMeshesAsDirty((defines) => defines.markAsMiscDirty());\n }\n /**\n * Flag the AbstractMesh as dirty (Forcing it to update everything)\n * @param property if set to \"rotation\" the objects rotationQuaternion will be set to null\n * @returns this AbstractMesh\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n markAsDirty(property) {\n this._currentRenderId = Number.MAX_VALUE;\n this._isDirty = true;\n return this;\n }\n /**\n * Resets the draw wrappers cache for all submeshes of this abstract mesh\n * @param passId If provided, releases only the draw wrapper corresponding to this render pass id\n */\n resetDrawCache(passId) {\n if (!this.subMeshes) {\n return;\n }\n for (const subMesh of this.subMeshes) {\n subMesh.resetDrawCache(passId);\n }\n }\n // Methods\n /**\n * Returns true if the mesh is blocked. Implemented by child classes\n */\n get isBlocked() {\n return false;\n }\n /**\n * Returns the mesh itself by default. Implemented by child classes\n * @param camera defines the camera to use to pick the right LOD level\n * @returns the currentAbstractMesh\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n getLOD(camera) {\n return this;\n }\n /**\n * Returns 0 by default. Implemented by child classes\n * @returns an integer\n */\n getTotalVertices() {\n return 0;\n }\n /**\n * Returns a positive integer : the total number of indices in this mesh geometry.\n * @returns the number of indices or zero if the mesh has no geometry.\n */\n getTotalIndices() {\n return 0;\n }\n /**\n * Returns null by default. Implemented by child classes\n * @returns null\n */\n getIndices() {\n return null;\n }\n /**\n * Returns the array of the requested vertex data kind. Implemented by child classes\n * @param kind defines the vertex data kind to use\n * @returns null\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n getVerticesData(kind) {\n return null;\n }\n /**\n * Sets the vertex data of the mesh geometry for the requested `kind`.\n * If the mesh has no geometry, a new Geometry object is set to the mesh and then passed this vertex data.\n * Note that a new underlying VertexBuffer object is created each call.\n * If the `kind` is the `PositionKind`, the mesh BoundingInfo is renewed, so the bounding box and sphere, and the mesh World Matrix is recomputed.\n * @param kind defines vertex data kind:\n * * VertexBuffer.PositionKind\n * * VertexBuffer.UVKind\n * * VertexBuffer.UV2Kind\n * * VertexBuffer.UV3Kind\n * * VertexBuffer.UV4Kind\n * * VertexBuffer.UV5Kind\n * * VertexBuffer.UV6Kind\n * * VertexBuffer.ColorKind\n * * VertexBuffer.MatricesIndicesKind\n * * VertexBuffer.MatricesIndicesExtraKind\n * * VertexBuffer.MatricesWeightsKind\n * * VertexBuffer.MatricesWeightsExtraKind\n * @param data defines the data source\n * @param updatable defines if the data must be flagged as updatable (or static)\n * @param stride defines the vertex stride (size of an entire vertex). Can be null and in this case will be deduced from vertex data kind\n * @returns the current mesh\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n setVerticesData(kind, data, updatable, stride) {\n return this;\n }\n /**\n * Updates the existing vertex data of the mesh geometry for the requested `kind`.\n * If the mesh has no geometry, it is simply returned as it is.\n * @param kind defines vertex data kind:\n * * VertexBuffer.PositionKind\n * * VertexBuffer.UVKind\n * * VertexBuffer.UV2Kind\n * * VertexBuffer.UV3Kind\n * * VertexBuffer.UV4Kind\n * * VertexBuffer.UV5Kind\n * * VertexBuffer.UV6Kind\n * * VertexBuffer.ColorKind\n * * VertexBuffer.MatricesIndicesKind\n * * VertexBuffer.MatricesIndicesExtraKind\n * * VertexBuffer.MatricesWeightsKind\n * * VertexBuffer.MatricesWeightsExtraKind\n * @param data defines the data source\n * @param updateExtends If `kind` is `PositionKind` and if `updateExtends` is true, the mesh BoundingInfo is renewed, so the bounding box and sphere, and the mesh World Matrix is recomputed\n * @param makeItUnique If true, a new global geometry is created from this data and is set to the mesh\n * @returns the current mesh\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n updateVerticesData(kind, data, updateExtends, makeItUnique) {\n return this;\n }\n /**\n * Sets the mesh indices,\n * If the mesh has no geometry, a new Geometry object is created and set to the mesh.\n * @param indices Expects an array populated with integers or a typed array (Int32Array, Uint32Array, Uint16Array)\n * @param totalVertices Defines the total number of vertices\n * @returns the current mesh\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n setIndices(indices, totalVertices) {\n return this;\n }\n /**\n * Gets a boolean indicating if specific vertex data is present\n * @param kind defines the vertex data kind to use\n * @returns true is data kind is present\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n isVerticesDataPresent(kind) {\n return false;\n }\n /**\n * Returns the mesh BoundingInfo object or creates a new one and returns if it was undefined.\n * Note that it returns a shallow bounding of the mesh (i.e. it does not include children).\n * However, if the mesh contains thin instances, it will be expanded to include them. If you want the \"raw\" bounding data instead, then use `getRawBoundingInfo()`.\n * To get the full bounding of all children, call `getHierarchyBoundingVectors` instead.\n * @returns a BoundingInfo\n */\n getBoundingInfo() {\n if (this._masterMesh) {\n return this._masterMesh.getBoundingInfo();\n }\n if (this._boundingInfoIsDirty) {\n this._boundingInfoIsDirty = false;\n // this._boundingInfo is being created if undefined\n this._updateBoundingInfo();\n }\n // cannot be null.\n return this._boundingInfo;\n }\n /**\n * Returns the bounding info unnafected by instance data.\n * @returns the bounding info of the mesh unaffected by instance data.\n */\n getRawBoundingInfo() {\n var _a;\n return (_a = this.rawBoundingInfo) !== null && _a !== void 0 ? _a : this.getBoundingInfo();\n }\n /**\n * Overwrite the current bounding info\n * @param boundingInfo defines the new bounding info\n * @returns the current mesh\n */\n setBoundingInfo(boundingInfo) {\n this._boundingInfo = boundingInfo;\n return this;\n }\n /**\n * Returns true if there is already a bounding info\n */\n get hasBoundingInfo() {\n return this._boundingInfo !== null;\n }\n /**\n * Creates a new bounding info for the mesh\n * @param minimum min vector of the bounding box/sphere\n * @param maximum max vector of the bounding box/sphere\n * @param worldMatrix defines the new world matrix\n * @returns the new bounding info\n */\n buildBoundingInfo(minimum, maximum, worldMatrix) {\n this._boundingInfo = new BoundingInfo(minimum, maximum, worldMatrix);\n return this._boundingInfo;\n }\n /**\n * Uniformly scales the mesh to fit inside of a unit cube (1 X 1 X 1 units)\n * @param includeDescendants Use the hierarchy's bounding box instead of the mesh's bounding box. Default is false\n * @param ignoreRotation ignore rotation when computing the scale (ie. object will be axis aligned). Default is false\n * @param predicate predicate that is passed in to getHierarchyBoundingVectors when selecting which object should be included when scaling\n * @returns the current mesh\n */\n normalizeToUnitCube(includeDescendants = true, ignoreRotation = false, predicate) {\n return super.normalizeToUnitCube(includeDescendants, ignoreRotation, predicate);\n }\n /** Gets a boolean indicating if this mesh has skinning data and an attached skeleton */\n get useBones() {\n return ((this.skeleton &&\n this.getScene().skeletonsEnabled &&\n this.isVerticesDataPresent(VertexBuffer.MatricesIndicesKind) &&\n this.isVerticesDataPresent(VertexBuffer.MatricesWeightsKind)));\n }\n /** @internal */\n _preActivate() { }\n /**\n * @internal\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _preActivateForIntermediateRendering(renderId) { }\n /**\n * @internal\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _activate(renderId, intermediateRendering) {\n this._renderId = renderId;\n return true;\n }\n /** @internal */\n _postActivate() {\n // Do nothing\n }\n /** @internal */\n _freeze() {\n // Do nothing\n }\n /** @internal */\n _unFreeze() {\n // Do nothing\n }\n /**\n * Gets the current world matrix\n * @returns a Matrix\n */\n getWorldMatrix() {\n if (this._masterMesh && this.billboardMode === TransformNode.BILLBOARDMODE_NONE) {\n return this._masterMesh.getWorldMatrix();\n }\n return super.getWorldMatrix();\n }\n /** @internal */\n _getWorldMatrixDeterminant() {\n if (this._masterMesh) {\n return this._masterMesh._getWorldMatrixDeterminant();\n }\n return super._getWorldMatrixDeterminant();\n }\n /**\n * Gets a boolean indicating if this mesh is an instance or a regular mesh\n */\n get isAnInstance() {\n return false;\n }\n /**\n * Gets a boolean indicating if this mesh has instances\n */\n get hasInstances() {\n return false;\n }\n /**\n * Gets a boolean indicating if this mesh has thin instances\n */\n get hasThinInstances() {\n return false;\n }\n // ================================== Point of View Movement =================================\n /**\n * Perform relative position change from the point of view of behind the front of the mesh.\n * This is performed taking into account the meshes current rotation, so you do not have to care.\n * Supports definition of mesh facing forward or backward {@link definedFacingForwardSearch | See definedFacingForwardSearch }.\n * @param amountRight defines the distance on the right axis\n * @param amountUp defines the distance on the up axis\n * @param amountForward defines the distance on the forward axis\n * @returns the current mesh\n */\n movePOV(amountRight, amountUp, amountForward) {\n this.position.addInPlace(this.calcMovePOV(amountRight, amountUp, amountForward));\n return this;\n }\n /**\n * Calculate relative position change from the point of view of behind the front of the mesh.\n * This is performed taking into account the meshes current rotation, so you do not have to care.\n * Supports definition of mesh facing forward or backward {@link definedFacingForwardSearch | See definedFacingForwardSearch }.\n * @param amountRight defines the distance on the right axis\n * @param amountUp defines the distance on the up axis\n * @param amountForward defines the distance on the forward axis\n * @returns the new displacement vector\n */\n calcMovePOV(amountRight, amountUp, amountForward) {\n const rotMatrix = new Matrix();\n const rotQuaternion = this.rotationQuaternion ? this.rotationQuaternion : Quaternion.RotationYawPitchRoll(this.rotation.y, this.rotation.x, this.rotation.z);\n rotQuaternion.toRotationMatrix(rotMatrix);\n const translationDelta = Vector3.Zero();\n const defForwardMult = this.definedFacingForward ? -1 : 1;\n Vector3.TransformCoordinatesFromFloatsToRef(amountRight * defForwardMult, amountUp, amountForward * defForwardMult, rotMatrix, translationDelta);\n return translationDelta;\n }\n // ================================== Point of View Rotation =================================\n /**\n * Perform relative rotation change from the point of view of behind the front of the mesh.\n * Supports definition of mesh facing forward or backward {@link definedFacingForwardSearch | See definedFacingForwardSearch }.\n * @param flipBack defines the flip\n * @param twirlClockwise defines the twirl\n * @param tiltRight defines the tilt\n * @returns the current mesh\n */\n rotatePOV(flipBack, twirlClockwise, tiltRight) {\n this.rotation.addInPlace(this.calcRotatePOV(flipBack, twirlClockwise, tiltRight));\n return this;\n }\n /**\n * Calculate relative rotation change from the point of view of behind the front of the mesh.\n * Supports definition of mesh facing forward or backward {@link definedFacingForwardSearch | See definedFacingForwardSearch }.\n * @param flipBack defines the flip\n * @param twirlClockwise defines the twirl\n * @param tiltRight defines the tilt\n * @returns the new rotation vector\n */\n calcRotatePOV(flipBack, twirlClockwise, tiltRight) {\n const defForwardMult = this.definedFacingForward ? 1 : -1;\n return new Vector3(flipBack * defForwardMult, twirlClockwise, tiltRight * defForwardMult);\n }\n /**\n * This method recomputes and sets a new BoundingInfo to the mesh unless it is locked.\n * This means the mesh underlying bounding box and sphere are recomputed.\n * @param applySkeleton defines whether to apply the skeleton before computing the bounding info\n * @param applyMorph defines whether to apply the morph target before computing the bounding info\n * @returns the current mesh\n */\n refreshBoundingInfo(applySkeleton = false, applyMorph = false) {\n if (this._boundingInfo && this._boundingInfo.isLocked) {\n return this;\n }\n this._refreshBoundingInfo(this._getPositionData(applySkeleton, applyMorph), null);\n return this;\n }\n /**\n * @internal\n */\n _refreshBoundingInfo(data, bias) {\n if (data) {\n const extend = extractMinAndMax(data, 0, this.getTotalVertices(), bias);\n if (this._boundingInfo) {\n this._boundingInfo.reConstruct(extend.minimum, extend.maximum);\n }\n else {\n this._boundingInfo = new BoundingInfo(extend.minimum, extend.maximum);\n }\n }\n if (this.subMeshes) {\n for (let index = 0; index < this.subMeshes.length; index++) {\n this.subMeshes[index].refreshBoundingInfo(data);\n }\n }\n this._updateBoundingInfo();\n }\n /**\n * Internal function to get buffer data and possibly apply morphs and normals\n * @param applySkeleton\n * @param applyMorph\n * @param data\n * @param kind the kind of data you want. Can be Normal or Position\n */\n _getData(applySkeleton = false, applyMorph = false, data, kind = VertexBuffer.PositionKind) {\n data = data !== null && data !== void 0 ? data : this.getVerticesData(kind).slice();\n if (data && applyMorph && this.morphTargetManager) {\n let faceIndexCount = 0;\n let positionIndex = 0;\n for (let vertexCount = 0; vertexCount < data.length; vertexCount++) {\n for (let targetCount = 0; targetCount < this.morphTargetManager.numTargets; targetCount++) {\n const targetMorph = this.morphTargetManager.getTarget(targetCount);\n const influence = targetMorph.influence;\n if (influence > 0.0) {\n const morphTargetPositions = targetMorph.getPositions();\n if (morphTargetPositions) {\n data[vertexCount] += (morphTargetPositions[vertexCount] - data[vertexCount]) * influence;\n }\n }\n }\n faceIndexCount++;\n if (kind === VertexBuffer.PositionKind) {\n if (this._positions && faceIndexCount === 3) {\n // We want to merge into positions every 3 indices starting (but not 0)\n faceIndexCount = 0;\n const index = positionIndex * 3;\n this._positions[positionIndex++].copyFromFloats(data[index], data[index + 1], data[index + 2]);\n }\n }\n }\n }\n if (data && applySkeleton && this.skeleton) {\n const matricesIndicesData = this.getVerticesData(VertexBuffer.MatricesIndicesKind);\n const matricesWeightsData = this.getVerticesData(VertexBuffer.MatricesWeightsKind);\n if (matricesWeightsData && matricesIndicesData) {\n const needExtras = this.numBoneInfluencers > 4;\n const matricesIndicesExtraData = needExtras ? this.getVerticesData(VertexBuffer.MatricesIndicesExtraKind) : null;\n const matricesWeightsExtraData = needExtras ? this.getVerticesData(VertexBuffer.MatricesWeightsExtraKind) : null;\n const skeletonMatrices = this.skeleton.getTransformMatrices(this);\n const tempVector = TmpVectors.Vector3[0];\n const finalMatrix = TmpVectors.Matrix[0];\n const tempMatrix = TmpVectors.Matrix[1];\n let matWeightIdx = 0;\n for (let index = 0; index < data.length; index += 3, matWeightIdx += 4) {\n finalMatrix.reset();\n let inf;\n let weight;\n for (inf = 0; inf < 4; inf++) {\n weight = matricesWeightsData[matWeightIdx + inf];\n if (weight > 0) {\n Matrix.FromFloat32ArrayToRefScaled(skeletonMatrices, Math.floor(matricesIndicesData[matWeightIdx + inf] * 16), weight, tempMatrix);\n finalMatrix.addToSelf(tempMatrix);\n }\n }\n if (needExtras) {\n for (inf = 0; inf < 4; inf++) {\n weight = matricesWeightsExtraData[matWeightIdx + inf];\n if (weight > 0) {\n Matrix.FromFloat32ArrayToRefScaled(skeletonMatrices, Math.floor(matricesIndicesExtraData[matWeightIdx + inf] * 16), weight, tempMatrix);\n finalMatrix.addToSelf(tempMatrix);\n }\n }\n }\n if (kind === VertexBuffer.NormalKind) {\n Vector3.TransformNormalFromFloatsToRef(data[index], data[index + 1], data[index + 2], finalMatrix, tempVector);\n }\n else {\n Vector3.TransformCoordinatesFromFloatsToRef(data[index], data[index + 1], data[index + 2], finalMatrix, tempVector);\n }\n tempVector.toArray(data, index);\n if (kind === VertexBuffer.PositionKind && this._positions) {\n this._positions[index / 3].copyFrom(tempVector);\n }\n }\n }\n }\n return data;\n }\n /**\n * Get the normals vertex data and optionally apply skeleton and morphing.\n * @param applySkeleton defines whether to apply the skeleton\n * @param applyMorph defines whether to apply the morph target\n * @returns the normals data\n */\n getNormalsData(applySkeleton = false, applyMorph = false) {\n return this._getData(applySkeleton, applyMorph, null, VertexBuffer.NormalKind);\n }\n /**\n * Get the position vertex data and optionally apply skeleton and morphing.\n * @param applySkeleton defines whether to apply the skeleton\n * @param applyMorph defines whether to apply the morph target\n * @param data defines the position data to apply the skeleton and morph to\n * @returns the position data\n */\n getPositionData(applySkeleton = false, applyMorph = false, data) {\n return this._getData(applySkeleton, applyMorph, data, VertexBuffer.PositionKind);\n }\n /**\n * @internal\n */\n _getPositionData(applySkeleton, applyMorph) {\n var _a;\n let data = this.getVerticesData(VertexBuffer.PositionKind);\n if (this._internalAbstractMeshDataInfo._positions) {\n this._internalAbstractMeshDataInfo._positions = null;\n }\n if (data && ((applySkeleton && this.skeleton) || (applyMorph && this.morphTargetManager))) {\n data = data.slice();\n this._generatePointsArray();\n if (this._positions) {\n const pos = this._positions;\n this._internalAbstractMeshDataInfo._positions = new Array(pos.length);\n for (let i = 0; i < pos.length; i++) {\n this._internalAbstractMeshDataInfo._positions[i] = ((_a = pos[i]) === null || _a === void 0 ? void 0 : _a.clone()) || new Vector3();\n }\n }\n return this.getPositionData(applySkeleton, applyMorph, data);\n }\n return data;\n }\n /** @internal */\n _updateBoundingInfo() {\n if (this._boundingInfo) {\n this._boundingInfo.update(this.worldMatrixFromCache);\n }\n else {\n this._boundingInfo = new BoundingInfo(Vector3.Zero(), Vector3.Zero(), this.worldMatrixFromCache);\n }\n this._updateSubMeshesBoundingInfo(this.worldMatrixFromCache);\n return this;\n }\n /**\n * @internal\n */\n _updateSubMeshesBoundingInfo(matrix) {\n if (!this.subMeshes) {\n return this;\n }\n const count = this.subMeshes.length;\n for (let subIndex = 0; subIndex < count; subIndex++) {\n const subMesh = this.subMeshes[subIndex];\n if (count > 1 || !subMesh.IsGlobal) {\n subMesh.updateBoundingInfo(matrix);\n }\n }\n return this;\n }\n /** @internal */\n _afterComputeWorldMatrix() {\n if (this.doNotSyncBoundingInfo) {\n return;\n }\n // Bounding info\n this._boundingInfoIsDirty = true;\n }\n /**\n * Returns `true` if the mesh is within the frustum defined by the passed array of planes.\n * A mesh is in the frustum if its bounding box intersects the frustum\n * @param frustumPlanes defines the frustum to test\n * @returns true if the mesh is in the frustum planes\n */\n isInFrustum(frustumPlanes) {\n return this.getBoundingInfo().isInFrustum(frustumPlanes, this.cullingStrategy);\n }\n /**\n * Returns `true` if the mesh is completely in the frustum defined be the passed array of planes.\n * A mesh is completely in the frustum if its bounding box it completely inside the frustum.\n * @param frustumPlanes defines the frustum to test\n * @returns true if the mesh is completely in the frustum planes\n */\n isCompletelyInFrustum(frustumPlanes) {\n return this.getBoundingInfo().isCompletelyInFrustum(frustumPlanes);\n }\n /**\n * True if the mesh intersects another mesh or a SolidParticle object\n * @param mesh defines a target mesh or SolidParticle to test\n * @param precise Unless the parameter `precise` is set to `true` the intersection is computed according to Axis Aligned Bounding Boxes (AABB), else according to OBB (Oriented BBoxes)\n * @param includeDescendants Can be set to true to test if the mesh defined in parameters intersects with the current mesh or any child meshes\n * @returns true if there is an intersection\n */\n intersectsMesh(mesh, precise = false, includeDescendants) {\n const boundingInfo = this.getBoundingInfo();\n const otherBoundingInfo = mesh.getBoundingInfo();\n if (boundingInfo.intersects(otherBoundingInfo, precise)) {\n return true;\n }\n if (includeDescendants) {\n for (const child of this.getChildMeshes()) {\n if (child.intersectsMesh(mesh, precise, true)) {\n return true;\n }\n }\n }\n return false;\n }\n /**\n * Returns true if the passed point (Vector3) is inside the mesh bounding box\n * @param point defines the point to test\n * @returns true if there is an intersection\n */\n intersectsPoint(point) {\n return this.getBoundingInfo().intersectsPoint(point);\n }\n // Collisions\n /**\n * Gets or sets a boolean indicating that this mesh can be used in the collision engine\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/camera_collisions\n */\n get checkCollisions() {\n return this._internalAbstractMeshDataInfo._meshCollisionData._checkCollisions;\n }\n set checkCollisions(collisionEnabled) {\n this._internalAbstractMeshDataInfo._meshCollisionData._checkCollisions = collisionEnabled;\n }\n /**\n * Gets Collider object used to compute collisions (not physics)\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/camera_collisions\n */\n get collider() {\n return this._internalAbstractMeshDataInfo._meshCollisionData._collider;\n }\n /**\n * Move the mesh using collision engine\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/camera_collisions\n * @param displacement defines the requested displacement vector\n * @returns the current mesh\n */\n moveWithCollisions(displacement) {\n const globalPosition = this.getAbsolutePosition();\n globalPosition.addToRef(this.ellipsoidOffset, this._internalAbstractMeshDataInfo._meshCollisionData._oldPositionForCollisions);\n const coordinator = this.getScene().collisionCoordinator;\n if (!this._internalAbstractMeshDataInfo._meshCollisionData._collider) {\n this._internalAbstractMeshDataInfo._meshCollisionData._collider = coordinator.createCollider();\n }\n this._internalAbstractMeshDataInfo._meshCollisionData._collider._radius = this.ellipsoid;\n coordinator.getNewPosition(this._internalAbstractMeshDataInfo._meshCollisionData._oldPositionForCollisions, displacement, this._internalAbstractMeshDataInfo._meshCollisionData._collider, this.collisionRetryCount, this, this._onCollisionPositionChange, this.uniqueId);\n return this;\n }\n // Collisions\n /**\n * @internal\n */\n _collideForSubMesh(subMesh, transformMatrix, collider) {\n var _a;\n this._generatePointsArray();\n if (!this._positions) {\n return this;\n }\n // Transformation\n if (!subMesh._lastColliderWorldVertices || !subMesh._lastColliderTransformMatrix.equals(transformMatrix)) {\n subMesh._lastColliderTransformMatrix = transformMatrix.clone();\n subMesh._lastColliderWorldVertices = [];\n subMesh._trianglePlanes = [];\n const start = subMesh.verticesStart;\n const end = subMesh.verticesStart + subMesh.verticesCount;\n for (let i = start; i < end; i++) {\n subMesh._lastColliderWorldVertices.push(Vector3.TransformCoordinates(this._positions[i], transformMatrix));\n }\n }\n // Collide\n collider._collide(subMesh._trianglePlanes, subMesh._lastColliderWorldVertices, this.getIndices(), subMesh.indexStart, subMesh.indexStart + subMesh.indexCount, subMesh.verticesStart, !!subMesh.getMaterial(), this, this._shouldConvertRHS(), ((_a = subMesh.getMaterial()) === null || _a === void 0 ? void 0 : _a.fillMode) === 7);\n return this;\n }\n /**\n * @internal\n */\n _processCollisionsForSubMeshes(collider, transformMatrix) {\n const subMeshes = this._scene.getCollidingSubMeshCandidates(this, collider);\n const len = subMeshes.length;\n for (let index = 0; index < len; index++) {\n const subMesh = subMeshes.data[index];\n // Bounding test\n if (len > 1 && !subMesh._checkCollision(collider)) {\n continue;\n }\n this._collideForSubMesh(subMesh, transformMatrix, collider);\n }\n return this;\n }\n /** @internal */\n _shouldConvertRHS() {\n return false;\n }\n /**\n * @internal\n */\n _checkCollision(collider) {\n // Bounding box test\n if (!this.getBoundingInfo()._checkCollision(collider)) {\n return this;\n }\n // Transformation matrix\n const collisionsScalingMatrix = TmpVectors.Matrix[0];\n const collisionsTransformMatrix = TmpVectors.Matrix[1];\n Matrix.ScalingToRef(1.0 / collider._radius.x, 1.0 / collider._radius.y, 1.0 / collider._radius.z, collisionsScalingMatrix);\n this.worldMatrixFromCache.multiplyToRef(collisionsScalingMatrix, collisionsTransformMatrix);\n this._processCollisionsForSubMeshes(collider, collisionsTransformMatrix);\n return this;\n }\n // Picking\n /** @internal */\n _generatePointsArray() {\n return false;\n }\n /**\n * Checks if the passed Ray intersects with the mesh. A mesh triangle can be picked both from its front and back sides,\n * irrespective of orientation.\n * @param ray defines the ray to use. It should be in the mesh's LOCAL coordinate space.\n * @param fastCheck defines if fast mode (but less precise) must be used (false by default)\n * @param trianglePredicate defines an optional predicate used to select faces when a mesh intersection is detected\n * @param onlyBoundingInfo defines a boolean indicating if picking should only happen using bounding info (false by default)\n * @param worldToUse defines the world matrix to use to get the world coordinate of the intersection point\n * @param skipBoundingInfo a boolean indicating if we should skip the bounding info check\n * @returns the picking info\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/interactions/mesh_intersect\n */\n intersects(ray, fastCheck, trianglePredicate, onlyBoundingInfo = false, worldToUse, skipBoundingInfo = false) {\n const pickingInfo = new PickingInfo();\n const className = this.getClassName();\n const intersectionThreshold = className === \"InstancedLinesMesh\" || className === \"LinesMesh\" || className === \"GreasedLineMesh\" ? this.intersectionThreshold : 0;\n const boundingInfo = this.getBoundingInfo();\n if (!this.subMeshes) {\n return pickingInfo;\n }\n if (!skipBoundingInfo &&\n (!ray.intersectsSphere(boundingInfo.boundingSphere, intersectionThreshold) || !ray.intersectsBox(boundingInfo.boundingBox, intersectionThreshold))) {\n return pickingInfo;\n }\n if (onlyBoundingInfo) {\n pickingInfo.hit = skipBoundingInfo ? false : true;\n pickingInfo.pickedMesh = skipBoundingInfo ? null : this;\n pickingInfo.distance = skipBoundingInfo ? 0 : Vector3.Distance(ray.origin, boundingInfo.boundingSphere.center);\n pickingInfo.subMeshId = 0;\n return pickingInfo;\n }\n if (!this._generatePointsArray()) {\n return pickingInfo;\n }\n let intersectInfo = null;\n const subMeshes = this._scene.getIntersectingSubMeshCandidates(this, ray);\n const len = subMeshes.length;\n // Check if all submeshes are using a material that don't allow picking (point/lines rendering)\n // if no submesh can be picked that way, then fallback to BBox picking\n let anySubmeshSupportIntersect = false;\n for (let index = 0; index < len; index++) {\n const subMesh = subMeshes.data[index];\n const material = subMesh.getMaterial();\n if (!material) {\n continue;\n }\n if (material.fillMode == 7 ||\n material.fillMode == 0 ||\n material.fillMode == 1 ||\n material.fillMode == 2 ||\n material.fillMode == 4) {\n anySubmeshSupportIntersect = true;\n break;\n }\n }\n // no sub mesh support intersection, fallback to BBox that has already be done\n if (!anySubmeshSupportIntersect) {\n pickingInfo.hit = true;\n pickingInfo.pickedMesh = this;\n pickingInfo.distance = Vector3.Distance(ray.origin, boundingInfo.boundingSphere.center);\n pickingInfo.subMeshId = -1;\n return pickingInfo;\n }\n // at least 1 submesh supports intersection, keep going\n for (let index = 0; index < len; index++) {\n const subMesh = subMeshes.data[index];\n // Bounding test\n if (len > 1 && !subMesh.canIntersects(ray)) {\n continue;\n }\n const currentIntersectInfo = subMesh.intersects(ray, this._positions, this.getIndices(), fastCheck, trianglePredicate);\n if (currentIntersectInfo) {\n if (fastCheck || !intersectInfo || currentIntersectInfo.distance < intersectInfo.distance) {\n intersectInfo = currentIntersectInfo;\n intersectInfo.subMeshId = index;\n if (fastCheck) {\n break;\n }\n }\n }\n }\n if (intersectInfo) {\n // Get picked point\n const world = worldToUse !== null && worldToUse !== void 0 ? worldToUse : this.getWorldMatrix();\n const worldOrigin = TmpVectors.Vector3[0];\n const direction = TmpVectors.Vector3[1];\n Vector3.TransformCoordinatesToRef(ray.origin, world, worldOrigin);\n ray.direction.scaleToRef(intersectInfo.distance, direction);\n const worldDirection = Vector3.TransformNormal(direction, world);\n const pickedPoint = worldDirection.addInPlace(worldOrigin);\n // Return result\n pickingInfo.hit = true;\n pickingInfo.distance = Vector3.Distance(worldOrigin, pickedPoint);\n pickingInfo.pickedPoint = pickedPoint;\n pickingInfo.pickedMesh = this;\n pickingInfo.bu = intersectInfo.bu || 0;\n pickingInfo.bv = intersectInfo.bv || 0;\n pickingInfo.subMeshFaceId = intersectInfo.faceId;\n pickingInfo.faceId = intersectInfo.faceId + subMeshes.data[intersectInfo.subMeshId].indexStart / (this.getClassName().indexOf(\"LinesMesh\") !== -1 ? 2 : 3);\n pickingInfo.subMeshId = intersectInfo.subMeshId;\n return pickingInfo;\n }\n return pickingInfo;\n }\n /**\n * Clones the current mesh\n * @param name defines the mesh name\n * @param newParent defines the new mesh parent\n * @param doNotCloneChildren defines a boolean indicating that children must not be cloned (false by default)\n * @returns the new mesh\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n clone(name, newParent, doNotCloneChildren) {\n return null;\n }\n /**\n * Disposes all the submeshes of the current meshnp\n * @returns the current mesh\n */\n releaseSubMeshes() {\n if (this.subMeshes) {\n while (this.subMeshes.length) {\n this.subMeshes[0].dispose();\n }\n }\n else {\n this.subMeshes = new Array();\n }\n return this;\n }\n /**\n * Releases resources associated with this abstract mesh.\n * @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)\n * @param disposeMaterialAndTextures Set to true to also dispose referenced materials and textures (false by default)\n */\n dispose(doNotRecurse, disposeMaterialAndTextures = false) {\n let index;\n // mesh map release.\n if (this._scene.useMaterialMeshMap) {\n // remove from material mesh map id needed\n if (this._internalAbstractMeshDataInfo._material && this._internalAbstractMeshDataInfo._material.meshMap) {\n this._internalAbstractMeshDataInfo._material.meshMap[this.uniqueId] = undefined;\n }\n }\n // Smart Array Retainers.\n this.getScene().freeActiveMeshes();\n this.getScene().freeRenderingGroups();\n // Action manager\n if (this.actionManager !== undefined && this.actionManager !== null) {\n // If it's the only mesh using the action manager, dispose of it.\n if (!this._scene.meshes.some((m) => m !== this && m.actionManager === this.actionManager)) {\n this.actionManager.dispose();\n }\n this.actionManager = null;\n }\n // Skeleton\n this._internalAbstractMeshDataInfo._skeleton = null;\n if (this._transformMatrixTexture) {\n this._transformMatrixTexture.dispose();\n this._transformMatrixTexture = null;\n }\n // Intersections in progress\n for (index = 0; index < this._intersectionsInProgress.length; index++) {\n const other = this._intersectionsInProgress[index];\n const pos = other._intersectionsInProgress.indexOf(this);\n other._intersectionsInProgress.splice(pos, 1);\n }\n this._intersectionsInProgress.length = 0;\n // Lights\n const lights = this.getScene().lights;\n lights.forEach((light) => {\n let meshIndex = light.includedOnlyMeshes.indexOf(this);\n if (meshIndex !== -1) {\n light.includedOnlyMeshes.splice(meshIndex, 1);\n }\n meshIndex = light.excludedMeshes.indexOf(this);\n if (meshIndex !== -1) {\n light.excludedMeshes.splice(meshIndex, 1);\n }\n // Shadow generators\n const generators = light.getShadowGenerators();\n if (generators) {\n const iterator = generators.values();\n for (let key = iterator.next(); key.done !== true; key = iterator.next()) {\n const generator = key.value;\n const shadowMap = generator.getShadowMap();\n if (shadowMap && shadowMap.renderList) {\n meshIndex = shadowMap.renderList.indexOf(this);\n if (meshIndex !== -1) {\n shadowMap.renderList.splice(meshIndex, 1);\n }\n }\n }\n }\n });\n // SubMeshes\n if (this.getClassName() !== \"InstancedMesh\" || this.getClassName() !== \"InstancedLinesMesh\") {\n this.releaseSubMeshes();\n }\n // Query\n const engine = this.getScene().getEngine();\n if (this._occlusionQuery !== null) {\n this.isOcclusionQueryInProgress = false;\n engine.deleteQuery(this._occlusionQuery);\n this._occlusionQuery = null;\n }\n // Engine\n engine.wipeCaches();\n // Remove from scene\n this.getScene().removeMesh(this);\n if (this._parentContainer) {\n const index = this._parentContainer.meshes.indexOf(this);\n if (index > -1) {\n this._parentContainer.meshes.splice(index, 1);\n }\n this._parentContainer = null;\n }\n if (disposeMaterialAndTextures) {\n if (this.material) {\n if (this.material.getClassName() === \"MultiMaterial\") {\n this.material.dispose(false, true, true);\n }\n else {\n this.material.dispose(false, true);\n }\n }\n }\n if (!doNotRecurse) {\n // Particles\n for (index = 0; index < this.getScene().particleSystems.length; index++) {\n if (this.getScene().particleSystems[index].emitter === this) {\n this.getScene().particleSystems[index].dispose();\n index--;\n }\n }\n }\n // facet data\n if (this._internalAbstractMeshDataInfo._facetData.facetDataEnabled) {\n this.disableFacetData();\n }\n this._uniformBuffer.dispose();\n this.onAfterWorldMatrixUpdateObservable.clear();\n this.onCollideObservable.clear();\n this.onCollisionPositionChangeObservable.clear();\n this.onRebuildObservable.clear();\n super.dispose(doNotRecurse, disposeMaterialAndTextures);\n }\n /**\n * Adds the passed mesh as a child to the current mesh\n * @param mesh defines the child mesh\n * @param preserveScalingSign if true, keep scaling sign of child. Otherwise, scaling sign might change.\n * @returns the current mesh\n */\n addChild(mesh, preserveScalingSign = false) {\n mesh.setParent(this, preserveScalingSign);\n return this;\n }\n /**\n * Removes the passed mesh from the current mesh children list\n * @param mesh defines the child mesh\n * @param preserveScalingSign if true, keep scaling sign of child. Otherwise, scaling sign might change.\n * @returns the current mesh\n */\n removeChild(mesh, preserveScalingSign = false) {\n mesh.setParent(null, preserveScalingSign);\n return this;\n }\n // Facet data\n /** @internal */\n _initFacetData() {\n const data = this._internalAbstractMeshDataInfo._facetData;\n if (!data.facetNormals) {\n data.facetNormals = new Array();\n }\n if (!data.facetPositions) {\n data.facetPositions = new Array();\n }\n if (!data.facetPartitioning) {\n data.facetPartitioning = new Array();\n }\n data.facetNb = (this.getIndices().length / 3) | 0;\n data.partitioningSubdivisions = data.partitioningSubdivisions ? data.partitioningSubdivisions : 10; // default nb of partitioning subdivisions = 10\n data.partitioningBBoxRatio = data.partitioningBBoxRatio ? data.partitioningBBoxRatio : 1.01; // default ratio 1.01 = the partitioning is 1% bigger than the bounding box\n for (let f = 0; f < data.facetNb; f++) {\n data.facetNormals[f] = Vector3.Zero();\n data.facetPositions[f] = Vector3.Zero();\n }\n data.facetDataEnabled = true;\n return this;\n }\n /**\n * Updates the mesh facetData arrays and the internal partitioning when the mesh is morphed or updated.\n * This method can be called within the render loop.\n * You don't need to call this method by yourself in the render loop when you update/morph a mesh with the methods CreateXXX() as they automatically manage this computation\n * @returns the current mesh\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/facetData\n */\n updateFacetData() {\n const data = this._internalAbstractMeshDataInfo._facetData;\n if (!data.facetDataEnabled) {\n this._initFacetData();\n }\n const positions = this.getVerticesData(VertexBuffer.PositionKind);\n const indices = this.getIndices();\n const normals = this.getVerticesData(VertexBuffer.NormalKind);\n const bInfo = this.getBoundingInfo();\n if (data.facetDepthSort && !data.facetDepthSortEnabled) {\n // init arrays, matrix and sort function on first call\n data.facetDepthSortEnabled = true;\n if (indices instanceof Uint16Array) {\n data.depthSortedIndices = new Uint16Array(indices);\n }\n else if (indices instanceof Uint32Array) {\n data.depthSortedIndices = new Uint32Array(indices);\n }\n else {\n let needs32bits = false;\n for (let i = 0; i < indices.length; i++) {\n if (indices[i] > 65535) {\n needs32bits = true;\n break;\n }\n }\n if (needs32bits) {\n data.depthSortedIndices = new Uint32Array(indices);\n }\n else {\n data.depthSortedIndices = new Uint16Array(indices);\n }\n }\n data.facetDepthSortFunction = function (f1, f2) {\n return f2.sqDistance - f1.sqDistance;\n };\n if (!data.facetDepthSortFrom) {\n const camera = this.getScene().activeCamera;\n data.facetDepthSortFrom = camera ? camera.position : Vector3.Zero();\n }\n data.depthSortedFacets = [];\n for (let f = 0; f < data.facetNb; f++) {\n const depthSortedFacet = { ind: f * 3, sqDistance: 0.0 };\n data.depthSortedFacets.push(depthSortedFacet);\n }\n data.invertedMatrix = Matrix.Identity();\n data.facetDepthSortOrigin = Vector3.Zero();\n }\n data.bbSize.x = bInfo.maximum.x - bInfo.minimum.x > Epsilon ? bInfo.maximum.x - bInfo.minimum.x : Epsilon;\n data.bbSize.y = bInfo.maximum.y - bInfo.minimum.y > Epsilon ? bInfo.maximum.y - bInfo.minimum.y : Epsilon;\n data.bbSize.z = bInfo.maximum.z - bInfo.minimum.z > Epsilon ? bInfo.maximum.z - bInfo.minimum.z : Epsilon;\n let bbSizeMax = data.bbSize.x > data.bbSize.y ? data.bbSize.x : data.bbSize.y;\n bbSizeMax = bbSizeMax > data.bbSize.z ? bbSizeMax : data.bbSize.z;\n data.subDiv.max = data.partitioningSubdivisions;\n data.subDiv.X = Math.floor((data.subDiv.max * data.bbSize.x) / bbSizeMax); // adjust the number of subdivisions per axis\n data.subDiv.Y = Math.floor((data.subDiv.max * data.bbSize.y) / bbSizeMax); // according to each bbox size per axis\n data.subDiv.Z = Math.floor((data.subDiv.max * data.bbSize.z) / bbSizeMax);\n data.subDiv.X = data.subDiv.X < 1 ? 1 : data.subDiv.X; // at least one subdivision\n data.subDiv.Y = data.subDiv.Y < 1 ? 1 : data.subDiv.Y;\n data.subDiv.Z = data.subDiv.Z < 1 ? 1 : data.subDiv.Z;\n // set the parameters for ComputeNormals()\n data.facetParameters.facetNormals = this.getFacetLocalNormals();\n data.facetParameters.facetPositions = this.getFacetLocalPositions();\n data.facetParameters.facetPartitioning = this.getFacetLocalPartitioning();\n data.facetParameters.bInfo = bInfo;\n data.facetParameters.bbSize = data.bbSize;\n data.facetParameters.subDiv = data.subDiv;\n data.facetParameters.ratio = this.partitioningBBoxRatio;\n data.facetParameters.depthSort = data.facetDepthSort;\n if (data.facetDepthSort && data.facetDepthSortEnabled) {\n this.computeWorldMatrix(true);\n this._worldMatrix.invertToRef(data.invertedMatrix);\n Vector3.TransformCoordinatesToRef(data.facetDepthSortFrom, data.invertedMatrix, data.facetDepthSortOrigin);\n data.facetParameters.distanceTo = data.facetDepthSortOrigin;\n }\n data.facetParameters.depthSortedFacets = data.depthSortedFacets;\n if (normals) {\n VertexData.ComputeNormals(positions, indices, normals, data.facetParameters);\n }\n if (data.facetDepthSort && data.facetDepthSortEnabled) {\n data.depthSortedFacets.sort(data.facetDepthSortFunction);\n const l = (data.depthSortedIndices.length / 3) | 0;\n for (let f = 0; f < l; f++) {\n const sind = data.depthSortedFacets[f].ind;\n data.depthSortedIndices[f * 3] = indices[sind];\n data.depthSortedIndices[f * 3 + 1] = indices[sind + 1];\n data.depthSortedIndices[f * 3 + 2] = indices[sind + 2];\n }\n this.updateIndices(data.depthSortedIndices, undefined, true);\n }\n return this;\n }\n /**\n * Returns the facetLocalNormals array.\n * The normals are expressed in the mesh local spac\n * @returns an array of Vector3\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/facetData\n */\n getFacetLocalNormals() {\n const facetData = this._internalAbstractMeshDataInfo._facetData;\n if (!facetData.facetNormals) {\n this.updateFacetData();\n }\n return facetData.facetNormals;\n }\n /**\n * Returns the facetLocalPositions array.\n * The facet positions are expressed in the mesh local space\n * @returns an array of Vector3\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/facetData\n */\n getFacetLocalPositions() {\n const facetData = this._internalAbstractMeshDataInfo._facetData;\n if (!facetData.facetPositions) {\n this.updateFacetData();\n }\n return facetData.facetPositions;\n }\n /**\n * Returns the facetLocalPartitioning array\n * @returns an array of array of numbers\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/facetData\n */\n getFacetLocalPartitioning() {\n const facetData = this._internalAbstractMeshDataInfo._facetData;\n if (!facetData.facetPartitioning) {\n this.updateFacetData();\n }\n return facetData.facetPartitioning;\n }\n /**\n * Returns the i-th facet position in the world system.\n * This method allocates a new Vector3 per call\n * @param i defines the facet index\n * @returns a new Vector3\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/facetData\n */\n getFacetPosition(i) {\n const pos = Vector3.Zero();\n this.getFacetPositionToRef(i, pos);\n return pos;\n }\n /**\n * Sets the reference Vector3 with the i-th facet position in the world system\n * @param i defines the facet index\n * @param ref defines the target vector\n * @returns the current mesh\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/facetData\n */\n getFacetPositionToRef(i, ref) {\n const localPos = this.getFacetLocalPositions()[i];\n const world = this.getWorldMatrix();\n Vector3.TransformCoordinatesToRef(localPos, world, ref);\n return this;\n }\n /**\n * Returns the i-th facet normal in the world system.\n * This method allocates a new Vector3 per call\n * @param i defines the facet index\n * @returns a new Vector3\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/facetData\n */\n getFacetNormal(i) {\n const norm = Vector3.Zero();\n this.getFacetNormalToRef(i, norm);\n return norm;\n }\n /**\n * Sets the reference Vector3 with the i-th facet normal in the world system\n * @param i defines the facet index\n * @param ref defines the target vector\n * @returns the current mesh\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/facetData\n */\n getFacetNormalToRef(i, ref) {\n const localNorm = this.getFacetLocalNormals()[i];\n Vector3.TransformNormalToRef(localNorm, this.getWorldMatrix(), ref);\n return this;\n }\n /**\n * Returns the facets (in an array) in the same partitioning block than the one the passed coordinates are located (expressed in the mesh local system)\n * @param x defines x coordinate\n * @param y defines y coordinate\n * @param z defines z coordinate\n * @returns the array of facet indexes\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/facetData\n */\n getFacetsAtLocalCoordinates(x, y, z) {\n const bInfo = this.getBoundingInfo();\n const data = this._internalAbstractMeshDataInfo._facetData;\n const ox = Math.floor(((x - bInfo.minimum.x * data.partitioningBBoxRatio) * data.subDiv.X * data.partitioningBBoxRatio) / data.bbSize.x);\n const oy = Math.floor(((y - bInfo.minimum.y * data.partitioningBBoxRatio) * data.subDiv.Y * data.partitioningBBoxRatio) / data.bbSize.y);\n const oz = Math.floor(((z - bInfo.minimum.z * data.partitioningBBoxRatio) * data.subDiv.Z * data.partitioningBBoxRatio) / data.bbSize.z);\n if (ox < 0 || ox > data.subDiv.max || oy < 0 || oy > data.subDiv.max || oz < 0 || oz > data.subDiv.max) {\n return null;\n }\n return data.facetPartitioning[ox + data.subDiv.max * oy + data.subDiv.max * data.subDiv.max * oz];\n }\n /**\n * Returns the closest mesh facet index at (x,y,z) World coordinates, null if not found\n * @param x defines x coordinate\n * @param y defines y coordinate\n * @param z defines z coordinate\n * @param projected sets as the (x,y,z) world projection on the facet\n * @param checkFace if true (default false), only the facet \"facing\" to (x,y,z) or only the ones \"turning their backs\", according to the parameter \"facing\" are returned\n * @param facing if facing and checkFace are true, only the facet \"facing\" to (x, y, z) are returned : positive dot (x, y, z) * facet position. If facing si false and checkFace is true, only the facet \"turning their backs\" to (x, y, z) are returned : negative dot (x, y, z) * facet position\n * @returns the face index if found (or null instead)\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/facetData\n */\n getClosestFacetAtCoordinates(x, y, z, projected, checkFace = false, facing = true) {\n const world = this.getWorldMatrix();\n const invMat = TmpVectors.Matrix[5];\n world.invertToRef(invMat);\n const invVect = TmpVectors.Vector3[8];\n Vector3.TransformCoordinatesFromFloatsToRef(x, y, z, invMat, invVect); // transform (x,y,z) to coordinates in the mesh local space\n const closest = this.getClosestFacetAtLocalCoordinates(invVect.x, invVect.y, invVect.z, projected, checkFace, facing);\n if (projected) {\n // transform the local computed projected vector to world coordinates\n Vector3.TransformCoordinatesFromFloatsToRef(projected.x, projected.y, projected.z, world, projected);\n }\n return closest;\n }\n /**\n * Returns the closest mesh facet index at (x,y,z) local coordinates, null if not found\n * @param x defines x coordinate\n * @param y defines y coordinate\n * @param z defines z coordinate\n * @param projected sets as the (x,y,z) local projection on the facet\n * @param checkFace if true (default false), only the facet \"facing\" to (x,y,z) or only the ones \"turning their backs\", according to the parameter \"facing\" are returned\n * @param facing if facing and checkFace are true, only the facet \"facing\" to (x, y, z) are returned : positive dot (x, y, z) * facet position. If facing si false and checkFace is true, only the facet \"turning their backs\" to (x, y, z) are returned : negative dot (x, y, z) * facet position\n * @returns the face index if found (or null instead)\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/facetData\n */\n getClosestFacetAtLocalCoordinates(x, y, z, projected, checkFace = false, facing = true) {\n let closest = null;\n let tmpx = 0.0;\n let tmpy = 0.0;\n let tmpz = 0.0;\n let d = 0.0; // tmp dot facet normal * facet position\n let t0 = 0.0;\n let projx = 0.0;\n let projy = 0.0;\n let projz = 0.0;\n // Get all the facets in the same partitioning block than (x, y, z)\n const facetPositions = this.getFacetLocalPositions();\n const facetNormals = this.getFacetLocalNormals();\n const facetsInBlock = this.getFacetsAtLocalCoordinates(x, y, z);\n if (!facetsInBlock) {\n return null;\n }\n // Get the closest facet to (x, y, z)\n let shortest = Number.MAX_VALUE; // init distance vars\n let tmpDistance = shortest;\n let fib; // current facet in the block\n let norm; // current facet normal\n let p0; // current facet barycenter position\n // loop on all the facets in the current partitioning block\n for (let idx = 0; idx < facetsInBlock.length; idx++) {\n fib = facetsInBlock[idx];\n norm = facetNormals[fib];\n p0 = facetPositions[fib];\n d = (x - p0.x) * norm.x + (y - p0.y) * norm.y + (z - p0.z) * norm.z;\n if (!checkFace || (checkFace && facing && d >= 0.0) || (checkFace && !facing && d <= 0.0)) {\n // compute (x,y,z) projection on the facet = (projx, projy, projz)\n d = norm.x * p0.x + norm.y * p0.y + norm.z * p0.z;\n t0 = -(norm.x * x + norm.y * y + norm.z * z - d) / (norm.x * norm.x + norm.y * norm.y + norm.z * norm.z);\n projx = x + norm.x * t0;\n projy = y + norm.y * t0;\n projz = z + norm.z * t0;\n tmpx = projx - x;\n tmpy = projy - y;\n tmpz = projz - z;\n tmpDistance = tmpx * tmpx + tmpy * tmpy + tmpz * tmpz; // compute length between (x, y, z) and its projection on the facet\n if (tmpDistance < shortest) {\n // just keep the closest facet to (x, y, z)\n shortest = tmpDistance;\n closest = fib;\n if (projected) {\n projected.x = projx;\n projected.y = projy;\n projected.z = projz;\n }\n }\n }\n }\n return closest;\n }\n /**\n * Returns the object \"parameter\" set with all the expected parameters for facetData computation by ComputeNormals()\n * @returns the parameters\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/facetData\n */\n getFacetDataParameters() {\n return this._internalAbstractMeshDataInfo._facetData.facetParameters;\n }\n /**\n * Disables the feature FacetData and frees the related memory\n * @returns the current mesh\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/facetData\n */\n disableFacetData() {\n const facetData = this._internalAbstractMeshDataInfo._facetData;\n if (facetData.facetDataEnabled) {\n facetData.facetDataEnabled = false;\n facetData.facetPositions = new Array();\n facetData.facetNormals = new Array();\n facetData.facetPartitioning = new Array();\n facetData.facetParameters = null;\n facetData.depthSortedIndices = new Uint32Array(0);\n }\n return this;\n }\n /**\n * Updates the AbstractMesh indices array\n * @param indices defines the data source\n * @param offset defines the offset in the index buffer where to store the new data (can be null)\n * @param gpuMemoryOnly defines a boolean indicating that only the GPU memory must be updated leaving the CPU version of the indices unchanged (false by default)\n * @returns the current mesh\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n updateIndices(indices, offset, gpuMemoryOnly = false) {\n return this;\n }\n /**\n * Creates new normals data for the mesh\n * @param updatable defines if the normal vertex buffer must be flagged as updatable\n * @returns the current mesh\n */\n createNormals(updatable) {\n const positions = this.getVerticesData(VertexBuffer.PositionKind);\n const indices = this.getIndices();\n let normals;\n if (this.isVerticesDataPresent(VertexBuffer.NormalKind)) {\n normals = this.getVerticesData(VertexBuffer.NormalKind);\n }\n else {\n normals = [];\n }\n VertexData.ComputeNormals(positions, indices, normals, { useRightHandedSystem: this.getScene().useRightHandedSystem });\n this.setVerticesData(VertexBuffer.NormalKind, normals, updatable);\n return this;\n }\n /**\n * Align the mesh with a normal\n * @param normal defines the normal to use\n * @param upDirection can be used to redefined the up vector to use (will use the (0, 1, 0) by default)\n * @returns the current mesh\n */\n alignWithNormal(normal, upDirection) {\n if (!upDirection) {\n upDirection = Axis.Y;\n }\n const axisX = TmpVectors.Vector3[0];\n const axisZ = TmpVectors.Vector3[1];\n Vector3.CrossToRef(upDirection, normal, axisZ);\n Vector3.CrossToRef(normal, axisZ, axisX);\n if (this.rotationQuaternion) {\n Quaternion.RotationQuaternionFromAxisToRef(axisX, normal, axisZ, this.rotationQuaternion);\n }\n else {\n Vector3.RotationFromAxisToRef(axisX, normal, axisZ, this.rotation);\n }\n return this;\n }\n /** @internal */\n _checkOcclusionQuery() {\n // Will be replaced by correct code if Occlusion queries are referenced\n return false;\n }\n /**\n * Disables the mesh edge rendering mode\n * @returns the currentAbstractMesh\n */\n disableEdgesRendering() {\n throw _WarnImport(\"EdgesRenderer\");\n }\n /**\n * Enables the edge rendering mode on the mesh.\n * This mode makes the mesh edges visible\n * @param epsilon defines the maximal distance between two angles to detect a face\n * @param checkVerticesInsteadOfIndices indicates that we should check vertex list directly instead of faces\n * @param options options to the edge renderer\n * @returns the currentAbstractMesh\n * @see https://www.babylonjs-playground.com/#19O9TU#0\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n enableEdgesRendering(epsilon, checkVerticesInsteadOfIndices, options) {\n throw _WarnImport(\"EdgesRenderer\");\n }\n /**\n * This function returns all of the particle systems in the scene that use the mesh as an emitter.\n * @returns an array of particle systems in the scene that use the mesh as an emitter\n */\n getConnectedParticleSystems() {\n return this._scene.particleSystems.filter((particleSystem) => particleSystem.emitter === this);\n }\n}\n/** No occlusion */\nAbstractMesh.OCCLUSION_TYPE_NONE = 0;\n/** Occlusion set to optimistic */\nAbstractMesh.OCCLUSION_TYPE_OPTIMISTIC = 1;\n/** Occlusion set to strict */\nAbstractMesh.OCCLUSION_TYPE_STRICT = 2;\n/** Use an accurate occlusion algorithm */\nAbstractMesh.OCCLUSION_ALGORITHM_TYPE_ACCURATE = 0;\n/** Use a conservative occlusion algorithm */\nAbstractMesh.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE = 1;\n/** Default culling strategy : this is an exclusion test and it's the more accurate.\n * Test order :\n * Is the bounding sphere outside the frustum ?\n * If not, are the bounding box vertices outside the frustum ?\n * It not, then the cullable object is in the frustum.\n */\nAbstractMesh.CULLINGSTRATEGY_STANDARD = 0;\n/** Culling strategy : Bounding Sphere Only.\n * This is an exclusion test. It's faster than the standard strategy because the bounding box is not tested.\n * It's also less accurate than the standard because some not visible objects can still be selected.\n * Test : is the bounding sphere outside the frustum ?\n * If not, then the cullable object is in the frustum.\n */\nAbstractMesh.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY = 1;\n/** Culling strategy : Optimistic Inclusion.\n * This in an inclusion test first, then the standard exclusion test.\n * This can be faster when a cullable object is expected to be almost always in the camera frustum.\n * This could also be a little slower than the standard test when the tested object center is not the frustum but one of its bounding box vertex is still inside.\n * Anyway, it's as accurate as the standard strategy.\n * Test :\n * Is the cullable object bounding sphere center in the frustum ?\n * If not, apply the default culling strategy.\n */\nAbstractMesh.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION = 2;\n/** Culling strategy : Optimistic Inclusion then Bounding Sphere Only.\n * This in an inclusion test first, then the bounding sphere only exclusion test.\n * This can be the fastest test when a cullable object is expected to be almost always in the camera frustum.\n * This could also be a little slower than the BoundingSphereOnly strategy when the tested object center is not in the frustum but its bounding sphere still intersects it.\n * It's less accurate than the standard strategy and as accurate as the BoundingSphereOnly strategy.\n * Test :\n * Is the cullable object bounding sphere center in the frustum ?\n * If not, apply the Bounding Sphere Only strategy. No Bounding Box is tested here.\n */\nAbstractMesh.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY = 3;\nRegisterClass(\"BABYLON.AbstractMesh\", AbstractMesh);\n//# sourceMappingURL=abstractMesh.js.map","/** @internal */\nexport function addClipPlaneUniforms(uniforms) {\n if (uniforms.indexOf(\"vClipPlane\") === -1) {\n uniforms.push(\"vClipPlane\");\n }\n if (uniforms.indexOf(\"vClipPlane2\") === -1) {\n uniforms.push(\"vClipPlane2\");\n }\n if (uniforms.indexOf(\"vClipPlane3\") === -1) {\n uniforms.push(\"vClipPlane3\");\n }\n if (uniforms.indexOf(\"vClipPlane4\") === -1) {\n uniforms.push(\"vClipPlane4\");\n }\n if (uniforms.indexOf(\"vClipPlane5\") === -1) {\n uniforms.push(\"vClipPlane5\");\n }\n if (uniforms.indexOf(\"vClipPlane6\") === -1) {\n uniforms.push(\"vClipPlane6\");\n }\n}\n/** @internal */\nexport function prepareStringDefinesForClipPlanes(primaryHolder, secondaryHolder, defines) {\n var _a, _b, _c, _d, _e, _f;\n const clipPlane = !!((_a = primaryHolder.clipPlane) !== null && _a !== void 0 ? _a : secondaryHolder.clipPlane);\n const clipPlane2 = !!((_b = primaryHolder.clipPlane2) !== null && _b !== void 0 ? _b : secondaryHolder.clipPlane2);\n const clipPlane3 = !!((_c = primaryHolder.clipPlane3) !== null && _c !== void 0 ? _c : secondaryHolder.clipPlane3);\n const clipPlane4 = !!((_d = primaryHolder.clipPlane4) !== null && _d !== void 0 ? _d : secondaryHolder.clipPlane4);\n const clipPlane5 = !!((_e = primaryHolder.clipPlane5) !== null && _e !== void 0 ? _e : secondaryHolder.clipPlane5);\n const clipPlane6 = !!((_f = primaryHolder.clipPlane6) !== null && _f !== void 0 ? _f : secondaryHolder.clipPlane6);\n if (clipPlane)\n defines.push(\"#define CLIPPLANE\");\n if (clipPlane2)\n defines.push(\"#define CLIPPLANE2\");\n if (clipPlane3)\n defines.push(\"#define CLIPPLANE3\");\n if (clipPlane4)\n defines.push(\"#define CLIPPLANE4\");\n if (clipPlane5)\n defines.push(\"#define CLIPPLANE5\");\n if (clipPlane6)\n defines.push(\"#define CLIPPLANE6\");\n}\n/** @internal */\nexport function prepareDefinesForClipPlanes(primaryHolder, secondaryHolder, defines) {\n var _a, _b, _c, _d, _e, _f;\n let changed = false;\n const clipPlane = !!((_a = primaryHolder.clipPlane) !== null && _a !== void 0 ? _a : secondaryHolder.clipPlane);\n const clipPlane2 = !!((_b = primaryHolder.clipPlane2) !== null && _b !== void 0 ? _b : secondaryHolder.clipPlane2);\n const clipPlane3 = !!((_c = primaryHolder.clipPlane3) !== null && _c !== void 0 ? _c : secondaryHolder.clipPlane3);\n const clipPlane4 = !!((_d = primaryHolder.clipPlane4) !== null && _d !== void 0 ? _d : secondaryHolder.clipPlane4);\n const clipPlane5 = !!((_e = primaryHolder.clipPlane5) !== null && _e !== void 0 ? _e : secondaryHolder.clipPlane5);\n const clipPlane6 = !!((_f = primaryHolder.clipPlane6) !== null && _f !== void 0 ? _f : secondaryHolder.clipPlane6);\n // Do not factorize this code, it breaks browsers optimizations.\n if (defines[\"CLIPPLANE\"] !== clipPlane) {\n defines[\"CLIPPLANE\"] = clipPlane;\n changed = true;\n }\n if (defines[\"CLIPPLANE2\"] !== clipPlane2) {\n defines[\"CLIPPLANE2\"] = clipPlane2;\n changed = true;\n }\n if (defines[\"CLIPPLANE3\"] !== clipPlane3) {\n defines[\"CLIPPLANE3\"] = clipPlane3;\n changed = true;\n }\n if (defines[\"CLIPPLANE4\"] !== clipPlane4) {\n defines[\"CLIPPLANE4\"] = clipPlane4;\n changed = true;\n }\n if (defines[\"CLIPPLANE5\"] !== clipPlane5) {\n defines[\"CLIPPLANE5\"] = clipPlane5;\n changed = true;\n }\n if (defines[\"CLIPPLANE6\"] !== clipPlane6) {\n defines[\"CLIPPLANE6\"] = clipPlane6;\n changed = true;\n }\n return changed;\n}\n/** @internal */\nexport function bindClipPlane(effect, primaryHolder, secondaryHolder) {\n var _a, _b, _c, _d, _e, _f;\n let clipPlane = (_a = primaryHolder.clipPlane) !== null && _a !== void 0 ? _a : secondaryHolder.clipPlane;\n setClipPlane(effect, \"vClipPlane\", clipPlane);\n clipPlane = (_b = primaryHolder.clipPlane2) !== null && _b !== void 0 ? _b : secondaryHolder.clipPlane2;\n setClipPlane(effect, \"vClipPlane2\", clipPlane);\n clipPlane = (_c = primaryHolder.clipPlane3) !== null && _c !== void 0 ? _c : secondaryHolder.clipPlane3;\n setClipPlane(effect, \"vClipPlane3\", clipPlane);\n clipPlane = (_d = primaryHolder.clipPlane4) !== null && _d !== void 0 ? _d : secondaryHolder.clipPlane4;\n setClipPlane(effect, \"vClipPlane4\", clipPlane);\n clipPlane = (_e = primaryHolder.clipPlane5) !== null && _e !== void 0 ? _e : secondaryHolder.clipPlane5;\n setClipPlane(effect, \"vClipPlane5\", clipPlane);\n clipPlane = (_f = primaryHolder.clipPlane6) !== null && _f !== void 0 ? _f : secondaryHolder.clipPlane6;\n setClipPlane(effect, \"vClipPlane6\", clipPlane);\n}\nfunction setClipPlane(effect, uniformName, clipPlane) {\n if (clipPlane) {\n effect.setFloat4(uniformName, clipPlane.normal.x, clipPlane.normal.y, clipPlane.normal.z, clipPlane.d);\n }\n}\n//# sourceMappingURL=clipPlaneMaterialHelper.js.map","import { Logger } from \"../Misc/logger.js\";\nimport { Camera } from \"../Cameras/camera.js\";\nimport { Scene } from \"../scene.js\";\nimport { EngineStore } from \"../Engines/engineStore.js\";\nimport { VertexBuffer } from \"../Buffers/buffer.js\";\nimport { LightConstants } from \"../Lights/lightConstants.js\";\n\nimport { Color3 } from \"../Maths/math.color.js\";\nimport { prepareDefinesForClipPlanes } from \"./clipPlaneMaterialHelper.js\";\n/**\n * \"Static Class\" containing the most commonly used helper while dealing with material for rendering purpose.\n *\n * It contains the basic tools to help defining defines, binding uniform for the common part of the materials.\n *\n * This works by convention in BabylonJS but is meant to be use only with shader following the in place naming rules and conventions.\n */\nexport class MaterialHelper {\n /**\n * Binds the scene's uniform buffer to the effect.\n * @param effect defines the effect to bind to the scene uniform buffer\n * @param sceneUbo defines the uniform buffer storing scene data\n */\n static BindSceneUniformBuffer(effect, sceneUbo) {\n sceneUbo.bindToEffect(effect, \"Scene\");\n }\n /**\n * Helps preparing the defines values about the UVs in used in the effect.\n * UVs are shared as much as we can across channels in the shaders.\n * @param texture The texture we are preparing the UVs for\n * @param defines The defines to update\n * @param key The channel key \"diffuse\", \"specular\"... used in the shader\n */\n static PrepareDefinesForMergedUV(texture, defines, key) {\n defines._needUVs = true;\n defines[key] = true;\n if (texture.optimizeUVAllocation && texture.getTextureMatrix().isIdentityAs3x2()) {\n defines[key + \"DIRECTUV\"] = texture.coordinatesIndex + 1;\n defines[\"MAINUV\" + (texture.coordinatesIndex + 1)] = true;\n }\n else {\n defines[key + \"DIRECTUV\"] = 0;\n }\n }\n /**\n * Binds a texture matrix value to its corresponding uniform\n * @param texture The texture to bind the matrix for\n * @param uniformBuffer The uniform buffer receiving the data\n * @param key The channel key \"diffuse\", \"specular\"... used in the shader\n */\n static BindTextureMatrix(texture, uniformBuffer, key) {\n const matrix = texture.getTextureMatrix();\n uniformBuffer.updateMatrix(key + \"Matrix\", matrix);\n }\n /**\n * Gets the current status of the fog (should it be enabled?)\n * @param mesh defines the mesh to evaluate for fog support\n * @param scene defines the hosting scene\n * @returns true if fog must be enabled\n */\n static GetFogState(mesh, scene) {\n return scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE;\n }\n /**\n * Helper used to prepare the list of defines associated with misc. values for shader compilation\n * @param mesh defines the current mesh\n * @param scene defines the current scene\n * @param useLogarithmicDepth defines if logarithmic depth has to be turned on\n * @param pointsCloud defines if point cloud rendering has to be turned on\n * @param fogEnabled defines if fog has to be turned on\n * @param alphaTest defines if alpha testing has to be turned on\n * @param defines defines the current list of defines\n * @param applyDecalAfterDetail Defines if the decal is applied after or before the detail\n */\n static PrepareDefinesForMisc(mesh, scene, useLogarithmicDepth, pointsCloud, fogEnabled, alphaTest, defines, applyDecalAfterDetail = false) {\n if (defines._areMiscDirty) {\n defines[\"LOGARITHMICDEPTH\"] = useLogarithmicDepth;\n defines[\"POINTSIZE\"] = pointsCloud;\n defines[\"FOG\"] = fogEnabled && this.GetFogState(mesh, scene);\n defines[\"NONUNIFORMSCALING\"] = mesh.nonUniformScaling;\n defines[\"ALPHATEST\"] = alphaTest;\n defines[\"DECAL_AFTER_DETAIL\"] = applyDecalAfterDetail;\n }\n }\n /**\n * Helper used to prepare the defines relative to the active camera\n * @param scene defines the current scene\n * @param defines specifies the list of active defines\n * @returns true if the defines have been updated, else false\n */\n static PrepareDefinesForCamera(scene, defines) {\n let changed = false;\n if (scene.activeCamera) {\n const wasOrtho = defines[\"CAMERA_ORTHOGRAPHIC\"] ? 1 : 0;\n const wasPersp = defines[\"CAMERA_PERSPECTIVE\"] ? 1 : 0;\n const isOrtho = scene.activeCamera.mode === Camera.ORTHOGRAPHIC_CAMERA ? 1 : 0;\n const isPersp = scene.activeCamera.mode === Camera.PERSPECTIVE_CAMERA ? 1 : 0;\n if (wasOrtho ^ isOrtho || wasPersp ^ isPersp) {\n defines[\"CAMERA_ORTHOGRAPHIC\"] = isOrtho === 1;\n defines[\"CAMERA_PERSPECTIVE\"] = isPersp === 1;\n changed = true;\n }\n }\n return changed;\n }\n /**\n * Helper used to prepare the list of defines associated with frame values for shader compilation\n * @param scene defines the current scene\n * @param engine defines the current engine\n * @param material defines the material we are compiling the shader for\n * @param defines specifies the list of active defines\n * @param useInstances defines if instances have to be turned on\n * @param useClipPlane defines if clip plane have to be turned on\n * @param useThinInstances defines if thin instances have to be turned on\n */\n static PrepareDefinesForFrameBoundValues(scene, engine, material, defines, useInstances, useClipPlane = null, useThinInstances = false) {\n let changed = MaterialHelper.PrepareDefinesForCamera(scene, defines);\n if (useClipPlane !== false) {\n changed = prepareDefinesForClipPlanes(material, scene, defines);\n }\n if (defines[\"DEPTHPREPASS\"] !== !engine.getColorWrite()) {\n defines[\"DEPTHPREPASS\"] = !defines[\"DEPTHPREPASS\"];\n changed = true;\n }\n if (defines[\"INSTANCES\"] !== useInstances) {\n defines[\"INSTANCES\"] = useInstances;\n changed = true;\n }\n if (defines[\"THIN_INSTANCES\"] !== useThinInstances) {\n defines[\"THIN_INSTANCES\"] = useThinInstances;\n changed = true;\n }\n if (changed) {\n defines.markAsUnprocessed();\n }\n }\n /**\n * Prepares the defines for bones\n * @param mesh The mesh containing the geometry data we will draw\n * @param defines The defines to update\n */\n static PrepareDefinesForBones(mesh, defines) {\n if (mesh.useBones && mesh.computeBonesUsingShaders && mesh.skeleton) {\n defines[\"NUM_BONE_INFLUENCERS\"] = mesh.numBoneInfluencers;\n const materialSupportsBoneTexture = defines[\"BONETEXTURE\"] !== undefined;\n if (mesh.skeleton.isUsingTextureForMatrices && materialSupportsBoneTexture) {\n defines[\"BONETEXTURE\"] = true;\n }\n else {\n defines[\"BonesPerMesh\"] = mesh.skeleton.bones.length + 1;\n defines[\"BONETEXTURE\"] = materialSupportsBoneTexture ? false : undefined;\n const prePassRenderer = mesh.getScene().prePassRenderer;\n if (prePassRenderer && prePassRenderer.enabled) {\n const nonExcluded = prePassRenderer.excludedSkinnedMesh.indexOf(mesh) === -1;\n defines[\"BONES_VELOCITY_ENABLED\"] = nonExcluded;\n }\n }\n }\n else {\n defines[\"NUM_BONE_INFLUENCERS\"] = 0;\n defines[\"BonesPerMesh\"] = 0;\n if (defines[\"BONETEXTURE\"] !== undefined) {\n defines[\"BONETEXTURE\"] = false;\n }\n }\n }\n /**\n * Prepares the defines for morph targets\n * @param mesh The mesh containing the geometry data we will draw\n * @param defines The defines to update\n */\n static PrepareDefinesForMorphTargets(mesh, defines) {\n const manager = mesh.morphTargetManager;\n if (manager) {\n defines[\"MORPHTARGETS_UV\"] = manager.supportsUVs && defines[\"UV1\"];\n defines[\"MORPHTARGETS_TANGENT\"] = manager.supportsTangents && defines[\"TANGENT\"];\n defines[\"MORPHTARGETS_NORMAL\"] = manager.supportsNormals && defines[\"NORMAL\"];\n defines[\"MORPHTARGETS\"] = manager.numInfluencers > 0;\n defines[\"NUM_MORPH_INFLUENCERS\"] = manager.numInfluencers;\n defines[\"MORPHTARGETS_TEXTURE\"] = manager.isUsingTextureForTargets;\n }\n else {\n defines[\"MORPHTARGETS_UV\"] = false;\n defines[\"MORPHTARGETS_TANGENT\"] = false;\n defines[\"MORPHTARGETS_NORMAL\"] = false;\n defines[\"MORPHTARGETS\"] = false;\n defines[\"NUM_MORPH_INFLUENCERS\"] = 0;\n }\n }\n /**\n * Prepares the defines for baked vertex animation\n * @param mesh The mesh containing the geometry data we will draw\n * @param defines The defines to update\n */\n static PrepareDefinesForBakedVertexAnimation(mesh, defines) {\n const manager = mesh.bakedVertexAnimationManager;\n defines[\"BAKED_VERTEX_ANIMATION_TEXTURE\"] = manager && manager.isEnabled ? true : false;\n }\n /**\n * Prepares the defines used in the shader depending on the attributes data available in the mesh\n * @param mesh The mesh containing the geometry data we will draw\n * @param defines The defines to update\n * @param useVertexColor Precise whether vertex colors should be used or not (override mesh info)\n * @param useBones Precise whether bones should be used or not (override mesh info)\n * @param useMorphTargets Precise whether morph targets should be used or not (override mesh info)\n * @param useVertexAlpha Precise whether vertex alpha should be used or not (override mesh info)\n * @param useBakedVertexAnimation Precise whether baked vertex animation should be used or not (override mesh info)\n * @returns false if defines are considered not dirty and have not been checked\n */\n static PrepareDefinesForAttributes(mesh, defines, useVertexColor, useBones, useMorphTargets = false, useVertexAlpha = true, useBakedVertexAnimation = true) {\n if (!defines._areAttributesDirty && defines._needNormals === defines._normals && defines._needUVs === defines._uvs) {\n return false;\n }\n defines._normals = defines._needNormals;\n defines._uvs = defines._needUVs;\n defines[\"NORMAL\"] = defines._needNormals && mesh.isVerticesDataPresent(VertexBuffer.NormalKind);\n if (defines._needNormals && mesh.isVerticesDataPresent(VertexBuffer.TangentKind)) {\n defines[\"TANGENT\"] = true;\n }\n for (let i = 1; i <= 6; ++i) {\n defines[\"UV\" + i] = defines._needUVs ? mesh.isVerticesDataPresent(`uv${i === 1 ? \"\" : i}`) : false;\n }\n if (useVertexColor) {\n const hasVertexColors = mesh.useVertexColors && mesh.isVerticesDataPresent(VertexBuffer.ColorKind);\n defines[\"VERTEXCOLOR\"] = hasVertexColors;\n defines[\"VERTEXALPHA\"] = mesh.hasVertexAlpha && hasVertexColors && useVertexAlpha;\n }\n if (mesh.isVerticesDataPresent(VertexBuffer.ColorInstanceKind) && (mesh.hasInstances || mesh.hasThinInstances)) {\n defines[\"INSTANCESCOLOR\"] = true;\n }\n if (useBones) {\n this.PrepareDefinesForBones(mesh, defines);\n }\n if (useMorphTargets) {\n this.PrepareDefinesForMorphTargets(mesh, defines);\n }\n if (useBakedVertexAnimation) {\n this.PrepareDefinesForBakedVertexAnimation(mesh, defines);\n }\n return true;\n }\n /**\n * Prepares the defines related to multiview\n * @param scene The scene we are intending to draw\n * @param defines The defines to update\n */\n static PrepareDefinesForMultiview(scene, defines) {\n if (scene.activeCamera) {\n const previousMultiview = defines.MULTIVIEW;\n defines.MULTIVIEW = scene.activeCamera.outputRenderTarget !== null && scene.activeCamera.outputRenderTarget.getViewCount() > 1;\n if (defines.MULTIVIEW != previousMultiview) {\n defines.markAsUnprocessed();\n }\n }\n }\n /**\n * Prepares the defines related to order independant transparency\n * @param scene The scene we are intending to draw\n * @param defines The defines to update\n * @param needAlphaBlending Determines if the material needs alpha blending\n */\n static PrepareDefinesForOIT(scene, defines, needAlphaBlending) {\n const previousDefine = defines.ORDER_INDEPENDENT_TRANSPARENCY;\n const previousDefine16Bits = defines.ORDER_INDEPENDENT_TRANSPARENCY_16BITS;\n defines.ORDER_INDEPENDENT_TRANSPARENCY = scene.useOrderIndependentTransparency && needAlphaBlending;\n defines.ORDER_INDEPENDENT_TRANSPARENCY_16BITS = !scene.getEngine().getCaps().textureFloatLinearFiltering;\n if (previousDefine !== defines.ORDER_INDEPENDENT_TRANSPARENCY || previousDefine16Bits !== defines.ORDER_INDEPENDENT_TRANSPARENCY_16BITS) {\n defines.markAsUnprocessed();\n }\n }\n /**\n * Prepares the defines related to the prepass\n * @param scene The scene we are intending to draw\n * @param defines The defines to update\n * @param canRenderToMRT Indicates if this material renders to several textures in the prepass\n */\n static PrepareDefinesForPrePass(scene, defines, canRenderToMRT) {\n const previousPrePass = defines.PREPASS;\n if (!defines._arePrePassDirty) {\n return;\n }\n const texturesList = [\n {\n type: 1,\n define: \"PREPASS_POSITION\",\n index: \"PREPASS_POSITION_INDEX\",\n },\n {\n type: 2,\n define: \"PREPASS_VELOCITY\",\n index: \"PREPASS_VELOCITY_INDEX\",\n },\n {\n type: 3,\n define: \"PREPASS_REFLECTIVITY\",\n index: \"PREPASS_REFLECTIVITY_INDEX\",\n },\n {\n type: 0,\n define: \"PREPASS_IRRADIANCE\",\n index: \"PREPASS_IRRADIANCE_INDEX\",\n },\n {\n type: 7,\n define: \"PREPASS_ALBEDO_SQRT\",\n index: \"PREPASS_ALBEDO_SQRT_INDEX\",\n },\n {\n type: 5,\n define: \"PREPASS_DEPTH\",\n index: \"PREPASS_DEPTH_INDEX\",\n },\n {\n type: 6,\n define: \"PREPASS_NORMAL\",\n index: \"PREPASS_NORMAL_INDEX\",\n },\n ];\n if (scene.prePassRenderer && scene.prePassRenderer.enabled && canRenderToMRT) {\n defines.PREPASS = true;\n defines.SCENE_MRT_COUNT = scene.prePassRenderer.mrtCount;\n defines.PREPASS_NORMAL_WORLDSPACE = scene.prePassRenderer.generateNormalsInWorldSpace;\n for (let i = 0; i < texturesList.length; i++) {\n const index = scene.prePassRenderer.getIndex(texturesList[i].type);\n if (index !== -1) {\n defines[texturesList[i].define] = true;\n defines[texturesList[i].index] = index;\n }\n else {\n defines[texturesList[i].define] = false;\n }\n }\n }\n else {\n defines.PREPASS = false;\n for (let i = 0; i < texturesList.length; i++) {\n defines[texturesList[i].define] = false;\n }\n }\n if (defines.PREPASS != previousPrePass) {\n defines.markAsUnprocessed();\n defines.markAsImageProcessingDirty();\n }\n }\n /**\n * Prepares the defines related to the light information passed in parameter\n * @param scene The scene we are intending to draw\n * @param mesh The mesh the effect is compiling for\n * @param light The light the effect is compiling for\n * @param lightIndex The index of the light\n * @param defines The defines to update\n * @param specularSupported Specifies whether specular is supported or not (override lights data)\n * @param state Defines the current state regarding what is needed (normals, etc...)\n * @param state.needNormals\n * @param state.needRebuild\n * @param state.shadowEnabled\n * @param state.specularEnabled\n * @param state.lightmapMode\n */\n static PrepareDefinesForLight(scene, mesh, light, lightIndex, defines, specularSupported, state) {\n var _a;\n state.needNormals = true;\n if (defines[\"LIGHT\" + lightIndex] === undefined) {\n state.needRebuild = true;\n }\n defines[\"LIGHT\" + lightIndex] = true;\n defines[\"SPOTLIGHT\" + lightIndex] = false;\n defines[\"HEMILIGHT\" + lightIndex] = false;\n defines[\"POINTLIGHT\" + lightIndex] = false;\n defines[\"DIRLIGHT\" + lightIndex] = false;\n light.prepareLightSpecificDefines(defines, lightIndex);\n // FallOff.\n defines[\"LIGHT_FALLOFF_PHYSICAL\" + lightIndex] = false;\n defines[\"LIGHT_FALLOFF_GLTF\" + lightIndex] = false;\n defines[\"LIGHT_FALLOFF_STANDARD\" + lightIndex] = false;\n switch (light.falloffType) {\n case LightConstants.FALLOFF_GLTF:\n defines[\"LIGHT_FALLOFF_GLTF\" + lightIndex] = true;\n break;\n case LightConstants.FALLOFF_PHYSICAL:\n defines[\"LIGHT_FALLOFF_PHYSICAL\" + lightIndex] = true;\n break;\n case LightConstants.FALLOFF_STANDARD:\n defines[\"LIGHT_FALLOFF_STANDARD\" + lightIndex] = true;\n break;\n }\n // Specular\n if (specularSupported && !light.specular.equalsFloats(0, 0, 0)) {\n state.specularEnabled = true;\n }\n // Shadows\n defines[\"SHADOW\" + lightIndex] = false;\n defines[\"SHADOWCSM\" + lightIndex] = false;\n defines[\"SHADOWCSMDEBUG\" + lightIndex] = false;\n defines[\"SHADOWCSMNUM_CASCADES\" + lightIndex] = false;\n defines[\"SHADOWCSMUSESHADOWMAXZ\" + lightIndex] = false;\n defines[\"SHADOWCSMNOBLEND\" + lightIndex] = false;\n defines[\"SHADOWCSM_RIGHTHANDED\" + lightIndex] = false;\n defines[\"SHADOWPCF\" + lightIndex] = false;\n defines[\"SHADOWPCSS\" + lightIndex] = false;\n defines[\"SHADOWPOISSON\" + lightIndex] = false;\n defines[\"SHADOWESM\" + lightIndex] = false;\n defines[\"SHADOWCLOSEESM\" + lightIndex] = false;\n defines[\"SHADOWCUBE\" + lightIndex] = false;\n defines[\"SHADOWLOWQUALITY\" + lightIndex] = false;\n defines[\"SHADOWMEDIUMQUALITY\" + lightIndex] = false;\n if (mesh && mesh.receiveShadows && scene.shadowsEnabled && light.shadowEnabled) {\n const shadowGenerator = (_a = light.getShadowGenerator(scene.activeCamera)) !== null && _a !== void 0 ? _a : light.getShadowGenerator();\n if (shadowGenerator) {\n const shadowMap = shadowGenerator.getShadowMap();\n if (shadowMap) {\n if (shadowMap.renderList && shadowMap.renderList.length > 0) {\n state.shadowEnabled = true;\n shadowGenerator.prepareDefines(defines, lightIndex);\n }\n }\n }\n }\n if (light.lightmapMode != LightConstants.LIGHTMAP_DEFAULT) {\n state.lightmapMode = true;\n defines[\"LIGHTMAPEXCLUDED\" + lightIndex] = true;\n defines[\"LIGHTMAPNOSPECULAR\" + lightIndex] = light.lightmapMode == LightConstants.LIGHTMAP_SHADOWSONLY;\n }\n else {\n defines[\"LIGHTMAPEXCLUDED\" + lightIndex] = false;\n defines[\"LIGHTMAPNOSPECULAR\" + lightIndex] = false;\n }\n }\n /**\n * Prepares the defines related to the light information passed in parameter\n * @param scene The scene we are intending to draw\n * @param mesh The mesh the effect is compiling for\n * @param defines The defines to update\n * @param specularSupported Specifies whether specular is supported or not (override lights data)\n * @param maxSimultaneousLights Specifies how manuy lights can be added to the effect at max\n * @param disableLighting Specifies whether the lighting is disabled (override scene and light)\n * @returns true if normals will be required for the rest of the effect\n */\n static PrepareDefinesForLights(scene, mesh, defines, specularSupported, maxSimultaneousLights = 4, disableLighting = false) {\n if (!defines._areLightsDirty) {\n return defines._needNormals;\n }\n let lightIndex = 0;\n const state = {\n needNormals: defines._needNormals,\n needRebuild: false,\n lightmapMode: false,\n shadowEnabled: false,\n specularEnabled: false,\n };\n if (scene.lightsEnabled && !disableLighting) {\n for (const light of mesh.lightSources) {\n this.PrepareDefinesForLight(scene, mesh, light, lightIndex, defines, specularSupported, state);\n lightIndex++;\n if (lightIndex === maxSimultaneousLights) {\n break;\n }\n }\n }\n defines[\"SPECULARTERM\"] = state.specularEnabled;\n defines[\"SHADOWS\"] = state.shadowEnabled;\n // Resetting all other lights if any\n for (let index = lightIndex; index < maxSimultaneousLights; index++) {\n if (defines[\"LIGHT\" + index] !== undefined) {\n defines[\"LIGHT\" + index] = false;\n defines[\"HEMILIGHT\" + index] = false;\n defines[\"POINTLIGHT\" + index] = false;\n defines[\"DIRLIGHT\" + index] = false;\n defines[\"SPOTLIGHT\" + index] = false;\n defines[\"SHADOW\" + index] = false;\n defines[\"SHADOWCSM\" + index] = false;\n defines[\"SHADOWCSMDEBUG\" + index] = false;\n defines[\"SHADOWCSMNUM_CASCADES\" + index] = false;\n defines[\"SHADOWCSMUSESHADOWMAXZ\" + index] = false;\n defines[\"SHADOWCSMNOBLEND\" + index] = false;\n defines[\"SHADOWCSM_RIGHTHANDED\" + index] = false;\n defines[\"SHADOWPCF\" + index] = false;\n defines[\"SHADOWPCSS\" + index] = false;\n defines[\"SHADOWPOISSON\" + index] = false;\n defines[\"SHADOWESM\" + index] = false;\n defines[\"SHADOWCLOSEESM\" + index] = false;\n defines[\"SHADOWCUBE\" + index] = false;\n defines[\"SHADOWLOWQUALITY\" + index] = false;\n defines[\"SHADOWMEDIUMQUALITY\" + index] = false;\n }\n }\n const caps = scene.getEngine().getCaps();\n if (defines[\"SHADOWFLOAT\"] === undefined) {\n state.needRebuild = true;\n }\n defines[\"SHADOWFLOAT\"] =\n state.shadowEnabled && ((caps.textureFloatRender && caps.textureFloatLinearFiltering) || (caps.textureHalfFloatRender && caps.textureHalfFloatLinearFiltering));\n defines[\"LIGHTMAPEXCLUDED\"] = state.lightmapMode;\n if (state.needRebuild) {\n defines.rebuild();\n }\n return state.needNormals;\n }\n /**\n * Prepares the uniforms and samplers list to be used in the effect (for a specific light)\n * @param lightIndex defines the light index\n * @param uniformsList The uniform list\n * @param samplersList The sampler list\n * @param projectedLightTexture defines if projected texture must be used\n * @param uniformBuffersList defines an optional list of uniform buffers\n * @param updateOnlyBuffersList True to only update the uniformBuffersList array\n */\n static PrepareUniformsAndSamplersForLight(lightIndex, uniformsList, samplersList, projectedLightTexture, uniformBuffersList = null, updateOnlyBuffersList = false) {\n if (uniformBuffersList) {\n uniformBuffersList.push(\"Light\" + lightIndex);\n }\n if (updateOnlyBuffersList) {\n return;\n }\n uniformsList.push(\"vLightData\" + lightIndex, \"vLightDiffuse\" + lightIndex, \"vLightSpecular\" + lightIndex, \"vLightDirection\" + lightIndex, \"vLightFalloff\" + lightIndex, \"vLightGround\" + lightIndex, \"lightMatrix\" + lightIndex, \"shadowsInfo\" + lightIndex, \"depthValues\" + lightIndex);\n samplersList.push(\"shadowSampler\" + lightIndex);\n samplersList.push(\"depthSampler\" + lightIndex);\n uniformsList.push(\"viewFrustumZ\" + lightIndex, \"cascadeBlendFactor\" + lightIndex, \"lightSizeUVCorrection\" + lightIndex, \"depthCorrection\" + lightIndex, \"penumbraDarkness\" + lightIndex, \"frustumLengths\" + lightIndex);\n if (projectedLightTexture) {\n samplersList.push(\"projectionLightSampler\" + lightIndex);\n uniformsList.push(\"textureProjectionMatrix\" + lightIndex);\n }\n }\n /**\n * Prepares the uniforms and samplers list to be used in the effect\n * @param uniformsListOrOptions The uniform names to prepare or an EffectCreationOptions containing the list and extra information\n * @param samplersList The sampler list\n * @param defines The defines helping in the list generation\n * @param maxSimultaneousLights The maximum number of simultaneous light allowed in the effect\n */\n static PrepareUniformsAndSamplersList(uniformsListOrOptions, samplersList, defines, maxSimultaneousLights = 4) {\n let uniformsList;\n let uniformBuffersList = null;\n if (uniformsListOrOptions.uniformsNames) {\n const options = uniformsListOrOptions;\n uniformsList = options.uniformsNames;\n uniformBuffersList = options.uniformBuffersNames;\n samplersList = options.samplers;\n defines = options.defines;\n maxSimultaneousLights = options.maxSimultaneousLights || 0;\n }\n else {\n uniformsList = uniformsListOrOptions;\n if (!samplersList) {\n samplersList = [];\n }\n }\n for (let lightIndex = 0; lightIndex < maxSimultaneousLights; lightIndex++) {\n if (!defines[\"LIGHT\" + lightIndex]) {\n break;\n }\n this.PrepareUniformsAndSamplersForLight(lightIndex, uniformsList, samplersList, defines[\"PROJECTEDLIGHTTEXTURE\" + lightIndex], uniformBuffersList);\n }\n if (defines[\"NUM_MORPH_INFLUENCERS\"]) {\n uniformsList.push(\"morphTargetInfluences\");\n }\n if (defines[\"BAKED_VERTEX_ANIMATION_TEXTURE\"]) {\n uniformsList.push(\"bakedVertexAnimationSettings\");\n uniformsList.push(\"bakedVertexAnimationTextureSizeInverted\");\n uniformsList.push(\"bakedVertexAnimationTime\");\n samplersList.push(\"bakedVertexAnimationTexture\");\n }\n }\n /**\n * This helps decreasing rank by rank the shadow quality (0 being the highest rank and quality)\n * @param defines The defines to update while falling back\n * @param fallbacks The authorized effect fallbacks\n * @param maxSimultaneousLights The maximum number of lights allowed\n * @param rank the current rank of the Effect\n * @returns The newly affected rank\n */\n static HandleFallbacksForShadows(defines, fallbacks, maxSimultaneousLights = 4, rank = 0) {\n let lightFallbackRank = 0;\n for (let lightIndex = 0; lightIndex < maxSimultaneousLights; lightIndex++) {\n if (!defines[\"LIGHT\" + lightIndex]) {\n break;\n }\n if (lightIndex > 0) {\n lightFallbackRank = rank + lightIndex;\n fallbacks.addFallback(lightFallbackRank, \"LIGHT\" + lightIndex);\n }\n if (!defines[\"SHADOWS\"]) {\n if (defines[\"SHADOW\" + lightIndex]) {\n fallbacks.addFallback(rank, \"SHADOW\" + lightIndex);\n }\n if (defines[\"SHADOWPCF\" + lightIndex]) {\n fallbacks.addFallback(rank, \"SHADOWPCF\" + lightIndex);\n }\n if (defines[\"SHADOWPCSS\" + lightIndex]) {\n fallbacks.addFallback(rank, \"SHADOWPCSS\" + lightIndex);\n }\n if (defines[\"SHADOWPOISSON\" + lightIndex]) {\n fallbacks.addFallback(rank, \"SHADOWPOISSON\" + lightIndex);\n }\n if (defines[\"SHADOWESM\" + lightIndex]) {\n fallbacks.addFallback(rank, \"SHADOWESM\" + lightIndex);\n }\n if (defines[\"SHADOWCLOSEESM\" + lightIndex]) {\n fallbacks.addFallback(rank, \"SHADOWCLOSEESM\" + lightIndex);\n }\n }\n }\n return lightFallbackRank++;\n }\n /**\n * Prepares the list of attributes required for morph targets according to the effect defines.\n * @param attribs The current list of supported attribs\n * @param mesh The mesh to prepare the morph targets attributes for\n * @param influencers The number of influencers\n */\n static PrepareAttributesForMorphTargetsInfluencers(attribs, mesh, influencers) {\n this._TmpMorphInfluencers.NUM_MORPH_INFLUENCERS = influencers;\n this.PrepareAttributesForMorphTargets(attribs, mesh, this._TmpMorphInfluencers);\n }\n /**\n * Prepares the list of attributes required for morph targets according to the effect defines.\n * @param attribs The current list of supported attribs\n * @param mesh The mesh to prepare the morph targets attributes for\n * @param defines The current Defines of the effect\n */\n static PrepareAttributesForMorphTargets(attribs, mesh, defines) {\n const influencers = defines[\"NUM_MORPH_INFLUENCERS\"];\n if (influencers > 0 && EngineStore.LastCreatedEngine) {\n const maxAttributesCount = EngineStore.LastCreatedEngine.getCaps().maxVertexAttribs;\n const manager = mesh.morphTargetManager;\n if (manager === null || manager === void 0 ? void 0 : manager.isUsingTextureForTargets) {\n return;\n }\n const normal = manager && manager.supportsNormals && defines[\"NORMAL\"];\n const tangent = manager && manager.supportsTangents && defines[\"TANGENT\"];\n const uv = manager && manager.supportsUVs && defines[\"UV1\"];\n for (let index = 0; index < influencers; index++) {\n attribs.push(VertexBuffer.PositionKind + index);\n if (normal) {\n attribs.push(VertexBuffer.NormalKind + index);\n }\n if (tangent) {\n attribs.push(VertexBuffer.TangentKind + index);\n }\n if (uv) {\n attribs.push(VertexBuffer.UVKind + \"_\" + index);\n }\n if (attribs.length > maxAttributesCount) {\n Logger.Error(\"Cannot add more vertex attributes for mesh \" + mesh.name);\n }\n }\n }\n }\n /**\n * Prepares the list of attributes required for baked vertex animations according to the effect defines.\n * @param attribs The current list of supported attribs\n * @param mesh The mesh to prepare the morph targets attributes for\n * @param defines The current Defines of the effect\n */\n static PrepareAttributesForBakedVertexAnimation(attribs, mesh, defines) {\n const enabled = defines[\"BAKED_VERTEX_ANIMATION_TEXTURE\"] && defines[\"INSTANCES\"];\n if (enabled) {\n attribs.push(\"bakedVertexAnimationSettingsInstanced\");\n }\n }\n /**\n * Prepares the list of attributes required for bones according to the effect defines.\n * @param attribs The current list of supported attribs\n * @param mesh The mesh to prepare the bones attributes for\n * @param defines The current Defines of the effect\n * @param fallbacks The current effect fallback strategy\n */\n static PrepareAttributesForBones(attribs, mesh, defines, fallbacks) {\n if (defines[\"NUM_BONE_INFLUENCERS\"] > 0) {\n fallbacks.addCPUSkinningFallback(0, mesh);\n attribs.push(VertexBuffer.MatricesIndicesKind);\n attribs.push(VertexBuffer.MatricesWeightsKind);\n if (defines[\"NUM_BONE_INFLUENCERS\"] > 4) {\n attribs.push(VertexBuffer.MatricesIndicesExtraKind);\n attribs.push(VertexBuffer.MatricesWeightsExtraKind);\n }\n }\n }\n /**\n * Check and prepare the list of attributes required for instances according to the effect defines.\n * @param attribs The current list of supported attribs\n * @param defines The current MaterialDefines of the effect\n */\n static PrepareAttributesForInstances(attribs, defines) {\n if (defines[\"INSTANCES\"] || defines[\"THIN_INSTANCES\"]) {\n this.PushAttributesForInstances(attribs, !!defines[\"PREPASS_VELOCITY\"]);\n }\n if (defines.INSTANCESCOLOR) {\n attribs.push(VertexBuffer.ColorInstanceKind);\n }\n }\n /**\n * Add the list of attributes required for instances to the attribs array.\n * @param attribs The current list of supported attribs\n * @param needsPreviousMatrices If the shader needs previous matrices\n */\n static PushAttributesForInstances(attribs, needsPreviousMatrices = false) {\n attribs.push(\"world0\");\n attribs.push(\"world1\");\n attribs.push(\"world2\");\n attribs.push(\"world3\");\n if (needsPreviousMatrices) {\n attribs.push(\"previousWorld0\");\n attribs.push(\"previousWorld1\");\n attribs.push(\"previousWorld2\");\n attribs.push(\"previousWorld3\");\n }\n }\n /**\n * Binds the light information to the effect.\n * @param light The light containing the generator\n * @param effect The effect we are binding the data to\n * @param lightIndex The light index in the effect used to render\n */\n static BindLightProperties(light, effect, lightIndex) {\n light.transferToEffect(effect, lightIndex + \"\");\n }\n /**\n * Binds the lights information from the scene to the effect for the given mesh.\n * @param light Light to bind\n * @param lightIndex Light index\n * @param scene The scene where the light belongs to\n * @param effect The effect we are binding the data to\n * @param useSpecular Defines if specular is supported\n * @param receiveShadows Defines if the effect (mesh) we bind the light for receives shadows\n */\n static BindLight(light, lightIndex, scene, effect, useSpecular, receiveShadows = true) {\n light._bindLight(lightIndex, scene, effect, useSpecular, receiveShadows);\n }\n /**\n * Binds the lights information from the scene to the effect for the given mesh.\n * @param scene The scene the lights belongs to\n * @param mesh The mesh we are binding the information to render\n * @param effect The effect we are binding the data to\n * @param defines The generated defines for the effect\n * @param maxSimultaneousLights The maximum number of light that can be bound to the effect\n */\n static BindLights(scene, mesh, effect, defines, maxSimultaneousLights = 4) {\n const len = Math.min(mesh.lightSources.length, maxSimultaneousLights);\n for (let i = 0; i < len; i++) {\n const light = mesh.lightSources[i];\n this.BindLight(light, i, scene, effect, typeof defines === \"boolean\" ? defines : defines[\"SPECULARTERM\"], mesh.receiveShadows);\n }\n }\n /**\n * Binds the fog information from the scene to the effect for the given mesh.\n * @param scene The scene the lights belongs to\n * @param mesh The mesh we are binding the information to render\n * @param effect The effect we are binding the data to\n * @param linearSpace Defines if the fog effect is applied in linear space\n */\n static BindFogParameters(scene, mesh, effect, linearSpace = false) {\n if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) {\n effect.setFloat4(\"vFogInfos\", scene.fogMode, scene.fogStart, scene.fogEnd, scene.fogDensity);\n // Convert fog color to linear space if used in a linear space computed shader.\n if (linearSpace) {\n scene.fogColor.toLinearSpaceToRef(this._TempFogColor, scene.getEngine().useExactSrgbConversions);\n effect.setColor3(\"vFogColor\", this._TempFogColor);\n }\n else {\n effect.setColor3(\"vFogColor\", scene.fogColor);\n }\n }\n }\n /**\n * Binds the bones information from the mesh to the effect.\n * @param mesh The mesh we are binding the information to render\n * @param effect The effect we are binding the data to\n * @param prePassConfiguration Configuration for the prepass, in case prepass is activated\n */\n static BindBonesParameters(mesh, effect, prePassConfiguration) {\n if (!effect || !mesh) {\n return;\n }\n if (mesh.computeBonesUsingShaders && effect._bonesComputationForcedToCPU) {\n mesh.computeBonesUsingShaders = false;\n }\n if (mesh.useBones && mesh.computeBonesUsingShaders && mesh.skeleton) {\n const skeleton = mesh.skeleton;\n if (skeleton.isUsingTextureForMatrices && effect.getUniformIndex(\"boneTextureWidth\") > -1) {\n const boneTexture = skeleton.getTransformMatrixTexture(mesh);\n effect.setTexture(\"boneSampler\", boneTexture);\n effect.setFloat(\"boneTextureWidth\", 4.0 * (skeleton.bones.length + 1));\n }\n else {\n const matrices = skeleton.getTransformMatrices(mesh);\n if (matrices) {\n effect.setMatrices(\"mBones\", matrices);\n if (prePassConfiguration && mesh.getScene().prePassRenderer && mesh.getScene().prePassRenderer.getIndex(2)) {\n if (!prePassConfiguration.previousBones[mesh.uniqueId]) {\n prePassConfiguration.previousBones[mesh.uniqueId] = matrices.slice();\n }\n effect.setMatrices(\"mPreviousBones\", prePassConfiguration.previousBones[mesh.uniqueId]);\n MaterialHelper._CopyBonesTransformationMatrices(matrices, prePassConfiguration.previousBones[mesh.uniqueId]);\n }\n }\n }\n }\n }\n // Copies the bones transformation matrices into the target array and returns the target's reference\n static _CopyBonesTransformationMatrices(source, target) {\n target.set(source);\n return target;\n }\n /**\n * Binds the morph targets information from the mesh to the effect.\n * @param abstractMesh The mesh we are binding the information to render\n * @param effect The effect we are binding the data to\n */\n static BindMorphTargetParameters(abstractMesh, effect) {\n const manager = abstractMesh.morphTargetManager;\n if (!abstractMesh || !manager) {\n return;\n }\n effect.setFloatArray(\"morphTargetInfluences\", manager.influences);\n }\n /**\n * Binds the logarithmic depth information from the scene to the effect for the given defines.\n * @param defines The generated defines used in the effect\n * @param effect The effect we are binding the data to\n * @param scene The scene we are willing to render with logarithmic scale for\n */\n static BindLogDepth(defines, effect, scene) {\n if (!defines || defines[\"LOGARITHMICDEPTH\"] || (defines.indexOf && defines.indexOf(\"LOGARITHMICDEPTH\") >= 0)) {\n const camera = scene.activeCamera;\n if (camera.mode === Camera.ORTHOGRAPHIC_CAMERA) {\n Logger.Error(\"Logarithmic depth is not compatible with orthographic cameras!\", 20);\n }\n effect.setFloat(\"logarithmicDepthConstant\", 2.0 / (Math.log(camera.maxZ + 1.0) / Math.LN2));\n }\n }\n}\n// eslint-disable-next-line @typescript-eslint/naming-convention\nMaterialHelper._TmpMorphInfluencers = { NUM_MORPH_INFLUENCERS: 0 };\nMaterialHelper._TempFogColor = Color3.Black();\n//# sourceMappingURL=materialHelper.js.map","import { __decorate } from \"../tslib.es6.js\";\n\nimport { SerializationHelper, serialize } from \"../Misc/decorators.js\";\n/**\n * Class that holds the different stencil states of a material\n * Usage example: https://playground.babylonjs.com/#CW5PRI#10\n */\nexport class MaterialStencilState {\n /**\n * Creates a material stencil state instance\n */\n constructor() {\n this.reset();\n }\n /**\n * Resets all the stencil states to default values\n */\n reset() {\n this.enabled = false;\n this.mask = 0xff;\n this.func = 519;\n this.funcRef = 1;\n this.funcMask = 0xff;\n this.opStencilFail = 7680;\n this.opDepthFail = 7680;\n this.opStencilDepthPass = 7681;\n }\n /**\n * Gets or sets the stencil function\n */\n get func() {\n return this._func;\n }\n set func(value) {\n this._func = value;\n }\n /**\n * Gets or sets the stencil function reference\n */\n get funcRef() {\n return this._funcRef;\n }\n set funcRef(value) {\n this._funcRef = value;\n }\n /**\n * Gets or sets the stencil function mask\n */\n get funcMask() {\n return this._funcMask;\n }\n set funcMask(value) {\n this._funcMask = value;\n }\n /**\n * Gets or sets the operation when the stencil test fails\n */\n get opStencilFail() {\n return this._opStencilFail;\n }\n set opStencilFail(value) {\n this._opStencilFail = value;\n }\n /**\n * Gets or sets the operation when the depth test fails\n */\n get opDepthFail() {\n return this._opDepthFail;\n }\n set opDepthFail(value) {\n this._opDepthFail = value;\n }\n /**\n * Gets or sets the operation when the stencil+depth test succeeds\n */\n get opStencilDepthPass() {\n return this._opStencilDepthPass;\n }\n set opStencilDepthPass(value) {\n this._opStencilDepthPass = value;\n }\n /**\n * Gets or sets the stencil mask\n */\n get mask() {\n return this._mask;\n }\n set mask(value) {\n this._mask = value;\n }\n /**\n * Enables or disables the stencil test\n */\n get enabled() {\n return this._enabled;\n }\n set enabled(value) {\n this._enabled = value;\n }\n /**\n * Get the current class name, useful for serialization or dynamic coding.\n * @returns \"MaterialStencilState\"\n */\n getClassName() {\n return \"MaterialStencilState\";\n }\n /**\n * Makes a duplicate of the current configuration into another one.\n * @param stencilState defines stencil state where to copy the info\n */\n copyTo(stencilState) {\n SerializationHelper.Clone(() => stencilState, this);\n }\n /**\n * Serializes this stencil configuration.\n * @returns - An object with the serialized config.\n */\n serialize() {\n return SerializationHelper.Serialize(this);\n }\n /**\n * Parses a stencil state configuration from a serialized object.\n * @param source - Serialized object.\n * @param scene Defines the scene we are parsing for\n * @param rootUrl Defines the rootUrl to load from\n */\n parse(source, scene, rootUrl) {\n SerializationHelper.Parse(() => this, source, scene, rootUrl);\n }\n}\n__decorate([\n serialize()\n], MaterialStencilState.prototype, \"func\", null);\n__decorate([\n serialize()\n], MaterialStencilState.prototype, \"funcRef\", null);\n__decorate([\n serialize()\n], MaterialStencilState.prototype, \"funcMask\", null);\n__decorate([\n serialize()\n], MaterialStencilState.prototype, \"opStencilFail\", null);\n__decorate([\n serialize()\n], MaterialStencilState.prototype, \"opDepthFail\", null);\n__decorate([\n serialize()\n], MaterialStencilState.prototype, \"opStencilDepthPass\", null);\n__decorate([\n serialize()\n], MaterialStencilState.prototype, \"mask\", null);\n__decorate([\n serialize()\n], MaterialStencilState.prototype, \"enabled\", null);\n//# sourceMappingURL=materialStencilState.js.map","/**\n * @internal\n */\nexport var MaterialPluginEvent;\n(function (MaterialPluginEvent) {\n MaterialPluginEvent[MaterialPluginEvent[\"Created\"] = 1] = \"Created\";\n MaterialPluginEvent[MaterialPluginEvent[\"Disposed\"] = 2] = \"Disposed\";\n MaterialPluginEvent[MaterialPluginEvent[\"GetDefineNames\"] = 4] = \"GetDefineNames\";\n MaterialPluginEvent[MaterialPluginEvent[\"PrepareUniformBuffer\"] = 8] = \"PrepareUniformBuffer\";\n MaterialPluginEvent[MaterialPluginEvent[\"IsReadyForSubMesh\"] = 16] = \"IsReadyForSubMesh\";\n MaterialPluginEvent[MaterialPluginEvent[\"PrepareDefines\"] = 32] = \"PrepareDefines\";\n MaterialPluginEvent[MaterialPluginEvent[\"BindForSubMesh\"] = 64] = \"BindForSubMesh\";\n MaterialPluginEvent[MaterialPluginEvent[\"PrepareEffect\"] = 128] = \"PrepareEffect\";\n MaterialPluginEvent[MaterialPluginEvent[\"GetAnimatables\"] = 256] = \"GetAnimatables\";\n MaterialPluginEvent[MaterialPluginEvent[\"GetActiveTextures\"] = 512] = \"GetActiveTextures\";\n MaterialPluginEvent[MaterialPluginEvent[\"HasTexture\"] = 1024] = \"HasTexture\";\n MaterialPluginEvent[MaterialPluginEvent[\"FillRenderTargetTextures\"] = 2048] = \"FillRenderTargetTextures\";\n MaterialPluginEvent[MaterialPluginEvent[\"HasRenderTargetTextures\"] = 4096] = \"HasRenderTargetTextures\";\n MaterialPluginEvent[MaterialPluginEvent[\"HardBindForSubMesh\"] = 8192] = \"HardBindForSubMesh\";\n})(MaterialPluginEvent || (MaterialPluginEvent = {}));\n//# sourceMappingURL=materialPluginEvent.js.map","import { __decorate } from \"../tslib.es6.js\";\nimport { serialize, SerializationHelper } from \"../Misc/decorators.js\";\nimport { Tools } from \"../Misc/tools.js\";\nimport { Observable } from \"../Misc/observable.js\";\nimport { EngineStore } from \"../Engines/engineStore.js\";\nimport { SubMesh } from \"../Meshes/subMesh.js\";\nimport { UniformBuffer } from \"./uniformBuffer.js\";\n\nimport { Logger } from \"../Misc/logger.js\";\nimport { Plane } from \"../Maths/math.plane.js\";\nimport { MaterialHelper } from \"./materialHelper.js\";\nimport { DrawWrapper } from \"./drawWrapper.js\";\nimport { MaterialStencilState } from \"./materialStencilState.js\";\nimport { ScenePerformancePriority } from \"../scene.js\";\nimport { MaterialPluginEvent } from \"./materialPluginEvent.js\";\n/**\n * Base class for the main features of a material in Babylon.js\n */\nexport class Material {\n /**\n * If the material can be rendered to several textures with MRT extension\n */\n get canRenderToMRT() {\n // By default, shaders are not compatible with MRTs\n // Base classes should override that if their shader supports MRT\n return false;\n }\n /**\n * Sets the alpha value of the material\n */\n set alpha(value) {\n if (this._alpha === value) {\n return;\n }\n const oldValue = this._alpha;\n this._alpha = value;\n // Only call dirty when there is a state change (no alpha / alpha)\n if (oldValue === 1 || value === 1) {\n this.markAsDirty(Material.MiscDirtyFlag + Material.PrePassDirtyFlag);\n }\n }\n /**\n * Gets the alpha value of the material\n */\n get alpha() {\n return this._alpha;\n }\n /**\n * Sets the culling state (true to enable culling, false to disable)\n */\n set backFaceCulling(value) {\n if (this._backFaceCulling === value) {\n return;\n }\n this._backFaceCulling = value;\n this.markAsDirty(Material.TextureDirtyFlag);\n }\n /**\n * Gets the culling state\n */\n get backFaceCulling() {\n return this._backFaceCulling;\n }\n /**\n * Sets the type of faces that should be culled (true for back faces, false for front faces)\n */\n set cullBackFaces(value) {\n if (this._cullBackFaces === value) {\n return;\n }\n this._cullBackFaces = value;\n this.markAsDirty(Material.TextureDirtyFlag);\n }\n /**\n * Gets the type of faces that should be culled\n */\n get cullBackFaces() {\n return this._cullBackFaces;\n }\n /**\n * Block the dirty-mechanism for this specific material\n * When set to false after being true the material will be marked as dirty.\n */\n get blockDirtyMechanism() {\n return this._blockDirtyMechanism;\n }\n set blockDirtyMechanism(value) {\n if (this._blockDirtyMechanism === value) {\n return;\n }\n this._blockDirtyMechanism = value;\n if (!value) {\n this.markDirty();\n }\n }\n /**\n * This allows you to modify the material without marking it as dirty after every change.\n * This function should be used if you need to make more than one dirty-enabling change to the material - adding a texture, setting a new fill mode and so on.\n * The callback will pass the material as an argument, so you can make your changes to it.\n * @param callback the callback to be executed that will update the material\n */\n atomicMaterialsUpdate(callback) {\n this.blockDirtyMechanism = true;\n try {\n callback(this);\n }\n finally {\n this.blockDirtyMechanism = false;\n }\n }\n /**\n * Gets a boolean indicating that current material needs to register RTT\n */\n get hasRenderTargetTextures() {\n this._eventInfo.hasRenderTargetTextures = false;\n this._callbackPluginEventHasRenderTargetTextures(this._eventInfo);\n return this._eventInfo.hasRenderTargetTextures;\n }\n /**\n * Called during a dispose event\n */\n set onDispose(callback) {\n if (this._onDisposeObserver) {\n this.onDisposeObservable.remove(this._onDisposeObserver);\n }\n this._onDisposeObserver = this.onDisposeObservable.add(callback);\n }\n /**\n * An event triggered when the material is bound\n */\n get onBindObservable() {\n if (!this._onBindObservable) {\n this._onBindObservable = new Observable();\n }\n return this._onBindObservable;\n }\n /**\n * Called during a bind event\n */\n set onBind(callback) {\n if (this._onBindObserver) {\n this.onBindObservable.remove(this._onBindObserver);\n }\n this._onBindObserver = this.onBindObservable.add(callback);\n }\n /**\n * An event triggered when the material is unbound\n */\n get onUnBindObservable() {\n if (!this._onUnBindObservable) {\n this._onUnBindObservable = new Observable();\n }\n return this._onUnBindObservable;\n }\n /**\n * An event triggered when the effect is (re)created\n */\n get onEffectCreatedObservable() {\n if (!this._onEffectCreatedObservable) {\n this._onEffectCreatedObservable = new Observable();\n }\n return this._onEffectCreatedObservable;\n }\n /**\n * Sets the value of the alpha mode.\n *\n * | Value | Type | Description |\n * | --- | --- | --- |\n * | 0 | ALPHA_DISABLE | |\n * | 1 | ALPHA_ADD | |\n * | 2 | ALPHA_COMBINE | |\n * | 3 | ALPHA_SUBTRACT | |\n * | 4 | ALPHA_MULTIPLY | |\n * | 5 | ALPHA_MAXIMIZED | |\n * | 6 | ALPHA_ONEONE | |\n * | 7 | ALPHA_PREMULTIPLIED | |\n * | 8 | ALPHA_PREMULTIPLIED_PORTERDUFF | |\n * | 9 | ALPHA_INTERPOLATE | |\n * | 10 | ALPHA_SCREENMODE | |\n *\n */\n set alphaMode(value) {\n if (this._alphaMode === value) {\n return;\n }\n this._alphaMode = value;\n this.markAsDirty(Material.TextureDirtyFlag);\n }\n /**\n * Gets the value of the alpha mode\n */\n get alphaMode() {\n return this._alphaMode;\n }\n /**\n * Sets the need depth pre-pass value\n */\n set needDepthPrePass(value) {\n if (this._needDepthPrePass === value) {\n return;\n }\n this._needDepthPrePass = value;\n if (this._needDepthPrePass) {\n this.checkReadyOnEveryCall = true;\n }\n }\n /**\n * Gets the depth pre-pass value\n */\n get needDepthPrePass() {\n return this._needDepthPrePass;\n }\n /**\n * Can this material render to prepass\n */\n get isPrePassCapable() {\n return false;\n }\n /**\n * Sets the state for enabling fog\n */\n set fogEnabled(value) {\n if (this._fogEnabled === value) {\n return;\n }\n this._fogEnabled = value;\n this.markAsDirty(Material.MiscDirtyFlag);\n }\n /**\n * Gets the value of the fog enabled state\n */\n get fogEnabled() {\n return this._fogEnabled;\n }\n get wireframe() {\n switch (this._fillMode) {\n case Material.WireFrameFillMode:\n case Material.LineListDrawMode:\n case Material.LineLoopDrawMode:\n case Material.LineStripDrawMode:\n return true;\n }\n return this._scene.forceWireframe;\n }\n /**\n * Sets the state of wireframe mode\n */\n set wireframe(value) {\n this.fillMode = value ? Material.WireFrameFillMode : Material.TriangleFillMode;\n }\n /**\n * Gets the value specifying if point clouds are enabled\n */\n get pointsCloud() {\n switch (this._fillMode) {\n case Material.PointFillMode:\n case Material.PointListDrawMode:\n return true;\n }\n return this._scene.forcePointsCloud;\n }\n /**\n * Sets the state of point cloud mode\n */\n set pointsCloud(value) {\n this.fillMode = value ? Material.PointFillMode : Material.TriangleFillMode;\n }\n /**\n * Gets the material fill mode\n */\n get fillMode() {\n return this._fillMode;\n }\n /**\n * Sets the material fill mode\n */\n set fillMode(value) {\n if (this._fillMode === value) {\n return;\n }\n this._fillMode = value;\n this.markAsDirty(Material.MiscDirtyFlag);\n }\n /** @internal */\n _getDrawWrapper() {\n return this._drawWrapper;\n }\n /**\n * @internal\n */\n _setDrawWrapper(drawWrapper) {\n this._drawWrapper = drawWrapper;\n }\n /**\n * Creates a material instance\n * @param name defines the name of the material\n * @param scene defines the scene to reference\n * @param doNotAdd specifies if the material should be added to the scene\n */\n constructor(name, scene, doNotAdd) {\n /**\n * Custom shadow depth material to use for shadow rendering instead of the in-built one\n */\n this.shadowDepthWrapper = null;\n /**\n * Gets or sets a boolean indicating that the material is allowed (if supported) to do shader hot swapping.\n * This means that the material can keep using a previous shader while a new one is being compiled.\n * This is mostly used when shader parallel compilation is supported (true by default)\n */\n this.allowShaderHotSwapping = true;\n /**\n * Gets or sets user defined metadata\n */\n this.metadata = null;\n /**\n * For internal use only. Please do not use.\n */\n this.reservedDataStore = null;\n /**\n * Specifies if the ready state should be checked on each call\n */\n this.checkReadyOnEveryCall = false;\n /**\n * Specifies if the ready state should be checked once\n */\n this.checkReadyOnlyOnce = false;\n /**\n * The state of the material\n */\n this.state = \"\";\n /**\n * The alpha value of the material\n */\n this._alpha = 1.0;\n /**\n * Specifies if back face culling is enabled\n */\n this._backFaceCulling = true;\n /**\n * Specifies if back or front faces should be culled (when culling is enabled)\n */\n this._cullBackFaces = true;\n this._blockDirtyMechanism = false;\n /**\n * Callback triggered when the material is compiled\n */\n this.onCompiled = null;\n /**\n * Callback triggered when an error occurs\n */\n this.onError = null;\n /**\n * Callback triggered to get the render target textures\n */\n this.getRenderTargetTextures = null;\n /**\n * Specifies if the material should be serialized\n */\n this.doNotSerialize = false;\n /**\n * @internal\n */\n this._storeEffectOnSubMeshes = false;\n /**\n * Stores the animations for the material\n */\n this.animations = null;\n /**\n * An event triggered when the material is disposed\n */\n this.onDisposeObservable = new Observable();\n /**\n * An observer which watches for dispose events\n */\n this._onDisposeObserver = null;\n this._onUnBindObservable = null;\n /**\n * An observer which watches for bind events\n */\n this._onBindObserver = null;\n /**\n * Stores the value of the alpha mode\n */\n this._alphaMode = 2;\n /**\n * Stores the state of the need depth pre-pass value\n */\n this._needDepthPrePass = false;\n /**\n * Specifies if depth writing should be disabled\n */\n this.disableDepthWrite = false;\n /**\n * Specifies if color writing should be disabled\n */\n this.disableColorWrite = false;\n /**\n * Specifies if depth writing should be forced\n */\n this.forceDepthWrite = false;\n /**\n * Specifies the depth function that should be used. 0 means the default engine function\n */\n this.depthFunction = 0;\n /**\n * Specifies if there should be a separate pass for culling\n */\n this.separateCullingPass = false;\n /**\n * Stores the state specifying if fog should be enabled\n */\n this._fogEnabled = true;\n /**\n * Stores the size of points\n */\n this.pointSize = 1.0;\n /**\n * Stores the z offset Factor value\n */\n this.zOffset = 0;\n /**\n * Stores the z offset Units value\n */\n this.zOffsetUnits = 0;\n /**\n * Gives access to the stencil properties of the material\n */\n this.stencil = new MaterialStencilState();\n /**\n * Specifies if uniform buffers should be used\n */\n this._useUBO = false;\n /**\n * Stores the fill mode state\n */\n this._fillMode = Material.TriangleFillMode;\n /**\n * Specifies if the depth write state should be cached\n */\n this._cachedDepthWriteState = false;\n /**\n * Specifies if the color write state should be cached\n */\n this._cachedColorWriteState = false;\n /**\n * Specifies if the depth function state should be cached\n */\n this._cachedDepthFunctionState = 0;\n /** @internal */\n this._indexInSceneMaterialArray = -1;\n /** @internal */\n this.meshMap = null;\n /** @internal */\n this._parentContainer = null;\n /** @internal */\n this._uniformBufferLayoutBuilt = false;\n this._eventInfo = {}; // will be initialized before each event notification\n /** @internal */\n this._callbackPluginEventGeneric = () => void 0;\n /** @internal */\n this._callbackPluginEventIsReadyForSubMesh = () => void 0;\n /** @internal */\n this._callbackPluginEventPrepareDefines = () => void 0;\n /** @internal */\n this._callbackPluginEventPrepareDefinesBeforeAttributes = () => void 0;\n /** @internal */\n this._callbackPluginEventHardBindForSubMesh = () => void 0;\n /** @internal */\n this._callbackPluginEventBindForSubMesh = () => void 0;\n /** @internal */\n this._callbackPluginEventHasRenderTargetTextures = () => void 0;\n /** @internal */\n this._callbackPluginEventFillRenderTargetTextures = () => void 0;\n /**\n * Enforces alpha test in opaque or blend mode in order to improve the performances of some situations.\n */\n this._forceAlphaTest = false;\n /**\n * The transparency mode of the material.\n */\n this._transparencyMode = null;\n this.name = name;\n const setScene = scene || EngineStore.LastCreatedScene;\n if (!setScene) {\n return;\n }\n this._scene = setScene;\n this._dirtyCallbacks = {};\n this._dirtyCallbacks[1] = this._markAllSubMeshesAsTexturesDirty.bind(this);\n this._dirtyCallbacks[2] = this._markAllSubMeshesAsLightsDirty.bind(this);\n this._dirtyCallbacks[4] = this._markAllSubMeshesAsFresnelDirty.bind(this);\n this._dirtyCallbacks[8] = this._markAllSubMeshesAsAttributesDirty.bind(this);\n this._dirtyCallbacks[16] = this._markAllSubMeshesAsMiscDirty.bind(this);\n this._dirtyCallbacks[32] = this._markAllSubMeshesAsPrePassDirty.bind(this);\n this._dirtyCallbacks[63] = this._markAllSubMeshesAsAllDirty.bind(this);\n this.id = name || Tools.RandomId();\n this.uniqueId = this._scene.getUniqueId();\n this._materialContext = this._scene.getEngine().createMaterialContext();\n this._drawWrapper = new DrawWrapper(this._scene.getEngine(), false);\n this._drawWrapper.materialContext = this._materialContext;\n if (this._scene.useRightHandedSystem) {\n this.sideOrientation = Material.ClockWiseSideOrientation;\n }\n else {\n this.sideOrientation = Material.CounterClockWiseSideOrientation;\n }\n this._uniformBuffer = new UniformBuffer(this._scene.getEngine(), undefined, undefined, name);\n this._useUBO = this.getScene().getEngine().supportsUniformBuffers;\n if (!doNotAdd) {\n this._scene.addMaterial(this);\n }\n if (this._scene.useMaterialMeshMap) {\n this.meshMap = {};\n }\n Material.OnEventObservable.notifyObservers(this, MaterialPluginEvent.Created);\n }\n /**\n * Returns a string representation of the current material\n * @param fullDetails defines a boolean indicating which levels of logging is desired\n * @returns a string with material information\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n toString(fullDetails) {\n const ret = \"Name: \" + this.name;\n return ret;\n }\n /**\n * Gets the class name of the material\n * @returns a string with the class name of the material\n */\n getClassName() {\n return \"Material\";\n }\n /** @internal */\n get _isMaterial() {\n return true;\n }\n /**\n * Specifies if updates for the material been locked\n */\n get isFrozen() {\n return this.checkReadyOnlyOnce;\n }\n /**\n * Locks updates for the material\n */\n freeze() {\n this.markDirty();\n this.checkReadyOnlyOnce = true;\n }\n /**\n * Unlocks updates for the material\n */\n unfreeze() {\n this.markDirty();\n this.checkReadyOnlyOnce = false;\n }\n /**\n * Specifies if the material is ready to be used\n * @param mesh defines the mesh to check\n * @param useInstances specifies if instances should be used\n * @returns a boolean indicating if the material is ready to be used\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n isReady(mesh, useInstances) {\n return true;\n }\n /**\n * Specifies that the submesh is ready to be used\n * @param mesh defines the mesh to check\n * @param subMesh defines which submesh to check\n * @param useInstances specifies that instances should be used\n * @returns a boolean indicating that the submesh is ready or not\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n isReadyForSubMesh(mesh, subMesh, useInstances) {\n const defines = subMesh.materialDefines;\n if (!defines) {\n return false;\n }\n this._eventInfo.isReadyForSubMesh = true;\n this._eventInfo.defines = defines;\n this._callbackPluginEventIsReadyForSubMesh(this._eventInfo);\n return this._eventInfo.isReadyForSubMesh;\n }\n /**\n * Returns the material effect\n * @returns the effect associated with the material\n */\n getEffect() {\n return this._drawWrapper.effect;\n }\n /**\n * Returns the current scene\n * @returns a Scene\n */\n getScene() {\n return this._scene;\n }\n /**\n * Gets the current transparency mode.\n */\n get transparencyMode() {\n return this._transparencyMode;\n }\n /**\n * Sets the transparency mode of the material.\n *\n * | Value | Type | Description |\n * | ----- | ----------------------------------- | ----------- |\n * | 0 | OPAQUE | |\n * | 1 | ALPHATEST | |\n * | 2 | ALPHABLEND | |\n * | 3 | ALPHATESTANDBLEND | |\n *\n */\n set transparencyMode(value) {\n if (this._transparencyMode === value) {\n return;\n }\n this._transparencyMode = value;\n this._forceAlphaTest = value === Material.MATERIAL_ALPHATESTANDBLEND;\n this._markAllSubMeshesAsTexturesAndMiscDirty();\n }\n /**\n * Returns true if alpha blending should be disabled.\n */\n get _disableAlphaBlending() {\n return this._transparencyMode === Material.MATERIAL_OPAQUE || this._transparencyMode === Material.MATERIAL_ALPHATEST;\n }\n /**\n * Specifies whether or not this material should be rendered in alpha blend mode.\n * @returns a boolean specifying if alpha blending is needed\n */\n needAlphaBlending() {\n if (this._disableAlphaBlending) {\n return false;\n }\n return this.alpha < 1.0;\n }\n /**\n * Specifies if the mesh will require alpha blending\n * @param mesh defines the mesh to check\n * @returns a boolean specifying if alpha blending is needed for the mesh\n */\n needAlphaBlendingForMesh(mesh) {\n if (mesh.visibility < 1.0) {\n return true;\n }\n if (this._disableAlphaBlending) {\n return false;\n }\n return mesh.hasVertexAlpha || this.needAlphaBlending();\n }\n /**\n * Specifies whether or not this material should be rendered in alpha test mode.\n * @returns a boolean specifying if an alpha test is needed.\n */\n needAlphaTesting() {\n if (this._forceAlphaTest) {\n return true;\n }\n return false;\n }\n /**\n * Specifies if material alpha testing should be turned on for the mesh\n * @param mesh defines the mesh to check\n */\n _shouldTurnAlphaTestOn(mesh) {\n return !this.needAlphaBlendingForMesh(mesh) && this.needAlphaTesting();\n }\n /**\n * Gets the texture used for the alpha test\n * @returns the texture to use for alpha testing\n */\n getAlphaTestTexture() {\n return null;\n }\n /**\n * Marks the material to indicate that it needs to be re-calculated\n * @param forceMaterialDirty - Forces the material to be marked as dirty for all components (same as this.markAsDirty(Material.AllDirtyFlag)). You should use this flag if the material is frozen and you want to force a recompilation.\n */\n markDirty(forceMaterialDirty = false) {\n const meshes = this.getScene().meshes;\n for (const mesh of meshes) {\n if (!mesh.subMeshes) {\n continue;\n }\n for (const subMesh of mesh.subMeshes) {\n if (subMesh.getMaterial() !== this) {\n continue;\n }\n if (!subMesh.effect) {\n continue;\n }\n subMesh.effect._wasPreviouslyReady = false;\n subMesh.effect._wasPreviouslyUsingInstances = null;\n subMesh.effect._forceRebindOnNextCall = forceMaterialDirty;\n }\n }\n if (forceMaterialDirty) {\n this.markAsDirty(Material.AllDirtyFlag);\n }\n }\n /**\n * @internal\n */\n _preBind(effect, overrideOrientation = null) {\n const engine = this._scene.getEngine();\n const orientation = overrideOrientation == null ? this.sideOrientation : overrideOrientation;\n const reverse = orientation === Material.ClockWiseSideOrientation;\n engine.enableEffect(effect ? effect : this._getDrawWrapper());\n engine.setState(this.backFaceCulling, this.zOffset, false, reverse, this._scene._mirroredCameraPosition ? !this.cullBackFaces : this.cullBackFaces, this.stencil, this.zOffsetUnits);\n return reverse;\n }\n /**\n * Binds the material to the mesh\n * @param world defines the world transformation matrix\n * @param mesh defines the mesh to bind the material to\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n bind(world, mesh) { }\n /**\n * Initializes the uniform buffer layout for the shader.\n */\n buildUniformLayout() {\n const ubo = this._uniformBuffer;\n this._eventInfo.ubo = ubo;\n this._callbackPluginEventGeneric(MaterialPluginEvent.PrepareUniformBuffer, this._eventInfo);\n ubo.create();\n this._uniformBufferLayoutBuilt = true;\n }\n /**\n * Binds the submesh to the material\n * @param world defines the world transformation matrix\n * @param mesh defines the mesh containing the submesh\n * @param subMesh defines the submesh to bind the material to\n */\n bindForSubMesh(world, mesh, subMesh) {\n const effect = subMesh.effect;\n if (!effect) {\n return;\n }\n this._eventInfo.subMesh = subMesh;\n this._callbackPluginEventBindForSubMesh(this._eventInfo);\n effect._forceRebindOnNextCall = false;\n }\n /**\n * Binds the world matrix to the material\n * @param world defines the world transformation matrix\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n bindOnlyWorldMatrix(world) { }\n /**\n * Binds the view matrix to the effect\n * @param effect defines the effect to bind the view matrix to\n */\n bindView(effect) {\n if (!this._useUBO) {\n effect.setMatrix(\"view\", this.getScene().getViewMatrix());\n }\n else {\n this._needToBindSceneUbo = true;\n }\n }\n /**\n * Binds the view projection and projection matrices to the effect\n * @param effect defines the effect to bind the view projection and projection matrices to\n */\n bindViewProjection(effect) {\n if (!this._useUBO) {\n effect.setMatrix(\"viewProjection\", this.getScene().getTransformMatrix());\n effect.setMatrix(\"projection\", this.getScene().getProjectionMatrix());\n }\n else {\n this._needToBindSceneUbo = true;\n }\n }\n /**\n * Binds the view matrix to the effect\n * @param effect defines the effect to bind the view matrix to\n * @param variableName name of the shader variable that will hold the eye position\n */\n bindEyePosition(effect, variableName) {\n if (!this._useUBO) {\n this._scene.bindEyePosition(effect, variableName);\n }\n else {\n this._needToBindSceneUbo = true;\n }\n }\n /**\n * Processes to execute after binding the material to a mesh\n * @param mesh defines the rendered mesh\n * @param effect\n */\n _afterBind(mesh, effect = null) {\n this._scene._cachedMaterial = this;\n if (this._needToBindSceneUbo) {\n if (effect) {\n this._needToBindSceneUbo = false;\n MaterialHelper.BindSceneUniformBuffer(effect, this.getScene().getSceneUniformBuffer());\n this._scene.finalizeSceneUbo();\n }\n }\n if (mesh) {\n this._scene._cachedVisibility = mesh.visibility;\n }\n else {\n this._scene._cachedVisibility = 1;\n }\n if (this._onBindObservable && mesh) {\n this._onBindObservable.notifyObservers(mesh);\n }\n if (this.disableDepthWrite) {\n const engine = this._scene.getEngine();\n this._cachedDepthWriteState = engine.getDepthWrite();\n engine.setDepthWrite(false);\n }\n if (this.disableColorWrite) {\n const engine = this._scene.getEngine();\n this._cachedColorWriteState = engine.getColorWrite();\n engine.setColorWrite(false);\n }\n if (this.depthFunction !== 0) {\n const engine = this._scene.getEngine();\n this._cachedDepthFunctionState = engine.getDepthFunction() || 0;\n engine.setDepthFunction(this.depthFunction);\n }\n }\n /**\n * Unbinds the material from the mesh\n */\n unbind() {\n if (this._onUnBindObservable) {\n this._onUnBindObservable.notifyObservers(this);\n }\n if (this.depthFunction !== 0) {\n const engine = this._scene.getEngine();\n engine.setDepthFunction(this._cachedDepthFunctionState);\n }\n if (this.disableDepthWrite) {\n const engine = this._scene.getEngine();\n engine.setDepthWrite(this._cachedDepthWriteState);\n }\n if (this.disableColorWrite) {\n const engine = this._scene.getEngine();\n engine.setColorWrite(this._cachedColorWriteState);\n }\n }\n /**\n * Returns the animatable textures.\n * @returns - Array of animatable textures.\n */\n getAnimatables() {\n this._eventInfo.animatables = [];\n this._callbackPluginEventGeneric(MaterialPluginEvent.GetAnimatables, this._eventInfo);\n return this._eventInfo.animatables;\n }\n /**\n * Gets the active textures from the material\n * @returns an array of textures\n */\n getActiveTextures() {\n this._eventInfo.activeTextures = [];\n this._callbackPluginEventGeneric(MaterialPluginEvent.GetActiveTextures, this._eventInfo);\n return this._eventInfo.activeTextures;\n }\n /**\n * Specifies if the material uses a texture\n * @param texture defines the texture to check against the material\n * @returns a boolean specifying if the material uses the texture\n */\n hasTexture(texture) {\n this._eventInfo.hasTexture = false;\n this._eventInfo.texture = texture;\n this._callbackPluginEventGeneric(MaterialPluginEvent.HasTexture, this._eventInfo);\n return this._eventInfo.hasTexture;\n }\n /**\n * Makes a duplicate of the material, and gives it a new name\n * @param name defines the new name for the duplicated material\n * @returns the cloned material\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n clone(name) {\n return null;\n }\n _clonePlugins(targetMaterial, rootUrl) {\n const serializationObject = {};\n // Create plugins in targetMaterial in case they don't exist\n this._serializePlugins(serializationObject);\n Material._parsePlugins(serializationObject, targetMaterial, this._scene, rootUrl);\n // Copy the properties of the current plugins to the cloned material's plugins\n if (this.pluginManager) {\n for (const plugin of this.pluginManager._plugins) {\n const targetPlugin = targetMaterial.pluginManager.getPlugin(plugin.name);\n plugin.copyTo(targetPlugin);\n }\n }\n }\n /**\n * Gets the meshes bound to the material\n * @returns an array of meshes bound to the material\n */\n getBindedMeshes() {\n if (this.meshMap) {\n const result = new Array();\n for (const meshId in this.meshMap) {\n const mesh = this.meshMap[meshId];\n if (mesh) {\n result.push(mesh);\n }\n }\n return result;\n }\n else {\n const meshes = this._scene.meshes;\n return meshes.filter((mesh) => mesh.material === this);\n }\n }\n /**\n * Force shader compilation\n * @param mesh defines the mesh associated with this material\n * @param onCompiled defines a function to execute once the material is compiled\n * @param options defines the options to configure the compilation\n * @param onError defines a function to execute if the material fails compiling\n */\n forceCompilation(mesh, onCompiled, options, onError) {\n const localOptions = Object.assign({ clipPlane: false, useInstances: false }, options);\n const scene = this.getScene();\n const currentHotSwapingState = this.allowShaderHotSwapping;\n this.allowShaderHotSwapping = false; // Turned off to let us evaluate the real compilation state\n const checkReady = () => {\n if (!this._scene || !this._scene.getEngine()) {\n return;\n }\n const clipPlaneState = scene.clipPlane;\n if (localOptions.clipPlane) {\n scene.clipPlane = new Plane(0, 0, 0, 1);\n }\n if (this._storeEffectOnSubMeshes) {\n let allDone = true, lastError = null;\n if (mesh.subMeshes) {\n const tempSubMesh = new SubMesh(0, 0, 0, 0, 0, mesh, undefined, false, false);\n if (tempSubMesh.materialDefines) {\n tempSubMesh.materialDefines._renderId = -1;\n }\n if (!this.isReadyForSubMesh(mesh, tempSubMesh, localOptions.useInstances)) {\n if (tempSubMesh.effect && tempSubMesh.effect.getCompilationError() && tempSubMesh.effect.allFallbacksProcessed()) {\n lastError = tempSubMesh.effect.getCompilationError();\n }\n else {\n allDone = false;\n setTimeout(checkReady, 16);\n }\n }\n }\n if (allDone) {\n this.allowShaderHotSwapping = currentHotSwapingState;\n if (lastError) {\n if (onError) {\n onError(lastError);\n }\n }\n if (onCompiled) {\n onCompiled(this);\n }\n }\n }\n else {\n if (this.isReady()) {\n this.allowShaderHotSwapping = currentHotSwapingState;\n if (onCompiled) {\n onCompiled(this);\n }\n }\n else {\n setTimeout(checkReady, 16);\n }\n }\n if (localOptions.clipPlane) {\n scene.clipPlane = clipPlaneState;\n }\n };\n checkReady();\n }\n /**\n * Force shader compilation\n * @param mesh defines the mesh that will use this material\n * @param options defines additional options for compiling the shaders\n * @returns a promise that resolves when the compilation completes\n */\n forceCompilationAsync(mesh, options) {\n return new Promise((resolve, reject) => {\n this.forceCompilation(mesh, () => {\n resolve();\n }, options, (reason) => {\n reject(reason);\n });\n });\n }\n /**\n * Marks a define in the material to indicate that it needs to be re-computed\n * @param flag defines a flag used to determine which parts of the material have to be marked as dirty\n */\n markAsDirty(flag) {\n if (this.getScene().blockMaterialDirtyMechanism || this._blockDirtyMechanism) {\n return;\n }\n Material._DirtyCallbackArray.length = 0;\n if (flag & Material.TextureDirtyFlag) {\n Material._DirtyCallbackArray.push(Material._TextureDirtyCallBack);\n }\n if (flag & Material.LightDirtyFlag) {\n Material._DirtyCallbackArray.push(Material._LightsDirtyCallBack);\n }\n if (flag & Material.FresnelDirtyFlag) {\n Material._DirtyCallbackArray.push(Material._FresnelDirtyCallBack);\n }\n if (flag & Material.AttributesDirtyFlag) {\n Material._DirtyCallbackArray.push(Material._AttributeDirtyCallBack);\n }\n if (flag & Material.MiscDirtyFlag) {\n Material._DirtyCallbackArray.push(Material._MiscDirtyCallBack);\n }\n if (flag & Material.PrePassDirtyFlag) {\n Material._DirtyCallbackArray.push(Material._PrePassDirtyCallBack);\n }\n if (Material._DirtyCallbackArray.length) {\n this._markAllSubMeshesAsDirty(Material._RunDirtyCallBacks);\n }\n this.getScene().resetCachedMaterial();\n }\n /**\n * Resets the draw wrappers cache for all submeshes that are using this material\n */\n resetDrawCache() {\n const meshes = this.getScene().meshes;\n for (const mesh of meshes) {\n if (!mesh.subMeshes) {\n continue;\n }\n for (const subMesh of mesh.subMeshes) {\n if (subMesh.getMaterial() !== this) {\n continue;\n }\n subMesh.resetDrawCache();\n }\n }\n }\n /**\n * Marks all submeshes of a material to indicate that their material defines need to be re-calculated\n * @param func defines a function which checks material defines against the submeshes\n */\n _markAllSubMeshesAsDirty(func) {\n if (this.getScene().blockMaterialDirtyMechanism || this._blockDirtyMechanism) {\n return;\n }\n const meshes = this.getScene().meshes;\n for (const mesh of meshes) {\n if (!mesh.subMeshes) {\n continue;\n }\n for (const subMesh of mesh.subMeshes) {\n // We want to skip the submeshes which are not using this material or which have not yet rendered at least once\n if (subMesh.getMaterial(false) !== this) {\n continue;\n }\n for (const drawWrapper of subMesh._drawWrappers) {\n if (!drawWrapper || !drawWrapper.defines || !drawWrapper.defines.markAllAsDirty) {\n continue;\n }\n if (this._materialContext === drawWrapper.materialContext) {\n func(drawWrapper.defines);\n }\n }\n }\n }\n }\n /**\n * Indicates that the scene should check if the rendering now needs a prepass\n */\n _markScenePrePassDirty() {\n if (this.getScene().blockMaterialDirtyMechanism || this._blockDirtyMechanism) {\n return;\n }\n const prePassRenderer = this.getScene().enablePrePassRenderer();\n if (prePassRenderer) {\n prePassRenderer.markAsDirty();\n }\n }\n /**\n * Indicates that we need to re-calculated for all submeshes\n */\n _markAllSubMeshesAsAllDirty() {\n this._markAllSubMeshesAsDirty(Material._AllDirtyCallBack);\n }\n /**\n * Indicates that image processing needs to be re-calculated for all submeshes\n */\n _markAllSubMeshesAsImageProcessingDirty() {\n this._markAllSubMeshesAsDirty(Material._ImageProcessingDirtyCallBack);\n }\n /**\n * Indicates that textures need to be re-calculated for all submeshes\n */\n _markAllSubMeshesAsTexturesDirty() {\n this._markAllSubMeshesAsDirty(Material._TextureDirtyCallBack);\n }\n /**\n * Indicates that fresnel needs to be re-calculated for all submeshes\n */\n _markAllSubMeshesAsFresnelDirty() {\n this._markAllSubMeshesAsDirty(Material._FresnelDirtyCallBack);\n }\n /**\n * Indicates that fresnel and misc need to be re-calculated for all submeshes\n */\n _markAllSubMeshesAsFresnelAndMiscDirty() {\n this._markAllSubMeshesAsDirty(Material._FresnelAndMiscDirtyCallBack);\n }\n /**\n * Indicates that lights need to be re-calculated for all submeshes\n */\n _markAllSubMeshesAsLightsDirty() {\n this._markAllSubMeshesAsDirty(Material._LightsDirtyCallBack);\n }\n /**\n * Indicates that attributes need to be re-calculated for all submeshes\n */\n _markAllSubMeshesAsAttributesDirty() {\n this._markAllSubMeshesAsDirty(Material._AttributeDirtyCallBack);\n }\n /**\n * Indicates that misc needs to be re-calculated for all submeshes\n */\n _markAllSubMeshesAsMiscDirty() {\n this._markAllSubMeshesAsDirty(Material._MiscDirtyCallBack);\n }\n /**\n * Indicates that prepass needs to be re-calculated for all submeshes\n */\n _markAllSubMeshesAsPrePassDirty() {\n this._markAllSubMeshesAsDirty(Material._MiscDirtyCallBack);\n }\n /**\n * Indicates that textures and misc need to be re-calculated for all submeshes\n */\n _markAllSubMeshesAsTexturesAndMiscDirty() {\n this._markAllSubMeshesAsDirty(Material._TextureAndMiscDirtyCallBack);\n }\n _checkScenePerformancePriority() {\n if (this._scene.performancePriority !== ScenePerformancePriority.BackwardCompatible) {\n this.checkReadyOnlyOnce = true;\n // re-set the flag when the perf priority changes\n const observer = this._scene.onScenePerformancePriorityChangedObservable.addOnce(() => {\n this.checkReadyOnlyOnce = false;\n });\n // if this material is disposed before the scene is disposed, cleanup the observer\n this.onDisposeObservable.add(() => {\n this._scene.onScenePerformancePriorityChangedObservable.remove(observer);\n });\n }\n }\n /**\n * Sets the required values to the prepass renderer.\n * @param prePassRenderer defines the prepass renderer to setup.\n * @returns true if the pre pass is needed.\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n setPrePassRenderer(prePassRenderer) {\n // Do Nothing by default\n return false;\n }\n /**\n * Disposes the material\n * @param forceDisposeEffect specifies if effects should be forcefully disposed\n * @param forceDisposeTextures specifies if textures should be forcefully disposed\n * @param notBoundToMesh specifies if the material that is being disposed is known to be not bound to any mesh\n */\n dispose(forceDisposeEffect, forceDisposeTextures, notBoundToMesh) {\n const scene = this.getScene();\n // Animations\n scene.stopAnimation(this);\n scene.freeProcessedMaterials();\n // Remove from scene\n scene.removeMaterial(this);\n this._eventInfo.forceDisposeTextures = forceDisposeTextures;\n this._callbackPluginEventGeneric(MaterialPluginEvent.Disposed, this._eventInfo);\n if (this._parentContainer) {\n const index = this._parentContainer.materials.indexOf(this);\n if (index > -1) {\n this._parentContainer.materials.splice(index, 1);\n }\n this._parentContainer = null;\n }\n if (notBoundToMesh !== true) {\n // Remove from meshes\n if (this.meshMap) {\n for (const meshId in this.meshMap) {\n const mesh = this.meshMap[meshId];\n if (mesh) {\n mesh.material = null; // will set the entry in the map to undefined\n this.releaseVertexArrayObject(mesh, forceDisposeEffect);\n }\n }\n }\n else {\n const meshes = scene.meshes;\n for (const mesh of meshes) {\n if (mesh.material === this && !mesh.sourceMesh) {\n mesh.material = null;\n this.releaseVertexArrayObject(mesh, forceDisposeEffect);\n }\n }\n }\n }\n this._uniformBuffer.dispose();\n // Shader are kept in cache for further use but we can get rid of this by using forceDisposeEffect\n if (forceDisposeEffect && this._drawWrapper.effect) {\n if (!this._storeEffectOnSubMeshes) {\n this._drawWrapper.effect.dispose();\n }\n this._drawWrapper.effect = null;\n }\n this.metadata = null;\n // Callback\n this.onDisposeObservable.notifyObservers(this);\n this.onDisposeObservable.clear();\n if (this._onBindObservable) {\n this._onBindObservable.clear();\n }\n if (this._onUnBindObservable) {\n this._onUnBindObservable.clear();\n }\n if (this._onEffectCreatedObservable) {\n this._onEffectCreatedObservable.clear();\n }\n if (this._eventInfo) {\n this._eventInfo = {};\n }\n }\n /**\n * @internal\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n releaseVertexArrayObject(mesh, forceDisposeEffect) {\n if (mesh.geometry) {\n const geometry = mesh.geometry;\n if (this._storeEffectOnSubMeshes) {\n for (const subMesh of mesh.subMeshes) {\n geometry._releaseVertexArrayObject(subMesh.effect);\n if (forceDisposeEffect && subMesh.effect) {\n subMesh.effect.dispose();\n }\n }\n }\n else {\n geometry._releaseVertexArrayObject(this._drawWrapper.effect);\n }\n }\n }\n /**\n * Serializes this material\n * @returns the serialized material object\n */\n serialize() {\n const serializationObject = SerializationHelper.Serialize(this);\n serializationObject.stencil = this.stencil.serialize();\n serializationObject.uniqueId = this.uniqueId;\n this._serializePlugins(serializationObject);\n return serializationObject;\n }\n _serializePlugins(serializationObject) {\n serializationObject.plugins = {};\n if (this.pluginManager) {\n for (const plugin of this.pluginManager._plugins) {\n serializationObject.plugins[plugin.getClassName()] = plugin.serialize();\n }\n }\n }\n /**\n * Creates a material from parsed material data\n * @param parsedMaterial defines parsed material data\n * @param scene defines the hosting scene\n * @param rootUrl defines the root URL to use to load textures\n * @returns a new material\n */\n static Parse(parsedMaterial, scene, rootUrl) {\n if (!parsedMaterial.customType) {\n parsedMaterial.customType = \"BABYLON.StandardMaterial\";\n }\n else if (parsedMaterial.customType === \"BABYLON.PBRMaterial\" && parsedMaterial.overloadedAlbedo) {\n parsedMaterial.customType = \"BABYLON.LegacyPBRMaterial\";\n if (!BABYLON.LegacyPBRMaterial) {\n Logger.Error(\"Your scene is trying to load a legacy version of the PBRMaterial, please, include it from the materials library.\");\n return null;\n }\n }\n const materialType = Tools.Instantiate(parsedMaterial.customType);\n const material = materialType.Parse(parsedMaterial, scene, rootUrl);\n material._loadedUniqueId = parsedMaterial.uniqueId;\n return material;\n }\n static _parsePlugins(serializationObject, material, scene, rootUrl) {\n var _a;\n if (!serializationObject.plugins) {\n return;\n }\n for (const pluginClassName in serializationObject.plugins) {\n const pluginData = serializationObject.plugins[pluginClassName];\n let plugin = (_a = material.pluginManager) === null || _a === void 0 ? void 0 : _a.getPlugin(pluginData.name);\n if (!plugin) {\n const pluginClassType = Tools.Instantiate(\"BABYLON.\" + pluginClassName);\n if (pluginClassType) {\n plugin = new pluginClassType(material);\n }\n }\n plugin === null || plugin === void 0 ? void 0 : plugin.parse(pluginData, scene, rootUrl);\n }\n }\n}\n/**\n * Returns the triangle fill mode\n */\nMaterial.TriangleFillMode = 0;\n/**\n * Returns the wireframe mode\n */\nMaterial.WireFrameFillMode = 1;\n/**\n * Returns the point fill mode\n */\nMaterial.PointFillMode = 2;\n/**\n * Returns the point list draw mode\n */\nMaterial.PointListDrawMode = 3;\n/**\n * Returns the line list draw mode\n */\nMaterial.LineListDrawMode = 4;\n/**\n * Returns the line loop draw mode\n */\nMaterial.LineLoopDrawMode = 5;\n/**\n * Returns the line strip draw mode\n */\nMaterial.LineStripDrawMode = 6;\n/**\n * Returns the triangle strip draw mode\n */\nMaterial.TriangleStripDrawMode = 7;\n/**\n * Returns the triangle fan draw mode\n */\nMaterial.TriangleFanDrawMode = 8;\n/**\n * Stores the clock-wise side orientation\n */\nMaterial.ClockWiseSideOrientation = 0;\n/**\n * Stores the counter clock-wise side orientation\n */\nMaterial.CounterClockWiseSideOrientation = 1;\n/**\n * The dirty texture flag value\n */\nMaterial.TextureDirtyFlag = 1;\n/**\n * The dirty light flag value\n */\nMaterial.LightDirtyFlag = 2;\n/**\n * The dirty fresnel flag value\n */\nMaterial.FresnelDirtyFlag = 4;\n/**\n * The dirty attribute flag value\n */\nMaterial.AttributesDirtyFlag = 8;\n/**\n * The dirty misc flag value\n */\nMaterial.MiscDirtyFlag = 16;\n/**\n * The dirty prepass flag value\n */\nMaterial.PrePassDirtyFlag = 32;\n/**\n * The all dirty flag value\n */\nMaterial.AllDirtyFlag = 63;\n/**\n * MaterialTransparencyMode: No transparency mode, Alpha channel is not use.\n */\nMaterial.MATERIAL_OPAQUE = 0;\n/**\n * MaterialTransparencyMode: Alpha Test mode, pixel are discarded below a certain threshold defined by the alpha cutoff value.\n */\nMaterial.MATERIAL_ALPHATEST = 1;\n/**\n * MaterialTransparencyMode: Pixels are blended (according to the alpha mode) with the already drawn pixels in the current frame buffer.\n */\nMaterial.MATERIAL_ALPHABLEND = 2;\n/**\n * MaterialTransparencyMode: Pixels are blended (according to the alpha mode) with the already drawn pixels in the current frame buffer.\n * They are also discarded below the alpha cutoff threshold to improve performances.\n */\nMaterial.MATERIAL_ALPHATESTANDBLEND = 3;\n/**\n * The Whiteout method is used to blend normals.\n * Details of the algorithm can be found here: https://blog.selfshadow.com/publications/blending-in-detail/\n */\nMaterial.MATERIAL_NORMALBLENDMETHOD_WHITEOUT = 0;\n/**\n * The Reoriented Normal Mapping method is used to blend normals.\n * Details of the algorithm can be found here: https://blog.selfshadow.com/publications/blending-in-detail/\n */\nMaterial.MATERIAL_NORMALBLENDMETHOD_RNM = 1;\n/**\n * Event observable which raises global events common to all materials (like MaterialPluginEvent.Created)\n */\nMaterial.OnEventObservable = new Observable();\nMaterial._AllDirtyCallBack = (defines) => defines.markAllAsDirty();\nMaterial._ImageProcessingDirtyCallBack = (defines) => defines.markAsImageProcessingDirty();\nMaterial._TextureDirtyCallBack = (defines) => defines.markAsTexturesDirty();\nMaterial._FresnelDirtyCallBack = (defines) => defines.markAsFresnelDirty();\nMaterial._MiscDirtyCallBack = (defines) => defines.markAsMiscDirty();\nMaterial._PrePassDirtyCallBack = (defines) => defines.markAsPrePassDirty();\nMaterial._LightsDirtyCallBack = (defines) => defines.markAsLightDirty();\nMaterial._AttributeDirtyCallBack = (defines) => defines.markAsAttributesDirty();\nMaterial._FresnelAndMiscDirtyCallBack = (defines) => {\n Material._FresnelDirtyCallBack(defines);\n Material._MiscDirtyCallBack(defines);\n};\nMaterial._TextureAndMiscDirtyCallBack = (defines) => {\n Material._TextureDirtyCallBack(defines);\n Material._MiscDirtyCallBack(defines);\n};\nMaterial._DirtyCallbackArray = [];\nMaterial._RunDirtyCallBacks = (defines) => {\n for (const cb of Material._DirtyCallbackArray) {\n cb(defines);\n }\n};\n__decorate([\n serialize()\n], Material.prototype, \"id\", void 0);\n__decorate([\n serialize()\n], Material.prototype, \"uniqueId\", void 0);\n__decorate([\n serialize()\n], Material.prototype, \"name\", void 0);\n__decorate([\n serialize()\n], Material.prototype, \"metadata\", void 0);\n__decorate([\n serialize()\n], Material.prototype, \"checkReadyOnEveryCall\", void 0);\n__decorate([\n serialize()\n], Material.prototype, \"checkReadyOnlyOnce\", void 0);\n__decorate([\n serialize()\n], Material.prototype, \"state\", void 0);\n__decorate([\n serialize(\"alpha\")\n], Material.prototype, \"_alpha\", void 0);\n__decorate([\n serialize(\"backFaceCulling\")\n], Material.prototype, \"_backFaceCulling\", void 0);\n__decorate([\n serialize(\"cullBackFaces\")\n], Material.prototype, \"_cullBackFaces\", void 0);\n__decorate([\n serialize()\n], Material.prototype, \"sideOrientation\", void 0);\n__decorate([\n serialize(\"alphaMode\")\n], Material.prototype, \"_alphaMode\", void 0);\n__decorate([\n serialize()\n], Material.prototype, \"_needDepthPrePass\", void 0);\n__decorate([\n serialize()\n], Material.prototype, \"disableDepthWrite\", void 0);\n__decorate([\n serialize()\n], Material.prototype, \"disableColorWrite\", void 0);\n__decorate([\n serialize()\n], Material.prototype, \"forceDepthWrite\", void 0);\n__decorate([\n serialize()\n], Material.prototype, \"depthFunction\", void 0);\n__decorate([\n serialize()\n], Material.prototype, \"separateCullingPass\", void 0);\n__decorate([\n serialize(\"fogEnabled\")\n], Material.prototype, \"_fogEnabled\", void 0);\n__decorate([\n serialize()\n], Material.prototype, \"pointSize\", void 0);\n__decorate([\n serialize()\n], Material.prototype, \"zOffset\", void 0);\n__decorate([\n serialize()\n], Material.prototype, \"zOffsetUnits\", void 0);\n__decorate([\n serialize()\n], Material.prototype, \"pointsCloud\", null);\n__decorate([\n serialize()\n], Material.prototype, \"fillMode\", null);\n__decorate([\n serialize()\n], Material.prototype, \"transparencyMode\", null);\n//# sourceMappingURL=material.js.map","import { Material } from \"../Materials/material.js\";\nimport { Tags } from \"../Misc/tags.js\";\nimport { RegisterClass } from \"../Misc/typeStore.js\";\n/**\n * A multi-material is used to apply different materials to different parts of the same object without the need of\n * separate meshes. This can be use to improve performances.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/multiMaterials\n */\nexport class MultiMaterial extends Material {\n /**\n * Gets or Sets the list of Materials used within the multi material.\n * They need to be ordered according to the submeshes order in the associated mesh\n */\n get subMaterials() {\n return this._subMaterials;\n }\n set subMaterials(value) {\n this._subMaterials = value;\n this._hookArray(value);\n }\n /**\n * Function used to align with Node.getChildren()\n * @returns the list of Materials used within the multi material\n */\n getChildren() {\n return this.subMaterials;\n }\n /**\n * Instantiates a new Multi Material\n * A multi-material is used to apply different materials to different parts of the same object without the need of\n * separate meshes. This can be use to improve performances.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/multiMaterials\n * @param name Define the name in the scene\n * @param scene Define the scene the material belongs to\n */\n constructor(name, scene) {\n super(name, scene, true);\n /** @internal */\n this._waitingSubMaterialsUniqueIds = [];\n this.getScene().addMultiMaterial(this);\n this.subMaterials = new Array();\n this._storeEffectOnSubMeshes = true; // multimaterial is considered like a push material\n }\n _hookArray(array) {\n const oldPush = array.push;\n array.push = (...items) => {\n const result = oldPush.apply(array, items);\n this._markAllSubMeshesAsTexturesDirty();\n return result;\n };\n const oldSplice = array.splice;\n array.splice = (index, deleteCount) => {\n const deleted = oldSplice.apply(array, [index, deleteCount]);\n this._markAllSubMeshesAsTexturesDirty();\n return deleted;\n };\n }\n /**\n * Get one of the submaterial by its index in the submaterials array\n * @param index The index to look the sub material at\n * @returns The Material if the index has been defined\n */\n getSubMaterial(index) {\n if (index < 0 || index >= this.subMaterials.length) {\n return this.getScene().defaultMaterial;\n }\n return this.subMaterials[index];\n }\n /**\n * Get the list of active textures for the whole sub materials list.\n * @returns All the textures that will be used during the rendering\n */\n getActiveTextures() {\n return super.getActiveTextures().concat(...this.subMaterials.map((subMaterial) => {\n if (subMaterial) {\n return subMaterial.getActiveTextures();\n }\n else {\n return [];\n }\n }));\n }\n /**\n * Specifies if any sub-materials of this multi-material use a given texture.\n * @param texture Defines the texture to check against this multi-material's sub-materials.\n * @returns A boolean specifying if any sub-material of this multi-material uses the texture.\n */\n hasTexture(texture) {\n var _a;\n if (super.hasTexture(texture)) {\n return true;\n }\n for (let i = 0; i < this.subMaterials.length; i++) {\n if ((_a = this.subMaterials[i]) === null || _a === void 0 ? void 0 : _a.hasTexture(texture)) {\n return true;\n }\n }\n return false;\n }\n /**\n * Gets the current class name of the material e.g. \"MultiMaterial\"\n * Mainly use in serialization.\n * @returns the class name\n */\n getClassName() {\n return \"MultiMaterial\";\n }\n /**\n * Checks if the material is ready to render the requested sub mesh\n * @param mesh Define the mesh the submesh belongs to\n * @param subMesh Define the sub mesh to look readiness for\n * @param useInstances Define whether or not the material is used with instances\n * @returns true if ready, otherwise false\n */\n isReadyForSubMesh(mesh, subMesh, useInstances) {\n for (let index = 0; index < this.subMaterials.length; index++) {\n const subMaterial = this.subMaterials[index];\n if (subMaterial) {\n if (subMaterial._storeEffectOnSubMeshes) {\n if (!subMaterial.isReadyForSubMesh(mesh, subMesh, useInstances)) {\n return false;\n }\n continue;\n }\n if (!subMaterial.isReady(mesh)) {\n return false;\n }\n }\n }\n return true;\n }\n /**\n * Clones the current material and its related sub materials\n * @param name Define the name of the newly cloned material\n * @param cloneChildren Define if submaterial will be cloned or shared with the parent instance\n * @returns the cloned material\n */\n clone(name, cloneChildren) {\n const newMultiMaterial = new MultiMaterial(name, this.getScene());\n for (let index = 0; index < this.subMaterials.length; index++) {\n let subMaterial = null;\n const current = this.subMaterials[index];\n if (cloneChildren && current) {\n subMaterial = current.clone(name + \"-\" + current.name);\n }\n else {\n subMaterial = this.subMaterials[index];\n }\n newMultiMaterial.subMaterials.push(subMaterial);\n }\n return newMultiMaterial;\n }\n /**\n * Serializes the materials into a JSON representation.\n * @returns the JSON representation\n */\n serialize() {\n const serializationObject = {};\n serializationObject.name = this.name;\n serializationObject.id = this.id;\n serializationObject.uniqueId = this.uniqueId;\n if (Tags) {\n serializationObject.tags = Tags.GetTags(this);\n }\n serializationObject.materialsUniqueIds = [];\n serializationObject.materials = [];\n for (let matIndex = 0; matIndex < this.subMaterials.length; matIndex++) {\n const subMat = this.subMaterials[matIndex];\n if (subMat) {\n serializationObject.materialsUniqueIds.push(subMat.uniqueId);\n serializationObject.materials.push(subMat.id);\n }\n else {\n serializationObject.materialsUniqueIds.push(null);\n serializationObject.materials.push(null);\n }\n }\n return serializationObject;\n }\n /**\n * Dispose the material and release its associated resources\n * @param forceDisposeEffect Define if we want to force disposing the associated effect (if false the shader is not released and could be reuse later on)\n * @param forceDisposeTextures Define if we want to force disposing the associated textures (if false, they will not be disposed and can still be use elsewhere in the app)\n * @param forceDisposeChildren Define if we want to force disposing the associated submaterials (if false, they will not be disposed and can still be use elsewhere in the app)\n */\n dispose(forceDisposeEffect, forceDisposeTextures, forceDisposeChildren) {\n const scene = this.getScene();\n if (!scene) {\n return;\n }\n if (forceDisposeChildren) {\n for (let index = 0; index < this.subMaterials.length; index++) {\n const subMaterial = this.subMaterials[index];\n if (subMaterial) {\n subMaterial.dispose(forceDisposeEffect, forceDisposeTextures);\n }\n }\n }\n const index = scene.multiMaterials.indexOf(this);\n if (index >= 0) {\n scene.multiMaterials.splice(index, 1);\n }\n super.dispose(forceDisposeEffect, forceDisposeTextures);\n }\n /**\n * Creates a MultiMaterial from parsed MultiMaterial data.\n * @param parsedMultiMaterial defines parsed MultiMaterial data.\n * @param scene defines the hosting scene\n * @returns a new MultiMaterial\n */\n static ParseMultiMaterial(parsedMultiMaterial, scene) {\n const multiMaterial = new MultiMaterial(parsedMultiMaterial.name, scene);\n multiMaterial.id = parsedMultiMaterial.id;\n multiMaterial._loadedUniqueId = parsedMultiMaterial.uniqueId;\n if (Tags) {\n Tags.AddTagsTo(multiMaterial, parsedMultiMaterial.tags);\n }\n if (parsedMultiMaterial.materialsUniqueIds) {\n multiMaterial._waitingSubMaterialsUniqueIds = parsedMultiMaterial.materialsUniqueIds;\n }\n else {\n parsedMultiMaterial.materials.forEach((subMatId) => multiMaterial.subMaterials.push(scene.getLastMaterialById(subMatId)));\n }\n return multiMaterial;\n }\n}\nRegisterClass(\"BABYLON.MultiMaterial\", MultiMaterial);\n//# sourceMappingURL=multiMaterial.js.map","/**\n * Class used to represent a specific level of detail of a mesh\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/LOD\n */\nexport class MeshLODLevel {\n /**\n * Creates a new LOD level\n * @param distanceOrScreenCoverage defines either the distance or the screen coverage where this level should start being displayed\n * @param mesh defines the mesh to use to render this level\n */\n constructor(\n /** Either distance from the center of the object to show this level or the screen coverage if `useLODScreenCoverage` is set to `true` on the mesh*/\n distanceOrScreenCoverage, \n /** Defines the mesh to use to render this level */\n mesh) {\n this.distanceOrScreenCoverage = distanceOrScreenCoverage;\n this.mesh = mesh;\n }\n}\n//# sourceMappingURL=meshLODLevel.js.map","import { Observable } from \"../Misc/observable.js\";\nimport { Tools, AsyncLoop } from \"../Misc/tools.js\";\nimport { DeepCopier } from \"../Misc/deepCopier.js\";\nimport { Tags } from \"../Misc/tags.js\";\nimport { runCoroutineSync, runCoroutineAsync, createYieldingScheduler } from \"../Misc/coroutine.js\";\nimport { Camera } from \"../Cameras/camera.js\";\nimport { ScenePerformancePriority } from \"../scene.js\";\nimport { Quaternion, Matrix, Vector3, Vector2 } from \"../Maths/math.vector.js\";\nimport { Color3 } from \"../Maths/math.color.js\";\nimport { Node } from \"../node.js\";\nimport { VertexBuffer, Buffer } from \"../Buffers/buffer.js\";\nimport { VertexData } from \"./mesh.vertexData.js\";\nimport { Geometry } from \"./geometry.js\";\nimport { AbstractMesh } from \"./abstractMesh.js\";\nimport { SubMesh } from \"./subMesh.js\";\nimport { Material } from \"../Materials/material.js\";\nimport { MultiMaterial } from \"../Materials/multiMaterial.js\";\nimport { SceneLoaderFlags } from \"../Loading/sceneLoaderFlags.js\";\n\nimport { SerializationHelper } from \"../Misc/decorators.js\";\nimport { Logger } from \"../Misc/logger.js\";\nimport { GetClass, RegisterClass } from \"../Misc/typeStore.js\";\nimport { _WarnImport } from \"../Misc/devTools.js\";\nimport { SceneComponentConstants } from \"../sceneComponent.js\";\nimport { MeshLODLevel } from \"./meshLODLevel.js\";\n/**\n * @internal\n **/\nexport class _CreationDataStorage {\n}\n/**\n * @internal\n **/\nclass _InstanceDataStorage {\n constructor() {\n this.visibleInstances = {};\n this.batchCache = new _InstancesBatch();\n this.batchCacheReplacementModeInFrozenMode = new _InstancesBatch();\n this.instancesBufferSize = 32 * 16 * 4; // let's start with a maximum of 32 instances\n }\n}\n/**\n * @internal\n **/\nexport class _InstancesBatch {\n constructor() {\n this.mustReturn = false;\n this.visibleInstances = new Array();\n this.renderSelf = new Array();\n this.hardwareInstancedRendering = new Array();\n }\n}\n/**\n * @internal\n **/\nclass _ThinInstanceDataStorage {\n constructor() {\n this.instancesCount = 0;\n this.matrixBuffer = null;\n this.previousMatrixBuffer = null;\n this.matrixBufferSize = 32 * 16; // let's start with a maximum of 32 thin instances\n this.matrixData = null;\n this.boundingVectors = [];\n this.worldMatrices = null;\n }\n}\n/**\n * @internal\n **/\nclass _InternalMeshDataInfo {\n constructor() {\n this._areNormalsFrozen = false; // Will be used by ribbons mainly\n // Will be used to save a source mesh reference, If any\n this._source = null;\n // Will be used to for fast cloned mesh lookup\n this.meshMap = null;\n this._preActivateId = -1;\n // eslint-disable-next-line @typescript-eslint/naming-convention\n this._LODLevels = new Array();\n /** Alternative definition of LOD level, using screen coverage instead of distance */\n this._useLODScreenCoverage = false;\n this._effectiveMaterial = null;\n this._forcedInstanceCount = 0;\n this._overrideRenderingFillMode = null;\n }\n}\n/**\n * Class used to represent renderable models\n */\nexport class Mesh extends AbstractMesh {\n /**\n * Gets the default side orientation.\n * @param orientation the orientation to value to attempt to get\n * @returns the default orientation\n * @internal\n */\n static _GetDefaultSideOrientation(orientation) {\n return orientation || Mesh.FRONTSIDE; // works as Mesh.FRONTSIDE is 0\n }\n /**\n * Determines if the LOD levels are intended to be calculated using screen coverage (surface area ratio) instead of distance.\n */\n get useLODScreenCoverage() {\n return this._internalMeshDataInfo._useLODScreenCoverage;\n }\n set useLODScreenCoverage(value) {\n this._internalMeshDataInfo._useLODScreenCoverage = value;\n this._sortLODLevels();\n }\n get computeBonesUsingShaders() {\n return this._internalAbstractMeshDataInfo._computeBonesUsingShaders;\n }\n set computeBonesUsingShaders(value) {\n if (this._internalAbstractMeshDataInfo._computeBonesUsingShaders === value) {\n return;\n }\n if (value && this._internalMeshDataInfo._sourcePositions) {\n // switch from software to GPU computation: we need to reset the vertex and normal buffers that have been updated by the software process\n this.setVerticesData(VertexBuffer.PositionKind, this._internalMeshDataInfo._sourcePositions, true);\n if (this._internalMeshDataInfo._sourceNormals) {\n this.setVerticesData(VertexBuffer.NormalKind, this._internalMeshDataInfo._sourceNormals, true);\n }\n this._internalMeshDataInfo._sourcePositions = null;\n this._internalMeshDataInfo._sourceNormals = null;\n }\n this._internalAbstractMeshDataInfo._computeBonesUsingShaders = value;\n this._markSubMeshesAsAttributesDirty();\n }\n /**\n * An event triggered before rendering the mesh\n */\n get onBeforeRenderObservable() {\n if (!this._internalMeshDataInfo._onBeforeRenderObservable) {\n this._internalMeshDataInfo._onBeforeRenderObservable = new Observable();\n }\n return this._internalMeshDataInfo._onBeforeRenderObservable;\n }\n /**\n * An event triggered before binding the mesh\n */\n get onBeforeBindObservable() {\n if (!this._internalMeshDataInfo._onBeforeBindObservable) {\n this._internalMeshDataInfo._onBeforeBindObservable = new Observable();\n }\n return this._internalMeshDataInfo._onBeforeBindObservable;\n }\n /**\n * An event triggered after rendering the mesh\n */\n get onAfterRenderObservable() {\n if (!this._internalMeshDataInfo._onAfterRenderObservable) {\n this._internalMeshDataInfo._onAfterRenderObservable = new Observable();\n }\n return this._internalMeshDataInfo._onAfterRenderObservable;\n }\n /**\n * An event triggeredbetween rendering pass when using separateCullingPass = true\n */\n get onBetweenPassObservable() {\n if (!this._internalMeshDataInfo._onBetweenPassObservable) {\n this._internalMeshDataInfo._onBetweenPassObservable = new Observable();\n }\n return this._internalMeshDataInfo._onBetweenPassObservable;\n }\n /**\n * An event triggered before drawing the mesh\n */\n get onBeforeDrawObservable() {\n if (!this._internalMeshDataInfo._onBeforeDrawObservable) {\n this._internalMeshDataInfo._onBeforeDrawObservable = new Observable();\n }\n return this._internalMeshDataInfo._onBeforeDrawObservable;\n }\n /**\n * Sets a callback to call before drawing the mesh. It is recommended to use onBeforeDrawObservable instead\n */\n set onBeforeDraw(callback) {\n if (this._onBeforeDrawObserver) {\n this.onBeforeDrawObservable.remove(this._onBeforeDrawObserver);\n }\n this._onBeforeDrawObserver = this.onBeforeDrawObservable.add(callback);\n }\n get hasInstances() {\n return this.instances.length > 0;\n }\n get hasThinInstances() {\n var _a;\n return ((_a = this._thinInstanceDataStorage.instancesCount) !== null && _a !== void 0 ? _a : 0) > 0;\n }\n /**\n * Gets or sets the forced number of instances to display.\n * If 0 (default value), the number of instances is not forced and depends on the draw type\n * (regular / instance / thin instances mesh)\n */\n get forcedInstanceCount() {\n return this._internalMeshDataInfo._forcedInstanceCount;\n }\n set forcedInstanceCount(count) {\n this._internalMeshDataInfo._forcedInstanceCount = count;\n }\n /**\n * Use this property to override the Material's fillMode value\n */\n get overrideRenderingFillMode() {\n return this._internalMeshDataInfo._overrideRenderingFillMode;\n }\n set overrideRenderingFillMode(fillMode) {\n this._internalMeshDataInfo._overrideRenderingFillMode = fillMode;\n }\n /**\n * Gets the source mesh (the one used to clone this one from)\n */\n get source() {\n return this._internalMeshDataInfo._source;\n }\n /**\n * Gets the list of clones of this mesh\n * The scene must have been constructed with useClonedMeshMap=true for this to work!\n * Note that useClonedMeshMap=true is the default setting\n */\n get cloneMeshMap() {\n return this._internalMeshDataInfo.meshMap;\n }\n /**\n * Gets or sets a boolean indicating that this mesh does not use index buffer\n */\n get isUnIndexed() {\n return this._unIndexed;\n }\n set isUnIndexed(value) {\n if (this._unIndexed !== value) {\n this._unIndexed = value;\n this._markSubMeshesAsAttributesDirty();\n }\n }\n /** Gets the array buffer used to store the instanced buffer used for instances' world matrices */\n get worldMatrixInstancedBuffer() {\n return this._instanceDataStorage.instancesData;\n }\n /** Gets the array buffer used to store the instanced buffer used for instances' previous world matrices */\n get previousWorldMatrixInstancedBuffer() {\n return this._instanceDataStorage.instancesPreviousData;\n }\n /** Gets or sets a boolean indicating that the update of the instance buffer of the world matrices is manual */\n get manualUpdateOfWorldMatrixInstancedBuffer() {\n return this._instanceDataStorage.manualUpdate;\n }\n set manualUpdateOfWorldMatrixInstancedBuffer(value) {\n this._instanceDataStorage.manualUpdate = value;\n }\n /** Gets or sets a boolean indicating that the update of the instance buffer of the world matrices is manual */\n get manualUpdateOfPreviousWorldMatrixInstancedBuffer() {\n return this._instanceDataStorage.previousManualUpdate;\n }\n set manualUpdateOfPreviousWorldMatrixInstancedBuffer(value) {\n this._instanceDataStorage.previousManualUpdate = value;\n }\n /** Gets or sets a boolean indicating that the update of the instance buffer of the world matrices must be performed in all cases (and notably even in frozen mode) */\n get forceWorldMatrixInstancedBufferUpdate() {\n return this._instanceDataStorage.forceMatrixUpdates;\n }\n set forceWorldMatrixInstancedBufferUpdate(value) {\n this._instanceDataStorage.forceMatrixUpdates = value;\n }\n /**\n * @constructor\n * @param name The value used by scene.getMeshByName() to do a lookup.\n * @param scene The scene to add this mesh to.\n * @param parent The parent of this mesh, if it has one\n * @param source An optional Mesh from which geometry is shared, cloned.\n * @param doNotCloneChildren When cloning, skip cloning child meshes of source, default False.\n * When false, achieved by calling a clone(), also passing False.\n * This will make creation of children, recursive.\n * @param clonePhysicsImpostor When cloning, include cloning mesh physics impostor, default True.\n */\n constructor(name, scene = null, parent = null, source = null, doNotCloneChildren, clonePhysicsImpostor = true) {\n super(name, scene);\n // Internal data\n this._internalMeshDataInfo = new _InternalMeshDataInfo();\n // Members\n /**\n * Gets the delay loading state of the mesh (when delay loading is turned on)\n * @see https://doc.babylonjs.com/features/featuresDeepDive/importers/incrementalLoading\n */\n this.delayLoadState = 0;\n /**\n * Gets the list of instances created from this mesh\n * it is not supposed to be modified manually.\n * Note also that the order of the InstancedMesh wihin the array is not significant and might change.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/copies/instances\n */\n this.instances = new Array();\n // Private\n /** @internal */\n this._creationDataStorage = null;\n /** @internal */\n this._geometry = null;\n /** @internal */\n this._instanceDataStorage = new _InstanceDataStorage();\n /** @internal */\n this._thinInstanceDataStorage = new _ThinInstanceDataStorage();\n /** @internal */\n this._shouldGenerateFlatShading = false;\n // Use by builder only to know what orientation were the mesh build in.\n /** @internal */\n this._originalBuilderSideOrientation = Mesh.DEFAULTSIDE;\n /**\n * Use this property to change the original side orientation defined at construction time\n */\n this.overrideMaterialSideOrientation = null;\n /**\n * Gets or sets a boolean indicating whether to render ignoring the active camera's max z setting. (false by default)\n * You should not mix meshes that have this property set to true with meshes that have it set to false if they all write\n * to the depth buffer, because the z-values are not comparable in the two cases and you will get rendering artifacts if you do.\n * You can set the property to true for meshes that do not write to the depth buffer, or set the same value (either false or true) otherwise.\n * Note this will reduce performance when set to true.\n */\n this.ignoreCameraMaxZ = false;\n scene = this.getScene();\n this._onBeforeDraw = (isInstance, world, effectiveMaterial) => {\n if (isInstance && effectiveMaterial) {\n if (this._uniformBuffer) {\n this.transferToEffect(world);\n }\n else {\n effectiveMaterial.bindOnlyWorldMatrix(world);\n }\n }\n };\n if (source) {\n // Geometry\n if (source._geometry) {\n source._geometry.applyToMesh(this);\n }\n // Deep copy\n DeepCopier.DeepCopy(source, this, [\n \"name\",\n \"material\",\n \"skeleton\",\n \"instances\",\n \"parent\",\n \"uniqueId\",\n \"source\",\n \"metadata\",\n \"morphTargetManager\",\n \"hasInstances\",\n \"worldMatrixInstancedBuffer\",\n \"previousWorldMatrixInstancedBuffer\",\n \"hasLODLevels\",\n \"geometry\",\n \"isBlocked\",\n \"areNormalsFrozen\",\n \"facetNb\",\n \"isFacetDataEnabled\",\n \"lightSources\",\n \"useBones\",\n \"isAnInstance\",\n \"collider\",\n \"edgesRenderer\",\n \"forward\",\n \"up\",\n \"right\",\n \"absolutePosition\",\n \"absoluteScaling\",\n \"absoluteRotationQuaternion\",\n \"isWorldMatrixFrozen\",\n \"nonUniformScaling\",\n \"behaviors\",\n \"worldMatrixFromCache\",\n \"hasThinInstances\",\n \"cloneMeshMap\",\n \"hasBoundingInfo\",\n \"physicsBody\",\n \"physicsImpostor\",\n ], [\"_poseMatrix\"]);\n // Source mesh\n this._internalMeshDataInfo._source = source;\n if (scene.useClonedMeshMap) {\n if (!source._internalMeshDataInfo.meshMap) {\n source._internalMeshDataInfo.meshMap = {};\n }\n source._internalMeshDataInfo.meshMap[this.uniqueId] = this;\n }\n // Construction Params\n // Clone parameters allowing mesh to be updated in case of parametric shapes.\n this._originalBuilderSideOrientation = source._originalBuilderSideOrientation;\n this._creationDataStorage = source._creationDataStorage;\n // Animation ranges\n if (source._ranges) {\n const ranges = source._ranges;\n for (const name in ranges) {\n if (!Object.prototype.hasOwnProperty.call(ranges, name)) {\n continue;\n }\n if (!ranges[name]) {\n continue;\n }\n this.createAnimationRange(name, ranges[name].from, ranges[name].to);\n }\n }\n // Metadata\n if (source.metadata && source.metadata.clone) {\n this.metadata = source.metadata.clone();\n }\n else {\n this.metadata = source.metadata;\n }\n this._internalMetadata = source._internalMetadata;\n // Tags\n if (Tags && Tags.HasTags(source)) {\n Tags.AddTagsTo(this, Tags.GetTags(source, true));\n }\n // Enabled. We shouldn't need to check the source's ancestors, as this mesh\n // will have the same ones.\n this.setEnabled(source.isEnabled(false));\n // Parent\n this.parent = source.parent;\n // Pivot\n this.setPivotMatrix(source.getPivotMatrix());\n this.id = name + \".\" + source.id;\n // Material\n this.material = source.material;\n if (!doNotCloneChildren) {\n // Children\n const directDescendants = source.getDescendants(true);\n for (let index = 0; index < directDescendants.length; index++) {\n const child = directDescendants[index];\n if (child.clone) {\n child.clone(name + \".\" + child.name, this);\n }\n }\n }\n // Morphs\n if (source.morphTargetManager) {\n this.morphTargetManager = source.morphTargetManager;\n }\n // Physics clone\n if (scene.getPhysicsEngine) {\n const physicsEngine = scene.getPhysicsEngine();\n if (clonePhysicsImpostor && physicsEngine) {\n if (physicsEngine.getPluginVersion() === 1) {\n const impostor = physicsEngine.getImpostorForPhysicsObject(source);\n if (impostor) {\n this.physicsImpostor = impostor.clone(this);\n }\n }\n else if (physicsEngine.getPluginVersion() === 2) {\n if (source.physicsBody) {\n source.physicsBody.clone(this);\n }\n }\n }\n }\n // Particles\n for (let index = 0; index < scene.particleSystems.length; index++) {\n const system = scene.particleSystems[index];\n if (system.emitter === source) {\n system.clone(system.name, this);\n }\n }\n // Skeleton\n this.skeleton = source.skeleton;\n this.refreshBoundingInfo(true, true);\n this.computeWorldMatrix(true);\n }\n // Parent\n if (parent !== null) {\n this.parent = parent;\n }\n this._instanceDataStorage.hardwareInstancedRendering = this.getEngine().getCaps().instancedArrays;\n this._internalMeshDataInfo._onMeshReadyObserverAdded = (observer) => {\n // only notify once! then unregister the observer\n observer.unregisterOnNextCall = true;\n if (this.isReady(true)) {\n this.onMeshReadyObservable.notifyObservers(this);\n }\n else {\n if (!this._internalMeshDataInfo._checkReadinessObserver) {\n this._internalMeshDataInfo._checkReadinessObserver = this._scene.onBeforeRenderObservable.add(() => {\n // check for complete readiness\n if (this.isReady(true)) {\n this._scene.onBeforeRenderObservable.remove(this._internalMeshDataInfo._checkReadinessObserver);\n this._internalMeshDataInfo._checkReadinessObserver = null;\n this.onMeshReadyObservable.notifyObservers(this);\n }\n });\n }\n }\n };\n this.onMeshReadyObservable = new Observable(this._internalMeshDataInfo._onMeshReadyObserverAdded);\n if (source) {\n source.onClonedObservable.notifyObservers(this);\n }\n }\n instantiateHierarchy(newParent = null, options, onNewNodeCreated) {\n const instance = this.getTotalVertices() === 0 || (options && options.doNotInstantiate && (options.doNotInstantiate === true || options.doNotInstantiate(this)))\n ? this.clone(\"Clone of \" + (this.name || this.id), newParent || this.parent, true)\n : this.createInstance(\"instance of \" + (this.name || this.id));\n instance.parent = newParent || this.parent;\n instance.position = this.position.clone();\n instance.scaling = this.scaling.clone();\n if (this.rotationQuaternion) {\n instance.rotationQuaternion = this.rotationQuaternion.clone();\n }\n else {\n instance.rotation = this.rotation.clone();\n }\n if (onNewNodeCreated) {\n onNewNodeCreated(this, instance);\n }\n for (const child of this.getChildTransformNodes(true)) {\n // instancedMesh should have a different sourced mesh\n if (child.getClassName() === \"InstancedMesh\" && instance.getClassName() === \"Mesh\" && child.sourceMesh === this) {\n child.instantiateHierarchy(instance, {\n doNotInstantiate: (options && options.doNotInstantiate) || false,\n newSourcedMesh: instance,\n }, onNewNodeCreated);\n }\n else {\n child.instantiateHierarchy(instance, options, onNewNodeCreated);\n }\n }\n return instance;\n }\n /**\n * Gets the class name\n * @returns the string \"Mesh\".\n */\n getClassName() {\n return \"Mesh\";\n }\n /** @internal */\n get _isMesh() {\n return true;\n }\n /**\n * Returns a description of this mesh\n * @param fullDetails define if full details about this mesh must be used\n * @returns a descriptive string representing this mesh\n */\n toString(fullDetails) {\n let ret = super.toString(fullDetails);\n ret += \", n vertices: \" + this.getTotalVertices();\n ret += \", parent: \" + (this._waitingParentId ? this._waitingParentId : this.parent ? this.parent.name : \"NONE\");\n if (this.animations) {\n for (let i = 0; i < this.animations.length; i++) {\n ret += \", animation[0]: \" + this.animations[i].toString(fullDetails);\n }\n }\n if (fullDetails) {\n if (this._geometry) {\n const ib = this.getIndices();\n const vb = this.getVerticesData(VertexBuffer.PositionKind);\n if (vb && ib) {\n ret += \", flat shading: \" + (vb.length / 3 === ib.length ? \"YES\" : \"NO\");\n }\n }\n else {\n ret += \", flat shading: UNKNOWN\";\n }\n }\n return ret;\n }\n /** @internal */\n _unBindEffect() {\n super._unBindEffect();\n for (const instance of this.instances) {\n instance._unBindEffect();\n }\n }\n /**\n * Gets a boolean indicating if this mesh has LOD\n */\n get hasLODLevels() {\n return this._internalMeshDataInfo._LODLevels.length > 0;\n }\n /**\n * Gets the list of MeshLODLevel associated with the current mesh\n * @returns an array of MeshLODLevel\n */\n getLODLevels() {\n return this._internalMeshDataInfo._LODLevels;\n }\n _sortLODLevels() {\n const sortingOrderFactor = this._internalMeshDataInfo._useLODScreenCoverage ? -1 : 1;\n this._internalMeshDataInfo._LODLevels.sort((a, b) => {\n if (a.distanceOrScreenCoverage < b.distanceOrScreenCoverage) {\n return sortingOrderFactor;\n }\n if (a.distanceOrScreenCoverage > b.distanceOrScreenCoverage) {\n return -sortingOrderFactor;\n }\n return 0;\n });\n }\n /**\n * Add a mesh as LOD level triggered at the given distance.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/LOD\n * @param distanceOrScreenCoverage Either distance from the center of the object to show this level or the screen coverage if `useScreenCoverage` is set to `true`.\n * If screen coverage, value is a fraction of the screen's total surface, between 0 and 1.\n * Example Playground for distance https://playground.babylonjs.com/#QE7KM#197\n * Example Playground for screen coverage https://playground.babylonjs.com/#QE7KM#196\n * @param mesh The mesh to be added as LOD level (can be null)\n * @returns This mesh (for chaining)\n */\n addLODLevel(distanceOrScreenCoverage, mesh) {\n if (mesh && mesh._masterMesh) {\n Logger.Warn(\"You cannot use a mesh as LOD level twice\");\n return this;\n }\n const level = new MeshLODLevel(distanceOrScreenCoverage, mesh);\n this._internalMeshDataInfo._LODLevels.push(level);\n if (mesh) {\n mesh._masterMesh = this;\n }\n this._sortLODLevels();\n return this;\n }\n /**\n * Returns the LOD level mesh at the passed distance or null if not found.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/LOD\n * @param distance The distance from the center of the object to show this level\n * @returns a Mesh or `null`\n */\n getLODLevelAtDistance(distance) {\n const internalDataInfo = this._internalMeshDataInfo;\n for (let index = 0; index < internalDataInfo._LODLevels.length; index++) {\n const level = internalDataInfo._LODLevels[index];\n if (level.distanceOrScreenCoverage === distance) {\n return level.mesh;\n }\n }\n return null;\n }\n /**\n * Remove a mesh from the LOD array\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/LOD\n * @param mesh defines the mesh to be removed\n * @returns This mesh (for chaining)\n */\n removeLODLevel(mesh) {\n const internalDataInfo = this._internalMeshDataInfo;\n for (let index = 0; index < internalDataInfo._LODLevels.length; index++) {\n if (internalDataInfo._LODLevels[index].mesh === mesh) {\n internalDataInfo._LODLevels.splice(index, 1);\n if (mesh) {\n mesh._masterMesh = null;\n }\n }\n }\n this._sortLODLevels();\n return this;\n }\n /**\n * Returns the registered LOD mesh distant from the parameter `camera` position if any, else returns the current mesh.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/LOD\n * @param camera defines the camera to use to compute distance\n * @param boundingSphere defines a custom bounding sphere to use instead of the one from this mesh\n * @returns This mesh (for chaining)\n */\n getLOD(camera, boundingSphere) {\n const internalDataInfo = this._internalMeshDataInfo;\n if (!internalDataInfo._LODLevels || internalDataInfo._LODLevels.length === 0) {\n return this;\n }\n const bSphere = boundingSphere || this.getBoundingInfo().boundingSphere;\n const distanceToCamera = camera.mode === Camera.ORTHOGRAPHIC_CAMERA ? camera.minZ : bSphere.centerWorld.subtract(camera.globalPosition).length();\n let compareValue = distanceToCamera;\n let compareSign = 1;\n if (internalDataInfo._useLODScreenCoverage) {\n const screenArea = camera.screenArea;\n let meshArea = (bSphere.radiusWorld * camera.minZ) / distanceToCamera;\n meshArea = meshArea * meshArea * Math.PI;\n compareValue = meshArea / screenArea;\n compareSign = -1;\n }\n if (compareSign * internalDataInfo._LODLevels[internalDataInfo._LODLevels.length - 1].distanceOrScreenCoverage > compareSign * compareValue) {\n if (this.onLODLevelSelection) {\n this.onLODLevelSelection(compareValue, this, this);\n }\n return this;\n }\n for (let index = 0; index < internalDataInfo._LODLevels.length; index++) {\n const level = internalDataInfo._LODLevels[index];\n if (compareSign * level.distanceOrScreenCoverage < compareSign * compareValue) {\n if (level.mesh) {\n if (level.mesh.delayLoadState === 4) {\n level.mesh._checkDelayState();\n return this;\n }\n if (level.mesh.delayLoadState === 2) {\n return this;\n }\n level.mesh._preActivate();\n level.mesh._updateSubMeshesBoundingInfo(this.worldMatrixFromCache);\n }\n if (this.onLODLevelSelection) {\n this.onLODLevelSelection(compareValue, this, level.mesh);\n }\n return level.mesh;\n }\n }\n if (this.onLODLevelSelection) {\n this.onLODLevelSelection(compareValue, this, this);\n }\n return this;\n }\n /**\n * Gets the mesh internal Geometry object\n */\n get geometry() {\n return this._geometry;\n }\n /**\n * Returns the total number of vertices within the mesh geometry or zero if the mesh has no geometry.\n * @returns the total number of vertices\n */\n getTotalVertices() {\n if (this._geometry === null || this._geometry === undefined) {\n return 0;\n }\n return this._geometry.getTotalVertices();\n }\n /**\n * Returns the content of an associated vertex buffer\n * @param kind defines which buffer to read from (positions, indices, normals, etc). Possible `kind` values :\n * - VertexBuffer.PositionKind\n * - VertexBuffer.UVKind\n * - VertexBuffer.UV2Kind\n * - VertexBuffer.UV3Kind\n * - VertexBuffer.UV4Kind\n * - VertexBuffer.UV5Kind\n * - VertexBuffer.UV6Kind\n * - VertexBuffer.ColorKind\n * - VertexBuffer.MatricesIndicesKind\n * - VertexBuffer.MatricesIndicesExtraKind\n * - VertexBuffer.MatricesWeightsKind\n * - VertexBuffer.MatricesWeightsExtraKind\n * @param copyWhenShared defines a boolean indicating that if the mesh geometry is shared among some other meshes, the returned array is a copy of the internal one\n * @param forceCopy defines a boolean forcing the copy of the buffer no matter what the value of copyWhenShared is\n * @param bypassInstanceData defines a boolean indicating that the function should not take into account the instance data (applies only if the mesh has instances). Default: false\n * @returns a FloatArray or null if the mesh has no geometry or no vertex buffer for this kind.\n */\n getVerticesData(kind, copyWhenShared, forceCopy, bypassInstanceData) {\n var _a, _b;\n if (!this._geometry) {\n return null;\n }\n let data = bypassInstanceData\n ? undefined\n : (_b = (_a = this._userInstancedBuffersStorage) === null || _a === void 0 ? void 0 : _a.vertexBuffers[kind]) === null || _b === void 0 ? void 0 : _b.getFloatData(this.instances.length + 1, // +1 because the master mesh is not included in the instances array\n forceCopy || (copyWhenShared && this._geometry.meshes.length !== 1));\n if (!data) {\n data = this._geometry.getVerticesData(kind, copyWhenShared, forceCopy);\n }\n return data;\n }\n /**\n * Returns the mesh VertexBuffer object from the requested `kind`\n * @param kind defines which buffer to read from (positions, indices, normals, etc). Possible `kind` values :\n * - VertexBuffer.PositionKind\n * - VertexBuffer.NormalKind\n * - VertexBuffer.UVKind\n * - VertexBuffer.UV2Kind\n * - VertexBuffer.UV3Kind\n * - VertexBuffer.UV4Kind\n * - VertexBuffer.UV5Kind\n * - VertexBuffer.UV6Kind\n * - VertexBuffer.ColorKind\n * - VertexBuffer.MatricesIndicesKind\n * - VertexBuffer.MatricesIndicesExtraKind\n * - VertexBuffer.MatricesWeightsKind\n * - VertexBuffer.MatricesWeightsExtraKind\n * @param bypassInstanceData defines a boolean indicating that the function should not take into account the instance data (applies only if the mesh has instances). Default: false\n * @returns a FloatArray or null if the mesh has no vertex buffer for this kind.\n */\n getVertexBuffer(kind, bypassInstanceData) {\n var _a, _b;\n if (!this._geometry) {\n return null;\n }\n return (_b = (bypassInstanceData ? undefined : (_a = this._userInstancedBuffersStorage) === null || _a === void 0 ? void 0 : _a.vertexBuffers[kind])) !== null && _b !== void 0 ? _b : this._geometry.getVertexBuffer(kind);\n }\n /**\n * Tests if a specific vertex buffer is associated with this mesh\n * @param kind defines which buffer to check (positions, indices, normals, etc). Possible `kind` values :\n * - VertexBuffer.PositionKind\n * - VertexBuffer.NormalKind\n * - VertexBuffer.UVKind\n * - VertexBuffer.UV2Kind\n * - VertexBuffer.UV3Kind\n * - VertexBuffer.UV4Kind\n * - VertexBuffer.UV5Kind\n * - VertexBuffer.UV6Kind\n * - VertexBuffer.ColorKind\n * - VertexBuffer.MatricesIndicesKind\n * - VertexBuffer.MatricesIndicesExtraKind\n * - VertexBuffer.MatricesWeightsKind\n * - VertexBuffer.MatricesWeightsExtraKind\n * @param bypassInstanceData defines a boolean indicating that the function should not take into account the instance data (applies only if the mesh has instances). Default: false\n * @returns a boolean\n */\n isVerticesDataPresent(kind, bypassInstanceData) {\n var _a;\n if (!this._geometry) {\n if (this._delayInfo) {\n return this._delayInfo.indexOf(kind) !== -1;\n }\n return false;\n }\n return (!bypassInstanceData && ((_a = this._userInstancedBuffersStorage) === null || _a === void 0 ? void 0 : _a.vertexBuffers[kind]) !== undefined) || this._geometry.isVerticesDataPresent(kind);\n }\n /**\n * Returns a boolean defining if the vertex data for the requested `kind` is updatable.\n * @param kind defines which buffer to check (positions, indices, normals, etc). Possible `kind` values :\n * - VertexBuffer.PositionKind\n * - VertexBuffer.UVKind\n * - VertexBuffer.UV2Kind\n * - VertexBuffer.UV3Kind\n * - VertexBuffer.UV4Kind\n * - VertexBuffer.UV5Kind\n * - VertexBuffer.UV6Kind\n * - VertexBuffer.ColorKind\n * - VertexBuffer.MatricesIndicesKind\n * - VertexBuffer.MatricesIndicesExtraKind\n * - VertexBuffer.MatricesWeightsKind\n * - VertexBuffer.MatricesWeightsExtraKind\n * @param bypassInstanceData defines a boolean indicating that the function should not take into account the instance data (applies only if the mesh has instances). Default: false\n * @returns a boolean\n */\n isVertexBufferUpdatable(kind, bypassInstanceData) {\n var _a;\n if (!this._geometry) {\n if (this._delayInfo) {\n return this._delayInfo.indexOf(kind) !== -1;\n }\n return false;\n }\n if (!bypassInstanceData) {\n const buffer = (_a = this._userInstancedBuffersStorage) === null || _a === void 0 ? void 0 : _a.vertexBuffers[kind];\n if (buffer) {\n return buffer.isUpdatable();\n }\n }\n return this._geometry.isVertexBufferUpdatable(kind);\n }\n /**\n * Returns a string which contains the list of existing `kinds` of Vertex Data associated with this mesh.\n * @param bypassInstanceData defines a boolean indicating that the function should not take into account the instance data (applies only if the mesh has instances). Default: false\n * @returns an array of strings\n */\n getVerticesDataKinds(bypassInstanceData) {\n if (!this._geometry) {\n const result = new Array();\n if (this._delayInfo) {\n this._delayInfo.forEach(function (kind) {\n result.push(kind);\n });\n }\n return result;\n }\n const kinds = this._geometry.getVerticesDataKinds();\n if (!bypassInstanceData && this._userInstancedBuffersStorage) {\n for (const kind in this._userInstancedBuffersStorage.vertexBuffers) {\n if (kinds.indexOf(kind) === -1) {\n kinds.push(kind);\n }\n }\n }\n return kinds;\n }\n /**\n * Returns a positive integer : the total number of indices in this mesh geometry.\n * @returns the numner of indices or zero if the mesh has no geometry.\n */\n getTotalIndices() {\n if (!this._geometry) {\n return 0;\n }\n return this._geometry.getTotalIndices();\n }\n /**\n * Returns an array of integers or a typed array (Int32Array, Uint32Array, Uint16Array) populated with the mesh indices.\n * @param copyWhenShared If true (default false) and and if the mesh geometry is shared among some other meshes, the returned array is a copy of the internal one.\n * @param forceCopy defines a boolean indicating that the returned array must be cloned upon returning it\n * @returns the indices array or an empty array if the mesh has no geometry\n */\n getIndices(copyWhenShared, forceCopy) {\n if (!this._geometry) {\n return [];\n }\n return this._geometry.getIndices(copyWhenShared, forceCopy);\n }\n get isBlocked() {\n return this._masterMesh !== null && this._masterMesh !== undefined;\n }\n /**\n * Determine if the current mesh is ready to be rendered\n * @param completeCheck defines if a complete check (including materials and lights) has to be done (false by default)\n * @param forceInstanceSupport will check if the mesh will be ready when used with instances (false by default)\n * @returns true if all associated assets are ready (material, textures, shaders)\n */\n isReady(completeCheck = false, forceInstanceSupport = false) {\n var _a, _b, _c, _d, _e, _f, _g;\n if (this.delayLoadState === 2) {\n return false;\n }\n if (!super.isReady(completeCheck)) {\n return false;\n }\n if (!this.subMeshes || this.subMeshes.length === 0) {\n return true;\n }\n if (!completeCheck) {\n return true;\n }\n const engine = this.getEngine();\n const scene = this.getScene();\n const hardwareInstancedRendering = forceInstanceSupport || (engine.getCaps().instancedArrays && (this.instances.length > 0 || this.hasThinInstances));\n this.computeWorldMatrix();\n const mat = this.material || scene.defaultMaterial;\n if (mat) {\n if (mat._storeEffectOnSubMeshes) {\n for (const subMesh of this.subMeshes) {\n const effectiveMaterial = subMesh.getMaterial();\n if (effectiveMaterial) {\n if (effectiveMaterial._storeEffectOnSubMeshes) {\n if (!effectiveMaterial.isReadyForSubMesh(this, subMesh, hardwareInstancedRendering)) {\n return false;\n }\n }\n else {\n if (!effectiveMaterial.isReady(this, hardwareInstancedRendering)) {\n return false;\n }\n }\n }\n }\n }\n else {\n if (!mat.isReady(this, hardwareInstancedRendering)) {\n return false;\n }\n }\n }\n // Shadows\n const currentRenderPassId = engine.currentRenderPassId;\n for (const light of this.lightSources) {\n const generators = light.getShadowGenerators();\n if (!generators) {\n continue;\n }\n const iterator = generators.values();\n for (let key = iterator.next(); key.done !== true; key = iterator.next()) {\n const generator = key.value;\n if (generator && (!((_a = generator.getShadowMap()) === null || _a === void 0 ? void 0 : _a.renderList) || (((_b = generator.getShadowMap()) === null || _b === void 0 ? void 0 : _b.renderList) && ((_d = (_c = generator.getShadowMap()) === null || _c === void 0 ? void 0 : _c.renderList) === null || _d === void 0 ? void 0 : _d.indexOf(this)) !== -1))) {\n const shadowMap = generator.getShadowMap();\n const renderPassIds = (_e = shadowMap.renderPassIds) !== null && _e !== void 0 ? _e : [engine.currentRenderPassId];\n for (let p = 0; p < renderPassIds.length; ++p) {\n engine.currentRenderPassId = renderPassIds[p];\n for (const subMesh of this.subMeshes) {\n if (!generator.isReady(subMesh, hardwareInstancedRendering, (_g = (_f = subMesh.getMaterial()) === null || _f === void 0 ? void 0 : _f.needAlphaBlendingForMesh(this)) !== null && _g !== void 0 ? _g : false)) {\n engine.currentRenderPassId = currentRenderPassId;\n return false;\n }\n }\n }\n engine.currentRenderPassId = currentRenderPassId;\n }\n }\n }\n // LOD\n for (const lod of this._internalMeshDataInfo._LODLevels) {\n if (lod.mesh && !lod.mesh.isReady(hardwareInstancedRendering)) {\n return false;\n }\n }\n return true;\n }\n /**\n * Gets a boolean indicating if the normals aren't to be recomputed on next mesh `positions` array update. This property is pertinent only for updatable parametric shapes.\n */\n get areNormalsFrozen() {\n return this._internalMeshDataInfo._areNormalsFrozen;\n }\n /**\n * This function affects parametric shapes on vertex position update only : ribbons, tubes, etc. It has no effect at all on other shapes. It prevents the mesh normals from being recomputed on next `positions` array update.\n * @returns the current mesh\n */\n freezeNormals() {\n this._internalMeshDataInfo._areNormalsFrozen = true;\n return this;\n }\n /**\n * This function affects parametric shapes on vertex position update only : ribbons, tubes, etc. It has no effect at all on other shapes. It reactivates the mesh normals computation if it was previously frozen\n * @returns the current mesh\n */\n unfreezeNormals() {\n this._internalMeshDataInfo._areNormalsFrozen = false;\n return this;\n }\n /**\n * Sets a value overriding the instance count. Only applicable when custom instanced InterleavedVertexBuffer are used rather than InstancedMeshs\n */\n set overridenInstanceCount(count) {\n this._instanceDataStorage.overridenInstanceCount = count;\n }\n // Methods\n /** @internal */\n _preActivate() {\n const internalDataInfo = this._internalMeshDataInfo;\n const sceneRenderId = this.getScene().getRenderId();\n if (internalDataInfo._preActivateId === sceneRenderId) {\n return this;\n }\n internalDataInfo._preActivateId = sceneRenderId;\n this._instanceDataStorage.visibleInstances = null;\n return this;\n }\n /**\n * @internal\n */\n _preActivateForIntermediateRendering(renderId) {\n if (this._instanceDataStorage.visibleInstances) {\n this._instanceDataStorage.visibleInstances.intermediateDefaultRenderId = renderId;\n }\n return this;\n }\n /**\n * @internal\n */\n _registerInstanceForRenderId(instance, renderId) {\n if (!this._instanceDataStorage.visibleInstances) {\n this._instanceDataStorage.visibleInstances = {\n defaultRenderId: renderId,\n selfDefaultRenderId: this._renderId,\n };\n }\n if (!this._instanceDataStorage.visibleInstances[renderId]) {\n if (this._instanceDataStorage.previousRenderId !== undefined && this._instanceDataStorage.isFrozen) {\n this._instanceDataStorage.visibleInstances[this._instanceDataStorage.previousRenderId] = null;\n }\n this._instanceDataStorage.previousRenderId = renderId;\n this._instanceDataStorage.visibleInstances[renderId] = new Array();\n }\n this._instanceDataStorage.visibleInstances[renderId].push(instance);\n return this;\n }\n _afterComputeWorldMatrix() {\n super._afterComputeWorldMatrix();\n if (!this.hasThinInstances) {\n return;\n }\n if (!this.doNotSyncBoundingInfo) {\n this.thinInstanceRefreshBoundingInfo(false);\n }\n }\n /** @internal */\n _postActivate() {\n if (this.edgesShareWithInstances && this.edgesRenderer && this.edgesRenderer.isEnabled && this._renderingGroup) {\n this._renderingGroup._edgesRenderers.pushNoDuplicate(this.edgesRenderer);\n this.edgesRenderer.customInstances.push(this.getWorldMatrix());\n }\n }\n /**\n * This method recomputes and sets a new BoundingInfo to the mesh unless it is locked.\n * This means the mesh underlying bounding box and sphere are recomputed.\n * @param applySkeleton defines whether to apply the skeleton before computing the bounding info\n * @param applyMorph defines whether to apply the morph target before computing the bounding info\n * @returns the current mesh\n */\n refreshBoundingInfo(applySkeleton = false, applyMorph = false) {\n if (this.hasBoundingInfo && this.getBoundingInfo().isLocked) {\n return this;\n }\n const bias = this.geometry ? this.geometry.boundingBias : null;\n this._refreshBoundingInfo(this._getPositionData(applySkeleton, applyMorph), bias);\n return this;\n }\n /**\n * @internal\n */\n _createGlobalSubMesh(force) {\n const totalVertices = this.getTotalVertices();\n if (!totalVertices || !this.getIndices()) {\n return null;\n }\n // Check if we need to recreate the submeshes\n if (this.subMeshes && this.subMeshes.length > 0) {\n const ib = this.getIndices();\n if (!ib) {\n return null;\n }\n const totalIndices = ib.length;\n let needToRecreate = false;\n if (force) {\n needToRecreate = true;\n }\n else {\n for (const submesh of this.subMeshes) {\n if (submesh.indexStart + submesh.indexCount > totalIndices) {\n needToRecreate = true;\n break;\n }\n if (submesh.verticesStart + submesh.verticesCount > totalVertices) {\n needToRecreate = true;\n break;\n }\n }\n }\n if (!needToRecreate) {\n return this.subMeshes[0];\n }\n }\n this.releaseSubMeshes();\n return new SubMesh(0, 0, totalVertices, 0, this.getTotalIndices(), this);\n }\n /**\n * This function will subdivide the mesh into multiple submeshes\n * @param count defines the expected number of submeshes\n */\n subdivide(count) {\n if (count < 1) {\n return;\n }\n const totalIndices = this.getTotalIndices();\n let subdivisionSize = (totalIndices / count) | 0;\n let offset = 0;\n // Ensure that subdivisionSize is a multiple of 3\n while (subdivisionSize % 3 !== 0) {\n subdivisionSize++;\n }\n this.releaseSubMeshes();\n for (let index = 0; index < count; index++) {\n if (offset >= totalIndices) {\n break;\n }\n SubMesh.CreateFromIndices(0, offset, index === count - 1 ? totalIndices - offset : subdivisionSize, this, undefined, false);\n offset += subdivisionSize;\n }\n this.refreshBoundingInfo();\n this.synchronizeInstances();\n }\n /**\n * Copy a FloatArray into a specific associated vertex buffer\n * @param kind defines which buffer to write to (positions, indices, normals, etc). Possible `kind` values :\n * - VertexBuffer.PositionKind\n * - VertexBuffer.UVKind\n * - VertexBuffer.UV2Kind\n * - VertexBuffer.UV3Kind\n * - VertexBuffer.UV4Kind\n * - VertexBuffer.UV5Kind\n * - VertexBuffer.UV6Kind\n * - VertexBuffer.ColorKind\n * - VertexBuffer.MatricesIndicesKind\n * - VertexBuffer.MatricesIndicesExtraKind\n * - VertexBuffer.MatricesWeightsKind\n * - VertexBuffer.MatricesWeightsExtraKind\n * @param data defines the data source\n * @param updatable defines if the updated vertex buffer must be flagged as updatable\n * @param stride defines the data stride size (can be null)\n * @returns the current mesh\n */\n setVerticesData(kind, data, updatable = false, stride) {\n if (!this._geometry) {\n const vertexData = new VertexData();\n vertexData.set(data, kind);\n const scene = this.getScene();\n new Geometry(Geometry.RandomId(), scene, vertexData, updatable, this);\n }\n else {\n this._geometry.setVerticesData(kind, data, updatable, stride);\n }\n return this;\n }\n /**\n * Delete a vertex buffer associated with this mesh\n * @param kind defines which buffer to delete (positions, indices, normals, etc). Possible `kind` values :\n * - VertexBuffer.PositionKind\n * - VertexBuffer.UVKind\n * - VertexBuffer.UV2Kind\n * - VertexBuffer.UV3Kind\n * - VertexBuffer.UV4Kind\n * - VertexBuffer.UV5Kind\n * - VertexBuffer.UV6Kind\n * - VertexBuffer.ColorKind\n * - VertexBuffer.MatricesIndicesKind\n * - VertexBuffer.MatricesIndicesExtraKind\n * - VertexBuffer.MatricesWeightsKind\n * - VertexBuffer.MatricesWeightsExtraKind\n */\n removeVerticesData(kind) {\n if (!this._geometry) {\n return;\n }\n this._geometry.removeVerticesData(kind);\n }\n /**\n * Flags an associated vertex buffer as updatable\n * @param kind defines which buffer to use (positions, indices, normals, etc). Possible `kind` values :\n * - VertexBuffer.PositionKind\n * - VertexBuffer.UVKind\n * - VertexBuffer.UV2Kind\n * - VertexBuffer.UV3Kind\n * - VertexBuffer.UV4Kind\n * - VertexBuffer.UV5Kind\n * - VertexBuffer.UV6Kind\n * - VertexBuffer.ColorKind\n * - VertexBuffer.MatricesIndicesKind\n * - VertexBuffer.MatricesIndicesExtraKind\n * - VertexBuffer.MatricesWeightsKind\n * - VertexBuffer.MatricesWeightsExtraKind\n * @param updatable defines if the updated vertex buffer must be flagged as updatable\n */\n markVerticesDataAsUpdatable(kind, updatable = true) {\n const vb = this.getVertexBuffer(kind);\n if (!vb || vb.isUpdatable() === updatable) {\n return;\n }\n this.setVerticesData(kind, this.getVerticesData(kind), updatable);\n }\n /**\n * Sets the mesh global Vertex Buffer\n * @param buffer defines the buffer to use\n * @param disposeExistingBuffer disposes the existing buffer, if any (default: true)\n * @returns the current mesh\n */\n setVerticesBuffer(buffer, disposeExistingBuffer = true) {\n if (!this._geometry) {\n this._geometry = Geometry.CreateGeometryForMesh(this);\n }\n this._geometry.setVerticesBuffer(buffer, null, disposeExistingBuffer);\n return this;\n }\n /**\n * Update a specific associated vertex buffer\n * @param kind defines which buffer to write to (positions, indices, normals, etc). Possible `kind` values :\n * - VertexBuffer.PositionKind\n * - VertexBuffer.UVKind\n * - VertexBuffer.UV2Kind\n * - VertexBuffer.UV3Kind\n * - VertexBuffer.UV4Kind\n * - VertexBuffer.UV5Kind\n * - VertexBuffer.UV6Kind\n * - VertexBuffer.ColorKind\n * - VertexBuffer.MatricesIndicesKind\n * - VertexBuffer.MatricesIndicesExtraKind\n * - VertexBuffer.MatricesWeightsKind\n * - VertexBuffer.MatricesWeightsExtraKind\n * @param data defines the data source\n * @param updateExtends defines if extends info of the mesh must be updated (can be null). This is mostly useful for \"position\" kind\n * @param makeItUnique defines if the geometry associated with the mesh must be cloned to make the change only for this mesh (and not all meshes associated with the same geometry)\n * @returns the current mesh\n */\n updateVerticesData(kind, data, updateExtends, makeItUnique) {\n if (!this._geometry) {\n return this;\n }\n if (!makeItUnique) {\n this._geometry.updateVerticesData(kind, data, updateExtends);\n }\n else {\n this.makeGeometryUnique();\n this.updateVerticesData(kind, data, updateExtends, false);\n }\n return this;\n }\n /**\n * This method updates the vertex positions of an updatable mesh according to the `positionFunction` returned values.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/dynamicMeshMorph#other-shapes-updatemeshpositions\n * @param positionFunction is a simple JS function what is passed the mesh `positions` array. It doesn't need to return anything\n * @param computeNormals is a boolean (default true) to enable/disable the mesh normal recomputation after the vertex position update\n * @returns the current mesh\n */\n updateMeshPositions(positionFunction, computeNormals = true) {\n const positions = this.getVerticesData(VertexBuffer.PositionKind);\n if (!positions) {\n return this;\n }\n positionFunction(positions);\n this.updateVerticesData(VertexBuffer.PositionKind, positions, false, false);\n if (computeNormals) {\n const indices = this.getIndices();\n const normals = this.getVerticesData(VertexBuffer.NormalKind);\n if (!normals) {\n return this;\n }\n VertexData.ComputeNormals(positions, indices, normals);\n this.updateVerticesData(VertexBuffer.NormalKind, normals, false, false);\n }\n return this;\n }\n /**\n * Creates a un-shared specific occurence of the geometry for the mesh.\n * @returns the current mesh\n */\n makeGeometryUnique() {\n if (!this._geometry) {\n return this;\n }\n if (this._geometry.meshes.length === 1) {\n return this;\n }\n const oldGeometry = this._geometry;\n const geometry = this._geometry.copy(Geometry.RandomId());\n oldGeometry.releaseForMesh(this, true);\n geometry.applyToMesh(this);\n return this;\n }\n /**\n * Set the index buffer of this mesh\n * @param indices defines the source data\n * @param totalVertices defines the total number of vertices referenced by this index data (can be null)\n * @param updatable defines if the updated index buffer must be flagged as updatable (default is false)\n * @returns the current mesh\n */\n setIndices(indices, totalVertices = null, updatable = false) {\n if (!this._geometry) {\n const vertexData = new VertexData();\n vertexData.indices = indices;\n const scene = this.getScene();\n new Geometry(Geometry.RandomId(), scene, vertexData, updatable, this);\n }\n else {\n this._geometry.setIndices(indices, totalVertices, updatable);\n }\n return this;\n }\n /**\n * Update the current index buffer\n * @param indices defines the source data\n * @param offset defines the offset in the index buffer where to store the new data (can be null)\n * @param gpuMemoryOnly defines a boolean indicating that only the GPU memory must be updated leaving the CPU version of the indices unchanged (false by default)\n * @returns the current mesh\n */\n updateIndices(indices, offset, gpuMemoryOnly = false) {\n if (!this._geometry) {\n return this;\n }\n this._geometry.updateIndices(indices, offset, gpuMemoryOnly);\n return this;\n }\n /**\n * Invert the geometry to move from a right handed system to a left handed one.\n * @returns the current mesh\n */\n toLeftHanded() {\n if (!this._geometry) {\n return this;\n }\n this._geometry.toLeftHanded();\n return this;\n }\n /**\n * @internal\n */\n _bind(subMesh, effect, fillMode, allowInstancedRendering = true) {\n if (!this._geometry) {\n return this;\n }\n const engine = this.getScene().getEngine();\n // Morph targets\n if (this.morphTargetManager && this.morphTargetManager.isUsingTextureForTargets) {\n this.morphTargetManager._bind(effect);\n }\n // Wireframe\n let indexToBind;\n if (this._unIndexed) {\n indexToBind = null;\n }\n else {\n switch (this._getRenderingFillMode(fillMode)) {\n case Material.PointFillMode:\n indexToBind = null;\n break;\n case Material.WireFrameFillMode:\n indexToBind = subMesh._getLinesIndexBuffer(this.getIndices(), engine);\n break;\n default:\n case Material.TriangleFillMode:\n indexToBind = this._geometry.getIndexBuffer();\n break;\n }\n }\n // VBOs\n if (!allowInstancedRendering || !this._userInstancedBuffersStorage || this.hasThinInstances) {\n this._geometry._bind(effect, indexToBind);\n }\n else {\n this._geometry._bind(effect, indexToBind, this._userInstancedBuffersStorage.vertexBuffers, this._userInstancedBuffersStorage.vertexArrayObjects);\n }\n return this;\n }\n /**\n * @internal\n */\n _draw(subMesh, fillMode, instancesCount) {\n if (!this._geometry || !this._geometry.getVertexBuffers() || (!this._unIndexed && !this._geometry.getIndexBuffer())) {\n return this;\n }\n if (this._internalMeshDataInfo._onBeforeDrawObservable) {\n this._internalMeshDataInfo._onBeforeDrawObservable.notifyObservers(this);\n }\n const scene = this.getScene();\n const engine = scene.getEngine();\n if (this._unIndexed || fillMode == Material.PointFillMode) {\n // or triangles as points\n engine.drawArraysType(fillMode, subMesh.verticesStart, subMesh.verticesCount, this.forcedInstanceCount || instancesCount);\n }\n else if (fillMode == Material.WireFrameFillMode) {\n // Triangles as wireframe\n engine.drawElementsType(fillMode, 0, subMesh._linesIndexCount, this.forcedInstanceCount || instancesCount);\n }\n else {\n engine.drawElementsType(fillMode, subMesh.indexStart, subMesh.indexCount, this.forcedInstanceCount || instancesCount);\n }\n return this;\n }\n /**\n * Registers for this mesh a javascript function called just before the rendering process\n * @param func defines the function to call before rendering this mesh\n * @returns the current mesh\n */\n registerBeforeRender(func) {\n this.onBeforeRenderObservable.add(func);\n return this;\n }\n /**\n * Disposes a previously registered javascript function called before the rendering\n * @param func defines the function to remove\n * @returns the current mesh\n */\n unregisterBeforeRender(func) {\n this.onBeforeRenderObservable.removeCallback(func);\n return this;\n }\n /**\n * Registers for this mesh a javascript function called just after the rendering is complete\n * @param func defines the function to call after rendering this mesh\n * @returns the current mesh\n */\n registerAfterRender(func) {\n this.onAfterRenderObservable.add(func);\n return this;\n }\n /**\n * Disposes a previously registered javascript function called after the rendering.\n * @param func defines the function to remove\n * @returns the current mesh\n */\n unregisterAfterRender(func) {\n this.onAfterRenderObservable.removeCallback(func);\n return this;\n }\n /**\n * @internal\n */\n _getInstancesRenderList(subMeshId, isReplacementMode = false) {\n if (this._instanceDataStorage.isFrozen) {\n if (isReplacementMode) {\n this._instanceDataStorage.batchCacheReplacementModeInFrozenMode.hardwareInstancedRendering[subMeshId] = false;\n this._instanceDataStorage.batchCacheReplacementModeInFrozenMode.renderSelf[subMeshId] = true;\n return this._instanceDataStorage.batchCacheReplacementModeInFrozenMode;\n }\n if (this._instanceDataStorage.previousBatch) {\n return this._instanceDataStorage.previousBatch;\n }\n }\n const scene = this.getScene();\n const isInIntermediateRendering = scene._isInIntermediateRendering();\n const onlyForInstances = isInIntermediateRendering\n ? this._internalAbstractMeshDataInfo._onlyForInstancesIntermediate\n : this._internalAbstractMeshDataInfo._onlyForInstances;\n const batchCache = this._instanceDataStorage.batchCache;\n batchCache.mustReturn = false;\n batchCache.renderSelf[subMeshId] = isReplacementMode || (!onlyForInstances && this.isEnabled() && this.isVisible);\n batchCache.visibleInstances[subMeshId] = null;\n if (this._instanceDataStorage.visibleInstances && !isReplacementMode) {\n const visibleInstances = this._instanceDataStorage.visibleInstances;\n const currentRenderId = scene.getRenderId();\n const defaultRenderId = isInIntermediateRendering ? visibleInstances.intermediateDefaultRenderId : visibleInstances.defaultRenderId;\n batchCache.visibleInstances[subMeshId] = visibleInstances[currentRenderId];\n if (!batchCache.visibleInstances[subMeshId] && defaultRenderId) {\n batchCache.visibleInstances[subMeshId] = visibleInstances[defaultRenderId];\n }\n }\n batchCache.hardwareInstancedRendering[subMeshId] =\n !isReplacementMode &&\n this._instanceDataStorage.hardwareInstancedRendering &&\n batchCache.visibleInstances[subMeshId] !== null &&\n batchCache.visibleInstances[subMeshId] !== undefined;\n this._instanceDataStorage.previousBatch = batchCache;\n return batchCache;\n }\n /**\n * @internal\n */\n _renderWithInstances(subMesh, fillMode, batch, effect, engine) {\n var _a;\n const visibleInstances = batch.visibleInstances[subMesh._id];\n const visibleInstanceCount = visibleInstances ? visibleInstances.length : 0;\n const instanceStorage = this._instanceDataStorage;\n const currentInstancesBufferSize = instanceStorage.instancesBufferSize;\n let instancesBuffer = instanceStorage.instancesBuffer;\n let instancesPreviousBuffer = instanceStorage.instancesPreviousBuffer;\n const matricesCount = visibleInstanceCount + 1;\n const bufferSize = matricesCount * 16 * 4;\n while (instanceStorage.instancesBufferSize < bufferSize) {\n instanceStorage.instancesBufferSize *= 2;\n }\n if (!instanceStorage.instancesData || currentInstancesBufferSize != instanceStorage.instancesBufferSize) {\n instanceStorage.instancesData = new Float32Array(instanceStorage.instancesBufferSize / 4);\n }\n if ((this._scene.needsPreviousWorldMatrices && !instanceStorage.instancesPreviousData) || currentInstancesBufferSize != instanceStorage.instancesBufferSize) {\n instanceStorage.instancesPreviousData = new Float32Array(instanceStorage.instancesBufferSize / 4);\n }\n let offset = 0;\n let instancesCount = 0;\n const renderSelf = batch.renderSelf[subMesh._id];\n const needUpdateBuffer = !instancesBuffer ||\n currentInstancesBufferSize !== instanceStorage.instancesBufferSize ||\n (this._scene.needsPreviousWorldMatrices && !instanceStorage.instancesPreviousBuffer);\n if (!this._instanceDataStorage.manualUpdate && (!instanceStorage.isFrozen || needUpdateBuffer)) {\n const world = this.getWorldMatrix();\n if (renderSelf) {\n if (this._scene.needsPreviousWorldMatrices) {\n if (!instanceStorage.masterMeshPreviousWorldMatrix) {\n instanceStorage.masterMeshPreviousWorldMatrix = world.clone();\n instanceStorage.masterMeshPreviousWorldMatrix.copyToArray(instanceStorage.instancesPreviousData, offset);\n }\n else {\n instanceStorage.masterMeshPreviousWorldMatrix.copyToArray(instanceStorage.instancesPreviousData, offset);\n instanceStorage.masterMeshPreviousWorldMatrix.copyFrom(world);\n }\n }\n world.copyToArray(instanceStorage.instancesData, offset);\n offset += 16;\n instancesCount++;\n }\n if (visibleInstances) {\n if (Mesh.INSTANCEDMESH_SORT_TRANSPARENT && this._scene.activeCamera && ((_a = subMesh.getMaterial()) === null || _a === void 0 ? void 0 : _a.needAlphaBlendingForMesh(subMesh.getRenderingMesh()))) {\n const cameraPosition = this._scene.activeCamera.globalPosition;\n for (let instanceIndex = 0; instanceIndex < visibleInstances.length; instanceIndex++) {\n const instanceMesh = visibleInstances[instanceIndex];\n instanceMesh._distanceToCamera = Vector3.Distance(instanceMesh.getBoundingInfo().boundingSphere.centerWorld, cameraPosition);\n }\n visibleInstances.sort((m1, m2) => {\n return m1._distanceToCamera > m2._distanceToCamera ? -1 : m1._distanceToCamera < m2._distanceToCamera ? 1 : 0;\n });\n }\n for (let instanceIndex = 0; instanceIndex < visibleInstances.length; instanceIndex++) {\n const instance = visibleInstances[instanceIndex];\n const matrix = instance.getWorldMatrix();\n matrix.copyToArray(instanceStorage.instancesData, offset);\n if (this._scene.needsPreviousWorldMatrices) {\n if (!instance._previousWorldMatrix) {\n instance._previousWorldMatrix = matrix.clone();\n instance._previousWorldMatrix.copyToArray(instanceStorage.instancesPreviousData, offset);\n }\n else {\n instance._previousWorldMatrix.copyToArray(instanceStorage.instancesPreviousData, offset);\n instance._previousWorldMatrix.copyFrom(matrix);\n }\n }\n offset += 16;\n instancesCount++;\n }\n }\n }\n else {\n instancesCount = (renderSelf ? 1 : 0) + visibleInstanceCount;\n }\n if (needUpdateBuffer) {\n if (instancesBuffer) {\n instancesBuffer.dispose();\n }\n if (instancesPreviousBuffer) {\n instancesPreviousBuffer.dispose();\n }\n instancesBuffer = new Buffer(engine, instanceStorage.instancesData, true, 16, false, true);\n instanceStorage.instancesBuffer = instancesBuffer;\n if (!this._userInstancedBuffersStorage) {\n this._userInstancedBuffersStorage = {\n data: {},\n vertexBuffers: {},\n strides: {},\n sizes: {},\n vertexArrayObjects: this.getEngine().getCaps().vertexArrayObject ? {} : undefined,\n };\n }\n this._userInstancedBuffersStorage.vertexBuffers[\"world0\"] = instancesBuffer.createVertexBuffer(\"world0\", 0, 4);\n this._userInstancedBuffersStorage.vertexBuffers[\"world1\"] = instancesBuffer.createVertexBuffer(\"world1\", 4, 4);\n this._userInstancedBuffersStorage.vertexBuffers[\"world2\"] = instancesBuffer.createVertexBuffer(\"world2\", 8, 4);\n this._userInstancedBuffersStorage.vertexBuffers[\"world3\"] = instancesBuffer.createVertexBuffer(\"world3\", 12, 4);\n if (this._scene.needsPreviousWorldMatrices) {\n instancesPreviousBuffer = new Buffer(engine, instanceStorage.instancesPreviousData, true, 16, false, true);\n instanceStorage.instancesPreviousBuffer = instancesPreviousBuffer;\n this._userInstancedBuffersStorage.vertexBuffers[\"previousWorld0\"] = instancesPreviousBuffer.createVertexBuffer(\"previousWorld0\", 0, 4);\n this._userInstancedBuffersStorage.vertexBuffers[\"previousWorld1\"] = instancesPreviousBuffer.createVertexBuffer(\"previousWorld1\", 4, 4);\n this._userInstancedBuffersStorage.vertexBuffers[\"previousWorld2\"] = instancesPreviousBuffer.createVertexBuffer(\"previousWorld2\", 8, 4);\n this._userInstancedBuffersStorage.vertexBuffers[\"previousWorld3\"] = instancesPreviousBuffer.createVertexBuffer(\"previousWorld3\", 12, 4);\n }\n this._invalidateInstanceVertexArrayObject();\n }\n else {\n if (!this._instanceDataStorage.isFrozen || this._instanceDataStorage.forceMatrixUpdates) {\n instancesBuffer.updateDirectly(instanceStorage.instancesData, 0, instancesCount);\n if (this._scene.needsPreviousWorldMatrices && (!this._instanceDataStorage.manualUpdate || this._instanceDataStorage.previousManualUpdate)) {\n instancesPreviousBuffer.updateDirectly(instanceStorage.instancesPreviousData, 0, instancesCount);\n }\n }\n }\n this._processInstancedBuffers(visibleInstances, renderSelf);\n // Stats\n this.getScene()._activeIndices.addCount(subMesh.indexCount * instancesCount, false);\n // Draw\n if (engine._currentDrawContext) {\n engine._currentDrawContext.useInstancing = true;\n }\n this._bind(subMesh, effect, fillMode);\n this._draw(subMesh, fillMode, instancesCount);\n // Write current matrices as previous matrices in case of manual update\n // Default behaviour when previous matrices are not specified explicitly\n // Will break if instances number/order changes\n if (this._scene.needsPreviousWorldMatrices &&\n !needUpdateBuffer &&\n this._instanceDataStorage.manualUpdate &&\n (!this._instanceDataStorage.isFrozen || this._instanceDataStorage.forceMatrixUpdates) &&\n !this._instanceDataStorage.previousManualUpdate) {\n instancesPreviousBuffer.updateDirectly(instanceStorage.instancesData, 0, instancesCount);\n }\n engine.unbindInstanceAttributes();\n return this;\n }\n /**\n * @internal\n */\n _renderWithThinInstances(subMesh, fillMode, effect, engine) {\n var _a, _b;\n // Stats\n const instancesCount = (_b = (_a = this._thinInstanceDataStorage) === null || _a === void 0 ? void 0 : _a.instancesCount) !== null && _b !== void 0 ? _b : 0;\n this.getScene()._activeIndices.addCount(subMesh.indexCount * instancesCount, false);\n // Draw\n if (engine._currentDrawContext) {\n engine._currentDrawContext.useInstancing = true;\n }\n this._bind(subMesh, effect, fillMode);\n this._draw(subMesh, fillMode, instancesCount);\n // Write current matrices as previous matrices\n // Default behaviour when previous matrices are not specified explicitly\n // Will break if instances number/order changes\n if (this._scene.needsPreviousWorldMatrices && !this._thinInstanceDataStorage.previousMatrixData && this._thinInstanceDataStorage.matrixData) {\n if (!this._thinInstanceDataStorage.previousMatrixBuffer) {\n this._thinInstanceDataStorage.previousMatrixBuffer = this._thinInstanceCreateMatrixBuffer(\"previousWorld\", this._thinInstanceDataStorage.matrixData, false);\n }\n else {\n this._thinInstanceDataStorage.previousMatrixBuffer.updateDirectly(this._thinInstanceDataStorage.matrixData, 0, instancesCount);\n }\n }\n engine.unbindInstanceAttributes();\n }\n /**\n * @internal\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _processInstancedBuffers(visibleInstances, renderSelf) {\n // Do nothing\n }\n /**\n * @internal\n */\n _processRendering(renderingMesh, subMesh, effect, fillMode, batch, hardwareInstancedRendering, onBeforeDraw, effectiveMaterial) {\n const scene = this.getScene();\n const engine = scene.getEngine();\n fillMode = this._getRenderingFillMode(fillMode);\n if (hardwareInstancedRendering && subMesh.getRenderingMesh().hasThinInstances) {\n this._renderWithThinInstances(subMesh, fillMode, effect, engine);\n return this;\n }\n if (hardwareInstancedRendering) {\n this._renderWithInstances(subMesh, fillMode, batch, effect, engine);\n }\n else {\n if (engine._currentDrawContext) {\n engine._currentDrawContext.useInstancing = false;\n }\n let instanceCount = 0;\n if (batch.renderSelf[subMesh._id]) {\n // Draw\n if (onBeforeDraw) {\n onBeforeDraw(false, renderingMesh.getWorldMatrix(), effectiveMaterial);\n }\n instanceCount++;\n this._draw(subMesh, fillMode, this._instanceDataStorage.overridenInstanceCount);\n }\n const visibleInstancesForSubMesh = batch.visibleInstances[subMesh._id];\n if (visibleInstancesForSubMesh) {\n const visibleInstanceCount = visibleInstancesForSubMesh.length;\n instanceCount += visibleInstanceCount;\n // Stats\n for (let instanceIndex = 0; instanceIndex < visibleInstanceCount; instanceIndex++) {\n const instance = visibleInstancesForSubMesh[instanceIndex];\n // World\n const world = instance.getWorldMatrix();\n if (onBeforeDraw) {\n onBeforeDraw(true, world, effectiveMaterial);\n }\n // Draw\n this._draw(subMesh, fillMode);\n }\n }\n // Stats\n scene._activeIndices.addCount(subMesh.indexCount * instanceCount, false);\n }\n return this;\n }\n /**\n * @internal\n */\n _rebuild(dispose = false) {\n if (this._instanceDataStorage.instancesBuffer) {\n // Dispose instance buffer to be recreated in _renderWithInstances when rendered\n if (dispose) {\n this._instanceDataStorage.instancesBuffer.dispose();\n }\n this._instanceDataStorage.instancesBuffer = null;\n }\n if (this._userInstancedBuffersStorage) {\n for (const kind in this._userInstancedBuffersStorage.vertexBuffers) {\n const buffer = this._userInstancedBuffersStorage.vertexBuffers[kind];\n if (buffer) {\n // Dispose instance buffer to be recreated in _renderWithInstances when rendered\n if (dispose) {\n buffer.dispose();\n }\n this._userInstancedBuffersStorage.vertexBuffers[kind] = null;\n }\n }\n if (this._userInstancedBuffersStorage.vertexArrayObjects) {\n this._userInstancedBuffersStorage.vertexArrayObjects = {};\n }\n }\n this._internalMeshDataInfo._effectiveMaterial = null;\n super._rebuild(dispose);\n }\n /** @internal */\n _freeze() {\n if (!this.subMeshes) {\n return;\n }\n // Prepare batches\n for (let index = 0; index < this.subMeshes.length; index++) {\n this._getInstancesRenderList(index);\n }\n this._internalMeshDataInfo._effectiveMaterial = null;\n this._instanceDataStorage.isFrozen = true;\n }\n /** @internal */\n _unFreeze() {\n this._instanceDataStorage.isFrozen = false;\n this._instanceDataStorage.previousBatch = null;\n }\n /**\n * Triggers the draw call for the mesh. Usually, you don't need to call this method by your own because the mesh rendering is handled by the scene rendering manager\n * @param subMesh defines the subMesh to render\n * @param enableAlphaMode defines if alpha mode can be changed\n * @param effectiveMeshReplacement defines an optional mesh used to provide info for the rendering\n * @returns the current mesh\n */\n render(subMesh, enableAlphaMode, effectiveMeshReplacement) {\n var _a, _b, _c, _d, _e;\n const scene = this.getScene();\n if (this._internalAbstractMeshDataInfo._isActiveIntermediate) {\n this._internalAbstractMeshDataInfo._isActiveIntermediate = false;\n }\n else {\n this._internalAbstractMeshDataInfo._isActive = false;\n }\n const numActiveCameras = (_b = (_a = scene.activeCameras) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;\n const canCheckOcclusionQuery = (numActiveCameras > 1 && scene.activeCamera === scene.activeCameras[0]) || numActiveCameras <= 1;\n if (canCheckOcclusionQuery && this._checkOcclusionQuery() && !this._occlusionDataStorage.forceRenderingWhenOccluded) {\n return this;\n }\n // Managing instances\n const batch = this._getInstancesRenderList(subMesh._id, !!effectiveMeshReplacement);\n if (batch.mustReturn) {\n return this;\n }\n // Checking geometry state\n if (!this._geometry || !this._geometry.getVertexBuffers() || (!this._unIndexed && !this._geometry.getIndexBuffer())) {\n return this;\n }\n const engine = scene.getEngine();\n let oldCameraMaxZ = 0;\n let oldCamera = null;\n if (this.ignoreCameraMaxZ && scene.activeCamera && !scene._isInIntermediateRendering()) {\n oldCameraMaxZ = scene.activeCamera.maxZ;\n oldCamera = scene.activeCamera;\n scene.activeCamera.maxZ = 0;\n scene.updateTransformMatrix(true);\n }\n if (this._internalMeshDataInfo._onBeforeRenderObservable) {\n this._internalMeshDataInfo._onBeforeRenderObservable.notifyObservers(this);\n }\n const renderingMesh = subMesh.getRenderingMesh();\n const hardwareInstancedRendering = batch.hardwareInstancedRendering[subMesh._id] ||\n renderingMesh.hasThinInstances ||\n (!!this._userInstancedBuffersStorage && !subMesh.getMesh()._internalAbstractMeshDataInfo._actAsRegularMesh);\n const instanceDataStorage = this._instanceDataStorage;\n const material = subMesh.getMaterial();\n if (!material) {\n if (oldCamera) {\n oldCamera.maxZ = oldCameraMaxZ;\n scene.updateTransformMatrix(true);\n }\n return this;\n }\n // Material\n if (!instanceDataStorage.isFrozen || !this._internalMeshDataInfo._effectiveMaterial || this._internalMeshDataInfo._effectiveMaterial !== material) {\n if (material._storeEffectOnSubMeshes) {\n if (!material.isReadyForSubMesh(this, subMesh, hardwareInstancedRendering)) {\n if (oldCamera) {\n oldCamera.maxZ = oldCameraMaxZ;\n scene.updateTransformMatrix(true);\n }\n return this;\n }\n }\n else if (!material.isReady(this, hardwareInstancedRendering)) {\n if (oldCamera) {\n oldCamera.maxZ = oldCameraMaxZ;\n scene.updateTransformMatrix(true);\n }\n return this;\n }\n this._internalMeshDataInfo._effectiveMaterial = material;\n }\n else if ((material._storeEffectOnSubMeshes && !((_c = subMesh.effect) === null || _c === void 0 ? void 0 : _c._wasPreviouslyReady)) ||\n (!material._storeEffectOnSubMeshes && !((_d = material.getEffect()) === null || _d === void 0 ? void 0 : _d._wasPreviouslyReady))) {\n if (oldCamera) {\n oldCamera.maxZ = oldCameraMaxZ;\n scene.updateTransformMatrix(true);\n }\n return this;\n }\n // Alpha mode\n if (enableAlphaMode) {\n engine.setAlphaMode(this._internalMeshDataInfo._effectiveMaterial.alphaMode);\n }\n let drawWrapper;\n if (this._internalMeshDataInfo._effectiveMaterial._storeEffectOnSubMeshes) {\n drawWrapper = subMesh._drawWrapper;\n }\n else {\n drawWrapper = this._internalMeshDataInfo._effectiveMaterial._getDrawWrapper();\n }\n const effect = (_e = drawWrapper === null || drawWrapper === void 0 ? void 0 : drawWrapper.effect) !== null && _e !== void 0 ? _e : null;\n for (const step of scene._beforeRenderingMeshStage) {\n step.action(this, subMesh, batch, effect);\n }\n if (!drawWrapper || !effect) {\n if (oldCamera) {\n oldCamera.maxZ = oldCameraMaxZ;\n scene.updateTransformMatrix(true);\n }\n return this;\n }\n const effectiveMesh = effectiveMeshReplacement || this;\n let sideOrientation;\n if (!instanceDataStorage.isFrozen && (this._internalMeshDataInfo._effectiveMaterial.backFaceCulling || this.overrideMaterialSideOrientation !== null)) {\n const mainDeterminant = effectiveMesh._getWorldMatrixDeterminant();\n sideOrientation = this.overrideMaterialSideOrientation;\n if (sideOrientation == null) {\n sideOrientation = this._internalMeshDataInfo._effectiveMaterial.sideOrientation;\n }\n if (mainDeterminant < 0) {\n sideOrientation = sideOrientation === Material.ClockWiseSideOrientation ? Material.CounterClockWiseSideOrientation : Material.ClockWiseSideOrientation;\n }\n instanceDataStorage.sideOrientation = sideOrientation;\n }\n else {\n sideOrientation = instanceDataStorage.sideOrientation;\n }\n const reverse = this._internalMeshDataInfo._effectiveMaterial._preBind(drawWrapper, sideOrientation);\n if (this._internalMeshDataInfo._effectiveMaterial.forceDepthWrite) {\n engine.setDepthWrite(true);\n }\n // Bind\n const effectiveMaterial = this._internalMeshDataInfo._effectiveMaterial;\n const fillMode = effectiveMaterial.fillMode;\n if (this._internalMeshDataInfo._onBeforeBindObservable) {\n this._internalMeshDataInfo._onBeforeBindObservable.notifyObservers(this);\n }\n if (!hardwareInstancedRendering) {\n // Binding will be done later because we need to add more info to the VB\n this._bind(subMesh, effect, fillMode, false);\n }\n const world = effectiveMesh.getWorldMatrix();\n if (effectiveMaterial._storeEffectOnSubMeshes) {\n effectiveMaterial.bindForSubMesh(world, this, subMesh);\n }\n else {\n effectiveMaterial.bind(world, this);\n }\n if (!effectiveMaterial.backFaceCulling && effectiveMaterial.separateCullingPass) {\n engine.setState(true, effectiveMaterial.zOffset, false, !reverse, effectiveMaterial.cullBackFaces, effectiveMaterial.stencil, effectiveMaterial.zOffsetUnits);\n this._processRendering(this, subMesh, effect, fillMode, batch, hardwareInstancedRendering, this._onBeforeDraw, this._internalMeshDataInfo._effectiveMaterial);\n engine.setState(true, effectiveMaterial.zOffset, false, reverse, effectiveMaterial.cullBackFaces, effectiveMaterial.stencil, effectiveMaterial.zOffsetUnits);\n if (this._internalMeshDataInfo._onBetweenPassObservable) {\n this._internalMeshDataInfo._onBetweenPassObservable.notifyObservers(subMesh);\n }\n }\n // Draw\n this._processRendering(this, subMesh, effect, fillMode, batch, hardwareInstancedRendering, this._onBeforeDraw, this._internalMeshDataInfo._effectiveMaterial);\n // Unbind\n this._internalMeshDataInfo._effectiveMaterial.unbind();\n for (const step of scene._afterRenderingMeshStage) {\n step.action(this, subMesh, batch, effect);\n }\n if (this._internalMeshDataInfo._onAfterRenderObservable) {\n this._internalMeshDataInfo._onAfterRenderObservable.notifyObservers(this);\n }\n if (oldCamera) {\n oldCamera.maxZ = oldCameraMaxZ;\n scene.updateTransformMatrix(true);\n }\n if (scene.performancePriority === ScenePerformancePriority.Aggressive && !instanceDataStorage.isFrozen) {\n this._freeze();\n }\n return this;\n }\n /**\n * Renormalize the mesh and patch it up if there are no weights\n * Similar to normalization by adding the weights compute the reciprocal and multiply all elements, this wil ensure that everything adds to 1.\n * However in the case of zero weights then we set just a single influence to 1.\n * We check in the function for extra's present and if so we use the normalizeSkinWeightsWithExtras rather than the FourWeights version.\n */\n cleanMatrixWeights() {\n if (this.isVerticesDataPresent(VertexBuffer.MatricesWeightsKind)) {\n if (this.isVerticesDataPresent(VertexBuffer.MatricesWeightsExtraKind)) {\n this._normalizeSkinWeightsAndExtra();\n }\n else {\n this._normalizeSkinFourWeights();\n }\n }\n }\n // faster 4 weight version.\n _normalizeSkinFourWeights() {\n const matricesWeights = this.getVerticesData(VertexBuffer.MatricesWeightsKind);\n const numWeights = matricesWeights.length;\n for (let a = 0; a < numWeights; a += 4) {\n // accumulate weights\n const t = matricesWeights[a] + matricesWeights[a + 1] + matricesWeights[a + 2] + matricesWeights[a + 3];\n // check for invalid weight and just set it to 1.\n if (t === 0) {\n matricesWeights[a] = 1;\n }\n else {\n // renormalize so everything adds to 1 use reciprocal\n const recip = 1 / t;\n matricesWeights[a] *= recip;\n matricesWeights[a + 1] *= recip;\n matricesWeights[a + 2] *= recip;\n matricesWeights[a + 3] *= recip;\n }\n }\n this.setVerticesData(VertexBuffer.MatricesWeightsKind, matricesWeights);\n }\n // handle special case of extra verts. (in theory gltf can handle 12 influences)\n _normalizeSkinWeightsAndExtra() {\n const matricesWeightsExtra = this.getVerticesData(VertexBuffer.MatricesWeightsExtraKind);\n const matricesWeights = this.getVerticesData(VertexBuffer.MatricesWeightsKind);\n const numWeights = matricesWeights.length;\n for (let a = 0; a < numWeights; a += 4) {\n // accumulate weights\n let t = matricesWeights[a] + matricesWeights[a + 1] + matricesWeights[a + 2] + matricesWeights[a + 3];\n t += matricesWeightsExtra[a] + matricesWeightsExtra[a + 1] + matricesWeightsExtra[a + 2] + matricesWeightsExtra[a + 3];\n // check for invalid weight and just set it to 1.\n if (t === 0) {\n matricesWeights[a] = 1;\n }\n else {\n // renormalize so everything adds to 1 use reciprocal\n const recip = 1 / t;\n matricesWeights[a] *= recip;\n matricesWeights[a + 1] *= recip;\n matricesWeights[a + 2] *= recip;\n matricesWeights[a + 3] *= recip;\n // same goes for extras\n matricesWeightsExtra[a] *= recip;\n matricesWeightsExtra[a + 1] *= recip;\n matricesWeightsExtra[a + 2] *= recip;\n matricesWeightsExtra[a + 3] *= recip;\n }\n }\n this.setVerticesData(VertexBuffer.MatricesWeightsKind, matricesWeights);\n this.setVerticesData(VertexBuffer.MatricesWeightsKind, matricesWeightsExtra);\n }\n /**\n * ValidateSkinning is used to determine that a mesh has valid skinning data along with skin metrics, if missing weights,\n * or not normalized it is returned as invalid mesh the string can be used for console logs, or on screen messages to let\n * the user know there was an issue with importing the mesh\n * @returns a validation object with skinned, valid and report string\n */\n validateSkinning() {\n const matricesWeightsExtra = this.getVerticesData(VertexBuffer.MatricesWeightsExtraKind);\n const matricesWeights = this.getVerticesData(VertexBuffer.MatricesWeightsKind);\n if (matricesWeights === null || this.skeleton == null) {\n return { skinned: false, valid: true, report: \"not skinned\" };\n }\n const numWeights = matricesWeights.length;\n let numberNotSorted = 0;\n let missingWeights = 0;\n let maxUsedWeights = 0;\n let numberNotNormalized = 0;\n const numInfluences = matricesWeightsExtra === null ? 4 : 8;\n const usedWeightCounts = new Array();\n for (let a = 0; a <= numInfluences; a++) {\n usedWeightCounts[a] = 0;\n }\n const toleranceEpsilon = 0.001;\n for (let a = 0; a < numWeights; a += 4) {\n let lastWeight = matricesWeights[a];\n let t = lastWeight;\n let usedWeights = t === 0 ? 0 : 1;\n for (let b = 1; b < numInfluences; b++) {\n const d = b < 4 ? matricesWeights[a + b] : matricesWeightsExtra[a + b - 4];\n if (d > lastWeight) {\n numberNotSorted++;\n }\n if (d !== 0) {\n usedWeights++;\n }\n t += d;\n lastWeight = d;\n }\n // count the buffer weights usage\n usedWeightCounts[usedWeights]++;\n // max influences\n if (usedWeights > maxUsedWeights) {\n maxUsedWeights = usedWeights;\n }\n // check for invalid weight and just set it to 1.\n if (t === 0) {\n missingWeights++;\n }\n else {\n // renormalize so everything adds to 1 use reciprocal\n const recip = 1 / t;\n let tolerance = 0;\n for (let b = 0; b < numInfluences; b++) {\n if (b < 4) {\n tolerance += Math.abs(matricesWeights[a + b] - matricesWeights[a + b] * recip);\n }\n else {\n tolerance += Math.abs(matricesWeightsExtra[a + b - 4] - matricesWeightsExtra[a + b - 4] * recip);\n }\n }\n // arbitrary epsilon value for dictating not normalized\n if (tolerance > toleranceEpsilon) {\n numberNotNormalized++;\n }\n }\n }\n // validate bone indices are in range of the skeleton\n const numBones = this.skeleton.bones.length;\n const matricesIndices = this.getVerticesData(VertexBuffer.MatricesIndicesKind);\n const matricesIndicesExtra = this.getVerticesData(VertexBuffer.MatricesIndicesExtraKind);\n let numBadBoneIndices = 0;\n for (let a = 0; a < numWeights; a += 4) {\n for (let b = 0; b < numInfluences; b++) {\n const index = b < 4 ? matricesIndices[a + b] : matricesIndicesExtra[a + b - 4];\n if (index >= numBones || index < 0) {\n numBadBoneIndices++;\n }\n }\n }\n // log mesh stats\n const output = \"Number of Weights = \" +\n numWeights / 4 +\n \"\\nMaximum influences = \" +\n maxUsedWeights +\n \"\\nMissing Weights = \" +\n missingWeights +\n \"\\nNot Sorted = \" +\n numberNotSorted +\n \"\\nNot Normalized = \" +\n numberNotNormalized +\n \"\\nWeightCounts = [\" +\n usedWeightCounts +\n \"]\" +\n \"\\nNumber of bones = \" +\n numBones +\n \"\\nBad Bone Indices = \" +\n numBadBoneIndices;\n return { skinned: true, valid: missingWeights === 0 && numberNotNormalized === 0 && numBadBoneIndices === 0, report: output };\n }\n /** @internal */\n _checkDelayState() {\n const scene = this.getScene();\n if (this._geometry) {\n this._geometry.load(scene);\n }\n else if (this.delayLoadState === 4) {\n this.delayLoadState = 2;\n this._queueLoad(scene);\n }\n return this;\n }\n _queueLoad(scene) {\n scene.addPendingData(this);\n const getBinaryData = this.delayLoadingFile.indexOf(\".babylonbinarymeshdata\") !== -1;\n Tools.LoadFile(this.delayLoadingFile, (data) => {\n if (data instanceof ArrayBuffer) {\n this._delayLoadingFunction(data, this);\n }\n else {\n this._delayLoadingFunction(JSON.parse(data), this);\n }\n this.instances.forEach((instance) => {\n instance.refreshBoundingInfo();\n instance._syncSubMeshes();\n });\n this.delayLoadState = 1;\n scene.removePendingData(this);\n }, () => { }, scene.offlineProvider, getBinaryData);\n return this;\n }\n /**\n * Returns `true` if the mesh is within the frustum defined by the passed array of planes.\n * A mesh is in the frustum if its bounding box intersects the frustum\n * @param frustumPlanes defines the frustum to test\n * @returns true if the mesh is in the frustum planes\n */\n isInFrustum(frustumPlanes) {\n if (this.delayLoadState === 2) {\n return false;\n }\n if (!super.isInFrustum(frustumPlanes)) {\n return false;\n }\n this._checkDelayState();\n return true;\n }\n /**\n * Sets the mesh material by the material or multiMaterial `id` property\n * @param id is a string identifying the material or the multiMaterial\n * @returns the current mesh\n */\n setMaterialById(id) {\n const materials = this.getScene().materials;\n let index;\n for (index = materials.length - 1; index > -1; index--) {\n if (materials[index].id === id) {\n this.material = materials[index];\n return this;\n }\n }\n // Multi\n const multiMaterials = this.getScene().multiMaterials;\n for (index = multiMaterials.length - 1; index > -1; index--) {\n if (multiMaterials[index].id === id) {\n this.material = multiMaterials[index];\n return this;\n }\n }\n return this;\n }\n /**\n * Returns as a new array populated with the mesh material and/or skeleton, if any.\n * @returns an array of IAnimatable\n */\n getAnimatables() {\n const results = new Array();\n if (this.material) {\n results.push(this.material);\n }\n if (this.skeleton) {\n results.push(this.skeleton);\n }\n return results;\n }\n /**\n * Modifies the mesh geometry according to the passed transformation matrix.\n * This method returns nothing, but it really modifies the mesh even if it's originally not set as updatable.\n * The mesh normals are modified using the same transformation.\n * Note that, under the hood, this method sets a new VertexBuffer each call.\n * @param transform defines the transform matrix to use\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/transforms/center_origin/bakingTransforms\n * @returns the current mesh\n */\n bakeTransformIntoVertices(transform) {\n // Position\n if (!this.isVerticesDataPresent(VertexBuffer.PositionKind)) {\n return this;\n }\n const submeshes = this.subMeshes.splice(0);\n this._resetPointsArrayCache();\n let data = this.getVerticesData(VertexBuffer.PositionKind);\n const temp = Vector3.Zero();\n let index;\n for (index = 0; index < data.length; index += 3) {\n Vector3.TransformCoordinatesFromFloatsToRef(data[index], data[index + 1], data[index + 2], transform, temp).toArray(data, index);\n }\n this.setVerticesData(VertexBuffer.PositionKind, data, this.getVertexBuffer(VertexBuffer.PositionKind).isUpdatable());\n // Normals\n if (this.isVerticesDataPresent(VertexBuffer.NormalKind)) {\n data = this.getVerticesData(VertexBuffer.NormalKind);\n for (index = 0; index < data.length; index += 3) {\n Vector3.TransformNormalFromFloatsToRef(data[index], data[index + 1], data[index + 2], transform, temp)\n .normalize()\n .toArray(data, index);\n }\n this.setVerticesData(VertexBuffer.NormalKind, data, this.getVertexBuffer(VertexBuffer.NormalKind).isUpdatable());\n }\n // flip faces?\n if (transform.determinant() < 0) {\n this.flipFaces();\n }\n // Restore submeshes\n this.releaseSubMeshes();\n this.subMeshes = submeshes;\n return this;\n }\n /**\n * Modifies the mesh geometry according to its own current World Matrix.\n * The mesh World Matrix is then reset.\n * This method returns nothing but really modifies the mesh even if it's originally not set as updatable.\n * Note that, under the hood, this method sets a new VertexBuffer each call.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/transforms/center_origin/bakingTransforms\n * @param bakeIndependentlyOfChildren indicates whether to preserve all child nodes' World Matrix during baking\n * @returns the current mesh\n */\n bakeCurrentTransformIntoVertices(bakeIndependentlyOfChildren = true) {\n this.bakeTransformIntoVertices(this.computeWorldMatrix(true));\n this.resetLocalMatrix(bakeIndependentlyOfChildren);\n return this;\n }\n // Cache\n /** @internal */\n get _positions() {\n if (this._internalAbstractMeshDataInfo._positions) {\n return this._internalAbstractMeshDataInfo._positions;\n }\n if (this._geometry) {\n return this._geometry._positions;\n }\n return null;\n }\n /** @internal */\n _resetPointsArrayCache() {\n if (this._geometry) {\n this._geometry._resetPointsArrayCache();\n }\n return this;\n }\n /** @internal */\n _generatePointsArray() {\n if (this._geometry) {\n return this._geometry._generatePointsArray();\n }\n return false;\n }\n /**\n * Returns a new Mesh object generated from the current mesh properties.\n * This method must not get confused with createInstance()\n * @param name is a string, the name given to the new mesh\n * @param newParent can be any Node object (default `null`)\n * @param doNotCloneChildren allows/denies the recursive cloning of the original mesh children if any (default `false`)\n * @param clonePhysicsImpostor allows/denies the cloning in the same time of the original mesh `body` used by the physics engine, if any (default `true`)\n * @returns a new mesh\n */\n clone(name = \"\", newParent = null, doNotCloneChildren, clonePhysicsImpostor = true) {\n return new Mesh(name, this.getScene(), newParent, this, doNotCloneChildren, clonePhysicsImpostor);\n }\n /**\n * Releases resources associated with this mesh.\n * @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)\n * @param disposeMaterialAndTextures Set to true to also dispose referenced materials and textures (false by default)\n */\n dispose(doNotRecurse, disposeMaterialAndTextures = false) {\n this.morphTargetManager = null;\n if (this._geometry) {\n this._geometry.releaseForMesh(this, true);\n }\n const internalDataInfo = this._internalMeshDataInfo;\n if (internalDataInfo._onBeforeDrawObservable) {\n internalDataInfo._onBeforeDrawObservable.clear();\n }\n if (internalDataInfo._onBeforeBindObservable) {\n internalDataInfo._onBeforeBindObservable.clear();\n }\n if (internalDataInfo._onBeforeRenderObservable) {\n internalDataInfo._onBeforeRenderObservable.clear();\n }\n if (internalDataInfo._onAfterRenderObservable) {\n internalDataInfo._onAfterRenderObservable.clear();\n }\n if (internalDataInfo._onBetweenPassObservable) {\n internalDataInfo._onBetweenPassObservable.clear();\n }\n // Sources\n if (this._scene.useClonedMeshMap) {\n if (internalDataInfo.meshMap) {\n for (const uniqueId in internalDataInfo.meshMap) {\n const mesh = internalDataInfo.meshMap[uniqueId];\n if (mesh) {\n mesh._internalMeshDataInfo._source = null;\n internalDataInfo.meshMap[uniqueId] = undefined;\n }\n }\n }\n if (internalDataInfo._source && internalDataInfo._source._internalMeshDataInfo.meshMap) {\n internalDataInfo._source._internalMeshDataInfo.meshMap[this.uniqueId] = undefined;\n }\n }\n else {\n const meshes = this.getScene().meshes;\n for (const abstractMesh of meshes) {\n const mesh = abstractMesh;\n if (mesh._internalMeshDataInfo && mesh._internalMeshDataInfo._source && mesh._internalMeshDataInfo._source === this) {\n mesh._internalMeshDataInfo._source = null;\n }\n }\n }\n internalDataInfo._source = null;\n this._instanceDataStorage.visibleInstances = {};\n // Instances\n this._disposeInstanceSpecificData();\n // Thin instances\n this._disposeThinInstanceSpecificData();\n if (this._internalMeshDataInfo._checkReadinessObserver) {\n this._scene.onBeforeRenderObservable.remove(this._internalMeshDataInfo._checkReadinessObserver);\n }\n super.dispose(doNotRecurse, disposeMaterialAndTextures);\n }\n /** @internal */\n _disposeInstanceSpecificData() {\n // Do nothing\n }\n /** @internal */\n _disposeThinInstanceSpecificData() {\n // Do nothing\n }\n /** @internal */\n _invalidateInstanceVertexArrayObject() {\n // Do nothing\n }\n /**\n * Modifies the mesh geometry according to a displacement map.\n * A displacement map is a colored image. Each pixel color value (actually a gradient computed from red, green, blue values) will give the displacement to apply to each mesh vertex.\n * The mesh must be set as updatable. Its internal geometry is directly modified, no new buffer are allocated.\n * @param url is a string, the URL from the image file is to be downloaded.\n * @param minHeight is the lower limit of the displacement.\n * @param maxHeight is the upper limit of the displacement.\n * @param onSuccess is an optional Javascript function to be called just after the mesh is modified. It is passed the modified mesh and must return nothing.\n * @param uvOffset is an optional vector2 used to offset UV.\n * @param uvScale is an optional vector2 used to scale UV.\n * @param forceUpdate defines whether or not to force an update of the generated buffers. This is useful to apply on a deserialized model for instance.\n * @returns the Mesh.\n */\n applyDisplacementMap(url, minHeight, maxHeight, onSuccess, uvOffset, uvScale, forceUpdate = false) {\n const scene = this.getScene();\n const onload = (img) => {\n // Getting height map data\n const heightMapWidth = img.width;\n const heightMapHeight = img.height;\n const canvas = this.getEngine().createCanvas(heightMapWidth, heightMapHeight);\n const context = canvas.getContext(\"2d\");\n context.drawImage(img, 0, 0);\n // Create VertexData from map data\n //Cast is due to wrong definition in lib.d.ts from ts 1.3 - https://github.com/Microsoft/TypeScript/issues/949\n const buffer = context.getImageData(0, 0, heightMapWidth, heightMapHeight).data;\n this.applyDisplacementMapFromBuffer(buffer, heightMapWidth, heightMapHeight, minHeight, maxHeight, uvOffset, uvScale, forceUpdate);\n //execute success callback, if set\n if (onSuccess) {\n onSuccess(this);\n }\n };\n Tools.LoadImage(url, onload, () => { }, scene.offlineProvider);\n return this;\n }\n /**\n * Modifies the mesh geometry according to a displacementMap buffer.\n * A displacement map is a colored image. Each pixel color value (actually a gradient computed from red, green, blue values) will give the displacement to apply to each mesh vertex.\n * The mesh must be set as updatable. Its internal geometry is directly modified, no new buffer are allocated.\n * @param buffer is a `Uint8Array` buffer containing series of `Uint8` lower than 255, the red, green, blue and alpha values of each successive pixel.\n * @param heightMapWidth is the width of the buffer image.\n * @param heightMapHeight is the height of the buffer image.\n * @param minHeight is the lower limit of the displacement.\n * @param maxHeight is the upper limit of the displacement.\n * @param uvOffset is an optional vector2 used to offset UV.\n * @param uvScale is an optional vector2 used to scale UV.\n * @param forceUpdate defines whether or not to force an update of the generated buffers. This is useful to apply on a deserialized model for instance.\n * @returns the Mesh.\n */\n applyDisplacementMapFromBuffer(buffer, heightMapWidth, heightMapHeight, minHeight, maxHeight, uvOffset, uvScale, forceUpdate = false) {\n if (!this.isVerticesDataPresent(VertexBuffer.PositionKind) || !this.isVerticesDataPresent(VertexBuffer.NormalKind) || !this.isVerticesDataPresent(VertexBuffer.UVKind)) {\n Logger.Warn(\"Cannot call applyDisplacementMap: Given mesh is not complete. Position, Normal or UV are missing\");\n return this;\n }\n const positions = this.getVerticesData(VertexBuffer.PositionKind, true, true);\n const normals = this.getVerticesData(VertexBuffer.NormalKind);\n const uvs = this.getVerticesData(VertexBuffer.UVKind);\n let position = Vector3.Zero();\n const normal = Vector3.Zero();\n const uv = Vector2.Zero();\n uvOffset = uvOffset || Vector2.Zero();\n uvScale = uvScale || new Vector2(1, 1);\n for (let index = 0; index < positions.length; index += 3) {\n Vector3.FromArrayToRef(positions, index, position);\n Vector3.FromArrayToRef(normals, index, normal);\n Vector2.FromArrayToRef(uvs, (index / 3) * 2, uv);\n // Compute height\n const u = (Math.abs(uv.x * uvScale.x + (uvOffset.x % 1)) * (heightMapWidth - 1)) % heightMapWidth | 0;\n const v = (Math.abs(uv.y * uvScale.y + (uvOffset.y % 1)) * (heightMapHeight - 1)) % heightMapHeight | 0;\n const pos = (u + v * heightMapWidth) * 4;\n const r = buffer[pos] / 255.0;\n const g = buffer[pos + 1] / 255.0;\n const b = buffer[pos + 2] / 255.0;\n const gradient = r * 0.3 + g * 0.59 + b * 0.11;\n normal.normalize();\n normal.scaleInPlace(minHeight + (maxHeight - minHeight) * gradient);\n position = position.add(normal);\n position.toArray(positions, index);\n }\n VertexData.ComputeNormals(positions, this.getIndices(), normals);\n if (forceUpdate) {\n this.setVerticesData(VertexBuffer.PositionKind, positions);\n this.setVerticesData(VertexBuffer.NormalKind, normals);\n this.setVerticesData(VertexBuffer.UVKind, uvs);\n }\n else {\n this.updateVerticesData(VertexBuffer.PositionKind, positions);\n this.updateVerticesData(VertexBuffer.NormalKind, normals);\n }\n return this;\n }\n _getFlattenedNormals(indices, positions) {\n const normals = new Float32Array(indices.length * 3);\n let normalsCount = 0;\n // Decide if normals should be flipped\n const flipNormalGeneration = this.overrideMaterialSideOrientation ===\n (this._scene.useRightHandedSystem ? 1 : 0);\n // Generate new normals\n for (let index = 0; index < indices.length; index += 3) {\n const p1 = Vector3.FromArray(positions, indices[index] * 3);\n const p2 = Vector3.FromArray(positions, indices[index + 1] * 3);\n const p3 = Vector3.FromArray(positions, indices[index + 2] * 3);\n const p1p2 = p1.subtract(p2);\n const p3p2 = p3.subtract(p2);\n const normal = Vector3.Normalize(Vector3.Cross(p1p2, p3p2));\n if (flipNormalGeneration) {\n normal.scaleInPlace(-1);\n }\n // Store same normals for every vertex\n for (let localIndex = 0; localIndex < 3; localIndex++) {\n normals[normalsCount++] = normal.x;\n normals[normalsCount++] = normal.y;\n normals[normalsCount++] = normal.z;\n }\n }\n return normals;\n }\n _convertToUnIndexedMesh(flattenNormals = false) {\n const kinds = this.getVerticesDataKinds();\n const indices = this.getIndices();\n const data = {};\n const separateVertices = (data, stride) => {\n const newData = new Float32Array(indices.length * stride);\n let count = 0;\n for (let index = 0; index < indices.length; index++) {\n for (let offset = 0; offset < stride; offset++) {\n newData[count++] = data[indices[index] * stride + offset];\n }\n }\n return newData;\n };\n // Save previous submeshes\n const previousSubmeshes = this.geometry ? this.subMeshes.slice(0) : [];\n // Cache vertex data\n for (const kind of kinds) {\n data[kind] = this.getVerticesData(kind);\n }\n // Update vertex data\n for (const kind of kinds) {\n const vertexBuffer = this.getVertexBuffer(kind);\n const stride = vertexBuffer.getStrideSize();\n if (flattenNormals && kind === VertexBuffer.NormalKind) {\n const normals = this._getFlattenedNormals(indices, data[VertexBuffer.PositionKind]);\n this.setVerticesData(VertexBuffer.NormalKind, normals, vertexBuffer.isUpdatable(), stride);\n }\n else {\n this.setVerticesData(kind, separateVertices(data[kind], stride), vertexBuffer.isUpdatable(), stride);\n }\n }\n // Update morph targets\n if (this.morphTargetManager) {\n for (let targetIndex = 0; targetIndex < this.morphTargetManager.numTargets; targetIndex++) {\n const target = this.morphTargetManager.getTarget(targetIndex);\n const positions = target.getPositions();\n target.setPositions(separateVertices(positions, 3));\n const normals = target.getNormals();\n if (normals) {\n target.setNormals(flattenNormals ? this._getFlattenedNormals(indices, positions) : separateVertices(normals, 3));\n }\n const tangents = target.getTangents();\n if (tangents) {\n target.setTangents(separateVertices(tangents, 3));\n }\n const uvs = target.getUVs();\n if (uvs) {\n target.setUVs(separateVertices(uvs, 2));\n }\n }\n this.morphTargetManager.synchronize();\n }\n // Update indices\n for (let index = 0; index < indices.length; index++) {\n indices[index] = index;\n }\n this.setIndices(indices);\n this._unIndexed = true;\n // Update submeshes\n this.releaseSubMeshes();\n for (const previousOne of previousSubmeshes) {\n SubMesh.AddToMesh(previousOne.materialIndex, previousOne.indexStart, previousOne.indexCount, previousOne.indexStart, previousOne.indexCount, this);\n }\n this.synchronizeInstances();\n return this;\n }\n /**\n * Modify the mesh to get a flat shading rendering.\n * This means each mesh facet will then have its own normals. Usually new vertices are added in the mesh geometry to get this result.\n * Warning : the mesh is really modified even if not set originally as updatable and, under the hood, a new VertexBuffer is allocated.\n * @returns current mesh\n */\n convertToFlatShadedMesh() {\n return this._convertToUnIndexedMesh(true);\n }\n /**\n * This method removes all the mesh indices and add new vertices (duplication) in order to unfold facets into buffers.\n * In other words, more vertices, no more indices and a single bigger VBO.\n * The mesh is really modified even if not set originally as updatable. Under the hood, a new VertexBuffer is allocated.\n * @returns current mesh\n */\n convertToUnIndexedMesh() {\n return this._convertToUnIndexedMesh();\n }\n /**\n * Inverses facet orientations.\n * Warning : the mesh is really modified even if not set originally as updatable. A new VertexBuffer is created under the hood each call.\n * @param flipNormals will also inverts the normals\n * @returns current mesh\n */\n flipFaces(flipNormals = false) {\n const vertex_data = VertexData.ExtractFromMesh(this);\n let i;\n if (flipNormals && this.isVerticesDataPresent(VertexBuffer.NormalKind) && vertex_data.normals) {\n for (i = 0; i < vertex_data.normals.length; i++) {\n vertex_data.normals[i] *= -1;\n }\n }\n if (vertex_data.indices) {\n let temp;\n for (i = 0; i < vertex_data.indices.length; i += 3) {\n // reassign indices\n temp = vertex_data.indices[i + 1];\n vertex_data.indices[i + 1] = vertex_data.indices[i + 2];\n vertex_data.indices[i + 2] = temp;\n }\n }\n vertex_data.applyToMesh(this, this.isVertexBufferUpdatable(VertexBuffer.PositionKind));\n return this;\n }\n /**\n * Increase the number of facets and hence vertices in a mesh\n * Vertex normals are interpolated from existing vertex normals\n * Warning : the mesh is really modified even if not set originally as updatable. A new VertexBuffer is created under the hood each call.\n * @param numberPerEdge the number of new vertices to add to each edge of a facet, optional default 1\n */\n increaseVertices(numberPerEdge = 1) {\n const vertex_data = VertexData.ExtractFromMesh(this);\n const currentIndices = vertex_data.indices && !Array.isArray(vertex_data.indices) && Array.from ? Array.from(vertex_data.indices) : vertex_data.indices;\n const positions = vertex_data.positions && !Array.isArray(vertex_data.positions) && Array.from ? Array.from(vertex_data.positions) : vertex_data.positions;\n const uvs = vertex_data.uvs && !Array.isArray(vertex_data.uvs) && Array.from ? Array.from(vertex_data.uvs) : vertex_data.uvs;\n const normals = vertex_data.normals && !Array.isArray(vertex_data.normals) && Array.from ? Array.from(vertex_data.normals) : vertex_data.normals;\n if (!currentIndices || !positions) {\n Logger.Warn(\"Couldn't increase number of vertices : VertexData must contain at least indices and positions\");\n }\n else {\n vertex_data.indices = currentIndices;\n vertex_data.positions = positions;\n if (uvs) {\n vertex_data.uvs = uvs;\n }\n if (normals) {\n vertex_data.normals = normals;\n }\n const segments = numberPerEdge + 1; //segments per current facet edge, become sides of new facets\n const tempIndices = new Array();\n for (let i = 0; i < segments + 1; i++) {\n tempIndices[i] = new Array();\n }\n let a; //vertex index of one end of a side\n let b; //vertex index of other end of the side\n const deltaPosition = new Vector3(0, 0, 0);\n const deltaNormal = new Vector3(0, 0, 0);\n const deltaUV = new Vector2(0, 0);\n const indices = new Array();\n const vertexIndex = new Array();\n const side = new Array();\n let len;\n let positionPtr = positions.length;\n let uvPtr;\n if (uvs) {\n uvPtr = uvs.length;\n }\n let normalsPtr;\n if (normals) {\n normalsPtr = normals.length;\n }\n for (let i = 0; i < currentIndices.length; i += 3) {\n vertexIndex[0] = currentIndices[i];\n vertexIndex[1] = currentIndices[i + 1];\n vertexIndex[2] = currentIndices[i + 2];\n for (let j = 0; j < 3; j++) {\n a = vertexIndex[j];\n b = vertexIndex[(j + 1) % 3];\n if (side[a] === undefined && side[b] === undefined) {\n side[a] = new Array();\n side[b] = new Array();\n }\n else {\n if (side[a] === undefined) {\n side[a] = new Array();\n }\n if (side[b] === undefined) {\n side[b] = new Array();\n }\n }\n if (side[a][b] === undefined && side[b][a] === undefined) {\n side[a][b] = [];\n deltaPosition.x = (positions[3 * b] - positions[3 * a]) / segments;\n deltaPosition.y = (positions[3 * b + 1] - positions[3 * a + 1]) / segments;\n deltaPosition.z = (positions[3 * b + 2] - positions[3 * a + 2]) / segments;\n if (normals) {\n deltaNormal.x = (normals[3 * b] - normals[3 * a]) / segments;\n deltaNormal.y = (normals[3 * b + 1] - normals[3 * a + 1]) / segments;\n deltaNormal.z = (normals[3 * b + 2] - normals[3 * a + 2]) / segments;\n }\n if (uvs) {\n deltaUV.x = (uvs[2 * b] - uvs[2 * a]) / segments;\n deltaUV.y = (uvs[2 * b + 1] - uvs[2 * a + 1]) / segments;\n }\n side[a][b].push(a);\n for (let k = 1; k < segments; k++) {\n side[a][b].push(positions.length / 3);\n positions[positionPtr++] = positions[3 * a] + k * deltaPosition.x;\n positions[positionPtr++] = positions[3 * a + 1] + k * deltaPosition.y;\n positions[positionPtr++] = positions[3 * a + 2] + k * deltaPosition.z;\n if (normals) {\n normals[normalsPtr++] = normals[3 * a] + k * deltaNormal.x;\n normals[normalsPtr++] = normals[3 * a + 1] + k * deltaNormal.y;\n normals[normalsPtr++] = normals[3 * a + 2] + k * deltaNormal.z;\n }\n if (uvs) {\n uvs[uvPtr++] = uvs[2 * a] + k * deltaUV.x;\n uvs[uvPtr++] = uvs[2 * a + 1] + k * deltaUV.y;\n }\n }\n side[a][b].push(b);\n side[b][a] = new Array();\n len = side[a][b].length;\n for (let idx = 0; idx < len; idx++) {\n side[b][a][idx] = side[a][b][len - 1 - idx];\n }\n }\n }\n //Calculate positions, normals and uvs of new internal vertices\n tempIndices[0][0] = currentIndices[i];\n tempIndices[1][0] = side[currentIndices[i]][currentIndices[i + 1]][1];\n tempIndices[1][1] = side[currentIndices[i]][currentIndices[i + 2]][1];\n for (let k = 2; k < segments; k++) {\n tempIndices[k][0] = side[currentIndices[i]][currentIndices[i + 1]][k];\n tempIndices[k][k] = side[currentIndices[i]][currentIndices[i + 2]][k];\n deltaPosition.x = (positions[3 * tempIndices[k][k]] - positions[3 * tempIndices[k][0]]) / k;\n deltaPosition.y = (positions[3 * tempIndices[k][k] + 1] - positions[3 * tempIndices[k][0] + 1]) / k;\n deltaPosition.z = (positions[3 * tempIndices[k][k] + 2] - positions[3 * tempIndices[k][0] + 2]) / k;\n if (normals) {\n deltaNormal.x = (normals[3 * tempIndices[k][k]] - normals[3 * tempIndices[k][0]]) / k;\n deltaNormal.y = (normals[3 * tempIndices[k][k] + 1] - normals[3 * tempIndices[k][0] + 1]) / k;\n deltaNormal.z = (normals[3 * tempIndices[k][k] + 2] - normals[3 * tempIndices[k][0] + 2]) / k;\n }\n if (uvs) {\n deltaUV.x = (uvs[2 * tempIndices[k][k]] - uvs[2 * tempIndices[k][0]]) / k;\n deltaUV.y = (uvs[2 * tempIndices[k][k] + 1] - uvs[2 * tempIndices[k][0] + 1]) / k;\n }\n for (let j = 1; j < k; j++) {\n tempIndices[k][j] = positions.length / 3;\n positions[positionPtr++] = positions[3 * tempIndices[k][0]] + j * deltaPosition.x;\n positions[positionPtr++] = positions[3 * tempIndices[k][0] + 1] + j * deltaPosition.y;\n positions[positionPtr++] = positions[3 * tempIndices[k][0] + 2] + j * deltaPosition.z;\n if (normals) {\n normals[normalsPtr++] = normals[3 * tempIndices[k][0]] + j * deltaNormal.x;\n normals[normalsPtr++] = normals[3 * tempIndices[k][0] + 1] + j * deltaNormal.y;\n normals[normalsPtr++] = normals[3 * tempIndices[k][0] + 2] + j * deltaNormal.z;\n }\n if (uvs) {\n uvs[uvPtr++] = uvs[2 * tempIndices[k][0]] + j * deltaUV.x;\n uvs[uvPtr++] = uvs[2 * tempIndices[k][0] + 1] + j * deltaUV.y;\n }\n }\n }\n tempIndices[segments] = side[currentIndices[i + 1]][currentIndices[i + 2]];\n // reform indices\n indices.push(tempIndices[0][0], tempIndices[1][0], tempIndices[1][1]);\n for (let k = 1; k < segments; k++) {\n let j;\n for (j = 0; j < k; j++) {\n indices.push(tempIndices[k][j], tempIndices[k + 1][j], tempIndices[k + 1][j + 1]);\n indices.push(tempIndices[k][j], tempIndices[k + 1][j + 1], tempIndices[k][j + 1]);\n }\n indices.push(tempIndices[k][j], tempIndices[k + 1][j], tempIndices[k + 1][j + 1]);\n }\n }\n vertex_data.indices = indices;\n vertex_data.applyToMesh(this, this.isVertexBufferUpdatable(VertexBuffer.PositionKind));\n }\n }\n /**\n * Force adjacent facets to share vertices and remove any facets that have all vertices in a line\n * This will undo any application of covertToFlatShadedMesh\n * Warning : the mesh is really modified even if not set originally as updatable. A new VertexBuffer is created under the hood each call.\n */\n forceSharedVertices() {\n const vertex_data = VertexData.ExtractFromMesh(this);\n const currentUVs = vertex_data.uvs;\n const currentIndices = vertex_data.indices;\n const currentPositions = vertex_data.positions;\n const currentColors = vertex_data.colors;\n const currentMatrixIndices = vertex_data.matricesIndices;\n const currentMatrixWeights = vertex_data.matricesWeights;\n const currentMatrixIndicesExtra = vertex_data.matricesIndicesExtra;\n const currentMatrixWeightsExtra = vertex_data.matricesWeightsExtra;\n if (currentIndices === void 0 || currentPositions === void 0 || currentIndices === null || currentPositions === null) {\n Logger.Warn(\"VertexData contains empty entries\");\n }\n else {\n const positions = new Array();\n const indices = new Array();\n const uvs = new Array();\n const colors = new Array();\n const matrixIndices = new Array();\n const matrixWeights = new Array();\n const matrixIndicesExtra = new Array();\n const matrixWeightsExtra = new Array();\n let pstring = new Array(); //lists facet vertex positions (a,b,c) as string \"a|b|c\"\n let indexPtr = 0; // pointer to next available index value\n const uniquePositions = {}; // unique vertex positions\n let ptr; // pointer to element in uniquePositions\n let facet;\n for (let i = 0; i < currentIndices.length; i += 3) {\n facet = [currentIndices[i], currentIndices[i + 1], currentIndices[i + 2]]; //facet vertex indices\n pstring = new Array();\n for (let j = 0; j < 3; j++) {\n pstring[j] = \"\";\n for (let k = 0; k < 3; k++) {\n //small values make 0\n if (Math.abs(currentPositions[3 * facet[j] + k]) < 0.00000001) {\n currentPositions[3 * facet[j] + k] = 0;\n }\n pstring[j] += currentPositions[3 * facet[j] + k] + \"|\";\n }\n }\n //check facet vertices to see that none are repeated\n // do not process any facet that has a repeated vertex, ie is a line\n if (!(pstring[0] == pstring[1] || pstring[0] == pstring[2] || pstring[1] == pstring[2])) {\n //for each facet position check if already listed in uniquePositions\n // if not listed add to uniquePositions and set index pointer\n // if listed use its index in uniquePositions and new index pointer\n for (let j = 0; j < 3; j++) {\n ptr = uniquePositions[pstring[j]];\n if (ptr === undefined) {\n uniquePositions[pstring[j]] = indexPtr;\n ptr = indexPtr++;\n //not listed so add individual x, y, z coordinates to positions\n for (let k = 0; k < 3; k++) {\n positions.push(currentPositions[3 * facet[j] + k]);\n }\n if (currentColors !== null && currentColors !== void 0) {\n for (let k = 0; k < 4; k++) {\n colors.push(currentColors[4 * facet[j] + k]);\n }\n }\n if (currentUVs !== null && currentUVs !== void 0) {\n for (let k = 0; k < 2; k++) {\n uvs.push(currentUVs[2 * facet[j] + k]);\n }\n }\n if (currentMatrixIndices !== null && currentMatrixIndices !== void 0) {\n for (let k = 0; k < 4; k++) {\n matrixIndices.push(currentMatrixIndices[4 * facet[j] + k]);\n }\n }\n if (currentMatrixWeights !== null && currentMatrixWeights !== void 0) {\n for (let k = 0; k < 4; k++) {\n matrixWeights.push(currentMatrixWeights[4 * facet[j] + k]);\n }\n }\n if (currentMatrixIndicesExtra !== null && currentMatrixIndicesExtra !== void 0) {\n for (let k = 0; k < 4; k++) {\n matrixIndicesExtra.push(currentMatrixIndicesExtra[4 * facet[j] + k]);\n }\n }\n if (currentMatrixWeightsExtra !== null && currentMatrixWeightsExtra !== void 0) {\n for (let k = 0; k < 4; k++) {\n matrixWeightsExtra.push(currentMatrixWeightsExtra[4 * facet[j] + k]);\n }\n }\n }\n // add new index pointer to indices array\n indices.push(ptr);\n }\n }\n }\n const normals = new Array();\n VertexData.ComputeNormals(positions, indices, normals);\n //create new vertex data object and update\n vertex_data.positions = positions;\n vertex_data.indices = indices;\n vertex_data.normals = normals;\n if (currentUVs !== null && currentUVs !== void 0) {\n vertex_data.uvs = uvs;\n }\n if (currentColors !== null && currentColors !== void 0) {\n vertex_data.colors = colors;\n }\n if (currentMatrixIndices !== null && currentMatrixIndices !== void 0) {\n vertex_data.matricesIndices = matrixIndices;\n }\n if (currentMatrixWeights !== null && currentMatrixWeights !== void 0) {\n vertex_data.matricesWeights = matrixWeights;\n }\n if (currentMatrixIndicesExtra !== null && currentMatrixIndicesExtra !== void 0) {\n vertex_data.matricesIndicesExtra = matrixIndicesExtra;\n }\n if (currentMatrixWeights !== null && currentMatrixWeights !== void 0) {\n vertex_data.matricesWeightsExtra = matrixWeightsExtra;\n }\n vertex_data.applyToMesh(this, this.isVertexBufferUpdatable(VertexBuffer.PositionKind));\n }\n }\n // Instances\n /**\n * @internal\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/naming-convention\n static _instancedMeshFactory(name, mesh) {\n throw _WarnImport(\"InstancedMesh\");\n }\n /**\n * @internal\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static _PhysicsImpostorParser(scene, physicObject, jsonObject) {\n throw _WarnImport(\"PhysicsImpostor\");\n }\n /**\n * Creates a new InstancedMesh object from the mesh model.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/copies/instances\n * @param name defines the name of the new instance\n * @returns a new InstancedMesh\n */\n createInstance(name) {\n return Mesh._instancedMeshFactory(name, this);\n }\n /**\n * Synchronises all the mesh instance submeshes to the current mesh submeshes, if any.\n * After this call, all the mesh instances have the same submeshes than the current mesh.\n * @returns the current mesh\n */\n synchronizeInstances() {\n for (let instanceIndex = 0; instanceIndex < this.instances.length; instanceIndex++) {\n const instance = this.instances[instanceIndex];\n instance._syncSubMeshes();\n }\n return this;\n }\n /**\n * Optimization of the mesh's indices, in case a mesh has duplicated vertices.\n * The function will only reorder the indices and will not remove unused vertices to avoid problems with submeshes.\n * This should be used together with the simplification to avoid disappearing triangles.\n * @param successCallback an optional success callback to be called after the optimization finished.\n * @returns the current mesh\n */\n optimizeIndices(successCallback) {\n const indices = this.getIndices();\n const positions = this.getVerticesData(VertexBuffer.PositionKind);\n if (!positions || !indices) {\n return this;\n }\n const vectorPositions = new Array();\n for (let pos = 0; pos < positions.length; pos = pos + 3) {\n vectorPositions.push(Vector3.FromArray(positions, pos));\n }\n const dupes = new Array();\n AsyncLoop.SyncAsyncForLoop(vectorPositions.length, 40, (iteration) => {\n const realPos = vectorPositions.length - 1 - iteration;\n const testedPosition = vectorPositions[realPos];\n for (let j = 0; j < realPos; ++j) {\n const againstPosition = vectorPositions[j];\n if (testedPosition.equals(againstPosition)) {\n dupes[realPos] = j;\n break;\n }\n }\n }, () => {\n for (let i = 0; i < indices.length; ++i) {\n indices[i] = dupes[indices[i]] || indices[i];\n }\n //indices are now reordered\n const originalSubMeshes = this.subMeshes.slice(0);\n this.setIndices(indices);\n this.subMeshes = originalSubMeshes;\n if (successCallback) {\n successCallback(this);\n }\n });\n return this;\n }\n /**\n * Serialize current mesh\n * @param serializationObject defines the object which will receive the serialization data\n */\n serialize(serializationObject = {}) {\n serializationObject.name = this.name;\n serializationObject.id = this.id;\n serializationObject.uniqueId = this.uniqueId;\n serializationObject.type = this.getClassName();\n if (Tags && Tags.HasTags(this)) {\n serializationObject.tags = Tags.GetTags(this);\n }\n serializationObject.position = this.position.asArray();\n if (this.rotationQuaternion) {\n serializationObject.rotationQuaternion = this.rotationQuaternion.asArray();\n }\n else if (this.rotation) {\n serializationObject.rotation = this.rotation.asArray();\n }\n serializationObject.scaling = this.scaling.asArray();\n if (this._postMultiplyPivotMatrix) {\n serializationObject.pivotMatrix = this.getPivotMatrix().asArray();\n }\n else {\n serializationObject.localMatrix = this.getPivotMatrix().asArray();\n }\n serializationObject.isEnabled = this.isEnabled(false);\n serializationObject.isVisible = this.isVisible;\n serializationObject.infiniteDistance = this.infiniteDistance;\n serializationObject.pickable = this.isPickable;\n serializationObject.receiveShadows = this.receiveShadows;\n serializationObject.billboardMode = this.billboardMode;\n serializationObject.visibility = this.visibility;\n serializationObject.checkCollisions = this.checkCollisions;\n serializationObject.isBlocker = this.isBlocker;\n serializationObject.overrideMaterialSideOrientation = this.overrideMaterialSideOrientation;\n // Parent\n if (this.parent) {\n this.parent._serializeAsParent(serializationObject);\n }\n // Geometry\n serializationObject.isUnIndexed = this.isUnIndexed;\n const geometry = this._geometry;\n if (geometry && this.subMeshes) {\n serializationObject.geometryUniqueId = geometry.uniqueId;\n serializationObject.geometryId = geometry.id;\n // SubMeshes\n serializationObject.subMeshes = [];\n for (let subIndex = 0; subIndex < this.subMeshes.length; subIndex++) {\n const subMesh = this.subMeshes[subIndex];\n serializationObject.subMeshes.push({\n materialIndex: subMesh.materialIndex,\n verticesStart: subMesh.verticesStart,\n verticesCount: subMesh.verticesCount,\n indexStart: subMesh.indexStart,\n indexCount: subMesh.indexCount,\n });\n }\n }\n // Material\n if (this.material) {\n if (!this.material.doNotSerialize) {\n serializationObject.materialUniqueId = this.material.uniqueId;\n serializationObject.materialId = this.material.id; // back compat\n }\n }\n else {\n this.material = null;\n serializationObject.materialUniqueId = this._scene.defaultMaterial.uniqueId;\n serializationObject.materialId = this._scene.defaultMaterial.id; // back compat\n }\n // Morph targets\n if (this.morphTargetManager) {\n serializationObject.morphTargetManagerId = this.morphTargetManager.uniqueId;\n }\n // Skeleton\n if (this.skeleton) {\n serializationObject.skeletonId = this.skeleton.id;\n serializationObject.numBoneInfluencers = this.numBoneInfluencers;\n }\n // Physics\n //TODO implement correct serialization for physics impostors.\n if (this.getScene()._getComponent(SceneComponentConstants.NAME_PHYSICSENGINE)) {\n const impostor = this.getPhysicsImpostor();\n if (impostor) {\n serializationObject.physicsMass = impostor.getParam(\"mass\");\n serializationObject.physicsFriction = impostor.getParam(\"friction\");\n serializationObject.physicsRestitution = impostor.getParam(\"mass\");\n serializationObject.physicsImpostor = impostor.type;\n }\n }\n // Metadata\n if (this.metadata) {\n serializationObject.metadata = this.metadata;\n }\n // Instances\n serializationObject.instances = [];\n for (let index = 0; index < this.instances.length; index++) {\n const instance = this.instances[index];\n if (instance.doNotSerialize) {\n continue;\n }\n const serializationInstance = {\n name: instance.name,\n id: instance.id,\n isEnabled: instance.isEnabled(false),\n isVisible: instance.isVisible,\n isPickable: instance.isPickable,\n checkCollisions: instance.checkCollisions,\n position: instance.position.asArray(),\n scaling: instance.scaling.asArray(),\n };\n if (instance.parent) {\n instance.parent._serializeAsParent(serializationInstance);\n }\n if (instance.rotationQuaternion) {\n serializationInstance.rotationQuaternion = instance.rotationQuaternion.asArray();\n }\n else if (instance.rotation) {\n serializationInstance.rotation = instance.rotation.asArray();\n }\n // Physics\n //TODO implement correct serialization for physics impostors.\n if (this.getScene()._getComponent(SceneComponentConstants.NAME_PHYSICSENGINE)) {\n const impostor = instance.getPhysicsImpostor();\n if (impostor) {\n serializationInstance.physicsMass = impostor.getParam(\"mass\");\n serializationInstance.physicsFriction = impostor.getParam(\"friction\");\n serializationInstance.physicsRestitution = impostor.getParam(\"mass\");\n serializationInstance.physicsImpostor = impostor.type;\n }\n }\n // Metadata\n if (instance.metadata) {\n serializationInstance.metadata = instance.metadata;\n }\n // Action Manager\n if (instance.actionManager) {\n serializationInstance.actions = instance.actionManager.serialize(instance.name);\n }\n serializationObject.instances.push(serializationInstance);\n // Animations\n SerializationHelper.AppendSerializedAnimations(instance, serializationInstance);\n serializationInstance.ranges = instance.serializeAnimationRanges();\n }\n // Thin instances\n if (this._thinInstanceDataStorage.instancesCount && this._thinInstanceDataStorage.matrixData) {\n serializationObject.thinInstances = {\n instancesCount: this._thinInstanceDataStorage.instancesCount,\n matrixData: Array.from(this._thinInstanceDataStorage.matrixData),\n matrixBufferSize: this._thinInstanceDataStorage.matrixBufferSize,\n enablePicking: this.thinInstanceEnablePicking,\n };\n if (this._userThinInstanceBuffersStorage) {\n const userThinInstance = {\n data: {},\n sizes: {},\n strides: {},\n };\n for (const kind in this._userThinInstanceBuffersStorage.data) {\n userThinInstance.data[kind] = Array.from(this._userThinInstanceBuffersStorage.data[kind]);\n userThinInstance.sizes[kind] = this._userThinInstanceBuffersStorage.sizes[kind];\n userThinInstance.strides[kind] = this._userThinInstanceBuffersStorage.strides[kind];\n }\n serializationObject.thinInstances.userThinInstance = userThinInstance;\n }\n }\n // Animations\n SerializationHelper.AppendSerializedAnimations(this, serializationObject);\n serializationObject.ranges = this.serializeAnimationRanges();\n // Layer mask\n serializationObject.layerMask = this.layerMask;\n // Alpha\n serializationObject.alphaIndex = this.alphaIndex;\n serializationObject.hasVertexAlpha = this.hasVertexAlpha;\n // Overlay\n serializationObject.overlayAlpha = this.overlayAlpha;\n serializationObject.overlayColor = this.overlayColor.asArray();\n serializationObject.renderOverlay = this.renderOverlay;\n // Fog\n serializationObject.applyFog = this.applyFog;\n // Action Manager\n if (this.actionManager) {\n serializationObject.actions = this.actionManager.serialize(this.name);\n }\n return serializationObject;\n }\n /** @internal */\n _syncGeometryWithMorphTargetManager() {\n if (!this.geometry) {\n return;\n }\n this._markSubMeshesAsAttributesDirty();\n const morphTargetManager = this._internalAbstractMeshDataInfo._morphTargetManager;\n if (morphTargetManager && morphTargetManager.vertexCount) {\n if (morphTargetManager.vertexCount !== this.getTotalVertices()) {\n Logger.Error(\"Mesh is incompatible with morph targets. Targets and mesh must all have the same vertices count.\");\n this.morphTargetManager = null;\n return;\n }\n if (morphTargetManager.isUsingTextureForTargets) {\n return;\n }\n for (let index = 0; index < morphTargetManager.numInfluencers; index++) {\n const morphTarget = morphTargetManager.getActiveTarget(index);\n const positions = morphTarget.getPositions();\n if (!positions) {\n Logger.Error(\"Invalid morph target. Target must have positions.\");\n return;\n }\n this.geometry.setVerticesData(VertexBuffer.PositionKind + index, positions, false, 3);\n const normals = morphTarget.getNormals();\n if (normals) {\n this.geometry.setVerticesData(VertexBuffer.NormalKind + index, normals, false, 3);\n }\n const tangents = morphTarget.getTangents();\n if (tangents) {\n this.geometry.setVerticesData(VertexBuffer.TangentKind + index, tangents, false, 3);\n }\n const uvs = morphTarget.getUVs();\n if (uvs) {\n this.geometry.setVerticesData(VertexBuffer.UVKind + \"_\" + index, uvs, false, 2);\n }\n }\n }\n else {\n let index = 0;\n // Positions\n while (this.geometry.isVerticesDataPresent(VertexBuffer.PositionKind + index)) {\n this.geometry.removeVerticesData(VertexBuffer.PositionKind + index);\n if (this.geometry.isVerticesDataPresent(VertexBuffer.NormalKind + index)) {\n this.geometry.removeVerticesData(VertexBuffer.NormalKind + index);\n }\n if (this.geometry.isVerticesDataPresent(VertexBuffer.TangentKind + index)) {\n this.geometry.removeVerticesData(VertexBuffer.TangentKind + index);\n }\n if (this.geometry.isVerticesDataPresent(VertexBuffer.UVKind + index)) {\n this.geometry.removeVerticesData(VertexBuffer.UVKind + \"_\" + index);\n }\n index++;\n }\n }\n }\n /**\n * Returns a new Mesh object parsed from the source provided.\n * @param parsedMesh is the source\n * @param scene defines the hosting scene\n * @param rootUrl is the root URL to prefix the `delayLoadingFile` property with\n * @returns a new Mesh\n */\n static Parse(parsedMesh, scene, rootUrl) {\n let mesh;\n if (parsedMesh.type && parsedMesh.type === \"LinesMesh\") {\n mesh = Mesh._LinesMeshParser(parsedMesh, scene);\n }\n else if (parsedMesh.type && parsedMesh.type === \"GroundMesh\") {\n mesh = Mesh._GroundMeshParser(parsedMesh, scene);\n }\n else if (parsedMesh.type && parsedMesh.type === \"GoldbergMesh\") {\n mesh = Mesh._GoldbergMeshParser(parsedMesh, scene);\n }\n else if (parsedMesh.type && parsedMesh.type === \"GreasedLineMesh\") {\n mesh = Mesh._GreasedLineMeshParser(parsedMesh, scene);\n }\n else if (parsedMesh.type && parsedMesh.type === \"TrailMesh\") {\n mesh = Mesh._TrailMeshParser(parsedMesh, scene);\n }\n else {\n mesh = new Mesh(parsedMesh.name, scene);\n }\n mesh.id = parsedMesh.id;\n mesh._waitingParsedUniqueId = parsedMesh.uniqueId;\n if (Tags) {\n Tags.AddTagsTo(mesh, parsedMesh.tags);\n }\n mesh.position = Vector3.FromArray(parsedMesh.position);\n if (parsedMesh.metadata !== undefined) {\n mesh.metadata = parsedMesh.metadata;\n }\n if (parsedMesh.rotationQuaternion) {\n mesh.rotationQuaternion = Quaternion.FromArray(parsedMesh.rotationQuaternion);\n }\n else if (parsedMesh.rotation) {\n mesh.rotation = Vector3.FromArray(parsedMesh.rotation);\n }\n mesh.scaling = Vector3.FromArray(parsedMesh.scaling);\n if (parsedMesh.localMatrix) {\n mesh.setPreTransformMatrix(Matrix.FromArray(parsedMesh.localMatrix));\n }\n else if (parsedMesh.pivotMatrix) {\n mesh.setPivotMatrix(Matrix.FromArray(parsedMesh.pivotMatrix));\n }\n mesh.setEnabled(parsedMesh.isEnabled);\n mesh.isVisible = parsedMesh.isVisible;\n mesh.infiniteDistance = parsedMesh.infiniteDistance;\n mesh.showBoundingBox = parsedMesh.showBoundingBox;\n mesh.showSubMeshesBoundingBox = parsedMesh.showSubMeshesBoundingBox;\n if (parsedMesh.applyFog !== undefined) {\n mesh.applyFog = parsedMesh.applyFog;\n }\n if (parsedMesh.pickable !== undefined) {\n mesh.isPickable = parsedMesh.pickable;\n }\n if (parsedMesh.alphaIndex !== undefined) {\n mesh.alphaIndex = parsedMesh.alphaIndex;\n }\n mesh.receiveShadows = parsedMesh.receiveShadows;\n if (parsedMesh.billboardMode !== undefined) {\n mesh.billboardMode = parsedMesh.billboardMode;\n }\n if (parsedMesh.visibility !== undefined) {\n mesh.visibility = parsedMesh.visibility;\n }\n mesh.checkCollisions = parsedMesh.checkCollisions;\n mesh.overrideMaterialSideOrientation = parsedMesh.overrideMaterialSideOrientation;\n if (parsedMesh.isBlocker !== undefined) {\n mesh.isBlocker = parsedMesh.isBlocker;\n }\n mesh._shouldGenerateFlatShading = parsedMesh.useFlatShading;\n // freezeWorldMatrix\n if (parsedMesh.freezeWorldMatrix) {\n mesh._waitingData.freezeWorldMatrix = parsedMesh.freezeWorldMatrix;\n }\n // Parent\n if (parsedMesh.parentId !== undefined) {\n mesh._waitingParentId = parsedMesh.parentId;\n }\n if (parsedMesh.parentInstanceIndex !== undefined) {\n mesh._waitingParentInstanceIndex = parsedMesh.parentInstanceIndex;\n }\n // Actions\n if (parsedMesh.actions !== undefined) {\n mesh._waitingData.actions = parsedMesh.actions;\n }\n // Overlay\n if (parsedMesh.overlayAlpha !== undefined) {\n mesh.overlayAlpha = parsedMesh.overlayAlpha;\n }\n if (parsedMesh.overlayColor !== undefined) {\n mesh.overlayColor = Color3.FromArray(parsedMesh.overlayColor);\n }\n if (parsedMesh.renderOverlay !== undefined) {\n mesh.renderOverlay = parsedMesh.renderOverlay;\n }\n // Geometry\n mesh.isUnIndexed = !!parsedMesh.isUnIndexed;\n mesh.hasVertexAlpha = parsedMesh.hasVertexAlpha;\n if (parsedMesh.delayLoadingFile) {\n mesh.delayLoadState = 4;\n mesh.delayLoadingFile = rootUrl + parsedMesh.delayLoadingFile;\n mesh.buildBoundingInfo(Vector3.FromArray(parsedMesh.boundingBoxMinimum), Vector3.FromArray(parsedMesh.boundingBoxMaximum));\n if (parsedMesh._binaryInfo) {\n mesh._binaryInfo = parsedMesh._binaryInfo;\n }\n mesh._delayInfo = [];\n if (parsedMesh.hasUVs) {\n mesh._delayInfo.push(VertexBuffer.UVKind);\n }\n if (parsedMesh.hasUVs2) {\n mesh._delayInfo.push(VertexBuffer.UV2Kind);\n }\n if (parsedMesh.hasUVs3) {\n mesh._delayInfo.push(VertexBuffer.UV3Kind);\n }\n if (parsedMesh.hasUVs4) {\n mesh._delayInfo.push(VertexBuffer.UV4Kind);\n }\n if (parsedMesh.hasUVs5) {\n mesh._delayInfo.push(VertexBuffer.UV5Kind);\n }\n if (parsedMesh.hasUVs6) {\n mesh._delayInfo.push(VertexBuffer.UV6Kind);\n }\n if (parsedMesh.hasColors) {\n mesh._delayInfo.push(VertexBuffer.ColorKind);\n }\n if (parsedMesh.hasMatricesIndices) {\n mesh._delayInfo.push(VertexBuffer.MatricesIndicesKind);\n }\n if (parsedMesh.hasMatricesWeights) {\n mesh._delayInfo.push(VertexBuffer.MatricesWeightsKind);\n }\n mesh._delayLoadingFunction = Geometry._ImportGeometry;\n if (SceneLoaderFlags.ForceFullSceneLoadingForIncremental) {\n mesh._checkDelayState();\n }\n }\n else {\n Geometry._ImportGeometry(parsedMesh, mesh);\n }\n // Material\n if (parsedMesh.materialUniqueId) {\n mesh._waitingMaterialId = parsedMesh.materialUniqueId;\n }\n else if (parsedMesh.materialId) {\n mesh._waitingMaterialId = parsedMesh.materialId;\n }\n // Morph targets\n if (parsedMesh.morphTargetManagerId > -1) {\n mesh.morphTargetManager = scene.getMorphTargetManagerById(parsedMesh.morphTargetManagerId);\n }\n // Skeleton\n if (parsedMesh.skeletonId !== undefined && parsedMesh.skeletonId !== null) {\n mesh.skeleton = scene.getLastSkeletonById(parsedMesh.skeletonId);\n if (parsedMesh.numBoneInfluencers) {\n mesh.numBoneInfluencers = parsedMesh.numBoneInfluencers;\n }\n }\n // Animations\n if (parsedMesh.animations) {\n for (let animationIndex = 0; animationIndex < parsedMesh.animations.length; animationIndex++) {\n const parsedAnimation = parsedMesh.animations[animationIndex];\n const internalClass = GetClass(\"BABYLON.Animation\");\n if (internalClass) {\n mesh.animations.push(internalClass.Parse(parsedAnimation));\n }\n }\n Node.ParseAnimationRanges(mesh, parsedMesh, scene);\n }\n if (parsedMesh.autoAnimate) {\n scene.beginAnimation(mesh, parsedMesh.autoAnimateFrom, parsedMesh.autoAnimateTo, parsedMesh.autoAnimateLoop, parsedMesh.autoAnimateSpeed || 1.0);\n }\n // Layer Mask\n if (parsedMesh.layerMask && !isNaN(parsedMesh.layerMask)) {\n mesh.layerMask = Math.abs(parseInt(parsedMesh.layerMask));\n }\n else {\n mesh.layerMask = 0x0fffffff;\n }\n // Physics\n if (parsedMesh.physicsImpostor) {\n Mesh._PhysicsImpostorParser(scene, mesh, parsedMesh);\n }\n // Levels\n if (parsedMesh.lodMeshIds) {\n mesh._waitingData.lods = {\n ids: parsedMesh.lodMeshIds,\n distances: parsedMesh.lodDistances ? parsedMesh.lodDistances : null,\n coverages: parsedMesh.lodCoverages ? parsedMesh.lodCoverages : null,\n };\n }\n // Instances\n if (parsedMesh.instances) {\n for (let index = 0; index < parsedMesh.instances.length; index++) {\n const parsedInstance = parsedMesh.instances[index];\n const instance = mesh.createInstance(parsedInstance.name);\n if (parsedInstance.id) {\n instance.id = parsedInstance.id;\n }\n if (Tags) {\n if (parsedInstance.tags) {\n Tags.AddTagsTo(instance, parsedInstance.tags);\n }\n else {\n Tags.AddTagsTo(instance, parsedMesh.tags);\n }\n }\n instance.position = Vector3.FromArray(parsedInstance.position);\n if (parsedInstance.metadata !== undefined) {\n instance.metadata = parsedInstance.metadata;\n }\n if (parsedInstance.parentId !== undefined) {\n instance._waitingParentId = parsedInstance.parentId;\n }\n if (parsedInstance.parentInstanceIndex !== undefined) {\n instance._waitingParentInstanceIndex = parsedInstance.parentInstanceIndex;\n }\n if (parsedInstance.isEnabled !== undefined && parsedInstance.isEnabled !== null) {\n instance.setEnabled(parsedInstance.isEnabled);\n }\n if (parsedInstance.isVisible !== undefined && parsedInstance.isVisible !== null) {\n instance.isVisible = parsedInstance.isVisible;\n }\n if (parsedInstance.isPickable !== undefined && parsedInstance.isPickable !== null) {\n instance.isPickable = parsedInstance.isPickable;\n }\n if (parsedInstance.rotationQuaternion) {\n instance.rotationQuaternion = Quaternion.FromArray(parsedInstance.rotationQuaternion);\n }\n else if (parsedInstance.rotation) {\n instance.rotation = Vector3.FromArray(parsedInstance.rotation);\n }\n instance.scaling = Vector3.FromArray(parsedInstance.scaling);\n if (parsedInstance.checkCollisions != undefined && parsedInstance.checkCollisions != null) {\n instance.checkCollisions = parsedInstance.checkCollisions;\n }\n if (parsedInstance.pickable != undefined && parsedInstance.pickable != null) {\n instance.isPickable = parsedInstance.pickable;\n }\n if (parsedInstance.showBoundingBox != undefined && parsedInstance.showBoundingBox != null) {\n instance.showBoundingBox = parsedInstance.showBoundingBox;\n }\n if (parsedInstance.showSubMeshesBoundingBox != undefined && parsedInstance.showSubMeshesBoundingBox != null) {\n instance.showSubMeshesBoundingBox = parsedInstance.showSubMeshesBoundingBox;\n }\n if (parsedInstance.alphaIndex != undefined && parsedInstance.showSubMeshesBoundingBox != null) {\n instance.alphaIndex = parsedInstance.alphaIndex;\n }\n // Physics\n if (parsedInstance.physicsImpostor) {\n Mesh._PhysicsImpostorParser(scene, instance, parsedInstance);\n }\n // Actions\n if (parsedInstance.actions !== undefined) {\n instance._waitingData.actions = parsedInstance.actions;\n }\n // Animation\n if (parsedInstance.animations) {\n for (let animationIndex = 0; animationIndex < parsedInstance.animations.length; animationIndex++) {\n const parsedAnimation = parsedInstance.animations[animationIndex];\n const internalClass = GetClass(\"BABYLON.Animation\");\n if (internalClass) {\n instance.animations.push(internalClass.Parse(parsedAnimation));\n }\n }\n Node.ParseAnimationRanges(instance, parsedInstance, scene);\n if (parsedInstance.autoAnimate) {\n scene.beginAnimation(instance, parsedInstance.autoAnimateFrom, parsedInstance.autoAnimateTo, parsedInstance.autoAnimateLoop, parsedInstance.autoAnimateSpeed || 1.0);\n }\n }\n }\n }\n // Thin instances\n if (parsedMesh.thinInstances) {\n const thinInstances = parsedMesh.thinInstances;\n mesh.thinInstanceEnablePicking = !!thinInstances.enablePicking;\n if (thinInstances.matrixData) {\n mesh.thinInstanceSetBuffer(\"matrix\", new Float32Array(thinInstances.matrixData), 16, false);\n mesh._thinInstanceDataStorage.matrixBufferSize = thinInstances.matrixBufferSize;\n mesh._thinInstanceDataStorage.instancesCount = thinInstances.instancesCount;\n }\n else {\n mesh._thinInstanceDataStorage.matrixBufferSize = thinInstances.matrixBufferSize;\n }\n if (parsedMesh.thinInstances.userThinInstance) {\n const userThinInstance = parsedMesh.thinInstances.userThinInstance;\n for (const kind in userThinInstance.data) {\n mesh.thinInstanceSetBuffer(kind, new Float32Array(userThinInstance.data[kind]), userThinInstance.strides[kind], false);\n mesh._userThinInstanceBuffersStorage.sizes[kind] = userThinInstance.sizes[kind];\n }\n }\n }\n return mesh;\n }\n // Skeletons\n /**\n * Prepare internal position array for software CPU skinning\n * @returns original positions used for CPU skinning. Useful for integrating Morphing with skeletons in same mesh\n */\n setPositionsForCPUSkinning() {\n const internalDataInfo = this._internalMeshDataInfo;\n if (!internalDataInfo._sourcePositions) {\n const source = this.getVerticesData(VertexBuffer.PositionKind);\n if (!source) {\n return internalDataInfo._sourcePositions;\n }\n internalDataInfo._sourcePositions = new Float32Array(source);\n if (!this.isVertexBufferUpdatable(VertexBuffer.PositionKind)) {\n this.setVerticesData(VertexBuffer.PositionKind, source, true);\n }\n }\n return internalDataInfo._sourcePositions;\n }\n /**\n * Prepare internal normal array for software CPU skinning\n * @returns original normals used for CPU skinning. Useful for integrating Morphing with skeletons in same mesh.\n */\n setNormalsForCPUSkinning() {\n const internalDataInfo = this._internalMeshDataInfo;\n if (!internalDataInfo._sourceNormals) {\n const source = this.getVerticesData(VertexBuffer.NormalKind);\n if (!source) {\n return internalDataInfo._sourceNormals;\n }\n internalDataInfo._sourceNormals = new Float32Array(source);\n if (!this.isVertexBufferUpdatable(VertexBuffer.NormalKind)) {\n this.setVerticesData(VertexBuffer.NormalKind, source, true);\n }\n }\n return internalDataInfo._sourceNormals;\n }\n /**\n * Updates the vertex buffer by applying transformation from the bones\n * @param skeleton defines the skeleton to apply to current mesh\n * @returns the current mesh\n */\n applySkeleton(skeleton) {\n if (!this.geometry) {\n return this;\n }\n if (this.geometry._softwareSkinningFrameId == this.getScene().getFrameId()) {\n return this;\n }\n this.geometry._softwareSkinningFrameId = this.getScene().getFrameId();\n if (!this.isVerticesDataPresent(VertexBuffer.PositionKind)) {\n return this;\n }\n if (!this.isVerticesDataPresent(VertexBuffer.MatricesIndicesKind)) {\n return this;\n }\n if (!this.isVerticesDataPresent(VertexBuffer.MatricesWeightsKind)) {\n return this;\n }\n const hasNormals = this.isVerticesDataPresent(VertexBuffer.NormalKind);\n const internalDataInfo = this._internalMeshDataInfo;\n if (!internalDataInfo._sourcePositions) {\n const submeshes = this.subMeshes.slice();\n this.setPositionsForCPUSkinning();\n this.subMeshes = submeshes;\n }\n if (hasNormals && !internalDataInfo._sourceNormals) {\n this.setNormalsForCPUSkinning();\n }\n // positionsData checks for not being Float32Array will only pass at most once\n let positionsData = this.getVerticesData(VertexBuffer.PositionKind);\n if (!positionsData) {\n return this;\n }\n if (!(positionsData instanceof Float32Array)) {\n positionsData = new Float32Array(positionsData);\n }\n // normalsData checks for not being Float32Array will only pass at most once\n let normalsData = this.getVerticesData(VertexBuffer.NormalKind);\n if (hasNormals) {\n if (!normalsData) {\n return this;\n }\n if (!(normalsData instanceof Float32Array)) {\n normalsData = new Float32Array(normalsData);\n }\n }\n const matricesIndicesData = this.getVerticesData(VertexBuffer.MatricesIndicesKind);\n const matricesWeightsData = this.getVerticesData(VertexBuffer.MatricesWeightsKind);\n if (!matricesWeightsData || !matricesIndicesData) {\n return this;\n }\n const needExtras = this.numBoneInfluencers > 4;\n const matricesIndicesExtraData = needExtras ? this.getVerticesData(VertexBuffer.MatricesIndicesExtraKind) : null;\n const matricesWeightsExtraData = needExtras ? this.getVerticesData(VertexBuffer.MatricesWeightsExtraKind) : null;\n const skeletonMatrices = skeleton.getTransformMatrices(this);\n const tempVector3 = Vector3.Zero();\n const finalMatrix = new Matrix();\n const tempMatrix = new Matrix();\n let matWeightIdx = 0;\n let inf;\n for (let index = 0; index < positionsData.length; index += 3, matWeightIdx += 4) {\n let weight;\n for (inf = 0; inf < 4; inf++) {\n weight = matricesWeightsData[matWeightIdx + inf];\n if (weight > 0) {\n Matrix.FromFloat32ArrayToRefScaled(skeletonMatrices, Math.floor(matricesIndicesData[matWeightIdx + inf] * 16), weight, tempMatrix);\n finalMatrix.addToSelf(tempMatrix);\n }\n }\n if (needExtras) {\n for (inf = 0; inf < 4; inf++) {\n weight = matricesWeightsExtraData[matWeightIdx + inf];\n if (weight > 0) {\n Matrix.FromFloat32ArrayToRefScaled(skeletonMatrices, Math.floor(matricesIndicesExtraData[matWeightIdx + inf] * 16), weight, tempMatrix);\n finalMatrix.addToSelf(tempMatrix);\n }\n }\n }\n Vector3.TransformCoordinatesFromFloatsToRef(internalDataInfo._sourcePositions[index], internalDataInfo._sourcePositions[index + 1], internalDataInfo._sourcePositions[index + 2], finalMatrix, tempVector3);\n tempVector3.toArray(positionsData, index);\n if (hasNormals) {\n Vector3.TransformNormalFromFloatsToRef(internalDataInfo._sourceNormals[index], internalDataInfo._sourceNormals[index + 1], internalDataInfo._sourceNormals[index + 2], finalMatrix, tempVector3);\n tempVector3.toArray(normalsData, index);\n }\n finalMatrix.reset();\n }\n this.updateVerticesData(VertexBuffer.PositionKind, positionsData);\n if (hasNormals) {\n this.updateVerticesData(VertexBuffer.NormalKind, normalsData);\n }\n return this;\n }\n // Tools\n /**\n * Returns an object containing a min and max Vector3 which are the minimum and maximum vectors of each mesh bounding box from the passed array, in the world coordinates\n * @param meshes defines the list of meshes to scan\n * @returns an object `{min:` Vector3`, max:` Vector3`}`\n */\n static MinMax(meshes) {\n let minVector = null;\n let maxVector = null;\n meshes.forEach(function (mesh) {\n const boundingInfo = mesh.getBoundingInfo();\n const boundingBox = boundingInfo.boundingBox;\n if (!minVector || !maxVector) {\n minVector = boundingBox.minimumWorld;\n maxVector = boundingBox.maximumWorld;\n }\n else {\n minVector.minimizeInPlace(boundingBox.minimumWorld);\n maxVector.maximizeInPlace(boundingBox.maximumWorld);\n }\n });\n if (!minVector || !maxVector) {\n return {\n min: Vector3.Zero(),\n max: Vector3.Zero(),\n };\n }\n return {\n min: minVector,\n max: maxVector,\n };\n }\n /**\n * Returns the center of the `{min:` Vector3`, max:` Vector3`}` or the center of MinMax vector3 computed from a mesh array\n * @param meshesOrMinMaxVector could be an array of meshes or a `{min:` Vector3`, max:` Vector3`}` object\n * @returns a vector3\n */\n static Center(meshesOrMinMaxVector) {\n const minMaxVector = meshesOrMinMaxVector instanceof Array ? Mesh.MinMax(meshesOrMinMaxVector) : meshesOrMinMaxVector;\n return Vector3.Center(minMaxVector.min, minMaxVector.max);\n }\n /**\n * Merge the array of meshes into a single mesh for performance reasons.\n * @param meshes array of meshes with the vertices to merge. Entries cannot be empty meshes.\n * @param disposeSource when true (default), dispose of the vertices from the source meshes.\n * @param allow32BitsIndices when the sum of the vertices > 64k, this must be set to true.\n * @param meshSubclass (optional) can be set to a Mesh where the merged vertices will be inserted.\n * @param subdivideWithSubMeshes when true (false default), subdivide mesh into subMeshes.\n * @param multiMultiMaterials when true (false default), subdivide mesh into subMeshes with multiple materials, ignores subdivideWithSubMeshes.\n * @returns a new mesh\n */\n static MergeMeshes(meshes, disposeSource = true, allow32BitsIndices, meshSubclass, subdivideWithSubMeshes, multiMultiMaterials) {\n return runCoroutineSync(Mesh._MergeMeshesCoroutine(meshes, disposeSource, allow32BitsIndices, meshSubclass, subdivideWithSubMeshes, multiMultiMaterials, false));\n }\n /**\n * Merge the array of meshes into a single mesh for performance reasons.\n * @param meshes array of meshes with the vertices to merge. Entries cannot be empty meshes.\n * @param disposeSource when true (default), dispose of the vertices from the source meshes.\n * @param allow32BitsIndices when the sum of the vertices > 64k, this must be set to true.\n * @param meshSubclass (optional) can be set to a Mesh where the merged vertices will be inserted.\n * @param subdivideWithSubMeshes when true (false default), subdivide mesh into subMeshes.\n * @param multiMultiMaterials when true (false default), subdivide mesh into subMeshes with multiple materials, ignores subdivideWithSubMeshes.\n * @returns a new mesh\n */\n static MergeMeshesAsync(meshes, disposeSource = true, allow32BitsIndices, meshSubclass, subdivideWithSubMeshes, multiMultiMaterials) {\n return runCoroutineAsync(Mesh._MergeMeshesCoroutine(meshes, disposeSource, allow32BitsIndices, meshSubclass, subdivideWithSubMeshes, multiMultiMaterials, true), createYieldingScheduler());\n }\n static *_MergeMeshesCoroutine(meshes, disposeSource = true, allow32BitsIndices, meshSubclass, subdivideWithSubMeshes, multiMultiMaterials, isAsync) {\n // Remove any null/undefined entries from the mesh array\n meshes = meshes.filter(Boolean);\n if (meshes.length === 0) {\n return null;\n }\n let index;\n if (!allow32BitsIndices) {\n let totalVertices = 0;\n // Counting vertices\n for (index = 0; index < meshes.length; index++) {\n totalVertices += meshes[index].getTotalVertices();\n if (totalVertices >= 65536) {\n Logger.Warn(\"Cannot merge meshes because resulting mesh will have more than 65536 vertices. Please use allow32BitsIndices = true to use 32 bits indices\");\n return null;\n }\n }\n }\n if (multiMultiMaterials) {\n subdivideWithSubMeshes = false;\n }\n const materialArray = new Array();\n const materialIndexArray = new Array();\n // Merge\n const indiceArray = new Array();\n const currentOverrideMaterialSideOrientation = meshes[0].overrideMaterialSideOrientation;\n for (index = 0; index < meshes.length; index++) {\n const mesh = meshes[index];\n if (mesh.isAnInstance) {\n Logger.Warn(\"Cannot merge instance meshes.\");\n return null;\n }\n if (currentOverrideMaterialSideOrientation !== mesh.overrideMaterialSideOrientation) {\n Logger.Warn(\"Cannot merge meshes with different overrideMaterialSideOrientation values.\");\n return null;\n }\n if (subdivideWithSubMeshes) {\n indiceArray.push(mesh.getTotalIndices());\n }\n if (multiMultiMaterials) {\n if (mesh.material) {\n const material = mesh.material;\n if (material instanceof MultiMaterial) {\n for (let matIndex = 0; matIndex < material.subMaterials.length; matIndex++) {\n if (materialArray.indexOf(material.subMaterials[matIndex]) < 0) {\n materialArray.push(material.subMaterials[matIndex]);\n }\n }\n for (let subIndex = 0; subIndex < mesh.subMeshes.length; subIndex++) {\n materialIndexArray.push(materialArray.indexOf(material.subMaterials[mesh.subMeshes[subIndex].materialIndex]));\n indiceArray.push(mesh.subMeshes[subIndex].indexCount);\n }\n }\n else {\n if (materialArray.indexOf(material) < 0) {\n materialArray.push(material);\n }\n for (let subIndex = 0; subIndex < mesh.subMeshes.length; subIndex++) {\n materialIndexArray.push(materialArray.indexOf(material));\n indiceArray.push(mesh.subMeshes[subIndex].indexCount);\n }\n }\n }\n else {\n for (let subIndex = 0; subIndex < mesh.subMeshes.length; subIndex++) {\n materialIndexArray.push(0);\n indiceArray.push(mesh.subMeshes[subIndex].indexCount);\n }\n }\n }\n }\n const source = meshes[0];\n const getVertexDataFromMesh = (mesh) => {\n const wm = mesh.computeWorldMatrix(true);\n const vertexData = VertexData.ExtractFromMesh(mesh, false, false);\n return { vertexData, transform: wm };\n };\n const { vertexData: sourceVertexData, transform: sourceTransform } = getVertexDataFromMesh(source);\n if (isAsync) {\n yield;\n }\n const meshVertexDatas = new Array(meshes.length - 1);\n for (let i = 1; i < meshes.length; i++) {\n meshVertexDatas[i - 1] = getVertexDataFromMesh(meshes[i]);\n if (isAsync) {\n yield;\n }\n }\n const mergeCoroutine = sourceVertexData._mergeCoroutine(sourceTransform, meshVertexDatas, allow32BitsIndices, isAsync, !disposeSource);\n let mergeCoroutineStep = mergeCoroutine.next();\n while (!mergeCoroutineStep.done) {\n if (isAsync) {\n yield;\n }\n mergeCoroutineStep = mergeCoroutine.next();\n }\n const vertexData = mergeCoroutineStep.value;\n if (!meshSubclass) {\n meshSubclass = new Mesh(source.name + \"_merged\", source.getScene());\n }\n const applyToCoroutine = vertexData._applyToCoroutine(meshSubclass, undefined, isAsync);\n let applyToCoroutineStep = applyToCoroutine.next();\n while (!applyToCoroutineStep.done) {\n if (isAsync) {\n yield;\n }\n applyToCoroutineStep = applyToCoroutine.next();\n }\n // Setting properties\n meshSubclass.checkCollisions = source.checkCollisions;\n meshSubclass.overrideMaterialSideOrientation = source.overrideMaterialSideOrientation;\n // Cleaning\n if (disposeSource) {\n for (index = 0; index < meshes.length; index++) {\n meshes[index].dispose();\n }\n }\n // Subdivide\n if (subdivideWithSubMeshes || multiMultiMaterials) {\n //-- removal of global submesh\n meshSubclass.releaseSubMeshes();\n index = 0;\n let offset = 0;\n //-- apply subdivision according to index table\n while (index < indiceArray.length) {\n SubMesh.CreateFromIndices(0, offset, indiceArray[index], meshSubclass, undefined, false);\n offset += indiceArray[index];\n index++;\n }\n for (const subMesh of meshSubclass.subMeshes) {\n subMesh.refreshBoundingInfo();\n }\n meshSubclass.computeWorldMatrix(true);\n }\n if (multiMultiMaterials) {\n const newMultiMaterial = new MultiMaterial(source.name + \"_merged\", source.getScene());\n newMultiMaterial.subMaterials = materialArray;\n for (let subIndex = 0; subIndex < meshSubclass.subMeshes.length; subIndex++) {\n meshSubclass.subMeshes[subIndex].materialIndex = materialIndexArray[subIndex];\n }\n meshSubclass.material = newMultiMaterial;\n }\n else {\n meshSubclass.material = source.material;\n }\n return meshSubclass;\n }\n /**\n * @internal\n */\n addInstance(instance) {\n instance._indexInSourceMeshInstanceArray = this.instances.length;\n this.instances.push(instance);\n }\n /**\n * @internal\n */\n removeInstance(instance) {\n // Remove from mesh\n const index = instance._indexInSourceMeshInstanceArray;\n if (index != -1) {\n if (index !== this.instances.length - 1) {\n const last = this.instances[this.instances.length - 1];\n this.instances[index] = last;\n last._indexInSourceMeshInstanceArray = index;\n }\n instance._indexInSourceMeshInstanceArray = -1;\n this.instances.pop();\n }\n }\n /** @internal */\n _shouldConvertRHS() {\n return this.overrideMaterialSideOrientation === Material.CounterClockWiseSideOrientation;\n }\n /** @internal */\n _getRenderingFillMode(fillMode) {\n var _a;\n const scene = this.getScene();\n if (scene.forcePointsCloud)\n return Material.PointFillMode;\n if (scene.forceWireframe)\n return Material.WireFrameFillMode;\n return (_a = this.overrideRenderingFillMode) !== null && _a !== void 0 ? _a : fillMode;\n }\n // deprecated methods\n /**\n * Sets the mesh material by the material or multiMaterial `id` property\n * @param id is a string identifying the material or the multiMaterial\n * @returns the current mesh\n * @deprecated Please use MeshBuilder instead Please use setMaterialById instead\n */\n setMaterialByID(id) {\n return this.setMaterialById(id);\n }\n /**\n * Creates a ribbon mesh.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param\n * @param name defines the name of the mesh to create\n * @param pathArray is a required array of paths, what are each an array of successive Vector3. The pathArray parameter depicts the ribbon geometry.\n * @param closeArray creates a seam between the first and the last paths of the path array (default is false)\n * @param closePath creates a seam between the first and the last points of each path of the path array\n * @param offset is taken in account only if the `pathArray` is containing a single path\n * @param scene defines the hosting scene\n * @param updatable defines if the mesh must be flagged as updatable\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)\n * @param instance defines an instance of an existing Ribbon object to be updated with the passed `pathArray` parameter (https://doc.babylonjs.com/how_to/How_to_dynamically_morph_a_mesh#ribbon)\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static CreateRibbon(name, pathArray, closeArray, closePath, offset, scene, updatable, sideOrientation, instance) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates a plane polygonal mesh. By default, this is a disc.\n * @param name defines the name of the mesh to create\n * @param radius sets the radius size (float) of the polygon (default 0.5)\n * @param tessellation sets the number of polygon sides (positive integer, default 64). So a tessellation valued to 3 will build a triangle, to 4 a square, etc\n * @param scene defines the hosting scene\n * @param updatable defines if the mesh must be flagged as updatable\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static CreateDisc(name, radius, tessellation, scene, updatable, sideOrientation) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates a box mesh.\n * @param name defines the name of the mesh to create\n * @param size sets the size (float) of each box side (default 1)\n * @param scene defines the hosting scene\n * @param updatable defines if the mesh must be flagged as updatable\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static CreateBox(name, size, scene, updatable, sideOrientation) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates a sphere mesh.\n * @param name defines the name of the mesh to create\n * @param segments sets the sphere number of horizontal stripes (positive integer, default 32)\n * @param diameter sets the diameter size (float) of the sphere (default 1)\n * @param scene defines the hosting scene\n * @param updatable defines if the mesh must be flagged as updatable\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static CreateSphere(name, segments, diameter, scene, updatable, sideOrientation) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates a hemisphere mesh.\n * @param name defines the name of the mesh to create\n * @param segments sets the sphere number of horizontal stripes (positive integer, default 32)\n * @param diameter sets the diameter size (float) of the sphere (default 1)\n * @param scene defines the hosting scene\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static CreateHemisphere(name, segments, diameter, scene) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates a cylinder or a cone mesh.\n * @param name defines the name of the mesh to create\n * @param height sets the height size (float) of the cylinder/cone (float, default 2)\n * @param diameterTop set the top cap diameter (floats, default 1)\n * @param diameterBottom set the bottom cap diameter (floats, default 1). This value can't be zero\n * @param tessellation sets the number of cylinder sides (positive integer, default 24). Set it to 3 to get a prism for instance\n * @param subdivisions sets the number of rings along the cylinder height (positive integer, default 1)\n * @param scene defines the hosting scene\n * @param updatable defines if the mesh must be flagged as updatable\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static CreateCylinder(name, height, diameterTop, diameterBottom, tessellation, subdivisions, scene, updatable, sideOrientation) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n // Torus (Code from SharpDX.org)\n /**\n * Creates a torus mesh.\n * @param name defines the name of the mesh to create\n * @param diameter sets the diameter size (float) of the torus (default 1)\n * @param thickness sets the diameter size of the tube of the torus (float, default 0.5)\n * @param tessellation sets the number of torus sides (positive integer, default 16)\n * @param scene defines the hosting scene\n * @param updatable defines if the mesh must be flagged as updatable\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static CreateTorus(name, diameter, thickness, tessellation, scene, updatable, sideOrientation) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates a torus knot mesh.\n * @param name defines the name of the mesh to create\n * @param radius sets the global radius size (float) of the torus knot (default 2)\n * @param tube sets the diameter size of the tube of the torus (float, default 0.5)\n * @param radialSegments sets the number of sides on each tube segments (positive integer, default 32)\n * @param tubularSegments sets the number of tubes to decompose the knot into (positive integer, default 32)\n * @param p the number of windings on X axis (positive integers, default 2)\n * @param q the number of windings on Y axis (positive integers, default 3)\n * @param scene defines the hosting scene\n * @param updatable defines if the mesh must be flagged as updatable\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static CreateTorusKnot(name, radius, tube, radialSegments, tubularSegments, p, q, scene, updatable, sideOrientation) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates a line mesh..\n * @param name defines the name of the mesh to create\n * @param points is an array successive Vector3\n * @param scene defines the hosting scene\n * @param updatable defines if the mesh must be flagged as updatable\n * @param instance is an instance of an existing LineMesh object to be updated with the passed `points` parameter (https://doc.babylonjs.com/how_to/How_to_dynamically_morph_a_mesh#lines-and-dashedlines).\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static CreateLines(name, points, scene, updatable, instance) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates a dashed line mesh.\n * @param name defines the name of the mesh to create\n * @param points is an array successive Vector3\n * @param dashSize is the size of the dashes relatively the dash number (positive float, default 3)\n * @param gapSize is the size of the gap between two successive dashes relatively the dash number (positive float, default 1)\n * @param dashNb is the intended total number of dashes (positive integer, default 200)\n * @param scene defines the hosting scene\n * @param updatable defines if the mesh must be flagged as updatable\n * @param instance is an instance of an existing LineMesh object to be updated with the passed `points` parameter (https://doc.babylonjs.com/how_to/How_to_dynamically_morph_a_mesh#lines-and-dashedlines)\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static CreateDashedLines(name, points, dashSize, gapSize, dashNb, scene, updatable, instance) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates a polygon mesh.Please consider using the same method from the MeshBuilder class instead\n * The polygon's shape will depend on the input parameters and is constructed parallel to a ground mesh.\n * The parameter `shape` is a required array of successive Vector3 representing the corners of the polygon in th XoZ plane, that is y = 0 for all vectors.\n * You can set the mesh side orientation with the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\n * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.\n * Remember you can only change the shape positions, not their number when updating a polygon.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param#non-regular-polygon\n * @param name defines the name of the mesh to create\n * @param shape is a required array of successive Vector3 representing the corners of the polygon in th XoZ plane, that is y = 0 for all vectors\n * @param scene defines the hosting scene\n * @param holes is a required array of arrays of successive Vector3 used to defines holes in the polygon\n * @param updatable defines if the mesh must be flagged as updatable\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)\n * @param earcutInjection can be used to inject your own earcut reference\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static CreatePolygon(name, shape, scene, holes, updatable, sideOrientation, earcutInjection) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates an extruded polygon mesh, with depth in the Y direction..\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param#extruded-non-regular-polygon\n * @param name defines the name of the mesh to create\n * @param shape is a required array of successive Vector3 representing the corners of the polygon in th XoZ plane, that is y = 0 for all vectors\n * @param depth defines the height of extrusion\n * @param scene defines the hosting scene\n * @param holes is a required array of arrays of successive Vector3 used to defines holes in the polygon\n * @param updatable defines if the mesh must be flagged as updatable\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)\n * @param earcutInjection can be used to inject your own earcut reference\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static ExtrudePolygon(name, shape, depth, scene, holes, updatable, sideOrientation, earcutInjection) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates an extruded shape mesh.\n * The extrusion is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param#extruded-shapes\n * @param name defines the name of the mesh to create\n * @param shape is a required array of successive Vector3. This array depicts the shape to be extruded in its local space : the shape must be designed in the xOy plane and will be extruded along the Z axis\n * @param path is a required array of successive Vector3. This is the axis curve the shape is extruded along\n * @param scale is the value to scale the shape\n * @param rotation is the angle value to rotate the shape each step (each path point), from the former step (so rotation added each step) along the curve\n * @param cap sets the way the extruded shape is capped. Possible values : Mesh.NO_CAP (default), Mesh.CAP_START, Mesh.CAP_END, Mesh.CAP_ALL\n * @param scene defines the hosting scene\n * @param updatable defines if the mesh must be flagged as updatable\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)\n * @param instance is an instance of an existing ExtrudedShape object to be updated with the passed `shape`, `path`, `scale` or `rotation` parameters (https://doc.babylonjs.com/how_to/How_to_dynamically_morph_a_mesh#extruded-shape)\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static ExtrudeShape(name, shape, path, scale, rotation, cap, scene, updatable, sideOrientation, instance) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates an custom extruded shape mesh.\n * The custom extrusion is a parametric shape.\n * It has no predefined shape. Its final shape will depend on the input parameters.\n *\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param#extruded-shapes\n * @param name defines the name of the mesh to create\n * @param shape is a required array of successive Vector3. This array depicts the shape to be extruded in its local space : the shape must be designed in the xOy plane and will be extruded along the Z axis\n * @param path is a required array of successive Vector3. This is the axis curve the shape is extruded along\n * @param scaleFunction is a custom Javascript function called on each path point\n * @param rotationFunction is a custom Javascript function called on each path point\n * @param ribbonCloseArray forces the extrusion underlying ribbon to close all the paths in its `pathArray`\n * @param ribbonClosePath forces the extrusion underlying ribbon to close its `pathArray`\n * @param cap sets the way the extruded shape is capped. Possible values : Mesh.NO_CAP (default), Mesh.CAP_START, Mesh.CAP_END, Mesh.CAP_ALL\n * @param scene defines the hosting scene\n * @param updatable defines if the mesh must be flagged as updatable\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)\n * @param instance is an instance of an existing ExtrudedShape object to be updated with the passed `shape`, `path`, `scale` or `rotation` parameters (https://doc.babylonjs.com/features/featuresDeepDive/mesh/dynamicMeshMorph#extruded-shape)\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static ExtrudeShapeCustom(name, shape, path, scaleFunction, rotationFunction, ribbonCloseArray, ribbonClosePath, cap, scene, updatable, sideOrientation, instance) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates lathe mesh.\n * The lathe is a shape with a symmetry axis : a 2D model shape is rotated around this axis to design the lathe.\n * @param name defines the name of the mesh to create\n * @param shape is a required array of successive Vector3. This array depicts the shape to be rotated in its local space : the shape must be designed in the xOy plane and will be rotated around the Y axis. It's usually a 2D shape, so the Vector3 z coordinates are often set to zero\n * @param radius is the radius value of the lathe\n * @param tessellation is the side number of the lathe.\n * @param scene defines the hosting scene\n * @param updatable defines if the mesh must be flagged as updatable\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static CreateLathe(name, shape, radius, tessellation, scene, updatable, sideOrientation) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates a plane mesh.\n * @param name defines the name of the mesh to create\n * @param size sets the size (float) of both sides of the plane at once (default 1)\n * @param scene defines the hosting scene\n * @param updatable defines if the mesh must be flagged as updatable\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static CreatePlane(name, size, scene, updatable, sideOrientation) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates a ground mesh.\n * @param name defines the name of the mesh to create\n * @param width set the width of the ground\n * @param height set the height of the ground\n * @param subdivisions sets the number of subdivisions per side\n * @param scene defines the hosting scene\n * @param updatable defines if the mesh must be flagged as updatable\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static CreateGround(name, width, height, subdivisions, scene, updatable) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates a tiled ground mesh.\n * @param name defines the name of the mesh to create\n * @param xmin set the ground minimum X coordinate\n * @param zmin set the ground minimum Y coordinate\n * @param xmax set the ground maximum X coordinate\n * @param zmax set the ground maximum Z coordinate\n * @param subdivisions is an object `{w: positive integer, h: positive integer}` (default `{w: 6, h: 6}`). `w` and `h` are the numbers of subdivisions on the ground width and height. Each subdivision is called a tile\n * @param precision is an object `{w: positive integer, h: positive integer}` (default `{w: 2, h: 2}`). `w` and `h` are the numbers of subdivisions on the ground width and height of each tile\n * @param scene defines the hosting scene\n * @param updatable defines if the mesh must be flagged as updatable\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static CreateTiledGround(name, xmin, zmin, xmax, zmax, subdivisions, precision, scene, updatable) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates a ground mesh from a height map.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set/height_map\n * @param name defines the name of the mesh to create\n * @param url sets the URL of the height map image resource\n * @param width set the ground width size\n * @param height set the ground height size\n * @param subdivisions sets the number of subdivision per side\n * @param minHeight is the minimum altitude on the ground\n * @param maxHeight is the maximum altitude on the ground\n * @param scene defines the hosting scene\n * @param updatable defines if the mesh must be flagged as updatable\n * @param onReady is a callback function that will be called once the mesh is built (the height map download can last some time)\n * @param alphaFilter will filter any data where the alpha channel is below this value, defaults 0 (all data visible)\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static CreateGroundFromHeightMap(name, url, width, height, subdivisions, minHeight, maxHeight, scene, updatable, onReady, alphaFilter) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates a tube mesh.\n * The tube is a parametric shape.\n * It has no predefined shape. Its final shape will depend on the input parameters.\n *\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param\n * @param name defines the name of the mesh to create\n * @param path is a required array of successive Vector3. It is the curve used as the axis of the tube\n * @param radius sets the tube radius size\n * @param tessellation is the number of sides on the tubular surface\n * @param radiusFunction is a custom function. If it is not null, it overrides the parameter `radius`. This function is called on each point of the tube path and is passed the index `i` of the i-th point and the distance of this point from the first point of the path\n * @param cap sets the way the extruded shape is capped. Possible values : Mesh.NO_CAP (default), Mesh.CAP_START, Mesh.CAP_END, Mesh.CAP_ALL\n * @param scene defines the hosting scene\n * @param updatable defines if the mesh must be flagged as updatable\n * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)\n * @param instance is an instance of an existing Tube object to be updated with the passed `pathArray` parameter (https://doc.babylonjs.com/how_to/How_to_dynamically_morph_a_mesh#tube)\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static CreateTube(name, path, radius, tessellation, radiusFunction, cap, scene, updatable, sideOrientation, instance) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates a polyhedron mesh.\n *.\n * * The parameter `type` (positive integer, max 14, default 0) sets the polyhedron type to build among the 15 embedded types. Please refer to the type sheet in the tutorial to choose the wanted type\n * * The parameter `size` (positive float, default 1) sets the polygon size\n * * You can overwrite the `size` on each dimension bu using the parameters `sizeX`, `sizeY` or `sizeZ` (positive floats, default to `size` value)\n * * You can build other polyhedron types than the 15 embbeded ones by setting the parameter `custom` (`polyhedronObject`, default null). If you set the parameter `custom`, this overwrittes the parameter `type`\n * * A `polyhedronObject` is a formatted javascript object. You'll find a full file with pre-set polyhedra here : https://github.com/BabylonJS/Extensions/tree/master/Polyhedron\n * * You can set the color and the UV of each side of the polyhedron with the parameters `faceColors` (Color4, default `(1, 1, 1, 1)`) and faceUV (Vector4, default `(0, 0, 1, 1)`)\n * * To understand how to set `faceUV` or `faceColors`, please read this by considering the right number of faces of your polyhedron, instead of only 6 for the box : https://doc.babylonjs.com/features/featuresDeepDive/materials/using/texturePerBoxFace\n * * The parameter `flat` (boolean, default true). If set to false, it gives the polyhedron a single global face, so less vertices and shared normals. In this case, `faceColors` and `faceUV` are ignored\n * * You can also set the mesh side orientation with the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\n * @param name defines the name of the mesh to create\n * @param options defines the options used to create the mesh\n * @param scene defines the hosting scene\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static CreatePolyhedron(name, options, scene) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates a sphere based upon an icosahedron with 20 triangular faces which can be subdivided\n * * The parameter `radius` sets the radius size (float) of the icosphere (default 1)\n * * You can set some different icosphere dimensions, for instance to build an ellipsoid, by using the parameters `radiusX`, `radiusY` and `radiusZ` (all by default have the same value than `radius`)\n * * The parameter `subdivisions` sets the number of subdivisions (positive integer, default 4). The more subdivisions, the more faces on the icosphere whatever its size\n * * The parameter `flat` (boolean, default true) gives each side its own normals. Set it to false to get a smooth continuous light reflection on the surface\n * * You can also set the mesh side orientation with the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/polyhedra#icosphere\n * @param name defines the name of the mesh\n * @param options defines the options used to create the mesh\n * @param scene defines the hosting scene\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static CreateIcoSphere(name, options, scene) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Creates a decal mesh.\n *.\n * A decal is a mesh usually applied as a model onto the surface of another mesh\n * @param name defines the name of the mesh\n * @param sourceMesh defines the mesh receiving the decal\n * @param position sets the position of the decal in world coordinates\n * @param normal sets the normal of the mesh where the decal is applied onto in world coordinates\n * @param size sets the decal scaling\n * @param angle sets the angle to rotate the decal\n * @returns a new Mesh\n * @deprecated Please use MeshBuilder instead\n */\n static CreateDecal(name, sourceMesh, position, normal, size, angle) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /** Creates a Capsule Mesh\n * @param name defines the name of the mesh.\n * @param options the constructors options used to shape the mesh.\n * @param scene defines the scene the mesh is scoped to.\n * @returns the capsule mesh\n * @see https://doc.babylonjs.com/how_to/capsule_shape\n * @deprecated Please use MeshBuilder instead\n */\n static CreateCapsule(name, options, scene) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n /**\n * Extends a mesh to a Goldberg mesh\n * Warning the mesh to convert MUST be an import of a perviously exported Goldberg mesh\n * @param mesh the mesh to convert\n * @returns the extended mesh\n * @deprecated Please use ExtendMeshToGoldberg instead\n */\n static ExtendToGoldberg(mesh) {\n throw new Error(\"Import MeshBuilder to populate this function\");\n }\n}\n// Consts\n/**\n * Mesh side orientation : usually the external or front surface\n */\nMesh.FRONTSIDE = VertexData.FRONTSIDE;\n/**\n * Mesh side orientation : usually the internal or back surface\n */\nMesh.BACKSIDE = VertexData.BACKSIDE;\n/**\n * Mesh side orientation : both internal and external or front and back surfaces\n */\nMesh.DOUBLESIDE = VertexData.DOUBLESIDE;\n/**\n * Mesh side orientation : by default, `FRONTSIDE`\n */\nMesh.DEFAULTSIDE = VertexData.DEFAULTSIDE;\n/**\n * Mesh cap setting : no cap\n */\nMesh.NO_CAP = 0;\n/**\n * Mesh cap setting : one cap at the beginning of the mesh\n */\nMesh.CAP_START = 1;\n/**\n * Mesh cap setting : one cap at the end of the mesh\n */\nMesh.CAP_END = 2;\n/**\n * Mesh cap setting : two caps, one at the beginning and one at the end of the mesh\n */\nMesh.CAP_ALL = 3;\n/**\n * Mesh pattern setting : no flip or rotate\n */\nMesh.NO_FLIP = 0;\n/**\n * Mesh pattern setting : flip (reflect in y axis) alternate tiles on each row or column\n */\nMesh.FLIP_TILE = 1;\n/**\n * Mesh pattern setting : rotate (180degs) alternate tiles on each row or column\n */\nMesh.ROTATE_TILE = 2;\n/**\n * Mesh pattern setting : flip (reflect in y axis) all tiles on alternate rows\n */\nMesh.FLIP_ROW = 3;\n/**\n * Mesh pattern setting : rotate (180degs) all tiles on alternate rows\n */\nMesh.ROTATE_ROW = 4;\n/**\n * Mesh pattern setting : flip and rotate alternate tiles on each row or column\n */\nMesh.FLIP_N_ROTATE_TILE = 5;\n/**\n * Mesh pattern setting : rotate pattern and rotate\n */\nMesh.FLIP_N_ROTATE_ROW = 6;\n/**\n * Mesh tile positioning : part tiles same on left/right or top/bottom\n */\nMesh.CENTER = 0;\n/**\n * Mesh tile positioning : part tiles on left\n */\nMesh.LEFT = 1;\n/**\n * Mesh tile positioning : part tiles on right\n */\nMesh.RIGHT = 2;\n/**\n * Mesh tile positioning : part tiles on top\n */\nMesh.TOP = 3;\n/**\n * Mesh tile positioning : part tiles on bottom\n */\nMesh.BOTTOM = 4;\n/**\n * Indicates that the instanced meshes should be sorted from back to front before rendering if their material is transparent\n */\nMesh.INSTANCEDMESH_SORT_TRANSPARENT = false;\n// Statics\n/**\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nMesh._GroundMeshParser = (parsedMesh, scene) => {\n throw _WarnImport(\"GroundMesh\");\n};\n/**\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nMesh._GoldbergMeshParser = (parsedMesh, scene) => {\n throw _WarnImport(\"GoldbergMesh\");\n};\n/**\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nMesh._LinesMeshParser = (parsedMesh, scene) => {\n throw _WarnImport(\"LinesMesh\");\n};\n/**\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nMesh._GreasedLineMeshParser = (parsedMesh, scene) => {\n throw _WarnImport(\"GreasedLineMesh\");\n};\n/**\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nMesh._TrailMeshParser = (parsedMesh, scene) => {\n throw _WarnImport(\"TrailMesh\");\n};\nRegisterClass(\"BABYLON.Mesh\", Mesh);\n//# sourceMappingURL=mesh.js.map","import { PointerEventTypes } from \"../../Events/pointerEvents.js\";\nimport { PrecisionDate } from \"../../Misc/precisionDate.js\";\nimport { Epsilon } from \"../../Maths/math.constants.js\";\n/**\n * The autoRotation behavior (AutoRotationBehavior) is designed to create a smooth rotation of an ArcRotateCamera when there is no user interaction.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/behaviors/cameraBehaviors#autorotation-behavior\n */\nexport class AutoRotationBehavior {\n constructor() {\n this._zoomStopsAnimation = false;\n this._idleRotationSpeed = 0.05;\n this._idleRotationWaitTime = 2000;\n this._idleRotationSpinupTime = 2000;\n this.targetAlpha = null;\n this._isPointerDown = false;\n this._lastFrameTime = null;\n this._lastInteractionTime = -Infinity;\n this._cameraRotationSpeed = 0;\n this._lastFrameRadius = 0;\n }\n /**\n * Gets the name of the behavior.\n */\n get name() {\n return \"AutoRotation\";\n }\n /**\n * Sets the flag that indicates if user zooming should stop animation.\n */\n set zoomStopsAnimation(flag) {\n this._zoomStopsAnimation = flag;\n }\n /**\n * Gets the flag that indicates if user zooming should stop animation.\n */\n get zoomStopsAnimation() {\n return this._zoomStopsAnimation;\n }\n /**\n * Sets the default speed at which the camera rotates around the model.\n */\n set idleRotationSpeed(speed) {\n this._idleRotationSpeed = speed;\n }\n /**\n * Gets the default speed at which the camera rotates around the model.\n */\n get idleRotationSpeed() {\n return this._idleRotationSpeed;\n }\n /**\n * Sets the time (in milliseconds) to wait after user interaction before the camera starts rotating.\n */\n set idleRotationWaitTime(time) {\n this._idleRotationWaitTime = time;\n }\n /**\n * Gets the time (milliseconds) to wait after user interaction before the camera starts rotating.\n */\n get idleRotationWaitTime() {\n return this._idleRotationWaitTime;\n }\n /**\n * Sets the time (milliseconds) to take to spin up to the full idle rotation speed.\n */\n set idleRotationSpinupTime(time) {\n this._idleRotationSpinupTime = time;\n }\n /**\n * Gets the time (milliseconds) to take to spin up to the full idle rotation speed.\n */\n get idleRotationSpinupTime() {\n return this._idleRotationSpinupTime;\n }\n /**\n * Gets a value indicating if the camera is currently rotating because of this behavior\n */\n get rotationInProgress() {\n return Math.abs(this._cameraRotationSpeed) > 0;\n }\n /**\n * Initializes the behavior.\n */\n init() {\n // Do nothing\n }\n /**\n * Attaches the behavior to its arc rotate camera.\n * @param camera Defines the camera to attach the behavior to\n */\n attach(camera) {\n this._attachedCamera = camera;\n const scene = this._attachedCamera.getScene();\n this._onPrePointerObservableObserver = scene.onPrePointerObservable.add((pointerInfoPre) => {\n if (pointerInfoPre.type === PointerEventTypes.POINTERDOWN) {\n this._isPointerDown = true;\n return;\n }\n if (pointerInfoPre.type === PointerEventTypes.POINTERUP) {\n this._isPointerDown = false;\n }\n });\n this._onAfterCheckInputsObserver = camera.onAfterCheckInputsObservable.add(() => {\n if (this._reachTargetAlpha()) {\n return;\n }\n const now = PrecisionDate.Now;\n let dt = 0;\n if (this._lastFrameTime != null) {\n dt = now - this._lastFrameTime;\n }\n this._lastFrameTime = now;\n // Stop the animation if there is user interaction and the animation should stop for this interaction\n this._applyUserInteraction();\n const timeToRotation = now - this._lastInteractionTime - this._idleRotationWaitTime;\n const scale = Math.max(Math.min(timeToRotation / this._idleRotationSpinupTime, 1), 0);\n this._cameraRotationSpeed = this._idleRotationSpeed * scale;\n // Step camera rotation by rotation speed\n if (this._attachedCamera) {\n this._attachedCamera.alpha -= this._cameraRotationSpeed * (dt / 1000);\n }\n });\n }\n /**\n * Detaches the behavior from its current arc rotate camera.\n */\n detach() {\n if (!this._attachedCamera) {\n return;\n }\n const scene = this._attachedCamera.getScene();\n if (this._onPrePointerObservableObserver) {\n scene.onPrePointerObservable.remove(this._onPrePointerObservableObserver);\n }\n this._attachedCamera.onAfterCheckInputsObservable.remove(this._onAfterCheckInputsObserver);\n this._attachedCamera = null;\n }\n /**\n * Force-reset the last interaction time\n * @param customTime an optional time that will be used instead of the current last interaction time. For example `Date.now()`\n */\n resetLastInteractionTime(customTime) {\n this._lastInteractionTime = customTime !== null && customTime !== void 0 ? customTime : PrecisionDate.Now;\n }\n /**\n * Returns true if camera alpha reaches the target alpha\n * @returns true if camera alpha reaches the target alpha\n */\n _reachTargetAlpha() {\n if (this._attachedCamera && this.targetAlpha) {\n return Math.abs(this._attachedCamera.alpha - this.targetAlpha) < Epsilon;\n }\n return false;\n }\n /**\n * Returns true if user is scrolling.\n * @returns true if user is scrolling.\n */\n _userIsZooming() {\n if (!this._attachedCamera) {\n return false;\n }\n return this._attachedCamera.inertialRadiusOffset !== 0;\n }\n _shouldAnimationStopForInteraction() {\n if (!this._attachedCamera) {\n return false;\n }\n let zoomHasHitLimit = false;\n if (this._lastFrameRadius === this._attachedCamera.radius && this._attachedCamera.inertialRadiusOffset !== 0) {\n zoomHasHitLimit = true;\n }\n // Update the record of previous radius - works as an approx. indicator of hitting radius limits\n this._lastFrameRadius = this._attachedCamera.radius;\n return this._zoomStopsAnimation ? zoomHasHitLimit : this._userIsZooming();\n }\n /**\n * Applies any current user interaction to the camera. Takes into account maximum alpha rotation.\n */\n _applyUserInteraction() {\n if (this._userIsMoving() && !this._shouldAnimationStopForInteraction()) {\n this._lastInteractionTime = PrecisionDate.Now;\n }\n }\n // Tools\n _userIsMoving() {\n if (!this._attachedCamera) {\n return false;\n }\n return (this._attachedCamera.inertialAlphaOffset !== 0 ||\n this._attachedCamera.inertialBetaOffset !== 0 ||\n this._attachedCamera.inertialRadiusOffset !== 0 ||\n this._attachedCamera.inertialPanningX !== 0 ||\n this._attachedCamera.inertialPanningY !== 0 ||\n this._isPointerDown);\n }\n}\n//# sourceMappingURL=autoRotationBehavior.js.map","import { BackEase, EasingFunction } from \"../../Animations/easing.js\";\nimport { Animation } from \"../../Animations/animation.js\";\n/**\n * Add a bouncing effect to an ArcRotateCamera when reaching a specified minimum and maximum radius\n * @see https://doc.babylonjs.com/features/featuresDeepDive/behaviors/cameraBehaviors#bouncing-behavior\n */\nexport class BouncingBehavior {\n constructor() {\n /**\n * The duration of the animation, in milliseconds\n */\n this.transitionDuration = 450;\n /**\n * Length of the distance animated by the transition when lower radius is reached\n */\n this.lowerRadiusTransitionRange = 2;\n /**\n * Length of the distance animated by the transition when upper radius is reached\n */\n this.upperRadiusTransitionRange = -2;\n this._autoTransitionRange = false;\n // Animations\n this._radiusIsAnimating = false;\n this._radiusBounceTransition = null;\n this._animatables = new Array();\n }\n /**\n * Gets the name of the behavior.\n */\n get name() {\n return \"Bouncing\";\n }\n /**\n * Gets a value indicating if the lowerRadiusTransitionRange and upperRadiusTransitionRange are defined automatically\n */\n get autoTransitionRange() {\n return this._autoTransitionRange;\n }\n /**\n * Sets a value indicating if the lowerRadiusTransitionRange and upperRadiusTransitionRange are defined automatically\n * Transition ranges will be set to 5% of the bounding box diagonal in world space\n */\n set autoTransitionRange(value) {\n if (this._autoTransitionRange === value) {\n return;\n }\n this._autoTransitionRange = value;\n const camera = this._attachedCamera;\n if (!camera) {\n return;\n }\n if (value) {\n this._onMeshTargetChangedObserver = camera.onMeshTargetChangedObservable.add((mesh) => {\n if (!mesh) {\n return;\n }\n mesh.computeWorldMatrix(true);\n const diagonal = mesh.getBoundingInfo().diagonalLength;\n this.lowerRadiusTransitionRange = diagonal * 0.05;\n this.upperRadiusTransitionRange = diagonal * 0.05;\n });\n }\n else if (this._onMeshTargetChangedObserver) {\n camera.onMeshTargetChangedObservable.remove(this._onMeshTargetChangedObserver);\n }\n }\n /**\n * Initializes the behavior.\n */\n init() {\n // Do nothing\n }\n /**\n * Attaches the behavior to its arc rotate camera.\n * @param camera Defines the camera to attach the behavior to\n */\n attach(camera) {\n this._attachedCamera = camera;\n this._onAfterCheckInputsObserver = camera.onAfterCheckInputsObservable.add(() => {\n if (!this._attachedCamera) {\n return;\n }\n // Add the bounce animation to the lower radius limit\n if (this._isRadiusAtLimit(this._attachedCamera.lowerRadiusLimit)) {\n this._applyBoundRadiusAnimation(this.lowerRadiusTransitionRange);\n }\n // Add the bounce animation to the upper radius limit\n if (this._isRadiusAtLimit(this._attachedCamera.upperRadiusLimit)) {\n this._applyBoundRadiusAnimation(this.upperRadiusTransitionRange);\n }\n });\n }\n /**\n * Detaches the behavior from its current arc rotate camera.\n */\n detach() {\n if (!this._attachedCamera) {\n return;\n }\n if (this._onAfterCheckInputsObserver) {\n this._attachedCamera.onAfterCheckInputsObservable.remove(this._onAfterCheckInputsObserver);\n }\n if (this._onMeshTargetChangedObserver) {\n this._attachedCamera.onMeshTargetChangedObservable.remove(this._onMeshTargetChangedObserver);\n }\n this._attachedCamera = null;\n }\n /**\n * Checks if the camera radius is at the specified limit. Takes into account animation locks.\n * @param radiusLimit The limit to check against.\n * @returns Bool to indicate if at limit.\n */\n _isRadiusAtLimit(radiusLimit) {\n if (!this._attachedCamera) {\n return false;\n }\n if (this._attachedCamera.radius === radiusLimit && !this._radiusIsAnimating) {\n return true;\n }\n return false;\n }\n /**\n * Applies an animation to the radius of the camera, extending by the radiusDelta.\n * @param radiusDelta The delta by which to animate to. Can be negative.\n */\n _applyBoundRadiusAnimation(radiusDelta) {\n if (!this._attachedCamera) {\n return;\n }\n if (!this._radiusBounceTransition) {\n BouncingBehavior.EasingFunction.setEasingMode(BouncingBehavior.EasingMode);\n this._radiusBounceTransition = Animation.CreateAnimation(\"radius\", Animation.ANIMATIONTYPE_FLOAT, 60, BouncingBehavior.EasingFunction);\n }\n // Prevent zoom until bounce has completed\n this._cachedWheelPrecision = this._attachedCamera.wheelPrecision;\n this._attachedCamera.wheelPrecision = Infinity;\n this._attachedCamera.inertialRadiusOffset = 0;\n // Animate to the radius limit\n this.stopAllAnimations();\n this._radiusIsAnimating = true;\n const animatable = Animation.TransitionTo(\"radius\", this._attachedCamera.radius + radiusDelta, this._attachedCamera, this._attachedCamera.getScene(), 60, this._radiusBounceTransition, this.transitionDuration, () => this._clearAnimationLocks());\n if (animatable) {\n this._animatables.push(animatable);\n }\n }\n /**\n * Removes all animation locks. Allows new animations to be added to any of the camera properties.\n */\n _clearAnimationLocks() {\n this._radiusIsAnimating = false;\n if (this._attachedCamera) {\n this._attachedCamera.wheelPrecision = this._cachedWheelPrecision;\n }\n }\n /**\n * Stops and removes all animations that have been applied to the camera\n */\n stopAllAnimations() {\n if (this._attachedCamera) {\n this._attachedCamera.animations = [];\n }\n while (this._animatables.length) {\n this._animatables[0].onAnimationEnd = null;\n this._animatables[0].stop();\n this._animatables.shift();\n }\n }\n}\n/**\n * The easing function used by animations\n */\nBouncingBehavior.EasingFunction = new BackEase(0.3);\n/**\n * The easing mode used by animations\n */\nBouncingBehavior.EasingMode = EasingFunction.EASINGMODE_EASEOUT;\n//# sourceMappingURL=bouncingBehavior.js.map","import { ExponentialEase, EasingFunction } from \"../../Animations/easing.js\";\nimport { Observable } from \"../../Misc/observable.js\";\nimport { PointerEventTypes } from \"../../Events/pointerEvents.js\";\nimport { PrecisionDate } from \"../../Misc/precisionDate.js\";\nimport { Vector3, Vector2 } from \"../../Maths/math.vector.js\";\nimport { Animation } from \"../../Animations/animation.js\";\n/**\n * The framing behavior (FramingBehavior) is designed to automatically position an ArcRotateCamera when its target is set to a mesh. It is also useful if you want to prevent the camera to go under a virtual horizontal plane.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/behaviors/cameraBehaviors#framing-behavior\n */\nexport class FramingBehavior {\n constructor() {\n /**\n * An event triggered when the animation to zoom on target mesh has ended\n */\n this.onTargetFramingAnimationEndObservable = new Observable();\n this._mode = FramingBehavior.FitFrustumSidesMode;\n this._radiusScale = 1.0;\n this._positionScale = 0.5;\n this._defaultElevation = 0.3;\n this._elevationReturnTime = 1500;\n this._elevationReturnWaitTime = 1000;\n this._zoomStopsAnimation = false;\n this._framingTime = 1500;\n /**\n * Define if the behavior should automatically change the configured\n * camera limits and sensibilities.\n */\n this.autoCorrectCameraLimitsAndSensibility = true;\n this._isPointerDown = false;\n this._lastInteractionTime = -Infinity;\n // Framing control\n this._animatables = new Array();\n this._betaIsAnimating = false;\n }\n /**\n * Gets the name of the behavior.\n */\n get name() {\n return \"Framing\";\n }\n /**\n * Sets the current mode used by the behavior\n */\n set mode(mode) {\n this._mode = mode;\n }\n /**\n * Gets current mode used by the behavior.\n */\n get mode() {\n return this._mode;\n }\n /**\n * Sets the scale applied to the radius (1 by default)\n */\n set radiusScale(radius) {\n this._radiusScale = radius;\n }\n /**\n * Gets the scale applied to the radius\n */\n get radiusScale() {\n return this._radiusScale;\n }\n /**\n * Sets the scale to apply on Y axis to position camera focus. 0.5 by default which means the center of the bounding box.\n */\n set positionScale(scale) {\n this._positionScale = scale;\n }\n /**\n * Gets the scale to apply on Y axis to position camera focus. 0.5 by default which means the center of the bounding box.\n */\n get positionScale() {\n return this._positionScale;\n }\n /**\n * Sets the angle above/below the horizontal plane to return to when the return to default elevation idle\n * behaviour is triggered, in radians.\n */\n set defaultElevation(elevation) {\n this._defaultElevation = elevation;\n }\n /**\n * Gets the angle above/below the horizontal plane to return to when the return to default elevation idle\n * behaviour is triggered, in radians.\n */\n get defaultElevation() {\n return this._defaultElevation;\n }\n /**\n * Sets the time (in milliseconds) taken to return to the default beta position.\n * Negative value indicates camera should not return to default.\n */\n set elevationReturnTime(speed) {\n this._elevationReturnTime = speed;\n }\n /**\n * Gets the time (in milliseconds) taken to return to the default beta position.\n * Negative value indicates camera should not return to default.\n */\n get elevationReturnTime() {\n return this._elevationReturnTime;\n }\n /**\n * Sets the delay (in milliseconds) taken before the camera returns to the default beta position.\n */\n set elevationReturnWaitTime(time) {\n this._elevationReturnWaitTime = time;\n }\n /**\n * Gets the delay (in milliseconds) taken before the camera returns to the default beta position.\n */\n get elevationReturnWaitTime() {\n return this._elevationReturnWaitTime;\n }\n /**\n * Sets the flag that indicates if user zooming should stop animation.\n */\n set zoomStopsAnimation(flag) {\n this._zoomStopsAnimation = flag;\n }\n /**\n * Gets the flag that indicates if user zooming should stop animation.\n */\n get zoomStopsAnimation() {\n return this._zoomStopsAnimation;\n }\n /**\n * Sets the transition time when framing the mesh, in milliseconds\n */\n set framingTime(time) {\n this._framingTime = time;\n }\n /**\n * Gets the transition time when framing the mesh, in milliseconds\n */\n get framingTime() {\n return this._framingTime;\n }\n /**\n * Initializes the behavior.\n */\n init() {\n // Do nothing\n }\n /**\n * Attaches the behavior to its arc rotate camera.\n * @param camera Defines the camera to attach the behavior to\n */\n attach(camera) {\n this._attachedCamera = camera;\n const scene = this._attachedCamera.getScene();\n FramingBehavior.EasingFunction.setEasingMode(FramingBehavior.EasingMode);\n this._onPrePointerObservableObserver = scene.onPrePointerObservable.add((pointerInfoPre) => {\n if (pointerInfoPre.type === PointerEventTypes.POINTERDOWN) {\n this._isPointerDown = true;\n return;\n }\n if (pointerInfoPre.type === PointerEventTypes.POINTERUP) {\n this._isPointerDown = false;\n }\n });\n this._onMeshTargetChangedObserver = camera.onMeshTargetChangedObservable.add((mesh) => {\n if (mesh) {\n this.zoomOnMesh(mesh, undefined, () => {\n this.onTargetFramingAnimationEndObservable.notifyObservers();\n });\n }\n });\n this._onAfterCheckInputsObserver = camera.onAfterCheckInputsObservable.add(() => {\n // Stop the animation if there is user interaction and the animation should stop for this interaction\n this._applyUserInteraction();\n // Maintain the camera above the ground. If the user pulls the camera beneath the ground plane, lift it\n // back to the default position after a given timeout\n this._maintainCameraAboveGround();\n });\n }\n /**\n * Detaches the behavior from its current arc rotate camera.\n */\n detach() {\n if (!this._attachedCamera) {\n return;\n }\n const scene = this._attachedCamera.getScene();\n if (this._onPrePointerObservableObserver) {\n scene.onPrePointerObservable.remove(this._onPrePointerObservableObserver);\n }\n if (this._onAfterCheckInputsObserver) {\n this._attachedCamera.onAfterCheckInputsObservable.remove(this._onAfterCheckInputsObserver);\n }\n if (this._onMeshTargetChangedObserver) {\n this._attachedCamera.onMeshTargetChangedObservable.remove(this._onMeshTargetChangedObserver);\n }\n this._attachedCamera = null;\n }\n /**\n * Targets the given mesh and updates zoom level accordingly.\n * @param mesh The mesh to target.\n * @param focusOnOriginXZ Determines if the camera should focus on 0 in the X and Z axis instead of the mesh\n * @param onAnimationEnd Callback triggered at the end of the framing animation\n */\n zoomOnMesh(mesh, focusOnOriginXZ = false, onAnimationEnd = null) {\n mesh.computeWorldMatrix(true);\n const boundingBox = mesh.getBoundingInfo().boundingBox;\n this.zoomOnBoundingInfo(boundingBox.minimumWorld, boundingBox.maximumWorld, focusOnOriginXZ, onAnimationEnd);\n }\n /**\n * Targets the given mesh with its children and updates zoom level accordingly.\n * @param mesh The mesh to target.\n * @param focusOnOriginXZ Determines if the camera should focus on 0 in the X and Z axis instead of the mesh\n * @param onAnimationEnd Callback triggered at the end of the framing animation\n */\n zoomOnMeshHierarchy(mesh, focusOnOriginXZ = false, onAnimationEnd = null) {\n mesh.computeWorldMatrix(true);\n const boundingBox = mesh.getHierarchyBoundingVectors(true);\n this.zoomOnBoundingInfo(boundingBox.min, boundingBox.max, focusOnOriginXZ, onAnimationEnd);\n }\n /**\n * Targets the given meshes with their children and updates zoom level accordingly.\n * @param meshes The mesh to target.\n * @param focusOnOriginXZ Determines if the camera should focus on 0 in the X and Z axis instead of the mesh\n * @param onAnimationEnd Callback triggered at the end of the framing animation\n */\n zoomOnMeshesHierarchy(meshes, focusOnOriginXZ = false, onAnimationEnd = null) {\n const min = new Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\n const max = new Vector3(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);\n for (let i = 0; i < meshes.length; i++) {\n const boundingInfo = meshes[i].getHierarchyBoundingVectors(true);\n Vector3.CheckExtends(boundingInfo.min, min, max);\n Vector3.CheckExtends(boundingInfo.max, min, max);\n }\n this.zoomOnBoundingInfo(min, max, focusOnOriginXZ, onAnimationEnd);\n }\n /**\n * Targets the bounding box info defined by its extends and updates zoom level accordingly.\n * @param minimumWorld Determines the smaller position of the bounding box extend\n * @param maximumWorld Determines the bigger position of the bounding box extend\n * @param focusOnOriginXZ Determines if the camera should focus on 0 in the X and Z axis instead of the mesh\n * @param onAnimationEnd Callback triggered at the end of the framing animation\n * @returns true if the zoom was done\n */\n zoomOnBoundingInfo(minimumWorld, maximumWorld, focusOnOriginXZ = false, onAnimationEnd = null) {\n let zoomTarget;\n if (!this._attachedCamera) {\n return false;\n }\n // Find target by interpolating from bottom of bounding box in world-space to top via framingPositionY\n const bottom = minimumWorld.y;\n const top = maximumWorld.y;\n const zoomTargetY = bottom + (top - bottom) * this._positionScale;\n const radiusWorld = maximumWorld.subtract(minimumWorld).scale(0.5);\n if (focusOnOriginXZ) {\n zoomTarget = new Vector3(0, zoomTargetY, 0);\n }\n else {\n const centerWorld = minimumWorld.add(radiusWorld);\n zoomTarget = new Vector3(centerWorld.x, zoomTargetY, centerWorld.z);\n }\n if (!this._vectorTransition) {\n this._vectorTransition = Animation.CreateAnimation(\"target\", Animation.ANIMATIONTYPE_VECTOR3, 60, FramingBehavior.EasingFunction);\n }\n this._betaIsAnimating = true;\n let animatable = Animation.TransitionTo(\"target\", zoomTarget, this._attachedCamera, this._attachedCamera.getScene(), 60, this._vectorTransition, this._framingTime);\n if (animatable) {\n this._animatables.push(animatable);\n }\n // sets the radius and lower radius bounds\n // Small delta ensures camera is not always at lower zoom limit.\n let radius = 0;\n if (this._mode === FramingBehavior.FitFrustumSidesMode) {\n const position = this._calculateLowerRadiusFromModelBoundingSphere(minimumWorld, maximumWorld);\n if (this.autoCorrectCameraLimitsAndSensibility) {\n this._attachedCamera.lowerRadiusLimit = radiusWorld.length() + this._attachedCamera.minZ;\n }\n radius = position;\n }\n else if (this._mode === FramingBehavior.IgnoreBoundsSizeMode) {\n radius = this._calculateLowerRadiusFromModelBoundingSphere(minimumWorld, maximumWorld);\n if (this.autoCorrectCameraLimitsAndSensibility && this._attachedCamera.lowerRadiusLimit === null) {\n this._attachedCamera.lowerRadiusLimit = this._attachedCamera.minZ;\n }\n }\n // Set sensibilities\n if (this.autoCorrectCameraLimitsAndSensibility) {\n const extend = maximumWorld.subtract(minimumWorld).length();\n this._attachedCamera.panningSensibility = 5000 / extend;\n this._attachedCamera.wheelPrecision = 100 / radius;\n }\n // transition to new radius\n if (!this._radiusTransition) {\n this._radiusTransition = Animation.CreateAnimation(\"radius\", Animation.ANIMATIONTYPE_FLOAT, 60, FramingBehavior.EasingFunction);\n }\n animatable = Animation.TransitionTo(\"radius\", radius, this._attachedCamera, this._attachedCamera.getScene(), 60, this._radiusTransition, this._framingTime, () => {\n this.stopAllAnimations();\n if (onAnimationEnd) {\n onAnimationEnd();\n }\n if (this._attachedCamera && this._attachedCamera.useInputToRestoreState) {\n this._attachedCamera.storeState();\n }\n });\n if (animatable) {\n this._animatables.push(animatable);\n }\n return true;\n }\n /**\n * Calculates the lowest radius for the camera based on the bounding box of the mesh.\n * @param minimumWorld\n * @param maximumWorld\n * @returns The minimum distance from the primary mesh's center point at which the camera must be kept in order\n *\t\t to fully enclose the mesh in the viewing frustum.\n */\n _calculateLowerRadiusFromModelBoundingSphere(minimumWorld, maximumWorld) {\n const size = maximumWorld.subtract(minimumWorld);\n const boxVectorGlobalDiagonal = size.length();\n const frustumSlope = this._getFrustumSlope();\n // Formula for setting distance\n // (Good explanation: http://stackoverflow.com/questions/2866350/move-camera-to-fit-3d-scene)\n const radiusWithoutFraming = boxVectorGlobalDiagonal * 0.5;\n // Horizon distance\n const radius = radiusWithoutFraming * this._radiusScale;\n const distanceForHorizontalFrustum = radius * Math.sqrt(1.0 + 1.0 / (frustumSlope.x * frustumSlope.x));\n const distanceForVerticalFrustum = radius * Math.sqrt(1.0 + 1.0 / (frustumSlope.y * frustumSlope.y));\n let distance = Math.max(distanceForHorizontalFrustum, distanceForVerticalFrustum);\n const camera = this._attachedCamera;\n if (!camera) {\n return 0;\n }\n if (camera.lowerRadiusLimit && this._mode === FramingBehavior.IgnoreBoundsSizeMode) {\n // Don't exceed the requested limit\n distance = distance < camera.lowerRadiusLimit ? camera.lowerRadiusLimit : distance;\n }\n // Don't exceed the upper radius limit\n if (camera.upperRadiusLimit) {\n distance = distance > camera.upperRadiusLimit ? camera.upperRadiusLimit : distance;\n }\n return distance;\n }\n /**\n * Keeps the camera above the ground plane. If the user pulls the camera below the ground plane, the camera\n * is automatically returned to its default position (expected to be above ground plane).\n */\n _maintainCameraAboveGround() {\n if (this._elevationReturnTime < 0) {\n return;\n }\n const timeSinceInteraction = PrecisionDate.Now - this._lastInteractionTime;\n const defaultBeta = Math.PI * 0.5 - this._defaultElevation;\n const limitBeta = Math.PI * 0.5;\n // Bring the camera back up if below the ground plane\n if (this._attachedCamera && !this._betaIsAnimating && this._attachedCamera.beta > limitBeta && timeSinceInteraction >= this._elevationReturnWaitTime) {\n this._betaIsAnimating = true;\n //Transition to new position\n this.stopAllAnimations();\n if (!this._betaTransition) {\n this._betaTransition = Animation.CreateAnimation(\"beta\", Animation.ANIMATIONTYPE_FLOAT, 60, FramingBehavior.EasingFunction);\n }\n const animatabe = Animation.TransitionTo(\"beta\", defaultBeta, this._attachedCamera, this._attachedCamera.getScene(), 60, this._betaTransition, this._elevationReturnTime, () => {\n this._clearAnimationLocks();\n this.stopAllAnimations();\n });\n if (animatabe) {\n this._animatables.push(animatabe);\n }\n }\n }\n /**\n * Returns the frustum slope based on the canvas ratio and camera FOV\n * @returns The frustum slope represented as a Vector2 with X and Y slopes\n */\n _getFrustumSlope() {\n // Calculate the viewport ratio\n // Aspect Ratio is Height/Width.\n const camera = this._attachedCamera;\n if (!camera) {\n return Vector2.Zero();\n }\n const engine = camera.getScene().getEngine();\n const aspectRatio = engine.getAspectRatio(camera);\n // Camera FOV is the vertical field of view (top-bottom) in radians.\n // Slope of the frustum top/bottom planes in view space, relative to the forward vector.\n const frustumSlopeY = Math.tan(camera.fov / 2);\n // Slope of the frustum left/right planes in view space, relative to the forward vector.\n // Provides the amount that one side (e.g. left) of the frustum gets wider for every unit\n // along the forward vector.\n const frustumSlopeX = frustumSlopeY * aspectRatio;\n return new Vector2(frustumSlopeX, frustumSlopeY);\n }\n /**\n * Removes all animation locks. Allows new animations to be added to any of the arcCamera properties.\n */\n _clearAnimationLocks() {\n this._betaIsAnimating = false;\n }\n /**\n * Applies any current user interaction to the camera. Takes into account maximum alpha rotation.\n */\n _applyUserInteraction() {\n if (this.isUserIsMoving) {\n this._lastInteractionTime = PrecisionDate.Now;\n this.stopAllAnimations();\n this._clearAnimationLocks();\n }\n }\n /**\n * Stops and removes all animations that have been applied to the camera\n */\n stopAllAnimations() {\n if (this._attachedCamera) {\n this._attachedCamera.animations = [];\n }\n while (this._animatables.length) {\n if (this._animatables[0]) {\n this._animatables[0].onAnimationEnd = null;\n this._animatables[0].stop();\n }\n this._animatables.shift();\n }\n }\n /**\n * Gets a value indicating if the user is moving the camera\n */\n get isUserIsMoving() {\n if (!this._attachedCamera) {\n return false;\n }\n return (this._attachedCamera.inertialAlphaOffset !== 0 ||\n this._attachedCamera.inertialBetaOffset !== 0 ||\n this._attachedCamera.inertialRadiusOffset !== 0 ||\n this._attachedCamera.inertialPanningX !== 0 ||\n this._attachedCamera.inertialPanningY !== 0 ||\n this._isPointerDown);\n }\n}\n/**\n * The easing function used by animations\n */\nFramingBehavior.EasingFunction = new ExponentialEase();\n/**\n * The easing mode used by animations\n */\nFramingBehavior.EasingMode = EasingFunction.EASINGMODE_EASEINOUT;\n// Statics\n/**\n * The camera can move all the way towards the mesh.\n */\nFramingBehavior.IgnoreBoundsSizeMode = 0;\n/**\n * The camera is not allowed to zoom closer to the mesh than the point at which the adjusted bounding sphere touches the frustum sides\n */\nFramingBehavior.FitFrustumSidesMode = 1;\n//# sourceMappingURL=framingBehavior.js.map","import { __decorate } from \"../tslib.es6.js\";\nimport { serialize, serializeAsVector3, serializeAsMeshReference } from \"../Misc/decorators.js\";\nimport { Camera } from \"./camera.js\";\nimport { Quaternion, Matrix, Vector3, Vector2, TmpVectors } from \"../Maths/math.vector.js\";\nimport { Epsilon } from \"../Maths/math.constants.js\";\nimport { Axis } from \"../Maths/math.axis.js\";\n/**\n * A target camera takes a mesh or position as a target and continues to look at it while it moves.\n * This is the base of the follow, arc rotate cameras and Free camera\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras\n */\nexport class TargetCamera extends Camera {\n /**\n * Instantiates a target camera that takes a mesh or position as a target and continues to look at it while it moves.\n * This is the base of the follow, arc rotate cameras and Free camera\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras\n * @param name Defines the name of the camera in the scene\n * @param position Defines the start position of the camera in the scene\n * @param scene Defines the scene the camera belongs to\n * @param setActiveOnSceneIfNoneActive Defines whether the camera should be marked as active if not other active cameras have been defined\n */\n constructor(name, position, scene, setActiveOnSceneIfNoneActive = true) {\n super(name, position, scene, setActiveOnSceneIfNoneActive);\n this._tmpUpVector = Vector3.Zero();\n this._tmpTargetVector = Vector3.Zero();\n /**\n * Define the current direction the camera is moving to\n */\n this.cameraDirection = new Vector3(0, 0, 0);\n /**\n * Define the current rotation the camera is rotating to\n */\n this.cameraRotation = new Vector2(0, 0);\n /** Gets or sets a boolean indicating that the scaling of the parent hierarchy will not be taken in account by the camera */\n this.ignoreParentScaling = false;\n /**\n * When set, the up vector of the camera will be updated by the rotation of the camera\n */\n this.updateUpVectorFromRotation = false;\n this._tmpQuaternion = new Quaternion();\n /**\n * Define the current rotation of the camera\n */\n this.rotation = new Vector3(0, 0, 0);\n /**\n * Define the current speed of the camera\n */\n this.speed = 2.0;\n /**\n * Add constraint to the camera to prevent it to move freely in all directions and\n * around all axis.\n */\n this.noRotationConstraint = false;\n /**\n * Reverses mouselook direction to 'natural' panning as opposed to traditional direct\n * panning\n */\n this.invertRotation = false;\n /**\n * Speed multiplier for inverse camera panning\n */\n this.inverseRotationSpeed = 0.2;\n /**\n * Define the current target of the camera as an object or a position.\n * Please note that locking a target will disable panning.\n */\n this.lockedTarget = null;\n /** @internal */\n this._currentTarget = Vector3.Zero();\n /** @internal */\n this._initialFocalDistance = 1;\n /** @internal */\n this._viewMatrix = Matrix.Zero();\n /** @internal */\n this._camMatrix = Matrix.Zero();\n /** @internal */\n this._cameraTransformMatrix = Matrix.Zero();\n /** @internal */\n this._cameraRotationMatrix = Matrix.Zero();\n /** @internal */\n this._referencePoint = new Vector3(0, 0, 1);\n /** @internal */\n this._transformedReferencePoint = Vector3.Zero();\n this._deferredPositionUpdate = new Vector3();\n this._deferredRotationQuaternionUpdate = new Quaternion();\n this._deferredRotationUpdate = new Vector3();\n this._deferredUpdated = false;\n this._deferOnly = false;\n this._defaultUp = Vector3.Up();\n this._cachedRotationZ = 0;\n this._cachedQuaternionRotationZ = 0;\n }\n /**\n * Gets the position in front of the camera at a given distance.\n * @param distance The distance from the camera we want the position to be\n * @returns the position\n */\n getFrontPosition(distance) {\n this.getWorldMatrix();\n const direction = this.getTarget().subtract(this.position);\n direction.normalize();\n direction.scaleInPlace(distance);\n return this.globalPosition.add(direction);\n }\n /** @internal */\n _getLockedTargetPosition() {\n if (!this.lockedTarget) {\n return null;\n }\n if (this.lockedTarget.absolutePosition) {\n const lockedTarget = this.lockedTarget;\n const m = lockedTarget.computeWorldMatrix();\n // in some cases the absolute position resets externally, but doesn't update since the matrix is cached.\n m.getTranslationToRef(lockedTarget.absolutePosition);\n }\n return this.lockedTarget.absolutePosition || this.lockedTarget;\n }\n /**\n * Store current camera state of the camera (fov, position, rotation, etc..)\n * @returns the camera\n */\n storeState() {\n this._storedPosition = this.position.clone();\n this._storedRotation = this.rotation.clone();\n if (this.rotationQuaternion) {\n this._storedRotationQuaternion = this.rotationQuaternion.clone();\n }\n return super.storeState();\n }\n /**\n * Restored camera state. You must call storeState() first\n * @returns whether it was successful or not\n * @internal\n */\n _restoreStateValues() {\n if (!super._restoreStateValues()) {\n return false;\n }\n this.position = this._storedPosition.clone();\n this.rotation = this._storedRotation.clone();\n if (this.rotationQuaternion) {\n this.rotationQuaternion = this._storedRotationQuaternion.clone();\n }\n this.cameraDirection.copyFromFloats(0, 0, 0);\n this.cameraRotation.copyFromFloats(0, 0);\n return true;\n }\n /** @internal */\n _initCache() {\n super._initCache();\n this._cache.lockedTarget = new Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\n this._cache.rotation = new Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\n this._cache.rotationQuaternion = new Quaternion(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\n }\n /**\n * @internal\n */\n _updateCache(ignoreParentClass) {\n if (!ignoreParentClass) {\n super._updateCache();\n }\n const lockedTargetPosition = this._getLockedTargetPosition();\n if (!lockedTargetPosition) {\n this._cache.lockedTarget = null;\n }\n else {\n if (!this._cache.lockedTarget) {\n this._cache.lockedTarget = lockedTargetPosition.clone();\n }\n else {\n this._cache.lockedTarget.copyFrom(lockedTargetPosition);\n }\n }\n this._cache.rotation.copyFrom(this.rotation);\n if (this.rotationQuaternion) {\n this._cache.rotationQuaternion.copyFrom(this.rotationQuaternion);\n }\n }\n // Synchronized\n /** @internal */\n _isSynchronizedViewMatrix() {\n if (!super._isSynchronizedViewMatrix()) {\n return false;\n }\n const lockedTargetPosition = this._getLockedTargetPosition();\n return ((this._cache.lockedTarget ? this._cache.lockedTarget.equals(lockedTargetPosition) : !lockedTargetPosition) &&\n (this.rotationQuaternion ? this.rotationQuaternion.equals(this._cache.rotationQuaternion) : this._cache.rotation.equals(this.rotation)));\n }\n // Methods\n /** @internal */\n _computeLocalCameraSpeed() {\n const engine = this.getEngine();\n return this.speed * Math.sqrt(engine.getDeltaTime() / (engine.getFps() * 100.0));\n }\n // Target\n /**\n * Defines the target the camera should look at.\n * @param target Defines the new target as a Vector\n */\n setTarget(target) {\n this.upVector.normalize();\n this._initialFocalDistance = target.subtract(this.position).length();\n if (this.position.z === target.z) {\n this.position.z += Epsilon;\n }\n this._referencePoint.normalize().scaleInPlace(this._initialFocalDistance);\n Matrix.LookAtLHToRef(this.position, target, this._defaultUp, this._camMatrix);\n this._camMatrix.invert();\n this.rotation.x = Math.atan(this._camMatrix.m[6] / this._camMatrix.m[10]);\n const vDir = target.subtract(this.position);\n if (vDir.x >= 0.0) {\n this.rotation.y = -Math.atan(vDir.z / vDir.x) + Math.PI / 2.0;\n }\n else {\n this.rotation.y = -Math.atan(vDir.z / vDir.x) - Math.PI / 2.0;\n }\n this.rotation.z = 0;\n if (isNaN(this.rotation.x)) {\n this.rotation.x = 0;\n }\n if (isNaN(this.rotation.y)) {\n this.rotation.y = 0;\n }\n if (isNaN(this.rotation.z)) {\n this.rotation.z = 0;\n }\n if (this.rotationQuaternion) {\n Quaternion.RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, this.rotation.z, this.rotationQuaternion);\n }\n }\n /**\n * Defines the target point of the camera.\n * The camera looks towards it form the radius distance.\n */\n get target() {\n return this.getTarget();\n }\n set target(value) {\n this.setTarget(value);\n }\n /**\n * Return the current target position of the camera. This value is expressed in local space.\n * @returns the target position\n */\n getTarget() {\n return this._currentTarget;\n }\n /** @internal */\n _decideIfNeedsToMove() {\n return Math.abs(this.cameraDirection.x) > 0 || Math.abs(this.cameraDirection.y) > 0 || Math.abs(this.cameraDirection.z) > 0;\n }\n /** @internal */\n _updatePosition() {\n if (this.parent) {\n this.parent.getWorldMatrix().invertToRef(TmpVectors.Matrix[0]);\n Vector3.TransformNormalToRef(this.cameraDirection, TmpVectors.Matrix[0], TmpVectors.Vector3[0]);\n this._deferredPositionUpdate.addInPlace(TmpVectors.Vector3[0]);\n if (!this._deferOnly) {\n this.position.copyFrom(this._deferredPositionUpdate);\n }\n else {\n this._deferredUpdated = true;\n }\n return;\n }\n this._deferredPositionUpdate.addInPlace(this.cameraDirection);\n if (!this._deferOnly) {\n this.position.copyFrom(this._deferredPositionUpdate);\n }\n else {\n this._deferredUpdated = true;\n }\n }\n /** @internal */\n _checkInputs() {\n const directionMultiplier = this.invertRotation ? -this.inverseRotationSpeed : 1.0;\n const needToMove = this._decideIfNeedsToMove();\n const needToRotate = this.cameraRotation.x || this.cameraRotation.y;\n this._deferredUpdated = false;\n this._deferredRotationUpdate.copyFrom(this.rotation);\n this._deferredPositionUpdate.copyFrom(this.position);\n if (this.rotationQuaternion) {\n this._deferredRotationQuaternionUpdate.copyFrom(this.rotationQuaternion);\n }\n // Move\n if (needToMove) {\n this._updatePosition();\n }\n // Rotate\n if (needToRotate) {\n //rotate, if quaternion is set and rotation was used\n if (this.rotationQuaternion) {\n this.rotationQuaternion.toEulerAnglesToRef(this._deferredRotationUpdate);\n }\n this._deferredRotationUpdate.x += this.cameraRotation.x * directionMultiplier;\n this._deferredRotationUpdate.y += this.cameraRotation.y * directionMultiplier;\n // Apply constraints\n if (!this.noRotationConstraint) {\n const limit = 1.570796;\n if (this._deferredRotationUpdate.x > limit) {\n this._deferredRotationUpdate.x = limit;\n }\n if (this._deferredRotationUpdate.x < -limit) {\n this._deferredRotationUpdate.x = -limit;\n }\n }\n if (!this._deferOnly) {\n this.rotation.copyFrom(this._deferredRotationUpdate);\n }\n else {\n this._deferredUpdated = true;\n }\n //rotate, if quaternion is set and rotation was used\n if (this.rotationQuaternion) {\n const len = this._deferredRotationUpdate.lengthSquared();\n if (len) {\n Quaternion.RotationYawPitchRollToRef(this._deferredRotationUpdate.y, this._deferredRotationUpdate.x, this._deferredRotationUpdate.z, this._deferredRotationQuaternionUpdate);\n if (!this._deferOnly) {\n this.rotationQuaternion.copyFrom(this._deferredRotationQuaternionUpdate);\n }\n else {\n this._deferredUpdated = true;\n }\n }\n }\n }\n // Inertia\n if (needToMove) {\n if (Math.abs(this.cameraDirection.x) < this.speed * Epsilon) {\n this.cameraDirection.x = 0;\n }\n if (Math.abs(this.cameraDirection.y) < this.speed * Epsilon) {\n this.cameraDirection.y = 0;\n }\n if (Math.abs(this.cameraDirection.z) < this.speed * Epsilon) {\n this.cameraDirection.z = 0;\n }\n this.cameraDirection.scaleInPlace(this.inertia);\n }\n if (needToRotate) {\n if (Math.abs(this.cameraRotation.x) < this.speed * Epsilon) {\n this.cameraRotation.x = 0;\n }\n if (Math.abs(this.cameraRotation.y) < this.speed * Epsilon) {\n this.cameraRotation.y = 0;\n }\n this.cameraRotation.scaleInPlace(this.inertia);\n }\n super._checkInputs();\n }\n _updateCameraRotationMatrix() {\n if (this.rotationQuaternion) {\n this.rotationQuaternion.toRotationMatrix(this._cameraRotationMatrix);\n }\n else {\n Matrix.RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, this.rotation.z, this._cameraRotationMatrix);\n }\n }\n /**\n * Update the up vector to apply the rotation of the camera (So if you changed the camera rotation.z this will let you update the up vector as well)\n * @returns the current camera\n */\n _rotateUpVectorWithCameraRotationMatrix() {\n Vector3.TransformNormalToRef(this._defaultUp, this._cameraRotationMatrix, this.upVector);\n return this;\n }\n /** @internal */\n _getViewMatrix() {\n if (this.lockedTarget) {\n this.setTarget(this._getLockedTargetPosition());\n }\n // Compute\n this._updateCameraRotationMatrix();\n // Apply the changed rotation to the upVector\n if (this.rotationQuaternion && this._cachedQuaternionRotationZ != this.rotationQuaternion.z) {\n this._rotateUpVectorWithCameraRotationMatrix();\n this._cachedQuaternionRotationZ = this.rotationQuaternion.z;\n }\n else if (this._cachedRotationZ !== this.rotation.z) {\n this._rotateUpVectorWithCameraRotationMatrix();\n this._cachedRotationZ = this.rotation.z;\n }\n Vector3.TransformCoordinatesToRef(this._referencePoint, this._cameraRotationMatrix, this._transformedReferencePoint);\n // Computing target and final matrix\n this.position.addToRef(this._transformedReferencePoint, this._currentTarget);\n if (this.updateUpVectorFromRotation) {\n if (this.rotationQuaternion) {\n Axis.Y.rotateByQuaternionToRef(this.rotationQuaternion, this.upVector);\n }\n else {\n Quaternion.FromEulerVectorToRef(this.rotation, this._tmpQuaternion);\n Axis.Y.rotateByQuaternionToRef(this._tmpQuaternion, this.upVector);\n }\n }\n this._computeViewMatrix(this.position, this._currentTarget, this.upVector);\n return this._viewMatrix;\n }\n _computeViewMatrix(position, target, up) {\n if (this.ignoreParentScaling) {\n if (this.parent) {\n const parentWorldMatrix = this.parent.getWorldMatrix();\n Vector3.TransformCoordinatesToRef(position, parentWorldMatrix, this._globalPosition);\n Vector3.TransformCoordinatesToRef(target, parentWorldMatrix, this._tmpTargetVector);\n Vector3.TransformNormalToRef(up, parentWorldMatrix, this._tmpUpVector);\n this._markSyncedWithParent();\n }\n else {\n this._globalPosition.copyFrom(position);\n this._tmpTargetVector.copyFrom(target);\n this._tmpUpVector.copyFrom(up);\n }\n if (this.getScene().useRightHandedSystem) {\n Matrix.LookAtRHToRef(this._globalPosition, this._tmpTargetVector, this._tmpUpVector, this._viewMatrix);\n }\n else {\n Matrix.LookAtLHToRef(this._globalPosition, this._tmpTargetVector, this._tmpUpVector, this._viewMatrix);\n }\n return;\n }\n if (this.getScene().useRightHandedSystem) {\n Matrix.LookAtRHToRef(position, target, up, this._viewMatrix);\n }\n else {\n Matrix.LookAtLHToRef(position, target, up, this._viewMatrix);\n }\n if (this.parent) {\n const parentWorldMatrix = this.parent.getWorldMatrix();\n this._viewMatrix.invert();\n this._viewMatrix.multiplyToRef(parentWorldMatrix, this._viewMatrix);\n this._viewMatrix.getTranslationToRef(this._globalPosition);\n this._viewMatrix.invert();\n this._markSyncedWithParent();\n }\n else {\n this._globalPosition.copyFrom(position);\n }\n }\n /**\n * @internal\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n createRigCamera(name, cameraIndex) {\n if (this.cameraRigMode !== Camera.RIG_MODE_NONE) {\n const rigCamera = new TargetCamera(name, this.position.clone(), this.getScene());\n rigCamera.isRigCamera = true;\n rigCamera.rigParent = this;\n if (this.cameraRigMode === Camera.RIG_MODE_VR || this.cameraRigMode === Camera.RIG_MODE_WEBVR) {\n if (!this.rotationQuaternion) {\n this.rotationQuaternion = new Quaternion();\n }\n rigCamera._cameraRigParams = {};\n rigCamera.rotationQuaternion = new Quaternion();\n }\n rigCamera.mode = this.mode;\n rigCamera.orthoLeft = this.orthoLeft;\n rigCamera.orthoRight = this.orthoRight;\n rigCamera.orthoTop = this.orthoTop;\n rigCamera.orthoBottom = this.orthoBottom;\n return rigCamera;\n }\n return null;\n }\n /**\n * @internal\n */\n _updateRigCameras() {\n const camLeft = this._rigCameras[0];\n const camRight = this._rigCameras[1];\n this.computeWorldMatrix();\n switch (this.cameraRigMode) {\n case Camera.RIG_MODE_STEREOSCOPIC_ANAGLYPH:\n case Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:\n case Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:\n case Camera.RIG_MODE_STEREOSCOPIC_OVERUNDER:\n case Camera.RIG_MODE_STEREOSCOPIC_INTERLACED: {\n //provisionnaly using _cameraRigParams.stereoHalfAngle instead of calculations based on _cameraRigParams.interaxialDistance:\n const leftSign = this.cameraRigMode === Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED ? 1 : -1;\n const rightSign = this.cameraRigMode === Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED ? -1 : 1;\n this._getRigCamPositionAndTarget(this._cameraRigParams.stereoHalfAngle * leftSign, camLeft);\n this._getRigCamPositionAndTarget(this._cameraRigParams.stereoHalfAngle * rightSign, camRight);\n break;\n }\n case Camera.RIG_MODE_VR:\n if (camLeft.rotationQuaternion) {\n camLeft.rotationQuaternion.copyFrom(this.rotationQuaternion);\n camRight.rotationQuaternion.copyFrom(this.rotationQuaternion);\n }\n else {\n camLeft.rotation.copyFrom(this.rotation);\n camRight.rotation.copyFrom(this.rotation);\n }\n camLeft.position.copyFrom(this.position);\n camRight.position.copyFrom(this.position);\n break;\n }\n super._updateRigCameras();\n }\n _getRigCamPositionAndTarget(halfSpace, rigCamera) {\n const target = this.getTarget();\n target.subtractToRef(this.position, TargetCamera._TargetFocalPoint);\n TargetCamera._TargetFocalPoint.normalize().scaleInPlace(this._initialFocalDistance);\n const newFocalTarget = TargetCamera._TargetFocalPoint.addInPlace(this.position);\n Matrix.TranslationToRef(-newFocalTarget.x, -newFocalTarget.y, -newFocalTarget.z, TargetCamera._TargetTransformMatrix);\n TargetCamera._TargetTransformMatrix.multiplyToRef(Matrix.RotationAxis(rigCamera.upVector, halfSpace), TargetCamera._RigCamTransformMatrix);\n Matrix.TranslationToRef(newFocalTarget.x, newFocalTarget.y, newFocalTarget.z, TargetCamera._TargetTransformMatrix);\n TargetCamera._RigCamTransformMatrix.multiplyToRef(TargetCamera._TargetTransformMatrix, TargetCamera._RigCamTransformMatrix);\n Vector3.TransformCoordinatesToRef(this.position, TargetCamera._RigCamTransformMatrix, rigCamera.position);\n rigCamera.setTarget(newFocalTarget);\n }\n /**\n * Gets the current object class name.\n * @returns the class name\n */\n getClassName() {\n return \"TargetCamera\";\n }\n}\nTargetCamera._RigCamTransformMatrix = new Matrix();\nTargetCamera._TargetTransformMatrix = new Matrix();\nTargetCamera._TargetFocalPoint = new Vector3();\n__decorate([\n serializeAsVector3()\n], TargetCamera.prototype, \"rotation\", void 0);\n__decorate([\n serialize()\n], TargetCamera.prototype, \"speed\", void 0);\n__decorate([\n serializeAsMeshReference(\"lockedTargetId\")\n], TargetCamera.prototype, \"lockedTarget\", void 0);\n//# sourceMappingURL=targetCamera.js.map","import { Logger } from \"../Misc/logger.js\";\nimport { SerializationHelper } from \"../Misc/decorators.js\";\nimport { Camera } from \"./camera.js\";\n/**\n * @ignore\n * This is a list of all the different input types that are available in the application.\n * Fo instance: ArcRotateCameraGamepadInput...\n */\n// eslint-disable-next-line no-var, @typescript-eslint/naming-convention\nexport var CameraInputTypes = {};\n/**\n * This represents the input manager used within a camera.\n * It helps dealing with all the different kind of input attached to a camera.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/customizingCameraInputs\n */\nexport class CameraInputsManager {\n /**\n * Instantiate a new Camera Input Manager.\n * @param camera Defines the camera the input manager belongs to\n */\n constructor(camera) {\n /**\n * Defines the dom element the camera is collecting inputs from.\n * This is null if the controls have not been attached.\n */\n this.attachedToElement = false;\n this.attached = {};\n this.camera = camera;\n this.checkInputs = () => { };\n }\n /**\n * Add an input method to a camera\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/customizingCameraInputs\n * @param input Camera input method\n */\n add(input) {\n const type = input.getSimpleName();\n if (this.attached[type]) {\n Logger.Warn(\"camera input of type \" + type + \" already exists on camera\");\n return;\n }\n this.attached[type] = input;\n input.camera = this.camera;\n // for checkInputs, we are dynamically creating a function\n // the goal is to avoid the performance penalty of looping for inputs in the render loop\n if (input.checkInputs) {\n this.checkInputs = this._addCheckInputs(input.checkInputs.bind(input));\n }\n if (this.attachedToElement) {\n input.attachControl(this.noPreventDefault);\n }\n }\n /**\n * Remove a specific input method from a camera\n * example: camera.inputs.remove(camera.inputs.attached.mouse);\n * @param inputToRemove camera input method\n */\n remove(inputToRemove) {\n for (const cam in this.attached) {\n const input = this.attached[cam];\n if (input === inputToRemove) {\n input.detachControl();\n input.camera = null;\n delete this.attached[cam];\n this.rebuildInputCheck();\n return;\n }\n }\n }\n /**\n * Remove a specific input type from a camera\n * example: camera.inputs.remove(\"ArcRotateCameraGamepadInput\");\n * @param inputType the type of the input to remove\n */\n removeByType(inputType) {\n for (const cam in this.attached) {\n const input = this.attached[cam];\n if (input.getClassName() === inputType) {\n input.detachControl();\n input.camera = null;\n delete this.attached[cam];\n this.rebuildInputCheck();\n }\n }\n }\n _addCheckInputs(fn) {\n const current = this.checkInputs;\n return () => {\n current();\n fn();\n };\n }\n /**\n * Attach the input controls to the currently attached dom element to listen the events from.\n * @param input Defines the input to attach\n */\n attachInput(input) {\n if (this.attachedToElement) {\n input.attachControl(this.noPreventDefault);\n }\n }\n /**\n * Attach the current manager inputs controls to a specific dom element to listen the events from.\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\n */\n attachElement(noPreventDefault = false) {\n if (this.attachedToElement) {\n return;\n }\n noPreventDefault = Camera.ForceAttachControlToAlwaysPreventDefault ? false : noPreventDefault;\n this.attachedToElement = true;\n this.noPreventDefault = noPreventDefault;\n for (const cam in this.attached) {\n this.attached[cam].attachControl(noPreventDefault);\n }\n }\n /**\n * Detach the current manager inputs controls from a specific dom element.\n * @param disconnect Defines whether the input should be removed from the current list of attached inputs\n */\n detachElement(disconnect = false) {\n for (const cam in this.attached) {\n this.attached[cam].detachControl();\n if (disconnect) {\n this.attached[cam].camera = null;\n }\n }\n this.attachedToElement = false;\n }\n /**\n * Rebuild the dynamic inputCheck function from the current list of\n * defined inputs in the manager.\n */\n rebuildInputCheck() {\n this.checkInputs = () => { };\n for (const cam in this.attached) {\n const input = this.attached[cam];\n if (input.checkInputs) {\n this.checkInputs = this._addCheckInputs(input.checkInputs.bind(input));\n }\n }\n }\n /**\n * Remove all attached input methods from a camera\n */\n clear() {\n if (this.attachedToElement) {\n this.detachElement(true);\n }\n this.attached = {};\n this.attachedToElement = false;\n this.checkInputs = () => { };\n }\n /**\n * Serialize the current input manager attached to a camera.\n * This ensures than once parsed,\n * the input associated to the camera will be identical to the current ones\n * @param serializedCamera Defines the camera serialization JSON the input serialization should write to\n */\n serialize(serializedCamera) {\n const inputs = {};\n for (const cam in this.attached) {\n const input = this.attached[cam];\n const res = SerializationHelper.Serialize(input);\n inputs[input.getClassName()] = res;\n }\n serializedCamera.inputsmgr = inputs;\n }\n /**\n * Parses an input manager serialized JSON to restore the previous list of inputs\n * and states associated to a camera.\n * @param parsedCamera Defines the JSON to parse\n */\n parse(parsedCamera) {\n const parsedInputs = parsedCamera.inputsmgr;\n if (parsedInputs) {\n this.clear();\n for (const n in parsedInputs) {\n const construct = CameraInputTypes[n];\n if (construct) {\n const parsedinput = parsedInputs[n];\n const input = SerializationHelper.Parse(() => {\n return new construct();\n }, parsedinput, null);\n this.add(input);\n }\n }\n }\n else {\n //2016-03-08 this part is for managing backward compatibility\n for (const n in this.attached) {\n const construct = CameraInputTypes[this.attached[n].getClassName()];\n if (construct) {\n const input = SerializationHelper.Parse(() => {\n return new construct();\n }, parsedCamera, null);\n this.remove(this.attached[n]);\n this.add(input);\n }\n }\n }\n }\n}\n//# sourceMappingURL=cameraInputsManager.js.map","import { __decorate } from \"../../tslib.es6.js\";\nimport { serialize } from \"../../Misc/decorators.js\";\nimport { Tools } from \"../../Misc/tools.js\";\nimport { PointerEventTypes } from \"../../Events/pointerEvents.js\";\n/**\n * Base class for Camera Pointer Inputs.\n * See FollowCameraPointersInput in src/Cameras/Inputs/followCameraPointersInput.ts\n * for example usage.\n */\nexport class BaseCameraPointersInput {\n constructor() {\n this._currentActiveButton = -1;\n /**\n * Defines the buttons associated with the input to handle camera move.\n */\n this.buttons = [0, 1, 2];\n }\n /**\n * Attach the input controls to a specific dom element to get the input from.\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\n */\n attachControl(noPreventDefault) {\n // eslint-disable-next-line prefer-rest-params\n noPreventDefault = Tools.BackCompatCameraNoPreventDefault(arguments);\n const engine = this.camera.getEngine();\n const element = engine.getInputElement();\n let previousPinchSquaredDistance = 0;\n let previousMultiTouchPanPosition = null;\n this._pointA = null;\n this._pointB = null;\n this._altKey = false;\n this._ctrlKey = false;\n this._metaKey = false;\n this._shiftKey = false;\n this._buttonsPressed = 0;\n this._pointerInput = (p) => {\n var _a, _b;\n const evt = p.event;\n const isTouch = evt.pointerType === \"touch\";\n if (engine.isInVRExclusivePointerMode) {\n return;\n }\n if (p.type !== PointerEventTypes.POINTERMOVE && this.buttons.indexOf(evt.button) === -1) {\n return;\n }\n const srcElement = evt.target;\n this._altKey = evt.altKey;\n this._ctrlKey = evt.ctrlKey;\n this._metaKey = evt.metaKey;\n this._shiftKey = evt.shiftKey;\n this._buttonsPressed = evt.buttons;\n if (engine.isPointerLock) {\n const offsetX = evt.movementX;\n const offsetY = evt.movementY;\n this.onTouch(null, offsetX, offsetY);\n this._pointA = null;\n this._pointB = null;\n }\n else if (p.type !== PointerEventTypes.POINTERDOWN && isTouch && ((_a = this._pointA) === null || _a === void 0 ? void 0 : _a.pointerId) !== evt.pointerId && ((_b = this._pointB) === null || _b === void 0 ? void 0 : _b.pointerId) !== evt.pointerId) {\n return; // If we get a non-down event for a touch that we're not tracking, ignore it\n }\n else if (p.type === PointerEventTypes.POINTERDOWN && (this._currentActiveButton === -1 || isTouch)) {\n try {\n srcElement === null || srcElement === void 0 ? void 0 : srcElement.setPointerCapture(evt.pointerId);\n }\n catch (e) {\n //Nothing to do with the error. Execution will continue.\n }\n if (this._pointA === null) {\n this._pointA = {\n x: evt.clientX,\n y: evt.clientY,\n pointerId: evt.pointerId,\n type: evt.pointerType,\n };\n }\n else if (this._pointB === null) {\n this._pointB = {\n x: evt.clientX,\n y: evt.clientY,\n pointerId: evt.pointerId,\n type: evt.pointerType,\n };\n }\n else {\n return; // We are already tracking two pointers so ignore this one\n }\n if (this._currentActiveButton === -1 && !isTouch) {\n this._currentActiveButton = evt.button;\n }\n this.onButtonDown(evt);\n if (!noPreventDefault) {\n evt.preventDefault();\n element && element.focus();\n }\n }\n else if (p.type === PointerEventTypes.POINTERDOUBLETAP) {\n this.onDoubleTap(evt.pointerType);\n }\n else if (p.type === PointerEventTypes.POINTERUP && (this._currentActiveButton === evt.button || isTouch)) {\n try {\n srcElement === null || srcElement === void 0 ? void 0 : srcElement.releasePointerCapture(evt.pointerId);\n }\n catch (e) {\n //Nothing to do with the error.\n }\n if (!isTouch) {\n this._pointB = null; // Mouse and pen are mono pointer\n }\n //would be better to use pointers.remove(evt.pointerId) for multitouch gestures,\n //but emptying completely pointers collection is required to fix a bug on iPhone :\n //when changing orientation while pinching camera,\n //one pointer stay pressed forever if we don't release all pointers\n //will be ok to put back pointers.remove(evt.pointerId); when iPhone bug corrected\n if (engine._badOS) {\n this._pointA = this._pointB = null;\n }\n else {\n //only remove the impacted pointer in case of multitouch allowing on most\n //platforms switching from rotate to zoom and pan seamlessly.\n if (this._pointB && this._pointA && this._pointA.pointerId == evt.pointerId) {\n this._pointA = this._pointB;\n this._pointB = null;\n }\n else if (this._pointA && this._pointB && this._pointB.pointerId == evt.pointerId) {\n this._pointB = null;\n }\n else {\n this._pointA = this._pointB = null;\n }\n }\n if (previousPinchSquaredDistance !== 0 || previousMultiTouchPanPosition) {\n // Previous pinch data is populated but a button has been lifted\n // so pinch has ended.\n this.onMultiTouch(this._pointA, this._pointB, previousPinchSquaredDistance, 0, // pinchSquaredDistance\n previousMultiTouchPanPosition, null // multiTouchPanPosition\n );\n previousPinchSquaredDistance = 0;\n previousMultiTouchPanPosition = null;\n }\n this._currentActiveButton = -1;\n this.onButtonUp(evt);\n if (!noPreventDefault) {\n evt.preventDefault();\n }\n }\n else if (p.type === PointerEventTypes.POINTERMOVE) {\n if (!noPreventDefault) {\n evt.preventDefault();\n }\n // One button down\n if (this._pointA && this._pointB === null) {\n const offsetX = evt.clientX - this._pointA.x;\n const offsetY = evt.clientY - this._pointA.y;\n this.onTouch(this._pointA, offsetX, offsetY);\n this._pointA.x = evt.clientX;\n this._pointA.y = evt.clientY;\n }\n // Two buttons down: pinch\n else if (this._pointA && this._pointB) {\n const ed = this._pointA.pointerId === evt.pointerId ? this._pointA : this._pointB;\n ed.x = evt.clientX;\n ed.y = evt.clientY;\n const distX = this._pointA.x - this._pointB.x;\n const distY = this._pointA.y - this._pointB.y;\n const pinchSquaredDistance = distX * distX + distY * distY;\n const multiTouchPanPosition = {\n x: (this._pointA.x + this._pointB.x) / 2,\n y: (this._pointA.y + this._pointB.y) / 2,\n pointerId: evt.pointerId,\n type: p.type,\n };\n this.onMultiTouch(this._pointA, this._pointB, previousPinchSquaredDistance, pinchSquaredDistance, previousMultiTouchPanPosition, multiTouchPanPosition);\n previousMultiTouchPanPosition = multiTouchPanPosition;\n previousPinchSquaredDistance = pinchSquaredDistance;\n }\n }\n };\n this._observer = this.camera\n .getScene()\n ._inputManager._addCameraPointerObserver(this._pointerInput, PointerEventTypes.POINTERDOWN | PointerEventTypes.POINTERUP | PointerEventTypes.POINTERMOVE | PointerEventTypes.POINTERDOUBLETAP);\n this._onLostFocus = () => {\n this._pointA = this._pointB = null;\n previousPinchSquaredDistance = 0;\n previousMultiTouchPanPosition = null;\n this.onLostFocus();\n };\n this._contextMenuBind = this.onContextMenu.bind(this);\n element && element.addEventListener(\"contextmenu\", this._contextMenuBind, false);\n const hostWindow = this.camera.getScene().getEngine().getHostWindow();\n if (hostWindow) {\n Tools.RegisterTopRootEvents(hostWindow, [{ name: \"blur\", handler: this._onLostFocus }]);\n }\n }\n /**\n * Detach the current controls from the specified dom element.\n */\n detachControl() {\n if (this._onLostFocus) {\n const hostWindow = this.camera.getScene().getEngine().getHostWindow();\n if (hostWindow) {\n Tools.UnregisterTopRootEvents(hostWindow, [{ name: \"blur\", handler: this._onLostFocus }]);\n }\n }\n if (this._observer) {\n this.camera.getScene()._inputManager._removeCameraPointerObserver(this._observer);\n this._observer = null;\n if (this._contextMenuBind) {\n const inputElement = this.camera.getScene().getEngine().getInputElement();\n inputElement && inputElement.removeEventListener(\"contextmenu\", this._contextMenuBind);\n }\n this._onLostFocus = null;\n }\n this._altKey = false;\n this._ctrlKey = false;\n this._metaKey = false;\n this._shiftKey = false;\n this._buttonsPressed = 0;\n this._currentActiveButton = -1;\n }\n /**\n * Gets the class name of the current input.\n * @returns the class name\n */\n getClassName() {\n return \"BaseCameraPointersInput\";\n }\n /**\n * Get the friendly name associated with the input class.\n * @returns the input friendly name\n */\n getSimpleName() {\n return \"pointers\";\n }\n /**\n * Called on pointer POINTERDOUBLETAP event.\n * Override this method to provide functionality on POINTERDOUBLETAP event.\n * @param type\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n onDoubleTap(type) { }\n /**\n * Called on pointer POINTERMOVE event if only a single touch is active.\n * Override this method to provide functionality.\n * @param point\n * @param offsetX\n * @param offsetY\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n onTouch(point, offsetX, offsetY) { }\n /**\n * Called on pointer POINTERMOVE event if multiple touches are active.\n * Override this method to provide functionality.\n * @param _pointA\n * @param _pointB\n * @param previousPinchSquaredDistance\n * @param pinchSquaredDistance\n * @param previousMultiTouchPanPosition\n * @param multiTouchPanPosition\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n onMultiTouch(_pointA, _pointB, previousPinchSquaredDistance, pinchSquaredDistance, previousMultiTouchPanPosition, multiTouchPanPosition) { }\n /**\n * Called on JS contextmenu event.\n * Override this method to provide functionality.\n * @param evt\n */\n onContextMenu(evt) {\n evt.preventDefault();\n }\n /**\n * Called each time a new POINTERDOWN event occurs. Ie, for each button\n * press.\n * Override this method to provide functionality.\n * @param _evt Defines the event to track\n */\n onButtonDown(_evt) { }\n /**\n * Called each time a new POINTERUP event occurs. Ie, for each button\n * release.\n * Override this method to provide functionality.\n * @param _evt Defines the event to track\n */\n onButtonUp(_evt) { }\n /**\n * Called when window becomes inactive.\n * Override this method to provide functionality.\n */\n onLostFocus() { }\n}\n__decorate([\n serialize()\n], BaseCameraPointersInput.prototype, \"buttons\", void 0);\n//# sourceMappingURL=BaseCameraPointersInput.js.map","import { __decorate } from \"../../tslib.es6.js\";\nimport { serialize } from \"../../Misc/decorators.js\";\nimport { CameraInputTypes } from \"../../Cameras/cameraInputsManager.js\";\nimport { BaseCameraPointersInput } from \"../../Cameras/Inputs/BaseCameraPointersInput.js\";\n/**\n * Manage the pointers inputs to control an arc rotate camera.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/customizingCameraInputs\n */\nexport class ArcRotateCameraPointersInput extends BaseCameraPointersInput {\n constructor() {\n super(...arguments);\n /**\n * Defines the buttons associated with the input to handle camera move.\n */\n this.buttons = [0, 1, 2];\n /**\n * Defines the pointer angular sensibility along the X axis or how fast is\n * the camera rotating.\n */\n this.angularSensibilityX = 1000.0;\n /**\n * Defines the pointer angular sensibility along the Y axis or how fast is\n * the camera rotating.\n */\n this.angularSensibilityY = 1000.0;\n /**\n * Defines the pointer pinch precision or how fast is the camera zooming.\n */\n this.pinchPrecision = 12.0;\n /**\n * pinchDeltaPercentage will be used instead of pinchPrecision if different\n * from 0.\n * It defines the percentage of current camera.radius to use as delta when\n * pinch zoom is used.\n */\n this.pinchDeltaPercentage = 0;\n /**\n * When useNaturalPinchZoom is true, multi touch zoom will zoom in such\n * that any object in the plane at the camera's target point will scale\n * perfectly with finger motion.\n * Overrides pinchDeltaPercentage and pinchPrecision.\n */\n this.useNaturalPinchZoom = false;\n /**\n * Defines whether zoom (2 fingers pinch) is enabled through multitouch\n */\n this.pinchZoom = true;\n /**\n * Defines the pointer panning sensibility or how fast is the camera moving.\n */\n this.panningSensibility = 1000.0;\n /**\n * Defines whether panning (2 fingers swipe) is enabled through multitouch.\n */\n this.multiTouchPanning = true;\n /**\n * Defines whether panning is enabled for both pan (2 fingers swipe) and\n * zoom (pinch) through multitouch.\n */\n this.multiTouchPanAndZoom = true;\n /**\n * Revers pinch action direction.\n */\n this.pinchInwards = true;\n this._isPanClick = false;\n this._twoFingerActivityCount = 0;\n this._isPinching = false;\n }\n /**\n * Gets the class name of the current input.\n * @returns the class name\n */\n getClassName() {\n return \"ArcRotateCameraPointersInput\";\n }\n /**\n * Move camera from multi touch panning positions.\n * @param previousMultiTouchPanPosition\n * @param multiTouchPanPosition\n */\n _computeMultiTouchPanning(previousMultiTouchPanPosition, multiTouchPanPosition) {\n if (this.panningSensibility !== 0 && previousMultiTouchPanPosition && multiTouchPanPosition) {\n const moveDeltaX = multiTouchPanPosition.x - previousMultiTouchPanPosition.x;\n const moveDeltaY = multiTouchPanPosition.y - previousMultiTouchPanPosition.y;\n this.camera.inertialPanningX += -moveDeltaX / this.panningSensibility;\n this.camera.inertialPanningY += moveDeltaY / this.panningSensibility;\n }\n }\n /**\n * Move camera from pinch zoom distances.\n * @param previousPinchSquaredDistance\n * @param pinchSquaredDistance\n */\n _computePinchZoom(previousPinchSquaredDistance, pinchSquaredDistance) {\n const radius = this.camera.radius || ArcRotateCameraPointersInput.MinimumRadiusForPinch;\n if (this.useNaturalPinchZoom) {\n this.camera.radius = (radius * Math.sqrt(previousPinchSquaredDistance)) / Math.sqrt(pinchSquaredDistance);\n }\n else if (this.pinchDeltaPercentage) {\n this.camera.inertialRadiusOffset += (pinchSquaredDistance - previousPinchSquaredDistance) * 0.001 * radius * this.pinchDeltaPercentage;\n }\n else {\n this.camera.inertialRadiusOffset +=\n (pinchSquaredDistance - previousPinchSquaredDistance) /\n ((this.pinchPrecision * (this.pinchInwards ? 1 : -1) * (this.angularSensibilityX + this.angularSensibilityY)) / 2);\n }\n }\n /**\n * Called on pointer POINTERMOVE event if only a single touch is active.\n * @param point\n * @param offsetX\n * @param offsetY\n */\n onTouch(point, offsetX, offsetY) {\n if (this.panningSensibility !== 0 && ((this._ctrlKey && this.camera._useCtrlForPanning) || this._isPanClick)) {\n this.camera.inertialPanningX += -offsetX / this.panningSensibility;\n this.camera.inertialPanningY += offsetY / this.panningSensibility;\n }\n else {\n this.camera.inertialAlphaOffset -= offsetX / this.angularSensibilityX;\n this.camera.inertialBetaOffset -= offsetY / this.angularSensibilityY;\n }\n }\n /**\n * Called on pointer POINTERDOUBLETAP event.\n */\n onDoubleTap() {\n if (this.camera.useInputToRestoreState) {\n this.camera.restoreState();\n }\n }\n /**\n * Called on pointer POINTERMOVE event if multiple touches are active.\n * @param pointA\n * @param pointB\n * @param previousPinchSquaredDistance\n * @param pinchSquaredDistance\n * @param previousMultiTouchPanPosition\n * @param multiTouchPanPosition\n */\n onMultiTouch(pointA, pointB, previousPinchSquaredDistance, pinchSquaredDistance, previousMultiTouchPanPosition, multiTouchPanPosition) {\n if (previousPinchSquaredDistance === 0 && previousMultiTouchPanPosition === null) {\n // First time this method is called for new pinch.\n // Next time this is called there will be a\n // previousPinchSquaredDistance and pinchSquaredDistance to compare.\n return;\n }\n if (pinchSquaredDistance === 0 && multiTouchPanPosition === null) {\n // Last time this method is called at the end of a pinch.\n return;\n }\n // Zoom and panning enabled together\n if (this.multiTouchPanAndZoom) {\n this._computePinchZoom(previousPinchSquaredDistance, pinchSquaredDistance);\n this._computeMultiTouchPanning(previousMultiTouchPanPosition, multiTouchPanPosition);\n // Zoom and panning enabled but only one at a time\n }\n else if (this.multiTouchPanning && this.pinchZoom) {\n this._twoFingerActivityCount++;\n if (this._isPinching ||\n (this._twoFingerActivityCount < 20 && Math.abs(Math.sqrt(pinchSquaredDistance) - Math.sqrt(previousPinchSquaredDistance)) > this.camera.pinchToPanMaxDistance)) {\n // Since pinch has not been active long, assume we intend to zoom.\n this._computePinchZoom(previousPinchSquaredDistance, pinchSquaredDistance);\n // Since we are pinching, remain pinching on next iteration.\n this._isPinching = true;\n }\n else {\n // Pause between pinch starting and moving implies not a zoom event. Pan instead.\n this._computeMultiTouchPanning(previousMultiTouchPanPosition, multiTouchPanPosition);\n }\n // Panning enabled, zoom disabled\n }\n else if (this.multiTouchPanning) {\n this._computeMultiTouchPanning(previousMultiTouchPanPosition, multiTouchPanPosition);\n // Zoom enabled, panning disabled\n }\n else if (this.pinchZoom) {\n this._computePinchZoom(previousPinchSquaredDistance, pinchSquaredDistance);\n }\n }\n /**\n * Called each time a new POINTERDOWN event occurs. Ie, for each button\n * press.\n * @param evt Defines the event to track\n */\n onButtonDown(evt) {\n this._isPanClick = evt.button === this.camera._panningMouseButton;\n }\n /**\n * Called each time a new POINTERUP event occurs. Ie, for each button\n * release.\n * @param _evt Defines the event to track\n */\n onButtonUp(_evt) {\n this._twoFingerActivityCount = 0;\n this._isPinching = false;\n }\n /**\n * Called when window becomes inactive.\n */\n onLostFocus() {\n this._isPanClick = false;\n this._twoFingerActivityCount = 0;\n this._isPinching = false;\n }\n}\n/**\n * The minimum radius used for pinch, to avoid radius lock at 0\n */\nArcRotateCameraPointersInput.MinimumRadiusForPinch = 0.001;\n__decorate([\n serialize()\n], ArcRotateCameraPointersInput.prototype, \"buttons\", void 0);\n__decorate([\n serialize()\n], ArcRotateCameraPointersInput.prototype, \"angularSensibilityX\", void 0);\n__decorate([\n serialize()\n], ArcRotateCameraPointersInput.prototype, \"angularSensibilityY\", void 0);\n__decorate([\n serialize()\n], ArcRotateCameraPointersInput.prototype, \"pinchPrecision\", void 0);\n__decorate([\n serialize()\n], ArcRotateCameraPointersInput.prototype, \"pinchDeltaPercentage\", void 0);\n__decorate([\n serialize()\n], ArcRotateCameraPointersInput.prototype, \"useNaturalPinchZoom\", void 0);\n__decorate([\n serialize()\n], ArcRotateCameraPointersInput.prototype, \"pinchZoom\", void 0);\n__decorate([\n serialize()\n], ArcRotateCameraPointersInput.prototype, \"panningSensibility\", void 0);\n__decorate([\n serialize()\n], ArcRotateCameraPointersInput.prototype, \"multiTouchPanning\", void 0);\n__decorate([\n serialize()\n], ArcRotateCameraPointersInput.prototype, \"multiTouchPanAndZoom\", void 0);\nCameraInputTypes[\"ArcRotateCameraPointersInput\"] = ArcRotateCameraPointersInput;\n//# sourceMappingURL=arcRotateCameraPointersInput.js.map","import { __decorate } from \"../../tslib.es6.js\";\nimport { serialize } from \"../../Misc/decorators.js\";\nimport { CameraInputTypes } from \"../../Cameras/cameraInputsManager.js\";\nimport { KeyboardEventTypes } from \"../../Events/keyboardEvents.js\";\nimport { Tools } from \"../../Misc/tools.js\";\n/**\n * Manage the keyboard inputs to control the movement of an arc rotate camera.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/customizingCameraInputs\n */\nexport class ArcRotateCameraKeyboardMoveInput {\n constructor() {\n /**\n * Defines the list of key codes associated with the up action (increase alpha)\n */\n this.keysUp = [38];\n /**\n * Defines the list of key codes associated with the down action (decrease alpha)\n */\n this.keysDown = [40];\n /**\n * Defines the list of key codes associated with the left action (increase beta)\n */\n this.keysLeft = [37];\n /**\n * Defines the list of key codes associated with the right action (decrease beta)\n */\n this.keysRight = [39];\n /**\n * Defines the list of key codes associated with the reset action.\n * Those keys reset the camera to its last stored state (with the method camera.storeState())\n */\n this.keysReset = [220];\n /**\n * Defines the panning sensibility of the inputs.\n * (How fast is the camera panning)\n */\n this.panningSensibility = 50.0;\n /**\n * Defines the zooming sensibility of the inputs.\n * (How fast is the camera zooming)\n */\n this.zoomingSensibility = 25.0;\n /**\n * Defines whether maintaining the alt key down switch the movement mode from\n * orientation to zoom.\n */\n this.useAltToZoom = true;\n /**\n * Rotation speed of the camera\n */\n this.angularSpeed = 0.01;\n this._keys = new Array();\n }\n /**\n * Attach the input controls to a specific dom element to get the input from.\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\n */\n attachControl(noPreventDefault) {\n // was there a second variable defined?\n // eslint-disable-next-line prefer-rest-params\n noPreventDefault = Tools.BackCompatCameraNoPreventDefault(arguments);\n if (this._onCanvasBlurObserver) {\n return;\n }\n this._scene = this.camera.getScene();\n this._engine = this._scene.getEngine();\n this._onCanvasBlurObserver = this._engine.onCanvasBlurObservable.add(() => {\n this._keys.length = 0;\n });\n this._onKeyboardObserver = this._scene.onKeyboardObservable.add((info) => {\n const evt = info.event;\n if (!evt.metaKey) {\n if (info.type === KeyboardEventTypes.KEYDOWN) {\n this._ctrlPressed = evt.ctrlKey;\n this._altPressed = evt.altKey;\n if (this.keysUp.indexOf(evt.keyCode) !== -1 ||\n this.keysDown.indexOf(evt.keyCode) !== -1 ||\n this.keysLeft.indexOf(evt.keyCode) !== -1 ||\n this.keysRight.indexOf(evt.keyCode) !== -1 ||\n this.keysReset.indexOf(evt.keyCode) !== -1) {\n const index = this._keys.indexOf(evt.keyCode);\n if (index === -1) {\n this._keys.push(evt.keyCode);\n }\n if (evt.preventDefault) {\n if (!noPreventDefault) {\n evt.preventDefault();\n }\n }\n }\n }\n else {\n if (this.keysUp.indexOf(evt.keyCode) !== -1 ||\n this.keysDown.indexOf(evt.keyCode) !== -1 ||\n this.keysLeft.indexOf(evt.keyCode) !== -1 ||\n this.keysRight.indexOf(evt.keyCode) !== -1 ||\n this.keysReset.indexOf(evt.keyCode) !== -1) {\n const index = this._keys.indexOf(evt.keyCode);\n if (index >= 0) {\n this._keys.splice(index, 1);\n }\n if (evt.preventDefault) {\n if (!noPreventDefault) {\n evt.preventDefault();\n }\n }\n }\n }\n }\n });\n }\n /**\n * Detach the current controls from the specified dom element.\n */\n detachControl() {\n if (this._scene) {\n if (this._onKeyboardObserver) {\n this._scene.onKeyboardObservable.remove(this._onKeyboardObserver);\n }\n if (this._onCanvasBlurObserver) {\n this._engine.onCanvasBlurObservable.remove(this._onCanvasBlurObserver);\n }\n this._onKeyboardObserver = null;\n this._onCanvasBlurObserver = null;\n }\n this._keys.length = 0;\n }\n /**\n * Update the current camera state depending on the inputs that have been used this frame.\n * This is a dynamically created lambda to avoid the performance penalty of looping for inputs in the render loop.\n */\n checkInputs() {\n if (this._onKeyboardObserver) {\n const camera = this.camera;\n for (let index = 0; index < this._keys.length; index++) {\n const keyCode = this._keys[index];\n if (this.keysLeft.indexOf(keyCode) !== -1) {\n if (this._ctrlPressed && this.camera._useCtrlForPanning) {\n camera.inertialPanningX -= 1 / this.panningSensibility;\n }\n else {\n camera.inertialAlphaOffset -= this.angularSpeed;\n }\n }\n else if (this.keysUp.indexOf(keyCode) !== -1) {\n if (this._ctrlPressed && this.camera._useCtrlForPanning) {\n camera.inertialPanningY += 1 / this.panningSensibility;\n }\n else if (this._altPressed && this.useAltToZoom) {\n camera.inertialRadiusOffset += 1 / this.zoomingSensibility;\n }\n else {\n camera.inertialBetaOffset -= this.angularSpeed;\n }\n }\n else if (this.keysRight.indexOf(keyCode) !== -1) {\n if (this._ctrlPressed && this.camera._useCtrlForPanning) {\n camera.inertialPanningX += 1 / this.panningSensibility;\n }\n else {\n camera.inertialAlphaOffset += this.angularSpeed;\n }\n }\n else if (this.keysDown.indexOf(keyCode) !== -1) {\n if (this._ctrlPressed && this.camera._useCtrlForPanning) {\n camera.inertialPanningY -= 1 / this.panningSensibility;\n }\n else if (this._altPressed && this.useAltToZoom) {\n camera.inertialRadiusOffset -= 1 / this.zoomingSensibility;\n }\n else {\n camera.inertialBetaOffset += this.angularSpeed;\n }\n }\n else if (this.keysReset.indexOf(keyCode) !== -1) {\n if (camera.useInputToRestoreState) {\n camera.restoreState();\n }\n }\n }\n }\n }\n /**\n * Gets the class name of the current input.\n * @returns the class name\n */\n getClassName() {\n return \"ArcRotateCameraKeyboardMoveInput\";\n }\n /**\n * Get the friendly name associated with the input class.\n * @returns the input friendly name\n */\n getSimpleName() {\n return \"keyboard\";\n }\n}\n__decorate([\n serialize()\n], ArcRotateCameraKeyboardMoveInput.prototype, \"keysUp\", void 0);\n__decorate([\n serialize()\n], ArcRotateCameraKeyboardMoveInput.prototype, \"keysDown\", void 0);\n__decorate([\n serialize()\n], ArcRotateCameraKeyboardMoveInput.prototype, \"keysLeft\", void 0);\n__decorate([\n serialize()\n], ArcRotateCameraKeyboardMoveInput.prototype, \"keysRight\", void 0);\n__decorate([\n serialize()\n], ArcRotateCameraKeyboardMoveInput.prototype, \"keysReset\", void 0);\n__decorate([\n serialize()\n], ArcRotateCameraKeyboardMoveInput.prototype, \"panningSensibility\", void 0);\n__decorate([\n serialize()\n], ArcRotateCameraKeyboardMoveInput.prototype, \"zoomingSensibility\", void 0);\n__decorate([\n serialize()\n], ArcRotateCameraKeyboardMoveInput.prototype, \"useAltToZoom\", void 0);\n__decorate([\n serialize()\n], ArcRotateCameraKeyboardMoveInput.prototype, \"angularSpeed\", void 0);\nCameraInputTypes[\"ArcRotateCameraKeyboardMoveInput\"] = ArcRotateCameraKeyboardMoveInput;\n//# sourceMappingURL=arcRotateCameraKeyboardMoveInput.js.map","import { __decorate } from \"../../tslib.es6.js\";\nimport { serialize } from \"../../Misc/decorators.js\";\nimport { CameraInputTypes } from \"../../Cameras/cameraInputsManager.js\";\nimport { PointerEventTypes } from \"../../Events/pointerEvents.js\";\nimport { Plane } from \"../../Maths/math.plane.js\";\nimport { Vector3, Matrix, TmpVectors } from \"../../Maths/math.vector.js\";\nimport { Epsilon } from \"../../Maths/math.constants.js\";\nimport { EventConstants } from \"../../Events/deviceInputEvents.js\";\nimport { Scalar } from \"../../Maths/math.scalar.js\";\nimport { Tools } from \"../../Misc/tools.js\";\n/**\n * Firefox uses a different scheme to report scroll distances to other\n * browsers. Rather than use complicated methods to calculate the exact\n * multiple we need to apply, let's just cheat and use a constant.\n * https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent/deltaMode\n * https://stackoverflow.com/questions/20110224/what-is-the-height-of-a-line-in-a-wheel-event-deltamode-dom-delta-line\n */\nconst ffMultiplier = 40;\n/**\n * Manage the mouse wheel inputs to control an arc rotate camera.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/customizingCameraInputs\n */\nexport class ArcRotateCameraMouseWheelInput {\n constructor() {\n /**\n * Gets or Set the mouse wheel precision or how fast is the camera zooming.\n */\n this.wheelPrecision = 3.0;\n /**\n * Gets or Set the boolean value that controls whether or not the mouse wheel\n * zooms to the location of the mouse pointer or not. The default is false.\n */\n this.zoomToMouseLocation = false;\n /**\n * wheelDeltaPercentage will be used instead of wheelPrecision if different from 0.\n * It defines the percentage of current camera.radius to use as delta when wheel is used.\n */\n this.wheelDeltaPercentage = 0;\n /**\n * If set, this function will be used to set the radius delta that will be added to the current camera radius\n */\n this.customComputeDeltaFromMouseWheel = null;\n this._viewOffset = new Vector3(0, 0, 0);\n this._globalOffset = new Vector3(0, 0, 0);\n this._inertialPanning = Vector3.Zero();\n }\n _computeDeltaFromMouseWheelLegacyEvent(mouseWheelDelta, radius) {\n let delta = 0;\n const wheelDelta = mouseWheelDelta * 0.01 * this.wheelDeltaPercentage * radius;\n if (mouseWheelDelta > 0) {\n delta = wheelDelta / (1.0 + this.wheelDeltaPercentage);\n }\n else {\n delta = wheelDelta * (1.0 + this.wheelDeltaPercentage);\n }\n return delta;\n }\n /**\n * Attach the input controls to a specific dom element to get the input from.\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\n */\n attachControl(noPreventDefault) {\n noPreventDefault = Tools.BackCompatCameraNoPreventDefault(arguments);\n this._wheel = (p) => {\n //sanity check - this should be a PointerWheel event.\n if (p.type !== PointerEventTypes.POINTERWHEEL) {\n return;\n }\n const event = p.event;\n let delta = 0;\n const platformScale = event.deltaMode === EventConstants.DOM_DELTA_LINE ? ffMultiplier : 1; // If this happens to be set to DOM_DELTA_LINE, adjust accordingly\n const wheelDelta = -(event.deltaY * platformScale);\n if (this.customComputeDeltaFromMouseWheel) {\n delta = this.customComputeDeltaFromMouseWheel(wheelDelta, this, event);\n }\n else {\n if (this.wheelDeltaPercentage) {\n delta = this._computeDeltaFromMouseWheelLegacyEvent(wheelDelta, this.camera.radius);\n // If zooming in, estimate the target radius and use that to compute the delta for inertia\n // this will stop multiple scroll events zooming in from adding too much inertia\n if (delta > 0) {\n let estimatedTargetRadius = this.camera.radius;\n let targetInertia = this.camera.inertialRadiusOffset + delta;\n for (let i = 0; i < 20 && Math.abs(targetInertia) > 0.001; i++) {\n estimatedTargetRadius -= targetInertia;\n targetInertia *= this.camera.inertia;\n }\n estimatedTargetRadius = Scalar.Clamp(estimatedTargetRadius, 0, Number.MAX_VALUE);\n delta = this._computeDeltaFromMouseWheelLegacyEvent(wheelDelta, estimatedTargetRadius);\n }\n }\n else {\n delta = wheelDelta / (this.wheelPrecision * 40);\n }\n }\n if (delta) {\n if (this.zoomToMouseLocation) {\n // If we are zooming to the mouse location, then we need to get the hit plane at the start of the zoom gesture if it doesn't exist\n // The hit plane is normally calculated after the first motion and each time there's motion so if we don't do this first,\n // the first zoom will be to the center of the screen\n if (!this._hitPlane) {\n this._updateHitPlane();\n }\n this._zoomToMouse(delta);\n }\n else {\n this.camera.inertialRadiusOffset += delta;\n }\n }\n if (event.preventDefault) {\n if (!noPreventDefault) {\n event.preventDefault();\n }\n }\n };\n this._observer = this.camera.getScene()._inputManager._addCameraPointerObserver(this._wheel, PointerEventTypes.POINTERWHEEL);\n if (this.zoomToMouseLocation) {\n this._inertialPanning.setAll(0);\n }\n }\n /**\n * Detach the current controls from the specified dom element.\n */\n detachControl() {\n if (this._observer) {\n this.camera.getScene()._inputManager._removeCameraPointerObserver(this._observer);\n this._observer = null;\n this._wheel = null;\n }\n }\n /**\n * Update the current camera state depending on the inputs that have been used this frame.\n * This is a dynamically created lambda to avoid the performance penalty of looping for inputs in the render loop.\n */\n checkInputs() {\n if (!this.zoomToMouseLocation) {\n return;\n }\n const camera = this.camera;\n const motion = 0.0 + camera.inertialAlphaOffset + camera.inertialBetaOffset + camera.inertialRadiusOffset;\n if (motion) {\n // if zooming is still happening as a result of inertia, then we also need to update\n // the hit plane.\n this._updateHitPlane();\n // Note we cannot use arcRotateCamera.inertialPlanning here because arcRotateCamera panning\n // uses a different panningInertia which could cause this panning to get out of sync with\n // the zooming, and for this to work they must be exactly in sync.\n camera.target.addInPlace(this._inertialPanning);\n this._inertialPanning.scaleInPlace(camera.inertia);\n this._zeroIfClose(this._inertialPanning);\n }\n }\n /**\n * Gets the class name of the current input.\n * @returns the class name\n */\n getClassName() {\n return \"ArcRotateCameraMouseWheelInput\";\n }\n /**\n * Get the friendly name associated with the input class.\n * @returns the input friendly name\n */\n getSimpleName() {\n return \"mousewheel\";\n }\n _updateHitPlane() {\n const camera = this.camera;\n const direction = camera.target.subtract(camera.position);\n this._hitPlane = Plane.FromPositionAndNormal(camera.target, direction);\n }\n // Get position on the hit plane\n _getPosition() {\n var _a;\n const camera = this.camera;\n const scene = camera.getScene();\n // since the _hitPlane is always updated to be orthogonal to the camera position vector\n // we don't have to worry about this ray shooting off to infinity. This ray creates\n // a vector defining where we want to zoom to.\n const ray = scene.createPickingRay(scene.pointerX, scene.pointerY, Matrix.Identity(), camera, false);\n // Since the camera is the origin of the picking ray, we need to offset it by the camera's offset manually\n // Because the offset is in view space, we need to convert it to world space first\n if (camera.targetScreenOffset.x !== 0 || camera.targetScreenOffset.y !== 0) {\n this._viewOffset.set(camera.targetScreenOffset.x, camera.targetScreenOffset.y, 0);\n camera.getViewMatrix().invertToRef(camera._cameraTransformMatrix);\n this._globalOffset = Vector3.TransformNormal(this._viewOffset, camera._cameraTransformMatrix);\n ray.origin.addInPlace(this._globalOffset);\n }\n let distance = 0;\n if (this._hitPlane) {\n distance = (_a = ray.intersectsPlane(this._hitPlane)) !== null && _a !== void 0 ? _a : 0;\n }\n // not using this ray again, so modifying its vectors here is fine\n return ray.origin.addInPlace(ray.direction.scaleInPlace(distance));\n }\n _zoomToMouse(delta) {\n var _a, _b;\n const camera = this.camera;\n const inertiaComp = 1 - camera.inertia;\n if (camera.lowerRadiusLimit) {\n const lowerLimit = (_a = camera.lowerRadiusLimit) !== null && _a !== void 0 ? _a : 0;\n if (camera.radius - (camera.inertialRadiusOffset + delta) / inertiaComp < lowerLimit) {\n delta = (camera.radius - lowerLimit) * inertiaComp - camera.inertialRadiusOffset;\n }\n }\n if (camera.upperRadiusLimit) {\n const upperLimit = (_b = camera.upperRadiusLimit) !== null && _b !== void 0 ? _b : 0;\n if (camera.radius - (camera.inertialRadiusOffset + delta) / inertiaComp > upperLimit) {\n delta = (camera.radius - upperLimit) * inertiaComp - camera.inertialRadiusOffset;\n }\n }\n const zoomDistance = delta / inertiaComp;\n const ratio = zoomDistance / camera.radius;\n const vec = this._getPosition();\n // Now this vector tells us how much we also need to pan the camera\n // so the targeted mouse location becomes the center of zooming.\n const directionToZoomLocation = TmpVectors.Vector3[6];\n vec.subtractToRef(camera.target, directionToZoomLocation);\n directionToZoomLocation.scaleInPlace(ratio);\n directionToZoomLocation.scaleInPlace(inertiaComp);\n this._inertialPanning.addInPlace(directionToZoomLocation);\n camera.inertialRadiusOffset += delta;\n }\n // Sets x y or z of passed in vector to zero if less than Epsilon.\n _zeroIfClose(vec) {\n if (Math.abs(vec.x) < Epsilon) {\n vec.x = 0;\n }\n if (Math.abs(vec.y) < Epsilon) {\n vec.y = 0;\n }\n if (Math.abs(vec.z) < Epsilon) {\n vec.z = 0;\n }\n }\n}\n__decorate([\n serialize()\n], ArcRotateCameraMouseWheelInput.prototype, \"wheelPrecision\", void 0);\n__decorate([\n serialize()\n], ArcRotateCameraMouseWheelInput.prototype, \"zoomToMouseLocation\", void 0);\n__decorate([\n serialize()\n], ArcRotateCameraMouseWheelInput.prototype, \"wheelDeltaPercentage\", void 0);\nCameraInputTypes[\"ArcRotateCameraMouseWheelInput\"] = ArcRotateCameraMouseWheelInput;\n//# sourceMappingURL=arcRotateCameraMouseWheelInput.js.map","import { ArcRotateCameraPointersInput } from \"../Cameras/Inputs/arcRotateCameraPointersInput.js\";\nimport { ArcRotateCameraKeyboardMoveInput } from \"../Cameras/Inputs/arcRotateCameraKeyboardMoveInput.js\";\nimport { ArcRotateCameraMouseWheelInput } from \"../Cameras/Inputs/arcRotateCameraMouseWheelInput.js\";\nimport { CameraInputsManager } from \"../Cameras/cameraInputsManager.js\";\n/**\n * Default Inputs manager for the ArcRotateCamera.\n * It groups all the default supported inputs for ease of use.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/customizingCameraInputs\n */\nexport class ArcRotateCameraInputsManager extends CameraInputsManager {\n /**\n * Instantiates a new ArcRotateCameraInputsManager.\n * @param camera Defines the camera the inputs belong to\n */\n constructor(camera) {\n super(camera);\n }\n /**\n * Add mouse wheel input support to the input manager.\n * @returns the current input manager\n */\n addMouseWheel() {\n this.add(new ArcRotateCameraMouseWheelInput());\n return this;\n }\n /**\n * Add pointers input support to the input manager.\n * @returns the current input manager\n */\n addPointers() {\n this.add(new ArcRotateCameraPointersInput());\n return this;\n }\n /**\n * Add keyboard input support to the input manager.\n * @returns the current input manager\n */\n addKeyboard() {\n this.add(new ArcRotateCameraKeyboardMoveInput());\n return this;\n }\n}\n//# sourceMappingURL=arcRotateCameraInputsManager.js.map","import { __decorate } from \"../tslib.es6.js\";\nimport { serialize, serializeAsVector3, serializeAsMeshReference, serializeAsVector2 } from \"../Misc/decorators.js\";\nimport { Observable } from \"../Misc/observable.js\";\nimport { Matrix, Vector3, Vector2 } from \"../Maths/math.vector.js\";\nimport { Node } from \"../node.js\";\nimport { Mesh } from \"../Meshes/mesh.js\";\nimport { AutoRotationBehavior } from \"../Behaviors/Cameras/autoRotationBehavior.js\";\nimport { BouncingBehavior } from \"../Behaviors/Cameras/bouncingBehavior.js\";\nimport { FramingBehavior } from \"../Behaviors/Cameras/framingBehavior.js\";\nimport { Camera } from \"./camera.js\";\nimport { TargetCamera } from \"./targetCamera.js\";\nimport { ArcRotateCameraInputsManager } from \"../Cameras/arcRotateCameraInputsManager.js\";\nimport { Epsilon } from \"../Maths/math.constants.js\";\nimport { Tools } from \"../Misc/tools.js\";\nNode.AddNodeConstructor(\"ArcRotateCamera\", (name, scene) => {\n return () => new ArcRotateCamera(name, 0, 0, 1.0, Vector3.Zero(), scene);\n});\n/**\n * This represents an orbital type of camera.\n *\n * This camera always points towards a given target position and can be rotated around that target with the target as the centre of rotation. It can be controlled with cursors and mouse, or with touch events.\n * Think of this camera as one orbiting its target position, or more imaginatively as a spy satellite orbiting the earth. Its position relative to the target (earth) can be set by three parameters, alpha (radians) the longitudinal rotation, beta (radians) the latitudinal rotation and radius the distance from the target position.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/camera_introduction#arc-rotate-camera\n */\nexport class ArcRotateCamera extends TargetCamera {\n /**\n * Defines the target point of the camera.\n * The camera looks towards it from the radius distance.\n */\n get target() {\n return this._target;\n }\n set target(value) {\n this.setTarget(value);\n }\n /**\n * Defines the target mesh of the camera.\n * The camera looks towards it from the radius distance.\n * Please note that setting a target host will disable panning.\n */\n get targetHost() {\n return this._targetHost;\n }\n set targetHost(value) {\n if (value) {\n this.setTarget(value);\n }\n }\n /**\n * Return the current target position of the camera. This value is expressed in local space.\n * @returns the target position\n */\n getTarget() {\n return this.target;\n }\n /**\n * Define the current local position of the camera in the scene\n */\n get position() {\n return this._position;\n }\n set position(newPosition) {\n this.setPosition(newPosition);\n }\n /**\n * The vector the camera should consider as up. (default is Vector3(0, 1, 0) as returned by Vector3.Up())\n * Setting this will copy the given vector to the camera's upVector, and set rotation matrices to and from Y up.\n * DO NOT set the up vector using copyFrom or copyFromFloats, as this bypasses setting the above matrices.\n */\n set upVector(vec) {\n if (!this._upToYMatrix) {\n this._yToUpMatrix = new Matrix();\n this._upToYMatrix = new Matrix();\n this._upVector = Vector3.Zero();\n }\n vec.normalize();\n this._upVector.copyFrom(vec);\n this.setMatUp();\n }\n get upVector() {\n return this._upVector;\n }\n /**\n * Sets the Y-up to camera up-vector rotation matrix, and the up-vector to Y-up rotation matrix.\n */\n setMatUp() {\n // from y-up to custom-up (used in _getViewMatrix)\n Matrix.RotationAlignToRef(Vector3.UpReadOnly, this._upVector, this._yToUpMatrix);\n // from custom-up to y-up (used in rebuildAnglesAndRadius)\n Matrix.RotationAlignToRef(this._upVector, Vector3.UpReadOnly, this._upToYMatrix);\n }\n //-- begin properties for backward compatibility for inputs\n /**\n * Gets or Set the pointer angular sensibility along the X axis or how fast is the camera rotating.\n */\n get angularSensibilityX() {\n const pointers = this.inputs.attached[\"pointers\"];\n if (pointers) {\n return pointers.angularSensibilityX;\n }\n return 0;\n }\n set angularSensibilityX(value) {\n const pointers = this.inputs.attached[\"pointers\"];\n if (pointers) {\n pointers.angularSensibilityX = value;\n }\n }\n /**\n * Gets or Set the pointer angular sensibility along the Y axis or how fast is the camera rotating.\n */\n get angularSensibilityY() {\n const pointers = this.inputs.attached[\"pointers\"];\n if (pointers) {\n return pointers.angularSensibilityY;\n }\n return 0;\n }\n set angularSensibilityY(value) {\n const pointers = this.inputs.attached[\"pointers\"];\n if (pointers) {\n pointers.angularSensibilityY = value;\n }\n }\n /**\n * Gets or Set the pointer pinch precision or how fast is the camera zooming.\n */\n get pinchPrecision() {\n const pointers = this.inputs.attached[\"pointers\"];\n if (pointers) {\n return pointers.pinchPrecision;\n }\n return 0;\n }\n set pinchPrecision(value) {\n const pointers = this.inputs.attached[\"pointers\"];\n if (pointers) {\n pointers.pinchPrecision = value;\n }\n }\n /**\n * Gets or Set the pointer pinch delta percentage or how fast is the camera zooming.\n * It will be used instead of pinchDeltaPrecision if different from 0.\n * It defines the percentage of current camera.radius to use as delta when pinch zoom is used.\n */\n get pinchDeltaPercentage() {\n const pointers = this.inputs.attached[\"pointers\"];\n if (pointers) {\n return pointers.pinchDeltaPercentage;\n }\n return 0;\n }\n set pinchDeltaPercentage(value) {\n const pointers = this.inputs.attached[\"pointers\"];\n if (pointers) {\n pointers.pinchDeltaPercentage = value;\n }\n }\n /**\n * Gets or Set the pointer use natural pinch zoom to override the pinch precision\n * and pinch delta percentage.\n * When useNaturalPinchZoom is true, multi touch zoom will zoom in such\n * that any object in the plane at the camera's target point will scale\n * perfectly with finger motion.\n */\n get useNaturalPinchZoom() {\n const pointers = this.inputs.attached[\"pointers\"];\n if (pointers) {\n return pointers.useNaturalPinchZoom;\n }\n return false;\n }\n set useNaturalPinchZoom(value) {\n const pointers = this.inputs.attached[\"pointers\"];\n if (pointers) {\n pointers.useNaturalPinchZoom = value;\n }\n }\n /**\n * Gets or Set the pointer panning sensibility or how fast is the camera moving.\n */\n get panningSensibility() {\n const pointers = this.inputs.attached[\"pointers\"];\n if (pointers) {\n return pointers.panningSensibility;\n }\n return 0;\n }\n set panningSensibility(value) {\n const pointers = this.inputs.attached[\"pointers\"];\n if (pointers) {\n pointers.panningSensibility = value;\n }\n }\n /**\n * Gets or Set the list of keyboard keys used to control beta angle in a positive direction.\n */\n get keysUp() {\n const keyboard = this.inputs.attached[\"keyboard\"];\n if (keyboard) {\n return keyboard.keysUp;\n }\n return [];\n }\n set keysUp(value) {\n const keyboard = this.inputs.attached[\"keyboard\"];\n if (keyboard) {\n keyboard.keysUp = value;\n }\n }\n /**\n * Gets or Set the list of keyboard keys used to control beta angle in a negative direction.\n */\n get keysDown() {\n const keyboard = this.inputs.attached[\"keyboard\"];\n if (keyboard) {\n return keyboard.keysDown;\n }\n return [];\n }\n set keysDown(value) {\n const keyboard = this.inputs.attached[\"keyboard\"];\n if (keyboard) {\n keyboard.keysDown = value;\n }\n }\n /**\n * Gets or Set the list of keyboard keys used to control alpha angle in a negative direction.\n */\n get keysLeft() {\n const keyboard = this.inputs.attached[\"keyboard\"];\n if (keyboard) {\n return keyboard.keysLeft;\n }\n return [];\n }\n set keysLeft(value) {\n const keyboard = this.inputs.attached[\"keyboard\"];\n if (keyboard) {\n keyboard.keysLeft = value;\n }\n }\n /**\n * Gets or Set the list of keyboard keys used to control alpha angle in a positive direction.\n */\n get keysRight() {\n const keyboard = this.inputs.attached[\"keyboard\"];\n if (keyboard) {\n return keyboard.keysRight;\n }\n return [];\n }\n set keysRight(value) {\n const keyboard = this.inputs.attached[\"keyboard\"];\n if (keyboard) {\n keyboard.keysRight = value;\n }\n }\n /**\n * Gets or Set the mouse wheel precision or how fast is the camera zooming.\n */\n get wheelPrecision() {\n const mousewheel = this.inputs.attached[\"mousewheel\"];\n if (mousewheel) {\n return mousewheel.wheelPrecision;\n }\n return 0;\n }\n set wheelPrecision(value) {\n const mousewheel = this.inputs.attached[\"mousewheel\"];\n if (mousewheel) {\n mousewheel.wheelPrecision = value;\n }\n }\n /**\n * Gets or Set the boolean value that controls whether or not the mouse wheel\n * zooms to the location of the mouse pointer or not. The default is false.\n */\n get zoomToMouseLocation() {\n const mousewheel = this.inputs.attached[\"mousewheel\"];\n if (mousewheel) {\n return mousewheel.zoomToMouseLocation;\n }\n return false;\n }\n set zoomToMouseLocation(value) {\n const mousewheel = this.inputs.attached[\"mousewheel\"];\n if (mousewheel) {\n mousewheel.zoomToMouseLocation = value;\n }\n }\n /**\n * Gets or Set the mouse wheel delta percentage or how fast is the camera zooming.\n * It will be used instead of pinchDeltaPrecision if different from 0.\n * It defines the percentage of current camera.radius to use as delta when pinch zoom is used.\n */\n get wheelDeltaPercentage() {\n const mousewheel = this.inputs.attached[\"mousewheel\"];\n if (mousewheel) {\n return mousewheel.wheelDeltaPercentage;\n }\n return 0;\n }\n set wheelDeltaPercentage(value) {\n const mousewheel = this.inputs.attached[\"mousewheel\"];\n if (mousewheel) {\n mousewheel.wheelDeltaPercentage = value;\n }\n }\n /**\n * Gets the bouncing behavior of the camera if it has been enabled.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/behaviors/cameraBehaviors#bouncing-behavior\n */\n get bouncingBehavior() {\n return this._bouncingBehavior;\n }\n /**\n * Defines if the bouncing behavior of the camera is enabled on the camera.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/behaviors/cameraBehaviors#bouncing-behavior\n */\n get useBouncingBehavior() {\n return this._bouncingBehavior != null;\n }\n set useBouncingBehavior(value) {\n if (value === this.useBouncingBehavior) {\n return;\n }\n if (value) {\n this._bouncingBehavior = new BouncingBehavior();\n this.addBehavior(this._bouncingBehavior);\n }\n else if (this._bouncingBehavior) {\n this.removeBehavior(this._bouncingBehavior);\n this._bouncingBehavior = null;\n }\n }\n /**\n * Gets the framing behavior of the camera if it has been enabled.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/behaviors/cameraBehaviors#framing-behavior\n */\n get framingBehavior() {\n return this._framingBehavior;\n }\n /**\n * Defines if the framing behavior of the camera is enabled on the camera.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/behaviors/cameraBehaviors#framing-behavior\n */\n get useFramingBehavior() {\n return this._framingBehavior != null;\n }\n set useFramingBehavior(value) {\n if (value === this.useFramingBehavior) {\n return;\n }\n if (value) {\n this._framingBehavior = new FramingBehavior();\n this.addBehavior(this._framingBehavior);\n }\n else if (this._framingBehavior) {\n this.removeBehavior(this._framingBehavior);\n this._framingBehavior = null;\n }\n }\n /**\n * Gets the auto rotation behavior of the camera if it has been enabled.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/behaviors/cameraBehaviors#autorotation-behavior\n */\n get autoRotationBehavior() {\n return this._autoRotationBehavior;\n }\n /**\n * Defines if the auto rotation behavior of the camera is enabled on the camera.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/behaviors/cameraBehaviors#autorotation-behavior\n */\n get useAutoRotationBehavior() {\n return this._autoRotationBehavior != null;\n }\n set useAutoRotationBehavior(value) {\n if (value === this.useAutoRotationBehavior) {\n return;\n }\n if (value) {\n this._autoRotationBehavior = new AutoRotationBehavior();\n this.addBehavior(this._autoRotationBehavior);\n }\n else if (this._autoRotationBehavior) {\n this.removeBehavior(this._autoRotationBehavior);\n this._autoRotationBehavior = null;\n }\n }\n /**\n * Instantiates a new ArcRotateCamera in a given scene\n * @param name Defines the name of the camera\n * @param alpha Defines the camera rotation along the longitudinal axis\n * @param beta Defines the camera rotation along the latitudinal axis\n * @param radius Defines the camera distance from its target\n * @param target Defines the camera target\n * @param scene Defines the scene the camera belongs to\n * @param setActiveOnSceneIfNoneActive Defines whether the camera should be marked as active if not other active cameras have been defined\n */\n constructor(name, alpha, beta, radius, target, scene, setActiveOnSceneIfNoneActive = true) {\n super(name, Vector3.Zero(), scene, setActiveOnSceneIfNoneActive);\n /**\n * Current inertia value on the longitudinal axis.\n * The bigger this number the longer it will take for the camera to stop.\n */\n this.inertialAlphaOffset = 0;\n /**\n * Current inertia value on the latitudinal axis.\n * The bigger this number the longer it will take for the camera to stop.\n */\n this.inertialBetaOffset = 0;\n /**\n * Current inertia value on the radius axis.\n * The bigger this number the longer it will take for the camera to stop.\n */\n this.inertialRadiusOffset = 0;\n /**\n * Minimum allowed angle on the longitudinal axis.\n * This can help limiting how the Camera is able to move in the scene.\n */\n this.lowerAlphaLimit = null;\n /**\n * Maximum allowed angle on the longitudinal axis.\n * This can help limiting how the Camera is able to move in the scene.\n */\n this.upperAlphaLimit = null;\n /**\n * Minimum allowed angle on the latitudinal axis.\n * This can help limiting how the Camera is able to move in the scene.\n */\n this.lowerBetaLimit = 0.01;\n /**\n * Maximum allowed angle on the latitudinal axis.\n * This can help limiting how the Camera is able to move in the scene.\n */\n this.upperBetaLimit = Math.PI - 0.01;\n /**\n * Minimum allowed distance of the camera to the target (The camera can not get closer).\n * This can help limiting how the Camera is able to move in the scene.\n */\n this.lowerRadiusLimit = null;\n /**\n * Maximum allowed distance of the camera to the target (The camera can not get further).\n * This can help limiting how the Camera is able to move in the scene.\n */\n this.upperRadiusLimit = null;\n /**\n * Defines the current inertia value used during panning of the camera along the X axis.\n */\n this.inertialPanningX = 0;\n /**\n * Defines the current inertia value used during panning of the camera along the Y axis.\n */\n this.inertialPanningY = 0;\n /**\n * Defines the distance used to consider the camera in pan mode vs pinch/zoom.\n * Basically if your fingers moves away from more than this distance you will be considered\n * in pinch mode.\n */\n this.pinchToPanMaxDistance = 20;\n /**\n * Defines the maximum distance the camera can pan.\n * This could help keeping the camera always in your scene.\n */\n this.panningDistanceLimit = null;\n /**\n * Defines the target of the camera before panning.\n */\n this.panningOriginTarget = Vector3.Zero();\n /**\n * Defines the value of the inertia used during panning.\n * 0 would mean stop inertia and one would mean no deceleration at all.\n */\n this.panningInertia = 0.9;\n //-- end properties for backward compatibility for inputs\n /**\n * Defines how much the radius should be scaled while zooming on a particular mesh (through the zoomOn function)\n */\n this.zoomOnFactor = 1;\n /**\n * Defines a screen offset for the camera position.\n */\n this.targetScreenOffset = Vector2.Zero();\n /**\n * Allows the camera to be completely reversed.\n * If false the camera can not arrive upside down.\n */\n this.allowUpsideDown = true;\n /**\n * Define if double tap/click is used to restore the previously saved state of the camera.\n */\n this.useInputToRestoreState = true;\n /** @internal */\n this._viewMatrix = new Matrix();\n /**\n * Defines the allowed panning axis.\n */\n this.panningAxis = new Vector3(1, 1, 0);\n this._transformedDirection = new Vector3();\n /**\n * Defines if camera will eliminate transform on y axis.\n */\n this.mapPanning = false;\n /**\n * Observable triggered when the mesh target has been changed on the camera.\n */\n this.onMeshTargetChangedObservable = new Observable();\n /**\n * Defines whether the camera should check collision with the objects oh the scene.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/camera_collisions#how-can-i-do-this-\n */\n this.checkCollisions = false;\n /**\n * Defines the collision radius of the camera.\n * This simulates a sphere around the camera.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/camera_collisions#arcrotatecamera\n */\n this.collisionRadius = new Vector3(0.5, 0.5, 0.5);\n this._previousPosition = Vector3.Zero();\n this._collisionVelocity = Vector3.Zero();\n this._newPosition = Vector3.Zero();\n this._computationVector = Vector3.Zero();\n this._onCollisionPositionChange = (collisionId, newPosition, collidedMesh = null) => {\n if (!collidedMesh) {\n this._previousPosition.copyFrom(this._position);\n }\n else {\n this.setPosition(newPosition);\n if (this.onCollide) {\n this.onCollide(collidedMesh);\n }\n }\n // Recompute because of constraints\n const cosa = Math.cos(this.alpha);\n const sina = Math.sin(this.alpha);\n const cosb = Math.cos(this.beta);\n let sinb = Math.sin(this.beta);\n if (sinb === 0) {\n sinb = 0.0001;\n }\n const target = this._getTargetPosition();\n this._computationVector.copyFromFloats(this.radius * cosa * sinb, this.radius * cosb, this.radius * sina * sinb);\n target.addToRef(this._computationVector, this._newPosition);\n this._position.copyFrom(this._newPosition);\n let up = this.upVector;\n if (this.allowUpsideDown && this.beta < 0) {\n up = up.clone();\n up = up.negate();\n }\n this._computeViewMatrix(this._position, target, up);\n this._viewMatrix.addAtIndex(12, this.targetScreenOffset.x);\n this._viewMatrix.addAtIndex(13, this.targetScreenOffset.y);\n this._collisionTriggered = false;\n };\n this._target = Vector3.Zero();\n if (target) {\n this.setTarget(target);\n }\n this.alpha = alpha;\n this.beta = beta;\n this.radius = radius;\n this.getViewMatrix();\n this.inputs = new ArcRotateCameraInputsManager(this);\n this.inputs.addKeyboard().addMouseWheel().addPointers();\n }\n // Cache\n /** @internal */\n _initCache() {\n super._initCache();\n this._cache._target = new Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);\n this._cache.alpha = undefined;\n this._cache.beta = undefined;\n this._cache.radius = undefined;\n this._cache.targetScreenOffset = Vector2.Zero();\n }\n /**\n * @internal\n */\n _updateCache(ignoreParentClass) {\n if (!ignoreParentClass) {\n super._updateCache();\n }\n this._cache._target.copyFrom(this._getTargetPosition());\n this._cache.alpha = this.alpha;\n this._cache.beta = this.beta;\n this._cache.radius = this.radius;\n this._cache.targetScreenOffset.copyFrom(this.targetScreenOffset);\n }\n _getTargetPosition() {\n if (this._targetHost && this._targetHost.getAbsolutePosition) {\n const pos = this._targetHost.getAbsolutePosition();\n if (this._targetBoundingCenter) {\n pos.addToRef(this._targetBoundingCenter, this._target);\n }\n else {\n this._target.copyFrom(pos);\n }\n }\n const lockedTargetPosition = this._getLockedTargetPosition();\n if (lockedTargetPosition) {\n return lockedTargetPosition;\n }\n return this._target;\n }\n /**\n * Stores the current state of the camera (alpha, beta, radius and target)\n * @returns the camera itself\n */\n storeState() {\n this._storedAlpha = this.alpha;\n this._storedBeta = this.beta;\n this._storedRadius = this.radius;\n this._storedTarget = this._getTargetPosition().clone();\n this._storedTargetScreenOffset = this.targetScreenOffset.clone();\n return super.storeState();\n }\n /**\n * @internal\n * Restored camera state. You must call storeState() first\n */\n _restoreStateValues() {\n if (!super._restoreStateValues()) {\n return false;\n }\n this.setTarget(this._storedTarget.clone());\n this.alpha = this._storedAlpha;\n this.beta = this._storedBeta;\n this.radius = this._storedRadius;\n this.targetScreenOffset = this._storedTargetScreenOffset.clone();\n this.inertialAlphaOffset = 0;\n this.inertialBetaOffset = 0;\n this.inertialRadiusOffset = 0;\n this.inertialPanningX = 0;\n this.inertialPanningY = 0;\n return true;\n }\n // Synchronized\n /** @internal */\n _isSynchronizedViewMatrix() {\n if (!super._isSynchronizedViewMatrix()) {\n return false;\n }\n return (this._cache._target.equals(this._getTargetPosition()) &&\n this._cache.alpha === this.alpha &&\n this._cache.beta === this.beta &&\n this._cache.radius === this.radius &&\n this._cache.targetScreenOffset.equals(this.targetScreenOffset));\n }\n /**\n * Attached controls to the current camera.\n * @param ignored defines an ignored parameter kept for backward compatibility.\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\n * @param useCtrlForPanning Defines whether ctrl is used for panning within the controls\n * @param panningMouseButton Defines whether panning is allowed through mouse click button\n */\n attachControl(ignored, noPreventDefault, useCtrlForPanning = true, panningMouseButton = 2) {\n // eslint-disable-next-line prefer-rest-params\n const args = arguments;\n noPreventDefault = Tools.BackCompatCameraNoPreventDefault(args);\n this._useCtrlForPanning = useCtrlForPanning;\n this._panningMouseButton = panningMouseButton;\n // backwards compatibility\n if (typeof args[0] === \"boolean\") {\n if (args.length > 1) {\n this._useCtrlForPanning = args[1];\n }\n if (args.length > 2) {\n this._panningMouseButton = args[2];\n }\n }\n this.inputs.attachElement(noPreventDefault);\n this._reset = () => {\n this.inertialAlphaOffset = 0;\n this.inertialBetaOffset = 0;\n this.inertialRadiusOffset = 0;\n this.inertialPanningX = 0;\n this.inertialPanningY = 0;\n };\n }\n /**\n * Detach the current controls from the specified dom element.\n */\n detachControl() {\n this.inputs.detachElement();\n if (this._reset) {\n this._reset();\n }\n }\n /** @internal */\n _checkInputs() {\n //if (async) collision inspection was triggered, don't update the camera's position - until the collision callback was called.\n if (this._collisionTriggered) {\n return;\n }\n this.inputs.checkInputs();\n // Inertia\n if (this.inertialAlphaOffset !== 0 || this.inertialBetaOffset !== 0 || this.inertialRadiusOffset !== 0) {\n const directionModifier = this.invertRotation ? -1 : 1;\n const handednessMultiplier = this._calculateHandednessMultiplier();\n let inertialAlphaOffset = this.inertialAlphaOffset * handednessMultiplier;\n if (this.beta <= 0) {\n inertialAlphaOffset *= -1;\n }\n this.alpha += inertialAlphaOffset * directionModifier;\n this.beta += this.inertialBetaOffset * directionModifier;\n this.radius -= this.inertialRadiusOffset;\n this.inertialAlphaOffset *= this.inertia;\n this.inertialBetaOffset *= this.inertia;\n this.inertialRadiusOffset *= this.inertia;\n if (Math.abs(this.inertialAlphaOffset) < Epsilon) {\n this.inertialAlphaOffset = 0;\n }\n if (Math.abs(this.inertialBetaOffset) < Epsilon) {\n this.inertialBetaOffset = 0;\n }\n if (Math.abs(this.inertialRadiusOffset) < this.speed * Epsilon) {\n this.inertialRadiusOffset = 0;\n }\n }\n // Panning inertia\n if (this.inertialPanningX !== 0 || this.inertialPanningY !== 0) {\n const localDirection = new Vector3(this.inertialPanningX, this.inertialPanningY, this.inertialPanningY);\n this._viewMatrix.invertToRef(this._cameraTransformMatrix);\n localDirection.multiplyInPlace(this.panningAxis);\n Vector3.TransformNormalToRef(localDirection, this._cameraTransformMatrix, this._transformedDirection);\n // Eliminate y if mapPanning is enabled\n if (this.mapPanning || !this.panningAxis.y) {\n this._transformedDirection.y = 0;\n }\n if (!this._targetHost) {\n if (this.panningDistanceLimit) {\n this._transformedDirection.addInPlace(this._target);\n const distanceSquared = Vector3.DistanceSquared(this._transformedDirection, this.panningOriginTarget);\n if (distanceSquared <= this.panningDistanceLimit * this.panningDistanceLimit) {\n this._target.copyFrom(this._transformedDirection);\n }\n }\n else {\n this._target.addInPlace(this._transformedDirection);\n }\n }\n this.inertialPanningX *= this.panningInertia;\n this.inertialPanningY *= this.panningInertia;\n if (Math.abs(this.inertialPanningX) < this.speed * Epsilon) {\n this.inertialPanningX = 0;\n }\n if (Math.abs(this.inertialPanningY) < this.speed * Epsilon) {\n this.inertialPanningY = 0;\n }\n }\n // Limits\n this._checkLimits();\n super._checkInputs();\n }\n _checkLimits() {\n if (this.lowerBetaLimit === null || this.lowerBetaLimit === undefined) {\n if (this.allowUpsideDown && this.beta > Math.PI) {\n this.beta = this.beta - 2 * Math.PI;\n }\n }\n else {\n if (this.beta < this.lowerBetaLimit) {\n this.beta = this.lowerBetaLimit;\n }\n }\n if (this.upperBetaLimit === null || this.upperBetaLimit === undefined) {\n if (this.allowUpsideDown && this.beta < -Math.PI) {\n this.beta = this.beta + 2 * Math.PI;\n }\n }\n else {\n if (this.beta > this.upperBetaLimit) {\n this.beta = this.upperBetaLimit;\n }\n }\n if (this.lowerAlphaLimit !== null && this.alpha < this.lowerAlphaLimit) {\n this.alpha = this.lowerAlphaLimit;\n }\n if (this.upperAlphaLimit !== null && this.alpha > this.upperAlphaLimit) {\n this.alpha = this.upperAlphaLimit;\n }\n if (this.lowerRadiusLimit !== null && this.radius < this.lowerRadiusLimit) {\n this.radius = this.lowerRadiusLimit;\n this.inertialRadiusOffset = 0;\n }\n if (this.upperRadiusLimit !== null && this.radius > this.upperRadiusLimit) {\n this.radius = this.upperRadiusLimit;\n this.inertialRadiusOffset = 0;\n }\n }\n /**\n * Rebuilds angles (alpha, beta) and radius from the give position and target\n */\n rebuildAnglesAndRadius() {\n this._position.subtractToRef(this._getTargetPosition(), this._computationVector);\n // need to rotate to Y up equivalent if up vector not Axis.Y\n if (this._upVector.x !== 0 || this._upVector.y !== 1.0 || this._upVector.z !== 0) {\n Vector3.TransformCoordinatesToRef(this._computationVector, this._upToYMatrix, this._computationVector);\n }\n this.radius = this._computationVector.length();\n if (this.radius === 0) {\n this.radius = 0.0001; // Just to avoid division by zero\n }\n // Alpha\n const previousAlpha = this.alpha;\n if (this._computationVector.x === 0 && this._computationVector.z === 0) {\n this.alpha = Math.PI / 2; // avoid division by zero when looking along up axis, and set to acos(0)\n }\n else {\n this.alpha = Math.acos(this._computationVector.x / Math.sqrt(Math.pow(this._computationVector.x, 2) + Math.pow(this._computationVector.z, 2)));\n }\n if (this._computationVector.z < 0) {\n this.alpha = 2 * Math.PI - this.alpha;\n }\n // Calculate the number of revolutions between the new and old alpha values.\n const alphaCorrectionTurns = Math.round((previousAlpha - this.alpha) / (2.0 * Math.PI));\n // Adjust alpha so that its numerical representation is the closest one to the old value.\n this.alpha += alphaCorrectionTurns * 2.0 * Math.PI;\n // Beta\n this.beta = Math.acos(this._computationVector.y / this.radius);\n this._checkLimits();\n }\n /**\n * Use a position to define the current camera related information like alpha, beta and radius\n * @param position Defines the position to set the camera at\n */\n setPosition(position) {\n if (this._position.equals(position)) {\n return;\n }\n this._position.copyFrom(position);\n this.rebuildAnglesAndRadius();\n }\n /**\n * Defines the target the camera should look at.\n * This will automatically adapt alpha beta and radius to fit within the new target.\n * Please note that setting a target as a mesh will disable panning.\n * @param target Defines the new target as a Vector or a mesh\n * @param toBoundingCenter In case of a mesh target, defines whether to target the mesh position or its bounding information center\n * @param allowSamePosition If false, prevents reapplying the new computed position if it is identical to the current one (optim)\n * @param cloneAlphaBetaRadius If true, replicate the current setup (alpha, beta, radius) on the new target\n */\n setTarget(target, toBoundingCenter = false, allowSamePosition = false, cloneAlphaBetaRadius = false) {\n var _a;\n cloneAlphaBetaRadius = (_a = this.overrideCloneAlphaBetaRadius) !== null && _a !== void 0 ? _a : cloneAlphaBetaRadius;\n if (target.getBoundingInfo) {\n if (toBoundingCenter) {\n this._targetBoundingCenter = target.getBoundingInfo().boundingBox.centerWorld.clone();\n }\n else {\n this._targetBoundingCenter = null;\n }\n target.computeWorldMatrix();\n this._targetHost = target;\n this._target = this._getTargetPosition();\n this.onMeshTargetChangedObservable.notifyObservers(this._targetHost);\n }\n else {\n const newTarget = target;\n const currentTarget = this._getTargetPosition();\n if (currentTarget && !allowSamePosition && currentTarget.equals(newTarget)) {\n return;\n }\n this._targetHost = null;\n this._target = newTarget;\n this._targetBoundingCenter = null;\n this.onMeshTargetChangedObservable.notifyObservers(null);\n }\n if (!cloneAlphaBetaRadius) {\n this.rebuildAnglesAndRadius();\n }\n }\n /** @internal */\n _getViewMatrix() {\n // Compute\n const cosa = Math.cos(this.alpha);\n const sina = Math.sin(this.alpha);\n const cosb = Math.cos(this.beta);\n let sinb = Math.sin(this.beta);\n if (sinb === 0) {\n sinb = 0.0001;\n }\n if (this.radius === 0) {\n this.radius = 0.0001; // Just to avoid division by zero\n }\n const target = this._getTargetPosition();\n this._computationVector.copyFromFloats(this.radius * cosa * sinb, this.radius * cosb, this.radius * sina * sinb);\n // Rotate according to up vector\n if (this._upVector.x !== 0 || this._upVector.y !== 1.0 || this._upVector.z !== 0) {\n Vector3.TransformCoordinatesToRef(this._computationVector, this._yToUpMatrix, this._computationVector);\n }\n target.addToRef(this._computationVector, this._newPosition);\n if (this.getScene().collisionsEnabled && this.checkCollisions) {\n const coordinator = this.getScene().collisionCoordinator;\n if (!this._collider) {\n this._collider = coordinator.createCollider();\n }\n this._collider._radius = this.collisionRadius;\n this._newPosition.subtractToRef(this._position, this._collisionVelocity);\n this._collisionTriggered = true;\n coordinator.getNewPosition(this._position, this._collisionVelocity, this._collider, 3, null, this._onCollisionPositionChange, this.uniqueId);\n }\n else {\n this._position.copyFrom(this._newPosition);\n let up = this.upVector;\n if (this.allowUpsideDown && sinb < 0) {\n up = up.negate();\n }\n this._computeViewMatrix(this._position, target, up);\n this._viewMatrix.addAtIndex(12, this.targetScreenOffset.x);\n this._viewMatrix.addAtIndex(13, this.targetScreenOffset.y);\n }\n this._currentTarget = target;\n return this._viewMatrix;\n }\n /**\n * Zooms on a mesh to be at the min distance where we could see it fully in the current viewport.\n * @param meshes Defines the mesh to zoom on\n * @param doNotUpdateMaxZ Defines whether or not maxZ should be updated whilst zooming on the mesh (this can happen if the mesh is big and the maxradius pretty small for instance)\n */\n zoomOn(meshes, doNotUpdateMaxZ = false) {\n meshes = meshes || this.getScene().meshes;\n const minMaxVector = Mesh.MinMax(meshes);\n const distance = Vector3.Distance(minMaxVector.min, minMaxVector.max);\n this.radius = distance * this.zoomOnFactor;\n this.focusOn({ min: minMaxVector.min, max: minMaxVector.max, distance: distance }, doNotUpdateMaxZ);\n }\n /**\n * Focus on a mesh or a bounding box. This adapts the target and maxRadius if necessary but does not update the current radius.\n * The target will be changed but the radius\n * @param meshesOrMinMaxVectorAndDistance Defines the mesh or bounding info to focus on\n * @param doNotUpdateMaxZ Defines whether or not maxZ should be updated whilst zooming on the mesh (this can happen if the mesh is big and the maxradius pretty small for instance)\n */\n focusOn(meshesOrMinMaxVectorAndDistance, doNotUpdateMaxZ = false) {\n let meshesOrMinMaxVector;\n let distance;\n if (meshesOrMinMaxVectorAndDistance.min === undefined) {\n // meshes\n const meshes = meshesOrMinMaxVectorAndDistance || this.getScene().meshes;\n meshesOrMinMaxVector = Mesh.MinMax(meshes);\n distance = Vector3.Distance(meshesOrMinMaxVector.min, meshesOrMinMaxVector.max);\n }\n else {\n //minMaxVector and distance\n const minMaxVectorAndDistance = meshesOrMinMaxVectorAndDistance;\n meshesOrMinMaxVector = minMaxVectorAndDistance;\n distance = minMaxVectorAndDistance.distance;\n }\n this._target = Mesh.Center(meshesOrMinMaxVector);\n if (!doNotUpdateMaxZ) {\n this.maxZ = distance * 2;\n }\n }\n /**\n * @override\n * Override Camera.createRigCamera\n */\n createRigCamera(name, cameraIndex) {\n let alphaShift = 0;\n switch (this.cameraRigMode) {\n case Camera.RIG_MODE_STEREOSCOPIC_ANAGLYPH:\n case Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:\n case Camera.RIG_MODE_STEREOSCOPIC_OVERUNDER:\n case Camera.RIG_MODE_STEREOSCOPIC_INTERLACED:\n case Camera.RIG_MODE_VR:\n alphaShift = this._cameraRigParams.stereoHalfAngle * (cameraIndex === 0 ? 1 : -1);\n break;\n case Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:\n alphaShift = this._cameraRigParams.stereoHalfAngle * (cameraIndex === 0 ? -1 : 1);\n break;\n }\n const rigCam = new ArcRotateCamera(name, this.alpha + alphaShift, this.beta, this.radius, this._target, this.getScene());\n rigCam._cameraRigParams = {};\n rigCam.isRigCamera = true;\n rigCam.rigParent = this;\n rigCam.upVector = this.upVector;\n rigCam.mode = this.mode;\n rigCam.orthoLeft = this.orthoLeft;\n rigCam.orthoRight = this.orthoRight;\n rigCam.orthoBottom = this.orthoBottom;\n rigCam.orthoTop = this.orthoTop;\n return rigCam;\n }\n /**\n * @internal\n * @override\n * Override Camera._updateRigCameras\n */\n _updateRigCameras() {\n const camLeft = this._rigCameras[0];\n const camRight = this._rigCameras[1];\n camLeft.beta = camRight.beta = this.beta;\n switch (this.cameraRigMode) {\n case Camera.RIG_MODE_STEREOSCOPIC_ANAGLYPH:\n case Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:\n case Camera.RIG_MODE_STEREOSCOPIC_OVERUNDER:\n case Camera.RIG_MODE_STEREOSCOPIC_INTERLACED:\n case Camera.RIG_MODE_VR:\n camLeft.alpha = this.alpha - this._cameraRigParams.stereoHalfAngle;\n camRight.alpha = this.alpha + this._cameraRigParams.stereoHalfAngle;\n break;\n case Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:\n camLeft.alpha = this.alpha + this._cameraRigParams.stereoHalfAngle;\n camRight.alpha = this.alpha - this._cameraRigParams.stereoHalfAngle;\n break;\n }\n super._updateRigCameras();\n }\n /**\n * Destroy the camera and release the current resources hold by it.\n */\n dispose() {\n this.inputs.clear();\n super.dispose();\n }\n /**\n * Gets the current object class name.\n * @returns the class name\n */\n getClassName() {\n return \"ArcRotateCamera\";\n }\n}\n__decorate([\n serialize()\n], ArcRotateCamera.prototype, \"alpha\", void 0);\n__decorate([\n serialize()\n], ArcRotateCamera.prototype, \"beta\", void 0);\n__decorate([\n serialize()\n], ArcRotateCamera.prototype, \"radius\", void 0);\n__decorate([\n serialize()\n], ArcRotateCamera.prototype, \"overrideCloneAlphaBetaRadius\", void 0);\n__decorate([\n serializeAsVector3(\"target\")\n], ArcRotateCamera.prototype, \"_target\", void 0);\n__decorate([\n serializeAsMeshReference(\"targetHost\")\n], ArcRotateCamera.prototype, \"_targetHost\", void 0);\n__decorate([\n serialize()\n], ArcRotateCamera.prototype, \"inertialAlphaOffset\", void 0);\n__decorate([\n serialize()\n], ArcRotateCamera.prototype, \"inertialBetaOffset\", void 0);\n__decorate([\n serialize()\n], ArcRotateCamera.prototype, \"inertialRadiusOffset\", void 0);\n__decorate([\n serialize()\n], ArcRotateCamera.prototype, \"lowerAlphaLimit\", void 0);\n__decorate([\n serialize()\n], ArcRotateCamera.prototype, \"upperAlphaLimit\", void 0);\n__decorate([\n serialize()\n], ArcRotateCamera.prototype, \"lowerBetaLimit\", void 0);\n__decorate([\n serialize()\n], ArcRotateCamera.prototype, \"upperBetaLimit\", void 0);\n__decorate([\n serialize()\n], ArcRotateCamera.prototype, \"lowerRadiusLimit\", void 0);\n__decorate([\n serialize()\n], ArcRotateCamera.prototype, \"upperRadiusLimit\", void 0);\n__decorate([\n serialize()\n], ArcRotateCamera.prototype, \"inertialPanningX\", void 0);\n__decorate([\n serialize()\n], ArcRotateCamera.prototype, \"inertialPanningY\", void 0);\n__decorate([\n serialize()\n], ArcRotateCamera.prototype, \"pinchToPanMaxDistance\", void 0);\n__decorate([\n serialize()\n], ArcRotateCamera.prototype, \"panningDistanceLimit\", void 0);\n__decorate([\n serializeAsVector3()\n], ArcRotateCamera.prototype, \"panningOriginTarget\", void 0);\n__decorate([\n serialize()\n], ArcRotateCamera.prototype, \"panningInertia\", void 0);\n__decorate([\n serialize()\n], ArcRotateCamera.prototype, \"zoomToMouseLocation\", null);\n__decorate([\n serialize()\n], ArcRotateCamera.prototype, \"zoomOnFactor\", void 0);\n__decorate([\n serializeAsVector2()\n], ArcRotateCamera.prototype, \"targetScreenOffset\", void 0);\n__decorate([\n serialize()\n], ArcRotateCamera.prototype, \"allowUpsideDown\", void 0);\n__decorate([\n serialize()\n], ArcRotateCamera.prototype, \"useInputToRestoreState\", void 0);\n//# sourceMappingURL=arcRotateCamera.js.map","\nimport { Size } from \"../../Maths/math.size.js\";\n/**\n * Base class of all the textures in babylon.\n * It groups all the common properties required to work with Thin Engine.\n */\nexport class ThinTexture {\n /**\n * | Value | Type | Description |\n * | ----- | ------------------ | ----------- |\n * | 0 | CLAMP_ADDRESSMODE | |\n * | 1 | WRAP_ADDRESSMODE | |\n * | 2 | MIRROR_ADDRESSMODE | |\n */\n get wrapU() {\n return this._wrapU;\n }\n set wrapU(value) {\n this._wrapU = value;\n }\n /**\n * | Value | Type | Description |\n * | ----- | ------------------ | ----------- |\n * | 0 | CLAMP_ADDRESSMODE | |\n * | 1 | WRAP_ADDRESSMODE | |\n * | 2 | MIRROR_ADDRESSMODE | |\n */\n get wrapV() {\n return this._wrapV;\n }\n set wrapV(value) {\n this._wrapV = value;\n }\n /**\n * How a texture is mapped.\n * Unused in thin texture mode.\n */\n get coordinatesMode() {\n return 0;\n }\n /**\n * Define if the texture is a cube texture or if false a 2d texture.\n */\n get isCube() {\n if (!this._texture) {\n return false;\n }\n return this._texture.isCube;\n }\n set isCube(value) {\n if (!this._texture) {\n return;\n }\n this._texture.isCube = value;\n }\n /**\n * Define if the texture is a 3d texture (webgl 2) or if false a 2d texture.\n */\n get is3D() {\n if (!this._texture) {\n return false;\n }\n return this._texture.is3D;\n }\n set is3D(value) {\n if (!this._texture) {\n return;\n }\n this._texture.is3D = value;\n }\n /**\n * Define if the texture is a 2d array texture (webgl 2) or if false a 2d texture.\n */\n get is2DArray() {\n if (!this._texture) {\n return false;\n }\n return this._texture.is2DArray;\n }\n set is2DArray(value) {\n if (!this._texture) {\n return;\n }\n this._texture.is2DArray = value;\n }\n /**\n * Get the class name of the texture.\n * @returns \"ThinTexture\"\n */\n getClassName() {\n return \"ThinTexture\";\n }\n static _IsRenderTargetWrapper(texture) {\n return (texture === null || texture === void 0 ? void 0 : texture._shareDepth) !== undefined;\n }\n /**\n * Instantiates a new ThinTexture.\n * Base class of all the textures in babylon.\n * This can be used as an internal texture wrapper in ThinEngine to benefit from the cache\n * @param internalTexture Define the internalTexture to wrap. You can also pass a RenderTargetWrapper, in which case the texture will be the render target's texture\n */\n constructor(internalTexture) {\n this._wrapU = 1;\n this._wrapV = 1;\n /**\n * | Value | Type | Description |\n * | ----- | ------------------ | ----------- |\n * | 0 | CLAMP_ADDRESSMODE | |\n * | 1 | WRAP_ADDRESSMODE | |\n * | 2 | MIRROR_ADDRESSMODE | |\n */\n this.wrapR = 1;\n /**\n * With compliant hardware and browser (supporting anisotropic filtering)\n * this defines the level of anisotropic filtering in the texture.\n * The higher the better but the slower. This defaults to 4 as it seems to be the best tradeoff.\n */\n this.anisotropicFilteringLevel = 4;\n /**\n * Define the current state of the loading sequence when in delayed load mode.\n */\n this.delayLoadState = 0;\n /** @internal */\n this._texture = null;\n this._engine = null;\n this._cachedSize = Size.Zero();\n this._cachedBaseSize = Size.Zero();\n /** @internal */\n this._initialSamplingMode = 2;\n this._texture = ThinTexture._IsRenderTargetWrapper(internalTexture) ? internalTexture.texture : internalTexture;\n if (this._texture) {\n this._engine = this._texture.getEngine();\n }\n }\n /**\n * Get if the texture is ready to be used (downloaded, converted, mip mapped...).\n * @returns true if fully ready\n */\n isReady() {\n if (this.delayLoadState === 4) {\n this.delayLoad();\n return false;\n }\n if (this._texture) {\n return this._texture.isReady;\n }\n return false;\n }\n /**\n * Triggers the load sequence in delayed load mode.\n */\n delayLoad() { }\n /**\n * Get the underlying lower level texture from Babylon.\n * @returns the internal texture\n */\n getInternalTexture() {\n return this._texture;\n }\n /**\n * Get the size of the texture.\n * @returns the texture size.\n */\n getSize() {\n if (this._texture) {\n if (this._texture.width) {\n this._cachedSize.width = this._texture.width;\n this._cachedSize.height = this._texture.height;\n return this._cachedSize;\n }\n if (this._texture._size) {\n this._cachedSize.width = this._texture._size;\n this._cachedSize.height = this._texture._size;\n return this._cachedSize;\n }\n }\n return this._cachedSize;\n }\n /**\n * Get the base size of the texture.\n * It can be different from the size if the texture has been resized for POT for instance\n * @returns the base size\n */\n getBaseSize() {\n if (!this.isReady() || !this._texture) {\n this._cachedBaseSize.width = 0;\n this._cachedBaseSize.height = 0;\n return this._cachedBaseSize;\n }\n if (this._texture._size) {\n this._cachedBaseSize.width = this._texture._size;\n this._cachedBaseSize.height = this._texture._size;\n return this._cachedBaseSize;\n }\n this._cachedBaseSize.width = this._texture.baseWidth;\n this._cachedBaseSize.height = this._texture.baseHeight;\n return this._cachedBaseSize;\n }\n /**\n * Get the current sampling mode associated with the texture.\n */\n get samplingMode() {\n if (!this._texture) {\n return this._initialSamplingMode;\n }\n return this._texture.samplingMode;\n }\n /**\n * Update the sampling mode of the texture.\n * Default is Trilinear mode.\n *\n * | Value | Type | Description |\n * | ----- | ------------------ | ----------- |\n * | 1 | NEAREST_SAMPLINGMODE or NEAREST_NEAREST_MIPLINEAR | Nearest is: mag = nearest, min = nearest, mip = linear |\n * | 2 | BILINEAR_SAMPLINGMODE or LINEAR_LINEAR_MIPNEAREST | Bilinear is: mag = linear, min = linear, mip = nearest |\n * | 3 | TRILINEAR_SAMPLINGMODE or LINEAR_LINEAR_MIPLINEAR | Trilinear is: mag = linear, min = linear, mip = linear |\n * | 4 | NEAREST_NEAREST_MIPNEAREST | |\n * | 5 | NEAREST_LINEAR_MIPNEAREST | |\n * | 6 | NEAREST_LINEAR_MIPLINEAR | |\n * | 7 | NEAREST_LINEAR | |\n * | 8 | NEAREST_NEAREST | |\n * | 9 | LINEAR_NEAREST_MIPNEAREST | |\n * | 10 | LINEAR_NEAREST_MIPLINEAR | |\n * | 11 | LINEAR_LINEAR | |\n * | 12 | LINEAR_NEAREST | |\n *\n * > _mag_: magnification filter (close to the viewer)\n * > _min_: minification filter (far from the viewer)\n * > _mip_: filter used between mip map levels\n *@param samplingMode Define the new sampling mode of the texture\n */\n updateSamplingMode(samplingMode) {\n if (this._texture && this._engine) {\n this._engine.updateTextureSamplingMode(samplingMode, this._texture);\n }\n }\n /**\n * Release and destroy the underlying lower level texture aka internalTexture.\n */\n releaseInternalTexture() {\n if (this._texture) {\n this._texture.dispose();\n this._texture = null;\n }\n }\n /**\n * Dispose the texture and release its associated resources.\n */\n dispose() {\n if (this._texture) {\n this.releaseInternalTexture();\n this._engine = null;\n }\n }\n}\n//# sourceMappingURL=thinTexture.js.map","import { __decorate } from \"../../tslib.es6.js\";\nimport { serialize, SerializationHelper, serializeAsTexture } from \"../../Misc/decorators.js\";\nimport { Observable } from \"../../Misc/observable.js\";\nimport { Matrix } from \"../../Maths/math.vector.js\";\nimport { EngineStore } from \"../../Engines/engineStore.js\";\n\nimport { RandomGUID } from \"../../Misc/guid.js\";\nimport \"../../Misc/fileTools.js\";\nimport { ThinTexture } from \"./thinTexture.js\";\n/**\n * Base class of all the textures in babylon.\n * It groups all the common properties the materials, post process, lights... might need\n * in order to make a correct use of the texture.\n */\nexport class BaseTexture extends ThinTexture {\n /**\n * Define if the texture is having a usable alpha value (can be use for transparency or glossiness for instance).\n */\n set hasAlpha(value) {\n if (this._hasAlpha === value) {\n return;\n }\n this._hasAlpha = value;\n if (this._scene) {\n this._scene.markAllMaterialsAsDirty(1, (mat) => {\n return mat.hasTexture(this);\n });\n }\n }\n get hasAlpha() {\n return this._hasAlpha;\n }\n /**\n * Defines if the alpha value should be determined via the rgb values.\n * If true the luminance of the pixel might be used to find the corresponding alpha value.\n */\n set getAlphaFromRGB(value) {\n if (this._getAlphaFromRGB === value) {\n return;\n }\n this._getAlphaFromRGB = value;\n if (this._scene) {\n this._scene.markAllMaterialsAsDirty(1, (mat) => {\n return mat.hasTexture(this);\n });\n }\n }\n get getAlphaFromRGB() {\n return this._getAlphaFromRGB;\n }\n /**\n * Define the UV channel to use starting from 0 and defaulting to 0.\n * This is part of the texture as textures usually maps to one uv set.\n */\n set coordinatesIndex(value) {\n if (this._coordinatesIndex === value) {\n return;\n }\n this._coordinatesIndex = value;\n if (this._scene) {\n this._scene.markAllMaterialsAsDirty(1, (mat) => {\n return mat.hasTexture(this);\n });\n }\n }\n get coordinatesIndex() {\n return this._coordinatesIndex;\n }\n /**\n * How a texture is mapped.\n *\n * | Value | Type | Description |\n * | ----- | ----------------------------------- | ----------- |\n * | 0 | EXPLICIT_MODE | |\n * | 1 | SPHERICAL_MODE | |\n * | 2 | PLANAR_MODE | |\n * | 3 | CUBIC_MODE | |\n * | 4 | PROJECTION_MODE | |\n * | 5 | SKYBOX_MODE | |\n * | 6 | INVCUBIC_MODE | |\n * | 7 | EQUIRECTANGULAR_MODE | |\n * | 8 | FIXED_EQUIRECTANGULAR_MODE | |\n * | 9 | FIXED_EQUIRECTANGULAR_MIRRORED_MODE | |\n */\n set coordinatesMode(value) {\n if (this._coordinatesMode === value) {\n return;\n }\n this._coordinatesMode = value;\n if (this._scene) {\n this._scene.markAllMaterialsAsDirty(1, (mat) => {\n return mat.hasTexture(this);\n });\n }\n }\n get coordinatesMode() {\n return this._coordinatesMode;\n }\n /**\n * | Value | Type | Description |\n * | ----- | ------------------ | ----------- |\n * | 0 | CLAMP_ADDRESSMODE | |\n * | 1 | WRAP_ADDRESSMODE | |\n * | 2 | MIRROR_ADDRESSMODE | |\n */\n get wrapU() {\n return this._wrapU;\n }\n set wrapU(value) {\n this._wrapU = value;\n }\n /**\n * | Value | Type | Description |\n * | ----- | ------------------ | ----------- |\n * | 0 | CLAMP_ADDRESSMODE | |\n * | 1 | WRAP_ADDRESSMODE | |\n * | 2 | MIRROR_ADDRESSMODE | |\n */\n get wrapV() {\n return this._wrapV;\n }\n set wrapV(value) {\n this._wrapV = value;\n }\n /**\n * Define if the texture is a cube texture or if false a 2d texture.\n */\n get isCube() {\n if (!this._texture) {\n return this._isCube;\n }\n return this._texture.isCube;\n }\n set isCube(value) {\n if (!this._texture) {\n this._isCube = value;\n }\n else {\n this._texture.isCube = value;\n }\n }\n /**\n * Define if the texture is a 3d texture (webgl 2) or if false a 2d texture.\n */\n get is3D() {\n if (!this._texture) {\n return false;\n }\n return this._texture.is3D;\n }\n set is3D(value) {\n if (!this._texture) {\n return;\n }\n this._texture.is3D = value;\n }\n /**\n * Define if the texture is a 2d array texture (webgl 2) or if false a 2d texture.\n */\n get is2DArray() {\n if (!this._texture) {\n return false;\n }\n return this._texture.is2DArray;\n }\n set is2DArray(value) {\n if (!this._texture) {\n return;\n }\n this._texture.is2DArray = value;\n }\n /**\n * Define if the texture contains data in gamma space (most of the png/jpg aside bump).\n * HDR texture are usually stored in linear space.\n * This only impacts the PBR and Background materials\n */\n get gammaSpace() {\n if (!this._texture) {\n return this._gammaSpace;\n }\n else {\n if (this._texture._gammaSpace === null) {\n this._texture._gammaSpace = this._gammaSpace;\n }\n }\n return this._texture._gammaSpace && !this._texture._useSRGBBuffer;\n }\n set gammaSpace(gamma) {\n if (!this._texture) {\n if (this._gammaSpace === gamma) {\n return;\n }\n this._gammaSpace = gamma;\n }\n else {\n if (this._texture._gammaSpace === gamma) {\n return;\n }\n this._texture._gammaSpace = gamma;\n }\n this._markAllSubMeshesAsTexturesDirty();\n }\n /**\n * Gets or sets whether or not the texture contains RGBD data.\n */\n get isRGBD() {\n return this._texture != null && this._texture._isRGBD;\n }\n set isRGBD(value) {\n if (this._texture) {\n this._texture._isRGBD = value;\n }\n }\n /**\n * Are mip maps generated for this texture or not.\n */\n get noMipmap() {\n return false;\n }\n /**\n * With prefiltered texture, defined the offset used during the prefiltering steps.\n */\n get lodGenerationOffset() {\n if (this._texture) {\n return this._texture._lodGenerationOffset;\n }\n return 0.0;\n }\n set lodGenerationOffset(value) {\n if (this._texture) {\n this._texture._lodGenerationOffset = value;\n }\n }\n /**\n * With prefiltered texture, defined the scale used during the prefiltering steps.\n */\n get lodGenerationScale() {\n if (this._texture) {\n return this._texture._lodGenerationScale;\n }\n return 0.0;\n }\n set lodGenerationScale(value) {\n if (this._texture) {\n this._texture._lodGenerationScale = value;\n }\n }\n /**\n * With prefiltered texture, defined if the specular generation is based on a linear ramp.\n * By default we are using a log2 of the linear roughness helping to keep a better resolution for\n * average roughness values.\n */\n get linearSpecularLOD() {\n if (this._texture) {\n return this._texture._linearSpecularLOD;\n }\n return false;\n }\n set linearSpecularLOD(value) {\n if (this._texture) {\n this._texture._linearSpecularLOD = value;\n }\n }\n /**\n * In case a better definition than spherical harmonics is required for the diffuse part of the environment.\n * You can set the irradiance texture to rely on a texture instead of the spherical approach.\n * This texture need to have the same characteristics than its parent (Cube vs 2d, coordinates mode, Gamma/Linear, RGBD).\n */\n get irradianceTexture() {\n if (this._texture) {\n return this._texture._irradianceTexture;\n }\n return null;\n }\n set irradianceTexture(value) {\n if (this._texture) {\n this._texture._irradianceTexture = value;\n }\n }\n /**\n * Define the unique id of the texture in the scene.\n */\n get uid() {\n if (!this._uid) {\n this._uid = RandomGUID();\n }\n return this._uid;\n }\n /**\n * Return a string representation of the texture.\n * @returns the texture as a string\n */\n toString() {\n return this.name;\n }\n /**\n * Get the class name of the texture.\n * @returns \"BaseTexture\"\n */\n getClassName() {\n return \"BaseTexture\";\n }\n /**\n * Callback triggered when the texture has been disposed.\n * Kept for back compatibility, you can use the onDisposeObservable instead.\n */\n set onDispose(callback) {\n if (this._onDisposeObserver) {\n this.onDisposeObservable.remove(this._onDisposeObserver);\n }\n this._onDisposeObserver = this.onDisposeObservable.add(callback);\n }\n /**\n * Define if the texture is preventing a material to render or not.\n * If not and the texture is not ready, the engine will use a default black texture instead.\n */\n get isBlocking() {\n return true;\n }\n /**\n * Was there any loading error?\n */\n get loadingError() {\n return this._loadingError;\n }\n /**\n * If a loading error occurred this object will be populated with information about the error.\n */\n get errorObject() {\n return this._errorObject;\n }\n /**\n * Instantiates a new BaseTexture.\n * Base class of all the textures in babylon.\n * It groups all the common properties the materials, post process, lights... might need\n * in order to make a correct use of the texture.\n * @param sceneOrEngine Define the scene or engine the texture belongs to\n * @param internalTexture Define the internal texture associated with the texture\n */\n constructor(sceneOrEngine, internalTexture = null) {\n super(null);\n /**\n * Gets or sets an object used to store user defined information.\n */\n this.metadata = null;\n /**\n * For internal use only. Please do not use.\n */\n this.reservedDataStore = null;\n this._hasAlpha = false;\n this._getAlphaFromRGB = false;\n /**\n * Intensity or strength of the texture.\n * It is commonly used by materials to fine tune the intensity of the texture\n */\n this.level = 1;\n this._coordinatesIndex = 0;\n /**\n * Gets or sets a boolean indicating that the texture should try to reduce shader code if there is no UV manipulation.\n * (ie. when texture.getTextureMatrix().isIdentityAs3x2() returns true)\n */\n this.optimizeUVAllocation = true;\n this._coordinatesMode = 0;\n /**\n * | Value | Type | Description |\n * | ----- | ------------------ | ----------- |\n * | 0 | CLAMP_ADDRESSMODE | |\n * | 1 | WRAP_ADDRESSMODE | |\n * | 2 | MIRROR_ADDRESSMODE | |\n */\n this.wrapR = 1;\n /**\n * With compliant hardware and browser (supporting anisotropic filtering)\n * this defines the level of anisotropic filtering in the texture.\n * The higher the better but the slower. This defaults to 4 as it seems to be the best tradeoff.\n */\n this.anisotropicFilteringLevel = BaseTexture.DEFAULT_ANISOTROPIC_FILTERING_LEVEL;\n /** @internal */\n this._isCube = false;\n this._gammaSpace = true;\n /**\n * Is Z inverted in the texture (useful in a cube texture).\n */\n this.invertZ = false;\n /**\n * @internal\n */\n this.lodLevelInAlpha = false;\n /**\n * Define if the texture is a render target.\n */\n this.isRenderTarget = false;\n /** @internal */\n this._prefiltered = false;\n /** @internal */\n this._forceSerialize = false;\n /**\n * Define the list of animation attached to the texture.\n */\n this.animations = new Array();\n /**\n * An event triggered when the texture is disposed.\n */\n this.onDisposeObservable = new Observable();\n this._onDisposeObserver = null;\n this._scene = null;\n /** @internal */\n this._uid = null;\n /** @internal */\n this._parentContainer = null;\n this._loadingError = false;\n if (sceneOrEngine) {\n if (BaseTexture._IsScene(sceneOrEngine)) {\n this._scene = sceneOrEngine;\n }\n else {\n this._engine = sceneOrEngine;\n }\n }\n else {\n this._scene = EngineStore.LastCreatedScene;\n }\n if (this._scene) {\n this.uniqueId = this._scene.getUniqueId();\n this._scene.addTexture(this);\n this._engine = this._scene.getEngine();\n }\n this._texture = internalTexture;\n this._uid = null;\n }\n /**\n * Get the scene the texture belongs to.\n * @returns the scene or null if undefined\n */\n getScene() {\n return this._scene;\n }\n /** @internal */\n _getEngine() {\n return this._engine;\n }\n /**\n * Checks if the texture has the same transform matrix than another texture\n * @param texture texture to check against\n * @returns true if the transforms are the same, else false\n */\n checkTransformsAreIdentical(texture) {\n return texture !== null;\n }\n /**\n * Get the texture transform matrix used to offset tile the texture for instance.\n * @returns the transformation matrix\n */\n getTextureMatrix() {\n return Matrix.IdentityReadOnly;\n }\n /**\n * Get the texture reflection matrix used to rotate/transform the reflection.\n * @returns the reflection matrix\n */\n getReflectionTextureMatrix() {\n return Matrix.IdentityReadOnly;\n }\n /**\n * Gets a suitable rotate/transform matrix when the texture is used for refraction.\n * There's a separate function from getReflectionTextureMatrix because refraction requires a special configuration of the matrix in right-handed mode.\n * @returns The refraction matrix\n */\n getRefractionTextureMatrix() {\n return this.getReflectionTextureMatrix();\n }\n /**\n * Get if the texture is ready to be consumed (either it is ready or it is not blocking)\n * @returns true if ready, not blocking or if there was an error loading the texture\n */\n isReadyOrNotBlocking() {\n return !this.isBlocking || this.isReady() || this.loadingError;\n }\n /**\n * Scales the texture if is `canRescale()`\n * @param ratio the resize factor we want to use to rescale\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n scale(ratio) { }\n /**\n * Get if the texture can rescale.\n */\n get canRescale() {\n return false;\n }\n /**\n * @internal\n */\n _getFromCache(url, noMipmap, sampling, invertY, useSRGBBuffer, isCube) {\n const engine = this._getEngine();\n if (!engine) {\n return null;\n }\n const correctedUseSRGBBuffer = engine._getUseSRGBBuffer(!!useSRGBBuffer, noMipmap);\n const texturesCache = engine.getLoadedTexturesCache();\n for (let index = 0; index < texturesCache.length; index++) {\n const texturesCacheEntry = texturesCache[index];\n if (useSRGBBuffer === undefined || correctedUseSRGBBuffer === texturesCacheEntry._useSRGBBuffer) {\n if (invertY === undefined || invertY === texturesCacheEntry.invertY) {\n if (texturesCacheEntry.url === url && texturesCacheEntry.generateMipMaps === !noMipmap) {\n if (!sampling || sampling === texturesCacheEntry.samplingMode) {\n if (isCube === undefined || isCube === texturesCacheEntry.isCube) {\n texturesCacheEntry.incrementReferences();\n return texturesCacheEntry;\n }\n }\n }\n }\n }\n }\n return null;\n }\n /** @internal */\n _rebuild() { }\n /**\n * Clones the texture.\n * @returns the cloned texture\n */\n clone() {\n return null;\n }\n /**\n * Get the texture underlying type (INT, FLOAT...)\n */\n get textureType() {\n if (!this._texture) {\n return 0;\n }\n return this._texture.type !== undefined ? this._texture.type : 0;\n }\n /**\n * Get the texture underlying format (RGB, RGBA...)\n */\n get textureFormat() {\n if (!this._texture) {\n return 5;\n }\n return this._texture.format !== undefined ? this._texture.format : 5;\n }\n /**\n * Indicates that textures need to be re-calculated for all materials\n */\n _markAllSubMeshesAsTexturesDirty() {\n const scene = this.getScene();\n if (!scene) {\n return;\n }\n scene.markAllMaterialsAsDirty(1);\n }\n /**\n * Reads the pixels stored in the webgl texture and returns them as an ArrayBuffer.\n * This will returns an RGBA array buffer containing either in values (0-255) or\n * float values (0-1) depending of the underlying buffer type.\n * @param faceIndex defines the face of the texture to read (in case of cube texture)\n * @param level defines the LOD level of the texture to read (in case of Mip Maps)\n * @param buffer defines a user defined buffer to fill with data (can be null)\n * @param flushRenderer true to flush the renderer from the pending commands before reading the pixels\n * @param noDataConversion false to convert the data to Uint8Array (if texture type is UNSIGNED_BYTE) or to Float32Array (if texture type is anything but UNSIGNED_BYTE). If true, the type of the generated buffer (if buffer==null) will depend on the type of the texture\n * @param x defines the region x coordinates to start reading from (default to 0)\n * @param y defines the region y coordinates to start reading from (default to 0)\n * @param width defines the region width to read from (default to the texture size at level)\n * @param height defines the region width to read from (default to the texture size at level)\n * @returns The Array buffer promise containing the pixels data.\n */\n readPixels(faceIndex = 0, level = 0, buffer = null, flushRenderer = true, noDataConversion = false, x = 0, y = 0, width = Number.MAX_VALUE, height = Number.MAX_VALUE) {\n if (!this._texture) {\n return null;\n }\n const engine = this._getEngine();\n if (!engine) {\n return null;\n }\n const size = this.getSize();\n let maxWidth = size.width;\n let maxHeight = size.height;\n if (level !== 0) {\n maxWidth = maxWidth / Math.pow(2, level);\n maxHeight = maxHeight / Math.pow(2, level);\n maxWidth = Math.round(maxWidth);\n maxHeight = Math.round(maxHeight);\n }\n width = Math.min(maxWidth, width);\n height = Math.min(maxHeight, height);\n try {\n if (this._texture.isCube) {\n return engine._readTexturePixels(this._texture, width, height, faceIndex, level, buffer, flushRenderer, noDataConversion, x, y);\n }\n return engine._readTexturePixels(this._texture, width, height, -1, level, buffer, flushRenderer, noDataConversion, x, y);\n }\n catch (e) {\n return null;\n }\n }\n /**\n * @internal\n */\n _readPixelsSync(faceIndex = 0, level = 0, buffer = null, flushRenderer = true, noDataConversion = false) {\n if (!this._texture) {\n return null;\n }\n const size = this.getSize();\n let width = size.width;\n let height = size.height;\n const engine = this._getEngine();\n if (!engine) {\n return null;\n }\n if (level != 0) {\n width = width / Math.pow(2, level);\n height = height / Math.pow(2, level);\n width = Math.round(width);\n height = Math.round(height);\n }\n try {\n if (this._texture.isCube) {\n return engine._readTexturePixelsSync(this._texture, width, height, faceIndex, level, buffer, flushRenderer, noDataConversion);\n }\n return engine._readTexturePixelsSync(this._texture, width, height, -1, level, buffer, flushRenderer, noDataConversion);\n }\n catch (e) {\n return null;\n }\n }\n /** @internal */\n get _lodTextureHigh() {\n if (this._texture) {\n return this._texture._lodTextureHigh;\n }\n return null;\n }\n /** @internal */\n get _lodTextureMid() {\n if (this._texture) {\n return this._texture._lodTextureMid;\n }\n return null;\n }\n /** @internal */\n get _lodTextureLow() {\n if (this._texture) {\n return this._texture._lodTextureLow;\n }\n return null;\n }\n /**\n * Dispose the texture and release its associated resources.\n */\n dispose() {\n if (this._scene) {\n // Animations\n if (this._scene.stopAnimation) {\n this._scene.stopAnimation(this);\n }\n // Remove from scene\n this._scene.removePendingData(this);\n const index = this._scene.textures.indexOf(this);\n if (index >= 0) {\n this._scene.textures.splice(index, 1);\n }\n this._scene.onTextureRemovedObservable.notifyObservers(this);\n this._scene = null;\n if (this._parentContainer) {\n const index = this._parentContainer.textures.indexOf(this);\n if (index > -1) {\n this._parentContainer.textures.splice(index, 1);\n }\n this._parentContainer = null;\n }\n }\n // Callback\n this.onDisposeObservable.notifyObservers(this);\n this.onDisposeObservable.clear();\n this.metadata = null;\n super.dispose();\n }\n /**\n * Serialize the texture into a JSON representation that can be parsed later on.\n * @param allowEmptyName True to force serialization even if name is empty. Default: false\n * @returns the JSON representation of the texture\n */\n serialize(allowEmptyName = false) {\n if (!this.name && !allowEmptyName) {\n return null;\n }\n const serializationObject = SerializationHelper.Serialize(this);\n // Animations\n SerializationHelper.AppendSerializedAnimations(this, serializationObject);\n return serializationObject;\n }\n /**\n * Helper function to be called back once a list of texture contains only ready textures.\n * @param textures Define the list of textures to wait for\n * @param callback Define the callback triggered once the entire list will be ready\n */\n static WhenAllReady(textures, callback) {\n let numRemaining = textures.length;\n if (numRemaining === 0) {\n callback();\n return;\n }\n for (let i = 0; i < textures.length; i++) {\n const texture = textures[i];\n if (texture.isReady()) {\n if (--numRemaining === 0) {\n callback();\n }\n }\n else {\n const onLoadObservable = texture.onLoadObservable;\n if (onLoadObservable) {\n onLoadObservable.addOnce(() => {\n if (--numRemaining === 0) {\n callback();\n }\n });\n }\n else {\n if (--numRemaining === 0) {\n callback();\n }\n }\n }\n }\n }\n static _IsScene(sceneOrEngine) {\n return sceneOrEngine.getClassName() === \"Scene\";\n }\n}\n/**\n * Default anisotropic filtering level for the application.\n * It is set to 4 as a good tradeoff between perf and quality.\n */\nBaseTexture.DEFAULT_ANISOTROPIC_FILTERING_LEVEL = 4;\n__decorate([\n serialize()\n], BaseTexture.prototype, \"uniqueId\", void 0);\n__decorate([\n serialize()\n], BaseTexture.prototype, \"name\", void 0);\n__decorate([\n serialize()\n], BaseTexture.prototype, \"metadata\", void 0);\n__decorate([\n serialize(\"hasAlpha\")\n], BaseTexture.prototype, \"_hasAlpha\", void 0);\n__decorate([\n serialize(\"getAlphaFromRGB\")\n], BaseTexture.prototype, \"_getAlphaFromRGB\", void 0);\n__decorate([\n serialize()\n], BaseTexture.prototype, \"level\", void 0);\n__decorate([\n serialize(\"coordinatesIndex\")\n], BaseTexture.prototype, \"_coordinatesIndex\", void 0);\n__decorate([\n serialize()\n], BaseTexture.prototype, \"optimizeUVAllocation\", void 0);\n__decorate([\n serialize(\"coordinatesMode\")\n], BaseTexture.prototype, \"_coordinatesMode\", void 0);\n__decorate([\n serialize()\n], BaseTexture.prototype, \"wrapU\", null);\n__decorate([\n serialize()\n], BaseTexture.prototype, \"wrapV\", null);\n__decorate([\n serialize()\n], BaseTexture.prototype, \"wrapR\", void 0);\n__decorate([\n serialize()\n], BaseTexture.prototype, \"anisotropicFilteringLevel\", void 0);\n__decorate([\n serialize()\n], BaseTexture.prototype, \"isCube\", null);\n__decorate([\n serialize()\n], BaseTexture.prototype, \"is3D\", null);\n__decorate([\n serialize()\n], BaseTexture.prototype, \"is2DArray\", null);\n__decorate([\n serialize()\n], BaseTexture.prototype, \"gammaSpace\", null);\n__decorate([\n serialize()\n], BaseTexture.prototype, \"invertZ\", void 0);\n__decorate([\n serialize()\n], BaseTexture.prototype, \"lodLevelInAlpha\", void 0);\n__decorate([\n serialize()\n], BaseTexture.prototype, \"lodGenerationOffset\", null);\n__decorate([\n serialize()\n], BaseTexture.prototype, \"lodGenerationScale\", null);\n__decorate([\n serialize()\n], BaseTexture.prototype, \"linearSpecularLOD\", null);\n__decorate([\n serializeAsTexture()\n], BaseTexture.prototype, \"irradianceTexture\", null);\n__decorate([\n serialize()\n], BaseTexture.prototype, \"isRenderTarget\", void 0);\n//# sourceMappingURL=baseTexture.js.map","/**\n * Transform some pixel data to a base64 string\n * @param pixels defines the pixel data to transform to base64\n * @param size defines the width and height of the (texture) data\n * @param invertY true if the data must be inverted for the Y coordinate during the conversion\n * @returns The base64 encoded string or null\n */\nexport function GenerateBase64StringFromPixelData(pixels, size, invertY = false) {\n const width = size.width;\n const height = size.height;\n if (pixels instanceof Float32Array) {\n let len = pixels.byteLength / pixels.BYTES_PER_ELEMENT;\n const npixels = new Uint8Array(len);\n while (--len >= 0) {\n let val = pixels[len];\n if (val < 0) {\n val = 0;\n }\n else if (val > 1) {\n val = 1;\n }\n npixels[len] = val * 255;\n }\n pixels = npixels;\n }\n const canvas = document.createElement(\"canvas\");\n canvas.width = width;\n canvas.height = height;\n const ctx = canvas.getContext(\"2d\");\n if (!ctx) {\n return null;\n }\n const imageData = ctx.createImageData(width, height);\n const castData = imageData.data;\n castData.set(pixels);\n ctx.putImageData(imageData, 0, 0);\n if (invertY) {\n const canvas2 = document.createElement(\"canvas\");\n canvas2.width = width;\n canvas2.height = height;\n const ctx2 = canvas2.getContext(\"2d\");\n if (!ctx2) {\n return null;\n }\n ctx2.translate(0, height);\n ctx2.scale(1, -1);\n ctx2.drawImage(canvas, 0, 0);\n return canvas2.toDataURL(\"image/png\");\n }\n return canvas.toDataURL(\"image/png\");\n}\n/**\n * Reads the pixels stored in the webgl texture and returns them as a base64 string\n * @param texture defines the texture to read pixels from\n * @param faceIndex defines the face of the texture to read (in case of cube texture)\n * @param level defines the LOD level of the texture to read (in case of Mip Maps)\n * @returns The base64 encoded string or null\n */\nexport function GenerateBase64StringFromTexture(texture, faceIndex = 0, level = 0) {\n const internalTexture = texture.getInternalTexture();\n if (!internalTexture) {\n return null;\n }\n const pixels = texture._readPixelsSync(faceIndex, level);\n if (!pixels) {\n return null;\n }\n return GenerateBase64StringFromPixelData(pixels, texture.getSize(), internalTexture.invertY);\n}\n/**\n * Reads the pixels stored in the webgl texture and returns them as a base64 string\n * @param texture defines the texture to read pixels from\n * @param faceIndex defines the face of the texture to read (in case of cube texture)\n * @param level defines the LOD level of the texture to read (in case of Mip Maps)\n * @returns The base64 encoded string or null wrapped in a promise\n */\nexport async function GenerateBase64StringFromTextureAsync(texture, faceIndex = 0, level = 0) {\n const internalTexture = texture.getInternalTexture();\n if (!internalTexture) {\n return null;\n }\n const pixels = await texture.readPixels(faceIndex, level);\n if (!pixels) {\n return null;\n }\n return GenerateBase64StringFromPixelData(pixels, texture.getSize(), internalTexture.invertY);\n}\n/**\n * Class used to host copy specific utilities\n * (Back-compat)\n */\nexport const CopyTools = {\n /**\n * Transform some pixel data to a base64 string\n * @param pixels defines the pixel data to transform to base64\n * @param size defines the width and height of the (texture) data\n * @param invertY true if the data must be inverted for the Y coordinate during the conversion\n * @returns The base64 encoded string or null\n */\n GenerateBase64StringFromPixelData,\n /**\n * Reads the pixels stored in the webgl texture and returns them as a base64 string\n * @param texture defines the texture to read pixels from\n * @param faceIndex defines the face of the texture to read (in case of cube texture)\n * @param level defines the LOD level of the texture to read (in case of Mip Maps)\n * @returns The base64 encoded string or null\n */\n GenerateBase64StringFromTexture,\n /**\n * Reads the pixels stored in the webgl texture and returns them as a base64 string\n * @param texture defines the texture to read pixels from\n * @param faceIndex defines the face of the texture to read (in case of cube texture)\n * @param level defines the LOD level of the texture to read (in case of Mip Maps)\n * @returns The base64 encoded string or null wrapped in a promise\n */\n GenerateBase64StringFromTextureAsync,\n};\n//# sourceMappingURL=copyTools.js.map","import { __decorate } from \"../../tslib.es6.js\";\nimport { serialize, SerializationHelper } from \"../../Misc/decorators.js\";\nimport { Observable } from \"../../Misc/observable.js\";\nimport { Matrix, TmpVectors, Vector3 } from \"../../Maths/math.vector.js\";\nimport { BaseTexture } from \"../../Materials/Textures/baseTexture.js\";\n\nimport { GetClass, RegisterClass } from \"../../Misc/typeStore.js\";\nimport { _WarnImport } from \"../../Misc/devTools.js\";\nimport { TimingTools } from \"../../Misc/timingTools.js\";\nimport { InstantiationTools } from \"../../Misc/instantiationTools.js\";\nimport { Plane } from \"../../Maths/math.plane.js\";\nimport { EncodeArrayBufferToBase64 } from \"../../Misc/stringTools.js\";\nimport { GenerateBase64StringFromTexture, GenerateBase64StringFromTextureAsync } from \"../../Misc/copyTools.js\";\nimport { CompatibilityOptions } from \"../../Compat/compatibilityOptions.js\";\n/**\n * This represents a texture in babylon. It can be easily loaded from a network, base64 or html input.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/materials_introduction#texture\n */\nexport class Texture extends BaseTexture {\n /**\n * Are mip maps generated for this texture or not.\n */\n get noMipmap() {\n return this._noMipmap;\n }\n /** Returns the texture mime type if it was defined by a loader (undefined else) */\n get mimeType() {\n return this._mimeType;\n }\n /**\n * Is the texture preventing material to render while loading.\n * If false, a default texture will be used instead of the loading one during the preparation step.\n */\n set isBlocking(value) {\n this._isBlocking = value;\n }\n get isBlocking() {\n return this._isBlocking;\n }\n /**\n * Gets a boolean indicating if the texture needs to be inverted on the y axis during loading\n */\n get invertY() {\n return this._invertY;\n }\n /**\n * Instantiates a new texture.\n * This represents a texture in babylon. It can be easily loaded from a network, base64 or html input.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/materials_introduction#texture\n * @param url defines the url of the picture to load as a texture\n * @param sceneOrEngine defines the scene or engine the texture will belong to\n * @param noMipmapOrOptions defines if the texture will require mip maps or not or set of all options to create the texture\n * @param invertY defines if the texture needs to be inverted on the y axis during loading\n * @param samplingMode defines the sampling mode we want for the texture while fetching from it (Texture.NEAREST_SAMPLINGMODE...)\n * @param onLoad defines a callback triggered when the texture has been loaded\n * @param onError defines a callback triggered when an error occurred during the loading session\n * @param buffer defines the buffer to load the texture from in case the texture is loaded from a buffer representation\n * @param deleteBuffer defines if the buffer we are loading the texture from should be deleted after load\n * @param format defines the format of the texture we are trying to load (Engine.TEXTUREFORMAT_RGBA...)\n * @param mimeType defines an optional mime type information\n * @param loaderOptions options to be passed to the loader\n * @param creationFlags specific flags to use when creating the texture (1 for storage textures, for eg)\n * @param forcedExtension defines the extension to use to pick the right loader\n */\n constructor(url, sceneOrEngine, noMipmapOrOptions, invertY, samplingMode = Texture.TRILINEAR_SAMPLINGMODE, onLoad = null, onError = null, buffer = null, deleteBuffer = false, format, mimeType, loaderOptions, creationFlags, forcedExtension) {\n var _a, _b, _c, _d, _e, _f, _g, _h, _j;\n super(sceneOrEngine);\n /**\n * Define the url of the texture.\n */\n this.url = null;\n /**\n * Define an offset on the texture to offset the u coordinates of the UVs\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/moreMaterials#offsetting\n */\n this.uOffset = 0;\n /**\n * Define an offset on the texture to offset the v coordinates of the UVs\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/moreMaterials#offsetting\n */\n this.vOffset = 0;\n /**\n * Define an offset on the texture to scale the u coordinates of the UVs\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/moreMaterials#tiling\n */\n this.uScale = 1.0;\n /**\n * Define an offset on the texture to scale the v coordinates of the UVs\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/moreMaterials#tiling\n */\n this.vScale = 1.0;\n /**\n * Define an offset on the texture to rotate around the u coordinates of the UVs\n * The angle is defined in radians.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/moreMaterials\n */\n this.uAng = 0;\n /**\n * Define an offset on the texture to rotate around the v coordinates of the UVs\n * The angle is defined in radians.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/moreMaterials\n */\n this.vAng = 0;\n /**\n * Define an offset on the texture to rotate around the w coordinates of the UVs (in case of 3d texture)\n * The angle is defined in radians.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/moreMaterials\n */\n this.wAng = 0;\n /**\n * Defines the center of rotation (U)\n */\n this.uRotationCenter = 0.5;\n /**\n * Defines the center of rotation (V)\n */\n this.vRotationCenter = 0.5;\n /**\n * Defines the center of rotation (W)\n */\n this.wRotationCenter = 0.5;\n /**\n * Sets this property to true to avoid deformations when rotating the texture with non-uniform scaling\n */\n this.homogeneousRotationInUVTransform = false;\n /**\n * List of inspectable custom properties (used by the Inspector)\n * @see https://doc.babylonjs.com/toolsAndResources/inspector#extensibility\n */\n this.inspectableCustomProperties = null;\n /** @internal */\n this._noMipmap = false;\n /** @internal */\n this._invertY = false;\n this._rowGenerationMatrix = null;\n this._cachedTextureMatrix = null;\n this._projectionModeMatrix = null;\n this._t0 = null;\n this._t1 = null;\n this._t2 = null;\n this._cachedUOffset = -1;\n this._cachedVOffset = -1;\n this._cachedUScale = 0;\n this._cachedVScale = 0;\n this._cachedUAng = -1;\n this._cachedVAng = -1;\n this._cachedWAng = -1;\n this._cachedReflectionProjectionMatrixId = -1;\n this._cachedURotationCenter = -1;\n this._cachedVRotationCenter = -1;\n this._cachedWRotationCenter = -1;\n this._cachedHomogeneousRotationInUVTransform = false;\n this._cachedReflectionTextureMatrix = null;\n this._cachedReflectionUOffset = -1;\n this._cachedReflectionVOffset = -1;\n this._cachedReflectionUScale = 0;\n this._cachedReflectionVScale = 0;\n this._cachedReflectionCoordinatesMode = -1;\n /** @internal */\n this._buffer = null;\n this._deleteBuffer = false;\n this._format = null;\n this._delayedOnLoad = null;\n this._delayedOnError = null;\n /**\n * Observable triggered once the texture has been loaded.\n */\n this.onLoadObservable = new Observable();\n this._isBlocking = true;\n this.name = url || \"\";\n this.url = url;\n let noMipmap;\n let useSRGBBuffer = false;\n let internalTexture = null;\n if (typeof noMipmapOrOptions === \"object\" && noMipmapOrOptions !== null) {\n noMipmap = (_a = noMipmapOrOptions.noMipmap) !== null && _a !== void 0 ? _a : false;\n invertY = (_b = noMipmapOrOptions.invertY) !== null && _b !== void 0 ? _b : (CompatibilityOptions.UseOpenGLOrientationForUV ? false : true);\n samplingMode = (_c = noMipmapOrOptions.samplingMode) !== null && _c !== void 0 ? _c : Texture.TRILINEAR_SAMPLINGMODE;\n onLoad = (_d = noMipmapOrOptions.onLoad) !== null && _d !== void 0 ? _d : null;\n onError = (_e = noMipmapOrOptions.onError) !== null && _e !== void 0 ? _e : null;\n buffer = (_f = noMipmapOrOptions.buffer) !== null && _f !== void 0 ? _f : null;\n deleteBuffer = (_g = noMipmapOrOptions.deleteBuffer) !== null && _g !== void 0 ? _g : false;\n format = noMipmapOrOptions.format;\n mimeType = noMipmapOrOptions.mimeType;\n loaderOptions = noMipmapOrOptions.loaderOptions;\n creationFlags = noMipmapOrOptions.creationFlags;\n useSRGBBuffer = (_h = noMipmapOrOptions.useSRGBBuffer) !== null && _h !== void 0 ? _h : false;\n internalTexture = (_j = noMipmapOrOptions.internalTexture) !== null && _j !== void 0 ? _j : null;\n }\n else {\n noMipmap = !!noMipmapOrOptions;\n }\n this._noMipmap = noMipmap;\n this._invertY = invertY === undefined ? (CompatibilityOptions.UseOpenGLOrientationForUV ? false : true) : invertY;\n this._initialSamplingMode = samplingMode;\n this._buffer = buffer;\n this._deleteBuffer = deleteBuffer;\n this._mimeType = mimeType;\n this._loaderOptions = loaderOptions;\n this._creationFlags = creationFlags;\n this._useSRGBBuffer = useSRGBBuffer;\n this._forcedExtension = forcedExtension;\n if (format) {\n this._format = format;\n }\n const scene = this.getScene();\n const engine = this._getEngine();\n if (!engine) {\n return;\n }\n engine.onBeforeTextureInitObservable.notifyObservers(this);\n const load = () => {\n if (this._texture) {\n if (this._texture._invertVScale) {\n this.vScale *= -1;\n this.vOffset += 1;\n }\n // Update texture to match internal texture's wrapping\n if (this._texture._cachedWrapU !== null) {\n this.wrapU = this._texture._cachedWrapU;\n this._texture._cachedWrapU = null;\n }\n if (this._texture._cachedWrapV !== null) {\n this.wrapV = this._texture._cachedWrapV;\n this._texture._cachedWrapV = null;\n }\n if (this._texture._cachedWrapR !== null) {\n this.wrapR = this._texture._cachedWrapR;\n this._texture._cachedWrapR = null;\n }\n }\n if (this.onLoadObservable.hasObservers()) {\n this.onLoadObservable.notifyObservers(this);\n }\n if (onLoad) {\n onLoad();\n }\n if (!this.isBlocking && scene) {\n scene.resetCachedMaterial();\n }\n };\n const errorHandler = (message, exception) => {\n this._loadingError = true;\n this._errorObject = { message, exception };\n if (onError) {\n onError(message, exception);\n }\n Texture.OnTextureLoadErrorObservable.notifyObservers(this);\n };\n if (!this.url && !internalTexture) {\n this._delayedOnLoad = load;\n this._delayedOnError = errorHandler;\n return;\n }\n this._texture = internalTexture !== null && internalTexture !== void 0 ? internalTexture : this._getFromCache(this.url, noMipmap, samplingMode, this._invertY, useSRGBBuffer);\n if (!this._texture) {\n if (!scene || !scene.useDelayedTextureLoading) {\n try {\n this._texture = engine.createTexture(this.url, noMipmap, this._invertY, scene, samplingMode, load, errorHandler, this._buffer, undefined, this._format, this._forcedExtension, mimeType, loaderOptions, creationFlags, useSRGBBuffer);\n }\n catch (e) {\n errorHandler(\"error loading\", e);\n throw e;\n }\n if (deleteBuffer) {\n this._buffer = null;\n }\n }\n else {\n this.delayLoadState = 4;\n this._delayedOnLoad = load;\n this._delayedOnError = errorHandler;\n }\n }\n else {\n if (this._texture.isReady) {\n TimingTools.SetImmediate(() => load());\n }\n else {\n const loadObserver = this._texture.onLoadedObservable.add(load);\n this._texture.onErrorObservable.add((e) => {\n var _a;\n errorHandler(e.message, e.exception);\n (_a = this._texture) === null || _a === void 0 ? void 0 : _a.onLoadedObservable.remove(loadObserver);\n });\n }\n }\n }\n /**\n * Update the url (and optional buffer) of this texture if url was null during construction.\n * @param url the url of the texture\n * @param buffer the buffer of the texture (defaults to null)\n * @param onLoad callback called when the texture is loaded (defaults to null)\n * @param forcedExtension defines the extension to use to pick the right loader\n */\n updateURL(url, buffer = null, onLoad, forcedExtension) {\n if (this.url) {\n this.releaseInternalTexture();\n this.getScene().markAllMaterialsAsDirty(1);\n }\n if (!this.name || this.name.startsWith(\"data:\")) {\n this.name = url;\n }\n this.url = url;\n this._buffer = buffer;\n this._forcedExtension = forcedExtension;\n this.delayLoadState = 4;\n if (onLoad) {\n this._delayedOnLoad = onLoad;\n }\n this.delayLoad();\n }\n /**\n * Finish the loading sequence of a texture flagged as delayed load.\n * @internal\n */\n delayLoad() {\n if (this.delayLoadState !== 4) {\n return;\n }\n const scene = this.getScene();\n if (!scene) {\n return;\n }\n this.delayLoadState = 1;\n this._texture = this._getFromCache(this.url, this._noMipmap, this.samplingMode, this._invertY, this._useSRGBBuffer);\n if (!this._texture) {\n this._texture = scene\n .getEngine()\n .createTexture(this.url, this._noMipmap, this._invertY, scene, this.samplingMode, this._delayedOnLoad, this._delayedOnError, this._buffer, null, this._format, this._forcedExtension, this._mimeType, this._loaderOptions, this._creationFlags, this._useSRGBBuffer);\n if (this._deleteBuffer) {\n this._buffer = null;\n }\n }\n else {\n if (this._delayedOnLoad) {\n if (this._texture.isReady) {\n TimingTools.SetImmediate(this._delayedOnLoad);\n }\n else {\n this._texture.onLoadedObservable.add(this._delayedOnLoad);\n }\n }\n }\n this._delayedOnLoad = null;\n this._delayedOnError = null;\n }\n _prepareRowForTextureGeneration(x, y, z, t) {\n x *= this._cachedUScale;\n y *= this._cachedVScale;\n x -= this.uRotationCenter * this._cachedUScale;\n y -= this.vRotationCenter * this._cachedVScale;\n z -= this.wRotationCenter;\n Vector3.TransformCoordinatesFromFloatsToRef(x, y, z, this._rowGenerationMatrix, t);\n t.x += this.uRotationCenter * this._cachedUScale + this._cachedUOffset;\n t.y += this.vRotationCenter * this._cachedVScale + this._cachedVOffset;\n t.z += this.wRotationCenter;\n }\n /**\n * Checks if the texture has the same transform matrix than another texture\n * @param texture texture to check against\n * @returns true if the transforms are the same, else false\n */\n checkTransformsAreIdentical(texture) {\n return (texture !== null &&\n this.uOffset === texture.uOffset &&\n this.vOffset === texture.vOffset &&\n this.uScale === texture.uScale &&\n this.vScale === texture.vScale &&\n this.uAng === texture.uAng &&\n this.vAng === texture.vAng &&\n this.wAng === texture.wAng);\n }\n /**\n * Get the current texture matrix which includes the requested offsetting, tiling and rotation components.\n * @param uBase\n * @returns the transform matrix of the texture.\n */\n getTextureMatrix(uBase = 1) {\n if (this.uOffset === this._cachedUOffset &&\n this.vOffset === this._cachedVOffset &&\n this.uScale * uBase === this._cachedUScale &&\n this.vScale === this._cachedVScale &&\n this.uAng === this._cachedUAng &&\n this.vAng === this._cachedVAng &&\n this.wAng === this._cachedWAng &&\n this.uRotationCenter === this._cachedURotationCenter &&\n this.vRotationCenter === this._cachedVRotationCenter &&\n this.wRotationCenter === this._cachedWRotationCenter &&\n this.homogeneousRotationInUVTransform === this._cachedHomogeneousRotationInUVTransform) {\n return this._cachedTextureMatrix;\n }\n this._cachedUOffset = this.uOffset;\n this._cachedVOffset = this.vOffset;\n this._cachedUScale = this.uScale * uBase;\n this._cachedVScale = this.vScale;\n this._cachedUAng = this.uAng;\n this._cachedVAng = this.vAng;\n this._cachedWAng = this.wAng;\n this._cachedURotationCenter = this.uRotationCenter;\n this._cachedVRotationCenter = this.vRotationCenter;\n this._cachedWRotationCenter = this.wRotationCenter;\n this._cachedHomogeneousRotationInUVTransform = this.homogeneousRotationInUVTransform;\n if (!this._cachedTextureMatrix || !this._rowGenerationMatrix) {\n this._cachedTextureMatrix = Matrix.Zero();\n this._rowGenerationMatrix = new Matrix();\n this._t0 = Vector3.Zero();\n this._t1 = Vector3.Zero();\n this._t2 = Vector3.Zero();\n }\n Matrix.RotationYawPitchRollToRef(this.vAng, this.uAng, this.wAng, this._rowGenerationMatrix);\n if (this.homogeneousRotationInUVTransform) {\n Matrix.TranslationToRef(-this._cachedURotationCenter, -this._cachedVRotationCenter, -this._cachedWRotationCenter, TmpVectors.Matrix[0]);\n Matrix.TranslationToRef(this._cachedURotationCenter, this._cachedVRotationCenter, this._cachedWRotationCenter, TmpVectors.Matrix[1]);\n Matrix.ScalingToRef(this._cachedUScale, this._cachedVScale, 0, TmpVectors.Matrix[2]);\n Matrix.TranslationToRef(this._cachedUOffset, this._cachedVOffset, 0, TmpVectors.Matrix[3]);\n TmpVectors.Matrix[0].multiplyToRef(this._rowGenerationMatrix, this._cachedTextureMatrix);\n this._cachedTextureMatrix.multiplyToRef(TmpVectors.Matrix[1], this._cachedTextureMatrix);\n this._cachedTextureMatrix.multiplyToRef(TmpVectors.Matrix[2], this._cachedTextureMatrix);\n this._cachedTextureMatrix.multiplyToRef(TmpVectors.Matrix[3], this._cachedTextureMatrix);\n // copy the translation row to the 3rd row of the matrix so that we don't need to update the shaders (which expects the translation to be on the 3rd row)\n this._cachedTextureMatrix.setRowFromFloats(2, this._cachedTextureMatrix.m[12], this._cachedTextureMatrix.m[13], this._cachedTextureMatrix.m[14], 1);\n }\n else {\n this._prepareRowForTextureGeneration(0, 0, 0, this._t0);\n this._prepareRowForTextureGeneration(1.0, 0, 0, this._t1);\n this._prepareRowForTextureGeneration(0, 1.0, 0, this._t2);\n this._t1.subtractInPlace(this._t0);\n this._t2.subtractInPlace(this._t0);\n Matrix.FromValuesToRef(this._t1.x, this._t1.y, this._t1.z, 0.0, this._t2.x, this._t2.y, this._t2.z, 0.0, this._t0.x, this._t0.y, this._t0.z, 0.0, 0.0, 0.0, 0.0, 1.0, this._cachedTextureMatrix);\n }\n const scene = this.getScene();\n if (!scene) {\n return this._cachedTextureMatrix;\n }\n if (this.optimizeUVAllocation) {\n // We flag the materials that are using this texture as \"texture dirty\" because depending on the fact that the matrix is the identity or not, some defines\n // will get different values (see MaterialHelper.PrepareDefinesForMergedUV), meaning we should regenerate the effect accordingly\n scene.markAllMaterialsAsDirty(1, (mat) => {\n return mat.hasTexture(this);\n });\n }\n return this._cachedTextureMatrix;\n }\n /**\n * Get the current matrix used to apply reflection. This is useful to rotate an environment texture for instance.\n * @returns The reflection texture transform\n */\n getReflectionTextureMatrix() {\n const scene = this.getScene();\n if (!scene) {\n return this._cachedReflectionTextureMatrix;\n }\n if (this.uOffset === this._cachedReflectionUOffset &&\n this.vOffset === this._cachedReflectionVOffset &&\n this.uScale === this._cachedReflectionUScale &&\n this.vScale === this._cachedReflectionVScale &&\n this.coordinatesMode === this._cachedReflectionCoordinatesMode) {\n if (this.coordinatesMode === Texture.PROJECTION_MODE) {\n if (this._cachedReflectionProjectionMatrixId === scene.getProjectionMatrix().updateFlag) {\n return this._cachedReflectionTextureMatrix;\n }\n }\n else {\n return this._cachedReflectionTextureMatrix;\n }\n }\n if (!this._cachedReflectionTextureMatrix) {\n this._cachedReflectionTextureMatrix = Matrix.Zero();\n }\n if (!this._projectionModeMatrix) {\n this._projectionModeMatrix = Matrix.Zero();\n }\n const flagMaterialsAsTextureDirty = this._cachedReflectionCoordinatesMode !== this.coordinatesMode;\n this._cachedReflectionUOffset = this.uOffset;\n this._cachedReflectionVOffset = this.vOffset;\n this._cachedReflectionUScale = this.uScale;\n this._cachedReflectionVScale = this.vScale;\n this._cachedReflectionCoordinatesMode = this.coordinatesMode;\n switch (this.coordinatesMode) {\n case Texture.PLANAR_MODE: {\n Matrix.IdentityToRef(this._cachedReflectionTextureMatrix);\n this._cachedReflectionTextureMatrix[0] = this.uScale;\n this._cachedReflectionTextureMatrix[5] = this.vScale;\n this._cachedReflectionTextureMatrix[12] = this.uOffset;\n this._cachedReflectionTextureMatrix[13] = this.vOffset;\n break;\n }\n case Texture.PROJECTION_MODE: {\n Matrix.FromValuesToRef(0.5, 0.0, 0.0, 0.0, 0.0, -0.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.5, 0.5, 1.0, 1.0, this._projectionModeMatrix);\n const projectionMatrix = scene.getProjectionMatrix();\n this._cachedReflectionProjectionMatrixId = projectionMatrix.updateFlag;\n projectionMatrix.multiplyToRef(this._projectionModeMatrix, this._cachedReflectionTextureMatrix);\n break;\n }\n default:\n Matrix.IdentityToRef(this._cachedReflectionTextureMatrix);\n break;\n }\n if (flagMaterialsAsTextureDirty) {\n // We flag the materials that are using this texture as \"texture dirty\" if the coordinatesMode has changed.\n // Indeed, this property is used to set the value of some defines used to generate the effect (in material.isReadyForSubMesh), so we must make sure this code will be re-executed and the effect recreated if necessary\n scene.markAllMaterialsAsDirty(1, (mat) => {\n return mat.getActiveTextures().indexOf(this) !== -1;\n });\n }\n return this._cachedReflectionTextureMatrix;\n }\n /**\n * Clones the texture.\n * @returns the cloned texture\n */\n clone() {\n const options = {\n noMipmap: this._noMipmap,\n invertY: this._invertY,\n samplingMode: this.samplingMode,\n onLoad: undefined,\n onError: undefined,\n buffer: this._texture ? this._texture._buffer : undefined,\n deleteBuffer: this._deleteBuffer,\n format: this.textureFormat,\n mimeType: this.mimeType,\n loaderOptions: this._loaderOptions,\n creationFlags: this._creationFlags,\n useSRGBBuffer: this._useSRGBBuffer,\n };\n return SerializationHelper.Clone(() => {\n return new Texture(this._texture ? this._texture.url : null, this.getScene(), options);\n }, this);\n }\n /**\n * Serialize the texture to a JSON representation we can easily use in the respective Parse function.\n * @returns The JSON representation of the texture\n */\n serialize() {\n var _a, _b;\n const savedName = this.name;\n if (!Texture.SerializeBuffers) {\n if (this.name.startsWith(\"data:\")) {\n this.name = \"\";\n }\n }\n if (this.name.startsWith(\"data:\") && this.url === this.name) {\n this.url = \"\";\n }\n const serializationObject = super.serialize(Texture._SerializeInternalTextureUniqueId);\n if (!serializationObject) {\n return null;\n }\n if (Texture.SerializeBuffers || Texture.ForceSerializeBuffers) {\n if (typeof this._buffer === \"string\" && this._buffer.substr(0, 5) === \"data:\") {\n serializationObject.base64String = this._buffer;\n serializationObject.name = serializationObject.name.replace(\"data:\", \"\");\n }\n else if (this.url && this.url.startsWith(\"data:\") && this._buffer instanceof Uint8Array) {\n serializationObject.base64String = \"data:image/png;base64,\" + EncodeArrayBufferToBase64(this._buffer);\n }\n else if (Texture.ForceSerializeBuffers || (this.url && this.url.startsWith(\"blob:\")) || this._forceSerialize) {\n serializationObject.base64String =\n !this._engine || this._engine._features.supportSyncTextureRead ? GenerateBase64StringFromTexture(this) : GenerateBase64StringFromTextureAsync(this);\n }\n }\n serializationObject.invertY = this._invertY;\n serializationObject.samplingMode = this.samplingMode;\n serializationObject._creationFlags = this._creationFlags;\n serializationObject._useSRGBBuffer = this._useSRGBBuffer;\n if (Texture._SerializeInternalTextureUniqueId) {\n serializationObject.internalTextureUniqueId = (_b = (_a = this._texture) === null || _a === void 0 ? void 0 : _a.uniqueId) !== null && _b !== void 0 ? _b : undefined;\n }\n this.name = savedName;\n return serializationObject;\n }\n /**\n * Get the current class name of the texture useful for serialization or dynamic coding.\n * @returns \"Texture\"\n */\n getClassName() {\n return \"Texture\";\n }\n /**\n * Dispose the texture and release its associated resources.\n */\n dispose() {\n super.dispose();\n this.onLoadObservable.clear();\n this._delayedOnLoad = null;\n this._delayedOnError = null;\n this._buffer = null;\n }\n /**\n * Parse the JSON representation of a texture in order to recreate the texture in the given scene.\n * @param parsedTexture Define the JSON representation of the texture\n * @param scene Define the scene the parsed texture should be instantiated in\n * @param rootUrl Define the root url of the parsing sequence in the case of relative dependencies\n * @returns The parsed texture if successful\n */\n static Parse(parsedTexture, scene, rootUrl) {\n if (parsedTexture.customType) {\n const customTexture = InstantiationTools.Instantiate(parsedTexture.customType);\n // Update Sampling Mode\n const parsedCustomTexture = customTexture.Parse(parsedTexture, scene, rootUrl);\n if (parsedTexture.samplingMode && parsedCustomTexture.updateSamplingMode && parsedCustomTexture._samplingMode) {\n if (parsedCustomTexture._samplingMode !== parsedTexture.samplingMode) {\n parsedCustomTexture.updateSamplingMode(parsedTexture.samplingMode);\n }\n }\n return parsedCustomTexture;\n }\n if (parsedTexture.isCube && !parsedTexture.isRenderTarget) {\n return Texture._CubeTextureParser(parsedTexture, scene, rootUrl);\n }\n const hasInternalTextureUniqueId = parsedTexture.internalTextureUniqueId !== undefined;\n if (!parsedTexture.name && !parsedTexture.isRenderTarget && !hasInternalTextureUniqueId) {\n return null;\n }\n let internalTexture;\n if (hasInternalTextureUniqueId) {\n const cache = scene.getEngine().getLoadedTexturesCache();\n for (const texture of cache) {\n if (texture.uniqueId === parsedTexture.internalTextureUniqueId) {\n internalTexture = texture;\n break;\n }\n }\n }\n const onLoaded = (texture) => {\n var _a;\n // Clear cache\n if (texture && texture._texture) {\n texture._texture._cachedWrapU = null;\n texture._texture._cachedWrapV = null;\n texture._texture._cachedWrapR = null;\n }\n // Update Sampling Mode\n if (parsedTexture.samplingMode) {\n const sampling = parsedTexture.samplingMode;\n if (texture && texture.samplingMode !== sampling) {\n texture.updateSamplingMode(sampling);\n }\n }\n // Animations\n if (texture && parsedTexture.animations) {\n for (let animationIndex = 0; animationIndex < parsedTexture.animations.length; animationIndex++) {\n const parsedAnimation = parsedTexture.animations[animationIndex];\n const internalClass = GetClass(\"BABYLON.Animation\");\n if (internalClass) {\n texture.animations.push(internalClass.Parse(parsedAnimation));\n }\n }\n }\n if (hasInternalTextureUniqueId && !internalTexture) {\n (_a = texture === null || texture === void 0 ? void 0 : texture._texture) === null || _a === void 0 ? void 0 : _a._setUniqueId(parsedTexture.internalTextureUniqueId);\n }\n };\n const texture = SerializationHelper.Parse(() => {\n var _a, _b, _c;\n let generateMipMaps = true;\n if (parsedTexture.noMipmap) {\n generateMipMaps = false;\n }\n if (parsedTexture.mirrorPlane) {\n const mirrorTexture = Texture._CreateMirror(parsedTexture.name, parsedTexture.renderTargetSize, scene, generateMipMaps);\n mirrorTexture._waitingRenderList = parsedTexture.renderList;\n mirrorTexture.mirrorPlane = Plane.FromArray(parsedTexture.mirrorPlane);\n onLoaded(mirrorTexture);\n return mirrorTexture;\n }\n else if (parsedTexture.isRenderTarget) {\n let renderTargetTexture = null;\n if (parsedTexture.isCube) {\n // Search for an existing reflection probe (which contains a cube render target texture)\n if (scene.reflectionProbes) {\n for (let index = 0; index < scene.reflectionProbes.length; index++) {\n const probe = scene.reflectionProbes[index];\n if (probe.name === parsedTexture.name) {\n return probe.cubeTexture;\n }\n }\n }\n }\n else {\n renderTargetTexture = Texture._CreateRenderTargetTexture(parsedTexture.name, parsedTexture.renderTargetSize, scene, generateMipMaps, (_a = parsedTexture._creationFlags) !== null && _a !== void 0 ? _a : 0);\n renderTargetTexture._waitingRenderList = parsedTexture.renderList;\n }\n onLoaded(renderTargetTexture);\n return renderTargetTexture;\n }\n else {\n let texture;\n if (parsedTexture.base64String && !internalTexture) {\n // name and url are the same to ensure caching happens from the actual base64 string\n texture = Texture.CreateFromBase64String(parsedTexture.base64String, parsedTexture.base64String, scene, !generateMipMaps, parsedTexture.invertY, parsedTexture.samplingMode, () => {\n onLoaded(texture);\n }, (_b = parsedTexture._creationFlags) !== null && _b !== void 0 ? _b : 0, (_c = parsedTexture._useSRGBBuffer) !== null && _c !== void 0 ? _c : false);\n // prettier name to fit with the loaded data\n texture.name = parsedTexture.name;\n }\n else {\n let url;\n if (parsedTexture.name && (parsedTexture.name.indexOf(\"://\") > 0 || parsedTexture.name.startsWith(\"data:\"))) {\n url = parsedTexture.name;\n }\n else {\n url = rootUrl + parsedTexture.name;\n }\n if (parsedTexture.url && (parsedTexture.url.startsWith(\"data:\") || Texture.UseSerializedUrlIfAny)) {\n url = parsedTexture.url;\n }\n const options = {\n noMipmap: !generateMipMaps,\n invertY: parsedTexture.invertY,\n samplingMode: parsedTexture.samplingMode,\n onLoad: () => {\n onLoaded(texture);\n },\n internalTexture,\n };\n texture = new Texture(url, scene, options);\n }\n return texture;\n }\n }, parsedTexture, scene);\n return texture;\n }\n /**\n * Creates a texture from its base 64 representation.\n * @param data Define the base64 payload without the data: prefix\n * @param name Define the name of the texture in the scene useful fo caching purpose for instance\n * @param scene Define the scene the texture should belong to\n * @param noMipmapOrOptions defines if the texture will require mip maps or not or set of all options to create the texture\n * @param invertY define if the texture needs to be inverted on the y axis during loading\n * @param samplingMode define the sampling mode we want for the texture while fetching from it (Texture.NEAREST_SAMPLINGMODE...)\n * @param onLoad define a callback triggered when the texture has been loaded\n * @param onError define a callback triggered when an error occurred during the loading session\n * @param format define the format of the texture we are trying to load (Engine.TEXTUREFORMAT_RGBA...)\n * @param creationFlags specific flags to use when creating the texture (1 for storage textures, for eg)\n * @returns the created texture\n */\n static CreateFromBase64String(data, name, scene, noMipmapOrOptions, invertY, samplingMode = Texture.TRILINEAR_SAMPLINGMODE, onLoad = null, onError = null, format = 5, creationFlags) {\n return new Texture(\"data:\" + name, scene, noMipmapOrOptions, invertY, samplingMode, onLoad, onError, data, false, format, undefined, undefined, creationFlags);\n }\n /**\n * Creates a texture from its data: representation. (data: will be added in case only the payload has been passed in)\n * @param name Define the name of the texture in the scene useful fo caching purpose for instance\n * @param buffer define the buffer to load the texture from in case the texture is loaded from a buffer representation\n * @param scene Define the scene the texture should belong to\n * @param deleteBuffer define if the buffer we are loading the texture from should be deleted after load\n * @param noMipmapOrOptions defines if the texture will require mip maps or not or set of all options to create the texture\n * @param invertY define if the texture needs to be inverted on the y axis during loading\n * @param samplingMode define the sampling mode we want for the texture while fetching from it (Texture.NEAREST_SAMPLINGMODE...)\n * @param onLoad define a callback triggered when the texture has been loaded\n * @param onError define a callback triggered when an error occurred during the loading session\n * @param format define the format of the texture we are trying to load (Engine.TEXTUREFORMAT_RGBA...)\n * @param creationFlags specific flags to use when creating the texture (1 for storage textures, for eg)\n * @returns the created texture\n */\n static LoadFromDataString(name, buffer, scene, deleteBuffer = false, noMipmapOrOptions, invertY = true, samplingMode = Texture.TRILINEAR_SAMPLINGMODE, onLoad = null, onError = null, format = 5, creationFlags) {\n if (name.substr(0, 5) !== \"data:\") {\n name = \"data:\" + name;\n }\n return new Texture(name, scene, noMipmapOrOptions, invertY, samplingMode, onLoad, onError, buffer, deleteBuffer, format, undefined, undefined, creationFlags);\n }\n}\n/**\n * Gets or sets a general boolean used to indicate that textures containing direct data (buffers) must be saved as part of the serialization process\n */\nTexture.SerializeBuffers = true;\n/**\n * Gets or sets a general boolean used to indicate that texture buffers must be saved as part of the serialization process.\n * If no buffer exists, one will be created as base64 string from the internal webgl data.\n */\nTexture.ForceSerializeBuffers = false;\n/**\n * This observable will notify when any texture had a loading error\n */\nTexture.OnTextureLoadErrorObservable = new Observable();\n/** @internal */\nTexture._SerializeInternalTextureUniqueId = false;\n/**\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nTexture._CubeTextureParser = (jsonTexture, scene, rootUrl) => {\n throw _WarnImport(\"CubeTexture\");\n};\n/**\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nTexture._CreateMirror = (name, renderTargetSize, scene, generateMipMaps) => {\n throw _WarnImport(\"MirrorTexture\");\n};\n/**\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nTexture._CreateRenderTargetTexture = (name, renderTargetSize, scene, generateMipMaps, creationFlags) => {\n throw _WarnImport(\"RenderTargetTexture\");\n};\n/** nearest is mag = nearest and min = nearest and no mip */\nTexture.NEAREST_SAMPLINGMODE = 1;\n/** nearest is mag = nearest and min = nearest and mip = linear */\nTexture.NEAREST_NEAREST_MIPLINEAR = 8; // nearest is mag = nearest and min = nearest and mip = linear\n/** Bilinear is mag = linear and min = linear and no mip */\nTexture.BILINEAR_SAMPLINGMODE = 2;\n/** Bilinear is mag = linear and min = linear and mip = nearest */\nTexture.LINEAR_LINEAR_MIPNEAREST = 11; // Bilinear is mag = linear and min = linear and mip = nearest\n/** Trilinear is mag = linear and min = linear and mip = linear */\nTexture.TRILINEAR_SAMPLINGMODE = 3;\n/** Trilinear is mag = linear and min = linear and mip = linear */\nTexture.LINEAR_LINEAR_MIPLINEAR = 3; // Trilinear is mag = linear and min = linear and mip = linear\n/** mag = nearest and min = nearest and mip = nearest */\nTexture.NEAREST_NEAREST_MIPNEAREST = 4;\n/** mag = nearest and min = linear and mip = nearest */\nTexture.NEAREST_LINEAR_MIPNEAREST = 5;\n/** mag = nearest and min = linear and mip = linear */\nTexture.NEAREST_LINEAR_MIPLINEAR = 6;\n/** mag = nearest and min = linear and mip = none */\nTexture.NEAREST_LINEAR = 7;\n/** mag = nearest and min = nearest and mip = none */\nTexture.NEAREST_NEAREST = 1;\n/** mag = linear and min = nearest and mip = nearest */\nTexture.LINEAR_NEAREST_MIPNEAREST = 9;\n/** mag = linear and min = nearest and mip = linear */\nTexture.LINEAR_NEAREST_MIPLINEAR = 10;\n/** mag = linear and min = linear and mip = none */\nTexture.LINEAR_LINEAR = 2;\n/** mag = linear and min = nearest and mip = none */\nTexture.LINEAR_NEAREST = 12;\n/** Explicit coordinates mode */\nTexture.EXPLICIT_MODE = 0;\n/** Spherical coordinates mode */\nTexture.SPHERICAL_MODE = 1;\n/** Planar coordinates mode */\nTexture.PLANAR_MODE = 2;\n/** Cubic coordinates mode */\nTexture.CUBIC_MODE = 3;\n/** Projection coordinates mode */\nTexture.PROJECTION_MODE = 4;\n/** Inverse Cubic coordinates mode */\nTexture.SKYBOX_MODE = 5;\n/** Inverse Cubic coordinates mode */\nTexture.INVCUBIC_MODE = 6;\n/** Equirectangular coordinates mode */\nTexture.EQUIRECTANGULAR_MODE = 7;\n/** Equirectangular Fixed coordinates mode */\nTexture.FIXED_EQUIRECTANGULAR_MODE = 8;\n/** Equirectangular Fixed Mirrored coordinates mode */\nTexture.FIXED_EQUIRECTANGULAR_MIRRORED_MODE = 9;\n/** Texture is not repeating outside of 0..1 UVs */\nTexture.CLAMP_ADDRESSMODE = 0;\n/** Texture is repeating outside of 0..1 UVs */\nTexture.WRAP_ADDRESSMODE = 1;\n/** Texture is repeating and mirrored */\nTexture.MIRROR_ADDRESSMODE = 2;\n/**\n * Gets or sets a boolean which defines if the texture url must be build from the serialized URL instead of just using the name and loading them side by side with the scene file\n */\nTexture.UseSerializedUrlIfAny = false;\n__decorate([\n serialize()\n], Texture.prototype, \"url\", void 0);\n__decorate([\n serialize()\n], Texture.prototype, \"uOffset\", void 0);\n__decorate([\n serialize()\n], Texture.prototype, \"vOffset\", void 0);\n__decorate([\n serialize()\n], Texture.prototype, \"uScale\", void 0);\n__decorate([\n serialize()\n], Texture.prototype, \"vScale\", void 0);\n__decorate([\n serialize()\n], Texture.prototype, \"uAng\", void 0);\n__decorate([\n serialize()\n], Texture.prototype, \"vAng\", void 0);\n__decorate([\n serialize()\n], Texture.prototype, \"wAng\", void 0);\n__decorate([\n serialize()\n], Texture.prototype, \"uRotationCenter\", void 0);\n__decorate([\n serialize()\n], Texture.prototype, \"vRotationCenter\", void 0);\n__decorate([\n serialize()\n], Texture.prototype, \"wRotationCenter\", void 0);\n__decorate([\n serialize()\n], Texture.prototype, \"homogeneousRotationInUVTransform\", void 0);\n__decorate([\n serialize()\n], Texture.prototype, \"isBlocking\", null);\n// References the dependencies.\nRegisterClass(\"BABYLON.Texture\", Texture);\nSerializationHelper._TextureParser = Texture.Parse;\n//# sourceMappingURL=texture.js.map","import { InternalTextureSource } from \"../Materials/Textures/internalTexture.js\";\n\n/**\n * Wrapper around a render target (either single or multi textures)\n */\nexport class RenderTargetWrapper {\n /**\n * Gets the depth/stencil texture (if created by a createDepthStencilTexture() call)\n */\n get depthStencilTexture() {\n return this._depthStencilTexture;\n }\n /**\n * Indicates if the depth/stencil texture has a stencil aspect\n */\n get depthStencilTextureWithStencil() {\n return this._depthStencilTextureWithStencil;\n }\n /**\n * Defines if the render target wrapper is for a cube texture or if false a 2d texture\n */\n get isCube() {\n return this._isCube;\n }\n /**\n * Defines if the render target wrapper is for a single or multi target render wrapper\n */\n get isMulti() {\n return this._isMulti;\n }\n /**\n * Defines if the render target wrapper is for a single or an array of textures\n */\n get is2DArray() {\n return this.layers > 0;\n }\n /**\n * Gets the size of the render target wrapper (used for cubes, as width=height in this case)\n */\n get size() {\n return this.width;\n }\n /**\n * Gets the width of the render target wrapper\n */\n get width() {\n return this._size.width || this._size;\n }\n /**\n * Gets the height of the render target wrapper\n */\n get height() {\n return this._size.height || this._size;\n }\n /**\n * Gets the number of layers of the render target wrapper (only used if is2DArray is true and wrapper is not a multi render target)\n */\n get layers() {\n return this._size.layers || 0;\n }\n /**\n * Gets the render texture. If this is a multi render target, gets the first texture\n */\n get texture() {\n var _a, _b;\n return (_b = (_a = this._textures) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : null;\n }\n /**\n * Gets the list of render textures. If we are not in a multi render target, the list will be null (use the texture getter instead)\n */\n get textures() {\n return this._textures;\n }\n /**\n * Gets the face indices that correspond to the list of render textures. If we are not in a multi render target, the list will be null\n */\n get faceIndices() {\n return this._faceIndices;\n }\n /**\n * Gets the layer indices that correspond to the list of render textures. If we are not in a multi render target, the list will be null\n */\n get layerIndices() {\n return this._layerIndices;\n }\n /**\n * Gets the sample count of the render target\n */\n get samples() {\n return this._samples;\n }\n /**\n * Sets the sample count of the render target\n * @param value sample count\n * @param initializeBuffers If set to true, the engine will make an initializing call to drawBuffers (only used when isMulti=true).\n * @param force true to force calling the update sample count engine function even if the current sample count is equal to value\n * @returns the sample count that has been set\n */\n setSamples(value, initializeBuffers = true, force = false) {\n if (this.samples === value && !force) {\n return value;\n }\n const result = this._isMulti\n ? this._engine.updateMultipleRenderTargetTextureSampleCount(this, value, initializeBuffers)\n : this._engine.updateRenderTargetTextureSampleCount(this, value);\n this._samples = value;\n return result;\n }\n /**\n * Initializes the render target wrapper\n * @param isMulti true if the wrapper is a multi render target\n * @param isCube true if the wrapper should render to a cube texture\n * @param size size of the render target (width/height/layers)\n * @param engine engine used to create the render target\n * @param label defines the label to use for the wrapper (for debugging purpose only)\n */\n constructor(isMulti, isCube, size, engine, label) {\n this._textures = null;\n this._faceIndices = null;\n this._layerIndices = null;\n /** @internal */\n this._samples = 1;\n /** @internal */\n this._attachments = null;\n /** @internal */\n this._generateStencilBuffer = false;\n /** @internal */\n this._generateDepthBuffer = false;\n /** @internal */\n this._depthStencilTextureWithStencil = false;\n this._isMulti = isMulti;\n this._isCube = isCube;\n this._size = size;\n this._engine = engine;\n this._depthStencilTexture = null;\n this.label = label;\n }\n /**\n * Sets the render target texture(s)\n * @param textures texture(s) to set\n */\n setTextures(textures) {\n if (Array.isArray(textures)) {\n this._textures = textures;\n }\n else if (textures) {\n this._textures = [textures];\n }\n else {\n this._textures = null;\n }\n }\n /**\n * Set a texture in the textures array\n * @param texture The texture to set\n * @param index The index in the textures array to set\n * @param disposePrevious If this function should dispose the previous texture\n */\n setTexture(texture, index = 0, disposePrevious = true) {\n if (!this._textures) {\n this._textures = [];\n }\n if (this._textures[index] === texture) {\n return;\n }\n if (this._textures[index] && disposePrevious) {\n this._textures[index].dispose();\n }\n this._textures[index] = texture;\n }\n /**\n * Sets the layer and face indices of every render target texture bound to each color attachment\n * @param layers The layers of each texture to be set\n * @param faces The faces of each texture to be set\n */\n setLayerAndFaceIndices(layers, faces) {\n this._layerIndices = layers;\n this._faceIndices = faces;\n }\n /**\n * Sets the layer and face indices of a texture in the textures array that should be bound to each color attachment\n * @param index The index of the texture in the textures array to modify\n * @param layer The layer of the texture to be set\n * @param face The face of the texture to be set\n */\n setLayerAndFaceIndex(index = 0, layer, face) {\n if (!this._layerIndices) {\n this._layerIndices = [];\n }\n if (!this._faceIndices) {\n this._faceIndices = [];\n }\n if (layer !== undefined && layer >= 0) {\n this._layerIndices[index] = layer;\n }\n if (face !== undefined && face >= 0) {\n this._faceIndices[index] = face;\n }\n }\n /**\n * Creates the depth/stencil texture\n * @param comparisonFunction Comparison function to use for the texture\n * @param bilinearFiltering true if bilinear filtering should be used when sampling the texture\n * @param generateStencil true if the stencil aspect should also be created\n * @param samples sample count to use when creating the texture\n * @param format format of the depth texture\n * @param label defines the label to use for the texture (for debugging purpose only)\n * @returns the depth/stencil created texture\n */\n createDepthStencilTexture(comparisonFunction = 0, bilinearFiltering = true, generateStencil = false, samples = 1, format = 14, label) {\n var _a;\n (_a = this._depthStencilTexture) === null || _a === void 0 ? void 0 : _a.dispose();\n this._depthStencilTextureWithStencil = generateStencil;\n this._depthStencilTexture = this._engine.createDepthStencilTexture(this._size, {\n bilinearFiltering,\n comparisonFunction,\n generateStencil,\n isCube: this._isCube,\n samples,\n depthTextureFormat: format,\n label,\n }, this);\n return this._depthStencilTexture;\n }\n /**\n * Shares the depth buffer of this render target with another render target.\n * @internal\n * @param renderTarget Destination renderTarget\n */\n _shareDepth(renderTarget) {\n if (this._depthStencilTexture) {\n if (renderTarget._depthStencilTexture) {\n renderTarget._depthStencilTexture.dispose();\n }\n renderTarget._depthStencilTexture = this._depthStencilTexture;\n this._depthStencilTexture.incrementReferences();\n }\n }\n /**\n * @internal\n */\n _swapAndDie(target) {\n if (this.texture) {\n this.texture._swapAndDie(target);\n }\n this._textures = null;\n this.dispose(true);\n }\n _cloneRenderTargetWrapper() {\n var _a, _b, _c, _d, _e, _f, _g, _h;\n let rtw = null;\n if (this._isMulti) {\n const textureArray = this.textures;\n if (textureArray && textureArray.length > 0) {\n let generateDepthTexture = false;\n let textureCount = textureArray.length;\n const lastTextureSource = textureArray[textureArray.length - 1]._source;\n if (lastTextureSource === InternalTextureSource.Depth || lastTextureSource === InternalTextureSource.DepthStencil) {\n generateDepthTexture = true;\n textureCount--;\n }\n const samplingModes = [];\n const types = [];\n const formats = [];\n const targetTypes = [];\n const faceIndex = [];\n const layerIndex = [];\n const layerCounts = [];\n const internalTexture2Index = {};\n for (let i = 0; i < textureCount; ++i) {\n const texture = textureArray[i];\n samplingModes.push(texture.samplingMode);\n types.push(texture.type);\n formats.push(texture.format);\n const index = internalTexture2Index[texture.uniqueId];\n if (index !== undefined) {\n targetTypes.push(-1);\n layerCounts.push(0);\n }\n else {\n internalTexture2Index[texture.uniqueId] = i;\n if (texture.is2DArray) {\n targetTypes.push(35866);\n layerCounts.push(texture.depth);\n }\n else if (texture.isCube) {\n targetTypes.push(34067);\n layerCounts.push(0);\n } /*else if (texture.isCubeArray) {\n targetTypes.push(3735928559);\n layerCounts.push(texture.depth);\n }*/\n else if (texture.is3D) {\n targetTypes.push(32879);\n layerCounts.push(texture.depth);\n }\n else {\n targetTypes.push(3553);\n layerCounts.push(0);\n }\n }\n if (this._faceIndices) {\n faceIndex.push((_a = this._faceIndices[i]) !== null && _a !== void 0 ? _a : 0);\n }\n if (this._layerIndices) {\n layerIndex.push((_b = this._layerIndices[i]) !== null && _b !== void 0 ? _b : 0);\n }\n }\n const optionsMRT = {\n samplingModes,\n generateMipMaps: textureArray[0].generateMipMaps,\n generateDepthBuffer: this._generateDepthBuffer,\n generateStencilBuffer: this._generateStencilBuffer,\n generateDepthTexture,\n types,\n formats,\n textureCount,\n targetTypes,\n faceIndex,\n layerIndex,\n layerCounts,\n };\n const size = {\n width: this.width,\n height: this.height,\n };\n rtw = this._engine.createMultipleRenderTarget(size, optionsMRT);\n for (let i = 0; i < textureCount; ++i) {\n if (targetTypes[i] !== -1) {\n continue;\n }\n const index = internalTexture2Index[textureArray[i].uniqueId];\n rtw.setTexture(rtw.textures[index], i);\n }\n }\n }\n else {\n const options = {};\n options.generateDepthBuffer = this._generateDepthBuffer;\n options.generateMipMaps = (_d = (_c = this.texture) === null || _c === void 0 ? void 0 : _c.generateMipMaps) !== null && _d !== void 0 ? _d : false;\n options.generateStencilBuffer = this._generateStencilBuffer;\n options.samplingMode = (_e = this.texture) === null || _e === void 0 ? void 0 : _e.samplingMode;\n options.type = (_f = this.texture) === null || _f === void 0 ? void 0 : _f.type;\n options.format = (_g = this.texture) === null || _g === void 0 ? void 0 : _g.format;\n if (this.isCube) {\n rtw = this._engine.createRenderTargetCubeTexture(this.width, options);\n }\n else {\n const size = {\n width: this.width,\n height: this.height,\n layers: this.is2DArray ? (_h = this.texture) === null || _h === void 0 ? void 0 : _h.depth : undefined,\n };\n rtw = this._engine.createRenderTargetTexture(size, options);\n }\n rtw.texture.isReady = true;\n }\n return rtw;\n }\n _swapRenderTargetWrapper(target) {\n if (this._textures && target._textures) {\n for (let i = 0; i < this._textures.length; ++i) {\n this._textures[i]._swapAndDie(target._textures[i], false);\n target._textures[i].isReady = true;\n }\n }\n if (this._depthStencilTexture && target._depthStencilTexture) {\n this._depthStencilTexture._swapAndDie(target._depthStencilTexture);\n target._depthStencilTexture.isReady = true;\n }\n this._textures = null;\n this._depthStencilTexture = null;\n }\n /** @internal */\n _rebuild() {\n const rtw = this._cloneRenderTargetWrapper();\n if (!rtw) {\n return;\n }\n if (this._depthStencilTexture) {\n const samplingMode = this._depthStencilTexture.samplingMode;\n const bilinear = samplingMode === 2 ||\n samplingMode === 3 ||\n samplingMode === 11;\n rtw.createDepthStencilTexture(this._depthStencilTexture._comparisonFunction, bilinear, this._depthStencilTextureWithStencil, this._depthStencilTexture.samples);\n }\n if (this.samples > 1) {\n rtw.setSamples(this.samples);\n }\n rtw._swapRenderTargetWrapper(this);\n rtw.dispose();\n }\n /**\n * Releases the internal render textures\n */\n releaseTextures() {\n var _a, _b;\n if (this._textures) {\n for (let i = 0; (_b = i < ((_a = this._textures) === null || _a === void 0 ? void 0 : _a.length)) !== null && _b !== void 0 ? _b : 0; ++i) {\n this._textures[i].dispose();\n }\n }\n this._textures = null;\n }\n /**\n * Disposes the whole render target wrapper\n * @param disposeOnlyFramebuffers true if only the frame buffers should be released (used for the WebGL engine). If false, all the textures will also be released\n */\n dispose(disposeOnlyFramebuffers = false) {\n var _a;\n if (!disposeOnlyFramebuffers) {\n (_a = this._depthStencilTexture) === null || _a === void 0 ? void 0 : _a.dispose();\n this._depthStencilTexture = null;\n this.releaseTextures();\n }\n this._engine._releaseRenderTargetWrapper(this);\n }\n}\n//# sourceMappingURL=renderTargetWrapper.js.map","import { RenderTargetWrapper } from \"../renderTargetWrapper.js\";\n/** @internal */\nexport class WebGLRenderTargetWrapper extends RenderTargetWrapper {\n constructor(isMulti, isCube, size, engine, context) {\n super(isMulti, isCube, size, engine);\n /**\n * @internal\n */\n this._framebuffer = null;\n /**\n * @internal\n */\n this._depthStencilBuffer = null;\n // eslint-disable-next-line @typescript-eslint/naming-convention\n /**\n * @internal\n */\n this._MSAAFramebuffer = null;\n // Multiview\n /**\n * @internal\n */\n this._colorTextureArray = null;\n /**\n * @internal\n */\n this._depthStencilTextureArray = null;\n /**\n * @internal\n */\n this._disposeOnlyFramebuffers = false;\n this._context = context;\n }\n _cloneRenderTargetWrapper() {\n let rtw = null;\n if (this._colorTextureArray && this._depthStencilTextureArray) {\n rtw = this._engine.createMultiviewRenderTargetTexture(this.width, this.height);\n rtw.texture.isReady = true;\n }\n else {\n rtw = super._cloneRenderTargetWrapper();\n }\n return rtw;\n }\n _swapRenderTargetWrapper(target) {\n super._swapRenderTargetWrapper(target);\n target._framebuffer = this._framebuffer;\n target._depthStencilBuffer = this._depthStencilBuffer;\n target._MSAAFramebuffer = this._MSAAFramebuffer;\n target._colorTextureArray = this._colorTextureArray;\n target._depthStencilTextureArray = this._depthStencilTextureArray;\n this._framebuffer = this._depthStencilBuffer = this._MSAAFramebuffer = this._colorTextureArray = this._depthStencilTextureArray = null;\n }\n /**\n * Shares the depth buffer of this render target with another render target.\n * @internal\n * @param renderTarget Destination renderTarget\n */\n _shareDepth(renderTarget) {\n super._shareDepth(renderTarget);\n const gl = this._context;\n const depthbuffer = this._depthStencilBuffer;\n const framebuffer = renderTarget._MSAAFramebuffer || renderTarget._framebuffer;\n if (renderTarget._depthStencilBuffer && renderTarget._depthStencilBuffer !== depthbuffer) {\n gl.deleteRenderbuffer(renderTarget._depthStencilBuffer);\n }\n renderTarget._depthStencilBuffer = depthbuffer;\n const attachment = renderTarget._generateStencilBuffer ? gl.DEPTH_STENCIL_ATTACHMENT : gl.DEPTH_ATTACHMENT;\n this._engine._bindUnboundFramebuffer(framebuffer);\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, attachment, gl.RENDERBUFFER, depthbuffer);\n this._engine._bindUnboundFramebuffer(null);\n }\n /**\n * Binds a texture to this render target on a specific attachment\n * @param texture The texture to bind to the framebuffer\n * @param attachmentIndex Index of the attachment\n * @param faceIndexOrLayer The face or layer of the texture to render to in case of cube texture or array texture\n * @param lodLevel defines the lod level to bind to the frame buffer\n */\n _bindTextureRenderTarget(texture, attachmentIndex = 0, faceIndexOrLayer, lodLevel = 0) {\n var _a, _b, _c, _d;\n if (!texture._hardwareTexture) {\n return;\n }\n const framebuffer = this._framebuffer;\n const currentFB = this._engine._currentFramebuffer;\n this._engine._bindUnboundFramebuffer(framebuffer);\n if (this._engine.webGLVersion > 1) {\n const gl = this._context;\n const attachment = gl[\"COLOR_ATTACHMENT\" + attachmentIndex];\n if (texture.is2DArray || texture.is3D) {\n faceIndexOrLayer = (_b = faceIndexOrLayer !== null && faceIndexOrLayer !== void 0 ? faceIndexOrLayer : (_a = this.layerIndices) === null || _a === void 0 ? void 0 : _a[attachmentIndex]) !== null && _b !== void 0 ? _b : 0;\n gl.framebufferTextureLayer(gl.FRAMEBUFFER, attachment, texture._hardwareTexture.underlyingResource, lodLevel, faceIndexOrLayer);\n }\n else if (texture.isCube) {\n // if face index is not specified, try to query it from faceIndices\n // default is face 0\n faceIndexOrLayer = (_d = faceIndexOrLayer !== null && faceIndexOrLayer !== void 0 ? faceIndexOrLayer : (_c = this.faceIndices) === null || _c === void 0 ? void 0 : _c[attachmentIndex]) !== null && _d !== void 0 ? _d : 0;\n gl.framebufferTexture2D(gl.FRAMEBUFFER, attachment, gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndexOrLayer, texture._hardwareTexture.underlyingResource, lodLevel);\n }\n else {\n gl.framebufferTexture2D(gl.FRAMEBUFFER, attachment, gl.TEXTURE_2D, texture._hardwareTexture.underlyingResource, lodLevel);\n }\n }\n else {\n // Default behavior (WebGL)\n const gl = this._context;\n const attachment = gl[\"COLOR_ATTACHMENT\" + attachmentIndex + \"_WEBGL\"];\n const target = faceIndexOrLayer !== undefined ? gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndexOrLayer : gl.TEXTURE_2D;\n gl.framebufferTexture2D(gl.FRAMEBUFFER, attachment, target, texture._hardwareTexture.underlyingResource, lodLevel);\n }\n this._engine._bindUnboundFramebuffer(currentFB);\n }\n /**\n * Set a texture in the textures array\n * @param texture the texture to set\n * @param index the index in the textures array to set\n * @param disposePrevious If this function should dispose the previous texture\n */\n setTexture(texture, index = 0, disposePrevious = true) {\n super.setTexture(texture, index, disposePrevious);\n this._bindTextureRenderTarget(texture, index);\n }\n /**\n * Sets the layer and face indices of every render target texture\n * @param layers The layer of the texture to be set (make negative to not modify)\n * @param faces The face of the texture to be set (make negative to not modify)\n */\n setLayerAndFaceIndices(layers, faces) {\n var _a, _b;\n super.setLayerAndFaceIndices(layers, faces);\n if (!this.textures || !this.layerIndices || !this.faceIndices) {\n return;\n }\n // the length of this._attachments is the right one as it does not count the depth texture, in case we generated it\n const textureCount = (_b = (_a = this._attachments) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : this.textures.length;\n for (let index = 0; index < textureCount; index++) {\n const texture = this.textures[index];\n if (!texture) {\n // The target type was probably -1 at creation time and setTexture has not been called yet for this index\n continue;\n }\n if (texture.is2DArray || texture.is3D) {\n this._bindTextureRenderTarget(texture, index, this.layerIndices[index]);\n }\n else if (texture.isCube) {\n this._bindTextureRenderTarget(texture, index, this.faceIndices[index]);\n }\n else {\n this._bindTextureRenderTarget(texture, index);\n }\n }\n }\n /**\n * Set the face and layer indices of a texture in the textures array\n * @param index The index of the texture in the textures array to modify\n * @param layer The layer of the texture to be set\n * @param face The face of the texture to be set\n */\n setLayerAndFaceIndex(index = 0, layer, face) {\n super.setLayerAndFaceIndex(index, layer, face);\n if (!this.textures || !this.layerIndices || !this.faceIndices) {\n return;\n }\n const texture = this.textures[index];\n if (texture.is2DArray || texture.is3D) {\n this._bindTextureRenderTarget(this.textures[index], index, this.layerIndices[index]);\n }\n else if (texture.isCube) {\n this._bindTextureRenderTarget(this.textures[index], index, this.faceIndices[index]);\n }\n }\n dispose(disposeOnlyFramebuffers = this._disposeOnlyFramebuffers) {\n const gl = this._context;\n if (!disposeOnlyFramebuffers) {\n if (this._colorTextureArray) {\n this._context.deleteTexture(this._colorTextureArray);\n this._colorTextureArray = null;\n }\n if (this._depthStencilTextureArray) {\n this._context.deleteTexture(this._depthStencilTextureArray);\n this._depthStencilTextureArray = null;\n }\n }\n if (this._framebuffer) {\n gl.deleteFramebuffer(this._framebuffer);\n this._framebuffer = null;\n }\n if (this._depthStencilBuffer) {\n gl.deleteRenderbuffer(this._depthStencilBuffer);\n this._depthStencilBuffer = null;\n }\n if (this._MSAAFramebuffer) {\n gl.deleteFramebuffer(this._MSAAFramebuffer);\n this._MSAAFramebuffer = null;\n }\n super.dispose(disposeOnlyFramebuffers);\n }\n}\n//# sourceMappingURL=webGLRenderTargetWrapper.js.map","import { InternalTexture, InternalTextureSource } from \"../../Materials/Textures/internalTexture.js\";\nimport { Logger } from \"../../Misc/logger.js\";\nimport { ThinEngine } from \"../thinEngine.js\";\nimport { WebGLRenderTargetWrapper } from \"../WebGL/webGLRenderTargetWrapper.js\";\n\nThinEngine.prototype._createHardwareRenderTargetWrapper = function (isMulti, isCube, size) {\n const rtWrapper = new WebGLRenderTargetWrapper(isMulti, isCube, size, this, this._gl);\n this._renderTargetWrapperCache.push(rtWrapper);\n return rtWrapper;\n};\nThinEngine.prototype.createRenderTargetTexture = function (size, options) {\n var _a, _b;\n const rtWrapper = this._createHardwareRenderTargetWrapper(false, false, size);\n let generateDepthBuffer = true;\n let generateStencilBuffer = false;\n let noColorAttachment = false;\n let colorAttachment = undefined;\n let samples = 1;\n if (options !== undefined && typeof options === \"object\") {\n generateDepthBuffer = (_a = options.generateDepthBuffer) !== null && _a !== void 0 ? _a : true;\n generateStencilBuffer = !!options.generateStencilBuffer;\n noColorAttachment = !!options.noColorAttachment;\n colorAttachment = options.colorAttachment;\n samples = (_b = options.samples) !== null && _b !== void 0 ? _b : 1;\n }\n const texture = colorAttachment || (noColorAttachment ? null : this._createInternalTexture(size, options, true, InternalTextureSource.RenderTarget));\n const width = size.width || size;\n const height = size.height || size;\n const currentFrameBuffer = this._currentFramebuffer;\n const gl = this._gl;\n // Create the framebuffer\n const framebuffer = gl.createFramebuffer();\n this._bindUnboundFramebuffer(framebuffer);\n rtWrapper._depthStencilBuffer = this._setupFramebufferDepthAttachments(generateStencilBuffer, generateDepthBuffer, width, height);\n // No need to rebind on every frame\n if (texture && !texture.is2DArray) {\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture._hardwareTexture.underlyingResource, 0);\n }\n this._bindUnboundFramebuffer(currentFrameBuffer);\n rtWrapper._framebuffer = framebuffer;\n rtWrapper._generateDepthBuffer = generateDepthBuffer;\n rtWrapper._generateStencilBuffer = generateStencilBuffer;\n rtWrapper.setTextures(texture);\n this.updateRenderTargetTextureSampleCount(rtWrapper, samples);\n return rtWrapper;\n};\nThinEngine.prototype.createDepthStencilTexture = function (size, options, rtWrapper) {\n if (options.isCube) {\n const width = size.width || size;\n return this._createDepthStencilCubeTexture(width, options, rtWrapper);\n }\n else {\n return this._createDepthStencilTexture(size, options, rtWrapper);\n }\n};\nThinEngine.prototype._createDepthStencilTexture = function (size, options, rtWrapper) {\n const gl = this._gl;\n const layers = size.layers || 0;\n const target = layers !== 0 ? gl.TEXTURE_2D_ARRAY : gl.TEXTURE_2D;\n const internalTexture = new InternalTexture(this, InternalTextureSource.DepthStencil);\n if (!this._caps.depthTextureExtension) {\n Logger.Error(\"Depth texture is not supported by your browser or hardware.\");\n return internalTexture;\n }\n const internalOptions = Object.assign({ bilinearFiltering: false, comparisonFunction: 0, generateStencil: false }, options);\n this._bindTextureDirectly(target, internalTexture, true);\n this._setupDepthStencilTexture(internalTexture, size, internalOptions.generateStencil, internalOptions.comparisonFunction === 0 ? false : internalOptions.bilinearFiltering, internalOptions.comparisonFunction, internalOptions.samples);\n if (internalOptions.depthTextureFormat !== undefined) {\n if (internalOptions.depthTextureFormat !== 15 &&\n internalOptions.depthTextureFormat !== 16 &&\n internalOptions.depthTextureFormat !== 17 &&\n internalOptions.depthTextureFormat !== 13 &&\n internalOptions.depthTextureFormat !== 14 &&\n internalOptions.depthTextureFormat !== 18) {\n Logger.Error(\"Depth texture format is not supported.\");\n return internalTexture;\n }\n internalTexture.format = internalOptions.depthTextureFormat;\n }\n else {\n internalTexture.format = internalOptions.generateStencil ? 13 : 16;\n }\n const hasStencil = internalTexture.format === 17 ||\n internalTexture.format === 13 ||\n internalTexture.format === 18;\n rtWrapper._depthStencilTexture = internalTexture;\n rtWrapper._depthStencilTextureWithStencil = hasStencil;\n let type = gl.UNSIGNED_INT;\n if (internalTexture.format === 15) {\n type = gl.UNSIGNED_SHORT;\n }\n else if (internalTexture.format === 17 || internalTexture.format === 13) {\n type = gl.UNSIGNED_INT_24_8;\n }\n else if (internalTexture.format === 14) {\n type = gl.FLOAT;\n }\n else if (internalTexture.format === 18) {\n type = gl.FLOAT_32_UNSIGNED_INT_24_8_REV;\n }\n const format = hasStencil ? gl.DEPTH_STENCIL : gl.DEPTH_COMPONENT;\n let internalFormat = format;\n if (this.webGLVersion > 1) {\n if (internalTexture.format === 15) {\n internalFormat = gl.DEPTH_COMPONENT16;\n }\n else if (internalTexture.format === 16) {\n internalFormat = gl.DEPTH_COMPONENT24;\n }\n else if (internalTexture.format === 17 || internalTexture.format === 13) {\n internalFormat = gl.DEPTH24_STENCIL8;\n }\n else if (internalTexture.format === 14) {\n internalFormat = gl.DEPTH_COMPONENT32F;\n }\n else if (internalTexture.format === 18) {\n internalFormat = gl.DEPTH32F_STENCIL8;\n }\n }\n if (internalTexture.is2DArray) {\n gl.texImage3D(target, 0, internalFormat, internalTexture.width, internalTexture.height, layers, 0, format, type, null);\n }\n else {\n gl.texImage2D(target, 0, internalFormat, internalTexture.width, internalTexture.height, 0, format, type, null);\n }\n this._bindTextureDirectly(target, null);\n this._internalTexturesCache.push(internalTexture);\n // Dispose previous depth/stencil render buffers and clear the corresponding attachment.\n // Next time this framebuffer is bound, the new depth/stencil texture will be attached.\n const glRtWrapper = rtWrapper;\n if (glRtWrapper._depthStencilBuffer) {\n const currentFrameBuffer = this._currentFramebuffer;\n this._bindUnboundFramebuffer(glRtWrapper._framebuffer);\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, null);\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, null);\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.STENCIL_ATTACHMENT, gl.RENDERBUFFER, null);\n this._bindUnboundFramebuffer(currentFrameBuffer);\n gl.deleteRenderbuffer(glRtWrapper._depthStencilBuffer);\n glRtWrapper._depthStencilBuffer = null;\n }\n return internalTexture;\n};\nThinEngine.prototype.updateRenderTargetTextureSampleCount = function (rtWrapper, samples) {\n if (this.webGLVersion < 2 || !rtWrapper || !rtWrapper.texture) {\n return 1;\n }\n if (rtWrapper.samples === samples) {\n return samples;\n }\n const gl = this._gl;\n samples = Math.min(samples, this.getCaps().maxMSAASamples);\n // Dispose previous render buffers\n if (rtWrapper._depthStencilBuffer) {\n gl.deleteRenderbuffer(rtWrapper._depthStencilBuffer);\n rtWrapper._depthStencilBuffer = null;\n }\n if (rtWrapper._MSAAFramebuffer) {\n gl.deleteFramebuffer(rtWrapper._MSAAFramebuffer);\n rtWrapper._MSAAFramebuffer = null;\n }\n const hardwareTexture = rtWrapper.texture._hardwareTexture;\n hardwareTexture.releaseMSAARenderBuffers();\n if (samples > 1 && typeof gl.renderbufferStorageMultisample === \"function\") {\n const framebuffer = gl.createFramebuffer();\n if (!framebuffer) {\n throw new Error(\"Unable to create multi sampled framebuffer\");\n }\n rtWrapper._MSAAFramebuffer = framebuffer;\n this._bindUnboundFramebuffer(rtWrapper._MSAAFramebuffer);\n const colorRenderbuffer = this._createRenderBuffer(rtWrapper.texture.width, rtWrapper.texture.height, samples, -1 /* not used */, this._getRGBAMultiSampleBufferFormat(rtWrapper.texture.type), gl.COLOR_ATTACHMENT0, false);\n if (!colorRenderbuffer) {\n throw new Error(\"Unable to create multi sampled framebuffer\");\n }\n hardwareTexture.addMSAARenderBuffer(colorRenderbuffer);\n }\n else {\n this._bindUnboundFramebuffer(rtWrapper._framebuffer);\n }\n rtWrapper.texture.samples = samples;\n rtWrapper._samples = samples;\n rtWrapper._depthStencilBuffer = this._setupFramebufferDepthAttachments(rtWrapper._generateStencilBuffer, rtWrapper._generateDepthBuffer, rtWrapper.texture.width, rtWrapper.texture.height, samples);\n this._bindUnboundFramebuffer(null);\n return samples;\n};\n//# sourceMappingURL=engine.renderTarget.js.map","import { InternalTexture, InternalTextureSource } from \"../../Materials/Textures/internalTexture.js\";\nimport { Logger } from \"../../Misc/logger.js\";\n\nimport { ThinEngine } from \"../thinEngine.js\";\nThinEngine.prototype.createRenderTargetCubeTexture = function (size, options) {\n const rtWrapper = this._createHardwareRenderTargetWrapper(false, true, size);\n const fullOptions = Object.assign({ generateMipMaps: true, generateDepthBuffer: true, generateStencilBuffer: false, type: 0, samplingMode: 3, format: 5 }, options);\n fullOptions.generateStencilBuffer = fullOptions.generateDepthBuffer && fullOptions.generateStencilBuffer;\n if (fullOptions.type === 1 && !this._caps.textureFloatLinearFiltering) {\n // if floating point linear (gl.FLOAT) then force to NEAREST_SAMPLINGMODE\n fullOptions.samplingMode = 1;\n }\n else if (fullOptions.type === 2 && !this._caps.textureHalfFloatLinearFiltering) {\n // if floating point linear (HALF_FLOAT) then force to NEAREST_SAMPLINGMODE\n fullOptions.samplingMode = 1;\n }\n const gl = this._gl;\n const texture = new InternalTexture(this, InternalTextureSource.RenderTarget);\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true);\n const filters = this._getSamplingParameters(fullOptions.samplingMode, fullOptions.generateMipMaps);\n if (fullOptions.type === 1 && !this._caps.textureFloat) {\n fullOptions.type = 0;\n Logger.Warn(\"Float textures are not supported. Cube render target forced to TEXTURETYPE_UNESIGNED_BYTE type\");\n }\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, filters.mag);\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, filters.min);\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n for (let face = 0; face < 6; face++) {\n gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + face, 0, this._getRGBABufferInternalSizedFormat(fullOptions.type, fullOptions.format), size, size, 0, this._getInternalFormat(fullOptions.format), this._getWebGLTextureType(fullOptions.type), null);\n }\n // Create the framebuffer\n const framebuffer = gl.createFramebuffer();\n this._bindUnboundFramebuffer(framebuffer);\n rtWrapper._depthStencilBuffer = this._setupFramebufferDepthAttachments(fullOptions.generateStencilBuffer, fullOptions.generateDepthBuffer, size, size);\n // MipMaps\n if (fullOptions.generateMipMaps) {\n gl.generateMipmap(gl.TEXTURE_CUBE_MAP);\n }\n // Unbind\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, null);\n this._bindUnboundFramebuffer(null);\n rtWrapper._framebuffer = framebuffer;\n rtWrapper._generateDepthBuffer = fullOptions.generateDepthBuffer;\n rtWrapper._generateStencilBuffer = fullOptions.generateStencilBuffer;\n texture.width = size;\n texture.height = size;\n texture.isReady = true;\n texture.isCube = true;\n texture.samples = 1;\n texture.generateMipMaps = fullOptions.generateMipMaps;\n texture.samplingMode = fullOptions.samplingMode;\n texture.type = fullOptions.type;\n texture.format = fullOptions.format;\n this._internalTexturesCache.push(texture);\n rtWrapper.setTextures(texture);\n return rtWrapper;\n};\n//# sourceMappingURL=engine.renderTargetCube.js.map","// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore.js\";\nconst name = \"postprocessVertexShader\";\nconst shader = `attribute vec2 position;uniform vec2 scale;varying vec2 vUV;const vec2 madd=vec2(0.5,0.5);\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvUV=(position*madd+madd)*scale;gl_Position=vec4(position,0.0,1.0);\n#define CUSTOM_VERTEX_MAIN_END\n}`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @internal */\nexport const postprocessVertexShader = { name, shader };\n//# sourceMappingURL=postprocess.vertex.js.map","import { VertexBuffer } from \"../Buffers/buffer.js\";\nimport { Viewport } from \"../Maths/math.viewport.js\";\n\nimport { Observable } from \"../Misc/observable.js\";\nimport { Effect } from \"./effect.js\";\nimport { DrawWrapper } from \"./drawWrapper.js\";\n// Prevents ES6 Crash if not imported.\nimport \"../Shaders/postprocess.vertex.js\";\n// Fullscreen quad buffers by default.\nconst defaultOptions = {\n positions: [1, 1, -1, 1, -1, -1, 1, -1],\n indices: [0, 1, 2, 0, 2, 3],\n};\n/**\n * Helper class to render one or more effects.\n * You can access the previous rendering in your shader by declaring a sampler named textureSampler\n */\nexport class EffectRenderer {\n /**\n * Creates an effect renderer\n * @param engine the engine to use for rendering\n * @param options defines the options of the effect renderer\n */\n constructor(engine, options = defaultOptions) {\n var _a, _b;\n this._fullscreenViewport = new Viewport(0, 0, 1, 1);\n const positions = (_a = options.positions) !== null && _a !== void 0 ? _a : defaultOptions.positions;\n const indices = (_b = options.indices) !== null && _b !== void 0 ? _b : defaultOptions.indices;\n this.engine = engine;\n this._vertexBuffers = {\n [VertexBuffer.PositionKind]: new VertexBuffer(engine, positions, VertexBuffer.PositionKind, false, false, 2),\n };\n this._indexBuffer = engine.createIndexBuffer(indices);\n this._onContextRestoredObserver = engine.onContextRestoredObservable.add(() => {\n this._indexBuffer = engine.createIndexBuffer(indices);\n for (const key in this._vertexBuffers) {\n const vertexBuffer = this._vertexBuffers[key];\n vertexBuffer._rebuild();\n }\n });\n }\n /**\n * Sets the current viewport in normalized coordinates 0-1\n * @param viewport Defines the viewport to set (defaults to 0 0 1 1)\n */\n setViewport(viewport = this._fullscreenViewport) {\n this.engine.setViewport(viewport);\n }\n /**\n * Binds the embedded attributes buffer to the effect.\n * @param effect Defines the effect to bind the attributes for\n */\n bindBuffers(effect) {\n this.engine.bindBuffers(this._vertexBuffers, this._indexBuffer, effect);\n }\n /**\n * Sets the current effect wrapper to use during draw.\n * The effect needs to be ready before calling this api.\n * This also sets the default full screen position attribute.\n * @param effectWrapper Defines the effect to draw with\n */\n applyEffectWrapper(effectWrapper) {\n this.engine.setState(true);\n this.engine.depthCullingState.depthTest = false;\n this.engine.stencilState.stencilTest = false;\n this.engine.enableEffect(effectWrapper._drawWrapper);\n this.bindBuffers(effectWrapper.effect);\n effectWrapper.onApplyObservable.notifyObservers({});\n }\n /**\n * Saves engine states\n */\n saveStates() {\n this._savedStateDepthTest = this.engine.depthCullingState.depthTest;\n this._savedStateStencilTest = this.engine.stencilState.stencilTest;\n }\n /**\n * Restores engine states\n */\n restoreStates() {\n this.engine.depthCullingState.depthTest = this._savedStateDepthTest;\n this.engine.stencilState.stencilTest = this._savedStateStencilTest;\n }\n /**\n * Draws a full screen quad.\n */\n draw() {\n this.engine.drawElementsType(0, 0, 6);\n }\n _isRenderTargetTexture(texture) {\n return texture.renderTarget !== undefined;\n }\n /**\n * renders one or more effects to a specified texture\n * @param effectWrapper the effect to renderer\n * @param outputTexture texture to draw to, if null it will render to the screen.\n */\n render(effectWrapper, outputTexture = null) {\n // Ensure effect is ready\n if (!effectWrapper.effect.isReady()) {\n return;\n }\n this.saveStates();\n // Reset state\n this.setViewport();\n const out = outputTexture === null ? null : this._isRenderTargetTexture(outputTexture) ? outputTexture.renderTarget : outputTexture;\n if (out) {\n this.engine.bindFramebuffer(out);\n }\n this.applyEffectWrapper(effectWrapper);\n this.draw();\n if (out) {\n this.engine.unBindFramebuffer(out);\n }\n this.restoreStates();\n }\n /**\n * Disposes of the effect renderer\n */\n dispose() {\n const vertexBuffer = this._vertexBuffers[VertexBuffer.PositionKind];\n if (vertexBuffer) {\n vertexBuffer.dispose();\n delete this._vertexBuffers[VertexBuffer.PositionKind];\n }\n if (this._indexBuffer) {\n this.engine._releaseBuffer(this._indexBuffer);\n }\n if (this._onContextRestoredObserver) {\n this.engine.onContextRestoredObservable.remove(this._onContextRestoredObserver);\n this._onContextRestoredObserver = null;\n }\n }\n}\n/**\n * Wraps an effect to be used for rendering\n */\nexport class EffectWrapper {\n /**\n * The underlying effect\n */\n get effect() {\n return this._drawWrapper.effect;\n }\n set effect(effect) {\n this._drawWrapper.effect = effect;\n }\n /**\n * Creates an effect to be renderer\n * @param creationOptions options to create the effect\n */\n constructor(creationOptions) {\n /**\n * Event that is fired right before the effect is drawn (should be used to update uniforms)\n */\n this.onApplyObservable = new Observable();\n let effectCreationOptions;\n const uniformNames = creationOptions.uniformNames || [];\n if (creationOptions.vertexShader) {\n effectCreationOptions = {\n fragmentSource: creationOptions.fragmentShader,\n vertexSource: creationOptions.vertexShader,\n spectorName: creationOptions.name || \"effectWrapper\",\n };\n }\n else {\n // Default scale to use in post process vertex shader.\n uniformNames.push(\"scale\");\n effectCreationOptions = {\n fragmentSource: creationOptions.fragmentShader,\n vertex: \"postprocess\",\n spectorName: creationOptions.name || \"effectWrapper\",\n };\n // Sets the default scale to identity for the post process vertex shader.\n this.onApplyObservable.add(() => {\n this.effect.setFloat2(\"scale\", 1, 1);\n });\n }\n const defines = creationOptions.defines ? creationOptions.defines.join(\"\\n\") : \"\";\n this._drawWrapper = new DrawWrapper(creationOptions.engine);\n if (creationOptions.useShaderStore) {\n effectCreationOptions.fragment = effectCreationOptions.fragmentSource;\n if (!effectCreationOptions.vertex) {\n effectCreationOptions.vertex = effectCreationOptions.vertexSource;\n }\n delete effectCreationOptions.fragmentSource;\n delete effectCreationOptions.vertexSource;\n this.effect = creationOptions.engine.createEffect(effectCreationOptions, creationOptions.attributeNames || [\"position\"], uniformNames, creationOptions.samplerNames, defines, undefined, creationOptions.onCompiled, undefined, undefined, creationOptions.shaderLanguage);\n }\n else {\n this.effect = new Effect(effectCreationOptions, creationOptions.attributeNames || [\"position\"], uniformNames, creationOptions.samplerNames, creationOptions.engine, defines, undefined, creationOptions.onCompiled, undefined, undefined, undefined, creationOptions.shaderLanguage);\n this._onContextRestoredObserver = creationOptions.engine.onContextRestoredObservable.add(() => {\n this.effect._pipelineContext = null; // because _prepareEffect will try to dispose this pipeline before recreating it and that would lead to webgl errors\n this.effect._wasPreviouslyReady = false;\n this.effect._prepareEffect();\n });\n }\n }\n /**\n * Disposes of the effect wrapper\n */\n dispose() {\n if (this._onContextRestoredObserver) {\n this.effect.getEngine().onContextRestoredObservable.remove(this._onContextRestoredObserver);\n this._onContextRestoredObserver = null;\n }\n this.effect.dispose();\n }\n}\n//# sourceMappingURL=effectRenderer.js.map","// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore.js\";\nconst name = \"passPixelShader\";\nconst shader = `varying vec2 vUV;uniform sampler2D textureSampler;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) \n{gl_FragColor=texture2D(textureSampler,vUV);}`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @internal */\nexport const passPixelShader = { name, shader };\n//# sourceMappingURL=pass.fragment.js.map","import { ThinEngine } from \"../Engines/thinEngine.js\";\n\nimport { EffectRenderer, EffectWrapper } from \"../Materials/effectRenderer.js\";\nimport { Tools } from \"./tools.js\";\nimport { passPixelShader } from \"../Shaders/pass.fragment.js\";\nimport { Scalar } from \"../Maths/math.scalar.js\";\n/**\n * Class containing a set of static utilities functions to dump data from a canvas\n */\nexport class DumpTools {\n static _CreateDumpRenderer() {\n if (!DumpTools._DumpToolsEngine) {\n let canvas;\n let engine = null;\n const options = {\n preserveDrawingBuffer: true,\n depth: false,\n stencil: false,\n alpha: true,\n premultipliedAlpha: false,\n antialias: false,\n failIfMajorPerformanceCaveat: false,\n };\n try {\n canvas = new OffscreenCanvas(100, 100); // will be resized later\n engine = new ThinEngine(canvas, false, options);\n }\n catch (e) {\n // The browser either does not support OffscreenCanvas or WebGL context in OffscreenCanvas, fallback on a regular canvas\n canvas = document.createElement(\"canvas\");\n engine = new ThinEngine(canvas, false, options);\n }\n engine.getCaps().parallelShaderCompile = undefined;\n const renderer = new EffectRenderer(engine);\n const wrapper = new EffectWrapper({\n engine,\n name: passPixelShader.name,\n fragmentShader: passPixelShader.shader,\n samplerNames: [\"textureSampler\"],\n });\n DumpTools._DumpToolsEngine = {\n canvas,\n engine,\n renderer,\n wrapper,\n };\n }\n return DumpTools._DumpToolsEngine;\n }\n /**\n * Dumps the current bound framebuffer\n * @param width defines the rendering width\n * @param height defines the rendering height\n * @param engine defines the hosting engine\n * @param successCallback defines the callback triggered once the data are available\n * @param mimeType defines the mime type of the result\n * @param fileName defines the filename to download. If present, the result will automatically be downloaded\n * @param quality The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob | HTMLCanvasElement.toBlob()}'s `quality` parameter.\n * @returns a void promise\n */\n static async DumpFramebuffer(width, height, engine, successCallback, mimeType = \"image/png\", fileName, quality) {\n // Read the contents of the framebuffer\n const bufferView = await engine.readPixels(0, 0, width, height);\n const data = new Uint8Array(bufferView.buffer);\n DumpTools.DumpData(width, height, data, successCallback, mimeType, fileName, true, undefined, quality);\n }\n /**\n * Dumps an array buffer\n * @param width defines the rendering width\n * @param height defines the rendering height\n * @param data the data array\n * @param mimeType defines the mime type of the result\n * @param fileName defines the filename to download. If present, the result will automatically be downloaded\n * @param invertY true to invert the picture in the Y dimension\n * @param toArrayBuffer true to convert the data to an ArrayBuffer (encoded as `mimeType`) instead of a base64 string\n * @param quality The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob | HTMLCanvasElement.toBlob()}'s `quality` parameter.\n * @returns a promise that resolve to the final data\n */\n static DumpDataAsync(width, height, data, mimeType = \"image/png\", fileName, invertY = false, toArrayBuffer = false, quality) {\n return new Promise((resolve) => {\n DumpTools.DumpData(width, height, data, (result) => resolve(result), mimeType, fileName, invertY, toArrayBuffer, quality);\n });\n }\n /**\n * Dumps an array buffer\n * @param width defines the rendering width\n * @param height defines the rendering height\n * @param data the data array\n * @param successCallback defines the callback triggered once the data are available\n * @param mimeType defines the mime type of the result\n * @param fileName defines the filename to download. If present, the result will automatically be downloaded\n * @param invertY true to invert the picture in the Y dimension\n * @param toArrayBuffer true to convert the data to an ArrayBuffer (encoded as `mimeType`) instead of a base64 string\n * @param quality The quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob | HTMLCanvasElement.toBlob()}'s `quality` parameter.\n */\n static DumpData(width, height, data, successCallback, mimeType = \"image/png\", fileName, invertY = false, toArrayBuffer = false, quality) {\n const renderer = DumpTools._CreateDumpRenderer();\n renderer.engine.setSize(width, height, true);\n // Convert if data are float32\n if (data instanceof Float32Array) {\n const data2 = new Uint8Array(data.length);\n let n = data.length;\n while (n--) {\n const v = data[n];\n data2[n] = Math.round(Scalar.Clamp(v) * 255);\n }\n data = data2;\n }\n // Create the image\n const texture = renderer.engine.createRawTexture(data, width, height, 5, false, !invertY, 1);\n renderer.renderer.setViewport();\n renderer.renderer.applyEffectWrapper(renderer.wrapper);\n renderer.wrapper.effect._bindTexture(\"textureSampler\", texture);\n renderer.renderer.draw();\n if (toArrayBuffer) {\n Tools.ToBlob(renderer.canvas, (blob) => {\n const fileReader = new FileReader();\n fileReader.onload = (event) => {\n const arrayBuffer = event.target.result;\n if (successCallback) {\n successCallback(arrayBuffer);\n }\n };\n fileReader.readAsArrayBuffer(blob);\n }, mimeType, quality);\n }\n else {\n Tools.EncodeScreenshotCanvasData(renderer.canvas, successCallback, mimeType, fileName, quality);\n }\n texture.dispose();\n }\n /**\n * Dispose the dump tools associated resources\n */\n static Dispose() {\n if (DumpTools._DumpToolsEngine) {\n DumpTools._DumpToolsEngine.wrapper.dispose();\n DumpTools._DumpToolsEngine.renderer.dispose();\n DumpTools._DumpToolsEngine.engine.dispose();\n }\n DumpTools._DumpToolsEngine = null;\n }\n}\n/**\n * This will be executed automatically for UMD and es5.\n * If esm dev wants the side effects to execute they will have to run it manually\n * Once we build native modules those need to be exported.\n * @internal\n */\nconst initSideEffects = () => {\n // References the dependencies.\n Tools.DumpData = DumpTools.DumpData;\n Tools.DumpDataAsync = DumpTools.DumpDataAsync;\n Tools.DumpFramebuffer = DumpTools.DumpFramebuffer;\n};\ninitSideEffects();\n//# sourceMappingURL=dumpTools.js.map","import { Observable } from \"../../Misc/observable.js\";\nimport { Matrix, Vector3 } from \"../../Maths/math.vector.js\";\nimport { Texture } from \"../../Materials/Textures/texture.js\";\nimport { PostProcessManager } from \"../../PostProcesses/postProcessManager.js\";\nimport { RenderingManager } from \"../../Rendering/renderingManager.js\";\n\nimport \"../../Engines/Extensions/engine.renderTarget.js\";\nimport \"../../Engines/Extensions/engine.renderTargetCube.js\";\nimport { Engine } from \"../../Engines/engine.js\";\nimport { _ObserveArray } from \"../../Misc/arrayTools.js\";\nimport { DumpTools } from \"../../Misc/dumpTools.js\";\n/**\n * This Helps creating a texture that will be created from a camera in your scene.\n * It is basically a dynamic texture that could be used to create special effects for instance.\n * Actually, It is the base of lot of effects in the framework like post process, shadows, effect layers and rendering pipelines...\n */\nexport class RenderTargetTexture extends Texture {\n /**\n * Use this list to define the list of mesh you want to render.\n */\n get renderList() {\n return this._renderList;\n }\n set renderList(value) {\n if (this._unObserveRenderList) {\n this._unObserveRenderList();\n this._unObserveRenderList = null;\n }\n if (value) {\n this._unObserveRenderList = _ObserveArray(value, this._renderListHasChanged);\n }\n this._renderList = value;\n }\n /**\n * Post-processes for this render target\n */\n get postProcesses() {\n return this._postProcesses;\n }\n get _prePassEnabled() {\n return !!this._prePassRenderTarget && this._prePassRenderTarget.enabled;\n }\n /**\n * Set a after unbind callback in the texture.\n * This has been kept for backward compatibility and use of onAfterUnbindObservable is recommended.\n */\n set onAfterUnbind(callback) {\n if (this._onAfterUnbindObserver) {\n this.onAfterUnbindObservable.remove(this._onAfterUnbindObserver);\n }\n this._onAfterUnbindObserver = this.onAfterUnbindObservable.add(callback);\n }\n /**\n * Set a before render callback in the texture.\n * This has been kept for backward compatibility and use of onBeforeRenderObservable is recommended.\n */\n set onBeforeRender(callback) {\n if (this._onBeforeRenderObserver) {\n this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver);\n }\n this._onBeforeRenderObserver = this.onBeforeRenderObservable.add(callback);\n }\n /**\n * Set a after render callback in the texture.\n * This has been kept for backward compatibility and use of onAfterRenderObservable is recommended.\n */\n set onAfterRender(callback) {\n if (this._onAfterRenderObserver) {\n this.onAfterRenderObservable.remove(this._onAfterRenderObserver);\n }\n this._onAfterRenderObserver = this.onAfterRenderObservable.add(callback);\n }\n /**\n * Set a clear callback in the texture.\n * This has been kept for backward compatibility and use of onClearObservable is recommended.\n */\n set onClear(callback) {\n if (this._onClearObserver) {\n this.onClearObservable.remove(this._onClearObserver);\n }\n this._onClearObserver = this.onClearObservable.add(callback);\n }\n /**\n * Gets the render pass ids used by the render target texture. For a single render target the array length will be 1, for a cube texture it will be 6 and for\n * a 2D texture array it will return an array of ids the size of the 2D texture array\n */\n get renderPassIds() {\n return this._renderPassIds;\n }\n /**\n * Gets the current value of the refreshId counter\n */\n get currentRefreshId() {\n return this._currentRefreshId;\n }\n /**\n * Sets a specific material to be used to render a mesh/a list of meshes in this render target texture\n * @param mesh mesh or array of meshes\n * @param material material or array of materials to use for this render pass. If undefined is passed, no specific material will be used but the regular material instead (mesh.material). It's possible to provide an array of materials to use a different material for each rendering in the case of a cube texture (6 rendering) and a 2D texture array (as many rendering as the length of the array)\n */\n setMaterialForRendering(mesh, material) {\n let meshes;\n if (!Array.isArray(mesh)) {\n meshes = [mesh];\n }\n else {\n meshes = mesh;\n }\n for (let j = 0; j < meshes.length; ++j) {\n for (let i = 0; i < this._renderPassIds.length; ++i) {\n meshes[j].setMaterialForRenderPass(this._renderPassIds[i], material !== undefined ? (Array.isArray(material) ? material[i] : material) : undefined);\n }\n }\n }\n /**\n * Define if the texture has multiple draw buffers or if false a single draw buffer.\n */\n get isMulti() {\n var _a, _b;\n return (_b = (_a = this._renderTarget) === null || _a === void 0 ? void 0 : _a.isMulti) !== null && _b !== void 0 ? _b : false;\n }\n /**\n * Gets render target creation options that were used.\n */\n get renderTargetOptions() {\n return this._renderTargetOptions;\n }\n /**\n * Gets the render target wrapper associated with this render target\n */\n get renderTarget() {\n return this._renderTarget;\n }\n _onRatioRescale() {\n if (this._sizeRatio) {\n this.resize(this._initialSizeParameter);\n }\n }\n /**\n * Gets or sets the size of the bounding box associated with the texture (when in cube mode)\n * When defined, the cubemap will switch to local mode\n * @see https://community.arm.com/graphics/b/blog/posts/reflections-based-on-local-cubemaps-in-unity\n * @example https://www.babylonjs-playground.com/#RNASML\n */\n set boundingBoxSize(value) {\n if (this._boundingBoxSize && this._boundingBoxSize.equals(value)) {\n return;\n }\n this._boundingBoxSize = value;\n const scene = this.getScene();\n if (scene) {\n scene.markAllMaterialsAsDirty(1);\n }\n }\n get boundingBoxSize() {\n return this._boundingBoxSize;\n }\n /**\n * In case the RTT has been created with a depth texture, get the associated\n * depth texture.\n * Otherwise, return null.\n */\n get depthStencilTexture() {\n var _a, _b;\n return (_b = (_a = this._renderTarget) === null || _a === void 0 ? void 0 : _a._depthStencilTexture) !== null && _b !== void 0 ? _b : null;\n }\n /** @internal */\n constructor(name, size, scene, generateMipMaps = false, doNotChangeAspectRatio = true, type = 0, isCube = false, samplingMode = Texture.TRILINEAR_SAMPLINGMODE, generateDepthBuffer = true, generateStencilBuffer = false, isMulti = false, format = 5, delayAllocation = false, samples, creationFlags, noColorAttachment = false, useSRGBBuffer = false) {\n var _a, _b, _c, _d, _e, _f;\n let colorAttachment = undefined;\n if (typeof generateMipMaps === \"object\") {\n const options = generateMipMaps;\n generateMipMaps = !!options.generateMipMaps;\n doNotChangeAspectRatio = (_a = options.doNotChangeAspectRatio) !== null && _a !== void 0 ? _a : true;\n type = (_b = options.type) !== null && _b !== void 0 ? _b : 0;\n isCube = !!options.isCube;\n samplingMode = (_c = options.samplingMode) !== null && _c !== void 0 ? _c : Texture.TRILINEAR_SAMPLINGMODE;\n generateDepthBuffer = (_d = options.generateDepthBuffer) !== null && _d !== void 0 ? _d : true;\n generateStencilBuffer = !!options.generateStencilBuffer;\n isMulti = !!options.isMulti;\n format = (_e = options.format) !== null && _e !== void 0 ? _e : 5;\n delayAllocation = !!options.delayAllocation;\n samples = options.samples;\n creationFlags = options.creationFlags;\n noColorAttachment = !!options.noColorAttachment;\n useSRGBBuffer = !!options.useSRGBBuffer;\n colorAttachment = options.colorAttachment;\n }\n super(null, scene, !generateMipMaps, undefined, samplingMode, undefined, undefined, undefined, undefined, format);\n this._unObserveRenderList = null;\n this._renderListHasChanged = (_functionName, previousLength) => {\n var _a;\n const newLength = this._renderList ? this._renderList.length : 0;\n if ((previousLength === 0 && newLength > 0) || newLength === 0) {\n (_a = this.getScene()) === null || _a === void 0 ? void 0 : _a.meshes.forEach((mesh) => {\n mesh._markSubMeshesAsLightDirty();\n });\n }\n };\n /**\n * Define if particles should be rendered in your texture.\n */\n this.renderParticles = true;\n /**\n * Define if sprites should be rendered in your texture.\n */\n this.renderSprites = false;\n /**\n * Force checking the layerMask property even if a custom list of meshes is provided (ie. if renderList is not undefined)\n */\n this.forceLayerMaskCheck = false;\n /**\n * Define if the camera viewport should be respected while rendering the texture or if the render should be done to the entire texture.\n */\n this.ignoreCameraViewport = false;\n /**\n * An event triggered when the texture is unbind.\n */\n this.onBeforeBindObservable = new Observable();\n /**\n * An event triggered when the texture is unbind.\n */\n this.onAfterUnbindObservable = new Observable();\n /**\n * An event triggered before rendering the texture\n */\n this.onBeforeRenderObservable = new Observable();\n /**\n * An event triggered after rendering the texture\n */\n this.onAfterRenderObservable = new Observable();\n /**\n * An event triggered after the texture clear\n */\n this.onClearObservable = new Observable();\n /**\n * An event triggered when the texture is resized.\n */\n this.onResizeObservable = new Observable();\n /** @internal */\n this._cleared = false;\n /**\n * Skip the initial clear of the rtt at the beginning of the frame render loop\n */\n this.skipInitialClear = false;\n this._currentRefreshId = -1;\n this._refreshRate = 1;\n this._samples = 1;\n this._canRescale = true;\n this._renderTarget = null;\n /**\n * Gets or sets the center of the bounding box associated with the texture (when in cube mode)\n * It must define where the camera used to render the texture is set\n */\n this.boundingBoxPosition = Vector3.Zero();\n scene = this.getScene();\n if (!scene) {\n return;\n }\n const engine = this.getScene().getEngine();\n this._coordinatesMode = Texture.PROJECTION_MODE;\n this.renderList = new Array();\n this.name = name;\n this.isRenderTarget = true;\n this._initialSizeParameter = size;\n this._renderPassIds = [];\n this._isCubeData = isCube;\n this._processSizeParameter(size);\n this.renderPassId = this._renderPassIds[0];\n this._resizeObserver = engine.onResizeObservable.add(() => { });\n this._generateMipMaps = generateMipMaps ? true : false;\n this._doNotChangeAspectRatio = doNotChangeAspectRatio;\n // Rendering groups\n this._renderingManager = new RenderingManager(scene);\n this._renderingManager._useSceneAutoClearSetup = true;\n if (isMulti) {\n return;\n }\n this._renderTargetOptions = {\n generateMipMaps: generateMipMaps,\n type: type,\n format: (_f = this._format) !== null && _f !== void 0 ? _f : undefined,\n samplingMode: this.samplingMode,\n generateDepthBuffer: generateDepthBuffer,\n generateStencilBuffer: generateStencilBuffer,\n samples,\n creationFlags,\n noColorAttachment: noColorAttachment,\n useSRGBBuffer,\n colorAttachment: colorAttachment,\n label: this.name,\n };\n if (this.samplingMode === Texture.NEAREST_SAMPLINGMODE) {\n this.wrapU = Texture.CLAMP_ADDRESSMODE;\n this.wrapV = Texture.CLAMP_ADDRESSMODE;\n }\n if (!delayAllocation) {\n if (isCube) {\n this._renderTarget = scene.getEngine().createRenderTargetCubeTexture(this.getRenderSize(), this._renderTargetOptions);\n this.coordinatesMode = Texture.INVCUBIC_MODE;\n this._textureMatrix = Matrix.Identity();\n }\n else {\n this._renderTarget = scene.getEngine().createRenderTargetTexture(this._size, this._renderTargetOptions);\n }\n this._texture = this._renderTarget.texture;\n if (samples !== undefined) {\n this.samples = samples;\n }\n }\n }\n /**\n * Creates a depth stencil texture.\n * This is only available in WebGL 2 or with the depth texture extension available.\n * @param comparisonFunction Specifies the comparison function to set on the texture. If 0 or undefined, the texture is not in comparison mode (default: 0)\n * @param bilinearFiltering Specifies whether or not bilinear filtering is enable on the texture (default: true)\n * @param generateStencil Specifies whether or not a stencil should be allocated in the texture (default: false)\n * @param samples sample count of the depth/stencil texture (default: 1)\n * @param format format of the depth texture (default: 14)\n */\n createDepthStencilTexture(comparisonFunction = 0, bilinearFiltering = true, generateStencil = false, samples = 1, format = 14) {\n var _a;\n (_a = this._renderTarget) === null || _a === void 0 ? void 0 : _a.createDepthStencilTexture(comparisonFunction, bilinearFiltering, generateStencil, samples, format);\n }\n _releaseRenderPassId() {\n if (this._scene) {\n const engine = this._scene.getEngine();\n for (let i = 0; i < this._renderPassIds.length; ++i) {\n engine.releaseRenderPassId(this._renderPassIds[i]);\n }\n }\n this._renderPassIds = [];\n }\n _createRenderPassId() {\n this._releaseRenderPassId();\n const engine = this._scene.getEngine(); // scene can't be null in a RenderTargetTexture, see constructor\n const numPasses = this._isCubeData ? 6 : this.getRenderLayers() || 1;\n for (let i = 0; i < numPasses; ++i) {\n this._renderPassIds[i] = engine.createRenderPassId(`RenderTargetTexture - ${this.name}#${i}`);\n }\n }\n _processSizeParameter(size, createRenderPassIds = true) {\n if (size.ratio) {\n this._sizeRatio = size.ratio;\n const engine = this._getEngine();\n this._size = {\n width: this._bestReflectionRenderTargetDimension(engine.getRenderWidth(), this._sizeRatio),\n height: this._bestReflectionRenderTargetDimension(engine.getRenderHeight(), this._sizeRatio),\n };\n }\n else {\n this._size = size;\n }\n if (createRenderPassIds) {\n this._createRenderPassId();\n }\n }\n /**\n * Define the number of samples to use in case of MSAA.\n * It defaults to one meaning no MSAA has been enabled.\n */\n get samples() {\n var _a, _b;\n return (_b = (_a = this._renderTarget) === null || _a === void 0 ? void 0 : _a.samples) !== null && _b !== void 0 ? _b : this._samples;\n }\n set samples(value) {\n if (this._renderTarget) {\n this._samples = this._renderTarget.setSamples(value);\n }\n }\n /**\n * Resets the refresh counter of the texture and start bak from scratch.\n * Could be useful to regenerate the texture if it is setup to render only once.\n */\n resetRefreshCounter() {\n this._currentRefreshId = -1;\n }\n /**\n * Define the refresh rate of the texture or the rendering frequency.\n * Use 0 to render just once, 1 to render on every frame, 2 to render every two frames and so on...\n */\n get refreshRate() {\n return this._refreshRate;\n }\n set refreshRate(value) {\n this._refreshRate = value;\n this.resetRefreshCounter();\n }\n /**\n * Adds a post process to the render target rendering passes.\n * @param postProcess define the post process to add\n */\n addPostProcess(postProcess) {\n if (!this._postProcessManager) {\n const scene = this.getScene();\n if (!scene) {\n return;\n }\n this._postProcessManager = new PostProcessManager(scene);\n this._postProcesses = new Array();\n }\n this._postProcesses.push(postProcess);\n this._postProcesses[0].autoClear = false;\n }\n /**\n * Clear all the post processes attached to the render target\n * @param dispose define if the cleared post processes should also be disposed (false by default)\n */\n clearPostProcesses(dispose = false) {\n if (!this._postProcesses) {\n return;\n }\n if (dispose) {\n for (const postProcess of this._postProcesses) {\n postProcess.dispose();\n }\n }\n this._postProcesses = [];\n }\n /**\n * Remove one of the post process from the list of attached post processes to the texture\n * @param postProcess define the post process to remove from the list\n */\n removePostProcess(postProcess) {\n if (!this._postProcesses) {\n return;\n }\n const index = this._postProcesses.indexOf(postProcess);\n if (index === -1) {\n return;\n }\n this._postProcesses.splice(index, 1);\n if (this._postProcesses.length > 0) {\n this._postProcesses[0].autoClear = false;\n }\n }\n /** @internal */\n _shouldRender() {\n if (this._currentRefreshId === -1) {\n // At least render once\n this._currentRefreshId = 1;\n return true;\n }\n if (this.refreshRate === this._currentRefreshId) {\n this._currentRefreshId = 1;\n return true;\n }\n this._currentRefreshId++;\n return false;\n }\n /**\n * Gets the actual render size of the texture.\n * @returns the width of the render size\n */\n getRenderSize() {\n return this.getRenderWidth();\n }\n /**\n * Gets the actual render width of the texture.\n * @returns the width of the render size\n */\n getRenderWidth() {\n if (this._size.width) {\n return this._size.width;\n }\n return this._size;\n }\n /**\n * Gets the actual render height of the texture.\n * @returns the height of the render size\n */\n getRenderHeight() {\n if (this._size.width) {\n return this._size.height;\n }\n return this._size;\n }\n /**\n * Gets the actual number of layers of the texture.\n * @returns the number of layers\n */\n getRenderLayers() {\n const layers = this._size.layers;\n if (layers) {\n return layers;\n }\n return 0;\n }\n /**\n * Don't allow this render target texture to rescale. Mainly used to prevent rescaling by the scene optimizer.\n */\n disableRescaling() {\n this._canRescale = false;\n }\n /**\n * Get if the texture can be rescaled or not.\n */\n get canRescale() {\n return this._canRescale;\n }\n /**\n * Resize the texture using a ratio.\n * @param ratio the ratio to apply to the texture size in order to compute the new target size\n */\n scale(ratio) {\n const newSize = Math.max(1, this.getRenderSize() * ratio);\n this.resize(newSize);\n }\n /**\n * Get the texture reflection matrix used to rotate/transform the reflection.\n * @returns the reflection matrix\n */\n getReflectionTextureMatrix() {\n if (this.isCube) {\n return this._textureMatrix;\n }\n return super.getReflectionTextureMatrix();\n }\n /**\n * Resize the texture to a new desired size.\n * Be careful as it will recreate all the data in the new texture.\n * @param size Define the new size. It can be:\n * - a number for squared texture,\n * - an object containing { width: number, height: number }\n * - or an object containing a ratio { ratio: number }\n */\n resize(size) {\n var _a;\n const wasCube = this.isCube;\n (_a = this._renderTarget) === null || _a === void 0 ? void 0 : _a.dispose();\n this._renderTarget = null;\n const scene = this.getScene();\n if (!scene) {\n return;\n }\n this._processSizeParameter(size, false);\n if (wasCube) {\n this._renderTarget = scene.getEngine().createRenderTargetCubeTexture(this.getRenderSize(), this._renderTargetOptions);\n }\n else {\n this._renderTarget = scene.getEngine().createRenderTargetTexture(this._size, this._renderTargetOptions);\n }\n this._texture = this._renderTarget.texture;\n if (this._renderTargetOptions.samples !== undefined) {\n this.samples = this._renderTargetOptions.samples;\n }\n if (this.onResizeObservable.hasObservers()) {\n this.onResizeObservable.notifyObservers(this);\n }\n }\n /**\n * Renders all the objects from the render list into the texture.\n * @param useCameraPostProcess Define if camera post processes should be used during the rendering\n * @param dumpForDebug Define if the rendering result should be dumped (copied) for debugging purpose\n */\n render(useCameraPostProcess = false, dumpForDebug = false) {\n this._render(useCameraPostProcess, dumpForDebug);\n }\n /**\n * This function will check if the render target texture can be rendered (textures are loaded, shaders are compiled)\n * @returns true if all required resources are ready\n */\n isReadyForRendering() {\n return this._render(false, false, true);\n }\n _render(useCameraPostProcess = false, dumpForDebug = false, checkReadiness = false) {\n var _a;\n const scene = this.getScene();\n if (!scene) {\n return checkReadiness;\n }\n const engine = scene.getEngine();\n if (this.useCameraPostProcesses !== undefined) {\n useCameraPostProcess = this.useCameraPostProcesses;\n }\n if (this._waitingRenderList) {\n this.renderList = [];\n for (let index = 0; index < this._waitingRenderList.length; index++) {\n const id = this._waitingRenderList[index];\n const mesh = scene.getMeshById(id);\n if (mesh) {\n this.renderList.push(mesh);\n }\n }\n this._waitingRenderList = undefined;\n }\n // Is predicate defined?\n if (this.renderListPredicate) {\n if (this.renderList) {\n this.renderList.length = 0; // Clear previous renderList\n }\n else {\n this.renderList = [];\n }\n const scene = this.getScene();\n if (!scene) {\n return checkReadiness;\n }\n const sceneMeshes = scene.meshes;\n for (let index = 0; index < sceneMeshes.length; index++) {\n const mesh = sceneMeshes[index];\n if (this.renderListPredicate(mesh)) {\n this.renderList.push(mesh);\n }\n }\n }\n const currentRenderPassId = engine.currentRenderPassId;\n this.onBeforeBindObservable.notifyObservers(this);\n // Set custom projection.\n // Needs to be before binding to prevent changing the aspect ratio.\n const camera = (_a = this.activeCamera) !== null && _a !== void 0 ? _a : scene.activeCamera;\n const sceneCamera = scene.activeCamera;\n if (camera) {\n if (camera !== scene.activeCamera) {\n scene.setTransformMatrix(camera.getViewMatrix(), camera.getProjectionMatrix(true));\n scene.activeCamera = camera;\n }\n engine.setViewport(camera.rigParent ? camera.rigParent.viewport : camera.viewport, this.getRenderWidth(), this.getRenderHeight());\n }\n this._defaultRenderListPrepared = false;\n let returnValue = checkReadiness;\n if (!checkReadiness) {\n if (this.is2DArray && !this.isMulti) {\n for (let layer = 0; layer < this.getRenderLayers(); layer++) {\n this._renderToTarget(0, useCameraPostProcess, dumpForDebug, layer, camera);\n scene.incrementRenderId();\n scene.resetCachedMaterial();\n }\n }\n else if (this.isCube && !this.isMulti) {\n for (let face = 0; face < 6; face++) {\n this._renderToTarget(face, useCameraPostProcess, dumpForDebug, undefined, camera);\n scene.incrementRenderId();\n scene.resetCachedMaterial();\n }\n }\n else {\n this._renderToTarget(0, useCameraPostProcess, dumpForDebug, undefined, camera);\n }\n }\n else {\n if (!scene.getViewMatrix()) {\n // We probably didn't execute scene.render() yet, so make sure we have a view/projection matrix setup for the scene\n scene.updateTransformMatrix();\n }\n const numLayers = this.is2DArray ? this.getRenderLayers() : this.isCube ? 6 : 1;\n for (let layer = 0; layer < numLayers && returnValue; layer++) {\n let currentRenderList = null;\n const defaultRenderList = this.renderList ? this.renderList : scene.getActiveMeshes().data;\n const defaultRenderListLength = this.renderList ? this.renderList.length : scene.getActiveMeshes().length;\n engine.currentRenderPassId = this._renderPassIds[layer];\n this.onBeforeRenderObservable.notifyObservers(layer);\n if (this.getCustomRenderList) {\n currentRenderList = this.getCustomRenderList(layer, defaultRenderList, defaultRenderListLength);\n }\n if (!currentRenderList) {\n currentRenderList = defaultRenderList;\n }\n if (!this._doNotChangeAspectRatio) {\n scene.updateTransformMatrix(true);\n }\n for (let i = 0; i < currentRenderList.length && returnValue; ++i) {\n const mesh = currentRenderList[i];\n if (!mesh.isEnabled() || mesh.isBlocked || !mesh.isVisible || !mesh.subMeshes) {\n continue;\n }\n if (this.customIsReadyFunction) {\n if (!this.customIsReadyFunction(mesh, this.refreshRate, checkReadiness)) {\n returnValue = false;\n continue;\n }\n }\n else if (!mesh.isReady(true)) {\n returnValue = false;\n continue;\n }\n }\n this.onAfterRenderObservable.notifyObservers(layer);\n if (this.is2DArray || this.isCube) {\n scene.incrementRenderId();\n scene.resetCachedMaterial();\n }\n }\n }\n this.onAfterUnbindObservable.notifyObservers(this);\n engine.currentRenderPassId = currentRenderPassId;\n if (sceneCamera) {\n scene.activeCamera = sceneCamera;\n // Do not avoid setting uniforms when multiple scenes are active as another camera may have overwrite these\n if (scene.getEngine().scenes.length > 1 || (this.activeCamera && this.activeCamera !== scene.activeCamera)) {\n scene.setTransformMatrix(scene.activeCamera.getViewMatrix(), scene.activeCamera.getProjectionMatrix(true));\n }\n engine.setViewport(scene.activeCamera.viewport);\n }\n scene.resetCachedMaterial();\n return returnValue;\n }\n _bestReflectionRenderTargetDimension(renderDimension, scale) {\n const minimum = 128;\n const x = renderDimension * scale;\n const curved = Engine.NearestPOT(x + (minimum * minimum) / (minimum + x));\n // Ensure we don't exceed the render dimension (while staying POT)\n return Math.min(Engine.FloorPOT(renderDimension), curved);\n }\n _prepareRenderingManager(currentRenderList, currentRenderListLength, camera, checkLayerMask) {\n const scene = this.getScene();\n if (!scene) {\n return;\n }\n this._renderingManager.reset();\n const sceneRenderId = scene.getRenderId();\n for (let meshIndex = 0; meshIndex < currentRenderListLength; meshIndex++) {\n const mesh = currentRenderList[meshIndex];\n if (mesh && !mesh.isBlocked) {\n if (this.customIsReadyFunction) {\n if (!this.customIsReadyFunction(mesh, this.refreshRate, false)) {\n this.resetRefreshCounter();\n continue;\n }\n }\n else if (!mesh.isReady(this.refreshRate === 0)) {\n this.resetRefreshCounter();\n continue;\n }\n if (!mesh._internalAbstractMeshDataInfo._currentLODIsUpToDate && scene.activeCamera) {\n mesh._internalAbstractMeshDataInfo._currentLOD = scene.customLODSelector\n ? scene.customLODSelector(mesh, this.activeCamera || scene.activeCamera)\n : mesh.getLOD(this.activeCamera || scene.activeCamera);\n mesh._internalAbstractMeshDataInfo._currentLODIsUpToDate = true;\n }\n if (!mesh._internalAbstractMeshDataInfo._currentLOD) {\n continue;\n }\n let meshToRender = mesh._internalAbstractMeshDataInfo._currentLOD;\n meshToRender._preActivateForIntermediateRendering(sceneRenderId);\n let isMasked;\n if (checkLayerMask && camera) {\n isMasked = (mesh.layerMask & camera.layerMask) === 0;\n }\n else {\n isMasked = false;\n }\n if (mesh.isEnabled() && mesh.isVisible && mesh.subMeshes && !isMasked) {\n if (meshToRender !== mesh) {\n meshToRender._activate(sceneRenderId, true);\n }\n if (mesh._activate(sceneRenderId, true) && mesh.subMeshes.length) {\n if (!mesh.isAnInstance) {\n meshToRender._internalAbstractMeshDataInfo._onlyForInstancesIntermediate = false;\n }\n else {\n if (mesh._internalAbstractMeshDataInfo._actAsRegularMesh) {\n meshToRender = mesh;\n }\n }\n meshToRender._internalAbstractMeshDataInfo._isActiveIntermediate = true;\n for (let subIndex = 0; subIndex < meshToRender.subMeshes.length; subIndex++) {\n const subMesh = meshToRender.subMeshes[subIndex];\n this._renderingManager.dispatch(subMesh, meshToRender);\n }\n }\n }\n }\n }\n for (let particleIndex = 0; particleIndex < scene.particleSystems.length; particleIndex++) {\n const particleSystem = scene.particleSystems[particleIndex];\n const emitter = particleSystem.emitter;\n if (!particleSystem.isStarted() || !emitter || (emitter.position && !emitter.isEnabled())) {\n continue;\n }\n this._renderingManager.dispatchParticles(particleSystem);\n }\n }\n /**\n * @internal\n * @param faceIndex face index to bind to if this is a cubetexture\n * @param layer defines the index of the texture to bind in the array\n */\n _bindFrameBuffer(faceIndex = 0, layer = 0) {\n const scene = this.getScene();\n if (!scene) {\n return;\n }\n const engine = scene.getEngine();\n if (this._renderTarget) {\n engine.bindFramebuffer(this._renderTarget, this.isCube ? faceIndex : undefined, undefined, undefined, this.ignoreCameraViewport, 0, layer);\n }\n }\n _unbindFrameBuffer(engine, faceIndex) {\n if (!this._renderTarget) {\n return;\n }\n engine.unBindFramebuffer(this._renderTarget, this.isCube, () => {\n this.onAfterRenderObservable.notifyObservers(faceIndex);\n });\n }\n /**\n * @internal\n */\n _prepareFrame(scene, faceIndex, layer, useCameraPostProcess) {\n if (this._postProcessManager) {\n if (!this._prePassEnabled) {\n this._postProcessManager._prepareFrame(this._texture, this._postProcesses);\n }\n }\n else if (!useCameraPostProcess || !scene.postProcessManager._prepareFrame(this._texture)) {\n this._bindFrameBuffer(faceIndex, layer);\n }\n }\n _renderToTarget(faceIndex, useCameraPostProcess, dumpForDebug, layer = 0, camera = null) {\n var _a, _b, _c, _d, _e, _f;\n const scene = this.getScene();\n if (!scene) {\n return;\n }\n const engine = scene.getEngine();\n (_a = engine._debugPushGroup) === null || _a === void 0 ? void 0 : _a.call(engine, `render to face #${faceIndex} layer #${layer}`, 1);\n // Bind\n this._prepareFrame(scene, faceIndex, layer, useCameraPostProcess);\n if (this.is2DArray) {\n engine.currentRenderPassId = this._renderPassIds[layer];\n this.onBeforeRenderObservable.notifyObservers(layer);\n }\n else {\n engine.currentRenderPassId = this._renderPassIds[faceIndex];\n this.onBeforeRenderObservable.notifyObservers(faceIndex);\n }\n const fastPath = engine.snapshotRendering && engine.snapshotRenderingMode === 1;\n if (!fastPath) {\n // Get the list of meshes to render\n let currentRenderList = null;\n const defaultRenderList = this.renderList ? this.renderList : scene.getActiveMeshes().data;\n const defaultRenderListLength = this.renderList ? this.renderList.length : scene.getActiveMeshes().length;\n if (this.getCustomRenderList) {\n currentRenderList = this.getCustomRenderList(this.is2DArray ? layer : faceIndex, defaultRenderList, defaultRenderListLength);\n }\n if (!currentRenderList) {\n // No custom render list provided, we prepare the rendering for the default list, but check\n // first if we did not already performed the preparation before so as to avoid re-doing it several times\n if (!this._defaultRenderListPrepared) {\n this._prepareRenderingManager(defaultRenderList, defaultRenderListLength, camera, !this.renderList || this.forceLayerMaskCheck);\n this._defaultRenderListPrepared = true;\n }\n currentRenderList = defaultRenderList;\n }\n else {\n // Prepare the rendering for the custom render list provided\n this._prepareRenderingManager(currentRenderList, currentRenderList.length, camera, this.forceLayerMaskCheck);\n }\n // Before clear\n for (const step of scene._beforeRenderTargetClearStage) {\n step.action(this, faceIndex, layer);\n }\n // Clear\n if (this.onClearObservable.hasObservers()) {\n this.onClearObservable.notifyObservers(engine);\n }\n else {\n if (!this.skipInitialClear) {\n engine.clear(this.clearColor || scene.clearColor, true, true, true);\n }\n }\n if (!this._doNotChangeAspectRatio) {\n scene.updateTransformMatrix(true);\n }\n // Before Camera Draw\n for (const step of scene._beforeRenderTargetDrawStage) {\n step.action(this, faceIndex, layer);\n }\n // Render\n this._renderingManager.render(this.customRenderFunction, currentRenderList, this.renderParticles, this.renderSprites);\n // After Camera Draw\n for (const step of scene._afterRenderTargetDrawStage) {\n step.action(this, faceIndex, layer);\n }\n const saveGenerateMipMaps = (_c = (_b = this._texture) === null || _b === void 0 ? void 0 : _b.generateMipMaps) !== null && _c !== void 0 ? _c : false;\n if (this._texture) {\n this._texture.generateMipMaps = false; // if left true, the mipmaps will be generated (if this._texture.generateMipMaps = true) when the first post process binds its own RTT: by doing so it will unbind the current RTT,\n // which will trigger a mipmap generation. We don't want this because it's a wasted work, we will do an unbind of the current RTT at the end of the process (see unbindFrameBuffer) which will\n // trigger the generation of the final mipmaps\n }\n if (this._postProcessManager) {\n this._postProcessManager._finalizeFrame(false, (_d = this._renderTarget) !== null && _d !== void 0 ? _d : undefined, faceIndex, this._postProcesses, this.ignoreCameraViewport);\n }\n else if (useCameraPostProcess) {\n scene.postProcessManager._finalizeFrame(false, (_e = this._renderTarget) !== null && _e !== void 0 ? _e : undefined, faceIndex);\n }\n for (const step of scene._afterRenderTargetPostProcessStage) {\n step.action(this, faceIndex, layer);\n }\n if (this._texture) {\n this._texture.generateMipMaps = saveGenerateMipMaps;\n }\n if (!this._doNotChangeAspectRatio) {\n scene.updateTransformMatrix(true);\n }\n // Dump ?\n if (dumpForDebug) {\n DumpTools.DumpFramebuffer(this.getRenderWidth(), this.getRenderHeight(), engine);\n }\n }\n else {\n // Clear\n if (this.onClearObservable.hasObservers()) {\n this.onClearObservable.notifyObservers(engine);\n }\n else {\n if (!this.skipInitialClear) {\n engine.clear(this.clearColor || scene.clearColor, true, true, true);\n }\n }\n }\n // Unbind\n this._unbindFrameBuffer(engine, faceIndex);\n if (this._texture && this.isCube && faceIndex === 5) {\n engine.generateMipMapsForCubemap(this._texture);\n }\n (_f = engine._debugPopGroup) === null || _f === void 0 ? void 0 : _f.call(engine, 1);\n }\n /**\n * Overrides the default sort function applied in the rendering group to prepare the meshes.\n * This allowed control for front to back rendering or reversely depending of the special needs.\n *\n * @param renderingGroupId The rendering group id corresponding to its index\n * @param opaqueSortCompareFn The opaque queue comparison function use to sort.\n * @param alphaTestSortCompareFn The alpha test queue comparison function use to sort.\n * @param transparentSortCompareFn The transparent queue comparison function use to sort.\n */\n setRenderingOrder(renderingGroupId, opaqueSortCompareFn = null, alphaTestSortCompareFn = null, transparentSortCompareFn = null) {\n this._renderingManager.setRenderingOrder(renderingGroupId, opaqueSortCompareFn, alphaTestSortCompareFn, transparentSortCompareFn);\n }\n /**\n * Specifies whether or not the stencil and depth buffer are cleared between two rendering groups.\n *\n * @param renderingGroupId The rendering group id corresponding to its index\n * @param autoClearDepthStencil Automatically clears depth and stencil between groups if true.\n */\n setRenderingAutoClearDepthStencil(renderingGroupId, autoClearDepthStencil) {\n this._renderingManager.setRenderingAutoClearDepthStencil(renderingGroupId, autoClearDepthStencil);\n this._renderingManager._useSceneAutoClearSetup = false;\n }\n /**\n * Clones the texture.\n * @returns the cloned texture\n */\n clone() {\n const textureSize = this.getSize();\n const newTexture = new RenderTargetTexture(this.name, textureSize, this.getScene(), this._renderTargetOptions.generateMipMaps, this._doNotChangeAspectRatio, this._renderTargetOptions.type, this.isCube, this._renderTargetOptions.samplingMode, this._renderTargetOptions.generateDepthBuffer, this._renderTargetOptions.generateStencilBuffer, undefined, this._renderTargetOptions.format, undefined, this._renderTargetOptions.samples);\n // Base texture\n newTexture.hasAlpha = this.hasAlpha;\n newTexture.level = this.level;\n // RenderTarget Texture\n newTexture.coordinatesMode = this.coordinatesMode;\n if (this.renderList) {\n newTexture.renderList = this.renderList.slice(0);\n }\n return newTexture;\n }\n /**\n * Serialize the texture to a JSON representation we can easily use in the respective Parse function.\n * @returns The JSON representation of the texture\n */\n serialize() {\n if (!this.name) {\n return null;\n }\n const serializationObject = super.serialize();\n serializationObject.renderTargetSize = this.getRenderSize();\n serializationObject.renderList = [];\n if (this.renderList) {\n for (let index = 0; index < this.renderList.length; index++) {\n serializationObject.renderList.push(this.renderList[index].id);\n }\n }\n return serializationObject;\n }\n /**\n * This will remove the attached framebuffer objects. The texture will not be able to be used as render target anymore\n */\n disposeFramebufferObjects() {\n var _a;\n (_a = this._renderTarget) === null || _a === void 0 ? void 0 : _a.dispose(true);\n }\n /**\n * Release and destroy the underlying lower level texture aka internalTexture.\n */\n releaseInternalTexture() {\n var _a;\n (_a = this._renderTarget) === null || _a === void 0 ? void 0 : _a.releaseTextures();\n this._texture = null;\n }\n /**\n * Dispose the texture and release its associated resources.\n */\n dispose() {\n var _a;\n this.onResizeObservable.clear();\n this.onClearObservable.clear();\n this.onAfterRenderObservable.clear();\n this.onAfterUnbindObservable.clear();\n this.onBeforeBindObservable.clear();\n this.onBeforeRenderObservable.clear();\n if (this._postProcessManager) {\n this._postProcessManager.dispose();\n this._postProcessManager = null;\n }\n if (this._prePassRenderTarget) {\n this._prePassRenderTarget.dispose();\n }\n this._releaseRenderPassId();\n this.clearPostProcesses(true);\n if (this._resizeObserver) {\n this.getScene().getEngine().onResizeObservable.remove(this._resizeObserver);\n this._resizeObserver = null;\n }\n this.renderList = null;\n // Remove from custom render targets\n const scene = this.getScene();\n if (!scene) {\n return;\n }\n let index = scene.customRenderTargets.indexOf(this);\n if (index >= 0) {\n scene.customRenderTargets.splice(index, 1);\n }\n for (const camera of scene.cameras) {\n index = camera.customRenderTargets.indexOf(this);\n if (index >= 0) {\n camera.customRenderTargets.splice(index, 1);\n }\n }\n (_a = this._renderTarget) === null || _a === void 0 ? void 0 : _a.dispose();\n this._renderTarget = null;\n this._texture = null;\n super.dispose();\n }\n /** @internal */\n _rebuild() {\n if (this.refreshRate === RenderTargetTexture.REFRESHRATE_RENDER_ONCE) {\n this.refreshRate = RenderTargetTexture.REFRESHRATE_RENDER_ONCE;\n }\n if (this._postProcessManager) {\n this._postProcessManager._rebuild();\n }\n }\n /**\n * Clear the info related to rendering groups preventing retention point in material dispose.\n */\n freeRenderingGroups() {\n if (this._renderingManager) {\n this._renderingManager.freeRenderingGroups();\n }\n }\n /**\n * Gets the number of views the corresponding to the texture (eg. a MultiviewRenderTarget will have > 1)\n * @returns the view count\n */\n getViewCount() {\n return 1;\n }\n}\n/**\n * The texture will only be rendered once which can be useful to improve performance if everything in your render is static for instance.\n */\nRenderTargetTexture.REFRESHRATE_RENDER_ONCE = 0;\n/**\n * The texture will only be rendered rendered every frame and is recommended for dynamic contents.\n */\nRenderTargetTexture.REFRESHRATE_RENDER_ONEVERYFRAME = 1;\n/**\n * The texture will be rendered every 2 frames which could be enough if your dynamic objects are not\n * the central point of your effect and can save a lot of performances.\n */\nRenderTargetTexture.REFRESHRATE_RENDER_ONEVERYTWOFRAMES = 2;\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nTexture._CreateRenderTargetTexture = (name, renderTargetSize, scene, generateMipMaps, creationFlags) => {\n return new RenderTargetTexture(name, renderTargetSize, scene, generateMipMaps);\n};\n//# sourceMappingURL=renderTargetTexture.js.map","import { __decorate } from \"../tslib.es6.js\";\nimport { SmartArray } from \"../Misc/smartArray.js\";\nimport { Observable } from \"../Misc/observable.js\";\nimport { Vector2 } from \"../Maths/math.vector.js\";\n\nimport \"../Shaders/postprocess.vertex.js\";\nimport { Engine } from \"../Engines/engine.js\";\nimport \"../Engines/Extensions/engine.renderTarget.js\";\nimport { serialize, serializeAsColor4, SerializationHelper } from \"../Misc/decorators.js\";\nimport { GetClass, RegisterClass } from \"../Misc/typeStore.js\";\nimport { DrawWrapper } from \"../Materials/drawWrapper.js\";\nimport { ShaderLanguage } from \"../Materials/shaderLanguage.js\";\n/**\n * PostProcess can be used to apply a shader to a texture after it has been rendered\n * See https://doc.babylonjs.com/features/featuresDeepDive/postProcesses/usePostProcesses\n */\nexport class PostProcess {\n /**\n * Registers a shader code processing with a post process name.\n * @param postProcessName name of the post process. Use null for the fallback shader code processing. This is the shader code processing that will be used in case no specific shader code processing has been associated to a post process name\n * @param customShaderCodeProcessing shader code processing to associate to the post process name\n * @returns\n */\n static RegisterShaderCodeProcessing(postProcessName, customShaderCodeProcessing) {\n if (!customShaderCodeProcessing) {\n delete PostProcess._CustomShaderCodeProcessing[postProcessName !== null && postProcessName !== void 0 ? postProcessName : \"\"];\n return;\n }\n PostProcess._CustomShaderCodeProcessing[postProcessName !== null && postProcessName !== void 0 ? postProcessName : \"\"] = customShaderCodeProcessing;\n }\n static _GetShaderCodeProcessing(postProcessName) {\n var _a;\n return (_a = PostProcess._CustomShaderCodeProcessing[postProcessName]) !== null && _a !== void 0 ? _a : PostProcess._CustomShaderCodeProcessing[\"\"];\n }\n /**\n * Number of sample textures (default: 1)\n */\n get samples() {\n return this._samples;\n }\n set samples(n) {\n this._samples = Math.min(n, this._engine.getCaps().maxMSAASamples);\n this._textures.forEach((texture) => {\n texture.setSamples(this._samples);\n });\n }\n /**\n * Returns the fragment url or shader name used in the post process.\n * @returns the fragment url or name in the shader store.\n */\n getEffectName() {\n return this._fragmentUrl;\n }\n /**\n * A function that is added to the onActivateObservable\n */\n set onActivate(callback) {\n if (this._onActivateObserver) {\n this.onActivateObservable.remove(this._onActivateObserver);\n }\n if (callback) {\n this._onActivateObserver = this.onActivateObservable.add(callback);\n }\n }\n /**\n * A function that is added to the onSizeChangedObservable\n */\n set onSizeChanged(callback) {\n if (this._onSizeChangedObserver) {\n this.onSizeChangedObservable.remove(this._onSizeChangedObserver);\n }\n this._onSizeChangedObserver = this.onSizeChangedObservable.add(callback);\n }\n /**\n * A function that is added to the onApplyObservable\n */\n set onApply(callback) {\n if (this._onApplyObserver) {\n this.onApplyObservable.remove(this._onApplyObserver);\n }\n this._onApplyObserver = this.onApplyObservable.add(callback);\n }\n /**\n * A function that is added to the onBeforeRenderObservable\n */\n set onBeforeRender(callback) {\n if (this._onBeforeRenderObserver) {\n this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver);\n }\n this._onBeforeRenderObserver = this.onBeforeRenderObservable.add(callback);\n }\n /**\n * A function that is added to the onAfterRenderObservable\n */\n set onAfterRender(callback) {\n if (this._onAfterRenderObserver) {\n this.onAfterRenderObservable.remove(this._onAfterRenderObserver);\n }\n this._onAfterRenderObserver = this.onAfterRenderObservable.add(callback);\n }\n /**\n * The input texture for this post process and the output texture of the previous post process. When added to a pipeline the previous post process will\n * render it's output into this texture and this texture will be used as textureSampler in the fragment shader of this post process.\n */\n get inputTexture() {\n return this._textures.data[this._currentRenderTextureInd];\n }\n set inputTexture(value) {\n this._forcedOutputTexture = value;\n }\n /**\n * Since inputTexture should always be defined, if we previously manually set `inputTexture`,\n * the only way to unset it is to use this function to restore its internal state\n */\n restoreDefaultInputTexture() {\n if (this._forcedOutputTexture) {\n this._forcedOutputTexture = null;\n this.markTextureDirty();\n }\n }\n /**\n * Gets the camera which post process is applied to.\n * @returns The camera the post process is applied to.\n */\n getCamera() {\n return this._camera;\n }\n /**\n * Gets the texel size of the postprocess.\n * See https://en.wikipedia.org/wiki/Texel_(graphics)\n */\n get texelSize() {\n if (this._shareOutputWithPostProcess) {\n return this._shareOutputWithPostProcess.texelSize;\n }\n if (this._forcedOutputTexture) {\n this._texelSize.copyFromFloats(1.0 / this._forcedOutputTexture.width, 1.0 / this._forcedOutputTexture.height);\n }\n return this._texelSize;\n }\n /**\n * Creates a new instance PostProcess\n * @param name The name of the PostProcess.\n * @param fragmentUrl The url of the fragment shader to be used.\n * @param parameters Array of the names of uniform non-sampler2D variables that will be passed to the shader.\n * @param samplers Array of the names of uniform sampler2D variables that will be passed to the shader.\n * @param options The required width/height ratio to downsize to before computing the render pass. (Use 1.0 for full size)\n * @param camera The camera to apply the render pass to.\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\n * @param engine The engine which the post process will be applied. (default: current engine)\n * @param reusable If the post process can be reused on the same frame. (default: false)\n * @param defines String of defines that will be set when running the fragment shader. (default: null)\n * @param textureType Type of textures used when performing the post process. (default: 0)\n * @param vertexUrl The url of the vertex shader to be used. (default: \"postprocess\")\n * @param indexParameters The index parameters to be used for babylons include syntax \"#include[0..varyingCount]\". (default: undefined) See usage in babylon.blurPostProcess.ts and kernelBlur.vertex.fx\n * @param blockCompilation If the shader should not be compiled immediatly. (default: false)\n * @param textureFormat Format of textures used when performing the post process. (default: TEXTUREFORMAT_RGBA)\n */\n constructor(name, fragmentUrl, parameters, samplers, options, camera, samplingMode = 1, engine, reusable, defines = null, textureType = 0, vertexUrl = \"postprocess\", indexParameters, blockCompilation = false, textureFormat = 5, shaderLanguage = ShaderLanguage.GLSL) {\n /** @internal */\n this._parentContainer = null;\n /**\n * Width of the texture to apply the post process on\n */\n this.width = -1;\n /**\n * Height of the texture to apply the post process on\n */\n this.height = -1;\n /**\n * Gets the node material used to create this postprocess (null if the postprocess was manually created)\n */\n this.nodeMaterialSource = null;\n /**\n * Internal, reference to the location where this postprocess was output to. (Typically the texture on the next postprocess in the chain)\n * @internal\n */\n this._outputTexture = null;\n /**\n * If the buffer needs to be cleared before applying the post process. (default: true)\n * Should be set to false if shader will overwrite all previous pixels.\n */\n this.autoClear = true;\n /**\n * If clearing the buffer should be forced in autoClear mode, even when alpha mode is enabled (default: false).\n * By default, the buffer will only be cleared if alpha mode is disabled (and autoClear is true).\n */\n this.forceAutoClearInAlphaMode = false;\n /**\n * Type of alpha mode to use when performing the post process (default: Engine.ALPHA_DISABLE)\n */\n this.alphaMode = 0;\n /**\n * Animations to be used for the post processing\n */\n this.animations = new Array();\n /**\n * Enable Pixel Perfect mode where texture is not scaled to be power of 2.\n * Can only be used on a single postprocess or on the last one of a chain. (default: false)\n */\n this.enablePixelPerfectMode = false;\n /**\n * Force the postprocess to be applied without taking in account viewport\n */\n this.forceFullscreenViewport = true;\n /**\n * Scale mode for the post process (default: Engine.SCALEMODE_FLOOR)\n *\n * | Value | Type | Description |\n * | ----- | ----------------------------------- | ----------- |\n * | 1 | SCALEMODE_FLOOR | [engine.scalemode_floor](https://doc.babylonjs.com/api/classes/babylon.engine#scalemode_floor) |\n * | 2 | SCALEMODE_NEAREST | [engine.scalemode_nearest](https://doc.babylonjs.com/api/classes/babylon.engine#scalemode_nearest) |\n * | 3 | SCALEMODE_CEILING | [engine.scalemode_ceiling](https://doc.babylonjs.com/api/classes/babylon.engine#scalemode_ceiling) |\n *\n */\n this.scaleMode = 1;\n /**\n * Force textures to be a power of two (default: false)\n */\n this.alwaysForcePOT = false;\n this._samples = 1;\n /**\n * Modify the scale of the post process to be the same as the viewport (default: false)\n */\n this.adaptScaleToCurrentViewport = false;\n this._reusable = false;\n this._renderId = 0;\n /**\n * if externalTextureSamplerBinding is true, the \"apply\" method won't bind the textureSampler texture, it is expected to be done by the \"outside\" (by the onApplyObservable observer most probably).\n * counter-productive in some cases because if the texture bound by \"apply\" is different from the currently texture bound, (the one set by the onApplyObservable observer, for eg) some\n * internal structures (materialContext) will be dirtified, which may impact performances\n */\n this.externalTextureSamplerBinding = false;\n /**\n * Smart array of input and output textures for the post process.\n * @internal\n */\n this._textures = new SmartArray(2);\n /**\n * Smart array of input and output textures for the post process.\n * @internal\n */\n this._textureCache = [];\n /**\n * The index in _textures that corresponds to the output texture.\n * @internal\n */\n this._currentRenderTextureInd = 0;\n this._scaleRatio = new Vector2(1, 1);\n this._texelSize = Vector2.Zero();\n // Events\n /**\n * An event triggered when the postprocess is activated.\n */\n this.onActivateObservable = new Observable();\n /**\n * An event triggered when the postprocess changes its size.\n */\n this.onSizeChangedObservable = new Observable();\n /**\n * An event triggered when the postprocess applies its effect.\n */\n this.onApplyObservable = new Observable();\n /**\n * An event triggered before rendering the postprocess\n */\n this.onBeforeRenderObservable = new Observable();\n /**\n * An event triggered after rendering the postprocess\n */\n this.onAfterRenderObservable = new Observable();\n this.name = name;\n if (camera != null) {\n this._camera = camera;\n this._scene = camera.getScene();\n camera.attachPostProcess(this);\n this._engine = this._scene.getEngine();\n this._scene.postProcesses.push(this);\n this.uniqueId = this._scene.getUniqueId();\n }\n else if (engine) {\n this._engine = engine;\n this._engine.postProcesses.push(this);\n }\n this._options = options;\n this.renderTargetSamplingMode = samplingMode ? samplingMode : 1;\n this._reusable = reusable || false;\n this._textureType = textureType;\n this._textureFormat = textureFormat;\n this._shaderLanguage = shaderLanguage;\n this._samplers = samplers || [];\n this._samplers.push(\"textureSampler\");\n this._fragmentUrl = fragmentUrl;\n this._vertexUrl = vertexUrl;\n this._parameters = parameters || [];\n this._parameters.push(\"scale\");\n this._indexParameters = indexParameters;\n this._drawWrapper = new DrawWrapper(this._engine);\n if (!blockCompilation) {\n this.updateEffect(defines);\n }\n }\n /**\n * Gets a string identifying the name of the class\n * @returns \"PostProcess\" string\n */\n getClassName() {\n return \"PostProcess\";\n }\n /**\n * Gets the engine which this post process belongs to.\n * @returns The engine the post process was enabled with.\n */\n getEngine() {\n return this._engine;\n }\n /**\n * The effect that is created when initializing the post process.\n * @returns The created effect corresponding the the postprocess.\n */\n getEffect() {\n return this._drawWrapper.effect;\n }\n /**\n * To avoid multiple redundant textures for multiple post process, the output the output texture for this post process can be shared with another.\n * @param postProcess The post process to share the output with.\n * @returns This post process.\n */\n shareOutputWith(postProcess) {\n this._disposeTextures();\n this._shareOutputWithPostProcess = postProcess;\n return this;\n }\n /**\n * Reverses the effect of calling shareOutputWith and returns the post process back to its original state.\n * This should be called if the post process that shares output with this post process is disabled/disposed.\n */\n useOwnOutput() {\n if (this._textures.length == 0) {\n this._textures = new SmartArray(2);\n }\n this._shareOutputWithPostProcess = null;\n }\n /**\n * Updates the effect with the current post process compile time values and recompiles the shader.\n * @param defines Define statements that should be added at the beginning of the shader. (default: null)\n * @param uniforms Set of uniform variables that will be passed to the shader. (default: null)\n * @param samplers Set of Texture2D variables that will be passed to the shader. (default: null)\n * @param indexParameters The index parameters to be used for babylons include syntax \"#include[0..varyingCount]\". (default: undefined) See usage in babylon.blurPostProcess.ts and kernelBlur.vertex.fx\n * @param onCompiled Called when the shader has been compiled.\n * @param onError Called if there is an error when compiling a shader.\n * @param vertexUrl The url of the vertex shader to be used (default: the one given at construction time)\n * @param fragmentUrl The url of the fragment shader to be used (default: the one given at construction time)\n */\n updateEffect(defines = null, uniforms = null, samplers = null, indexParameters, onCompiled, onError, vertexUrl, fragmentUrl) {\n var _a, _b;\n const customShaderCodeProcessing = PostProcess._GetShaderCodeProcessing(this.name);\n if (customShaderCodeProcessing === null || customShaderCodeProcessing === void 0 ? void 0 : customShaderCodeProcessing.defineCustomBindings) {\n const newUniforms = (_a = uniforms === null || uniforms === void 0 ? void 0 : uniforms.slice()) !== null && _a !== void 0 ? _a : [];\n newUniforms.push(...this._parameters);\n const newSamplers = (_b = samplers === null || samplers === void 0 ? void 0 : samplers.slice()) !== null && _b !== void 0 ? _b : [];\n newSamplers.push(...this._samplers);\n defines = customShaderCodeProcessing.defineCustomBindings(this.name, defines, newUniforms, newSamplers);\n uniforms = newUniforms;\n samplers = newSamplers;\n }\n this._postProcessDefines = defines;\n this._drawWrapper.effect = this._engine.createEffect({ vertex: vertexUrl !== null && vertexUrl !== void 0 ? vertexUrl : this._vertexUrl, fragment: fragmentUrl !== null && fragmentUrl !== void 0 ? fragmentUrl : this._fragmentUrl }, {\n attributes: [\"position\"],\n uniformsNames: uniforms || this._parameters,\n uniformBuffersNames: [],\n samplers: samplers || this._samplers,\n defines: defines !== null ? defines : \"\",\n fallbacks: null,\n onCompiled: onCompiled !== null && onCompiled !== void 0 ? onCompiled : null,\n onError: onError !== null && onError !== void 0 ? onError : null,\n indexParameters: indexParameters || this._indexParameters,\n processCodeAfterIncludes: (customShaderCodeProcessing === null || customShaderCodeProcessing === void 0 ? void 0 : customShaderCodeProcessing.processCodeAfterIncludes)\n ? (shaderType, code) => customShaderCodeProcessing.processCodeAfterIncludes(this.name, shaderType, code)\n : null,\n processFinalCode: (customShaderCodeProcessing === null || customShaderCodeProcessing === void 0 ? void 0 : customShaderCodeProcessing.processFinalCode)\n ? (shaderType, code) => customShaderCodeProcessing.processFinalCode(this.name, shaderType, code)\n : null,\n shaderLanguage: this._shaderLanguage,\n }, this._engine);\n }\n /**\n * The post process is reusable if it can be used multiple times within one frame.\n * @returns If the post process is reusable\n */\n isReusable() {\n return this._reusable;\n }\n /** invalidate frameBuffer to hint the postprocess to create a depth buffer */\n markTextureDirty() {\n this.width = -1;\n }\n _createRenderTargetTexture(textureSize, textureOptions, channel = 0) {\n for (let i = 0; i < this._textureCache.length; i++) {\n if (this._textureCache[i].texture.width === textureSize.width &&\n this._textureCache[i].texture.height === textureSize.height &&\n this._textureCache[i].postProcessChannel === channel &&\n this._textureCache[i].texture._generateDepthBuffer === textureOptions.generateDepthBuffer &&\n this._textureCache[i].texture.samples === textureOptions.samples) {\n return this._textureCache[i].texture;\n }\n }\n const tex = this._engine.createRenderTargetTexture(textureSize, textureOptions);\n this._textureCache.push({ texture: tex, postProcessChannel: channel, lastUsedRenderId: -1 });\n return tex;\n }\n _flushTextureCache() {\n const currentRenderId = this._renderId;\n for (let i = this._textureCache.length - 1; i >= 0; i--) {\n if (currentRenderId - this._textureCache[i].lastUsedRenderId > 100) {\n let currentlyUsed = false;\n for (let j = 0; j < this._textures.length; j++) {\n if (this._textures.data[j] === this._textureCache[i].texture) {\n currentlyUsed = true;\n break;\n }\n }\n if (!currentlyUsed) {\n this._textureCache[i].texture.dispose();\n this._textureCache.splice(i, 1);\n }\n }\n }\n }\n _resize(width, height, camera, needMipMaps, forceDepthStencil) {\n if (this._textures.length > 0) {\n this._textures.reset();\n }\n this.width = width;\n this.height = height;\n let firstPP = null;\n for (let i = 0; i < camera._postProcesses.length; i++) {\n if (camera._postProcesses[i] !== null) {\n firstPP = camera._postProcesses[i];\n break;\n }\n }\n const textureSize = { width: this.width, height: this.height };\n const textureOptions = {\n generateMipMaps: needMipMaps,\n generateDepthBuffer: forceDepthStencil || firstPP === this,\n generateStencilBuffer: (forceDepthStencil || firstPP === this) && this._engine.isStencilEnable,\n samplingMode: this.renderTargetSamplingMode,\n type: this._textureType,\n format: this._textureFormat,\n samples: this._samples,\n label: \"PostProcessRTT-\" + this.name,\n };\n this._textures.push(this._createRenderTargetTexture(textureSize, textureOptions, 0));\n if (this._reusable) {\n this._textures.push(this._createRenderTargetTexture(textureSize, textureOptions, 1));\n }\n this._texelSize.copyFromFloats(1.0 / this.width, 1.0 / this.height);\n this.onSizeChangedObservable.notifyObservers(this);\n }\n /**\n * Activates the post process by intializing the textures to be used when executed. Notifies onActivateObservable.\n * When this post process is used in a pipeline, this is call will bind the input texture of this post process to the output of the previous.\n * @param camera The camera that will be used in the post process. This camera will be used when calling onActivateObservable.\n * @param sourceTexture The source texture to be inspected to get the width and height if not specified in the post process constructor. (default: null)\n * @param forceDepthStencil If true, a depth and stencil buffer will be generated. (default: false)\n * @returns The render target wrapper that was bound to be written to.\n */\n activate(camera, sourceTexture = null, forceDepthStencil) {\n var _a, _b;\n camera = camera || this._camera;\n const scene = camera.getScene();\n const engine = scene.getEngine();\n const maxSize = engine.getCaps().maxTextureSize;\n let requiredWidth = ((sourceTexture ? sourceTexture.width : this._engine.getRenderWidth(true)) * this._options) | 0;\n const requiredHeight = ((sourceTexture ? sourceTexture.height : this._engine.getRenderHeight(true)) * this._options) | 0;\n // If rendering to a webvr camera's left or right eye only half the width should be used to avoid resize when rendered to screen\n const webVRCamera = camera.parent;\n if (webVRCamera && (webVRCamera.leftCamera == camera || webVRCamera.rightCamera == camera)) {\n requiredWidth /= 2;\n }\n let desiredWidth = this._options.width || requiredWidth;\n let desiredHeight = this._options.height || requiredHeight;\n const needMipMaps = this.renderTargetSamplingMode !== 7 &&\n this.renderTargetSamplingMode !== 1 &&\n this.renderTargetSamplingMode !== 2;\n if (!this._shareOutputWithPostProcess && !this._forcedOutputTexture) {\n if (this.adaptScaleToCurrentViewport) {\n const currentViewport = engine.currentViewport;\n if (currentViewport) {\n desiredWidth *= currentViewport.width;\n desiredHeight *= currentViewport.height;\n }\n }\n if (needMipMaps || this.alwaysForcePOT) {\n if (!this._options.width) {\n desiredWidth = engine.needPOTTextures ? Engine.GetExponentOfTwo(desiredWidth, maxSize, this.scaleMode) : desiredWidth;\n }\n if (!this._options.height) {\n desiredHeight = engine.needPOTTextures ? Engine.GetExponentOfTwo(desiredHeight, maxSize, this.scaleMode) : desiredHeight;\n }\n }\n if (this.width !== desiredWidth || this.height !== desiredHeight) {\n this._resize(desiredWidth, desiredHeight, camera, needMipMaps, forceDepthStencil);\n }\n this._textures.forEach((texture) => {\n if (texture.samples !== this.samples) {\n this._engine.updateRenderTargetTextureSampleCount(texture, this.samples);\n }\n });\n this._flushTextureCache();\n this._renderId++;\n }\n let target;\n if (this._shareOutputWithPostProcess) {\n target = this._shareOutputWithPostProcess.inputTexture;\n }\n else if (this._forcedOutputTexture) {\n target = this._forcedOutputTexture;\n this.width = this._forcedOutputTexture.width;\n this.height = this._forcedOutputTexture.height;\n }\n else {\n target = this.inputTexture;\n let cache;\n for (let i = 0; i < this._textureCache.length; i++) {\n if (this._textureCache[i].texture === target) {\n cache = this._textureCache[i];\n break;\n }\n }\n if (cache) {\n cache.lastUsedRenderId = this._renderId;\n }\n }\n // Bind the input of this post process to be used as the output of the previous post process.\n if (this.enablePixelPerfectMode) {\n this._scaleRatio.copyFromFloats(requiredWidth / desiredWidth, requiredHeight / desiredHeight);\n this._engine.bindFramebuffer(target, 0, requiredWidth, requiredHeight, this.forceFullscreenViewport);\n }\n else {\n this._scaleRatio.copyFromFloats(1, 1);\n this._engine.bindFramebuffer(target, 0, undefined, undefined, this.forceFullscreenViewport);\n }\n (_b = (_a = this._engine)._debugInsertMarker) === null || _b === void 0 ? void 0 : _b.call(_a, `post process ${this.name} input`);\n this.onActivateObservable.notifyObservers(camera);\n // Clear\n if (this.autoClear && (this.alphaMode === 0 || this.forceAutoClearInAlphaMode)) {\n this._engine.clear(this.clearColor ? this.clearColor : scene.clearColor, scene._allowPostProcessClearColor, true, true);\n }\n if (this._reusable) {\n this._currentRenderTextureInd = (this._currentRenderTextureInd + 1) % 2;\n }\n return target;\n }\n /**\n * If the post process is supported.\n */\n get isSupported() {\n return this._drawWrapper.effect.isSupported;\n }\n /**\n * The aspect ratio of the output texture.\n */\n get aspectRatio() {\n if (this._shareOutputWithPostProcess) {\n return this._shareOutputWithPostProcess.aspectRatio;\n }\n if (this._forcedOutputTexture) {\n return this._forcedOutputTexture.width / this._forcedOutputTexture.height;\n }\n return this.width / this.height;\n }\n /**\n * Get a value indicating if the post-process is ready to be used\n * @returns true if the post-process is ready (shader is compiled)\n */\n isReady() {\n var _a, _b;\n return (_b = (_a = this._drawWrapper.effect) === null || _a === void 0 ? void 0 : _a.isReady()) !== null && _b !== void 0 ? _b : false;\n }\n /**\n * Binds all textures and uniforms to the shader, this will be run on every pass.\n * @returns the effect corresponding to this post process. Null if not compiled or not ready.\n */\n apply() {\n var _a, _b, _c;\n // Check\n if (!((_a = this._drawWrapper.effect) === null || _a === void 0 ? void 0 : _a.isReady())) {\n return null;\n }\n // States\n this._engine.enableEffect(this._drawWrapper);\n this._engine.setState(false);\n this._engine.setDepthBuffer(false);\n this._engine.setDepthWrite(false);\n // Alpha\n this._engine.setAlphaMode(this.alphaMode);\n if (this.alphaConstants) {\n this.getEngine().setAlphaConstants(this.alphaConstants.r, this.alphaConstants.g, this.alphaConstants.b, this.alphaConstants.a);\n }\n // Bind the output texture of the preivous post process as the input to this post process.\n let source;\n if (this._shareOutputWithPostProcess) {\n source = this._shareOutputWithPostProcess.inputTexture;\n }\n else if (this._forcedOutputTexture) {\n source = this._forcedOutputTexture;\n }\n else {\n source = this.inputTexture;\n }\n if (!this.externalTextureSamplerBinding) {\n this._drawWrapper.effect._bindTexture(\"textureSampler\", source === null || source === void 0 ? void 0 : source.texture);\n }\n // Parameters\n this._drawWrapper.effect.setVector2(\"scale\", this._scaleRatio);\n this.onApplyObservable.notifyObservers(this._drawWrapper.effect);\n (_c = (_b = PostProcess._GetShaderCodeProcessing(this.name)) === null || _b === void 0 ? void 0 : _b.bindCustomBindings) === null || _c === void 0 ? void 0 : _c.call(_b, this.name, this._drawWrapper.effect);\n return this._drawWrapper.effect;\n }\n _disposeTextures() {\n if (this._shareOutputWithPostProcess || this._forcedOutputTexture) {\n this._disposeTextureCache();\n return;\n }\n this._disposeTextureCache();\n this._textures.dispose();\n }\n _disposeTextureCache() {\n for (let i = this._textureCache.length - 1; i >= 0; i--) {\n this._textureCache[i].texture.dispose();\n }\n this._textureCache.length = 0;\n }\n /**\n * Sets the required values to the prepass renderer.\n * @param prePassRenderer defines the prepass renderer to setup.\n * @returns true if the pre pass is needed.\n */\n setPrePassRenderer(prePassRenderer) {\n if (this._prePassEffectConfiguration) {\n this._prePassEffectConfiguration = prePassRenderer.addEffectConfiguration(this._prePassEffectConfiguration);\n this._prePassEffectConfiguration.enabled = true;\n return true;\n }\n return false;\n }\n /**\n * Disposes the post process.\n * @param camera The camera to dispose the post process on.\n */\n dispose(camera) {\n camera = camera || this._camera;\n this._disposeTextures();\n let index;\n if (this._scene) {\n index = this._scene.postProcesses.indexOf(this);\n if (index !== -1) {\n this._scene.postProcesses.splice(index, 1);\n }\n }\n if (this._parentContainer) {\n const index = this._parentContainer.postProcesses.indexOf(this);\n if (index > -1) {\n this._parentContainer.postProcesses.splice(index, 1);\n }\n this._parentContainer = null;\n }\n index = this._engine.postProcesses.indexOf(this);\n if (index !== -1) {\n this._engine.postProcesses.splice(index, 1);\n }\n if (!camera) {\n return;\n }\n camera.detachPostProcess(this);\n index = camera._postProcesses.indexOf(this);\n if (index === 0 && camera._postProcesses.length > 0) {\n const firstPostProcess = this._camera._getFirstPostProcess();\n if (firstPostProcess) {\n firstPostProcess.markTextureDirty();\n }\n }\n this.onActivateObservable.clear();\n this.onAfterRenderObservable.clear();\n this.onApplyObservable.clear();\n this.onBeforeRenderObservable.clear();\n this.onSizeChangedObservable.clear();\n }\n /**\n * Serializes the post process to a JSON object\n * @returns the JSON object\n */\n serialize() {\n const serializationObject = SerializationHelper.Serialize(this);\n const camera = this.getCamera() || (this._scene && this._scene.activeCamera);\n serializationObject.customType = \"BABYLON.\" + this.getClassName();\n serializationObject.cameraId = camera ? camera.id : null;\n serializationObject.reusable = this._reusable;\n serializationObject.textureType = this._textureType;\n serializationObject.fragmentUrl = this._fragmentUrl;\n serializationObject.parameters = this._parameters;\n serializationObject.samplers = this._samplers;\n serializationObject.options = this._options;\n serializationObject.defines = this._postProcessDefines;\n serializationObject.textureFormat = this._textureFormat;\n serializationObject.vertexUrl = this._vertexUrl;\n serializationObject.indexParameters = this._indexParameters;\n return serializationObject;\n }\n /**\n * Clones this post process\n * @returns a new post process similar to this one\n */\n clone() {\n const serializationObject = this.serialize();\n serializationObject._engine = this._engine;\n serializationObject.cameraId = null;\n const result = PostProcess.Parse(serializationObject, this._scene, \"\");\n if (!result) {\n return null;\n }\n result.onActivateObservable = this.onActivateObservable.clone();\n result.onSizeChangedObservable = this.onSizeChangedObservable.clone();\n result.onApplyObservable = this.onApplyObservable.clone();\n result.onBeforeRenderObservable = this.onBeforeRenderObservable.clone();\n result.onAfterRenderObservable = this.onAfterRenderObservable.clone();\n result._prePassEffectConfiguration = this._prePassEffectConfiguration;\n return result;\n }\n /**\n * Creates a material from parsed material data\n * @param parsedPostProcess defines parsed post process data\n * @param scene defines the hosting scene\n * @param rootUrl defines the root URL to use to load textures\n * @returns a new post process\n */\n static Parse(parsedPostProcess, scene, rootUrl) {\n const postProcessType = GetClass(parsedPostProcess.customType);\n if (!postProcessType || !postProcessType._Parse) {\n return null;\n }\n const camera = scene ? scene.getCameraById(parsedPostProcess.cameraId) : null;\n return postProcessType._Parse(parsedPostProcess, camera, scene, rootUrl);\n }\n /**\n * @internal\n */\n static _Parse(parsedPostProcess, targetCamera, scene, rootUrl) {\n return SerializationHelper.Parse(() => {\n return new PostProcess(parsedPostProcess.name, parsedPostProcess.fragmentUrl, parsedPostProcess.parameters, parsedPostProcess.samplers, parsedPostProcess.options, targetCamera, parsedPostProcess.renderTargetSamplingMode, parsedPostProcess._engine, parsedPostProcess.reusable, parsedPostProcess.defines, parsedPostProcess.textureType, parsedPostProcess.vertexUrl, parsedPostProcess.indexParameters, false, parsedPostProcess.textureFormat);\n }, parsedPostProcess, scene, rootUrl);\n }\n}\nPostProcess._CustomShaderCodeProcessing = {};\n__decorate([\n serialize()\n], PostProcess.prototype, \"uniqueId\", void 0);\n__decorate([\n serialize()\n], PostProcess.prototype, \"name\", void 0);\n__decorate([\n serialize()\n], PostProcess.prototype, \"width\", void 0);\n__decorate([\n serialize()\n], PostProcess.prototype, \"height\", void 0);\n__decorate([\n serialize()\n], PostProcess.prototype, \"renderTargetSamplingMode\", void 0);\n__decorate([\n serializeAsColor4()\n], PostProcess.prototype, \"clearColor\", void 0);\n__decorate([\n serialize()\n], PostProcess.prototype, \"autoClear\", void 0);\n__decorate([\n serialize()\n], PostProcess.prototype, \"forceAutoClearInAlphaMode\", void 0);\n__decorate([\n serialize()\n], PostProcess.prototype, \"alphaMode\", void 0);\n__decorate([\n serialize()\n], PostProcess.prototype, \"alphaConstants\", void 0);\n__decorate([\n serialize()\n], PostProcess.prototype, \"enablePixelPerfectMode\", void 0);\n__decorate([\n serialize()\n], PostProcess.prototype, \"forceFullscreenViewport\", void 0);\n__decorate([\n serialize()\n], PostProcess.prototype, \"scaleMode\", void 0);\n__decorate([\n serialize()\n], PostProcess.prototype, \"alwaysForcePOT\", void 0);\n__decorate([\n serialize(\"samples\")\n], PostProcess.prototype, \"_samples\", void 0);\n__decorate([\n serialize()\n], PostProcess.prototype, \"adaptScaleToCurrentViewport\", void 0);\nRegisterClass(\"BABYLON.PostProcess\", PostProcess);\n//# sourceMappingURL=postProcess.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"kernelBlurVaryingDeclaration\";\nconst shader = `varying vec2 sampleCoord{X};`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const kernelBlurVaryingDeclaration = { name, shader };\n//# sourceMappingURL=kernelBlurVaryingDeclaration.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"packingFunctions\";\nconst shader = `vec4 pack(float depth)\n{const vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);const vec4 bit_mask=vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;}\nfloat unpack(vec4 color)\n{const vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(color,bit_shift);}`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const packingFunctions = { name, shader };\n//# sourceMappingURL=packingFunctions.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"kernelBlurFragment\";\nconst shader = `#ifdef DOF\nfactor=sampleCoC(sampleCoord{X}); \ncomputedWeight=KERNEL_WEIGHT{X}*factor;sumOfWeights+=computedWeight;\n#else\ncomputedWeight=KERNEL_WEIGHT{X};\n#endif\n#ifdef PACKEDFLOAT\nblend+=unpack(texture2D(textureSampler,sampleCoord{X}))*computedWeight;\n#else\nblend+=texture2D(textureSampler,sampleCoord{X})*computedWeight;\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const kernelBlurFragment = { name, shader };\n//# sourceMappingURL=kernelBlurFragment.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"kernelBlurFragment2\";\nconst shader = `#ifdef DOF\nfactor=sampleCoC(sampleCenter+delta*KERNEL_DEP_OFFSET{X});computedWeight=KERNEL_DEP_WEIGHT{X}*factor;sumOfWeights+=computedWeight;\n#else\ncomputedWeight=KERNEL_DEP_WEIGHT{X};\n#endif\n#ifdef PACKEDFLOAT\nblend+=unpack(texture2D(textureSampler,sampleCenter+delta*KERNEL_DEP_OFFSET{X}))*computedWeight;\n#else\nblend+=texture2D(textureSampler,sampleCenter+delta*KERNEL_DEP_OFFSET{X})*computedWeight;\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const kernelBlurFragment2 = { name, shader };\n//# sourceMappingURL=kernelBlurFragment2.js.map","// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore.js\";\nimport \"./ShadersInclude/kernelBlurVaryingDeclaration.js\";\nimport \"./ShadersInclude/packingFunctions.js\";\nimport \"./ShadersInclude/kernelBlurFragment.js\";\nimport \"./ShadersInclude/kernelBlurFragment2.js\";\nconst name = \"kernelBlurPixelShader\";\nconst shader = `uniform sampler2D textureSampler;uniform vec2 delta;varying vec2 sampleCenter;\n#ifdef DOF\nuniform sampler2D circleOfConfusionSampler;float sampleCoC(in vec2 offset) {float coc=texture2D(circleOfConfusionSampler,offset).r;return coc; }\n#endif\n#include[0..varyingCount]\n#ifdef PACKEDFLOAT\n#include\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{float computedWeight=0.0;\n#ifdef PACKEDFLOAT\nfloat blend=0.;\n#else\nvec4 blend=vec4(0.);\n#endif\n#ifdef DOF\nfloat sumOfWeights=CENTER_WEIGHT; \nfloat factor=0.0;\n#ifdef PACKEDFLOAT\nblend+=unpack(texture2D(textureSampler,sampleCenter))*CENTER_WEIGHT;\n#else\nblend+=texture2D(textureSampler,sampleCenter)*CENTER_WEIGHT;\n#endif\n#endif\n#include[0..varyingCount]\n#include[0..depCount]\n#ifdef PACKEDFLOAT\ngl_FragColor=pack(blend);\n#else\ngl_FragColor=blend;\n#endif\n#ifdef DOF\ngl_FragColor/=sumOfWeights;\n#endif\n}`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @internal */\nexport const kernelBlurPixelShader = { name, shader };\n//# sourceMappingURL=kernelBlur.fragment.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"kernelBlurVertex\";\nconst shader = `sampleCoord{X}=sampleCenter+delta*KERNEL_OFFSET{X};`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const kernelBlurVertex = { name, shader };\n//# sourceMappingURL=kernelBlurVertex.js.map","// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore.js\";\nimport \"./ShadersInclude/kernelBlurVaryingDeclaration.js\";\nimport \"./ShadersInclude/kernelBlurVertex.js\";\nconst name = \"kernelBlurVertexShader\";\nconst shader = `attribute vec2 position;uniform vec2 delta;varying vec2 sampleCenter;\n#include[0..varyingCount]\nconst vec2 madd=vec2(0.5,0.5);\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nsampleCenter=(position*madd+madd);\n#include[0..varyingCount]\ngl_Position=vec4(position,0.0,1.0);\n#define CUSTOM_VERTEX_MAIN_END\n}`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @internal */\nexport const kernelBlurVertexShader = { name, shader };\n//# sourceMappingURL=kernelBlur.vertex.js.map","import { __decorate } from \"../tslib.es6.js\";\nimport { PostProcess } from \"./postProcess.js\";\nimport { Texture } from \"../Materials/Textures/texture.js\";\n\nimport \"../Shaders/kernelBlur.fragment.js\";\nimport \"../Shaders/kernelBlur.vertex.js\";\nimport { RegisterClass } from \"../Misc/typeStore.js\";\nimport { serialize, serializeAsVector2, SerializationHelper } from \"../Misc/decorators.js\";\n/**\n * The Blur Post Process which blurs an image based on a kernel and direction.\n * Can be used twice in x and y directions to perform a gaussian blur in two passes.\n */\nexport class BlurPostProcess extends PostProcess {\n /**\n * Sets the length in pixels of the blur sample region\n */\n set kernel(v) {\n if (this._idealKernel === v) {\n return;\n }\n v = Math.max(v, 1);\n this._idealKernel = v;\n this._kernel = this._nearestBestKernel(v);\n if (!this._blockCompilation) {\n this._updateParameters();\n }\n }\n /**\n * Gets the length in pixels of the blur sample region\n */\n get kernel() {\n return this._idealKernel;\n }\n /**\n * Sets whether or not the blur needs to unpack/repack floats\n */\n set packedFloat(v) {\n if (this._packedFloat === v) {\n return;\n }\n this._packedFloat = v;\n if (!this._blockCompilation) {\n this._updateParameters();\n }\n }\n /**\n * Gets whether or not the blur is unpacking/repacking floats\n */\n get packedFloat() {\n return this._packedFloat;\n }\n /**\n * Gets a string identifying the name of the class\n * @returns \"BlurPostProcess\" string\n */\n getClassName() {\n return \"BlurPostProcess\";\n }\n /**\n * Creates a new instance BlurPostProcess\n * @param name The name of the effect.\n * @param direction The direction in which to blur the image.\n * @param kernel The size of the kernel to be used when computing the blur. eg. Size of 3 will blur the center pixel by 2 pixels surrounding it.\n * @param options The required width/height ratio to downsize to before computing the render pass. (Use 1.0 for full size)\n * @param camera The camera to apply the render pass to.\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\n * @param engine The engine which the post process will be applied. (default: current engine)\n * @param reusable If the post process can be reused on the same frame. (default: false)\n * @param textureType Type of textures used when performing the post process. (default: 0)\n * @param defines\n * @param _blockCompilation If compilation of the shader should not be done in the constructor. The updateEffect method can be used to compile the shader at a later time. (default: false)\n * @param textureFormat Format of textures used when performing the post process. (default: TEXTUREFORMAT_RGBA)\n */\n constructor(name, direction, kernel, options, camera, samplingMode = Texture.BILINEAR_SAMPLINGMODE, engine, reusable, textureType = 0, defines = \"\", _blockCompilation = false, textureFormat = 5) {\n super(name, \"kernelBlur\", [\"delta\", \"direction\"], [\"circleOfConfusionSampler\"], options, camera, samplingMode, engine, reusable, null, textureType, \"kernelBlur\", { varyingCount: 0, depCount: 0 }, true, textureFormat);\n this._blockCompilation = _blockCompilation;\n this._packedFloat = false;\n this._staticDefines = \"\";\n this._staticDefines = defines;\n this.direction = direction;\n this.onApplyObservable.add((effect) => {\n if (this._outputTexture) {\n effect.setFloat2(\"delta\", (1 / this._outputTexture.width) * this.direction.x, (1 / this._outputTexture.height) * this.direction.y);\n }\n else {\n effect.setFloat2(\"delta\", (1 / this.width) * this.direction.x, (1 / this.height) * this.direction.y);\n }\n });\n this.kernel = kernel;\n }\n /**\n * Updates the effect with the current post process compile time values and recompiles the shader.\n * @param defines Define statements that should be added at the beginning of the shader. (default: null)\n * @param uniforms Set of uniform variables that will be passed to the shader. (default: null)\n * @param samplers Set of Texture2D variables that will be passed to the shader. (default: null)\n * @param indexParameters The index parameters to be used for babylons include syntax \"#include[0..varyingCount]\". (default: undefined) See usage in babylon.blurPostProcess.ts and kernelBlur.vertex.fx\n * @param onCompiled Called when the shader has been compiled.\n * @param onError Called if there is an error when compiling a shader.\n */\n updateEffect(defines = null, uniforms = null, samplers = null, indexParameters, onCompiled, onError) {\n this._updateParameters(onCompiled, onError);\n }\n _updateParameters(onCompiled, onError) {\n // Generate sampling offsets and weights\n const N = this._kernel;\n const centerIndex = (N - 1) / 2;\n // Generate Gaussian sampling weights over kernel\n let offsets = [];\n let weights = [];\n let totalWeight = 0;\n for (let i = 0; i < N; i++) {\n const u = i / (N - 1);\n const w = this._gaussianWeight(u * 2.0 - 1);\n offsets[i] = i - centerIndex;\n weights[i] = w;\n totalWeight += w;\n }\n // Normalize weights\n for (let i = 0; i < weights.length; i++) {\n weights[i] /= totalWeight;\n }\n // Optimize: combine samples to take advantage of hardware linear sampling\n // Walk from left to center, combining pairs (symmetrically)\n const linearSamplingWeights = [];\n const linearSamplingOffsets = [];\n const linearSamplingMap = [];\n for (let i = 0; i <= centerIndex; i += 2) {\n const j = Math.min(i + 1, Math.floor(centerIndex));\n const singleCenterSample = i === j;\n if (singleCenterSample) {\n linearSamplingMap.push({ o: offsets[i], w: weights[i] });\n }\n else {\n const sharedCell = j === centerIndex;\n const weightLinear = weights[i] + weights[j] * (sharedCell ? 0.5 : 1);\n const offsetLinear = offsets[i] + 1 / (1 + weights[i] / weights[j]);\n if (offsetLinear === 0) {\n linearSamplingMap.push({ o: offsets[i], w: weights[i] });\n linearSamplingMap.push({ o: offsets[i + 1], w: weights[i + 1] });\n }\n else {\n linearSamplingMap.push({ o: offsetLinear, w: weightLinear });\n linearSamplingMap.push({ o: -offsetLinear, w: weightLinear });\n }\n }\n }\n for (let i = 0; i < linearSamplingMap.length; i++) {\n linearSamplingOffsets[i] = linearSamplingMap[i].o;\n linearSamplingWeights[i] = linearSamplingMap[i].w;\n }\n // Replace with optimized\n offsets = linearSamplingOffsets;\n weights = linearSamplingWeights;\n // Generate shaders\n const maxVaryingRows = this.getEngine().getCaps().maxVaryingVectors;\n const freeVaryingVec2 = Math.max(maxVaryingRows, 0) - 1; // Because of sampleCenter\n let varyingCount = Math.min(offsets.length, freeVaryingVec2);\n let defines = \"\";\n defines += this._staticDefines;\n // The DOF fragment should ignore the center pixel when looping as it is handled manually in the fragment shader.\n if (this._staticDefines.indexOf(\"DOF\") != -1) {\n defines += `#define CENTER_WEIGHT ${this._glslFloat(weights[varyingCount - 1])}\\n`;\n varyingCount--;\n }\n for (let i = 0; i < varyingCount; i++) {\n defines += `#define KERNEL_OFFSET${i} ${this._glslFloat(offsets[i])}\\n`;\n defines += `#define KERNEL_WEIGHT${i} ${this._glslFloat(weights[i])}\\n`;\n }\n let depCount = 0;\n for (let i = freeVaryingVec2; i < offsets.length; i++) {\n defines += `#define KERNEL_DEP_OFFSET${depCount} ${this._glslFloat(offsets[i])}\\n`;\n defines += `#define KERNEL_DEP_WEIGHT${depCount} ${this._glslFloat(weights[i])}\\n`;\n depCount++;\n }\n if (this.packedFloat) {\n defines += `#define PACKEDFLOAT 1`;\n }\n this._blockCompilation = false;\n super.updateEffect(defines, null, null, {\n varyingCount: varyingCount,\n depCount: depCount,\n }, onCompiled, onError);\n }\n /**\n * Best kernels are odd numbers that when divided by 2, their integer part is even, so 5, 9 or 13.\n * Other odd kernels optimize correctly but require proportionally more samples, even kernels are\n * possible but will produce minor visual artifacts. Since each new kernel requires a new shader we\n * want to minimize kernel changes, having gaps between physical kernels is helpful in that regard.\n * The gaps between physical kernels are compensated for in the weighting of the samples\n * @param idealKernel Ideal blur kernel.\n * @returns Nearest best kernel.\n */\n _nearestBestKernel(idealKernel) {\n const v = Math.round(idealKernel);\n for (const k of [v, v - 1, v + 1, v - 2, v + 2]) {\n if (k % 2 !== 0 && Math.floor(k / 2) % 2 === 0 && k > 0) {\n return Math.max(k, 3);\n }\n }\n return Math.max(v, 3);\n }\n /**\n * Calculates the value of a Gaussian distribution with sigma 3 at a given point.\n * @param x The point on the Gaussian distribution to sample.\n * @returns the value of the Gaussian function at x.\n */\n _gaussianWeight(x) {\n //reference: Engines/ImageProcessingBlur.cpp #dcc760\n // We are evaluating the Gaussian (normal) distribution over a kernel parameter space of [-1,1],\n // so we truncate at three standard deviations by setting stddev (sigma) to 1/3.\n // The choice of 3-sigma truncation is common but arbitrary, and means that the signal is\n // truncated at around 1.3% of peak strength.\n //the distribution is scaled to account for the difference between the actual kernel size and the requested kernel size\n const sigma = 1 / 3;\n const denominator = Math.sqrt(2.0 * Math.PI) * sigma;\n const exponent = -((x * x) / (2.0 * sigma * sigma));\n const weight = (1.0 / denominator) * Math.exp(exponent);\n return weight;\n }\n /**\n * Generates a string that can be used as a floating point number in GLSL.\n * @param x Value to print.\n * @param decimalFigures Number of decimal places to print the number to (excluding trailing 0s).\n * @returns GLSL float string.\n */\n _glslFloat(x, decimalFigures = 8) {\n return x.toFixed(decimalFigures).replace(/0+$/, \"\");\n }\n /**\n * @internal\n */\n static _Parse(parsedPostProcess, targetCamera, scene, rootUrl) {\n return SerializationHelper.Parse(() => {\n return new BlurPostProcess(parsedPostProcess.name, parsedPostProcess.direction, parsedPostProcess.kernel, parsedPostProcess.options, targetCamera, parsedPostProcess.renderTargetSamplingMode, scene.getEngine(), parsedPostProcess.reusable, parsedPostProcess.textureType, undefined, false);\n }, parsedPostProcess, scene, rootUrl);\n }\n}\n__decorate([\n serialize(\"kernel\")\n], BlurPostProcess.prototype, \"_kernel\", void 0);\n__decorate([\n serialize(\"packedFloat\")\n], BlurPostProcess.prototype, \"_packedFloat\", void 0);\n__decorate([\n serializeAsVector2()\n], BlurPostProcess.prototype, \"direction\", void 0);\nRegisterClass(\"BABYLON.BlurPostProcess\", BlurPostProcess);\n//# sourceMappingURL=blurPostProcess.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"helperFunctions\";\nconst shader = `const float PI=3.1415926535897932384626433832795;const float HALF_MIN=5.96046448e-08; \nconst float LinearEncodePowerApprox=2.2;const float GammaEncodePowerApprox=1.0/LinearEncodePowerApprox;const vec3 LuminanceEncodeApprox=vec3(0.2126,0.7152,0.0722);const float Epsilon=0.0000001;\n#define saturate(x) clamp(x,0.0,1.0)\n#define absEps(x) abs(x)+Epsilon\n#define maxEps(x) max(x,Epsilon)\n#define saturateEps(x) clamp(x,Epsilon,1.0)\nmat3 transposeMat3(mat3 inMatrix) {vec3 i0=inMatrix[0];vec3 i1=inMatrix[1];vec3 i2=inMatrix[2];mat3 outMatrix=mat3(\nvec3(i0.x,i1.x,i2.x),\nvec3(i0.y,i1.y,i2.y),\nvec3(i0.z,i1.z,i2.z)\n);return outMatrix;}\nmat3 inverseMat3(mat3 inMatrix) {float a00=inMatrix[0][0],a01=inMatrix[0][1],a02=inMatrix[0][2];float a10=inMatrix[1][0],a11=inMatrix[1][1],a12=inMatrix[1][2];float a20=inMatrix[2][0],a21=inMatrix[2][1],a22=inMatrix[2][2];float b01=a22*a11-a12*a21;float b11=-a22*a10+a12*a20;float b21=a21*a10-a11*a20;float det=a00*b01+a01*b11+a02*b21;return mat3(b01,(-a22*a01+a02*a21),(a12*a01-a02*a11),\nb11,(a22*a00-a02*a20),(-a12*a00+a02*a10),\nb21,(-a21*a00+a01*a20),(a11*a00-a01*a10))/det;}\n#if USE_EXACT_SRGB_CONVERSIONS\nvec3 toLinearSpaceExact(vec3 color)\n{vec3 nearZeroSection=0.0773993808*color;vec3 remainingSection=pow(0.947867299*(color+vec3(0.055)),vec3(2.4));\n#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)\nreturn mix(remainingSection,nearZeroSection,lessThanEqual(color,vec3(0.04045)));\n#else\nreturn\nvec3(\ncolor.r<=0.04045 ? nearZeroSection.r : remainingSection.r,\ncolor.g<=0.04045 ? nearZeroSection.g : remainingSection.g,\ncolor.b<=0.04045 ? nearZeroSection.b : remainingSection.b);\n#endif\n}\nvec3 toGammaSpaceExact(vec3 color)\n{vec3 nearZeroSection=12.92*color;vec3 remainingSection=1.055*pow(color,vec3(0.41666))-vec3(0.055);\n#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)\nreturn mix(remainingSection,nearZeroSection,lessThanEqual(color,vec3(0.0031308)));\n#else\nreturn\nvec3(\ncolor.r<=0.0031308 ? nearZeroSection.r : remainingSection.r,\ncolor.g<=0.0031308 ? nearZeroSection.g : remainingSection.g,\ncolor.b<=0.0031308 ? nearZeroSection.b : remainingSection.b);\n#endif\n}\n#endif\nfloat toLinearSpace(float color)\n{\n#if USE_EXACT_SRGB_CONVERSIONS\nfloat nearZeroSection=0.0773993808*color;float remainingSection=pow(0.947867299*(color+0.055),2.4);return color<=0.04045 ? nearZeroSection : remainingSection;\n#else\nreturn pow(color,LinearEncodePowerApprox);\n#endif\n}\nvec3 toLinearSpace(vec3 color)\n{\n#if USE_EXACT_SRGB_CONVERSIONS\nreturn toLinearSpaceExact(color);\n#else\nreturn pow(color,vec3(LinearEncodePowerApprox));\n#endif\n}\nvec4 toLinearSpace(vec4 color)\n{\n#if USE_EXACT_SRGB_CONVERSIONS\nreturn vec4(toLinearSpaceExact(color.rgb),color.a);\n#else\nreturn vec4(pow(color.rgb,vec3(LinearEncodePowerApprox)),color.a);\n#endif\n}\nfloat toGammaSpace(float color)\n{\n#if USE_EXACT_SRGB_CONVERSIONS\nfloat nearZeroSection=12.92*color;float remainingSection=1.055*pow(color,0.41666)-0.055;return color<=0.0031308 ? nearZeroSection : remainingSection;\n#else\nreturn pow(color,GammaEncodePowerApprox);\n#endif\n}\nvec3 toGammaSpace(vec3 color)\n{\n#if USE_EXACT_SRGB_CONVERSIONS\nreturn toGammaSpaceExact(color);\n#else\nreturn pow(color,vec3(GammaEncodePowerApprox));\n#endif\n}\nvec4 toGammaSpace(vec4 color)\n{\n#if USE_EXACT_SRGB_CONVERSIONS\nreturn vec4(toGammaSpaceExact(color.rgb),color.a);\n#else\nreturn vec4(pow(color.rgb,vec3(GammaEncodePowerApprox)),color.a);\n#endif\n}\nfloat square(float value)\n{return value*value;}\nvec3 square(vec3 value)\n{return value*value;}\nfloat pow5(float value) {float sq=value*value;return sq*sq*value;}\nfloat getLuminance(vec3 color)\n{return clamp(dot(color,LuminanceEncodeApprox),0.,1.);}\nfloat getRand(vec2 seed) {return fract(sin(dot(seed.xy ,vec2(12.9898,78.233)))*43758.5453);}\nfloat dither(vec2 seed,float varianceAmount) {float rand=getRand(seed);float normVariance=varianceAmount/255.0;float dither=mix(-normVariance,normVariance,rand);return dither;}\nconst float rgbdMaxRange=255.0;vec4 toRGBD(vec3 color) {float maxRGB=maxEps(max(color.r,max(color.g,color.b)));float D =max(rgbdMaxRange/maxRGB,1.);D =clamp(floor(D)/255.0,0.,1.);vec3 rgb=color.rgb*D;rgb=toGammaSpace(rgb);return vec4(clamp(rgb,0.,1.),D); }\nvec3 fromRGBD(vec4 rgbd) {rgbd.rgb=toLinearSpace(rgbd.rgb);return rgbd.rgb/rgbd.a;}\nvec3 parallaxCorrectNormal( vec3 vertexPos,vec3 origVec,vec3 cubeSize,vec3 cubePos ) {vec3 invOrigVec=vec3(1.0,1.0,1.0)/origVec;vec3 halfSize=cubeSize*0.5;vec3 intersecAtMaxPlane=(cubePos+halfSize-vertexPos)*invOrigVec;vec3 intersecAtMinPlane=(cubePos-halfSize-vertexPos)*invOrigVec;vec3 largestIntersec=max(intersecAtMaxPlane,intersecAtMinPlane);float distance=min(min(largestIntersec.x,largestIntersec.y),largestIntersec.z);vec3 intersectPositionWS=vertexPos+origVec*distance;return intersectPositionWS-cubePos;}\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const helperFunctions = { name, shader };\n//# sourceMappingURL=helperFunctions.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"clipPlaneFragmentDeclaration\";\nconst shader = `#ifdef CLIPPLANE\nvarying float fClipDistance;\n#endif\n#ifdef CLIPPLANE2\nvarying float fClipDistance2;\n#endif\n#ifdef CLIPPLANE3\nvarying float fClipDistance3;\n#endif\n#ifdef CLIPPLANE4\nvarying float fClipDistance4;\n#endif\n#ifdef CLIPPLANE5\nvarying float fClipDistance5;\n#endif\n#ifdef CLIPPLANE6\nvarying float fClipDistance6;\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const clipPlaneFragmentDeclaration = { name, shader };\n//# sourceMappingURL=clipPlaneFragmentDeclaration.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"clipPlaneFragment\";\nconst shader = `#if defined(CLIPPLANE) || defined(CLIPPLANE2) || defined(CLIPPLANE3) || defined(CLIPPLANE4) || defined(CLIPPLANE5) || defined(CLIPPLANE6)\nif (false) {}\n#endif\n#ifdef CLIPPLANE\nelse if (fClipDistance>0.0)\n{discard;}\n#endif\n#ifdef CLIPPLANE2\nelse if (fClipDistance2>0.0)\n{discard;}\n#endif\n#ifdef CLIPPLANE3\nelse if (fClipDistance3>0.0)\n{discard;}\n#endif\n#ifdef CLIPPLANE4\nelse if (fClipDistance4>0.0)\n{discard;}\n#endif\n#ifdef CLIPPLANE5\nelse if (fClipDistance5>0.0)\n{discard;}\n#endif\n#ifdef CLIPPLANE6\nelse if (fClipDistance6>0.0)\n{discard;}\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const clipPlaneFragment = { name, shader };\n//# sourceMappingURL=clipPlaneFragment.js.map","// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore.js\";\nimport \"./ShadersInclude/helperFunctions.js\";\nimport \"./ShadersInclude/clipPlaneFragmentDeclaration.js\";\nimport \"./ShadersInclude/clipPlaneFragment.js\";\nconst name = \"glowMapGenerationPixelShader\";\nconst shader = `#if defined(DIFFUSE_ISLINEAR) || defined(EMISSIVE_ISLINEAR)\n#include\n#endif\n#ifdef DIFFUSE\nvarying vec2 vUVDiffuse;uniform sampler2D diffuseSampler;\n#endif\n#ifdef OPACITY\nvarying vec2 vUVOpacity;uniform sampler2D opacitySampler;uniform float opacityIntensity;\n#endif\n#ifdef EMISSIVE\nvarying vec2 vUVEmissive;uniform sampler2D emissiveSampler;\n#endif\n#ifdef VERTEXALPHA\nvarying vec4 vColor;\n#endif\nuniform vec4 glowColor;uniform float glowIntensity;\n#include\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{\n#include\nvec4 finalColor=glowColor;\n#ifdef DIFFUSE\nvec4 albedoTexture=texture2D(diffuseSampler,vUVDiffuse);\n#ifdef DIFFUSE_ISLINEAR\nalbedoTexture=toGammaSpace(albedoTexture);\n#endif\n#ifdef GLOW\nfinalColor.a*=albedoTexture.a;\n#endif\n#ifdef HIGHLIGHT\nfinalColor.a=albedoTexture.a;\n#endif\n#endif\n#ifdef OPACITY\nvec4 opacityMap=texture2D(opacitySampler,vUVOpacity);\n#ifdef OPACITYRGB\nfinalColor.a*=getLuminance(opacityMap.rgb);\n#else\nfinalColor.a*=opacityMap.a;\n#endif\nfinalColor.a*=opacityIntensity;\n#endif\n#ifdef VERTEXALPHA\nfinalColor.a*=vColor.a;\n#endif\n#ifdef ALPHATEST\nif (finalColor.a0\nattribute vec4 matricesIndices;attribute vec4 matricesWeights;\n#if NUM_BONE_INFLUENCERS>4\nattribute vec4 matricesIndicesExtra;attribute vec4 matricesWeightsExtra;\n#endif\n#ifndef BAKED_VERTEX_ANIMATION_TEXTURE\n#ifdef BONETEXTURE\nuniform sampler2D boneSampler;uniform float boneTextureWidth;\n#else\nuniform mat4 mBones[BonesPerMesh];\n#ifdef BONES_VELOCITY_ENABLED\nuniform mat4 mPreviousBones[BonesPerMesh];\n#endif\n#endif\n#ifdef BONETEXTURE\n#define inline\nmat4 readMatrixFromRawSampler(sampler2D smp,float index)\n{float offset=index *4.0;float dx=1.0/boneTextureWidth;vec4 m0=texture2D(smp,vec2(dx*(offset+0.5),0.));vec4 m1=texture2D(smp,vec2(dx*(offset+1.5),0.));vec4 m2=texture2D(smp,vec2(dx*(offset+2.5),0.));vec4 m3=texture2D(smp,vec2(dx*(offset+3.5),0.));return mat4(m0,m1,m2,m3);}\n#endif\n#endif\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const bonesDeclaration = { name, shader };\n//# sourceMappingURL=bonesDeclaration.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"bakedVertexAnimationDeclaration\";\nconst shader = `#ifdef BAKED_VERTEX_ANIMATION_TEXTURE\nuniform float bakedVertexAnimationTime;uniform vec2 bakedVertexAnimationTextureSizeInverted;uniform vec4 bakedVertexAnimationSettings;uniform sampler2D bakedVertexAnimationTexture;\n#ifdef INSTANCES\nattribute vec4 bakedVertexAnimationSettingsInstanced;\n#endif\n#define inline\nmat4 readMatrixFromRawSamplerVAT(sampler2D smp,float index,float frame)\n{float offset=index*4.0;float frameUV=(frame+0.5)*bakedVertexAnimationTextureSizeInverted.y;float dx=bakedVertexAnimationTextureSizeInverted.x;vec4 m0=texture2D(smp,vec2(dx*(offset+0.5),frameUV));vec4 m1=texture2D(smp,vec2(dx*(offset+1.5),frameUV));vec4 m2=texture2D(smp,vec2(dx*(offset+2.5),frameUV));vec4 m3=texture2D(smp,vec2(dx*(offset+3.5),frameUV));return mat4(m0,m1,m2,m3);}\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const bakedVertexAnimationDeclaration = { name, shader };\n//# sourceMappingURL=bakedVertexAnimationDeclaration.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"morphTargetsVertexGlobalDeclaration\";\nconst shader = `#ifdef MORPHTARGETS\nuniform float morphTargetInfluences[NUM_MORPH_INFLUENCERS];\n#ifdef MORPHTARGETS_TEXTURE \nprecision mediump sampler2DArray; \nuniform float morphTargetTextureIndices[NUM_MORPH_INFLUENCERS];uniform vec3 morphTargetTextureInfo;uniform sampler2DArray morphTargets;vec3 readVector3FromRawSampler(int targetIndex,float vertexIndex)\n{ \nfloat y=floor(vertexIndex/morphTargetTextureInfo.y);float x=vertexIndex-y*morphTargetTextureInfo.y;vec3 textureUV=vec3((x+0.5)/morphTargetTextureInfo.y,(y+0.5)/morphTargetTextureInfo.z,morphTargetTextureIndices[targetIndex]);return texture(morphTargets,textureUV).xyz;}\n#endif\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const morphTargetsVertexGlobalDeclaration = { name, shader };\n//# sourceMappingURL=morphTargetsVertexGlobalDeclaration.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"morphTargetsVertexDeclaration\";\nconst shader = `#ifdef MORPHTARGETS\n#ifndef MORPHTARGETS_TEXTURE\nattribute vec3 position{X};\n#ifdef MORPHTARGETS_NORMAL\nattribute vec3 normal{X};\n#endif\n#ifdef MORPHTARGETS_TANGENT\nattribute vec3 tangent{X};\n#endif\n#ifdef MORPHTARGETS_UV\nattribute vec2 uv_{X};\n#endif\n#endif\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const morphTargetsVertexDeclaration = { name, shader };\n//# sourceMappingURL=morphTargetsVertexDeclaration.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"clipPlaneVertexDeclaration\";\nconst shader = `#ifdef CLIPPLANE\nuniform vec4 vClipPlane;varying float fClipDistance;\n#endif\n#ifdef CLIPPLANE2\nuniform vec4 vClipPlane2;varying float fClipDistance2;\n#endif\n#ifdef CLIPPLANE3\nuniform vec4 vClipPlane3;varying float fClipDistance3;\n#endif\n#ifdef CLIPPLANE4\nuniform vec4 vClipPlane4;varying float fClipDistance4;\n#endif\n#ifdef CLIPPLANE5\nuniform vec4 vClipPlane5;varying float fClipDistance5;\n#endif\n#ifdef CLIPPLANE6\nuniform vec4 vClipPlane6;varying float fClipDistance6;\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const clipPlaneVertexDeclaration = { name, shader };\n//# sourceMappingURL=clipPlaneVertexDeclaration.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"instancesDeclaration\";\nconst shader = `#ifdef INSTANCES\nattribute vec4 world0;attribute vec4 world1;attribute vec4 world2;attribute vec4 world3;\n#ifdef INSTANCESCOLOR\nattribute vec4 instanceColor;\n#endif\n#if defined(THIN_INSTANCES) && !defined(WORLD_UBO)\nuniform mat4 world;\n#endif\n#if defined(VELOCITY) || defined(PREPASS_VELOCITY)\nattribute vec4 previousWorld0;attribute vec4 previousWorld1;attribute vec4 previousWorld2;attribute vec4 previousWorld3;\n#ifdef THIN_INSTANCES\nuniform mat4 previousWorld;\n#endif\n#endif\n#else\n#if !defined(WORLD_UBO)\nuniform mat4 world;\n#endif\n#if defined(VELOCITY) || defined(PREPASS_VELOCITY)\nuniform mat4 previousWorld;\n#endif\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const instancesDeclaration = { name, shader };\n//# sourceMappingURL=instancesDeclaration.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"morphTargetsVertexGlobal\";\nconst shader = `#ifdef MORPHTARGETS\n#ifdef MORPHTARGETS_TEXTURE\nfloat vertexID;\n#endif\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const morphTargetsVertexGlobal = { name, shader };\n//# sourceMappingURL=morphTargetsVertexGlobal.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"morphTargetsVertex\";\nconst shader = `#ifdef MORPHTARGETS\n#ifdef MORPHTARGETS_TEXTURE \nvertexID=float(gl_VertexID)*morphTargetTextureInfo.x;positionUpdated+=(readVector3FromRawSampler({X},vertexID)-position)*morphTargetInfluences[{X}];vertexID+=1.0;\n#ifdef MORPHTARGETS_NORMAL\nnormalUpdated+=(readVector3FromRawSampler({X},vertexID) -normal)*morphTargetInfluences[{X}];vertexID+=1.0;\n#endif\n#ifdef MORPHTARGETS_UV\nuvUpdated+=(readVector3FromRawSampler({X},vertexID).xy-uv)*morphTargetInfluences[{X}];vertexID+=1.0;\n#endif\n#ifdef MORPHTARGETS_TANGENT\ntangentUpdated.xyz+=(readVector3FromRawSampler({X},vertexID) -tangent.xyz)*morphTargetInfluences[{X}];\n#endif\n#else\npositionUpdated+=(position{X}-position)*morphTargetInfluences[{X}];\n#ifdef MORPHTARGETS_NORMAL\nnormalUpdated+=(normal{X}-normal)*morphTargetInfluences[{X}];\n#endif\n#ifdef MORPHTARGETS_TANGENT\ntangentUpdated.xyz+=(tangent{X}-tangent.xyz)*morphTargetInfluences[{X}];\n#endif\n#ifdef MORPHTARGETS_UV\nuvUpdated+=(uv_{X}-uv)*morphTargetInfluences[{X}];\n#endif\n#endif\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const morphTargetsVertex = { name, shader };\n//# sourceMappingURL=morphTargetsVertex.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"instancesVertex\";\nconst shader = `#ifdef INSTANCES\nmat4 finalWorld=mat4(world0,world1,world2,world3);\n#if defined(PREPASS_VELOCITY) || defined(VELOCITY)\nmat4 finalPreviousWorld=mat4(previousWorld0,previousWorld1,previousWorld2,previousWorld3);\n#endif\n#ifdef THIN_INSTANCES\nfinalWorld=world*finalWorld;\n#if defined(PREPASS_VELOCITY) || defined(VELOCITY)\nfinalPreviousWorld=previousWorld*finalPreviousWorld;\n#endif\n#endif\n#else\nmat4 finalWorld=world;\n#if defined(PREPASS_VELOCITY) || defined(VELOCITY)\nmat4 finalPreviousWorld=previousWorld;\n#endif\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const instancesVertex = { name, shader };\n//# sourceMappingURL=instancesVertex.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"bonesVertex\";\nconst shader = `#ifndef BAKED_VERTEX_ANIMATION_TEXTURE\n#if NUM_BONE_INFLUENCERS>0\nmat4 influence;\n#ifdef BONETEXTURE\ninfluence=readMatrixFromRawSampler(boneSampler,matricesIndices[0])*matricesWeights[0];\n#if NUM_BONE_INFLUENCERS>1\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndices[1])*matricesWeights[1];\n#endif\n#if NUM_BONE_INFLUENCERS>2\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndices[2])*matricesWeights[2];\n#endif\n#if NUM_BONE_INFLUENCERS>3\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndices[3])*matricesWeights[3];\n#endif\n#if NUM_BONE_INFLUENCERS>4\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[0])*matricesWeightsExtra[0];\n#endif\n#if NUM_BONE_INFLUENCERS>5\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[1])*matricesWeightsExtra[1];\n#endif\n#if NUM_BONE_INFLUENCERS>6\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[2])*matricesWeightsExtra[2];\n#endif\n#if NUM_BONE_INFLUENCERS>7\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[3])*matricesWeightsExtra[3];\n#endif\n#else\ninfluence=mBones[int(matricesIndices[0])]*matricesWeights[0];\n#if NUM_BONE_INFLUENCERS>1\ninfluence+=mBones[int(matricesIndices[1])]*matricesWeights[1];\n#endif\n#if NUM_BONE_INFLUENCERS>2\ninfluence+=mBones[int(matricesIndices[2])]*matricesWeights[2];\n#endif\n#if NUM_BONE_INFLUENCERS>3\ninfluence+=mBones[int(matricesIndices[3])]*matricesWeights[3];\n#endif\n#if NUM_BONE_INFLUENCERS>4\ninfluence+=mBones[int(matricesIndicesExtra[0])]*matricesWeightsExtra[0];\n#endif\n#if NUM_BONE_INFLUENCERS>5\ninfluence+=mBones[int(matricesIndicesExtra[1])]*matricesWeightsExtra[1];\n#endif\n#if NUM_BONE_INFLUENCERS>6\ninfluence+=mBones[int(matricesIndicesExtra[2])]*matricesWeightsExtra[2];\n#endif\n#if NUM_BONE_INFLUENCERS>7\ninfluence+=mBones[int(matricesIndicesExtra[3])]*matricesWeightsExtra[3];\n#endif\n#endif\nfinalWorld=finalWorld*influence;\n#endif\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const bonesVertex = { name, shader };\n//# sourceMappingURL=bonesVertex.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"bakedVertexAnimation\";\nconst shader = `#ifdef BAKED_VERTEX_ANIMATION_TEXTURE\n{\n#ifdef INSTANCES\n#define BVASNAME bakedVertexAnimationSettingsInstanced\n#else\n#define BVASNAME bakedVertexAnimationSettings\n#endif\nfloat VATStartFrame=BVASNAME.x;float VATEndFrame=BVASNAME.y;float VATOffsetFrame=BVASNAME.z;float VATSpeed=BVASNAME.w;float totalFrames=VATEndFrame-VATStartFrame+1.0;float time=bakedVertexAnimationTime*VATSpeed/totalFrames;float frameCorrection=time<1.0 ? 0.0 : 1.0;float numOfFrames=totalFrames-frameCorrection;float VATFrameNum=fract(time)*numOfFrames;VATFrameNum=mod(VATFrameNum+VATOffsetFrame,numOfFrames);VATFrameNum=floor(VATFrameNum);VATFrameNum+=VATStartFrame+frameCorrection;mat4 VATInfluence;VATInfluence=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndices[0],VATFrameNum)*matricesWeights[0];\n#if NUM_BONE_INFLUENCERS>1\nVATInfluence+=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndices[1],VATFrameNum)*matricesWeights[1];\n#endif\n#if NUM_BONE_INFLUENCERS>2\nVATInfluence+=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndices[2],VATFrameNum)*matricesWeights[2];\n#endif\n#if NUM_BONE_INFLUENCERS>3\nVATInfluence+=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndices[3],VATFrameNum)*matricesWeights[3];\n#endif\n#if NUM_BONE_INFLUENCERS>4\nVATInfluence+=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndicesExtra[0],VATFrameNum)*matricesWeightsExtra[0];\n#endif\n#if NUM_BONE_INFLUENCERS>5\nVATInfluence+=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndicesExtra[1],VATFrameNum)*matricesWeightsExtra[1];\n#endif\n#if NUM_BONE_INFLUENCERS>6\nVATInfluence+=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndicesExtra[2],VATFrameNum)*matricesWeightsExtra[2];\n#endif\n#if NUM_BONE_INFLUENCERS>7\nVATInfluence+=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndicesExtra[3],VATFrameNum)*matricesWeightsExtra[3];\n#endif\nfinalWorld=finalWorld*VATInfluence;}\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const bakedVertexAnimation = { name, shader };\n//# sourceMappingURL=bakedVertexAnimation.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"clipPlaneVertex\";\nconst shader = `#ifdef CLIPPLANE\nfClipDistance=dot(worldPos,vClipPlane);\n#endif\n#ifdef CLIPPLANE2\nfClipDistance2=dot(worldPos,vClipPlane2);\n#endif\n#ifdef CLIPPLANE3\nfClipDistance3=dot(worldPos,vClipPlane3);\n#endif\n#ifdef CLIPPLANE4\nfClipDistance4=dot(worldPos,vClipPlane4);\n#endif\n#ifdef CLIPPLANE5\nfClipDistance5=dot(worldPos,vClipPlane5);\n#endif\n#ifdef CLIPPLANE6\nfClipDistance6=dot(worldPos,vClipPlane6);\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const clipPlaneVertex = { name, shader };\n//# sourceMappingURL=clipPlaneVertex.js.map","// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore.js\";\nimport \"./ShadersInclude/bonesDeclaration.js\";\nimport \"./ShadersInclude/bakedVertexAnimationDeclaration.js\";\nimport \"./ShadersInclude/morphTargetsVertexGlobalDeclaration.js\";\nimport \"./ShadersInclude/morphTargetsVertexDeclaration.js\";\nimport \"./ShadersInclude/clipPlaneVertexDeclaration.js\";\nimport \"./ShadersInclude/instancesDeclaration.js\";\nimport \"./ShadersInclude/morphTargetsVertexGlobal.js\";\nimport \"./ShadersInclude/morphTargetsVertex.js\";\nimport \"./ShadersInclude/instancesVertex.js\";\nimport \"./ShadersInclude/bonesVertex.js\";\nimport \"./ShadersInclude/bakedVertexAnimation.js\";\nimport \"./ShadersInclude/clipPlaneVertex.js\";\nconst name = \"glowMapGenerationVertexShader\";\nconst shader = `attribute vec3 position;\n#include\n#include\n#include\n#include[0..maxSimultaneousMorphTargets]\n#include\n#include\nuniform mat4 viewProjection;varying vec4 vPosition;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef DIFFUSE\nvarying vec2 vUVDiffuse;uniform mat4 diffuseMatrix;\n#endif\n#ifdef OPACITY\nvarying vec2 vUVOpacity;uniform mat4 opacityMatrix;\n#endif\n#ifdef EMISSIVE\nvarying vec2 vUVEmissive;uniform mat4 emissiveMatrix;\n#endif\n#ifdef VERTEXALPHA\nattribute vec4 color;varying vec4 vColor;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void)\n{vec3 positionUpdated=position;\n#ifdef UV1\nvec2 uvUpdated=uv;\n#endif\n#include\n#include[0..maxSimultaneousMorphTargets]\n#include\n#include\n#include\nvec4 worldPos=finalWorld*vec4(positionUpdated,1.0);\n#ifdef CUBEMAP\nvPosition=worldPos;gl_Position=viewProjection*finalWorld*vec4(position,1.0);\n#else\nvPosition=viewProjection*worldPos;gl_Position=vPosition;\n#endif\n#ifdef DIFFUSE\n#ifdef DIFFUSEUV1\nvUVDiffuse=vec2(diffuseMatrix*vec4(uvUpdated,1.0,0.0));\n#endif\n#ifdef DIFFUSEUV2\nvUVDiffuse=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n#ifdef OPACITY\n#ifdef OPACITYUV1\nvUVOpacity=vec2(opacityMatrix*vec4(uvUpdated,1.0,0.0));\n#endif\n#ifdef OPACITYUV2\nvUVOpacity=vec2(opacityMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n#ifdef EMISSIVE\n#ifdef EMISSIVEUV1\nvUVEmissive=vec2(emissiveMatrix*vec4(uvUpdated,1.0,0.0));\n#endif\n#ifdef EMISSIVEUV2\nvUVEmissive=vec2(emissiveMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n#ifdef VERTEXALPHA\nvColor=color;\n#endif\n#include\n}`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @internal */\nexport const glowMapGenerationVertexShader = { name, shader };\n//# sourceMappingURL=glowMapGeneration.vertex.js.map","/**\n * EffectFallbacks can be used to add fallbacks (properties to disable) to certain properties when desired to improve performance.\n * (Eg. Start at high quality with reflection and fog, if fps is low, remove reflection, if still low remove fog)\n */\nexport class EffectFallbacks {\n constructor() {\n this._defines = {};\n this._currentRank = 32;\n this._maxRank = -1;\n this._mesh = null;\n }\n /**\n * Removes the fallback from the bound mesh.\n */\n unBindMesh() {\n this._mesh = null;\n }\n /**\n * Adds a fallback on the specified property.\n * @param rank The rank of the fallback (Lower ranks will be fallbacked to first)\n * @param define The name of the define in the shader\n */\n addFallback(rank, define) {\n if (!this._defines[rank]) {\n if (rank < this._currentRank) {\n this._currentRank = rank;\n }\n if (rank > this._maxRank) {\n this._maxRank = rank;\n }\n this._defines[rank] = new Array();\n }\n this._defines[rank].push(define);\n }\n /**\n * Sets the mesh to use CPU skinning when needing to fallback.\n * @param rank The rank of the fallback (Lower ranks will be fallbacked to first)\n * @param mesh The mesh to use the fallbacks.\n */\n addCPUSkinningFallback(rank, mesh) {\n this._mesh = mesh;\n if (rank < this._currentRank) {\n this._currentRank = rank;\n }\n if (rank > this._maxRank) {\n this._maxRank = rank;\n }\n }\n /**\n * Checks to see if more fallbacks are still available.\n */\n get hasMoreFallbacks() {\n return this._currentRank <= this._maxRank;\n }\n /**\n * Removes the defines that should be removed when falling back.\n * @param currentDefines defines the current define statements for the shader.\n * @param effect defines the current effect we try to compile\n * @returns The resulting defines with defines of the current rank removed.\n */\n reduce(currentDefines, effect) {\n // First we try to switch to CPU skinning\n if (this._mesh && this._mesh.computeBonesUsingShaders && this._mesh.numBoneInfluencers > 0) {\n this._mesh.computeBonesUsingShaders = false;\n currentDefines = currentDefines.replace(\"#define NUM_BONE_INFLUENCERS \" + this._mesh.numBoneInfluencers, \"#define NUM_BONE_INFLUENCERS 0\");\n effect._bonesComputationForcedToCPU = true;\n const scene = this._mesh.getScene();\n for (let index = 0; index < scene.meshes.length; index++) {\n const otherMesh = scene.meshes[index];\n if (!otherMesh.material) {\n if (!this._mesh.material && otherMesh.computeBonesUsingShaders && otherMesh.numBoneInfluencers > 0) {\n otherMesh.computeBonesUsingShaders = false;\n }\n continue;\n }\n if (!otherMesh.computeBonesUsingShaders || otherMesh.numBoneInfluencers === 0) {\n continue;\n }\n if (otherMesh.material.getEffect() === effect) {\n otherMesh.computeBonesUsingShaders = false;\n }\n else if (otherMesh.subMeshes) {\n for (const subMesh of otherMesh.subMeshes) {\n const subMeshEffect = subMesh.effect;\n if (subMeshEffect === effect) {\n otherMesh.computeBonesUsingShaders = false;\n break;\n }\n }\n }\n }\n }\n else {\n const currentFallbacks = this._defines[this._currentRank];\n if (currentFallbacks) {\n for (let index = 0; index < currentFallbacks.length; index++) {\n currentDefines = currentDefines.replace(\"#define \" + currentFallbacks[index], \"\");\n }\n }\n this._currentRank++;\n }\n return currentDefines;\n }\n}\n//# sourceMappingURL=effectFallbacks.js.map","import { __decorate } from \"../tslib.es6.js\";\nimport { serialize, serializeAsColor4, serializeAsCameraReference } from \"../Misc/decorators.js\";\nimport { Tools } from \"../Misc/tools.js\";\nimport { Observable } from \"../Misc/observable.js\";\nimport { Color4 } from \"../Maths/math.color.js\";\nimport { Engine } from \"../Engines/engine.js\";\nimport { EngineStore } from \"../Engines/engineStore.js\";\nimport { VertexBuffer } from \"../Buffers/buffer.js\";\nimport { Texture } from \"../Materials/Textures/texture.js\";\nimport { RenderTargetTexture } from \"../Materials/Textures/renderTargetTexture.js\";\nimport { Material } from \"../Materials/material.js\";\nimport { MaterialHelper } from \"../Materials/materialHelper.js\";\n\nimport \"../Shaders/glowMapGeneration.fragment.js\";\nimport \"../Shaders/glowMapGeneration.vertex.js\";\nimport { _WarnImport } from \"../Misc/devTools.js\";\nimport { EffectFallbacks } from \"../Materials/effectFallbacks.js\";\nimport { DrawWrapper } from \"../Materials/drawWrapper.js\";\nimport { addClipPlaneUniforms, bindClipPlane, prepareStringDefinesForClipPlanes } from \"../Materials/clipPlaneMaterialHelper.js\";\n/**\n * The effect layer Helps adding post process effect blended with the main pass.\n *\n * This can be for instance use to generate glow or highlight effects on the scene.\n *\n * The effect layer class can not be used directly and is intented to inherited from to be\n * customized per effects.\n */\nexport class EffectLayer {\n /**\n * Gets the camera attached to the layer.\n */\n get camera() {\n return this._effectLayerOptions.camera;\n }\n /**\n * Gets the rendering group id the layer should render in.\n */\n get renderingGroupId() {\n return this._effectLayerOptions.renderingGroupId;\n }\n set renderingGroupId(renderingGroupId) {\n this._effectLayerOptions.renderingGroupId = renderingGroupId;\n }\n /**\n * Gets the main texture where the effect is rendered\n */\n get mainTexture() {\n return this._mainTexture;\n }\n /**\n * Sets a specific material to be used to render a mesh/a list of meshes in the layer\n * @param mesh mesh or array of meshes\n * @param material material to use by the layer when rendering the mesh(es). If undefined is passed, the specific material created by the layer will be used.\n */\n setMaterialForRendering(mesh, material) {\n this._mainTexture.setMaterialForRendering(mesh, material);\n if (Array.isArray(mesh)) {\n for (let i = 0; i < mesh.length; ++i) {\n const currentMesh = mesh[i];\n if (!material) {\n delete this._materialForRendering[currentMesh.uniqueId];\n }\n else {\n this._materialForRendering[currentMesh.uniqueId] = [currentMesh, material];\n }\n }\n }\n else {\n if (!material) {\n delete this._materialForRendering[mesh.uniqueId];\n }\n else {\n this._materialForRendering[mesh.uniqueId] = [mesh, material];\n }\n }\n }\n /**\n * Gets the intensity of the effect for a specific mesh.\n * @param mesh The mesh to get the effect intensity for\n * @returns The intensity of the effect for the mesh\n */\n getEffectIntensity(mesh) {\n var _a;\n return (_a = this._effectIntensity[mesh.uniqueId]) !== null && _a !== void 0 ? _a : 1;\n }\n /**\n * Sets the intensity of the effect for a specific mesh.\n * @param mesh The mesh to set the effect intensity for\n * @param intensity The intensity of the effect for the mesh\n */\n setEffectIntensity(mesh, intensity) {\n this._effectIntensity[mesh.uniqueId] = intensity;\n }\n /**\n * Instantiates a new effect Layer and references it in the scene.\n * @param name The name of the layer\n * @param scene The scene to use the layer in\n */\n constructor(\n /** The Friendly of the effect in the scene */\n name, scene) {\n this._vertexBuffers = {};\n this._maxSize = 0;\n this._mainTextureDesiredSize = { width: 0, height: 0 };\n this._shouldRender = true;\n this._postProcesses = [];\n this._textures = [];\n this._emissiveTextureAndColor = { texture: null, color: new Color4() };\n this._effectIntensity = {};\n /**\n * The clear color of the texture used to generate the glow map.\n */\n this.neutralColor = new Color4();\n /**\n * Specifies whether the highlight layer is enabled or not.\n */\n this.isEnabled = true;\n /**\n * Specifies if the bounding boxes should be rendered normally or if they should undergo the effect of the layer\n */\n this.disableBoundingBoxesFromEffectLayer = false;\n /**\n * An event triggered when the effect layer has been disposed.\n */\n this.onDisposeObservable = new Observable();\n /**\n * An event triggered when the effect layer is about rendering the main texture with the glowy parts.\n */\n this.onBeforeRenderMainTextureObservable = new Observable();\n /**\n * An event triggered when the generated texture is being merged in the scene.\n */\n this.onBeforeComposeObservable = new Observable();\n /**\n * An event triggered when the mesh is rendered into the effect render target.\n */\n this.onBeforeRenderMeshToEffect = new Observable();\n /**\n * An event triggered after the mesh has been rendered into the effect render target.\n */\n this.onAfterRenderMeshToEffect = new Observable();\n /**\n * An event triggered when the generated texture has been merged in the scene.\n */\n this.onAfterComposeObservable = new Observable();\n /**\n * An event triggered when the effect layer changes its size.\n */\n this.onSizeChangedObservable = new Observable();\n this._materialForRendering = {};\n this.name = name;\n this._scene = scene || EngineStore.LastCreatedScene;\n EffectLayer._SceneComponentInitialization(this._scene);\n this._engine = this._scene.getEngine();\n this._maxSize = this._engine.getCaps().maxTextureSize;\n this._scene.effectLayers.push(this);\n this._mergeDrawWrapper = [];\n // Generate Buffers\n this._generateIndexBuffer();\n this._generateVertexBuffer();\n }\n /**\n * Number of times _internalRender will be called. Some effect layers need to render the mesh several times, so they should override this method with the number of times the mesh should be rendered\n * @returns Number of times a mesh must be rendered in the layer\n */\n _numInternalDraws() {\n return 1;\n }\n /**\n * Initializes the effect layer with the required options.\n * @param options Sets of none mandatory options to use with the layer (see IEffectLayerOptions for more information)\n */\n _init(options) {\n // Adapt options\n this._effectLayerOptions = Object.assign({ mainTextureRatio: 0.5, alphaBlendingMode: 2, camera: null, renderingGroupId: -1, mainTextureType: 0, generateStencilBuffer: false }, options);\n this._setMainTextureSize();\n this._createMainTexture();\n this._createTextureAndPostProcesses();\n }\n /**\n * Generates the index buffer of the full screen quad blending to the main canvas.\n */\n _generateIndexBuffer() {\n // Indices\n const indices = [];\n indices.push(0);\n indices.push(1);\n indices.push(2);\n indices.push(0);\n indices.push(2);\n indices.push(3);\n this._indexBuffer = this._engine.createIndexBuffer(indices);\n }\n /**\n * Generates the vertex buffer of the full screen quad blending to the main canvas.\n */\n _generateVertexBuffer() {\n // VBO\n const vertices = [];\n vertices.push(1, 1);\n vertices.push(-1, 1);\n vertices.push(-1, -1);\n vertices.push(1, -1);\n const vertexBuffer = new VertexBuffer(this._engine, vertices, VertexBuffer.PositionKind, false, false, 2);\n this._vertexBuffers[VertexBuffer.PositionKind] = vertexBuffer;\n }\n /**\n * Sets the main texture desired size which is the closest power of two\n * of the engine canvas size.\n */\n _setMainTextureSize() {\n if (this._effectLayerOptions.mainTextureFixedSize) {\n this._mainTextureDesiredSize.width = this._effectLayerOptions.mainTextureFixedSize;\n this._mainTextureDesiredSize.height = this._effectLayerOptions.mainTextureFixedSize;\n }\n else {\n this._mainTextureDesiredSize.width = this._engine.getRenderWidth() * this._effectLayerOptions.mainTextureRatio;\n this._mainTextureDesiredSize.height = this._engine.getRenderHeight() * this._effectLayerOptions.mainTextureRatio;\n this._mainTextureDesiredSize.width = this._engine.needPOTTextures\n ? Engine.GetExponentOfTwo(this._mainTextureDesiredSize.width, this._maxSize)\n : this._mainTextureDesiredSize.width;\n this._mainTextureDesiredSize.height = this._engine.needPOTTextures\n ? Engine.GetExponentOfTwo(this._mainTextureDesiredSize.height, this._maxSize)\n : this._mainTextureDesiredSize.height;\n }\n this._mainTextureDesiredSize.width = Math.floor(this._mainTextureDesiredSize.width);\n this._mainTextureDesiredSize.height = Math.floor(this._mainTextureDesiredSize.height);\n }\n /**\n * Creates the main texture for the effect layer.\n */\n _createMainTexture() {\n this._mainTexture = new RenderTargetTexture(\"EffectLayerMainRTT\", {\n width: this._mainTextureDesiredSize.width,\n height: this._mainTextureDesiredSize.height,\n }, this._scene, false, true, this._effectLayerOptions.mainTextureType, false, Texture.TRILINEAR_SAMPLINGMODE, true, this._effectLayerOptions.generateStencilBuffer);\n this._mainTexture.activeCamera = this._effectLayerOptions.camera;\n this._mainTexture.wrapU = Texture.CLAMP_ADDRESSMODE;\n this._mainTexture.wrapV = Texture.CLAMP_ADDRESSMODE;\n this._mainTexture.anisotropicFilteringLevel = 1;\n this._mainTexture.updateSamplingMode(Texture.BILINEAR_SAMPLINGMODE);\n this._mainTexture.renderParticles = false;\n this._mainTexture.renderList = null;\n this._mainTexture.ignoreCameraViewport = true;\n for (const id in this._materialForRendering) {\n const [mesh, material] = this._materialForRendering[id];\n this._mainTexture.setMaterialForRendering(mesh, material);\n }\n this._mainTexture.customIsReadyFunction = (mesh, refreshRate, preWarm) => {\n if ((preWarm || refreshRate === 0) && mesh.subMeshes) {\n for (let i = 0; i < mesh.subMeshes.length; ++i) {\n const subMesh = mesh.subMeshes[i];\n const material = subMesh.getMaterial();\n const renderingMesh = subMesh.getRenderingMesh();\n if (!material) {\n continue;\n }\n const batch = renderingMesh._getInstancesRenderList(subMesh._id, !!subMesh.getReplacementMesh());\n const hardwareInstancedRendering = batch.hardwareInstancedRendering[subMesh._id] || renderingMesh.hasThinInstances;\n this._setEmissiveTextureAndColor(renderingMesh, subMesh, material);\n if (!this._isReady(subMesh, hardwareInstancedRendering, this._emissiveTextureAndColor.texture)) {\n return false;\n }\n }\n }\n return true;\n };\n // Custom render function\n this._mainTexture.customRenderFunction = (opaqueSubMeshes, alphaTestSubMeshes, transparentSubMeshes, depthOnlySubMeshes) => {\n this.onBeforeRenderMainTextureObservable.notifyObservers(this);\n let index;\n const engine = this._scene.getEngine();\n if (depthOnlySubMeshes.length) {\n engine.setColorWrite(false);\n for (index = 0; index < depthOnlySubMeshes.length; index++) {\n this._renderSubMesh(depthOnlySubMeshes.data[index]);\n }\n engine.setColorWrite(true);\n }\n for (index = 0; index < opaqueSubMeshes.length; index++) {\n this._renderSubMesh(opaqueSubMeshes.data[index]);\n }\n for (index = 0; index < alphaTestSubMeshes.length; index++) {\n this._renderSubMesh(alphaTestSubMeshes.data[index]);\n }\n const previousAlphaMode = engine.getAlphaMode();\n for (index = 0; index < transparentSubMeshes.length; index++) {\n this._renderSubMesh(transparentSubMeshes.data[index], true);\n }\n engine.setAlphaMode(previousAlphaMode);\n };\n this._mainTexture.onClearObservable.add((engine) => {\n engine.clear(this.neutralColor, true, true, true);\n });\n // Prevent package size in es6 (getBoundingBoxRenderer might not be present)\n if (this._scene.getBoundingBoxRenderer) {\n const boundingBoxRendererEnabled = this._scene.getBoundingBoxRenderer().enabled;\n this._mainTexture.onBeforeBindObservable.add(() => {\n this._scene.getBoundingBoxRenderer().enabled = !this.disableBoundingBoxesFromEffectLayer && boundingBoxRendererEnabled;\n });\n this._mainTexture.onAfterUnbindObservable.add(() => {\n this._scene.getBoundingBoxRenderer().enabled = boundingBoxRendererEnabled;\n });\n }\n }\n /**\n * Adds specific effects defines.\n * @param defines The defines to add specifics to.\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _addCustomEffectDefines(defines) {\n // Nothing to add by default.\n }\n /**\n * Checks for the readiness of the element composing the layer.\n * @param subMesh the mesh to check for\n * @param useInstances specify whether or not to use instances to render the mesh\n * @param emissiveTexture the associated emissive texture used to generate the glow\n * @returns true if ready otherwise, false\n */\n _isReady(subMesh, useInstances, emissiveTexture) {\n var _a;\n const engine = this._scene.getEngine();\n const mesh = subMesh.getMesh();\n const renderingMaterial = (_a = mesh._internalAbstractMeshDataInfo._materialForRenderPass) === null || _a === void 0 ? void 0 : _a[engine.currentRenderPassId];\n if (renderingMaterial) {\n return renderingMaterial.isReadyForSubMesh(mesh, subMesh, useInstances);\n }\n const material = subMesh.getMaterial();\n if (!material) {\n return false;\n }\n if (this._useMeshMaterial(subMesh.getRenderingMesh())) {\n return material.isReadyForSubMesh(subMesh.getMesh(), subMesh, useInstances);\n }\n const defines = [];\n const attribs = [VertexBuffer.PositionKind];\n let uv1 = false;\n let uv2 = false;\n // Diffuse\n if (material) {\n const needAlphaTest = material.needAlphaTesting();\n const diffuseTexture = material.getAlphaTestTexture();\n const needAlphaBlendFromDiffuse = diffuseTexture && diffuseTexture.hasAlpha && (material.useAlphaFromDiffuseTexture || material._useAlphaFromAlbedoTexture);\n if (diffuseTexture && (needAlphaTest || needAlphaBlendFromDiffuse)) {\n defines.push(\"#define DIFFUSE\");\n if (mesh.isVerticesDataPresent(VertexBuffer.UV2Kind) && diffuseTexture.coordinatesIndex === 1) {\n defines.push(\"#define DIFFUSEUV2\");\n uv2 = true;\n }\n else if (mesh.isVerticesDataPresent(VertexBuffer.UVKind)) {\n defines.push(\"#define DIFFUSEUV1\");\n uv1 = true;\n }\n if (needAlphaTest) {\n defines.push(\"#define ALPHATEST\");\n defines.push(\"#define ALPHATESTVALUE 0.4\");\n }\n if (!diffuseTexture.gammaSpace) {\n defines.push(\"#define DIFFUSE_ISLINEAR\");\n }\n }\n const opacityTexture = material.opacityTexture;\n if (opacityTexture) {\n defines.push(\"#define OPACITY\");\n if (mesh.isVerticesDataPresent(VertexBuffer.UV2Kind) && opacityTexture.coordinatesIndex === 1) {\n defines.push(\"#define OPACITYUV2\");\n uv2 = true;\n }\n else if (mesh.isVerticesDataPresent(VertexBuffer.UVKind)) {\n defines.push(\"#define OPACITYUV1\");\n uv1 = true;\n }\n }\n }\n // Emissive\n if (emissiveTexture) {\n defines.push(\"#define EMISSIVE\");\n if (mesh.isVerticesDataPresent(VertexBuffer.UV2Kind) && emissiveTexture.coordinatesIndex === 1) {\n defines.push(\"#define EMISSIVEUV2\");\n uv2 = true;\n }\n else if (mesh.isVerticesDataPresent(VertexBuffer.UVKind)) {\n defines.push(\"#define EMISSIVEUV1\");\n uv1 = true;\n }\n if (!emissiveTexture.gammaSpace) {\n defines.push(\"#define EMISSIVE_ISLINEAR\");\n }\n }\n // Vertex\n if (mesh.useVertexColors && mesh.isVerticesDataPresent(VertexBuffer.ColorKind) && mesh.hasVertexAlpha && material.transparencyMode !== Material.MATERIAL_OPAQUE) {\n attribs.push(VertexBuffer.ColorKind);\n defines.push(\"#define VERTEXALPHA\");\n }\n if (uv1) {\n attribs.push(VertexBuffer.UVKind);\n defines.push(\"#define UV1\");\n }\n if (uv2) {\n attribs.push(VertexBuffer.UV2Kind);\n defines.push(\"#define UV2\");\n }\n // Bones\n const fallbacks = new EffectFallbacks();\n if (mesh.useBones && mesh.computeBonesUsingShaders) {\n attribs.push(VertexBuffer.MatricesIndicesKind);\n attribs.push(VertexBuffer.MatricesWeightsKind);\n if (mesh.numBoneInfluencers > 4) {\n attribs.push(VertexBuffer.MatricesIndicesExtraKind);\n attribs.push(VertexBuffer.MatricesWeightsExtraKind);\n }\n defines.push(\"#define NUM_BONE_INFLUENCERS \" + mesh.numBoneInfluencers);\n const skeleton = mesh.skeleton;\n if (skeleton && skeleton.isUsingTextureForMatrices) {\n defines.push(\"#define BONETEXTURE\");\n }\n else {\n defines.push(\"#define BonesPerMesh \" + (skeleton ? skeleton.bones.length + 1 : 0));\n }\n if (mesh.numBoneInfluencers > 0) {\n fallbacks.addCPUSkinningFallback(0, mesh);\n }\n }\n else {\n defines.push(\"#define NUM_BONE_INFLUENCERS 0\");\n }\n // Morph targets\n const manager = mesh.morphTargetManager;\n let morphInfluencers = 0;\n if (manager) {\n if (manager.numInfluencers > 0) {\n defines.push(\"#define MORPHTARGETS\");\n morphInfluencers = manager.numInfluencers;\n defines.push(\"#define NUM_MORPH_INFLUENCERS \" + morphInfluencers);\n if (manager.isUsingTextureForTargets) {\n defines.push(\"#define MORPHTARGETS_TEXTURE\");\n }\n MaterialHelper.PrepareAttributesForMorphTargetsInfluencers(attribs, mesh, morphInfluencers);\n }\n }\n // Instances\n if (useInstances) {\n defines.push(\"#define INSTANCES\");\n MaterialHelper.PushAttributesForInstances(attribs);\n if (subMesh.getRenderingMesh().hasThinInstances) {\n defines.push(\"#define THIN_INSTANCES\");\n }\n }\n // ClipPlanes\n prepareStringDefinesForClipPlanes(material, this._scene, defines);\n this._addCustomEffectDefines(defines);\n // Get correct effect\n const drawWrapper = subMesh._getDrawWrapper(undefined, true);\n const cachedDefines = drawWrapper.defines;\n const join = defines.join(\"\\n\");\n if (cachedDefines !== join) {\n const uniforms = [\n \"world\",\n \"mBones\",\n \"viewProjection\",\n \"glowColor\",\n \"morphTargetInfluences\",\n \"boneTextureWidth\",\n \"diffuseMatrix\",\n \"emissiveMatrix\",\n \"opacityMatrix\",\n \"opacityIntensity\",\n \"morphTargetTextureInfo\",\n \"morphTargetTextureIndices\",\n \"glowIntensity\",\n ];\n addClipPlaneUniforms(uniforms);\n drawWrapper.setEffect(this._engine.createEffect(\"glowMapGeneration\", attribs, uniforms, [\"diffuseSampler\", \"emissiveSampler\", \"opacitySampler\", \"boneSampler\", \"morphTargets\"], join, fallbacks, undefined, undefined, { maxSimultaneousMorphTargets: morphInfluencers }), join);\n }\n return drawWrapper.effect.isReady();\n }\n /**\n * Renders the glowing part of the scene by blending the blurred glowing meshes on top of the rendered scene.\n */\n render() {\n for (let i = 0; i < this._postProcesses.length; i++) {\n if (!this._postProcesses[i].isReady()) {\n return;\n }\n }\n const engine = this._scene.getEngine();\n const numDraws = this._numInternalDraws();\n // Check\n let isReady = true;\n for (let i = 0; i < numDraws; ++i) {\n let currentEffect = this._mergeDrawWrapper[i];\n if (!currentEffect) {\n currentEffect = this._mergeDrawWrapper[i] = new DrawWrapper(this._engine);\n currentEffect.setEffect(this._createMergeEffect());\n }\n isReady = isReady && currentEffect.effect.isReady();\n }\n if (!isReady) {\n return;\n }\n this.onBeforeComposeObservable.notifyObservers(this);\n const previousAlphaMode = engine.getAlphaMode();\n for (let i = 0; i < numDraws; ++i) {\n const currentEffect = this._mergeDrawWrapper[i];\n // Render\n engine.enableEffect(currentEffect);\n engine.setState(false);\n // VBOs\n engine.bindBuffers(this._vertexBuffers, this._indexBuffer, currentEffect.effect);\n // Go Blend.\n engine.setAlphaMode(this._effectLayerOptions.alphaBlendingMode);\n // Blends the map on the main canvas.\n this._internalRender(currentEffect.effect, i);\n }\n // Restore Alpha\n engine.setAlphaMode(previousAlphaMode);\n this.onAfterComposeObservable.notifyObservers(this);\n // Handle size changes.\n const size = this._mainTexture.getSize();\n this._setMainTextureSize();\n if ((size.width !== this._mainTextureDesiredSize.width || size.height !== this._mainTextureDesiredSize.height) &&\n this._mainTextureDesiredSize.width !== 0 &&\n this._mainTextureDesiredSize.height !== 0) {\n // Recreate RTT and post processes on size change.\n this.onSizeChangedObservable.notifyObservers(this);\n this._disposeTextureAndPostProcesses();\n this._createMainTexture();\n this._createTextureAndPostProcesses();\n }\n }\n /**\n * Determine if a given mesh will be used in the current effect.\n * @param mesh mesh to test\n * @returns true if the mesh will be used\n */\n hasMesh(mesh) {\n if (this.renderingGroupId === -1 || mesh.renderingGroupId === this.renderingGroupId) {\n return true;\n }\n return false;\n }\n /**\n * Returns true if the layer contains information to display, otherwise false.\n * @returns true if the glow layer should be rendered\n */\n shouldRender() {\n return this.isEnabled && this._shouldRender;\n }\n /**\n * Returns true if the mesh should render, otherwise false.\n * @param mesh The mesh to render\n * @returns true if it should render otherwise false\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _shouldRenderMesh(mesh) {\n return true;\n }\n /**\n * Returns true if the mesh can be rendered, otherwise false.\n * @param mesh The mesh to render\n * @param material The material used on the mesh\n * @returns true if it can be rendered otherwise false\n */\n _canRenderMesh(mesh, material) {\n return !material.needAlphaBlendingForMesh(mesh);\n }\n /**\n * Returns true if the mesh should render, otherwise false.\n * @returns true if it should render otherwise false\n */\n _shouldRenderEmissiveTextureForMesh() {\n return true;\n }\n /**\n * Renders the submesh passed in parameter to the generation map.\n * @param subMesh\n * @param enableAlphaMode\n */\n _renderSubMesh(subMesh, enableAlphaMode = false) {\n var _a, _b;\n if (!this.shouldRender()) {\n return;\n }\n const material = subMesh.getMaterial();\n const ownerMesh = subMesh.getMesh();\n const replacementMesh = subMesh.getReplacementMesh();\n const renderingMesh = subMesh.getRenderingMesh();\n const effectiveMesh = subMesh.getEffectiveMesh();\n const scene = this._scene;\n const engine = scene.getEngine();\n effectiveMesh._internalAbstractMeshDataInfo._isActiveIntermediate = false;\n if (!material) {\n return;\n }\n // Do not block in blend mode.\n if (!this._canRenderMesh(renderingMesh, material)) {\n return;\n }\n // Culling\n let sideOrientation = (_a = renderingMesh.overrideMaterialSideOrientation) !== null && _a !== void 0 ? _a : material.sideOrientation;\n const mainDeterminant = effectiveMesh._getWorldMatrixDeterminant();\n if (mainDeterminant < 0) {\n sideOrientation = sideOrientation === Material.ClockWiseSideOrientation ? Material.CounterClockWiseSideOrientation : Material.ClockWiseSideOrientation;\n }\n const reverse = sideOrientation === Material.ClockWiseSideOrientation;\n engine.setState(material.backFaceCulling, material.zOffset, undefined, reverse, material.cullBackFaces, undefined, material.zOffsetUnits);\n // Managing instances\n const batch = renderingMesh._getInstancesRenderList(subMesh._id, !!replacementMesh);\n if (batch.mustReturn) {\n return;\n }\n // Early Exit per mesh\n if (!this._shouldRenderMesh(renderingMesh)) {\n return;\n }\n const hardwareInstancedRendering = batch.hardwareInstancedRendering[subMesh._id] || renderingMesh.hasThinInstances;\n this._setEmissiveTextureAndColor(renderingMesh, subMesh, material);\n this.onBeforeRenderMeshToEffect.notifyObservers(ownerMesh);\n if (this._useMeshMaterial(renderingMesh)) {\n renderingMesh.render(subMesh, enableAlphaMode, replacementMesh || undefined);\n }\n else if (this._isReady(subMesh, hardwareInstancedRendering, this._emissiveTextureAndColor.texture)) {\n const renderingMaterial = (_b = effectiveMesh._internalAbstractMeshDataInfo._materialForRenderPass) === null || _b === void 0 ? void 0 : _b[engine.currentRenderPassId];\n let drawWrapper = subMesh._getDrawWrapper();\n if (!drawWrapper && renderingMaterial) {\n drawWrapper = renderingMaterial._getDrawWrapper();\n }\n if (!drawWrapper) {\n return;\n }\n const effect = drawWrapper.effect;\n engine.enableEffect(drawWrapper);\n if (!hardwareInstancedRendering) {\n renderingMesh._bind(subMesh, effect, material.fillMode);\n }\n if (!renderingMaterial) {\n effect.setMatrix(\"viewProjection\", scene.getTransformMatrix());\n effect.setMatrix(\"world\", effectiveMesh.getWorldMatrix());\n effect.setFloat4(\"glowColor\", this._emissiveTextureAndColor.color.r, this._emissiveTextureAndColor.color.g, this._emissiveTextureAndColor.color.b, this._emissiveTextureAndColor.color.a);\n }\n else {\n renderingMaterial.bindForSubMesh(effectiveMesh.getWorldMatrix(), effectiveMesh, subMesh);\n }\n if (!renderingMaterial) {\n const needAlphaTest = material.needAlphaTesting();\n const diffuseTexture = material.getAlphaTestTexture();\n const needAlphaBlendFromDiffuse = diffuseTexture && diffuseTexture.hasAlpha && (material.useAlphaFromDiffuseTexture || material._useAlphaFromAlbedoTexture);\n if (diffuseTexture && (needAlphaTest || needAlphaBlendFromDiffuse)) {\n effect.setTexture(\"diffuseSampler\", diffuseTexture);\n const textureMatrix = diffuseTexture.getTextureMatrix();\n if (textureMatrix) {\n effect.setMatrix(\"diffuseMatrix\", textureMatrix);\n }\n }\n const opacityTexture = material.opacityTexture;\n if (opacityTexture) {\n effect.setTexture(\"opacitySampler\", opacityTexture);\n effect.setFloat(\"opacityIntensity\", opacityTexture.level);\n const textureMatrix = opacityTexture.getTextureMatrix();\n if (textureMatrix) {\n effect.setMatrix(\"opacityMatrix\", textureMatrix);\n }\n }\n // Glow emissive only\n if (this._emissiveTextureAndColor.texture) {\n effect.setTexture(\"emissiveSampler\", this._emissiveTextureAndColor.texture);\n effect.setMatrix(\"emissiveMatrix\", this._emissiveTextureAndColor.texture.getTextureMatrix());\n }\n // Bones\n if (renderingMesh.useBones && renderingMesh.computeBonesUsingShaders && renderingMesh.skeleton) {\n const skeleton = renderingMesh.skeleton;\n if (skeleton.isUsingTextureForMatrices) {\n const boneTexture = skeleton.getTransformMatrixTexture(renderingMesh);\n if (!boneTexture) {\n return;\n }\n effect.setTexture(\"boneSampler\", boneTexture);\n effect.setFloat(\"boneTextureWidth\", 4.0 * (skeleton.bones.length + 1));\n }\n else {\n effect.setMatrices(\"mBones\", skeleton.getTransformMatrices(renderingMesh));\n }\n }\n // Morph targets\n MaterialHelper.BindMorphTargetParameters(renderingMesh, effect);\n if (renderingMesh.morphTargetManager && renderingMesh.morphTargetManager.isUsingTextureForTargets) {\n renderingMesh.morphTargetManager._bind(effect);\n }\n // Alpha mode\n if (enableAlphaMode) {\n engine.setAlphaMode(material.alphaMode);\n }\n // Intensity of effect\n effect.setFloat(\"glowIntensity\", this.getEffectIntensity(renderingMesh));\n // Clip planes\n bindClipPlane(effect, material, scene);\n }\n // Draw\n renderingMesh._processRendering(effectiveMesh, subMesh, effect, material.fillMode, batch, hardwareInstancedRendering, (isInstance, world) => effect.setMatrix(\"world\", world));\n }\n else {\n // Need to reset refresh rate of the main map\n this._mainTexture.resetRefreshCounter();\n }\n this.onAfterRenderMeshToEffect.notifyObservers(ownerMesh);\n }\n /**\n * Defines whether the current material of the mesh should be use to render the effect.\n * @param mesh defines the current mesh to render\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _useMeshMaterial(mesh) {\n return false;\n }\n /**\n * Rebuild the required buffers.\n * @internal Internal use only.\n */\n _rebuild() {\n const vb = this._vertexBuffers[VertexBuffer.PositionKind];\n if (vb) {\n vb._rebuild();\n }\n this._generateIndexBuffer();\n }\n /**\n * Dispose only the render target textures and post process.\n */\n _disposeTextureAndPostProcesses() {\n this._mainTexture.dispose();\n for (let i = 0; i < this._postProcesses.length; i++) {\n if (this._postProcesses[i]) {\n this._postProcesses[i].dispose();\n }\n }\n this._postProcesses = [];\n for (let i = 0; i < this._textures.length; i++) {\n if (this._textures[i]) {\n this._textures[i].dispose();\n }\n }\n this._textures = [];\n }\n /**\n * Dispose the highlight layer and free resources.\n */\n dispose() {\n const vertexBuffer = this._vertexBuffers[VertexBuffer.PositionKind];\n if (vertexBuffer) {\n vertexBuffer.dispose();\n this._vertexBuffers[VertexBuffer.PositionKind] = null;\n }\n if (this._indexBuffer) {\n this._scene.getEngine()._releaseBuffer(this._indexBuffer);\n this._indexBuffer = null;\n }\n for (const drawWrapper of this._mergeDrawWrapper) {\n drawWrapper.dispose();\n }\n this._mergeDrawWrapper = [];\n // Clean textures and post processes\n this._disposeTextureAndPostProcesses();\n // Remove from scene\n const index = this._scene.effectLayers.indexOf(this, 0);\n if (index > -1) {\n this._scene.effectLayers.splice(index, 1);\n }\n // Callback\n this.onDisposeObservable.notifyObservers(this);\n this.onDisposeObservable.clear();\n this.onBeforeRenderMainTextureObservable.clear();\n this.onBeforeComposeObservable.clear();\n this.onBeforeRenderMeshToEffect.clear();\n this.onAfterRenderMeshToEffect.clear();\n this.onAfterComposeObservable.clear();\n this.onSizeChangedObservable.clear();\n }\n /**\n * Gets the class name of the effect layer\n * @returns the string with the class name of the effect layer\n */\n getClassName() {\n return \"EffectLayer\";\n }\n /**\n * Creates an effect layer from parsed effect layer data\n * @param parsedEffectLayer defines effect layer data\n * @param scene defines the current scene\n * @param rootUrl defines the root URL containing the effect layer information\n * @returns a parsed effect Layer\n */\n static Parse(parsedEffectLayer, scene, rootUrl) {\n const effectLayerType = Tools.Instantiate(parsedEffectLayer.customType);\n return effectLayerType.Parse(parsedEffectLayer, scene, rootUrl);\n }\n}\n/**\n * @internal\n */\nEffectLayer._SceneComponentInitialization = (_) => {\n throw _WarnImport(\"EffectLayerSceneComponent\");\n};\n__decorate([\n serialize()\n], EffectLayer.prototype, \"name\", void 0);\n__decorate([\n serializeAsColor4()\n], EffectLayer.prototype, \"neutralColor\", void 0);\n__decorate([\n serialize()\n], EffectLayer.prototype, \"isEnabled\", void 0);\n__decorate([\n serializeAsCameraReference()\n], EffectLayer.prototype, \"camera\", null);\n__decorate([\n serialize()\n], EffectLayer.prototype, \"renderingGroupId\", null);\n__decorate([\n serialize()\n], EffectLayer.prototype, \"disableBoundingBoxesFromEffectLayer\", void 0);\n//# sourceMappingURL=effectLayer.js.map","// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore.js\";\nconst name = \"glowMapMergePixelShader\";\nconst shader = `varying vec2 vUV;uniform sampler2D textureSampler;\n#ifdef EMISSIVE\nuniform sampler2D textureSampler2;\n#endif\nuniform float offset;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\nvec4 baseColor=texture2D(textureSampler,vUV);\n#ifdef EMISSIVE\nbaseColor+=texture2D(textureSampler2,vUV);baseColor*=offset;\n#else\nbaseColor.a=abs(offset-baseColor.a);\n#ifdef STROKE\nfloat alpha=smoothstep(.0,.1,baseColor.a);baseColor.a=alpha;baseColor.rgb=baseColor.rgb*alpha;\n#endif\n#endif\n#if LDR\nbaseColor=clamp(baseColor,0.,1.0);\n#endif\ngl_FragColor=baseColor;\n#define CUSTOM_FRAGMENT_MAIN_END\n}`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @internal */\nexport const glowMapMergePixelShader = { name, shader };\n//# sourceMappingURL=glowMapMerge.fragment.js.map","// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore.js\";\nconst name = \"glowMapMergeVertexShader\";\nconst shader = `attribute vec2 position;varying vec2 vUV;const vec2 madd=vec2(0.5,0.5);\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvUV=position*madd+madd;gl_Position=vec4(position,0.0,1.0);\n#define CUSTOM_VERTEX_MAIN_END\n}`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @internal */\nexport const glowMapMergeVertexShader = { name, shader };\n//# sourceMappingURL=glowMapMerge.vertex.js.map","import { Camera } from \"../Cameras/camera.js\";\nimport { SceneComponentConstants } from \"../sceneComponent.js\";\nimport { EffectLayer } from \"./effectLayer.js\";\nimport { AbstractScene } from \"../abstractScene.js\";\nimport { EngineStore } from \"../Engines/engineStore.js\";\n// Adds the parser to the scene parsers.\nAbstractScene.AddParser(SceneComponentConstants.NAME_EFFECTLAYER, (parsedData, scene, container, rootUrl) => {\n if (parsedData.effectLayers) {\n if (!container.effectLayers) {\n container.effectLayers = new Array();\n }\n for (let index = 0; index < parsedData.effectLayers.length; index++) {\n const effectLayer = EffectLayer.Parse(parsedData.effectLayers[index], scene, rootUrl);\n container.effectLayers.push(effectLayer);\n }\n }\n});\nAbstractScene.prototype.removeEffectLayer = function (toRemove) {\n const index = this.effectLayers.indexOf(toRemove);\n if (index !== -1) {\n this.effectLayers.splice(index, 1);\n }\n return index;\n};\nAbstractScene.prototype.addEffectLayer = function (newEffectLayer) {\n this.effectLayers.push(newEffectLayer);\n};\n/**\n * Defines the layer scene component responsible to manage any effect layers\n * in a given scene.\n */\nexport class EffectLayerSceneComponent {\n /**\n * Creates a new instance of the component for the given scene\n * @param scene Defines the scene to register the component in\n */\n constructor(scene) {\n /**\n * The component name helpful to identify the component in the list of scene components.\n */\n this.name = SceneComponentConstants.NAME_EFFECTLAYER;\n this._renderEffects = false;\n this._needStencil = false;\n this._previousStencilState = false;\n this.scene = scene || EngineStore.LastCreatedScene;\n if (!this.scene) {\n return;\n }\n this._engine = this.scene.getEngine();\n this.scene.effectLayers = new Array();\n }\n /**\n * Registers the component in a given scene\n */\n register() {\n this.scene._isReadyForMeshStage.registerStep(SceneComponentConstants.STEP_ISREADYFORMESH_EFFECTLAYER, this, this._isReadyForMesh);\n this.scene._cameraDrawRenderTargetStage.registerStep(SceneComponentConstants.STEP_CAMERADRAWRENDERTARGET_EFFECTLAYER, this, this._renderMainTexture);\n this.scene._beforeCameraDrawStage.registerStep(SceneComponentConstants.STEP_BEFORECAMERADRAW_EFFECTLAYER, this, this._setStencil);\n this.scene._afterRenderingGroupDrawStage.registerStep(SceneComponentConstants.STEP_AFTERRENDERINGGROUPDRAW_EFFECTLAYER_DRAW, this, this._drawRenderingGroup);\n this.scene._afterCameraDrawStage.registerStep(SceneComponentConstants.STEP_AFTERCAMERADRAW_EFFECTLAYER, this, this._setStencilBack);\n this.scene._afterCameraDrawStage.registerStep(SceneComponentConstants.STEP_AFTERCAMERADRAW_EFFECTLAYER_DRAW, this, this._drawCamera);\n }\n /**\n * Rebuilds the elements related to this component in case of\n * context lost for instance.\n */\n rebuild() {\n const layers = this.scene.effectLayers;\n for (const effectLayer of layers) {\n effectLayer._rebuild();\n }\n }\n /**\n * Serializes the component data to the specified json object\n * @param serializationObject The object to serialize to\n */\n serialize(serializationObject) {\n // Effect layers\n serializationObject.effectLayers = [];\n const layers = this.scene.effectLayers;\n for (const effectLayer of layers) {\n if (effectLayer.serialize) {\n serializationObject.effectLayers.push(effectLayer.serialize());\n }\n }\n }\n /**\n * Adds all the elements from the container to the scene\n * @param container the container holding the elements\n */\n addFromContainer(container) {\n if (!container.effectLayers) {\n return;\n }\n container.effectLayers.forEach((o) => {\n this.scene.addEffectLayer(o);\n });\n }\n /**\n * Removes all the elements in the container from the scene\n * @param container contains the elements to remove\n * @param dispose if the removed element should be disposed (default: false)\n */\n removeFromContainer(container, dispose) {\n if (!container.effectLayers) {\n return;\n }\n container.effectLayers.forEach((o) => {\n this.scene.removeEffectLayer(o);\n if (dispose) {\n o.dispose();\n }\n });\n }\n /**\n * Disposes the component and the associated resources.\n */\n dispose() {\n const layers = this.scene.effectLayers;\n while (layers.length) {\n layers[0].dispose();\n }\n }\n _isReadyForMesh(mesh, hardwareInstancedRendering) {\n const currentRenderPassId = this._engine.currentRenderPassId;\n const layers = this.scene.effectLayers;\n for (const layer of layers) {\n if (!layer.hasMesh(mesh)) {\n continue;\n }\n const renderTarget = layer._mainTexture;\n this._engine.currentRenderPassId = renderTarget.renderPassId;\n for (const subMesh of mesh.subMeshes) {\n if (!layer.isReady(subMesh, hardwareInstancedRendering)) {\n this._engine.currentRenderPassId = currentRenderPassId;\n return false;\n }\n }\n }\n this._engine.currentRenderPassId = currentRenderPassId;\n return true;\n }\n _renderMainTexture(camera) {\n this._renderEffects = false;\n this._needStencil = false;\n let needRebind = false;\n const layers = this.scene.effectLayers;\n if (layers && layers.length > 0) {\n this._previousStencilState = this._engine.getStencilBuffer();\n for (const effectLayer of layers) {\n if (effectLayer.shouldRender() &&\n (!effectLayer.camera ||\n (effectLayer.camera.cameraRigMode === Camera.RIG_MODE_NONE && camera === effectLayer.camera) ||\n (effectLayer.camera.cameraRigMode !== Camera.RIG_MODE_NONE && effectLayer.camera._rigCameras.indexOf(camera) > -1))) {\n this._renderEffects = true;\n this._needStencil = this._needStencil || effectLayer.needStencil();\n const renderTarget = effectLayer._mainTexture;\n if (renderTarget._shouldRender()) {\n this.scene.incrementRenderId();\n renderTarget.render(false, false);\n needRebind = true;\n }\n }\n }\n this.scene.incrementRenderId();\n }\n return needRebind;\n }\n _setStencil() {\n // Activate effect Layer stencil\n if (this._needStencil) {\n this._engine.setStencilBuffer(true);\n }\n }\n _setStencilBack() {\n // Restore effect Layer stencil\n if (this._needStencil) {\n this._engine.setStencilBuffer(this._previousStencilState);\n }\n }\n _draw(renderingGroupId) {\n if (this._renderEffects) {\n this._engine.setDepthBuffer(false);\n const layers = this.scene.effectLayers;\n for (let i = 0; i < layers.length; i++) {\n const effectLayer = layers[i];\n if (effectLayer.renderingGroupId === renderingGroupId) {\n if (effectLayer.shouldRender()) {\n effectLayer.render();\n }\n }\n }\n this._engine.setDepthBuffer(true);\n }\n }\n _drawCamera() {\n if (this._renderEffects) {\n this._draw(-1);\n }\n }\n _drawRenderingGroup(index) {\n if (!this.scene._isInIntermediateRendering() && this._renderEffects) {\n this._draw(index);\n }\n }\n}\nEffectLayer._SceneComponentInitialization = (scene) => {\n let component = scene._getComponent(SceneComponentConstants.NAME_EFFECTLAYER);\n if (!component) {\n component = new EffectLayerSceneComponent(scene);\n scene._addComponent(component);\n }\n};\n//# sourceMappingURL=effectLayerSceneComponent.js.map","import { __decorate } from \"../tslib.es6.js\";\n/* eslint-disable @typescript-eslint/no-unused-vars */\nimport { serialize, SerializationHelper } from \"../Misc/decorators.js\";\nimport { Vector2 } from \"../Maths/math.vector.js\";\nimport { VertexBuffer } from \"../Buffers/buffer.js\";\nimport { Texture } from \"../Materials/Textures/texture.js\";\nimport { RenderTargetTexture } from \"../Materials/Textures/renderTargetTexture.js\";\nimport { Material } from \"../Materials/material.js\";\nimport { BlurPostProcess } from \"../PostProcesses/blurPostProcess.js\";\nimport { EffectLayer } from \"./effectLayer.js\";\nimport { AbstractScene } from \"../abstractScene.js\";\n\nimport { RegisterClass } from \"../Misc/typeStore.js\";\nimport { Engine } from \"../Engines/engine.js\";\nimport { Color4 } from \"../Maths/math.color.js\";\nimport \"../Shaders/glowMapMerge.fragment.js\";\nimport \"../Shaders/glowMapMerge.vertex.js\";\nimport \"../Layers/effectLayerSceneComponent.js\";\nAbstractScene.prototype.getGlowLayerByName = function (name) {\n var _a;\n for (let index = 0; index < ((_a = this.effectLayers) === null || _a === void 0 ? void 0 : _a.length); index++) {\n if (this.effectLayers[index].name === name && this.effectLayers[index].getEffectName() === GlowLayer.EffectName) {\n return this.effectLayers[index];\n }\n }\n return null;\n};\n/**\n * The glow layer Helps adding a glow effect around the emissive parts of a mesh.\n *\n * Once instantiated in a scene, by default, all the emissive meshes will glow.\n *\n * Documentation: https://doc.babylonjs.com/features/featuresDeepDive/mesh/glowLayer\n */\nexport class GlowLayer extends EffectLayer {\n /**\n * Sets the kernel size of the blur.\n */\n set blurKernelSize(value) {\n if (value === this._options.blurKernelSize) {\n return;\n }\n this._options.blurKernelSize = value;\n const effectiveKernel = this._getEffectiveBlurKernelSize();\n this._horizontalBlurPostprocess1.kernel = effectiveKernel;\n this._verticalBlurPostprocess1.kernel = effectiveKernel;\n this._horizontalBlurPostprocess2.kernel = effectiveKernel;\n this._verticalBlurPostprocess2.kernel = effectiveKernel;\n }\n /**\n * Gets the kernel size of the blur.\n */\n get blurKernelSize() {\n return this._options.blurKernelSize;\n }\n /**\n * Sets the glow intensity.\n */\n set intensity(value) {\n this._intensity = value;\n }\n /**\n * Gets the glow intensity.\n */\n get intensity() {\n return this._intensity;\n }\n /**\n * Instantiates a new glow Layer and references it to the scene.\n * @param name The name of the layer\n * @param scene The scene to use the layer in\n * @param options Sets of none mandatory options to use with the layer (see IGlowLayerOptions for more information)\n */\n constructor(name, scene, options) {\n super(name, scene);\n this._intensity = 1.0;\n this._includedOnlyMeshes = [];\n this._excludedMeshes = [];\n this._meshesUsingTheirOwnMaterials = [];\n this.neutralColor = new Color4(0, 0, 0, 1);\n // Adapt options\n this._options = Object.assign({ mainTextureRatio: GlowLayer.DefaultTextureRatio, blurKernelSize: 32, mainTextureFixedSize: undefined, camera: null, mainTextureSamples: 1, renderingGroupId: -1, ldrMerge: false, alphaBlendingMode: 1, mainTextureType: 0, generateStencilBuffer: false }, options);\n // Initialize the layer\n this._init({\n alphaBlendingMode: this._options.alphaBlendingMode,\n camera: this._options.camera,\n mainTextureFixedSize: this._options.mainTextureFixedSize,\n mainTextureRatio: this._options.mainTextureRatio,\n renderingGroupId: this._options.renderingGroupId,\n mainTextureType: this._options.mainTextureType,\n generateStencilBuffer: this._options.generateStencilBuffer,\n });\n }\n /**\n * Get the effect name of the layer.\n * @returns The effect name\n */\n getEffectName() {\n return GlowLayer.EffectName;\n }\n /**\n * Create the merge effect. This is the shader use to blit the information back\n * to the main canvas at the end of the scene rendering.\n */\n _createMergeEffect() {\n let defines = \"#define EMISSIVE \\n\";\n if (this._options.ldrMerge) {\n defines += \"#define LDR \\n\";\n }\n // Effect\n return this._engine.createEffect(\"glowMapMerge\", [VertexBuffer.PositionKind], [\"offset\"], [\"textureSampler\", \"textureSampler2\"], defines);\n }\n /**\n * Creates the render target textures and post processes used in the glow layer.\n */\n _createTextureAndPostProcesses() {\n let blurTextureWidth = this._mainTextureDesiredSize.width;\n let blurTextureHeight = this._mainTextureDesiredSize.height;\n blurTextureWidth = this._engine.needPOTTextures ? Engine.GetExponentOfTwo(blurTextureWidth, this._maxSize) : blurTextureWidth;\n blurTextureHeight = this._engine.needPOTTextures ? Engine.GetExponentOfTwo(blurTextureHeight, this._maxSize) : blurTextureHeight;\n let textureType = 0;\n if (this._engine.getCaps().textureHalfFloatRender) {\n textureType = 2;\n }\n else {\n textureType = 0;\n }\n this._blurTexture1 = new RenderTargetTexture(\"GlowLayerBlurRTT\", {\n width: blurTextureWidth,\n height: blurTextureHeight,\n }, this._scene, false, true, textureType);\n this._blurTexture1.wrapU = Texture.CLAMP_ADDRESSMODE;\n this._blurTexture1.wrapV = Texture.CLAMP_ADDRESSMODE;\n this._blurTexture1.updateSamplingMode(Texture.BILINEAR_SAMPLINGMODE);\n this._blurTexture1.renderParticles = false;\n this._blurTexture1.ignoreCameraViewport = true;\n const blurTextureWidth2 = Math.floor(blurTextureWidth / 2);\n const blurTextureHeight2 = Math.floor(blurTextureHeight / 2);\n this._blurTexture2 = new RenderTargetTexture(\"GlowLayerBlurRTT2\", {\n width: blurTextureWidth2,\n height: blurTextureHeight2,\n }, this._scene, false, true, textureType);\n this._blurTexture2.wrapU = Texture.CLAMP_ADDRESSMODE;\n this._blurTexture2.wrapV = Texture.CLAMP_ADDRESSMODE;\n this._blurTexture2.updateSamplingMode(Texture.BILINEAR_SAMPLINGMODE);\n this._blurTexture2.renderParticles = false;\n this._blurTexture2.ignoreCameraViewport = true;\n this._textures = [this._blurTexture1, this._blurTexture2];\n const effectiveKernel = this._getEffectiveBlurKernelSize();\n this._horizontalBlurPostprocess1 = new BlurPostProcess(\"GlowLayerHBP1\", new Vector2(1.0, 0), effectiveKernel, {\n width: blurTextureWidth,\n height: blurTextureHeight,\n }, null, Texture.BILINEAR_SAMPLINGMODE, this._scene.getEngine(), false, textureType);\n this._horizontalBlurPostprocess1.width = blurTextureWidth;\n this._horizontalBlurPostprocess1.height = blurTextureHeight;\n this._horizontalBlurPostprocess1.externalTextureSamplerBinding = true;\n this._horizontalBlurPostprocess1.onApplyObservable.add((effect) => {\n effect.setTexture(\"textureSampler\", this._mainTexture);\n });\n this._verticalBlurPostprocess1 = new BlurPostProcess(\"GlowLayerVBP1\", new Vector2(0, 1.0), effectiveKernel, {\n width: blurTextureWidth,\n height: blurTextureHeight,\n }, null, Texture.BILINEAR_SAMPLINGMODE, this._scene.getEngine(), false, textureType);\n this._horizontalBlurPostprocess2 = new BlurPostProcess(\"GlowLayerHBP2\", new Vector2(1.0, 0), effectiveKernel, {\n width: blurTextureWidth2,\n height: blurTextureHeight2,\n }, null, Texture.BILINEAR_SAMPLINGMODE, this._scene.getEngine(), false, textureType);\n this._horizontalBlurPostprocess2.width = blurTextureWidth2;\n this._horizontalBlurPostprocess2.height = blurTextureHeight2;\n this._horizontalBlurPostprocess2.externalTextureSamplerBinding = true;\n this._horizontalBlurPostprocess2.onApplyObservable.add((effect) => {\n effect.setTexture(\"textureSampler\", this._blurTexture1);\n });\n this._verticalBlurPostprocess2 = new BlurPostProcess(\"GlowLayerVBP2\", new Vector2(0, 1.0), effectiveKernel, {\n width: blurTextureWidth2,\n height: blurTextureHeight2,\n }, null, Texture.BILINEAR_SAMPLINGMODE, this._scene.getEngine(), false, textureType);\n this._postProcesses = [this._horizontalBlurPostprocess1, this._verticalBlurPostprocess1, this._horizontalBlurPostprocess2, this._verticalBlurPostprocess2];\n this._postProcesses1 = [this._horizontalBlurPostprocess1, this._verticalBlurPostprocess1];\n this._postProcesses2 = [this._horizontalBlurPostprocess2, this._verticalBlurPostprocess2];\n this._mainTexture.samples = this._options.mainTextureSamples;\n this._mainTexture.onAfterUnbindObservable.add(() => {\n const internalTexture = this._blurTexture1.renderTarget;\n if (internalTexture) {\n this._scene.postProcessManager.directRender(this._postProcesses1, internalTexture, true);\n const internalTexture2 = this._blurTexture2.renderTarget;\n if (internalTexture2) {\n this._scene.postProcessManager.directRender(this._postProcesses2, internalTexture2, true);\n }\n this._engine.unBindFramebuffer(internalTexture2 !== null && internalTexture2 !== void 0 ? internalTexture2 : internalTexture, true);\n }\n });\n // Prevent autoClear.\n this._postProcesses.map((pp) => {\n pp.autoClear = false;\n });\n }\n /**\n * @returns The blur kernel size used by the glow.\n * Note: The value passed in the options is divided by 2 for back compatibility.\n */\n _getEffectiveBlurKernelSize() {\n return this._options.blurKernelSize / 2;\n }\n /**\n * Checks for the readiness of the element composing the layer.\n * @param subMesh the mesh to check for\n * @param useInstances specify whether or not to use instances to render the mesh\n * @returns true if ready otherwise, false\n */\n isReady(subMesh, useInstances) {\n const material = subMesh.getMaterial();\n const mesh = subMesh.getRenderingMesh();\n if (!material || !mesh) {\n return false;\n }\n const emissiveTexture = material.emissiveTexture;\n return super._isReady(subMesh, useInstances, emissiveTexture);\n }\n /**\n * Returns whether or not the layer needs stencil enabled during the mesh rendering.\n */\n needStencil() {\n return false;\n }\n /**\n * Returns true if the mesh can be rendered, otherwise false.\n * @param mesh The mesh to render\n * @param material The material used on the mesh\n * @returns true if it can be rendered otherwise false\n */\n _canRenderMesh(mesh, material) {\n return true;\n }\n /**\n * Implementation specific of rendering the generating effect on the main canvas.\n * @param effect The effect used to render through\n */\n _internalRender(effect) {\n // Texture\n effect.setTexture(\"textureSampler\", this._blurTexture1);\n effect.setTexture(\"textureSampler2\", this._blurTexture2);\n effect.setFloat(\"offset\", this._intensity);\n // Cache\n const engine = this._engine;\n const previousStencilBuffer = engine.getStencilBuffer();\n // Draw order\n engine.setStencilBuffer(false);\n engine.drawElementsType(Material.TriangleFillMode, 0, 6);\n // Draw order\n engine.setStencilBuffer(previousStencilBuffer);\n }\n /**\n * Sets the required values for both the emissive texture and and the main color.\n * @param mesh\n * @param subMesh\n * @param material\n */\n _setEmissiveTextureAndColor(mesh, subMesh, material) {\n var _a;\n let textureLevel = 1.0;\n if (this.customEmissiveTextureSelector) {\n this._emissiveTextureAndColor.texture = this.customEmissiveTextureSelector(mesh, subMesh, material);\n }\n else {\n if (material) {\n this._emissiveTextureAndColor.texture = material.emissiveTexture;\n if (this._emissiveTextureAndColor.texture) {\n textureLevel = this._emissiveTextureAndColor.texture.level;\n }\n }\n else {\n this._emissiveTextureAndColor.texture = null;\n }\n }\n if (this.customEmissiveColorSelector) {\n this.customEmissiveColorSelector(mesh, subMesh, material, this._emissiveTextureAndColor.color);\n }\n else {\n if (material.emissiveColor) {\n const emissiveIntensity = (_a = material.emissiveIntensity) !== null && _a !== void 0 ? _a : 1;\n textureLevel *= emissiveIntensity;\n this._emissiveTextureAndColor.color.set(material.emissiveColor.r * textureLevel, material.emissiveColor.g * textureLevel, material.emissiveColor.b * textureLevel, material.alpha);\n }\n else {\n this._emissiveTextureAndColor.color.set(this.neutralColor.r, this.neutralColor.g, this.neutralColor.b, this.neutralColor.a);\n }\n }\n }\n /**\n * Returns true if the mesh should render, otherwise false.\n * @param mesh The mesh to render\n * @returns true if it should render otherwise false\n */\n _shouldRenderMesh(mesh) {\n return this.hasMesh(mesh);\n }\n /**\n * Adds specific effects defines.\n * @param defines The defines to add specifics to.\n */\n _addCustomEffectDefines(defines) {\n defines.push(\"#define GLOW\");\n }\n /**\n * Add a mesh in the exclusion list to prevent it to impact or being impacted by the glow layer.\n * @param mesh The mesh to exclude from the glow layer\n */\n addExcludedMesh(mesh) {\n if (this._excludedMeshes.indexOf(mesh.uniqueId) === -1) {\n this._excludedMeshes.push(mesh.uniqueId);\n }\n }\n /**\n * Remove a mesh from the exclusion list to let it impact or being impacted by the glow layer.\n * @param mesh The mesh to remove\n */\n removeExcludedMesh(mesh) {\n const index = this._excludedMeshes.indexOf(mesh.uniqueId);\n if (index !== -1) {\n this._excludedMeshes.splice(index, 1);\n }\n }\n /**\n * Add a mesh in the inclusion list to impact or being impacted by the glow layer.\n * @param mesh The mesh to include in the glow layer\n */\n addIncludedOnlyMesh(mesh) {\n if (this._includedOnlyMeshes.indexOf(mesh.uniqueId) === -1) {\n this._includedOnlyMeshes.push(mesh.uniqueId);\n }\n }\n /**\n * Remove a mesh from the Inclusion list to prevent it to impact or being impacted by the glow layer.\n * @param mesh The mesh to remove\n */\n removeIncludedOnlyMesh(mesh) {\n const index = this._includedOnlyMeshes.indexOf(mesh.uniqueId);\n if (index !== -1) {\n this._includedOnlyMeshes.splice(index, 1);\n }\n }\n /**\n * Determine if a given mesh will be used in the glow layer\n * @param mesh The mesh to test\n * @returns true if the mesh will be highlighted by the current glow layer\n */\n hasMesh(mesh) {\n if (!super.hasMesh(mesh)) {\n return false;\n }\n // Included Mesh\n if (this._includedOnlyMeshes.length) {\n return this._includedOnlyMeshes.indexOf(mesh.uniqueId) !== -1;\n }\n // Excluded Mesh\n if (this._excludedMeshes.length) {\n return this._excludedMeshes.indexOf(mesh.uniqueId) === -1;\n }\n return true;\n }\n /**\n * Defines whether the current material of the mesh should be use to render the effect.\n * @param mesh defines the current mesh to render\n */\n _useMeshMaterial(mesh) {\n if (this._meshesUsingTheirOwnMaterials.length == 0) {\n return false;\n }\n return this._meshesUsingTheirOwnMaterials.indexOf(mesh.uniqueId) > -1;\n }\n /**\n * Add a mesh to be rendered through its own material and not with emissive only.\n * @param mesh The mesh for which we need to use its material\n */\n referenceMeshToUseItsOwnMaterial(mesh) {\n mesh.resetDrawCache(this._mainTexture.renderPassId);\n this._meshesUsingTheirOwnMaterials.push(mesh.uniqueId);\n mesh.onDisposeObservable.add(() => {\n this._disposeMesh(mesh);\n });\n }\n /**\n * Remove a mesh from being rendered through its own material and not with emissive only.\n * @param mesh The mesh for which we need to not use its material\n */\n unReferenceMeshFromUsingItsOwnMaterial(mesh) {\n let index = this._meshesUsingTheirOwnMaterials.indexOf(mesh.uniqueId);\n while (index >= 0) {\n this._meshesUsingTheirOwnMaterials.splice(index, 1);\n index = this._meshesUsingTheirOwnMaterials.indexOf(mesh.uniqueId);\n }\n mesh.resetDrawCache(this._mainTexture.renderPassId);\n }\n /**\n * Free any resources and references associated to a mesh.\n * Internal use\n * @param mesh The mesh to free.\n * @internal\n */\n _disposeMesh(mesh) {\n this.removeIncludedOnlyMesh(mesh);\n this.removeExcludedMesh(mesh);\n }\n /**\n * Gets the class name of the effect layer\n * @returns the string with the class name of the effect layer\n */\n getClassName() {\n return \"GlowLayer\";\n }\n /**\n * Serializes this glow layer\n * @returns a serialized glow layer object\n */\n serialize() {\n const serializationObject = SerializationHelper.Serialize(this);\n serializationObject.customType = \"BABYLON.GlowLayer\";\n let index;\n // Included meshes\n serializationObject.includedMeshes = [];\n if (this._includedOnlyMeshes.length) {\n for (index = 0; index < this._includedOnlyMeshes.length; index++) {\n const mesh = this._scene.getMeshByUniqueId(this._includedOnlyMeshes[index]);\n if (mesh) {\n serializationObject.includedMeshes.push(mesh.id);\n }\n }\n }\n // Excluded meshes\n serializationObject.excludedMeshes = [];\n if (this._excludedMeshes.length) {\n for (index = 0; index < this._excludedMeshes.length; index++) {\n const mesh = this._scene.getMeshByUniqueId(this._excludedMeshes[index]);\n if (mesh) {\n serializationObject.excludedMeshes.push(mesh.id);\n }\n }\n }\n return serializationObject;\n }\n /**\n * Creates a Glow Layer from parsed glow layer data\n * @param parsedGlowLayer defines glow layer data\n * @param scene defines the current scene\n * @param rootUrl defines the root URL containing the glow layer information\n * @returns a parsed Glow Layer\n */\n static Parse(parsedGlowLayer, scene, rootUrl) {\n const gl = SerializationHelper.Parse(() => new GlowLayer(parsedGlowLayer.name, scene, parsedGlowLayer.options), parsedGlowLayer, scene, rootUrl);\n let index;\n // Excluded meshes\n for (index = 0; index < parsedGlowLayer.excludedMeshes.length; index++) {\n const mesh = scene.getMeshById(parsedGlowLayer.excludedMeshes[index]);\n if (mesh) {\n gl.addExcludedMesh(mesh);\n }\n }\n // Included meshes\n for (index = 0; index < parsedGlowLayer.includedMeshes.length; index++) {\n const mesh = scene.getMeshById(parsedGlowLayer.includedMeshes[index]);\n if (mesh) {\n gl.addIncludedOnlyMesh(mesh);\n }\n }\n return gl;\n }\n}\n/**\n * Effect Name of the layer.\n */\nGlowLayer.EffectName = \"GlowLayer\";\n/**\n * The default blur kernel size used for the glow.\n */\nGlowLayer.DefaultBlurKernelSize = 32;\n/**\n * The default texture size ratio used for the glow.\n */\nGlowLayer.DefaultTextureRatio = 0.5;\n__decorate([\n serialize()\n], GlowLayer.prototype, \"blurKernelSize\", null);\n__decorate([\n serialize()\n], GlowLayer.prototype, \"intensity\", null);\n__decorate([\n serialize(\"options\")\n], GlowLayer.prototype, \"_options\", void 0);\nRegisterClass(\"BABYLON.GlowLayer\", GlowLayer);\n//# sourceMappingURL=glowLayer.js.map","// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore.js\";\nconst name = \"sharpenPixelShader\";\nconst shader = `varying vec2 vUV;uniform sampler2D textureSampler;uniform vec2 screenSize;uniform vec2 sharpnessAmounts;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{vec2 onePixel=vec2(1.0,1.0)/screenSize;vec4 color=texture2D(textureSampler,vUV);vec4 edgeDetection=texture2D(textureSampler,vUV+onePixel*vec2(0,-1)) +\ntexture2D(textureSampler,vUV+onePixel*vec2(-1,0)) +\ntexture2D(textureSampler,vUV+onePixel*vec2(1,0)) +\ntexture2D(textureSampler,vUV+onePixel*vec2(0,1)) -\ncolor*4.0;gl_FragColor=max(vec4(color.rgb*sharpnessAmounts.y,color.a)-(sharpnessAmounts.x*vec4(edgeDetection.rgb,0)),0.);}`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @internal */\nexport const sharpenPixelShader = { name, shader };\n//# sourceMappingURL=sharpen.fragment.js.map","import { __decorate } from \"../tslib.es6.js\";\nimport { PostProcess } from \"./postProcess.js\";\n\nimport \"../Shaders/sharpen.fragment.js\";\nimport { RegisterClass } from \"../Misc/typeStore.js\";\nimport { serialize, SerializationHelper } from \"../Misc/decorators.js\";\n/**\n * The SharpenPostProcess applies a sharpen kernel to every pixel\n * See http://en.wikipedia.org/wiki/Kernel_(image_processing)\n */\nexport class SharpenPostProcess extends PostProcess {\n /**\n * Gets a string identifying the name of the class\n * @returns \"SharpenPostProcess\" string\n */\n getClassName() {\n return \"SharpenPostProcess\";\n }\n /**\n * Creates a new instance ConvolutionPostProcess\n * @param name The name of the effect.\n * @param options The required width/height ratio to downsize to before computing the render pass.\n * @param camera The camera to apply the render pass to.\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\n * @param engine The engine which the post process will be applied. (default: current engine)\n * @param reusable If the post process can be reused on the same frame. (default: false)\n * @param textureType Type of textures used when performing the post process. (default: 0)\n * @param blockCompilation If compilation of the shader should not be done in the constructor. The updateEffect method can be used to compile the shader at a later time. (default: false)\n */\n constructor(name, options, camera, samplingMode, engine, reusable, textureType = 0, blockCompilation = false) {\n super(name, \"sharpen\", [\"sharpnessAmounts\", \"screenSize\"], null, options, camera, samplingMode, engine, reusable, null, textureType, undefined, null, blockCompilation);\n /**\n * How much of the original color should be applied. Setting this to 0 will display edge detection. (default: 1)\n */\n this.colorAmount = 1.0;\n /**\n * How much sharpness should be applied (default: 0.3)\n */\n this.edgeAmount = 0.3;\n this.onApply = (effect) => {\n effect.setFloat2(\"screenSize\", this.width, this.height);\n effect.setFloat2(\"sharpnessAmounts\", this.edgeAmount, this.colorAmount);\n };\n }\n /**\n * @internal\n */\n static _Parse(parsedPostProcess, targetCamera, scene, rootUrl) {\n return SerializationHelper.Parse(() => {\n return new SharpenPostProcess(parsedPostProcess.name, parsedPostProcess.options, targetCamera, parsedPostProcess.renderTargetSamplingMode, scene.getEngine(), parsedPostProcess.textureType, parsedPostProcess.reusable);\n }, parsedPostProcess, scene, rootUrl);\n }\n}\n__decorate([\n serialize()\n], SharpenPostProcess.prototype, \"colorAmount\", void 0);\n__decorate([\n serialize()\n], SharpenPostProcess.prototype, \"edgeAmount\", void 0);\nRegisterClass(\"BABYLON.SharpenPostProcess\", SharpenPostProcess);\n//# sourceMappingURL=sharpenPostProcess.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"imageProcessingDeclaration\";\nconst shader = `#ifdef EXPOSURE\nuniform float exposureLinear;\n#endif\n#ifdef CONTRAST\nuniform float contrast;\n#endif\n#if defined(VIGNETTE) || defined(DITHER)\nuniform vec2 vInverseScreenSize;\n#endif\n#ifdef VIGNETTE\nuniform vec4 vignetteSettings1;uniform vec4 vignetteSettings2;\n#endif\n#ifdef COLORCURVES\nuniform vec4 vCameraColorCurveNegative;uniform vec4 vCameraColorCurveNeutral;uniform vec4 vCameraColorCurvePositive;\n#endif\n#ifdef COLORGRADING\n#ifdef COLORGRADING3D\nuniform highp sampler3D txColorTransform;\n#else\nuniform sampler2D txColorTransform;\n#endif\nuniform vec4 colorTransformSettings;\n#endif\n#ifdef DITHER\nuniform float ditherIntensity;\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const imageProcessingDeclaration = { name, shader };\n//# sourceMappingURL=imageProcessingDeclaration.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"imageProcessingFunctions\";\nconst shader = `#if defined(COLORGRADING) && !defined(COLORGRADING3D)\n/** \n* Polyfill for SAMPLE_TEXTURE_3D,which is unsupported in WebGL.\n* sampler3dSetting.x=textureOffset (0.5/textureSize).\n* sampler3dSetting.y=textureSize.\n*/\n#define inline\nvec3 sampleTexture3D(sampler2D colorTransform,vec3 color,vec2 sampler3dSetting)\n{float sliceSize=2.0*sampler3dSetting.x; \n#ifdef SAMPLER3DGREENDEPTH\nfloat sliceContinuous=(color.g-sampler3dSetting.x)*sampler3dSetting.y;\n#else\nfloat sliceContinuous=(color.b-sampler3dSetting.x)*sampler3dSetting.y;\n#endif\nfloat sliceInteger=floor(sliceContinuous);float sliceFraction=sliceContinuous-sliceInteger;\n#ifdef SAMPLER3DGREENDEPTH\nvec2 sliceUV=color.rb;\n#else\nvec2 sliceUV=color.rg;\n#endif\nsliceUV.x*=sliceSize;sliceUV.x+=sliceInteger*sliceSize;sliceUV=saturate(sliceUV);vec4 slice0Color=texture2D(colorTransform,sliceUV);sliceUV.x+=sliceSize;sliceUV=saturate(sliceUV);vec4 slice1Color=texture2D(colorTransform,sliceUV);vec3 result=mix(slice0Color.rgb,slice1Color.rgb,sliceFraction);\n#ifdef SAMPLER3DBGRMAP\ncolor.rgb=result.rgb;\n#else\ncolor.rgb=result.bgr;\n#endif\nreturn color;}\n#endif\n#ifdef TONEMAPPING_ACES\nconst mat3 ACESInputMat=mat3(\nvec3(0.59719,0.07600,0.02840),\nvec3(0.35458,0.90834,0.13383),\nvec3(0.04823,0.01566,0.83777)\n);const mat3 ACESOutputMat=mat3(\nvec3( 1.60475,-0.10208,-0.00327),\nvec3(-0.53108, 1.10813,-0.07276),\nvec3(-0.07367,-0.00605, 1.07602)\n);vec3 RRTAndODTFit(vec3 v)\n{vec3 a=v*(v+0.0245786)-0.000090537;vec3 b=v*(0.983729*v+0.4329510)+0.238081;return a/b;}\nvec3 ACESFitted(vec3 color)\n{color=ACESInputMat*color;color=RRTAndODTFit(color);color=ACESOutputMat*color;color=saturate(color);return color;}\n#endif\n#define CUSTOM_IMAGEPROCESSINGFUNCTIONS_DEFINITIONS\nvec4 applyImageProcessing(vec4 result) {\n#define CUSTOM_IMAGEPROCESSINGFUNCTIONS_UPDATERESULT_ATSTART\n#ifdef EXPOSURE\nresult.rgb*=exposureLinear;\n#endif\n#ifdef VIGNETTE\nvec2 viewportXY=gl_FragCoord.xy*vInverseScreenSize;viewportXY=viewportXY*2.0-1.0;vec3 vignetteXY1=vec3(viewportXY*vignetteSettings1.xy+vignetteSettings1.zw,1.0);float vignetteTerm=dot(vignetteXY1,vignetteXY1);float vignette=pow(vignetteTerm,vignetteSettings2.w);vec3 vignetteColor=vignetteSettings2.rgb;\n#ifdef VIGNETTEBLENDMODEMULTIPLY\nvec3 vignetteColorMultiplier=mix(vignetteColor,vec3(1,1,1),vignette);result.rgb*=vignetteColorMultiplier;\n#endif\n#ifdef VIGNETTEBLENDMODEOPAQUE\nresult.rgb=mix(vignetteColor,result.rgb,vignette);\n#endif\n#endif\n#ifdef TONEMAPPING\n#ifdef TONEMAPPING_ACES\nresult.rgb=ACESFitted(result.rgb);\n#else\nconst float tonemappingCalibration=1.590579;result.rgb=1.0-exp2(-tonemappingCalibration*result.rgb);\n#endif\n#endif\nresult.rgb=toGammaSpace(result.rgb);result.rgb=saturate(result.rgb);\n#ifdef CONTRAST\nvec3 resultHighContrast=result.rgb*result.rgb*(3.0-2.0*result.rgb);if (contrast<1.0) {result.rgb=mix(vec3(0.5,0.5,0.5),result.rgb,contrast);} else {result.rgb=mix(result.rgb,resultHighContrast,contrast-1.0);}\n#endif\n#ifdef COLORGRADING\nvec3 colorTransformInput=result.rgb*colorTransformSettings.xxx+colorTransformSettings.yyy;\n#ifdef COLORGRADING3D\nvec3 colorTransformOutput=texture(txColorTransform,colorTransformInput).rgb;\n#else\nvec3 colorTransformOutput=sampleTexture3D(txColorTransform,colorTransformInput,colorTransformSettings.yz).rgb;\n#endif\nresult.rgb=mix(result.rgb,colorTransformOutput,colorTransformSettings.www);\n#endif\n#ifdef COLORCURVES\nfloat luma=getLuminance(result.rgb);vec2 curveMix=clamp(vec2(luma*3.0-1.5,luma*-3.0+1.5),vec2(0.0),vec2(1.0));vec4 colorCurve=vCameraColorCurveNeutral+curveMix.x*vCameraColorCurvePositive-curveMix.y*vCameraColorCurveNegative;result.rgb*=colorCurve.rgb;result.rgb=mix(vec3(luma),result.rgb,colorCurve.a);\n#endif\n#ifdef DITHER\nfloat rand=getRand(gl_FragCoord.xy*vInverseScreenSize);float dither=mix(-ditherIntensity,ditherIntensity,rand);result.rgb=saturate(result.rgb+vec3(dither));\n#endif\n#define CUSTOM_IMAGEPROCESSINGFUNCTIONS_UPDATERESULT_ATEND\nreturn result;}`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const imageProcessingFunctions = { name, shader };\n//# sourceMappingURL=imageProcessingFunctions.js.map","// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore.js\";\nimport \"./ShadersInclude/imageProcessingDeclaration.js\";\nimport \"./ShadersInclude/helperFunctions.js\";\nimport \"./ShadersInclude/imageProcessingFunctions.js\";\nconst name = \"imageProcessingPixelShader\";\nconst shader = `varying vec2 vUV;uniform sampler2D textureSampler;\n#include\n#include\n#include\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{vec4 result=texture2D(textureSampler,vUV);\n#ifdef IMAGEPROCESSING\n#ifndef FROMLINEARSPACE\nresult.rgb=toLinearSpace(result.rgb);\n#endif\nresult=applyImageProcessing(result);\n#else\n#ifdef FROMLINEARSPACE\nresult=applyImageProcessing(result);\n#endif\n#endif\ngl_FragColor=result;}`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @internal */\nexport const imageProcessingPixelShader = { name, shader };\n//# sourceMappingURL=imageProcessing.fragment.js.map","import { __decorate } from \"../tslib.es6.js\";\nimport { serialize } from \"../Misc/decorators.js\";\nimport { ImageProcessingConfiguration } from \"../Materials/imageProcessingConfiguration.js\";\nimport { PostProcess } from \"./postProcess.js\";\nimport { EngineStore } from \"../Engines/engineStore.js\";\n\nimport \"../Shaders/imageProcessing.fragment.js\";\nimport \"../Shaders/postprocess.vertex.js\";\n/**\n * ImageProcessingPostProcess\n * @see https://doc.babylonjs.com/features/featuresDeepDive/postProcesses/usePostProcesses#imageprocessing\n */\nexport class ImageProcessingPostProcess extends PostProcess {\n /**\n * Gets the image processing configuration used either in this material.\n */\n get imageProcessingConfiguration() {\n return this._imageProcessingConfiguration;\n }\n /**\n * Sets the Default image processing configuration used either in the this material.\n *\n * If sets to null, the scene one is in use.\n */\n set imageProcessingConfiguration(value) {\n // We are almost sure it is applied by post process as\n // We are in the post process :-)\n value.applyByPostProcess = true;\n this._attachImageProcessingConfiguration(value);\n }\n /**\n * Attaches a new image processing configuration to the PBR Material.\n * @param configuration\n * @param doNotBuild\n */\n _attachImageProcessingConfiguration(configuration, doNotBuild = false) {\n if (configuration === this._imageProcessingConfiguration) {\n return;\n }\n // Detaches observer.\n if (this._imageProcessingConfiguration && this._imageProcessingObserver) {\n this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver);\n }\n // Pick the scene configuration if needed.\n if (!configuration) {\n let scene = null;\n const engine = this.getEngine();\n const camera = this.getCamera();\n if (camera) {\n scene = camera.getScene();\n }\n else if (engine && engine.scenes) {\n const scenes = engine.scenes;\n scene = scenes[scenes.length - 1];\n }\n else {\n scene = EngineStore.LastCreatedScene;\n }\n if (scene) {\n this._imageProcessingConfiguration = scene.imageProcessingConfiguration;\n }\n else {\n this._imageProcessingConfiguration = new ImageProcessingConfiguration();\n }\n }\n else {\n this._imageProcessingConfiguration = configuration;\n }\n // Attaches observer.\n if (this._imageProcessingConfiguration) {\n this._imageProcessingObserver = this._imageProcessingConfiguration.onUpdateParameters.add(() => {\n this._updateParameters();\n });\n }\n // Ensure the effect will be rebuilt.\n if (!doNotBuild) {\n this._updateParameters();\n }\n }\n /**\n * If the post process is supported.\n */\n get isSupported() {\n const effect = this.getEffect();\n return !effect || effect.isSupported;\n }\n /**\n * Gets Color curves setup used in the effect if colorCurvesEnabled is set to true .\n */\n get colorCurves() {\n return this.imageProcessingConfiguration.colorCurves;\n }\n /**\n * Sets Color curves setup used in the effect if colorCurvesEnabled is set to true .\n */\n set colorCurves(value) {\n this.imageProcessingConfiguration.colorCurves = value;\n }\n /**\n * Gets whether the color curves effect is enabled.\n */\n get colorCurvesEnabled() {\n return this.imageProcessingConfiguration.colorCurvesEnabled;\n }\n /**\n * Sets whether the color curves effect is enabled.\n */\n set colorCurvesEnabled(value) {\n this.imageProcessingConfiguration.colorCurvesEnabled = value;\n }\n /**\n * Gets Color grading LUT texture used in the effect if colorGradingEnabled is set to true.\n */\n get colorGradingTexture() {\n return this.imageProcessingConfiguration.colorGradingTexture;\n }\n /**\n * Sets Color grading LUT texture used in the effect if colorGradingEnabled is set to true.\n */\n set colorGradingTexture(value) {\n this.imageProcessingConfiguration.colorGradingTexture = value;\n }\n /**\n * Gets whether the color grading effect is enabled.\n */\n get colorGradingEnabled() {\n return this.imageProcessingConfiguration.colorGradingEnabled;\n }\n /**\n * Gets whether the color grading effect is enabled.\n */\n set colorGradingEnabled(value) {\n this.imageProcessingConfiguration.colorGradingEnabled = value;\n }\n /**\n * Gets exposure used in the effect.\n */\n get exposure() {\n return this.imageProcessingConfiguration.exposure;\n }\n /**\n * Sets exposure used in the effect.\n */\n set exposure(value) {\n this.imageProcessingConfiguration.exposure = value;\n }\n /**\n * Gets whether tonemapping is enabled or not.\n */\n get toneMappingEnabled() {\n return this._imageProcessingConfiguration.toneMappingEnabled;\n }\n /**\n * Sets whether tonemapping is enabled or not\n */\n set toneMappingEnabled(value) {\n this._imageProcessingConfiguration.toneMappingEnabled = value;\n }\n /**\n * Gets the type of tone mapping effect.\n */\n get toneMappingType() {\n return this._imageProcessingConfiguration.toneMappingType;\n }\n /**\n * Sets the type of tone mapping effect.\n */\n set toneMappingType(value) {\n this._imageProcessingConfiguration.toneMappingType = value;\n }\n /**\n * Gets contrast used in the effect.\n */\n get contrast() {\n return this.imageProcessingConfiguration.contrast;\n }\n /**\n * Sets contrast used in the effect.\n */\n set contrast(value) {\n this.imageProcessingConfiguration.contrast = value;\n }\n /**\n * Gets Vignette stretch size.\n */\n get vignetteStretch() {\n return this.imageProcessingConfiguration.vignetteStretch;\n }\n /**\n * Sets Vignette stretch size.\n */\n set vignetteStretch(value) {\n this.imageProcessingConfiguration.vignetteStretch = value;\n }\n /**\n * Gets Vignette center X Offset.\n * @deprecated use vignetteCenterX instead\n */\n get vignetteCentreX() {\n return this.imageProcessingConfiguration.vignetteCenterX;\n }\n /**\n * Sets Vignette center X Offset.\n * @deprecated use vignetteCenterX instead\n */\n set vignetteCentreX(value) {\n this.imageProcessingConfiguration.vignetteCenterX = value;\n }\n /**\n * Gets Vignette center Y Offset.\n * @deprecated use vignetteCenterY instead\n */\n get vignetteCentreY() {\n return this.imageProcessingConfiguration.vignetteCenterY;\n }\n /**\n * Sets Vignette center Y Offset.\n * @deprecated use vignetteCenterY instead\n */\n set vignetteCentreY(value) {\n this.imageProcessingConfiguration.vignetteCenterY = value;\n }\n /**\n * Vignette center Y Offset.\n */\n get vignetteCenterY() {\n return this.imageProcessingConfiguration.vignetteCenterY;\n }\n set vignetteCenterY(value) {\n this.imageProcessingConfiguration.vignetteCenterY = value;\n }\n /**\n * Vignette center X Offset.\n */\n get vignetteCenterX() {\n return this.imageProcessingConfiguration.vignetteCenterX;\n }\n set vignetteCenterX(value) {\n this.imageProcessingConfiguration.vignetteCenterX = value;\n }\n /**\n * Gets Vignette weight or intensity of the vignette effect.\n */\n get vignetteWeight() {\n return this.imageProcessingConfiguration.vignetteWeight;\n }\n /**\n * Sets Vignette weight or intensity of the vignette effect.\n */\n set vignetteWeight(value) {\n this.imageProcessingConfiguration.vignetteWeight = value;\n }\n /**\n * Gets Color of the vignette applied on the screen through the chosen blend mode (vignetteBlendMode)\n * if vignetteEnabled is set to true.\n */\n get vignetteColor() {\n return this.imageProcessingConfiguration.vignetteColor;\n }\n /**\n * Sets Color of the vignette applied on the screen through the chosen blend mode (vignetteBlendMode)\n * if vignetteEnabled is set to true.\n */\n set vignetteColor(value) {\n this.imageProcessingConfiguration.vignetteColor = value;\n }\n /**\n * Gets Camera field of view used by the Vignette effect.\n */\n get vignetteCameraFov() {\n return this.imageProcessingConfiguration.vignetteCameraFov;\n }\n /**\n * Sets Camera field of view used by the Vignette effect.\n */\n set vignetteCameraFov(value) {\n this.imageProcessingConfiguration.vignetteCameraFov = value;\n }\n /**\n * Gets the vignette blend mode allowing different kind of effect.\n */\n get vignetteBlendMode() {\n return this.imageProcessingConfiguration.vignetteBlendMode;\n }\n /**\n * Sets the vignette blend mode allowing different kind of effect.\n */\n set vignetteBlendMode(value) {\n this.imageProcessingConfiguration.vignetteBlendMode = value;\n }\n /**\n * Gets whether the vignette effect is enabled.\n */\n get vignetteEnabled() {\n return this.imageProcessingConfiguration.vignetteEnabled;\n }\n /**\n * Sets whether the vignette effect is enabled.\n */\n set vignetteEnabled(value) {\n this.imageProcessingConfiguration.vignetteEnabled = value;\n }\n /**\n * Gets intensity of the dithering effect.\n */\n get ditheringIntensity() {\n return this.imageProcessingConfiguration.ditheringIntensity;\n }\n /**\n * Sets intensity of the dithering effect.\n */\n set ditheringIntensity(value) {\n this.imageProcessingConfiguration.ditheringIntensity = value;\n }\n /**\n * Gets whether the dithering effect is enabled.\n */\n get ditheringEnabled() {\n return this.imageProcessingConfiguration.ditheringEnabled;\n }\n /**\n * Sets whether the dithering effect is enabled.\n */\n set ditheringEnabled(value) {\n this.imageProcessingConfiguration.ditheringEnabled = value;\n }\n /**\n * Gets whether the input of the processing is in Gamma or Linear Space.\n */\n get fromLinearSpace() {\n return this._fromLinearSpace;\n }\n /**\n * Sets whether the input of the processing is in Gamma or Linear Space.\n */\n set fromLinearSpace(value) {\n if (this._fromLinearSpace === value) {\n return;\n }\n this._fromLinearSpace = value;\n this._updateParameters();\n }\n constructor(name, options, camera = null, samplingMode, engine, reusable, textureType = 0, imageProcessingConfiguration) {\n super(name, \"imageProcessing\", [], [], options, camera, samplingMode, engine, reusable, null, textureType, \"postprocess\", null, true);\n this._fromLinearSpace = true;\n /**\n * Defines cache preventing GC.\n */\n this._defines = {\n IMAGEPROCESSING: false,\n VIGNETTE: false,\n VIGNETTEBLENDMODEMULTIPLY: false,\n VIGNETTEBLENDMODEOPAQUE: false,\n TONEMAPPING: false,\n TONEMAPPING_ACES: false,\n CONTRAST: false,\n COLORCURVES: false,\n COLORGRADING: false,\n COLORGRADING3D: false,\n FROMLINEARSPACE: false,\n SAMPLER3DGREENDEPTH: false,\n SAMPLER3DBGRMAP: false,\n DITHER: false,\n IMAGEPROCESSINGPOSTPROCESS: false,\n EXPOSURE: false,\n SKIPFINALCOLORCLAMP: false,\n };\n // Setup the configuration as forced by the constructor. This would then not force the\n // scene materials output in linear space and let untouched the default forward pass.\n if (imageProcessingConfiguration) {\n imageProcessingConfiguration.applyByPostProcess = true;\n this._attachImageProcessingConfiguration(imageProcessingConfiguration, true);\n // This will cause the shader to be compiled\n this._updateParameters();\n }\n // Setup the default processing configuration to the scene.\n else {\n this._attachImageProcessingConfiguration(null, true);\n this.imageProcessingConfiguration.applyByPostProcess = true;\n }\n this.onApply = (effect) => {\n this.imageProcessingConfiguration.bind(effect, this.aspectRatio);\n };\n }\n /**\n * \"ImageProcessingPostProcess\"\n * @returns \"ImageProcessingPostProcess\"\n */\n getClassName() {\n return \"ImageProcessingPostProcess\";\n }\n /**\n * @internal\n */\n _updateParameters() {\n this._defines.FROMLINEARSPACE = this._fromLinearSpace;\n this.imageProcessingConfiguration.prepareDefines(this._defines, true);\n let defines = \"\";\n for (const define in this._defines) {\n if (this._defines[define]) {\n defines += `#define ${define};\\n`;\n }\n }\n const samplers = [\"textureSampler\"];\n const uniforms = [\"scale\"];\n if (ImageProcessingConfiguration) {\n ImageProcessingConfiguration.PrepareSamplers(samplers, this._defines);\n ImageProcessingConfiguration.PrepareUniforms(uniforms, this._defines);\n }\n this.updateEffect(defines, uniforms, samplers);\n }\n dispose(camera) {\n super.dispose(camera);\n if (this._imageProcessingConfiguration && this._imageProcessingObserver) {\n this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver);\n }\n if (this._imageProcessingConfiguration) {\n this.imageProcessingConfiguration.applyByPostProcess = false;\n }\n }\n}\n__decorate([\n serialize()\n], ImageProcessingPostProcess.prototype, \"_fromLinearSpace\", void 0);\n//# sourceMappingURL=imageProcessingPostProcess.js.map","// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore.js\";\nconst name = \"chromaticAberrationPixelShader\";\nconst shader = `uniform sampler2D textureSampler; \nuniform float chromatic_aberration;uniform float radialIntensity;uniform vec2 direction;uniform vec2 centerPosition;uniform float screen_width;uniform float screen_height;varying vec2 vUV;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{vec2 centered_screen_pos=vec2(vUV.x-centerPosition.x,vUV.y-centerPosition.y);vec2 directionOfEffect=direction;if(directionOfEffect.x==0. && directionOfEffect.y==0.){directionOfEffect=normalize(centered_screen_pos);}\nfloat radius2=centered_screen_pos.x*centered_screen_pos.x\n+ centered_screen_pos.y*centered_screen_pos.y;float radius=sqrt(radius2);vec4 original=texture2D(textureSampler,vUV);vec3 ref_indices=vec3(-0.3,0.0,0.3);float ref_shiftX=chromatic_aberration*pow(radius,radialIntensity)*directionOfEffect.x/screen_width;float ref_shiftY=chromatic_aberration*pow(radius,radialIntensity)*directionOfEffect.y/screen_height;vec2 ref_coords_r=vec2(vUV.x+ref_indices.r*ref_shiftX,vUV.y+ref_indices.r*ref_shiftY*0.5);vec2 ref_coords_g=vec2(vUV.x+ref_indices.g*ref_shiftX,vUV.y+ref_indices.g*ref_shiftY*0.5);vec2 ref_coords_b=vec2(vUV.x+ref_indices.b*ref_shiftX,vUV.y+ref_indices.b*ref_shiftY*0.5);original.r=texture2D(textureSampler,ref_coords_r).r;original.g=texture2D(textureSampler,ref_coords_g).g;original.b=texture2D(textureSampler,ref_coords_b).b;original.a=clamp(texture2D(textureSampler,ref_coords_r).a+texture2D(textureSampler,ref_coords_g).a+texture2D(textureSampler,ref_coords_b).a,0.,1.);gl_FragColor=original;}`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @internal */\nexport const chromaticAberrationPixelShader = { name, shader };\n//# sourceMappingURL=chromaticAberration.fragment.js.map","import { __decorate } from \"../tslib.es6.js\";\nimport { Vector2 } from \"../Maths/math.vector.js\";\nimport { PostProcess } from \"./postProcess.js\";\n\nimport \"../Shaders/chromaticAberration.fragment.js\";\nimport { RegisterClass } from \"../Misc/typeStore.js\";\nimport { serialize, SerializationHelper } from \"../Misc/decorators.js\";\n/**\n * The ChromaticAberrationPostProcess separates the rgb channels in an image to produce chromatic distortion around the edges of the screen\n */\nexport class ChromaticAberrationPostProcess extends PostProcess {\n /**\n * Gets a string identifying the name of the class\n * @returns \"ChromaticAberrationPostProcess\" string\n */\n getClassName() {\n return \"ChromaticAberrationPostProcess\";\n }\n /**\n * Creates a new instance ChromaticAberrationPostProcess\n * @param name The name of the effect.\n * @param screenWidth The width of the screen to apply the effect on.\n * @param screenHeight The height of the screen to apply the effect on.\n * @param options The required width/height ratio to downsize to before computing the render pass.\n * @param camera The camera to apply the render pass to.\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\n * @param engine The engine which the post process will be applied. (default: current engine)\n * @param reusable If the post process can be reused on the same frame. (default: false)\n * @param textureType Type of textures used when performing the post process. (default: 0)\n * @param blockCompilation If compilation of the shader should not be done in the constructor. The updateEffect method can be used to compile the shader at a later time. (default: false)\n */\n constructor(name, screenWidth, screenHeight, options, camera, samplingMode, engine, reusable, textureType = 0, blockCompilation = false) {\n super(name, \"chromaticAberration\", [\"chromatic_aberration\", \"screen_width\", \"screen_height\", \"direction\", \"radialIntensity\", \"centerPosition\"], [], options, camera, samplingMode, engine, reusable, null, textureType, undefined, null, blockCompilation);\n /**\n * The amount of separation of rgb channels (default: 30)\n */\n this.aberrationAmount = 30;\n /**\n * The amount the effect will increase for pixels closer to the edge of the screen. (default: 0)\n */\n this.radialIntensity = 0;\n /**\n * The normalized direction in which the rgb channels should be separated. If set to 0,0 radial direction will be used. (default: Vector2(0.707,0.707))\n */\n this.direction = new Vector2(0.707, 0.707);\n /**\n * The center position where the radialIntensity should be around. [0.5,0.5 is center of screen, 1,1 is top right corner] (default: Vector2(0.5 ,0.5))\n */\n this.centerPosition = new Vector2(0.5, 0.5);\n this.screenWidth = screenWidth;\n this.screenHeight = screenHeight;\n this.onApplyObservable.add((effect) => {\n effect.setFloat(\"chromatic_aberration\", this.aberrationAmount);\n effect.setFloat(\"screen_width\", screenWidth);\n effect.setFloat(\"screen_height\", screenHeight);\n effect.setFloat(\"radialIntensity\", this.radialIntensity);\n effect.setFloat2(\"direction\", this.direction.x, this.direction.y);\n effect.setFloat2(\"centerPosition\", this.centerPosition.x, this.centerPosition.y);\n });\n }\n /**\n * @internal\n */\n static _Parse(parsedPostProcess, targetCamera, scene, rootUrl) {\n return SerializationHelper.Parse(() => {\n return new ChromaticAberrationPostProcess(parsedPostProcess.name, parsedPostProcess.screenWidth, parsedPostProcess.screenHeight, parsedPostProcess.options, targetCamera, parsedPostProcess.renderTargetSamplingMode, scene.getEngine(), parsedPostProcess.reusable, parsedPostProcess.textureType, false);\n }, parsedPostProcess, scene, rootUrl);\n }\n}\n__decorate([\n serialize()\n], ChromaticAberrationPostProcess.prototype, \"aberrationAmount\", void 0);\n__decorate([\n serialize()\n], ChromaticAberrationPostProcess.prototype, \"radialIntensity\", void 0);\n__decorate([\n serialize()\n], ChromaticAberrationPostProcess.prototype, \"direction\", void 0);\n__decorate([\n serialize()\n], ChromaticAberrationPostProcess.prototype, \"centerPosition\", void 0);\n__decorate([\n serialize()\n], ChromaticAberrationPostProcess.prototype, \"screenWidth\", void 0);\n__decorate([\n serialize()\n], ChromaticAberrationPostProcess.prototype, \"screenHeight\", void 0);\nRegisterClass(\"BABYLON.ChromaticAberrationPostProcess\", ChromaticAberrationPostProcess);\n//# sourceMappingURL=chromaticAberrationPostProcess.js.map","// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore.js\";\nimport \"./ShadersInclude/helperFunctions.js\";\nconst name = \"grainPixelShader\";\nconst shader = `#include\nuniform sampler2D textureSampler; \nuniform float intensity;uniform float animatedSeed;varying vec2 vUV;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{gl_FragColor=texture2D(textureSampler,vUV);vec2 seed=vUV*(animatedSeed);float grain=dither(seed,intensity);float lum=getLuminance(gl_FragColor.rgb);float grainAmount=(cos(-PI+(lum*PI*2.))+1.)/2.;gl_FragColor.rgb+=grain*grainAmount;gl_FragColor.rgb=max(gl_FragColor.rgb,0.0);}`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @internal */\nexport const grainPixelShader = { name, shader };\n//# sourceMappingURL=grain.fragment.js.map","import { __decorate } from \"../tslib.es6.js\";\nimport { PostProcess } from \"./postProcess.js\";\n\nimport \"../Shaders/grain.fragment.js\";\nimport { RegisterClass } from \"../Misc/typeStore.js\";\nimport { serialize, SerializationHelper } from \"../Misc/decorators.js\";\n/**\n * The GrainPostProcess adds noise to the image at mid luminance levels\n */\nexport class GrainPostProcess extends PostProcess {\n /**\n * Gets a string identifying the name of the class\n * @returns \"GrainPostProcess\" string\n */\n getClassName() {\n return \"GrainPostProcess\";\n }\n /**\n * Creates a new instance of @see GrainPostProcess\n * @param name The name of the effect.\n * @param options The required width/height ratio to downsize to before computing the render pass.\n * @param camera The camera to apply the render pass to.\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\n * @param engine The engine which the post process will be applied. (default: current engine)\n * @param reusable If the post process can be reused on the same frame. (default: false)\n * @param textureType Type of textures used when performing the post process. (default: 0)\n * @param blockCompilation If compilation of the shader should not be done in the constructor. The updateEffect method can be used to compile the shader at a later time. (default: false)\n */\n constructor(name, options, camera, samplingMode, engine, reusable, textureType = 0, blockCompilation = false) {\n super(name, \"grain\", [\"intensity\", \"animatedSeed\"], [], options, camera, samplingMode, engine, reusable, null, textureType, undefined, null, blockCompilation);\n /**\n * The intensity of the grain added (default: 30)\n */\n this.intensity = 30;\n /**\n * If the grain should be randomized on every frame\n */\n this.animated = false;\n this.onApplyObservable.add((effect) => {\n effect.setFloat(\"intensity\", this.intensity);\n effect.setFloat(\"animatedSeed\", this.animated ? Math.random() + 1 : 1);\n });\n }\n /**\n * @internal\n */\n static _Parse(parsedPostProcess, targetCamera, scene, rootUrl) {\n return SerializationHelper.Parse(() => {\n return new GrainPostProcess(parsedPostProcess.name, parsedPostProcess.options, targetCamera, parsedPostProcess.renderTargetSamplingMode, scene.getEngine(), parsedPostProcess.reusable);\n }, parsedPostProcess, scene, rootUrl);\n }\n}\n__decorate([\n serialize()\n], GrainPostProcess.prototype, \"intensity\", void 0);\n__decorate([\n serialize()\n], GrainPostProcess.prototype, \"animated\", void 0);\nRegisterClass(\"BABYLON.GrainPostProcess\", GrainPostProcess);\n//# sourceMappingURL=grainPostProcess.js.map","// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore.js\";\nconst name = \"fxaaPixelShader\";\nconst shader = `#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)\n#define TEXTUREFUNC(s,c,l) texture2DLodEXT(s,c,l)\n#else\n#define TEXTUREFUNC(s,c,b) texture2D(s,c,b)\n#endif\nuniform sampler2D textureSampler;uniform vec2 texelSize;varying vec2 vUV;varying vec2 sampleCoordS;varying vec2 sampleCoordE;varying vec2 sampleCoordN;varying vec2 sampleCoordW;varying vec2 sampleCoordNW;varying vec2 sampleCoordSE;varying vec2 sampleCoordNE;varying vec2 sampleCoordSW;const float fxaaQualitySubpix=1.0;const float fxaaQualityEdgeThreshold=0.166;const float fxaaQualityEdgeThresholdMin=0.0833;const vec3 kLumaCoefficients=vec3(0.2126,0.7152,0.0722);\n#define FxaaLuma(rgba) dot(rgba.rgb,kLumaCoefficients)\nvoid main(){vec2 posM;posM.x=vUV.x;posM.y=vUV.y;vec4 rgbyM=TEXTUREFUNC(textureSampler,vUV,0.0);float lumaM=FxaaLuma(rgbyM);float lumaS=FxaaLuma(TEXTUREFUNC(textureSampler,sampleCoordS,0.0));float lumaE=FxaaLuma(TEXTUREFUNC(textureSampler,sampleCoordE,0.0));float lumaN=FxaaLuma(TEXTUREFUNC(textureSampler,sampleCoordN,0.0));float lumaW=FxaaLuma(TEXTUREFUNC(textureSampler,sampleCoordW,0.0));float maxSM=max(lumaS,lumaM);float minSM=min(lumaS,lumaM);float maxESM=max(lumaE,maxSM);float minESM=min(lumaE,minSM);float maxWN=max(lumaN,lumaW);float minWN=min(lumaN,lumaW);float rangeMax=max(maxWN,maxESM);float rangeMin=min(minWN,minESM);float rangeMaxScaled=rangeMax*fxaaQualityEdgeThreshold;float range=rangeMax-rangeMin;float rangeMaxClamped=max(fxaaQualityEdgeThresholdMin,rangeMaxScaled);\n#ifndef MALI\nif(range=edgeVert;float subpixA=subpixNSWE*2.0+subpixNWSWNESE;if (!horzSpan)\n{lumaN=lumaW;}\nif (!horzSpan) \n{lumaS=lumaE;}\nif (horzSpan) \n{lengthSign=texelSize.y;}\nfloat subpixB=(subpixA*(1.0/12.0))-lumaM;float gradientN=lumaN-lumaM;float gradientS=lumaS-lumaM;float lumaNN=lumaN+lumaM;float lumaSS=lumaS+lumaM;bool pairN=abs(gradientN)>=abs(gradientS);float gradient=max(abs(gradientN),abs(gradientS));if (pairN)\n{lengthSign=-lengthSign;}\nfloat subpixC=clamp(abs(subpixB)*subpixRcpRange,0.0,1.0);vec2 posB;posB.x=posM.x;posB.y=posM.y;vec2 offNP;offNP.x=(!horzSpan) ? 0.0 : texelSize.x;offNP.y=(horzSpan) ? 0.0 : texelSize.y;if (!horzSpan) \n{posB.x+=lengthSign*0.5;}\nif (horzSpan)\n{posB.y+=lengthSign*0.5;}\nvec2 posN;posN.x=posB.x-offNP.x*1.5;posN.y=posB.y-offNP.y*1.5;vec2 posP;posP.x=posB.x+offNP.x*1.5;posP.y=posB.y+offNP.y*1.5;float subpixD=((-2.0)*subpixC)+3.0;float lumaEndN=FxaaLuma(TEXTUREFUNC(textureSampler,posN,0.0));float subpixE=subpixC*subpixC;float lumaEndP=FxaaLuma(TEXTUREFUNC(textureSampler,posP,0.0));if (!pairN) \n{lumaNN=lumaSS;}\nfloat gradientScaled=gradient*1.0/4.0;float lumaMM=lumaM-lumaNN*0.5;float subpixF=subpixD*subpixE;bool lumaMLTZero=lumaMM<0.0;lumaEndN-=lumaNN*0.5;lumaEndP-=lumaNN*0.5;bool doneN=abs(lumaEndN)>=gradientScaled;bool doneP=abs(lumaEndP)>=gradientScaled;if (!doneN) \n{posN.x-=offNP.x*3.0;}\nif (!doneN) \n{posN.y-=offNP.y*3.0;}\nbool doneNP=(!doneN) || (!doneP);if (!doneP) \n{posP.x+=offNP.x*3.0;}\nif (!doneP)\n{posP.y+=offNP.y*3.0;}\nif (doneNP)\n{if (!doneN) lumaEndN=FxaaLuma(TEXTUREFUNC(textureSampler,posN.xy,0.0));if (!doneP) lumaEndP=FxaaLuma(TEXTUREFUNC(textureSampler,posP.xy,0.0));if (!doneN) lumaEndN=lumaEndN-lumaNN*0.5;if (!doneP) lumaEndP=lumaEndP-lumaNN*0.5;doneN=abs(lumaEndN)>=gradientScaled;doneP=abs(lumaEndP)>=gradientScaled;if (!doneN) posN.x-=offNP.x*12.0;if (!doneN) posN.y-=offNP.y*12.0;doneNP=(!doneN) || (!doneP);if (!doneP) posP.x+=offNP.x*12.0;if (!doneP) posP.y+=offNP.y*12.0;}\nfloat dstN=posM.x-posN.x;float dstP=posP.x-posM.x;if (!horzSpan)\n{dstN=posM.y-posN.y;}\nif (!horzSpan) \n{dstP=posP.y-posM.y;}\nbool goodSpanN=(lumaEndN<0.0) != lumaMLTZero;float spanLength=(dstP+dstN);bool goodSpanP=(lumaEndP<0.0) != lumaMLTZero;float spanLengthRcp=1.0/spanLength;bool directionN=dstN {\n const texelSize = this.texelSize;\n effect.setFloat2(\"texelSize\", texelSize.x, texelSize.y);\n });\n }\n _getDefines() {\n const engine = this.getEngine();\n if (!engine) {\n return null;\n }\n const glInfo = engine.getGlInfo();\n if (glInfo && glInfo.renderer && glInfo.renderer.toLowerCase().indexOf(\"mali\") > -1) {\n return \"#define MALI 1\\n\";\n }\n return null;\n }\n /**\n * @internal\n */\n static _Parse(parsedPostProcess, targetCamera, scene, rootUrl) {\n return SerializationHelper.Parse(() => {\n return new FxaaPostProcess(parsedPostProcess.name, parsedPostProcess.options, targetCamera, parsedPostProcess.renderTargetSamplingMode, scene.getEngine(), parsedPostProcess.reusable);\n }, parsedPostProcess, scene, rootUrl);\n }\n}\nRegisterClass(\"BABYLON.FxaaPostProcess\", FxaaPostProcess);\n//# sourceMappingURL=fxaaPostProcess.js.map","import { __decorate } from \"../../tslib.es6.js\";\nimport { Tools } from \"../../Misc/tools.js\";\nimport { serialize } from \"../../Misc/decorators.js\";\n/**\n * PostProcessRenderPipeline\n * @see https://doc.babylonjs.com/features/featuresDeepDive/postProcesses/postProcessRenderPipeline\n */\nexport class PostProcessRenderPipeline {\n /**\n * Gets pipeline name\n */\n get name() {\n return this._name;\n }\n /** Gets the list of attached cameras */\n get cameras() {\n return this._cameras;\n }\n /**\n * Initializes a PostProcessRenderPipeline\n * @param _engine engine to add the pipeline to\n * @param name name of the pipeline\n */\n constructor(_engine, name) {\n this._engine = _engine;\n this._name = name;\n this._renderEffects = {};\n this._renderEffectsForIsolatedPass = new Array();\n this._cameras = [];\n }\n /**\n * Gets the class name\n * @returns \"PostProcessRenderPipeline\"\n */\n getClassName() {\n return \"PostProcessRenderPipeline\";\n }\n /**\n * If all the render effects in the pipeline are supported\n */\n get isSupported() {\n for (const renderEffectName in this._renderEffects) {\n if (Object.prototype.hasOwnProperty.call(this._renderEffects, renderEffectName)) {\n if (!this._renderEffects[renderEffectName].isSupported) {\n return false;\n }\n }\n }\n return true;\n }\n /**\n * Adds an effect to the pipeline\n * @param renderEffect the effect to add\n */\n addEffect(renderEffect) {\n this._renderEffects[renderEffect._name] = renderEffect;\n }\n // private\n /** @internal */\n _rebuild() { }\n /**\n * @internal\n */\n _enableEffect(renderEffectName, cameras) {\n const renderEffects = this._renderEffects[renderEffectName];\n if (!renderEffects) {\n return;\n }\n renderEffects._enable(Tools.MakeArray(cameras || this._cameras));\n }\n /**\n * @internal\n */\n _disableEffect(renderEffectName, cameras) {\n const renderEffects = this._renderEffects[renderEffectName];\n if (!renderEffects) {\n return;\n }\n renderEffects._disable(Tools.MakeArray(cameras || this._cameras));\n }\n /**\n * @internal\n */\n _attachCameras(cameras, unique) {\n const cams = Tools.MakeArray(cameras || this._cameras);\n if (!cams) {\n return;\n }\n const indicesToDelete = [];\n let i;\n for (i = 0; i < cams.length; i++) {\n const camera = cams[i];\n if (!camera) {\n continue;\n }\n if (this._cameras.indexOf(camera) === -1) {\n this._cameras.push(camera);\n }\n else if (unique) {\n indicesToDelete.push(i);\n }\n }\n for (i = 0; i < indicesToDelete.length; i++) {\n cams.splice(indicesToDelete[i], 1);\n }\n for (const renderEffectName in this._renderEffects) {\n if (Object.prototype.hasOwnProperty.call(this._renderEffects, renderEffectName)) {\n this._renderEffects[renderEffectName]._attachCameras(cams);\n }\n }\n }\n /**\n * @internal\n */\n _detachCameras(cameras) {\n const cams = Tools.MakeArray(cameras || this._cameras);\n if (!cams) {\n return;\n }\n for (const renderEffectName in this._renderEffects) {\n if (Object.prototype.hasOwnProperty.call(this._renderEffects, renderEffectName)) {\n this._renderEffects[renderEffectName]._detachCameras(cams);\n }\n }\n for (let i = 0; i < cams.length; i++) {\n this._cameras.splice(this._cameras.indexOf(cams[i]), 1);\n }\n }\n /** @internal */\n _update() {\n for (const renderEffectName in this._renderEffects) {\n if (Object.prototype.hasOwnProperty.call(this._renderEffects, renderEffectName)) {\n this._renderEffects[renderEffectName]._update();\n }\n }\n for (let i = 0; i < this._cameras.length; i++) {\n if (!this._cameras[i]) {\n continue;\n }\n const cameraName = this._cameras[i].name;\n if (this._renderEffectsForIsolatedPass[cameraName]) {\n this._renderEffectsForIsolatedPass[cameraName]._update();\n }\n }\n }\n /** @internal */\n _reset() {\n this._renderEffects = {};\n this._renderEffectsForIsolatedPass = new Array();\n }\n _enableMSAAOnFirstPostProcess(sampleCount) {\n if (!this._engine._features.supportMSAA) {\n return false;\n }\n // Set samples of the very first post process to 4 to enable native anti-aliasing in browsers that support webGL 2.0 (See: https://github.com/BabylonJS/Babylon.js/issues/3754)\n const effectKeys = Object.keys(this._renderEffects);\n if (effectKeys.length > 0) {\n const postProcesses = this._renderEffects[effectKeys[0]].getPostProcesses();\n if (postProcesses) {\n postProcesses[0].samples = sampleCount;\n }\n }\n return true;\n }\n /**\n * Sets the required values to the prepass renderer.\n * @param prePassRenderer defines the prepass renderer to setup.\n * @returns true if the pre pass is needed.\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n setPrePassRenderer(prePassRenderer) {\n // Do Nothing by default\n return false;\n }\n /**\n * Disposes of the pipeline\n */\n dispose() {\n // Must be implemented by children\n }\n}\n__decorate([\n serialize()\n], PostProcessRenderPipeline.prototype, \"_name\", void 0);\n//# sourceMappingURL=postProcessRenderPipeline.js.map","import { Tools } from \"../../Misc/tools.js\";\n/**\n * This represents a set of one or more post processes in Babylon.\n * A post process can be used to apply a shader to a texture after it is rendered.\n * @example https://doc.babylonjs.com/features/featuresDeepDive/postProcesses/postProcessRenderPipeline\n */\nexport class PostProcessRenderEffect {\n /**\n * Instantiates a post process render effect.\n * A post process can be used to apply a shader to a texture after it is rendered.\n * @param engine The engine the effect is tied to\n * @param name The name of the effect\n * @param getPostProcesses A function that returns a set of post processes which the effect will run in order to be run.\n * @param singleInstance False if this post process can be run on multiple cameras. (default: true)\n */\n constructor(engine, name, getPostProcesses, singleInstance) {\n this._name = name;\n this._singleInstance = singleInstance || true;\n this._getPostProcesses = getPostProcesses;\n this._cameras = {};\n this._indicesForCamera = {};\n this._postProcesses = {};\n }\n /**\n * Checks if all the post processes in the effect are supported.\n */\n get isSupported() {\n for (const index in this._postProcesses) {\n if (Object.prototype.hasOwnProperty.call(this._postProcesses, index)) {\n const pps = this._postProcesses[index];\n for (let ppIndex = 0; ppIndex < pps.length; ppIndex++) {\n if (!pps[ppIndex].isSupported) {\n return false;\n }\n }\n }\n }\n return true;\n }\n /**\n * Updates the current state of the effect\n * @internal\n */\n _update() { }\n /**\n * Attaches the effect on cameras\n * @param cameras The camera to attach to.\n * @internal\n */\n _attachCameras(cameras) {\n let cameraKey;\n const cams = Tools.MakeArray(cameras || this._cameras);\n if (!cams) {\n return;\n }\n for (let i = 0; i < cams.length; i++) {\n const camera = cams[i];\n if (!camera) {\n continue;\n }\n const cameraName = camera.name;\n if (this._singleInstance) {\n cameraKey = 0;\n }\n else {\n cameraKey = cameraName;\n }\n if (!this._postProcesses[cameraKey]) {\n const postProcess = this._getPostProcesses();\n if (postProcess) {\n this._postProcesses[cameraKey] = Array.isArray(postProcess) ? postProcess : [postProcess];\n }\n }\n if (!this._indicesForCamera[cameraName]) {\n this._indicesForCamera[cameraName] = [];\n }\n this._postProcesses[cameraKey].forEach((postProcess) => {\n const index = camera.attachPostProcess(postProcess);\n this._indicesForCamera[cameraName].push(index);\n });\n if (!this._cameras[cameraName]) {\n this._cameras[cameraName] = camera;\n }\n }\n }\n /**\n * Detaches the effect on cameras\n * @param cameras The camera to detach from.\n * @internal\n */\n _detachCameras(cameras) {\n const cams = Tools.MakeArray(cameras || this._cameras);\n if (!cams) {\n return;\n }\n for (let i = 0; i < cams.length; i++) {\n const camera = cams[i];\n const cameraName = camera.name;\n const postProcesses = this._postProcesses[this._singleInstance ? 0 : cameraName];\n if (postProcesses) {\n postProcesses.forEach((postProcess) => {\n camera.detachPostProcess(postProcess);\n });\n }\n if (this._cameras[cameraName]) {\n this._cameras[cameraName] = null;\n }\n delete this._indicesForCamera[cameraName];\n }\n }\n /**\n * Enables the effect on given cameras\n * @param cameras The camera to enable.\n * @internal\n */\n _enable(cameras) {\n const cams = Tools.MakeArray(cameras || this._cameras);\n if (!cams) {\n return;\n }\n for (let i = 0; i < cams.length; i++) {\n const camera = cams[i];\n const cameraName = camera.name;\n const cameraKey = this._singleInstance ? 0 : cameraName;\n for (let j = 0; j < this._indicesForCamera[cameraName].length; j++) {\n const index = this._indicesForCamera[cameraName][j];\n const postProcess = camera._postProcesses[index];\n if (postProcess === undefined || postProcess === null) {\n cams[i].attachPostProcess(this._postProcesses[cameraKey][j], index);\n }\n }\n }\n }\n /**\n * Disables the effect on the given cameras\n * @param cameras The camera to disable.\n * @internal\n */\n _disable(cameras) {\n const cams = Tools.MakeArray(cameras || this._cameras);\n if (!cams) {\n return;\n }\n for (let i = 0; i < cams.length; i++) {\n const camera = cams[i];\n const cameraName = camera.name;\n this._postProcesses[this._singleInstance ? 0 : cameraName].forEach((postProcess) => {\n camera.detachPostProcess(postProcess);\n });\n }\n }\n /**\n * Gets a list of the post processes contained in the effect.\n * @param camera The camera to get the post processes on.\n * @returns The list of the post processes in the effect.\n */\n getPostProcesses(camera) {\n if (this._singleInstance) {\n return this._postProcesses[0];\n }\n else {\n if (!camera) {\n return null;\n }\n return this._postProcesses[camera.name];\n }\n }\n}\n//# sourceMappingURL=postProcessRenderEffect.js.map","// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore.js\";\nconst name = \"circleOfConfusionPixelShader\";\nconst shader = `uniform sampler2D depthSampler;varying vec2 vUV;uniform vec2 cameraMinMaxZ;uniform float focusDistance;uniform float cocPrecalculation;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{float depth=texture2D(depthSampler,vUV).r;\n#define CUSTOM_COC_DEPTH\nfloat pixelDistance=(cameraMinMaxZ.x+cameraMinMaxZ.y*depth)*1000.0; \n#define CUSTOM_COC_PIXELDISTANCE\nfloat coc=abs(cocPrecalculation*((focusDistance-pixelDistance)/pixelDistance));coc=clamp(coc,0.0,1.0);gl_FragColor=vec4(coc,coc,coc,1.0);}\n`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @internal */\nexport const circleOfConfusionPixelShader = { name, shader };\n//# sourceMappingURL=circleOfConfusion.fragment.js.map","import { __decorate } from \"../tslib.es6.js\";\nimport { PostProcess } from \"./postProcess.js\";\nimport { Logger } from \"../Misc/logger.js\";\n\nimport \"../Shaders/circleOfConfusion.fragment.js\";\nimport { RegisterClass } from \"../Misc/typeStore.js\";\nimport { serialize } from \"../Misc/decorators.js\";\n/**\n * The CircleOfConfusionPostProcess computes the circle of confusion value for each pixel given required lens parameters. See https://en.wikipedia.org/wiki/Circle_of_confusion\n */\nexport class CircleOfConfusionPostProcess extends PostProcess {\n /**\n * Gets a string identifying the name of the class\n * @returns \"CircleOfConfusionPostProcess\" string\n */\n getClassName() {\n return \"CircleOfConfusionPostProcess\";\n }\n /**\n * Creates a new instance CircleOfConfusionPostProcess\n * @param name The name of the effect.\n * @param depthTexture The depth texture of the scene to compute the circle of confusion. This must be set in order for this to function but may be set after initialization if needed.\n * @param options The required width/height ratio to downsize to before computing the render pass.\n * @param camera The camera to apply the render pass to.\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\n * @param engine The engine which the post process will be applied. (default: current engine)\n * @param reusable If the post process can be reused on the same frame. (default: false)\n * @param textureType Type of textures used when performing the post process. (default: 0)\n * @param blockCompilation If compilation of the shader should not be done in the constructor. The updateEffect method can be used to compile the shader at a later time. (default: false)\n */\n constructor(name, depthTexture, options, camera, samplingMode, engine, reusable, textureType = 0, blockCompilation = false) {\n super(name, \"circleOfConfusion\", [\"cameraMinMaxZ\", \"focusDistance\", \"cocPrecalculation\"], [\"depthSampler\"], options, camera, samplingMode, engine, reusable, null, textureType, undefined, null, blockCompilation);\n /**\n * Max lens size in scene units/1000 (eg. millimeter). Standard cameras are 50mm. (default: 50) The diameter of the resulting aperture can be computed by lensSize/fStop.\n */\n this.lensSize = 50;\n /**\n * F-Stop of the effect's camera. The diameter of the resulting aperture can be computed by lensSize/fStop. (default: 1.4)\n */\n this.fStop = 1.4;\n /**\n * Distance away from the camera to focus on in scene units/1000 (eg. millimeter). (default: 2000)\n */\n this.focusDistance = 2000;\n /**\n * Focal length of the effect's camera in scene units/1000 (eg. millimeter). (default: 50)\n */\n this.focalLength = 50;\n this._depthTexture = null;\n this._depthTexture = depthTexture;\n this.onApplyObservable.add((effect) => {\n if (!this._depthTexture) {\n Logger.Warn(\"No depth texture set on CircleOfConfusionPostProcess\");\n return;\n }\n effect.setTexture(\"depthSampler\", this._depthTexture);\n // Circle of confusion calculation, See https://developer.nvidia.com/gpugems/GPUGems/gpugems_ch23.html\n const aperture = this.lensSize / this.fStop;\n const cocPrecalculation = (aperture * this.focalLength) / (this.focusDistance - this.focalLength); // * ((this.focusDistance - pixelDistance)/pixelDistance) [This part is done in shader]\n effect.setFloat(\"focusDistance\", this.focusDistance);\n effect.setFloat(\"cocPrecalculation\", cocPrecalculation);\n const activeCamera = this._depthTexture.activeCamera;\n effect.setFloat2(\"cameraMinMaxZ\", activeCamera.minZ, activeCamera.maxZ - activeCamera.minZ);\n });\n }\n /**\n * Depth texture to be used to compute the circle of confusion. This must be set here or in the constructor in order for the post process to function.\n */\n set depthTexture(value) {\n this._depthTexture = value;\n }\n}\n__decorate([\n serialize()\n], CircleOfConfusionPostProcess.prototype, \"lensSize\", void 0);\n__decorate([\n serialize()\n], CircleOfConfusionPostProcess.prototype, \"fStop\", void 0);\n__decorate([\n serialize()\n], CircleOfConfusionPostProcess.prototype, \"focusDistance\", void 0);\n__decorate([\n serialize()\n], CircleOfConfusionPostProcess.prototype, \"focalLength\", void 0);\nRegisterClass(\"BABYLON.CircleOfConfusionPostProcess\", CircleOfConfusionPostProcess);\n//# sourceMappingURL=circleOfConfusionPostProcess.js.map","import { __decorate } from \"../tslib.es6.js\";\nimport { Texture } from \"../Materials/Textures/texture.js\";\nimport { BlurPostProcess } from \"./blurPostProcess.js\";\n\nimport { RegisterClass } from \"../Misc/typeStore.js\";\nimport { serialize } from \"../Misc/decorators.js\";\n/**\n * The DepthOfFieldBlurPostProcess applied a blur in a give direction.\n * This blur differs from the standard BlurPostProcess as it attempts to avoid blurring pixels\n * based on samples that have a large difference in distance than the center pixel.\n * See section 2.6.2 http://fileadmin.cs.lth.se/cs/education/edan35/lectures/12dof.pdf\n */\nexport class DepthOfFieldBlurPostProcess extends BlurPostProcess {\n /**\n * Gets a string identifying the name of the class\n * @returns \"DepthOfFieldBlurPostProcess\" string\n */\n getClassName() {\n return \"DepthOfFieldBlurPostProcess\";\n }\n /**\n * Creates a new instance DepthOfFieldBlurPostProcess\n * @param name The name of the effect.\n * @param scene The scene the effect belongs to.\n * @param direction The direction the blur should be applied.\n * @param kernel The size of the kernel used to blur.\n * @param options The required width/height ratio to downsize to before computing the render pass.\n * @param camera The camera to apply the render pass to.\n * @param circleOfConfusion The circle of confusion + depth map to be used to avoid blurring across edges\n * @param imageToBlur The image to apply the blur to (default: Current rendered frame)\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\n * @param engine The engine which the post process will be applied. (default: current engine)\n * @param reusable If the post process can be reused on the same frame. (default: false)\n * @param textureType Type of textures used when performing the post process. (default: 0)\n * @param blockCompilation If compilation of the shader should not be done in the constructor. The updateEffect method can be used to compile the shader at a later time. (default: false)\n * @param textureFormat Format of textures used when performing the post process. (default: TEXTUREFORMAT_RGBA)\n */\n constructor(name, scene, direction, kernel, options, camera, circleOfConfusion, imageToBlur = null, samplingMode = Texture.BILINEAR_SAMPLINGMODE, engine, reusable, textureType = 0, blockCompilation = false, textureFormat = 5) {\n super(name, direction, kernel, options, camera, \n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n (samplingMode = 2), engine, reusable, textureType, `#define DOF 1\\n`, blockCompilation, textureFormat);\n this.direction = direction;\n this.externalTextureSamplerBinding = !!imageToBlur;\n this.onApplyObservable.add((effect) => {\n if (imageToBlur != null) {\n effect.setTextureFromPostProcess(\"textureSampler\", imageToBlur);\n }\n effect.setTextureFromPostProcessOutput(\"circleOfConfusionSampler\", circleOfConfusion);\n });\n }\n}\n__decorate([\n serialize()\n], DepthOfFieldBlurPostProcess.prototype, \"direction\", void 0);\nRegisterClass(\"BABYLON.DepthOfFieldBlurPostProcess\", DepthOfFieldBlurPostProcess);\n//# sourceMappingURL=depthOfFieldBlurPostProcess.js.map","// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore.js\";\nconst name = \"depthOfFieldMergePixelShader\";\nconst shader = `#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)\n#define TEXTUREFUNC(s,c,lod) texture2DLodEXT(s,c,lod)\n#else\n#define TEXTUREFUNC(s,c,bias) texture2D(s,c,bias)\n#endif\nuniform sampler2D textureSampler;varying vec2 vUV;uniform sampler2D circleOfConfusionSampler;uniform sampler2D blurStep0;\n#if BLUR_LEVEL>0\nuniform sampler2D blurStep1;\n#endif\n#if BLUR_LEVEL>1\nuniform sampler2D blurStep2;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{float coc=TEXTUREFUNC(circleOfConfusionSampler,vUV,0.0).r;\n#if BLUR_LEVEL==0\nvec4 original=TEXTUREFUNC(textureSampler,vUV,0.0);vec4 blurred0=TEXTUREFUNC(blurStep0,vUV,0.0);gl_FragColor=mix(original,blurred0,coc);\n#endif\n#if BLUR_LEVEL==1\nif(coc<0.5){vec4 original=TEXTUREFUNC(textureSampler,vUV,0.0);vec4 blurred1=TEXTUREFUNC(blurStep1,vUV,0.0);gl_FragColor=mix(original,blurred1,coc/0.5);}else{vec4 blurred0=TEXTUREFUNC(blurStep0,vUV,0.0);vec4 blurred1=TEXTUREFUNC(blurStep1,vUV,0.0);gl_FragColor=mix(blurred1,blurred0,(coc-0.5)/0.5);}\n#endif\n#if BLUR_LEVEL==2\nif(coc<0.33){vec4 original=TEXTUREFUNC(textureSampler,vUV,0.0);vec4 blurred2=TEXTUREFUNC(blurStep2,vUV,0.0);gl_FragColor=mix(original,blurred2,coc/0.33);}else if(coc<0.66){vec4 blurred1=TEXTUREFUNC(blurStep1,vUV,0.0);vec4 blurred2=TEXTUREFUNC(blurStep2,vUV,0.0);gl_FragColor=mix(blurred2,blurred1,(coc-0.33)/0.33);}else{vec4 blurred0=TEXTUREFUNC(blurStep0,vUV,0.0);vec4 blurred1=TEXTUREFUNC(blurStep1,vUV,0.0);gl_FragColor=mix(blurred1,blurred0,(coc-0.66)/0.34);}\n#endif\n}\n`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @internal */\nexport const depthOfFieldMergePixelShader = { name, shader };\n//# sourceMappingURL=depthOfFieldMerge.fragment.js.map","import { PostProcess } from \"./postProcess.js\";\n\nimport \"../Shaders/depthOfFieldMerge.fragment.js\";\n/**\n * The DepthOfFieldMergePostProcess merges blurred images with the original based on the values of the circle of confusion.\n */\nexport class DepthOfFieldMergePostProcess extends PostProcess {\n /**\n * Gets a string identifying the name of the class\n * @returns \"DepthOfFieldMergePostProcess\" string\n */\n getClassName() {\n return \"DepthOfFieldMergePostProcess\";\n }\n /**\n * Creates a new instance of DepthOfFieldMergePostProcess\n * @param name The name of the effect.\n * @param originalFromInput Post process which's input will be used for the merge.\n * @param circleOfConfusion Circle of confusion post process which's output will be used to blur each pixel.\n * @param _blurSteps Blur post processes from low to high which will be mixed with the original image.\n * @param options The required width/height ratio to downsize to before computing the render pass.\n * @param camera The camera to apply the render pass to.\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\n * @param engine The engine which the post process will be applied. (default: current engine)\n * @param reusable If the post process can be reused on the same frame. (default: false)\n * @param textureType Type of textures used when performing the post process. (default: 0)\n * @param blockCompilation If compilation of the shader should not be done in the constructor. The updateEffect method can be used to compile the shader at a later time. (default: false)\n */\n constructor(name, originalFromInput, circleOfConfusion, _blurSteps, options, camera, samplingMode, engine, reusable, textureType = 0, blockCompilation = false) {\n super(name, \"depthOfFieldMerge\", [], [\"circleOfConfusionSampler\", \"blurStep0\", \"blurStep1\", \"blurStep2\"], options, camera, samplingMode, engine, reusable, null, textureType, undefined, null, true);\n this._blurSteps = _blurSteps;\n this.externalTextureSamplerBinding = true;\n this.onApplyObservable.add((effect) => {\n effect.setTextureFromPostProcess(\"textureSampler\", originalFromInput);\n effect.setTextureFromPostProcessOutput(\"circleOfConfusionSampler\", circleOfConfusion);\n _blurSteps.forEach((step, index) => {\n effect.setTextureFromPostProcessOutput(\"blurStep\" + (_blurSteps.length - index - 1), step);\n });\n });\n if (!blockCompilation) {\n this.updateEffect();\n }\n }\n /**\n * Updates the effect with the current post process compile time values and recompiles the shader.\n * @param defines Define statements that should be added at the beginning of the shader. (default: null)\n * @param uniforms Set of uniform variables that will be passed to the shader. (default: null)\n * @param samplers Set of Texture2D variables that will be passed to the shader. (default: null)\n * @param indexParameters The index parameters to be used for babylons include syntax \"#include[0..varyingCount]\". (default: undefined) See usage in babylon.blurPostProcess.ts and kernelBlur.vertex.fx\n * @param onCompiled Called when the shader has been compiled.\n * @param onError Called if there is an error when compiling a shader.\n */\n updateEffect(defines = null, uniforms = null, samplers = null, indexParameters, onCompiled, onError) {\n if (!defines) {\n defines = \"\";\n defines += \"#define BLUR_LEVEL \" + (this._blurSteps.length - 1) + \"\\n\";\n }\n super.updateEffect(defines, uniforms, samplers, indexParameters, onCompiled, onError);\n }\n}\n//# sourceMappingURL=depthOfFieldMergePostProcess.js.map","import { Vector2 } from \"../Maths/math.vector.js\";\nimport { Texture } from \"../Materials/Textures/texture.js\";\nimport { PostProcessRenderEffect } from \"../PostProcesses/RenderPipeline/postProcessRenderEffect.js\";\nimport { CircleOfConfusionPostProcess } from \"./circleOfConfusionPostProcess.js\";\nimport { DepthOfFieldBlurPostProcess } from \"./depthOfFieldBlurPostProcess.js\";\nimport { DepthOfFieldMergePostProcess } from \"./depthOfFieldMergePostProcess.js\";\n\n/**\n * Specifies the level of max blur that should be applied when using the depth of field effect\n */\nexport var DepthOfFieldEffectBlurLevel;\n(function (DepthOfFieldEffectBlurLevel) {\n /**\n * Subtle blur\n */\n DepthOfFieldEffectBlurLevel[DepthOfFieldEffectBlurLevel[\"Low\"] = 0] = \"Low\";\n /**\n * Medium blur\n */\n DepthOfFieldEffectBlurLevel[DepthOfFieldEffectBlurLevel[\"Medium\"] = 1] = \"Medium\";\n /**\n * Large blur\n */\n DepthOfFieldEffectBlurLevel[DepthOfFieldEffectBlurLevel[\"High\"] = 2] = \"High\";\n})(DepthOfFieldEffectBlurLevel || (DepthOfFieldEffectBlurLevel = {}));\n/**\n * The depth of field effect applies a blur to objects that are closer or further from where the camera is focusing.\n */\nexport class DepthOfFieldEffect extends PostProcessRenderEffect {\n /**\n * The focal the length of the camera used in the effect in scene units/1000 (eg. millimeter)\n */\n set focalLength(value) {\n this._circleOfConfusion.focalLength = value;\n }\n get focalLength() {\n return this._circleOfConfusion.focalLength;\n }\n /**\n * F-Stop of the effect's camera. The diameter of the resulting aperture can be computed by lensSize/fStop. (default: 1.4)\n */\n set fStop(value) {\n this._circleOfConfusion.fStop = value;\n }\n get fStop() {\n return this._circleOfConfusion.fStop;\n }\n /**\n * Distance away from the camera to focus on in scene units/1000 (eg. millimeter). (default: 2000)\n */\n set focusDistance(value) {\n this._circleOfConfusion.focusDistance = value;\n }\n get focusDistance() {\n return this._circleOfConfusion.focusDistance;\n }\n /**\n * Max lens size in scene units/1000 (eg. millimeter). Standard cameras are 50mm. (default: 50) The diameter of the resulting aperture can be computed by lensSize/fStop.\n */\n set lensSize(value) {\n this._circleOfConfusion.lensSize = value;\n }\n get lensSize() {\n return this._circleOfConfusion.lensSize;\n }\n /**\n * Creates a new instance DepthOfFieldEffect\n * @param scene The scene the effect belongs to.\n * @param depthTexture The depth texture of the scene to compute the circle of confusion.This must be set in order for this to function but may be set after initialization if needed.\n * @param blurLevel\n * @param pipelineTextureType The type of texture to be used when performing the post processing.\n * @param blockCompilation If compilation of the shader should not be done in the constructor. The updateEffect method can be used to compile the shader at a later time. (default: false)\n */\n constructor(scene, depthTexture, blurLevel = DepthOfFieldEffectBlurLevel.Low, pipelineTextureType = 0, blockCompilation = false) {\n super(scene.getEngine(), \"depth of field\", () => {\n return this._effects;\n }, true);\n /**\n * @internal Internal post processes in depth of field effect\n */\n this._effects = [];\n // Use R-only formats if supported to store the circle of confusion values.\n // This should be more space and bandwidth efficient than using RGBA.\n const engine = scene.getEngine();\n const circleOfConfusionTextureFormat = engine.isWebGPU || engine.webGLVersion > 1 ? 6 : 5;\n // Circle of confusion value for each pixel is used to determine how much to blur that pixel\n this._circleOfConfusion = new CircleOfConfusionPostProcess(\"circleOfConfusion\", depthTexture, 1, null, Texture.BILINEAR_SAMPLINGMODE, engine, false, pipelineTextureType, blockCompilation);\n // Create a pyramid of blurred images (eg. fullSize 1/4 blur, half size 1/2 blur, quarter size 3/4 blur, eith size 4/4 blur)\n // Blur the image but do not blur on sharp far to near distance changes to avoid bleeding artifacts\n // See section 2.6.2 http://fileadmin.cs.lth.se/cs/education/edan35/lectures/12dof.pdf\n this._depthOfFieldBlurY = [];\n this._depthOfFieldBlurX = [];\n let blurCount = 1;\n let kernelSize = 15;\n switch (blurLevel) {\n case DepthOfFieldEffectBlurLevel.High: {\n blurCount = 3;\n kernelSize = 51;\n break;\n }\n case DepthOfFieldEffectBlurLevel.Medium: {\n blurCount = 2;\n kernelSize = 31;\n break;\n }\n default: {\n kernelSize = 15;\n blurCount = 1;\n break;\n }\n }\n const adjustedKernelSize = kernelSize / Math.pow(2, blurCount - 1);\n let ratio = 1.0;\n for (let i = 0; i < blurCount; i++) {\n const blurY = new DepthOfFieldBlurPostProcess(\"vertical blur\", scene, new Vector2(0, 1.0), adjustedKernelSize, ratio, null, this._circleOfConfusion, i == 0 ? this._circleOfConfusion : null, Texture.BILINEAR_SAMPLINGMODE, engine, false, pipelineTextureType, blockCompilation, i == 0 ? circleOfConfusionTextureFormat : 5);\n blurY.autoClear = false;\n ratio = 0.75 / Math.pow(2, i);\n const blurX = new DepthOfFieldBlurPostProcess(\"horizontal blur\", scene, new Vector2(1.0, 0), adjustedKernelSize, ratio, null, this._circleOfConfusion, null, Texture.BILINEAR_SAMPLINGMODE, engine, false, pipelineTextureType, blockCompilation);\n blurX.autoClear = false;\n this._depthOfFieldBlurY.push(blurY);\n this._depthOfFieldBlurX.push(blurX);\n }\n // Set all post processes on the effect.\n this._effects = [this._circleOfConfusion];\n for (let i = 0; i < this._depthOfFieldBlurX.length; i++) {\n this._effects.push(this._depthOfFieldBlurY[i]);\n this._effects.push(this._depthOfFieldBlurX[i]);\n }\n // Merge blurred images with original image based on circleOfConfusion\n this._dofMerge = new DepthOfFieldMergePostProcess(\"dofMerge\", this._circleOfConfusion, this._circleOfConfusion, this._depthOfFieldBlurX, ratio, null, Texture.BILINEAR_SAMPLINGMODE, engine, false, pipelineTextureType, blockCompilation);\n this._dofMerge.autoClear = false;\n this._effects.push(this._dofMerge);\n }\n /**\n * Get the current class name of the current effect\n * @returns \"DepthOfFieldEffect\"\n */\n getClassName() {\n return \"DepthOfFieldEffect\";\n }\n /**\n * Depth texture to be used to compute the circle of confusion. This must be set here or in the constructor in order for the post process to function.\n */\n set depthTexture(value) {\n this._circleOfConfusion.depthTexture = value;\n }\n /**\n * Disposes each of the internal effects for a given camera.\n * @param camera The camera to dispose the effect on.\n */\n disposeEffects(camera) {\n for (let effectIndex = 0; effectIndex < this._effects.length; effectIndex++) {\n this._effects[effectIndex].dispose(camera);\n }\n }\n /**\n * @internal Internal\n */\n _updateEffects() {\n for (let effectIndex = 0; effectIndex < this._effects.length; effectIndex++) {\n this._effects[effectIndex].updateEffect();\n }\n }\n /**\n * Internal\n * @returns if all the contained post processes are ready.\n * @internal\n */\n _isReady() {\n for (let effectIndex = 0; effectIndex < this._effects.length; effectIndex++) {\n if (!this._effects[effectIndex].isReady()) {\n return false;\n }\n }\n return true;\n }\n}\n//# sourceMappingURL=depthOfFieldEffect.js.map","// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore.js\";\nimport \"./ShadersInclude/helperFunctions.js\";\nconst name = \"extractHighlightsPixelShader\";\nconst shader = `#include\nvarying vec2 vUV;uniform sampler2D textureSampler;uniform float threshold;uniform float exposure;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) \n{gl_FragColor=texture2D(textureSampler,vUV);float luma=dot(LuminanceEncodeApprox,gl_FragColor.rgb*exposure);gl_FragColor.rgb=step(threshold,luma)*gl_FragColor.rgb;}`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @internal */\nexport const extractHighlightsPixelShader = { name, shader };\n//# sourceMappingURL=extractHighlights.fragment.js.map","import { __decorate } from \"../tslib.es6.js\";\nimport { PostProcess } from \"./postProcess.js\";\nimport { ToGammaSpace } from \"../Maths/math.constants.js\";\n\nimport \"../Shaders/extractHighlights.fragment.js\";\nimport { serialize } from \"../Misc/decorators.js\";\nimport { RegisterClass } from \"../Misc/typeStore.js\";\n/**\n * The extract highlights post process sets all pixels to black except pixels above the specified luminance threshold. Used as the first step for a bloom effect.\n */\nexport class ExtractHighlightsPostProcess extends PostProcess {\n /**\n * Gets a string identifying the name of the class\n * @returns \"ExtractHighlightsPostProcess\" string\n */\n getClassName() {\n return \"ExtractHighlightsPostProcess\";\n }\n constructor(name, options, camera, samplingMode, engine, reusable, textureType = 0, blockCompilation = false) {\n super(name, \"extractHighlights\", [\"threshold\", \"exposure\"], null, options, camera, samplingMode, engine, reusable, null, textureType, undefined, null, blockCompilation);\n /**\n * The luminance threshold, pixels below this value will be set to black.\n */\n this.threshold = 0.9;\n /** @internal */\n this._exposure = 1;\n /**\n * Post process which has the input texture to be used when performing highlight extraction\n * @internal\n */\n this._inputPostProcess = null;\n this.onApplyObservable.add((effect) => {\n this.externalTextureSamplerBinding = !!this._inputPostProcess;\n if (this._inputPostProcess) {\n effect.setTextureFromPostProcess(\"textureSampler\", this._inputPostProcess);\n }\n effect.setFloat(\"threshold\", Math.pow(this.threshold, ToGammaSpace));\n effect.setFloat(\"exposure\", this._exposure);\n });\n }\n}\n__decorate([\n serialize()\n], ExtractHighlightsPostProcess.prototype, \"threshold\", void 0);\nRegisterClass(\"BABYLON.ExtractHighlightsPostProcess\", ExtractHighlightsPostProcess);\n//# sourceMappingURL=extractHighlightsPostProcess.js.map","// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore.js\";\nconst name = \"bloomMergePixelShader\";\nconst shader = `uniform sampler2D textureSampler;uniform sampler2D bloomBlur;varying vec2 vUV;uniform float bloomWeight;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{gl_FragColor=texture2D(textureSampler,vUV);vec3 blurred=texture2D(bloomBlur,vUV).rgb;gl_FragColor.rgb=gl_FragColor.rgb+(blurred.rgb*bloomWeight); }\n`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @internal */\nexport const bloomMergePixelShader = { name, shader };\n//# sourceMappingURL=bloomMerge.fragment.js.map","import { __decorate } from \"../tslib.es6.js\";\nimport { PostProcess } from \"./postProcess.js\";\n\nimport \"../Shaders/bloomMerge.fragment.js\";\nimport { RegisterClass } from \"../Misc/typeStore.js\";\nimport { serialize } from \"../Misc/decorators.js\";\n/**\n * The BloomMergePostProcess merges blurred images with the original based on the values of the circle of confusion.\n */\nexport class BloomMergePostProcess extends PostProcess {\n /**\n * Gets a string identifying the name of the class\n * @returns \"BloomMergePostProcess\" string\n */\n getClassName() {\n return \"BloomMergePostProcess\";\n }\n /**\n * Creates a new instance of @see BloomMergePostProcess\n * @param name The name of the effect.\n * @param originalFromInput Post process which's input will be used for the merge.\n * @param blurred Blurred highlights post process which's output will be used.\n * @param weight Weight of the bloom to be added to the original input.\n * @param options The required width/height ratio to downsize to before computing the render pass.\n * @param camera The camera to apply the render pass to.\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\n * @param engine The engine which the post process will be applied. (default: current engine)\n * @param reusable If the post process can be reused on the same frame. (default: false)\n * @param textureType Type of textures used when performing the post process. (default: 0)\n * @param blockCompilation If compilation of the shader should not be done in the constructor. The updateEffect method can be used to compile the shader at a later time. (default: false)\n */\n constructor(name, originalFromInput, blurred, \n /** Weight of the bloom to be added to the original input. */\n weight, options, camera, samplingMode, engine, reusable, textureType = 0, blockCompilation = false) {\n super(name, \"bloomMerge\", [\"bloomWeight\"], [\"bloomBlur\"], options, camera, samplingMode, engine, reusable, null, textureType, undefined, null, true);\n /** Weight of the bloom to be added to the original input. */\n this.weight = 1;\n this.weight = weight;\n this.externalTextureSamplerBinding = true;\n this.onApplyObservable.add((effect) => {\n effect.setTextureFromPostProcess(\"textureSampler\", originalFromInput);\n effect.setTextureFromPostProcessOutput(\"bloomBlur\", blurred);\n effect.setFloat(\"bloomWeight\", this.weight);\n });\n if (!blockCompilation) {\n this.updateEffect();\n }\n }\n}\n__decorate([\n serialize()\n], BloomMergePostProcess.prototype, \"weight\", void 0);\nRegisterClass(\"BABYLON.BloomMergePostProcess\", BloomMergePostProcess);\n//# sourceMappingURL=bloomMergePostProcess.js.map","import { PostProcessRenderEffect } from \"../PostProcesses/RenderPipeline/postProcessRenderEffect.js\";\nimport { ExtractHighlightsPostProcess } from \"./extractHighlightsPostProcess.js\";\nimport { BlurPostProcess } from \"./blurPostProcess.js\";\nimport { BloomMergePostProcess } from \"./bloomMergePostProcess.js\";\nimport { Vector2 } from \"../Maths/math.vector.js\";\nimport { Texture } from \"../Materials/Textures/texture.js\";\n/**\n * The bloom effect spreads bright areas of an image to simulate artifacts seen in cameras\n */\nexport class BloomEffect extends PostProcessRenderEffect {\n /**\n * The luminance threshold to find bright areas of the image to bloom.\n */\n get threshold() {\n return this._downscale.threshold;\n }\n set threshold(value) {\n this._downscale.threshold = value;\n }\n /**\n * The strength of the bloom.\n */\n get weight() {\n return this._merge.weight;\n }\n set weight(value) {\n this._merge.weight = value;\n }\n /**\n * Specifies the size of the bloom blur kernel, relative to the final output size\n */\n get kernel() {\n return this._blurX.kernel / this._bloomScale;\n }\n set kernel(value) {\n this._blurX.kernel = value * this._bloomScale;\n this._blurY.kernel = value * this._bloomScale;\n }\n /**\n * Creates a new instance of @see BloomEffect\n * @param scene The scene the effect belongs to.\n * @param _bloomScale The ratio of the blur texture to the input texture that should be used to compute the bloom.\n * @param bloomWeight The the strength of bloom.\n * @param bloomKernel The size of the kernel to be used when applying the blur.\n * @param pipelineTextureType The type of texture to be used when performing the post processing.\n * @param blockCompilation If compilation of the shader should not be done in the constructor. The updateEffect method can be used to compile the shader at a later time. (default: false)\n */\n constructor(scene, _bloomScale, bloomWeight, bloomKernel, pipelineTextureType = 0, blockCompilation = false) {\n super(scene.getEngine(), \"bloom\", () => {\n return this._effects;\n }, true);\n this._bloomScale = _bloomScale;\n /**\n * @internal Internal\n */\n this._effects = [];\n this._downscale = new ExtractHighlightsPostProcess(\"highlights\", 1.0, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, pipelineTextureType, blockCompilation);\n this._blurX = new BlurPostProcess(\"horizontal blur\", new Vector2(1.0, 0), 10.0, _bloomScale, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, pipelineTextureType, undefined, blockCompilation);\n this._blurX.alwaysForcePOT = true;\n this._blurX.autoClear = false;\n this._blurY = new BlurPostProcess(\"vertical blur\", new Vector2(0, 1.0), 10.0, _bloomScale, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, pipelineTextureType, undefined, blockCompilation);\n this._blurY.alwaysForcePOT = true;\n this._blurY.autoClear = false;\n this.kernel = bloomKernel;\n this._effects = [this._downscale, this._blurX, this._blurY];\n this._merge = new BloomMergePostProcess(\"bloomMerge\", this._downscale, this._blurY, bloomWeight, _bloomScale, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, pipelineTextureType, blockCompilation);\n this._merge.autoClear = false;\n this._effects.push(this._merge);\n }\n /**\n * Disposes each of the internal effects for a given camera.\n * @param camera The camera to dispose the effect on.\n */\n disposeEffects(camera) {\n for (let effectIndex = 0; effectIndex < this._effects.length; effectIndex++) {\n this._effects[effectIndex].dispose(camera);\n }\n }\n /**\n * @internal Internal\n */\n _updateEffects() {\n for (let effectIndex = 0; effectIndex < this._effects.length; effectIndex++) {\n this._effects[effectIndex].updateEffect();\n }\n }\n /**\n * Internal\n * @returns if all the contained post processes are ready.\n * @internal\n */\n _isReady() {\n for (let effectIndex = 0; effectIndex < this._effects.length; effectIndex++) {\n if (!this._effects[effectIndex].isReady()) {\n return false;\n }\n }\n return true;\n }\n}\n//# sourceMappingURL=bloomEffect.js.map","/**\n * PostProcessRenderPipelineManager class\n * @see https://doc.babylonjs.com/features/featuresDeepDive/postProcesses/postProcessRenderPipeline\n */\nexport class PostProcessRenderPipelineManager {\n /**\n * Initializes a PostProcessRenderPipelineManager\n * @see https://doc.babylonjs.com/features/featuresDeepDive/postProcesses/postProcessRenderPipeline\n */\n constructor() {\n this._renderPipelines = {};\n }\n /**\n * Gets the list of supported render pipelines\n */\n get supportedPipelines() {\n const result = [];\n for (const renderPipelineName in this._renderPipelines) {\n if (Object.prototype.hasOwnProperty.call(this._renderPipelines, renderPipelineName)) {\n const pipeline = this._renderPipelines[renderPipelineName];\n if (pipeline.isSupported) {\n result.push(pipeline);\n }\n }\n }\n return result;\n }\n /**\n * Adds a pipeline to the manager\n * @param renderPipeline The pipeline to add\n */\n addPipeline(renderPipeline) {\n this._renderPipelines[renderPipeline._name] = renderPipeline;\n }\n /**\n * Remove the pipeline from the manager\n * @param renderPipelineName the name of the pipeline to remove\n */\n removePipeline(renderPipelineName) {\n delete this._renderPipelines[renderPipelineName];\n }\n /**\n * Attaches a camera to the pipeline\n * @param renderPipelineName The name of the pipeline to attach to\n * @param cameras the camera to attach\n * @param unique if the camera can be attached multiple times to the pipeline\n */\n attachCamerasToRenderPipeline(renderPipelineName, cameras, unique = false) {\n const renderPipeline = this._renderPipelines[renderPipelineName];\n if (!renderPipeline) {\n return;\n }\n renderPipeline._attachCameras(cameras, unique);\n }\n /**\n * Detaches a camera from the pipeline\n * @param renderPipelineName The name of the pipeline to detach from\n * @param cameras the camera to detach\n */\n detachCamerasFromRenderPipeline(renderPipelineName, cameras) {\n const renderPipeline = this._renderPipelines[renderPipelineName];\n if (!renderPipeline) {\n return;\n }\n renderPipeline._detachCameras(cameras);\n }\n /**\n * Enables an effect by name on a pipeline\n * @param renderPipelineName the name of the pipeline to enable the effect in\n * @param renderEffectName the name of the effect to enable\n * @param cameras the cameras that the effect should be enabled on\n */\n enableEffectInPipeline(renderPipelineName, renderEffectName, cameras) {\n const renderPipeline = this._renderPipelines[renderPipelineName];\n if (!renderPipeline) {\n return;\n }\n renderPipeline._enableEffect(renderEffectName, cameras);\n }\n /**\n * Disables an effect by name on a pipeline\n * @param renderPipelineName the name of the pipeline to disable the effect in\n * @param renderEffectName the name of the effect to disable\n * @param cameras the cameras that the effect should be disabled on\n */\n disableEffectInPipeline(renderPipelineName, renderEffectName, cameras) {\n const renderPipeline = this._renderPipelines[renderPipelineName];\n if (!renderPipeline) {\n return;\n }\n renderPipeline._disableEffect(renderEffectName, cameras);\n }\n /**\n * Updates the state of all contained render pipelines and disposes of any non supported pipelines\n */\n update() {\n for (const renderPipelineName in this._renderPipelines) {\n if (Object.prototype.hasOwnProperty.call(this._renderPipelines, renderPipelineName)) {\n const pipeline = this._renderPipelines[renderPipelineName];\n if (!pipeline.isSupported) {\n pipeline.dispose();\n delete this._renderPipelines[renderPipelineName];\n }\n else {\n pipeline._update();\n }\n }\n }\n }\n /** @internal */\n _rebuild() {\n for (const renderPipelineName in this._renderPipelines) {\n if (Object.prototype.hasOwnProperty.call(this._renderPipelines, renderPipelineName)) {\n const pipeline = this._renderPipelines[renderPipelineName];\n pipeline._rebuild();\n }\n }\n }\n /**\n * Disposes of the manager and pipelines\n */\n dispose() {\n for (const renderPipelineName in this._renderPipelines) {\n if (Object.prototype.hasOwnProperty.call(this._renderPipelines, renderPipelineName)) {\n const pipeline = this._renderPipelines[renderPipelineName];\n pipeline.dispose();\n }\n }\n }\n}\n//# sourceMappingURL=postProcessRenderPipelineManager.js.map","import { SceneComponentConstants } from \"../../sceneComponent.js\";\nimport { PostProcessRenderPipelineManager } from \"./postProcessRenderPipelineManager.js\";\nimport { Scene } from \"../../scene.js\";\nObject.defineProperty(Scene.prototype, \"postProcessRenderPipelineManager\", {\n get: function () {\n if (!this._postProcessRenderPipelineManager) {\n // Register the G Buffer component to the scene.\n let component = this._getComponent(SceneComponentConstants.NAME_POSTPROCESSRENDERPIPELINEMANAGER);\n if (!component) {\n component = new PostProcessRenderPipelineManagerSceneComponent(this);\n this._addComponent(component);\n }\n this._postProcessRenderPipelineManager = new PostProcessRenderPipelineManager();\n }\n return this._postProcessRenderPipelineManager;\n },\n enumerable: true,\n configurable: true,\n});\n/**\n * Defines the Render Pipeline scene component responsible to rendering pipelines\n */\nexport class PostProcessRenderPipelineManagerSceneComponent {\n /**\n * Creates a new instance of the component for the given scene\n * @param scene Defines the scene to register the component in\n */\n constructor(scene) {\n /**\n * The component name helpful to identify the component in the list of scene components.\n */\n this.name = SceneComponentConstants.NAME_POSTPROCESSRENDERPIPELINEMANAGER;\n this.scene = scene;\n }\n /**\n * Registers the component in a given scene\n */\n register() {\n this.scene._gatherRenderTargetsStage.registerStep(SceneComponentConstants.STEP_GATHERRENDERTARGETS_POSTPROCESSRENDERPIPELINEMANAGER, this, this._gatherRenderTargets);\n }\n /**\n * Rebuilds the elements related to this component in case of\n * context lost for instance.\n */\n rebuild() {\n if (this.scene._postProcessRenderPipelineManager) {\n this.scene._postProcessRenderPipelineManager._rebuild();\n }\n }\n /**\n * Disposes the component and the associated resources\n */\n dispose() {\n if (this.scene._postProcessRenderPipelineManager) {\n this.scene._postProcessRenderPipelineManager.dispose();\n }\n }\n _gatherRenderTargets() {\n if (this.scene._postProcessRenderPipelineManager) {\n this.scene._postProcessRenderPipelineManager.update();\n }\n }\n}\n//# sourceMappingURL=postProcessRenderPipelineManagerSceneComponent.js.map","import { __decorate } from \"../../../tslib.es6.js\";\nimport { serialize, SerializationHelper } from \"../../../Misc/decorators.js\";\nimport { Observable } from \"../../../Misc/observable.js\";\nimport { Logger } from \"../../../Misc/logger.js\";\nimport { Texture } from \"../../../Materials/Textures/texture.js\";\n\nimport { GlowLayer } from \"../../../Layers/glowLayer.js\";\nimport { SharpenPostProcess } from \"../../../PostProcesses/sharpenPostProcess.js\";\nimport { ImageProcessingPostProcess } from \"../../../PostProcesses/imageProcessingPostProcess.js\";\nimport { ChromaticAberrationPostProcess } from \"../../../PostProcesses/chromaticAberrationPostProcess.js\";\nimport { GrainPostProcess } from \"../../../PostProcesses/grainPostProcess.js\";\nimport { FxaaPostProcess } from \"../../../PostProcesses/fxaaPostProcess.js\";\nimport { PostProcessRenderPipeline } from \"../../../PostProcesses/RenderPipeline/postProcessRenderPipeline.js\";\nimport { PostProcessRenderEffect } from \"../../../PostProcesses/RenderPipeline/postProcessRenderEffect.js\";\nimport { DepthOfFieldEffect, DepthOfFieldEffectBlurLevel } from \"../../../PostProcesses/depthOfFieldEffect.js\";\nimport { BloomEffect } from \"../../../PostProcesses/bloomEffect.js\";\nimport { RegisterClass } from \"../../../Misc/typeStore.js\";\nimport { EngineStore } from \"../../../Engines/engineStore.js\";\nimport { Tools } from \"../../../Misc/tools.js\";\nimport \"../../../PostProcesses/RenderPipeline/postProcessRenderPipelineManagerSceneComponent.js\";\n/**\n * The default rendering pipeline can be added to a scene to apply common post processing effects such as anti-aliasing or depth of field.\n * See https://doc.babylonjs.com/features/featuresDeepDive/postProcesses/defaultRenderingPipeline\n */\nexport class DefaultRenderingPipeline extends PostProcessRenderPipeline {\n /**\n * Enable or disable automatic building of the pipeline when effects are enabled and disabled.\n * If false, you will have to manually call prepare() to update the pipeline.\n */\n get automaticBuild() {\n return this._buildAllowed;\n }\n set automaticBuild(value) {\n this._buildAllowed = value;\n }\n /**\n * Gets active scene\n */\n get scene() {\n return this._scene;\n }\n /**\n * Enable or disable the sharpen process from the pipeline\n */\n set sharpenEnabled(enabled) {\n if (this._sharpenEnabled === enabled) {\n return;\n }\n this._sharpenEnabled = enabled;\n this._buildPipeline();\n }\n get sharpenEnabled() {\n return this._sharpenEnabled;\n }\n /**\n * Specifies the size of the bloom blur kernel, relative to the final output size\n */\n get bloomKernel() {\n return this._bloomKernel;\n }\n set bloomKernel(value) {\n this._bloomKernel = value;\n this.bloom.kernel = value / this._hardwareScaleLevel;\n }\n /**\n * The strength of the bloom.\n */\n set bloomWeight(value) {\n if (this._bloomWeight === value) {\n return;\n }\n this.bloom.weight = value;\n this._bloomWeight = value;\n }\n get bloomWeight() {\n return this._bloomWeight;\n }\n /**\n * The luminance threshold to find bright areas of the image to bloom.\n */\n set bloomThreshold(value) {\n if (this._bloomThreshold === value) {\n return;\n }\n this.bloom.threshold = value;\n this._bloomThreshold = value;\n }\n get bloomThreshold() {\n return this._bloomThreshold;\n }\n /**\n * The scale of the bloom, lower value will provide better performance.\n */\n set bloomScale(value) {\n if (this._bloomScale === value) {\n return;\n }\n this._bloomScale = value;\n // recreate bloom and dispose old as this setting is not dynamic\n this._rebuildBloom();\n this._buildPipeline();\n }\n get bloomScale() {\n return this._bloomScale;\n }\n /**\n * Enable or disable the bloom from the pipeline\n */\n set bloomEnabled(enabled) {\n if (this._bloomEnabled === enabled) {\n return;\n }\n this._bloomEnabled = enabled;\n this._buildPipeline();\n }\n get bloomEnabled() {\n return this._bloomEnabled;\n }\n _rebuildBloom() {\n // recreate bloom and dispose old as this setting is not dynamic\n const oldBloom = this.bloom;\n this.bloom = new BloomEffect(this._scene, this.bloomScale, this._bloomWeight, this.bloomKernel / this._hardwareScaleLevel, this._defaultPipelineTextureType, false);\n this.bloom.threshold = oldBloom.threshold;\n for (let i = 0; i < this._cameras.length; i++) {\n oldBloom.disposeEffects(this._cameras[i]);\n }\n }\n /**\n * If the depth of field is enabled.\n */\n get depthOfFieldEnabled() {\n return this._depthOfFieldEnabled;\n }\n set depthOfFieldEnabled(enabled) {\n if (this._depthOfFieldEnabled === enabled) {\n return;\n }\n this._depthOfFieldEnabled = enabled;\n this._buildPipeline();\n }\n /**\n * Blur level of the depth of field effect. (Higher blur will effect performance)\n */\n get depthOfFieldBlurLevel() {\n return this._depthOfFieldBlurLevel;\n }\n set depthOfFieldBlurLevel(value) {\n if (this._depthOfFieldBlurLevel === value) {\n return;\n }\n this._depthOfFieldBlurLevel = value;\n // recreate dof and dispose old as this setting is not dynamic\n const oldDof = this.depthOfField;\n this.depthOfField = new DepthOfFieldEffect(this._scene, null, this._depthOfFieldBlurLevel, this._defaultPipelineTextureType, false);\n this.depthOfField.focalLength = oldDof.focalLength;\n this.depthOfField.focusDistance = oldDof.focusDistance;\n this.depthOfField.fStop = oldDof.fStop;\n this.depthOfField.lensSize = oldDof.lensSize;\n for (let i = 0; i < this._cameras.length; i++) {\n oldDof.disposeEffects(this._cameras[i]);\n }\n this._buildPipeline();\n }\n /**\n * If the anti aliasing is enabled.\n */\n set fxaaEnabled(enabled) {\n if (this._fxaaEnabled === enabled) {\n return;\n }\n this._fxaaEnabled = enabled;\n this._buildPipeline();\n }\n get fxaaEnabled() {\n return this._fxaaEnabled;\n }\n /**\n * MSAA sample count, setting this to 4 will provide 4x anti aliasing. (default: 1)\n */\n set samples(sampleCount) {\n if (this._samples === sampleCount) {\n return;\n }\n this._samples = sampleCount;\n this._buildPipeline();\n }\n get samples() {\n return this._samples;\n }\n /**\n * If image processing is enabled.\n */\n set imageProcessingEnabled(enabled) {\n if (this._imageProcessingEnabled === enabled) {\n return;\n }\n this._scene.imageProcessingConfiguration.isEnabled = enabled;\n }\n get imageProcessingEnabled() {\n return this._imageProcessingEnabled;\n }\n /**\n * If glow layer is enabled. (Adds a glow effect to emmissive materials)\n */\n set glowLayerEnabled(enabled) {\n if (enabled && !this._glowLayer) {\n this._glowLayer = new GlowLayer(\"\", this._scene);\n }\n else if (!enabled && this._glowLayer) {\n this._glowLayer.dispose();\n this._glowLayer = null;\n }\n }\n get glowLayerEnabled() {\n return this._glowLayer != null;\n }\n /**\n * Gets the glow layer (or null if not defined)\n */\n get glowLayer() {\n return this._glowLayer;\n }\n /**\n * Enable or disable the chromaticAberration process from the pipeline\n */\n set chromaticAberrationEnabled(enabled) {\n if (this._chromaticAberrationEnabled === enabled) {\n return;\n }\n this._chromaticAberrationEnabled = enabled;\n this._buildPipeline();\n }\n get chromaticAberrationEnabled() {\n return this._chromaticAberrationEnabled;\n }\n /**\n * Enable or disable the grain process from the pipeline\n */\n set grainEnabled(enabled) {\n if (this._grainEnabled === enabled) {\n return;\n }\n this._grainEnabled = enabled;\n this._buildPipeline();\n }\n get grainEnabled() {\n return this._grainEnabled;\n }\n /**\n * Instantiates a DefaultRenderingPipeline.\n * @param name The rendering pipeline name (default: \"\")\n * @param hdr If high dynamic range textures should be used (default: true)\n * @param scene The scene linked to this pipeline (default: the last created scene)\n * @param cameras The array of cameras that the rendering pipeline will be attached to (default: scene.cameras)\n * @param automaticBuild If false, you will have to manually call prepare() to update the pipeline (default: true)\n */\n constructor(name = \"\", hdr = true, scene = EngineStore.LastCreatedScene, cameras, automaticBuild = true) {\n super(scene.getEngine(), name);\n this._camerasToBeAttached = [];\n /**\n * ID of the sharpen post process,\n */\n this.SharpenPostProcessId = \"SharpenPostProcessEffect\";\n /**\n * @ignore\n * ID of the image processing post process;\n */\n this.ImageProcessingPostProcessId = \"ImageProcessingPostProcessEffect\";\n /**\n * @ignore\n * ID of the Fast Approximate Anti-Aliasing post process;\n */\n this.FxaaPostProcessId = \"FxaaPostProcessEffect\";\n /**\n * ID of the chromatic aberration post process,\n */\n this.ChromaticAberrationPostProcessId = \"ChromaticAberrationPostProcessEffect\";\n /**\n * ID of the grain post process\n */\n this.GrainPostProcessId = \"GrainPostProcessEffect\";\n /**\n * Glow post process which adds a glow to emissive areas of the image\n */\n this._glowLayer = null;\n /**\n * Animations which can be used to tweak settings over a period of time\n */\n this.animations = [];\n this._imageProcessingConfigurationObserver = null;\n // Values\n this._sharpenEnabled = false;\n this._bloomEnabled = false;\n this._depthOfFieldEnabled = false;\n this._depthOfFieldBlurLevel = DepthOfFieldEffectBlurLevel.Low;\n this._fxaaEnabled = false;\n this._imageProcessingEnabled = true;\n this._bloomScale = 0.5;\n this._chromaticAberrationEnabled = false;\n this._grainEnabled = false;\n this._buildAllowed = true;\n /**\n * This is triggered each time the pipeline has been built.\n */\n this.onBuildObservable = new Observable();\n this._resizeObserver = null;\n this._hardwareScaleLevel = 1.0;\n this._bloomKernel = 64;\n /**\n * Specifies the weight of the bloom in the final rendering\n */\n this._bloomWeight = 0.15;\n /**\n * Specifies the luma threshold for the area that will be blurred by the bloom\n */\n this._bloomThreshold = 0.9;\n this._samples = 1;\n this._hasCleared = false;\n this._prevPostProcess = null;\n this._prevPrevPostProcess = null;\n this._depthOfFieldSceneObserver = null;\n this._activeCameraChangedObserver = null;\n this._activeCamerasChangedObserver = null;\n this._cameras = cameras || scene.cameras;\n this._cameras = this._cameras.slice();\n this._camerasToBeAttached = this._cameras.slice();\n this._buildAllowed = automaticBuild;\n // Initialize\n this._scene = scene;\n const caps = this._scene.getEngine().getCaps();\n this._hdr = hdr && (caps.textureHalfFloatRender || caps.textureFloatRender);\n // Misc\n if (this._hdr) {\n if (caps.textureHalfFloatRender) {\n this._defaultPipelineTextureType = 2;\n }\n else if (caps.textureFloatRender) {\n this._defaultPipelineTextureType = 1;\n }\n }\n else {\n this._defaultPipelineTextureType = 0;\n }\n // Attach\n scene.postProcessRenderPipelineManager.addPipeline(this);\n const engine = this._scene.getEngine();\n // Create post processes before hand so they can be modified before enabled.\n // Block compilation flag is set to true to avoid compilation prior to use, these will be updated on first use in build pipeline.\n this.sharpen = new SharpenPostProcess(\"sharpen\", 1.0, null, Texture.BILINEAR_SAMPLINGMODE, engine, false, this._defaultPipelineTextureType, true);\n this._sharpenEffect = new PostProcessRenderEffect(engine, this.SharpenPostProcessId, () => {\n return this.sharpen;\n }, true);\n this.depthOfField = new DepthOfFieldEffect(this._scene, null, this._depthOfFieldBlurLevel, this._defaultPipelineTextureType, true);\n // To keep the bloom sizes consistent across different display densities, factor in the hardware scaling level.\n this._hardwareScaleLevel = engine.getHardwareScalingLevel();\n this._resizeObserver = engine.onResizeObservable.add(() => {\n this._hardwareScaleLevel = engine.getHardwareScalingLevel();\n this.bloomKernel = this._bloomKernel;\n });\n this.bloom = new BloomEffect(this._scene, this._bloomScale, this._bloomWeight, this.bloomKernel / this._hardwareScaleLevel, this._defaultPipelineTextureType, true);\n this.chromaticAberration = new ChromaticAberrationPostProcess(\"ChromaticAberration\", engine.getRenderWidth(), engine.getRenderHeight(), 1.0, null, Texture.BILINEAR_SAMPLINGMODE, engine, false, this._defaultPipelineTextureType, true);\n this._chromaticAberrationEffect = new PostProcessRenderEffect(engine, this.ChromaticAberrationPostProcessId, () => {\n return this.chromaticAberration;\n }, true);\n this.grain = new GrainPostProcess(\"Grain\", 1.0, null, Texture.BILINEAR_SAMPLINGMODE, engine, false, this._defaultPipelineTextureType, true);\n this._grainEffect = new PostProcessRenderEffect(engine, this.GrainPostProcessId, () => {\n return this.grain;\n }, true);\n this._imageProcessingConfigurationObserver = this._scene.imageProcessingConfiguration.onUpdateParameters.add(() => {\n this.bloom._downscale._exposure = this._scene.imageProcessingConfiguration.exposure;\n if (this.imageProcessingEnabled !== this._scene.imageProcessingConfiguration.isEnabled) {\n this._imageProcessingEnabled = this._scene.imageProcessingConfiguration.isEnabled;\n // Avoid re-entrant problems by deferring the call to _buildPipeline because the call to _buildPipeline\n // at the end of the constructor could end up triggering imageProcessingConfiguration.onUpdateParameters!\n // Note that the pipeline could have been disposed before the deferred call was executed, but in that case\n // _buildAllowed will have been set to false, preventing _buildPipeline from being executed.\n Tools.SetImmediate(() => {\n this._buildPipeline();\n });\n }\n });\n this._buildPipeline();\n }\n /**\n * Get the class name\n * @returns \"DefaultRenderingPipeline\"\n */\n getClassName() {\n return \"DefaultRenderingPipeline\";\n }\n /**\n * Force the compilation of the entire pipeline.\n */\n prepare() {\n const previousState = this._buildAllowed;\n this._buildAllowed = true;\n this._buildPipeline();\n this._buildAllowed = previousState;\n }\n _setAutoClearAndTextureSharing(postProcess, skipTextureSharing = false) {\n if (this._hasCleared) {\n postProcess.autoClear = false;\n }\n else {\n postProcess.autoClear = true;\n this._scene.autoClear = false;\n this._hasCleared = true;\n }\n if (!skipTextureSharing) {\n if (this._prevPrevPostProcess) {\n postProcess.shareOutputWith(this._prevPrevPostProcess);\n }\n else {\n postProcess.useOwnOutput();\n }\n if (this._prevPostProcess) {\n this._prevPrevPostProcess = this._prevPostProcess;\n }\n this._prevPostProcess = postProcess;\n }\n }\n _buildPipeline() {\n if (!this._buildAllowed) {\n return;\n }\n this._scene.autoClear = true;\n const engine = this._scene.getEngine();\n this._disposePostProcesses();\n if (this._cameras !== null) {\n this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name, this._cameras);\n // get back cameras to be used to reattach pipeline\n this._cameras = this._camerasToBeAttached.slice();\n }\n this._reset();\n this._prevPostProcess = null;\n this._prevPrevPostProcess = null;\n this._hasCleared = false;\n if (this.depthOfFieldEnabled) {\n // Multi camera suport\n if (this._cameras.length > 1) {\n for (const camera of this._cameras) {\n const depthRenderer = this._scene.enableDepthRenderer(camera);\n depthRenderer.useOnlyInActiveCamera = true;\n }\n this._depthOfFieldSceneObserver = this._scene.onAfterRenderTargetsRenderObservable.add((scene) => {\n if (this._cameras.indexOf(scene.activeCamera) > -1) {\n this.depthOfField.depthTexture = scene.enableDepthRenderer(scene.activeCamera).getDepthMap();\n }\n });\n }\n else {\n this._scene.onAfterRenderTargetsRenderObservable.remove(this._depthOfFieldSceneObserver);\n const depthRenderer = this._scene.enableDepthRenderer(this._cameras[0]);\n this.depthOfField.depthTexture = depthRenderer.getDepthMap();\n }\n if (!this.depthOfField._isReady()) {\n this.depthOfField._updateEffects();\n }\n this.addEffect(this.depthOfField);\n this._setAutoClearAndTextureSharing(this.depthOfField._effects[0], true);\n }\n else {\n this._scene.onAfterRenderTargetsRenderObservable.remove(this._depthOfFieldSceneObserver);\n }\n if (this.bloomEnabled) {\n if (!this.bloom._isReady()) {\n this.bloom._updateEffects();\n }\n this.addEffect(this.bloom);\n this._setAutoClearAndTextureSharing(this.bloom._effects[0], true);\n }\n if (this._imageProcessingEnabled) {\n this.imageProcessing = new ImageProcessingPostProcess(\"imageProcessing\", 1.0, null, Texture.BILINEAR_SAMPLINGMODE, engine, false, this._defaultPipelineTextureType, this.scene.imageProcessingConfiguration);\n if (this._hdr) {\n this.addEffect(new PostProcessRenderEffect(engine, this.ImageProcessingPostProcessId, () => {\n return this.imageProcessing;\n }, true));\n this._setAutoClearAndTextureSharing(this.imageProcessing);\n }\n else {\n this._scene.imageProcessingConfiguration.applyByPostProcess = false;\n }\n if (!this._cameras || this._cameras.length === 0) {\n this._scene.imageProcessingConfiguration.applyByPostProcess = false;\n }\n if (!this.imageProcessing.getEffect()) {\n this.imageProcessing._updateParameters();\n }\n }\n if (this.sharpenEnabled) {\n if (!this.sharpen.isReady()) {\n this.sharpen.updateEffect();\n }\n this.addEffect(this._sharpenEffect);\n this._setAutoClearAndTextureSharing(this.sharpen);\n }\n if (this.grainEnabled) {\n if (!this.grain.isReady()) {\n this.grain.updateEffect();\n }\n this.addEffect(this._grainEffect);\n this._setAutoClearAndTextureSharing(this.grain);\n }\n if (this.chromaticAberrationEnabled) {\n if (!this.chromaticAberration.isReady()) {\n this.chromaticAberration.updateEffect();\n }\n this.addEffect(this._chromaticAberrationEffect);\n this._setAutoClearAndTextureSharing(this.chromaticAberration);\n }\n if (this.fxaaEnabled) {\n this.fxaa = new FxaaPostProcess(\"fxaa\", 1.0, null, Texture.BILINEAR_SAMPLINGMODE, engine, false, this._defaultPipelineTextureType);\n this.addEffect(new PostProcessRenderEffect(engine, this.FxaaPostProcessId, () => {\n return this.fxaa;\n }, true));\n this._setAutoClearAndTextureSharing(this.fxaa, true);\n }\n if (this._cameras !== null) {\n this._scene.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(this._name, this._cameras);\n }\n // In multicamera mode, the scene needs to autoclear in between cameras.\n if ((this._scene.activeCameras && this._scene.activeCameras.length > 1) || (this._scene.activeCamera && this._cameras.indexOf(this._scene.activeCamera) === -1)) {\n this._scene.autoClear = true;\n }\n // The active camera on the scene can be changed anytime\n if (!this._activeCameraChangedObserver) {\n this._activeCameraChangedObserver = this._scene.onActiveCameraChanged.add(() => {\n if (this._scene.activeCamera && this._cameras.indexOf(this._scene.activeCamera) === -1) {\n this._scene.autoClear = true;\n }\n });\n }\n if (!this._activeCamerasChangedObserver) {\n this._activeCamerasChangedObserver = this._scene.onActiveCamerasChanged.add(() => {\n if (this._scene.activeCameras && this._scene.activeCameras.length > 1) {\n this._scene.autoClear = true;\n }\n });\n }\n if (!this._enableMSAAOnFirstPostProcess(this.samples) && this.samples > 1) {\n Logger.Warn(\"MSAA failed to enable, MSAA is only supported in browsers that support webGL >= 2.0\");\n }\n this.onBuildObservable.notifyObservers(this);\n }\n _disposePostProcesses(disposeNonRecreated = false) {\n for (let i = 0; i < this._cameras.length; i++) {\n const camera = this._cameras[i];\n if (this.imageProcessing) {\n this.imageProcessing.dispose(camera);\n }\n if (this.fxaa) {\n this.fxaa.dispose(camera);\n }\n // These are created in the constructor and should not be disposed on every pipeline change\n if (disposeNonRecreated) {\n if (this.sharpen) {\n this.sharpen.dispose(camera);\n }\n if (this.depthOfField) {\n this._scene.onAfterRenderTargetsRenderObservable.remove(this._depthOfFieldSceneObserver);\n this.depthOfField.disposeEffects(camera);\n }\n if (this.bloom) {\n this.bloom.disposeEffects(camera);\n }\n if (this.chromaticAberration) {\n this.chromaticAberration.dispose(camera);\n }\n if (this.grain) {\n this.grain.dispose(camera);\n }\n if (this._glowLayer) {\n this._glowLayer.dispose();\n }\n }\n }\n this.imageProcessing = null;\n this.fxaa = null;\n if (disposeNonRecreated) {\n this.sharpen = null;\n this._sharpenEffect = null;\n this.depthOfField = null;\n this.bloom = null;\n this.chromaticAberration = null;\n this._chromaticAberrationEffect = null;\n this.grain = null;\n this._grainEffect = null;\n this._glowLayer = null;\n }\n }\n /**\n * Adds a camera to the pipeline\n * @param camera the camera to be added\n */\n addCamera(camera) {\n this._camerasToBeAttached.push(camera);\n this._buildPipeline();\n }\n /**\n * Removes a camera from the pipeline\n * @param camera the camera to remove\n */\n removeCamera(camera) {\n const index = this._camerasToBeAttached.indexOf(camera);\n this._camerasToBeAttached.splice(index, 1);\n this._buildPipeline();\n }\n /**\n * Dispose of the pipeline and stop all post processes\n */\n dispose() {\n this._buildAllowed = false;\n this.onBuildObservable.clear();\n this._disposePostProcesses(true);\n this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name, this._cameras);\n this._scene._postProcessRenderPipelineManager.removePipeline(this.name);\n this._scene.autoClear = true;\n if (this._resizeObserver) {\n this._scene.getEngine().onResizeObservable.remove(this._resizeObserver);\n this._resizeObserver = null;\n }\n this._scene.onActiveCameraChanged.remove(this._activeCameraChangedObserver);\n this._scene.onActiveCamerasChanged.remove(this._activeCamerasChangedObserver);\n this._scene.imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingConfigurationObserver);\n super.dispose();\n }\n /**\n * Serialize the rendering pipeline (Used when exporting)\n * @returns the serialized object\n */\n serialize() {\n const serializationObject = SerializationHelper.Serialize(this);\n serializationObject.customType = \"DefaultRenderingPipeline\";\n return serializationObject;\n }\n /**\n * Parse the serialized pipeline\n * @param source Source pipeline.\n * @param scene The scene to load the pipeline to.\n * @param rootUrl The URL of the serialized pipeline.\n * @returns An instantiated pipeline from the serialized object.\n */\n static Parse(source, scene, rootUrl) {\n return SerializationHelper.Parse(() => new DefaultRenderingPipeline(source._name, source._name._hdr, scene), source, scene, rootUrl);\n }\n}\n__decorate([\n serialize()\n], DefaultRenderingPipeline.prototype, \"sharpenEnabled\", null);\n__decorate([\n serialize()\n], DefaultRenderingPipeline.prototype, \"bloomKernel\", null);\n__decorate([\n serialize()\n], DefaultRenderingPipeline.prototype, \"_bloomWeight\", void 0);\n__decorate([\n serialize()\n], DefaultRenderingPipeline.prototype, \"_bloomThreshold\", void 0);\n__decorate([\n serialize()\n], DefaultRenderingPipeline.prototype, \"_hdr\", void 0);\n__decorate([\n serialize()\n], DefaultRenderingPipeline.prototype, \"bloomWeight\", null);\n__decorate([\n serialize()\n], DefaultRenderingPipeline.prototype, \"bloomThreshold\", null);\n__decorate([\n serialize()\n], DefaultRenderingPipeline.prototype, \"bloomScale\", null);\n__decorate([\n serialize()\n], DefaultRenderingPipeline.prototype, \"bloomEnabled\", null);\n__decorate([\n serialize()\n], DefaultRenderingPipeline.prototype, \"depthOfFieldEnabled\", null);\n__decorate([\n serialize()\n], DefaultRenderingPipeline.prototype, \"depthOfFieldBlurLevel\", null);\n__decorate([\n serialize()\n], DefaultRenderingPipeline.prototype, \"fxaaEnabled\", null);\n__decorate([\n serialize()\n], DefaultRenderingPipeline.prototype, \"samples\", null);\n__decorate([\n serialize()\n], DefaultRenderingPipeline.prototype, \"imageProcessingEnabled\", null);\n__decorate([\n serialize()\n], DefaultRenderingPipeline.prototype, \"glowLayerEnabled\", null);\n__decorate([\n serialize()\n], DefaultRenderingPipeline.prototype, \"chromaticAberrationEnabled\", null);\n__decorate([\n serialize()\n], DefaultRenderingPipeline.prototype, \"grainEnabled\", null);\nRegisterClass(\"BABYLON.DefaultRenderingPipeline\", DefaultRenderingPipeline);\n//# sourceMappingURL=defaultRenderingPipeline.js.map","import { InternalTexture, InternalTextureSource } from \"../../Materials/Textures/internalTexture.js\";\nimport { Logger } from \"../../Misc/logger.js\";\nimport { Tools } from \"../../Misc/tools.js\";\n\nimport { ThinEngine } from \"../thinEngine.js\";\nThinEngine.prototype.updateRawTexture = function (texture, data, format, invertY, compression = null, type = 0, useSRGBBuffer = false) {\n if (!texture) {\n return;\n }\n // Babylon's internalSizedFomat but gl's texImage2D internalFormat\n const internalSizedFomat = this._getRGBABufferInternalSizedFormat(type, format, useSRGBBuffer);\n // Babylon's internalFormat but gl's texImage2D format\n const internalFormat = this._getInternalFormat(format);\n const textureType = this._getWebGLTextureType(type);\n this._bindTextureDirectly(this._gl.TEXTURE_2D, texture, true);\n this._unpackFlipY(invertY === undefined ? true : invertY ? true : false);\n if (!this._doNotHandleContextLost) {\n texture._bufferView = data;\n texture.format = format;\n texture.type = type;\n texture.invertY = invertY;\n texture._compression = compression;\n }\n if (texture.width % 4 !== 0) {\n this._gl.pixelStorei(this._gl.UNPACK_ALIGNMENT, 1);\n }\n if (compression && data) {\n this._gl.compressedTexImage2D(this._gl.TEXTURE_2D, 0, this.getCaps().s3tc[compression], texture.width, texture.height, 0, data);\n }\n else {\n this._gl.texImage2D(this._gl.TEXTURE_2D, 0, internalSizedFomat, texture.width, texture.height, 0, internalFormat, textureType, data);\n }\n if (texture.generateMipMaps) {\n this._gl.generateMipmap(this._gl.TEXTURE_2D);\n }\n this._bindTextureDirectly(this._gl.TEXTURE_2D, null);\n // this.resetTextureCache();\n texture.isReady = true;\n};\nThinEngine.prototype.createRawTexture = function (data, width, height, format, generateMipMaps, invertY, samplingMode, compression = null, type = 0, \n// eslint-disable-next-line @typescript-eslint/no-unused-vars\ncreationFlags = 0, useSRGBBuffer = false) {\n const texture = new InternalTexture(this, InternalTextureSource.Raw);\n texture.baseWidth = width;\n texture.baseHeight = height;\n texture.width = width;\n texture.height = height;\n texture.format = format;\n texture.generateMipMaps = generateMipMaps;\n texture.samplingMode = samplingMode;\n texture.invertY = invertY;\n texture._compression = compression;\n texture.type = type;\n texture._useSRGBBuffer = this._getUseSRGBBuffer(useSRGBBuffer, !generateMipMaps);\n if (!this._doNotHandleContextLost) {\n texture._bufferView = data;\n }\n this.updateRawTexture(texture, data, format, invertY, compression, type, texture._useSRGBBuffer);\n this._bindTextureDirectly(this._gl.TEXTURE_2D, texture, true);\n // Filters\n const filters = this._getSamplingParameters(samplingMode, generateMipMaps);\n this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MAG_FILTER, filters.mag);\n this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MIN_FILTER, filters.min);\n if (generateMipMaps) {\n this._gl.generateMipmap(this._gl.TEXTURE_2D);\n }\n this._bindTextureDirectly(this._gl.TEXTURE_2D, null);\n this._internalTexturesCache.push(texture);\n return texture;\n};\nThinEngine.prototype.createRawCubeTexture = function (data, size, format, type, generateMipMaps, invertY, samplingMode, compression = null) {\n const gl = this._gl;\n const texture = new InternalTexture(this, InternalTextureSource.CubeRaw);\n texture.isCube = true;\n texture.format = format;\n texture.type = type;\n if (!this._doNotHandleContextLost) {\n texture._bufferViewArray = data;\n }\n const textureType = this._getWebGLTextureType(type);\n let internalFormat = this._getInternalFormat(format);\n if (internalFormat === gl.RGB) {\n internalFormat = gl.RGBA;\n }\n // Mipmap generation needs a sized internal format that is both color-renderable and texture-filterable\n if (textureType === gl.FLOAT && !this._caps.textureFloatLinearFiltering) {\n generateMipMaps = false;\n samplingMode = 1;\n Logger.Warn(\"Float texture filtering is not supported. Mipmap generation and sampling mode are forced to false and TEXTURE_NEAREST_SAMPLINGMODE, respectively.\");\n }\n else if (textureType === this._gl.HALF_FLOAT_OES && !this._caps.textureHalfFloatLinearFiltering) {\n generateMipMaps = false;\n samplingMode = 1;\n Logger.Warn(\"Half float texture filtering is not supported. Mipmap generation and sampling mode are forced to false and TEXTURE_NEAREST_SAMPLINGMODE, respectively.\");\n }\n else if (textureType === gl.FLOAT && !this._caps.textureFloatRender) {\n generateMipMaps = false;\n Logger.Warn(\"Render to float textures is not supported. Mipmap generation forced to false.\");\n }\n else if (textureType === gl.HALF_FLOAT && !this._caps.colorBufferFloat) {\n generateMipMaps = false;\n Logger.Warn(\"Render to half float textures is not supported. Mipmap generation forced to false.\");\n }\n const width = size;\n const height = width;\n texture.width = width;\n texture.height = height;\n texture.invertY = invertY;\n texture._compression = compression;\n // Double check on POT to generate Mips.\n const isPot = !this.needPOTTextures || (Tools.IsExponentOfTwo(texture.width) && Tools.IsExponentOfTwo(texture.height));\n if (!isPot) {\n generateMipMaps = false;\n }\n // Upload data if needed. The texture won't be ready until then.\n if (data) {\n this.updateRawCubeTexture(texture, data, format, type, invertY, compression);\n }\n else {\n const internalSizedFomat = this._getRGBABufferInternalSizedFormat(type);\n const level = 0;\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true);\n for (let faceIndex = 0; faceIndex < 6; faceIndex++) {\n if (compression) {\n gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, level, this.getCaps().s3tc[compression], texture.width, texture.height, 0, undefined);\n }\n else {\n gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, level, internalSizedFomat, texture.width, texture.height, 0, internalFormat, textureType, null);\n }\n }\n this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null);\n }\n this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, texture, true);\n // Filters\n if (data && generateMipMaps) {\n this._gl.generateMipmap(this._gl.TEXTURE_CUBE_MAP);\n }\n const filters = this._getSamplingParameters(samplingMode, generateMipMaps);\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, filters.mag);\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, filters.min);\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, null);\n texture.generateMipMaps = generateMipMaps;\n texture.samplingMode = samplingMode;\n texture.isReady = true;\n return texture;\n};\nThinEngine.prototype.updateRawCubeTexture = function (texture, data, format, type, invertY, compression = null, level = 0) {\n texture._bufferViewArray = data;\n texture.format = format;\n texture.type = type;\n texture.invertY = invertY;\n texture._compression = compression;\n const gl = this._gl;\n const textureType = this._getWebGLTextureType(type);\n let internalFormat = this._getInternalFormat(format);\n const internalSizedFomat = this._getRGBABufferInternalSizedFormat(type);\n let needConversion = false;\n if (internalFormat === gl.RGB) {\n internalFormat = gl.RGBA;\n needConversion = true;\n }\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true);\n this._unpackFlipY(invertY === undefined ? true : invertY ? true : false);\n if (texture.width % 4 !== 0) {\n gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1);\n }\n // Data are known to be in +X +Y +Z -X -Y -Z\n for (let faceIndex = 0; faceIndex < 6; faceIndex++) {\n let faceData = data[faceIndex];\n if (compression) {\n gl.compressedTexImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, level, this.getCaps().s3tc[compression], texture.width, texture.height, 0, faceData);\n }\n else {\n if (needConversion) {\n faceData = _convertRGBtoRGBATextureData(faceData, texture.width, texture.height, type);\n }\n gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, level, internalSizedFomat, texture.width, texture.height, 0, internalFormat, textureType, faceData);\n }\n }\n const isPot = !this.needPOTTextures || (Tools.IsExponentOfTwo(texture.width) && Tools.IsExponentOfTwo(texture.height));\n if (isPot && texture.generateMipMaps && level === 0) {\n this._gl.generateMipmap(this._gl.TEXTURE_CUBE_MAP);\n }\n this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null);\n // this.resetTextureCache();\n texture.isReady = true;\n};\nThinEngine.prototype.createRawCubeTextureFromUrl = function (url, scene, size, format, type, noMipmap, callback, mipmapGenerator, onLoad = null, onError = null, samplingMode = 3, invertY = false) {\n const gl = this._gl;\n const texture = this.createRawCubeTexture(null, size, format, type, !noMipmap, invertY, samplingMode, null);\n scene === null || scene === void 0 ? void 0 : scene.addPendingData(texture);\n texture.url = url;\n texture.isReady = false;\n this._internalTexturesCache.push(texture);\n const onerror = (request, exception) => {\n scene === null || scene === void 0 ? void 0 : scene.removePendingData(texture);\n if (onError && request) {\n onError(request.status + \" \" + request.statusText, exception);\n }\n };\n const internalCallback = (data) => {\n const width = texture.width;\n const faceDataArrays = callback(data);\n if (!faceDataArrays) {\n return;\n }\n if (mipmapGenerator) {\n const textureType = this._getWebGLTextureType(type);\n let internalFormat = this._getInternalFormat(format);\n const internalSizedFomat = this._getRGBABufferInternalSizedFormat(type);\n let needConversion = false;\n if (internalFormat === gl.RGB) {\n internalFormat = gl.RGBA;\n needConversion = true;\n }\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true);\n this._unpackFlipY(false);\n const mipData = mipmapGenerator(faceDataArrays);\n for (let level = 0; level < mipData.length; level++) {\n const mipSize = width >> level;\n for (let faceIndex = 0; faceIndex < 6; faceIndex++) {\n let mipFaceData = mipData[level][faceIndex];\n if (needConversion) {\n mipFaceData = _convertRGBtoRGBATextureData(mipFaceData, mipSize, mipSize, type);\n }\n gl.texImage2D(faceIndex, level, internalSizedFomat, mipSize, mipSize, 0, internalFormat, textureType, mipFaceData);\n }\n }\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, null);\n }\n else {\n this.updateRawCubeTexture(texture, faceDataArrays, format, type, invertY);\n }\n texture.isReady = true;\n // this.resetTextureCache();\n scene === null || scene === void 0 ? void 0 : scene.removePendingData(texture);\n texture.onLoadedObservable.notifyObservers(texture);\n texture.onLoadedObservable.clear();\n if (onLoad) {\n onLoad();\n }\n };\n this._loadFile(url, (data) => {\n internalCallback(data);\n }, undefined, scene === null || scene === void 0 ? void 0 : scene.offlineProvider, true, onerror);\n return texture;\n};\n/**\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction _convertRGBtoRGBATextureData(rgbData, width, height, textureType) {\n // Create new RGBA data container.\n let rgbaData;\n let val1 = 1;\n if (textureType === 1) {\n rgbaData = new Float32Array(width * height * 4);\n }\n else if (textureType === 2) {\n rgbaData = new Uint16Array(width * height * 4);\n val1 = 15360; // 15360 is the encoding of 1 in half float\n }\n else if (textureType === 7) {\n rgbaData = new Uint32Array(width * height * 4);\n }\n else {\n rgbaData = new Uint8Array(width * height * 4);\n }\n // Convert each pixel.\n for (let x = 0; x < width; x++) {\n for (let y = 0; y < height; y++) {\n const index = (y * width + x) * 3;\n const newIndex = (y * width + x) * 4;\n // Map Old Value to new value.\n rgbaData[newIndex + 0] = rgbData[index + 0];\n rgbaData[newIndex + 1] = rgbData[index + 1];\n rgbaData[newIndex + 2] = rgbData[index + 2];\n // Add fully opaque alpha channel.\n rgbaData[newIndex + 3] = val1;\n }\n }\n return rgbaData;\n}\n/**\n * Create a function for createRawTexture3D/createRawTexture2DArray\n * @param is3D true for TEXTURE_3D and false for TEXTURE_2D_ARRAY\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction _makeCreateRawTextureFunction(is3D) {\n return function (data, width, height, depth, format, generateMipMaps, invertY, samplingMode, compression = null, textureType = 0) {\n const target = is3D ? this._gl.TEXTURE_3D : this._gl.TEXTURE_2D_ARRAY;\n const source = is3D ? InternalTextureSource.Raw3D : InternalTextureSource.Raw2DArray;\n const texture = new InternalTexture(this, source);\n texture.baseWidth = width;\n texture.baseHeight = height;\n texture.baseDepth = depth;\n texture.width = width;\n texture.height = height;\n texture.depth = depth;\n texture.format = format;\n texture.type = textureType;\n texture.generateMipMaps = generateMipMaps;\n texture.samplingMode = samplingMode;\n if (is3D) {\n texture.is3D = true;\n }\n else {\n texture.is2DArray = true;\n }\n if (!this._doNotHandleContextLost) {\n texture._bufferView = data;\n }\n if (is3D) {\n this.updateRawTexture3D(texture, data, format, invertY, compression, textureType);\n }\n else {\n this.updateRawTexture2DArray(texture, data, format, invertY, compression, textureType);\n }\n this._bindTextureDirectly(target, texture, true);\n // Filters\n const filters = this._getSamplingParameters(samplingMode, generateMipMaps);\n this._gl.texParameteri(target, this._gl.TEXTURE_MAG_FILTER, filters.mag);\n this._gl.texParameteri(target, this._gl.TEXTURE_MIN_FILTER, filters.min);\n if (generateMipMaps) {\n this._gl.generateMipmap(target);\n }\n this._bindTextureDirectly(target, null);\n this._internalTexturesCache.push(texture);\n return texture;\n };\n}\nThinEngine.prototype.createRawTexture2DArray = _makeCreateRawTextureFunction(false);\nThinEngine.prototype.createRawTexture3D = _makeCreateRawTextureFunction(true);\n/**\n * Create a function for updateRawTexture3D/updateRawTexture2DArray\n * @param is3D true for TEXTURE_3D and false for TEXTURE_2D_ARRAY\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction _makeUpdateRawTextureFunction(is3D) {\n return function (texture, data, format, invertY, compression = null, textureType = 0) {\n const target = is3D ? this._gl.TEXTURE_3D : this._gl.TEXTURE_2D_ARRAY;\n const internalType = this._getWebGLTextureType(textureType);\n const internalFormat = this._getInternalFormat(format);\n const internalSizedFomat = this._getRGBABufferInternalSizedFormat(textureType, format);\n this._bindTextureDirectly(target, texture, true);\n this._unpackFlipY(invertY === undefined ? true : invertY ? true : false);\n if (!this._doNotHandleContextLost) {\n texture._bufferView = data;\n texture.format = format;\n texture.invertY = invertY;\n texture._compression = compression;\n }\n if (texture.width % 4 !== 0) {\n this._gl.pixelStorei(this._gl.UNPACK_ALIGNMENT, 1);\n }\n if (compression && data) {\n this._gl.compressedTexImage3D(target, 0, this.getCaps().s3tc[compression], texture.width, texture.height, texture.depth, 0, data);\n }\n else {\n this._gl.texImage3D(target, 0, internalSizedFomat, texture.width, texture.height, texture.depth, 0, internalFormat, internalType, data);\n }\n if (texture.generateMipMaps) {\n this._gl.generateMipmap(target);\n }\n this._bindTextureDirectly(target, null);\n // this.resetTextureCache();\n texture.isReady = true;\n };\n}\nThinEngine.prototype.updateRawTexture2DArray = _makeUpdateRawTextureFunction(false);\nThinEngine.prototype.updateRawTexture3D = _makeUpdateRawTextureFunction(true);\n//# sourceMappingURL=engine.rawTexture.js.map","import { Texture } from \"./texture.js\";\n\nimport \"../../Engines/Extensions/engine.rawTexture.js\";\n/**\n * Raw texture can help creating a texture directly from an array of data.\n * This can be super useful if you either get the data from an uncompressed source or\n * if you wish to create your texture pixel by pixel.\n */\nexport class RawTexture extends Texture {\n /**\n * Instantiates a new RawTexture.\n * Raw texture can help creating a texture directly from an array of data.\n * This can be super useful if you either get the data from an uncompressed source or\n * if you wish to create your texture pixel by pixel.\n * @param data define the array of data to use to create the texture (null to create an empty texture)\n * @param width define the width of the texture\n * @param height define the height of the texture\n * @param format define the format of the data (RGB, RGBA... Engine.TEXTUREFORMAT_xxx)\n * @param sceneOrEngine defines the scene or engine the texture will belong to\n * @param generateMipMaps define whether mip maps should be generated or not\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\n * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx)\n * @param creationFlags specific flags to use when creating the texture (1 for storage textures, for eg)\n * @param useSRGBBuffer defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU).\n */\n constructor(data, width, height, \n /**\n * Define the format of the data (RGB, RGBA... Engine.TEXTUREFORMAT_xxx)\n */\n format, sceneOrEngine, generateMipMaps = true, invertY = false, samplingMode = 3, type = 0, creationFlags, useSRGBBuffer) {\n super(null, sceneOrEngine, !generateMipMaps, invertY, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, creationFlags);\n this.format = format;\n if (!this._engine) {\n return;\n }\n if (!this._engine._caps.textureFloatLinearFiltering && type === 1) {\n samplingMode = 1;\n }\n if (!this._engine._caps.textureHalfFloatLinearFiltering && type === 2) {\n samplingMode = 1;\n }\n this._texture = this._engine.createRawTexture(data, width, height, format, generateMipMaps, invertY, samplingMode, null, type, creationFlags !== null && creationFlags !== void 0 ? creationFlags : 0, useSRGBBuffer !== null && useSRGBBuffer !== void 0 ? useSRGBBuffer : false);\n this.wrapU = Texture.CLAMP_ADDRESSMODE;\n this.wrapV = Texture.CLAMP_ADDRESSMODE;\n }\n /**\n * Updates the texture underlying data.\n * @param data Define the new data of the texture\n */\n update(data) {\n this._getEngine().updateRawTexture(this._texture, data, this._texture.format, this._texture.invertY, null, this._texture.type, this._texture._useSRGBBuffer);\n }\n /**\n * Creates a luminance texture from some data.\n * @param data Define the texture data\n * @param width Define the width of the texture\n * @param height Define the height of the texture\n * @param sceneOrEngine defines the scene or engine the texture will belong to\n * @param generateMipMaps Define whether or not to create mip maps for the texture\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\n * @returns the luminance texture\n */\n static CreateLuminanceTexture(data, width, height, sceneOrEngine, generateMipMaps = true, invertY = false, samplingMode = 3) {\n return new RawTexture(data, width, height, 1, sceneOrEngine, generateMipMaps, invertY, samplingMode);\n }\n /**\n * Creates a luminance alpha texture from some data.\n * @param data Define the texture data\n * @param width Define the width of the texture\n * @param height Define the height of the texture\n * @param sceneOrEngine defines the scene or engine the texture will belong to\n * @param generateMipMaps Define whether or not to create mip maps for the texture\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\n * @returns the luminance alpha texture\n */\n static CreateLuminanceAlphaTexture(data, width, height, sceneOrEngine, generateMipMaps = true, invertY = false, samplingMode = 3) {\n return new RawTexture(data, width, height, 2, sceneOrEngine, generateMipMaps, invertY, samplingMode);\n }\n /**\n * Creates an alpha texture from some data.\n * @param data Define the texture data\n * @param width Define the width of the texture\n * @param height Define the height of the texture\n * @param sceneOrEngine defines the scene or engine the texture will belong to\n * @param generateMipMaps Define whether or not to create mip maps for the texture\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\n * @returns the alpha texture\n */\n static CreateAlphaTexture(data, width, height, sceneOrEngine, generateMipMaps = true, invertY = false, samplingMode = 3) {\n return new RawTexture(data, width, height, 0, sceneOrEngine, generateMipMaps, invertY, samplingMode);\n }\n /**\n * Creates a RGB texture from some data.\n * @param data Define the texture data\n * @param width Define the width of the texture\n * @param height Define the height of the texture\n * @param sceneOrEngine defines the scene or engine the texture will belong to\n * @param generateMipMaps Define whether or not to create mip maps for the texture\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\n * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx)\n * @param creationFlags specific flags to use when creating the texture (1 for storage textures, for eg)\n * @param useSRGBBuffer defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU).\n * @returns the RGB alpha texture\n */\n static CreateRGBTexture(data, width, height, sceneOrEngine, generateMipMaps = true, invertY = false, samplingMode = 3, type = 0, creationFlags = 0, useSRGBBuffer = false) {\n return new RawTexture(data, width, height, 4, sceneOrEngine, generateMipMaps, invertY, samplingMode, type, creationFlags, useSRGBBuffer);\n }\n /**\n * Creates a RGBA texture from some data.\n * @param data Define the texture data\n * @param width Define the width of the texture\n * @param height Define the height of the texture\n * @param sceneOrEngine defines the scene or engine the texture will belong to\n * @param generateMipMaps Define whether or not to create mip maps for the texture\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\n * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx)\n * @param creationFlags specific flags to use when creating the texture (1 for storage textures, for eg)\n * @param useSRGBBuffer defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU).\n * @returns the RGBA texture\n */\n static CreateRGBATexture(data, width, height, sceneOrEngine, generateMipMaps = true, invertY = false, samplingMode = 3, type = 0, creationFlags = 0, useSRGBBuffer = false) {\n return new RawTexture(data, width, height, 5, sceneOrEngine, generateMipMaps, invertY, samplingMode, type, creationFlags, useSRGBBuffer);\n }\n /**\n * Creates a RGBA storage texture from some data.\n * @param data Define the texture data\n * @param width Define the width of the texture\n * @param height Define the height of the texture\n * @param sceneOrEngine defines the scene or engine the texture will belong to\n * @param generateMipMaps Define whether or not to create mip maps for the texture\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\n * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx)\n * @param useSRGBBuffer defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU).\n * @returns the RGBA texture\n */\n static CreateRGBAStorageTexture(data, width, height, sceneOrEngine, generateMipMaps = true, invertY = false, samplingMode = 3, type = 0, useSRGBBuffer = false) {\n return new RawTexture(data, width, height, 5, sceneOrEngine, generateMipMaps, invertY, samplingMode, type, 1, useSRGBBuffer);\n }\n /**\n * Creates a R texture from some data.\n * @param data Define the texture data\n * @param width Define the width of the texture\n * @param height Define the height of the texture\n * @param sceneOrEngine defines the scene or engine the texture will belong to\n * @param generateMipMaps Define whether or not to create mip maps for the texture\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\n * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx)\n * @returns the R texture\n */\n static CreateRTexture(data, width, height, sceneOrEngine, generateMipMaps = true, invertY = false, samplingMode = Texture.TRILINEAR_SAMPLINGMODE, type = 1) {\n return new RawTexture(data, width, height, 6, sceneOrEngine, generateMipMaps, invertY, samplingMode, type);\n }\n /**\n * Creates a R storage texture from some data.\n * @param data Define the texture data\n * @param width Define the width of the texture\n * @param height Define the height of the texture\n * @param sceneOrEngine defines the scene or engine the texture will belong to\n * @param generateMipMaps Define whether or not to create mip maps for the texture\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\n * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx)\n * @returns the R texture\n */\n static CreateRStorageTexture(data, width, height, sceneOrEngine, generateMipMaps = true, invertY = false, samplingMode = Texture.TRILINEAR_SAMPLINGMODE, type = 1) {\n return new RawTexture(data, width, height, 6, sceneOrEngine, generateMipMaps, invertY, samplingMode, type, 1);\n }\n}\n//# sourceMappingURL=rawTexture.js.map","// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore.js\";\nconst name = \"lensHighlightsPixelShader\";\nconst shader = `uniform sampler2D textureSampler; \nuniform float gain;uniform float threshold;uniform float screen_width;uniform float screen_height;varying vec2 vUV;vec4 highlightColor(vec4 color) {vec4 highlight=color;float luminance=dot(highlight.rgb,vec3(0.2125,0.7154,0.0721));float lum_threshold;if (threshold>1.0) { lum_threshold=0.94+0.01*threshold; }\nelse { lum_threshold=0.5+0.44*threshold; }\nluminance=clamp((luminance-lum_threshold)*(1.0/(1.0-lum_threshold)),0.0,1.0);highlight*=luminance*gain;highlight.a=1.0;return highlight;}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{vec4 original=texture2D(textureSampler,vUV);if (gain==-1.0) {gl_FragColor=vec4(0.0,0.0,0.0,1.0);return;}\nfloat w=2.0/screen_width;float h=2.0/screen_height;float weight=1.0;vec4 blurred=vec4(0.0,0.0,0.0,0.0);\n#ifdef PENTAGON\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.84*w,0.43*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.48*w,-1.29*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.61*w,1.51*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.55*w,-0.74*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.71*w,-0.52*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.94*w,1.59*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.40*w,-1.87*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.62*w,1.16*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.09*w,0.25*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.46*w,-1.71*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.08*w,2.42*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.85*w,-1.89*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.89*w,0.16*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.29*w,1.88*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.40*w,-2.81*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.54*w,2.26*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.60*w,-0.61*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.31*w,-1.30*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.83*w,2.53*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.12*w,-2.48*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.60*w,1.11*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.82*w,0.99*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.50*w,-2.81*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.85*w,3.33*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.94*w,-1.92*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.27*w,-0.53*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.95*w,2.48*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.23*w,-3.04*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.17*w,2.05*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.97*w,-0.04*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.25*w,-2.00*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.31*w,3.08*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.94*w,-2.59*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.37*w,0.64*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-3.13*w,1.93*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.03*w,-3.65*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.60*w,3.17*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-3.14*w,-1.19*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.00*w,-1.19*h)));\n#else\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.85*w,0.36*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.52*w,-1.14*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.46*w,1.42*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.46*w,-0.83*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.79*w,-0.42*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.11*w,1.62*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.29*w,-2.07*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.69*w,1.39*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.28*w,0.12*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.65*w,-1.69*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.08*w,2.44*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.63*w,-1.90*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.55*w,0.31*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.13*w,1.52*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.56*w,-2.61*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.38*w,2.34*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.64*w,-0.81*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.53*w,-1.21*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.06*w,2.63*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.00*w,-2.69*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.59*w,1.32*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.82*w,0.78*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.57*w,-2.50*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.54*w,2.93*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.39*w,-1.81*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.01*w,-0.28*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.04*w,2.25*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.02*w,-3.05*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.09*w,2.25*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-3.07*w,-0.25*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.44*w,-1.90*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.52*w,3.05*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.68*w,-2.61*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.01*w,0.79*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.76*w,1.46*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.05*w,-2.94*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.21*w,2.88*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.84*w,-1.30*h)));blurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.98*w,-0.96*h)));\n#endif\nblurred/=39.0;gl_FragColor=blurred;}`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @internal */\nexport const lensHighlightsPixelShader = { name, shader };\n//# sourceMappingURL=lensHighlights.fragment.js.map","// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore.js\";\nconst name = \"depthOfFieldPixelShader\";\nconst shader = `uniform sampler2D textureSampler;uniform sampler2D highlightsSampler;uniform sampler2D depthSampler;uniform sampler2D grainSampler;uniform float grain_amount;uniform bool blur_noise;uniform float screen_width;uniform float screen_height;uniform float distortion;uniform bool dof_enabled;uniform float screen_distance; \nuniform float aperture;uniform float darken;uniform float edge_blur;uniform bool highlights;uniform float near;uniform float far;varying vec2 vUV;\n#define PI 3.14159265\n#define TWOPI 6.28318530\n#define inverse_focal_length 0.1 \nvec2 centered_screen_pos;vec2 distorted_coords;float radius2;float radius;vec2 rand(vec2 co)\n{float noise1=(fract(sin(dot(co,vec2(12.9898,78.233)))*43758.5453));float noise2=(fract(sin(dot(co,vec2(12.9898,78.233)*2.0))*43758.5453));return clamp(vec2(noise1,noise2),0.0,1.0);}\nvec2 getDistortedCoords(vec2 coords) {if (distortion==0.0) { return coords; }\nvec2 direction=1.0*normalize(centered_screen_pos);vec2 dist_coords=vec2(0.5,0.5);dist_coords.x=0.5+direction.x*radius2*1.0;dist_coords.y=0.5+direction.y*radius2*1.0;float dist_amount=clamp(distortion*0.23,0.0,1.0);dist_coords=mix(coords,dist_coords,dist_amount);return dist_coords;}\nfloat sampleScreen(inout vec4 color,in vec2 offset,in float weight) {vec2 coords=distorted_coords;float angle=rand(coords*100.0).x*TWOPI;coords+=vec2(offset.x*cos(angle)-offset.y*sin(angle),offset.x*sin(angle)+offset.y*cos(angle));color+=texture2D(textureSampler,coords)*weight;return weight;}\nfloat getBlurLevel(float size) {return min(3.0,ceil(size/1.0));}\nvec4 getBlurColor(float size) {vec4 col=texture2D(textureSampler,distorted_coords);float blur_level=getBlurLevel(size);float w=(size/screen_width);float h=(size/screen_height);float total_weight=1.0;vec2 sample_coords;total_weight+=sampleScreen(col,vec2(-0.50*w,0.24*h),0.93);total_weight+=sampleScreen(col,vec2(0.30*w,-0.75*h),0.90);total_weight+=sampleScreen(col,vec2(0.36*w,0.96*h),0.87);total_weight+=sampleScreen(col,vec2(-1.08*w,-0.55*h),0.85);total_weight+=sampleScreen(col,vec2(1.33*w,-0.37*h),0.83);total_weight+=sampleScreen(col,vec2(-0.82*w,1.31*h),0.80);total_weight+=sampleScreen(col,vec2(-0.31*w,-1.67*h),0.78);total_weight+=sampleScreen(col,vec2(1.47*w,1.11*h),0.76);total_weight+=sampleScreen(col,vec2(-1.97*w,0.19*h),0.74);total_weight+=sampleScreen(col,vec2(1.42*w,-1.57*h),0.72);if (blur_level>1.0) {total_weight+=sampleScreen(col,vec2(0.01*w,2.25*h),0.70);total_weight+=sampleScreen(col,vec2(-1.62*w,-1.74*h),0.67);total_weight+=sampleScreen(col,vec2(2.49*w,0.20*h),0.65);total_weight+=sampleScreen(col,vec2(-2.07*w,1.61*h),0.63);total_weight+=sampleScreen(col,vec2(0.46*w,-2.70*h),0.61);total_weight+=sampleScreen(col,vec2(1.55*w,2.40*h),0.59);total_weight+=sampleScreen(col,vec2(-2.88*w,-0.75*h),0.56);total_weight+=sampleScreen(col,vec2(2.73*w,-1.44*h),0.54);total_weight+=sampleScreen(col,vec2(-1.08*w,3.02*h),0.52);total_weight+=sampleScreen(col,vec2(-1.28*w,-3.05*h),0.49);}\nif (blur_level>2.0) {total_weight+=sampleScreen(col,vec2(3.11*w,1.43*h),0.46);total_weight+=sampleScreen(col,vec2(-3.36*w,1.08*h),0.44);total_weight+=sampleScreen(col,vec2(1.80*w,-3.16*h),0.41);total_weight+=sampleScreen(col,vec2(0.83*w,3.65*h),0.38);total_weight+=sampleScreen(col,vec2(-3.16*w,-2.19*h),0.34);total_weight+=sampleScreen(col,vec2(3.92*w,-0.53*h),0.31);total_weight+=sampleScreen(col,vec2(-2.59*w,3.12*h),0.26);total_weight+=sampleScreen(col,vec2(-0.20*w,-4.15*h),0.22);total_weight+=sampleScreen(col,vec2(3.02*w,3.00*h),0.15);}\ncol/=total_weight; \nif (darken>0.0) {col.rgb*=clamp(0.3,1.0,1.05-size*0.5*darken);}\nreturn col;}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{centered_screen_pos=vec2(vUV.x-0.5,vUV.y-0.5);radius2=centered_screen_pos.x*centered_screen_pos.x+centered_screen_pos.y*centered_screen_pos.y;radius=sqrt(radius2);distorted_coords=getDistortedCoords(vUV); \nvec2 texels_coords=vec2(vUV.x*screen_width,vUV.y*screen_height); \nfloat depth=texture2D(depthSampler,distorted_coords).r; \nfloat distance=near+(far-near)*depth; \nvec4 color=texture2D(textureSampler,vUV); \nfloat coc=abs(aperture*(screen_distance*(inverse_focal_length-1.0/distance)-1.0));if (dof_enabled==false || coc<0.07) { coc=0.0; }\nfloat edge_blur_amount=0.0;if (edge_blur>0.0) {edge_blur_amount=clamp((radius*2.0-1.0+0.15*edge_blur)*1.5,0.0,1.0)*1.3;}\nfloat blur_amount=max(edge_blur_amount,coc);if (blur_amount==0.0) {gl_FragColor=texture2D(textureSampler,distorted_coords);}\nelse {gl_FragColor=getBlurColor(blur_amount*1.7);if (highlights) {gl_FragColor.rgb+=clamp(coc,0.0,1.0)*texture2D(highlightsSampler,distorted_coords).rgb;}\nif (blur_noise) {vec2 noise=rand(distorted_coords)*0.01*blur_amount;vec2 blurred_coord=vec2(distorted_coords.x+noise.x,distorted_coords.y+noise.y);gl_FragColor=0.04*texture2D(textureSampler,blurred_coord)+0.96*gl_FragColor;}}\nif (grain_amount>0.0) {vec4 grain_color=texture2D(grainSampler,texels_coords*0.003);gl_FragColor.rgb+=(-0.5+grain_color.rgb)*0.30*grain_amount;}}\n`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @internal */\nexport const depthOfFieldPixelShader = { name, shader };\n//# sourceMappingURL=depthOfField.fragment.js.map","// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore.js\";\nconst name = \"passCubePixelShader\";\nconst shader = `varying vec2 vUV;uniform samplerCube textureSampler;\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) \n{vec2 uv=vUV*2.0-1.0;\n#ifdef POSITIVEX\ngl_FragColor=textureCube(textureSampler,vec3(1.001,uv.y,uv.x));\n#endif\n#ifdef NEGATIVEX\ngl_FragColor=textureCube(textureSampler,vec3(-1.001,uv.y,uv.x));\n#endif\n#ifdef POSITIVEY\ngl_FragColor=textureCube(textureSampler,vec3(uv.y,1.001,uv.x));\n#endif\n#ifdef NEGATIVEY\ngl_FragColor=textureCube(textureSampler,vec3(uv.y,-1.001,uv.x));\n#endif\n#ifdef POSITIVEZ\ngl_FragColor=textureCube(textureSampler,vec3(uv,1.001));\n#endif\n#ifdef NEGATIVEZ\ngl_FragColor=textureCube(textureSampler,vec3(uv,-1.001));\n#endif\n}`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @internal */\nexport const passCubePixelShader = { name, shader };\n//# sourceMappingURL=passCube.fragment.js.map","\nimport { PostProcess } from \"./postProcess.js\";\nimport { Engine } from \"../Engines/engine.js\";\nimport \"../Shaders/pass.fragment.js\";\nimport \"../Shaders/passCube.fragment.js\";\nimport { RegisterClass } from \"../Misc/typeStore.js\";\nimport { SerializationHelper } from \"../Misc/decorators.js\";\n/**\n * PassPostProcess which produces an output the same as it's input\n */\nexport class PassPostProcess extends PostProcess {\n /**\n * Gets a string identifying the name of the class\n * @returns \"PassPostProcess\" string\n */\n getClassName() {\n return \"PassPostProcess\";\n }\n /**\n * Creates the PassPostProcess\n * @param name The name of the effect.\n * @param options The required width/height ratio to downsize to before computing the render pass.\n * @param camera The camera to apply the render pass to.\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\n * @param engine The engine which the post process will be applied. (default: current engine)\n * @param reusable If the post process can be reused on the same frame. (default: false)\n * @param textureType The type of texture to be used when performing the post processing.\n * @param blockCompilation If compilation of the shader should not be done in the constructor. The updateEffect method can be used to compile the shader at a later time. (default: false)\n */\n constructor(name, options, camera = null, samplingMode, engine, reusable, textureType = 0, blockCompilation = false) {\n super(name, \"pass\", null, null, options, camera, samplingMode, engine, reusable, undefined, textureType, undefined, null, blockCompilation);\n }\n /**\n * @internal\n */\n static _Parse(parsedPostProcess, targetCamera, scene, rootUrl) {\n return SerializationHelper.Parse(() => {\n return new PassPostProcess(parsedPostProcess.name, parsedPostProcess.options, targetCamera, parsedPostProcess.renderTargetSamplingMode, parsedPostProcess._engine, parsedPostProcess.reusable);\n }, parsedPostProcess, scene, rootUrl);\n }\n}\nRegisterClass(\"BABYLON.PassPostProcess\", PassPostProcess);\n/**\n * PassCubePostProcess which produces an output the same as it's input (which must be a cube texture)\n */\nexport class PassCubePostProcess extends PostProcess {\n /**\n * Gets or sets the cube face to display.\n * * 0 is +X\n * * 1 is -X\n * * 2 is +Y\n * * 3 is -Y\n * * 4 is +Z\n * * 5 is -Z\n */\n get face() {\n return this._face;\n }\n set face(value) {\n if (value < 0 || value > 5) {\n return;\n }\n this._face = value;\n switch (this._face) {\n case 0:\n this.updateEffect(\"#define POSITIVEX\");\n break;\n case 1:\n this.updateEffect(\"#define NEGATIVEX\");\n break;\n case 2:\n this.updateEffect(\"#define POSITIVEY\");\n break;\n case 3:\n this.updateEffect(\"#define NEGATIVEY\");\n break;\n case 4:\n this.updateEffect(\"#define POSITIVEZ\");\n break;\n case 5:\n this.updateEffect(\"#define NEGATIVEZ\");\n break;\n }\n }\n /**\n * Gets a string identifying the name of the class\n * @returns \"PassCubePostProcess\" string\n */\n getClassName() {\n return \"PassCubePostProcess\";\n }\n /**\n * Creates the PassCubePostProcess\n * @param name The name of the effect.\n * @param options The required width/height ratio to downsize to before computing the render pass.\n * @param camera The camera to apply the render pass to.\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\n * @param engine The engine which the post process will be applied. (default: current engine)\n * @param reusable If the post process can be reused on the same frame. (default: false)\n * @param textureType The type of texture to be used when performing the post processing.\n * @param blockCompilation If compilation of the shader should not be done in the constructor. The updateEffect method can be used to compile the shader at a later time. (default: false)\n */\n constructor(name, options, camera = null, samplingMode, engine, reusable, textureType = 0, blockCompilation = false) {\n super(name, \"passCube\", null, null, options, camera, samplingMode, engine, reusable, \"#define POSITIVEX\", textureType, undefined, null, blockCompilation);\n this._face = 0;\n }\n /**\n * @internal\n */\n static _Parse(parsedPostProcess, targetCamera, scene, rootUrl) {\n return SerializationHelper.Parse(() => {\n return new PassCubePostProcess(parsedPostProcess.name, parsedPostProcess.options, targetCamera, parsedPostProcess.renderTargetSamplingMode, parsedPostProcess._engine, parsedPostProcess.reusable);\n }, parsedPostProcess, scene, rootUrl);\n }\n}\nEngine._RescalePostProcessFactory = (engine) => {\n return new PassPostProcess(\"rescale\", 1, null, 2, engine, false, 0);\n};\n//# sourceMappingURL=passPostProcess.js.map","\n/**\n * Contains all parameters needed for the prepass to perform\n * screen space subsurface scattering\n */\nexport class SSAO2Configuration {\n constructor() {\n /**\n * Is subsurface enabled\n */\n this.enabled = false;\n /**\n * Name of the configuration\n */\n this.name = \"ssao2\";\n /**\n * Textures that should be present in the MRT for this effect to work\n */\n this.texturesRequired = [6, 5];\n }\n}\n//# sourceMappingURL=ssao2Configuration.js.map","// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore.js\";\nconst name = \"ssao2PixelShader\";\nconst shader = `precision highp float;uniform sampler2D textureSampler;varying vec2 vUV;\n#ifdef SSAO\nfloat scales[16]=float[16](\n0.1,\n0.11406250000000001,\n0.131640625,\n0.15625,\n0.187890625,\n0.2265625,\n0.272265625,\n0.325,\n0.384765625,\n0.4515625,\n0.525390625,\n0.60625,\n0.694140625,\n0.7890625,\n0.891015625,\n1.0\n);uniform float near;uniform float radius;uniform sampler2D depthSampler;uniform sampler2D randomSampler;uniform sampler2D normalSampler;uniform float randTextureTiles;uniform float samplesFactor;uniform vec3 sampleSphere[SAMPLES];uniform float totalStrength;uniform float base;uniform float xViewport;uniform float yViewport;uniform mat3 depthProjection;uniform float maxZ;uniform float minZAspect;uniform vec2 texelSize;uniform mat4 projection;void main()\n{vec3 random=textureLod(randomSampler,vUV*randTextureTiles,0.0).rgb;float depth=textureLod(depthSampler,vUV,0.0).r;float depthSign=depth/abs(depth);depth=depth*depthSign;vec3 normal=textureLod(normalSampler,vUV,0.0).rgb;float occlusion=0.0;float correctedRadius=min(radius,minZAspect*depth/near);vec3 vViewRay=vec3((vUV.x*2.0-1.0)*xViewport,(vUV.y*2.0-1.0)*yViewport,depthSign);vec3 vDepthFactor=depthProjection*vec3(1.0,1.0,depth);vec3 origin=vViewRay*vDepthFactor;vec3 rvec=random*2.0-1.0;rvec.z=0.0;float dotProduct=dot(rvec,normal);rvec=1.0-abs(dotProduct)>1e-2 ? rvec : vec3(-rvec.y,0.0,rvec.x);vec3 tangent=normalize(rvec-normal*dot(rvec,normal));vec3 bitangent=cross(normal,tangent);mat3 tbn=mat3(tangent,bitangent,normal);float difference;for (int i=0; i1.0 || offset.y>1.0) {continue;}\nfloat sampleDepth=abs(textureLod(depthSampler,offset.xy,0.0).r);difference=depthSign*samplePosition.z-sampleDepth;float rangeCheck=1.0-smoothstep(correctedRadius*0.5,correctedRadius,difference);occlusion+=step(EPSILON,difference)*rangeCheck;}\nocclusion=occlusion*(1.0-smoothstep(maxZ*0.75,maxZ,depth));float ao=1.0-totalStrength*occlusion*samplesFactor;float result=clamp(ao+base,0.0,1.0);gl_FragColor=vec4(vec3(result),1.0);}\n#endif\n#ifdef BLUR\nuniform float outSize;uniform float soften;uniform float tolerance;uniform int samples;\n#ifndef BLUR_BYPASS\nuniform sampler2D depthSampler;\n#ifdef BLUR_LEGACY\n#define inline\nfloat blur13Bilateral(sampler2D image,vec2 uv,vec2 step) {float result=0.0;vec2 off1=vec2(1.411764705882353)*step;vec2 off2=vec2(3.2941176470588234)*step;vec2 off3=vec2(5.176470588235294)*step;float compareDepth=abs(textureLod(depthSampler,uv,0.0).r);float sampleDepth;float weight;float weightSum=30.0;result+=textureLod(image,uv,0.0).r*30.0;sampleDepth=abs(textureLod(depthSampler,uv+off1,0.0).r);weight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);weightSum+= weight;result+=textureLod(image,uv+off1,0.0).r*weight;sampleDepth=abs(textureLod(depthSampler,uv-off1,0.0).r);weight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);weightSum+= weight;result+=textureLod(image,uv-off1,0.0).r*weight;sampleDepth=abs(textureLod(depthSampler,uv+off2,0.0).r);weight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);weightSum+=weight;result+=textureLod(image,uv+off2,0.0).r*weight;sampleDepth=abs(textureLod(depthSampler,uv-off2,0.0).r);weight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);weightSum+=weight;result+=textureLod(image,uv-off2,0.0).r*weight;sampleDepth=abs(textureLod(depthSampler,uv+off3,0.0).r);weight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);weightSum+=weight;result+=textureLod(image,uv+off3,0.0).r*weight;sampleDepth=abs(textureLod(depthSampler,uv-off3,0.0).r);weight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);weightSum+=weight;result+=textureLod(image,uv-off3,0.0).r*weight;return result/weightSum;}\n#endif\n#endif\nvoid main()\n{float result=0.0;\n#ifdef BLUR_BYPASS\nresult=textureLod(textureSampler,vUV,0.0).r;\n#else\n#ifdef BLUR_H\nvec2 step=vec2(1.0/outSize,0.0);\n#else\nvec2 step=vec2(0.0,1.0/outSize);\n#endif\n#ifdef BLUR_LEGACY\nresult=blur13Bilateral(textureSampler,vUV,step);\n#else\nfloat compareDepth=abs(textureLod(depthSampler,vUV,0.0).r);float weightSum=0.0;for (int i=-samples; i {\n return this._originalColorPostProcess;\n }, true));\n this.addEffect(new PostProcessRenderEffect(scene.getEngine(), this.SSAORenderEffect, () => {\n return this._ssaoPostProcess;\n }, true));\n this.addEffect(new PostProcessRenderEffect(scene.getEngine(), this.SSAOBlurHRenderEffect, () => {\n return this._blurHPostProcess;\n }, true));\n this.addEffect(new PostProcessRenderEffect(scene.getEngine(), this.SSAOBlurVRenderEffect, () => {\n return this._blurVPostProcess;\n }, true));\n this.addEffect(new PostProcessRenderEffect(scene.getEngine(), this.SSAOCombineRenderEffect, () => {\n return this._ssaoCombinePostProcess;\n }, true));\n // Finish\n scene.postProcessRenderPipelineManager.addPipeline(this);\n if (cameras) {\n scene.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(name, cameras);\n }\n }\n // Public Methods\n /**\n * Get the class name\n * @returns \"SSAO2RenderingPipeline\"\n */\n getClassName() {\n return \"SSAO2RenderingPipeline\";\n }\n /**\n * Removes the internal pipeline assets and detaches the pipeline from the scene cameras\n * @param disableGeometryBufferRenderer\n */\n dispose(disableGeometryBufferRenderer = false) {\n for (let i = 0; i < this._scene.cameras.length; i++) {\n const camera = this._scene.cameras[i];\n this._originalColorPostProcess.dispose(camera);\n this._ssaoPostProcess.dispose(camera);\n this._blurHPostProcess.dispose(camera);\n this._blurVPostProcess.dispose(camera);\n this._ssaoCombinePostProcess.dispose(camera);\n }\n this._randomTexture.dispose();\n if (disableGeometryBufferRenderer) {\n this._scene.disableGeometryBufferRenderer();\n }\n this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name, this._scene.cameras);\n super.dispose();\n }\n // Private Methods\n /** @internal */\n _rebuild() {\n super._rebuild();\n }\n _getSamplersForBlur(disabled) {\n return disabled ? [\"textureSampler\"] : [\"textureSampler\", \"depthSampler\"];\n }\n _getDefinesForBlur(bilateral, disabled) {\n let define = \"#define BLUR\\n\";\n if (disabled) {\n define += \"#define BLUR_BYPASS\\n\";\n }\n if (!bilateral) {\n define += \"#define BLUR_LEGACY\\n\";\n }\n return { h: define + \"#define BLUR_H\\n\", v: define };\n }\n _createBlurPostProcess(ssaoRatio, blurRatio, textureType) {\n const defines = this._getDefinesForBlur(this.expensiveBlur, this.bypassBlur);\n const samplers = this._getSamplersForBlur(this.bypassBlur);\n this._blurHPostProcess = this._createBlurFilter(\"BlurH\", samplers, ssaoRatio, defines.h, textureType, true);\n this._blurVPostProcess = this._createBlurFilter(\"BlurV\", samplers, blurRatio, defines.v, textureType, false);\n }\n _createBlurFilter(name, samplers, ratio, defines, textureType, horizontal) {\n const blurFilter = new PostProcess(name, \"ssao2\", [\"outSize\", \"samples\", \"soften\", \"tolerance\"], samplers, ratio, null, Texture.BILINEAR_SAMPLINGMODE, this._scene.getEngine(), false, defines, textureType);\n blurFilter.onApply = (effect) => {\n if (!this._scene.activeCamera) {\n return;\n }\n const ssaoCombineSize = horizontal ? this._ssaoCombinePostProcess.width : this._ssaoCombinePostProcess.height;\n const originalColorSize = horizontal ? this._originalColorPostProcess.width : this._originalColorPostProcess.height;\n effect.setFloat(\"outSize\", ssaoCombineSize > 0 ? ssaoCombineSize : originalColorSize);\n effect.setInt(\"samples\", this.bilateralSamples);\n effect.setFloat(\"soften\", this.bilateralSoften);\n effect.setFloat(\"tolerance\", this.bilateralTolerance);\n if (this._geometryBufferRenderer) {\n effect.setTexture(\"depthSampler\", this._geometryBufferRenderer.getGBuffer().textures[0]);\n }\n else if (this._prePassRenderer) {\n effect.setTexture(\"depthSampler\", this._prePassRenderer.getRenderTarget().textures[this._prePassRenderer.getIndex(5)]);\n }\n };\n blurFilter.samples = this.textureSamples;\n return blurFilter;\n }\n //Van der Corput radical inverse\n _radicalInverse_VdC(i) {\n this._bits[0] = i;\n this._bits[0] = ((this._bits[0] << 16) | (this._bits[0] >> 16)) >>> 0;\n this._bits[0] = ((this._bits[0] & 0x55555555) << 1) | (((this._bits[0] & 0xaaaaaaaa) >>> 1) >>> 0);\n this._bits[0] = ((this._bits[0] & 0x33333333) << 2) | (((this._bits[0] & 0xcccccccc) >>> 2) >>> 0);\n this._bits[0] = ((this._bits[0] & 0x0f0f0f0f) << 4) | (((this._bits[0] & 0xf0f0f0f0) >>> 4) >>> 0);\n this._bits[0] = ((this._bits[0] & 0x00ff00ff) << 8) | (((this._bits[0] & 0xff00ff00) >>> 8) >>> 0);\n return this._bits[0] * 2.3283064365386963e-10; // / 0x100000000 or / 4294967296\n }\n _hammersley(i, n) {\n return [i / n, this._radicalInverse_VdC(i)];\n }\n _hemisphereSample_uniform(u, v) {\n const phi = v * 2.0 * Math.PI;\n // rejecting samples that are close to tangent plane to avoid z-fighting artifacts\n const cosTheta = 1.0 - u * 0.85;\n const sinTheta = Math.sqrt(1.0 - cosTheta * cosTheta);\n return new Vector3(Math.cos(phi) * sinTheta, Math.sin(phi) * sinTheta, cosTheta);\n }\n _generateHemisphere() {\n const numSamples = this.samples;\n const result = [];\n let vector;\n let i = 0;\n while (i < numSamples) {\n if (numSamples < 16) {\n vector = this._hemisphereSample_uniform(Math.random(), Math.random());\n }\n else {\n const rand = this._hammersley(i, numSamples);\n vector = this._hemisphereSample_uniform(rand[0], rand[1]);\n }\n result.push(vector.x, vector.y, vector.z);\n i++;\n }\n return result;\n }\n _getDefinesForSSAO() {\n const defines = `#define SSAO\\n#define SAMPLES ${this.samples}\\n#define EPSILON ${this.epsilon.toFixed(4)}`;\n return defines;\n }\n _createSSAOPostProcess(ratio, textureType) {\n this._sampleSphere = this._generateHemisphere();\n const defines = this._getDefinesForSSAO();\n const samplers = [\"randomSampler\", \"depthSampler\", \"normalSampler\"];\n this._ssaoPostProcess = new PostProcess(\"ssao2\", \"ssao2\", [\n \"sampleSphere\",\n \"samplesFactor\",\n \"randTextureTiles\",\n \"totalStrength\",\n \"radius\",\n \"base\",\n \"range\",\n \"projection\",\n \"near\",\n \"texelSize\",\n \"xViewport\",\n \"yViewport\",\n \"maxZ\",\n \"minZAspect\",\n \"depthProjection\",\n ], samplers, ratio, null, Texture.BILINEAR_SAMPLINGMODE, this._scene.getEngine(), false, defines, textureType);\n this._ssaoPostProcess.onApply = (effect) => {\n var _a, _b, _c, _d;\n if (!this._scene.activeCamera) {\n return;\n }\n effect.setArray3(\"sampleSphere\", this._sampleSphere);\n effect.setFloat(\"randTextureTiles\", 32.0);\n effect.setFloat(\"samplesFactor\", 1 / this.samples);\n effect.setFloat(\"totalStrength\", this.totalStrength);\n effect.setFloat2(\"texelSize\", 1 / this._ssaoPostProcess.width, 1 / this._ssaoPostProcess.height);\n effect.setFloat(\"radius\", this.radius);\n effect.setFloat(\"maxZ\", this.maxZ);\n effect.setFloat(\"minZAspect\", this.minZAspect);\n effect.setFloat(\"base\", this.base);\n effect.setFloat(\"near\", this._scene.activeCamera.minZ);\n if (this._scene.activeCamera.mode === Camera.PERSPECTIVE_CAMERA) {\n effect.setMatrix3x3(\"depthProjection\", SSAO2RenderingPipeline.PERSPECTIVE_DEPTH_PROJECTION);\n effect.setFloat(\"xViewport\", Math.tan(this._scene.activeCamera.fov / 2) * this._scene.getEngine().getAspectRatio(this._scene.activeCamera, true));\n effect.setFloat(\"yViewport\", Math.tan(this._scene.activeCamera.fov / 2));\n }\n else {\n const halfWidth = this._scene.getEngine().getRenderWidth() / 2.0;\n const halfHeight = this._scene.getEngine().getRenderHeight() / 2.0;\n const orthoLeft = (_a = this._scene.activeCamera.orthoLeft) !== null && _a !== void 0 ? _a : -halfWidth;\n const orthoRight = (_b = this._scene.activeCamera.orthoRight) !== null && _b !== void 0 ? _b : halfWidth;\n const orthoBottom = (_c = this._scene.activeCamera.orthoBottom) !== null && _c !== void 0 ? _c : -halfHeight;\n const orthoTop = (_d = this._scene.activeCamera.orthoTop) !== null && _d !== void 0 ? _d : halfHeight;\n effect.setMatrix3x3(\"depthProjection\", SSAO2RenderingPipeline.ORTHO_DEPTH_PROJECTION);\n effect.setFloat(\"xViewport\", (orthoRight - orthoLeft) * 0.5);\n effect.setFloat(\"yViewport\", (orthoTop - orthoBottom) * 0.5);\n }\n effect.setMatrix(\"projection\", this._scene.getProjectionMatrix());\n if (this._geometryBufferRenderer) {\n effect.setTexture(\"depthSampler\", this._geometryBufferRenderer.getGBuffer().textures[0]);\n effect.setTexture(\"normalSampler\", this._geometryBufferRenderer.getGBuffer().textures[1]);\n }\n else if (this._prePassRenderer) {\n effect.setTexture(\"depthSampler\", this._prePassRenderer.getRenderTarget().textures[this._prePassRenderer.getIndex(5)]);\n effect.setTexture(\"normalSampler\", this._prePassRenderer.getRenderTarget().textures[this._prePassRenderer.getIndex(6)]);\n }\n effect.setTexture(\"randomSampler\", this._randomTexture);\n };\n this._ssaoPostProcess.samples = this.textureSamples;\n if (!this._forceGeometryBuffer) {\n this._ssaoPostProcess._prePassEffectConfiguration = new SSAO2Configuration();\n }\n }\n _createSSAOCombinePostProcess(ratio, textureType) {\n this._ssaoCombinePostProcess = new PostProcess(\"ssaoCombine\", \"ssaoCombine\", [], [\"originalColor\", \"viewport\"], ratio, null, Texture.BILINEAR_SAMPLINGMODE, this._scene.getEngine(), false, undefined, textureType);\n this._ssaoCombinePostProcess.onApply = (effect) => {\n const viewport = this._scene.activeCamera.viewport;\n effect.setVector4(\"viewport\", TmpVectors.Vector4[0].copyFromFloats(viewport.x, viewport.y, viewport.width, viewport.height));\n effect.setTextureFromPostProcessOutput(\"originalColor\", this._originalColorPostProcess);\n };\n this._ssaoCombinePostProcess.samples = this.textureSamples;\n }\n _createRandomTexture() {\n const size = 128;\n const data = new Uint8Array(size * size * 4);\n const randVector = Vector2.Zero();\n for (let index = 0; index < data.length;) {\n randVector.set(Scalar.RandomRange(0, 1), Scalar.RandomRange(0, 1)).normalize().scaleInPlace(255);\n data[index++] = Math.floor(randVector.x);\n data[index++] = Math.floor(randVector.y);\n data[index++] = 0;\n data[index++] = 255;\n }\n const texture = RawTexture.CreateRGBATexture(data, size, size, this._scene, false, false, 2);\n texture.name = \"SSAORandomTexture\";\n texture.wrapU = Texture.WRAP_ADDRESSMODE;\n texture.wrapV = Texture.WRAP_ADDRESSMODE;\n this._randomTexture = texture;\n }\n /**\n * Serialize the rendering pipeline (Used when exporting)\n * @returns the serialized object\n */\n serialize() {\n const serializationObject = SerializationHelper.Serialize(this);\n serializationObject.customType = \"SSAO2RenderingPipeline\";\n return serializationObject;\n }\n /**\n * Parse the serialized pipeline\n * @param source Source pipeline.\n * @param scene The scene to load the pipeline to.\n * @param rootUrl The URL of the serialized pipeline.\n * @returns An instantiated pipeline from the serialized object.\n */\n static Parse(source, scene, rootUrl) {\n return SerializationHelper.Parse(() => new SSAO2RenderingPipeline(source._name, scene, source._ratio, undefined, source._forceGeometryBuffer, source._textureType), source, scene, rootUrl);\n }\n}\nSSAO2RenderingPipeline.ORTHO_DEPTH_PROJECTION = [1, 0, 0, 0, 1, 0, 0, 0, 1];\nSSAO2RenderingPipeline.PERSPECTIVE_DEPTH_PROJECTION = [0, 0, 0, 0, 0, 0, 1, 1, 1];\n__decorate([\n serialize()\n], SSAO2RenderingPipeline.prototype, \"totalStrength\", void 0);\n__decorate([\n serialize()\n], SSAO2RenderingPipeline.prototype, \"maxZ\", void 0);\n__decorate([\n serialize()\n], SSAO2RenderingPipeline.prototype, \"minZAspect\", void 0);\n__decorate([\n serialize(\"epsilon\")\n], SSAO2RenderingPipeline.prototype, \"_epsilon\", void 0);\n__decorate([\n serialize(\"samples\")\n], SSAO2RenderingPipeline.prototype, \"_samples\", void 0);\n__decorate([\n serialize(\"textureSamples\")\n], SSAO2RenderingPipeline.prototype, \"_textureSamples\", void 0);\n__decorate([\n serialize()\n], SSAO2RenderingPipeline.prototype, \"_forceGeometryBuffer\", void 0);\n__decorate([\n serialize()\n], SSAO2RenderingPipeline.prototype, \"_ratio\", void 0);\n__decorate([\n serialize()\n], SSAO2RenderingPipeline.prototype, \"_textureType\", void 0);\n__decorate([\n serialize()\n], SSAO2RenderingPipeline.prototype, \"radius\", void 0);\n__decorate([\n serialize()\n], SSAO2RenderingPipeline.prototype, \"base\", void 0);\n__decorate([\n serialize(\"bypassBlur\")\n], SSAO2RenderingPipeline.prototype, \"_bypassBlur\", void 0);\n__decorate([\n serialize(\"expensiveBlur\")\n], SSAO2RenderingPipeline.prototype, \"_expensiveBlur\", void 0);\n__decorate([\n serialize()\n], SSAO2RenderingPipeline.prototype, \"bilateralSamples\", void 0);\n__decorate([\n serialize()\n], SSAO2RenderingPipeline.prototype, \"bilateralSoften\", void 0);\n__decorate([\n serialize()\n], SSAO2RenderingPipeline.prototype, \"bilateralTolerance\", void 0);\nRegisterClass(\"BABYLON.SSAO2RenderingPipeline\", SSAO2RenderingPipeline);\n//# sourceMappingURL=ssao2RenderingPipeline.js.map","// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore.js\";\nconst name = \"ssaoPixelShader\";\nconst shader = `uniform sampler2D textureSampler;varying vec2 vUV;\n#ifdef SSAO\nuniform sampler2D randomSampler;uniform float randTextureTiles;uniform float samplesFactor;uniform vec3 sampleSphere[SAMPLES];uniform float totalStrength;uniform float radius;uniform float area;uniform float fallOff;uniform float base;vec3 normalFromDepth(float depth,vec2 coords)\n{vec2 offset1=vec2(0.0,radius);vec2 offset2=vec2(radius,0.0);float depth1=texture2D(textureSampler,coords+offset1).r;float depth2=texture2D(textureSampler,coords+offset2).r;vec3 p1=vec3(offset1,depth1-depth);vec3 p2=vec3(offset2,depth2-depth);vec3 normal=cross(p1,p2);normal.z=-normal.z;return normalize(normal);}\nvoid main()\n{vec3 random=normalize(texture2D(randomSampler,vUV*randTextureTiles).rgb);float depth=texture2D(textureSampler,vUV).r;vec3 position=vec3(vUV,depth);vec3 normal=normalFromDepth(depth,vUV);float radiusDepth=radius/depth;float occlusion=0.0;vec3 ray;vec3 hemiRay;float occlusionDepth;float difference;for (int i=0; i {\n return this._originalColorPostProcess;\n }, true));\n this.addEffect(new PostProcessRenderEffect(scene.getEngine(), this.SSAORenderEffect, () => {\n return this._ssaoPostProcess;\n }, true));\n this.addEffect(new PostProcessRenderEffect(scene.getEngine(), this.SSAOBlurHRenderEffect, () => {\n return this._blurHPostProcess;\n }, true));\n this.addEffect(new PostProcessRenderEffect(scene.getEngine(), this.SSAOBlurVRenderEffect, () => {\n return this._blurVPostProcess;\n }, true));\n this.addEffect(new PostProcessRenderEffect(scene.getEngine(), this.SSAOCombineRenderEffect, () => {\n return this._ssaoCombinePostProcess;\n }, true));\n // Finish\n scene.postProcessRenderPipelineManager.addPipeline(this);\n if (cameras) {\n scene.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(name, cameras);\n }\n }\n /**\n * @internal\n */\n _attachCameras(cameras, unique) {\n super._attachCameras(cameras, unique);\n for (const camera of this._cameras) {\n this._scene.enableDepthRenderer(camera).getDepthMap(); // Force depth renderer \"on\"\n }\n }\n // Public Methods\n /**\n * Get the class name\n * @returns \"SSAORenderingPipeline\"\n */\n getClassName() {\n return \"SSAORenderingPipeline\";\n }\n /**\n * Removes the internal pipeline assets and detaches the pipeline from the scene cameras\n * @param disableDepthRender\n */\n dispose(disableDepthRender = false) {\n for (let i = 0; i < this._scene.cameras.length; i++) {\n const camera = this._scene.cameras[i];\n this._originalColorPostProcess.dispose(camera);\n this._ssaoPostProcess.dispose(camera);\n this._blurHPostProcess.dispose(camera);\n this._blurVPostProcess.dispose(camera);\n this._ssaoCombinePostProcess.dispose(camera);\n }\n this._randomTexture.dispose();\n if (disableDepthRender) {\n this._scene.disableDepthRenderer();\n }\n this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name, this._scene.cameras);\n super.dispose();\n }\n // Private Methods\n _createBlurPostProcess(ratio) {\n const size = 16;\n this._blurHPostProcess = new BlurPostProcess(\"BlurH\", new Vector2(1, 0), size, ratio, null, Texture.BILINEAR_SAMPLINGMODE, this._scene.getEngine(), false, 0);\n this._blurVPostProcess = new BlurPostProcess(\"BlurV\", new Vector2(0, 1), size, ratio, null, Texture.BILINEAR_SAMPLINGMODE, this._scene.getEngine(), false, 0);\n this._blurHPostProcess.onActivateObservable.add(() => {\n const dw = this._blurHPostProcess.width / this._scene.getEngine().getRenderWidth();\n this._blurHPostProcess.kernel = size * dw;\n });\n this._blurVPostProcess.onActivateObservable.add(() => {\n const dw = this._blurVPostProcess.height / this._scene.getEngine().getRenderHeight();\n this._blurVPostProcess.kernel = size * dw;\n });\n }\n /** @internal */\n _rebuild() {\n this._firstUpdate = true;\n super._rebuild();\n }\n _createSSAOPostProcess(ratio) {\n const numSamples = 16;\n const sampleSphere = [\n 0.5381, 0.1856, -0.4319, 0.1379, 0.2486, 0.443, 0.3371, 0.5679, -0.0057, -0.6999, -0.0451, -0.0019, 0.0689, -0.1598, -0.8547, 0.056, 0.0069, -0.1843, -0.0146, 0.1402,\n 0.0762, 0.01, -0.1924, -0.0344, -0.3577, -0.5301, -0.4358, -0.3169, 0.1063, 0.0158, 0.0103, -0.5869, 0.0046, -0.0897, -0.494, 0.3287, 0.7119, -0.0154, -0.0918, -0.0533,\n 0.0596, -0.5411, 0.0352, -0.0631, 0.546, -0.4776, 0.2847, -0.0271,\n ];\n const samplesFactor = 1.0 / numSamples;\n this._ssaoPostProcess = new PostProcess(\"ssao\", \"ssao\", [\"sampleSphere\", \"samplesFactor\", \"randTextureTiles\", \"totalStrength\", \"radius\", \"area\", \"fallOff\", \"base\", \"range\", \"viewport\"], [\"randomSampler\"], ratio, null, Texture.BILINEAR_SAMPLINGMODE, this._scene.getEngine(), false, \"#define SAMPLES \" + numSamples + \"\\n#define SSAO\");\n this._ssaoPostProcess.externalTextureSamplerBinding = true;\n this._ssaoPostProcess.onApply = (effect) => {\n if (this._firstUpdate) {\n effect.setArray3(\"sampleSphere\", sampleSphere);\n effect.setFloat(\"samplesFactor\", samplesFactor);\n effect.setFloat(\"randTextureTiles\", 4.0);\n }\n effect.setFloat(\"totalStrength\", this.totalStrength);\n effect.setFloat(\"radius\", this.radius);\n effect.setFloat(\"area\", this.area);\n effect.setFloat(\"fallOff\", this.fallOff);\n effect.setFloat(\"base\", this.base);\n effect.setTexture(\"textureSampler\", this._scene.enableDepthRenderer(this._scene.activeCamera).getDepthMap());\n effect.setTexture(\"randomSampler\", this._randomTexture);\n };\n }\n _createSSAOCombinePostProcess(ratio) {\n this._ssaoCombinePostProcess = new PostProcess(\"ssaoCombine\", \"ssaoCombine\", [], [\"originalColor\", \"viewport\"], ratio, null, Texture.BILINEAR_SAMPLINGMODE, this._scene.getEngine(), false);\n this._ssaoCombinePostProcess.onApply = (effect) => {\n effect.setVector4(\"viewport\", TmpVectors.Vector4[0].copyFromFloats(0, 0, 1.0, 1.0));\n effect.setTextureFromPostProcess(\"originalColor\", this._originalColorPostProcess);\n };\n }\n _createRandomTexture() {\n const size = 512;\n const data = new Uint8Array(size * size * 4);\n for (let index = 0; index < data.length;) {\n data[index++] = Math.floor(Math.max(0.0, Scalar.RandomRange(-1.0, 1.0)) * 255);\n data[index++] = Math.floor(Math.max(0.0, Scalar.RandomRange(-1.0, 1.0)) * 255);\n data[index++] = Math.floor(Math.max(0.0, Scalar.RandomRange(-1.0, 1.0)) * 255);\n data[index++] = 255;\n }\n const texture = RawTexture.CreateRGBATexture(data, size, size, this._scene, false, false, 2);\n texture.name = \"SSAORandomTexture\";\n texture.wrapU = Texture.WRAP_ADDRESSMODE;\n texture.wrapV = Texture.WRAP_ADDRESSMODE;\n this._randomTexture = texture;\n }\n}\n__decorate([\n serialize()\n], SSAORenderingPipeline.prototype, \"totalStrength\", void 0);\n__decorate([\n serialize()\n], SSAORenderingPipeline.prototype, \"radius\", void 0);\n__decorate([\n serialize()\n], SSAORenderingPipeline.prototype, \"area\", void 0);\n__decorate([\n serialize()\n], SSAORenderingPipeline.prototype, \"fallOff\", void 0);\n__decorate([\n serialize()\n], SSAORenderingPipeline.prototype, \"base\", void 0);\n//# sourceMappingURL=ssaoRenderingPipeline.js.map","import { InternalTexture, InternalTextureSource } from \"../../Materials/Textures/internalTexture.js\";\nimport { Logger } from \"../../Misc/logger.js\";\n\nimport { ThinEngine } from \"../thinEngine.js\";\nThinEngine.prototype.restoreSingleAttachment = function () {\n const gl = this._gl;\n this.bindAttachments([gl.BACK]);\n};\nThinEngine.prototype.restoreSingleAttachmentForRenderTarget = function () {\n const gl = this._gl;\n this.bindAttachments([gl.COLOR_ATTACHMENT0]);\n};\nThinEngine.prototype.buildTextureLayout = function (textureStatus) {\n const gl = this._gl;\n const result = [];\n for (let i = 0; i < textureStatus.length; i++) {\n if (textureStatus[i]) {\n result.push(gl[\"COLOR_ATTACHMENT\" + i]);\n }\n else {\n result.push(gl.NONE);\n }\n }\n return result;\n};\nThinEngine.prototype.bindAttachments = function (attachments) {\n const gl = this._gl;\n gl.drawBuffers(attachments);\n};\nThinEngine.prototype.unBindMultiColorAttachmentFramebuffer = function (rtWrapper, disableGenerateMipMaps = false, onBeforeUnbind) {\n this._currentRenderTarget = null;\n // If MSAA, we need to bitblt back to main texture\n const gl = this._gl;\n const attachments = rtWrapper._attachments;\n const count = attachments.length;\n if (rtWrapper._MSAAFramebuffer) {\n gl.bindFramebuffer(gl.READ_FRAMEBUFFER, rtWrapper._MSAAFramebuffer);\n gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, rtWrapper._framebuffer);\n for (let i = 0; i < count; i++) {\n const texture = rtWrapper.textures[i];\n for (let j = 0; j < count; j++) {\n attachments[j] = gl.NONE;\n }\n attachments[i] = gl[this.webGLVersion > 1 ? \"COLOR_ATTACHMENT\" + i : \"COLOR_ATTACHMENT\" + i + \"_WEBGL\"];\n gl.readBuffer(attachments[i]);\n gl.drawBuffers(attachments);\n gl.blitFramebuffer(0, 0, texture.width, texture.height, 0, 0, texture.width, texture.height, gl.COLOR_BUFFER_BIT, gl.NEAREST);\n }\n for (let i = 0; i < count; i++) {\n attachments[i] = gl[this.webGLVersion > 1 ? \"COLOR_ATTACHMENT\" + i : \"COLOR_ATTACHMENT\" + i + \"_WEBGL\"];\n }\n gl.drawBuffers(attachments);\n }\n for (let i = 0; i < count; i++) {\n const texture = rtWrapper.textures[i];\n if ((texture === null || texture === void 0 ? void 0 : texture.generateMipMaps) && !disableGenerateMipMaps && !texture.isCube) {\n this._bindTextureDirectly(gl.TEXTURE_2D, texture, true);\n gl.generateMipmap(gl.TEXTURE_2D);\n this._bindTextureDirectly(gl.TEXTURE_2D, null);\n }\n }\n if (onBeforeUnbind) {\n if (rtWrapper._MSAAFramebuffer) {\n // Bind the correct framebuffer\n this._bindUnboundFramebuffer(rtWrapper._framebuffer);\n }\n onBeforeUnbind();\n }\n this._bindUnboundFramebuffer(null);\n};\nThinEngine.prototype.createMultipleRenderTarget = function (size, options, initializeBuffers = true) {\n var _a;\n let generateMipMaps = false;\n let generateDepthBuffer = true;\n let generateStencilBuffer = false;\n let generateDepthTexture = false;\n let depthTextureFormat = 15;\n let textureCount = 1;\n const defaultType = 0;\n const defaultSamplingMode = 3;\n const defaultUseSRGBBuffer = false;\n const defaultFormat = 5;\n const defaultTarget = 3553;\n let types = new Array();\n let samplingModes = new Array();\n let useSRGBBuffers = new Array();\n let formats = new Array();\n let targets = new Array();\n let faceIndex = new Array();\n let layerIndex = new Array();\n let layers = new Array();\n const rtWrapper = this._createHardwareRenderTargetWrapper(true, false, size);\n if (options !== undefined) {\n generateMipMaps = options.generateMipMaps === undefined ? false : options.generateMipMaps;\n generateDepthBuffer = options.generateDepthBuffer === undefined ? true : options.generateDepthBuffer;\n generateStencilBuffer = options.generateStencilBuffer === undefined ? false : options.generateStencilBuffer;\n generateDepthTexture = options.generateDepthTexture === undefined ? false : options.generateDepthTexture;\n textureCount = options.textureCount || 1;\n if (options.types) {\n types = options.types;\n }\n if (options.samplingModes) {\n samplingModes = options.samplingModes;\n }\n if (options.useSRGBBuffers) {\n useSRGBBuffers = options.useSRGBBuffers;\n }\n if (options.formats) {\n formats = options.formats;\n }\n if (options.targetTypes) {\n targets = options.targetTypes;\n }\n if (options.faceIndex) {\n faceIndex = options.faceIndex;\n }\n if (options.layerIndex) {\n layerIndex = options.layerIndex;\n }\n if (options.layerCounts) {\n layers = options.layerCounts;\n }\n if (this.webGLVersion > 1 &&\n (options.depthTextureFormat === 13 ||\n options.depthTextureFormat === 17 ||\n options.depthTextureFormat === 16 ||\n options.depthTextureFormat === 14 ||\n options.depthTextureFormat === 18)) {\n depthTextureFormat = options.depthTextureFormat;\n }\n }\n const gl = this._gl;\n // Create the framebuffer\n const framebuffer = gl.createFramebuffer();\n this._bindUnboundFramebuffer(framebuffer);\n const width = size.width || size;\n const height = size.height || size;\n const textures = [];\n const attachments = [];\n const useStencilTexture = this.webGLVersion > 1 &&\n generateDepthTexture &&\n (options.depthTextureFormat === 13 ||\n options.depthTextureFormat === 17 ||\n options.depthTextureFormat === 18);\n const depthStencilBuffer = this._setupFramebufferDepthAttachments(!useStencilTexture && generateStencilBuffer, !generateDepthTexture && generateDepthBuffer, width, height);\n rtWrapper._framebuffer = framebuffer;\n rtWrapper._depthStencilBuffer = depthStencilBuffer;\n rtWrapper._generateDepthBuffer = !generateDepthTexture && generateDepthBuffer;\n rtWrapper._generateStencilBuffer = !useStencilTexture && generateStencilBuffer;\n rtWrapper._attachments = attachments;\n for (let i = 0; i < textureCount; i++) {\n let samplingMode = samplingModes[i] || defaultSamplingMode;\n let type = types[i] || defaultType;\n let useSRGBBuffer = useSRGBBuffers[i] || defaultUseSRGBBuffer;\n const format = formats[i] || defaultFormat;\n const target = targets[i] || defaultTarget;\n const layerCount = (_a = layers[i]) !== null && _a !== void 0 ? _a : 1;\n if (type === 1 && !this._caps.textureFloatLinearFiltering) {\n // if floating point linear (gl.FLOAT) then force to NEAREST_SAMPLINGMODE\n samplingMode = 1;\n }\n else if (type === 2 && !this._caps.textureHalfFloatLinearFiltering) {\n // if floating point linear (HALF_FLOAT) then force to NEAREST_SAMPLINGMODE\n samplingMode = 1;\n }\n const filters = this._getSamplingParameters(samplingMode, generateMipMaps);\n if (type === 1 && !this._caps.textureFloat) {\n type = 0;\n Logger.Warn(\"Float textures are not supported. Render target forced to TEXTURETYPE_UNSIGNED_BYTE type\");\n }\n useSRGBBuffer = useSRGBBuffer && this._caps.supportSRGBBuffers && (this.webGLVersion > 1 || this.isWebGPU);\n const isWebGL2 = this.webGLVersion > 1;\n const attachment = gl[isWebGL2 ? \"COLOR_ATTACHMENT\" + i : \"COLOR_ATTACHMENT\" + i + \"_WEBGL\"];\n attachments.push(attachment);\n if (target === -1) {\n continue;\n }\n const texture = new InternalTexture(this, InternalTextureSource.MultiRenderTarget);\n textures[i] = texture;\n gl.activeTexture(gl[\"TEXTURE\" + i]);\n gl.bindTexture(target, texture._hardwareTexture.underlyingResource);\n gl.texParameteri(target, gl.TEXTURE_MAG_FILTER, filters.mag);\n gl.texParameteri(target, gl.TEXTURE_MIN_FILTER, filters.min);\n gl.texParameteri(target, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(target, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n const internalSizedFormat = this._getRGBABufferInternalSizedFormat(type, format, useSRGBBuffer);\n const internalFormat = this._getInternalFormat(format);\n const webGLTextureType = this._getWebGLTextureType(type);\n if (isWebGL2 && (target === 35866 || target === 32879)) {\n if (target === 35866) {\n texture.is2DArray = true;\n }\n else {\n texture.is3D = true;\n }\n texture.baseDepth = texture.depth = layerCount;\n gl.texImage3D(target, 0, internalSizedFormat, width, height, layerCount, 0, internalFormat, webGLTextureType, null);\n }\n else if (target === 34067) {\n // We have to generate all faces to complete the framebuffer\n for (let i = 0; i < 6; i++) {\n gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, internalSizedFormat, width, height, 0, internalFormat, webGLTextureType, null);\n }\n texture.isCube = true;\n }\n else {\n gl.texImage2D(gl.TEXTURE_2D, 0, internalSizedFormat, width, height, 0, internalFormat, webGLTextureType, null);\n }\n if (generateMipMaps) {\n gl.generateMipmap(target);\n }\n // Unbind\n this._bindTextureDirectly(target, null);\n texture.baseWidth = width;\n texture.baseHeight = height;\n texture.width = width;\n texture.height = height;\n texture.isReady = true;\n texture.samples = 1;\n texture.generateMipMaps = generateMipMaps;\n texture.samplingMode = samplingMode;\n texture.type = type;\n texture._useSRGBBuffer = useSRGBBuffer;\n texture.format = format;\n this._internalTexturesCache.push(texture);\n }\n if (generateDepthTexture && this._caps.depthTextureExtension) {\n // Depth texture\n const depthTexture = new InternalTexture(this, InternalTextureSource.Depth);\n let depthTextureType = 5;\n let glDepthTextureInternalFormat = gl.DEPTH_COMPONENT16;\n let glDepthTextureFormat = gl.DEPTH_COMPONENT;\n let glDepthTextureType = gl.UNSIGNED_SHORT;\n let glDepthTextureAttachment = gl.DEPTH_ATTACHMENT;\n if (this.webGLVersion < 2) {\n glDepthTextureInternalFormat = gl.DEPTH_COMPONENT;\n }\n else {\n if (depthTextureFormat === 14) {\n depthTextureType = 1;\n glDepthTextureType = gl.FLOAT;\n glDepthTextureInternalFormat = gl.DEPTH_COMPONENT32F;\n }\n else if (depthTextureFormat === 18) {\n depthTextureType = 0;\n glDepthTextureType = gl.FLOAT_32_UNSIGNED_INT_24_8_REV;\n glDepthTextureInternalFormat = gl.DEPTH32F_STENCIL8;\n glDepthTextureFormat = gl.DEPTH_STENCIL;\n glDepthTextureAttachment = gl.DEPTH_STENCIL_ATTACHMENT;\n }\n else if (depthTextureFormat === 16) {\n depthTextureType = 0;\n glDepthTextureType = gl.UNSIGNED_INT;\n glDepthTextureInternalFormat = gl.DEPTH_COMPONENT24;\n glDepthTextureAttachment = gl.DEPTH_ATTACHMENT;\n }\n else if (depthTextureFormat === 13 || depthTextureFormat === 17) {\n depthTextureType = 12;\n glDepthTextureType = gl.UNSIGNED_INT_24_8;\n glDepthTextureInternalFormat = gl.DEPTH24_STENCIL8;\n glDepthTextureFormat = gl.DEPTH_STENCIL;\n glDepthTextureAttachment = gl.DEPTH_STENCIL_ATTACHMENT;\n }\n }\n gl.activeTexture(gl.TEXTURE0);\n gl.bindTexture(gl.TEXTURE_2D, depthTexture._hardwareTexture.underlyingResource);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n gl.texImage2D(gl.TEXTURE_2D, 0, glDepthTextureInternalFormat, width, height, 0, glDepthTextureFormat, glDepthTextureType, null);\n gl.framebufferTexture2D(gl.FRAMEBUFFER, glDepthTextureAttachment, gl.TEXTURE_2D, depthTexture._hardwareTexture.underlyingResource, 0);\n depthTexture.baseWidth = width;\n depthTexture.baseHeight = height;\n depthTexture.width = width;\n depthTexture.height = height;\n depthTexture.isReady = true;\n depthTexture.samples = 1;\n depthTexture.generateMipMaps = generateMipMaps;\n depthTexture.samplingMode = 1;\n depthTexture.format = depthTextureFormat;\n depthTexture.type = depthTextureType;\n textures[textureCount] = depthTexture;\n this._internalTexturesCache.push(depthTexture);\n }\n rtWrapper.setTextures(textures);\n if (initializeBuffers) {\n gl.drawBuffers(attachments);\n }\n this._bindUnboundFramebuffer(null);\n rtWrapper.setLayerAndFaceIndices(layerIndex, faceIndex);\n this.resetTextureCache();\n return rtWrapper;\n};\nThinEngine.prototype.updateMultipleRenderTargetTextureSampleCount = function (rtWrapper, samples, initializeBuffers = true) {\n if (this.webGLVersion < 2 || !rtWrapper || !rtWrapper.texture) {\n return 1;\n }\n if (rtWrapper.samples === samples) {\n return samples;\n }\n const count = rtWrapper._attachments.length;\n if (count === 0) {\n return 1;\n }\n const gl = this._gl;\n samples = Math.min(samples, this.getCaps().maxMSAASamples);\n // Dispose previous render buffers\n const useDepthStencil = !!rtWrapper._depthStencilBuffer;\n if (useDepthStencil) {\n gl.deleteRenderbuffer(rtWrapper._depthStencilBuffer);\n rtWrapper._depthStencilBuffer = null;\n }\n if (rtWrapper._MSAAFramebuffer) {\n gl.deleteFramebuffer(rtWrapper._MSAAFramebuffer);\n rtWrapper._MSAAFramebuffer = null;\n }\n if (samples > 1 && typeof gl.renderbufferStorageMultisample === \"function\") {\n const framebuffer = gl.createFramebuffer();\n if (!framebuffer) {\n throw new Error(\"Unable to create multi sampled framebuffer\");\n }\n rtWrapper._MSAAFramebuffer = framebuffer;\n this._bindUnboundFramebuffer(framebuffer);\n const attachments = [];\n for (let i = 0; i < count; i++) {\n const texture = rtWrapper.textures[i];\n const hardwareTexture = texture._hardwareTexture;\n hardwareTexture.releaseMSAARenderBuffers();\n }\n for (let i = 0; i < count; i++) {\n const texture = rtWrapper.textures[i];\n const hardwareTexture = texture._hardwareTexture;\n const attachment = gl[this.webGLVersion > 1 ? \"COLOR_ATTACHMENT\" + i : \"COLOR_ATTACHMENT\" + i + \"_WEBGL\"];\n const colorRenderbuffer = this._createRenderBuffer(texture.width, texture.height, samples, -1 /* not used */, this._getRGBAMultiSampleBufferFormat(texture.type, texture.format), attachment);\n if (!colorRenderbuffer) {\n throw new Error(\"Unable to create multi sampled framebuffer\");\n }\n hardwareTexture.addMSAARenderBuffer(colorRenderbuffer);\n texture.samples = samples;\n attachments.push(attachment);\n }\n if (initializeBuffers) {\n gl.drawBuffers(attachments);\n }\n }\n else {\n this._bindUnboundFramebuffer(rtWrapper._framebuffer);\n }\n if (useDepthStencil) {\n rtWrapper._depthStencilBuffer = this._setupFramebufferDepthAttachments(rtWrapper._generateStencilBuffer, rtWrapper._generateDepthBuffer, rtWrapper.texture.width, rtWrapper.texture.height, samples);\n }\n this._bindUnboundFramebuffer(null);\n return samples;\n};\n//# sourceMappingURL=engine.multiRender.js.map","import { Texture } from \"../../Materials/Textures/texture.js\";\nimport { RenderTargetTexture } from \"../../Materials/Textures/renderTargetTexture.js\";\n\nimport \"../../Engines/Extensions/engine.multiRender.js\";\n/**\n * A multi render target, like a render target provides the ability to render to a texture.\n * Unlike the render target, it can render to several draw buffers in one draw.\n * This is specially interesting in deferred rendering or for any effects requiring more than\n * just one color from a single pass.\n */\nexport class MultiRenderTarget extends RenderTargetTexture {\n /**\n * Get if draw buffers are currently supported by the used hardware and browser.\n */\n get isSupported() {\n var _a, _b;\n return (_b = (_a = this._engine) === null || _a === void 0 ? void 0 : _a.getCaps().drawBuffersExtension) !== null && _b !== void 0 ? _b : false;\n }\n /**\n * Get the list of textures generated by the multi render target.\n */\n get textures() {\n return this._textures;\n }\n /**\n * Gets the number of textures in this MRT. This number can be different from `_textures.length` in case a depth texture is generated.\n */\n get count() {\n return this._count;\n }\n /**\n * Get the depth texture generated by the multi render target if options.generateDepthTexture has been set\n */\n get depthTexture() {\n return this._textures[this._textures.length - 1];\n }\n /**\n * Set the wrapping mode on U of all the textures we are rendering to.\n * Can be any of the Texture. (CLAMP_ADDRESSMODE, MIRROR_ADDRESSMODE or WRAP_ADDRESSMODE)\n */\n set wrapU(wrap) {\n if (this._textures) {\n for (let i = 0; i < this._textures.length; i++) {\n this._textures[i].wrapU = wrap;\n }\n }\n }\n /**\n * Set the wrapping mode on V of all the textures we are rendering to.\n * Can be any of the Texture. (CLAMP_ADDRESSMODE, MIRROR_ADDRESSMODE or WRAP_ADDRESSMODE)\n */\n set wrapV(wrap) {\n if (this._textures) {\n for (let i = 0; i < this._textures.length; i++) {\n this._textures[i].wrapV = wrap;\n }\n }\n }\n /**\n * Instantiate a new multi render target texture.\n * A multi render target, like a render target provides the ability to render to a texture.\n * Unlike the render target, it can render to several draw buffers in one draw.\n * This is specially interesting in deferred rendering or for any effects requiring more than\n * just one color from a single pass.\n * @param name Define the name of the texture\n * @param size Define the size of the buffers to render to\n * @param count Define the number of target we are rendering into\n * @param scene Define the scene the texture belongs to\n * @param options Define the options used to create the multi render target\n * @param textureNames Define the names to set to the textures (if count > 0 - optional)\n */\n constructor(name, size, count, scene, options, textureNames) {\n const generateMipMaps = options && options.generateMipMaps ? options.generateMipMaps : false;\n const generateDepthTexture = options && options.generateDepthTexture ? options.generateDepthTexture : false;\n const depthTextureFormat = options && options.depthTextureFormat ? options.depthTextureFormat : 15;\n const doNotChangeAspectRatio = !options || options.doNotChangeAspectRatio === undefined ? true : options.doNotChangeAspectRatio;\n const drawOnlyOnFirstAttachmentByDefault = options && options.drawOnlyOnFirstAttachmentByDefault ? options.drawOnlyOnFirstAttachmentByDefault : false;\n super(name, size, scene, generateMipMaps, doNotChangeAspectRatio, undefined, undefined, undefined, undefined, undefined, undefined, undefined, true);\n if (!this.isSupported) {\n this.dispose();\n return;\n }\n this._textureNames = textureNames;\n const types = [];\n const samplingModes = [];\n const useSRGBBuffers = [];\n const formats = [];\n const targetTypes = [];\n const faceIndex = [];\n const layerIndex = [];\n const layerCounts = [];\n this._initTypes(count, types, samplingModes, useSRGBBuffers, formats, targetTypes, faceIndex, layerIndex, layerCounts, options);\n const generateDepthBuffer = !options || options.generateDepthBuffer === undefined ? true : options.generateDepthBuffer;\n const generateStencilBuffer = !options || options.generateStencilBuffer === undefined ? false : options.generateStencilBuffer;\n this._multiRenderTargetOptions = {\n samplingModes: samplingModes,\n generateMipMaps: generateMipMaps,\n generateDepthBuffer: generateDepthBuffer,\n generateStencilBuffer: generateStencilBuffer,\n generateDepthTexture: generateDepthTexture,\n depthTextureFormat: depthTextureFormat,\n types: types,\n textureCount: count,\n useSRGBBuffers: useSRGBBuffers,\n formats: formats,\n targetTypes: targetTypes,\n faceIndex: faceIndex,\n layerIndex: layerIndex,\n layerCounts: layerCounts,\n };\n this._count = count;\n this._drawOnlyOnFirstAttachmentByDefault = drawOnlyOnFirstAttachmentByDefault;\n if (count > 0) {\n this._createInternalTextures();\n this._createTextures(textureNames);\n }\n }\n _initTypes(count, types, samplingModes, useSRGBBuffers, formats, targets, faceIndex, layerIndex, layerCounts, options) {\n for (let i = 0; i < count; i++) {\n if (options && options.types && options.types[i] !== undefined) {\n types.push(options.types[i]);\n }\n else {\n types.push(options && options.defaultType ? options.defaultType : 0);\n }\n if (options && options.samplingModes && options.samplingModes[i] !== undefined) {\n samplingModes.push(options.samplingModes[i]);\n }\n else {\n samplingModes.push(Texture.BILINEAR_SAMPLINGMODE);\n }\n if (options && options.useSRGBBuffers && options.useSRGBBuffers[i] !== undefined) {\n useSRGBBuffers.push(options.useSRGBBuffers[i]);\n }\n else {\n useSRGBBuffers.push(false);\n }\n if (options && options.formats && options.formats[i] !== undefined) {\n formats.push(options.formats[i]);\n }\n else {\n formats.push(5);\n }\n if (options && options.targetTypes && options.targetTypes[i] !== undefined) {\n targets.push(options.targetTypes[i]);\n }\n else {\n targets.push(3553);\n }\n if (options && options.faceIndex && options.faceIndex[i] !== undefined) {\n faceIndex.push(options.faceIndex[i]);\n }\n else {\n faceIndex.push(0);\n }\n if (options && options.layerIndex && options.layerIndex[i] !== undefined) {\n layerIndex.push(options.layerIndex[i]);\n }\n else {\n layerIndex.push(0);\n }\n if (options && options.layerCounts && options.layerCounts[i] !== undefined) {\n layerCounts.push(options.layerCounts[i]);\n }\n else {\n layerCounts.push(1);\n }\n }\n }\n _createInternaTextureIndexMapping() {\n const mapMainInternalTexture2Index = {};\n const mapInternalTexture2MainIndex = [];\n if (!this._renderTarget) {\n return mapInternalTexture2MainIndex;\n }\n const internalTextures = this._renderTarget.textures;\n for (let i = 0; i < internalTextures.length; i++) {\n const texture = internalTextures[i];\n if (!texture) {\n continue;\n }\n const mainIndex = mapMainInternalTexture2Index[texture.uniqueId];\n if (mainIndex !== undefined) {\n mapInternalTexture2MainIndex[i] = mainIndex;\n }\n else {\n mapMainInternalTexture2Index[texture.uniqueId] = i;\n }\n }\n return mapInternalTexture2MainIndex;\n }\n /**\n * @internal\n */\n _rebuild(forceFullRebuild = false, textureNames) {\n if (this._count < 1) {\n return;\n }\n const mapInternalTexture2MainIndex = this._createInternaTextureIndexMapping();\n this.releaseInternalTextures();\n this._createInternalTextures();\n if (forceFullRebuild) {\n this._releaseTextures();\n this._createTextures(textureNames);\n }\n const internalTextures = this._renderTarget.textures;\n for (let i = 0; i < internalTextures.length; i++) {\n const texture = this._textures[i];\n if (mapInternalTexture2MainIndex[i] !== undefined) {\n this._renderTarget.setTexture(internalTextures[mapInternalTexture2MainIndex[i]], i);\n }\n texture._texture = internalTextures[i];\n if (texture._texture) {\n texture._noMipmap = !texture._texture.useMipMaps;\n texture._useSRGBBuffer = texture._texture._useSRGBBuffer;\n }\n }\n if (this.samples !== 1) {\n this._renderTarget.setSamples(this.samples, !this._drawOnlyOnFirstAttachmentByDefault, true);\n }\n }\n _createInternalTextures() {\n this._renderTarget = this._getEngine().createMultipleRenderTarget(this._size, this._multiRenderTargetOptions, !this._drawOnlyOnFirstAttachmentByDefault);\n this._texture = this._renderTarget.texture;\n }\n _releaseTextures() {\n if (this._textures) {\n for (let i = 0; i < this._textures.length; i++) {\n this._textures[i]._texture = null; // internal textures are released by a call to releaseInternalTextures()\n this._textures[i].dispose();\n }\n }\n }\n _createTextures(textureNames) {\n const internalTextures = this._renderTarget.textures;\n this._textures = [];\n for (let i = 0; i < internalTextures.length; i++) {\n const texture = new Texture(null, this.getScene());\n if (textureNames === null || textureNames === void 0 ? void 0 : textureNames[i]) {\n texture.name = textureNames[i];\n }\n texture._texture = internalTextures[i];\n if (texture._texture) {\n texture._noMipmap = !texture._texture.useMipMaps;\n texture._useSRGBBuffer = texture._texture._useSRGBBuffer;\n }\n this._textures.push(texture);\n }\n }\n /**\n * Replaces an internal texture within the MRT. Useful to share textures between MultiRenderTarget.\n * @param texture The new texture to set in the MRT\n * @param index The index of the texture to replace\n * @param disposePrevious Set to true if the previous internal texture should be disposed\n */\n setInternalTexture(texture, index, disposePrevious = true) {\n var _a, _b;\n if (!this.renderTarget) {\n return;\n }\n if (index === 0) {\n this._texture = texture;\n }\n this.renderTarget.setTexture(texture, index, disposePrevious);\n if (!this.textures[index]) {\n this.textures[index] = new Texture(null, this.getScene());\n this.textures[index].name = (_b = (_a = this._textureNames) === null || _a === void 0 ? void 0 : _a[index]) !== null && _b !== void 0 ? _b : this.textures[index].name;\n }\n this.textures[index]._texture = texture;\n this.textures[index]._noMipmap = !texture.useMipMaps;\n this.textures[index]._useSRGBBuffer = texture._useSRGBBuffer;\n this._count = this.renderTarget.textures ? this.renderTarget.textures.length : 0;\n if (this._multiRenderTargetOptions.types) {\n this._multiRenderTargetOptions.types[index] = texture.type;\n }\n if (this._multiRenderTargetOptions.samplingModes) {\n this._multiRenderTargetOptions.samplingModes[index] = texture.samplingMode;\n }\n if (this._multiRenderTargetOptions.useSRGBBuffers) {\n this._multiRenderTargetOptions.useSRGBBuffers[index] = texture._useSRGBBuffer;\n }\n if (this._multiRenderTargetOptions.targetTypes && this._multiRenderTargetOptions.targetTypes[index] !== -1) {\n let target = 0;\n if (texture.is2DArray) {\n target = 35866;\n }\n else if (texture.isCube) {\n target = 34067;\n } /*else if (texture.isCubeArray) {\n target = 3735928559;\n }*/\n else if (texture.is3D) {\n target = 32879;\n }\n else {\n target = 3553;\n }\n this._multiRenderTargetOptions.targetTypes[index] = target;\n }\n }\n /**\n * Changes an attached texture's face index or layer.\n * @param index The index of the texture to modify the attachment of\n * @param layerIndex The layer index of the texture to be attached to the framebuffer\n * @param faceIndex The face index of the texture to be attached to the framebuffer\n */\n setLayerAndFaceIndex(index, layerIndex = -1, faceIndex = -1) {\n if (!this.textures[index] || !this.renderTarget) {\n return;\n }\n if (this._multiRenderTargetOptions.layerIndex) {\n this._multiRenderTargetOptions.layerIndex[index] = layerIndex;\n }\n if (this._multiRenderTargetOptions.faceIndex) {\n this._multiRenderTargetOptions.faceIndex[index] = faceIndex;\n }\n this.renderTarget.setLayerAndFaceIndex(index, layerIndex, faceIndex);\n }\n /**\n * Changes every attached texture's face index or layer.\n * @param layerIndices The layer indices of the texture to be attached to the framebuffer\n * @param faceIndices The face indices of the texture to be attached to the framebuffer\n */\n setLayerAndFaceIndices(layerIndices, faceIndices) {\n if (!this.renderTarget) {\n return;\n }\n this._multiRenderTargetOptions.layerIndex = layerIndices;\n this._multiRenderTargetOptions.faceIndex = faceIndices;\n this.renderTarget.setLayerAndFaceIndices(layerIndices, faceIndices);\n }\n /**\n * Define the number of samples used if MSAA is enabled.\n */\n get samples() {\n return this._samples;\n }\n set samples(value) {\n if (this._renderTarget) {\n this._samples = this._renderTarget.setSamples(value);\n }\n else {\n // In case samples are set with 0 textures created, we must save the desired samples value\n this._samples = value;\n }\n }\n /**\n * Resize all the textures in the multi render target.\n * Be careful as it will recreate all the data in the new texture.\n * @param size Define the new size\n */\n resize(size) {\n this._processSizeParameter(size, false);\n this._rebuild(undefined, this._textureNames);\n }\n /**\n * Changes the number of render targets in this MRT\n * Be careful as it will recreate all the data in the new texture.\n * @param count new texture count\n * @param options Specifies texture types and sampling modes for new textures\n * @param textureNames Specifies the names of the textures (optional)\n */\n updateCount(count, options, textureNames) {\n this._multiRenderTargetOptions.textureCount = count;\n this._count = count;\n const types = [];\n const samplingModes = [];\n const useSRGBBuffers = [];\n const formats = [];\n const targetTypes = [];\n const faceIndex = [];\n const layerIndex = [];\n const layerCounts = [];\n this._textureNames = textureNames;\n this._initTypes(count, types, samplingModes, useSRGBBuffers, formats, targetTypes, faceIndex, layerIndex, layerCounts, options);\n this._multiRenderTargetOptions.types = types;\n this._multiRenderTargetOptions.samplingModes = samplingModes;\n this._multiRenderTargetOptions.useSRGBBuffers = useSRGBBuffers;\n this._multiRenderTargetOptions.formats = formats;\n this._multiRenderTargetOptions.targetTypes = targetTypes;\n this._multiRenderTargetOptions.faceIndex = faceIndex;\n this._multiRenderTargetOptions.layerIndex = layerIndex;\n this._multiRenderTargetOptions.layerCounts = layerCounts;\n this._rebuild(true, textureNames);\n }\n _unbindFrameBuffer(engine, faceIndex) {\n if (this._renderTarget) {\n engine.unBindMultiColorAttachmentFramebuffer(this._renderTarget, this.isCube, () => {\n this.onAfterRenderObservable.notifyObservers(faceIndex);\n });\n }\n }\n /**\n * Dispose the render targets and their associated resources\n * @param doNotDisposeInternalTextures\n */\n dispose(doNotDisposeInternalTextures = false) {\n this._releaseTextures();\n if (!doNotDisposeInternalTextures) {\n this.releaseInternalTextures();\n }\n else {\n // Prevent internal texture dispose in super.dispose\n this._texture = null;\n }\n super.dispose();\n }\n /**\n * Release all the underlying texture used as draw buffers.\n */\n releaseInternalTextures() {\n var _a, _b;\n const internalTextures = (_a = this._renderTarget) === null || _a === void 0 ? void 0 : _a.textures;\n if (!internalTextures) {\n return;\n }\n for (let i = internalTextures.length - 1; i >= 0; i--) {\n this._textures[i]._texture = null;\n }\n (_b = this._renderTarget) === null || _b === void 0 ? void 0 : _b.dispose();\n this._renderTarget = null;\n }\n}\n//# sourceMappingURL=multiRenderTarget.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"mrtFragmentDeclaration\";\nconst shader = `#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)\nlayout(location=0) out vec4 glFragData[{X}];\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const mrtFragmentDeclaration = { name, shader };\n//# sourceMappingURL=mrtFragmentDeclaration.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"bumpFragmentMainFunctions\";\nconst shader = `#if defined(BUMP) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC) || defined(DETAIL)\n#if defined(TANGENT) && defined(NORMAL) \nvarying mat3 vTBN;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\nuniform mat4 normalMatrix;\n#if defined(WEBGL2) || defined(WEBGPU)\nmat4 toNormalMatrix(mat4 wMatrix)\n{mat4 ret=inverse(wMatrix);ret=transpose(ret);ret[0][3]=0.;ret[1][3]=0.;ret[2][3]=0.;ret[3]=vec4(0.,0.,0.,1.);return ret;}\n#else\nmat4 toNormalMatrix(mat4 m)\n{float\na00=m[0][0],a01=m[0][1],a02=m[0][2],a03=m[0][3],\na10=m[1][0],a11=m[1][1],a12=m[1][2],a13=m[1][3],\na20=m[2][0],a21=m[2][1],a22=m[2][2],a23=m[2][3],\na30=m[3][0],a31=m[3][1],a32=m[3][2],a33=m[3][3],\nb00=a00*a11-a01*a10,\nb01=a00*a12-a02*a10,\nb02=a00*a13-a03*a10,\nb03=a01*a12-a02*a11,\nb04=a01*a13-a03*a11,\nb05=a02*a13-a03*a12,\nb06=a20*a31-a21*a30,\nb07=a20*a32-a22*a30,\nb08=a20*a33-a23*a30,\nb09=a21*a32-a22*a31,\nb10=a21*a33-a23*a31,\nb11=a22*a33-a23*a32,\ndet=b00*b11-b01*b10+b02*b09+b03*b08-b04*b07+b05*b06;mat4 mi=mat4(\na11*b11-a12*b10+a13*b09,\na02*b10-a01*b11-a03*b09,\na31*b05-a32*b04+a33*b03,\na22*b04-a21*b05-a23*b03,\na12*b08-a10*b11-a13*b07,\na00*b11-a02*b08+a03*b07,\na32*b02-a30*b05-a33*b01,\na20*b05-a22*b02+a23*b01,\na10*b10-a11*b08+a13*b06,\na01*b08-a00*b10-a03*b06,\na30*b04-a31*b02+a33*b00,\na21*b02-a20*b04-a23*b00,\na11*b07-a10*b09-a12*b06,\na00*b09-a01*b07+a02*b06,\na31*b01-a30*b03-a32*b00,\na20*b03-a21*b01+a22*b00)/det;return mat4(mi[0][0],mi[1][0],mi[2][0],mi[3][0],\nmi[0][1],mi[1][1],mi[2][1],mi[3][1],\nmi[0][2],mi[1][2],mi[2][2],mi[3][2],\nmi[0][3],mi[1][3],mi[2][3],mi[3][3]);}\n#endif\n#endif\nvec3 perturbNormalBase(mat3 cotangentFrame,vec3 normal,float scale)\n{\n#ifdef NORMALXYSCALE\nnormal=normalize(normal*vec3(scale,scale,1.0));\n#endif\nreturn normalize(cotangentFrame*normal);}\nvec3 perturbNormal(mat3 cotangentFrame,vec3 textureSample,float scale)\n{return perturbNormalBase(cotangentFrame,textureSample*2.0-1.0,scale);}\nmat3 cotangent_frame(vec3 normal,vec3 p,vec2 uv,vec2 tangentSpaceParams)\n{vec3 dp1=dFdx(p);vec3 dp2=dFdy(p);vec2 duv1=dFdx(uv);vec2 duv2=dFdy(uv);vec3 dp2perp=cross(dp2,normal);vec3 dp1perp=cross(normal,dp1);vec3 tangent=dp2perp*duv1.x+dp1perp*duv2.x;vec3 bitangent=dp2perp*duv1.y+dp1perp*duv2.y;tangent*=tangentSpaceParams.x;bitangent*=tangentSpaceParams.y;float det=max(dot(tangent,tangent),dot(bitangent,bitangent));float invmax=det==0.0 ? 0.0 : inversesqrt(det);return mat3(tangent*invmax,bitangent*invmax,normal);}\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const bumpFragmentMainFunctions = { name, shader };\n//# sourceMappingURL=bumpFragmentMainFunctions.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"samplerFragmentDeclaration\";\nconst shader = `#ifdef _DEFINENAME_\n#if _DEFINENAME_DIRECTUV==1\n#define v_VARYINGNAME_UV vMainUV1\n#elif _DEFINENAME_DIRECTUV==2\n#define v_VARYINGNAME_UV vMainUV2\n#elif _DEFINENAME_DIRECTUV==3\n#define v_VARYINGNAME_UV vMainUV3\n#elif _DEFINENAME_DIRECTUV==4\n#define v_VARYINGNAME_UV vMainUV4\n#elif _DEFINENAME_DIRECTUV==5\n#define v_VARYINGNAME_UV vMainUV5\n#elif _DEFINENAME_DIRECTUV==6\n#define v_VARYINGNAME_UV vMainUV6\n#else\nvarying vec2 v_VARYINGNAME_UV;\n#endif\nuniform sampler2D _SAMPLERNAME_Sampler;\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const samplerFragmentDeclaration = { name, shader };\n//# sourceMappingURL=samplerFragmentDeclaration.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nimport \"./samplerFragmentDeclaration.js\";\nconst name = \"bumpFragmentFunctions\";\nconst shader = `#if defined(BUMP)\n#include(_DEFINENAME_,BUMP,_VARYINGNAME_,Bump,_SAMPLERNAME_,bump)\n#endif\n#if defined(DETAIL)\n#include(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail,_SAMPLERNAME_,detail)\n#endif\n#if defined(BUMP) && defined(PARALLAX)\nconst float minSamples=4.;const float maxSamples=15.;const int iMaxSamples=15;vec2 parallaxOcclusion(vec3 vViewDirCoT,vec3 vNormalCoT,vec2 texCoord,float parallaxScale) {float parallaxLimit=length(vViewDirCoT.xy)/vViewDirCoT.z;parallaxLimit*=parallaxScale;vec2 vOffsetDir=normalize(vViewDirCoT.xy);vec2 vMaxOffset=vOffsetDir*parallaxLimit;float numSamples=maxSamples+(dot(vViewDirCoT,vNormalCoT)*(minSamples-maxSamples));float stepSize=1.0/numSamples;float currRayHeight=1.0;vec2 vCurrOffset=vec2(0,0);vec2 vLastOffset=vec2(0,0);float lastSampledHeight=1.0;float currSampledHeight=1.0;bool keepWorking=true;for (int i=0; icurrRayHeight)\n{float delta1=currSampledHeight-currRayHeight;float delta2=(currRayHeight+stepSize)-lastSampledHeight;float ratio=delta1/(delta1+delta2);vCurrOffset=(ratio)* vLastOffset+(1.0-ratio)*vCurrOffset;keepWorking=false;}\nelse\n{currRayHeight-=stepSize;vLastOffset=vCurrOffset;\n#ifdef PARALLAX_RHS\nvCurrOffset-=stepSize*vMaxOffset;\n#else\nvCurrOffset+=stepSize*vMaxOffset;\n#endif\nlastSampledHeight=currSampledHeight;}}\nreturn vCurrOffset;}\nvec2 parallaxOffset(vec3 viewDir,float heightScale)\n{float height=texture2D(bumpSampler,vBumpUV).w;vec2 texCoordOffset=heightScale*viewDir.xy*height;\n#ifdef PARALLAX_RHS\nreturn texCoordOffset;\n#else\nreturn -texCoordOffset;\n#endif\n}\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const bumpFragmentFunctions = { name, shader };\n//# sourceMappingURL=bumpFragmentFunctions.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"bumpFragment\";\nconst shader = `vec2 uvOffset=vec2(0.0,0.0);\n#if defined(BUMP) || defined(PARALLAX) || defined(DETAIL)\n#ifdef NORMALXYSCALE\nfloat normalScale=1.0;\n#elif defined(BUMP)\nfloat normalScale=vBumpInfos.y;\n#else\nfloat normalScale=1.0;\n#endif\n#if defined(TANGENT) && defined(NORMAL)\nmat3 TBN=vTBN;\n#elif defined(BUMP)\nvec2 TBNUV=gl_FrontFacing ? vBumpUV : -vBumpUV;mat3 TBN=cotangent_frame(normalW*normalScale,vPositionW,TBNUV,vTangentSpaceParams);\n#else\nvec2 TBNUV=gl_FrontFacing ? vDetailUV : -vDetailUV;mat3 TBN=cotangent_frame(normalW*normalScale,vPositionW,TBNUV,vec2(1.,1.));\n#endif\n#elif defined(ANISOTROPIC)\n#if defined(TANGENT) && defined(NORMAL)\nmat3 TBN=vTBN;\n#else\nvec2 TBNUV=gl_FrontFacing ? vMainUV1 : -vMainUV1;mat3 TBN=cotangent_frame(normalW,vPositionW,TBNUV,vec2(1.,1.));\n#endif\n#endif\n#ifdef PARALLAX\nmat3 invTBN=transposeMat3(TBN);\n#ifdef PARALLAXOCCLUSION\nuvOffset=parallaxOcclusion(invTBN*-viewDirectionW,invTBN*normalW,vBumpUV,vBumpInfos.z);\n#else\nuvOffset=parallaxOffset(invTBN*viewDirectionW,vBumpInfos.z);\n#endif\n#endif\n#ifdef DETAIL\nvec4 detailColor=texture2D(detailSampler,vDetailUV+uvOffset);vec2 detailNormalRG=detailColor.wy*2.0-1.0;float detailNormalB=sqrt(1.-saturate(dot(detailNormalRG,detailNormalRG)));vec3 detailNormal=vec3(detailNormalRG,detailNormalB);\n#endif\n#ifdef BUMP\n#ifdef OBJECTSPACE_NORMALMAP\n#define CUSTOM_FRAGMENT_BUMP_FRAGMENT\nnormalW=normalize(texture2D(bumpSampler,vBumpUV).xyz *2.0-1.0);normalW=normalize(mat3(normalMatrix)*normalW);\n#elif !defined(DETAIL)\nnormalW=perturbNormal(TBN,texture2D(bumpSampler,vBumpUV+uvOffset).xyz,vBumpInfos.y);\n#else\nvec3 bumpNormal=texture2D(bumpSampler,vBumpUV+uvOffset).xyz*2.0-1.0;\n#if DETAIL_NORMALBLENDMETHOD==0 \ndetailNormal.xy*=vDetailInfos.z;vec3 blendedNormal=normalize(vec3(bumpNormal.xy+detailNormal.xy,bumpNormal.z*detailNormal.z));\n#elif DETAIL_NORMALBLENDMETHOD==1 \ndetailNormal.xy*=vDetailInfos.z;bumpNormal+=vec3(0.0,0.0,1.0);detailNormal*=vec3(-1.0,-1.0,1.0);vec3 blendedNormal=bumpNormal*dot(bumpNormal,detailNormal)/bumpNormal.z-detailNormal;\n#endif\nnormalW=perturbNormalBase(TBN,blendedNormal,vBumpInfos.y);\n#endif\n#elif defined(DETAIL)\ndetailNormal.xy*=vDetailInfos.z;normalW=perturbNormalBase(TBN,detailNormal,vDetailInfos.z);\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const bumpFragment = { name, shader };\n//# sourceMappingURL=bumpFragment.js.map","// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore.js\";\nimport \"./ShadersInclude/clipPlaneFragmentDeclaration.js\";\nimport \"./ShadersInclude/mrtFragmentDeclaration.js\";\nimport \"./ShadersInclude/bumpFragmentMainFunctions.js\";\nimport \"./ShadersInclude/bumpFragmentFunctions.js\";\nimport \"./ShadersInclude/helperFunctions.js\";\nimport \"./ShadersInclude/clipPlaneFragment.js\";\nimport \"./ShadersInclude/bumpFragment.js\";\nconst name = \"geometryPixelShader\";\nconst shader = `#extension GL_EXT_draw_buffers : require\n#if defined(BUMP) || !defined(NORMAL)\n#extension GL_OES_standard_derivatives : enable\n#endif\nprecision highp float;\n#ifdef BUMP\nvarying mat4 vWorldView;varying vec3 vNormalW;\n#else\nvarying vec3 vNormalV;\n#endif\nvarying vec4 vViewPos;\n#if defined(POSITION) || defined(BUMP)\nvarying vec3 vPositionW;\n#endif\n#ifdef VELOCITY\nvarying vec4 vCurrentPosition;varying vec4 vPreviousPosition;\n#endif\n#ifdef NEED_UV\nvarying vec2 vUV;\n#endif\n#ifdef BUMP\nuniform vec3 vBumpInfos;uniform vec2 vTangentSpaceParams;\n#endif\n#if defined(REFLECTIVITY)\n#if defined(ORMTEXTURE) || defined(SPECULARGLOSSINESSTEXTURE) || defined(REFLECTIVITYTEXTURE)\nuniform sampler2D reflectivitySampler;varying vec2 vReflectivityUV;\n#endif\n#ifdef ALBEDOTEXTURE\nvarying vec2 vAlbedoUV;uniform sampler2D albedoSampler;\n#endif\n#ifdef REFLECTIVITYCOLOR\nuniform vec3 reflectivityColor;\n#endif\n#ifdef ALBEDOCOLOR\nuniform vec3 albedoColor;\n#endif\n#ifdef METALLIC\nuniform float metallic;\n#endif\n#if defined(ROUGHNESS) || defined(GLOSSINESS)\nuniform float glossiness;\n#endif\n#endif\n#if defined(ALPHATEST) && defined(NEED_UV)\nuniform sampler2D diffuseSampler;\n#endif\n#include\n#include[RENDER_TARGET_COUNT]\n#include\n#include\n#include\nvoid main() {\n#include\n#ifdef ALPHATEST\nif (texture2D(diffuseSampler,vUV).a<0.4)\ndiscard;\n#endif\nvec3 normalOutput;\n#ifdef BUMP\nvec3 normalW=normalize(vNormalW);\n#include\nnormalOutput=normalize(vec3(vWorldView*vec4(normalW,0.0)));\n#else\nnormalOutput=normalize(vNormalV);\n#endif\n#ifdef PREPASS\n#ifdef PREPASS_DEPTH\ngl_FragData[DEPTH_INDEX]=vec4(vViewPos.z/vViewPos.w,0.0,0.0,1.0);\n#endif\n#ifdef PREPASS_NORMAL\ngl_FragData[NORMAL_INDEX]=vec4(normalOutput,1.0);\n#endif\n#else\ngl_FragData[0]=vec4(vViewPos.z/vViewPos.w,0.0,0.0,1.0);gl_FragData[1]=vec4(normalOutput,1.0);\n#endif\n#ifdef POSITION\ngl_FragData[POSITION_INDEX]=vec4(vPositionW,1.0);\n#endif\n#ifdef VELOCITY\nvec2 a=(vCurrentPosition.xy/vCurrentPosition.w)*0.5+0.5;vec2 b=(vPreviousPosition.xy/vPreviousPosition.w)*0.5+0.5;vec2 velocity=abs(a-b);velocity=vec2(pow(velocity.x,1.0/3.0),pow(velocity.y,1.0/3.0))*sign(a-b)*0.5+0.5;gl_FragData[VELOCITY_INDEX]=vec4(velocity,0.0,1.0);\n#endif\n#ifdef REFLECTIVITY\nvec4 reflectivity=vec4(0.0,0.0,0.0,1.0);\n#ifdef METALLICWORKFLOW\nfloat metal=1.0;float roughness=1.0;\n#ifdef ORMTEXTURE\nmetal*=texture2D(reflectivitySampler,vReflectivityUV).b;roughness*=texture2D(reflectivitySampler,vReflectivityUV).g;\n#endif\n#ifdef METALLIC\nmetal*=metallic;\n#endif\n#ifdef ROUGHNESS\nroughness*=(1.0-glossiness); \n#endif\nreflectivity.a-=roughness;vec3 color=vec3(1.0);\n#ifdef ALBEDOTEXTURE\ncolor=texture2D(albedoSampler,vAlbedoUV).rgb;\n#ifdef GAMMAALBEDO\ncolor=toLinearSpace(color);\n#endif\n#endif\n#ifdef ALBEDOCOLOR\ncolor*=albedoColor.xyz;\n#endif\nreflectivity.rgb=mix(vec3(0.04),color,metal);\n#else\n#if defined(SPECULARGLOSSINESSTEXTURE) || defined(REFLECTIVITYTEXTURE)\nreflectivity=texture2D(reflectivitySampler,vReflectivityUV);\n#ifdef GAMMAREFLECTIVITYTEXTURE\nreflectivity.rgb=toLinearSpace(reflectivity.rgb);\n#endif\n#else \n#ifdef REFLECTIVITYCOLOR\nreflectivity.rgb=toLinearSpace(reflectivityColor.xyz);reflectivity.a=1.0;\n#endif\n#endif\n#ifdef GLOSSINESSS\nreflectivity.a*=glossiness; \n#endif\n#endif\ngl_FragData[REFLECTIVITY_INDEX]=reflectivity;\n#endif\n}\n`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @internal */\nexport const geometryPixelShader = { name, shader };\n//# sourceMappingURL=geometry.fragment.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"geometryVertexDeclaration\";\nconst shader = `uniform mat4 viewProjection;uniform mat4 view;`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const geometryVertexDeclaration = { name, shader };\n//# sourceMappingURL=geometryVertexDeclaration.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"sceneUboDeclaration\";\nconst shader = `layout(std140,column_major) uniform;uniform Scene {mat4 viewProjection;\n#ifdef MULTIVIEW\nmat4 viewProjectionR;\n#endif \nmat4 view;mat4 projection;vec4 vEyePosition;};\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const sceneUboDeclaration = { name, shader };\n//# sourceMappingURL=sceneUboDeclaration.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nimport \"./sceneUboDeclaration.js\";\nconst name = \"geometryUboDeclaration\";\nconst shader = `#include\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const geometryUboDeclaration = { name, shader };\n//# sourceMappingURL=geometryUboDeclaration.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"bumpVertex\";\nconst shader = `#if defined(BUMP) || defined(PARALLAX) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC)\n#if defined(TANGENT) && defined(NORMAL)\nvec3 tbnNormal=normalize(normalUpdated);vec3 tbnTangent=normalize(tangentUpdated.xyz);vec3 tbnBitangent=cross(tbnNormal,tbnTangent)*tangentUpdated.w;vTBN=mat3(finalWorld)*mat3(tbnTangent,tbnBitangent,tbnNormal);\n#endif\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const bumpVertex = { name, shader };\n//# sourceMappingURL=bumpVertex.js.map","// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore.js\";\nimport \"./ShadersInclude/bonesDeclaration.js\";\nimport \"./ShadersInclude/bakedVertexAnimationDeclaration.js\";\nimport \"./ShadersInclude/morphTargetsVertexGlobalDeclaration.js\";\nimport \"./ShadersInclude/morphTargetsVertexDeclaration.js\";\nimport \"./ShadersInclude/instancesDeclaration.js\";\nimport \"./ShadersInclude/geometryVertexDeclaration.js\";\nimport \"./ShadersInclude/geometryUboDeclaration.js\";\nimport \"./ShadersInclude/clipPlaneVertexDeclaration.js\";\nimport \"./ShadersInclude/morphTargetsVertexGlobal.js\";\nimport \"./ShadersInclude/morphTargetsVertex.js\";\nimport \"./ShadersInclude/instancesVertex.js\";\nimport \"./ShadersInclude/bonesVertex.js\";\nimport \"./ShadersInclude/bakedVertexAnimation.js\";\nimport \"./ShadersInclude/clipPlaneVertex.js\";\nimport \"./ShadersInclude/bumpVertex.js\";\nconst name = \"geometryVertexShader\";\nconst shader = `precision highp float;\n#include\n#include\n#include\n#include[0..maxSimultaneousMorphTargets]\n#include\n#include<__decl__geometryVertex>\n#include\nattribute vec3 position;attribute vec3 normal;\n#ifdef NEED_UV\nvarying vec2 vUV;\n#ifdef ALPHATEST\nuniform mat4 diffuseMatrix;\n#endif\n#ifdef BUMP\nuniform mat4 bumpMatrix;varying vec2 vBumpUV;\n#endif\n#ifdef REFLECTIVITY\nuniform mat4 reflectivityMatrix;uniform mat4 albedoMatrix;varying vec2 vReflectivityUV;varying vec2 vAlbedoUV;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#endif\n#ifdef BUMP\nvarying mat4 vWorldView;\n#endif\n#ifdef BUMP\nvarying vec3 vNormalW;\n#else\nvarying vec3 vNormalV;\n#endif\nvarying vec4 vViewPos;\n#if defined(POSITION) || defined(BUMP)\nvarying vec3 vPositionW;\n#endif\n#ifdef VELOCITY\nuniform mat4 previousViewProjection;varying vec4 vCurrentPosition;varying vec4 vPreviousPosition;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void)\n{vec3 positionUpdated=position;vec3 normalUpdated=normal;\n#ifdef UV1\nvec2 uvUpdated=uv;\n#endif\n#include\n#include[0..maxSimultaneousMorphTargets]\n#include\n#if defined(VELOCITY) && !defined(BONES_VELOCITY_ENABLED)\nvCurrentPosition=viewProjection*finalWorld*vec4(positionUpdated,1.0);vPreviousPosition=previousViewProjection*finalPreviousWorld*vec4(positionUpdated,1.0);\n#endif\n#include\n#include\nvec4 worldPos=vec4(finalWorld*vec4(positionUpdated,1.0));\n#ifdef BUMP\nvWorldView=view*finalWorld;vNormalW=normalUpdated;\n#else\nvNormalV=normalize(vec3((view*finalWorld)*vec4(normalUpdated,0.0)));\n#endif\nvViewPos=view*worldPos;\n#if defined(VELOCITY) && defined(BONES_VELOCITY_ENABLED)\nvCurrentPosition=viewProjection*finalWorld*vec4(positionUpdated,1.0);\n#if NUM_BONE_INFLUENCERS>0\nmat4 previousInfluence;previousInfluence=mPreviousBones[int(matricesIndices[0])]*matricesWeights[0];\n#if NUM_BONE_INFLUENCERS>1\npreviousInfluence+=mPreviousBones[int(matricesIndices[1])]*matricesWeights[1];\n#endif\n#if NUM_BONE_INFLUENCERS>2\npreviousInfluence+=mPreviousBones[int(matricesIndices[2])]*matricesWeights[2];\n#endif\n#if NUM_BONE_INFLUENCERS>3\npreviousInfluence+=mPreviousBones[int(matricesIndices[3])]*matricesWeights[3];\n#endif\n#if NUM_BONE_INFLUENCERS>4\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[0])]*matricesWeightsExtra[0];\n#endif\n#if NUM_BONE_INFLUENCERS>5\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[1])]*matricesWeightsExtra[1];\n#endif\n#if NUM_BONE_INFLUENCERS>6\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[2])]*matricesWeightsExtra[2];\n#endif\n#if NUM_BONE_INFLUENCERS>7\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[3])]*matricesWeightsExtra[3];\n#endif\nvPreviousPosition=previousViewProjection*finalPreviousWorld*previousInfluence*vec4(positionUpdated,1.0);\n#else\nvPreviousPosition=previousViewProjection*finalPreviousWorld*vec4(positionUpdated,1.0);\n#endif\n#endif\n#if defined(POSITION) || defined(BUMP)\nvPositionW=worldPos.xyz/worldPos.w;\n#endif\ngl_Position=viewProjection*finalWorld*vec4(positionUpdated,1.0);\n#include\n#ifdef NEED_UV\n#ifdef UV1\n#if defined(ALPHATEST) && defined(ALPHATEST_UV1)\nvUV=vec2(diffuseMatrix*vec4(uvUpdated,1.0,0.0));\n#else\nvUV=uv;\n#endif\n#ifdef BUMP_UV1\nvBumpUV=vec2(bumpMatrix*vec4(uvUpdated,1.0,0.0));\n#endif\n#ifdef REFLECTIVITY_UV1\nvReflectivityUV=vec2(reflectivityMatrix*vec4(uvUpdated,1.0,0.0));\n#endif\n#ifdef ALBEDO_UV1\nvAlbedoUV=vec2(albedoMatrix*vec4(uvUpdated,1.0,0.0));\n#endif\n#endif\n#ifdef UV2\n#if defined(ALPHATEST) && defined(ALPHATEST_UV2)\nvUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n#else\nvUV=uv2;\n#endif\n#ifdef BUMP_UV2\nvBumpUV=vec2(bumpMatrix*vec4(uv2,1.0,0.0));\n#endif\n#ifdef REFLECTIVITY_UV2\nvReflectivityUV=vec2(reflectivityMatrix*vec4(uv2,1.0,0.0));\n#endif\n#ifdef ALBEDO_UV2\nvAlbedoUV=vec2(albedoMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n#endif\n#include\n}\n`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @internal */\nexport const geometryVertexShader = { name, shader };\n//# sourceMappingURL=geometry.vertex.js.map","import { Engine } from \"../Engines/engine.js\";\n\n/**\n * This groups all the flags used to control the materials channel.\n */\nexport class MaterialFlags {\n /**\n * Are diffuse textures enabled in the application.\n */\n static get DiffuseTextureEnabled() {\n return this._DiffuseTextureEnabled;\n }\n static set DiffuseTextureEnabled(value) {\n if (this._DiffuseTextureEnabled === value) {\n return;\n }\n this._DiffuseTextureEnabled = value;\n Engine.MarkAllMaterialsAsDirty(1);\n }\n /**\n * Are detail textures enabled in the application.\n */\n static get DetailTextureEnabled() {\n return this._DetailTextureEnabled;\n }\n static set DetailTextureEnabled(value) {\n if (this._DetailTextureEnabled === value) {\n return;\n }\n this._DetailTextureEnabled = value;\n Engine.MarkAllMaterialsAsDirty(1);\n }\n /**\n * Are decal maps enabled in the application.\n */\n static get DecalMapEnabled() {\n return this._DecalMapEnabled;\n }\n static set DecalMapEnabled(value) {\n if (this._DecalMapEnabled === value) {\n return;\n }\n this._DecalMapEnabled = value;\n Engine.MarkAllMaterialsAsDirty(1);\n }\n /**\n * Are ambient textures enabled in the application.\n */\n static get AmbientTextureEnabled() {\n return this._AmbientTextureEnabled;\n }\n static set AmbientTextureEnabled(value) {\n if (this._AmbientTextureEnabled === value) {\n return;\n }\n this._AmbientTextureEnabled = value;\n Engine.MarkAllMaterialsAsDirty(1);\n }\n /**\n * Are opacity textures enabled in the application.\n */\n static get OpacityTextureEnabled() {\n return this._OpacityTextureEnabled;\n }\n static set OpacityTextureEnabled(value) {\n if (this._OpacityTextureEnabled === value) {\n return;\n }\n this._OpacityTextureEnabled = value;\n Engine.MarkAllMaterialsAsDirty(1);\n }\n /**\n * Are reflection textures enabled in the application.\n */\n static get ReflectionTextureEnabled() {\n return this._ReflectionTextureEnabled;\n }\n static set ReflectionTextureEnabled(value) {\n if (this._ReflectionTextureEnabled === value) {\n return;\n }\n this._ReflectionTextureEnabled = value;\n Engine.MarkAllMaterialsAsDirty(1);\n }\n /**\n * Are emissive textures enabled in the application.\n */\n static get EmissiveTextureEnabled() {\n return this._EmissiveTextureEnabled;\n }\n static set EmissiveTextureEnabled(value) {\n if (this._EmissiveTextureEnabled === value) {\n return;\n }\n this._EmissiveTextureEnabled = value;\n Engine.MarkAllMaterialsAsDirty(1);\n }\n /**\n * Are specular textures enabled in the application.\n */\n static get SpecularTextureEnabled() {\n return this._SpecularTextureEnabled;\n }\n static set SpecularTextureEnabled(value) {\n if (this._SpecularTextureEnabled === value) {\n return;\n }\n this._SpecularTextureEnabled = value;\n Engine.MarkAllMaterialsAsDirty(1);\n }\n /**\n * Are bump textures enabled in the application.\n */\n static get BumpTextureEnabled() {\n return this._BumpTextureEnabled;\n }\n static set BumpTextureEnabled(value) {\n if (this._BumpTextureEnabled === value) {\n return;\n }\n this._BumpTextureEnabled = value;\n Engine.MarkAllMaterialsAsDirty(1);\n }\n /**\n * Are lightmap textures enabled in the application.\n */\n static get LightmapTextureEnabled() {\n return this._LightmapTextureEnabled;\n }\n static set LightmapTextureEnabled(value) {\n if (this._LightmapTextureEnabled === value) {\n return;\n }\n this._LightmapTextureEnabled = value;\n Engine.MarkAllMaterialsAsDirty(1);\n }\n /**\n * Are refraction textures enabled in the application.\n */\n static get RefractionTextureEnabled() {\n return this._RefractionTextureEnabled;\n }\n static set RefractionTextureEnabled(value) {\n if (this._RefractionTextureEnabled === value) {\n return;\n }\n this._RefractionTextureEnabled = value;\n Engine.MarkAllMaterialsAsDirty(1);\n }\n /**\n * Are color grading textures enabled in the application.\n */\n static get ColorGradingTextureEnabled() {\n return this._ColorGradingTextureEnabled;\n }\n static set ColorGradingTextureEnabled(value) {\n if (this._ColorGradingTextureEnabled === value) {\n return;\n }\n this._ColorGradingTextureEnabled = value;\n Engine.MarkAllMaterialsAsDirty(1);\n }\n /**\n * Are fresnels enabled in the application.\n */\n static get FresnelEnabled() {\n return this._FresnelEnabled;\n }\n static set FresnelEnabled(value) {\n if (this._FresnelEnabled === value) {\n return;\n }\n this._FresnelEnabled = value;\n Engine.MarkAllMaterialsAsDirty(4);\n }\n /**\n * Are clear coat textures enabled in the application.\n */\n static get ClearCoatTextureEnabled() {\n return this._ClearCoatTextureEnabled;\n }\n static set ClearCoatTextureEnabled(value) {\n if (this._ClearCoatTextureEnabled === value) {\n return;\n }\n this._ClearCoatTextureEnabled = value;\n Engine.MarkAllMaterialsAsDirty(1);\n }\n /**\n * Are clear coat bump textures enabled in the application.\n */\n static get ClearCoatBumpTextureEnabled() {\n return this._ClearCoatBumpTextureEnabled;\n }\n static set ClearCoatBumpTextureEnabled(value) {\n if (this._ClearCoatBumpTextureEnabled === value) {\n return;\n }\n this._ClearCoatBumpTextureEnabled = value;\n Engine.MarkAllMaterialsAsDirty(1);\n }\n /**\n * Are clear coat tint textures enabled in the application.\n */\n static get ClearCoatTintTextureEnabled() {\n return this._ClearCoatTintTextureEnabled;\n }\n static set ClearCoatTintTextureEnabled(value) {\n if (this._ClearCoatTintTextureEnabled === value) {\n return;\n }\n this._ClearCoatTintTextureEnabled = value;\n Engine.MarkAllMaterialsAsDirty(1);\n }\n /**\n * Are sheen textures enabled in the application.\n */\n static get SheenTextureEnabled() {\n return this._SheenTextureEnabled;\n }\n static set SheenTextureEnabled(value) {\n if (this._SheenTextureEnabled === value) {\n return;\n }\n this._SheenTextureEnabled = value;\n Engine.MarkAllMaterialsAsDirty(1);\n }\n /**\n * Are anisotropic textures enabled in the application.\n */\n static get AnisotropicTextureEnabled() {\n return this._AnisotropicTextureEnabled;\n }\n static set AnisotropicTextureEnabled(value) {\n if (this._AnisotropicTextureEnabled === value) {\n return;\n }\n this._AnisotropicTextureEnabled = value;\n Engine.MarkAllMaterialsAsDirty(1);\n }\n /**\n * Are thickness textures enabled in the application.\n */\n static get ThicknessTextureEnabled() {\n return this._ThicknessTextureEnabled;\n }\n static set ThicknessTextureEnabled(value) {\n if (this._ThicknessTextureEnabled === value) {\n return;\n }\n this._ThicknessTextureEnabled = value;\n Engine.MarkAllMaterialsAsDirty(1);\n }\n /**\n * Are refraction intensity textures enabled in the application.\n */\n static get RefractionIntensityTextureEnabled() {\n return this._ThicknessTextureEnabled;\n }\n static set RefractionIntensityTextureEnabled(value) {\n if (this._RefractionIntensityTextureEnabled === value) {\n return;\n }\n this._RefractionIntensityTextureEnabled = value;\n Engine.MarkAllMaterialsAsDirty(1);\n }\n /**\n * Are translucency intensity textures enabled in the application.\n */\n static get TranslucencyIntensityTextureEnabled() {\n return this._ThicknessTextureEnabled;\n }\n static set TranslucencyIntensityTextureEnabled(value) {\n if (this._TranslucencyIntensityTextureEnabled === value) {\n return;\n }\n this._TranslucencyIntensityTextureEnabled = value;\n Engine.MarkAllMaterialsAsDirty(1);\n }\n /**\n * Are translucency intensity textures enabled in the application.\n */\n static get IridescenceTextureEnabled() {\n return this._IridescenceTextureEnabled;\n }\n static set IridescenceTextureEnabled(value) {\n if (this._IridescenceTextureEnabled === value) {\n return;\n }\n this._IridescenceTextureEnabled = value;\n Engine.MarkAllMaterialsAsDirty(1);\n }\n}\n// Flags used to enable or disable a type of texture for all Standard Materials\nMaterialFlags._DiffuseTextureEnabled = true;\nMaterialFlags._DetailTextureEnabled = true;\nMaterialFlags._DecalMapEnabled = true;\nMaterialFlags._AmbientTextureEnabled = true;\nMaterialFlags._OpacityTextureEnabled = true;\nMaterialFlags._ReflectionTextureEnabled = true;\nMaterialFlags._EmissiveTextureEnabled = true;\nMaterialFlags._SpecularTextureEnabled = true;\nMaterialFlags._BumpTextureEnabled = true;\nMaterialFlags._LightmapTextureEnabled = true;\nMaterialFlags._RefractionTextureEnabled = true;\nMaterialFlags._ColorGradingTextureEnabled = true;\nMaterialFlags._FresnelEnabled = true;\nMaterialFlags._ClearCoatTextureEnabled = true;\nMaterialFlags._ClearCoatBumpTextureEnabled = true;\nMaterialFlags._ClearCoatTintTextureEnabled = true;\nMaterialFlags._SheenTextureEnabled = true;\nMaterialFlags._AnisotropicTextureEnabled = true;\nMaterialFlags._ThicknessTextureEnabled = true;\nMaterialFlags._RefractionIntensityTextureEnabled = true;\nMaterialFlags._TranslucencyIntensityTextureEnabled = true;\nMaterialFlags._IridescenceTextureEnabled = true;\n//# sourceMappingURL=materialFlags.js.map","import { Matrix } from \"../Maths/math.vector.js\";\nimport { VertexBuffer } from \"../Buffers/buffer.js\";\n\nimport { Texture } from \"../Materials/Textures/texture.js\";\nimport { MultiRenderTarget } from \"../Materials/Textures/multiRenderTarget.js\";\nimport { MaterialHelper } from \"../Materials/materialHelper.js\";\nimport { Color4 } from \"../Maths/math.color.js\";\nimport { _WarnImport } from \"../Misc/devTools.js\";\nimport { Material } from \"../Materials/material.js\";\nimport \"../Shaders/geometry.fragment.js\";\nimport \"../Shaders/geometry.vertex.js\";\nimport { MaterialFlags } from \"../Materials/materialFlags.js\";\nimport { addClipPlaneUniforms, bindClipPlane, prepareStringDefinesForClipPlanes } from \"../Materials/clipPlaneMaterialHelper.js\";\n/** list the uniforms used by the geometry renderer */\nconst uniforms = [\n \"world\",\n \"mBones\",\n \"viewProjection\",\n \"diffuseMatrix\",\n \"view\",\n \"previousWorld\",\n \"previousViewProjection\",\n \"mPreviousBones\",\n \"bumpMatrix\",\n \"reflectivityMatrix\",\n \"albedoMatrix\",\n \"reflectivityColor\",\n \"albedoColor\",\n \"metallic\",\n \"glossiness\",\n \"vTangentSpaceParams\",\n \"vBumpInfos\",\n \"morphTargetInfluences\",\n \"morphTargetTextureInfo\",\n \"morphTargetTextureIndices\",\n];\naddClipPlaneUniforms(uniforms);\n/**\n * This renderer is helpful to fill one of the render target with a geometry buffer.\n */\nexport class GeometryBufferRenderer {\n /**\n * @internal\n * Sets up internal structures to share outputs with PrePassRenderer\n * This method should only be called by the PrePassRenderer itself\n */\n _linkPrePassRenderer(prePassRenderer) {\n this._linkedWithPrePass = true;\n this._prePassRenderer = prePassRenderer;\n if (this._multiRenderTarget) {\n // prevents clearing of the RT since it's done by prepass\n this._multiRenderTarget.onClearObservable.clear();\n this._multiRenderTarget.onClearObservable.add(() => {\n // pass\n });\n }\n }\n /**\n * @internal\n * Separates internal structures from PrePassRenderer so the geometry buffer can now operate by itself.\n * This method should only be called by the PrePassRenderer itself\n */\n _unlinkPrePassRenderer() {\n this._linkedWithPrePass = false;\n this._createRenderTargets();\n }\n /**\n * @internal\n * Resets the geometry buffer layout\n */\n _resetLayout() {\n this._enablePosition = false;\n this._enableReflectivity = false;\n this._enableVelocity = false;\n this._attachmentsFromPrePass = [];\n }\n /**\n * @internal\n * Replaces a texture in the geometry buffer renderer\n * Useful when linking textures of the prepass renderer\n */\n _forceTextureType(geometryBufferType, index) {\n if (geometryBufferType === GeometryBufferRenderer.POSITION_TEXTURE_TYPE) {\n this._positionIndex = index;\n this._enablePosition = true;\n }\n else if (geometryBufferType === GeometryBufferRenderer.VELOCITY_TEXTURE_TYPE) {\n this._velocityIndex = index;\n this._enableVelocity = true;\n }\n else if (geometryBufferType === GeometryBufferRenderer.REFLECTIVITY_TEXTURE_TYPE) {\n this._reflectivityIndex = index;\n this._enableReflectivity = true;\n }\n else if (geometryBufferType === GeometryBufferRenderer.DEPTH_TEXTURE_TYPE) {\n this._depthIndex = index;\n }\n else if (geometryBufferType === GeometryBufferRenderer.NORMAL_TEXTURE_TYPE) {\n this._normalIndex = index;\n }\n }\n /**\n * @internal\n * Sets texture attachments\n * Useful when linking textures of the prepass renderer\n */\n _setAttachments(attachments) {\n this._attachmentsFromPrePass = attachments;\n }\n /**\n * @internal\n * Replaces the first texture which is hard coded as a depth texture in the geometry buffer\n * Useful when linking textures of the prepass renderer\n */\n _linkInternalTexture(internalTexture) {\n this._multiRenderTarget.setInternalTexture(internalTexture, 0, false);\n }\n /**\n * Gets the render list (meshes to be rendered) used in the G buffer.\n */\n get renderList() {\n return this._multiRenderTarget.renderList;\n }\n /**\n * Set the render list (meshes to be rendered) used in the G buffer.\n */\n set renderList(meshes) {\n this._multiRenderTarget.renderList = meshes;\n }\n /**\n * Gets whether or not G buffer are supported by the running hardware.\n * This requires draw buffer supports\n */\n get isSupported() {\n return this._multiRenderTarget.isSupported;\n }\n /**\n * Returns the index of the given texture type in the G-Buffer textures array\n * @param textureType The texture type constant. For example GeometryBufferRenderer.POSITION_TEXTURE_INDEX\n * @returns the index of the given texture type in the G-Buffer textures array\n */\n getTextureIndex(textureType) {\n switch (textureType) {\n case GeometryBufferRenderer.POSITION_TEXTURE_TYPE:\n return this._positionIndex;\n case GeometryBufferRenderer.VELOCITY_TEXTURE_TYPE:\n return this._velocityIndex;\n case GeometryBufferRenderer.REFLECTIVITY_TEXTURE_TYPE:\n return this._reflectivityIndex;\n default:\n return -1;\n }\n }\n /**\n * Gets a boolean indicating if objects positions are enabled for the G buffer.\n */\n get enablePosition() {\n return this._enablePosition;\n }\n /**\n * Sets whether or not objects positions are enabled for the G buffer.\n */\n set enablePosition(enable) {\n this._enablePosition = enable;\n // PrePass handles index and texture links\n if (!this._linkedWithPrePass) {\n this.dispose();\n this._createRenderTargets();\n }\n }\n /**\n * Gets a boolean indicating if objects velocities are enabled for the G buffer.\n */\n get enableVelocity() {\n return this._enableVelocity;\n }\n /**\n * Sets whether or not objects velocities are enabled for the G buffer.\n */\n set enableVelocity(enable) {\n this._enableVelocity = enable;\n if (!enable) {\n this._previousTransformationMatrices = {};\n }\n if (!this._linkedWithPrePass) {\n this.dispose();\n this._createRenderTargets();\n }\n this._scene.needsPreviousWorldMatrices = enable;\n }\n /**\n * Gets a boolean indicating if objects reflectivity are enabled in the G buffer.\n */\n get enableReflectivity() {\n return this._enableReflectivity;\n }\n /**\n * Sets whether or not objects reflectivity are enabled for the G buffer.\n * For Metallic-Roughness workflow with ORM texture, we assume that ORM texture is defined according to the default layout:\n * pbr.useRoughnessFromMetallicTextureAlpha = false;\n * pbr.useRoughnessFromMetallicTextureGreen = true;\n * pbr.useMetallnessFromMetallicTextureBlue = true;\n */\n set enableReflectivity(enable) {\n this._enableReflectivity = enable;\n if (!this._linkedWithPrePass) {\n this.dispose();\n this._createRenderTargets();\n }\n }\n /**\n * Gets the scene associated with the buffer.\n */\n get scene() {\n return this._scene;\n }\n /**\n * Gets the ratio used by the buffer during its creation.\n * How big is the buffer related to the main canvas.\n */\n get ratio() {\n return this._ratio;\n }\n /**\n * Creates a new G Buffer for the scene\n * @param scene The scene the buffer belongs to\n * @param ratio How big is the buffer related to the main canvas (default: 1)\n * @param depthFormat Format of the depth texture (default: 15)\n */\n constructor(scene, ratio = 1, depthFormat = 15) {\n /**\n * Dictionary used to store the previous transformation matrices of each rendered mesh\n * in order to compute objects velocities when enableVelocity is set to \"true\"\n * @internal\n */\n this._previousTransformationMatrices = {};\n /**\n * Dictionary used to store the previous bones transformation matrices of each rendered mesh\n * in order to compute objects velocities when enableVelocity is set to \"true\"\n * @internal\n */\n this._previousBonesTransformationMatrices = {};\n /**\n * Array used to store the ignored skinned meshes while computing velocity map (typically used by the motion blur post-process).\n * Avoids computing bones velocities and computes only mesh's velocity itself (position, rotation, scaling).\n */\n this.excludedSkinnedMeshesFromVelocity = [];\n /** Gets or sets a boolean indicating if transparent meshes should be rendered */\n this.renderTransparentMeshes = true;\n this._resizeObserver = null;\n this._enablePosition = false;\n this._enableVelocity = false;\n this._enableReflectivity = false;\n this._clearColor = new Color4(0, 0, 0, 0);\n this._clearDepthColor = new Color4(1e8, 0, 0, 1); // \"infinity\" value - depth in the depth texture is view.z, not a 0..1 value!\n this._positionIndex = -1;\n this._velocityIndex = -1;\n this._reflectivityIndex = -1;\n this._depthIndex = -1;\n this._normalIndex = -1;\n this._linkedWithPrePass = false;\n /**\n * If set to true (default: false), the depth texture will be cleared with the depth value corresponding to the far plane (1 in normal mode, 0 in reverse depth buffer mode)\n * If set to false, the depth texture is always cleared with 0.\n */\n this.useSpecificClearForDepthTexture = false;\n this._scene = scene;\n this._ratio = ratio;\n this._useUbo = scene.getEngine().supportsUniformBuffers;\n this._depthFormat = depthFormat;\n GeometryBufferRenderer._SceneComponentInitialization(this._scene);\n // Render target\n this._createRenderTargets();\n }\n /**\n * Checks whether everything is ready to render a submesh to the G buffer.\n * @param subMesh the submesh to check readiness for\n * @param useInstances is the mesh drawn using instance or not\n * @returns true if ready otherwise false\n */\n isReady(subMesh, useInstances) {\n const material = subMesh.getMaterial();\n if (material && material.disableDepthWrite) {\n return false;\n }\n const defines = [];\n const attribs = [VertexBuffer.PositionKind, VertexBuffer.NormalKind];\n const mesh = subMesh.getMesh();\n // Alpha test\n if (material) {\n let needUv = false;\n if (material.needAlphaTesting() && material.getAlphaTestTexture()) {\n defines.push(\"#define ALPHATEST\");\n defines.push(`#define ALPHATEST_UV${material.getAlphaTestTexture().coordinatesIndex + 1}`);\n needUv = true;\n }\n if (material.bumpTexture && MaterialFlags.BumpTextureEnabled) {\n defines.push(\"#define BUMP\");\n defines.push(`#define BUMP_UV${material.bumpTexture.coordinatesIndex + 1}`);\n needUv = true;\n }\n if (this._enableReflectivity) {\n let metallicWorkflow = false;\n // for PBR materials: cf. https://doc.babylonjs.com/features/featuresDeepDive/materials/using/masterPBR\n if (material.getClassName() === \"PBRMetallicRoughnessMaterial\") {\n // if it is a PBR material in MetallicRoughness Mode:\n if (material.metallicRoughnessTexture !== null) {\n defines.push(\"#define ORMTEXTURE\");\n defines.push(`#define REFLECTIVITY_UV${material.metallicRoughnessTexture.coordinatesIndex + 1}`);\n defines.push(\"#define METALLICWORKFLOW\");\n needUv = true;\n metallicWorkflow = true;\n }\n if (material.metallic !== null) {\n defines.push(\"#define METALLIC\");\n defines.push(\"#define METALLICWORKFLOW\");\n metallicWorkflow = true;\n }\n if (material.roughness !== null) {\n defines.push(\"#define ROUGHNESS\");\n defines.push(\"#define METALLICWORKFLOW\");\n metallicWorkflow = true;\n }\n if (metallicWorkflow) {\n if (material.baseTexture !== null) {\n defines.push(\"#define ALBEDOTEXTURE\");\n defines.push(`#define ALBEDO_UV${material.baseTexture.coordinatesIndex + 1}`);\n if (material.baseTexture.gammaSpace) {\n defines.push(\"#define GAMMAALBEDO\");\n }\n needUv = true;\n }\n if (material.baseColor !== null) {\n defines.push(\"#define ALBEDOCOLOR\");\n }\n }\n }\n else if (material.getClassName() === \"PBRSpecularGlossinessMaterial\") {\n // if it is a PBR material in Specular/Glossiness Mode:\n if (material.specularGlossinessTexture !== null) {\n defines.push(\"#define SPECULARGLOSSINESSTEXTURE\");\n defines.push(`#define REFLECTIVITY_UV${material.specularGlossinessTexture.coordinatesIndex + 1}`);\n needUv = true;\n if (material.specularGlossinessTexture.gammaSpace) {\n defines.push(\"#define GAMMAREFLECTIVITYTEXTURE\");\n }\n }\n else {\n if (material.specularColor !== null) {\n defines.push(\"#define REFLECTIVITYCOLOR\");\n }\n }\n if (material.glossiness !== null) {\n defines.push(\"#define GLOSSINESS\");\n }\n }\n else if (material.getClassName() === \"PBRMaterial\") {\n // if it is the bigger PBRMaterial\n if (material.metallicTexture !== null) {\n defines.push(\"#define ORMTEXTURE\");\n defines.push(`#define REFLECTIVITY_UV${material.metallicTexture.coordinatesIndex + 1}`);\n defines.push(\"#define METALLICWORKFLOW\");\n needUv = true;\n metallicWorkflow = true;\n }\n if (material.metallic !== null) {\n defines.push(\"#define METALLIC\");\n defines.push(\"#define METALLICWORKFLOW\");\n metallicWorkflow = true;\n }\n if (material.roughness !== null) {\n defines.push(\"#define ROUGHNESS\");\n defines.push(\"#define METALLICWORKFLOW\");\n metallicWorkflow = true;\n }\n if (metallicWorkflow) {\n if (material.albedoTexture !== null) {\n defines.push(\"#define ALBEDOTEXTURE\");\n defines.push(`#define ALBEDO_UV${material.albedoTexture.coordinatesIndex + 1}`);\n if (material.albedoTexture.gammaSpace) {\n defines.push(\"#define GAMMAALBEDO\");\n }\n needUv = true;\n }\n if (material.albedoColor !== null) {\n defines.push(\"#define ALBEDOCOLOR\");\n }\n }\n else {\n // SpecularGlossiness Model\n if (material.reflectivityTexture !== null) {\n defines.push(\"#define SPECULARGLOSSINESSTEXTURE\");\n defines.push(`#define REFLECTIVITY_UV${material.reflectivityTexture.coordinatesIndex + 1}`);\n if (material.reflectivityTexture.gammaSpace) {\n defines.push(\"#define GAMMAREFLECTIVITYTEXTURE\");\n }\n needUv = true;\n }\n else if (material.reflectivityColor !== null) {\n defines.push(\"#define REFLECTIVITYCOLOR\");\n }\n if (material.microSurface !== null) {\n defines.push(\"#define GLOSSINESS\");\n }\n }\n }\n else if (material.getClassName() === \"StandardMaterial\") {\n // if StandardMaterial:\n if (material.specularTexture !== null) {\n defines.push(\"#define REFLECTIVITYTEXTURE\");\n defines.push(`#define REFLECTIVITY_UV${material.specularTexture.coordinatesIndex + 1}`);\n if (material.specularTexture.gammaSpace) {\n defines.push(\"#define GAMMAREFLECTIVITYTEXTURE\");\n }\n needUv = true;\n }\n if (material.specularColor !== null) {\n defines.push(\"#define REFLECTIVITYCOLOR\");\n }\n }\n }\n if (needUv) {\n defines.push(\"#define NEED_UV\");\n if (mesh.isVerticesDataPresent(VertexBuffer.UVKind)) {\n attribs.push(VertexBuffer.UVKind);\n defines.push(\"#define UV1\");\n }\n if (mesh.isVerticesDataPresent(VertexBuffer.UV2Kind)) {\n attribs.push(VertexBuffer.UV2Kind);\n defines.push(\"#define UV2\");\n }\n }\n }\n // PrePass\n if (this._linkedWithPrePass) {\n defines.push(\"#define PREPASS\");\n if (this._depthIndex !== -1) {\n defines.push(\"#define DEPTH_INDEX \" + this._depthIndex);\n defines.push(\"#define PREPASS_DEPTH\");\n }\n if (this._normalIndex !== -1) {\n defines.push(\"#define NORMAL_INDEX \" + this._normalIndex);\n defines.push(\"#define PREPASS_NORMAL\");\n }\n }\n // Buffers\n if (this._enablePosition) {\n defines.push(\"#define POSITION\");\n defines.push(\"#define POSITION_INDEX \" + this._positionIndex);\n }\n if (this._enableVelocity) {\n defines.push(\"#define VELOCITY\");\n defines.push(\"#define VELOCITY_INDEX \" + this._velocityIndex);\n if (this.excludedSkinnedMeshesFromVelocity.indexOf(mesh) === -1) {\n defines.push(\"#define BONES_VELOCITY_ENABLED\");\n }\n }\n if (this._enableReflectivity) {\n defines.push(\"#define REFLECTIVITY\");\n defines.push(\"#define REFLECTIVITY_INDEX \" + this._reflectivityIndex);\n }\n // Bones\n if (mesh.useBones && mesh.computeBonesUsingShaders) {\n attribs.push(VertexBuffer.MatricesIndicesKind);\n attribs.push(VertexBuffer.MatricesWeightsKind);\n if (mesh.numBoneInfluencers > 4) {\n attribs.push(VertexBuffer.MatricesIndicesExtraKind);\n attribs.push(VertexBuffer.MatricesWeightsExtraKind);\n }\n defines.push(\"#define NUM_BONE_INFLUENCERS \" + mesh.numBoneInfluencers);\n defines.push(\"#define BonesPerMesh \" + (mesh.skeleton ? mesh.skeleton.bones.length + 1 : 0));\n }\n else {\n defines.push(\"#define NUM_BONE_INFLUENCERS 0\");\n }\n // Morph targets\n const morphTargetManager = mesh.morphTargetManager;\n let numMorphInfluencers = 0;\n if (morphTargetManager) {\n if (morphTargetManager.numInfluencers > 0) {\n numMorphInfluencers = morphTargetManager.numInfluencers;\n defines.push(\"#define MORPHTARGETS\");\n defines.push(\"#define NUM_MORPH_INFLUENCERS \" + numMorphInfluencers);\n if (morphTargetManager.isUsingTextureForTargets) {\n defines.push(\"#define MORPHTARGETS_TEXTURE\");\n }\n MaterialHelper.PrepareAttributesForMorphTargetsInfluencers(attribs, mesh, numMorphInfluencers);\n }\n }\n // Instances\n if (useInstances) {\n defines.push(\"#define INSTANCES\");\n MaterialHelper.PushAttributesForInstances(attribs, this._enableVelocity);\n if (subMesh.getRenderingMesh().hasThinInstances) {\n defines.push(\"#define THIN_INSTANCES\");\n }\n }\n // Setup textures count\n if (this._linkedWithPrePass) {\n defines.push(\"#define RENDER_TARGET_COUNT \" + this._attachmentsFromPrePass.length);\n }\n else {\n defines.push(\"#define RENDER_TARGET_COUNT \" + this._multiRenderTarget.textures.length);\n }\n prepareStringDefinesForClipPlanes(material, this._scene, defines);\n // Get correct effect\n const engine = this._scene.getEngine();\n const drawWrapper = subMesh._getDrawWrapper(undefined, true);\n const cachedDefines = drawWrapper.defines;\n const join = defines.join(\"\\n\");\n if (cachedDefines !== join) {\n drawWrapper.setEffect(engine.createEffect(\"geometry\", {\n attributes: attribs,\n uniformsNames: uniforms,\n samplers: [\"diffuseSampler\", \"bumpSampler\", \"reflectivitySampler\", \"albedoSampler\", \"morphTargets\"],\n defines: join,\n onCompiled: null,\n fallbacks: null,\n onError: null,\n uniformBuffersNames: [\"Scene\"],\n indexParameters: { buffersCount: this._multiRenderTarget.textures.length - 1, maxSimultaneousMorphTargets: numMorphInfluencers },\n }, engine), join);\n }\n return drawWrapper.effect.isReady();\n }\n /**\n * Gets the current underlying G Buffer.\n * @returns the buffer\n */\n getGBuffer() {\n return this._multiRenderTarget;\n }\n /**\n * Gets the number of samples used to render the buffer (anti aliasing).\n */\n get samples() {\n return this._multiRenderTarget.samples;\n }\n /**\n * Sets the number of samples used to render the buffer (anti aliasing).\n */\n set samples(value) {\n this._multiRenderTarget.samples = value;\n }\n /**\n * Disposes the renderer and frees up associated resources.\n */\n dispose() {\n if (this._resizeObserver) {\n const engine = this._scene.getEngine();\n engine.onResizeObservable.remove(this._resizeObserver);\n this._resizeObserver = null;\n }\n this.getGBuffer().dispose();\n }\n _assignRenderTargetIndices() {\n const textureNames = [];\n let count = 2;\n textureNames.push(\"gBuffer_Depth\", \"gBuffer_Normal\");\n if (this._enablePosition) {\n this._positionIndex = count;\n count++;\n textureNames.push(\"gBuffer_Position\");\n }\n if (this._enableVelocity) {\n this._velocityIndex = count;\n count++;\n textureNames.push(\"gBuffer_Velocity\");\n }\n if (this._enableReflectivity) {\n this._reflectivityIndex = count;\n count++;\n textureNames.push(\"gBuffer_Reflectivity\");\n }\n return [count, textureNames];\n }\n _createRenderTargets() {\n const engine = this._scene.getEngine();\n const [count, textureNames] = this._assignRenderTargetIndices();\n let type = 0;\n if (engine._caps.textureFloat && engine._caps.textureFloatLinearFiltering) {\n type = 1;\n }\n else if (engine._caps.textureHalfFloat && engine._caps.textureHalfFloatLinearFiltering) {\n type = 2;\n }\n this._multiRenderTarget = new MultiRenderTarget(\"gBuffer\", { width: engine.getRenderWidth() * this._ratio, height: engine.getRenderHeight() * this._ratio }, count, this._scene, { generateMipMaps: false, generateDepthTexture: true, defaultType: type, depthTextureFormat: this._depthFormat }, textureNames.concat(\"gBuffer_DepthBuffer\"));\n if (!this.isSupported) {\n return;\n }\n this._multiRenderTarget.wrapU = Texture.CLAMP_ADDRESSMODE;\n this._multiRenderTarget.wrapV = Texture.CLAMP_ADDRESSMODE;\n this._multiRenderTarget.refreshRate = 1;\n this._multiRenderTarget.renderParticles = false;\n this._multiRenderTarget.renderList = null;\n // Depth is always the first texture in the geometry buffer renderer!\n const layoutAttachmentsAll = [true];\n const layoutAttachmentsAllButDepth = [false];\n const layoutAttachmentsDepthOnly = [true];\n for (let i = 1; i < count; ++i) {\n layoutAttachmentsAll.push(true);\n layoutAttachmentsDepthOnly.push(false);\n layoutAttachmentsAllButDepth.push(true);\n }\n const attachmentsAll = engine.buildTextureLayout(layoutAttachmentsAll);\n const attachmentsAllButDepth = engine.buildTextureLayout(layoutAttachmentsAllButDepth);\n const attachmentsDepthOnly = engine.buildTextureLayout(layoutAttachmentsDepthOnly);\n this._multiRenderTarget.onClearObservable.add((engine) => {\n engine.bindAttachments(this.useSpecificClearForDepthTexture ? attachmentsAllButDepth : attachmentsAll);\n engine.clear(this._clearColor, true, true, true);\n if (this.useSpecificClearForDepthTexture) {\n engine.bindAttachments(attachmentsDepthOnly);\n engine.clear(this._clearDepthColor, true, true, true);\n }\n engine.bindAttachments(attachmentsAll);\n });\n this._resizeObserver = engine.onResizeObservable.add(() => {\n if (this._multiRenderTarget) {\n this._multiRenderTarget.resize({ width: engine.getRenderWidth() * this._ratio, height: engine.getRenderHeight() * this._ratio });\n }\n });\n // Custom render function\n const renderSubMesh = (subMesh) => {\n const renderingMesh = subMesh.getRenderingMesh();\n const effectiveMesh = subMesh.getEffectiveMesh();\n const scene = this._scene;\n const engine = scene.getEngine();\n const material = subMesh.getMaterial();\n if (!material) {\n return;\n }\n effectiveMesh._internalAbstractMeshDataInfo._isActiveIntermediate = false;\n // Velocity\n if (this._enableVelocity && !this._previousTransformationMatrices[effectiveMesh.uniqueId]) {\n this._previousTransformationMatrices[effectiveMesh.uniqueId] = {\n world: Matrix.Identity(),\n viewProjection: scene.getTransformMatrix(),\n };\n if (renderingMesh.skeleton) {\n const bonesTransformations = renderingMesh.skeleton.getTransformMatrices(renderingMesh);\n this._previousBonesTransformationMatrices[renderingMesh.uniqueId] = this._copyBonesTransformationMatrices(bonesTransformations, new Float32Array(bonesTransformations.length));\n }\n }\n // Managing instances\n const batch = renderingMesh._getInstancesRenderList(subMesh._id, !!subMesh.getReplacementMesh());\n if (batch.mustReturn) {\n return;\n }\n const hardwareInstancedRendering = engine.getCaps().instancedArrays && (batch.visibleInstances[subMesh._id] !== null || renderingMesh.hasThinInstances);\n const world = effectiveMesh.getWorldMatrix();\n if (this.isReady(subMesh, hardwareInstancedRendering)) {\n const drawWrapper = subMesh._getDrawWrapper();\n if (!drawWrapper) {\n return;\n }\n const effect = drawWrapper.effect;\n engine.enableEffect(drawWrapper);\n if (!hardwareInstancedRendering) {\n renderingMesh._bind(subMesh, effect, material.fillMode);\n }\n if (!this._useUbo) {\n effect.setMatrix(\"viewProjection\", scene.getTransformMatrix());\n effect.setMatrix(\"view\", scene.getViewMatrix());\n }\n else {\n MaterialHelper.BindSceneUniformBuffer(effect, this._scene.getSceneUniformBuffer());\n this._scene.finalizeSceneUbo();\n }\n let sideOrientation;\n const instanceDataStorage = renderingMesh._instanceDataStorage;\n if (!instanceDataStorage.isFrozen && (material.backFaceCulling || renderingMesh.overrideMaterialSideOrientation !== null)) {\n const mainDeterminant = effectiveMesh._getWorldMatrixDeterminant();\n sideOrientation = renderingMesh.overrideMaterialSideOrientation;\n if (sideOrientation === null) {\n sideOrientation = material.sideOrientation;\n }\n if (mainDeterminant < 0) {\n sideOrientation = sideOrientation === Material.ClockWiseSideOrientation ? Material.CounterClockWiseSideOrientation : Material.ClockWiseSideOrientation;\n }\n }\n else {\n sideOrientation = instanceDataStorage.sideOrientation;\n }\n material._preBind(drawWrapper, sideOrientation);\n // Alpha test\n if (material.needAlphaTesting()) {\n const alphaTexture = material.getAlphaTestTexture();\n if (alphaTexture) {\n effect.setTexture(\"diffuseSampler\", alphaTexture);\n effect.setMatrix(\"diffuseMatrix\", alphaTexture.getTextureMatrix());\n }\n }\n // Bump\n if (material.bumpTexture && scene.getEngine().getCaps().standardDerivatives && MaterialFlags.BumpTextureEnabled) {\n effect.setFloat3(\"vBumpInfos\", material.bumpTexture.coordinatesIndex, 1.0 / material.bumpTexture.level, material.parallaxScaleBias);\n effect.setMatrix(\"bumpMatrix\", material.bumpTexture.getTextureMatrix());\n effect.setTexture(\"bumpSampler\", material.bumpTexture);\n effect.setFloat2(\"vTangentSpaceParams\", material.invertNormalMapX ? -1.0 : 1.0, material.invertNormalMapY ? -1.0 : 1.0);\n }\n // Reflectivity\n if (this._enableReflectivity) {\n // for PBR materials: cf. https://doc.babylonjs.com/features/featuresDeepDive/materials/using/masterPBR\n if (material.getClassName() === \"PBRMetallicRoughnessMaterial\") {\n // if it is a PBR material in MetallicRoughness Mode:\n if (material.metallicRoughnessTexture !== null) {\n effect.setTexture(\"reflectivitySampler\", material.metallicRoughnessTexture);\n effect.setMatrix(\"reflectivityMatrix\", material.metallicRoughnessTexture.getTextureMatrix());\n }\n if (material.metallic !== null) {\n effect.setFloat(\"metallic\", material.metallic);\n }\n if (material.roughness !== null) {\n effect.setFloat(\"glossiness\", 1.0 - material.roughness);\n }\n if (material.baseTexture !== null) {\n effect.setTexture(\"albedoSampler\", material.baseTexture);\n effect.setMatrix(\"albedoMatrix\", material.baseTexture.getTextureMatrix());\n }\n if (material.baseColor !== null) {\n effect.setColor3(\"albedoColor\", material.baseColor);\n }\n }\n else if (material.getClassName() === \"PBRSpecularGlossinessMaterial\") {\n // if it is a PBR material in Specular/Glossiness Mode:\n if (material.specularGlossinessTexture !== null) {\n effect.setTexture(\"reflectivitySampler\", material.specularGlossinessTexture);\n effect.setMatrix(\"reflectivityMatrix\", material.specularGlossinessTexture.getTextureMatrix());\n }\n else {\n if (material.specularColor !== null) {\n effect.setColor3(\"reflectivityColor\", material.specularColor);\n }\n }\n if (material.glossiness !== null) {\n effect.setFloat(\"glossiness\", material.glossiness);\n }\n }\n else if (material.getClassName() === \"PBRMaterial\") {\n // if it is the bigger PBRMaterial\n if (material.metallicTexture !== null) {\n effect.setTexture(\"reflectivitySampler\", material.metallicTexture);\n effect.setMatrix(\"reflectivityMatrix\", material.metallicTexture.getTextureMatrix());\n }\n if (material.metallic !== null) {\n effect.setFloat(\"metallic\", material.metallic);\n }\n if (material.roughness !== null) {\n effect.setFloat(\"glossiness\", 1.0 - material.roughness);\n }\n if (material.roughness !== null || material.metallic !== null || material.metallicTexture !== null) {\n // MetallicRoughness Model\n if (material.albedoTexture !== null) {\n effect.setTexture(\"albedoSampler\", material.albedoTexture);\n effect.setMatrix(\"albedoMatrix\", material.albedoTexture.getTextureMatrix());\n }\n if (material.albedoColor !== null) {\n effect.setColor3(\"albedoColor\", material.albedoColor);\n }\n }\n else {\n // SpecularGlossiness Model\n if (material.reflectivityTexture !== null) {\n effect.setTexture(\"reflectivitySampler\", material.reflectivityTexture);\n effect.setMatrix(\"reflectivityMatrix\", material.reflectivityTexture.getTextureMatrix());\n }\n else if (material.reflectivityColor !== null) {\n effect.setColor3(\"reflectivityColor\", material.reflectivityColor);\n }\n if (material.microSurface !== null) {\n effect.setFloat(\"glossiness\", material.microSurface);\n }\n }\n }\n else if (material.getClassName() === \"StandardMaterial\") {\n // if StandardMaterial:\n if (material.specularTexture !== null) {\n effect.setTexture(\"reflectivitySampler\", material.specularTexture);\n effect.setMatrix(\"reflectivityMatrix\", material.specularTexture.getTextureMatrix());\n }\n if (material.specularColor !== null) {\n effect.setColor3(\"reflectivityColor\", material.specularColor);\n }\n }\n }\n // Clip plane\n bindClipPlane(effect, material, this._scene);\n // Bones\n if (renderingMesh.useBones && renderingMesh.computeBonesUsingShaders && renderingMesh.skeleton) {\n effect.setMatrices(\"mBones\", renderingMesh.skeleton.getTransformMatrices(renderingMesh));\n if (this._enableVelocity) {\n effect.setMatrices(\"mPreviousBones\", this._previousBonesTransformationMatrices[renderingMesh.uniqueId]);\n }\n }\n // Morph targets\n MaterialHelper.BindMorphTargetParameters(renderingMesh, effect);\n if (renderingMesh.morphTargetManager && renderingMesh.morphTargetManager.isUsingTextureForTargets) {\n renderingMesh.morphTargetManager._bind(effect);\n }\n // Velocity\n if (this._enableVelocity) {\n effect.setMatrix(\"previousWorld\", this._previousTransformationMatrices[effectiveMesh.uniqueId].world);\n effect.setMatrix(\"previousViewProjection\", this._previousTransformationMatrices[effectiveMesh.uniqueId].viewProjection);\n }\n if (hardwareInstancedRendering && renderingMesh.hasThinInstances) {\n effect.setMatrix(\"world\", world);\n }\n // Draw\n renderingMesh._processRendering(effectiveMesh, subMesh, effect, material.fillMode, batch, hardwareInstancedRendering, (isInstance, w) => {\n if (!isInstance) {\n effect.setMatrix(\"world\", w);\n }\n });\n }\n // Velocity\n if (this._enableVelocity) {\n this._previousTransformationMatrices[effectiveMesh.uniqueId].world = world.clone();\n this._previousTransformationMatrices[effectiveMesh.uniqueId].viewProjection = this._scene.getTransformMatrix().clone();\n if (renderingMesh.skeleton) {\n this._copyBonesTransformationMatrices(renderingMesh.skeleton.getTransformMatrices(renderingMesh), this._previousBonesTransformationMatrices[effectiveMesh.uniqueId]);\n }\n }\n };\n this._multiRenderTarget.customIsReadyFunction = (mesh, refreshRate, preWarm) => {\n if ((preWarm || refreshRate === 0) && mesh.subMeshes) {\n for (let i = 0; i < mesh.subMeshes.length; ++i) {\n const subMesh = mesh.subMeshes[i];\n const material = subMesh.getMaterial();\n const renderingMesh = subMesh.getRenderingMesh();\n if (!material) {\n continue;\n }\n const batch = renderingMesh._getInstancesRenderList(subMesh._id, !!subMesh.getReplacementMesh());\n const hardwareInstancedRendering = engine.getCaps().instancedArrays && (batch.visibleInstances[subMesh._id] !== null || renderingMesh.hasThinInstances);\n if (!this.isReady(subMesh, hardwareInstancedRendering)) {\n return false;\n }\n }\n }\n return true;\n };\n this._multiRenderTarget.customRenderFunction = (opaqueSubMeshes, alphaTestSubMeshes, transparentSubMeshes, depthOnlySubMeshes) => {\n let index;\n if (this._linkedWithPrePass) {\n if (!this._prePassRenderer.enabled) {\n return;\n }\n this._scene.getEngine().bindAttachments(this._attachmentsFromPrePass);\n }\n if (depthOnlySubMeshes.length) {\n engine.setColorWrite(false);\n for (index = 0; index < depthOnlySubMeshes.length; index++) {\n renderSubMesh(depthOnlySubMeshes.data[index]);\n }\n engine.setColorWrite(true);\n }\n for (index = 0; index < opaqueSubMeshes.length; index++) {\n renderSubMesh(opaqueSubMeshes.data[index]);\n }\n engine.setDepthWrite(false);\n for (index = 0; index < alphaTestSubMeshes.length; index++) {\n renderSubMesh(alphaTestSubMeshes.data[index]);\n }\n if (this.renderTransparentMeshes) {\n for (index = 0; index < transparentSubMeshes.length; index++) {\n renderSubMesh(transparentSubMeshes.data[index]);\n }\n }\n engine.setDepthWrite(true);\n };\n }\n // Copies the bones transformation matrices into the target array and returns the target's reference\n _copyBonesTransformationMatrices(source, target) {\n for (let i = 0; i < source.length; i++) {\n target[i] = source[i];\n }\n return target;\n }\n}\n/**\n * Constant used to retrieve the depth texture index in the G-Buffer textures array\n * using getIndex(GeometryBufferRenderer.DEPTH_TEXTURE_INDEX)\n */\nGeometryBufferRenderer.DEPTH_TEXTURE_TYPE = 0;\n/**\n * Constant used to retrieve the normal texture index in the G-Buffer textures array\n * using getIndex(GeometryBufferRenderer.NORMAL_TEXTURE_INDEX)\n */\nGeometryBufferRenderer.NORMAL_TEXTURE_TYPE = 1;\n/**\n * Constant used to retrieve the position texture index in the G-Buffer textures array\n * using getIndex(GeometryBufferRenderer.POSITION_TEXTURE_INDEX)\n */\nGeometryBufferRenderer.POSITION_TEXTURE_TYPE = 2;\n/**\n * Constant used to retrieve the velocity texture index in the G-Buffer textures array\n * using getIndex(GeometryBufferRenderer.VELOCITY_TEXTURE_INDEX)\n */\nGeometryBufferRenderer.VELOCITY_TEXTURE_TYPE = 3;\n/**\n * Constant used to retrieve the reflectivity texture index in the G-Buffer textures array\n * using the getIndex(GeometryBufferRenderer.REFLECTIVITY_TEXTURE_TYPE)\n */\nGeometryBufferRenderer.REFLECTIVITY_TEXTURE_TYPE = 4;\n/**\n * @internal\n */\nGeometryBufferRenderer._SceneComponentInitialization = (_) => {\n throw _WarnImport(\"GeometryBufferRendererSceneComponent\");\n};\n//# sourceMappingURL=geometryBufferRenderer.js.map","\n/**\n * Contains all parameters needed for the prepass to perform\n * motion blur\n */\nexport class MotionBlurConfiguration {\n constructor() {\n /**\n * Is motion blur enabled\n */\n this.enabled = false;\n /**\n * Name of the configuration\n */\n this.name = \"motionBlur\";\n /**\n * Textures that should be present in the MRT for this effect to work\n */\n this.texturesRequired = [2];\n }\n}\n//# sourceMappingURL=motionBlurConfiguration.js.map","import { Quaternion, Vector3, Vector2, Matrix } from \"../Maths/math.vector.js\";\nimport { Color3 } from \"../Maths/math.color.js\";\nimport { Animation } from \"./animation.js\";\nimport { Size } from \"../Maths/math.size.js\";\n// Static values to help the garbage collector\n// Quaternion\nconst _staticOffsetValueQuaternion = Object.freeze(new Quaternion(0, 0, 0, 0));\n// Vector3\nconst _staticOffsetValueVector3 = Object.freeze(Vector3.Zero());\n// Vector2\nconst _staticOffsetValueVector2 = Object.freeze(Vector2.Zero());\n// Size\nconst _staticOffsetValueSize = Object.freeze(Size.Zero());\n// Color3\nconst _staticOffsetValueColor3 = Object.freeze(Color3.Black());\n/**\n * Defines a runtime animation\n */\nexport class RuntimeAnimation {\n /**\n * Gets the current frame of the runtime animation\n */\n get currentFrame() {\n return this._currentFrame;\n }\n /**\n * Gets the weight of the runtime animation\n */\n get weight() {\n return this._weight;\n }\n /**\n * Gets the current value of the runtime animation\n */\n get currentValue() {\n return this._currentValue;\n }\n /**\n * Gets or sets the target path of the runtime animation\n */\n get targetPath() {\n return this._targetPath;\n }\n /**\n * Gets the actual target of the runtime animation\n */\n get target() {\n return this._currentActiveTarget;\n }\n /**\n * Gets the additive state of the runtime animation\n */\n get isAdditive() {\n return this._host && this._host.isAdditive;\n }\n /**\n * Create a new RuntimeAnimation object\n * @param target defines the target of the animation\n * @param animation defines the source animation object\n * @param scene defines the hosting scene\n * @param host defines the initiating Animatable\n */\n constructor(target, animation, scene, host) {\n this._events = new Array();\n /**\n * The current frame of the runtime animation\n */\n this._currentFrame = 0;\n /**\n * The original value of the runtime animation\n */\n this._originalValue = new Array();\n /**\n * The original blend value of the runtime animation\n */\n this._originalBlendValue = null;\n /**\n * The offsets cache of the runtime animation\n */\n this._offsetsCache = {};\n /**\n * The high limits cache of the runtime animation\n */\n this._highLimitsCache = {};\n /**\n * Specifies if the runtime animation has been stopped\n */\n this._stopped = false;\n /**\n * The blending factor of the runtime animation\n */\n this._blendingFactor = 0;\n /**\n * The current value of the runtime animation\n */\n this._currentValue = null;\n this._currentActiveTarget = null;\n this._directTarget = null;\n /**\n * The target path of the runtime animation\n */\n this._targetPath = \"\";\n /**\n * The weight of the runtime animation\n */\n this._weight = 1.0;\n /**\n * The absolute frame offset of the runtime animation\n */\n this._absoluteFrameOffset = 0;\n /**\n * The previous elapsed time (since start of animation) of the runtime animation\n */\n this._previousElapsedTime = 0;\n /**\n * The previous absolute frame of the runtime animation (meaning, without taking into account the from/to values, only the elapsed time and the fps)\n */\n this._previousAbsoluteFrame = 0;\n this._targetIsArray = false;\n this._animation = animation;\n this._target = target;\n this._scene = scene;\n this._host = host;\n this._activeTargets = [];\n animation._runtimeAnimations.push(this);\n // State\n this._animationState = {\n key: 0,\n repeatCount: 0,\n loopMode: this._getCorrectLoopMode(),\n };\n if (this._animation.dataType === Animation.ANIMATIONTYPE_MATRIX) {\n this._animationState.workValue = Matrix.Zero();\n }\n // Limits\n this._keys = this._animation.getKeys();\n this._minFrame = this._keys[0].frame;\n this._maxFrame = this._keys[this._keys.length - 1].frame;\n this._minValue = this._keys[0].value;\n this._maxValue = this._keys[this._keys.length - 1].value;\n // Add a start key at frame 0 if missing\n if (this._minFrame !== 0) {\n const newKey = { frame: 0, value: this._minValue };\n this._keys.splice(0, 0, newKey);\n }\n // Check data\n if (this._target instanceof Array) {\n let index = 0;\n for (const target of this._target) {\n this._preparePath(target, index);\n this._getOriginalValues(index);\n index++;\n }\n this._targetIsArray = true;\n }\n else {\n this._preparePath(this._target);\n this._getOriginalValues();\n this._targetIsArray = false;\n this._directTarget = this._activeTargets[0];\n }\n // Cloning events locally\n const events = animation.getEvents();\n if (events && events.length > 0) {\n events.forEach((e) => {\n this._events.push(e._clone());\n });\n }\n this._enableBlending = target && target.animationPropertiesOverride ? target.animationPropertiesOverride.enableBlending : this._animation.enableBlending;\n }\n _preparePath(target, targetIndex = 0) {\n const targetPropertyPath = this._animation.targetPropertyPath;\n if (targetPropertyPath.length > 1) {\n let property = target[targetPropertyPath[0]];\n for (let index = 1; index < targetPropertyPath.length - 1; index++) {\n property = property[targetPropertyPath[index]];\n }\n this._targetPath = targetPropertyPath[targetPropertyPath.length - 1];\n this._activeTargets[targetIndex] = property;\n }\n else {\n this._targetPath = targetPropertyPath[0];\n this._activeTargets[targetIndex] = target;\n }\n }\n /**\n * Gets the animation from the runtime animation\n */\n get animation() {\n return this._animation;\n }\n /**\n * Resets the runtime animation to the beginning\n * @param restoreOriginal defines whether to restore the target property to the original value\n */\n reset(restoreOriginal = false) {\n if (restoreOriginal) {\n if (this._target instanceof Array) {\n let index = 0;\n for (const target of this._target) {\n if (this._originalValue[index] !== undefined) {\n this._setValue(target, this._activeTargets[index], this._originalValue[index], -1, index);\n }\n index++;\n }\n }\n else {\n if (this._originalValue[0] !== undefined) {\n this._setValue(this._target, this._directTarget, this._originalValue[0], -1, 0);\n }\n }\n }\n this._offsetsCache = {};\n this._highLimitsCache = {};\n this._currentFrame = 0;\n this._blendingFactor = 0;\n // Events\n for (let index = 0; index < this._events.length; index++) {\n this._events[index].isDone = false;\n }\n }\n /**\n * Specifies if the runtime animation is stopped\n * @returns Boolean specifying if the runtime animation is stopped\n */\n isStopped() {\n return this._stopped;\n }\n /**\n * Disposes of the runtime animation\n */\n dispose() {\n const index = this._animation.runtimeAnimations.indexOf(this);\n if (index > -1) {\n this._animation.runtimeAnimations.splice(index, 1);\n }\n }\n /**\n * Apply the interpolated value to the target\n * @param currentValue defines the value computed by the animation\n * @param weight defines the weight to apply to this value (Defaults to 1.0)\n */\n setValue(currentValue, weight) {\n if (this._targetIsArray) {\n for (let index = 0; index < this._target.length; index++) {\n const target = this._target[index];\n this._setValue(target, this._activeTargets[index], currentValue, weight, index);\n }\n return;\n }\n this._setValue(this._target, this._directTarget, currentValue, weight, 0);\n }\n _getOriginalValues(targetIndex = 0) {\n let originalValue;\n const target = this._activeTargets[targetIndex];\n if (target.getLocalMatrix && this._targetPath === \"_matrix\") {\n // For bones\n originalValue = target.getLocalMatrix();\n }\n else {\n originalValue = target[this._targetPath];\n }\n if (originalValue && originalValue.clone) {\n this._originalValue[targetIndex] = originalValue.clone();\n }\n else {\n this._originalValue[targetIndex] = originalValue;\n }\n }\n _setValue(target, destination, currentValue, weight, targetIndex) {\n // Set value\n this._currentActiveTarget = destination;\n this._weight = weight;\n if (this._enableBlending && this._blendingFactor <= 1.0) {\n if (!this._originalBlendValue) {\n const originalValue = destination[this._targetPath];\n if (originalValue.clone) {\n this._originalBlendValue = originalValue.clone();\n }\n else {\n this._originalBlendValue = originalValue;\n }\n }\n if (this._originalBlendValue.m) {\n // Matrix\n if (Animation.AllowMatrixDecomposeForInterpolation) {\n if (this._currentValue) {\n Matrix.DecomposeLerpToRef(this._originalBlendValue, currentValue, this._blendingFactor, this._currentValue);\n }\n else {\n this._currentValue = Matrix.DecomposeLerp(this._originalBlendValue, currentValue, this._blendingFactor);\n }\n }\n else {\n if (this._currentValue) {\n Matrix.LerpToRef(this._originalBlendValue, currentValue, this._blendingFactor, this._currentValue);\n }\n else {\n this._currentValue = Matrix.Lerp(this._originalBlendValue, currentValue, this._blendingFactor);\n }\n }\n }\n else {\n this._currentValue = Animation._UniversalLerp(this._originalBlendValue, currentValue, this._blendingFactor);\n }\n const blendingSpeed = target && target.animationPropertiesOverride ? target.animationPropertiesOverride.blendingSpeed : this._animation.blendingSpeed;\n this._blendingFactor += blendingSpeed;\n }\n else {\n if (!this._currentValue) {\n if (currentValue === null || currentValue === void 0 ? void 0 : currentValue.clone) {\n this._currentValue = currentValue.clone();\n }\n else {\n this._currentValue = currentValue;\n }\n }\n else if (this._currentValue.copyFrom) {\n this._currentValue.copyFrom(currentValue);\n }\n else {\n this._currentValue = currentValue;\n }\n }\n if (weight !== -1.0) {\n this._scene._registerTargetForLateAnimationBinding(this, this._originalValue[targetIndex]);\n }\n else {\n destination[this._targetPath] = this._currentValue;\n }\n if (target.markAsDirty) {\n target.markAsDirty(this._animation.targetProperty);\n }\n }\n /**\n * Gets the loop pmode of the runtime animation\n * @returns Loop Mode\n */\n _getCorrectLoopMode() {\n if (this._target && this._target.animationPropertiesOverride) {\n return this._target.animationPropertiesOverride.loopMode;\n }\n return this._animation.loopMode;\n }\n /**\n * Move the current animation to a given frame\n * @param frame defines the frame to move to\n */\n goToFrame(frame) {\n const keys = this._animation.getKeys();\n if (frame < keys[0].frame) {\n frame = keys[0].frame;\n }\n else if (frame > keys[keys.length - 1].frame) {\n frame = keys[keys.length - 1].frame;\n }\n // Need to reset animation events\n const events = this._events;\n if (events.length) {\n for (let index = 0; index < events.length; index++) {\n if (!events[index].onlyOnce) {\n // reset events in the future\n events[index].isDone = events[index].frame < frame;\n }\n }\n }\n this._currentFrame = frame;\n const currentValue = this._animation._interpolate(frame, this._animationState);\n this.setValue(currentValue, -1);\n }\n /**\n * @internal Internal use only\n */\n _prepareForSpeedRatioChange(newSpeedRatio) {\n const newAbsoluteFrame = (this._previousElapsedTime * (this._animation.framePerSecond * newSpeedRatio)) / 1000.0;\n this._absoluteFrameOffset = this._previousAbsoluteFrame - newAbsoluteFrame;\n }\n /**\n * Execute the current animation\n * @param elapsedTimeSinceAnimationStart defines the elapsed time (in milliseconds) since the animation was started\n * @param from defines the lower frame of the animation range\n * @param to defines the upper frame of the animation range\n * @param loop defines if the current animation must loop\n * @param speedRatio defines the current speed ratio\n * @param weight defines the weight of the animation (default is -1 so no weight)\n * @returns a boolean indicating if the animation is running\n */\n animate(elapsedTimeSinceAnimationStart, from, to, loop, speedRatio, weight = -1.0) {\n const animation = this._animation;\n const targetPropertyPath = animation.targetPropertyPath;\n if (!targetPropertyPath || targetPropertyPath.length < 1) {\n this._stopped = true;\n return false;\n }\n let returnValue = true;\n // Check limits\n if (from < this._minFrame || from > this._maxFrame) {\n from = this._minFrame;\n }\n if (to < this._minFrame || to > this._maxFrame) {\n to = this._maxFrame;\n }\n const frameRange = to - from;\n let offsetValue;\n // Compute the frame according to the elapsed time and the fps of the animation (\"from\" and \"to\" are not factored in!)\n let absoluteFrame = (elapsedTimeSinceAnimationStart * (animation.framePerSecond * speedRatio)) / 1000.0 + this._absoluteFrameOffset;\n let highLimitValue = 0;\n // Apply the yoyo function if required\n if (loop && this._animationState.loopMode === Animation.ANIMATIONLOOPMODE_YOYO) {\n const position = (absoluteFrame - from) / frameRange;\n // Apply the yoyo curve\n const yoyoPosition = Math.abs(Math.sin(position * Math.PI));\n // Map the yoyo position back to the range\n absoluteFrame = yoyoPosition * frameRange + from;\n }\n this._previousElapsedTime = elapsedTimeSinceAnimationStart;\n this._previousAbsoluteFrame = absoluteFrame;\n if (!loop && to >= from && absoluteFrame >= frameRange) {\n // If we are out of range and not looping get back to caller\n returnValue = false;\n highLimitValue = animation._getKeyValue(this._maxValue);\n }\n else if (!loop && from >= to && absoluteFrame <= frameRange) {\n returnValue = false;\n highLimitValue = animation._getKeyValue(this._minValue);\n }\n else if (this._animationState.loopMode !== Animation.ANIMATIONLOOPMODE_CYCLE) {\n const keyOffset = to.toString() + from.toString();\n if (!this._offsetsCache[keyOffset]) {\n this._animationState.repeatCount = 0;\n this._animationState.loopMode = Animation.ANIMATIONLOOPMODE_CYCLE; // force a specific codepath in animation._interpolate()!\n const fromValue = animation._interpolate(from, this._animationState);\n const toValue = animation._interpolate(to, this._animationState);\n this._animationState.loopMode = this._getCorrectLoopMode();\n switch (animation.dataType) {\n // Float\n case Animation.ANIMATIONTYPE_FLOAT:\n this._offsetsCache[keyOffset] = toValue - fromValue;\n break;\n // Quaternion\n case Animation.ANIMATIONTYPE_QUATERNION:\n this._offsetsCache[keyOffset] = toValue.subtract(fromValue);\n break;\n // Vector3\n case Animation.ANIMATIONTYPE_VECTOR3:\n this._offsetsCache[keyOffset] = toValue.subtract(fromValue);\n break;\n // Vector2\n case Animation.ANIMATIONTYPE_VECTOR2:\n this._offsetsCache[keyOffset] = toValue.subtract(fromValue);\n break;\n // Size\n case Animation.ANIMATIONTYPE_SIZE:\n this._offsetsCache[keyOffset] = toValue.subtract(fromValue);\n break;\n // Color3\n case Animation.ANIMATIONTYPE_COLOR3:\n this._offsetsCache[keyOffset] = toValue.subtract(fromValue);\n break;\n default:\n break;\n }\n this._highLimitsCache[keyOffset] = toValue;\n }\n highLimitValue = this._highLimitsCache[keyOffset];\n offsetValue = this._offsetsCache[keyOffset];\n }\n if (offsetValue === undefined) {\n switch (animation.dataType) {\n // Float\n case Animation.ANIMATIONTYPE_FLOAT:\n offsetValue = 0;\n break;\n // Quaternion\n case Animation.ANIMATIONTYPE_QUATERNION:\n offsetValue = _staticOffsetValueQuaternion;\n break;\n // Vector3\n case Animation.ANIMATIONTYPE_VECTOR3:\n offsetValue = _staticOffsetValueVector3;\n break;\n // Vector2\n case Animation.ANIMATIONTYPE_VECTOR2:\n offsetValue = _staticOffsetValueVector2;\n break;\n // Size\n case Animation.ANIMATIONTYPE_SIZE:\n offsetValue = _staticOffsetValueSize;\n break;\n // Color3\n case Animation.ANIMATIONTYPE_COLOR3:\n offsetValue = _staticOffsetValueColor3;\n }\n }\n // Compute value\n let currentFrame;\n if (this._host && this._host.syncRoot) {\n // If we must sync with an animatable, calculate the current frame based on the frame of the root animatable\n const syncRoot = this._host.syncRoot;\n const hostNormalizedFrame = (syncRoot.masterFrame - syncRoot.fromFrame) / (syncRoot.toFrame - syncRoot.fromFrame);\n currentFrame = from + frameRange * hostNormalizedFrame;\n }\n else {\n if ((absoluteFrame > 0 && from > to) || (absoluteFrame < 0 && from < to)) {\n currentFrame = returnValue && frameRange !== 0 ? to + (absoluteFrame % frameRange) : from;\n }\n else {\n currentFrame = returnValue && frameRange !== 0 ? from + (absoluteFrame % frameRange) : to;\n }\n }\n const events = this._events;\n // Reset event/state if looping\n if ((speedRatio > 0 && this.currentFrame > currentFrame) || (speedRatio < 0 && this.currentFrame < currentFrame)) {\n this._onLoop();\n // Need to reset animation events\n for (let index = 0; index < events.length; index++) {\n if (!events[index].onlyOnce) {\n // reset event, the animation is looping\n events[index].isDone = false;\n }\n }\n this._animationState.key = speedRatio > 0 ? 0 : animation.getKeys().length - 1;\n }\n this._currentFrame = currentFrame;\n this._animationState.repeatCount = frameRange === 0 ? 0 : (absoluteFrame / frameRange) >> 0;\n this._animationState.highLimitValue = highLimitValue;\n this._animationState.offsetValue = offsetValue;\n const currentValue = animation._interpolate(currentFrame, this._animationState);\n // Set value\n this.setValue(currentValue, weight);\n // Check events\n if (events.length) {\n for (let index = 0; index < events.length; index++) {\n // Make sure current frame has passed event frame and that event frame is within the current range\n // Also, handle both forward and reverse animations\n if ((frameRange > 0 && currentFrame >= events[index].frame && events[index].frame >= from) ||\n (frameRange < 0 && currentFrame <= events[index].frame && events[index].frame <= from)) {\n const event = events[index];\n if (!event.isDone) {\n // If event should be done only once, remove it.\n if (event.onlyOnce) {\n events.splice(index, 1);\n index--;\n }\n event.isDone = true;\n event.action(currentFrame);\n } // Don't do anything if the event has already been done.\n }\n }\n }\n if (!returnValue) {\n this._stopped = true;\n }\n return returnValue;\n }\n}\n//# sourceMappingURL=runtimeAnimation.js.map","import { Vector3, Quaternion, Matrix, TmpVectors } from \"../Maths/math.vector.js\";\nimport { ArrayTools } from \"../Misc/arrayTools.js\";\nimport { Node } from \"../node.js\";\nimport { Space } from \"../Maths/math.axis.js\";\n/**\n * Class used to store bone information\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/bonesSkeletons\n */\nexport class Bone extends Node {\n /** @internal */\n get _matrix() {\n this._compose();\n return this._localMatrix;\n }\n /** @internal */\n set _matrix(value) {\n // skip if the matrices are the same\n if (value.updateFlag === this._localMatrix.updateFlag && !this._needToCompose) {\n return;\n }\n this._needToCompose = false; // in case there was a pending compose\n this._localMatrix.copyFrom(value);\n this._markAsDirtyAndDecompose();\n }\n /**\n * Create a new bone\n * @param name defines the bone name\n * @param skeleton defines the parent skeleton\n * @param parentBone defines the parent (can be null if the bone is the root)\n * @param localMatrix defines the local matrix (default: identity)\n * @param restMatrix defines the rest matrix (default: localMatrix)\n * @param bindMatrix defines the bind matrix (default: localMatrix)\n * @param index defines index of the bone in the hierarchy (default: null)\n */\n constructor(\n /**\n * defines the bone name\n */\n name, skeleton, parentBone = null, localMatrix = null, restMatrix = null, bindMatrix = null, index = null) {\n var _a;\n super(name, skeleton.getScene());\n this.name = name;\n /**\n * Gets the list of child bones\n */\n this.children = new Array();\n /** Gets the animations associated with this bone */\n this.animations = new Array();\n /**\n * @internal Internal only\n * Set this value to map this bone to a different index in the transform matrices\n * Set this value to -1 to exclude the bone from the transform matrices\n */\n this._index = null;\n this._scalingDeterminant = 1;\n this._needToDecompose = true;\n this._needToCompose = false;\n /** @internal */\n this._linkedTransformNode = null;\n /** @internal */\n this._waitingTransformNodeId = null;\n this._skeleton = skeleton;\n this._localMatrix = (_a = localMatrix === null || localMatrix === void 0 ? void 0 : localMatrix.clone()) !== null && _a !== void 0 ? _a : Matrix.Identity();\n this._restMatrix = restMatrix !== null && restMatrix !== void 0 ? restMatrix : this._localMatrix.clone();\n this._bindMatrix = bindMatrix !== null && bindMatrix !== void 0 ? bindMatrix : this._localMatrix.clone();\n this._index = index;\n this._absoluteMatrix = new Matrix();\n this._absoluteBindMatrix = new Matrix();\n this._absoluteInverseBindMatrix = new Matrix();\n this._finalMatrix = new Matrix();\n skeleton.bones.push(this);\n this.setParent(parentBone, false);\n this._updateAbsoluteBindMatrices();\n }\n /**\n * Gets the current object class name.\n * @returns the class name\n */\n getClassName() {\n return \"Bone\";\n }\n // Members\n /**\n * Gets the parent skeleton\n * @returns a skeleton\n */\n getSkeleton() {\n return this._skeleton;\n }\n get parent() {\n return this._parentNode;\n }\n /**\n * Gets parent bone\n * @returns a bone or null if the bone is the root of the bone hierarchy\n */\n getParent() {\n return this.parent;\n }\n /**\n * Returns an array containing the children of the bone\n * @returns an array containing the children of the bone (can be empty if the bone has no children)\n */\n getChildren() {\n return this.children;\n }\n /**\n * Gets the node index in matrix array generated for rendering\n * @returns the node index\n */\n getIndex() {\n return this._index === null ? this.getSkeleton().bones.indexOf(this) : this._index;\n }\n set parent(newParent) {\n this.setParent(newParent);\n }\n /**\n * Sets the parent bone\n * @param parent defines the parent (can be null if the bone is the root)\n * @param updateAbsoluteBindMatrices defines if the absolute bind and absolute inverse bind matrices must be updated\n */\n setParent(parent, updateAbsoluteBindMatrices = true) {\n if (this.parent === parent) {\n return;\n }\n if (this.parent) {\n const index = this.parent.children.indexOf(this);\n if (index !== -1) {\n this.parent.children.splice(index, 1);\n }\n }\n this._parentNode = parent;\n if (this.parent) {\n this.parent.children.push(this);\n }\n if (updateAbsoluteBindMatrices) {\n this._updateAbsoluteBindMatrices();\n }\n this.markAsDirty();\n }\n /**\n * Gets the local matrix\n * @returns the local matrix\n */\n getLocalMatrix() {\n this._compose();\n return this._localMatrix;\n }\n /**\n * Gets the bind matrix\n * @returns the bind matrix\n */\n getBindMatrix() {\n return this._bindMatrix;\n }\n /**\n * Gets the bind matrix.\n * @returns the bind matrix\n * @deprecated Please use getBindMatrix instead\n */\n getBaseMatrix() {\n return this.getBindMatrix();\n }\n /**\n * Gets the rest matrix\n * @returns the rest matrix\n */\n getRestMatrix() {\n return this._restMatrix;\n }\n /**\n * Gets the rest matrix\n * @returns the rest matrix\n * @deprecated Please use getRestMatrix instead\n */\n getRestPose() {\n return this.getRestMatrix();\n }\n /**\n * Sets the rest matrix\n * @param matrix the local-space rest matrix to set for this bone\n */\n setRestMatrix(matrix) {\n this._restMatrix.copyFrom(matrix);\n }\n /**\n * Sets the rest matrix\n * @param matrix the local-space rest to set for this bone\n * @deprecated Please use setRestMatrix instead\n */\n setRestPose(matrix) {\n this.setRestMatrix(matrix);\n }\n /**\n * Gets the bind matrix\n * @returns the bind matrix\n * @deprecated Please use getBindMatrix instead\n */\n getBindPose() {\n return this.getBindMatrix();\n }\n /**\n * Sets the bind matrix\n * This will trigger a recomputation of the absolute bind and absolute inverse bind matrices for this bone and its children\n * Note that the local matrix will also be set with the matrix passed in parameter!\n * @param matrix the local-space bind matrix to set for this bone\n */\n setBindMatrix(matrix) {\n this.updateMatrix(matrix);\n }\n /**\n * Sets the bind matrix\n * @param matrix the local-space bind to set for this bone\n * @deprecated Please use setBindMatrix instead\n */\n setBindPose(matrix) {\n this.setBindMatrix(matrix);\n }\n /**\n * Gets the matrix used to store the final world transformation of the bone (ie. the matrix sent to shaders)\n */\n getFinalMatrix() {\n return this._finalMatrix;\n }\n /**\n * Gets the matrix used to store the final world transformation of the bone (ie. the matrix sent to shaders)\n * @deprecated Please use getFinalMatrix instead\n */\n getWorldMatrix() {\n return this.getFinalMatrix();\n }\n /**\n * Sets the local matrix to the rest matrix\n */\n returnToRest() {\n var _a;\n if (this._linkedTransformNode) {\n const localScaling = TmpVectors.Vector3[0];\n const localRotation = TmpVectors.Quaternion[0];\n const localPosition = TmpVectors.Vector3[1];\n this.getRestMatrix().decompose(localScaling, localRotation, localPosition);\n this._linkedTransformNode.position.copyFrom(localPosition);\n this._linkedTransformNode.rotationQuaternion = (_a = this._linkedTransformNode.rotationQuaternion) !== null && _a !== void 0 ? _a : Quaternion.Identity();\n this._linkedTransformNode.rotationQuaternion.copyFrom(localRotation);\n this._linkedTransformNode.scaling.copyFrom(localScaling);\n }\n else {\n this._matrix = this._restMatrix;\n }\n }\n /**\n * Gets the inverse of the bind matrix, in world space (relative to the skeleton root)\n * @returns the inverse bind matrix, in world space\n */\n getAbsoluteInverseBindMatrix() {\n return this._absoluteInverseBindMatrix;\n }\n /**\n * Gets the inverse of the bind matrix, in world space (relative to the skeleton root)\n * @returns the inverse bind matrix, in world space\n * @deprecated Please use getAbsoluteInverseBindMatrix instead\n */\n getInvertedAbsoluteTransform() {\n return this.getAbsoluteInverseBindMatrix();\n }\n /**\n * Gets the bone matrix, in world space (relative to the skeleton root)\n * @returns the bone matrix, in world space\n */\n getAbsoluteMatrix() {\n return this._absoluteMatrix;\n }\n /**\n * Gets the bone matrix, in world space (relative to the skeleton root)\n * @returns the bone matrix, in world space\n * @deprecated Please use getAbsoluteMatrix instead\n */\n getAbsoluteTransform() {\n return this._absoluteMatrix;\n }\n /**\n * Links with the given transform node.\n * The local matrix of this bone is overwritten by the transform of the node every frame.\n * @param transformNode defines the transform node to link to\n */\n linkTransformNode(transformNode) {\n if (this._linkedTransformNode) {\n this._skeleton._numBonesWithLinkedTransformNode--;\n }\n this._linkedTransformNode = transformNode;\n if (this._linkedTransformNode) {\n this._skeleton._numBonesWithLinkedTransformNode++;\n }\n }\n // Properties (matches TransformNode properties)\n /**\n * Gets the node used to drive the bone's transformation\n * @returns a transform node or null\n */\n getTransformNode() {\n return this._linkedTransformNode;\n }\n /** Gets or sets current position (in local space) */\n get position() {\n this._decompose();\n return this._localPosition;\n }\n set position(newPosition) {\n this._decompose();\n this._localPosition.copyFrom(newPosition);\n this._markAsDirtyAndCompose();\n }\n /** Gets or sets current rotation (in local space) */\n get rotation() {\n return this.getRotation();\n }\n set rotation(newRotation) {\n this.setRotation(newRotation);\n }\n /** Gets or sets current rotation quaternion (in local space) */\n get rotationQuaternion() {\n this._decompose();\n return this._localRotation;\n }\n set rotationQuaternion(newRotation) {\n this.setRotationQuaternion(newRotation);\n }\n /** Gets or sets current scaling (in local space) */\n get scaling() {\n return this.getScale();\n }\n set scaling(newScaling) {\n this.setScale(newScaling);\n }\n /**\n * Gets the animation properties override\n */\n get animationPropertiesOverride() {\n return this._skeleton.animationPropertiesOverride;\n }\n // Methods\n _decompose() {\n if (!this._needToDecompose) {\n return;\n }\n this._needToDecompose = false;\n if (!this._localScaling) {\n this._localScaling = Vector3.Zero();\n this._localRotation = Quaternion.Zero();\n this._localPosition = Vector3.Zero();\n }\n this._localMatrix.decompose(this._localScaling, this._localRotation, this._localPosition);\n }\n _compose() {\n if (!this._needToCompose) {\n return;\n }\n if (!this._localScaling) {\n this._needToCompose = false;\n return;\n }\n this._needToCompose = false;\n Matrix.ComposeToRef(this._localScaling, this._localRotation, this._localPosition, this._localMatrix);\n }\n /**\n * Update the bind (and optionally the local) matrix\n * @param bindMatrix defines the new matrix to set to the bind/local matrix, in local space\n * @param updateAbsoluteBindMatrices defines if the absolute bind and absolute inverse bind matrices must be recomputed (default: true)\n * @param updateLocalMatrix defines if the local matrix should also be updated with the matrix passed in parameter (default: true)\n */\n updateMatrix(bindMatrix, updateAbsoluteBindMatrices = true, updateLocalMatrix = true) {\n this._bindMatrix.copyFrom(bindMatrix);\n if (updateAbsoluteBindMatrices) {\n this._updateAbsoluteBindMatrices();\n }\n if (updateLocalMatrix) {\n this._matrix = bindMatrix;\n }\n else {\n this.markAsDirty();\n }\n }\n /**\n * @internal\n */\n _updateAbsoluteBindMatrices(bindMatrix, updateChildren = true) {\n if (!bindMatrix) {\n bindMatrix = this._bindMatrix;\n }\n if (this.parent) {\n bindMatrix.multiplyToRef(this.parent._absoluteBindMatrix, this._absoluteBindMatrix);\n }\n else {\n this._absoluteBindMatrix.copyFrom(bindMatrix);\n }\n this._absoluteBindMatrix.invertToRef(this._absoluteInverseBindMatrix);\n if (updateChildren) {\n for (let index = 0; index < this.children.length; index++) {\n this.children[index]._updateAbsoluteBindMatrices();\n }\n }\n this._scalingDeterminant = this._absoluteBindMatrix.determinant() < 0 ? -1 : 1;\n }\n /**\n * Flag the bone as dirty (Forcing it to update everything)\n * @returns this bone\n */\n markAsDirty() {\n this._currentRenderId++;\n this._childUpdateId++;\n this._skeleton._markAsDirty();\n return this;\n }\n /** @internal */\n _markAsDirtyAndCompose() {\n this.markAsDirty();\n this._needToCompose = true;\n }\n _markAsDirtyAndDecompose() {\n this.markAsDirty();\n this._needToDecompose = true;\n }\n _updatePosition(vec, space = Space.LOCAL, tNode, translationMode = true) {\n const lm = this.getLocalMatrix();\n if (space == Space.LOCAL) {\n if (translationMode) {\n lm.addAtIndex(12, vec.x);\n lm.addAtIndex(13, vec.y);\n lm.addAtIndex(14, vec.z);\n }\n else {\n lm.setTranslationFromFloats(vec.x, vec.y, vec.z);\n }\n }\n else {\n let wm = null;\n //tNode.getWorldMatrix() needs to be called before skeleton.computeAbsoluteMatrices()\n if (tNode) {\n wm = tNode.getWorldMatrix();\n }\n this._skeleton.computeAbsoluteMatrices();\n const tmat = Bone._TmpMats[0];\n const tvec = Bone._TmpVecs[0];\n if (this.parent) {\n if (tNode && wm) {\n tmat.copyFrom(this.parent.getAbsoluteMatrix());\n tmat.multiplyToRef(wm, tmat);\n }\n else {\n tmat.copyFrom(this.parent.getAbsoluteMatrix());\n }\n }\n else {\n Matrix.IdentityToRef(tmat);\n }\n if (translationMode) {\n tmat.setTranslationFromFloats(0, 0, 0);\n }\n tmat.invert();\n Vector3.TransformCoordinatesToRef(vec, tmat, tvec);\n if (translationMode) {\n lm.addAtIndex(12, tvec.x);\n lm.addAtIndex(13, tvec.y);\n lm.addAtIndex(14, tvec.z);\n }\n else {\n lm.setTranslationFromFloats(tvec.x, tvec.y, tvec.z);\n }\n }\n this._markAsDirtyAndDecompose();\n }\n /**\n * Translate the bone in local or world space\n * @param vec The amount to translate the bone\n * @param space The space that the translation is in (default: Space.LOCAL)\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\n */\n translate(vec, space = Space.LOCAL, tNode) {\n this._updatePosition(vec, space, tNode, true);\n }\n /**\n * Set the position of the bone in local or world space\n * @param position The position to set the bone\n * @param space The space that the position is in (default: Space.LOCAL)\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\n */\n setPosition(position, space = Space.LOCAL, tNode) {\n this._updatePosition(position, space, tNode, false);\n }\n /**\n * Set the absolute position of the bone (world space)\n * @param position The position to set the bone\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\n */\n setAbsolutePosition(position, tNode) {\n this.setPosition(position, Space.WORLD, tNode);\n }\n /**\n * Scale the bone on the x, y and z axes (in local space)\n * @param x The amount to scale the bone on the x axis\n * @param y The amount to scale the bone on the y axis\n * @param z The amount to scale the bone on the z axis\n * @param scaleChildren sets this to true if children of the bone should be scaled as well (false by default)\n */\n scale(x, y, z, scaleChildren = false) {\n const locMat = this.getLocalMatrix();\n // Apply new scaling on top of current local matrix\n const scaleMat = Bone._TmpMats[0];\n Matrix.ScalingToRef(x, y, z, scaleMat);\n scaleMat.multiplyToRef(locMat, locMat);\n // Invert scaling matrix and apply the inverse to all children\n scaleMat.invert();\n for (const child of this.children) {\n const cm = child.getLocalMatrix();\n cm.multiplyToRef(scaleMat, cm);\n cm.multiplyAtIndex(12, x);\n cm.multiplyAtIndex(13, y);\n cm.multiplyAtIndex(14, z);\n child._markAsDirtyAndDecompose();\n }\n this._markAsDirtyAndDecompose();\n if (scaleChildren) {\n for (const child of this.children) {\n child.scale(x, y, z, scaleChildren);\n }\n }\n }\n /**\n * Set the bone scaling in local space\n * @param scale defines the scaling vector\n */\n setScale(scale) {\n this._decompose();\n this._localScaling.copyFrom(scale);\n this._markAsDirtyAndCompose();\n }\n /**\n * Gets the current scaling in local space\n * @returns the current scaling vector\n */\n getScale() {\n this._decompose();\n return this._localScaling;\n }\n /**\n * Gets the current scaling in local space and stores it in a target vector\n * @param result defines the target vector\n */\n getScaleToRef(result) {\n this._decompose();\n result.copyFrom(this._localScaling);\n }\n /**\n * Set the yaw, pitch, and roll of the bone in local or world space\n * @param yaw The rotation of the bone on the y axis\n * @param pitch The rotation of the bone on the x axis\n * @param roll The rotation of the bone on the z axis\n * @param space The space that the axes of rotation are in\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\n */\n setYawPitchRoll(yaw, pitch, roll, space = Space.LOCAL, tNode) {\n if (space === Space.LOCAL) {\n const quat = Bone._TmpQuat;\n Quaternion.RotationYawPitchRollToRef(yaw, pitch, roll, quat);\n this.setRotationQuaternion(quat, space, tNode);\n return;\n }\n const rotMatInv = Bone._TmpMats[0];\n if (!this._getAbsoluteInverseMatrixUnscaledToRef(rotMatInv, tNode)) {\n return;\n }\n const rotMat = Bone._TmpMats[1];\n Matrix.RotationYawPitchRollToRef(yaw, pitch, roll, rotMat);\n rotMatInv.multiplyToRef(rotMat, rotMat);\n this._rotateWithMatrix(rotMat, space, tNode);\n }\n /**\n * Add a rotation to the bone on an axis in local or world space\n * @param axis The axis to rotate the bone on\n * @param amount The amount to rotate the bone\n * @param space The space that the axis is in\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\n */\n rotate(axis, amount, space = Space.LOCAL, tNode) {\n const rmat = Bone._TmpMats[0];\n rmat.setTranslationFromFloats(0, 0, 0);\n Matrix.RotationAxisToRef(axis, amount, rmat);\n this._rotateWithMatrix(rmat, space, tNode);\n }\n /**\n * Set the rotation of the bone to a particular axis angle in local or world space\n * @param axis The axis to rotate the bone on\n * @param angle The angle that the bone should be rotated to\n * @param space The space that the axis is in\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\n */\n setAxisAngle(axis, angle, space = Space.LOCAL, tNode) {\n if (space === Space.LOCAL) {\n const quat = Bone._TmpQuat;\n Quaternion.RotationAxisToRef(axis, angle, quat);\n this.setRotationQuaternion(quat, space, tNode);\n return;\n }\n const rotMatInv = Bone._TmpMats[0];\n if (!this._getAbsoluteInverseMatrixUnscaledToRef(rotMatInv, tNode)) {\n return;\n }\n const rotMat = Bone._TmpMats[1];\n Matrix.RotationAxisToRef(axis, angle, rotMat);\n rotMatInv.multiplyToRef(rotMat, rotMat);\n this._rotateWithMatrix(rotMat, space, tNode);\n }\n /**\n * Set the euler rotation of the bone in local or world space\n * @param rotation The euler rotation that the bone should be set to\n * @param space The space that the rotation is in\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\n */\n setRotation(rotation, space = Space.LOCAL, tNode) {\n this.setYawPitchRoll(rotation.y, rotation.x, rotation.z, space, tNode);\n }\n /**\n * Set the quaternion rotation of the bone in local or world space\n * @param quat The quaternion rotation that the bone should be set to\n * @param space The space that the rotation is in\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\n */\n setRotationQuaternion(quat, space = Space.LOCAL, tNode) {\n if (space === Space.LOCAL) {\n this._decompose();\n this._localRotation.copyFrom(quat);\n this._markAsDirtyAndCompose();\n return;\n }\n const rotMatInv = Bone._TmpMats[0];\n if (!this._getAbsoluteInverseMatrixUnscaledToRef(rotMatInv, tNode)) {\n return;\n }\n const rotMat = Bone._TmpMats[1];\n Matrix.FromQuaternionToRef(quat, rotMat);\n rotMatInv.multiplyToRef(rotMat, rotMat);\n this._rotateWithMatrix(rotMat, space, tNode);\n }\n /**\n * Set the rotation matrix of the bone in local or world space\n * @param rotMat The rotation matrix that the bone should be set to\n * @param space The space that the rotation is in\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\n */\n setRotationMatrix(rotMat, space = Space.LOCAL, tNode) {\n if (space === Space.LOCAL) {\n const quat = Bone._TmpQuat;\n Quaternion.FromRotationMatrixToRef(rotMat, quat);\n this.setRotationQuaternion(quat, space, tNode);\n return;\n }\n const rotMatInv = Bone._TmpMats[0];\n if (!this._getAbsoluteInverseMatrixUnscaledToRef(rotMatInv, tNode)) {\n return;\n }\n const rotMat2 = Bone._TmpMats[1];\n rotMat2.copyFrom(rotMat);\n rotMatInv.multiplyToRef(rotMat, rotMat2);\n this._rotateWithMatrix(rotMat2, space, tNode);\n }\n _rotateWithMatrix(rmat, space = Space.LOCAL, tNode) {\n const lmat = this.getLocalMatrix();\n const lx = lmat.m[12];\n const ly = lmat.m[13];\n const lz = lmat.m[14];\n const parent = this.getParent();\n const parentScale = Bone._TmpMats[3];\n const parentScaleInv = Bone._TmpMats[4];\n if (parent && space == Space.WORLD) {\n if (tNode) {\n parentScale.copyFrom(tNode.getWorldMatrix());\n parent.getAbsoluteMatrix().multiplyToRef(parentScale, parentScale);\n }\n else {\n parentScale.copyFrom(parent.getAbsoluteMatrix());\n }\n parentScaleInv.copyFrom(parentScale);\n parentScaleInv.invert();\n lmat.multiplyToRef(parentScale, lmat);\n lmat.multiplyToRef(rmat, lmat);\n lmat.multiplyToRef(parentScaleInv, lmat);\n }\n else {\n if (space == Space.WORLD && tNode) {\n parentScale.copyFrom(tNode.getWorldMatrix());\n parentScaleInv.copyFrom(parentScale);\n parentScaleInv.invert();\n lmat.multiplyToRef(parentScale, lmat);\n lmat.multiplyToRef(rmat, lmat);\n lmat.multiplyToRef(parentScaleInv, lmat);\n }\n else {\n lmat.multiplyToRef(rmat, lmat);\n }\n }\n lmat.setTranslationFromFloats(lx, ly, lz);\n this.computeAbsoluteMatrices();\n this._markAsDirtyAndDecompose();\n }\n _getAbsoluteInverseMatrixUnscaledToRef(rotMatInv, tNode) {\n const scaleMatrix = Bone._TmpMats[2];\n rotMatInv.copyFrom(this.getAbsoluteMatrix());\n if (tNode) {\n rotMatInv.multiplyToRef(tNode.getWorldMatrix(), rotMatInv);\n Matrix.ScalingToRef(tNode.scaling.x, tNode.scaling.y, tNode.scaling.z, scaleMatrix);\n }\n else {\n Matrix.IdentityToRef(scaleMatrix);\n }\n rotMatInv.invert();\n if (isNaN(rotMatInv.m[0])) {\n // Matrix failed to invert.\n // This can happen if scale is zero for example.\n return false;\n }\n scaleMatrix.multiplyAtIndex(0, this._scalingDeterminant);\n rotMatInv.multiplyToRef(scaleMatrix, rotMatInv);\n return true;\n }\n /**\n * Get the position of the bone in local or world space\n * @param space The space that the returned position is in\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\n * @returns The position of the bone\n */\n getPosition(space = Space.LOCAL, tNode = null) {\n const pos = Vector3.Zero();\n this.getPositionToRef(space, tNode, pos);\n return pos;\n }\n /**\n * Copy the position of the bone to a vector3 in local or world space\n * @param space The space that the returned position is in\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\n * @param result The vector3 to copy the position to\n */\n getPositionToRef(space = Space.LOCAL, tNode, result) {\n if (space == Space.LOCAL) {\n const lm = this.getLocalMatrix();\n result.x = lm.m[12];\n result.y = lm.m[13];\n result.z = lm.m[14];\n }\n else {\n let wm = null;\n //tNode.getWorldMatrix() needs to be called before skeleton.computeAbsoluteMatrices()\n if (tNode) {\n wm = tNode.getWorldMatrix();\n }\n this._skeleton.computeAbsoluteMatrices();\n let tmat = Bone._TmpMats[0];\n if (tNode && wm) {\n tmat.copyFrom(this.getAbsoluteMatrix());\n tmat.multiplyToRef(wm, tmat);\n }\n else {\n tmat = this.getAbsoluteMatrix();\n }\n result.x = tmat.m[12];\n result.y = tmat.m[13];\n result.z = tmat.m[14];\n }\n }\n /**\n * Get the absolute position of the bone (world space)\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\n * @returns The absolute position of the bone\n */\n getAbsolutePosition(tNode = null) {\n const pos = Vector3.Zero();\n this.getPositionToRef(Space.WORLD, tNode, pos);\n return pos;\n }\n /**\n * Copy the absolute position of the bone (world space) to the result param\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\n * @param result The vector3 to copy the absolute position to\n */\n getAbsolutePositionToRef(tNode, result) {\n this.getPositionToRef(Space.WORLD, tNode, result);\n }\n /**\n * Compute the absolute matrices of this bone and its children\n */\n computeAbsoluteMatrices() {\n this._compose();\n if (this.parent) {\n this._localMatrix.multiplyToRef(this.parent._absoluteMatrix, this._absoluteMatrix);\n }\n else {\n this._absoluteMatrix.copyFrom(this._localMatrix);\n const poseMatrix = this._skeleton.getPoseMatrix();\n if (poseMatrix) {\n this._absoluteMatrix.multiplyToRef(poseMatrix, this._absoluteMatrix);\n }\n }\n const children = this.children;\n const len = children.length;\n for (let i = 0; i < len; i++) {\n children[i].computeAbsoluteMatrices();\n }\n }\n /**\n * Compute the absolute matrices of this bone and its children\n * @deprecated Please use computeAbsoluteMatrices instead\n */\n computeAbsoluteTransforms() {\n this.computeAbsoluteMatrices();\n }\n /**\n * Get the world direction from an axis that is in the local space of the bone\n * @param localAxis The local direction that is used to compute the world direction\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\n * @returns The world direction\n */\n getDirection(localAxis, tNode = null) {\n const result = Vector3.Zero();\n this.getDirectionToRef(localAxis, tNode, result);\n return result;\n }\n /**\n * Copy the world direction to a vector3 from an axis that is in the local space of the bone\n * @param localAxis The local direction that is used to compute the world direction\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\n * @param result The vector3 that the world direction will be copied to\n */\n getDirectionToRef(localAxis, tNode = null, result) {\n let wm = null;\n //tNode.getWorldMatrix() needs to be called before skeleton.computeAbsoluteMatrices()\n if (tNode) {\n wm = tNode.getWorldMatrix();\n }\n this._skeleton.computeAbsoluteMatrices();\n const mat = Bone._TmpMats[0];\n mat.copyFrom(this.getAbsoluteMatrix());\n if (tNode && wm) {\n mat.multiplyToRef(wm, mat);\n }\n Vector3.TransformNormalToRef(localAxis, mat, result);\n result.normalize();\n }\n /**\n * Get the euler rotation of the bone in local or world space\n * @param space The space that the rotation should be in\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\n * @returns The euler rotation\n */\n getRotation(space = Space.LOCAL, tNode = null) {\n const result = Vector3.Zero();\n this.getRotationToRef(space, tNode, result);\n return result;\n }\n /**\n * Copy the euler rotation of the bone to a vector3. The rotation can be in either local or world space\n * @param space The space that the rotation should be in\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\n * @param result The vector3 that the rotation should be copied to\n */\n getRotationToRef(space = Space.LOCAL, tNode = null, result) {\n const quat = Bone._TmpQuat;\n this.getRotationQuaternionToRef(space, tNode, quat);\n quat.toEulerAnglesToRef(result);\n }\n /**\n * Get the quaternion rotation of the bone in either local or world space\n * @param space The space that the rotation should be in\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\n * @returns The quaternion rotation\n */\n getRotationQuaternion(space = Space.LOCAL, tNode = null) {\n const result = Quaternion.Identity();\n this.getRotationQuaternionToRef(space, tNode, result);\n return result;\n }\n /**\n * Copy the quaternion rotation of the bone to a quaternion. The rotation can be in either local or world space\n * @param space The space that the rotation should be in\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\n * @param result The quaternion that the rotation should be copied to\n */\n getRotationQuaternionToRef(space = Space.LOCAL, tNode = null, result) {\n if (space == Space.LOCAL) {\n this._decompose();\n result.copyFrom(this._localRotation);\n }\n else {\n const mat = Bone._TmpMats[0];\n const amat = this.getAbsoluteMatrix();\n if (tNode) {\n amat.multiplyToRef(tNode.getWorldMatrix(), mat);\n }\n else {\n mat.copyFrom(amat);\n }\n mat.multiplyAtIndex(0, this._scalingDeterminant);\n mat.multiplyAtIndex(1, this._scalingDeterminant);\n mat.multiplyAtIndex(2, this._scalingDeterminant);\n mat.decompose(undefined, result, undefined);\n }\n }\n /**\n * Get the rotation matrix of the bone in local or world space\n * @param space The space that the rotation should be in\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\n * @returns The rotation matrix\n */\n getRotationMatrix(space = Space.LOCAL, tNode) {\n const result = Matrix.Identity();\n this.getRotationMatrixToRef(space, tNode, result);\n return result;\n }\n /**\n * Copy the rotation matrix of the bone to a matrix. The rotation can be in either local or world space\n * @param space The space that the rotation should be in\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\n * @param result The quaternion that the rotation should be copied to\n */\n getRotationMatrixToRef(space = Space.LOCAL, tNode, result) {\n if (space == Space.LOCAL) {\n this.getLocalMatrix().getRotationMatrixToRef(result);\n }\n else {\n const mat = Bone._TmpMats[0];\n const amat = this.getAbsoluteMatrix();\n if (tNode) {\n amat.multiplyToRef(tNode.getWorldMatrix(), mat);\n }\n else {\n mat.copyFrom(amat);\n }\n mat.multiplyAtIndex(0, this._scalingDeterminant);\n mat.multiplyAtIndex(1, this._scalingDeterminant);\n mat.multiplyAtIndex(2, this._scalingDeterminant);\n mat.getRotationMatrixToRef(result);\n }\n }\n /**\n * Get the world position of a point that is in the local space of the bone\n * @param position The local position\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\n * @returns The world position\n */\n getAbsolutePositionFromLocal(position, tNode = null) {\n const result = Vector3.Zero();\n this.getAbsolutePositionFromLocalToRef(position, tNode, result);\n return result;\n }\n /**\n * Get the world position of a point that is in the local space of the bone and copy it to the result param\n * @param position The local position\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\n * @param result The vector3 that the world position should be copied to\n */\n getAbsolutePositionFromLocalToRef(position, tNode = null, result) {\n let wm = null;\n //tNode.getWorldMatrix() needs to be called before skeleton.computeAbsoluteMatrices()\n if (tNode) {\n wm = tNode.getWorldMatrix();\n }\n this._skeleton.computeAbsoluteMatrices();\n const tmat = Bone._TmpMats[0];\n tmat.copyFrom(this.getAbsoluteMatrix());\n if (tNode && wm) {\n tmat.multiplyToRef(wm, tmat);\n }\n Vector3.TransformCoordinatesToRef(position, tmat, result);\n }\n /**\n * Get the local position of a point that is in world space\n * @param position The world position\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\n * @returns The local position\n */\n getLocalPositionFromAbsolute(position, tNode = null) {\n const result = Vector3.Zero();\n this.getLocalPositionFromAbsoluteToRef(position, tNode, result);\n return result;\n }\n /**\n * Get the local position of a point that is in world space and copy it to the result param\n * @param position The world position\n * @param tNode A TransformNode whose world matrix is to be applied to the calculated absolute matrix. In most cases, you'll want to pass the mesh associated with the skeleton from which this bone comes. Used only when space=Space.WORLD\n * @param result The vector3 that the local position should be copied to\n */\n getLocalPositionFromAbsoluteToRef(position, tNode = null, result) {\n let wm = null;\n //tNode.getWorldMatrix() needs to be called before skeleton.computeAbsoluteMatrices()\n if (tNode) {\n wm = tNode.getWorldMatrix();\n }\n this._skeleton.computeAbsoluteMatrices();\n const tmat = Bone._TmpMats[0];\n tmat.copyFrom(this.getAbsoluteMatrix());\n if (tNode && wm) {\n tmat.multiplyToRef(wm, tmat);\n }\n tmat.invert();\n Vector3.TransformCoordinatesToRef(position, tmat, result);\n }\n /**\n * Set the current local matrix as the restMatrix for this bone.\n */\n setCurrentPoseAsRest() {\n this.setRestMatrix(this.getLocalMatrix());\n }\n}\nBone._TmpVecs = ArrayTools.BuildArray(2, Vector3.Zero);\nBone._TmpQuat = Quaternion.Identity();\nBone._TmpMats = ArrayTools.BuildArray(5, Matrix.Identity);\n//# sourceMappingURL=bone.js.map","import { Animation } from \"./animation.js\";\nimport { RuntimeAnimation } from \"./runtimeAnimation.js\";\nimport { Observable } from \"../Misc/observable.js\";\nimport { Scene } from \"../scene.js\";\nimport { Matrix, Quaternion, Vector3, TmpVectors } from \"../Maths/math.vector.js\";\nimport { PrecisionDate } from \"../Misc/precisionDate.js\";\nimport { Bone } from \"../Bones/bone.js\";\n/**\n * Class used to store an actual running animation\n */\nexport class Animatable {\n /**\n * Gets the root Animatable used to synchronize and normalize animations\n */\n get syncRoot() {\n return this._syncRoot;\n }\n /**\n * Gets the current frame of the first RuntimeAnimation\n * Used to synchronize Animatables\n */\n get masterFrame() {\n if (this._runtimeAnimations.length === 0) {\n return 0;\n }\n return this._runtimeAnimations[0].currentFrame;\n }\n /**\n * Gets or sets the animatable weight (-1.0 by default meaning not weighted)\n */\n get weight() {\n return this._weight;\n }\n set weight(value) {\n if (value === -1) {\n // -1 is ok and means no weight\n this._weight = -1;\n return;\n }\n // Else weight must be in [0, 1] range\n this._weight = Math.min(Math.max(value, 0), 1.0);\n }\n /**\n * Gets or sets the speed ratio to apply to the animatable (1.0 by default)\n */\n get speedRatio() {\n return this._speedRatio;\n }\n set speedRatio(value) {\n for (let index = 0; index < this._runtimeAnimations.length; index++) {\n const animation = this._runtimeAnimations[index];\n animation._prepareForSpeedRatioChange(value);\n }\n this._speedRatio = value;\n // Resync _manualJumpDelay in case goToFrame was called before speedRatio was set.\n if (this._goToFrame !== null) {\n this.goToFrame(this._goToFrame);\n }\n }\n /**\n * Creates a new Animatable\n * @param scene defines the hosting scene\n * @param target defines the target object\n * @param fromFrame defines the starting frame number (default is 0)\n * @param toFrame defines the ending frame number (default is 100)\n * @param loopAnimation defines if the animation must loop (default is false)\n * @param speedRatio defines the factor to apply to animation speed (default is 1)\n * @param onAnimationEnd defines a callback to call when animation ends if it is not looping\n * @param animations defines a group of animation to add to the new Animatable\n * @param onAnimationLoop defines a callback to call when animation loops\n * @param isAdditive defines whether the animation should be evaluated additively\n * @param playOrder defines the order in which this animatable should be processed in the list of active animatables (default: 0)\n */\n constructor(scene, \n /** defines the target object */\n target, \n /** defines the starting frame number (default is 0) */\n fromFrame = 0, \n /** defines the ending frame number (default is 100) */\n toFrame = 100, \n /** defines if the animation must loop (default is false) */\n loopAnimation = false, speedRatio = 1.0, \n /** defines a callback to call when animation ends if it is not looping */\n onAnimationEnd, animations, \n /** defines a callback to call when animation loops */\n onAnimationLoop, \n /** defines whether the animation should be evaluated additively */\n isAdditive = false, \n /** defines the order in which this animatable should be processed in the list of active animatables (default: 0) */\n playOrder = 0) {\n this.target = target;\n this.fromFrame = fromFrame;\n this.toFrame = toFrame;\n this.loopAnimation = loopAnimation;\n this.onAnimationEnd = onAnimationEnd;\n this.onAnimationLoop = onAnimationLoop;\n this.isAdditive = isAdditive;\n this.playOrder = playOrder;\n this._localDelayOffset = null;\n this._pausedDelay = null;\n this._manualJumpDelay = null;\n /** @hidden */\n this._runtimeAnimations = new Array();\n this._paused = false;\n this._speedRatio = 1;\n this._weight = -1.0;\n this._syncRoot = null;\n this._frameToSyncFromJump = null;\n this._goToFrame = null;\n /**\n * Gets or sets a boolean indicating if the animatable must be disposed and removed at the end of the animation.\n * This will only apply for non looping animation (default is true)\n */\n this.disposeOnEnd = true;\n /**\n * Gets a boolean indicating if the animation has started\n */\n this.animationStarted = false;\n /**\n * Observer raised when the animation ends\n */\n this.onAnimationEndObservable = new Observable();\n /**\n * Observer raised when the animation loops\n */\n this.onAnimationLoopObservable = new Observable();\n this._scene = scene;\n if (animations) {\n this.appendAnimations(target, animations);\n }\n this._speedRatio = speedRatio;\n scene._activeAnimatables.push(this);\n }\n // Methods\n /**\n * Synchronize and normalize current Animatable with a source Animatable\n * This is useful when using animation weights and when animations are not of the same length\n * @param root defines the root Animatable to synchronize with (null to stop synchronizing)\n * @returns the current Animatable\n */\n syncWith(root) {\n this._syncRoot = root;\n if (root) {\n // Make sure this animatable will animate after the root\n const index = this._scene._activeAnimatables.indexOf(this);\n if (index > -1) {\n this._scene._activeAnimatables.splice(index, 1);\n this._scene._activeAnimatables.push(this);\n }\n }\n return this;\n }\n /**\n * Gets the list of runtime animations\n * @returns an array of RuntimeAnimation\n */\n getAnimations() {\n return this._runtimeAnimations;\n }\n /**\n * Adds more animations to the current animatable\n * @param target defines the target of the animations\n * @param animations defines the new animations to add\n */\n appendAnimations(target, animations) {\n for (let index = 0; index < animations.length; index++) {\n const animation = animations[index];\n const newRuntimeAnimation = new RuntimeAnimation(target, animation, this._scene, this);\n newRuntimeAnimation._onLoop = () => {\n this.onAnimationLoopObservable.notifyObservers(this);\n if (this.onAnimationLoop) {\n this.onAnimationLoop();\n }\n };\n this._runtimeAnimations.push(newRuntimeAnimation);\n }\n }\n /**\n * Gets the source animation for a specific property\n * @param property defines the property to look for\n * @returns null or the source animation for the given property\n */\n getAnimationByTargetProperty(property) {\n const runtimeAnimations = this._runtimeAnimations;\n for (let index = 0; index < runtimeAnimations.length; index++) {\n if (runtimeAnimations[index].animation.targetProperty === property) {\n return runtimeAnimations[index].animation;\n }\n }\n return null;\n }\n /**\n * Gets the runtime animation for a specific property\n * @param property defines the property to look for\n * @returns null or the runtime animation for the given property\n */\n getRuntimeAnimationByTargetProperty(property) {\n const runtimeAnimations = this._runtimeAnimations;\n for (let index = 0; index < runtimeAnimations.length; index++) {\n if (runtimeAnimations[index].animation.targetProperty === property) {\n return runtimeAnimations[index];\n }\n }\n return null;\n }\n /**\n * Resets the animatable to its original state\n */\n reset() {\n const runtimeAnimations = this._runtimeAnimations;\n for (let index = 0; index < runtimeAnimations.length; index++) {\n runtimeAnimations[index].reset(true);\n }\n this._localDelayOffset = null;\n this._pausedDelay = null;\n }\n /**\n * Allows the animatable to blend with current running animations\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#animation-blending\n * @param blendingSpeed defines the blending speed to use\n */\n enableBlending(blendingSpeed) {\n const runtimeAnimations = this._runtimeAnimations;\n for (let index = 0; index < runtimeAnimations.length; index++) {\n runtimeAnimations[index].animation.enableBlending = true;\n runtimeAnimations[index].animation.blendingSpeed = blendingSpeed;\n }\n }\n /**\n * Disable animation blending\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#animation-blending\n */\n disableBlending() {\n const runtimeAnimations = this._runtimeAnimations;\n for (let index = 0; index < runtimeAnimations.length; index++) {\n runtimeAnimations[index].animation.enableBlending = false;\n }\n }\n /**\n * Jump directly to a given frame\n * @param frame defines the frame to jump to\n */\n goToFrame(frame) {\n var _a;\n const runtimeAnimations = this._runtimeAnimations;\n if (runtimeAnimations[0]) {\n const fps = runtimeAnimations[0].animation.framePerSecond;\n this._frameToSyncFromJump = (_a = this._frameToSyncFromJump) !== null && _a !== void 0 ? _a : runtimeAnimations[0].currentFrame;\n const delay = this.speedRatio === 0 ? 0 : (((frame - this._frameToSyncFromJump) / fps) * 1000) / this.speedRatio;\n this._manualJumpDelay = -delay;\n }\n for (let index = 0; index < runtimeAnimations.length; index++) {\n runtimeAnimations[index].goToFrame(frame);\n }\n this._goToFrame = frame;\n }\n /**\n * Returns true if the animations for this animatable are paused\n */\n get paused() {\n return this._paused;\n }\n /**\n * Pause the animation\n */\n pause() {\n if (this._paused) {\n return;\n }\n this._paused = true;\n }\n /**\n * Restart the animation\n */\n restart() {\n this._paused = false;\n }\n _raiseOnAnimationEnd() {\n if (this.onAnimationEnd) {\n this.onAnimationEnd();\n }\n this.onAnimationEndObservable.notifyObservers(this);\n }\n /**\n * Stop and delete the current animation\n * @param animationName defines a string used to only stop some of the runtime animations instead of all\n * @param targetMask a function that determines if the animation should be stopped based on its target (all animations will be stopped if both this and animationName are empty)\n * @param useGlobalSplice if true, the animatables will be removed by the caller of this function (false by default)\n */\n stop(animationName, targetMask, useGlobalSplice = false) {\n if (animationName || targetMask) {\n const idx = this._scene._activeAnimatables.indexOf(this);\n if (idx > -1) {\n const runtimeAnimations = this._runtimeAnimations;\n for (let index = runtimeAnimations.length - 1; index >= 0; index--) {\n const runtimeAnimation = runtimeAnimations[index];\n if (animationName && runtimeAnimation.animation.name != animationName) {\n continue;\n }\n if (targetMask && !targetMask(runtimeAnimation.target)) {\n continue;\n }\n runtimeAnimation.dispose();\n runtimeAnimations.splice(index, 1);\n }\n if (runtimeAnimations.length == 0) {\n if (!useGlobalSplice) {\n this._scene._activeAnimatables.splice(idx, 1);\n }\n this._raiseOnAnimationEnd();\n }\n }\n }\n else {\n const index = this._scene._activeAnimatables.indexOf(this);\n if (index > -1) {\n if (!useGlobalSplice) {\n this._scene._activeAnimatables.splice(index, 1);\n }\n const runtimeAnimations = this._runtimeAnimations;\n for (let index = 0; index < runtimeAnimations.length; index++) {\n runtimeAnimations[index].dispose();\n }\n this._runtimeAnimations.length = 0;\n this._raiseOnAnimationEnd();\n }\n }\n }\n /**\n * Wait asynchronously for the animation to end\n * @returns a promise which will be fulfilled when the animation ends\n */\n waitAsync() {\n return new Promise((resolve) => {\n this.onAnimationEndObservable.add(() => {\n resolve(this);\n }, undefined, undefined, this, true);\n });\n }\n /**\n * @internal\n */\n _animate(delay) {\n if (this._paused) {\n this.animationStarted = false;\n if (this._pausedDelay === null) {\n this._pausedDelay = delay;\n }\n return true;\n }\n if (this._localDelayOffset === null) {\n this._localDelayOffset = delay;\n this._pausedDelay = null;\n }\n else if (this._pausedDelay !== null) {\n this._localDelayOffset += delay - this._pausedDelay;\n this._pausedDelay = null;\n }\n if (this._manualJumpDelay !== null) {\n this._localDelayOffset += this._manualJumpDelay;\n this._manualJumpDelay = null;\n this._frameToSyncFromJump = null;\n }\n this._goToFrame = null;\n if (this._weight === 0) {\n // We consider that an animatable with a weight === 0 is \"actively\" paused\n return true;\n }\n // Animating\n let running = false;\n const runtimeAnimations = this._runtimeAnimations;\n let index;\n for (index = 0; index < runtimeAnimations.length; index++) {\n const animation = runtimeAnimations[index];\n const isRunning = animation.animate(delay - this._localDelayOffset, this.fromFrame, this.toFrame, this.loopAnimation, this._speedRatio, this._weight);\n running = running || isRunning;\n }\n this.animationStarted = running;\n if (!running) {\n if (this.disposeOnEnd) {\n // Remove from active animatables\n index = this._scene._activeAnimatables.indexOf(this);\n this._scene._activeAnimatables.splice(index, 1);\n // Dispose all runtime animations\n for (index = 0; index < runtimeAnimations.length; index++) {\n runtimeAnimations[index].dispose();\n }\n }\n this._raiseOnAnimationEnd();\n if (this.disposeOnEnd) {\n this.onAnimationEnd = null;\n this.onAnimationLoop = null;\n this.onAnimationLoopObservable.clear();\n this.onAnimationEndObservable.clear();\n }\n }\n return running;\n }\n}\nScene.prototype._animate = function () {\n if (!this.animationsEnabled) {\n return;\n }\n // Getting time\n const now = PrecisionDate.Now;\n if (!this._animationTimeLast) {\n if (this._pendingData.length > 0) {\n return;\n }\n this._animationTimeLast = now;\n }\n this.deltaTime = this.useConstantAnimationDeltaTime ? 16.0 : (now - this._animationTimeLast) * this.animationTimeScale;\n this._animationTimeLast = now;\n const animatables = this._activeAnimatables;\n if (animatables.length === 0) {\n return;\n }\n this._animationTime += this.deltaTime;\n const animationTime = this._animationTime;\n for (let index = 0; index < animatables.length; index++) {\n const animatable = animatables[index];\n if (!animatable._animate(animationTime) && animatable.disposeOnEnd) {\n index--; // Array was updated\n }\n }\n // Late animation bindings\n this._processLateAnimationBindings();\n};\nScene.prototype.sortActiveAnimatables = function () {\n this._activeAnimatables.sort((a, b) => {\n return a.playOrder - b.playOrder;\n });\n};\nScene.prototype.beginWeightedAnimation = function (target, from, to, weight = 1.0, loop, speedRatio = 1.0, onAnimationEnd, animatable, targetMask, onAnimationLoop, isAdditive = false) {\n const returnedAnimatable = this.beginAnimation(target, from, to, loop, speedRatio, onAnimationEnd, animatable, false, targetMask, onAnimationLoop, isAdditive);\n returnedAnimatable.weight = weight;\n return returnedAnimatable;\n};\nScene.prototype.beginAnimation = function (target, from, to, loop, speedRatio = 1.0, onAnimationEnd, animatable, stopCurrent = true, targetMask, onAnimationLoop, isAdditive = false) {\n if (from > to && speedRatio > 0) {\n speedRatio *= -1;\n }\n if (stopCurrent) {\n this.stopAnimation(target, undefined, targetMask);\n }\n if (!animatable) {\n animatable = new Animatable(this, target, from, to, loop, speedRatio, onAnimationEnd, undefined, onAnimationLoop, isAdditive);\n }\n const shouldRunTargetAnimations = targetMask ? targetMask(target) : true;\n // Local animations\n if (target.animations && shouldRunTargetAnimations) {\n animatable.appendAnimations(target, target.animations);\n }\n // Children animations\n if (target.getAnimatables) {\n const animatables = target.getAnimatables();\n for (let index = 0; index < animatables.length; index++) {\n this.beginAnimation(animatables[index], from, to, loop, speedRatio, onAnimationEnd, animatable, stopCurrent, targetMask, onAnimationLoop);\n }\n }\n animatable.reset();\n return animatable;\n};\nScene.prototype.beginHierarchyAnimation = function (target, directDescendantsOnly, from, to, loop, speedRatio = 1.0, onAnimationEnd, animatable, stopCurrent = true, targetMask, onAnimationLoop, isAdditive = false) {\n const children = target.getDescendants(directDescendantsOnly);\n const result = [];\n result.push(this.beginAnimation(target, from, to, loop, speedRatio, onAnimationEnd, animatable, stopCurrent, targetMask, undefined, isAdditive));\n for (const child of children) {\n result.push(this.beginAnimation(child, from, to, loop, speedRatio, onAnimationEnd, animatable, stopCurrent, targetMask, undefined, isAdditive));\n }\n return result;\n};\nScene.prototype.beginDirectAnimation = function (target, animations, from, to, loop, speedRatio, onAnimationEnd, onAnimationLoop, isAdditive = false) {\n if (speedRatio === undefined) {\n speedRatio = 1.0;\n }\n if (from > to && speedRatio > 0) {\n speedRatio *= -1;\n }\n else if (to > from && speedRatio < 0) {\n const temp = to;\n to = from;\n from = temp;\n }\n const animatable = new Animatable(this, target, from, to, loop, speedRatio, onAnimationEnd, animations, onAnimationLoop, isAdditive);\n return animatable;\n};\nScene.prototype.beginDirectHierarchyAnimation = function (target, directDescendantsOnly, animations, from, to, loop, speedRatio, onAnimationEnd, onAnimationLoop, isAdditive = false) {\n const children = target.getDescendants(directDescendantsOnly);\n const result = [];\n result.push(this.beginDirectAnimation(target, animations, from, to, loop, speedRatio, onAnimationEnd, onAnimationLoop, isAdditive));\n for (const child of children) {\n result.push(this.beginDirectAnimation(child, animations, from, to, loop, speedRatio, onAnimationEnd, onAnimationLoop, isAdditive));\n }\n return result;\n};\nScene.prototype.getAnimatableByTarget = function (target) {\n for (let index = 0; index < this._activeAnimatables.length; index++) {\n if (this._activeAnimatables[index].target === target) {\n return this._activeAnimatables[index];\n }\n }\n return null;\n};\nScene.prototype.getAllAnimatablesByTarget = function (target) {\n const result = [];\n for (let index = 0; index < this._activeAnimatables.length; index++) {\n if (this._activeAnimatables[index].target === target) {\n result.push(this._activeAnimatables[index]);\n }\n }\n return result;\n};\n/**\n * Will stop the animation of the given target\n * @param target - the target\n * @param animationName - the name of the animation to stop (all animations will be stopped if both this and targetMask are empty)\n * @param targetMask - a function that determines if the animation should be stopped based on its target (all animations will be stopped if both this and animationName are empty)\n */\nScene.prototype.stopAnimation = function (target, animationName, targetMask) {\n const animatables = this.getAllAnimatablesByTarget(target);\n for (const animatable of animatables) {\n animatable.stop(animationName, targetMask);\n }\n};\n/**\n * Stops and removes all animations that have been applied to the scene\n */\nScene.prototype.stopAllAnimations = function () {\n if (this._activeAnimatables) {\n for (let i = 0; i < this._activeAnimatables.length; i++) {\n this._activeAnimatables[i].stop(undefined, undefined, true);\n }\n this._activeAnimatables.length = 0;\n }\n for (const group of this.animationGroups) {\n group.stop();\n }\n};\nScene.prototype._registerTargetForLateAnimationBinding = function (runtimeAnimation, originalValue) {\n const target = runtimeAnimation.target;\n this._registeredForLateAnimationBindings.pushNoDuplicate(target);\n if (!target._lateAnimationHolders) {\n target._lateAnimationHolders = {};\n }\n if (!target._lateAnimationHolders[runtimeAnimation.targetPath]) {\n target._lateAnimationHolders[runtimeAnimation.targetPath] = {\n totalWeight: 0,\n totalAdditiveWeight: 0,\n animations: [],\n additiveAnimations: [],\n originalValue: originalValue,\n };\n }\n if (runtimeAnimation.isAdditive) {\n target._lateAnimationHolders[runtimeAnimation.targetPath].additiveAnimations.push(runtimeAnimation);\n target._lateAnimationHolders[runtimeAnimation.targetPath].totalAdditiveWeight += runtimeAnimation.weight;\n }\n else {\n target._lateAnimationHolders[runtimeAnimation.targetPath].animations.push(runtimeAnimation);\n target._lateAnimationHolders[runtimeAnimation.targetPath].totalWeight += runtimeAnimation.weight;\n }\n};\nScene.prototype._processLateAnimationBindingsForMatrices = function (holder) {\n if (holder.totalWeight === 0 && holder.totalAdditiveWeight === 0) {\n return holder.originalValue;\n }\n let normalizer = 1.0;\n const finalPosition = TmpVectors.Vector3[0];\n const finalScaling = TmpVectors.Vector3[1];\n const finalQuaternion = TmpVectors.Quaternion[0];\n let startIndex = 0;\n const originalAnimation = holder.animations[0];\n const originalValue = holder.originalValue;\n let scale = 1;\n let skipOverride = false;\n if (holder.totalWeight < 1.0) {\n // We need to mix the original value in\n scale = 1.0 - holder.totalWeight;\n originalValue.decompose(finalScaling, finalQuaternion, finalPosition);\n }\n else {\n startIndex = 1;\n // We need to normalize the weights\n normalizer = holder.totalWeight;\n scale = originalAnimation.weight / normalizer;\n if (scale == 1) {\n if (holder.totalAdditiveWeight) {\n skipOverride = true;\n }\n else {\n return originalAnimation.currentValue;\n }\n }\n originalAnimation.currentValue.decompose(finalScaling, finalQuaternion, finalPosition);\n }\n // Add up the override animations\n if (!skipOverride) {\n finalScaling.scaleInPlace(scale);\n finalPosition.scaleInPlace(scale);\n finalQuaternion.scaleInPlace(scale);\n for (let animIndex = startIndex; animIndex < holder.animations.length; animIndex++) {\n const runtimeAnimation = holder.animations[animIndex];\n if (runtimeAnimation.weight === 0) {\n continue;\n }\n scale = runtimeAnimation.weight / normalizer;\n const currentPosition = TmpVectors.Vector3[2];\n const currentScaling = TmpVectors.Vector3[3];\n const currentQuaternion = TmpVectors.Quaternion[1];\n runtimeAnimation.currentValue.decompose(currentScaling, currentQuaternion, currentPosition);\n currentScaling.scaleAndAddToRef(scale, finalScaling);\n currentQuaternion.scaleAndAddToRef(Quaternion.Dot(finalQuaternion, currentQuaternion) > 0 ? scale : -scale, finalQuaternion);\n currentPosition.scaleAndAddToRef(scale, finalPosition);\n }\n finalQuaternion.normalize();\n }\n // Add up the additive animations\n for (let animIndex = 0; animIndex < holder.additiveAnimations.length; animIndex++) {\n const runtimeAnimation = holder.additiveAnimations[animIndex];\n if (runtimeAnimation.weight === 0) {\n continue;\n }\n const currentPosition = TmpVectors.Vector3[2];\n const currentScaling = TmpVectors.Vector3[3];\n const currentQuaternion = TmpVectors.Quaternion[1];\n runtimeAnimation.currentValue.decompose(currentScaling, currentQuaternion, currentPosition);\n currentScaling.multiplyToRef(finalScaling, currentScaling);\n Vector3.LerpToRef(finalScaling, currentScaling, runtimeAnimation.weight, finalScaling);\n finalQuaternion.multiplyToRef(currentQuaternion, currentQuaternion);\n Quaternion.SlerpToRef(finalQuaternion, currentQuaternion, runtimeAnimation.weight, finalQuaternion);\n currentPosition.scaleAndAddToRef(runtimeAnimation.weight, finalPosition);\n }\n const workValue = originalAnimation ? originalAnimation._animationState.workValue : TmpVectors.Matrix[0].clone();\n Matrix.ComposeToRef(finalScaling, finalQuaternion, finalPosition, workValue);\n return workValue;\n};\nScene.prototype._processLateAnimationBindingsForQuaternions = function (holder, refQuaternion) {\n if (holder.totalWeight === 0 && holder.totalAdditiveWeight === 0) {\n return refQuaternion;\n }\n const originalAnimation = holder.animations[0];\n const originalValue = holder.originalValue;\n let cumulativeQuaternion = refQuaternion;\n if (holder.totalWeight === 0 && holder.totalAdditiveWeight > 0) {\n cumulativeQuaternion.copyFrom(originalValue);\n }\n else if (holder.animations.length === 1) {\n Quaternion.SlerpToRef(originalValue, originalAnimation.currentValue, Math.min(1.0, holder.totalWeight), cumulativeQuaternion);\n if (holder.totalAdditiveWeight === 0) {\n return cumulativeQuaternion;\n }\n }\n else if (holder.animations.length > 1) {\n // Add up the override animations\n let normalizer = 1.0;\n let quaternions;\n let weights;\n if (holder.totalWeight < 1.0) {\n const scale = 1.0 - holder.totalWeight;\n quaternions = [];\n weights = [];\n quaternions.push(originalValue);\n weights.push(scale);\n }\n else {\n if (holder.animations.length === 2) {\n // Slerp as soon as we can\n Quaternion.SlerpToRef(holder.animations[0].currentValue, holder.animations[1].currentValue, holder.animations[1].weight / holder.totalWeight, refQuaternion);\n if (holder.totalAdditiveWeight === 0) {\n return refQuaternion;\n }\n }\n quaternions = [];\n weights = [];\n normalizer = holder.totalWeight;\n }\n for (let animIndex = 0; animIndex < holder.animations.length; animIndex++) {\n const runtimeAnimation = holder.animations[animIndex];\n quaternions.push(runtimeAnimation.currentValue);\n weights.push(runtimeAnimation.weight / normalizer);\n }\n // https://gamedev.stackexchange.com/questions/62354/method-for-interpolation-between-3-quaternions\n let cumulativeAmount = 0;\n for (let index = 0; index < quaternions.length;) {\n if (!index) {\n Quaternion.SlerpToRef(quaternions[index], quaternions[index + 1], weights[index + 1] / (weights[index] + weights[index + 1]), refQuaternion);\n cumulativeQuaternion = refQuaternion;\n cumulativeAmount = weights[index] + weights[index + 1];\n index += 2;\n continue;\n }\n cumulativeAmount += weights[index];\n Quaternion.SlerpToRef(cumulativeQuaternion, quaternions[index], weights[index] / cumulativeAmount, cumulativeQuaternion);\n index++;\n }\n }\n // Add up the additive animations\n for (let animIndex = 0; animIndex < holder.additiveAnimations.length; animIndex++) {\n const runtimeAnimation = holder.additiveAnimations[animIndex];\n if (runtimeAnimation.weight === 0) {\n continue;\n }\n cumulativeQuaternion.multiplyToRef(runtimeAnimation.currentValue, TmpVectors.Quaternion[0]);\n Quaternion.SlerpToRef(cumulativeQuaternion, TmpVectors.Quaternion[0], runtimeAnimation.weight, cumulativeQuaternion);\n }\n return cumulativeQuaternion;\n};\nScene.prototype._processLateAnimationBindings = function () {\n if (!this._registeredForLateAnimationBindings.length) {\n return;\n }\n for (let index = 0; index < this._registeredForLateAnimationBindings.length; index++) {\n const target = this._registeredForLateAnimationBindings.data[index];\n for (const path in target._lateAnimationHolders) {\n const holder = target._lateAnimationHolders[path];\n const originalAnimation = holder.animations[0];\n const originalValue = holder.originalValue;\n if (originalValue === undefined || originalValue === null) {\n continue;\n }\n const matrixDecomposeMode = Animation.AllowMatrixDecomposeForInterpolation && originalValue.m; // ie. data is matrix\n let finalValue = target[path];\n if (matrixDecomposeMode) {\n finalValue = this._processLateAnimationBindingsForMatrices(holder);\n }\n else {\n const quaternionMode = originalValue.w !== undefined;\n if (quaternionMode) {\n finalValue = this._processLateAnimationBindingsForQuaternions(holder, finalValue || Quaternion.Identity());\n }\n else {\n let startIndex = 0;\n let normalizer = 1.0;\n if (holder.totalWeight < 1.0) {\n // We need to mix the original value in\n if (originalAnimation && originalValue.scale) {\n finalValue = originalValue.scale(1.0 - holder.totalWeight);\n }\n else if (originalAnimation) {\n finalValue = originalValue * (1.0 - holder.totalWeight);\n }\n else if (originalValue.clone) {\n finalValue = originalValue.clone();\n }\n else {\n finalValue = originalValue;\n }\n }\n else if (originalAnimation) {\n // We need to normalize the weights\n normalizer = holder.totalWeight;\n const scale = originalAnimation.weight / normalizer;\n if (scale !== 1) {\n if (originalAnimation.currentValue.scale) {\n finalValue = originalAnimation.currentValue.scale(scale);\n }\n else {\n finalValue = originalAnimation.currentValue * scale;\n }\n }\n else {\n finalValue = originalAnimation.currentValue;\n }\n startIndex = 1;\n }\n // Add up the override animations\n for (let animIndex = startIndex; animIndex < holder.animations.length; animIndex++) {\n const runtimeAnimation = holder.animations[animIndex];\n const scale = runtimeAnimation.weight / normalizer;\n if (!scale) {\n continue;\n }\n else if (runtimeAnimation.currentValue.scaleAndAddToRef) {\n runtimeAnimation.currentValue.scaleAndAddToRef(scale, finalValue);\n }\n else {\n finalValue += runtimeAnimation.currentValue * scale;\n }\n }\n // Add up the additive animations\n for (let animIndex = 0; animIndex < holder.additiveAnimations.length; animIndex++) {\n const runtimeAnimation = holder.additiveAnimations[animIndex];\n const scale = runtimeAnimation.weight;\n if (!scale) {\n continue;\n }\n else if (runtimeAnimation.currentValue.scaleAndAddToRef) {\n runtimeAnimation.currentValue.scaleAndAddToRef(scale, finalValue);\n }\n else {\n finalValue += runtimeAnimation.currentValue * scale;\n }\n }\n }\n }\n target[path] = finalValue;\n }\n target._lateAnimationHolders = {};\n }\n this._registeredForLateAnimationBindings.reset();\n};\nBone.prototype.copyAnimationRange = function (source, rangeName, frameOffset, rescaleAsRequired = false, skelDimensionsRatio = null) {\n // all animation may be coming from a library skeleton, so may need to create animation\n if (this.animations.length === 0) {\n this.animations.push(new Animation(this.name, \"_matrix\", source.animations[0].framePerSecond, Animation.ANIMATIONTYPE_MATRIX, 0));\n this.animations[0].setKeys([]);\n }\n // get animation info / verify there is such a range from the source bone\n const sourceRange = source.animations[0].getRange(rangeName);\n if (!sourceRange) {\n return false;\n }\n const from = sourceRange.from;\n const to = sourceRange.to;\n const sourceKeys = source.animations[0].getKeys();\n // rescaling prep\n const sourceBoneLength = source.length;\n const sourceParent = source.getParent();\n const parent = this.getParent();\n const parentScalingReqd = rescaleAsRequired && sourceParent && sourceBoneLength && this.length && sourceBoneLength !== this.length;\n const parentRatio = parentScalingReqd && parent && sourceParent ? parent.length / sourceParent.length : 1;\n const dimensionsScalingReqd = rescaleAsRequired && !parent && skelDimensionsRatio && (skelDimensionsRatio.x !== 1 || skelDimensionsRatio.y !== 1 || skelDimensionsRatio.z !== 1);\n const destKeys = this.animations[0].getKeys();\n // loop vars declaration\n let orig;\n let origTranslation;\n let mat;\n for (let key = 0, nKeys = sourceKeys.length; key < nKeys; key++) {\n orig = sourceKeys[key];\n if (orig.frame >= from && orig.frame <= to) {\n if (rescaleAsRequired) {\n mat = orig.value.clone();\n // scale based on parent ratio, when bone has parent\n if (parentScalingReqd) {\n origTranslation = mat.getTranslation();\n mat.setTranslation(origTranslation.scaleInPlace(parentRatio));\n // scale based on skeleton dimension ratio when root bone, and value is passed\n }\n else if (dimensionsScalingReqd && skelDimensionsRatio) {\n origTranslation = mat.getTranslation();\n mat.setTranslation(origTranslation.multiplyInPlace(skelDimensionsRatio));\n // use original when root bone, and no data for skelDimensionsRatio\n }\n else {\n mat = orig.value;\n }\n }\n else {\n mat = orig.value;\n }\n destKeys.push({ frame: orig.frame + frameOffset, value: mat });\n }\n }\n this.animations[0].createRange(rangeName, from + frameOffset, to + frameOffset);\n return true;\n};\n//# sourceMappingURL=animatable.js.map","import { Scene } from \"../scene.js\";\nimport { SceneComponentConstants } from \"../sceneComponent.js\";\nimport { GeometryBufferRenderer } from \"./geometryBufferRenderer.js\";\n\nObject.defineProperty(Scene.prototype, \"geometryBufferRenderer\", {\n get: function () {\n return this._geometryBufferRenderer;\n },\n set: function (value) {\n if (value && value.isSupported) {\n this._geometryBufferRenderer = value;\n }\n },\n enumerable: true,\n configurable: true,\n});\nScene.prototype.enableGeometryBufferRenderer = function (ratio = 1, depthFormat = 15) {\n if (this._geometryBufferRenderer) {\n return this._geometryBufferRenderer;\n }\n this._geometryBufferRenderer = new GeometryBufferRenderer(this, ratio, depthFormat);\n if (!this._geometryBufferRenderer.isSupported) {\n this._geometryBufferRenderer = null;\n }\n return this._geometryBufferRenderer;\n};\nScene.prototype.disableGeometryBufferRenderer = function () {\n if (!this._geometryBufferRenderer) {\n return;\n }\n this._geometryBufferRenderer.dispose();\n this._geometryBufferRenderer = null;\n};\n/**\n * Defines the Geometry Buffer scene component responsible to manage a G-Buffer useful\n * in several rendering techniques.\n */\nexport class GeometryBufferRendererSceneComponent {\n /**\n * Creates a new instance of the component for the given scene\n * @param scene Defines the scene to register the component in\n */\n constructor(scene) {\n /**\n * The component name helpful to identify the component in the list of scene components.\n */\n this.name = SceneComponentConstants.NAME_GEOMETRYBUFFERRENDERER;\n this.scene = scene;\n }\n /**\n * Registers the component in a given scene\n */\n register() {\n this.scene._gatherRenderTargetsStage.registerStep(SceneComponentConstants.STEP_GATHERRENDERTARGETS_GEOMETRYBUFFERRENDERER, this, this._gatherRenderTargets);\n }\n /**\n * Rebuilds the elements related to this component in case of\n * context lost for instance.\n */\n rebuild() {\n // Nothing to do for this component\n }\n /**\n * Disposes the component and the associated resources\n */\n dispose() {\n // Nothing to do for this component\n }\n _gatherRenderTargets(renderTargets) {\n if (this.scene._geometryBufferRenderer) {\n renderTargets.push(this.scene._geometryBufferRenderer.getGBuffer());\n }\n }\n}\nGeometryBufferRenderer._SceneComponentInitialization = (scene) => {\n // Register the G Buffer component to the scene.\n let component = scene._getComponent(SceneComponentConstants.NAME_GEOMETRYBUFFERRENDERER);\n if (!component) {\n component = new GeometryBufferRendererSceneComponent(scene);\n scene._addComponent(component);\n }\n};\n//# sourceMappingURL=geometryBufferRendererSceneComponent.js.map","// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore.js\";\nconst name = \"motionBlurPixelShader\";\nconst shader = `varying vec2 vUV;uniform sampler2D textureSampler;uniform float motionStrength;uniform float motionScale;uniform vec2 screenSize;\n#ifdef OBJECT_BASED\nuniform sampler2D velocitySampler;\n#else\nuniform sampler2D depthSampler;uniform mat4 inverseViewProjection;uniform mat4 prevViewProjection;uniform mat4 projection;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{\n#ifdef GEOMETRY_SUPPORTED\n#ifdef OBJECT_BASED\nvec2 texelSize=1.0/screenSize;vec4 velocityColor=texture2D(velocitySampler,vUV);velocityColor.rg=velocityColor.rg*2.0-vec2(1.0);vec2 velocity=vec2(pow(velocityColor.r,3.0),pow(velocityColor.g,3.0))*velocityColor.a;velocity*=motionScale*motionStrength;float speed=length(velocity/texelSize);int samplesCount=int(clamp(speed,1.0,SAMPLES));velocity=normalize(velocity)*texelSize;float hlim=float(-samplesCount)*0.5+0.5;vec4 result=texture2D(textureSampler,vUV);for (int i=1; i=samplesCount)\nbreak;vec2 offset=vUV+velocity*(hlim+float(i));\n#if defined(WEBGPU)\nresult+=texture2DLodEXT(textureSampler,offset,0.0);\n#else\nresult+=texture2D(textureSampler,offset);\n#endif\n}\ngl_FragColor=result/float(samplesCount);gl_FragColor.a=1.0;\n#else\nvec2 texelSize=1.0/screenSize;float depth=texture2D(depthSampler,vUV).r;depth=projection[2].z+projection[3].z/depth; \nvec4 cpos=vec4(vUV*2.0-1.0,depth,1.0);cpos=inverseViewProjection*cpos;cpos/=cpos.w;vec4 ppos=prevViewProjection*cpos;ppos/=ppos.w;ppos.xy=ppos.xy*0.5+0.5;vec2 velocity=(ppos.xy-vUV)*motionScale*motionStrength;float speed=length(velocity/texelSize);int nSamples=int(clamp(speed,1.0,SAMPLES));vec4 result=texture2D(textureSampler,vUV);for (int i=1; i=nSamples)\nbreak;vec2 offset1=vUV+velocity*(float(i)/float(nSamples-1)-0.5);\n#if defined(WEBGPU)\nresult+=texture2DLodEXT(textureSampler,offset1,0.0);\n#else\nresult+=texture2D(textureSampler,offset1);\n#endif\n}\ngl_FragColor=result/float(nSamples);\n#endif\n#else\ngl_FragColor=texture2D(textureSampler,vUV);\n#endif\n}\n`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @internal */\nexport const motionBlurPixelShader = { name, shader };\n//# sourceMappingURL=motionBlur.fragment.js.map","import { __decorate } from \"../tslib.es6.js\";\nimport { Logger } from \"../Misc/logger.js\";\nimport { Matrix, TmpVectors, Vector2 } from \"../Maths/math.vector.js\";\nimport { PostProcess } from \"./postProcess.js\";\n\nimport { GeometryBufferRenderer } from \"../Rendering/geometryBufferRenderer.js\";\nimport { MotionBlurConfiguration } from \"../Rendering/motionBlurConfiguration.js\";\nimport \"../Animations/animatable.js\";\nimport \"../Rendering/geometryBufferRendererSceneComponent.js\";\nimport \"../Shaders/motionBlur.fragment.js\";\nimport { serialize, SerializationHelper } from \"../Misc/decorators.js\";\nimport { RegisterClass } from \"../Misc/typeStore.js\";\n/**\n * The Motion Blur Post Process which blurs an image based on the objects velocity in scene.\n * Velocity can be affected by each object's rotation, position and scale depending on the transformation speed.\n * As an example, all you have to do is to create the post-process:\n * var mb = new BABYLON.MotionBlurPostProcess(\n * 'mb', // The name of the effect.\n * scene, // The scene containing the objects to blur according to their velocity.\n * 1.0, // The required width/height ratio to downsize to before computing the render pass.\n * camera // The camera to apply the render pass to.\n * );\n * Then, all objects moving, rotating and/or scaling will be blurred depending on the transformation speed.\n */\nexport class MotionBlurPostProcess extends PostProcess {\n /**\n * Gets the number of iterations are used for motion blur quality. Default value is equal to 32\n */\n get motionBlurSamples() {\n return this._motionBlurSamples;\n }\n /**\n * Sets the number of iterations to be used for motion blur quality\n */\n set motionBlurSamples(samples) {\n this._motionBlurSamples = samples;\n this._updateEffect();\n }\n /**\n * Gets whether or not the motion blur post-process is in object based mode.\n */\n get isObjectBased() {\n return this._isObjectBased;\n }\n /**\n * Sets whether or not the motion blur post-process is in object based mode.\n */\n set isObjectBased(value) {\n if (this._isObjectBased === value) {\n return;\n }\n this._isObjectBased = value;\n this._applyMode();\n }\n get _geometryBufferRenderer() {\n if (!this._forceGeometryBuffer) {\n return null;\n }\n return this._scene.geometryBufferRenderer;\n }\n get _prePassRenderer() {\n if (this._forceGeometryBuffer) {\n return null;\n }\n return this._scene.prePassRenderer;\n }\n /**\n * Gets a string identifying the name of the class\n * @returns \"MotionBlurPostProcess\" string\n */\n getClassName() {\n return \"MotionBlurPostProcess\";\n }\n /**\n * Creates a new instance MotionBlurPostProcess\n * @param name The name of the effect.\n * @param scene The scene containing the objects to blur according to their velocity.\n * @param options The required width/height ratio to downsize to before computing the render pass.\n * @param camera The camera to apply the render pass to.\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\n * @param engine The engine which the post process will be applied. (default: current engine)\n * @param reusable If the post process can be reused on the same frame. (default: false)\n * @param textureType Type of textures used when performing the post process. (default: 0)\n * @param blockCompilation If compilation of the shader should not be done in the constructor. The updateEffect method can be used to compile the shader at a later time. (default: true)\n * @param forceGeometryBuffer If this post process should use geometry buffer instead of prepass (default: false)\n */\n constructor(name, scene, options, camera, samplingMode, engine, reusable, textureType = 0, blockCompilation = false, forceGeometryBuffer = false) {\n super(name, \"motionBlur\", [\"motionStrength\", \"motionScale\", \"screenSize\", \"inverseViewProjection\", \"prevViewProjection\", \"projection\"], [\"velocitySampler\", \"depthSampler\"], options, camera, samplingMode, engine, reusable, \"#define GEOMETRY_SUPPORTED\\n#define SAMPLES 64.0\\n#define OBJECT_BASED\", textureType, undefined, null, blockCompilation);\n /**\n * Defines how much the image is blurred by the movement. Default value is equal to 1\n */\n this.motionStrength = 1;\n this._motionBlurSamples = 32;\n this._isObjectBased = true;\n this._forceGeometryBuffer = false;\n this._invViewProjection = null;\n this._previousViewProjection = null;\n this._forceGeometryBuffer = forceGeometryBuffer;\n // Set up assets\n if (this._forceGeometryBuffer) {\n scene.enableGeometryBufferRenderer();\n if (this._geometryBufferRenderer) {\n this._geometryBufferRenderer.enableVelocity = true;\n }\n }\n else {\n scene.enablePrePassRenderer();\n if (this._prePassRenderer) {\n this._prePassRenderer.markAsDirty();\n this._prePassEffectConfiguration = new MotionBlurConfiguration();\n }\n }\n this._applyMode();\n }\n /**\n * Excludes the given skinned mesh from computing bones velocities.\n * Computing bones velocities can have a cost and that cost. The cost can be saved by calling this function and by passing the skinned mesh reference to ignore.\n * @param skinnedMesh The mesh containing the skeleton to ignore when computing the velocity map.\n */\n excludeSkinnedMesh(skinnedMesh) {\n if (skinnedMesh.skeleton) {\n let list;\n if (this._geometryBufferRenderer) {\n list = this._geometryBufferRenderer.excludedSkinnedMeshesFromVelocity;\n }\n else if (this._prePassRenderer) {\n list = this._prePassRenderer.excludedSkinnedMesh;\n }\n else {\n return;\n }\n list.push(skinnedMesh);\n }\n }\n /**\n * Removes the given skinned mesh from the excluded meshes to integrate bones velocities while rendering the velocity map.\n * @param skinnedMesh The mesh containing the skeleton that has been ignored previously.\n * @see excludeSkinnedMesh to exclude a skinned mesh from bones velocity computation.\n */\n removeExcludedSkinnedMesh(skinnedMesh) {\n if (skinnedMesh.skeleton) {\n let list;\n if (this._geometryBufferRenderer) {\n list = this._geometryBufferRenderer.excludedSkinnedMeshesFromVelocity;\n }\n else if (this._prePassRenderer) {\n list = this._prePassRenderer.excludedSkinnedMesh;\n }\n else {\n return;\n }\n const index = list.indexOf(skinnedMesh);\n if (index !== -1) {\n list.splice(index, 1);\n }\n }\n }\n /**\n * Disposes the post process.\n * @param camera The camera to dispose the post process on.\n */\n dispose(camera) {\n if (this._geometryBufferRenderer) {\n // Clear previous transformation matrices dictionary used to compute objects velocities\n this._geometryBufferRenderer._previousTransformationMatrices = {};\n this._geometryBufferRenderer._previousBonesTransformationMatrices = {};\n this._geometryBufferRenderer.excludedSkinnedMeshesFromVelocity = [];\n }\n super.dispose(camera);\n }\n /**\n * Called on the mode changed (object based or screen based).\n */\n _applyMode() {\n if (!this._geometryBufferRenderer && !this._prePassRenderer) {\n // We can't get a velocity or depth texture. So, work as a passthrough.\n Logger.Warn(\"Multiple Render Target support needed to compute object based motion blur\");\n return this.updateEffect();\n }\n this._updateEffect();\n this._invViewProjection = null;\n this._previousViewProjection = null;\n if (this.isObjectBased) {\n if (this._prePassRenderer && this._prePassEffectConfiguration) {\n this._prePassEffectConfiguration.texturesRequired[0] = 2;\n }\n this.onApply = (effect) => this._onApplyObjectBased(effect);\n }\n else {\n this._invViewProjection = Matrix.Identity();\n this._previousViewProjection = this._scene.getTransformMatrix().clone();\n if (this._prePassRenderer && this._prePassEffectConfiguration) {\n this._prePassEffectConfiguration.texturesRequired[0] = 5;\n }\n this.onApply = (effect) => this._onApplyScreenBased(effect);\n }\n }\n /**\n * Called on the effect is applied when the motion blur post-process is in object based mode.\n * @param effect\n */\n _onApplyObjectBased(effect) {\n effect.setVector2(\"screenSize\", new Vector2(this.width, this.height));\n effect.setFloat(\"motionScale\", this._scene.getAnimationRatio());\n effect.setFloat(\"motionStrength\", this.motionStrength);\n if (this._geometryBufferRenderer) {\n const velocityIndex = this._geometryBufferRenderer.getTextureIndex(GeometryBufferRenderer.VELOCITY_TEXTURE_TYPE);\n effect.setTexture(\"velocitySampler\", this._geometryBufferRenderer.getGBuffer().textures[velocityIndex]);\n }\n else if (this._prePassRenderer) {\n const velocityIndex = this._prePassRenderer.getIndex(2);\n effect.setTexture(\"velocitySampler\", this._prePassRenderer.getRenderTarget().textures[velocityIndex]);\n }\n }\n /**\n * Called on the effect is applied when the motion blur post-process is in screen based mode.\n * @param effect\n */\n _onApplyScreenBased(effect) {\n const viewProjection = TmpVectors.Matrix[0];\n viewProjection.copyFrom(this._scene.getTransformMatrix());\n viewProjection.invertToRef(this._invViewProjection);\n effect.setMatrix(\"inverseViewProjection\", this._invViewProjection);\n effect.setMatrix(\"prevViewProjection\", this._previousViewProjection);\n this._previousViewProjection.copyFrom(viewProjection);\n effect.setMatrix(\"projection\", this._scene.getProjectionMatrix());\n effect.setVector2(\"screenSize\", new Vector2(this.width, this.height));\n effect.setFloat(\"motionScale\", this._scene.getAnimationRatio());\n effect.setFloat(\"motionStrength\", this.motionStrength);\n if (this._geometryBufferRenderer) {\n const depthIndex = this._geometryBufferRenderer.getTextureIndex(GeometryBufferRenderer.DEPTH_TEXTURE_TYPE);\n effect.setTexture(\"depthSampler\", this._geometryBufferRenderer.getGBuffer().textures[depthIndex]);\n }\n else if (this._prePassRenderer) {\n const depthIndex = this._prePassRenderer.getIndex(5);\n effect.setTexture(\"depthSampler\", this._prePassRenderer.getRenderTarget().textures[depthIndex]);\n }\n }\n /**\n * Called on the effect must be updated (changed mode, samples count, etc.).\n */\n _updateEffect() {\n if (this._geometryBufferRenderer || this._prePassRenderer) {\n const defines = [\n \"#define GEOMETRY_SUPPORTED\",\n \"#define SAMPLES \" + this._motionBlurSamples.toFixed(1),\n this._isObjectBased ? \"#define OBJECT_BASED\" : \"#define SCREEN_BASED\",\n ];\n this.updateEffect(defines.join(\"\\n\"));\n }\n }\n /**\n * @internal\n */\n static _Parse(parsedPostProcess, targetCamera, scene, rootUrl) {\n return SerializationHelper.Parse(() => {\n return new MotionBlurPostProcess(parsedPostProcess.name, scene, parsedPostProcess.options, targetCamera, parsedPostProcess.renderTargetSamplingMode, scene.getEngine(), parsedPostProcess.reusable, parsedPostProcess.textureType, false);\n }, parsedPostProcess, scene, rootUrl);\n }\n}\n__decorate([\n serialize()\n], MotionBlurPostProcess.prototype, \"motionStrength\", void 0);\n__decorate([\n serialize()\n], MotionBlurPostProcess.prototype, \"motionBlurSamples\", null);\n__decorate([\n serialize()\n], MotionBlurPostProcess.prototype, \"isObjectBased\", null);\nRegisterClass(\"BABYLON.MotionBlurPostProcess\", MotionBlurPostProcess);\n//# sourceMappingURL=motionBlurPostProcess.js.map","\n/**\n * Contains all parameters needed for the prepass to perform\n * screen space reflections\n */\nexport class ScreenSpaceReflectionsConfiguration {\n constructor() {\n /**\n * Is ssr enabled\n */\n this.enabled = false;\n /**\n * Name of the configuration\n */\n this.name = \"screenSpaceReflections\";\n /**\n * Textures that should be present in the MRT for this effect to work\n */\n this.texturesRequired = [6, 3, 1];\n }\n}\n//# sourceMappingURL=screenSpaceReflectionsConfiguration.js.map","// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore.js\";\nconst name = \"screenSpaceReflectionPixelShader\";\nconst shader = `uniform sampler2D textureSampler;\n#ifdef SSR_SUPPORTED\nuniform sampler2D reflectivitySampler;uniform sampler2D normalSampler;uniform sampler2D positionSampler;\n#endif\nuniform mat4 view;uniform mat4 projection;uniform float stepSize;uniform float strength;uniform float threshold;uniform float roughnessFactor;uniform float reflectionSpecularFalloffExponent;varying vec2 vUV;\n#ifdef SSR_SUPPORTED\nstruct ReflectionInfo {vec3 color;vec4 coords;};/**\n* According to specular,see https:\n*/\nvec3 fresnelSchlick(float cosTheta,vec3 F0)\n{return F0+(1.0-F0)*pow(1.0-cosTheta,5.0);}\n/**\n* Once the pixel's coordinates has been found,let's adjust (smooth) a little bit\n* by sampling multiple reflection pixels.\n*/\nReflectionInfo smoothReflectionInfo(vec3 dir,vec3 hitCoord)\n{ReflectionInfo info;info.color=vec3(0.0);vec4 projectedCoord;float sampledDepth;for(int i=0; i0.0)\nhitCoord-=dir;else\nhitCoord+=dir;info.color+=texture2D(textureSampler,projectedCoord.xy).rgb;}\nprojectedCoord=projection*vec4(hitCoord,1.0);projectedCoord.xy/=projectedCoord.w;projectedCoord.xy=0.5*projectedCoord.xy+vec2(0.5);info.coords=vec4(projectedCoord.xy,sampledDepth,1.0);info.color+=texture2D(textureSampler,projectedCoord.xy).rgb;info.color/=float(SMOOTH_STEPS+1);return info;}\n/**\n* Tests the given world position (hitCoord) according to the given reflection vector (dir)\n* until it finds a collision (means that depth is enough close to say \"it's the pixel to sample!\").\n*/\nReflectionInfo getReflectionInfo(vec3 dir,vec3 hitCoord)\n{ReflectionInfo info;vec4 projectedCoord;float sampledDepth;dir*=stepSize;for(int i=0; i {\n const geometryBufferRenderer = this._geometryBufferRenderer;\n const prePassRenderer = this._prePassRenderer;\n if (!prePassRenderer && !geometryBufferRenderer) {\n return;\n }\n if (geometryBufferRenderer) {\n // Samplers\n const positionIndex = geometryBufferRenderer.getTextureIndex(GeometryBufferRenderer.POSITION_TEXTURE_TYPE);\n const roughnessIndex = geometryBufferRenderer.getTextureIndex(GeometryBufferRenderer.REFLECTIVITY_TEXTURE_TYPE);\n effect.setTexture(\"normalSampler\", geometryBufferRenderer.getGBuffer().textures[1]);\n effect.setTexture(\"positionSampler\", geometryBufferRenderer.getGBuffer().textures[positionIndex]);\n effect.setTexture(\"reflectivitySampler\", geometryBufferRenderer.getGBuffer().textures[roughnessIndex]);\n }\n else if (prePassRenderer) {\n // Samplers\n const positionIndex = prePassRenderer.getIndex(1);\n const roughnessIndex = prePassRenderer.getIndex(3);\n const normalIndex = prePassRenderer.getIndex(6);\n effect.setTexture(\"normalSampler\", prePassRenderer.getRenderTarget().textures[normalIndex]);\n effect.setTexture(\"positionSampler\", prePassRenderer.getRenderTarget().textures[positionIndex]);\n effect.setTexture(\"reflectivitySampler\", prePassRenderer.getRenderTarget().textures[roughnessIndex]);\n }\n // Uniforms\n const camera = scene.activeCamera;\n if (!camera) {\n return;\n }\n const viewMatrix = camera.getViewMatrix(true);\n const projectionMatrix = camera.getProjectionMatrix(true);\n effect.setMatrix(\"projection\", projectionMatrix);\n effect.setMatrix(\"view\", viewMatrix);\n effect.setFloat(\"threshold\", this.threshold);\n effect.setFloat(\"reflectionSpecularFalloffExponent\", this.reflectionSpecularFalloffExponent);\n effect.setFloat(\"strength\", this.strength);\n effect.setFloat(\"stepSize\", this.step);\n effect.setFloat(\"roughnessFactor\", this.roughnessFactor);\n };\n this._isSceneRightHanded = scene.useRightHandedSystem;\n }\n /**\n * Gets whether or not smoothing reflections is enabled.\n * Enabling smoothing will require more GPU power and can generate a drop in FPS.\n */\n get enableSmoothReflections() {\n return this._enableSmoothReflections;\n }\n /**\n * Sets whether or not smoothing reflections is enabled.\n * Enabling smoothing will require more GPU power and can generate a drop in FPS.\n */\n set enableSmoothReflections(enabled) {\n if (enabled === this._enableSmoothReflections) {\n return;\n }\n this._enableSmoothReflections = enabled;\n this._updateEffectDefines();\n }\n /**\n * Gets the number of samples taken while computing reflections. More samples count is high,\n * more the post-process wil require GPU power and can generate a drop in FPS. Basically in interval [25, 100].\n */\n get reflectionSamples() {\n return this._reflectionSamples;\n }\n /**\n * Sets the number of samples taken while computing reflections. More samples count is high,\n * more the post-process wil require GPU power and can generate a drop in FPS. Basically in interval [25, 100].\n */\n set reflectionSamples(samples) {\n if (samples === this._reflectionSamples) {\n return;\n }\n this._reflectionSamples = samples;\n this._updateEffectDefines();\n }\n /**\n * Gets the number of samples taken while smoothing reflections. More samples count is high,\n * more the post-process will require GPU power and can generate a drop in FPS.\n * Default value (5.0) work pretty well in all cases but can be adjusted.\n */\n get smoothSteps() {\n return this._smoothSteps;\n }\n /*\n * Sets the number of samples taken while smoothing reflections. More samples count is high,\n * more the post-process will require GPU power and can generate a drop in FPS.\n * Default value (5.0) work pretty well in all cases but can be adjusted.\n */\n set smoothSteps(steps) {\n if (steps === this._smoothSteps) {\n return;\n }\n this._smoothSteps = steps;\n this._updateEffectDefines();\n }\n _updateEffectDefines() {\n const defines = [];\n if (this._geometryBufferRenderer || this._prePassRenderer) {\n defines.push(\"#define SSR_SUPPORTED\");\n }\n if (this._enableSmoothReflections) {\n defines.push(\"#define ENABLE_SMOOTH_REFLECTIONS\");\n }\n if (this._isSceneRightHanded) {\n defines.push(\"#define RIGHT_HANDED_SCENE\");\n }\n defines.push(\"#define REFLECTION_SAMPLES \" + (this._reflectionSamples >> 0));\n defines.push(\"#define SMOOTH_STEPS \" + (this._smoothSteps >> 0));\n this.updateEffect(defines.join(\"\\n\"));\n }\n /**\n * @internal\n */\n static _Parse(parsedPostProcess, targetCamera, scene, rootUrl) {\n return SerializationHelper.Parse(() => {\n return new ScreenSpaceReflectionPostProcess(parsedPostProcess.name, scene, parsedPostProcess.options, targetCamera, parsedPostProcess.renderTargetSamplingMode, scene.getEngine(), parsedPostProcess.textureType, parsedPostProcess.reusable);\n }, parsedPostProcess, scene, rootUrl);\n }\n}\n__decorate([\n serialize()\n], ScreenSpaceReflectionPostProcess.prototype, \"threshold\", void 0);\n__decorate([\n serialize()\n], ScreenSpaceReflectionPostProcess.prototype, \"strength\", void 0);\n__decorate([\n serialize()\n], ScreenSpaceReflectionPostProcess.prototype, \"reflectionSpecularFalloffExponent\", void 0);\n__decorate([\n serialize()\n], ScreenSpaceReflectionPostProcess.prototype, \"step\", void 0);\n__decorate([\n serialize()\n], ScreenSpaceReflectionPostProcess.prototype, \"roughnessFactor\", void 0);\n__decorate([\n serialize()\n], ScreenSpaceReflectionPostProcess.prototype, \"enableSmoothReflections\", null);\n__decorate([\n serialize()\n], ScreenSpaceReflectionPostProcess.prototype, \"reflectionSamples\", null);\n__decorate([\n serialize()\n], ScreenSpaceReflectionPostProcess.prototype, \"smoothSteps\", null);\nRegisterClass(\"BABYLON.ScreenSpaceReflectionPostProcess\", ScreenSpaceReflectionPostProcess);\n//# sourceMappingURL=screenSpaceReflectionPostProcess.js.map","// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore.js\";\nimport \"./ShadersInclude/packingFunctions.js\";\nconst name = \"standardPixelShader\";\nconst shader = `uniform sampler2D textureSampler;varying vec2 vUV;\n#define CUSTOM_FRAGMENT_DEFINITIONS\n#if defined(PASS_POST_PROCESS)\nvoid main(void)\n{vec4 color=texture2D(textureSampler,vUV);gl_FragColor=color;}\n#endif\n#if defined(DOWN_SAMPLE_X4)\nuniform vec2 dsOffsets[16];void main(void)\n{vec4 average=vec4(0.0,0.0,0.0,0.0);average=texture2D(textureSampler,vUV+dsOffsets[0]);average+=texture2D(textureSampler,vUV+dsOffsets[1]);average+=texture2D(textureSampler,vUV+dsOffsets[2]);average+=texture2D(textureSampler,vUV+dsOffsets[3]);average+=texture2D(textureSampler,vUV+dsOffsets[4]);average+=texture2D(textureSampler,vUV+dsOffsets[5]);average+=texture2D(textureSampler,vUV+dsOffsets[6]);average+=texture2D(textureSampler,vUV+dsOffsets[7]);average+=texture2D(textureSampler,vUV+dsOffsets[8]);average+=texture2D(textureSampler,vUV+dsOffsets[9]);average+=texture2D(textureSampler,vUV+dsOffsets[10]);average+=texture2D(textureSampler,vUV+dsOffsets[11]);average+=texture2D(textureSampler,vUV+dsOffsets[12]);average+=texture2D(textureSampler,vUV+dsOffsets[13]);average+=texture2D(textureSampler,vUV+dsOffsets[14]);average+=texture2D(textureSampler,vUV+dsOffsets[15]);average/=16.0;gl_FragColor=average;}\n#endif\n#if defined(BRIGHT_PASS)\nuniform vec2 dsOffsets[4];uniform float brightThreshold;void main(void)\n{vec4 average=vec4(0.0,0.0,0.0,0.0);average=texture2D(textureSampler,vUV+vec2(dsOffsets[0].x,dsOffsets[0].y));average+=texture2D(textureSampler,vUV+vec2(dsOffsets[1].x,dsOffsets[1].y));average+=texture2D(textureSampler,vUV+vec2(dsOffsets[2].x,dsOffsets[2].y));average+=texture2D(textureSampler,vUV+vec2(dsOffsets[3].x,dsOffsets[3].y));average*=0.25;float luminance=length(average.rgb);if (luminanceshadowPixelDepth)\naccumFog+=sunColor*computeScattering(dot(rayDirection,sunDirection));currentPosition+=stepL;}\naccumFog/=NB_STEPS;vec3 color=accumFog*scatteringPower;gl_FragColor=vec4(color*exp(color) ,1.0);}\n#endif\n#if defined(VLSMERGE)\nuniform sampler2D originalSampler;void main(void)\n{gl_FragColor=texture2D(originalSampler,vUV)+texture2D(textureSampler,vUV);}\n#endif\n#if defined(LUMINANCE)\nuniform vec2 lumOffsets[4];void main()\n{float average=0.0;vec4 color=vec4(0.0);float maximum=-1e20;vec3 weight=vec3(0.299,0.587,0.114);for (int i=0; i<4; i++)\n{color=texture2D(textureSampler,vUV+ lumOffsets[i]);float GreyValue=dot(color.rgb,vec3(0.33,0.33,0.33));\n#ifdef WEIGHTED_AVERAGE\nfloat GreyValue=dot(color.rgb,weight);\n#endif\n#ifdef BRIGHTNESS\nfloat GreyValue=max(color.r,max(color.g,color.b));\n#endif\n#ifdef HSL_COMPONENT\nfloat GreyValue=0.5*(max(color.r,max(color.g,color.b))+min(color.r,min(color.g,color.b)));\n#endif\n#ifdef MAGNITUDE\nfloat GreyValue=length(color.rgb);\n#endif\nmaximum=max(maximum,GreyValue);average+=(0.25*log(1e-5+GreyValue));}\naverage=exp(average);gl_FragColor=vec4(average,maximum,0.0,1.0);}\n#endif\n#if defined(LUMINANCE_DOWN_SAMPLE)\nuniform vec2 dsOffsets[9];uniform float halfDestPixelSize;\n#ifdef FINAL_DOWN_SAMPLER\n#include\n#endif\nvoid main()\n{vec4 color=vec4(0.0);float average=0.0;for (int i=0; i<9; i++)\n{color=texture2D(textureSampler,vUV+vec2(halfDestPixelSize,halfDestPixelSize)+dsOffsets[i]);average+=color.r;}\naverage/=9.0;\n#ifdef FINAL_DOWN_SAMPLER\ngl_FragColor=pack(average);\n#else\ngl_FragColor=vec4(average,average,0.0,1.0);\n#endif\n}\n#endif\n#if defined(HDR)\nuniform sampler2D textureAdderSampler;uniform float averageLuminance;void main()\n{vec4 color=texture2D(textureAdderSampler,vUV);\n#ifndef AUTO_EXPOSURE\nvec4 adjustedColor=color/averageLuminance;color=adjustedColor;color.a=1.0;\n#endif\ngl_FragColor=color;}\n#endif\n#if defined(LENS_FLARE)\n#define GHOSTS 3\nuniform sampler2D lensColorSampler;uniform float strength;uniform float ghostDispersal;uniform float haloWidth;uniform vec2 resolution;uniform float distortionStrength;float hash(vec2 p)\n{float h=dot(p,vec2(127.1,311.7));return -1.0+2.0*fract(sin(h)*43758.5453123);}\nfloat noise(in vec2 p)\n{vec2 i=floor(p);vec2 f=fract(p);vec2 u=f*f*(3.0-2.0*f);return mix(mix(hash(i+vec2(0.0,0.0)),\nhash(i+vec2(1.0,0.0)),u.x),\nmix(hash(i+vec2(0.0,1.0)),\nhash(i+vec2(1.0,1.0)),u.x),u.y);}\nfloat fbm(vec2 p)\n{float f=0.0;f+=0.5000*noise(p); p*=2.02;f+=0.2500*noise(p); p*=2.03;f+=0.1250*noise(p); p*=2.01;f+=0.0625*noise(p); p*=2.04;f/=0.9375;return f;}\nvec3 pattern(vec2 uv)\n{vec2 p=-1.0+2.0*uv;float p2=dot(p,p);float f=fbm(vec2(15.0*p2))/2.0;float r=0.2+0.6*sin(12.5*length(uv-vec2(0.5)));float g=0.2+0.6*sin(20.5*length(uv-vec2(0.5)));float b=0.2+0.6*sin(17.2*length(uv-vec2(0.5)));return (1.0-f)*vec3(r,g,b);}\nfloat luminance(vec3 color)\n{return dot(color.rgb,vec3(0.2126,0.7152,0.0722));}\nvec4 textureDistorted(sampler2D tex,vec2 texcoord,vec2 direction,vec3 distortion)\n{return vec4(\ntexture2D(tex,texcoord+direction*distortion.r).r,\ntexture2D(tex,texcoord+direction*distortion.g).g,\ntexture2D(tex,texcoord+direction*distortion.b).b,\n1.0\n);}\nvoid main(void)\n{vec2 uv=-vUV+vec2(1.0);vec2 ghostDir=(vec2(0.5)-uv)*ghostDispersal;vec2 texelSize=1.0/resolution;vec3 distortion=vec3(-texelSize.x*distortionStrength,0.0,texelSize.x*distortionStrength);vec4 result=vec4(0.0);float ghostIndice=1.0;for (int i=0; i=nSamples)\nbreak;vec2 offset1=vUV+velocity*(float(i)/float(nSamples-1)-0.5);result+=texture2D(textureSampler,offset1);}\ngl_FragColor=result/float(nSamples);}\n#endif\n`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @internal */\nexport const standardPixelShader = { name, shader };\n//# sourceMappingURL=standard.fragment.js.map","import { __decorate } from \"../../../tslib.es6.js\";\nimport { serialize, serializeAsTexture, SerializationHelper } from \"../../../Misc/decorators.js\";\nimport { Logger } from \"../../../Misc/logger.js\";\nimport { Vector2, Vector3, Matrix, Vector4 } from \"../../../Maths/math.vector.js\";\nimport { Scalar } from \"../../../Maths/math.scalar.js\";\nimport { Texture } from \"../../../Materials/Textures/texture.js\";\nimport { PostProcess } from \"../../../PostProcesses/postProcess.js\";\nimport { PostProcessRenderPipeline } from \"../../../PostProcesses/RenderPipeline/postProcessRenderPipeline.js\";\nimport { PostProcessRenderEffect } from \"../../../PostProcesses/RenderPipeline/postProcessRenderEffect.js\";\nimport { BlurPostProcess } from \"../../../PostProcesses/blurPostProcess.js\";\nimport { FxaaPostProcess } from \"../../../PostProcesses/fxaaPostProcess.js\";\n\nimport { RegisterClass } from \"../../../Misc/typeStore.js\";\nimport { MotionBlurPostProcess } from \"../../motionBlurPostProcess.js\";\nimport { ScreenSpaceReflectionPostProcess } from \"../../screenSpaceReflectionPostProcess.js\";\nimport \"../../../PostProcesses/RenderPipeline/postProcessRenderPipelineManagerSceneComponent.js\";\nimport \"../../../Shaders/standard.fragment.js\";\n/**\n * Standard rendering pipeline\n * Default pipeline should be used going forward but the standard pipeline will be kept for backwards compatibility.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/postProcesses/standardRenderingPipeline\n */\nexport class StandardRenderingPipeline extends PostProcessRenderPipeline {\n /**\n * Gets the overall exposure used by the pipeline\n */\n get exposure() {\n return this._fixedExposure;\n }\n /**\n * Sets the overall exposure used by the pipeline\n */\n set exposure(value) {\n this._fixedExposure = value;\n this._currentExposure = value;\n }\n /**\n * Gets whether or not the exposure of the overall pipeline should be automatically adjusted by the HDR post-process\n */\n get hdrAutoExposure() {\n return this._hdrAutoExposure;\n }\n /**\n * Sets whether or not the exposure of the overall pipeline should be automatically adjusted by the HDR post-process\n */\n set hdrAutoExposure(value) {\n this._hdrAutoExposure = value;\n if (this.hdrPostProcess) {\n const defines = [\"#define HDR\"];\n if (value) {\n defines.push(\"#define AUTO_EXPOSURE\");\n }\n this.hdrPostProcess.updateEffect(defines.join(\"\\n\"));\n }\n }\n /**\n * Gets how much the image is blurred by the movement while using the motion blur post-process\n */\n get motionStrength() {\n return this._motionStrength;\n }\n /**\n * Sets how much the image is blurred by the movement while using the motion blur post-process\n */\n set motionStrength(strength) {\n this._motionStrength = strength;\n if (this._isObjectBasedMotionBlur && this.motionBlurPostProcess) {\n this.motionBlurPostProcess.motionStrength = strength;\n }\n }\n /**\n * Gets whether or not the motion blur post-process is object based or screen based.\n */\n get objectBasedMotionBlur() {\n return this._isObjectBasedMotionBlur;\n }\n /**\n * Sets whether or not the motion blur post-process should be object based or screen based\n */\n set objectBasedMotionBlur(value) {\n const shouldRebuild = this._isObjectBasedMotionBlur !== value;\n this._isObjectBasedMotionBlur = value;\n if (shouldRebuild) {\n this._buildPipeline();\n }\n }\n /**\n * @ignore\n * Specifies if the bloom pipeline is enabled\n */\n get BloomEnabled() {\n return this._bloomEnabled;\n }\n set BloomEnabled(enabled) {\n if (this._bloomEnabled === enabled) {\n return;\n }\n this._bloomEnabled = enabled;\n this._buildPipeline();\n }\n /**\n * @ignore\n * Specifies if the depth of field pipeline is enabled\n */\n get DepthOfFieldEnabled() {\n return this._depthOfFieldEnabled;\n }\n set DepthOfFieldEnabled(enabled) {\n if (this._depthOfFieldEnabled === enabled) {\n return;\n }\n this._depthOfFieldEnabled = enabled;\n this._buildPipeline();\n }\n /**\n * @ignore\n * Specifies if the lens flare pipeline is enabled\n */\n get LensFlareEnabled() {\n return this._lensFlareEnabled;\n }\n set LensFlareEnabled(enabled) {\n if (this._lensFlareEnabled === enabled) {\n return;\n }\n this._lensFlareEnabled = enabled;\n this._buildPipeline();\n }\n /**\n * @ignore\n * Specifies if the HDR pipeline is enabled\n */\n get HDREnabled() {\n return this._hdrEnabled;\n }\n set HDREnabled(enabled) {\n if (this._hdrEnabled === enabled) {\n return;\n }\n this._hdrEnabled = enabled;\n this._buildPipeline();\n }\n /**\n * @ignore\n * Specifies if the volumetric lights scattering effect is enabled\n */\n get VLSEnabled() {\n return this._vlsEnabled;\n }\n // eslint-disable-next-line @typescript-eslint/naming-convention\n set VLSEnabled(enabled) {\n if (this._vlsEnabled === enabled) {\n return;\n }\n if (enabled) {\n const geometry = this._scene.enableGeometryBufferRenderer();\n if (!geometry) {\n Logger.Warn(\"Geometry renderer is not supported, cannot create volumetric lights in Standard Rendering Pipeline\");\n return;\n }\n }\n this._vlsEnabled = enabled;\n this._buildPipeline();\n }\n /**\n * @ignore\n * Specifies if the motion blur effect is enabled\n */\n get MotionBlurEnabled() {\n return this._motionBlurEnabled;\n }\n set MotionBlurEnabled(enabled) {\n if (this._motionBlurEnabled === enabled) {\n return;\n }\n this._motionBlurEnabled = enabled;\n this._buildPipeline();\n }\n /**\n * Specifies if anti-aliasing is enabled\n */\n get fxaaEnabled() {\n return this._fxaaEnabled;\n }\n set fxaaEnabled(enabled) {\n if (this._fxaaEnabled === enabled) {\n return;\n }\n this._fxaaEnabled = enabled;\n this._buildPipeline();\n }\n /**\n * Specifies if screen space reflections are enabled.\n */\n get screenSpaceReflectionsEnabled() {\n return this._screenSpaceReflectionsEnabled;\n }\n set screenSpaceReflectionsEnabled(enabled) {\n if (this._screenSpaceReflectionsEnabled === enabled) {\n return;\n }\n this._screenSpaceReflectionsEnabled = enabled;\n this._buildPipeline();\n }\n /**\n * Specifies the number of steps used to calculate the volumetric lights\n * Typically in interval [50, 200]\n */\n get volumetricLightStepsCount() {\n return this._volumetricLightStepsCount;\n }\n set volumetricLightStepsCount(count) {\n if (this.volumetricLightPostProcess) {\n this.volumetricLightPostProcess.updateEffect(\"#define VLS\\n#define NB_STEPS \" + count.toFixed(1));\n }\n this._volumetricLightStepsCount = count;\n }\n /**\n * Specifies the number of samples used for the motion blur effect\n * Typically in interval [16, 64]\n */\n get motionBlurSamples() {\n return this._motionBlurSamples;\n }\n set motionBlurSamples(samples) {\n if (this.motionBlurPostProcess) {\n if (this._isObjectBasedMotionBlur) {\n this.motionBlurPostProcess.motionBlurSamples = samples;\n }\n else {\n this.motionBlurPostProcess.updateEffect(\"#define MOTION_BLUR\\n#define MAX_MOTION_SAMPLES \" + samples.toFixed(1));\n }\n }\n this._motionBlurSamples = samples;\n }\n /**\n * Specifies MSAA sample count, setting this to 4 will provide 4x anti aliasing. (default: 1)\n */\n get samples() {\n return this._samples;\n }\n set samples(sampleCount) {\n if (this._samples === sampleCount) {\n return;\n }\n this._samples = sampleCount;\n this._buildPipeline();\n }\n /**\n * Default pipeline should be used going forward but the standard pipeline will be kept for backwards compatibility.\n * @constructor\n * @param name The rendering pipeline name\n * @param scene The scene linked to this pipeline\n * @param ratio The size of the postprocesses (0.5 means that your postprocess will have a width = canvas.width 0.5 and a height = canvas.height 0.5)\n * @param originalPostProcess the custom original color post-process. Must be \"reusable\". Can be null.\n * @param cameras The array of cameras that the rendering pipeline will be attached to\n */\n constructor(name, scene, ratio, originalPostProcess = null, cameras) {\n super(scene.getEngine(), name);\n /**\n * Post-process used to down scale an image x4\n */\n this.downSampleX4PostProcess = null;\n /**\n * Post-process used to calculate the illuminated surfaces controlled by a threshold\n */\n this.brightPassPostProcess = null;\n /**\n * Post-process array storing all the horizontal blur post-processes used by the pipeline\n */\n this.blurHPostProcesses = [];\n /**\n * Post-process array storing all the vertical blur post-processes used by the pipeline\n */\n this.blurVPostProcesses = [];\n /**\n * Post-process used to add colors of 2 textures (typically brightness + real scene color)\n */\n this.textureAdderPostProcess = null;\n /**\n * Post-process used to create volumetric lighting effect\n */\n this.volumetricLightPostProcess = null;\n /**\n * Post-process used to smooth the previous volumetric light post-process on the X axis\n */\n this.volumetricLightSmoothXPostProcess = null;\n /**\n * Post-process used to smooth the previous volumetric light post-process on the Y axis\n */\n this.volumetricLightSmoothYPostProcess = null;\n /**\n * Post-process used to merge the volumetric light effect and the real scene color\n */\n this.volumetricLightMergePostProces = null;\n /**\n * Post-process used to store the final volumetric light post-process (attach/detach for debug purpose)\n */\n this.volumetricLightFinalPostProcess = null;\n /**\n * Base post-process used to calculate the average luminance of the final image for HDR\n */\n this.luminancePostProcess = null;\n /**\n * Post-processes used to create down sample post-processes in order to get\n * the average luminance of the final image for HDR\n * Array of length \"StandardRenderingPipeline.LuminanceSteps\"\n */\n this.luminanceDownSamplePostProcesses = [];\n /**\n * Post-process used to create a HDR effect (light adaptation)\n */\n this.hdrPostProcess = null;\n /**\n * Post-process used to store the final texture adder post-process (attach/detach for debug purpose)\n */\n this.textureAdderFinalPostProcess = null;\n /**\n * Post-process used to store the final lens flare post-process (attach/detach for debug purpose)\n */\n this.lensFlareFinalPostProcess = null;\n /**\n * Post-process used to merge the final HDR post-process and the real scene color\n */\n this.hdrFinalPostProcess = null;\n /**\n * Post-process used to create a lens flare effect\n */\n this.lensFlarePostProcess = null;\n /**\n * Post-process that merges the result of the lens flare post-process and the real scene color\n */\n this.lensFlareComposePostProcess = null;\n /**\n * Post-process used to create a motion blur effect\n */\n this.motionBlurPostProcess = null;\n /**\n * Post-process used to create a depth of field effect\n */\n this.depthOfFieldPostProcess = null;\n /**\n * The Fast Approximate Anti-Aliasing post process which attempts to remove aliasing from an image.\n */\n this.fxaaPostProcess = null;\n /**\n * Post-process used to simulate realtime reflections using the screen space and geometry renderer.\n */\n this.screenSpaceReflectionPostProcess = null;\n // Values\n /**\n * Represents the brightness threshold in order to configure the illuminated surfaces\n */\n this.brightThreshold = 1.0;\n /**\n * Configures the blur intensity used for surexposed surfaces are highlighted surfaces (light halo)\n */\n this.blurWidth = 512.0;\n /**\n * Sets if the blur for highlighted surfaces must be only horizontal\n */\n this.horizontalBlur = false;\n /**\n * Texture used typically to simulate \"dirty\" on camera lens\n */\n this.lensTexture = null;\n /**\n * Represents the offset coefficient based on Rayleigh principle. Typically in interval [-0.2, 0.2]\n */\n this.volumetricLightCoefficient = 0.2;\n /**\n * The overall power of volumetric lights, typically in interval [0, 10] maximum\n */\n this.volumetricLightPower = 4.0;\n /**\n * Used the set the blur intensity to smooth the volumetric lights\n */\n this.volumetricLightBlurScale = 64.0;\n /**\n * Light (spot or directional) used to generate the volumetric lights rays\n * The source light must have a shadow generate so the pipeline can get its\n * depth map\n */\n this.sourceLight = null;\n /**\n * For eye adaptation, represents the minimum luminance the eye can see\n */\n this.hdrMinimumLuminance = 1.0;\n /**\n * For eye adaptation, represents the decrease luminance speed\n */\n this.hdrDecreaseRate = 0.5;\n /**\n * For eye adaptation, represents the increase luminance speed\n */\n this.hdrIncreaseRate = 0.5;\n /**\n * Lens color texture used by the lens flare effect. Mandatory if lens flare effect enabled\n */\n this.lensColorTexture = null;\n /**\n * The overall strength for the lens flare effect\n */\n this.lensFlareStrength = 20.0;\n /**\n * Dispersion coefficient for lens flare ghosts\n */\n this.lensFlareGhostDispersal = 1.4;\n /**\n * Main lens flare halo width\n */\n this.lensFlareHaloWidth = 0.7;\n /**\n * Based on the lens distortion effect, defines how much the lens flare result\n * is distorted\n */\n this.lensFlareDistortionStrength = 16.0;\n /**\n * Configures the blur intensity used for for lens flare (halo)\n */\n this.lensFlareBlurWidth = 512.0;\n /**\n * Lens star texture must be used to simulate rays on the flares and is available\n * in the documentation\n */\n this.lensStarTexture = null;\n /**\n * As the \"lensTexture\" (can be the same texture or different), it is used to apply the lens\n * flare effect by taking account of the dirt texture\n */\n this.lensFlareDirtTexture = null;\n /**\n * Represents the focal length for the depth of field effect\n */\n this.depthOfFieldDistance = 10.0;\n /**\n * Represents the blur intensity for the blurred part of the depth of field effect\n */\n this.depthOfFieldBlurWidth = 64.0;\n /**\n * List of animations for the pipeline (IAnimatable implementation)\n */\n this.animations = [];\n this._currentDepthOfFieldSource = null;\n this._fixedExposure = 1.0;\n this._currentExposure = 1.0;\n this._hdrAutoExposure = false;\n this._hdrCurrentLuminance = 1.0;\n this._motionStrength = 1.0;\n this._isObjectBasedMotionBlur = false;\n this._camerasToBeAttached = [];\n // Getters and setters\n this._bloomEnabled = false;\n this._depthOfFieldEnabled = false;\n this._vlsEnabled = false;\n this._lensFlareEnabled = false;\n this._hdrEnabled = false;\n this._motionBlurEnabled = false;\n this._fxaaEnabled = false;\n this._screenSpaceReflectionsEnabled = false;\n this._motionBlurSamples = 64.0;\n this._volumetricLightStepsCount = 50.0;\n this._samples = 1;\n this._cameras = cameras || scene.cameras;\n this._cameras = this._cameras.slice();\n this._camerasToBeAttached = this._cameras.slice();\n // Initialize\n this._scene = scene;\n this._basePostProcess = originalPostProcess;\n this._ratio = ratio;\n // Misc\n this._floatTextureType = scene.getEngine().getCaps().textureFloatRender ? 1 : 2;\n // Finish\n scene.postProcessRenderPipelineManager.addPipeline(this);\n this._buildPipeline();\n }\n _buildPipeline() {\n const ratio = this._ratio;\n const scene = this._scene;\n this._disposePostProcesses();\n if (this._cameras !== null) {\n this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name, this._cameras);\n // get back cameras to be used to reattach pipeline\n this._cameras = this._camerasToBeAttached.slice();\n }\n this._reset();\n // Create pass post-process\n if (this._screenSpaceReflectionsEnabled) {\n this.screenSpaceReflectionPostProcess = new ScreenSpaceReflectionPostProcess(\"HDRPass\", scene, ratio, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, this._floatTextureType);\n this.screenSpaceReflectionPostProcess.onApplyObservable.add(() => {\n this._currentDepthOfFieldSource = this.screenSpaceReflectionPostProcess;\n });\n this.addEffect(new PostProcessRenderEffect(scene.getEngine(), \"HDRScreenSpaceReflections\", () => this.screenSpaceReflectionPostProcess, true));\n }\n if (!this._basePostProcess) {\n this.originalPostProcess = new PostProcess(\"HDRPass\", \"standard\", [], [], ratio, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, \"#define PASS_POST_PROCESS\", this._floatTextureType);\n }\n else {\n this.originalPostProcess = this._basePostProcess;\n }\n this.originalPostProcess.autoClear = !this.screenSpaceReflectionPostProcess;\n this.originalPostProcess.onApplyObservable.add(() => {\n this._currentDepthOfFieldSource = this.originalPostProcess;\n });\n this.addEffect(new PostProcessRenderEffect(scene.getEngine(), \"HDRPassPostProcess\", () => this.originalPostProcess, true));\n if (this._bloomEnabled) {\n // Create down sample X4 post-process\n this._createDownSampleX4PostProcess(scene, ratio / 4);\n // Create bright pass post-process\n this._createBrightPassPostProcess(scene, ratio / 4);\n // Create gaussian blur post-processes (down sampling blurs)\n this._createBlurPostProcesses(scene, ratio / 4, 1);\n // Create texture adder post-process\n this._createTextureAdderPostProcess(scene, ratio);\n // Create depth-of-field source post-process\n this.textureAdderFinalPostProcess = new PostProcess(\"HDRDepthOfFieldSource\", \"standard\", [], [], ratio, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, \"#define PASS_POST_PROCESS\", 0);\n this.addEffect(new PostProcessRenderEffect(scene.getEngine(), \"HDRBaseDepthOfFieldSource\", () => {\n return this.textureAdderFinalPostProcess;\n }, true));\n }\n if (this._vlsEnabled) {\n // Create volumetric light\n this._createVolumetricLightPostProcess(scene, ratio);\n // Create volumetric light final post-process\n this.volumetricLightFinalPostProcess = new PostProcess(\"HDRVLSFinal\", \"standard\", [], [], ratio, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, \"#define PASS_POST_PROCESS\", 0);\n this.addEffect(new PostProcessRenderEffect(scene.getEngine(), \"HDRVLSFinal\", () => {\n return this.volumetricLightFinalPostProcess;\n }, true));\n }\n if (this._lensFlareEnabled) {\n // Create lens flare post-process\n this._createLensFlarePostProcess(scene, ratio);\n // Create depth-of-field source post-process post lens-flare and disable it now\n this.lensFlareFinalPostProcess = new PostProcess(\"HDRPostLensFlareDepthOfFieldSource\", \"standard\", [], [], ratio, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, \"#define PASS_POST_PROCESS\", 0);\n this.addEffect(new PostProcessRenderEffect(scene.getEngine(), \"HDRPostLensFlareDepthOfFieldSource\", () => {\n return this.lensFlareFinalPostProcess;\n }, true));\n }\n if (this._hdrEnabled) {\n // Create luminance\n this._createLuminancePostProcesses(scene, this._floatTextureType);\n // Create HDR\n this._createHdrPostProcess(scene, ratio);\n // Create depth-of-field source post-process post hdr and disable it now\n this.hdrFinalPostProcess = new PostProcess(\"HDRPostHDReDepthOfFieldSource\", \"standard\", [], [], ratio, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, \"#define PASS_POST_PROCESS\", 0);\n this.addEffect(new PostProcessRenderEffect(scene.getEngine(), \"HDRPostHDReDepthOfFieldSource\", () => {\n return this.hdrFinalPostProcess;\n }, true));\n }\n if (this._depthOfFieldEnabled) {\n // Create gaussian blur used by depth-of-field\n this._createBlurPostProcesses(scene, ratio / 2, 3, \"depthOfFieldBlurWidth\");\n // Create depth-of-field post-process\n this._createDepthOfFieldPostProcess(scene, ratio);\n }\n if (this._motionBlurEnabled) {\n // Create motion blur post-process\n this._createMotionBlurPostProcess(scene, ratio);\n }\n if (this._fxaaEnabled) {\n // Create fxaa post-process\n this.fxaaPostProcess = new FxaaPostProcess(\"fxaa\", 1.0, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, 0);\n this.addEffect(new PostProcessRenderEffect(scene.getEngine(), \"HDRFxaa\", () => {\n return this.fxaaPostProcess;\n }, true));\n }\n if (this._cameras !== null) {\n this._scene.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(this._name, this._cameras);\n }\n if (!this._enableMSAAOnFirstPostProcess(this._samples) && this._samples > 1) {\n Logger.Warn(\"MSAA failed to enable, MSAA is only supported in browsers that support webGL >= 2.0\");\n }\n }\n // Down Sample X4 Post-Process\n _createDownSampleX4PostProcess(scene, ratio) {\n const downSampleX4Offsets = new Array(32);\n this.downSampleX4PostProcess = new PostProcess(\"HDRDownSampleX4\", \"standard\", [\"dsOffsets\"], [], ratio, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, \"#define DOWN_SAMPLE_X4\", this._floatTextureType);\n this.downSampleX4PostProcess.onApply = (effect) => {\n let id = 0;\n const width = this.downSampleX4PostProcess.width;\n const height = this.downSampleX4PostProcess.height;\n for (let i = -2; i < 2; i++) {\n for (let j = -2; j < 2; j++) {\n downSampleX4Offsets[id] = (i + 0.5) * (1.0 / width);\n downSampleX4Offsets[id + 1] = (j + 0.5) * (1.0 / height);\n id += 2;\n }\n }\n effect.setArray2(\"dsOffsets\", downSampleX4Offsets);\n };\n // Add to pipeline\n this.addEffect(new PostProcessRenderEffect(scene.getEngine(), \"HDRDownSampleX4\", () => {\n return this.downSampleX4PostProcess;\n }, true));\n }\n // Brightpass Post-Process\n _createBrightPassPostProcess(scene, ratio) {\n const brightOffsets = new Array(8);\n this.brightPassPostProcess = new PostProcess(\"HDRBrightPass\", \"standard\", [\"dsOffsets\", \"brightThreshold\"], [], ratio, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, \"#define BRIGHT_PASS\", this._floatTextureType);\n this.brightPassPostProcess.onApply = (effect) => {\n const sU = 1.0 / this.brightPassPostProcess.width;\n const sV = 1.0 / this.brightPassPostProcess.height;\n brightOffsets[0] = -0.5 * sU;\n brightOffsets[1] = 0.5 * sV;\n brightOffsets[2] = 0.5 * sU;\n brightOffsets[3] = 0.5 * sV;\n brightOffsets[4] = -0.5 * sU;\n brightOffsets[5] = -0.5 * sV;\n brightOffsets[6] = 0.5 * sU;\n brightOffsets[7] = -0.5 * sV;\n effect.setArray2(\"dsOffsets\", brightOffsets);\n effect.setFloat(\"brightThreshold\", this.brightThreshold);\n };\n // Add to pipeline\n this.addEffect(new PostProcessRenderEffect(scene.getEngine(), \"HDRBrightPass\", () => {\n return this.brightPassPostProcess;\n }, true));\n }\n // Create blur H&V post-processes\n _createBlurPostProcesses(scene, ratio, indice, blurWidthKey = \"blurWidth\") {\n const engine = scene.getEngine();\n const blurX = new BlurPostProcess(\"HDRBlurH\" + \"_\" + indice, new Vector2(1, 0), this[blurWidthKey], ratio, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, this._floatTextureType);\n const blurY = new BlurPostProcess(\"HDRBlurV\" + \"_\" + indice, new Vector2(0, 1), this[blurWidthKey], ratio, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, this._floatTextureType);\n blurX.onActivateObservable.add(() => {\n const dw = blurX.width / engine.getRenderWidth();\n blurX.kernel = this[blurWidthKey] * dw;\n });\n blurY.onActivateObservable.add(() => {\n const dw = blurY.height / engine.getRenderHeight();\n blurY.kernel = this.horizontalBlur ? 64 * dw : this[blurWidthKey] * dw;\n });\n this.addEffect(new PostProcessRenderEffect(scene.getEngine(), \"HDRBlurH\" + indice, () => {\n return blurX;\n }, true));\n this.addEffect(new PostProcessRenderEffect(scene.getEngine(), \"HDRBlurV\" + indice, () => {\n return blurY;\n }, true));\n this.blurHPostProcesses.push(blurX);\n this.blurVPostProcesses.push(blurY);\n }\n // Create texture adder post-process\n _createTextureAdderPostProcess(scene, ratio) {\n this.textureAdderPostProcess = new PostProcess(\"HDRTextureAdder\", \"standard\", [\"exposure\"], [\"otherSampler\", \"lensSampler\"], ratio, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, \"#define TEXTURE_ADDER\", this._floatTextureType);\n this.textureAdderPostProcess.onApply = (effect) => {\n effect.setTextureFromPostProcess(\"otherSampler\", this._vlsEnabled ? this._currentDepthOfFieldSource : this.originalPostProcess);\n effect.setTexture(\"lensSampler\", this.lensTexture);\n effect.setFloat(\"exposure\", this._currentExposure);\n this._currentDepthOfFieldSource = this.textureAdderFinalPostProcess;\n };\n // Add to pipeline\n this.addEffect(new PostProcessRenderEffect(scene.getEngine(), \"HDRTextureAdder\", () => {\n return this.textureAdderPostProcess;\n }, true));\n }\n _createVolumetricLightPostProcess(scene, ratio) {\n const geometryRenderer = scene.enableGeometryBufferRenderer();\n geometryRenderer.enablePosition = true;\n const geometry = geometryRenderer.getGBuffer();\n // Base post-process\n this.volumetricLightPostProcess = new PostProcess(\"HDRVLS\", \"standard\", [\"shadowViewProjection\", \"cameraPosition\", \"sunDirection\", \"sunColor\", \"scatteringCoefficient\", \"scatteringPower\", \"depthValues\"], [\"shadowMapSampler\", \"positionSampler\"], ratio / 8, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, \"#define VLS\\n#define NB_STEPS \" + this._volumetricLightStepsCount.toFixed(1));\n const depthValues = Vector2.Zero();\n this.volumetricLightPostProcess.onApply = (effect) => {\n if (this.sourceLight && this.sourceLight.getShadowGenerator() && this._scene.activeCamera) {\n const generator = this.sourceLight.getShadowGenerator();\n effect.setTexture(\"shadowMapSampler\", generator.getShadowMap());\n effect.setTexture(\"positionSampler\", geometry.textures[2]);\n effect.setColor3(\"sunColor\", this.sourceLight.diffuse);\n effect.setVector3(\"sunDirection\", this.sourceLight.getShadowDirection());\n effect.setVector3(\"cameraPosition\", this._scene.activeCamera.globalPosition);\n effect.setMatrix(\"shadowViewProjection\", generator.getTransformMatrix());\n effect.setFloat(\"scatteringCoefficient\", this.volumetricLightCoefficient);\n effect.setFloat(\"scatteringPower\", this.volumetricLightPower);\n depthValues.x = this.sourceLight.getDepthMinZ(this._scene.activeCamera);\n depthValues.y = this.sourceLight.getDepthMaxZ(this._scene.activeCamera);\n effect.setVector2(\"depthValues\", depthValues);\n }\n };\n this.addEffect(new PostProcessRenderEffect(scene.getEngine(), \"HDRVLS\", () => {\n return this.volumetricLightPostProcess;\n }, true));\n // Smooth\n this._createBlurPostProcesses(scene, ratio / 4, 0, \"volumetricLightBlurScale\");\n // Merge\n this.volumetricLightMergePostProces = new PostProcess(\"HDRVLSMerge\", \"standard\", [], [\"originalSampler\"], ratio, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, \"#define VLSMERGE\");\n this.volumetricLightMergePostProces.onApply = (effect) => {\n effect.setTextureFromPostProcess(\"originalSampler\", this._bloomEnabled ? this.textureAdderFinalPostProcess : this.originalPostProcess);\n this._currentDepthOfFieldSource = this.volumetricLightFinalPostProcess;\n };\n this.addEffect(new PostProcessRenderEffect(scene.getEngine(), \"HDRVLSMerge\", () => {\n return this.volumetricLightMergePostProces;\n }, true));\n }\n // Create luminance\n _createLuminancePostProcesses(scene, textureType) {\n // Create luminance\n let size = Math.pow(3, StandardRenderingPipeline.LuminanceSteps);\n this.luminancePostProcess = new PostProcess(\"HDRLuminance\", \"standard\", [\"lumOffsets\"], [], { width: size, height: size }, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, \"#define LUMINANCE\", textureType);\n const offsets = [];\n this.luminancePostProcess.onApply = (effect) => {\n const sU = 1.0 / this.luminancePostProcess.width;\n const sV = 1.0 / this.luminancePostProcess.height;\n offsets[0] = -0.5 * sU;\n offsets[1] = 0.5 * sV;\n offsets[2] = 0.5 * sU;\n offsets[3] = 0.5 * sV;\n offsets[4] = -0.5 * sU;\n offsets[5] = -0.5 * sV;\n offsets[6] = 0.5 * sU;\n offsets[7] = -0.5 * sV;\n effect.setArray2(\"lumOffsets\", offsets);\n };\n // Add to pipeline\n this.addEffect(new PostProcessRenderEffect(scene.getEngine(), \"HDRLuminance\", () => {\n return this.luminancePostProcess;\n }, true));\n // Create down sample luminance\n for (let i = StandardRenderingPipeline.LuminanceSteps - 1; i >= 0; i--) {\n size = Math.pow(3, i);\n let defines = \"#define LUMINANCE_DOWN_SAMPLE\\n\";\n if (i === 0) {\n defines += \"#define FINAL_DOWN_SAMPLER\";\n }\n const postProcess = new PostProcess(\"HDRLuminanceDownSample\" + i, \"standard\", [\"dsOffsets\", \"halfDestPixelSize\"], [], { width: size, height: size }, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, defines, textureType);\n this.luminanceDownSamplePostProcesses.push(postProcess);\n }\n // Create callbacks and add effects\n let lastLuminance = this.luminancePostProcess;\n this.luminanceDownSamplePostProcesses.forEach((pp, index) => {\n const downSampleOffsets = new Array(18);\n pp.onApply = (effect) => {\n if (!lastLuminance) {\n return;\n }\n let id = 0;\n for (let x = -1; x < 2; x++) {\n for (let y = -1; y < 2; y++) {\n downSampleOffsets[id] = x / lastLuminance.width;\n downSampleOffsets[id + 1] = y / lastLuminance.height;\n id += 2;\n }\n }\n effect.setArray2(\"dsOffsets\", downSampleOffsets);\n effect.setFloat(\"halfDestPixelSize\", 0.5 / lastLuminance.width);\n if (index === this.luminanceDownSamplePostProcesses.length - 1) {\n lastLuminance = this.luminancePostProcess;\n }\n else {\n lastLuminance = pp;\n }\n };\n if (index === this.luminanceDownSamplePostProcesses.length - 1) {\n pp.onAfterRender = () => {\n const pixel = scene.getEngine().readPixels(0, 0, 1, 1);\n const bit_shift = new Vector4(1.0 / (255.0 * 255.0 * 255.0), 1.0 / (255.0 * 255.0), 1.0 / 255.0, 1.0);\n pixel.then((pixel) => {\n const data = new Uint8Array(pixel.buffer);\n this._hdrCurrentLuminance = (data[0] * bit_shift.x + data[1] * bit_shift.y + data[2] * bit_shift.z + data[3] * bit_shift.w) / 100.0;\n });\n };\n }\n this.addEffect(new PostProcessRenderEffect(scene.getEngine(), \"HDRLuminanceDownSample\" + index, () => {\n return pp;\n }, true));\n });\n }\n // Create HDR post-process\n _createHdrPostProcess(scene, ratio) {\n const defines = [\"#define HDR\"];\n if (this._hdrAutoExposure) {\n defines.push(\"#define AUTO_EXPOSURE\");\n }\n this.hdrPostProcess = new PostProcess(\"HDR\", \"standard\", [\"averageLuminance\"], [\"textureAdderSampler\"], ratio, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, defines.join(\"\\n\"), 0);\n let outputLiminance = 1;\n let time = 0;\n let lastTime = 0;\n this.hdrPostProcess.onApply = (effect) => {\n effect.setTextureFromPostProcess(\"textureAdderSampler\", this._currentDepthOfFieldSource);\n time += scene.getEngine().getDeltaTime();\n if (outputLiminance < 0) {\n outputLiminance = this._hdrCurrentLuminance;\n }\n else {\n const dt = (lastTime - time) / 1000.0;\n if (this._hdrCurrentLuminance < outputLiminance + this.hdrDecreaseRate * dt) {\n outputLiminance += this.hdrDecreaseRate * dt;\n }\n else if (this._hdrCurrentLuminance > outputLiminance - this.hdrIncreaseRate * dt) {\n outputLiminance -= this.hdrIncreaseRate * dt;\n }\n else {\n outputLiminance = this._hdrCurrentLuminance;\n }\n }\n if (this.hdrAutoExposure) {\n this._currentExposure = this._fixedExposure / outputLiminance;\n }\n else {\n outputLiminance = Scalar.Clamp(outputLiminance, this.hdrMinimumLuminance, 1e20);\n effect.setFloat(\"averageLuminance\", outputLiminance);\n }\n lastTime = time;\n this._currentDepthOfFieldSource = this.hdrFinalPostProcess;\n };\n this.addEffect(new PostProcessRenderEffect(scene.getEngine(), \"HDR\", () => {\n return this.hdrPostProcess;\n }, true));\n }\n // Create lens flare post-process\n _createLensFlarePostProcess(scene, ratio) {\n this.lensFlarePostProcess = new PostProcess(\"HDRLensFlare\", \"standard\", [\"strength\", \"ghostDispersal\", \"haloWidth\", \"resolution\", \"distortionStrength\"], [\"lensColorSampler\"], ratio / 2, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, \"#define LENS_FLARE\", 0);\n this.addEffect(new PostProcessRenderEffect(scene.getEngine(), \"HDRLensFlare\", () => {\n return this.lensFlarePostProcess;\n }, true));\n this._createBlurPostProcesses(scene, ratio / 4, 2, \"lensFlareBlurWidth\");\n this.lensFlareComposePostProcess = new PostProcess(\"HDRLensFlareCompose\", \"standard\", [\"lensStarMatrix\"], [\"otherSampler\", \"lensDirtSampler\", \"lensStarSampler\"], ratio, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, \"#define LENS_FLARE_COMPOSE\", 0);\n this.addEffect(new PostProcessRenderEffect(scene.getEngine(), \"HDRLensFlareCompose\", () => {\n return this.lensFlareComposePostProcess;\n }, true));\n const resolution = new Vector2(0, 0);\n // Lens flare\n this.lensFlarePostProcess.externalTextureSamplerBinding = true;\n this.lensFlarePostProcess.onApply = (effect) => {\n effect.setTextureFromPostProcess(\"textureSampler\", this._bloomEnabled ? this.blurHPostProcesses[0] : this.originalPostProcess);\n effect.setTexture(\"lensColorSampler\", this.lensColorTexture);\n effect.setFloat(\"strength\", this.lensFlareStrength);\n effect.setFloat(\"ghostDispersal\", this.lensFlareGhostDispersal);\n effect.setFloat(\"haloWidth\", this.lensFlareHaloWidth);\n // Shift\n resolution.x = this.lensFlarePostProcess.width;\n resolution.y = this.lensFlarePostProcess.height;\n effect.setVector2(\"resolution\", resolution);\n effect.setFloat(\"distortionStrength\", this.lensFlareDistortionStrength);\n };\n // Compose\n const scaleBias1 = Matrix.FromValues(2.0, 0.0, -1.0, 0.0, 0.0, 2.0, -1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0);\n const scaleBias2 = Matrix.FromValues(0.5, 0.0, 0.5, 0.0, 0.0, 0.5, 0.5, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0);\n this.lensFlareComposePostProcess.onApply = (effect) => {\n if (!this._scene.activeCamera) {\n return;\n }\n effect.setTextureFromPostProcess(\"otherSampler\", this.lensFlarePostProcess);\n effect.setTexture(\"lensDirtSampler\", this.lensFlareDirtTexture);\n effect.setTexture(\"lensStarSampler\", this.lensStarTexture);\n // Lens start rotation matrix\n const camerax = this._scene.activeCamera.getViewMatrix().getRow(0);\n const cameraz = this._scene.activeCamera.getViewMatrix().getRow(2);\n let camRot = Vector3.Dot(camerax.toVector3(), new Vector3(1.0, 0.0, 0.0)) + Vector3.Dot(cameraz.toVector3(), new Vector3(0.0, 0.0, 1.0));\n camRot *= 4.0;\n const starRotation = Matrix.FromValues(Math.cos(camRot) * 0.5, -Math.sin(camRot), 0.0, 0.0, Math.sin(camRot), Math.cos(camRot) * 0.5, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0);\n const lensStarMatrix = scaleBias2.multiply(starRotation).multiply(scaleBias1);\n effect.setMatrix(\"lensStarMatrix\", lensStarMatrix);\n this._currentDepthOfFieldSource = this.lensFlareFinalPostProcess;\n };\n }\n // Create depth-of-field post-process\n _createDepthOfFieldPostProcess(scene, ratio) {\n this.depthOfFieldPostProcess = new PostProcess(\"HDRDepthOfField\", \"standard\", [\"distance\"], [\"otherSampler\", \"depthSampler\"], ratio, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, \"#define DEPTH_OF_FIELD\", 0);\n this.depthOfFieldPostProcess.onApply = (effect) => {\n effect.setTextureFromPostProcess(\"otherSampler\", this._currentDepthOfFieldSource);\n effect.setTexture(\"depthSampler\", this._getDepthTexture());\n effect.setFloat(\"distance\", this.depthOfFieldDistance);\n };\n // Add to pipeline\n this.addEffect(new PostProcessRenderEffect(scene.getEngine(), \"HDRDepthOfField\", () => {\n return this.depthOfFieldPostProcess;\n }, true));\n }\n // Create motion blur post-process\n _createMotionBlurPostProcess(scene, ratio) {\n if (this._isObjectBasedMotionBlur) {\n const mb = new MotionBlurPostProcess(\"HDRMotionBlur\", scene, ratio, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, 0);\n mb.motionStrength = this.motionStrength;\n mb.motionBlurSamples = this.motionBlurSamples;\n this.motionBlurPostProcess = mb;\n }\n else {\n this.motionBlurPostProcess = new PostProcess(\"HDRMotionBlur\", \"standard\", [\"inverseViewProjection\", \"prevViewProjection\", \"screenSize\", \"motionScale\", \"motionStrength\"], [\"depthSampler\"], ratio, null, Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, \"#define MOTION_BLUR\\n#define MAX_MOTION_SAMPLES \" + this.motionBlurSamples.toFixed(1), 0);\n let motionScale = 0;\n let prevViewProjection = Matrix.Identity();\n const invViewProjection = Matrix.Identity();\n let viewProjection = Matrix.Identity();\n const screenSize = Vector2.Zero();\n this.motionBlurPostProcess.onApply = (effect) => {\n viewProjection = scene.getProjectionMatrix().multiply(scene.getViewMatrix());\n viewProjection.invertToRef(invViewProjection);\n effect.setMatrix(\"inverseViewProjection\", invViewProjection);\n effect.setMatrix(\"prevViewProjection\", prevViewProjection);\n prevViewProjection = viewProjection;\n screenSize.x = this.motionBlurPostProcess.width;\n screenSize.y = this.motionBlurPostProcess.height;\n effect.setVector2(\"screenSize\", screenSize);\n motionScale = scene.getEngine().getFps() / 60.0;\n effect.setFloat(\"motionScale\", motionScale);\n effect.setFloat(\"motionStrength\", this.motionStrength);\n effect.setTexture(\"depthSampler\", this._getDepthTexture());\n };\n }\n this.addEffect(new PostProcessRenderEffect(scene.getEngine(), \"HDRMotionBlur\", () => {\n return this.motionBlurPostProcess;\n }, true));\n }\n _getDepthTexture() {\n if (this._scene.getEngine().getCaps().drawBuffersExtension) {\n const renderer = this._scene.enableGeometryBufferRenderer();\n return renderer.getGBuffer().textures[0];\n }\n return this._scene.enableDepthRenderer().getDepthMap();\n }\n _disposePostProcesses() {\n for (let i = 0; i < this._cameras.length; i++) {\n const camera = this._cameras[i];\n if (this.originalPostProcess) {\n this.originalPostProcess.dispose(camera);\n }\n if (this.screenSpaceReflectionPostProcess) {\n this.screenSpaceReflectionPostProcess.dispose(camera);\n }\n if (this.downSampleX4PostProcess) {\n this.downSampleX4PostProcess.dispose(camera);\n }\n if (this.brightPassPostProcess) {\n this.brightPassPostProcess.dispose(camera);\n }\n if (this.textureAdderPostProcess) {\n this.textureAdderPostProcess.dispose(camera);\n }\n if (this.volumetricLightPostProcess) {\n this.volumetricLightPostProcess.dispose(camera);\n }\n if (this.volumetricLightSmoothXPostProcess) {\n this.volumetricLightSmoothXPostProcess.dispose(camera);\n }\n if (this.volumetricLightSmoothYPostProcess) {\n this.volumetricLightSmoothYPostProcess.dispose(camera);\n }\n if (this.volumetricLightMergePostProces) {\n this.volumetricLightMergePostProces.dispose(camera);\n }\n if (this.volumetricLightFinalPostProcess) {\n this.volumetricLightFinalPostProcess.dispose(camera);\n }\n if (this.lensFlarePostProcess) {\n this.lensFlarePostProcess.dispose(camera);\n }\n if (this.lensFlareComposePostProcess) {\n this.lensFlareComposePostProcess.dispose(camera);\n }\n for (let j = 0; j < this.luminanceDownSamplePostProcesses.length; j++) {\n this.luminanceDownSamplePostProcesses[j].dispose(camera);\n }\n if (this.luminancePostProcess) {\n this.luminancePostProcess.dispose(camera);\n }\n if (this.hdrPostProcess) {\n this.hdrPostProcess.dispose(camera);\n }\n if (this.hdrFinalPostProcess) {\n this.hdrFinalPostProcess.dispose(camera);\n }\n if (this.depthOfFieldPostProcess) {\n this.depthOfFieldPostProcess.dispose(camera);\n }\n if (this.motionBlurPostProcess) {\n this.motionBlurPostProcess.dispose(camera);\n }\n if (this.fxaaPostProcess) {\n this.fxaaPostProcess.dispose(camera);\n }\n for (let j = 0; j < this.blurHPostProcesses.length; j++) {\n this.blurHPostProcesses[j].dispose(camera);\n }\n for (let j = 0; j < this.blurVPostProcesses.length; j++) {\n this.blurVPostProcesses[j].dispose(camera);\n }\n }\n this.originalPostProcess = null;\n this.downSampleX4PostProcess = null;\n this.brightPassPostProcess = null;\n this.textureAdderPostProcess = null;\n this.textureAdderFinalPostProcess = null;\n this.volumetricLightPostProcess = null;\n this.volumetricLightSmoothXPostProcess = null;\n this.volumetricLightSmoothYPostProcess = null;\n this.volumetricLightMergePostProces = null;\n this.volumetricLightFinalPostProcess = null;\n this.lensFlarePostProcess = null;\n this.lensFlareComposePostProcess = null;\n this.luminancePostProcess = null;\n this.hdrPostProcess = null;\n this.hdrFinalPostProcess = null;\n this.depthOfFieldPostProcess = null;\n this.motionBlurPostProcess = null;\n this.fxaaPostProcess = null;\n this.screenSpaceReflectionPostProcess = null;\n this.luminanceDownSamplePostProcesses.length = 0;\n this.blurHPostProcesses.length = 0;\n this.blurVPostProcesses.length = 0;\n }\n /**\n * Dispose of the pipeline and stop all post processes\n */\n dispose() {\n this._disposePostProcesses();\n this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name, this._cameras);\n super.dispose();\n }\n /**\n * Serialize the rendering pipeline (Used when exporting)\n * @returns the serialized object\n */\n serialize() {\n const serializationObject = SerializationHelper.Serialize(this);\n if (this.sourceLight) {\n serializationObject.sourceLightId = this.sourceLight.id;\n }\n if (this.screenSpaceReflectionPostProcess) {\n serializationObject.screenSpaceReflectionPostProcess = SerializationHelper.Serialize(this.screenSpaceReflectionPostProcess);\n }\n serializationObject.customType = \"StandardRenderingPipeline\";\n return serializationObject;\n }\n /**\n * Parse the serialized pipeline\n * @param source Source pipeline.\n * @param scene The scene to load the pipeline to.\n * @param rootUrl The URL of the serialized pipeline.\n * @returns An instantiated pipeline from the serialized object.\n */\n static Parse(source, scene, rootUrl) {\n const p = SerializationHelper.Parse(() => new StandardRenderingPipeline(source._name, scene, source._ratio), source, scene, rootUrl);\n if (source.sourceLightId) {\n p.sourceLight = scene.getLightById(source.sourceLightId);\n }\n if (source.screenSpaceReflectionPostProcess) {\n SerializationHelper.Parse(() => p.screenSpaceReflectionPostProcess, source.screenSpaceReflectionPostProcess, scene, rootUrl);\n }\n return p;\n }\n}\n/**\n * Luminance steps\n */\nStandardRenderingPipeline.LuminanceSteps = 6;\n__decorate([\n serialize()\n], StandardRenderingPipeline.prototype, \"brightThreshold\", void 0);\n__decorate([\n serialize()\n], StandardRenderingPipeline.prototype, \"blurWidth\", void 0);\n__decorate([\n serialize()\n], StandardRenderingPipeline.prototype, \"horizontalBlur\", void 0);\n__decorate([\n serialize()\n], StandardRenderingPipeline.prototype, \"exposure\", null);\n__decorate([\n serializeAsTexture(\"lensTexture\")\n], StandardRenderingPipeline.prototype, \"lensTexture\", void 0);\n__decorate([\n serialize()\n], StandardRenderingPipeline.prototype, \"volumetricLightCoefficient\", void 0);\n__decorate([\n serialize()\n], StandardRenderingPipeline.prototype, \"volumetricLightPower\", void 0);\n__decorate([\n serialize()\n], StandardRenderingPipeline.prototype, \"volumetricLightBlurScale\", void 0);\n__decorate([\n serialize()\n], StandardRenderingPipeline.prototype, \"hdrMinimumLuminance\", void 0);\n__decorate([\n serialize()\n], StandardRenderingPipeline.prototype, \"hdrDecreaseRate\", void 0);\n__decorate([\n serialize()\n], StandardRenderingPipeline.prototype, \"hdrIncreaseRate\", void 0);\n__decorate([\n serialize()\n], StandardRenderingPipeline.prototype, \"hdrAutoExposure\", null);\n__decorate([\n serializeAsTexture(\"lensColorTexture\")\n], StandardRenderingPipeline.prototype, \"lensColorTexture\", void 0);\n__decorate([\n serialize()\n], StandardRenderingPipeline.prototype, \"lensFlareStrength\", void 0);\n__decorate([\n serialize()\n], StandardRenderingPipeline.prototype, \"lensFlareGhostDispersal\", void 0);\n__decorate([\n serialize()\n], StandardRenderingPipeline.prototype, \"lensFlareHaloWidth\", void 0);\n__decorate([\n serialize()\n], StandardRenderingPipeline.prototype, \"lensFlareDistortionStrength\", void 0);\n__decorate([\n serialize()\n], StandardRenderingPipeline.prototype, \"lensFlareBlurWidth\", void 0);\n__decorate([\n serializeAsTexture(\"lensStarTexture\")\n], StandardRenderingPipeline.prototype, \"lensStarTexture\", void 0);\n__decorate([\n serializeAsTexture(\"lensFlareDirtTexture\")\n], StandardRenderingPipeline.prototype, \"lensFlareDirtTexture\", void 0);\n__decorate([\n serialize()\n], StandardRenderingPipeline.prototype, \"depthOfFieldDistance\", void 0);\n__decorate([\n serialize()\n], StandardRenderingPipeline.prototype, \"depthOfFieldBlurWidth\", void 0);\n__decorate([\n serialize()\n], StandardRenderingPipeline.prototype, \"motionStrength\", null);\n__decorate([\n serialize()\n], StandardRenderingPipeline.prototype, \"objectBasedMotionBlur\", null);\n__decorate([\n serialize()\n], StandardRenderingPipeline.prototype, \"_ratio\", void 0);\n__decorate([\n serialize()\n], StandardRenderingPipeline.prototype, \"BloomEnabled\", null);\n__decorate([\n serialize()\n], StandardRenderingPipeline.prototype, \"DepthOfFieldEnabled\", null);\n__decorate([\n serialize()\n], StandardRenderingPipeline.prototype, \"LensFlareEnabled\", null);\n__decorate([\n serialize()\n], StandardRenderingPipeline.prototype, \"HDREnabled\", null);\n__decorate([\n serialize()\n // eslint-disable-next-line @typescript-eslint/naming-convention\n], StandardRenderingPipeline.prototype, \"VLSEnabled\", null);\n__decorate([\n serialize()\n], StandardRenderingPipeline.prototype, \"MotionBlurEnabled\", null);\n__decorate([\n serialize()\n], StandardRenderingPipeline.prototype, \"fxaaEnabled\", null);\n__decorate([\n serialize()\n], StandardRenderingPipeline.prototype, \"screenSpaceReflectionsEnabled\", null);\n__decorate([\n serialize()\n], StandardRenderingPipeline.prototype, \"volumetricLightStepsCount\", null);\n__decorate([\n serialize()\n], StandardRenderingPipeline.prototype, \"motionBlurSamples\", null);\n__decorate([\n serialize()\n], StandardRenderingPipeline.prototype, \"samples\", null);\nRegisterClass(\"BABYLON.StandardRenderingPipeline\", StandardRenderingPipeline);\n//# sourceMappingURL=standardRenderingPipeline.js.map","\n/**\n * Contains all parameters needed for the prepass to perform\n * screen space reflections\n */\nexport class ScreenSpaceReflections2Configuration {\n constructor() {\n /**\n * Is ssr enabled\n */\n this.enabled = false;\n /**\n * Name of the configuration\n */\n this.name = \"screenSpaceReflections2\";\n /**\n * Textures that should be present in the MRT for this effect to work\n */\n this.texturesRequired = [6, 3, 5];\n }\n}\n//# sourceMappingURL=screenSpaceReflections2Configuration.js.map","// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore.js\";\nimport \"./ShadersInclude/clipPlaneFragmentDeclaration.js\";\nimport \"./ShadersInclude/packingFunctions.js\";\nimport \"./ShadersInclude/clipPlaneFragment.js\";\nconst name = \"depthPixelShader\";\nconst shader = `#ifdef ALPHATEST\nvarying vec2 vUV;uniform sampler2D diffuseSampler;\n#endif\n#include\nvarying float vDepthMetric;\n#ifdef PACKED\n#include\n#endif\n#ifdef STORE_CAMERASPACE_Z\nvarying vec4 vViewPos;\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{\n#include\n#ifdef ALPHATEST\nif (texture2D(diffuseSampler,vUV).a<0.4)\ndiscard;\n#endif\n#ifdef STORE_CAMERASPACE_Z\n#ifdef PACKED\ngl_FragColor=pack(vViewPos.z);\n#else\ngl_FragColor=vec4(vViewPos.z,0.0,0.0,1.0);\n#endif\n#else\n#ifdef NONLINEARDEPTH\n#ifdef PACKED\ngl_FragColor=pack(gl_FragCoord.z);\n#else\ngl_FragColor=vec4(gl_FragCoord.z,0.0,0.0,0.0);\n#endif\n#else\n#ifdef PACKED\ngl_FragColor=pack(vDepthMetric);\n#else\ngl_FragColor=vec4(vDepthMetric,0.0,0.0,1.0);\n#endif\n#endif\n#endif\n}`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @internal */\nexport const depthPixelShader = { name, shader };\n//# sourceMappingURL=depth.fragment.js.map","// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore.js\";\nimport \"./ShadersInclude/bonesDeclaration.js\";\nimport \"./ShadersInclude/bakedVertexAnimationDeclaration.js\";\nimport \"./ShadersInclude/morphTargetsVertexGlobalDeclaration.js\";\nimport \"./ShadersInclude/morphTargetsVertexDeclaration.js\";\nimport \"./ShadersInclude/clipPlaneVertexDeclaration.js\";\nimport \"./ShadersInclude/instancesDeclaration.js\";\nimport \"./ShadersInclude/morphTargetsVertexGlobal.js\";\nimport \"./ShadersInclude/morphTargetsVertex.js\";\nimport \"./ShadersInclude/instancesVertex.js\";\nimport \"./ShadersInclude/bonesVertex.js\";\nimport \"./ShadersInclude/bakedVertexAnimation.js\";\nimport \"./ShadersInclude/clipPlaneVertex.js\";\nconst name = \"depthVertexShader\";\nconst shader = `attribute vec3 position;\n#include\n#include\n#include\n#include[0..maxSimultaneousMorphTargets]\n#include\n#include\nuniform mat4 viewProjection;uniform vec2 depthValues;\n#if defined(ALPHATEST) || defined(NEED_UV)\nvarying vec2 vUV;uniform mat4 diffuseMatrix;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#endif\n#ifdef STORE_CAMERASPACE_Z\nuniform mat4 view;varying vec4 vViewPos;\n#endif\nvarying float vDepthMetric;\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void)\n{vec3 positionUpdated=position;\n#ifdef UV1\nvec2 uvUpdated=uv;\n#endif\n#include\n#include[0..maxSimultaneousMorphTargets]\n#include\n#include\n#include\nvec4 worldPos=finalWorld*vec4(positionUpdated,1.0);\n#include\ngl_Position=viewProjection*worldPos;\n#ifdef STORE_CAMERASPACE_Z\nvViewPos=view*worldPos;\n#else\n#ifdef USE_REVERSE_DEPTHBUFFER\nvDepthMetric=((-gl_Position.z+depthValues.x)/(depthValues.y));\n#else\nvDepthMetric=((gl_Position.z+depthValues.x)/(depthValues.y));\n#endif\n#endif\n#if defined(ALPHATEST) || defined(BASIC_RENDER)\n#ifdef UV1\nvUV=vec2(diffuseMatrix*vec4(uvUpdated,1.0,0.0));\n#endif\n#ifdef UV2\nvUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n}\n`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @internal */\nexport const depthVertexShader = { name, shader };\n//# sourceMappingURL=depth.vertex.js.map","import { Color4 } from \"../Maths/math.color.js\";\nimport { VertexBuffer } from \"../Buffers/buffer.js\";\nimport { Texture } from \"../Materials/Textures/texture.js\";\nimport { RenderTargetTexture } from \"../Materials/Textures/renderTargetTexture.js\";\nimport { MaterialHelper } from \"../Materials/materialHelper.js\";\nimport { Camera } from \"../Cameras/camera.js\";\n\nimport \"../Shaders/depth.fragment.js\";\nimport \"../Shaders/depth.vertex.js\";\nimport { _WarnImport } from \"../Misc/devTools.js\";\nimport { addClipPlaneUniforms, bindClipPlane, prepareStringDefinesForClipPlanes } from \"../Materials/clipPlaneMaterialHelper.js\";\n/**\n * This represents a depth renderer in Babylon.\n * A depth renderer will render to it's depth map every frame which can be displayed or used in post processing\n */\nexport class DepthRenderer {\n /**\n * Sets a specific material to be used to render a mesh/a list of meshes by the depth renderer\n * @param mesh mesh or array of meshes\n * @param material material to use by the depth render when rendering the mesh(es). If undefined is passed, the specific material created by the depth renderer will be used.\n */\n setMaterialForRendering(mesh, material) {\n this._depthMap.setMaterialForRendering(mesh, material);\n }\n /**\n * Instantiates a depth renderer\n * @param scene The scene the renderer belongs to\n * @param type The texture type of the depth map (default: Engine.TEXTURETYPE_FLOAT)\n * @param camera The camera to be used to render the depth map (default: scene's active camera)\n * @param storeNonLinearDepth Defines whether the depth is stored linearly like in Babylon Shadows or directly like glFragCoord.z\n * @param samplingMode The sampling mode to be used with the render target (Linear, Nearest...) (default: TRILINEAR_SAMPLINGMODE)\n * @param storeCameraSpaceZ Defines whether the depth stored is the Z coordinate in camera space. If true, storeNonLinearDepth has no effect. (Default: false)\n * @param name Name of the render target (default: DepthRenderer)\n */\n constructor(scene, type = 1, camera = null, storeNonLinearDepth = false, samplingMode = Texture.TRILINEAR_SAMPLINGMODE, storeCameraSpaceZ = false, name) {\n /** Enable or disable the depth renderer. When disabled, the depth texture is not updated */\n this.enabled = true;\n /** Force writing the transparent objects into the depth map */\n this.forceDepthWriteTransparentMeshes = false;\n /**\n * Specifies that the depth renderer will only be used within\n * the camera it is created for.\n * This can help forcing its rendering during the camera processing.\n */\n this.useOnlyInActiveCamera = false;\n /** If true, reverse the culling of materials before writing to the depth texture.\n * So, basically, when \"true\", back facing instead of front facing faces are rasterized into the texture\n */\n this.reverseCulling = false;\n this._scene = scene;\n this._storeNonLinearDepth = storeNonLinearDepth;\n this._storeCameraSpaceZ = storeCameraSpaceZ;\n this.isPacked = type === 0;\n if (this.isPacked) {\n this.clearColor = new Color4(1.0, 1.0, 1.0, 1.0);\n }\n else {\n this.clearColor = new Color4(storeCameraSpaceZ ? 1e8 : 1.0, 0.0, 0.0, 1.0);\n }\n DepthRenderer._SceneComponentInitialization(this._scene);\n const engine = scene.getEngine();\n this._camera = camera;\n if (samplingMode !== Texture.NEAREST_SAMPLINGMODE) {\n if (type === 1 && !engine._caps.textureFloatLinearFiltering) {\n samplingMode = Texture.NEAREST_SAMPLINGMODE;\n }\n if (type === 2 && !engine._caps.textureHalfFloatLinearFiltering) {\n samplingMode = Texture.NEAREST_SAMPLINGMODE;\n }\n }\n // Render target\n const format = this.isPacked || !engine._features.supportExtendedTextureFormats ? 5 : 6;\n this._depthMap = new RenderTargetTexture(name !== null && name !== void 0 ? name : \"DepthRenderer\", { width: engine.getRenderWidth(), height: engine.getRenderHeight() }, this._scene, false, true, type, false, samplingMode, undefined, undefined, undefined, format);\n this._depthMap.wrapU = Texture.CLAMP_ADDRESSMODE;\n this._depthMap.wrapV = Texture.CLAMP_ADDRESSMODE;\n this._depthMap.refreshRate = 1;\n this._depthMap.renderParticles = false;\n this._depthMap.renderList = null;\n this._depthMap.noPrePassRenderer = true;\n // Camera to get depth map from to support multiple concurrent cameras\n this._depthMap.activeCamera = this._camera;\n this._depthMap.ignoreCameraViewport = true;\n this._depthMap.useCameraPostProcesses = false;\n // set default depth value to 1.0 (far away)\n this._depthMap.onClearObservable.add((engine) => {\n engine.clear(this.clearColor, true, true, true);\n });\n this._depthMap.onBeforeBindObservable.add(() => {\n var _a;\n (_a = engine._debugPushGroup) === null || _a === void 0 ? void 0 : _a.call(engine, \"depth renderer\", 1);\n });\n this._depthMap.onAfterUnbindObservable.add(() => {\n var _a;\n (_a = engine._debugPopGroup) === null || _a === void 0 ? void 0 : _a.call(engine, 1);\n });\n this._depthMap.customIsReadyFunction = (mesh, refreshRate, preWarm) => {\n if ((preWarm || refreshRate === 0) && mesh.subMeshes) {\n for (let i = 0; i < mesh.subMeshes.length; ++i) {\n const subMesh = mesh.subMeshes[i];\n const renderingMesh = subMesh.getRenderingMesh();\n const batch = renderingMesh._getInstancesRenderList(subMesh._id, !!subMesh.getReplacementMesh());\n const hardwareInstancedRendering = engine.getCaps().instancedArrays &&\n ((batch.visibleInstances[subMesh._id] !== null && batch.visibleInstances[subMesh._id] !== undefined) || renderingMesh.hasThinInstances);\n if (!this.isReady(subMesh, hardwareInstancedRendering)) {\n return false;\n }\n }\n }\n return true;\n };\n // Custom render function\n const renderSubMesh = (subMesh) => {\n var _a, _b;\n const renderingMesh = subMesh.getRenderingMesh();\n const effectiveMesh = subMesh.getEffectiveMesh();\n const scene = this._scene;\n const engine = scene.getEngine();\n const material = subMesh.getMaterial();\n effectiveMesh._internalAbstractMeshDataInfo._isActiveIntermediate = false;\n if (!material || effectiveMesh.infiniteDistance || material.disableDepthWrite || subMesh.verticesCount === 0 || subMesh._renderId === scene.getRenderId()) {\n return;\n }\n // Culling\n const detNeg = effectiveMesh._getWorldMatrixDeterminant() < 0;\n let sideOrientation = (_a = renderingMesh.overrideMaterialSideOrientation) !== null && _a !== void 0 ? _a : material.sideOrientation;\n if (detNeg) {\n sideOrientation =\n sideOrientation === 0\n ? 1\n : 0;\n }\n const reverseSideOrientation = sideOrientation === 0;\n engine.setState(material.backFaceCulling, 0, false, reverseSideOrientation, this.reverseCulling ? !material.cullBackFaces : material.cullBackFaces);\n // Managing instances\n const batch = renderingMesh._getInstancesRenderList(subMesh._id, !!subMesh.getReplacementMesh());\n if (batch.mustReturn) {\n return;\n }\n const hardwareInstancedRendering = engine.getCaps().instancedArrays &&\n ((batch.visibleInstances[subMesh._id] !== null && batch.visibleInstances[subMesh._id] !== undefined) || renderingMesh.hasThinInstances);\n const camera = this._camera || scene.activeCamera;\n if (this.isReady(subMesh, hardwareInstancedRendering) && camera) {\n subMesh._renderId = scene.getRenderId();\n const renderingMaterial = (_b = effectiveMesh._internalAbstractMeshDataInfo._materialForRenderPass) === null || _b === void 0 ? void 0 : _b[engine.currentRenderPassId];\n let drawWrapper = subMesh._getDrawWrapper();\n if (!drawWrapper && renderingMaterial) {\n drawWrapper = renderingMaterial._getDrawWrapper();\n }\n const cameraIsOrtho = camera.mode === Camera.ORTHOGRAPHIC_CAMERA;\n if (!drawWrapper) {\n return;\n }\n const effect = drawWrapper.effect;\n engine.enableEffect(drawWrapper);\n if (!hardwareInstancedRendering) {\n renderingMesh._bind(subMesh, effect, material.fillMode);\n }\n if (!renderingMaterial) {\n effect.setMatrix(\"viewProjection\", scene.getTransformMatrix());\n effect.setMatrix(\"world\", effectiveMesh.getWorldMatrix());\n if (this._storeCameraSpaceZ) {\n effect.setMatrix(\"view\", scene.getViewMatrix());\n }\n }\n else {\n renderingMaterial.bindForSubMesh(effectiveMesh.getWorldMatrix(), effectiveMesh, subMesh);\n }\n let minZ, maxZ;\n if (cameraIsOrtho) {\n minZ = !engine.useReverseDepthBuffer && engine.isNDCHalfZRange ? 0 : 1;\n maxZ = engine.useReverseDepthBuffer && engine.isNDCHalfZRange ? 0 : 1;\n }\n else {\n minZ = engine.useReverseDepthBuffer && engine.isNDCHalfZRange ? camera.minZ : engine.isNDCHalfZRange ? 0 : camera.minZ;\n maxZ = engine.useReverseDepthBuffer && engine.isNDCHalfZRange ? 0 : camera.maxZ;\n }\n effect.setFloat2(\"depthValues\", minZ, minZ + maxZ);\n if (!renderingMaterial) {\n // Alpha test\n if (material.needAlphaTesting()) {\n const alphaTexture = material.getAlphaTestTexture();\n if (alphaTexture) {\n effect.setTexture(\"diffuseSampler\", alphaTexture);\n effect.setMatrix(\"diffuseMatrix\", alphaTexture.getTextureMatrix());\n }\n }\n // Bones\n if (renderingMesh.useBones && renderingMesh.computeBonesUsingShaders && renderingMesh.skeleton) {\n const skeleton = renderingMesh.skeleton;\n if (skeleton.isUsingTextureForMatrices) {\n const boneTexture = skeleton.getTransformMatrixTexture(renderingMesh);\n if (!boneTexture) {\n return;\n }\n effect.setTexture(\"boneSampler\", boneTexture);\n effect.setFloat(\"boneTextureWidth\", 4.0 * (skeleton.bones.length + 1));\n }\n else {\n effect.setMatrices(\"mBones\", skeleton.getTransformMatrices(renderingMesh));\n }\n }\n // Clip planes\n bindClipPlane(effect, material, scene);\n // Morph targets\n MaterialHelper.BindMorphTargetParameters(renderingMesh, effect);\n if (renderingMesh.morphTargetManager && renderingMesh.morphTargetManager.isUsingTextureForTargets) {\n renderingMesh.morphTargetManager._bind(effect);\n }\n }\n // Draw\n renderingMesh._processRendering(effectiveMesh, subMesh, effect, material.fillMode, batch, hardwareInstancedRendering, (isInstance, world) => effect.setMatrix(\"world\", world));\n }\n };\n this._depthMap.customRenderFunction = (opaqueSubMeshes, alphaTestSubMeshes, transparentSubMeshes, depthOnlySubMeshes) => {\n let index;\n if (depthOnlySubMeshes.length) {\n for (index = 0; index < depthOnlySubMeshes.length; index++) {\n renderSubMesh(depthOnlySubMeshes.data[index]);\n }\n }\n for (index = 0; index < opaqueSubMeshes.length; index++) {\n renderSubMesh(opaqueSubMeshes.data[index]);\n }\n for (index = 0; index < alphaTestSubMeshes.length; index++) {\n renderSubMesh(alphaTestSubMeshes.data[index]);\n }\n if (this.forceDepthWriteTransparentMeshes) {\n for (index = 0; index < transparentSubMeshes.length; index++) {\n renderSubMesh(transparentSubMeshes.data[index]);\n }\n }\n else {\n for (index = 0; index < transparentSubMeshes.length; index++) {\n transparentSubMeshes.data[index].getEffectiveMesh()._internalAbstractMeshDataInfo._isActiveIntermediate = false;\n }\n }\n };\n }\n /**\n * Creates the depth rendering effect and checks if the effect is ready.\n * @param subMesh The submesh to be used to render the depth map of\n * @param useInstances If multiple world instances should be used\n * @returns if the depth renderer is ready to render the depth map\n */\n isReady(subMesh, useInstances) {\n var _a;\n const engine = this._scene.getEngine();\n const mesh = subMesh.getMesh();\n const scene = mesh.getScene();\n const renderingMaterial = (_a = mesh._internalAbstractMeshDataInfo._materialForRenderPass) === null || _a === void 0 ? void 0 : _a[engine.currentRenderPassId];\n if (renderingMaterial) {\n return renderingMaterial.isReadyForSubMesh(mesh, subMesh, useInstances);\n }\n const material = subMesh.getMaterial();\n if (!material || material.disableDepthWrite) {\n return false;\n }\n const defines = [];\n const attribs = [VertexBuffer.PositionKind];\n // Alpha test\n if (material && material.needAlphaTesting() && material.getAlphaTestTexture()) {\n defines.push(\"#define ALPHATEST\");\n if (mesh.isVerticesDataPresent(VertexBuffer.UVKind)) {\n attribs.push(VertexBuffer.UVKind);\n defines.push(\"#define UV1\");\n }\n if (mesh.isVerticesDataPresent(VertexBuffer.UV2Kind)) {\n attribs.push(VertexBuffer.UV2Kind);\n defines.push(\"#define UV2\");\n }\n }\n // Bones\n if (mesh.useBones && mesh.computeBonesUsingShaders) {\n attribs.push(VertexBuffer.MatricesIndicesKind);\n attribs.push(VertexBuffer.MatricesWeightsKind);\n if (mesh.numBoneInfluencers > 4) {\n attribs.push(VertexBuffer.MatricesIndicesExtraKind);\n attribs.push(VertexBuffer.MatricesWeightsExtraKind);\n }\n defines.push(\"#define NUM_BONE_INFLUENCERS \" + mesh.numBoneInfluencers);\n defines.push(\"#define BonesPerMesh \" + (mesh.skeleton ? mesh.skeleton.bones.length + 1 : 0));\n const skeleton = subMesh.getRenderingMesh().skeleton;\n if (skeleton === null || skeleton === void 0 ? void 0 : skeleton.isUsingTextureForMatrices) {\n defines.push(\"#define BONETEXTURE\");\n }\n }\n else {\n defines.push(\"#define NUM_BONE_INFLUENCERS 0\");\n }\n // Morph targets\n const morphTargetManager = mesh.morphTargetManager;\n let numMorphInfluencers = 0;\n if (morphTargetManager) {\n if (morphTargetManager.numInfluencers > 0) {\n numMorphInfluencers = morphTargetManager.numInfluencers;\n defines.push(\"#define MORPHTARGETS\");\n defines.push(\"#define NUM_MORPH_INFLUENCERS \" + numMorphInfluencers);\n if (morphTargetManager.isUsingTextureForTargets) {\n defines.push(\"#define MORPHTARGETS_TEXTURE\");\n }\n MaterialHelper.PrepareAttributesForMorphTargetsInfluencers(attribs, mesh, numMorphInfluencers);\n }\n }\n // Instances\n if (useInstances) {\n defines.push(\"#define INSTANCES\");\n MaterialHelper.PushAttributesForInstances(attribs);\n if (subMesh.getRenderingMesh().hasThinInstances) {\n defines.push(\"#define THIN_INSTANCES\");\n }\n }\n // None linear depth\n if (this._storeNonLinearDepth) {\n defines.push(\"#define NONLINEARDEPTH\");\n }\n // Store camera space Z coordinate instead of NDC Z\n if (this._storeCameraSpaceZ) {\n defines.push(\"#define STORE_CAMERASPACE_Z\");\n }\n // Float Mode\n if (this.isPacked) {\n defines.push(\"#define PACKED\");\n }\n // Clip planes\n prepareStringDefinesForClipPlanes(material, scene, defines);\n // Get correct effect\n const drawWrapper = subMesh._getDrawWrapper(undefined, true);\n const cachedDefines = drawWrapper.defines;\n const join = defines.join(\"\\n\");\n if (cachedDefines !== join) {\n const uniforms = [\n \"world\",\n \"mBones\",\n \"boneTextureWidth\",\n \"viewProjection\",\n \"view\",\n \"diffuseMatrix\",\n \"depthValues\",\n \"morphTargetInfluences\",\n \"morphTargetTextureInfo\",\n \"morphTargetTextureIndices\",\n ];\n addClipPlaneUniforms(uniforms);\n drawWrapper.setEffect(engine.createEffect(\"depth\", attribs, uniforms, [\"diffuseSampler\", \"morphTargets\", \"boneSampler\"], join, undefined, undefined, undefined, {\n maxSimultaneousMorphTargets: numMorphInfluencers,\n }), join);\n }\n return drawWrapper.effect.isReady();\n }\n /**\n * Gets the texture which the depth map will be written to.\n * @returns The depth map texture\n */\n getDepthMap() {\n return this._depthMap;\n }\n /**\n * Disposes of the depth renderer.\n */\n dispose() {\n const keysToDelete = [];\n for (const key in this._scene._depthRenderer) {\n const depthRenderer = this._scene._depthRenderer[key];\n if (depthRenderer === this) {\n keysToDelete.push(key);\n }\n }\n if (keysToDelete.length > 0) {\n this._depthMap.dispose();\n for (const key of keysToDelete) {\n delete this._scene._depthRenderer[key];\n }\n }\n }\n}\n/**\n * @internal\n */\nDepthRenderer._SceneComponentInitialization = (_) => {\n throw _WarnImport(\"DepthRendererSceneComponent\");\n};\n//# sourceMappingURL=depthRenderer.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"pbrBRDFFunctions\";\nconst shader = `#define FRESNEL_MAXIMUM_ON_ROUGH 0.25\n#ifdef MS_BRDF_ENERGY_CONSERVATION\nvec3 getEnergyConservationFactor(const vec3 specularEnvironmentR0,const vec3 environmentBrdf) {return 1.0+specularEnvironmentR0*(1.0/environmentBrdf.y-1.0);}\n#endif\n#ifdef ENVIRONMENTBRDF\nvec3 getBRDFLookup(float NdotV,float perceptualRoughness) {vec2 UV=vec2(NdotV,perceptualRoughness);vec4 brdfLookup=texture2D(environmentBrdfSampler,UV);\n#ifdef ENVIRONMENTBRDF_RGBD\nbrdfLookup.rgb=fromRGBD(brdfLookup.rgba);\n#endif\nreturn brdfLookup.rgb;}\nvec3 getReflectanceFromBRDFLookup(const vec3 specularEnvironmentR0,const vec3 specularEnvironmentR90,const vec3 environmentBrdf) {\n#ifdef BRDF_V_HEIGHT_CORRELATED\nvec3 reflectance=(specularEnvironmentR90-specularEnvironmentR0)*environmentBrdf.x+specularEnvironmentR0*environmentBrdf.y;\n#else\nvec3 reflectance=specularEnvironmentR0*environmentBrdf.x+specularEnvironmentR90*environmentBrdf.y;\n#endif\nreturn reflectance;}\nvec3 getReflectanceFromBRDFLookup(const vec3 specularEnvironmentR0,const vec3 environmentBrdf) {\n#ifdef BRDF_V_HEIGHT_CORRELATED\nvec3 reflectance=mix(environmentBrdf.xxx,environmentBrdf.yyy,specularEnvironmentR0);\n#else\nvec3 reflectance=specularEnvironmentR0*environmentBrdf.x+environmentBrdf.y;\n#endif\nreturn reflectance;}\n#endif\n/* NOT USED\n#if defined(SHEEN) && defined(SHEEN_SOFTER)\nfloat getBRDFLookupCharlieSheen(float NdotV,float perceptualRoughness)\n{float c=1.0-NdotV;float c3=c*c*c;return 0.65584461*c3+1.0/(4.16526551+exp(-7.97291361*perceptualRoughness+6.33516894));}\n#endif\n*/\n#if !defined(ENVIRONMENTBRDF) || defined(REFLECTIONMAP_SKYBOX) || defined(ALPHAFRESNEL)\nvec3 getReflectanceFromAnalyticalBRDFLookup_Jones(float VdotN,vec3 reflectance0,vec3 reflectance90,float smoothness)\n{float weight=mix(FRESNEL_MAXIMUM_ON_ROUGH,1.0,smoothness);return reflectance0+weight*(reflectance90-reflectance0)*pow5(saturate(1.0-VdotN));}\n#endif\n#if defined(SHEEN) && defined(ENVIRONMENTBRDF)\n/**\n* The sheen BRDF not containing F can be easily stored in the blue channel of the BRDF texture.\n* The blue channel contains DCharlie*VAshikhmin*NdotL as a lokkup table\n*/\nvec3 getSheenReflectanceFromBRDFLookup(const vec3 reflectance0,const vec3 environmentBrdf) {vec3 sheenEnvironmentReflectance=reflectance0*environmentBrdf.b;return sheenEnvironmentReflectance;}\n#endif\nvec3 fresnelSchlickGGX(float VdotH,vec3 reflectance0,vec3 reflectance90)\n{return reflectance0+(reflectance90-reflectance0)*pow5(1.0-VdotH);}\nfloat fresnelSchlickGGX(float VdotH,float reflectance0,float reflectance90)\n{return reflectance0+(reflectance90-reflectance0)*pow5(1.0-VdotH);}\n#ifdef CLEARCOAT\nvec3 getR0RemappedForClearCoat(vec3 f0) {\n#ifdef CLEARCOAT_DEFAULTIOR\n#ifdef MOBILE\nreturn saturate(f0*(f0*0.526868+0.529324)-0.0482256);\n#else\nreturn saturate(f0*(f0*(0.941892-0.263008*f0)+0.346479)-0.0285998);\n#endif\n#else\nvec3 s=sqrt(f0);vec3 t=(vClearCoatRefractionParams.z+vClearCoatRefractionParams.w*s)/(vClearCoatRefractionParams.w+vClearCoatRefractionParams.z*s);return square(t);\n#endif\n}\n#endif\n#ifdef IRIDESCENCE\nconst mat3 XYZ_TO_REC709=mat3(\n3.2404542,-0.9692660, 0.0556434,\n-1.5371385, 1.8760108,-0.2040259,\n-0.4985314, 0.0415560, 1.0572252\n);vec3 getIORTfromAirToSurfaceR0(vec3 f0) {vec3 sqrtF0=sqrt(f0);return (1.+sqrtF0)/(1.-sqrtF0);}\nvec3 getR0fromIORs(vec3 iorT,float iorI) {return square((iorT-vec3(iorI))/(iorT+vec3(iorI)));}\nfloat getR0fromIORs(float iorT,float iorI) {return square((iorT-iorI)/(iorT+iorI));}\nvec3 evalSensitivity(float opd,vec3 shift) {float phase=2.0*PI*opd*1.0e-9;const vec3 val=vec3(5.4856e-13,4.4201e-13,5.2481e-13);const vec3 pos=vec3(1.6810e+06,1.7953e+06,2.2084e+06);const vec3 var=vec3(4.3278e+09,9.3046e+09,6.6121e+09);vec3 xyz=val*sqrt(2.0*PI*var)*cos(pos*phase+shift)*exp(-square(phase)*var);xyz.x+=9.7470e-14*sqrt(2.0*PI*4.5282e+09)*cos(2.2399e+06*phase+shift[0])*exp(-4.5282e+09*square(phase));xyz/=1.0685e-7;vec3 srgb=XYZ_TO_REC709*xyz;return srgb;}\nvec3 evalIridescence(float outsideIOR,float eta2,float cosTheta1,float thinFilmThickness,vec3 baseF0) {vec3 I=vec3(1.0);float iridescenceIOR=mix(outsideIOR,eta2,smoothstep(0.0,0.03,thinFilmThickness));float sinTheta2Sq=square(outsideIOR/iridescenceIOR)*(1.0-square(cosTheta1));float cosTheta2Sq=1.0-sinTheta2Sq;if (cosTheta2Sq<0.0) {return I;}\nfloat cosTheta2=sqrt(cosTheta2Sq);float R0=getR0fromIORs(iridescenceIOR,outsideIOR);float R12=fresnelSchlickGGX(cosTheta1,R0,1.);float R21=R12;float T121=1.0-R12;float phi12=0.0;if (iridescenceIOR0.01 and project within the valid screen rectangle\n\\param csDirection Unit length camera-space ray direction\n\\param projectToPixelMatrix A projection matrix that maps to **pixel** coordinates \n(**not** [-1,+1] normalized device coordinates).\n\\param csZBuffer The camera-space Z buffer\n\\param csZBufferSize Dimensions of csZBuffer\n\\param csZThickness Camera space csZThickness to ascribe to each pixel in the depth buffer\n\\param nearPlaneZ Positive number. Doesn't have to be THE actual near plane,just a reasonable value\nfor clipping rays headed towards the camera\n\\param stride Step in horizontal or vertical pixels between samples. This is a float\nbecause integer math is slow on GPUs,but should be set to an integer>=1\n\\param jitterFraction Number between 0 and 1 for how far to bump the ray in stride units\nto conceal banding artifacts,plus the stride ray offset.\n\\param maxSteps Maximum number of iterations. Higher gives better images but may be slow\n\\param maxRayTraceDistance Maximum camera-space distance to trace before returning a miss\n\\param selfCollisionNumSkip Number of steps to skip at start when raytracing to avoid self collisions.\n1 is a reasonable value,depending on the scene you may need to set this value to 2\n\\param hitPixel Pixel coordinates of the first intersection with the scene\n\\param numIterations number of iterations performed\n\\param csHitPoint Camera space location of the ray hit\n*/\n#define inline\nbool traceScreenSpaceRay1(\nvec3 csOrigin,\nvec3 csDirection,\nmat4 projectToPixelMatrix,\nsampler2D csZBuffer,\nvec2 csZBufferSize,\n#ifdef SSRAYTRACE_USE_BACK_DEPTHBUFFER\nsampler2D csZBackBuffer,\nfloat csZBackSizeFactor,\n#endif\nfloat csZThickness,\nfloat nearPlaneZ,\nfloat stride,\nfloat jitterFraction,\nfloat maxSteps,\nfloat maxRayTraceDistance,\nfloat selfCollisionNumSkip,\nout vec2 startPixel,\nout vec2 hitPixel,\nout vec3 csHitPoint,\nout float numIterations\n#ifdef SSRAYTRACE_DEBUG\n,out vec3 debugColor\n#endif\n)\n{\n#ifdef SSRAYTRACE_RIGHT_HANDED_SCENE\nfloat rayLength=(csOrigin.z+csDirection.z*maxRayTraceDistance)>-nearPlaneZ ? (-nearPlaneZ-csOrigin.z)/csDirection.z : maxRayTraceDistance;\n#else\nfloat rayLength=(csOrigin.z+csDirection.z*maxRayTraceDistance)yMax) || (P1.yyMax) ? yMax : yMin))/(P1.y-P0.y);}\nif ((P1.x>xMax) || (P1.xxMax) ? xMax : xMin))/(P1.x-P0.x));}\nP1=mix(P1,P0,alpha); k1=mix(k1,k0,alpha); Q1=mix(Q1,Q0,alpha);\n#endif\nP1+=vec2((distanceSquared(P0,P1)<0.0001) ? 0.01 : 0.0);vec2 delta=P1-P0;bool permute=false;if (abs(delta.x)rayZMax) { \nfloat t=rayZMin; rayZMin=rayZMax; rayZMax=t;}\nsceneZMax=texelFetch(csZBuffer,ivec2(hitPixel),0).r;\n#ifdef SSRAYTRACE_RIGHT_HANDED_SCENE\n#ifdef SSRAYTRACE_USE_BACK_DEPTHBUFFER\nfloat sceneBackZ=texelFetch(csZBackBuffer,ivec2(hitPixel/csZBackSizeFactor),0).r;hit=(rayZMax>=sceneBackZ-csZThickness) && (rayZMin<=sceneZMax);\n#else\nhit=(rayZMax>=sceneZMax-csZThickness) && (rayZMin<=sceneZMax);\n#endif\n#else\n#ifdef SSRAYTRACE_USE_BACK_DEPTHBUFFER\nfloat sceneBackZ=texelFetch(csZBackBuffer,ivec2(hitPixel/csZBackSizeFactor),0).r;hit=(rayZMin<=sceneBackZ+csZThickness) && (rayZMax>=sceneZMax) && (sceneZMax != 0.0);\n#else\nhit=(rayZMin<=sceneZMax+csZThickness) && (rayZMax>=sceneZMax);\n#endif\n#endif\n}\npqk-=dPQK;stepCount-=1.0;if (((pqk.x+dPQK.x)*stepDirection)>end || (stepCount+1.0)>=maxSteps || sceneZMax==0.0) {hit=false;}\n#ifdef SSRAYTRACE_ENABLE_REFINEMENT\nif (stride>1.0 && hit) {pqk-=dPQK;stepCount-=1.0;float invStride=1.0/stride;dPQK*=invStride;float refinementStepCount=0.0;prevZMaxEstimate=pqk.z/pqk.w;rayZMax=prevZMaxEstimate;sceneZMax=rayZMax+1e7;for (;refinementStepCount<=1.0 ||\n(refinementStepCount<=stride*1.4) &&\n(rayZMaxend) {debugColor=vec3(0,0,1);} else if ((stepCount+1.0)>=maxSteps) {debugColor=vec3(1,0,0);} else if (sceneZMax==0.0) {debugColor=vec3(1,1,0);} else {debugColor=vec3(0,stepCount/maxSteps,0);}\n#endif\nreturn hit;}\n/**\ntexCoord: in the [0,1] range\ndepth: depth in view space (range [znear,zfar]])\n*/\nvec3 computeViewPosFromUVDepth(vec2 texCoord,float depth,mat4 projection,mat4 invProjectionMatrix) {vec4 ndc;ndc.xy=texCoord*2.0-1.0;\n#ifdef SSRAYTRACE_RIGHT_HANDED_SCENE\nndc.z=-projection[2].z-projection[3].z/depth;\n#else\nndc.z=projection[2].z+projection[3].z/depth;\n#endif\nndc.w=1.0;vec4 eyePos=invProjectionMatrix*ndc;eyePos.xyz/=eyePos.w;return eyePos.xyz;}\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const screenSpaceRayTrace = { name, shader };\n//# sourceMappingURL=screenSpaceRayTrace.js.map","// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore.js\";\nimport \"./ShadersInclude/helperFunctions.js\";\nimport \"./ShadersInclude/pbrBRDFFunctions.js\";\nimport \"./ShadersInclude/screenSpaceRayTrace.js\";\nconst name = \"screenSpaceReflection2PixelShader\";\nconst shader = `#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)\n#define TEXTUREFUNC(s,c,lod) texture2DLodEXT(s,c,lod)\n#define TEXTURECUBEFUNC(s,c,lod) textureLod(s,c,lod)\n#else\n#define TEXTUREFUNC(s,c,bias) texture2D(s,c,bias)\n#define TEXTURECUBEFUNC(s,c,bias) textureCube(s,c,bias)\n#endif\nuniform sampler2D textureSampler;varying vec2 vUV;\n#ifdef SSR_SUPPORTED\nuniform sampler2D reflectivitySampler;uniform sampler2D normalSampler;uniform sampler2D depthSampler;\n#ifdef SSRAYTRACE_USE_BACK_DEPTHBUFFER\nuniform sampler2D backDepthSampler;uniform float backSizeFactor;\n#endif\n#ifdef SSR_USE_ENVIRONMENT_CUBE\nuniform samplerCube envCubeSampler;\n#ifdef SSR_USE_LOCAL_REFLECTIONMAP_CUBIC\nuniform vec3 vReflectionPosition;uniform vec3 vReflectionSize;\n#endif\n#endif\nuniform mat4 view;uniform mat4 invView;uniform mat4 projection;uniform mat4 invProjectionMatrix;uniform mat4 projectionPixel;uniform float nearPlaneZ;uniform float stepSize;uniform float maxSteps;uniform float strength;uniform float thickness;uniform float roughnessFactor;uniform float reflectionSpecularFalloffExponent;uniform float maxDistance;uniform float selfCollisionNumSkip;uniform float reflectivityThreshold;\n#include\n#include\n#include\nvec3 hash(vec3 a)\n{a=fract(a*0.8);a+=dot(a,a.yxz+19.19);return fract((a.xxy+a.yxx)*a.zyx);}\nfloat computeAttenuationForIntersection(ivec2 hitPixel,vec2 hitUV,vec3 vsRayOrigin,vec3 vsHitPoint,vec3 reflectionVector,float maxRayDistance,float numIterations) {float attenuation=1.0;\n#ifdef SSR_ATTENUATE_SCREEN_BORDERS\nvec2 dCoords=smoothstep(0.2,0.6,abs(vec2(0.5,0.5)-hitUV.xy));attenuation*=clamp(1.0-(dCoords.x+dCoords.y),0.0,1.0);\n#endif\n#ifdef SSR_ATTENUATE_INTERSECTION_DISTANCE\nattenuation*=1.0-clamp(distance(vsRayOrigin,vsHitPoint)/maxRayDistance,0.0,1.0);\n#endif\n#ifdef SSR_ATTENUATE_INTERSECTION_NUMITERATIONS\nattenuation*=1.0-(numIterations/maxSteps);\n#endif\n#ifdef SSR_ATTENUATE_BACKFACE_REFLECTION\nvec3 reflectionNormal=texelFetch(normalSampler,hitPixel,0).xyz;float directionBasedAttenuation=smoothstep(-0.17,0.0,dot(reflectionNormal,-reflectionVector));attenuation*=directionBasedAttenuation;\n#endif\nreturn attenuation;}\n#endif\nvoid main()\n{\n#ifdef SSR_SUPPORTED\nvec4 colorFull=TEXTUREFUNC(textureSampler,vUV,0.0);vec3 color=colorFull.rgb;vec4 reflectivity=TEXTUREFUNC(reflectivitySampler,vUV,0.0);\n#ifndef SSR_DISABLE_REFLECTIVITY_TEST\nif (max(reflectivity.r,max(reflectivity.g,reflectivity.b))<=reflectivityThreshold) {\n#ifdef SSR_USE_BLUR\ngl_FragColor=vec4(0.);\n#else\ngl_FragColor=colorFull;\n#endif\nreturn;}\n#endif\n#ifdef SSR_INPUT_IS_GAMMA_SPACE\ncolor=toLinearSpace(color);\n#endif\nvec2 texSize=vec2(textureSize(depthSampler,0));vec3 csNormal=texelFetch(normalSampler,ivec2(vUV*texSize),0).xyz; \nfloat depth=texelFetch(depthSampler,ivec2(vUV*texSize),0).r;vec3 csPosition=computeViewPosFromUVDepth(vUV,depth,projection,invProjectionMatrix);vec3 csViewDirection=normalize(csPosition);vec3 csReflectedVector=reflect(csViewDirection,csNormal);\n#ifdef SSR_USE_ENVIRONMENT_CUBE\nvec3 wReflectedVector=vec3(invView*vec4(csReflectedVector,0.0));\n#ifdef SSR_USE_LOCAL_REFLECTIONMAP_CUBIC\nvec4 worldPos=invView*vec4(csPosition,1.0);wReflectedVector=parallaxCorrectNormal(worldPos.xyz,normalize(wReflectedVector),vReflectionSize,vReflectionPosition);\n#endif\n#ifdef SSR_INVERTCUBICMAP\nwReflectedVector.y*=-1.0;\n#endif\n#ifdef SSRAYTRACE_RIGHT_HANDED_SCENE\nwReflectedVector.z*=-1.0;\n#endif\nvec3 envColor=TEXTURECUBEFUNC(envCubeSampler,wReflectedVector,0.0).xyz;\n#ifdef SSR_ENVIRONMENT_CUBE_IS_GAMMASPACE\nenvColor=toLinearSpace(envColor);\n#endif\n#else\nvec3 envColor=color;\n#endif\nfloat reflectionAttenuation=1.0;bool rayHasHit=false;vec2 startPixel;vec2 hitPixel;vec3 hitPoint;float numIterations;\n#ifdef SSRAYTRACE_DEBUG\nvec3 debugColor;\n#endif\n#ifdef SSR_ATTENUATE_FACING_CAMERA\nreflectionAttenuation*=1.0-smoothstep(0.25,0.5,dot(-csViewDirection,csReflectedVector));\n#endif\nif (reflectionAttenuation>0.0) {\n#ifdef SSR_USE_BLUR\nvec3 jitt=vec3(0.);\n#else\nfloat roughness=1.0-reflectivity.a;vec3 jitt=mix(vec3(0.0),hash(csPosition)-vec3(0.5),roughness)*roughnessFactor; \n#endif\nvec2 uv2=vUV*texSize;float c=(uv2.x+uv2.y)*0.25;float jitter=mod(c,1.0); \nrayHasHit=traceScreenSpaceRay1(\ncsPosition,\nnormalize(csReflectedVector+jitt),\nprojectionPixel,\ndepthSampler,\ntexSize,\n#ifdef SSRAYTRACE_USE_BACK_DEPTHBUFFER\nbackDepthSampler,\nbackSizeFactor,\n#endif\nthickness,\nnearPlaneZ,\nstepSize,\njitter,\nmaxSteps,\nmaxDistance,\nselfCollisionNumSkip,\nstartPixel,\nhitPixel,\nhitPoint,\nnumIterations\n#ifdef SSRAYTRACE_DEBUG\n,debugColor\n#endif\n);}\n#ifdef SSRAYTRACE_DEBUG\ngl_FragColor=vec4(debugColor,1.);return;\n#endif\nvec3 F0=reflectivity.rgb;vec3 fresnel=fresnelSchlickGGX(max(dot(csNormal,-csViewDirection),0.0),F0,vec3(1.));vec3 SSR=envColor;if (rayHasHit) {vec3 reflectedColor=texelFetch(textureSampler,ivec2(hitPixel),0).rgb;\n#ifdef SSR_INPUT_IS_GAMMA_SPACE\nreflectedColor=toLinearSpace(reflectedColor);\n#endif\nreflectionAttenuation*=computeAttenuationForIntersection(ivec2(hitPixel),hitPixel/texSize,csPosition,hitPoint,csReflectedVector,maxDistance,numIterations);SSR=reflectedColor*reflectionAttenuation+(1.0-reflectionAttenuation)*envColor;}\n#ifndef SSR_BLEND_WITH_FRESNEL\nSSR*=fresnel;\n#endif\n#ifdef SSR_USE_BLUR\nfloat blur_radius=0.0;float roughness=1.0-reflectivity.a*(1.0-roughnessFactor);if (roughness>0.001) {float cone_angle=min(roughness,0.999)*3.14159265*0.5;float cone_len=distance(startPixel,hitPixel);float op_len=2.0*tan(cone_angle)*cone_len; \nfloat a=op_len;float h=cone_len;float a2=a*a;float fh2=4.0f*h*h;blur_radius=(a*(sqrt(a2+fh2)-a))/(4.0f*h);}\ngl_FragColor=vec4(SSR,blur_radius/255.0); \n#else\n#ifdef SSR_BLEND_WITH_FRESNEL\nvec3 reflectionMultiplier=clamp(pow(fresnel*strength,vec3(reflectionSpecularFalloffExponent)),0.0,1.0);\n#else\nvec3 reflectionMultiplier=clamp(pow(reflectivity.rgb*strength,vec3(reflectionSpecularFalloffExponent)),0.0,1.0);\n#endif\nvec3 colorMultiplier=1.0-reflectionMultiplier;vec3 finalColor=(color*colorMultiplier)+(SSR*reflectionMultiplier);\n#ifdef SSR_OUTPUT_IS_GAMMA_SPACE\nfinalColor=toGammaSpace(finalColor);\n#endif\ngl_FragColor=vec4(finalColor,colorFull.a);\n#endif\n#else\ngl_FragColor=TEXTUREFUNC(textureSampler,vUV,0.0);\n#endif\n}\n`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @internal */\nexport const screenSpaceReflection2PixelShader = { name, shader };\n//# sourceMappingURL=screenSpaceReflection2.fragment.js.map","// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore.js\";\nconst name = \"screenSpaceReflection2BlurPixelShader\";\nconst shader = `#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)\n#define TEXTUREFUNC(s,c,lod) texture2DLodEXT(s,c,lod)\n#else\n#define TEXTUREFUNC(s,c,bias) texture2D(s,c,bias)\n#endif\nuniform sampler2D textureSampler;varying vec2 vUV;uniform vec2 texelOffsetScale;const float weights[8]=float[8] (0.071303,0.131514,0.189879,0.321392,0.452906, 0.584419,0.715932,0.847445);void processSample(vec2 uv,float i,vec2 stepSize,inout vec4 accumulator,inout float denominator)\n{vec2 offsetUV=stepSize*i+uv;float coefficient=weights[int(2.0-abs(i))];accumulator+=TEXTUREFUNC(textureSampler,offsetUV,0.0)*coefficient;denominator+=coefficient;}\nvoid main()\n{vec4 colorFull=TEXTUREFUNC(textureSampler,vUV,0.0);if (dot(colorFull,vec4(1.0))==0.0) {gl_FragColor=colorFull;return;}\nfloat blurRadius=colorFull.a*255.0; \nvec2 stepSize=texelOffsetScale.xy*blurRadius;vec4 accumulator=TEXTUREFUNC(textureSampler,vUV,0.0)*0.214607;float denominator=0.214607;processSample(vUV,1.0,stepSize,accumulator,denominator);processSample(vUV,1.0*0.2,stepSize,accumulator,denominator);processSample(vUV,1.0*0.4,stepSize,accumulator,denominator);processSample(vUV,1.0*0.6,stepSize,accumulator,denominator);processSample(vUV,1.0*0.8,stepSize,accumulator,denominator);processSample(vUV,1.0*1.2,stepSize,accumulator,denominator);processSample(vUV,1.0*1.4,stepSize,accumulator,denominator);processSample(vUV,1.0*1.6,stepSize,accumulator,denominator);processSample(vUV,1.0*1.8,stepSize,accumulator,denominator);processSample(vUV,1.0*2.0,stepSize,accumulator,denominator);processSample(vUV,-1.0,stepSize,accumulator,denominator);processSample(vUV,-1.0*0.2,stepSize,accumulator,denominator);processSample(vUV,-1.0*0.4,stepSize,accumulator,denominator);processSample(vUV,-1.0*0.6,stepSize,accumulator,denominator);processSample(vUV,-1.0*0.8,stepSize,accumulator,denominator);processSample(vUV,-1.0*1.2,stepSize,accumulator,denominator);processSample(vUV,-1.0*1.4,stepSize,accumulator,denominator);processSample(vUV,-1.0*1.6,stepSize,accumulator,denominator);processSample(vUV,-1.0*1.8,stepSize,accumulator,denominator);processSample(vUV,-1.0*2.0,stepSize,accumulator,denominator);gl_FragColor=vec4(accumulator.rgb/denominator,colorFull.a);}\n`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @internal */\nexport const screenSpaceReflection2BlurPixelShader = { name, shader };\n//# sourceMappingURL=screenSpaceReflection2Blur.fragment.js.map","// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore.js\";\nimport \"./ShadersInclude/helperFunctions.js\";\nimport \"./ShadersInclude/pbrBRDFFunctions.js\";\nimport \"./ShadersInclude/screenSpaceRayTrace.js\";\nconst name = \"screenSpaceReflection2BlurCombinerPixelShader\";\nconst shader = `uniform sampler2D textureSampler; \nuniform sampler2D mainSampler;uniform sampler2D reflectivitySampler;uniform float strength;uniform float reflectionSpecularFalloffExponent;uniform float reflectivityThreshold;varying vec2 vUV;\n#include\n#ifdef SSR_BLEND_WITH_FRESNEL\n#include\n#include\nuniform mat4 projection;uniform mat4 invProjectionMatrix;uniform sampler2D normalSampler;uniform sampler2D depthSampler;\n#endif\nvoid main()\n{\n#ifdef SSRAYTRACE_DEBUG\ngl_FragColor=texture2D(textureSampler,vUV);\n#else\nvec3 SSR=texture2D(textureSampler,vUV).rgb;vec4 color=texture2D(mainSampler,vUV);vec4 reflectivity=texture2D(reflectivitySampler,vUV);\n#ifndef SSR_DISABLE_REFLECTIVITY_TEST\nif (max(reflectivity.r,max(reflectivity.g,reflectivity.b))<=reflectivityThreshold) {gl_FragColor=color;return;}\n#endif\n#ifdef SSR_INPUT_IS_GAMMA_SPACE\ncolor=toLinearSpace(color);\n#endif\n#ifdef SSR_BLEND_WITH_FRESNEL\nvec2 texSize=vec2(textureSize(depthSampler,0));vec3 csNormal=texelFetch(normalSampler,ivec2(vUV*texSize),0).xyz;float depth=texelFetch(depthSampler,ivec2(vUV*texSize),0).r;vec3 csPosition=computeViewPosFromUVDepth(vUV,depth,projection,invProjectionMatrix);vec3 csViewDirection=normalize(csPosition);vec3 F0=reflectivity.rgb;vec3 fresnel=fresnelSchlickGGX(max(dot(csNormal,-csViewDirection),0.0),F0,vec3(1.));vec3 reflectionMultiplier=clamp(pow(fresnel*strength,vec3(reflectionSpecularFalloffExponent)),0.0,1.0);\n#else\nvec3 reflectionMultiplier=clamp(pow(reflectivity.rgb*strength,vec3(reflectionSpecularFalloffExponent)),0.0,1.0);\n#endif\nvec3 colorMultiplier=1.0-reflectionMultiplier;vec3 finalColor=(color.rgb*colorMultiplier)+(SSR*reflectionMultiplier);\n#ifdef SSR_OUTPUT_IS_GAMMA_SPACE\nfinalColor=toGammaSpace(finalColor);\n#endif\ngl_FragColor=vec4(finalColor,color.a);\n#endif\n}\n`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @internal */\nexport const screenSpaceReflection2BlurCombinerPixelShader = { name, shader };\n//# sourceMappingURL=screenSpaceReflection2BlurCombiner.fragment.js.map","import { __decorate } from \"../../../tslib.es6.js\";\n/* eslint-disable @typescript-eslint/naming-convention */\nimport { serialize, SerializationHelper } from \"../../../Misc/decorators.js\";\nimport { Vector3, Matrix, Quaternion, TmpVectors } from \"../../../Maths/math.vector.js\";\nimport { PostProcess } from \"../../postProcess.js\";\nimport { PostProcessRenderPipeline } from \"../postProcessRenderPipeline.js\";\nimport { PostProcessRenderEffect } from \"../postProcessRenderEffect.js\";\nimport { RegisterClass } from \"../../../Misc/typeStore.js\";\nimport { ScreenSpaceReflections2Configuration } from \"../../../Rendering/screenSpaceReflections2Configuration.js\";\nimport { GeometryBufferRenderer } from \"../../../Rendering/geometryBufferRenderer.js\";\n\nimport { DepthRenderer } from \"../../../Rendering/depthRenderer.js\";\nimport \"../postProcessRenderPipelineManagerSceneComponent.js\";\nimport \"../../../Shaders/screenSpaceReflection2.fragment.js\";\nimport \"../../../Shaders/screenSpaceReflection2Blur.fragment.js\";\nimport \"../../../Shaders/screenSpaceReflection2BlurCombiner.fragment.js\";\nconst trs = Matrix.Compose(new Vector3(0.5, 0.5, 0.5), Quaternion.Identity(), new Vector3(0.5, 0.5, 0.5));\nconst trsWebGPU = Matrix.Compose(new Vector3(0.5, 0.5, 1), Quaternion.Identity(), new Vector3(0.5, 0.5, 0));\n/**\n * Render pipeline to produce Screen Space Reflections (SSR) effect\n *\n * References:\n * Screen Space Ray Tracing:\n * - http://casual-effects.blogspot.com/2014/08/screen-space-ray-tracing.html\n * - https://sourceforge.net/p/g3d/code/HEAD/tree/G3D10/data-files/shader/screenSpaceRayTrace.glsl\n * - https://github.com/kode80/kode80SSR\n * SSR:\n * - general tips: https://sakibsaikia.github.io/graphics/2016/12/26/Screen-Space-Reflection-in-Killing-Floor-2.html\n * - computation of blur radius from roughness and distance: https://github.com/godotengine/godot/blob/master/servers/rendering/renderer_rd/shaders/effects/screen_space_reflection.glsl\n * - blur and usage of back depth buffer: https://github.com/kode80/kode80SSR\n */\nexport class SSRRenderingPipeline extends PostProcessRenderPipeline {\n /**\n * MSAA sample count, setting this to 4 will provide 4x anti aliasing. (default: 1)\n */\n set samples(sampleCount) {\n if (this._samples === sampleCount) {\n return;\n }\n this._samples = sampleCount;\n this._buildPipeline();\n }\n get samples() {\n return this._samples;\n }\n /**\n * Gets or sets the minimum value for one of the reflectivity component of the material to consider it for SSR (default: 0.04).\n * If all r/g/b components of the reflectivity is below or equal this value, the pixel will not be considered reflective and SSR won't be applied.\n */\n get reflectivityThreshold() {\n return this._reflectivityThreshold;\n }\n set reflectivityThreshold(threshold) {\n if (threshold === this._reflectivityThreshold) {\n return;\n }\n if ((threshold === 0 && this._reflectivityThreshold !== 0) || (threshold !== 0 && this._reflectivityThreshold === 0)) {\n this._reflectivityThreshold = threshold;\n this._buildPipeline();\n }\n else {\n this._reflectivityThreshold = threshold;\n }\n }\n /**\n * Gets or sets the downsample factor used to reduce the size of the texture used to compute the SSR contribution (default: 0).\n * Use 0 to render the SSR contribution at full resolution, 1 to render at half resolution, 2 to render at 1/3 resolution, etc.\n * Note that it is used only when blurring is enabled (blurDispersionStrength \\> 0), because in that mode the SSR contribution is generated in a separate texture.\n */\n get ssrDownsample() {\n return this._ssrDownsample;\n }\n set ssrDownsample(downsample) {\n if (downsample === this._ssrDownsample) {\n return;\n }\n this._ssrDownsample = downsample;\n this._buildPipeline();\n }\n /**\n * Gets or sets the blur dispersion strength. Set this value to 0 to disable blurring (default: 0.05)\n * The reflections are blurred based on the roughness of the surface and the distance between the pixel shaded and the reflected pixel: the higher the distance the more blurry the reflection is.\n * blurDispersionStrength allows to increase or decrease this effect.\n */\n get blurDispersionStrength() {\n return this._blurDispersionStrength;\n }\n set blurDispersionStrength(strength) {\n if (strength === this._blurDispersionStrength) {\n return;\n }\n const rebuild = (strength === 0 && this._blurDispersionStrength !== 0) || (strength !== 0 && this._blurDispersionStrength === 0);\n this._blurDispersionStrength = strength;\n if (rebuild) {\n this._buildPipeline();\n }\n }\n _useBlur() {\n return this._blurDispersionStrength > 0;\n }\n /**\n * Gets or sets the downsample factor used to reduce the size of the textures used to blur the reflection effect (default: 0).\n * Use 0 to blur at full resolution, 1 to render at half resolution, 2 to render at 1/3 resolution, etc.\n */\n get blurDownsample() {\n return this._blurDownsample;\n }\n set blurDownsample(downsample) {\n if (downsample === this._blurDownsample) {\n return;\n }\n this._blurDownsample = downsample;\n this._buildPipeline();\n }\n /**\n * Gets or sets whether or not smoothing reflections is enabled (default: false)\n * Enabling smoothing will require more GPU power.\n * Note that this setting has no effect if step = 1: it's only used if step \\> 1.\n */\n get enableSmoothReflections() {\n return this._enableSmoothReflections;\n }\n set enableSmoothReflections(enabled) {\n if (enabled === this._enableSmoothReflections) {\n return;\n }\n this._enableSmoothReflections = enabled;\n this._updateEffectDefines();\n }\n /**\n * Gets or sets the environment cube texture used to define the reflection when the reflected rays of SSR leave the view space or when the maxDistance/maxSteps is reached.\n */\n get environmentTexture() {\n return this._environmentTexture;\n }\n set environmentTexture(texture) {\n this._environmentTexture = texture;\n this._updateEffectDefines();\n }\n /**\n * Gets or sets the boolean defining if the environment texture is a standard cubemap (false) or a probe (true). Default value is false.\n * Note: a probe cube texture is treated differently than an ordinary cube texture because the Y axis is reversed.\n */\n get environmentTextureIsProbe() {\n return this._environmentTextureIsProbe;\n }\n set environmentTextureIsProbe(isProbe) {\n this._environmentTextureIsProbe = isProbe;\n this._updateEffectDefines();\n }\n /**\n * Gets or sets a boolean indicating if the reflections should be attenuated at the screen borders (default: true).\n */\n get attenuateScreenBorders() {\n return this._attenuateScreenBorders;\n }\n set attenuateScreenBorders(attenuate) {\n if (this._attenuateScreenBorders === attenuate) {\n return;\n }\n this._attenuateScreenBorders = attenuate;\n this._updateEffectDefines();\n }\n /**\n * Gets or sets a boolean indicating if the reflections should be attenuated according to the distance of the intersection (default: true).\n */\n get attenuateIntersectionDistance() {\n return this._attenuateIntersectionDistance;\n }\n set attenuateIntersectionDistance(attenuate) {\n if (this._attenuateIntersectionDistance === attenuate) {\n return;\n }\n this._attenuateIntersectionDistance = attenuate;\n this._updateEffectDefines();\n }\n /**\n * Gets or sets a boolean indicating if the reflections should be attenuated according to the number of iterations performed to find the intersection (default: true).\n */\n get attenuateIntersectionIterations() {\n return this._attenuateIntersectionIterations;\n }\n set attenuateIntersectionIterations(attenuate) {\n if (this._attenuateIntersectionIterations === attenuate) {\n return;\n }\n this._attenuateIntersectionIterations = attenuate;\n this._updateEffectDefines();\n }\n /**\n * Gets or sets a boolean indicating if the reflections should be attenuated when the reflection ray is facing the camera (the view direction) (default: false).\n */\n get attenuateFacingCamera() {\n return this._attenuateFacingCamera;\n }\n set attenuateFacingCamera(attenuate) {\n if (this._attenuateFacingCamera === attenuate) {\n return;\n }\n this._attenuateFacingCamera = attenuate;\n this._updateEffectDefines();\n }\n /**\n * Gets or sets a boolean indicating if the backface reflections should be attenuated (default: false).\n */\n get attenuateBackfaceReflection() {\n return this._attenuateBackfaceReflection;\n }\n set attenuateBackfaceReflection(attenuate) {\n if (this._attenuateBackfaceReflection === attenuate) {\n return;\n }\n this._attenuateBackfaceReflection = attenuate;\n this._updateEffectDefines();\n }\n /**\n * Gets or sets a boolean indicating if the ray should be clipped to the frustum (default: true).\n * You can try to set this parameter to false to save some performances: it may produce some artefacts in some cases, but generally they won't really be visible\n */\n get clipToFrustum() {\n return this._clipToFrustum;\n }\n set clipToFrustum(clip) {\n if (this._clipToFrustum === clip) {\n return;\n }\n this._clipToFrustum = clip;\n this._updateEffectDefines();\n }\n /**\n * Gets or sets a boolean indicating whether the blending between the current color pixel and the reflection color should be done with a Fresnel coefficient (default: false).\n * It is more physically accurate to use the Fresnel coefficient (otherwise it uses the reflectivity of the material for blending), but it is also more expensive when you use blur (when blurDispersionStrength \\> 0).\n */\n get useFresnel() {\n return this._useFresnel;\n }\n set useFresnel(fresnel) {\n if (this._useFresnel === fresnel) {\n return;\n }\n this._useFresnel = fresnel;\n this._buildPipeline();\n }\n /**\n * Gets or sets a boolean defining if geometry thickness should be computed automatically (default: false).\n * When enabled, a depth renderer is created which will render the back faces of the scene to a depth texture (meaning additional work for the GPU).\n * In that mode, the \"thickness\" property is still used as an offset to compute the ray intersection, but you can typically use a much lower\n * value than when enableAutomaticThicknessComputation is false (it's even possible to use a value of 0 when using low values for \"step\")\n * Note that for performance reasons, this option will only apply to the first camera to which the the rendering pipeline is attached!\n */\n get enableAutomaticThicknessComputation() {\n return this._enableAutomaticThicknessComputation;\n }\n set enableAutomaticThicknessComputation(automatic) {\n if (this._enableAutomaticThicknessComputation === automatic) {\n return;\n }\n this._enableAutomaticThicknessComputation = automatic;\n this._buildPipeline();\n }\n /**\n * Gets the depth renderer used to render the back faces of the scene to a depth texture.\n */\n get backfaceDepthRenderer() {\n return this._depthRenderer;\n }\n /**\n * Gets or sets the downsample factor (default: 0) used to create the backface depth texture - used only if enableAutomaticThicknessComputation = true.\n * Use 0 to render the depth at full resolution, 1 to render at half resolution, 2 to render at 1/4 resolution, etc.\n * Note that you will get rendering artefacts when using a value different from 0: it's a tradeoff between image quality and performances.\n */\n get backfaceDepthTextureDownsample() {\n return this._backfaceDepthTextureDownsample;\n }\n set backfaceDepthTextureDownsample(factor) {\n if (this._backfaceDepthTextureDownsample === factor) {\n return;\n }\n this._backfaceDepthTextureDownsample = factor;\n this._resizeDepthRenderer();\n }\n /**\n * Gets or sets a boolean (default: true) indicating if the depth of transparent meshes should be written to the backface depth texture (when automatic thickness computation is enabled).\n */\n get backfaceForceDepthWriteTransparentMeshes() {\n return this._backfaceForceDepthWriteTransparentMeshes;\n }\n set backfaceForceDepthWriteTransparentMeshes(force) {\n if (this._backfaceForceDepthWriteTransparentMeshes === force) {\n return;\n }\n this._backfaceForceDepthWriteTransparentMeshes = force;\n if (this._depthRenderer) {\n this._depthRenderer.forceDepthWriteTransparentMeshes = force;\n }\n }\n /**\n * Gets or sets a boolean indicating if the effect is enabled (default: true).\n */\n get isEnabled() {\n return this._isEnabled;\n }\n set isEnabled(value) {\n if (this._isEnabled === value) {\n return;\n }\n this._isEnabled = value;\n if (!value) {\n if (this._cameras !== null) {\n this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name, this._cameras);\n this._cameras = this._camerasToBeAttached.slice();\n }\n }\n else if (value) {\n if (!this._isDirty) {\n if (this._cameras !== null) {\n this._scene.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(this._name, this._cameras);\n }\n }\n else {\n this._buildPipeline();\n }\n }\n }\n /**\n * Gets or sets a boolean defining if the input color texture is in gamma space (default: true)\n * The SSR effect works in linear space, so if the input texture is in gamma space, we must convert the texture to linear space before applying the effect\n */\n get inputTextureColorIsInGammaSpace() {\n return this._inputTextureColorIsInGammaSpace;\n }\n set inputTextureColorIsInGammaSpace(gammaSpace) {\n if (this._inputTextureColorIsInGammaSpace === gammaSpace) {\n return;\n }\n this._inputTextureColorIsInGammaSpace = gammaSpace;\n this._buildPipeline();\n }\n /**\n * Gets or sets a boolean defining if the output color texture generated by the SSR pipeline should be in gamma space (default: true)\n * If you have a post-process that comes after the SSR and that post-process needs the input to be in a linear space, you must disable generateOutputInGammaSpace\n */\n get generateOutputInGammaSpace() {\n return this._generateOutputInGammaSpace;\n }\n set generateOutputInGammaSpace(gammaSpace) {\n if (this._generateOutputInGammaSpace === gammaSpace) {\n return;\n }\n this._generateOutputInGammaSpace = gammaSpace;\n this._buildPipeline();\n }\n /**\n * Gets or sets a boolean indicating if the effect should be rendered in debug mode (default: false).\n * In this mode, colors have this meaning:\n * - blue: the ray hit the max distance (we reached maxDistance)\n * - red: the ray ran out of steps (we reached maxSteps)\n * - yellow: the ray went off screen\n * - green: the ray hit a surface. The brightness of the green color is proportional to the distance between the ray origin and the intersection point: A brighter green means more computation than a darker green.\n * In the first 3 cases, the final color is calculated by mixing the skybox color with the pixel color (if environmentTexture is defined), otherwise the pixel color is not modified\n * You should try to get as few blue/red/yellow pixels as possible, as this means that the ray has gone further than if it had hit a surface.\n */\n get debug() {\n return this._debug;\n }\n set debug(value) {\n if (this._debug === value) {\n return;\n }\n this._debug = value;\n this._buildPipeline();\n }\n /**\n * Gets the scene the effect belongs to.\n * @returns the scene the effect belongs to.\n */\n getScene() {\n return this._scene;\n }\n get _geometryBufferRenderer() {\n if (!this._forceGeometryBuffer) {\n return null;\n }\n return this._scene.geometryBufferRenderer;\n }\n get _prePassRenderer() {\n if (this._forceGeometryBuffer) {\n return null;\n }\n return this._scene.prePassRenderer;\n }\n /**\n * Gets active scene\n */\n get scene() {\n return this._scene;\n }\n /**\n * Returns true if SSR is supported by the running hardware\n */\n get isSupported() {\n const caps = this._scene.getEngine().getCaps();\n return caps.drawBuffersExtension && caps.texelFetch;\n }\n /**\n * Constructor of the SSR rendering pipeline\n * @param name The rendering pipeline name\n * @param scene The scene linked to this pipeline\n * @param cameras The array of cameras that the rendering pipeline will be attached to (default: scene.cameras)\n * @param forceGeometryBuffer Set to true if you want to use the legacy geometry buffer renderer (default: false)\n * @param textureType The texture type used by the different post processes created by SSR (default: 0)\n */\n constructor(name, scene, cameras, forceGeometryBuffer = false, textureType = 0) {\n super(scene.getEngine(), name);\n /**\n * The SSR PostProcess effect id in the pipeline\n */\n this.SSRRenderEffect = \"SSRRenderEffect\";\n /**\n * The blur PostProcess effect id in the pipeline\n */\n this.SSRBlurRenderEffect = \"SSRBlurRenderEffect\";\n /**\n * The PostProcess effect id in the pipeline that combines the SSR-Blur output with the original scene color\n */\n this.SSRCombineRenderEffect = \"SSRCombineRenderEffect\";\n this._samples = 1;\n /**\n * Gets or sets the maxDistance used to define how far we look for reflection during the ray-marching on the reflected ray (default: 1000).\n * Note that this value is a view (camera) space distance (not pixels!).\n */\n this.maxDistance = 1000.0;\n /**\n * Gets or sets the step size used to iterate until the effect finds the color of the reflection's pixel. Should be an integer \\>= 1 as it is the number of pixels we advance at each step (default: 1).\n * Use higher values to improve performances (but at the expense of quality).\n */\n this.step = 1.0;\n /**\n * Gets or sets the thickness value used as tolerance when computing the intersection between the reflected ray and the scene (default: 0.5).\n * If setting \"enableAutomaticThicknessComputation\" to true, you can use lower values for \"thickness\" (even 0), as the geometry thickness\n * is automatically computed thank to the regular depth buffer + the backface depth buffer\n */\n this.thickness = 0.5;\n /**\n * Gets or sets the current reflection strength. 1.0 is an ideal value but can be increased/decreased for particular results (default: 1).\n */\n this.strength = 1;\n /**\n * Gets or sets the falloff exponent used to compute the reflection strength. Higher values lead to fainter reflections (default: 1).\n */\n this.reflectionSpecularFalloffExponent = 1;\n /**\n * Maximum number of steps during the ray marching process after which we consider an intersection could not be found (default: 1000).\n * Should be an integer value.\n */\n this.maxSteps = 1000.0;\n /**\n * Gets or sets the factor applied when computing roughness. Default value is 0.2.\n * When blurring based on roughness is enabled (meaning blurDispersionStrength \\> 0), roughnessFactor is used as a global roughness factor applied on all objects.\n * If you want to disable this global roughness set it to 0.\n */\n this.roughnessFactor = 0.2;\n /**\n * Number of steps to skip at start when marching the ray to avoid self collisions (default: 1)\n * 1 should normally be a good value, depending on the scene you may need to use a higher value (2 or 3)\n */\n this.selfCollisionNumSkip = 1;\n this._reflectivityThreshold = 0.04;\n this._ssrDownsample = 0;\n this._blurDispersionStrength = 0.03;\n this._blurDownsample = 0;\n this._enableSmoothReflections = false;\n this._environmentTextureIsProbe = false;\n this._attenuateScreenBorders = true;\n this._attenuateIntersectionDistance = true;\n this._attenuateIntersectionIterations = true;\n this._attenuateFacingCamera = false;\n this._attenuateBackfaceReflection = false;\n this._clipToFrustum = true;\n this._useFresnel = false;\n this._enableAutomaticThicknessComputation = false;\n this._backfaceDepthTextureDownsample = 0;\n this._backfaceForceDepthWriteTransparentMeshes = true;\n this._isEnabled = true;\n this._inputTextureColorIsInGammaSpace = true;\n this._generateOutputInGammaSpace = true;\n this._debug = false;\n this._forceGeometryBuffer = false;\n this._isDirty = false;\n this._camerasToBeAttached = [];\n this._cameras = cameras || scene.cameras;\n this._cameras = this._cameras.slice();\n this._camerasToBeAttached = this._cameras.slice();\n this._scene = scene;\n this._textureType = textureType;\n this._forceGeometryBuffer = forceGeometryBuffer;\n if (this.isSupported) {\n scene.postProcessRenderPipelineManager.addPipeline(this);\n if (this._forceGeometryBuffer) {\n const geometryBufferRenderer = scene.enableGeometryBufferRenderer();\n if (geometryBufferRenderer) {\n geometryBufferRenderer.enableReflectivity = true;\n geometryBufferRenderer.useSpecificClearForDepthTexture = true;\n }\n }\n else {\n const prePassRenderer = scene.enablePrePassRenderer();\n if (prePassRenderer) {\n prePassRenderer.useSpecificClearForDepthTexture = true;\n prePassRenderer.markAsDirty();\n }\n }\n this._buildPipeline();\n }\n }\n /**\n * Get the class name\n * @returns \"SSRRenderingPipeline\"\n */\n getClassName() {\n return \"SSRRenderingPipeline\";\n }\n /**\n * Adds a camera to the pipeline\n * @param camera the camera to be added\n */\n addCamera(camera) {\n this._camerasToBeAttached.push(camera);\n this._buildPipeline();\n }\n /**\n * Removes a camera from the pipeline\n * @param camera the camera to remove\n */\n removeCamera(camera) {\n const index = this._camerasToBeAttached.indexOf(camera);\n this._camerasToBeAttached.splice(index, 1);\n this._buildPipeline();\n }\n /**\n * Removes the internal pipeline assets and detaches the pipeline from the scene cameras\n * @param disableGeometryBufferRenderer\n */\n dispose(disableGeometryBufferRenderer = false) {\n this._disposeDepthRenderer();\n this._disposePostProcesses();\n if (disableGeometryBufferRenderer) {\n this._scene.disableGeometryBufferRenderer();\n }\n this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name, this._cameras);\n super.dispose();\n }\n _getTextureSize() {\n var _a, _b;\n const engine = this._scene.getEngine();\n const prePassRenderer = this._prePassRenderer;\n let textureSize = { width: engine.getRenderWidth(), height: engine.getRenderHeight() };\n if (prePassRenderer && ((_a = this._scene.activeCamera) === null || _a === void 0 ? void 0 : _a._getFirstPostProcess()) === this._ssrPostProcess) {\n const renderTarget = prePassRenderer.getRenderTarget();\n if (renderTarget && renderTarget.textures) {\n textureSize = renderTarget.textures[prePassRenderer.getIndex(4)].getSize();\n }\n }\n else if ((_b = this._ssrPostProcess) === null || _b === void 0 ? void 0 : _b.inputTexture) {\n textureSize.width = this._ssrPostProcess.inputTexture.width;\n textureSize.height = this._ssrPostProcess.inputTexture.height;\n }\n return textureSize;\n }\n _updateEffectDefines() {\n var _a;\n const defines = [];\n if (this._geometryBufferRenderer || this._prePassRenderer) {\n defines.push(\"#define SSR_SUPPORTED\");\n }\n if (this._enableSmoothReflections) {\n defines.push(\"#define SSRAYTRACE_ENABLE_REFINEMENT\");\n }\n if (this._scene.useRightHandedSystem) {\n defines.push(\"#define SSRAYTRACE_RIGHT_HANDED_SCENE\");\n }\n if (this._environmentTexture) {\n defines.push(\"#define SSR_USE_ENVIRONMENT_CUBE\");\n if (this._environmentTexture.boundingBoxSize) {\n defines.push(\"#define SSR_USE_LOCAL_REFLECTIONMAP_CUBIC\");\n }\n if (this._environmentTexture.gammaSpace) {\n defines.push(\"#define SSR_ENVIRONMENT_CUBE_IS_GAMMASPACE\");\n }\n }\n if (this._environmentTextureIsProbe) {\n defines.push(\"#define SSR_INVERTCUBICMAP\");\n }\n if (this._enableAutomaticThicknessComputation) {\n defines.push(\"#define SSRAYTRACE_USE_BACK_DEPTHBUFFER\");\n }\n if (this._attenuateScreenBorders) {\n defines.push(\"#define SSR_ATTENUATE_SCREEN_BORDERS\");\n }\n if (this._attenuateIntersectionDistance) {\n defines.push(\"#define SSR_ATTENUATE_INTERSECTION_DISTANCE\");\n }\n if (this._attenuateIntersectionIterations) {\n defines.push(\"#define SSR_ATTENUATE_INTERSECTION_NUMITERATIONS\");\n }\n if (this._attenuateFacingCamera) {\n defines.push(\"#define SSR_ATTENUATE_FACING_CAMERA\");\n }\n if (this._attenuateBackfaceReflection) {\n defines.push(\"#define SSR_ATTENUATE_BACKFACE_REFLECTION\");\n }\n if (this._clipToFrustum) {\n defines.push(\"#define SSRAYTRACE_CLIP_TO_FRUSTUM\");\n }\n if (this._useBlur()) {\n defines.push(\"#define SSR_USE_BLUR\");\n }\n if (this._debug) {\n defines.push(\"#define SSRAYTRACE_DEBUG\");\n }\n if (this._inputTextureColorIsInGammaSpace) {\n defines.push(\"#define SSR_INPUT_IS_GAMMA_SPACE\");\n }\n if (this._generateOutputInGammaSpace) {\n defines.push(\"#define SSR_OUTPUT_IS_GAMMA_SPACE\");\n }\n if (this._useFresnel) {\n defines.push(\"#define SSR_BLEND_WITH_FRESNEL\");\n }\n if (this._reflectivityThreshold === 0) {\n defines.push(\"#define SSR_DISABLE_REFLECTIVITY_TEST\");\n }\n (_a = this._ssrPostProcess) === null || _a === void 0 ? void 0 : _a.updateEffect(defines.join(\"\\n\"));\n }\n _buildPipeline() {\n var _a;\n if (!this.isSupported) {\n return;\n }\n if (!this._isEnabled) {\n this._isDirty = true;\n return;\n }\n this._isDirty = false;\n const engine = this._scene.getEngine();\n this._disposeDepthRenderer();\n this._disposePostProcesses();\n if (this._cameras !== null) {\n this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name, this._cameras);\n // get back cameras to be used to reattach pipeline\n this._cameras = this._camerasToBeAttached.slice();\n }\n this._reset();\n if (this._enableAutomaticThicknessComputation) {\n const camera = (_a = this._cameras) === null || _a === void 0 ? void 0 : _a[0];\n if (camera) {\n this._depthRendererCamera = camera;\n this._depthRenderer = new DepthRenderer(this._scene, undefined, undefined, undefined, 1, true, \"SSRBackDepth\");\n this._depthRenderer.clearColor.r = 1e8; // \"infinity\": put a big value because we use the storeCameraSpaceZ mode\n this._depthRenderer.reverseCulling = true; // we generate depth for the back faces\n this._depthRenderer.forceDepthWriteTransparentMeshes = this._backfaceForceDepthWriteTransparentMeshes;\n this._resizeDepthRenderer();\n camera.customRenderTargets.push(this._depthRenderer.getDepthMap());\n }\n }\n this._createSSRPostProcess();\n this.addEffect(new PostProcessRenderEffect(engine, this.SSRRenderEffect, () => {\n return this._ssrPostProcess;\n }, true));\n if (this._useBlur()) {\n this._createBlurAndCombinerPostProcesses();\n this.addEffect(new PostProcessRenderEffect(engine, this.SSRBlurRenderEffect, () => {\n return [this._blurPostProcessX, this._blurPostProcessY];\n }, true));\n this.addEffect(new PostProcessRenderEffect(engine, this.SSRCombineRenderEffect, () => {\n return this._blurCombinerPostProcess;\n }, true));\n }\n if (this._cameras !== null) {\n this._scene.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(this._name, this._cameras);\n }\n }\n _resizeDepthRenderer() {\n if (!this._depthRenderer) {\n return;\n }\n const textureSize = this._getTextureSize();\n const depthRendererSize = this._depthRenderer.getDepthMap().getSize();\n const width = Math.floor(textureSize.width / (this._backfaceDepthTextureDownsample + 1));\n const height = Math.floor(textureSize.height / (this._backfaceDepthTextureDownsample + 1));\n if (depthRendererSize.width !== width || depthRendererSize.height !== height) {\n this._depthRenderer.getDepthMap().resize({ width, height });\n }\n }\n _disposeDepthRenderer() {\n var _a;\n if (this._depthRenderer) {\n if (this._depthRendererCamera) {\n const idx = (_a = this._depthRendererCamera.customRenderTargets.indexOf(this._depthRenderer.getDepthMap())) !== null && _a !== void 0 ? _a : -1;\n if (idx !== -1) {\n this._depthRendererCamera.customRenderTargets.splice(idx, 1);\n }\n }\n this._depthRendererCamera = null;\n this._depthRenderer.getDepthMap().dispose();\n }\n this._depthRenderer = null;\n }\n _disposePostProcesses() {\n var _a, _b, _c, _d;\n for (let i = 0; i < this._cameras.length; i++) {\n const camera = this._cameras[i];\n (_a = this._ssrPostProcess) === null || _a === void 0 ? void 0 : _a.dispose(camera);\n (_b = this._blurPostProcessX) === null || _b === void 0 ? void 0 : _b.dispose(camera);\n (_c = this._blurPostProcessY) === null || _c === void 0 ? void 0 : _c.dispose(camera);\n (_d = this._blurCombinerPostProcess) === null || _d === void 0 ? void 0 : _d.dispose(camera);\n }\n this._ssrPostProcess = null;\n this._blurPostProcessX = null;\n this._blurPostProcessY = null;\n this._blurCombinerPostProcess = null;\n }\n _createSSRPostProcess() {\n this._ssrPostProcess = new PostProcess(\"ssr\", \"screenSpaceReflection2\", [\n \"projection\",\n \"invProjectionMatrix\",\n \"view\",\n \"invView\",\n \"thickness\",\n \"reflectionSpecularFalloffExponent\",\n \"strength\",\n \"stepSize\",\n \"maxSteps\",\n \"roughnessFactor\",\n \"projectionPixel\",\n \"nearPlaneZ\",\n \"maxDistance\",\n \"selfCollisionNumSkip\",\n \"vReflectionPosition\",\n \"vReflectionSize\",\n \"backSizeFactor\",\n \"reflectivityThreshold\",\n ], [\"textureSampler\", \"normalSampler\", \"reflectivitySampler\", \"depthSampler\", \"envCubeSampler\", \"backDepthSampler\"], 1.0, null, this._textureType, this._scene.getEngine(), false, \"\", this._textureType);\n this._updateEffectDefines();\n this._ssrPostProcess.onApply = (effect) => {\n this._resizeDepthRenderer();\n const geometryBufferRenderer = this._geometryBufferRenderer;\n const prePassRenderer = this._prePassRenderer;\n if (!prePassRenderer && !geometryBufferRenderer) {\n return;\n }\n if (geometryBufferRenderer) {\n const roughnessIndex = geometryBufferRenderer.getTextureIndex(GeometryBufferRenderer.REFLECTIVITY_TEXTURE_TYPE);\n effect.setTexture(\"normalSampler\", geometryBufferRenderer.getGBuffer().textures[1]);\n effect.setTexture(\"reflectivitySampler\", geometryBufferRenderer.getGBuffer().textures[roughnessIndex]);\n effect.setTexture(\"depthSampler\", geometryBufferRenderer.getGBuffer().textures[0]);\n }\n else if (prePassRenderer) {\n const depthIndex = prePassRenderer.getIndex(5);\n const roughnessIndex = prePassRenderer.getIndex(3);\n const normalIndex = prePassRenderer.getIndex(6);\n effect.setTexture(\"normalSampler\", prePassRenderer.getRenderTarget().textures[normalIndex]);\n effect.setTexture(\"depthSampler\", prePassRenderer.getRenderTarget().textures[depthIndex]);\n effect.setTexture(\"reflectivitySampler\", prePassRenderer.getRenderTarget().textures[roughnessIndex]);\n }\n if (this._enableAutomaticThicknessComputation && this._depthRenderer) {\n effect.setTexture(\"backDepthSampler\", this._depthRenderer.getDepthMap());\n effect.setFloat(\"backSizeFactor\", this._backfaceDepthTextureDownsample + 1);\n }\n const camera = this._scene.activeCamera;\n if (!camera) {\n return;\n }\n const viewMatrix = camera.getViewMatrix(true);\n const projectionMatrix = camera.getProjectionMatrix(true);\n projectionMatrix.invertToRef(TmpVectors.Matrix[0]);\n viewMatrix.invertToRef(TmpVectors.Matrix[1]);\n effect.setMatrix(\"projection\", projectionMatrix);\n effect.setMatrix(\"view\", viewMatrix);\n effect.setMatrix(\"invView\", TmpVectors.Matrix[1]);\n effect.setMatrix(\"invProjectionMatrix\", TmpVectors.Matrix[0]);\n effect.setFloat(\"thickness\", this.thickness);\n effect.setFloat(\"reflectionSpecularFalloffExponent\", this.reflectionSpecularFalloffExponent);\n effect.setFloat(\"strength\", this.strength);\n effect.setFloat(\"stepSize\", this.step);\n effect.setFloat(\"maxSteps\", this.maxSteps);\n effect.setFloat(\"roughnessFactor\", this.roughnessFactor);\n effect.setFloat(\"nearPlaneZ\", camera.minZ);\n effect.setFloat(\"maxDistance\", this.maxDistance);\n effect.setFloat(\"selfCollisionNumSkip\", this.selfCollisionNumSkip);\n effect.setFloat(\"reflectivityThreshold\", this._reflectivityThreshold);\n const textureSize = this._getTextureSize();\n Matrix.ScalingToRef(textureSize.width, textureSize.height, 1, TmpVectors.Matrix[2]);\n projectionMatrix.multiplyToRef(this._scene.getEngine().isWebGPU ? trsWebGPU : trs, TmpVectors.Matrix[3]);\n TmpVectors.Matrix[3].multiplyToRef(TmpVectors.Matrix[2], TmpVectors.Matrix[4]);\n effect.setMatrix(\"projectionPixel\", TmpVectors.Matrix[4]);\n if (this._environmentTexture) {\n effect.setTexture(\"envCubeSampler\", this._environmentTexture);\n if (this._environmentTexture.boundingBoxSize) {\n effect.setVector3(\"vReflectionPosition\", this._environmentTexture.boundingBoxPosition);\n effect.setVector3(\"vReflectionSize\", this._environmentTexture.boundingBoxSize);\n }\n }\n };\n this._ssrPostProcess.samples = this.samples;\n if (!this._forceGeometryBuffer) {\n this._ssrPostProcess._prePassEffectConfiguration = new ScreenSpaceReflections2Configuration();\n }\n }\n _createBlurAndCombinerPostProcesses() {\n const engine = this._scene.getEngine();\n this._blurPostProcessX = new PostProcess(\"SSRblurX\", \"screenSpaceReflection2Blur\", [\"texelOffsetScale\"], [\"textureSampler\"], this._useBlur() ? 1 / (this._ssrDownsample + 1) : 1, null, 2, engine, false, \"\", this._textureType);\n this._blurPostProcessX.autoClear = false;\n this._blurPostProcessX.onApplyObservable.add((effect) => {\n var _a, _b;\n const width = (_b = (_a = this._blurPostProcessX) === null || _a === void 0 ? void 0 : _a.inputTexture.width) !== null && _b !== void 0 ? _b : this._scene.getEngine().getRenderWidth();\n effect.setFloat2(\"texelOffsetScale\", this._blurDispersionStrength / width, 0);\n });\n this._blurPostProcessY = new PostProcess(\"SSRblurY\", \"screenSpaceReflection2Blur\", [\"texelOffsetScale\"], [\"textureSampler\"], this._useBlur() ? 1 / (this._blurDownsample + 1) : 1, null, 2, engine, false, \"\", this._textureType);\n this._blurPostProcessY.autoClear = false;\n this._blurPostProcessY.onApplyObservable.add((effect) => {\n var _a, _b;\n const height = (_b = (_a = this._blurPostProcessY) === null || _a === void 0 ? void 0 : _a.inputTexture.height) !== null && _b !== void 0 ? _b : this._scene.getEngine().getRenderHeight();\n effect.setFloat2(\"texelOffsetScale\", 0, this._blurDispersionStrength / height);\n });\n const uniformNames = [\"strength\", \"reflectionSpecularFalloffExponent\", \"reflectivityThreshold\"];\n const samplerNames = [\"textureSampler\", \"mainSampler\", \"reflectivitySampler\"];\n let defines = \"\";\n if (this._debug) {\n defines += \"#define SSRAYTRACE_DEBUG\\n\";\n }\n if (this._inputTextureColorIsInGammaSpace) {\n defines += \"#define SSR_INPUT_IS_GAMMA_SPACE\\n\";\n }\n if (this._generateOutputInGammaSpace) {\n defines += \"#define SSR_OUTPUT_IS_GAMMA_SPACE\\n\";\n }\n if (this.useFresnel) {\n defines += \"#define SSR_BLEND_WITH_FRESNEL\\n\";\n uniformNames.push(\"projection\", \"invProjectionMatrix\");\n samplerNames.push(\"depthSampler\", \"normalSampler\");\n }\n if (this._reflectivityThreshold === 0) {\n defines += \"#define SSR_DISABLE_REFLECTIVITY_TEST\";\n }\n this._blurCombinerPostProcess = new PostProcess(\"SSRblurCombiner\", \"screenSpaceReflection2BlurCombiner\", uniformNames, samplerNames, this._useBlur() ? 1 / (this._blurDownsample + 1) : 1, null, 1, engine, false, defines, this._textureType);\n this._blurCombinerPostProcess.autoClear = false;\n this._blurCombinerPostProcess.onApplyObservable.add((effect) => {\n var _a;\n const geometryBufferRenderer = this._geometryBufferRenderer;\n const prePassRenderer = this._prePassRenderer;\n if (!prePassRenderer && !geometryBufferRenderer) {\n return;\n }\n if (prePassRenderer && ((_a = this._scene.activeCamera) === null || _a === void 0 ? void 0 : _a._getFirstPostProcess()) === this._ssrPostProcess) {\n const renderTarget = prePassRenderer.getRenderTarget();\n if (renderTarget && renderTarget.textures) {\n effect.setTexture(\"mainSampler\", renderTarget.textures[prePassRenderer.getIndex(4)]);\n }\n }\n else {\n effect.setTextureFromPostProcess(\"mainSampler\", this._ssrPostProcess);\n }\n if (geometryBufferRenderer) {\n const roughnessIndex = geometryBufferRenderer.getTextureIndex(GeometryBufferRenderer.REFLECTIVITY_TEXTURE_TYPE);\n effect.setTexture(\"reflectivitySampler\", geometryBufferRenderer.getGBuffer().textures[roughnessIndex]);\n if (this.useFresnel) {\n effect.setTexture(\"normalSampler\", geometryBufferRenderer.getGBuffer().textures[1]);\n effect.setTexture(\"depthSampler\", geometryBufferRenderer.getGBuffer().textures[0]);\n }\n }\n else if (prePassRenderer) {\n const roughnessIndex = prePassRenderer.getIndex(3);\n effect.setTexture(\"reflectivitySampler\", prePassRenderer.getRenderTarget().textures[roughnessIndex]);\n if (this.useFresnel) {\n const depthIndex = prePassRenderer.getIndex(5);\n const normalIndex = prePassRenderer.getIndex(6);\n effect.setTexture(\"normalSampler\", prePassRenderer.getRenderTarget().textures[normalIndex]);\n effect.setTexture(\"depthSampler\", prePassRenderer.getRenderTarget().textures[depthIndex]);\n }\n }\n effect.setFloat(\"strength\", this.strength);\n effect.setFloat(\"reflectionSpecularFalloffExponent\", this.reflectionSpecularFalloffExponent);\n effect.setFloat(\"reflectivityThreshold\", this._reflectivityThreshold);\n if (this.useFresnel) {\n const camera = this._scene.activeCamera;\n if (camera) {\n const projectionMatrix = camera.getProjectionMatrix();\n projectionMatrix.invertToRef(TmpVectors.Matrix[0]);\n effect.setMatrix(\"projection\", projectionMatrix);\n effect.setMatrix(\"invProjectionMatrix\", TmpVectors.Matrix[0]);\n }\n }\n });\n }\n /**\n * Serializes the rendering pipeline (Used when exporting)\n * @returns the serialized object\n */\n serialize() {\n const serializationObject = SerializationHelper.Serialize(this);\n serializationObject.customType = \"SSRRenderingPipeline\";\n return serializationObject;\n }\n /**\n * Parse the serialized pipeline\n * @param source Source pipeline.\n * @param scene The scene to load the pipeline to.\n * @param rootUrl The URL of the serialized pipeline.\n * @returns An instantiated pipeline from the serialized object.\n */\n static Parse(source, scene, rootUrl) {\n return SerializationHelper.Parse(() => new SSRRenderingPipeline(source._name, scene, source._ratio), source, scene, rootUrl);\n }\n}\n__decorate([\n serialize()\n], SSRRenderingPipeline.prototype, \"samples\", null);\n__decorate([\n serialize()\n], SSRRenderingPipeline.prototype, \"maxDistance\", void 0);\n__decorate([\n serialize()\n], SSRRenderingPipeline.prototype, \"step\", void 0);\n__decorate([\n serialize()\n], SSRRenderingPipeline.prototype, \"thickness\", void 0);\n__decorate([\n serialize()\n], SSRRenderingPipeline.prototype, \"strength\", void 0);\n__decorate([\n serialize()\n], SSRRenderingPipeline.prototype, \"reflectionSpecularFalloffExponent\", void 0);\n__decorate([\n serialize()\n], SSRRenderingPipeline.prototype, \"maxSteps\", void 0);\n__decorate([\n serialize()\n], SSRRenderingPipeline.prototype, \"roughnessFactor\", void 0);\n__decorate([\n serialize()\n], SSRRenderingPipeline.prototype, \"selfCollisionNumSkip\", void 0);\n__decorate([\n serialize()\n], SSRRenderingPipeline.prototype, \"_reflectivityThreshold\", void 0);\n__decorate([\n serialize(\"_ssrDownsample\")\n], SSRRenderingPipeline.prototype, \"_ssrDownsample\", void 0);\n__decorate([\n serialize()\n], SSRRenderingPipeline.prototype, \"ssrDownsample\", null);\n__decorate([\n serialize(\"blurDispersionStrength\")\n], SSRRenderingPipeline.prototype, \"_blurDispersionStrength\", void 0);\n__decorate([\n serialize(\"blurDownsample\")\n], SSRRenderingPipeline.prototype, \"_blurDownsample\", void 0);\n__decorate([\n serialize(\"enableSmoothReflections\")\n], SSRRenderingPipeline.prototype, \"_enableSmoothReflections\", void 0);\n__decorate([\n serialize(\"environmentTexture\")\n], SSRRenderingPipeline.prototype, \"_environmentTexture\", void 0);\n__decorate([\n serialize(\"environmentTextureIsProbe\")\n], SSRRenderingPipeline.prototype, \"_environmentTextureIsProbe\", void 0);\n__decorate([\n serialize(\"attenuateScreenBorders\")\n], SSRRenderingPipeline.prototype, \"_attenuateScreenBorders\", void 0);\n__decorate([\n serialize(\"attenuateIntersectionDistance\")\n], SSRRenderingPipeline.prototype, \"_attenuateIntersectionDistance\", void 0);\n__decorate([\n serialize(\"attenuateIntersectionIterations\")\n], SSRRenderingPipeline.prototype, \"_attenuateIntersectionIterations\", void 0);\n__decorate([\n serialize(\"attenuateFacingCamera\")\n], SSRRenderingPipeline.prototype, \"_attenuateFacingCamera\", void 0);\n__decorate([\n serialize(\"attenuateBackfaceReflection\")\n], SSRRenderingPipeline.prototype, \"_attenuateBackfaceReflection\", void 0);\n__decorate([\n serialize(\"clipToFrustum\")\n], SSRRenderingPipeline.prototype, \"_clipToFrustum\", void 0);\n__decorate([\n serialize(\"useFresnel\")\n], SSRRenderingPipeline.prototype, \"_useFresnel\", void 0);\n__decorate([\n serialize(\"enableAutomaticThicknessComputation\")\n], SSRRenderingPipeline.prototype, \"_enableAutomaticThicknessComputation\", void 0);\n__decorate([\n serialize(\"backfaceDepthTextureDownsample\")\n], SSRRenderingPipeline.prototype, \"_backfaceDepthTextureDownsample\", void 0);\n__decorate([\n serialize(\"backfaceForceDepthWriteTransparentMeshes\")\n], SSRRenderingPipeline.prototype, \"_backfaceForceDepthWriteTransparentMeshes\", void 0);\n__decorate([\n serialize(\"isEnabled\")\n], SSRRenderingPipeline.prototype, \"_isEnabled\", void 0);\n__decorate([\n serialize(\"inputTextureColorIsInGammaSpace\")\n], SSRRenderingPipeline.prototype, \"_inputTextureColorIsInGammaSpace\", void 0);\n__decorate([\n serialize(\"generateOutputInGammaSpace\")\n], SSRRenderingPipeline.prototype, \"_generateOutputInGammaSpace\", void 0);\n__decorate([\n serialize(\"debug\")\n], SSRRenderingPipeline.prototype, \"_debug\", void 0);\nRegisterClass(\"BABYLON.SSRRenderingPipeline\", SSRRenderingPipeline);\n//# sourceMappingURL=ssrRenderingPipeline.js.map","import { Tools } from \"../Misc/tools.js\";\nimport { Observable } from \"../Misc/observable.js\";\nimport { Scene } from \"../scene.js\";\nimport { Engine } from \"../Engines/engine.js\";\nimport { EngineStore } from \"../Engines/engineStore.js\";\nimport { Logger } from \"../Misc/logger.js\";\n\nimport { SceneLoaderFlags } from \"./sceneLoaderFlags.js\";\nimport { IsBase64DataUrl } from \"../Misc/fileTools.js\";\nimport { RuntimeError, ErrorCodes } from \"../Misc/error.js\";\n/**\n * Mode that determines how to handle old animation groups before loading new ones.\n */\nexport var SceneLoaderAnimationGroupLoadingMode;\n(function (SceneLoaderAnimationGroupLoadingMode) {\n /**\n * Reset all old animations to initial state then dispose them.\n */\n SceneLoaderAnimationGroupLoadingMode[SceneLoaderAnimationGroupLoadingMode[\"Clean\"] = 0] = \"Clean\";\n /**\n * Stop all old animations.\n */\n SceneLoaderAnimationGroupLoadingMode[SceneLoaderAnimationGroupLoadingMode[\"Stop\"] = 1] = \"Stop\";\n /**\n * Restart old animations from first frame.\n */\n SceneLoaderAnimationGroupLoadingMode[SceneLoaderAnimationGroupLoadingMode[\"Sync\"] = 2] = \"Sync\";\n /**\n * Old animations remains untouched.\n */\n SceneLoaderAnimationGroupLoadingMode[SceneLoaderAnimationGroupLoadingMode[\"NoSync\"] = 3] = \"NoSync\";\n})(SceneLoaderAnimationGroupLoadingMode || (SceneLoaderAnimationGroupLoadingMode = {}));\n/**\n * Class used to load scene from various file formats using registered plugins\n * @see https://doc.babylonjs.com/features/featuresDeepDive/importers/loadingFileTypes\n */\nexport class SceneLoader {\n /**\n * Gets or sets a boolean indicating if entire scene must be loaded even if scene contains incremental data\n */\n static get ForceFullSceneLoadingForIncremental() {\n return SceneLoaderFlags.ForceFullSceneLoadingForIncremental;\n }\n static set ForceFullSceneLoadingForIncremental(value) {\n SceneLoaderFlags.ForceFullSceneLoadingForIncremental = value;\n }\n /**\n * Gets or sets a boolean indicating if loading screen must be displayed while loading a scene\n */\n static get ShowLoadingScreen() {\n return SceneLoaderFlags.ShowLoadingScreen;\n }\n static set ShowLoadingScreen(value) {\n SceneLoaderFlags.ShowLoadingScreen = value;\n }\n /**\n * Defines the current logging level (while loading the scene)\n * @ignorenaming\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n static get loggingLevel() {\n return SceneLoaderFlags.loggingLevel;\n }\n // eslint-disable-next-line @typescript-eslint/naming-convention\n static set loggingLevel(value) {\n SceneLoaderFlags.loggingLevel = value;\n }\n /**\n * Gets or set a boolean indicating if matrix weights must be cleaned upon loading\n */\n static get CleanBoneMatrixWeights() {\n return SceneLoaderFlags.CleanBoneMatrixWeights;\n }\n static set CleanBoneMatrixWeights(value) {\n SceneLoaderFlags.CleanBoneMatrixWeights = value;\n }\n /**\n * Gets the default plugin (used to load Babylon files)\n * @returns the .babylon plugin\n */\n static GetDefaultPlugin() {\n return SceneLoader._RegisteredPlugins[\".babylon\"];\n }\n static _GetPluginForExtension(extension) {\n const registeredPlugin = SceneLoader._RegisteredPlugins[extension];\n if (registeredPlugin) {\n return registeredPlugin;\n }\n Logger.Warn(\"Unable to find a plugin to load \" +\n extension +\n \" files. Trying to use .babylon default plugin. To load from a specific filetype (eg. gltf) see: https://doc.babylonjs.com/features/featuresDeepDive/importers/loadingFileTypes\");\n return SceneLoader.GetDefaultPlugin();\n }\n static _GetPluginForDirectLoad(data) {\n for (const extension in SceneLoader._RegisteredPlugins) {\n const plugin = SceneLoader._RegisteredPlugins[extension].plugin;\n if (plugin.canDirectLoad && plugin.canDirectLoad(data)) {\n return SceneLoader._RegisteredPlugins[extension];\n }\n }\n return SceneLoader.GetDefaultPlugin();\n }\n static _GetPluginForFilename(sceneFilename) {\n const queryStringPosition = sceneFilename.indexOf(\"?\");\n if (queryStringPosition !== -1) {\n sceneFilename = sceneFilename.substring(0, queryStringPosition);\n }\n const dotPosition = sceneFilename.lastIndexOf(\".\");\n const extension = sceneFilename.substring(dotPosition, sceneFilename.length).toLowerCase();\n return SceneLoader._GetPluginForExtension(extension);\n }\n static _GetDirectLoad(sceneFilename) {\n if (sceneFilename.substr(0, 5) === \"data:\") {\n return sceneFilename.substr(5);\n }\n return null;\n }\n static _FormatErrorMessage(fileInfo, message, exception) {\n const fromLoad = fileInfo.rawData ? \"binary data\" : fileInfo.url;\n let errorMessage = \"Unable to load from \" + fromLoad;\n if (message) {\n errorMessage += `: ${message}`;\n }\n else if (exception) {\n errorMessage += `: ${exception}`;\n }\n return errorMessage;\n }\n static _LoadData(fileInfo, scene, onSuccess, onProgress, onError, onDispose, pluginExtension, name) {\n const directLoad = SceneLoader._GetDirectLoad(fileInfo.url);\n if (fileInfo.rawData && !pluginExtension) {\n throw \"When using ArrayBufferView to load data the file extension must be provided.\";\n }\n const registeredPlugin = pluginExtension\n ? SceneLoader._GetPluginForExtension(pluginExtension)\n : directLoad\n ? SceneLoader._GetPluginForDirectLoad(fileInfo.url)\n : SceneLoader._GetPluginForFilename(fileInfo.url);\n if (fileInfo.rawData && !registeredPlugin.isBinary) {\n throw \"Loading from ArrayBufferView can not be used with plugins that don't support binary loading.\";\n }\n let plugin;\n if (registeredPlugin.plugin.createPlugin !== undefined) {\n plugin = registeredPlugin.plugin.createPlugin();\n }\n else {\n plugin = registeredPlugin.plugin;\n }\n if (!plugin) {\n throw \"The loader plugin corresponding to the file type you are trying to load has not been found. If using es6, please import the plugin you wish to use before.\";\n }\n SceneLoader.OnPluginActivatedObservable.notifyObservers(plugin);\n // Check if we have a direct load url. If the plugin is registered to handle\n // it or it's not a base64 data url, then pass it through the direct load path.\n if (directLoad && ((plugin.canDirectLoad && plugin.canDirectLoad(fileInfo.url)) || !IsBase64DataUrl(fileInfo.url))) {\n if (plugin.directLoad) {\n const result = plugin.directLoad(scene, directLoad);\n if (result.then) {\n result\n .then((data) => {\n onSuccess(plugin, data);\n })\n .catch((error) => {\n onError(\"Error in directLoad of _loadData: \" + error, error);\n });\n }\n else {\n onSuccess(plugin, result);\n }\n }\n else {\n onSuccess(plugin, directLoad);\n }\n return plugin;\n }\n const useArrayBuffer = registeredPlugin.isBinary;\n const dataCallback = (data, responseURL) => {\n if (scene.isDisposed) {\n onError(\"Scene has been disposed\");\n return;\n }\n onSuccess(plugin, data, responseURL);\n };\n let request = null;\n let pluginDisposed = false;\n const onDisposeObservable = plugin.onDisposeObservable;\n if (onDisposeObservable) {\n onDisposeObservable.add(() => {\n pluginDisposed = true;\n if (request) {\n request.abort();\n request = null;\n }\n onDispose();\n });\n }\n const manifestChecked = () => {\n if (pluginDisposed) {\n return;\n }\n const errorCallback = (request, exception) => {\n onError(request === null || request === void 0 ? void 0 : request.statusText, exception);\n };\n if (!plugin.loadFile && fileInfo.rawData) {\n throw \"Plugin does not support loading ArrayBufferView.\";\n }\n request = plugin.loadFile\n ? plugin.loadFile(scene, fileInfo.rawData || fileInfo.file || fileInfo.url, fileInfo.rootUrl, dataCallback, onProgress, useArrayBuffer, errorCallback, name)\n : scene._loadFile(fileInfo.file || fileInfo.url, dataCallback, onProgress, true, useArrayBuffer, errorCallback);\n };\n const engine = scene.getEngine();\n let canUseOfflineSupport = engine.enableOfflineSupport;\n if (canUseOfflineSupport) {\n // Also check for exceptions\n let exceptionFound = false;\n for (const regex of scene.disableOfflineSupportExceptionRules) {\n if (regex.test(fileInfo.url)) {\n exceptionFound = true;\n break;\n }\n }\n canUseOfflineSupport = !exceptionFound;\n }\n if (canUseOfflineSupport && Engine.OfflineProviderFactory) {\n // Checking if a manifest file has been set for this scene and if offline mode has been requested\n scene.offlineProvider = Engine.OfflineProviderFactory(fileInfo.url, manifestChecked, engine.disableManifestCheck);\n }\n else {\n manifestChecked();\n }\n return plugin;\n }\n static _GetFileInfo(rootUrl, sceneFilename) {\n let url;\n let name;\n let file = null;\n let rawData = null;\n if (!sceneFilename) {\n url = rootUrl;\n name = Tools.GetFilename(rootUrl);\n rootUrl = Tools.GetFolderPath(rootUrl);\n }\n else if (sceneFilename.name) {\n const sceneFile = sceneFilename;\n url = `file:${sceneFile.name}`;\n name = sceneFile.name;\n file = sceneFile;\n }\n else if (ArrayBuffer.isView(sceneFilename)) {\n url = \"\";\n name = \"arrayBuffer\";\n rawData = sceneFilename;\n }\n else if (typeof sceneFilename === \"string\" && sceneFilename.startsWith(\"data:\")) {\n url = sceneFilename;\n name = \"\";\n }\n else {\n const filename = sceneFilename;\n if (filename.substr(0, 1) === \"/\") {\n Tools.Error(\"Wrong sceneFilename parameter\");\n return null;\n }\n url = rootUrl + filename;\n name = filename;\n }\n return {\n url: url,\n rootUrl: rootUrl,\n name: name,\n file: file,\n rawData,\n };\n }\n // Public functions\n /**\n * Gets a plugin that can load the given extension\n * @param extension defines the extension to load\n * @returns a plugin or null if none works\n */\n static GetPluginForExtension(extension) {\n return SceneLoader._GetPluginForExtension(extension).plugin;\n }\n /**\n * Gets a boolean indicating that the given extension can be loaded\n * @param extension defines the extension to load\n * @returns true if the extension is supported\n */\n static IsPluginForExtensionAvailable(extension) {\n return !!SceneLoader._RegisteredPlugins[extension];\n }\n /**\n * Adds a new plugin to the list of registered plugins\n * @param plugin defines the plugin to add\n */\n static RegisterPlugin(plugin) {\n if (typeof plugin.extensions === \"string\") {\n const extension = plugin.extensions;\n SceneLoader._RegisteredPlugins[extension.toLowerCase()] = {\n plugin: plugin,\n isBinary: false,\n };\n }\n else {\n const extensions = plugin.extensions;\n Object.keys(extensions).forEach((extension) => {\n SceneLoader._RegisteredPlugins[extension.toLowerCase()] = {\n plugin: plugin,\n isBinary: extensions[extension].isBinary,\n };\n });\n }\n }\n /**\n * Import meshes into a scene\n * @param meshNames an array of mesh names, a single mesh name, or empty string for all meshes that filter what meshes are imported\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\n * @param scene the instance of BABYLON.Scene to append to\n * @param onSuccess a callback with a list of imported meshes, particleSystems, skeletons, and animationGroups when import succeeds\n * @param onProgress a callback with a progress event for each file being loaded\n * @param onError a callback with the scene, a message, and possibly an exception when import fails\n * @param pluginExtension the extension used to determine the plugin\n * @returns The loaded plugin\n */\n static ImportMesh(meshNames, rootUrl, sceneFilename = \"\", scene = EngineStore.LastCreatedScene, onSuccess = null, onProgress = null, onError = null, pluginExtension = null, name = \"\") {\n if (!scene) {\n Logger.Error(\"No scene available to import mesh to\");\n return null;\n }\n const fileInfo = SceneLoader._GetFileInfo(rootUrl, sceneFilename);\n if (!fileInfo) {\n return null;\n }\n const loadingToken = {};\n scene.addPendingData(loadingToken);\n const disposeHandler = () => {\n scene.removePendingData(loadingToken);\n };\n const errorHandler = (message, exception) => {\n const errorMessage = SceneLoader._FormatErrorMessage(fileInfo, message, exception);\n if (onError) {\n onError(scene, errorMessage, new RuntimeError(errorMessage, ErrorCodes.SceneLoaderError, exception));\n }\n else {\n Logger.Error(errorMessage);\n // should the exception be thrown?\n }\n disposeHandler();\n };\n const progressHandler = onProgress\n ? (event) => {\n try {\n onProgress(event);\n }\n catch (e) {\n errorHandler(\"Error in onProgress callback: \" + e, e);\n }\n }\n : undefined;\n const successHandler = (meshes, particleSystems, skeletons, animationGroups, transformNodes, geometries, lights) => {\n scene.importedMeshesFiles.push(fileInfo.url);\n if (onSuccess) {\n try {\n onSuccess(meshes, particleSystems, skeletons, animationGroups, transformNodes, geometries, lights);\n }\n catch (e) {\n errorHandler(\"Error in onSuccess callback: \" + e, e);\n }\n }\n scene.removePendingData(loadingToken);\n };\n return SceneLoader._LoadData(fileInfo, scene, (plugin, data, responseURL) => {\n if (plugin.rewriteRootURL) {\n fileInfo.rootUrl = plugin.rewriteRootURL(fileInfo.rootUrl, responseURL);\n }\n if (plugin.importMesh) {\n const syncedPlugin = plugin;\n const meshes = new Array();\n const particleSystems = new Array();\n const skeletons = new Array();\n if (!syncedPlugin.importMesh(meshNames, scene, data, fileInfo.rootUrl, meshes, particleSystems, skeletons, errorHandler)) {\n return;\n }\n scene.loadingPluginName = plugin.name;\n successHandler(meshes, particleSystems, skeletons, [], [], [], []);\n }\n else {\n const asyncedPlugin = plugin;\n asyncedPlugin\n .importMeshAsync(meshNames, scene, data, fileInfo.rootUrl, progressHandler, fileInfo.name)\n .then((result) => {\n scene.loadingPluginName = plugin.name;\n successHandler(result.meshes, result.particleSystems, result.skeletons, result.animationGroups, result.transformNodes, result.geometries, result.lights);\n })\n .catch((error) => {\n errorHandler(error.message, error);\n });\n }\n }, progressHandler, errorHandler, disposeHandler, pluginExtension, name);\n }\n /**\n * Import meshes into a scene\n * @param meshNames an array of mesh names, a single mesh name, or empty string for all meshes that filter what meshes are imported\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\n * @param scene the instance of BABYLON.Scene to append to\n * @param onProgress a callback with a progress event for each file being loaded\n * @param pluginExtension the extension used to determine the plugin\n * @returns The loaded list of imported meshes, particle systems, skeletons, and animation groups\n */\n static ImportMeshAsync(meshNames, rootUrl, sceneFilename = \"\", scene = EngineStore.LastCreatedScene, onProgress = null, pluginExtension = null, name = \"\") {\n return new Promise((resolve, reject) => {\n SceneLoader.ImportMesh(meshNames, rootUrl, sceneFilename, scene, (meshes, particleSystems, skeletons, animationGroups, transformNodes, geometries, lights) => {\n resolve({\n meshes: meshes,\n particleSystems: particleSystems,\n skeletons: skeletons,\n animationGroups: animationGroups,\n transformNodes: transformNodes,\n geometries: geometries,\n lights: lights,\n });\n }, onProgress, (scene, message, exception) => {\n reject(exception || new Error(message));\n }, pluginExtension, name);\n });\n }\n /**\n * Load a scene\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\n * @param engine is the instance of BABYLON.Engine to use to create the scene\n * @param onSuccess a callback with the scene when import succeeds\n * @param onProgress a callback with a progress event for each file being loaded\n * @param onError a callback with the scene, a message, and possibly an exception when import fails\n * @param pluginExtension the extension used to determine the plugin\n * @returns The loaded plugin\n */\n static Load(rootUrl, sceneFilename = \"\", engine = EngineStore.LastCreatedEngine, onSuccess = null, onProgress = null, onError = null, pluginExtension = null, name = \"\") {\n if (!engine) {\n Tools.Error(\"No engine available\");\n return null;\n }\n return SceneLoader.Append(rootUrl, sceneFilename, new Scene(engine), onSuccess, onProgress, onError, pluginExtension, name);\n }\n /**\n * Load a scene\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\n * @param engine is the instance of BABYLON.Engine to use to create the scene\n * @param onProgress a callback with a progress event for each file being loaded\n * @param pluginExtension the extension used to determine the plugin\n * @returns The loaded scene\n */\n static LoadAsync(rootUrl, sceneFilename = \"\", engine = EngineStore.LastCreatedEngine, onProgress = null, pluginExtension = null, name = \"\") {\n return new Promise((resolve, reject) => {\n SceneLoader.Load(rootUrl, sceneFilename, engine, (scene) => {\n resolve(scene);\n }, onProgress, (scene, message, exception) => {\n reject(exception || new Error(message));\n }, pluginExtension, name);\n });\n }\n /**\n * Append a scene\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\n * @param scene is the instance of BABYLON.Scene to append to\n * @param onSuccess a callback with the scene when import succeeds\n * @param onProgress a callback with a progress event for each file being loaded\n * @param onError a callback with the scene, a message, and possibly an exception when import fails\n * @param pluginExtension the extension used to determine the plugin\n * @returns The loaded plugin\n */\n static Append(rootUrl, sceneFilename = \"\", scene = EngineStore.LastCreatedScene, onSuccess = null, onProgress = null, onError = null, pluginExtension = null, name = \"\") {\n if (!scene) {\n Logger.Error(\"No scene available to append to\");\n return null;\n }\n const fileInfo = SceneLoader._GetFileInfo(rootUrl, sceneFilename);\n if (!fileInfo) {\n return null;\n }\n const loadingToken = {};\n scene.addPendingData(loadingToken);\n const disposeHandler = () => {\n scene.removePendingData(loadingToken);\n };\n if (SceneLoader.ShowLoadingScreen && !this._ShowingLoadingScreen) {\n this._ShowingLoadingScreen = true;\n scene.getEngine().displayLoadingUI();\n scene.executeWhenReady(() => {\n scene.getEngine().hideLoadingUI();\n this._ShowingLoadingScreen = false;\n });\n }\n const errorHandler = (message, exception) => {\n const errorMessage = SceneLoader._FormatErrorMessage(fileInfo, message, exception);\n if (onError) {\n onError(scene, errorMessage, new RuntimeError(errorMessage, ErrorCodes.SceneLoaderError, exception));\n }\n else {\n Logger.Error(errorMessage);\n // should the exception be thrown?\n }\n disposeHandler();\n };\n const progressHandler = onProgress\n ? (event) => {\n try {\n onProgress(event);\n }\n catch (e) {\n errorHandler(\"Error in onProgress callback\", e);\n }\n }\n : undefined;\n const successHandler = () => {\n if (onSuccess) {\n try {\n onSuccess(scene);\n }\n catch (e) {\n errorHandler(\"Error in onSuccess callback\", e);\n }\n }\n scene.removePendingData(loadingToken);\n };\n return SceneLoader._LoadData(fileInfo, scene, (plugin, data) => {\n if (plugin.load) {\n const syncedPlugin = plugin;\n if (!syncedPlugin.load(scene, data, fileInfo.rootUrl, errorHandler)) {\n return;\n }\n scene.loadingPluginName = plugin.name;\n successHandler();\n }\n else {\n const asyncedPlugin = plugin;\n asyncedPlugin\n .loadAsync(scene, data, fileInfo.rootUrl, progressHandler, fileInfo.name)\n .then(() => {\n scene.loadingPluginName = plugin.name;\n successHandler();\n })\n .catch((error) => {\n errorHandler(error.message, error);\n });\n }\n }, progressHandler, errorHandler, disposeHandler, pluginExtension, name);\n }\n /**\n * Append a scene\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\n * @param scene is the instance of BABYLON.Scene to append to\n * @param onProgress a callback with a progress event for each file being loaded\n * @param pluginExtension the extension used to determine the plugin\n * @returns The given scene\n */\n static AppendAsync(rootUrl, sceneFilename = \"\", scene = EngineStore.LastCreatedScene, onProgress = null, pluginExtension = null, name = \"\") {\n return new Promise((resolve, reject) => {\n SceneLoader.Append(rootUrl, sceneFilename, scene, (scene) => {\n resolve(scene);\n }, onProgress, (scene, message, exception) => {\n reject(exception || new Error(message));\n }, pluginExtension, name);\n });\n }\n /**\n * Load a scene into an asset container\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\n * @param scene is the instance of BABYLON.Scene to append to (default: last created scene)\n * @param onSuccess a callback with the scene when import succeeds\n * @param onProgress a callback with a progress event for each file being loaded\n * @param onError a callback with the scene, a message, and possibly an exception when import fails\n * @param pluginExtension the extension used to determine the plugin\n * @returns The loaded plugin\n */\n static LoadAssetContainer(rootUrl, sceneFilename = \"\", scene = EngineStore.LastCreatedScene, onSuccess = null, onProgress = null, onError = null, pluginExtension = null, name = \"\") {\n if (!scene) {\n Logger.Error(\"No scene available to load asset container to\");\n return null;\n }\n const fileInfo = SceneLoader._GetFileInfo(rootUrl, sceneFilename);\n if (!fileInfo) {\n return null;\n }\n const loadingToken = {};\n scene.addPendingData(loadingToken);\n const disposeHandler = () => {\n scene.removePendingData(loadingToken);\n };\n const errorHandler = (message, exception) => {\n const errorMessage = SceneLoader._FormatErrorMessage(fileInfo, message, exception);\n if (onError) {\n onError(scene, errorMessage, new RuntimeError(errorMessage, ErrorCodes.SceneLoaderError, exception));\n }\n else {\n Logger.Error(errorMessage);\n // should the exception be thrown?\n }\n disposeHandler();\n };\n const progressHandler = onProgress\n ? (event) => {\n try {\n onProgress(event);\n }\n catch (e) {\n errorHandler(\"Error in onProgress callback\", e);\n }\n }\n : undefined;\n const successHandler = (assets) => {\n if (onSuccess) {\n try {\n onSuccess(assets);\n }\n catch (e) {\n errorHandler(\"Error in onSuccess callback\", e);\n }\n }\n scene.removePendingData(loadingToken);\n };\n return SceneLoader._LoadData(fileInfo, scene, (plugin, data) => {\n if (plugin.loadAssetContainer) {\n const syncedPlugin = plugin;\n const assetContainer = syncedPlugin.loadAssetContainer(scene, data, fileInfo.rootUrl, errorHandler);\n if (!assetContainer) {\n return;\n }\n assetContainer.populateRootNodes();\n scene.loadingPluginName = plugin.name;\n successHandler(assetContainer);\n }\n else if (plugin.loadAssetContainerAsync) {\n const asyncedPlugin = plugin;\n asyncedPlugin\n .loadAssetContainerAsync(scene, data, fileInfo.rootUrl, progressHandler, fileInfo.name)\n .then((assetContainer) => {\n assetContainer.populateRootNodes();\n scene.loadingPluginName = plugin.name;\n successHandler(assetContainer);\n })\n .catch((error) => {\n errorHandler(error.message, error);\n });\n }\n else {\n errorHandler(\"LoadAssetContainer is not supported by this plugin. Plugin did not provide a loadAssetContainer or loadAssetContainerAsync method.\");\n }\n }, progressHandler, errorHandler, disposeHandler, pluginExtension, name);\n }\n /**\n * Load a scene into an asset container\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene (default: empty string)\n * @param scene is the instance of Scene to append to\n * @param onProgress a callback with a progress event for each file being loaded\n * @param pluginExtension the extension used to determine the plugin\n * @returns The loaded asset container\n */\n static LoadAssetContainerAsync(rootUrl, sceneFilename = \"\", scene = EngineStore.LastCreatedScene, onProgress = null, pluginExtension = null) {\n return new Promise((resolve, reject) => {\n SceneLoader.LoadAssetContainer(rootUrl, sceneFilename, scene, (assetContainer) => {\n resolve(assetContainer);\n }, onProgress, (scene, message, exception) => {\n reject(exception || new Error(message));\n }, pluginExtension);\n });\n }\n /**\n * Import animations from a file into a scene\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\n * @param scene is the instance of BABYLON.Scene to append to (default: last created scene)\n * @param overwriteAnimations when true, animations are cleaned before importing new ones. Animations are appended otherwise\n * @param animationGroupLoadingMode defines how to handle old animations groups before importing new ones\n * @param targetConverter defines a function used to convert animation targets from loaded scene to current scene (default: search node by name)\n * @param onSuccess a callback with the scene when import succeeds\n * @param onProgress a callback with a progress event for each file being loaded\n * @param onError a callback with the scene, a message, and possibly an exception when import fails\n * @param pluginExtension the extension used to determine the plugin\n */\n static ImportAnimations(rootUrl, sceneFilename = \"\", scene = EngineStore.LastCreatedScene, overwriteAnimations = true, animationGroupLoadingMode = SceneLoaderAnimationGroupLoadingMode.Clean, targetConverter = null, onSuccess = null, onProgress = null, onError = null, pluginExtension = null) {\n if (!scene) {\n Logger.Error(\"No scene available to load animations to\");\n return;\n }\n if (overwriteAnimations) {\n // Reset, stop and dispose all animations before loading new ones\n for (const animatable of scene.animatables) {\n animatable.reset();\n }\n scene.stopAllAnimations();\n scene.animationGroups.slice().forEach((animationGroup) => {\n animationGroup.dispose();\n });\n const nodes = scene.getNodes();\n nodes.forEach((node) => {\n if (node.animations) {\n node.animations = [];\n }\n });\n }\n else {\n switch (animationGroupLoadingMode) {\n case SceneLoaderAnimationGroupLoadingMode.Clean:\n scene.animationGroups.slice().forEach((animationGroup) => {\n animationGroup.dispose();\n });\n break;\n case SceneLoaderAnimationGroupLoadingMode.Stop:\n scene.animationGroups.forEach((animationGroup) => {\n animationGroup.stop();\n });\n break;\n case SceneLoaderAnimationGroupLoadingMode.Sync:\n scene.animationGroups.forEach((animationGroup) => {\n animationGroup.reset();\n animationGroup.restart();\n });\n break;\n case SceneLoaderAnimationGroupLoadingMode.NoSync:\n // nothing to do\n break;\n default:\n Logger.Error(\"Unknown animation group loading mode value '\" + animationGroupLoadingMode + \"'\");\n return;\n }\n }\n const startingIndexForNewAnimatables = scene.animatables.length;\n const onAssetContainerLoaded = (container) => {\n container.mergeAnimationsTo(scene, scene.animatables.slice(startingIndexForNewAnimatables), targetConverter);\n container.dispose();\n scene.onAnimationFileImportedObservable.notifyObservers(scene);\n if (onSuccess) {\n onSuccess(scene);\n }\n };\n this.LoadAssetContainer(rootUrl, sceneFilename, scene, onAssetContainerLoaded, onProgress, onError, pluginExtension);\n }\n /**\n * Import animations from a file into a scene\n * @param rootUrl a string that defines the root url for the scene and resources or the concatenation of rootURL and filename (e.g. http://example.com/test.glb)\n * @param sceneFilename a string that defines the name of the scene file or starts with \"data:\" following by the stringified version of the scene or a File object (default: empty string)\n * @param scene is the instance of BABYLON.Scene to append to (default: last created scene)\n * @param overwriteAnimations when true, animations are cleaned before importing new ones. Animations are appended otherwise\n * @param animationGroupLoadingMode defines how to handle old animations groups before importing new ones\n * @param targetConverter defines a function used to convert animation targets from loaded scene to current scene (default: search node by name)\n * @param onSuccess a callback with the scene when import succeeds\n * @param onProgress a callback with a progress event for each file being loaded\n * @param onError a callback with the scene, a message, and possibly an exception when import fails\n * @param pluginExtension the extension used to determine the plugin\n * @returns the updated scene with imported animations\n */\n static ImportAnimationsAsync(rootUrl, sceneFilename = \"\", scene = EngineStore.LastCreatedScene, overwriteAnimations = true, animationGroupLoadingMode = SceneLoaderAnimationGroupLoadingMode.Clean, targetConverter = null, \n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n onSuccess = null, onProgress = null, \n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n onError = null, pluginExtension = null) {\n return new Promise((resolve, reject) => {\n SceneLoader.ImportAnimations(rootUrl, sceneFilename, scene, overwriteAnimations, animationGroupLoadingMode, targetConverter, (_scene) => {\n resolve(_scene);\n }, onProgress, (_scene, message, exception) => {\n reject(exception || new Error(message));\n }, pluginExtension);\n });\n }\n}\n/**\n * No logging while loading\n */\nSceneLoader.NO_LOGGING = 0;\n/**\n * Minimal logging while loading\n */\nSceneLoader.MINIMAL_LOGGING = 1;\n/**\n * Summary logging while loading\n */\nSceneLoader.SUMMARY_LOGGING = 2;\n/**\n * Detailed logging while loading\n */\nSceneLoader.DETAILED_LOGGING = 3;\n// Members\n/**\n * Event raised when a plugin is used to load a scene\n */\nSceneLoader.OnPluginActivatedObservable = new Observable();\nSceneLoader._RegisteredPlugins = {};\nSceneLoader._ShowingLoadingScreen = false;\n//# sourceMappingURL=sceneLoader.js.map","import { ThinEngine } from \"../../Engines/thinEngine.js\";\nimport { InternalTexture, InternalTextureSource } from \"../../Materials/Textures/internalTexture.js\";\nimport { Logger } from \"../../Misc/logger.js\";\nimport { LoadImage } from \"../../Misc/fileTools.js\";\nimport { RandomGUID } from \"../../Misc/guid.js\";\n\nThinEngine.prototype._createDepthStencilCubeTexture = function (size, options, rtWrapper) {\n const internalTexture = new InternalTexture(this, InternalTextureSource.DepthStencil);\n internalTexture.isCube = true;\n if (this.webGLVersion === 1) {\n Logger.Error(\"Depth cube texture is not supported by WebGL 1.\");\n return internalTexture;\n }\n const internalOptions = Object.assign({ bilinearFiltering: false, comparisonFunction: 0, generateStencil: false }, options);\n const gl = this._gl;\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, internalTexture, true);\n this._setupDepthStencilTexture(internalTexture, size, internalOptions.generateStencil, internalOptions.bilinearFiltering, internalOptions.comparisonFunction);\n rtWrapper._depthStencilTexture = internalTexture;\n rtWrapper._depthStencilTextureWithStencil = internalOptions.generateStencil;\n // Create the depth/stencil buffer\n for (let face = 0; face < 6; face++) {\n if (internalOptions.generateStencil) {\n gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + face, 0, gl.DEPTH24_STENCIL8, size, size, 0, gl.DEPTH_STENCIL, gl.UNSIGNED_INT_24_8, null);\n }\n else {\n gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + face, 0, gl.DEPTH_COMPONENT24, size, size, 0, gl.DEPTH_COMPONENT, gl.UNSIGNED_INT, null);\n }\n }\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, null);\n this._internalTexturesCache.push(internalTexture);\n return internalTexture;\n};\nThinEngine.prototype._partialLoadFile = function (url, index, loadedFiles, onfinish, onErrorCallBack = null) {\n const onload = (data) => {\n loadedFiles[index] = data;\n loadedFiles._internalCount++;\n if (loadedFiles._internalCount === 6) {\n onfinish(loadedFiles);\n }\n };\n const onerror = (request, exception) => {\n if (onErrorCallBack && request) {\n onErrorCallBack(request.status + \" \" + request.statusText, exception);\n }\n };\n this._loadFile(url, onload, undefined, undefined, true, onerror);\n};\nThinEngine.prototype._cascadeLoadFiles = function (scene, onfinish, files, onError = null) {\n const loadedFiles = [];\n loadedFiles._internalCount = 0;\n for (let index = 0; index < 6; index++) {\n this._partialLoadFile(files[index], index, loadedFiles, onfinish, onError);\n }\n};\nThinEngine.prototype._cascadeLoadImgs = function (scene, texture, onfinish, files, onError = null, mimeType) {\n const loadedImages = [];\n loadedImages._internalCount = 0;\n for (let index = 0; index < 6; index++) {\n this._partialLoadImg(files[index], index, loadedImages, scene, texture, onfinish, onError, mimeType);\n }\n};\nThinEngine.prototype._partialLoadImg = function (url, index, loadedImages, scene, texture, onfinish, onErrorCallBack = null, mimeType) {\n const tokenPendingData = RandomGUID();\n const onload = (img) => {\n loadedImages[index] = img;\n loadedImages._internalCount++;\n if (scene) {\n scene.removePendingData(tokenPendingData);\n }\n if (loadedImages._internalCount === 6 && onfinish) {\n onfinish(texture, loadedImages);\n }\n };\n const onerror = (message, exception) => {\n if (scene) {\n scene.removePendingData(tokenPendingData);\n }\n if (onErrorCallBack) {\n onErrorCallBack(message, exception);\n }\n };\n LoadImage(url, onload, onerror, scene ? scene.offlineProvider : null, mimeType);\n if (scene) {\n scene.addPendingData(tokenPendingData);\n }\n};\nThinEngine.prototype._setCubeMapTextureParams = function (texture, loadMipmap, maxLevel) {\n const gl = this._gl;\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, loadMipmap ? gl.LINEAR_MIPMAP_LINEAR : gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n texture.samplingMode = loadMipmap ? 3 : 2;\n if (loadMipmap && this.getCaps().textureMaxLevel && maxLevel !== undefined && maxLevel > 0) {\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAX_LEVEL, maxLevel);\n texture._maxLodLevel = maxLevel;\n }\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, null);\n};\nThinEngine.prototype.createCubeTextureBase = function (rootUrl, scene, files, noMipmap, onLoad = null, onError = null, format, forcedExtension = null, createPolynomials = false, lodScale = 0, lodOffset = 0, fallback = null, beforeLoadCubeDataCallback = null, imageHandler = null, useSRGBBuffer = false) {\n const texture = fallback ? fallback : new InternalTexture(this, InternalTextureSource.Cube);\n texture.isCube = true;\n texture.url = rootUrl;\n texture.generateMipMaps = !noMipmap;\n texture._lodGenerationScale = lodScale;\n texture._lodGenerationOffset = lodOffset;\n texture._useSRGBBuffer = !!useSRGBBuffer && this._caps.supportSRGBBuffers && (this.webGLVersion > 1 || this.isWebGPU || !!noMipmap);\n if (texture !== fallback) {\n texture.label = rootUrl.substring(0, 60); // default label, can be overriden by the caller\n }\n if (!this._doNotHandleContextLost) {\n texture._extension = forcedExtension;\n texture._files = files;\n }\n const originalRootUrl = rootUrl;\n if (this._transformTextureUrl && !fallback) {\n rootUrl = this._transformTextureUrl(rootUrl);\n }\n const rootUrlWithoutUriParams = rootUrl.split(\"?\")[0];\n const lastDot = rootUrlWithoutUriParams.lastIndexOf(\".\");\n const extension = forcedExtension ? forcedExtension : lastDot > -1 ? rootUrlWithoutUriParams.substring(lastDot).toLowerCase() : \"\";\n let loader = null;\n for (const availableLoader of ThinEngine._TextureLoaders) {\n if (availableLoader.canLoad(extension)) {\n loader = availableLoader;\n break;\n }\n }\n const onInternalError = (request, exception) => {\n if (rootUrl === originalRootUrl) {\n if (onError && request) {\n onError(request.status + \" \" + request.statusText, exception);\n }\n }\n else {\n // fall back to the original url if the transformed url fails to load\n Logger.Warn(`Failed to load ${rootUrl}, falling back to the ${originalRootUrl}`);\n this.createCubeTextureBase(originalRootUrl, scene, files, !!noMipmap, onLoad, onError, format, forcedExtension, createPolynomials, lodScale, lodOffset, texture, beforeLoadCubeDataCallback, imageHandler, useSRGBBuffer);\n }\n };\n if (loader) {\n const onloaddata = (data) => {\n if (beforeLoadCubeDataCallback) {\n beforeLoadCubeDataCallback(texture, data);\n }\n loader.loadCubeData(data, texture, createPolynomials, onLoad, onError);\n };\n if (files && files.length === 6) {\n if (loader.supportCascades) {\n this._cascadeLoadFiles(scene, (images) => onloaddata(images.map((image) => new Uint8Array(image))), files, onError);\n }\n else {\n if (onError) {\n onError(\"Textures type does not support cascades.\");\n }\n else {\n Logger.Warn(\"Texture loader does not support cascades.\");\n }\n }\n }\n else {\n this._loadFile(rootUrl, (data) => onloaddata(new Uint8Array(data)), undefined, undefined, true, onInternalError);\n }\n }\n else {\n if (!files) {\n throw new Error(\"Cannot load cubemap because files were not defined\");\n }\n this._cascadeLoadImgs(scene, texture, (texture, imgs) => {\n if (imageHandler) {\n imageHandler(texture, imgs);\n }\n }, files, onError);\n }\n this._internalTexturesCache.push(texture);\n return texture;\n};\nThinEngine.prototype.createCubeTexture = function (rootUrl, scene, files, noMipmap, onLoad = null, onError = null, format, forcedExtension = null, createPolynomials = false, lodScale = 0, lodOffset = 0, fallback = null, loaderOptions, useSRGBBuffer = false) {\n const gl = this._gl;\n return this.createCubeTextureBase(rootUrl, scene, files, !!noMipmap, onLoad, onError, format, forcedExtension, createPolynomials, lodScale, lodOffset, fallback, (texture) => this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true), (texture, imgs) => {\n const width = this.needPOTTextures ? ThinEngine.GetExponentOfTwo(imgs[0].width, this._caps.maxCubemapTextureSize) : imgs[0].width;\n const height = width;\n const faces = [\n gl.TEXTURE_CUBE_MAP_POSITIVE_X,\n gl.TEXTURE_CUBE_MAP_POSITIVE_Y,\n gl.TEXTURE_CUBE_MAP_POSITIVE_Z,\n gl.TEXTURE_CUBE_MAP_NEGATIVE_X,\n gl.TEXTURE_CUBE_MAP_NEGATIVE_Y,\n gl.TEXTURE_CUBE_MAP_NEGATIVE_Z,\n ];\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true);\n this._unpackFlipY(false);\n const internalFormat = format ? this._getInternalFormat(format, texture._useSRGBBuffer) : texture._useSRGBBuffer ? this._glSRGBExtensionValues.SRGB8_ALPHA8 : gl.RGBA;\n let texelFormat = format ? this._getInternalFormat(format) : gl.RGBA;\n if (texture._useSRGBBuffer && this.webGLVersion === 1) {\n texelFormat = internalFormat;\n }\n for (let index = 0; index < faces.length; index++) {\n if (imgs[index].width !== width || imgs[index].height !== height) {\n this._prepareWorkingCanvas();\n if (!this._workingCanvas || !this._workingContext) {\n Logger.Warn(\"Cannot create canvas to resize texture.\");\n return;\n }\n this._workingCanvas.width = width;\n this._workingCanvas.height = height;\n this._workingContext.drawImage(imgs[index], 0, 0, imgs[index].width, imgs[index].height, 0, 0, width, height);\n gl.texImage2D(faces[index], 0, internalFormat, texelFormat, gl.UNSIGNED_BYTE, this._workingCanvas);\n }\n else {\n gl.texImage2D(faces[index], 0, internalFormat, texelFormat, gl.UNSIGNED_BYTE, imgs[index]);\n }\n }\n if (!noMipmap) {\n gl.generateMipmap(gl.TEXTURE_CUBE_MAP);\n }\n this._setCubeMapTextureParams(texture, !noMipmap);\n texture.width = width;\n texture.height = height;\n texture.isReady = true;\n if (format) {\n texture.format = format;\n }\n texture.onLoadedObservable.notifyObservers(texture);\n texture.onLoadedObservable.clear();\n if (onLoad) {\n onLoad();\n }\n }, !!useSRGBBuffer);\n};\n//# sourceMappingURL=engine.cubeTexture.js.map","import { __decorate } from \"../../tslib.es6.js\";\nimport { serialize, serializeAsMatrix, SerializationHelper, serializeAsVector3 } from \"../../Misc/decorators.js\";\nimport { Tools } from \"../../Misc/tools.js\";\nimport { Matrix, TmpVectors, Vector3 } from \"../../Maths/math.vector.js\";\nimport { BaseTexture } from \"../../Materials/Textures/baseTexture.js\";\nimport { Texture } from \"../../Materials/Textures/texture.js\";\n\nimport { GetClass, RegisterClass } from \"../../Misc/typeStore.js\";\nimport \"../../Engines/Extensions/engine.cubeTexture.js\";\nimport { Observable } from \"../../Misc/observable.js\";\n/**\n * Class for creating a cube texture\n */\nexport class CubeTexture extends BaseTexture {\n /**\n * Gets or sets the size of the bounding box associated with the cube texture\n * When defined, the cubemap will switch to local mode\n * @see https://community.arm.com/graphics/b/blog/posts/reflections-based-on-local-cubemaps-in-unity\n * @example https://www.babylonjs-playground.com/#RNASML\n */\n set boundingBoxSize(value) {\n if (this._boundingBoxSize && this._boundingBoxSize.equals(value)) {\n return;\n }\n this._boundingBoxSize = value;\n const scene = this.getScene();\n if (scene) {\n scene.markAllMaterialsAsDirty(1);\n }\n }\n /**\n * Returns the bounding box size\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/reflectionTexture#using-local-cubemap-mode\n */\n get boundingBoxSize() {\n return this._boundingBoxSize;\n }\n /**\n * Sets texture matrix rotation angle around Y axis in radians.\n */\n set rotationY(value) {\n this._rotationY = value;\n this.setReflectionTextureMatrix(Matrix.RotationY(this._rotationY));\n }\n /**\n * Gets texture matrix rotation angle around Y axis radians.\n */\n get rotationY() {\n return this._rotationY;\n }\n /**\n * Are mip maps generated for this texture or not.\n */\n get noMipmap() {\n return this._noMipmap;\n }\n /**\n * Gets the forced extension (if any)\n */\n get forcedExtension() {\n return this._forcedExtension;\n }\n /**\n * Creates a cube texture from an array of image urls\n * @param files defines an array of image urls\n * @param scene defines the hosting scene\n * @param noMipmap specifies if mip maps are not used\n * @returns a cube texture\n */\n static CreateFromImages(files, scene, noMipmap) {\n let rootUrlKey = \"\";\n files.forEach((url) => (rootUrlKey += url));\n return new CubeTexture(rootUrlKey, scene, null, noMipmap, files);\n }\n /**\n * Creates and return a texture created from prefilterd data by tools like IBL Baker or Lys.\n * @param url defines the url of the prefiltered texture\n * @param scene defines the scene the texture is attached to\n * @param forcedExtension defines the extension of the file if different from the url\n * @param createPolynomials defines whether or not to create polynomial harmonics from the texture data if necessary\n * @returns the prefiltered texture\n */\n static CreateFromPrefilteredData(url, scene, forcedExtension = null, createPolynomials = true) {\n const oldValue = scene.useDelayedTextureLoading;\n scene.useDelayedTextureLoading = false;\n const result = new CubeTexture(url, scene, null, false, null, null, null, undefined, true, forcedExtension, createPolynomials);\n scene.useDelayedTextureLoading = oldValue;\n return result;\n }\n /**\n * Creates a cube texture to use with reflection for instance. It can be based upon dds or six images as well\n * as prefiltered data.\n * @param rootUrl defines the url of the texture or the root name of the six images\n * @param sceneOrEngine defines the scene or engine the texture is attached to\n * @param extensions defines the suffixes add to the picture name in case six images are in use like _px.jpg...\n * @param noMipmap defines if mipmaps should be created or not\n * @param files defines the six files to load for the different faces in that order: px, py, pz, nx, ny, nz\n * @param onLoad defines a callback triggered at the end of the file load if no errors occurred\n * @param onError defines a callback triggered in case of error during load\n * @param format defines the internal format to use for the texture once loaded\n * @param prefiltered defines whether or not the texture is created from prefiltered data\n * @param forcedExtension defines the extensions to use (force a special type of file to load) in case it is different from the file name\n * @param createPolynomials defines whether or not to create polynomial harmonics from the texture data if necessary\n * @param lodScale defines the scale applied to environment texture. This manages the range of LOD level used for IBL according to the roughness\n * @param lodOffset defines the offset applied to environment texture. This manages first LOD level used for IBL according to the roughness\n * @param loaderOptions options to be passed to the loader\n * @param useSRGBBuffer Defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU) (default: false)\n * @returns the cube texture\n */\n constructor(rootUrl, sceneOrEngine, extensions = null, noMipmap = false, files = null, onLoad = null, onError = null, format = 5, prefiltered = false, forcedExtension = null, createPolynomials = false, lodScale = 0.8, lodOffset = 0, loaderOptions, useSRGBBuffer) {\n var _a;\n super(sceneOrEngine);\n this._lodScale = 0.8;\n this._lodOffset = 0;\n /**\n * Observable triggered once the texture has been loaded.\n */\n this.onLoadObservable = new Observable();\n /**\n * Gets or sets the center of the bounding box associated with the cube texture.\n * It must define where the camera used to render the texture was set\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/reflectionTexture#using-local-cubemap-mode\n */\n this.boundingBoxPosition = Vector3.Zero();\n this._rotationY = 0;\n /** @internal */\n this._files = null;\n this._forcedExtension = null;\n this._extensions = null;\n this._textureMatrixRefraction = new Matrix();\n this.name = rootUrl;\n this.url = rootUrl;\n this._noMipmap = noMipmap;\n this.hasAlpha = false;\n this._format = format;\n this.isCube = true;\n this._textureMatrix = Matrix.Identity();\n this._createPolynomials = createPolynomials;\n this.coordinatesMode = Texture.CUBIC_MODE;\n this._extensions = extensions;\n this._files = files;\n this._forcedExtension = forcedExtension;\n this._loaderOptions = loaderOptions;\n this._useSRGBBuffer = useSRGBBuffer;\n this._lodScale = lodScale;\n this._lodOffset = lodOffset;\n if (!rootUrl && !files) {\n return;\n }\n this.updateURL(rootUrl, forcedExtension, onLoad, prefiltered, onError, extensions, (_a = this.getScene()) === null || _a === void 0 ? void 0 : _a.useDelayedTextureLoading, files);\n }\n /**\n * Get the current class name of the texture useful for serialization or dynamic coding.\n * @returns \"CubeTexture\"\n */\n getClassName() {\n return \"CubeTexture\";\n }\n /**\n * Update the url (and optional buffer) of this texture if url was null during construction.\n * @param url the url of the texture\n * @param forcedExtension defines the extension to use\n * @param onLoad callback called when the texture is loaded (defaults to null)\n * @param prefiltered Defines whether the updated texture is prefiltered or not\n * @param onError callback called if there was an error during the loading process (defaults to null)\n * @param extensions defines the suffixes add to the picture name in case six images are in use like _px.jpg...\n * @param delayLoad defines if the texture should be loaded now (false by default)\n * @param files defines the six files to load for the different faces in that order: px, py, pz, nx, ny, nz\n */\n updateURL(url, forcedExtension, onLoad = null, prefiltered = false, onError = null, extensions = null, delayLoad = false, files = null) {\n if (!this.name || this.name.startsWith(\"data:\")) {\n this.name = url;\n }\n this.url = url;\n if (forcedExtension) {\n this._forcedExtension = forcedExtension;\n }\n const lastDot = url.lastIndexOf(\".\");\n const extension = forcedExtension ? forcedExtension : lastDot > -1 ? url.substring(lastDot).toLowerCase() : \"\";\n const isDDS = extension.indexOf(\".dds\") === 0;\n const isEnv = extension.indexOf(\".env\") === 0;\n const isBasis = extension.indexOf(\".basis\") === 0;\n if (isEnv) {\n this.gammaSpace = false;\n this._prefiltered = false;\n this.anisotropicFilteringLevel = 1;\n }\n else {\n this._prefiltered = prefiltered;\n if (prefiltered) {\n this.gammaSpace = false;\n this.anisotropicFilteringLevel = 1;\n }\n }\n if (files) {\n this._files = files;\n }\n else {\n if (!isBasis && !isEnv && !isDDS && !extensions) {\n extensions = [\"_px.jpg\", \"_py.jpg\", \"_pz.jpg\", \"_nx.jpg\", \"_ny.jpg\", \"_nz.jpg\"];\n }\n this._files = this._files || [];\n this._files.length = 0;\n if (extensions) {\n for (let index = 0; index < extensions.length; index++) {\n this._files.push(url + extensions[index]);\n }\n this._extensions = extensions;\n }\n }\n if (delayLoad) {\n this.delayLoadState = 4;\n this._delayedOnLoad = onLoad;\n this._delayedOnError = onError;\n }\n else {\n this._loadTexture(onLoad, onError);\n }\n }\n /**\n * Delays loading of the cube texture\n * @param forcedExtension defines the extension to use\n */\n delayLoad(forcedExtension) {\n if (this.delayLoadState !== 4) {\n return;\n }\n if (forcedExtension) {\n this._forcedExtension = forcedExtension;\n }\n this.delayLoadState = 1;\n this._loadTexture(this._delayedOnLoad, this._delayedOnError);\n }\n /**\n * Returns the reflection texture matrix\n * @returns the reflection texture matrix\n */\n getReflectionTextureMatrix() {\n return this._textureMatrix;\n }\n /**\n * Sets the reflection texture matrix\n * @param value Reflection texture matrix\n */\n setReflectionTextureMatrix(value) {\n var _a, _b;\n if (value.updateFlag === this._textureMatrix.updateFlag) {\n return;\n }\n if (value.isIdentity() !== this._textureMatrix.isIdentity()) {\n (_a = this.getScene()) === null || _a === void 0 ? void 0 : _a.markAllMaterialsAsDirty(1, (mat) => mat.getActiveTextures().indexOf(this) !== -1);\n }\n this._textureMatrix = value;\n if (!((_b = this.getScene()) === null || _b === void 0 ? void 0 : _b.useRightHandedSystem)) {\n return;\n }\n const scale = TmpVectors.Vector3[0];\n const quat = TmpVectors.Quaternion[0];\n const trans = TmpVectors.Vector3[1];\n this._textureMatrix.decompose(scale, quat, trans);\n quat.z *= -1; // these two operations correspond to negating the x and y euler angles\n quat.w *= -1;\n Matrix.ComposeToRef(scale, quat, trans, this._textureMatrixRefraction);\n }\n /**\n * Gets a suitable rotate/transform matrix when the texture is used for refraction.\n * There's a separate function from getReflectionTextureMatrix because refraction requires a special configuration of the matrix in right-handed mode.\n * @returns The refraction matrix\n */\n getRefractionTextureMatrix() {\n var _a;\n return ((_a = this.getScene()) === null || _a === void 0 ? void 0 : _a.useRightHandedSystem) ? this._textureMatrixRefraction : this._textureMatrix;\n }\n _loadTexture(onLoad = null, onError = null) {\n var _a;\n const scene = this.getScene();\n const oldTexture = this._texture;\n this._texture = this._getFromCache(this.url, this._noMipmap, undefined, undefined, this._useSRGBBuffer, this.isCube);\n const onLoadProcessing = () => {\n var _a;\n this.onLoadObservable.notifyObservers(this);\n if (oldTexture) {\n oldTexture.dispose();\n (_a = this.getScene()) === null || _a === void 0 ? void 0 : _a.markAllMaterialsAsDirty(1);\n }\n if (onLoad) {\n onLoad();\n }\n };\n const errorHandler = (message, exception) => {\n this._loadingError = true;\n this._errorObject = { message, exception };\n if (onError) {\n onError(message, exception);\n }\n Texture.OnTextureLoadErrorObservable.notifyObservers(this);\n };\n if (!this._texture) {\n if (this._prefiltered) {\n this._texture = this._getEngine().createPrefilteredCubeTexture(this.url, scene, this._lodScale, this._lodOffset, onLoad, errorHandler, this._format, this._forcedExtension, this._createPolynomials);\n }\n else {\n this._texture = this._getEngine().createCubeTexture(this.url, scene, this._files, this._noMipmap, onLoad, errorHandler, this._format, this._forcedExtension, false, this._lodScale, this._lodOffset, null, this._loaderOptions, !!this._useSRGBBuffer);\n }\n (_a = this._texture) === null || _a === void 0 ? void 0 : _a.onLoadedObservable.add(() => this.onLoadObservable.notifyObservers(this));\n }\n else {\n if (this._texture.isReady) {\n Tools.SetImmediate(() => onLoadProcessing());\n }\n else {\n this._texture.onLoadedObservable.add(() => onLoadProcessing());\n }\n }\n }\n /**\n * Parses text to create a cube texture\n * @param parsedTexture define the serialized text to read from\n * @param scene defines the hosting scene\n * @param rootUrl defines the root url of the cube texture\n * @returns a cube texture\n */\n static Parse(parsedTexture, scene, rootUrl) {\n const texture = SerializationHelper.Parse(() => {\n var _a;\n let prefiltered = false;\n if (parsedTexture.prefiltered) {\n prefiltered = parsedTexture.prefiltered;\n }\n return new CubeTexture(rootUrl + ((_a = parsedTexture.url) !== null && _a !== void 0 ? _a : parsedTexture.name), scene, parsedTexture.extensions, false, parsedTexture.files || null, null, null, undefined, prefiltered, parsedTexture.forcedExtension);\n }, parsedTexture, scene);\n // Local Cubemaps\n if (parsedTexture.boundingBoxPosition) {\n texture.boundingBoxPosition = Vector3.FromArray(parsedTexture.boundingBoxPosition);\n }\n if (parsedTexture.boundingBoxSize) {\n texture.boundingBoxSize = Vector3.FromArray(parsedTexture.boundingBoxSize);\n }\n // Animations\n if (parsedTexture.animations) {\n for (let animationIndex = 0; animationIndex < parsedTexture.animations.length; animationIndex++) {\n const parsedAnimation = parsedTexture.animations[animationIndex];\n const internalClass = GetClass(\"BABYLON.Animation\");\n if (internalClass) {\n texture.animations.push(internalClass.Parse(parsedAnimation));\n }\n }\n }\n return texture;\n }\n /**\n * Makes a clone, or deep copy, of the cube texture\n * @returns a new cube texture\n */\n clone() {\n let uniqueId = 0;\n const newCubeTexture = SerializationHelper.Clone(() => {\n const cubeTexture = new CubeTexture(this.url, this.getScene() || this._getEngine(), this._extensions, this._noMipmap, this._files);\n uniqueId = cubeTexture.uniqueId;\n return cubeTexture;\n }, this);\n newCubeTexture.uniqueId = uniqueId;\n return newCubeTexture;\n }\n}\n__decorate([\n serialize()\n], CubeTexture.prototype, \"url\", void 0);\n__decorate([\n serializeAsVector3()\n], CubeTexture.prototype, \"boundingBoxPosition\", void 0);\n__decorate([\n serializeAsVector3()\n], CubeTexture.prototype, \"boundingBoxSize\", null);\n__decorate([\n serialize(\"rotationY\")\n], CubeTexture.prototype, \"rotationY\", null);\n__decorate([\n serialize(\"files\")\n], CubeTexture.prototype, \"_files\", void 0);\n__decorate([\n serialize(\"forcedExtension\")\n], CubeTexture.prototype, \"_forcedExtension\", void 0);\n__decorate([\n serialize(\"extensions\")\n], CubeTexture.prototype, \"_extensions\", void 0);\n__decorate([\n serializeAsMatrix(\"textureMatrix\")\n], CubeTexture.prototype, \"_textureMatrix\", void 0);\n__decorate([\n serializeAsMatrix(\"textureMatrixRefraction\")\n], CubeTexture.prototype, \"_textureMatrixRefraction\", void 0);\nTexture._CubeTextureParser = CubeTexture.Parse;\n// Some exporters relies on Tools.Instantiate\nRegisterClass(\"BABYLON.CubeTexture\", CubeTexture);\n//# sourceMappingURL=cubeTexture.js.map","import { Vector3 } from \"../../Maths/math.vector.js\";\n\n/**\n * Helper class useful to convert panorama picture to their cubemap representation in 6 faces.\n */\nexport class PanoramaToCubeMapTools {\n /**\n * Converts a panorama stored in RGB right to left up to down format into a cubemap (6 faces).\n *\n * @param float32Array The source data.\n * @param inputWidth The width of the input panorama.\n * @param inputHeight The height of the input panorama.\n * @param size The willing size of the generated cubemap (each faces will be size * size pixels)\n * @returns The cubemap data\n */\n static ConvertPanoramaToCubemap(float32Array, inputWidth, inputHeight, size, supersample = false) {\n if (!float32Array) {\n throw \"ConvertPanoramaToCubemap: input cannot be null\";\n }\n if (float32Array.length != inputWidth * inputHeight * 3) {\n throw \"ConvertPanoramaToCubemap: input size is wrong\";\n }\n const textureFront = this.CreateCubemapTexture(size, this.FACE_FRONT, float32Array, inputWidth, inputHeight, supersample);\n const textureBack = this.CreateCubemapTexture(size, this.FACE_BACK, float32Array, inputWidth, inputHeight, supersample);\n const textureLeft = this.CreateCubemapTexture(size, this.FACE_LEFT, float32Array, inputWidth, inputHeight, supersample);\n const textureRight = this.CreateCubemapTexture(size, this.FACE_RIGHT, float32Array, inputWidth, inputHeight, supersample);\n const textureUp = this.CreateCubemapTexture(size, this.FACE_UP, float32Array, inputWidth, inputHeight, supersample);\n const textureDown = this.CreateCubemapTexture(size, this.FACE_DOWN, float32Array, inputWidth, inputHeight, supersample);\n return {\n front: textureFront,\n back: textureBack,\n left: textureLeft,\n right: textureRight,\n up: textureUp,\n down: textureDown,\n size: size,\n type: 1,\n format: 4,\n gammaSpace: false,\n };\n }\n static CreateCubemapTexture(texSize, faceData, float32Array, inputWidth, inputHeight, supersample = false) {\n const buffer = new ArrayBuffer(texSize * texSize * 4 * 3);\n const textureArray = new Float32Array(buffer);\n // If supersampling, determine number of samples needed when source texture width is divided for 4 cube faces\n const samples = supersample ? Math.max(1, Math.round(inputWidth / 4 / texSize)) : 1;\n const sampleFactor = 1 / samples;\n const sampleFactorSqr = sampleFactor * sampleFactor;\n const rotDX1 = faceData[1].subtract(faceData[0]).scale(sampleFactor / texSize);\n const rotDX2 = faceData[3].subtract(faceData[2]).scale(sampleFactor / texSize);\n const dy = 1 / texSize;\n let fy = 0;\n for (let y = 0; y < texSize; y++) {\n for (let sy = 0; sy < samples; sy++) {\n let xv1 = faceData[0];\n let xv2 = faceData[2];\n for (let x = 0; x < texSize; x++) {\n for (let sx = 0; sx < samples; sx++) {\n const v = xv2.subtract(xv1).scale(fy).add(xv1);\n v.normalize();\n const color = this.CalcProjectionSpherical(v, float32Array, inputWidth, inputHeight);\n // 3 channels per pixels\n textureArray[y * texSize * 3 + x * 3 + 0] += color.r * sampleFactorSqr;\n textureArray[y * texSize * 3 + x * 3 + 1] += color.g * sampleFactorSqr;\n textureArray[y * texSize * 3 + x * 3 + 2] += color.b * sampleFactorSqr;\n xv1 = xv1.add(rotDX1);\n xv2 = xv2.add(rotDX2);\n }\n }\n fy += dy * sampleFactor;\n }\n }\n return textureArray;\n }\n static CalcProjectionSpherical(vDir, float32Array, inputWidth, inputHeight) {\n let theta = Math.atan2(vDir.z, vDir.x);\n const phi = Math.acos(vDir.y);\n while (theta < -Math.PI) {\n theta += 2 * Math.PI;\n }\n while (theta > Math.PI) {\n theta -= 2 * Math.PI;\n }\n let dx = theta / Math.PI;\n const dy = phi / Math.PI;\n // recenter.\n dx = dx * 0.5 + 0.5;\n let px = Math.round(dx * inputWidth);\n if (px < 0) {\n px = 0;\n }\n else if (px >= inputWidth) {\n px = inputWidth - 1;\n }\n let py = Math.round(dy * inputHeight);\n if (py < 0) {\n py = 0;\n }\n else if (py >= inputHeight) {\n py = inputHeight - 1;\n }\n const inputY = inputHeight - py - 1;\n const r = float32Array[inputY * inputWidth * 3 + px * 3 + 0];\n const g = float32Array[inputY * inputWidth * 3 + px * 3 + 1];\n const b = float32Array[inputY * inputWidth * 3 + px * 3 + 2];\n return {\n r: r,\n g: g,\n b: b,\n };\n }\n}\nPanoramaToCubeMapTools.FACE_LEFT = [new Vector3(-1.0, -1.0, -1.0), new Vector3(1.0, -1.0, -1.0), new Vector3(-1.0, 1.0, -1.0), new Vector3(1.0, 1.0, -1.0)];\nPanoramaToCubeMapTools.FACE_RIGHT = [new Vector3(1.0, -1.0, 1.0), new Vector3(-1.0, -1.0, 1.0), new Vector3(1.0, 1.0, 1.0), new Vector3(-1.0, 1.0, 1.0)];\nPanoramaToCubeMapTools.FACE_FRONT = [new Vector3(1.0, -1.0, -1.0), new Vector3(1.0, -1.0, 1.0), new Vector3(1.0, 1.0, -1.0), new Vector3(1.0, 1.0, 1.0)];\nPanoramaToCubeMapTools.FACE_BACK = [new Vector3(-1.0, -1.0, 1.0), new Vector3(-1.0, -1.0, -1.0), new Vector3(-1.0, 1.0, 1.0), new Vector3(-1.0, 1.0, -1.0)];\nPanoramaToCubeMapTools.FACE_DOWN = [new Vector3(1.0, 1.0, -1.0), new Vector3(1.0, 1.0, 1.0), new Vector3(-1.0, 1.0, -1.0), new Vector3(-1.0, 1.0, 1.0)];\nPanoramaToCubeMapTools.FACE_UP = [new Vector3(-1.0, -1.0, -1.0), new Vector3(-1.0, -1.0, 1.0), new Vector3(1.0, -1.0, -1.0), new Vector3(1.0, -1.0, 1.0)];\n//# sourceMappingURL=panoramaToCubemap.js.map","import { PanoramaToCubeMapTools } from \"./panoramaToCubemap.js\";\n/**\n * This groups tools to convert HDR texture to native colors array.\n */\nexport class HDRTools {\n static _Ldexp(mantissa, exponent) {\n if (exponent > 1023) {\n return mantissa * Math.pow(2, 1023) * Math.pow(2, exponent - 1023);\n }\n if (exponent < -1074) {\n return mantissa * Math.pow(2, -1074) * Math.pow(2, exponent + 1074);\n }\n return mantissa * Math.pow(2, exponent);\n }\n static _Rgbe2float(float32array, red, green, blue, exponent, index) {\n if (exponent > 0) {\n /*nonzero pixel*/\n exponent = this._Ldexp(1.0, exponent - (128 + 8));\n float32array[index + 0] = red * exponent;\n float32array[index + 1] = green * exponent;\n float32array[index + 2] = blue * exponent;\n }\n else {\n float32array[index + 0] = 0;\n float32array[index + 1] = 0;\n float32array[index + 2] = 0;\n }\n }\n static _ReadStringLine(uint8array, startIndex) {\n let line = \"\";\n let character = \"\";\n for (let i = startIndex; i < uint8array.length - startIndex; i++) {\n character = String.fromCharCode(uint8array[i]);\n if (character == \"\\n\") {\n break;\n }\n line += character;\n }\n return line;\n }\n /**\n * Reads header information from an RGBE texture stored in a native array.\n * More information on this format are available here:\n * https://en.wikipedia.org/wiki/RGBE_image_format\n *\n * @param uint8array The binary file stored in native array.\n * @returns The header information.\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n static RGBE_ReadHeader(uint8array) {\n let height = 0;\n let width = 0;\n let line = this._ReadStringLine(uint8array, 0);\n if (line[0] != \"#\" || line[1] != \"?\") {\n throw \"Bad HDR Format.\";\n }\n let endOfHeader = false;\n let findFormat = false;\n let lineIndex = 0;\n do {\n lineIndex += line.length + 1;\n line = this._ReadStringLine(uint8array, lineIndex);\n if (line == \"FORMAT=32-bit_rle_rgbe\") {\n findFormat = true;\n }\n else if (line.length == 0) {\n endOfHeader = true;\n }\n } while (!endOfHeader);\n if (!findFormat) {\n throw \"HDR Bad header format, unsupported FORMAT\";\n }\n lineIndex += line.length + 1;\n line = this._ReadStringLine(uint8array, lineIndex);\n const sizeRegexp = /^-Y (.*) \\+X (.*)$/g;\n const match = sizeRegexp.exec(line);\n // TODO. Support +Y and -X if needed.\n if (!match || match.length < 3) {\n throw \"HDR Bad header format, no size\";\n }\n width = parseInt(match[2]);\n height = parseInt(match[1]);\n if (width < 8 || width > 0x7fff) {\n throw \"HDR Bad header format, unsupported size\";\n }\n lineIndex += line.length + 1;\n return {\n height: height,\n width: width,\n dataPosition: lineIndex,\n };\n }\n /**\n * Returns the cubemap information (each faces texture data) extracted from an RGBE texture.\n * This RGBE texture needs to store the information as a panorama.\n *\n * More information on this format are available here:\n * https://en.wikipedia.org/wiki/RGBE_image_format\n *\n * @param buffer The binary file stored in an array buffer.\n * @param size The expected size of the extracted cubemap.\n * @returns The Cube Map information.\n */\n static GetCubeMapTextureData(buffer, size, supersample = false) {\n const uint8array = new Uint8Array(buffer);\n const hdrInfo = this.RGBE_ReadHeader(uint8array);\n const data = this.RGBE_ReadPixels(uint8array, hdrInfo);\n const cubeMapData = PanoramaToCubeMapTools.ConvertPanoramaToCubemap(data, hdrInfo.width, hdrInfo.height, size, supersample);\n return cubeMapData;\n }\n /**\n * Returns the pixels data extracted from an RGBE texture.\n * This pixels will be stored left to right up to down in the R G B order in one array.\n *\n * More information on this format are available here:\n * https://en.wikipedia.org/wiki/RGBE_image_format\n *\n * @param uint8array The binary file stored in an array buffer.\n * @param hdrInfo The header information of the file.\n * @returns The pixels data in RGB right to left up to down order.\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n static RGBE_ReadPixels(uint8array, hdrInfo) {\n return this._RGBEReadPixelsRLE(uint8array, hdrInfo);\n }\n static _RGBEReadPixelsRLE(uint8array, hdrInfo) {\n let num_scanlines = hdrInfo.height;\n const scanline_width = hdrInfo.width;\n let a, b, c, d, count;\n let dataIndex = hdrInfo.dataPosition;\n let index = 0, endIndex = 0, i = 0;\n const scanLineArrayBuffer = new ArrayBuffer(scanline_width * 4); // four channel R G B E\n const scanLineArray = new Uint8Array(scanLineArrayBuffer);\n // 3 channels of 4 bytes per pixel in float.\n const resultBuffer = new ArrayBuffer(hdrInfo.width * hdrInfo.height * 4 * 3);\n const resultArray = new Float32Array(resultBuffer);\n // read in each successive scanline\n while (num_scanlines > 0) {\n a = uint8array[dataIndex++];\n b = uint8array[dataIndex++];\n c = uint8array[dataIndex++];\n d = uint8array[dataIndex++];\n if (a != 2 || b != 2 || c & 0x80 || hdrInfo.width < 8 || hdrInfo.width > 32767) {\n return this._RGBEReadPixelsNOTRLE(uint8array, hdrInfo);\n }\n if (((c << 8) | d) != scanline_width) {\n throw \"HDR Bad header format, wrong scan line width\";\n }\n index = 0;\n // read each of the four channels for the scanline into the buffer\n for (i = 0; i < 4; i++) {\n endIndex = (i + 1) * scanline_width;\n while (index < endIndex) {\n a = uint8array[dataIndex++];\n b = uint8array[dataIndex++];\n if (a > 128) {\n // a run of the same value\n count = a - 128;\n if (count == 0 || count > endIndex - index) {\n throw \"HDR Bad Format, bad scanline data (run)\";\n }\n while (count-- > 0) {\n scanLineArray[index++] = b;\n }\n }\n else {\n // a non-run\n count = a;\n if (count == 0 || count > endIndex - index) {\n throw \"HDR Bad Format, bad scanline data (non-run)\";\n }\n scanLineArray[index++] = b;\n if (--count > 0) {\n for (let j = 0; j < count; j++) {\n scanLineArray[index++] = uint8array[dataIndex++];\n }\n }\n }\n }\n }\n // now convert data from buffer into floats\n for (i = 0; i < scanline_width; i++) {\n a = scanLineArray[i];\n b = scanLineArray[i + scanline_width];\n c = scanLineArray[i + 2 * scanline_width];\n d = scanLineArray[i + 3 * scanline_width];\n this._Rgbe2float(resultArray, a, b, c, d, (hdrInfo.height - num_scanlines) * scanline_width * 3 + i * 3);\n }\n num_scanlines--;\n }\n return resultArray;\n }\n static _RGBEReadPixelsNOTRLE(uint8array, hdrInfo) {\n // this file is not run length encoded\n // read values sequentially\n let num_scanlines = hdrInfo.height;\n const scanline_width = hdrInfo.width;\n let a, b, c, d, i;\n let dataIndex = hdrInfo.dataPosition;\n // 3 channels of 4 bytes per pixel in float.\n const resultBuffer = new ArrayBuffer(hdrInfo.width * hdrInfo.height * 4 * 3);\n const resultArray = new Float32Array(resultBuffer);\n // read in each successive scanline\n while (num_scanlines > 0) {\n for (i = 0; i < hdrInfo.width; i++) {\n a = uint8array[dataIndex++];\n b = uint8array[dataIndex++];\n c = uint8array[dataIndex++];\n d = uint8array[dataIndex++];\n this._Rgbe2float(resultArray, a, b, c, d, (hdrInfo.height - num_scanlines) * scanline_width * 3 + i * 3);\n }\n num_scanlines--;\n }\n return resultArray;\n }\n}\n//# sourceMappingURL=hdr.js.map","/* eslint-disable @typescript-eslint/naming-convention */\nimport { Vector3 } from \"../Maths/math.vector.js\";\nimport { TmpVectors } from \"./math.js\";\n// https://dickyjim.wordpress.com/2013/09/04/spherical-harmonics-for-beginners/\n// http://silviojemma.com/public/papers/lighting/spherical-harmonic-lighting.pdf\n// https://www.ppsloan.org/publications/StupidSH36.pdf\n// http://cseweb.ucsd.edu/~ravir/papers/envmap/envmap.pdf\n// https://www.ppsloan.org/publications/SHJCGT.pdf\n// https://www.ppsloan.org/publications/shdering.pdf\n// https://google.github.io/filament/Filament.md.html#annex/sphericalharmonics\n// https://patapom.com/blog/SHPortal/\n// https://imdoingitwrong.wordpress.com/2011/04/14/spherical-harmonics-wtf/\n// Using real SH basis:\n// m>0 m m\n// y = sqrt(2) * K * P * cos(m*phi) * cos(theta)\n// l l l\n//\n// m<0 m |m|\n// y = sqrt(2) * K * P * sin(m*phi) * cos(theta)\n// l l l\n//\n// m=0 0 0\n// y = K * P * trigono terms\n// l l l\n//\n// m (2l + 1)(l - |m|)!\n// K = sqrt(------------------)\n// l 4pi(l + |m|)!\n//\n// and P by recursion:\n//\n// P00(x) = 1\n// P01(x) = x\n// Pll(x) = (-1^l)(2l - 1)!!(1-x*x)^(1/2)\n// ((2l - 1)x[Pl-1/m]-(l + m - 1)[Pl-2/m])\n// Plm(x) = ---------------------------------------\n// l - m\n// Leaving the trigonometric terms aside we can precompute the constants to :\nconst SH3ylmBasisConstants = [\n Math.sqrt(1 / (4 * Math.PI)),\n -Math.sqrt(3 / (4 * Math.PI)),\n Math.sqrt(3 / (4 * Math.PI)),\n -Math.sqrt(3 / (4 * Math.PI)),\n Math.sqrt(15 / (4 * Math.PI)),\n -Math.sqrt(15 / (4 * Math.PI)),\n Math.sqrt(5 / (16 * Math.PI)),\n -Math.sqrt(15 / (4 * Math.PI)),\n Math.sqrt(15 / (16 * Math.PI)), // l22\n];\n// cm = cos(m * phi)\n// sm = sin(m * phi)\n// {x,y,z} = {cos(phi)sin(theta), sin(phi)sin(theta), cos(theta)}\n// By recursion on using trigo identities:\nconst SH3ylmBasisTrigonometricTerms = [\n () => 1,\n (direction) => direction.y,\n (direction) => direction.z,\n (direction) => direction.x,\n (direction) => direction.x * direction.y,\n (direction) => direction.y * direction.z,\n (direction) => 3 * direction.z * direction.z - 1,\n (direction) => direction.x * direction.z,\n (direction) => direction.x * direction.x - direction.y * direction.y, // l22\n];\n// Wrap the full compute\nconst applySH3 = (lm, direction) => {\n return SH3ylmBasisConstants[lm] * SH3ylmBasisTrigonometricTerms[lm](direction);\n};\n// Derived from the integration of the a kernel convolution to SH.\n// Great explanation here: https://patapom.com/blog/SHPortal/#about-distant-radiance-and-irradiance-environments\nconst SHCosKernelConvolution = [Math.PI, (2 * Math.PI) / 3, (2 * Math.PI) / 3, (2 * Math.PI) / 3, Math.PI / 4, Math.PI / 4, Math.PI / 4, Math.PI / 4, Math.PI / 4];\n/**\n * Class representing spherical harmonics coefficients to the 3rd degree\n */\nexport class SphericalHarmonics {\n constructor() {\n /**\n * Defines whether or not the harmonics have been prescaled for rendering.\n */\n this.preScaled = false;\n /**\n * The l0,0 coefficients of the spherical harmonics\n */\n this.l00 = Vector3.Zero();\n /**\n * The l1,-1 coefficients of the spherical harmonics\n */\n this.l1_1 = Vector3.Zero();\n /**\n * The l1,0 coefficients of the spherical harmonics\n */\n this.l10 = Vector3.Zero();\n /**\n * The l1,1 coefficients of the spherical harmonics\n */\n this.l11 = Vector3.Zero();\n /**\n * The l2,-2 coefficients of the spherical harmonics\n */\n this.l2_2 = Vector3.Zero();\n /**\n * The l2,-1 coefficients of the spherical harmonics\n */\n this.l2_1 = Vector3.Zero();\n /**\n * The l2,0 coefficients of the spherical harmonics\n */\n this.l20 = Vector3.Zero();\n /**\n * The l2,1 coefficients of the spherical harmonics\n */\n this.l21 = Vector3.Zero();\n /**\n * The l2,2 coefficients of the spherical harmonics\n */\n this.l22 = Vector3.Zero();\n }\n /**\n * Adds a light to the spherical harmonics\n * @param direction the direction of the light\n * @param color the color of the light\n * @param deltaSolidAngle the delta solid angle of the light\n */\n addLight(direction, color, deltaSolidAngle) {\n TmpVectors.Vector3[0].set(color.r, color.g, color.b);\n const colorVector = TmpVectors.Vector3[0];\n const c = TmpVectors.Vector3[1];\n colorVector.scaleToRef(deltaSolidAngle, c);\n c.scaleToRef(applySH3(0, direction), TmpVectors.Vector3[2]);\n this.l00.addInPlace(TmpVectors.Vector3[2]);\n c.scaleToRef(applySH3(1, direction), TmpVectors.Vector3[2]);\n this.l1_1.addInPlace(TmpVectors.Vector3[2]);\n c.scaleToRef(applySH3(2, direction), TmpVectors.Vector3[2]);\n this.l10.addInPlace(TmpVectors.Vector3[2]);\n c.scaleToRef(applySH3(3, direction), TmpVectors.Vector3[2]);\n this.l11.addInPlace(TmpVectors.Vector3[2]);\n c.scaleToRef(applySH3(4, direction), TmpVectors.Vector3[2]);\n this.l2_2.addInPlace(TmpVectors.Vector3[2]);\n c.scaleToRef(applySH3(5, direction), TmpVectors.Vector3[2]);\n this.l2_1.addInPlace(TmpVectors.Vector3[2]);\n c.scaleToRef(applySH3(6, direction), TmpVectors.Vector3[2]);\n this.l20.addInPlace(TmpVectors.Vector3[2]);\n c.scaleToRef(applySH3(7, direction), TmpVectors.Vector3[2]);\n this.l21.addInPlace(TmpVectors.Vector3[2]);\n c.scaleToRef(applySH3(8, direction), TmpVectors.Vector3[2]);\n this.l22.addInPlace(TmpVectors.Vector3[2]);\n }\n /**\n * Scales the spherical harmonics by the given amount\n * @param scale the amount to scale\n */\n scaleInPlace(scale) {\n this.l00.scaleInPlace(scale);\n this.l1_1.scaleInPlace(scale);\n this.l10.scaleInPlace(scale);\n this.l11.scaleInPlace(scale);\n this.l2_2.scaleInPlace(scale);\n this.l2_1.scaleInPlace(scale);\n this.l20.scaleInPlace(scale);\n this.l21.scaleInPlace(scale);\n this.l22.scaleInPlace(scale);\n }\n /**\n * Convert from incident radiance (Li) to irradiance (E) by applying convolution with the cosine-weighted hemisphere.\n *\n * ```\n * E_lm = A_l * L_lm\n * ```\n *\n * In spherical harmonics this convolution amounts to scaling factors for each frequency band.\n * This corresponds to equation 5 in \"An Efficient Representation for Irradiance Environment Maps\", where\n * the scaling factors are given in equation 9.\n */\n convertIncidentRadianceToIrradiance() {\n // Constant (Band 0)\n this.l00.scaleInPlace(SHCosKernelConvolution[0]);\n // Linear (Band 1)\n this.l1_1.scaleInPlace(SHCosKernelConvolution[1]);\n this.l10.scaleInPlace(SHCosKernelConvolution[2]);\n this.l11.scaleInPlace(SHCosKernelConvolution[3]);\n // Quadratic (Band 2)\n this.l2_2.scaleInPlace(SHCosKernelConvolution[4]);\n this.l2_1.scaleInPlace(SHCosKernelConvolution[5]);\n this.l20.scaleInPlace(SHCosKernelConvolution[6]);\n this.l21.scaleInPlace(SHCosKernelConvolution[7]);\n this.l22.scaleInPlace(SHCosKernelConvolution[8]);\n }\n /**\n * Convert from irradiance to outgoing radiance for Lambertian BDRF, suitable for efficient shader evaluation.\n *\n * ```\n * L = (1/pi) * E * rho\n * ```\n *\n * This is done by an additional scale by 1/pi, so is a fairly trivial operation but important conceptually.\n */\n convertIrradianceToLambertianRadiance() {\n this.scaleInPlace(1.0 / Math.PI);\n // The resultant SH now represents outgoing radiance, so includes the Lambert 1/pi normalisation factor but without albedo (rho) applied\n // (The pixel shader must apply albedo after texture fetches, etc).\n }\n /**\n * Integrates the reconstruction coefficients directly in to the SH preventing further\n * required operations at run time.\n *\n * This is simply done by scaling back the SH with Ylm constants parameter.\n * The trigonometric part being applied by the shader at run time.\n */\n preScaleForRendering() {\n this.preScaled = true;\n this.l00.scaleInPlace(SH3ylmBasisConstants[0]);\n this.l1_1.scaleInPlace(SH3ylmBasisConstants[1]);\n this.l10.scaleInPlace(SH3ylmBasisConstants[2]);\n this.l11.scaleInPlace(SH3ylmBasisConstants[3]);\n this.l2_2.scaleInPlace(SH3ylmBasisConstants[4]);\n this.l2_1.scaleInPlace(SH3ylmBasisConstants[5]);\n this.l20.scaleInPlace(SH3ylmBasisConstants[6]);\n this.l21.scaleInPlace(SH3ylmBasisConstants[7]);\n this.l22.scaleInPlace(SH3ylmBasisConstants[8]);\n }\n /**\n * update the spherical harmonics coefficients from the given array\n * @param data defines the 9x3 coefficients (l00, l1-1, l10, l11, l2-2, l2-1, l20, l21, l22)\n * @returns the spherical harmonics (this)\n */\n updateFromArray(data) {\n Vector3.FromArrayToRef(data[0], 0, this.l00);\n Vector3.FromArrayToRef(data[1], 0, this.l1_1);\n Vector3.FromArrayToRef(data[2], 0, this.l10);\n Vector3.FromArrayToRef(data[3], 0, this.l11);\n Vector3.FromArrayToRef(data[4], 0, this.l2_2);\n Vector3.FromArrayToRef(data[5], 0, this.l2_1);\n Vector3.FromArrayToRef(data[6], 0, this.l20);\n Vector3.FromArrayToRef(data[7], 0, this.l21);\n Vector3.FromArrayToRef(data[8], 0, this.l22);\n return this;\n }\n /**\n * update the spherical harmonics coefficients from the given floats array\n * @param data defines the 9x3 coefficients (l00, l1-1, l10, l11, l2-2, l2-1, l20, l21, l22)\n * @returns the spherical harmonics (this)\n */\n updateFromFloatsArray(data) {\n Vector3.FromFloatsToRef(data[0], data[1], data[2], this.l00);\n Vector3.FromFloatsToRef(data[3], data[4], data[5], this.l1_1);\n Vector3.FromFloatsToRef(data[6], data[7], data[8], this.l10);\n Vector3.FromFloatsToRef(data[9], data[10], data[11], this.l11);\n Vector3.FromFloatsToRef(data[12], data[13], data[14], this.l2_2);\n Vector3.FromFloatsToRef(data[15], data[16], data[17], this.l2_1);\n Vector3.FromFloatsToRef(data[18], data[19], data[20], this.l20);\n Vector3.FromFloatsToRef(data[21], data[22], data[23], this.l21);\n Vector3.FromFloatsToRef(data[24], data[25], data[26], this.l22);\n return this;\n }\n /**\n * Constructs a spherical harmonics from an array.\n * @param data defines the 9x3 coefficients (l00, l1-1, l10, l11, l2-2, l2-1, l20, l21, l22)\n * @returns the spherical harmonics\n */\n static FromArray(data) {\n const sh = new SphericalHarmonics();\n return sh.updateFromArray(data);\n }\n // Keep for references.\n /**\n * Gets the spherical harmonics from polynomial\n * @param polynomial the spherical polynomial\n * @returns the spherical harmonics\n */\n static FromPolynomial(polynomial) {\n const result = new SphericalHarmonics();\n result.l00 = polynomial.xx.scale(0.376127).add(polynomial.yy.scale(0.376127)).add(polynomial.zz.scale(0.376126));\n result.l1_1 = polynomial.y.scale(0.977204);\n result.l10 = polynomial.z.scale(0.977204);\n result.l11 = polynomial.x.scale(0.977204);\n result.l2_2 = polynomial.xy.scale(1.16538);\n result.l2_1 = polynomial.yz.scale(1.16538);\n result.l20 = polynomial.zz.scale(1.34567).subtract(polynomial.xx.scale(0.672834)).subtract(polynomial.yy.scale(0.672834));\n result.l21 = polynomial.zx.scale(1.16538);\n result.l22 = polynomial.xx.scale(1.16538).subtract(polynomial.yy.scale(1.16538));\n result.l1_1.scaleInPlace(-1);\n result.l11.scaleInPlace(-1);\n result.l2_1.scaleInPlace(-1);\n result.l21.scaleInPlace(-1);\n result.scaleInPlace(Math.PI);\n return result;\n }\n}\n/**\n * Class representing spherical polynomial coefficients to the 3rd degree\n */\nexport class SphericalPolynomial {\n constructor() {\n /**\n * The x coefficients of the spherical polynomial\n */\n this.x = Vector3.Zero();\n /**\n * The y coefficients of the spherical polynomial\n */\n this.y = Vector3.Zero();\n /**\n * The z coefficients of the spherical polynomial\n */\n this.z = Vector3.Zero();\n /**\n * The xx coefficients of the spherical polynomial\n */\n this.xx = Vector3.Zero();\n /**\n * The yy coefficients of the spherical polynomial\n */\n this.yy = Vector3.Zero();\n /**\n * The zz coefficients of the spherical polynomial\n */\n this.zz = Vector3.Zero();\n /**\n * The xy coefficients of the spherical polynomial\n */\n this.xy = Vector3.Zero();\n /**\n * The yz coefficients of the spherical polynomial\n */\n this.yz = Vector3.Zero();\n /**\n * The zx coefficients of the spherical polynomial\n */\n this.zx = Vector3.Zero();\n }\n /**\n * The spherical harmonics used to create the polynomials.\n */\n get preScaledHarmonics() {\n if (!this._harmonics) {\n this._harmonics = SphericalHarmonics.FromPolynomial(this);\n }\n if (!this._harmonics.preScaled) {\n this._harmonics.preScaleForRendering();\n }\n return this._harmonics;\n }\n /**\n * Adds an ambient color to the spherical polynomial\n * @param color the color to add\n */\n addAmbient(color) {\n TmpVectors.Vector3[0].copyFromFloats(color.r, color.g, color.b);\n const colorVector = TmpVectors.Vector3[0];\n this.xx.addInPlace(colorVector);\n this.yy.addInPlace(colorVector);\n this.zz.addInPlace(colorVector);\n }\n /**\n * Scales the spherical polynomial by the given amount\n * @param scale the amount to scale\n */\n scaleInPlace(scale) {\n this.x.scaleInPlace(scale);\n this.y.scaleInPlace(scale);\n this.z.scaleInPlace(scale);\n this.xx.scaleInPlace(scale);\n this.yy.scaleInPlace(scale);\n this.zz.scaleInPlace(scale);\n this.yz.scaleInPlace(scale);\n this.zx.scaleInPlace(scale);\n this.xy.scaleInPlace(scale);\n }\n /**\n * Updates the spherical polynomial from harmonics\n * @param harmonics the spherical harmonics\n * @returns the spherical polynomial\n */\n updateFromHarmonics(harmonics) {\n this._harmonics = harmonics;\n this.x.copyFrom(harmonics.l11);\n this.x.scaleInPlace(1.02333).scaleInPlace(-1);\n this.y.copyFrom(harmonics.l1_1);\n this.y.scaleInPlace(1.02333).scaleInPlace(-1);\n this.z.copyFrom(harmonics.l10);\n this.z.scaleInPlace(1.02333);\n this.xx.copyFrom(harmonics.l00);\n TmpVectors.Vector3[0].copyFrom(harmonics.l20).scaleInPlace(0.247708);\n TmpVectors.Vector3[1].copyFrom(harmonics.l22).scaleInPlace(0.429043);\n this.xx.scaleInPlace(0.886277).subtractInPlace(TmpVectors.Vector3[0]).addInPlace(TmpVectors.Vector3[1]);\n this.yy.copyFrom(harmonics.l00);\n this.yy.scaleInPlace(0.886277).subtractInPlace(TmpVectors.Vector3[0]).subtractInPlace(TmpVectors.Vector3[1]);\n this.zz.copyFrom(harmonics.l00);\n TmpVectors.Vector3[0].copyFrom(harmonics.l20).scaleInPlace(0.495417);\n this.zz.scaleInPlace(0.886277).addInPlace(TmpVectors.Vector3[0]);\n this.yz.copyFrom(harmonics.l2_1);\n this.yz.scaleInPlace(0.858086).scaleInPlace(-1);\n this.zx.copyFrom(harmonics.l21);\n this.zx.scaleInPlace(0.858086).scaleInPlace(-1);\n this.xy.copyFrom(harmonics.l2_2);\n this.xy.scaleInPlace(0.858086);\n this.scaleInPlace(1.0 / Math.PI);\n return this;\n }\n /**\n * Gets the spherical polynomial from harmonics\n * @param harmonics the spherical harmonics\n * @returns the spherical polynomial\n */\n static FromHarmonics(harmonics) {\n const result = new SphericalPolynomial();\n return result.updateFromHarmonics(harmonics);\n }\n /**\n * Constructs a spherical polynomial from an array.\n * @param data defines the 9x3 coefficients (x, y, z, xx, yy, zz, yz, zx, xy)\n * @returns the spherical polynomial\n */\n static FromArray(data) {\n const sp = new SphericalPolynomial();\n Vector3.FromArrayToRef(data[0], 0, sp.x);\n Vector3.FromArrayToRef(data[1], 0, sp.y);\n Vector3.FromArrayToRef(data[2], 0, sp.z);\n Vector3.FromArrayToRef(data[3], 0, sp.xx);\n Vector3.FromArrayToRef(data[4], 0, sp.yy);\n Vector3.FromArrayToRef(data[5], 0, sp.zz);\n Vector3.FromArrayToRef(data[6], 0, sp.yz);\n Vector3.FromArrayToRef(data[7], 0, sp.zx);\n Vector3.FromArrayToRef(data[8], 0, sp.xy);\n return sp;\n }\n}\n//# sourceMappingURL=sphericalPolynomial.js.map","import { Vector3 } from \"../../Maths/math.vector.js\";\nimport { Scalar } from \"../../Maths/math.scalar.js\";\nimport { SphericalPolynomial, SphericalHarmonics } from \"../../Maths/sphericalPolynomial.js\";\n\nimport { ToLinearSpace } from \"../../Maths/math.constants.js\";\nimport { Color3 } from \"../../Maths/math.color.js\";\nclass FileFaceOrientation {\n constructor(name, worldAxisForNormal, worldAxisForFileX, worldAxisForFileY) {\n this.name = name;\n this.worldAxisForNormal = worldAxisForNormal;\n this.worldAxisForFileX = worldAxisForFileX;\n this.worldAxisForFileY = worldAxisForFileY;\n }\n}\n/**\n * Helper class dealing with the extraction of spherical polynomial dataArray\n * from a cube map.\n */\nexport class CubeMapToSphericalPolynomialTools {\n /**\n * Converts a texture to the according Spherical Polynomial data.\n * This extracts the first 3 orders only as they are the only one used in the lighting.\n *\n * @param texture The texture to extract the information from.\n * @returns The Spherical Polynomial data.\n */\n static ConvertCubeMapTextureToSphericalPolynomial(texture) {\n var _a;\n if (!texture.isCube) {\n // Only supports cube Textures currently.\n return null;\n }\n (_a = texture.getScene()) === null || _a === void 0 ? void 0 : _a.getEngine().flushFramebuffer();\n const size = texture.getSize().width;\n const rightPromise = texture.readPixels(0, undefined, undefined, false);\n const leftPromise = texture.readPixels(1, undefined, undefined, false);\n let upPromise;\n let downPromise;\n if (texture.isRenderTarget) {\n upPromise = texture.readPixels(3, undefined, undefined, false);\n downPromise = texture.readPixels(2, undefined, undefined, false);\n }\n else {\n upPromise = texture.readPixels(2, undefined, undefined, false);\n downPromise = texture.readPixels(3, undefined, undefined, false);\n }\n const frontPromise = texture.readPixels(4, undefined, undefined, false);\n const backPromise = texture.readPixels(5, undefined, undefined, false);\n const gammaSpace = texture.gammaSpace;\n // Always read as RGBA.\n const format = 5;\n let type = 0;\n if (texture.textureType == 1 || texture.textureType == 2) {\n type = 1;\n }\n return new Promise((resolve) => {\n Promise.all([leftPromise, rightPromise, upPromise, downPromise, frontPromise, backPromise]).then(([left, right, up, down, front, back]) => {\n const cubeInfo = {\n size,\n right,\n left,\n up,\n down,\n front,\n back,\n format,\n type,\n gammaSpace,\n };\n resolve(this.ConvertCubeMapToSphericalPolynomial(cubeInfo));\n });\n });\n }\n /**\n * Compute the area on the unit sphere of the rectangle defined by (x,y) and the origin\n * See https://www.rorydriscoll.com/2012/01/15/cubemap-texel-solid-angle/\n * @param x\n * @param y\n */\n static _AreaElement(x, y) {\n return Math.atan2(x * y, Math.sqrt(x * x + y * y + 1));\n }\n /**\n * Converts a cubemap to the according Spherical Polynomial data.\n * This extracts the first 3 orders only as they are the only one used in the lighting.\n *\n * @param cubeInfo The Cube map to extract the information from.\n * @returns The Spherical Polynomial data.\n */\n static ConvertCubeMapToSphericalPolynomial(cubeInfo) {\n const sphericalHarmonics = new SphericalHarmonics();\n let totalSolidAngle = 0.0;\n // The (u,v) range is [-1,+1], so the distance between each texel is 2/Size.\n const du = 2.0 / cubeInfo.size;\n const dv = du;\n const halfTexel = 0.5 * du;\n // The (u,v) of the first texel is half a texel from the corner (-1,-1).\n const minUV = halfTexel - 1.0;\n for (let faceIndex = 0; faceIndex < 6; faceIndex++) {\n const fileFace = this._FileFaces[faceIndex];\n const dataArray = cubeInfo[fileFace.name];\n let v = minUV;\n // TODO: we could perform the summation directly into a SphericalPolynomial (SP), which is more efficient than SphericalHarmonic (SH).\n // This is possible because during the summation we do not need the SH-specific properties, e.g. orthogonality.\n // Because SP is still linear, so summation is fine in that basis.\n const stride = cubeInfo.format === 5 ? 4 : 3;\n for (let y = 0; y < cubeInfo.size; y++) {\n let u = minUV;\n for (let x = 0; x < cubeInfo.size; x++) {\n // World direction (not normalised)\n const worldDirection = fileFace.worldAxisForFileX.scale(u).add(fileFace.worldAxisForFileY.scale(v)).add(fileFace.worldAxisForNormal);\n worldDirection.normalize();\n const deltaSolidAngle = this._AreaElement(u - halfTexel, v - halfTexel) -\n this._AreaElement(u - halfTexel, v + halfTexel) -\n this._AreaElement(u + halfTexel, v - halfTexel) +\n this._AreaElement(u + halfTexel, v + halfTexel);\n let r = dataArray[y * cubeInfo.size * stride + x * stride + 0];\n let g = dataArray[y * cubeInfo.size * stride + x * stride + 1];\n let b = dataArray[y * cubeInfo.size * stride + x * stride + 2];\n // Prevent NaN harmonics with extreme HDRI data.\n if (isNaN(r)) {\n r = 0;\n }\n if (isNaN(g)) {\n g = 0;\n }\n if (isNaN(b)) {\n b = 0;\n }\n // Handle Integer types.\n if (cubeInfo.type === 0) {\n r /= 255;\n g /= 255;\n b /= 255;\n }\n // Handle Gamma space textures.\n if (cubeInfo.gammaSpace) {\n r = Math.pow(Scalar.Clamp(r), ToLinearSpace);\n g = Math.pow(Scalar.Clamp(g), ToLinearSpace);\n b = Math.pow(Scalar.Clamp(b), ToLinearSpace);\n }\n // Prevent to explode in case of really high dynamic ranges.\n // sh 3 would not be enough to accurately represent it.\n const max = this.MAX_HDRI_VALUE;\n if (this.PRESERVE_CLAMPED_COLORS) {\n const currentMax = Math.max(r, g, b);\n if (currentMax > max) {\n const factor = max / currentMax;\n r *= factor;\n g *= factor;\n b *= factor;\n }\n }\n else {\n r = Scalar.Clamp(r, 0, max);\n g = Scalar.Clamp(g, 0, max);\n b = Scalar.Clamp(b, 0, max);\n }\n const color = new Color3(r, g, b);\n sphericalHarmonics.addLight(worldDirection, color, deltaSolidAngle);\n totalSolidAngle += deltaSolidAngle;\n u += du;\n }\n v += dv;\n }\n }\n // Solid angle for entire sphere is 4*pi\n const sphereSolidAngle = 4.0 * Math.PI;\n // Adjust the solid angle to allow for how many faces we processed.\n const facesProcessed = 6.0;\n const expectedSolidAngle = (sphereSolidAngle * facesProcessed) / 6.0;\n // Adjust the harmonics so that the accumulated solid angle matches the expected solid angle.\n // This is needed because the numerical integration over the cube uses a\n // small angle approximation of solid angle for each texel (see deltaSolidAngle),\n // and also to compensate for accumulative error due to float precision in the summation.\n const correctionFactor = expectedSolidAngle / totalSolidAngle;\n sphericalHarmonics.scaleInPlace(correctionFactor);\n sphericalHarmonics.convertIncidentRadianceToIrradiance();\n sphericalHarmonics.convertIrradianceToLambertianRadiance();\n return SphericalPolynomial.FromHarmonics(sphericalHarmonics);\n }\n}\nCubeMapToSphericalPolynomialTools._FileFaces = [\n new FileFaceOrientation(\"right\", new Vector3(1, 0, 0), new Vector3(0, 0, -1), new Vector3(0, -1, 0)),\n new FileFaceOrientation(\"left\", new Vector3(-1, 0, 0), new Vector3(0, 0, 1), new Vector3(0, -1, 0)),\n new FileFaceOrientation(\"up\", new Vector3(0, 1, 0), new Vector3(1, 0, 0), new Vector3(0, 0, 1)),\n new FileFaceOrientation(\"down\", new Vector3(0, -1, 0), new Vector3(1, 0, 0), new Vector3(0, 0, -1)),\n new FileFaceOrientation(\"front\", new Vector3(0, 0, 1), new Vector3(1, 0, 0), new Vector3(0, -1, 0)),\n new FileFaceOrientation(\"back\", new Vector3(0, 0, -1), new Vector3(-1, 0, 0), new Vector3(0, -1, 0)), // -Z bottom\n];\n/** @internal */\nCubeMapToSphericalPolynomialTools.MAX_HDRI_VALUE = 4096;\n/** @internal */\nCubeMapToSphericalPolynomialTools.PRESERVE_CLAMPED_COLORS = false;\n//# sourceMappingURL=cubemapToSphericalPolynomial.js.map","// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore.js\";\nconst name = \"hdrFilteringVertexShader\";\nconst shader = `attribute vec2 position;varying vec3 direction;uniform vec3 up;uniform vec3 right;uniform vec3 front;\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nmat3 view=mat3(up,right,front);direction=view*vec3(position,1.0);gl_Position=vec4(position,0.0,1.0);\n#define CUSTOM_VERTEX_MAIN_END\n}`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @internal */\nexport const hdrFilteringVertexShader = { name, shader };\n//# sourceMappingURL=hdrFiltering.vertex.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"importanceSampling\";\nconst shader = `vec3 hemisphereCosSample(vec2 u) {float phi=2.*PI*u.x;float cosTheta2=1.-u.y;float cosTheta=sqrt(cosTheta2);float sinTheta=sqrt(1.-cosTheta2);return vec3(sinTheta*cos(phi),sinTheta*sin(phi),cosTheta);}\nvec3 hemisphereImportanceSampleDggx(vec2 u,float a) {float phi=2.*PI*u.x;float cosTheta2=(1.-u.y)/(1.+(a+1.)*((a-1.)*u.y));float cosTheta=sqrt(cosTheta2);float sinTheta=sqrt(1.-cosTheta2);return vec3(sinTheta*cos(phi),sinTheta*sin(phi),cosTheta);}\nvec3 hemisphereImportanceSampleDCharlie(vec2 u,float a) { \nfloat phi=2.*PI*u.x;float sinTheta=pow(u.y,a/(2.*a+1.));float cosTheta=sqrt(1.-sinTheta*sinTheta);return vec3(sinTheta*cos(phi),sinTheta*sin(phi),cosTheta);}`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const importanceSampling = { name, shader };\n//# sourceMappingURL=importanceSampling.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"hdrFilteringFunctions\";\nconst shader = `#ifdef NUM_SAMPLES\n#if NUM_SAMPLES>0\n#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)\nfloat radicalInverse_VdC(uint bits) \n{bits=(bits<<16u) | (bits>>16u);bits=((bits & 0x55555555u)<<1u) | ((bits & 0xAAAAAAAAu)>>1u);bits=((bits & 0x33333333u)<<2u) | ((bits & 0xCCCCCCCCu)>>2u);bits=((bits & 0x0F0F0F0Fu)<<4u) | ((bits & 0xF0F0F0F0u)>>4u);bits=((bits & 0x00FF00FFu)<<8u) | ((bits & 0xFF00FF00u)>>8u);return float(bits)*2.3283064365386963e-10; }\nvec2 hammersley(uint i,uint N)\n{return vec2(float(i)/float(N),radicalInverse_VdC(i));}\n#else\nfloat vanDerCorpus(int n,int base)\n{float invBase=1.0/float(base);float denom =1.0;float result =0.0;for(int i=0; i<32; ++i)\n{if(n>0)\n{denom =mod(float(n),2.0);result+=denom*invBase;invBase=invBase/2.0;n =int(float(n)/2.0);}}\nreturn result;}\nvec2 hammersley(int i,int N)\n{return vec2(float(i)/float(N),vanDerCorpus(i,2));}\n#endif\nfloat log4(float x) {return log2(x)/2.;}\nconst float NUM_SAMPLES_FLOAT=float(NUM_SAMPLES);const float NUM_SAMPLES_FLOAT_INVERSED=1./NUM_SAMPLES_FLOAT;const float K=4.;\n#define inline\nvec3 irradiance(samplerCube inputTexture,vec3 inputN,vec2 filteringInfo)\n{vec3 n=normalize(inputN);vec3 result=vec3(0.0);vec3 tangent=abs(n.z)<0.999 ? vec3(0.,0.,1.) : vec3(1.,0.,0.);tangent=normalize(cross(tangent,n));vec3 bitangent=cross(n,tangent);mat3 tbn=mat3(tangent,bitangent,n);float maxLevel=filteringInfo.y;float dim0=filteringInfo.x;float omegaP=(4.*PI)/(6.*dim0*dim0);\n#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)\nfor(uint i=0u; i0.) {float pdf_inversed=PI/NoL;float omegaS=NUM_SAMPLES_FLOAT_INVERSED*pdf_inversed;float l=log4(omegaS)-log4(omegaP)+log4(K);float mipLevel=clamp(l,0.0,maxLevel);vec3 c=textureCubeLodEXT(inputTexture,tbn*Ls,mipLevel).rgb;\n#ifdef GAMMA_INPUT\nc=toLinearSpace(c);\n#endif\nresult+=c;}}\nresult=result*NUM_SAMPLES_FLOAT_INVERSED;return result;}\n#define inline\nvec3 radiance(float alphaG,samplerCube inputTexture,vec3 inputN,vec2 filteringInfo)\n{vec3 n=normalize(inputN);if (alphaG==0.) {vec3 c=textureCube(inputTexture,n).rgb;\n#ifdef GAMMA_INPUT\nc=toLinearSpace(c);\n#endif\nreturn c;} else {vec3 result=vec3(0.);vec3 tangent=abs(n.z)<0.999 ? vec3(0.,0.,1.) : vec3(1.,0.,0.);tangent=normalize(cross(tangent,n));vec3 bitangent=cross(n,tangent);mat3 tbn=mat3(tangent,bitangent,n);float maxLevel=filteringInfo.y;float dim0=filteringInfo.x;float omegaP=(4.*PI)/(6.*dim0*dim0);float weight=0.;\n#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)\nfor(uint i=0u; i0.) {float pdf_inversed=4./normalDistributionFunction_TrowbridgeReitzGGX(NoH,alphaG);float omegaS=NUM_SAMPLES_FLOAT_INVERSED*pdf_inversed;float l=log4(omegaS)-log4(omegaP)+log4(K);float mipLevel=clamp(float(l),0.0,maxLevel);weight+=NoL;vec3 c=textureCubeLodEXT(inputTexture,tbn*L,mipLevel).rgb;\n#ifdef GAMMA_INPUT\nc=toLinearSpace(c);\n#endif\nresult+=c*NoL;}}\nresult=result/weight;return result;}}\n#endif\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const hdrFilteringFunctions = { name, shader };\n//# sourceMappingURL=hdrFilteringFunctions.js.map","// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore.js\";\nimport \"./ShadersInclude/helperFunctions.js\";\nimport \"./ShadersInclude/importanceSampling.js\";\nimport \"./ShadersInclude/pbrBRDFFunctions.js\";\nimport \"./ShadersInclude/hdrFilteringFunctions.js\";\nconst name = \"hdrFilteringPixelShader\";\nconst shader = `#include\n#include\n#include\n#include\nuniform float alphaG;uniform samplerCube inputTexture;uniform vec2 vFilteringInfo;uniform float hdrScale;varying vec3 direction;void main() {vec3 color=radiance(alphaG,inputTexture,direction,vFilteringInfo);gl_FragColor=vec4(color*hdrScale,1.0);}`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @internal */\nexport const hdrFilteringPixelShader = { name, shader };\n//# sourceMappingURL=hdrFiltering.fragment.js.map","import { Vector3 } from \"../../../Maths/math.js\";\nimport { Scalar } from \"../../../Maths/math.scalar.js\";\n\nimport { EffectWrapper, EffectRenderer } from \"../../../Materials/effectRenderer.js\";\nimport \"../../../Shaders/hdrFiltering.vertex.js\";\nimport \"../../../Shaders/hdrFiltering.fragment.js\";\nimport { Logger } from \"../../../Misc/logger.js\";\n/**\n * Filters HDR maps to get correct renderings of PBR reflections\n */\nexport class HDRFiltering {\n /**\n * Instantiates HDR filter for reflection maps\n *\n * @param engine Thin engine\n * @param options Options\n */\n constructor(engine, options = {}) {\n this._lodGenerationOffset = 0;\n this._lodGenerationScale = 0.8;\n /**\n * Quality switch for prefiltering. Should be set to `4096` unless\n * you care about baking speed.\n */\n this.quality = 4096;\n /**\n * Scales pixel intensity for the input HDR map.\n */\n this.hdrScale = 1;\n // pass\n this._engine = engine;\n this.hdrScale = options.hdrScale || this.hdrScale;\n this.quality = options.quality || this.quality;\n }\n _createRenderTarget(size) {\n let textureType = 0;\n if (this._engine.getCaps().textureHalfFloatRender) {\n textureType = 2;\n }\n else if (this._engine.getCaps().textureFloatRender) {\n textureType = 1;\n }\n const rtWrapper = this._engine.createRenderTargetCubeTexture(size, {\n format: 5,\n type: textureType,\n createMipMaps: true,\n generateMipMaps: false,\n generateDepthBuffer: false,\n generateStencilBuffer: false,\n samplingMode: 1,\n });\n this._engine.updateTextureWrappingMode(rtWrapper.texture, 0, 0, 0);\n this._engine.updateTextureSamplingMode(3, rtWrapper.texture, true);\n return rtWrapper;\n }\n _prefilterInternal(texture) {\n const width = texture.getSize().width;\n const mipmapsCount = Scalar.ILog2(width) + 1;\n const effect = this._effectWrapper.effect;\n const outputTexture = this._createRenderTarget(width);\n this._effectRenderer.saveStates();\n this._effectRenderer.setViewport();\n const intTexture = texture.getInternalTexture();\n if (intTexture) {\n // Just in case generate fresh clean mips.\n this._engine.updateTextureSamplingMode(3, intTexture, true);\n }\n this._effectRenderer.applyEffectWrapper(this._effectWrapper);\n const directions = [\n [new Vector3(0, 0, -1), new Vector3(0, -1, 0), new Vector3(1, 0, 0)],\n [new Vector3(0, 0, 1), new Vector3(0, -1, 0), new Vector3(-1, 0, 0)],\n [new Vector3(1, 0, 0), new Vector3(0, 0, 1), new Vector3(0, 1, 0)],\n [new Vector3(1, 0, 0), new Vector3(0, 0, -1), new Vector3(0, -1, 0)],\n [new Vector3(1, 0, 0), new Vector3(0, -1, 0), new Vector3(0, 0, 1)],\n [new Vector3(-1, 0, 0), new Vector3(0, -1, 0), new Vector3(0, 0, -1)], // NegativeZ\n ];\n effect.setFloat(\"hdrScale\", this.hdrScale);\n effect.setFloat2(\"vFilteringInfo\", texture.getSize().width, mipmapsCount);\n effect.setTexture(\"inputTexture\", texture);\n for (let face = 0; face < 6; face++) {\n effect.setVector3(\"up\", directions[face][0]);\n effect.setVector3(\"right\", directions[face][1]);\n effect.setVector3(\"front\", directions[face][2]);\n for (let lod = 0; lod < mipmapsCount; lod++) {\n this._engine.bindFramebuffer(outputTexture, face, undefined, undefined, true, lod);\n this._effectRenderer.applyEffectWrapper(this._effectWrapper);\n let alpha = Math.pow(2, (lod - this._lodGenerationOffset) / this._lodGenerationScale) / width;\n if (lod === 0) {\n alpha = 0;\n }\n effect.setFloat(\"alphaG\", alpha);\n this._effectRenderer.draw();\n }\n }\n // Cleanup\n this._effectRenderer.restoreStates();\n this._engine.restoreDefaultFramebuffer();\n this._engine._releaseTexture(texture._texture);\n // Internal Swap\n const type = outputTexture.texture.type;\n const format = outputTexture.texture.format;\n outputTexture._swapAndDie(texture._texture);\n texture._texture.type = type;\n texture._texture.format = format;\n // New settings\n texture.gammaSpace = false;\n texture.lodGenerationOffset = this._lodGenerationOffset;\n texture.lodGenerationScale = this._lodGenerationScale;\n texture._prefiltered = true;\n return texture;\n }\n _createEffect(texture, onCompiled) {\n const defines = [];\n if (texture.gammaSpace) {\n defines.push(\"#define GAMMA_INPUT\");\n }\n defines.push(\"#define NUM_SAMPLES \" + this.quality + \"u\"); // unsigned int\n const effectWrapper = new EffectWrapper({\n engine: this._engine,\n name: \"hdrFiltering\",\n vertexShader: \"hdrFiltering\",\n fragmentShader: \"hdrFiltering\",\n samplerNames: [\"inputTexture\"],\n uniformNames: [\"vSampleDirections\", \"vWeights\", \"up\", \"right\", \"front\", \"vFilteringInfo\", \"hdrScale\", \"alphaG\"],\n useShaderStore: true,\n defines,\n onCompiled: onCompiled,\n });\n return effectWrapper;\n }\n /**\n * Get a value indicating if the filter is ready to be used\n * @param texture Texture to filter\n * @returns true if the filter is ready\n */\n isReady(texture) {\n return texture.isReady() && this._effectWrapper.effect.isReady();\n }\n /**\n * Prefilters a cube texture to have mipmap levels representing roughness values.\n * Prefiltering will be invoked at the end of next rendering pass.\n * This has to be done once the map is loaded, and has not been prefiltered by a third party software.\n * See http://blog.selfshadow.com/publications/s2013-shading-course/karis/s2013_pbs_epic_notes_v2.pdf for more information\n * @param texture Texture to filter\n * @param onFinished Callback when filtering is done\n * @returns Promise called when prefiltering is done\n */\n prefilter(texture, onFinished = null) {\n if (!this._engine._features.allowTexturePrefiltering) {\n Logger.Warn(\"HDR prefiltering is not available in WebGL 1., you can use real time filtering instead.\");\n return Promise.reject(\"HDR prefiltering is not available in WebGL 1., you can use real time filtering instead.\");\n }\n return new Promise((resolve) => {\n this._effectRenderer = new EffectRenderer(this._engine);\n this._effectWrapper = this._createEffect(texture);\n this._effectWrapper.effect.executeWhenCompiled(() => {\n this._prefilterInternal(texture);\n this._effectRenderer.dispose();\n this._effectWrapper.dispose();\n resolve();\n if (onFinished) {\n onFinished();\n }\n });\n });\n }\n}\n//# sourceMappingURL=hdrFiltering.js.map","import { Texture } from \"../Materials/Textures/texture.js\";\nimport { RenderTargetTexture } from \"../Materials/Textures/renderTargetTexture.js\";\nimport { PassPostProcess } from \"../PostProcesses/passPostProcess.js\";\n\nimport { PostProcess } from \"../PostProcesses/postProcess.js\";\n/**\n * Uses the GPU to create a copy texture rescaled at a given size\n * @param texture Texture to copy from\n * @param width defines the desired width\n * @param height defines the desired height\n * @param useBilinearMode defines if bilinear mode has to be used\n * @returns the generated texture\n */\nexport function CreateResizedCopy(texture, width, height, useBilinearMode = true) {\n const scene = texture.getScene();\n const engine = scene.getEngine();\n const rtt = new RenderTargetTexture(\"resized\" + texture.name, { width: width, height: height }, scene, !texture.noMipmap, true, texture._texture.type, false, texture.samplingMode, false);\n rtt.wrapU = texture.wrapU;\n rtt.wrapV = texture.wrapV;\n rtt.uOffset = texture.uOffset;\n rtt.vOffset = texture.vOffset;\n rtt.uScale = texture.uScale;\n rtt.vScale = texture.vScale;\n rtt.uAng = texture.uAng;\n rtt.vAng = texture.vAng;\n rtt.wAng = texture.wAng;\n rtt.coordinatesIndex = texture.coordinatesIndex;\n rtt.level = texture.level;\n rtt.anisotropicFilteringLevel = texture.anisotropicFilteringLevel;\n rtt._texture.isReady = false;\n texture.wrapU = Texture.CLAMP_ADDRESSMODE;\n texture.wrapV = Texture.CLAMP_ADDRESSMODE;\n const passPostProcess = new PassPostProcess(\"pass\", 1, null, useBilinearMode ? Texture.BILINEAR_SAMPLINGMODE : Texture.NEAREST_SAMPLINGMODE, engine, false, 0);\n passPostProcess.externalTextureSamplerBinding = true;\n passPostProcess.getEffect().executeWhenCompiled(() => {\n passPostProcess.onApply = function (effect) {\n effect.setTexture(\"textureSampler\", texture);\n };\n const internalTexture = rtt.renderTarget;\n if (internalTexture) {\n scene.postProcessManager.directRender([passPostProcess], internalTexture);\n engine.unBindFramebuffer(internalTexture);\n rtt.disposeFramebufferObjects();\n passPostProcess.dispose();\n rtt.getInternalTexture().isReady = true;\n }\n });\n return rtt;\n}\n/**\n * Apply a post process to a texture\n * @param postProcessName name of the fragment post process\n * @param internalTexture the texture to encode\n * @param scene the scene hosting the texture\n * @param type type of the output texture. If not provided, use the one from internalTexture\n * @param samplingMode sampling mode to use to sample the source texture. If not provided, use the one from internalTexture\n * @param format format of the output texture. If not provided, use the one from internalTexture\n * @returns a promise with the internalTexture having its texture replaced by the result of the processing\n */\nexport function ApplyPostProcess(postProcessName, internalTexture, scene, type, samplingMode, format, width, height) {\n // Gets everything ready.\n const engine = internalTexture.getEngine();\n internalTexture.isReady = false;\n samplingMode = samplingMode !== null && samplingMode !== void 0 ? samplingMode : internalTexture.samplingMode;\n type = type !== null && type !== void 0 ? type : internalTexture.type;\n format = format !== null && format !== void 0 ? format : internalTexture.format;\n width = width !== null && width !== void 0 ? width : internalTexture.width;\n height = height !== null && height !== void 0 ? height : internalTexture.height;\n if (type === -1) {\n type = 0;\n }\n return new Promise((resolve) => {\n // Create the post process\n const postProcess = new PostProcess(\"postprocess\", postProcessName, null, null, 1, null, samplingMode, engine, false, undefined, type, undefined, null, false, format);\n postProcess.externalTextureSamplerBinding = true;\n // Hold the output of the decoding.\n const encodedTexture = engine.createRenderTargetTexture({ width: width, height: height }, {\n generateDepthBuffer: false,\n generateMipMaps: false,\n generateStencilBuffer: false,\n samplingMode,\n type,\n format,\n });\n postProcess.getEffect().executeWhenCompiled(() => {\n // PP Render Pass\n postProcess.onApply = (effect) => {\n effect._bindTexture(\"textureSampler\", internalTexture);\n effect.setFloat2(\"scale\", 1, 1);\n };\n scene.postProcessManager.directRender([postProcess], encodedTexture, true);\n // Cleanup\n engine.restoreDefaultFramebuffer();\n engine._releaseTexture(internalTexture);\n if (postProcess) {\n postProcess.dispose();\n }\n // Internal Swap\n encodedTexture._swapAndDie(internalTexture);\n // Ready to get rolling again.\n internalTexture.type = type;\n internalTexture.format = 5;\n internalTexture.isReady = true;\n resolve(internalTexture);\n });\n });\n}\n// ref: http://stackoverflow.com/questions/32633585/how-do-you-convert-to-half-floats-in-javascript\nlet floatView;\nlet int32View;\n/**\n * Converts a number to half float\n * @param value number to convert\n * @returns converted number\n */\nexport function ToHalfFloat(value) {\n if (!floatView) {\n floatView = new Float32Array(1);\n int32View = new Int32Array(floatView.buffer);\n }\n floatView[0] = value;\n const x = int32View[0];\n let bits = (x >> 16) & 0x8000; /* Get the sign */\n let m = (x >> 12) & 0x07ff; /* Keep one extra bit for rounding */\n const e = (x >> 23) & 0xff; /* Using int is faster here */\n /* If zero, or denormal, or exponent underflows too much for a denormal\n * half, return signed zero. */\n if (e < 103) {\n return bits;\n }\n /* If NaN, return NaN. If Inf or exponent overflow, return Inf. */\n if (e > 142) {\n bits |= 0x7c00;\n /* If exponent was 0xff and one mantissa bit was set, it means NaN,\n * not Inf, so make sure we set one mantissa bit too. */\n bits |= (e == 255 ? 0 : 1) && x & 0x007fffff;\n return bits;\n }\n /* If exponent underflows but not too much, return a denormal */\n if (e < 113) {\n m |= 0x0800;\n /* Extra rounding may overflow and set mantissa to 0 and exponent\n * to 1, which is OK. */\n bits |= (m >> (114 - e)) + ((m >> (113 - e)) & 1);\n return bits;\n }\n bits |= ((e - 112) << 10) | (m >> 1);\n bits += m & 1;\n return bits;\n}\n/**\n * Converts a half float to a number\n * @param value half float to convert\n * @returns converted half float\n */\nexport function FromHalfFloat(value) {\n const s = (value & 0x8000) >> 15;\n const e = (value & 0x7c00) >> 10;\n const f = value & 0x03ff;\n if (e === 0) {\n return (s ? -1 : 1) * Math.pow(2, -14) * (f / Math.pow(2, 10));\n }\n else if (e == 0x1f) {\n return f ? NaN : (s ? -1 : 1) * Infinity;\n }\n return (s ? -1 : 1) * Math.pow(2, e - 15) * (1 + f / Math.pow(2, 10));\n}\n/**\n * Class used to host texture specific utilities\n */\nexport const TextureTools = {\n /**\n * Uses the GPU to create a copy texture rescaled at a given size\n * @param texture Texture to copy from\n * @param width defines the desired width\n * @param height defines the desired height\n * @param useBilinearMode defines if bilinear mode has to be used\n * @returns the generated texture\n */\n CreateResizedCopy,\n /**\n * Apply a post process to a texture\n * @param postProcessName name of the fragment post process\n * @param internalTexture the texture to encode\n * @param scene the scene hosting the texture\n * @param type type of the output texture. If not provided, use the one from internalTexture\n * @param samplingMode sampling mode to use to sample the source texture. If not provided, use the one from internalTexture\n * @param format format of the output texture. If not provided, use the one from internalTexture\n * @returns a promise with the internalTexture having its texture replaced by the result of the processing\n */\n ApplyPostProcess,\n /**\n * Converts a number to half float\n * @param value number to convert\n * @returns converted number\n */\n ToHalfFloat,\n /**\n * Converts a half float to a number\n * @param value half float to convert\n * @returns converted half float\n */\n FromHalfFloat,\n};\n//# sourceMappingURL=textureTools.js.map","import { CubeMapToSphericalPolynomialTools } from \"../../Misc/HighDynamicRange/cubemapToSphericalPolynomial.js\";\nimport { BaseTexture } from \"./baseTexture.js\";\nBaseTexture.prototype.forceSphericalPolynomialsRecompute = function () {\n if (this._texture) {\n this._texture._sphericalPolynomial = null;\n this._texture._sphericalPolynomialPromise = null;\n this._texture._sphericalPolynomialComputed = false;\n }\n};\nObject.defineProperty(BaseTexture.prototype, \"sphericalPolynomial\", {\n get: function () {\n if (this._texture) {\n if (this._texture._sphericalPolynomial || this._texture._sphericalPolynomialComputed) {\n return this._texture._sphericalPolynomial;\n }\n if (this._texture.isReady) {\n if (!this._texture._sphericalPolynomialPromise) {\n this._texture._sphericalPolynomialPromise = CubeMapToSphericalPolynomialTools.ConvertCubeMapTextureToSphericalPolynomial(this);\n if (this._texture._sphericalPolynomialPromise === null) {\n this._texture._sphericalPolynomialComputed = true;\n }\n else {\n this._texture._sphericalPolynomialPromise.then((sphericalPolynomial) => {\n this._texture._sphericalPolynomial = sphericalPolynomial;\n this._texture._sphericalPolynomialComputed = true;\n });\n }\n }\n return null;\n }\n }\n return null;\n },\n set: function (value) {\n if (this._texture) {\n this._texture._sphericalPolynomial = value;\n }\n },\n enumerable: true,\n configurable: true,\n});\n//# sourceMappingURL=baseTexture.polynomial.js.map","import { Matrix, Vector3 } from \"../../Maths/math.vector.js\";\nimport { BaseTexture } from \"../../Materials/Textures/baseTexture.js\";\nimport { Texture } from \"../../Materials/Textures/texture.js\";\n\nimport { HDRTools } from \"../../Misc/HighDynamicRange/hdr.js\";\nimport { CubeMapToSphericalPolynomialTools } from \"../../Misc/HighDynamicRange/cubemapToSphericalPolynomial.js\";\nimport { RegisterClass } from \"../../Misc/typeStore.js\";\nimport { Observable } from \"../../Misc/observable.js\";\nimport { Tools } from \"../../Misc/tools.js\";\nimport { ToGammaSpace } from \"../../Maths/math.constants.js\";\nimport { HDRFiltering } from \"../../Materials/Textures/Filtering/hdrFiltering.js\";\nimport { ToHalfFloat } from \"../../Misc/textureTools.js\";\nimport \"../../Engines/Extensions/engine.rawTexture.js\";\nimport \"../../Materials/Textures/baseTexture.polynomial.js\";\n/**\n * This represents a texture coming from an HDR input.\n *\n * The only supported format is currently panorama picture stored in RGBE format.\n * Example of such files can be found on Poly Haven: https://polyhaven.com/hdris\n */\nexport class HDRCubeTexture extends BaseTexture {\n /**\n * Sets whether or not the texture is blocking during loading.\n */\n set isBlocking(value) {\n this._isBlocking = value;\n }\n /**\n * Gets whether or not the texture is blocking during loading.\n */\n get isBlocking() {\n return this._isBlocking;\n }\n /**\n * Sets texture matrix rotation angle around Y axis in radians.\n */\n set rotationY(value) {\n this._rotationY = value;\n this.setReflectionTextureMatrix(Matrix.RotationY(this._rotationY));\n }\n /**\n * Gets texture matrix rotation angle around Y axis radians.\n */\n get rotationY() {\n return this._rotationY;\n }\n /**\n * Gets or sets the size of the bounding box associated with the cube texture\n * When defined, the cubemap will switch to local mode\n * @see https://community.arm.com/graphics/b/blog/posts/reflections-based-on-local-cubemaps-in-unity\n * @example https://www.babylonjs-playground.com/#RNASML\n */\n set boundingBoxSize(value) {\n if (this._boundingBoxSize && this._boundingBoxSize.equals(value)) {\n return;\n }\n this._boundingBoxSize = value;\n const scene = this.getScene();\n if (scene) {\n scene.markAllMaterialsAsDirty(1);\n }\n }\n get boundingBoxSize() {\n return this._boundingBoxSize;\n }\n /**\n * Instantiates an HDRTexture from the following parameters.\n *\n * @param url The location of the HDR raw data (Panorama stored in RGBE format)\n * @param sceneOrEngine The scene or engine the texture will be used in\n * @param size The cubemap desired size (the more it increases the longer the generation will be)\n * @param noMipmap Forces to not generate the mipmap if true\n * @param generateHarmonics Specifies whether you want to extract the polynomial harmonics during the generation process\n * @param gammaSpace Specifies if the texture will be use in gamma or linear space (the PBR material requires those texture in linear space, but the standard material would require them in Gamma space)\n * @param prefilterOnLoad Prefilters HDR texture to allow use of this texture as a PBR reflection texture.\n * @param onLoad\n * @param onError\n */\n constructor(url, sceneOrEngine, size, noMipmap = false, generateHarmonics = true, gammaSpace = false, prefilterOnLoad = false, onLoad = null, onError = null, supersample = false) {\n var _a;\n super(sceneOrEngine);\n this._generateHarmonics = true;\n this._onError = null;\n this._isBlocking = true;\n this._rotationY = 0;\n /**\n * Gets or sets the center of the bounding box associated with the cube texture\n * It must define where the camera used to render the texture was set\n */\n this.boundingBoxPosition = Vector3.Zero();\n /**\n * Observable triggered once the texture has been loaded.\n */\n this.onLoadObservable = new Observable();\n if (!url) {\n return;\n }\n this._coordinatesMode = Texture.CUBIC_MODE;\n this.name = url;\n this.url = url;\n this.hasAlpha = false;\n this.isCube = true;\n this._textureMatrix = Matrix.Identity();\n this._prefilterOnLoad = prefilterOnLoad;\n this._onLoad = () => {\n this.onLoadObservable.notifyObservers(this);\n if (onLoad) {\n onLoad();\n }\n };\n this._onError = onError;\n this.gammaSpace = gammaSpace;\n this._noMipmap = noMipmap;\n this._size = size;\n this._supersample = supersample;\n this._generateHarmonics = generateHarmonics;\n this._texture = this._getFromCache(url, this._noMipmap, undefined, undefined, undefined, this.isCube);\n if (!this._texture) {\n if (!((_a = this.getScene()) === null || _a === void 0 ? void 0 : _a.useDelayedTextureLoading)) {\n this._loadTexture();\n }\n else {\n this.delayLoadState = 4;\n }\n }\n else {\n if (this._texture.isReady) {\n Tools.SetImmediate(() => this._onLoad());\n }\n else {\n this._texture.onLoadedObservable.add(this._onLoad);\n }\n }\n }\n /**\n * Get the current class name of the texture useful for serialization or dynamic coding.\n * @returns \"HDRCubeTexture\"\n */\n getClassName() {\n return \"HDRCubeTexture\";\n }\n /**\n * Occurs when the file is raw .hdr file.\n */\n _loadTexture() {\n const engine = this._getEngine();\n const caps = engine.getCaps();\n let textureType = 0;\n if (caps.textureFloat && caps.textureFloatLinearFiltering) {\n textureType = 1;\n }\n else if (caps.textureHalfFloat && caps.textureHalfFloatLinearFiltering) {\n textureType = 2;\n }\n const callback = (buffer) => {\n this.lodGenerationOffset = 0.0;\n this.lodGenerationScale = 0.8;\n // Extract the raw linear data.\n const data = HDRTools.GetCubeMapTextureData(buffer, this._size, this._supersample);\n // Generate harmonics if needed.\n if (this._generateHarmonics) {\n const sphericalPolynomial = CubeMapToSphericalPolynomialTools.ConvertCubeMapToSphericalPolynomial(data);\n this.sphericalPolynomial = sphericalPolynomial;\n }\n const results = [];\n let byteArray = null;\n let shortArray = null;\n // Push each faces.\n for (let j = 0; j < 6; j++) {\n // Create fallback array\n if (textureType === 2) {\n shortArray = new Uint16Array(this._size * this._size * 3);\n }\n else if (textureType === 0) {\n // 3 channels of 1 bytes per pixel in bytes.\n byteArray = new Uint8Array(this._size * this._size * 3);\n }\n const dataFace = data[HDRCubeTexture._FacesMapping[j]];\n // If special cases.\n if (this.gammaSpace || shortArray || byteArray) {\n for (let i = 0; i < this._size * this._size; i++) {\n // Put in gamma space if requested.\n if (this.gammaSpace) {\n dataFace[i * 3 + 0] = Math.pow(dataFace[i * 3 + 0], ToGammaSpace);\n dataFace[i * 3 + 1] = Math.pow(dataFace[i * 3 + 1], ToGammaSpace);\n dataFace[i * 3 + 2] = Math.pow(dataFace[i * 3 + 2], ToGammaSpace);\n }\n // Convert to half float texture for fallback.\n if (shortArray) {\n shortArray[i * 3 + 0] = ToHalfFloat(dataFace[i * 3 + 0]);\n shortArray[i * 3 + 1] = ToHalfFloat(dataFace[i * 3 + 1]);\n shortArray[i * 3 + 2] = ToHalfFloat(dataFace[i * 3 + 2]);\n }\n // Convert to int texture for fallback.\n if (byteArray) {\n let r = Math.max(dataFace[i * 3 + 0] * 255, 0);\n let g = Math.max(dataFace[i * 3 + 1] * 255, 0);\n let b = Math.max(dataFace[i * 3 + 2] * 255, 0);\n // May use luminance instead if the result is not accurate.\n const max = Math.max(Math.max(r, g), b);\n if (max > 255) {\n const scale = 255 / max;\n r *= scale;\n g *= scale;\n b *= scale;\n }\n byteArray[i * 3 + 0] = r;\n byteArray[i * 3 + 1] = g;\n byteArray[i * 3 + 2] = b;\n }\n }\n }\n if (shortArray) {\n results.push(shortArray);\n }\n else if (byteArray) {\n results.push(byteArray);\n }\n else {\n results.push(dataFace);\n }\n }\n return results;\n };\n if (engine._features.allowTexturePrefiltering && this._prefilterOnLoad) {\n const previousOnLoad = this._onLoad;\n const hdrFiltering = new HDRFiltering(engine);\n this._onLoad = () => {\n hdrFiltering.prefilter(this, previousOnLoad);\n };\n }\n this._texture = engine.createRawCubeTextureFromUrl(this.url, this.getScene(), this._size, 4, textureType, this._noMipmap, callback, null, this._onLoad, this._onError);\n }\n clone() {\n const newTexture = new HDRCubeTexture(this.url, this.getScene() || this._getEngine(), this._size, this._noMipmap, this._generateHarmonics, this.gammaSpace);\n // Base texture\n newTexture.level = this.level;\n newTexture.wrapU = this.wrapU;\n newTexture.wrapV = this.wrapV;\n newTexture.coordinatesIndex = this.coordinatesIndex;\n newTexture.coordinatesMode = this.coordinatesMode;\n return newTexture;\n }\n // Methods\n delayLoad() {\n if (this.delayLoadState !== 4) {\n return;\n }\n this.delayLoadState = 1;\n this._texture = this._getFromCache(this.url, this._noMipmap);\n if (!this._texture) {\n this._loadTexture();\n }\n }\n /**\n * Get the texture reflection matrix used to rotate/transform the reflection.\n * @returns the reflection matrix\n */\n getReflectionTextureMatrix() {\n return this._textureMatrix;\n }\n /**\n * Set the texture reflection matrix used to rotate/transform the reflection.\n * @param value Define the reflection matrix to set\n */\n setReflectionTextureMatrix(value) {\n var _a;\n this._textureMatrix = value;\n if (value.updateFlag === this._textureMatrix.updateFlag) {\n return;\n }\n if (value.isIdentity() !== this._textureMatrix.isIdentity()) {\n (_a = this.getScene()) === null || _a === void 0 ? void 0 : _a.markAllMaterialsAsDirty(1, (mat) => mat.getActiveTextures().indexOf(this) !== -1);\n }\n }\n /**\n * Dispose the texture and release its associated resources.\n */\n dispose() {\n this.onLoadObservable.clear();\n super.dispose();\n }\n /**\n * Parses a JSON representation of an HDR Texture in order to create the texture\n * @param parsedTexture Define the JSON representation\n * @param scene Define the scene the texture should be created in\n * @param rootUrl Define the root url in case we need to load relative dependencies\n * @returns the newly created texture after parsing\n */\n static Parse(parsedTexture, scene, rootUrl) {\n let texture = null;\n if (parsedTexture.name && !parsedTexture.isRenderTarget) {\n texture = new HDRCubeTexture(rootUrl + parsedTexture.name, scene, parsedTexture.size, parsedTexture.noMipmap, parsedTexture.generateHarmonics, parsedTexture.useInGammaSpace);\n texture.name = parsedTexture.name;\n texture.hasAlpha = parsedTexture.hasAlpha;\n texture.level = parsedTexture.level;\n texture.coordinatesMode = parsedTexture.coordinatesMode;\n texture.isBlocking = parsedTexture.isBlocking;\n }\n if (texture) {\n if (parsedTexture.boundingBoxPosition) {\n texture.boundingBoxPosition = Vector3.FromArray(parsedTexture.boundingBoxPosition);\n }\n if (parsedTexture.boundingBoxSize) {\n texture.boundingBoxSize = Vector3.FromArray(parsedTexture.boundingBoxSize);\n }\n if (parsedTexture.rotationY) {\n texture.rotationY = parsedTexture.rotationY;\n }\n }\n return texture;\n }\n serialize() {\n if (!this.name) {\n return null;\n }\n const serializationObject = {};\n serializationObject.name = this.name;\n serializationObject.hasAlpha = this.hasAlpha;\n serializationObject.isCube = true;\n serializationObject.level = this.level;\n serializationObject.size = this._size;\n serializationObject.coordinatesMode = this.coordinatesMode;\n serializationObject.useInGammaSpace = this.gammaSpace;\n serializationObject.generateHarmonics = this._generateHarmonics;\n serializationObject.customType = \"BABYLON.HDRCubeTexture\";\n serializationObject.noMipmap = this._noMipmap;\n serializationObject.isBlocking = this._isBlocking;\n serializationObject.rotationY = this._rotationY;\n return serializationObject;\n }\n}\nHDRCubeTexture._FacesMapping = [\"right\", \"left\", \"up\", \"down\", \"front\", \"back\"];\nRegisterClass(\"BABYLON.HDRCubeTexture\", HDRCubeTexture);\n//# sourceMappingURL=hdrCubeTexture.js.map","import { PanoramaToCubeMapTools } from \"../../Misc/HighDynamicRange/panoramaToCubemap.js\";\nimport { BaseTexture } from \"./baseTexture.js\";\nimport { Texture } from \"./texture.js\";\nimport { Tools } from \"../../Misc/tools.js\";\nimport \"../../Engines/Extensions/engine.rawTexture.js\";\n\nimport { LoadImage } from \"../../Misc/fileTools.js\";\n/**\n * This represents a texture coming from an equirectangular image supported by the web browser canvas.\n */\nexport class EquiRectangularCubeTexture extends BaseTexture {\n /**\n * Instantiates an EquiRectangularCubeTexture from the following parameters.\n * @param url The location of the image\n * @param scene The scene the texture will be used in\n * @param size The cubemap desired size (the more it increases the longer the generation will be)\n * @param noMipmap Forces to not generate the mipmap if true\n * @param gammaSpace Specifies if the texture will be used in gamma or linear space\n * (the PBR material requires those textures in linear space, but the standard material would require them in Gamma space)\n * @param onLoad — defines a callback called when texture is loaded\n * @param onError — defines a callback called if there is an error\n */\n constructor(url, scene, size, noMipmap = false, gammaSpace = true, onLoad = null, onError = null, supersample = false) {\n super(scene);\n this._onLoad = null;\n this._onError = null;\n if (!url) {\n throw new Error(\"Image url is not set\");\n }\n this._coordinatesMode = Texture.CUBIC_MODE;\n this.name = url;\n this.url = url;\n this._size = size;\n this._supersample = supersample;\n this._noMipmap = noMipmap;\n this.gammaSpace = gammaSpace;\n this._onLoad = onLoad;\n this._onError = onError;\n this.hasAlpha = false;\n this.isCube = true;\n this._texture = this._getFromCache(url, this._noMipmap, undefined, undefined, undefined, this.isCube);\n if (!this._texture) {\n if (!scene.useDelayedTextureLoading) {\n this._loadImage(this._loadTexture.bind(this), this._onError);\n }\n else {\n this.delayLoadState = 4;\n }\n }\n else if (onLoad) {\n if (this._texture.isReady) {\n Tools.SetImmediate(() => onLoad());\n }\n else {\n this._texture.onLoadedObservable.add(onLoad);\n }\n }\n }\n /**\n * Load the image data, by putting the image on a canvas and extracting its buffer.\n * @param loadTextureCallback\n * @param onError\n */\n _loadImage(loadTextureCallback, onError) {\n const canvas = document.createElement(\"canvas\");\n LoadImage(this.url, (image) => {\n this._width = image.width;\n this._height = image.height;\n canvas.width = this._width;\n canvas.height = this._height;\n const ctx = canvas.getContext(\"2d\");\n ctx.drawImage(image, 0, 0);\n const imageData = ctx.getImageData(0, 0, image.width, image.height);\n this._buffer = imageData.data.buffer;\n canvas.remove();\n loadTextureCallback();\n }, (_, e) => {\n if (onError) {\n onError(`${this.getClassName()} could not be loaded`, e);\n }\n }, null);\n }\n /**\n * Convert the image buffer into a cubemap and create a CubeTexture.\n */\n _loadTexture() {\n const scene = this.getScene();\n const callback = () => {\n const imageData = this._getFloat32ArrayFromArrayBuffer(this._buffer);\n // Extract the raw linear data.\n const data = PanoramaToCubeMapTools.ConvertPanoramaToCubemap(imageData, this._width, this._height, this._size, this._supersample);\n const results = [];\n // Push each faces.\n for (let i = 0; i < 6; i++) {\n const dataFace = data[EquiRectangularCubeTexture._FacesMapping[i]];\n results.push(dataFace);\n }\n return results;\n };\n if (!scene) {\n return;\n }\n this._texture = scene\n .getEngine()\n .createRawCubeTextureFromUrl(this.url, scene, this._size, 4, scene.getEngine().getCaps().textureFloat ? 1 : 7, this._noMipmap, callback, null, this._onLoad, this._onError);\n }\n /**\n * Convert the ArrayBuffer into a Float32Array and drop the transparency channel.\n * @param buffer The ArrayBuffer that should be converted.\n * @returns The buffer as Float32Array.\n */\n _getFloat32ArrayFromArrayBuffer(buffer) {\n const dataView = new DataView(buffer);\n const floatImageData = new Float32Array((buffer.byteLength * 3) / 4);\n let k = 0;\n for (let i = 0; i < buffer.byteLength; i++) {\n // We drop the transparency channel, because we do not need/want it\n if ((i + 1) % 4 !== 0) {\n floatImageData[k++] = dataView.getUint8(i) / 255;\n }\n }\n return floatImageData;\n }\n /**\n * Get the current class name of the texture useful for serialization or dynamic coding.\n * @returns \"EquiRectangularCubeTexture\"\n */\n getClassName() {\n return \"EquiRectangularCubeTexture\";\n }\n /**\n * Create a clone of the current EquiRectangularCubeTexture and return it.\n * @returns A clone of the current EquiRectangularCubeTexture.\n */\n clone() {\n const scene = this.getScene();\n if (!scene) {\n return this;\n }\n const newTexture = new EquiRectangularCubeTexture(this.url, scene, this._size, this._noMipmap, this.gammaSpace);\n // Base texture\n newTexture.level = this.level;\n newTexture.wrapU = this.wrapU;\n newTexture.wrapV = this.wrapV;\n newTexture.coordinatesIndex = this.coordinatesIndex;\n newTexture.coordinatesMode = this.coordinatesMode;\n return newTexture;\n }\n}\n/** The six faces of the cube. */\nEquiRectangularCubeTexture._FacesMapping = [\"right\", \"left\", \"up\", \"down\", \"front\", \"back\"];\n//# sourceMappingURL=equiRectangularCubeTexture.js.map","import { SceneLoader, SceneLoaderAnimationGroupLoadingMode } from \"../Loading/sceneLoader.js\";\nimport { Tools } from \"./tools.js\";\nimport { Observable } from \"./observable.js\";\nimport { Texture } from \"../Materials/Textures/texture.js\";\nimport { CubeTexture } from \"../Materials/Textures/cubeTexture.js\";\nimport { HDRCubeTexture } from \"../Materials/Textures/hdrCubeTexture.js\";\nimport { EquiRectangularCubeTexture } from \"../Materials/Textures/equiRectangularCubeTexture.js\";\nimport { Logger } from \"../Misc/logger.js\";\nimport { EngineStore } from \"../Engines/engineStore.js\";\n/**\n * Defines the list of states available for a task inside a AssetsManager\n */\nexport var AssetTaskState;\n(function (AssetTaskState) {\n /**\n * Initialization\n */\n AssetTaskState[AssetTaskState[\"INIT\"] = 0] = \"INIT\";\n /**\n * Running\n */\n AssetTaskState[AssetTaskState[\"RUNNING\"] = 1] = \"RUNNING\";\n /**\n * Done\n */\n AssetTaskState[AssetTaskState[\"DONE\"] = 2] = \"DONE\";\n /**\n * Error\n */\n AssetTaskState[AssetTaskState[\"ERROR\"] = 3] = \"ERROR\";\n})(AssetTaskState || (AssetTaskState = {}));\n/**\n * Define an abstract asset task used with a AssetsManager class to load assets into a scene\n */\nexport class AbstractAssetTask {\n /**\n * Creates a new AssetsManager\n * @param name defines the name of the task\n */\n constructor(\n /**\n * Task name\n */ name) {\n this.name = name;\n this._isCompleted = false;\n this._taskState = AssetTaskState.INIT;\n }\n /**\n * Get if the task is completed\n */\n get isCompleted() {\n return this._isCompleted;\n }\n /**\n * Gets the current state of the task\n */\n get taskState() {\n return this._taskState;\n }\n /**\n * Gets the current error object (if task is in error)\n */\n get errorObject() {\n return this._errorObject;\n }\n /**\n * Internal only\n * @internal\n */\n _setErrorObject(message, exception) {\n if (this._errorObject) {\n return;\n }\n this._errorObject = {\n message: message,\n exception: exception,\n };\n }\n /**\n * Execute the current task\n * @param scene defines the scene where you want your assets to be loaded\n * @param onSuccess is a callback called when the task is successfully executed\n * @param onError is a callback called if an error occurs\n */\n run(scene, onSuccess, onError) {\n this._taskState = AssetTaskState.RUNNING;\n this.runTask(scene, () => {\n this._onDoneCallback(onSuccess, onError);\n }, (msg, exception) => {\n this._onErrorCallback(onError, msg, exception);\n });\n }\n /**\n * Execute the current task\n * @param scene defines the scene where you want your assets to be loaded\n * @param onSuccess is a callback called when the task is successfully executed\n * @param onError is a callback called if an error occurs\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n runTask(scene, onSuccess, onError) {\n throw new Error(\"runTask is not implemented\");\n }\n /**\n * Reset will set the task state back to INIT, so the next load call of the assets manager will execute this task again.\n * This can be used with failed tasks that have the reason for failure fixed.\n */\n reset() {\n this._taskState = AssetTaskState.INIT;\n }\n _onErrorCallback(onError, message, exception) {\n this._taskState = AssetTaskState.ERROR;\n this._errorObject = {\n message: message,\n exception: exception,\n };\n if (this.onError) {\n this.onError(this, message, exception);\n }\n onError();\n }\n _onDoneCallback(onSuccess, onError) {\n try {\n this._taskState = AssetTaskState.DONE;\n this._isCompleted = true;\n if (this.onSuccess) {\n this.onSuccess(this);\n }\n onSuccess();\n }\n catch (e) {\n this._onErrorCallback(onError, \"Task is done, error executing success callback(s)\", e);\n }\n }\n}\n/**\n * Class used to share progress information about assets loading\n */\nexport class AssetsProgressEvent {\n /**\n * Creates a AssetsProgressEvent\n * @param remainingCount defines the number of remaining tasks to process\n * @param totalCount defines the total number of tasks\n * @param task defines the task that was just processed\n */\n constructor(remainingCount, totalCount, task) {\n this.remainingCount = remainingCount;\n this.totalCount = totalCount;\n this.task = task;\n }\n}\n/**\n * Define a task used by AssetsManager to load assets into a container\n */\nexport class ContainerAssetTask extends AbstractAssetTask {\n /**\n * Creates a new ContainerAssetTask\n * @param name defines the name of the task\n * @param meshesNames defines the list of mesh's names you want to load\n * @param rootUrl defines the root url to use as a base to load your meshes and associated resources\n * @param sceneFilename defines the filename or File of the scene to load from\n */\n constructor(\n /**\n * Defines the name of the task\n */\n name, \n /**\n * Defines the list of mesh's names you want to load\n */\n meshesNames, \n /**\n * Defines the root url to use as a base to load your meshes and associated resources\n */\n rootUrl, \n /**\n * Defines the filename or File of the scene to load from\n */\n sceneFilename, \n /**\n * Defines the extension to use to load the scene (if not defined, \".babylon\" will be used)\n */\n extension) {\n super(name);\n this.name = name;\n this.meshesNames = meshesNames;\n this.rootUrl = rootUrl;\n this.sceneFilename = sceneFilename;\n this.extension = extension;\n }\n /**\n * Execute the current task\n * @param scene defines the scene where you want your assets to be loaded\n * @param onSuccess is a callback called when the task is successfully executed\n * @param onError is a callback called if an error occurs\n */\n runTask(scene, onSuccess, onError) {\n SceneLoader.LoadAssetContainer(this.rootUrl, this.sceneFilename, scene, (container) => {\n this.loadedContainer = container;\n this.loadedMeshes = container.meshes;\n this.loadedTransformNodes = container.transformNodes;\n this.loadedParticleSystems = container.particleSystems;\n this.loadedSkeletons = container.skeletons;\n this.loadedAnimationGroups = container.animationGroups;\n onSuccess();\n }, null, (scene, message, exception) => {\n onError(message, exception);\n }, this.extension);\n }\n}\n/**\n * Define a task used by AssetsManager to load meshes\n */\nexport class MeshAssetTask extends AbstractAssetTask {\n /**\n * Creates a new MeshAssetTask\n * @param name defines the name of the task\n * @param meshesNames defines the list of mesh's names you want to load\n * @param rootUrl defines the root url to use as a base to load your meshes and associated resources\n * @param sceneFilename defines the filename or File of the scene to load from\n */\n constructor(\n /**\n * Defines the name of the task\n */\n name, \n /**\n * Defines the list of mesh's names you want to load\n */\n meshesNames, \n /**\n * Defines the root url to use as a base to load your meshes and associated resources\n */\n rootUrl, \n /**\n * Defines the filename or File of the scene to load from\n */\n sceneFilename, \n /**\n * Defines the extension to use to load the scene (if not defined, \".babylon\" will be used)\n */\n extension) {\n super(name);\n this.name = name;\n this.meshesNames = meshesNames;\n this.rootUrl = rootUrl;\n this.sceneFilename = sceneFilename;\n this.extension = extension;\n }\n /**\n * Execute the current task\n * @param scene defines the scene where you want your assets to be loaded\n * @param onSuccess is a callback called when the task is successfully executed\n * @param onError is a callback called if an error occurs\n */\n runTask(scene, onSuccess, onError) {\n SceneLoader.ImportMesh(this.meshesNames, this.rootUrl, this.sceneFilename, scene, (meshes, particleSystems, skeletons, animationGroups, transformNodes) => {\n this.loadedMeshes = meshes;\n this.loadedTransformNodes = transformNodes;\n this.loadedParticleSystems = particleSystems;\n this.loadedSkeletons = skeletons;\n this.loadedAnimationGroups = animationGroups;\n onSuccess();\n }, null, (scene, message, exception) => {\n onError(message, exception);\n }, this.extension);\n }\n}\n/**\n * Define a task used by AssetsManager to load animations\n */\nexport class AnimationAssetTask extends AbstractAssetTask {\n /**\n * Creates a new AnimationAssetTask\n * @param name defines the name of the task\n * @param rootUrl defines the root url to use as a base to load your meshes and associated resources\n * @param filename defines the filename or File of the scene to load from\n * @param targetConverter defines a function used to convert animation targets from loaded scene to current scene (default: search node by name)\n */\n constructor(\n /**\n * Defines the name of the task\n */\n name, \n /**\n * Defines the root url to use as a base to load your meshes and associated resources\n */\n rootUrl, \n /**\n * Defines the filename to load from\n */\n filename, \n /**\n * Defines a function used to convert animation targets from loaded scene to current scene (default: search node by name)\n */\n targetConverter, \n /**\n * Defines the extension to use to load the scene (if not defined, \".babylon\" will be used)\n */\n extension) {\n super(name);\n this.name = name;\n this.rootUrl = rootUrl;\n this.filename = filename;\n this.targetConverter = targetConverter;\n this.extension = extension;\n }\n /**\n * Execute the current task\n * @param scene defines the scene where you want your assets to be loaded\n * @param onSuccess is a callback called when the task is successfully executed\n * @param onError is a callback called if an error occurs\n */\n runTask(scene, onSuccess, onError) {\n const startingIndexForNewAnimatables = scene.animatables.length;\n const startingIndexForNewAnimationGroups = scene.animationGroups.length;\n this.loadedAnimatables = [];\n this.loadedAnimationGroups = [];\n SceneLoader.ImportAnimations(this.rootUrl, this.filename, scene, false, SceneLoaderAnimationGroupLoadingMode.NoSync, this.targetConverter, () => {\n this.loadedAnimatables = scene.animatables.slice(startingIndexForNewAnimatables);\n this.loadedAnimationGroups = scene.animationGroups.slice(startingIndexForNewAnimationGroups);\n onSuccess();\n }, null, (scene, message, exception) => {\n onError(message, exception);\n }, this.extension);\n }\n}\n/**\n * Define a task used by AssetsManager to load text content\n */\nexport class TextFileAssetTask extends AbstractAssetTask {\n /**\n * Creates a new TextFileAssetTask object\n * @param name defines the name of the task\n * @param url defines the location of the file to load\n */\n constructor(\n /**\n * Defines the name of the task\n */\n name, \n /**\n * Defines the location of the file to load\n */\n url) {\n super(name);\n this.name = name;\n this.url = url;\n }\n /**\n * Execute the current task\n * @param scene defines the scene where you want your assets to be loaded\n * @param onSuccess is a callback called when the task is successfully executed\n * @param onError is a callback called if an error occurs\n */\n runTask(scene, onSuccess, onError) {\n scene._loadFile(this.url, (data) => {\n this.text = data;\n onSuccess();\n }, undefined, false, false, (request, exception) => {\n if (request) {\n onError(request.status + \" \" + request.statusText, exception);\n }\n });\n }\n}\n/**\n * Define a task used by AssetsManager to load binary data\n */\nexport class BinaryFileAssetTask extends AbstractAssetTask {\n /**\n * Creates a new BinaryFileAssetTask object\n * @param name defines the name of the new task\n * @param url defines the location of the file to load\n */\n constructor(\n /**\n * Defines the name of the task\n */\n name, \n /**\n * Defines the location of the file to load\n */\n url) {\n super(name);\n this.name = name;\n this.url = url;\n }\n /**\n * Execute the current task\n * @param scene defines the scene where you want your assets to be loaded\n * @param onSuccess is a callback called when the task is successfully executed\n * @param onError is a callback called if an error occurs\n */\n runTask(scene, onSuccess, onError) {\n scene._loadFile(this.url, (data) => {\n this.data = data;\n onSuccess();\n }, undefined, true, true, (request, exception) => {\n if (request) {\n onError(request.status + \" \" + request.statusText, exception);\n }\n });\n }\n}\n/**\n * Define a task used by AssetsManager to load images\n */\nexport class ImageAssetTask extends AbstractAssetTask {\n /**\n * Creates a new ImageAssetTask\n * @param name defines the name of the task\n * @param url defines the location of the image to load\n */\n constructor(\n /**\n * Defines the name of the task\n */\n name, \n /**\n * Defines the location of the image to load\n */\n url) {\n super(name);\n this.name = name;\n this.url = url;\n }\n /**\n * Execute the current task\n * @param scene defines the scene where you want your assets to be loaded\n * @param onSuccess is a callback called when the task is successfully executed\n * @param onError is a callback called if an error occurs\n */\n runTask(scene, onSuccess, onError) {\n const img = new Image();\n Tools.SetCorsBehavior(this.url, img);\n img.onload = () => {\n this.image = img;\n onSuccess();\n };\n img.onerror = (err) => {\n onError(\"Error loading image\", err);\n };\n img.src = this.url;\n }\n}\n/**\n * Define a task used by AssetsManager to load 2D textures\n */\nexport class TextureAssetTask extends AbstractAssetTask {\n /**\n * Creates a new TextureAssetTask object\n * @param name defines the name of the task\n * @param url defines the location of the file to load\n * @param noMipmap defines if mipmap should not be generated (default is false)\n * @param invertY defines if texture must be inverted on Y axis (default is true)\n * @param samplingMode defines the sampling mode to use (default is Texture.TRILINEAR_SAMPLINGMODE)\n */\n constructor(\n /**\n * Defines the name of the task\n */\n name, \n /**\n * Defines the location of the file to load\n */\n url, \n /**\n * Defines if mipmap should not be generated (default is false)\n */\n noMipmap, \n /**\n * Defines if texture must be inverted on Y axis (default is true)\n */\n invertY = true, \n /**\n * Defines the sampling mode to use (default is Texture.TRILINEAR_SAMPLINGMODE)\n */\n samplingMode = Texture.TRILINEAR_SAMPLINGMODE) {\n super(name);\n this.name = name;\n this.url = url;\n this.noMipmap = noMipmap;\n this.invertY = invertY;\n this.samplingMode = samplingMode;\n }\n /**\n * Execute the current task\n * @param scene defines the scene where you want your assets to be loaded\n * @param onSuccess is a callback called when the task is successfully executed\n * @param onError is a callback called if an error occurs\n */\n runTask(scene, onSuccess, onError) {\n const onload = () => {\n onSuccess();\n };\n const onerror = (message, exception) => {\n onError(message, exception);\n };\n this.texture = new Texture(this.url, scene, this.noMipmap, this.invertY, this.samplingMode, onload, onerror);\n }\n}\n/**\n * Define a task used by AssetsManager to load cube textures\n */\nexport class CubeTextureAssetTask extends AbstractAssetTask {\n /**\n * Creates a new CubeTextureAssetTask\n * @param name defines the name of the task\n * @param url defines the location of the files to load (You have to specify the folder where the files are + filename with no extension)\n * @param extensions defines the extensions to use to load files ([\"_px\", \"_py\", \"_pz\", \"_nx\", \"_ny\", \"_nz\"] by default)\n * @param noMipmap defines if mipmaps should not be generated (default is false)\n * @param files defines the explicit list of files (undefined by default)\n * @param prefiltered\n */\n constructor(\n /**\n * Defines the name of the task\n */\n name, \n /**\n * Defines the location of the files to load (You have to specify the folder where the files are + filename with no extension)\n */\n url, \n /**\n * Defines the extensions to use to load files ([\"_px\", \"_py\", \"_pz\", \"_nx\", \"_ny\", \"_nz\"] by default)\n */\n extensions, \n /**\n * Defines if mipmaps should not be generated (default is false)\n */\n noMipmap, \n /**\n * Defines the explicit list of files (undefined by default)\n */\n files, \n /**\n * Defines the prefiltered texture option (default is false)\n */\n prefiltered) {\n super(name);\n this.name = name;\n this.url = url;\n this.extensions = extensions;\n this.noMipmap = noMipmap;\n this.files = files;\n this.prefiltered = prefiltered;\n }\n /**\n * Execute the current task\n * @param scene defines the scene where you want your assets to be loaded\n * @param onSuccess is a callback called when the task is successfully executed\n * @param onError is a callback called if an error occurs\n */\n runTask(scene, onSuccess, onError) {\n const onload = () => {\n onSuccess();\n };\n const onerror = (message, exception) => {\n onError(message, exception);\n };\n this.texture = new CubeTexture(this.url, scene, this.extensions, this.noMipmap, this.files, onload, onerror, undefined, this.prefiltered);\n }\n}\n/**\n * Define a task used by AssetsManager to load HDR cube textures\n */\nexport class HDRCubeTextureAssetTask extends AbstractAssetTask {\n /**\n * Creates a new HDRCubeTextureAssetTask object\n * @param name defines the name of the task\n * @param url defines the location of the file to load\n * @param size defines the desired size (the more it increases the longer the generation will be) If the size is omitted this implies you are using a preprocessed cubemap.\n * @param noMipmap defines if mipmaps should not be generated (default is false)\n * @param generateHarmonics specifies whether you want to extract the polynomial harmonics during the generation process (default is true)\n * @param gammaSpace specifies if the texture will be use in gamma or linear space (the PBR material requires those texture in linear space, but the standard material would require them in Gamma space) (default is false)\n * @param reserved Internal use only\n */\n constructor(\n /**\n * Defines the name of the task\n */\n name, \n /**\n * Defines the location of the file to load\n */\n url, \n /**\n * Defines the desired size (the more it increases the longer the generation will be)\n */\n size, \n /**\n * Defines if mipmaps should not be generated (default is false)\n */\n noMipmap = false, \n /**\n * Specifies whether you want to extract the polynomial harmonics during the generation process (default is true)\n */\n generateHarmonics = true, \n /**\n * Specifies if the texture will be use in gamma or linear space (the PBR material requires those texture in linear space, but the standard material would require them in Gamma space) (default is false)\n */\n gammaSpace = false, \n /**\n * Internal Use Only\n */\n reserved = false) {\n super(name);\n this.name = name;\n this.url = url;\n this.size = size;\n this.noMipmap = noMipmap;\n this.generateHarmonics = generateHarmonics;\n this.gammaSpace = gammaSpace;\n this.reserved = reserved;\n }\n /**\n * Execute the current task\n * @param scene defines the scene where you want your assets to be loaded\n * @param onSuccess is a callback called when the task is successfully executed\n * @param onError is a callback called if an error occurs\n */\n runTask(scene, onSuccess, onError) {\n const onload = () => {\n onSuccess();\n };\n const onerror = (message, exception) => {\n onError(message, exception);\n };\n this.texture = new HDRCubeTexture(this.url, scene, this.size, this.noMipmap, this.generateHarmonics, this.gammaSpace, this.reserved, onload, onerror);\n }\n}\n/**\n * Define a task used by AssetsManager to load Equirectangular cube textures\n */\nexport class EquiRectangularCubeTextureAssetTask extends AbstractAssetTask {\n /**\n * Creates a new EquiRectangularCubeTextureAssetTask object\n * @param name defines the name of the task\n * @param url defines the location of the file to load\n * @param size defines the desired size (the more it increases the longer the generation will be)\n * If the size is omitted this implies you are using a preprocessed cubemap.\n * @param noMipmap defines if mipmaps should not be generated (default is false)\n * @param gammaSpace specifies if the texture will be used in gamma or linear space\n * (the PBR material requires those texture in linear space, but the standard material would require them in Gamma space)\n * (default is true)\n */\n constructor(\n /**\n * Defines the name of the task\n */\n name, \n /**\n * Defines the location of the file to load\n */\n url, \n /**\n * Defines the desired size (the more it increases the longer the generation will be)\n */\n size, \n /**\n * Defines if mipmaps should not be generated (default is false)\n */\n noMipmap = false, \n /**\n * Specifies if the texture will be use in gamma or linear space (the PBR material requires those texture in linear space,\n * but the standard material would require them in Gamma space) (default is true)\n */\n gammaSpace = true) {\n super(name);\n this.name = name;\n this.url = url;\n this.size = size;\n this.noMipmap = noMipmap;\n this.gammaSpace = gammaSpace;\n }\n /**\n * Execute the current task\n * @param scene defines the scene where you want your assets to be loaded\n * @param onSuccess is a callback called when the task is successfully executed\n * @param onError is a callback called if an error occurs\n */\n runTask(scene, onSuccess, onError) {\n const onload = () => {\n onSuccess();\n };\n const onerror = (message, exception) => {\n onError(message, exception);\n };\n this.texture = new EquiRectangularCubeTexture(this.url, scene, this.size, this.noMipmap, this.gammaSpace, onload, onerror);\n }\n}\n/**\n * This class can be used to easily import assets into a scene\n * @see https://doc.babylonjs.com/features/featuresDeepDive/importers/assetManager\n */\nexport class AssetsManager {\n /**\n * Creates a new AssetsManager\n * @param scene defines the scene to work on\n */\n constructor(scene) {\n this._isLoading = false;\n this._tasks = new Array();\n this._waitingTasksCount = 0;\n this._totalTasksCount = 0;\n /**\n * Observable called when all tasks are processed\n */\n this.onTaskSuccessObservable = new Observable();\n /**\n * Observable called when a task had an error\n */\n this.onTaskErrorObservable = new Observable();\n /**\n * Observable called when all tasks were executed\n */\n this.onTasksDoneObservable = new Observable();\n /**\n * Observable called when a task is done (whatever the result is)\n */\n this.onProgressObservable = new Observable();\n /**\n * Gets or sets a boolean defining if the AssetsManager should use the default loading screen\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/customLoadingScreen\n */\n this.useDefaultLoadingScreen = true;\n /**\n * Gets or sets a boolean defining if the AssetsManager should automatically hide the loading screen\n * when all assets have been downloaded.\n * If set to false, you need to manually call in hideLoadingUI() once your scene is ready.\n */\n this.autoHideLoadingUI = true;\n this._scene = scene || EngineStore.LastCreatedScene;\n }\n /**\n * Add a ContainerAssetTask to the list of active tasks\n * @param taskName defines the name of the new task\n * @param meshesNames defines the name of meshes to load\n * @param rootUrl defines the root url to use to locate files\n * @param sceneFilename defines the filename of the scene file or the File itself\n * @param extension defines the extension to use to load the file\n * @returns a new ContainerAssetTask object\n */\n addContainerTask(taskName, meshesNames, rootUrl, sceneFilename, extension) {\n const task = new ContainerAssetTask(taskName, meshesNames, rootUrl, sceneFilename, extension);\n this._tasks.push(task);\n return task;\n }\n /**\n * Add a MeshAssetTask to the list of active tasks\n * @param taskName defines the name of the new task\n * @param meshesNames defines the name of meshes to load\n * @param rootUrl defines the root url to use to locate files\n * @param sceneFilename defines the filename of the scene file or the File itself\n * @param extension defines the extension to use to load the file\n * @returns a new MeshAssetTask object\n */\n addMeshTask(taskName, meshesNames, rootUrl, sceneFilename, extension) {\n const task = new MeshAssetTask(taskName, meshesNames, rootUrl, sceneFilename, extension);\n this._tasks.push(task);\n return task;\n }\n /**\n * Add a TextFileAssetTask to the list of active tasks\n * @param taskName defines the name of the new task\n * @param url defines the url of the file to load\n * @returns a new TextFileAssetTask object\n */\n addTextFileTask(taskName, url) {\n const task = new TextFileAssetTask(taskName, url);\n this._tasks.push(task);\n return task;\n }\n /**\n * Add a BinaryFileAssetTask to the list of active tasks\n * @param taskName defines the name of the new task\n * @param url defines the url of the file to load\n * @returns a new BinaryFileAssetTask object\n */\n addBinaryFileTask(taskName, url) {\n const task = new BinaryFileAssetTask(taskName, url);\n this._tasks.push(task);\n return task;\n }\n /**\n * Add a ImageAssetTask to the list of active tasks\n * @param taskName defines the name of the new task\n * @param url defines the url of the file to load\n * @returns a new ImageAssetTask object\n */\n addImageTask(taskName, url) {\n const task = new ImageAssetTask(taskName, url);\n this._tasks.push(task);\n return task;\n }\n /**\n * Add a TextureAssetTask to the list of active tasks\n * @param taskName defines the name of the new task\n * @param url defines the url of the file to load\n * @param noMipmap defines if the texture must not receive mipmaps (false by default)\n * @param invertY defines if you want to invert Y axis of the loaded texture (true by default)\n * @param samplingMode defines the sampling mode to use (Texture.TRILINEAR_SAMPLINGMODE by default)\n * @returns a new TextureAssetTask object\n */\n addTextureTask(taskName, url, noMipmap, invertY, samplingMode = Texture.TRILINEAR_SAMPLINGMODE) {\n const task = new TextureAssetTask(taskName, url, noMipmap, invertY, samplingMode);\n this._tasks.push(task);\n return task;\n }\n /**\n * Add a CubeTextureAssetTask to the list of active tasks\n * @param taskName defines the name of the new task\n * @param url defines the url of the file to load\n * @param extensions defines the extension to use to load the cube map (can be null)\n * @param noMipmap defines if the texture must not receive mipmaps (false by default)\n * @param files defines the list of files to load (can be null)\n * @param prefiltered defines the prefiltered texture option (default is false)\n * @returns a new CubeTextureAssetTask object\n */\n addCubeTextureTask(taskName, url, extensions, noMipmap, files, prefiltered) {\n const task = new CubeTextureAssetTask(taskName, url, extensions, noMipmap, files, prefiltered);\n this._tasks.push(task);\n return task;\n }\n /**\n *\n * Add a HDRCubeTextureAssetTask to the list of active tasks\n * @param taskName defines the name of the new task\n * @param url defines the url of the file to load\n * @param size defines the size you want for the cubemap (can be null)\n * @param noMipmap defines if the texture must not receive mipmaps (false by default)\n * @param generateHarmonics defines if you want to automatically generate (true by default)\n * @param gammaSpace specifies if the texture will be use in gamma or linear space (the PBR material requires those texture in linear space, but the standard material would require them in Gamma space) (default is false)\n * @param reserved Internal use only\n * @returns a new HDRCubeTextureAssetTask object\n */\n addHDRCubeTextureTask(taskName, url, size, noMipmap = false, generateHarmonics = true, gammaSpace = false, reserved = false) {\n const task = new HDRCubeTextureAssetTask(taskName, url, size, noMipmap, generateHarmonics, gammaSpace, reserved);\n this._tasks.push(task);\n return task;\n }\n /**\n *\n * Add a EquiRectangularCubeTextureAssetTask to the list of active tasks\n * @param taskName defines the name of the new task\n * @param url defines the url of the file to load\n * @param size defines the size you want for the cubemap (can be null)\n * @param noMipmap defines if the texture must not receive mipmaps (false by default)\n * @param gammaSpace Specifies if the texture will be used in gamma or linear space\n * (the PBR material requires those textures in linear space, but the standard material would require them in Gamma space)\n * @returns a new EquiRectangularCubeTextureAssetTask object\n */\n addEquiRectangularCubeTextureAssetTask(taskName, url, size, noMipmap = false, gammaSpace = true) {\n const task = new EquiRectangularCubeTextureAssetTask(taskName, url, size, noMipmap, gammaSpace);\n this._tasks.push(task);\n return task;\n }\n /**\n * Remove a task from the assets manager.\n * @param task the task to remove\n */\n removeTask(task) {\n const index = this._tasks.indexOf(task);\n if (index > -1) {\n this._tasks.splice(index, 1);\n }\n }\n _decreaseWaitingTasksCount(task) {\n this._waitingTasksCount--;\n try {\n if (this.onProgress) {\n this.onProgress(this._waitingTasksCount, this._totalTasksCount, task);\n }\n this.onProgressObservable.notifyObservers(new AssetsProgressEvent(this._waitingTasksCount, this._totalTasksCount, task));\n }\n catch (e) {\n Logger.Error(\"Error running progress callbacks.\");\n console.log(e);\n }\n if (this._waitingTasksCount === 0) {\n try {\n const currentTasks = this._tasks.slice();\n if (this.onFinish) {\n // Calling onFinish with immutable array of tasks\n this.onFinish(currentTasks);\n }\n // Let's remove successful tasks\n for (const task of currentTasks) {\n if (task.taskState === AssetTaskState.DONE) {\n const index = this._tasks.indexOf(task);\n if (index > -1) {\n this._tasks.splice(index, 1);\n }\n }\n }\n this.onTasksDoneObservable.notifyObservers(this._tasks);\n }\n catch (e) {\n Logger.Error(\"Error running tasks-done callbacks.\");\n console.log(e);\n }\n this._isLoading = false;\n if (this.autoHideLoadingUI) {\n this._scene.getEngine().hideLoadingUI();\n }\n }\n }\n _runTask(task) {\n const done = () => {\n try {\n if (this.onTaskSuccess) {\n this.onTaskSuccess(task);\n }\n this.onTaskSuccessObservable.notifyObservers(task);\n this._decreaseWaitingTasksCount(task);\n }\n catch (e) {\n error(\"Error executing task success callbacks\", e);\n }\n };\n const error = (message, exception) => {\n task._setErrorObject(message, exception);\n if (this.onTaskError) {\n this.onTaskError(task);\n }\n else if (!task.onError) {\n Logger.Error(this._formatTaskErrorMessage(task));\n }\n this.onTaskErrorObservable.notifyObservers(task);\n this._decreaseWaitingTasksCount(task);\n };\n task.run(this._scene, done, error);\n }\n _formatTaskErrorMessage(task) {\n let errorMessage = \"Unable to complete task \" + task.name;\n if (task.errorObject.message) {\n errorMessage += `: ${task.errorObject.message}`;\n }\n if (task.errorObject.exception) {\n errorMessage += `: ${task.errorObject.exception}`;\n }\n return errorMessage;\n }\n /**\n * Reset the AssetsManager and remove all tasks\n * @returns the current instance of the AssetsManager\n */\n reset() {\n this._isLoading = false;\n this._tasks = new Array();\n return this;\n }\n /**\n * Start the loading process\n * @returns the current instance of the AssetsManager\n */\n load() {\n if (this._isLoading) {\n return this;\n }\n this._isLoading = true;\n this._waitingTasksCount = this._tasks.length;\n this._totalTasksCount = this._tasks.length;\n if (this._waitingTasksCount === 0) {\n this._isLoading = false;\n if (this.onFinish) {\n this.onFinish(this._tasks);\n }\n this.onTasksDoneObservable.notifyObservers(this._tasks);\n return this;\n }\n if (this.useDefaultLoadingScreen) {\n this._scene.getEngine().displayLoadingUI();\n }\n for (let index = 0; index < this._tasks.length; index++) {\n const task = this._tasks[index];\n if (task.taskState === AssetTaskState.INIT) {\n this._runTask(task);\n }\n }\n return this;\n }\n /**\n * Start the loading process as an async operation\n * @returns a promise returning the list of failed tasks\n */\n loadAsync() {\n return new Promise((resolve, reject) => {\n if (this._isLoading) {\n resolve();\n return;\n }\n this.onTasksDoneObservable.addOnce((remainingTasks) => {\n if (remainingTasks && remainingTasks.length) {\n reject(remainingTasks);\n }\n else {\n resolve();\n }\n });\n this.load();\n });\n }\n}\n//# sourceMappingURL=assetsManager.js.map","\n\n\n\n\n\n","\n/**\n * Configuration needed for prepass-capable materials\n */\nexport class PrePassConfiguration {\n constructor() {\n /**\n * Previous world matrices of meshes carrying this material\n * Used for computing velocity\n */\n this.previousWorldMatrices = {};\n /**\n * Previous bones of meshes carrying this material\n * Used for computing velocity\n */\n this.previousBones = {};\n }\n /**\n * Add the required uniforms to the current list.\n * @param uniforms defines the current uniform list.\n */\n static AddUniforms(uniforms) {\n uniforms.push(\"previousWorld\", \"previousViewProjection\", \"mPreviousBones\");\n }\n /**\n * Add the required samplers to the current list.\n * @param samplers defines the current sampler list.\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static AddSamplers(samplers) {\n // pass\n }\n /**\n * Binds the material data.\n * @param effect defines the effect to update\n * @param scene defines the scene the material belongs to.\n * @param mesh The mesh\n * @param world World matrix of this mesh\n * @param isFrozen Is the material frozen\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n bindForSubMesh(effect, scene, mesh, world, isFrozen) {\n if (scene.prePassRenderer && scene.prePassRenderer.enabled && scene.prePassRenderer.currentRTisSceneRT) {\n if (scene.prePassRenderer.getIndex(2) !== -1) {\n if (!this.previousWorldMatrices[mesh.uniqueId]) {\n this.previousWorldMatrices[mesh.uniqueId] = world.clone();\n }\n if (!this.previousViewProjection) {\n this.previousViewProjection = scene.getTransformMatrix().clone();\n this.currentViewProjection = scene.getTransformMatrix().clone();\n }\n const engine = scene.getEngine();\n if (this.currentViewProjection.updateFlag !== scene.getTransformMatrix().updateFlag) {\n // First update of the prepass configuration for this rendering pass\n this._lastUpdateFrameId = engine.frameId;\n this.previousViewProjection.copyFrom(this.currentViewProjection);\n this.currentViewProjection.copyFrom(scene.getTransformMatrix());\n }\n else if (this._lastUpdateFrameId !== engine.frameId) {\n // The scene transformation did not change from the previous frame (so no camera motion), we must update previousViewProjection accordingly\n this._lastUpdateFrameId = engine.frameId;\n this.previousViewProjection.copyFrom(this.currentViewProjection);\n }\n effect.setMatrix(\"previousWorld\", this.previousWorldMatrices[mesh.uniqueId]);\n effect.setMatrix(\"previousViewProjection\", this.previousViewProjection);\n this.previousWorldMatrices[mesh.uniqueId] = world.clone();\n }\n }\n }\n}\n//# sourceMappingURL=prePassConfiguration.js.map","import { Matrix } from \"../Maths/math.vector.js\";\nimport { Material } from \"../Materials/material.js\";\n/**\n * Base class of materials working in push mode in babylon JS\n * @internal\n */\nexport class PushMaterial extends Material {\n constructor(name, scene, storeEffectOnSubMeshes = true) {\n super(name, scene);\n this._normalMatrix = new Matrix();\n this._storeEffectOnSubMeshes = storeEffectOnSubMeshes;\n }\n getEffect() {\n return this._storeEffectOnSubMeshes ? this._activeEffect : super.getEffect();\n }\n isReady(mesh, useInstances) {\n if (!mesh) {\n return false;\n }\n if (!this._storeEffectOnSubMeshes) {\n return true;\n }\n if (!mesh.subMeshes || mesh.subMeshes.length === 0) {\n return true;\n }\n return this.isReadyForSubMesh(mesh, mesh.subMeshes[0], useInstances);\n }\n _isReadyForSubMesh(subMesh) {\n const defines = subMesh.materialDefines;\n if (!this.checkReadyOnEveryCall && subMesh.effect && defines) {\n if (defines._renderId === this.getScene().getRenderId()) {\n return true;\n }\n }\n return false;\n }\n /**\n * Binds the given world matrix to the active effect\n *\n * @param world the matrix to bind\n */\n bindOnlyWorldMatrix(world) {\n this._activeEffect.setMatrix(\"world\", world);\n }\n /**\n * Binds the given normal matrix to the active effect\n *\n * @param normalMatrix the matrix to bind\n */\n bindOnlyNormalMatrix(normalMatrix) {\n this._activeEffect.setMatrix(\"normalMatrix\", normalMatrix);\n }\n bind(world, mesh) {\n if (!mesh) {\n return;\n }\n this.bindForSubMesh(world, mesh, mesh.subMeshes[0]);\n }\n _afterBind(mesh, effect = null) {\n super._afterBind(mesh, effect);\n this.getScene()._cachedEffect = effect;\n if (effect) {\n effect._forceRebindOnNextCall = false;\n }\n }\n _mustRebind(scene, effect, visibility = 1) {\n return scene.isCachedMaterialInvalid(this, effect, visibility);\n }\n dispose(forceDisposeEffect, forceDisposeTextures, notBoundToMesh) {\n this._activeEffect = undefined;\n super.dispose(forceDisposeEffect, forceDisposeTextures, notBoundToMesh);\n }\n}\n//# sourceMappingURL=pushMaterial.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"decalFragmentDeclaration\";\nconst shader = `#ifdef DECAL\nuniform vec4 vDecalInfos;\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const decalFragmentDeclaration = { name, shader };\n//# sourceMappingURL=decalFragmentDeclaration.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nimport \"./decalFragmentDeclaration.js\";\nconst name = \"defaultFragmentDeclaration\";\nconst shader = `uniform vec4 vEyePosition;uniform vec4 vDiffuseColor;\n#ifdef SPECULARTERM\nuniform vec4 vSpecularColor;\n#endif\nuniform vec3 vEmissiveColor;uniform vec3 vAmbientColor;uniform float visibility;\n#ifdef DIFFUSE\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef AMBIENT\nuniform vec2 vAmbientInfos;\n#endif\n#ifdef OPACITY \nuniform vec2 vOpacityInfos;\n#endif\n#ifdef EMISSIVE\nuniform vec2 vEmissiveInfos;\n#endif\n#ifdef LIGHTMAP\nuniform vec2 vLightmapInfos;\n#endif\n#ifdef BUMP\nuniform vec3 vBumpInfos;uniform vec2 vTangentSpaceParams;\n#endif\n#ifdef ALPHATEST\nuniform float alphaCutOff;\n#endif\n#if defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_PROJECTION) || defined(REFRACTION) || defined(PREPASS)\nuniform mat4 view;\n#endif\n#ifdef REFRACTION\nuniform vec4 vRefractionInfos;\n#ifndef REFRACTIONMAP_3D\nuniform mat4 refractionMatrix;\n#endif\n#ifdef REFRACTIONFRESNEL\nuniform vec4 refractionLeftColor;uniform vec4 refractionRightColor;\n#endif\n#if defined(USE_LOCAL_REFRACTIONMAP_CUBIC) && defined(REFRACTIONMAP_3D)\nuniform vec3 vRefractionPosition;uniform vec3 vRefractionSize; \n#endif\n#endif\n#if defined(SPECULAR) && defined(SPECULARTERM)\nuniform vec2 vSpecularInfos;\n#endif\n#ifdef DIFFUSEFRESNEL\nuniform vec4 diffuseLeftColor;uniform vec4 diffuseRightColor;\n#endif\n#ifdef OPACITYFRESNEL\nuniform vec4 opacityParts;\n#endif\n#ifdef EMISSIVEFRESNEL\nuniform vec4 emissiveLeftColor;uniform vec4 emissiveRightColor;\n#endif\n#ifdef REFLECTION\nuniform vec2 vReflectionInfos;\n#if defined(REFLECTIONMAP_PLANAR) || defined(REFLECTIONMAP_CUBIC) || defined(REFLECTIONMAP_PROJECTION) || defined(REFLECTIONMAP_EQUIRECTANGULAR) || defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_SKYBOX)\nuniform mat4 reflectionMatrix;\n#endif\n#ifndef REFLECTIONMAP_SKYBOX\n#if defined(USE_LOCAL_REFLECTIONMAP_CUBIC) && defined(REFLECTIONMAP_CUBIC)\nuniform vec3 vReflectionPosition;uniform vec3 vReflectionSize; \n#endif\n#endif\n#ifdef REFLECTIONFRESNEL\nuniform vec4 reflectionLeftColor;uniform vec4 reflectionRightColor;\n#endif\n#endif\n#ifdef DETAIL\nuniform vec4 vDetailInfos;\n#endif\n#include\n#define ADDITIONAL_FRAGMENT_DECLARATION\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const defaultFragmentDeclaration = { name, shader };\n//# sourceMappingURL=defaultFragmentDeclaration.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"meshUboDeclaration\";\nconst shader = `#ifdef WEBGL2\nuniform mat4 world;uniform float visibility;\n#else\nlayout(std140,column_major) uniform;uniform Mesh\n{mat4 world;float visibility;};\n#endif\n#define WORLD_UBO\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const meshUboDeclaration = { name, shader };\n//# sourceMappingURL=meshUboDeclaration.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nimport \"./sceneUboDeclaration.js\";\nimport \"./meshUboDeclaration.js\";\nconst name = \"defaultUboDeclaration\";\nconst shader = `layout(std140,column_major) uniform;uniform Material\n{vec4 diffuseLeftColor;vec4 diffuseRightColor;vec4 opacityParts;vec4 reflectionLeftColor;vec4 reflectionRightColor;vec4 refractionLeftColor;vec4 refractionRightColor;vec4 emissiveLeftColor;vec4 emissiveRightColor;vec2 vDiffuseInfos;vec2 vAmbientInfos;vec2 vOpacityInfos;vec2 vReflectionInfos;vec3 vReflectionPosition;vec3 vReflectionSize;vec2 vEmissiveInfos;vec2 vLightmapInfos;vec2 vSpecularInfos;vec3 vBumpInfos;mat4 diffuseMatrix;mat4 ambientMatrix;mat4 opacityMatrix;mat4 reflectionMatrix;mat4 emissiveMatrix;mat4 lightmapMatrix;mat4 specularMatrix;mat4 bumpMatrix;vec2 vTangentSpaceParams;float pointSize;float alphaCutOff;mat4 refractionMatrix;vec4 vRefractionInfos;vec3 vRefractionPosition;vec3 vRefractionSize;vec4 vSpecularColor;vec3 vEmissiveColor;vec4 vDiffuseColor;vec3 vAmbientColor;\n#define ADDITIONAL_UBO_DECLARATION\n};\n#include\n#include\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const defaultUboDeclaration = { name, shader };\n//# sourceMappingURL=defaultUboDeclaration.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"prePassDeclaration\";\nconst shader = `#ifdef PREPASS\n#extension GL_EXT_draw_buffers : require\nlayout(location=0) out highp vec4 glFragData[{X}];highp vec4 gl_FragColor;\n#ifdef PREPASS_DEPTH\nvarying highp vec3 vViewPos;\n#endif\n#ifdef PREPASS_VELOCITY\nvarying highp vec4 vCurrentPosition;varying highp vec4 vPreviousPosition;\n#endif\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const prePassDeclaration = { name, shader };\n//# sourceMappingURL=prePassDeclaration.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"oitDeclaration\";\nconst shader = `#ifdef ORDER_INDEPENDENT_TRANSPARENCY\n#extension GL_EXT_draw_buffers : require\nlayout(location=0) out vec2 depth; \nlayout(location=1) out vec4 frontColor;layout(location=2) out vec4 backColor;\n#define MAX_DEPTH 99999.0\nhighp vec4 gl_FragColor;uniform sampler2D oitDepthSampler;uniform sampler2D oitFrontColorSampler;\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const oitDeclaration = { name, shader };\n//# sourceMappingURL=oitDeclaration.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"mainUVVaryingDeclaration\";\nconst shader = `#ifdef MAINUV{X}\nvarying vec2 vMainUV{X};\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const mainUVVaryingDeclaration = { name, shader };\n//# sourceMappingURL=mainUVVaryingDeclaration.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"lightFragmentDeclaration\";\nconst shader = `#ifdef LIGHT{X}\nuniform vec4 vLightData{X};uniform vec4 vLightDiffuse{X};\n#ifdef SPECULARTERM\nuniform vec4 vLightSpecular{X};\n#else\nvec4 vLightSpecular{X}=vec4(0.);\n#endif\n#ifdef SHADOW{X}\n#ifdef SHADOWCSM{X}\nuniform mat4 lightMatrix{X}[SHADOWCSMNUM_CASCADES{X}];uniform float viewFrustumZ{X}[SHADOWCSMNUM_CASCADES{X}];uniform float frustumLengths{X}[SHADOWCSMNUM_CASCADES{X}];uniform float cascadeBlendFactor{X};varying vec4 vPositionFromLight{X}[SHADOWCSMNUM_CASCADES{X}];varying float vDepthMetric{X}[SHADOWCSMNUM_CASCADES{X}];varying vec4 vPositionFromCamera{X};\n#if defined(SHADOWPCSS{X})\nuniform highp sampler2DArrayShadow shadowSampler{X};uniform highp sampler2DArray depthSampler{X};uniform vec2 lightSizeUVCorrection{X}[SHADOWCSMNUM_CASCADES{X}];uniform float depthCorrection{X}[SHADOWCSMNUM_CASCADES{X}];uniform float penumbraDarkness{X};\n#elif defined(SHADOWPCF{X})\nuniform highp sampler2DArrayShadow shadowSampler{X};\n#else\nuniform highp sampler2DArray shadowSampler{X};\n#endif\n#ifdef SHADOWCSMDEBUG{X}\nconst vec3 vCascadeColorsMultiplier{X}[8]=vec3[8]\n(\nvec3 ( 1.5,0.0,0.0 ),\nvec3 ( 0.0,1.5,0.0 ),\nvec3 ( 0.0,0.0,5.5 ),\nvec3 ( 1.5,0.0,5.5 ),\nvec3 ( 1.5,1.5,0.0 ),\nvec3 ( 1.0,1.0,1.0 ),\nvec3 ( 0.0,1.0,5.5 ),\nvec3 ( 0.5,3.5,0.75 )\n);vec3 shadowDebug{X};\n#endif\n#ifdef SHADOWCSMUSESHADOWMAXZ{X}\nint index{X}=-1;\n#else\nint index{X}=SHADOWCSMNUM_CASCADES{X}-1;\n#endif\nfloat diff{X}=0.;\n#elif defined(SHADOWCUBE{X})\nuniform samplerCube shadowSampler{X};\n#else\nvarying vec4 vPositionFromLight{X};varying float vDepthMetric{X};\n#if defined(SHADOWPCSS{X})\nuniform highp sampler2DShadow shadowSampler{X};uniform highp sampler2D depthSampler{X};\n#elif defined(SHADOWPCF{X})\nuniform highp sampler2DShadow shadowSampler{X};\n#else\nuniform sampler2D shadowSampler{X};\n#endif\nuniform mat4 lightMatrix{X};\n#endif\nuniform vec4 shadowsInfo{X};uniform vec2 depthValues{X};\n#endif\n#ifdef SPOTLIGHT{X}\nuniform vec4 vLightDirection{X};uniform vec4 vLightFalloff{X};\n#elif defined(POINTLIGHT{X})\nuniform vec4 vLightFalloff{X};\n#elif defined(HEMILIGHT{X})\nuniform vec3 vLightGround{X};\n#endif\n#ifdef PROJECTEDLIGHTTEXTURE{X}\nuniform mat4 textureProjectionMatrix{X};uniform sampler2D projectionLightSampler{X};\n#endif\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const lightFragmentDeclaration = { name, shader };\n//# sourceMappingURL=lightFragmentDeclaration.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"lightUboDeclaration\";\nconst shader = `#ifdef LIGHT{X}\nuniform Light{X}\n{vec4 vLightData;vec4 vLightDiffuse;vec4 vLightSpecular;\n#ifdef SPOTLIGHT{X}\nvec4 vLightDirection;vec4 vLightFalloff;\n#elif defined(POINTLIGHT{X})\nvec4 vLightFalloff;\n#elif defined(HEMILIGHT{X})\nvec3 vLightGround;\n#endif\nvec4 shadowsInfo;vec2 depthValues;} light{X};\n#ifdef PROJECTEDLIGHTTEXTURE{X}\nuniform mat4 textureProjectionMatrix{X};uniform sampler2D projectionLightSampler{X};\n#endif\n#ifdef SHADOW{X}\n#ifdef SHADOWCSM{X}\nuniform mat4 lightMatrix{X}[SHADOWCSMNUM_CASCADES{X}];uniform float viewFrustumZ{X}[SHADOWCSMNUM_CASCADES{X}];uniform float frustumLengths{X}[SHADOWCSMNUM_CASCADES{X}];uniform float cascadeBlendFactor{X};varying vec4 vPositionFromLight{X}[SHADOWCSMNUM_CASCADES{X}];varying float vDepthMetric{X}[SHADOWCSMNUM_CASCADES{X}];varying vec4 vPositionFromCamera{X};\n#if defined(SHADOWPCSS{X})\nuniform highp sampler2DArrayShadow shadowSampler{X};uniform highp sampler2DArray depthSampler{X};uniform vec2 lightSizeUVCorrection{X}[SHADOWCSMNUM_CASCADES{X}];uniform float depthCorrection{X}[SHADOWCSMNUM_CASCADES{X}];uniform float penumbraDarkness{X};\n#elif defined(SHADOWPCF{X})\nuniform highp sampler2DArrayShadow shadowSampler{X};\n#else\nuniform highp sampler2DArray shadowSampler{X};\n#endif\n#ifdef SHADOWCSMDEBUG{X}\nconst vec3 vCascadeColorsMultiplier{X}[8]=vec3[8]\n(\nvec3 ( 1.5,0.0,0.0 ),\nvec3 ( 0.0,1.5,0.0 ),\nvec3 ( 0.0,0.0,5.5 ),\nvec3 ( 1.5,0.0,5.5 ),\nvec3 ( 1.5,1.5,0.0 ),\nvec3 ( 1.0,1.0,1.0 ),\nvec3 ( 0.0,1.0,5.5 ),\nvec3 ( 0.5,3.5,0.75 )\n);vec3 shadowDebug{X};\n#endif\n#ifdef SHADOWCSMUSESHADOWMAXZ{X}\nint index{X}=-1;\n#else\nint index{X}=SHADOWCSMNUM_CASCADES{X}-1;\n#endif\nfloat diff{X}=0.;\n#elif defined(SHADOWCUBE{X})\nuniform samplerCube shadowSampler{X}; \n#else\nvarying vec4 vPositionFromLight{X};varying float vDepthMetric{X};\n#if defined(SHADOWPCSS{X})\nuniform highp sampler2DShadow shadowSampler{X};uniform highp sampler2D depthSampler{X};\n#elif defined(SHADOWPCF{X})\nuniform highp sampler2DShadow shadowSampler{X};\n#else\nuniform sampler2D shadowSampler{X};\n#endif\nuniform mat4 lightMatrix{X};\n#endif\n#endif\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const lightUboDeclaration = { name, shader };\n//# sourceMappingURL=lightUboDeclaration.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"lightsFragmentFunctions\";\nconst shader = `struct lightingInfo\n{vec3 diffuse;\n#ifdef SPECULARTERM\nvec3 specular;\n#endif\n#ifdef NDOTL\nfloat ndl;\n#endif\n};lightingInfo computeLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec3 diffuseColor,vec3 specularColor,float range,float glossiness) {lightingInfo result;vec3 lightVectorW;float attenuation=1.0;if (lightData.w==0.)\n{vec3 direction=lightData.xyz-vPositionW;attenuation=max(0.,1.0-length(direction)/range);lightVectorW=normalize(direction);}\nelse\n{lightVectorW=normalize(-lightData.xyz);}\nfloat ndl=max(0.,dot(vNormal,lightVectorW));\n#ifdef NDOTL\nresult.ndl=ndl;\n#endif\nresult.diffuse=ndl*diffuseColor*attenuation;\n#ifdef SPECULARTERM\nvec3 angleW=normalize(viewDirectionW+lightVectorW);float specComp=max(0.,dot(vNormal,angleW));specComp=pow(specComp,max(1.,glossiness));result.specular=specComp*specularColor*attenuation;\n#endif\nreturn result;}\nlightingInfo computeSpotLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec4 lightDirection,vec3 diffuseColor,vec3 specularColor,float range,float glossiness) {lightingInfo result;vec3 direction=lightData.xyz-vPositionW;vec3 lightVectorW=normalize(direction);float attenuation=max(0.,1.0-length(direction)/range);float cosAngle=max(0.,dot(lightDirection.xyz,-lightVectorW));if (cosAngle>=lightDirection.w)\n{cosAngle=max(0.,pow(cosAngle,lightData.w));attenuation*=cosAngle;float ndl=max(0.,dot(vNormal,lightVectorW));\n#ifdef NDOTL\nresult.ndl=ndl;\n#endif\nresult.diffuse=ndl*diffuseColor*attenuation;\n#ifdef SPECULARTERM\nvec3 angleW=normalize(viewDirectionW+lightVectorW);float specComp=max(0.,dot(vNormal,angleW));specComp=pow(specComp,max(1.,glossiness));result.specular=specComp*specularColor*attenuation;\n#endif\nreturn result;}\nresult.diffuse=vec3(0.);\n#ifdef SPECULARTERM\nresult.specular=vec3(0.);\n#endif\n#ifdef NDOTL\nresult.ndl=0.;\n#endif\nreturn result;}\nlightingInfo computeHemisphericLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec3 diffuseColor,vec3 specularColor,vec3 groundColor,float glossiness) {lightingInfo result;float ndl=dot(vNormal,lightData.xyz)*0.5+0.5;\n#ifdef NDOTL\nresult.ndl=ndl;\n#endif\nresult.diffuse=mix(groundColor,diffuseColor,ndl);\n#ifdef SPECULARTERM\nvec3 angleW=normalize(viewDirectionW+lightData.xyz);float specComp=max(0.,dot(vNormal,angleW));specComp=pow(specComp,max(1.,glossiness));result.specular=specComp*specularColor;\n#endif\nreturn result;}\n#define inline\nvec3 computeProjectionTextureDiffuseLighting(sampler2D projectionLightSampler,mat4 textureProjectionMatrix){vec4 strq=textureProjectionMatrix*vec4(vPositionW,1.0);strq/=strq.w;vec3 textureColor=texture2D(projectionLightSampler,strq.xy).rgb;return textureColor;}`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const lightsFragmentFunctions = { name, shader };\n//# sourceMappingURL=lightsFragmentFunctions.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"shadowsFragmentFunctions\";\nconst shader = `#ifdef SHADOWS\n#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)\n#define TEXTUREFUNC(s,c,l) texture2DLodEXT(s,c,l)\n#else\n#define TEXTUREFUNC(s,c,b) texture2D(s,c,b)\n#endif\n#ifndef SHADOWFLOAT\nfloat unpack(vec4 color)\n{const vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(color,bit_shift);}\n#endif\nfloat computeFallOff(float value,vec2 clipSpace,float frustumEdgeFalloff)\n{float mask=smoothstep(1.0-frustumEdgeFalloff,1.00000012,clamp(dot(clipSpace,clipSpace),0.,1.));return mix(value,1.0,mask);}\n#define inline\nfloat computeShadowCube(vec3 lightPosition,samplerCube shadowSampler,float darkness,vec2 depthValues)\n{vec3 directionToLight=vPositionW-lightPosition;float depth=length(directionToLight);depth=(depth+depthValues.x)/(depthValues.y);depth=clamp(depth,0.,1.0);directionToLight=normalize(directionToLight);directionToLight.y=-directionToLight.y;\n#ifndef SHADOWFLOAT\nfloat shadow=unpack(textureCube(shadowSampler,directionToLight));\n#else\nfloat shadow=textureCube(shadowSampler,directionToLight).x;\n#endif\nreturn depth>shadow ? darkness : 1.0;}\n#define inline\nfloat computeShadowWithPoissonSamplingCube(vec3 lightPosition,samplerCube shadowSampler,float mapSize,float darkness,vec2 depthValues)\n{vec3 directionToLight=vPositionW-lightPosition;float depth=length(directionToLight);depth=(depth+depthValues.x)/(depthValues.y);depth=clamp(depth,0.,1.0);directionToLight=normalize(directionToLight);directionToLight.y=-directionToLight.y;float visibility=1.;vec3 poissonDisk[4];poissonDisk[0]=vec3(-1.0,1.0,-1.0);poissonDisk[1]=vec3(1.0,-1.0,-1.0);poissonDisk[2]=vec3(-1.0,-1.0,-1.0);poissonDisk[3]=vec3(1.0,-1.0,1.0);\n#ifndef SHADOWFLOAT\nif (unpack(textureCube(shadowSampler,directionToLight+poissonDisk[0]*mapSize))shadow ? computeFallOff(darkness,clipSpace.xy,frustumEdgeFalloff) : 1.;}\n#endif\n#define inline\nfloat computeShadow(vec4 vPositionFromLight,float depthMetric,sampler2D shadowSampler,float darkness,float frustumEdgeFalloff)\n{vec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;vec2 uv=0.5*clipSpace.xy+vec2(0.5);if (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)\n{return 1.0;}\nelse\n{float shadowPixelDepth=clamp(depthMetric,0.,1.0);\n#ifndef SHADOWFLOAT\nfloat shadow=unpack(TEXTUREFUNC(shadowSampler,uv,0.));\n#else\nfloat shadow=TEXTUREFUNC(shadowSampler,uv,0.).x;\n#endif\nreturn shadowPixelDepth>shadow ? computeFallOff(darkness,clipSpace.xy,frustumEdgeFalloff) : 1.;}}\n#define inline\nfloat computeShadowWithPoissonSampling(vec4 vPositionFromLight,float depthMetric,sampler2D shadowSampler,float mapSize,float darkness,float frustumEdgeFalloff)\n{vec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;vec2 uv=0.5*clipSpace.xy+vec2(0.5);if (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)\n{return 1.0;}\nelse\n{float shadowPixelDepth=clamp(depthMetric,0.,1.0);float visibility=1.;vec2 poissonDisk[4];poissonDisk[0]=vec2(-0.94201624,-0.39906216);poissonDisk[1]=vec2(0.94558609,-0.76890725);poissonDisk[2]=vec2(-0.094184101,-0.92938870);poissonDisk[3]=vec2(0.34495938,0.29387760);\n#ifndef SHADOWFLOAT\nif (unpack(TEXTUREFUNC(shadowSampler,uv+poissonDisk[0]*mapSize,0.))1.0 || uv.y<0. || uv.y>1.0)\n{return 1.0;}\nelse\n{float shadowPixelDepth=clamp(depthMetric,0.,1.0);\n#ifndef SHADOWFLOAT\nfloat shadowMapSample=unpack(TEXTUREFUNC(shadowSampler,uv,0.));\n#else\nfloat shadowMapSample=TEXTUREFUNC(shadowSampler,uv,0.).x;\n#endif\nfloat esm=1.0-clamp(exp(min(87.,depthScale*shadowPixelDepth))*shadowMapSample,0.,1.-darkness);return computeFallOff(esm,clipSpace.xy,frustumEdgeFalloff);}}\n#define inline\nfloat computeShadowWithCloseESM(vec4 vPositionFromLight,float depthMetric,sampler2D shadowSampler,float darkness,float depthScale,float frustumEdgeFalloff)\n{vec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;vec2 uv=0.5*clipSpace.xy+vec2(0.5);if (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)\n{return 1.0;}\nelse\n{float shadowPixelDepth=clamp(depthMetric,0.,1.0); \n#ifndef SHADOWFLOAT\nfloat shadowMapSample=unpack(TEXTUREFUNC(shadowSampler,uv,0.));\n#else\nfloat shadowMapSample=TEXTUREFUNC(shadowSampler,uv,0.).x;\n#endif\nfloat esm=clamp(exp(min(87.,-depthScale*(shadowPixelDepth-shadowMapSample))),darkness,1.);return computeFallOff(esm,clipSpace.xy,frustumEdgeFalloff);}}\n#ifdef IS_NDC_HALF_ZRANGE\n#define ZINCLIP clipSpace.z\n#else\n#define ZINCLIP uvDepth.z\n#endif\n#if defined(WEBGL2) || defined(WEBGPU) || defined(NATIVE)\n#define GREATEST_LESS_THAN_ONE 0.99999994\n#define inline\nfloat computeShadowWithCSMPCF1(float layer,vec4 vPositionFromLight,float depthMetric,highp sampler2DArrayShadow shadowSampler,float darkness,float frustumEdgeFalloff)\n{vec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;vec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));uvDepth.z=clamp(ZINCLIP,0.,GREATEST_LESS_THAN_ONE);vec4 uvDepthLayer=vec4(uvDepth.x,uvDepth.y,layer,uvDepth.z);float shadow=texture2D(shadowSampler,uvDepthLayer);shadow=mix(darkness,1.,shadow);return computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);}\n#define inline\nfloat computeShadowWithCSMPCF3(float layer,vec4 vPositionFromLight,float depthMetric,highp sampler2DArrayShadow shadowSampler,vec2 shadowMapSizeAndInverse,float darkness,float frustumEdgeFalloff)\n{vec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;vec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));uvDepth.z=clamp(ZINCLIP,0.,GREATEST_LESS_THAN_ONE);vec2 uv=uvDepth.xy*shadowMapSizeAndInverse.x; \nuv+=0.5; \nvec2 st=fract(uv); \nvec2 base_uv=floor(uv)-0.5; \nbase_uv*=shadowMapSizeAndInverse.y; \nvec2 uvw0=3.-2.*st;vec2 uvw1=1.+2.*st;vec2 u=vec2((2.-st.x)/uvw0.x-1.,st.x/uvw1.x+1.)*shadowMapSizeAndInverse.y;vec2 v=vec2((2.-st.y)/uvw0.y-1.,st.y/uvw1.y+1.)*shadowMapSizeAndInverse.y;float shadow=0.;shadow+=uvw0.x*uvw0.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[0],v[0]),layer,uvDepth.z));shadow+=uvw1.x*uvw0.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[1],v[0]),layer,uvDepth.z));shadow+=uvw0.x*uvw1.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[0],v[1]),layer,uvDepth.z));shadow+=uvw1.x*uvw1.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[1],v[1]),layer,uvDepth.z));shadow=shadow/16.;shadow=mix(darkness,1.,shadow);return computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);}\n#define inline\nfloat computeShadowWithCSMPCF5(float layer,vec4 vPositionFromLight,float depthMetric,highp sampler2DArrayShadow shadowSampler,vec2 shadowMapSizeAndInverse,float darkness,float frustumEdgeFalloff)\n{vec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;vec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));uvDepth.z=clamp(ZINCLIP,0.,GREATEST_LESS_THAN_ONE);vec2 uv=uvDepth.xy*shadowMapSizeAndInverse.x; \nuv+=0.5; \nvec2 st=fract(uv); \nvec2 base_uv=floor(uv)-0.5; \nbase_uv*=shadowMapSizeAndInverse.y; \nvec2 uvw0=4.-3.*st;vec2 uvw1=vec2(7.);vec2 uvw2=1.+3.*st;vec3 u=vec3((3.-2.*st.x)/uvw0.x-2.,(3.+st.x)/uvw1.x,st.x/uvw2.x+2.)*shadowMapSizeAndInverse.y;vec3 v=vec3((3.-2.*st.y)/uvw0.y-2.,(3.+st.y)/uvw1.y,st.y/uvw2.y+2.)*shadowMapSizeAndInverse.y;float shadow=0.;shadow+=uvw0.x*uvw0.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[0],v[0]),layer,uvDepth.z));shadow+=uvw1.x*uvw0.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[1],v[0]),layer,uvDepth.z));shadow+=uvw2.x*uvw0.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[2],v[0]),layer,uvDepth.z));shadow+=uvw0.x*uvw1.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[0],v[1]),layer,uvDepth.z));shadow+=uvw1.x*uvw1.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[1],v[1]),layer,uvDepth.z));shadow+=uvw2.x*uvw1.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[2],v[1]),layer,uvDepth.z));shadow+=uvw0.x*uvw2.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[0],v[2]),layer,uvDepth.z));shadow+=uvw1.x*uvw2.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[1],v[2]),layer,uvDepth.z));shadow+=uvw2.x*uvw2.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[2],v[2]),layer,uvDepth.z));shadow=shadow/144.;shadow=mix(darkness,1.,shadow);return computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);}\n#define inline\nfloat computeShadowWithPCF1(vec4 vPositionFromLight,float depthMetric,highp sampler2DShadow shadowSampler,float darkness,float frustumEdgeFalloff)\n{if (depthMetric>1.0 || depthMetric<0.0) {return 1.0;}\nelse\n{vec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;vec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));uvDepth.z=ZINCLIP;float shadow=TEXTUREFUNC(shadowSampler,uvDepth,0.);shadow=mix(darkness,1.,shadow);return computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);}}\n#define inline\nfloat computeShadowWithPCF3(vec4 vPositionFromLight,float depthMetric,highp sampler2DShadow shadowSampler,vec2 shadowMapSizeAndInverse,float darkness,float frustumEdgeFalloff)\n{if (depthMetric>1.0 || depthMetric<0.0) {return 1.0;}\nelse\n{vec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;vec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));uvDepth.z=ZINCLIP;vec2 uv=uvDepth.xy*shadowMapSizeAndInverse.x; \nuv+=0.5; \nvec2 st=fract(uv); \nvec2 base_uv=floor(uv)-0.5; \nbase_uv*=shadowMapSizeAndInverse.y; \nvec2 uvw0=3.-2.*st;vec2 uvw1=1.+2.*st;vec2 u=vec2((2.-st.x)/uvw0.x-1.,st.x/uvw1.x+1.)*shadowMapSizeAndInverse.y;vec2 v=vec2((2.-st.y)/uvw0.y-1.,st.y/uvw1.y+1.)*shadowMapSizeAndInverse.y;float shadow=0.;shadow+=uvw0.x*uvw0.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[0]),uvDepth.z),0.);shadow+=uvw1.x*uvw0.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[0]),uvDepth.z),0.);shadow+=uvw0.x*uvw1.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[1]),uvDepth.z),0.);shadow+=uvw1.x*uvw1.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[1]),uvDepth.z),0.);shadow=shadow/16.;shadow=mix(darkness,1.,shadow);return computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);}}\n#define inline\nfloat computeShadowWithPCF5(vec4 vPositionFromLight,float depthMetric,highp sampler2DShadow shadowSampler,vec2 shadowMapSizeAndInverse,float darkness,float frustumEdgeFalloff)\n{if (depthMetric>1.0 || depthMetric<0.0) {return 1.0;}\nelse\n{vec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;vec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));uvDepth.z=ZINCLIP;vec2 uv=uvDepth.xy*shadowMapSizeAndInverse.x; \nuv+=0.5; \nvec2 st=fract(uv); \nvec2 base_uv=floor(uv)-0.5; \nbase_uv*=shadowMapSizeAndInverse.y; \nvec2 uvw0=4.-3.*st;vec2 uvw1=vec2(7.);vec2 uvw2=1.+3.*st;vec3 u=vec3((3.-2.*st.x)/uvw0.x-2.,(3.+st.x)/uvw1.x,st.x/uvw2.x+2.)*shadowMapSizeAndInverse.y;vec3 v=vec3((3.-2.*st.y)/uvw0.y-2.,(3.+st.y)/uvw1.y,st.y/uvw2.y+2.)*shadowMapSizeAndInverse.y;float shadow=0.;shadow+=uvw0.x*uvw0.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[0]),uvDepth.z),0.);shadow+=uvw1.x*uvw0.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[0]),uvDepth.z),0.);shadow+=uvw2.x*uvw0.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[2],v[0]),uvDepth.z),0.);shadow+=uvw0.x*uvw1.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[1]),uvDepth.z),0.);shadow+=uvw1.x*uvw1.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[1]),uvDepth.z),0.);shadow+=uvw2.x*uvw1.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[2],v[1]),uvDepth.z),0.);shadow+=uvw0.x*uvw2.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[2]),uvDepth.z),0.);shadow+=uvw1.x*uvw2.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[2]),uvDepth.z),0.);shadow+=uvw2.x*uvw2.y*TEXTUREFUNC(shadowSampler,vec3(base_uv.xy+vec2(u[2],v[2]),uvDepth.z),0.);shadow=shadow/144.;shadow=mix(darkness,1.,shadow);return computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);}}\nconst vec3 PoissonSamplers32[64]=vec3[64](\nvec3(0.06407013,0.05409927,0.),\nvec3(0.7366577,0.5789394,0.),\nvec3(-0.6270542,-0.5320278,0.),\nvec3(-0.4096107,0.8411095,0.),\nvec3(0.6849564,-0.4990818,0.),\nvec3(-0.874181,-0.04579735,0.),\nvec3(0.9989998,0.0009880066,0.),\nvec3(-0.004920578,-0.9151649,0.),\nvec3(0.1805763,0.9747483,0.),\nvec3(-0.2138451,0.2635818,0.),\nvec3(0.109845,0.3884785,0.),\nvec3(0.06876755,-0.3581074,0.),\nvec3(0.374073,-0.7661266,0.),\nvec3(0.3079132,-0.1216763,0.),\nvec3(-0.3794335,-0.8271583,0.),\nvec3(-0.203878,-0.07715034,0.),\nvec3(0.5912697,0.1469799,0.),\nvec3(-0.88069,0.3031784,0.),\nvec3(0.5040108,0.8283722,0.),\nvec3(-0.5844124,0.5494877,0.),\nvec3(0.6017799,-0.1726654,0.),\nvec3(-0.5554981,0.1559997,0.),\nvec3(-0.3016369,-0.3900928,0.),\nvec3(-0.5550632,-0.1723762,0.),\nvec3(0.925029,0.2995041,0.),\nvec3(-0.2473137,0.5538505,0.),\nvec3(0.9183037,-0.2862392,0.),\nvec3(0.2469421,0.6718712,0.),\nvec3(0.3916397,-0.4328209,0.),\nvec3(-0.03576927,-0.6220032,0.),\nvec3(-0.04661255,0.7995201,0.),\nvec3(0.4402924,0.3640312,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.)\n);const vec3 PoissonSamplers64[64]=vec3[64](\nvec3(-0.613392,0.617481,0.),\nvec3(0.170019,-0.040254,0.),\nvec3(-0.299417,0.791925,0.),\nvec3(0.645680,0.493210,0.),\nvec3(-0.651784,0.717887,0.),\nvec3(0.421003,0.027070,0.),\nvec3(-0.817194,-0.271096,0.),\nvec3(-0.705374,-0.668203,0.),\nvec3(0.977050,-0.108615,0.),\nvec3(0.063326,0.142369,0.),\nvec3(0.203528,0.214331,0.),\nvec3(-0.667531,0.326090,0.),\nvec3(-0.098422,-0.295755,0.),\nvec3(-0.885922,0.215369,0.),\nvec3(0.566637,0.605213,0.),\nvec3(0.039766,-0.396100,0.),\nvec3(0.751946,0.453352,0.),\nvec3(0.078707,-0.715323,0.),\nvec3(-0.075838,-0.529344,0.),\nvec3(0.724479,-0.580798,0.),\nvec3(0.222999,-0.215125,0.),\nvec3(-0.467574,-0.405438,0.),\nvec3(-0.248268,-0.814753,0.),\nvec3(0.354411,-0.887570,0.),\nvec3(0.175817,0.382366,0.),\nvec3(0.487472,-0.063082,0.),\nvec3(-0.084078,0.898312,0.),\nvec3(0.488876,-0.783441,0.),\nvec3(0.470016,0.217933,0.),\nvec3(-0.696890,-0.549791,0.),\nvec3(-0.149693,0.605762,0.),\nvec3(0.034211,0.979980,0.),\nvec3(0.503098,-0.308878,0.),\nvec3(-0.016205,-0.872921,0.),\nvec3(0.385784,-0.393902,0.),\nvec3(-0.146886,-0.859249,0.),\nvec3(0.643361,0.164098,0.),\nvec3(0.634388,-0.049471,0.),\nvec3(-0.688894,0.007843,0.),\nvec3(0.464034,-0.188818,0.),\nvec3(-0.440840,0.137486,0.),\nvec3(0.364483,0.511704,0.),\nvec3(0.034028,0.325968,0.),\nvec3(0.099094,-0.308023,0.),\nvec3(0.693960,-0.366253,0.),\nvec3(0.678884,-0.204688,0.),\nvec3(0.001801,0.780328,0.),\nvec3(0.145177,-0.898984,0.),\nvec3(0.062655,-0.611866,0.),\nvec3(0.315226,-0.604297,0.),\nvec3(-0.780145,0.486251,0.),\nvec3(-0.371868,0.882138,0.),\nvec3(0.200476,0.494430,0.),\nvec3(-0.494552,-0.711051,0.),\nvec3(0.612476,0.705252,0.),\nvec3(-0.578845,-0.768792,0.),\nvec3(-0.772454,-0.090976,0.),\nvec3(0.504440,0.372295,0.),\nvec3(0.155736,0.065157,0.),\nvec3(0.391522,0.849605,0.),\nvec3(-0.620106,-0.328104,0.),\nvec3(0.789239,-0.419965,0.),\nvec3(-0.545396,0.538133,0.),\nvec3(-0.178564,-0.596057,0.)\n);\n#define inline\nfloat computeShadowWithCSMPCSS(float layer,vec4 vPositionFromLight,float depthMetric,highp sampler2DArray depthSampler,highp sampler2DArrayShadow shadowSampler,float shadowMapSizeInverse,float lightSizeUV,float darkness,float frustumEdgeFalloff,int searchTapCount,int pcfTapCount,vec3[64] poissonSamplers,vec2 lightSizeUVCorrection,float depthCorrection,float penumbraDarkness)\n{vec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;vec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));uvDepth.z=clamp(ZINCLIP,0.,GREATEST_LESS_THAN_ONE);vec4 uvDepthLayer=vec4(uvDepth.x,uvDepth.y,layer,uvDepth.z);float blockerDepth=0.0;float sumBlockerDepth=0.0;float numBlocker=0.0;for (int i=0; i1.0 || depthMetric<0.0) {return 1.0;}\nelse\n{vec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;vec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));uvDepth.z=ZINCLIP;float blockerDepth=0.0;float sumBlockerDepth=0.0;float numBlocker=0.0;for (int i=0; i=0.) {index{X}=i;break;}}\n#ifdef SHADOWCSMUSESHADOWMAXZ{X}\nif (index{X}>=0)\n#endif\n{\n#if defined(SHADOWPCF{X})\n#if defined(SHADOWLOWQUALITY{X})\nshadow=computeShadowWithCSMPCF1(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#elif defined(SHADOWMEDIUMQUALITY{X})\nshadow=computeShadowWithCSMPCF3(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#else\nshadow=computeShadowWithCSMPCF5(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWPCSS{X})\n#if defined(SHADOWLOWQUALITY{X})\nshadow=computeShadowWithCSMPCSS16(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\n#elif defined(SHADOWMEDIUMQUALITY{X})\nshadow=computeShadowWithCSMPCSS32(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\n#else\nshadow=computeShadowWithCSMPCSS64(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\n#endif\n#else\nshadow=computeShadowCSM(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#ifdef SHADOWCSMDEBUG{X}\nshadowDebug{X}=vec3(shadow)*vCascadeColorsMultiplier{X}[index{X}];\n#endif\n#ifndef SHADOWCSMNOBLEND{X}\nfloat frustumLength=frustumLengths{X}[index{X}];float diffRatio=clamp(diff{X}/frustumLength,0.,1.)*cascadeBlendFactor{X};if (index{X}<(SHADOWCSMNUM_CASCADES{X}-1) && diffRatio<1.)\n{index{X}+=1;float nextShadow=0.;\n#if defined(SHADOWPCF{X})\n#if defined(SHADOWLOWQUALITY{X})\nnextShadow=computeShadowWithCSMPCF1(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#elif defined(SHADOWMEDIUMQUALITY{X})\nnextShadow=computeShadowWithCSMPCF3(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#else\nnextShadow=computeShadowWithCSMPCF5(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWPCSS{X})\n#if defined(SHADOWLOWQUALITY{X})\nnextShadow=computeShadowWithCSMPCSS16(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\n#elif defined(SHADOWMEDIUMQUALITY{X})\nnextShadow=computeShadowWithCSMPCSS32(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\n#else\nnextShadow=computeShadowWithCSMPCSS64(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\n#endif\n#else\nnextShadow=computeShadowCSM(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\nshadow=mix(nextShadow,shadow,diffRatio);\n#ifdef SHADOWCSMDEBUG{X}\nshadowDebug{X}=mix(vec3(nextShadow)*vCascadeColorsMultiplier{X}[index{X}],shadowDebug{X},diffRatio);\n#endif\n}\n#endif\n}\n#elif defined(SHADOWCLOSEESM{X})\n#if defined(SHADOWCUBE{X})\nshadow=computeShadowWithCloseESMCube(light{X}.vLightData.xyz,shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.depthValues);\n#else\nshadow=computeShadowWithCloseESM(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWESM{X})\n#if defined(SHADOWCUBE{X})\nshadow=computeShadowWithESMCube(light{X}.vLightData.xyz,shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.depthValues);\n#else\nshadow=computeShadowWithESM(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWPOISSON{X})\n#if defined(SHADOWCUBE{X})\nshadow=computeShadowWithPoissonSamplingCube(light{X}.vLightData.xyz,shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.x,light{X}.depthValues);\n#else\nshadow=computeShadowWithPoissonSampling(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWPCF{X})\n#if defined(SHADOWLOWQUALITY{X})\nshadow=computeShadowWithPCF1(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#elif defined(SHADOWMEDIUMQUALITY{X})\nshadow=computeShadowWithPCF3(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#else\nshadow=computeShadowWithPCF5(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWPCSS{X})\n#if defined(SHADOWLOWQUALITY{X})\nshadow=computeShadowWithPCSS16(vPositionFromLight{X},vDepthMetric{X},depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#elif defined(SHADOWMEDIUMQUALITY{X})\nshadow=computeShadowWithPCSS32(vPositionFromLight{X},vDepthMetric{X},depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#else\nshadow=computeShadowWithPCSS64(vPositionFromLight{X},vDepthMetric{X},depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#else\n#if defined(SHADOWCUBE{X})\nshadow=computeShadowCube(light{X}.vLightData.xyz,shadowSampler{X},light{X}.shadowsInfo.x,light{X}.depthValues);\n#else\nshadow=computeShadow(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#endif\n#ifdef SHADOWONLY\n#ifndef SHADOWINUSE\n#define SHADOWINUSE\n#endif\nglobalShadow+=shadow;shadowLightCount+=1.0;\n#endif\n#else\nshadow=1.;\n#endif\naggShadow+=shadow;numLights+=1.0;\n#ifndef SHADOWONLY\n#ifdef CUSTOMUSERLIGHTING\ndiffuseBase+=computeCustomDiffuseLighting(info,diffuseBase,shadow);\n#ifdef SPECULARTERM\nspecularBase+=computeCustomSpecularLighting(info,specularBase,shadow);\n#endif\n#elif defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED{X})\ndiffuseBase+=lightmapColor.rgb*shadow;\n#ifdef SPECULARTERM\n#ifndef LIGHTMAPNOSPECULAR{X}\nspecularBase+=info.specular*shadow*lightmapColor.rgb;\n#endif\n#endif\n#ifdef CLEARCOAT\n#ifndef LIGHTMAPNOSPECULAR{X}\nclearCoatBase+=info.clearCoat.rgb*shadow*lightmapColor.rgb;\n#endif\n#endif\n#ifdef SHEEN\n#ifndef LIGHTMAPNOSPECULAR{X}\nsheenBase+=info.sheen.rgb*shadow;\n#endif\n#endif\n#else\n#ifdef SHADOWCSMDEBUG{X}\ndiffuseBase+=info.diffuse*shadowDebug{X};\n#else \ndiffuseBase+=info.diffuse*shadow;\n#endif\n#ifdef SPECULARTERM\nspecularBase+=info.specular*shadow;\n#endif\n#ifdef CLEARCOAT\nclearCoatBase+=info.clearCoat.rgb*shadow;\n#endif\n#ifdef SHEEN\nsheenBase+=info.sheen.rgb*shadow;\n#endif\n#endif\n#endif\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const lightFragment = { name, shader };\n//# sourceMappingURL=lightFragment.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"logDepthFragment\";\nconst shader = `#ifdef LOGARITHMICDEPTH\ngl_FragDepthEXT=log2(vFragmentDepth)*logarithmicDepthConstant*0.5;\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const logDepthFragment = { name, shader };\n//# sourceMappingURL=logDepthFragment.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"fogFragment\";\nconst shader = `#ifdef FOG\nfloat fog=CalcFogFactor();\n#ifdef PBR\nfog=toLinearSpace(fog);\n#endif\ncolor.rgb=mix(vFogColor,color.rgb,fog);\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const fogFragment = { name, shader };\n//# sourceMappingURL=fogFragment.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"oitFragment\";\nconst shader = `#ifdef ORDER_INDEPENDENT_TRANSPARENCY\nfloat fragDepth=gl_FragCoord.z; \n#ifdef ORDER_INDEPENDENT_TRANSPARENCY_16BITS\nuint halfFloat=packHalf2x16(vec2(fragDepth));vec2 full=unpackHalf2x16(halfFloat);fragDepth=full.x;\n#endif\nivec2 fragCoord=ivec2(gl_FragCoord.xy);vec2 lastDepth=texelFetch(oitDepthSampler,fragCoord,0).rg;vec4 lastFrontColor=texelFetch(oitFrontColorSampler,fragCoord,0);depth.rg=vec2(-MAX_DEPTH);frontColor=lastFrontColor;backColor=vec4(0.0);\n#ifdef USE_REVERSE_DEPTHBUFFER\nfloat furthestDepth=-lastDepth.x;float nearestDepth=lastDepth.y;\n#else\nfloat nearestDepth=-lastDepth.x;float furthestDepth=lastDepth.y;\n#endif\nfloat alphaMultiplier=1.0-lastFrontColor.a;\n#ifdef USE_REVERSE_DEPTHBUFFER\nif (fragDepth>nearestDepth || fragDepthfurthestDepth) {\n#endif\nreturn;}\n#ifdef USE_REVERSE_DEPTHBUFFER\nif (fragDepthfurthestDepth) {\n#else\nif (fragDepth>nearestDepth && fragDepth\n#if defined(BUMP) || !defined(NORMAL)\n#extension GL_OES_standard_derivatives : enable\n#endif\n#include[SCENE_MRT_COUNT]\n#include\n#define CUSTOM_FRAGMENT_BEGIN\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n#define RECIPROCAL_PI2 0.15915494\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vec4 vColor;\n#endif\n#include[1..7]\n#include\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include\n#include\n#include(_DEFINENAME_,DIFFUSE,_VARYINGNAME_,Diffuse,_SAMPLERNAME_,diffuse)\n#include(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient,_SAMPLERNAME_,ambient)\n#include(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity,_SAMPLERNAME_,opacity)\n#include(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive,_SAMPLERNAME_,emissive)\n#include(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap,_SAMPLERNAME_,lightmap)\n#include(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal,_SAMPLERNAME_,decal)\n#ifdef REFRACTION\n#ifdef REFRACTIONMAP_3D\nuniform samplerCube refractionCubeSampler;\n#else\nuniform sampler2D refraction2DSampler;\n#endif\n#endif\n#if defined(SPECULARTERM)\n#include(_DEFINENAME_,SPECULAR,_VARYINGNAME_,Specular,_SAMPLERNAME_,specular)\n#endif\n#include\n#ifdef REFLECTION\n#ifdef REFLECTIONMAP_3D\nuniform samplerCube reflectionCubeSampler;\n#else\nuniform sampler2D reflection2DSampler;\n#endif\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#else\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vec3 vDirectionW;\n#endif\n#endif\n#include\n#endif\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);vec4 baseColor=vec4(1.,1.,1.,1.);vec3 diffuseColor=vDiffuseColor.rgb;float alpha=vDiffuseColor.a;\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=normalize(-cross(dFdx(vPositionW),dFdy(vPositionW)));\n#endif\n#include\n#ifdef TWOSIDEDLIGHTING\nnormalW=gl_FrontFacing ? normalW : -normalW;\n#endif\n#ifdef DIFFUSE\nbaseColor=texture2D(diffuseSampler,vDiffuseUV+uvOffset);\n#if defined(ALPHATEST) && !defined(ALPHATEST_AFTERALLALPHACOMPUTATIONS)\nif (baseColor.a(surfaceAlbedo,baseColor,GAMMADECAL,_GAMMADECAL_NOTUSED_)\n#endif\n#include\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nbaseColor.rgb*=vColor.rgb;\n#endif\n#ifdef DETAIL\nbaseColor.rgb=baseColor.rgb*2.0*mix(0.5,detailColor.r,vDetailInfos.y);\n#endif\n#if defined(DECAL) && defined(DECAL_AFTER_DETAIL)\nvec4 decalColor=texture2D(decalSampler,vDecalUV+uvOffset);\n#include(surfaceAlbedo,baseColor,GAMMADECAL,_GAMMADECAL_NOTUSED_)\n#endif\n#define CUSTOM_FRAGMENT_UPDATE_DIFFUSE\nvec3 baseAmbientColor=vec3(1.,1.,1.);\n#ifdef AMBIENT\nbaseAmbientColor=texture2D(ambientSampler,vAmbientUV+uvOffset).rgb*vAmbientInfos.y;\n#endif\n#define CUSTOM_FRAGMENT_BEFORE_LIGHTS\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;vec3 specularColor=vSpecularColor.rgb;\n#ifdef SPECULAR\nvec4 specularMapColor=texture2D(specularSampler,vSpecularUV+uvOffset);specularColor=specularMapColor.rgb;\n#ifdef GLOSSINESS\nglossiness=glossiness*specularMapColor.a;\n#endif\n#endif\n#else\nfloat glossiness=0.;\n#endif\nvec3 diffuseBase=vec3(0.,0.,0.);lightingInfo info;\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif\nfloat shadow=1.;float aggShadow=0.;float numLights=0.;\n#ifdef LIGHTMAP\nvec4 lightmapColor=texture2D(lightmapSampler,vLightmapUV+uvOffset);\n#ifdef RGBDLIGHTMAP\nlightmapColor.rgb=fromRGBD(lightmapColor);\n#endif\nlightmapColor.rgb*=vLightmapInfos.y;\n#endif\n#include[0..maxSimultaneousLights]\naggShadow=aggShadow/numLights;vec4 refractionColor=vec4(0.,0.,0.,1.);\n#ifdef REFRACTION\nvec3 refractionVector=normalize(refract(-viewDirectionW,normalW,vRefractionInfos.y));\n#ifdef REFRACTIONMAP_3D\n#ifdef USE_LOCAL_REFRACTIONMAP_CUBIC\nrefractionVector=parallaxCorrectNormal(vPositionW,refractionVector,vRefractionSize,vRefractionPosition);\n#endif\nrefractionVector.y=refractionVector.y*vRefractionInfos.w;vec4 refractionLookup=textureCube(refractionCubeSampler,refractionVector);if (dot(refractionVector,viewDirectionW)<1.0) {refractionColor=refractionLookup;}\n#else\nvec3 vRefractionUVW=vec3(refractionMatrix*(view*vec4(vPositionW+refractionVector*vRefractionInfos.z,1.0)));vec2 refractionCoords=vRefractionUVW.xy/vRefractionUVW.z;refractionCoords.y=1.0-refractionCoords.y;refractionColor=texture2D(refraction2DSampler,refractionCoords);\n#endif\n#ifdef RGBDREFRACTION\nrefractionColor.rgb=fromRGBD(refractionColor);\n#endif\n#ifdef IS_REFRACTION_LINEAR\nrefractionColor.rgb=toGammaSpace(refractionColor.rgb);\n#endif\nrefractionColor.rgb*=vRefractionInfos.x;\n#endif\nvec4 reflectionColor=vec4(0.,0.,0.,1.);\n#ifdef REFLECTION\nvec3 vReflectionUVW=computeReflectionCoords(vec4(vPositionW,1.0),normalW);\n#ifdef REFLECTIONMAP_OPPOSITEZ\nvReflectionUVW.z*=-1.0;\n#endif\n#ifdef REFLECTIONMAP_3D\n#ifdef ROUGHNESS\nfloat bias=vReflectionInfos.y;\n#ifdef SPECULARTERM\n#ifdef SPECULAR\n#ifdef GLOSSINESS\nbias*=(1.0-specularMapColor.a);\n#endif\n#endif\n#endif\nreflectionColor=textureCube(reflectionCubeSampler,vReflectionUVW,bias);\n#else\nreflectionColor=textureCube(reflectionCubeSampler,vReflectionUVW);\n#endif\n#else\nvec2 coords=vReflectionUVW.xy;\n#ifdef REFLECTIONMAP_PROJECTION\ncoords/=vReflectionUVW.z;\n#endif\ncoords.y=1.0-coords.y;reflectionColor=texture2D(reflection2DSampler,coords);\n#endif\n#ifdef RGBDREFLECTION\nreflectionColor.rgb=fromRGBD(reflectionColor);\n#endif\n#ifdef IS_REFLECTION_LINEAR\nreflectionColor.rgb=toGammaSpace(reflectionColor.rgb);\n#endif\nreflectionColor.rgb*=vReflectionInfos.x;\n#ifdef REFLECTIONFRESNEL\nfloat reflectionFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,reflectionRightColor.a,reflectionLeftColor.a);\n#ifdef REFLECTIONFRESNELFROMSPECULAR\n#ifdef SPECULARTERM\nreflectionColor.rgb*=specularColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;\n#else\nreflectionColor.rgb*=reflectionLeftColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;\n#endif\n#else\nreflectionColor.rgb*=reflectionLeftColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;\n#endif\n#endif\n#endif\n#ifdef REFRACTIONFRESNEL\nfloat refractionFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,refractionRightColor.a,refractionLeftColor.a);refractionColor.rgb*=refractionLeftColor.rgb*(1.0-refractionFresnelTerm)+refractionFresnelTerm*refractionRightColor.rgb;\n#endif\n#ifdef OPACITY\nvec4 opacityMap=texture2D(opacitySampler,vOpacityUV+uvOffset);\n#ifdef OPACITYRGB\nopacityMap.rgb=opacityMap.rgb*vec3(0.3,0.59,0.11);alpha*=(opacityMap.x+opacityMap.y+opacityMap.z)* vOpacityInfos.y;\n#else\nalpha*=opacityMap.a*vOpacityInfos.y;\n#endif\n#endif\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=vColor.a;\n#endif\n#ifdef OPACITYFRESNEL\nfloat opacityFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,opacityParts.z,opacityParts.w);alpha+=opacityParts.x*(1.0-opacityFresnelTerm)+opacityFresnelTerm*opacityParts.y;\n#endif\n#ifdef ALPHATEST\n#ifdef ALPHATEST_AFTERALLALPHACOMPUTATIONS\nif (alpha\n#include\n#ifdef IMAGEPROCESSINGPOSTPROCESS\ncolor.rgb=toLinearSpace(color.rgb);\n#else\n#ifdef IMAGEPROCESSING\ncolor.rgb=toLinearSpace(color.rgb);color=applyImageProcessing(color);\n#endif\n#endif\ncolor.a*=visibility;\n#ifdef PREMULTIPLYALPHA\ncolor.rgb*=color.a;\n#endif\n#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR\n#ifdef PREPASS\nfloat writeGeometryInfo=color.a>0.4 ? 1.0 : 0.0;gl_FragData[0]=color; \n#ifdef PREPASS_POSITION\ngl_FragData[PREPASS_POSITION_INDEX]=vec4(vPositionW,writeGeometryInfo);\n#endif\n#ifdef PREPASS_VELOCITY\nvec2 a=(vCurrentPosition.xy/vCurrentPosition.w)*0.5+0.5;vec2 b=(vPreviousPosition.xy/vPreviousPosition.w)*0.5+0.5;vec2 velocity=abs(a-b);velocity=vec2(pow(velocity.x,1.0/3.0),pow(velocity.y,1.0/3.0))*sign(a-b)*0.5+0.5;gl_FragData[PREPASS_VELOCITY_INDEX]=vec4(velocity,0.0,writeGeometryInfo);\n#endif\n#ifdef PREPASS_IRRADIANCE\ngl_FragData[PREPASS_IRRADIANCE_INDEX]=vec4(0.0,0.0,0.0,writeGeometryInfo); \n#endif\n#ifdef PREPASS_DEPTH\ngl_FragData[PREPASS_DEPTH_INDEX]=vec4(vViewPos.z,0.0,0.0,writeGeometryInfo); \n#endif\n#ifdef PREPASS_NORMAL\n#ifdef PREPASS_NORMAL_WORLDSPACE\ngl_FragData[PREPASS_NORMAL_INDEX]=vec4(normalW,writeGeometryInfo); \n#else\ngl_FragData[PREPASS_NORMAL_INDEX]=vec4(normalize((view*vec4(normalW,0.0)).rgb),writeGeometryInfo); \n#endif\n#endif\n#ifdef PREPASS_ALBEDO_SQRT\ngl_FragData[PREPASS_ALBEDO_SQRT_INDEX]=vec4(0.0,0.0,0.0,writeGeometryInfo); \n#endif\n#ifdef PREPASS_REFLECTIVITY\n#if defined(SPECULARTERM)\n#if defined(SPECULAR)\ngl_FragData[PREPASS_REFLECTIVITY_INDEX]=vec4(toLinearSpace(specularMapColor))*writeGeometryInfo; \n#else\ngl_FragData[PREPASS_REFLECTIVITY_INDEX]=vec4(toLinearSpace(specularColor),1.0)*writeGeometryInfo;\n#endif\n#else\ngl_FragData[PREPASS_REFLECTIVITY_INDEX]=vec4(0.0,0.0,0.0,1.0)*writeGeometryInfo;\n#endif\n#endif\n#endif\n#if !defined(PREPASS) || defined(WEBGL2)\ngl_FragColor=color;\n#endif\n#include\n#if ORDER_INDEPENDENT_TRANSPARENCY\nif (fragDepth==nearestDepth) {frontColor.rgb+=color.rgb*color.a*alphaMultiplier;frontColor.a=1.0-alphaMultiplier*(1.0-color.a);} else {backColor+=color;}\n#endif\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @internal */\nexport const defaultPixelShader = { name, shader };\n//# sourceMappingURL=default.fragment.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"decalVertexDeclaration\";\nconst shader = `#ifdef DECAL\nuniform vec4 vDecalInfos;uniform mat4 decalMatrix;\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const decalVertexDeclaration = { name, shader };\n//# sourceMappingURL=decalVertexDeclaration.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nimport \"./decalVertexDeclaration.js\";\nconst name = \"defaultVertexDeclaration\";\nconst shader = `uniform mat4 viewProjection;uniform mat4 view;\n#ifdef DIFFUSE\nuniform mat4 diffuseMatrix;uniform vec2 vDiffuseInfos;\n#endif\n#ifdef AMBIENT\nuniform mat4 ambientMatrix;uniform vec2 vAmbientInfos;\n#endif\n#ifdef OPACITY\nuniform mat4 opacityMatrix;uniform vec2 vOpacityInfos;\n#endif\n#ifdef EMISSIVE\nuniform vec2 vEmissiveInfos;uniform mat4 emissiveMatrix;\n#endif\n#ifdef LIGHTMAP\nuniform vec2 vLightmapInfos;uniform mat4 lightmapMatrix;\n#endif\n#if defined(SPECULAR) && defined(SPECULARTERM)\nuniform vec2 vSpecularInfos;uniform mat4 specularMatrix;\n#endif\n#ifdef BUMP\nuniform vec3 vBumpInfos;uniform mat4 bumpMatrix;\n#endif\n#ifdef REFLECTION\nuniform mat4 reflectionMatrix;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n#ifdef DETAIL\nuniform vec4 vDetailInfos;uniform mat4 detailMatrix;\n#endif\n#include\n#define ADDITIONAL_VERTEX_DECLARATION\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const defaultVertexDeclaration = { name, shader };\n//# sourceMappingURL=defaultVertexDeclaration.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"uvAttributeDeclaration\";\nconst shader = `#ifdef UV{X}\nattribute vec2 uv{X};\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const uvAttributeDeclaration = { name, shader };\n//# sourceMappingURL=uvAttributeDeclaration.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"prePassVertexDeclaration\";\nconst shader = `#ifdef PREPASS\n#ifdef PREPASS_DEPTH\nvarying vec3 vViewPos;\n#endif\n#ifdef PREPASS_VELOCITY\nuniform mat4 previousViewProjection;varying vec4 vCurrentPosition;varying vec4 vPreviousPosition;\n#endif\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const prePassVertexDeclaration = { name, shader };\n//# sourceMappingURL=prePassVertexDeclaration.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"samplerVertexDeclaration\";\nconst shader = `#if defined(_DEFINENAME_) && _DEFINENAME_DIRECTUV==0\nvarying vec2 v_VARYINGNAME_UV;\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const samplerVertexDeclaration = { name, shader };\n//# sourceMappingURL=samplerVertexDeclaration.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"bumpVertexDeclaration\";\nconst shader = `#if defined(BUMP) || defined(PARALLAX) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC)\n#if defined(TANGENT) && defined(NORMAL) \nvarying mat3 vTBN;\n#endif\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const bumpVertexDeclaration = { name, shader };\n//# sourceMappingURL=bumpVertexDeclaration.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"fogVertexDeclaration\";\nconst shader = `#ifdef FOG\nvarying vec3 vFogDistance;\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const fogVertexDeclaration = { name, shader };\n//# sourceMappingURL=fogVertexDeclaration.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"lightVxFragmentDeclaration\";\nconst shader = `#ifdef LIGHT{X}\nuniform vec4 vLightData{X};uniform vec4 vLightDiffuse{X};\n#ifdef SPECULARTERM\nuniform vec4 vLightSpecular{X};\n#else\nvec4 vLightSpecular{X}=vec4(0.);\n#endif\n#ifdef SHADOW{X}\n#ifdef SHADOWCSM{X}\nuniform mat4 lightMatrix{X}[SHADOWCSMNUM_CASCADES{X}];varying vec4 vPositionFromLight{X}[SHADOWCSMNUM_CASCADES{X}];varying float vDepthMetric{X}[SHADOWCSMNUM_CASCADES{X}];varying vec4 vPositionFromCamera{X};\n#elif defined(SHADOWCUBE{X})\n#else\nvarying vec4 vPositionFromLight{X};varying float vDepthMetric{X};uniform mat4 lightMatrix{X};\n#endif\nuniform vec4 shadowsInfo{X};uniform vec2 depthValues{X};\n#endif\n#ifdef SPOTLIGHT{X}\nuniform vec4 vLightDirection{X};uniform vec4 vLightFalloff{X};\n#elif defined(POINTLIGHT{X})\nuniform vec4 vLightFalloff{X};\n#elif defined(HEMILIGHT{X})\nuniform vec3 vLightGround{X};\n#endif\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const lightVxFragmentDeclaration = { name, shader };\n//# sourceMappingURL=lightVxFragmentDeclaration.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"lightVxUboDeclaration\";\nconst shader = `#ifdef LIGHT{X}\nuniform Light{X}\n{vec4 vLightData;vec4 vLightDiffuse;vec4 vLightSpecular;\n#ifdef SPOTLIGHT{X}\nvec4 vLightDirection;vec4 vLightFalloff;\n#elif defined(POINTLIGHT{X})\nvec4 vLightFalloff;\n#elif defined(HEMILIGHT{X})\nvec3 vLightGround;\n#endif\nvec4 shadowsInfo;vec2 depthValues;} light{X};\n#ifdef SHADOW{X}\n#ifdef SHADOWCSM{X}\nuniform mat4 lightMatrix{X}[SHADOWCSMNUM_CASCADES{X}];varying vec4 vPositionFromLight{X}[SHADOWCSMNUM_CASCADES{X}];varying float vDepthMetric{X}[SHADOWCSMNUM_CASCADES{X}];varying vec4 vPositionFromCamera{X};\n#elif defined(SHADOWCUBE{X})\n#else\nvarying vec4 vPositionFromLight{X};varying float vDepthMetric{X};uniform mat4 lightMatrix{X};\n#endif\n#endif\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const lightVxUboDeclaration = { name, shader };\n//# sourceMappingURL=lightVxUboDeclaration.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"prePassVertex\";\nconst shader = `#ifdef PREPASS_DEPTH\nvViewPos=(view*worldPos).rgb;\n#endif\n#if defined(PREPASS_VELOCITY) && defined(BONES_VELOCITY_ENABLED)\nvCurrentPosition=viewProjection*worldPos;\n#if NUM_BONE_INFLUENCERS>0\nmat4 previousInfluence;previousInfluence=mPreviousBones[int(matricesIndices[0])]*matricesWeights[0];\n#if NUM_BONE_INFLUENCERS>1\npreviousInfluence+=mPreviousBones[int(matricesIndices[1])]*matricesWeights[1];\n#endif \n#if NUM_BONE_INFLUENCERS>2\npreviousInfluence+=mPreviousBones[int(matricesIndices[2])]*matricesWeights[2];\n#endif \n#if NUM_BONE_INFLUENCERS>3\npreviousInfluence+=mPreviousBones[int(matricesIndices[3])]*matricesWeights[3];\n#endif\n#if NUM_BONE_INFLUENCERS>4\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[0])]*matricesWeightsExtra[0];\n#endif \n#if NUM_BONE_INFLUENCERS>5\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[1])]*matricesWeightsExtra[1];\n#endif \n#if NUM_BONE_INFLUENCERS>6\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[2])]*matricesWeightsExtra[2];\n#endif \n#if NUM_BONE_INFLUENCERS>7\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[3])]*matricesWeightsExtra[3];\n#endif\nvPreviousPosition=previousViewProjection*finalPreviousWorld*previousInfluence*vec4(positionUpdated,1.0);\n#else\nvPreviousPosition=previousViewProjection*finalPreviousWorld*vec4(positionUpdated,1.0);\n#endif\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const prePassVertex = { name, shader };\n//# sourceMappingURL=prePassVertex.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"uvVariableDeclaration\";\nconst shader = `#if !defined(UV{X}) && defined(MAINUV{X})\nvec2 uv{X}=vec2(0.,0.);\n#endif\n#ifdef MAINUV{X}\nvMainUV{X}=uv{X};\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const uvVariableDeclaration = { name, shader };\n//# sourceMappingURL=uvVariableDeclaration.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"samplerVertexImplementation\";\nconst shader = `#if defined(_DEFINENAME_) && _DEFINENAME_DIRECTUV==0\nif (v_INFONAME_==0.)\n{v_VARYINGNAME_UV=vec2(_MATRIXNAME_Matrix*vec4(uvUpdated,1.0,0.0));}\n#ifdef UV2\nelse if (v_INFONAME_==1.)\n{v_VARYINGNAME_UV=vec2(_MATRIXNAME_Matrix*vec4(uv2,1.0,0.0));}\n#endif\n#ifdef UV3\nelse if (v_INFONAME_==2.)\n{v_VARYINGNAME_UV=vec2(_MATRIXNAME_Matrix*vec4(uv3,1.0,0.0));}\n#endif\n#ifdef UV4\nelse if (v_INFONAME_==3.)\n{v_VARYINGNAME_UV=vec2(_MATRIXNAME_Matrix*vec4(uv4,1.0,0.0));}\n#endif\n#ifdef UV5\nelse if (v_INFONAME_==4.)\n{v_VARYINGNAME_UV=vec2(_MATRIXNAME_Matrix*vec4(uv5,1.0,0.0));}\n#endif\n#ifdef UV6\nelse if (v_INFONAME_==5.)\n{v_VARYINGNAME_UV=vec2(_MATRIXNAME_Matrix*vec4(uv6,1.0,0.0));}\n#endif\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const samplerVertexImplementation = { name, shader };\n//# sourceMappingURL=samplerVertexImplementation.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"fogVertex\";\nconst shader = `#ifdef FOG\nvFogDistance=(view*worldPos).xyz;\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const fogVertex = { name, shader };\n//# sourceMappingURL=fogVertex.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"shadowsVertex\";\nconst shader = `#ifdef SHADOWS\n#if defined(SHADOWCSM{X})\nvPositionFromCamera{X}=view*worldPos;for (int i=0; i\n#define CUSTOM_VERTEX_BEGIN\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef TANGENT\nattribute vec4 tangent;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#include[2..7]\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include\n#include\n#include\n#include\n#include\n#include[1..7]\n#include(_DEFINENAME_,DIFFUSE,_VARYINGNAME_,Diffuse)\n#include(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail)\n#include(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient)\n#include(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity)\n#include(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive)\n#include(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap)\n#if defined(SPECULARTERM)\n#include(_DEFINENAME_,SPECULAR,_VARYINGNAME_,Specular)\n#endif\n#include(_DEFINENAME_,BUMP,_VARYINGNAME_,Bump)\n#include(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal)\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vec4 vColor;\n#endif\n#include\n#include\n#include\n#include<__decl__lightVxFragment>[0..maxSimultaneousLights]\n#include\n#include[0..maxSimultaneousMorphTargets]\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#endif\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vec3 vDirectionW;\n#endif\n#include\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvec3 positionUpdated=position;\n#ifdef NORMAL\nvec3 normalUpdated=normal;\n#endif\n#ifdef TANGENT\nvec4 tangentUpdated=tangent;\n#endif\n#ifdef UV1\nvec2 uvUpdated=uv;\n#endif\n#include\n#include[0..maxSimultaneousMorphTargets]\n#ifdef REFLECTIONMAP_SKYBOX\nvPositionUVW=positionUpdated;\n#endif\n#define CUSTOM_VERTEX_UPDATE_POSITION\n#define CUSTOM_VERTEX_UPDATE_NORMAL\n#include\n#if defined(PREPASS) && defined(PREPASS_VELOCITY) && !defined(BONES_VELOCITY_ENABLED)\nvCurrentPosition=viewProjection*finalWorld*vec4(positionUpdated,1.0);vPreviousPosition=previousViewProjection*finalPreviousWorld*vec4(positionUpdated,1.0);\n#endif\n#include\n#include\nvec4 worldPos=finalWorld*vec4(positionUpdated,1.0);\n#ifdef NORMAL\nmat3 normalWorld=mat3(finalWorld);\n#if defined(INSTANCES) && defined(THIN_INSTANCES)\nvNormalW=normalUpdated/vec3(dot(normalWorld[0],normalWorld[0]),dot(normalWorld[1],normalWorld[1]),dot(normalWorld[2],normalWorld[2]));vNormalW=normalize(normalWorld*vNormalW);\n#else\n#ifdef NONUNIFORMSCALING\nnormalWorld=transposeMat3(inverseMat3(normalWorld));\n#endif\nvNormalW=normalize(normalWorld*normalUpdated);\n#endif\n#endif\n#define CUSTOM_VERTEX_UPDATE_WORLDPOS\n#ifdef MULTIVIEW\nif (gl_ViewID_OVR==0u) {gl_Position=viewProjection*worldPos;} else {gl_Position=viewProjectionR*worldPos;}\n#else\ngl_Position=viewProjection*worldPos;\n#endif\nvPositionW=vec3(worldPos);\n#include\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvDirectionW=normalize(vec3(finalWorld*vec4(positionUpdated,0.0)));\n#endif\n#ifndef UV1\nvec2 uvUpdated=vec2(0.,0.);\n#endif\n#ifdef MAINUV1\nvMainUV1=uvUpdated;\n#endif\n#include[2..7]\n#include(_DEFINENAME_,DIFFUSE,_VARYINGNAME_,Diffuse,_MATRIXNAME_,diffuse,_INFONAME_,DiffuseInfos.x)\n#include(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail,_MATRIXNAME_,detail,_INFONAME_,DetailInfos.x)\n#include(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient,_MATRIXNAME_,ambient,_INFONAME_,AmbientInfos.x)\n#include(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity,_MATRIXNAME_,opacity,_INFONAME_,OpacityInfos.x)\n#include(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive,_MATRIXNAME_,emissive,_INFONAME_,EmissiveInfos.x)\n#include(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap,_MATRIXNAME_,lightmap,_INFONAME_,LightmapInfos.x)\n#if defined(SPECULARTERM)\n#include(_DEFINENAME_,SPECULAR,_VARYINGNAME_,Specular,_MATRIXNAME_,specular,_INFONAME_,SpecularInfos.x)\n#endif\n#include(_DEFINENAME_,BUMP,_VARYINGNAME_,Bump,_MATRIXNAME_,bump,_INFONAME_,BumpInfos.x)\n#include(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal,_MATRIXNAME_,decal,_INFONAME_,DecalInfos.x)\n#include\n#include\n#include\n#include[0..maxSimultaneousLights]\n#include\n#include\n#include\n#define CUSTOM_VERTEX_MAIN_END\n}\n`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @internal */\nexport const defaultVertexShader = { name, shader };\n//# sourceMappingURL=default.vertex.js.map","import { Material } from \"./material.js\";\nimport { MaterialPluginEvent } from \"./materialPluginEvent.js\";\nimport { EngineStore } from \"../Engines/engineStore.js\";\nimport { ShaderProcessor } from \"../Engines/Processors/shaderProcessor.js\";\nimport { ShaderLanguage } from \"./shaderLanguage.js\";\nimport { ShaderStore } from \"../Engines/shaderStore.js\";\nconst rxOption = new RegExp(\"^([gimus]+)!\");\n/**\n * Class that manages the plugins of a material\n * @since 5.0\n */\nexport class MaterialPluginManager {\n /**\n * Creates a new instance of the plugin manager\n * @param material material that this manager will manage the plugins for\n */\n constructor(material) {\n /** @internal */\n this._plugins = [];\n this._activePlugins = [];\n this._activePluginsForExtraEvents = [];\n this._material = material;\n this._scene = material.getScene();\n this._engine = this._scene.getEngine();\n }\n /**\n * @internal\n */\n _addPlugin(plugin) {\n for (let i = 0; i < this._plugins.length; ++i) {\n if (this._plugins[i].name === plugin.name) {\n return false;\n }\n }\n if (this._material._uniformBufferLayoutBuilt) {\n throw `The plugin \"${plugin.name}\" can't be added to the material \"${this._material.name}\" because this material has already been used for rendering! Please add plugins to materials before any rendering with this material occurs.`;\n }\n const pluginClassName = plugin.getClassName();\n if (!MaterialPluginManager._MaterialPluginClassToMainDefine[pluginClassName]) {\n MaterialPluginManager._MaterialPluginClassToMainDefine[pluginClassName] = \"MATERIALPLUGIN_\" + ++MaterialPluginManager._MaterialPluginCounter;\n }\n this._material._callbackPluginEventGeneric = this._handlePluginEvent.bind(this);\n this._plugins.push(plugin);\n this._plugins.sort((a, b) => a.priority - b.priority);\n this._codeInjectionPoints = {};\n const defineNamesFromPlugins = {};\n defineNamesFromPlugins[MaterialPluginManager._MaterialPluginClassToMainDefine[pluginClassName]] = {\n type: \"boolean\",\n default: true,\n };\n for (const plugin of this._plugins) {\n plugin.collectDefines(defineNamesFromPlugins);\n this._collectPointNames(\"vertex\", plugin.getCustomCode(\"vertex\"));\n this._collectPointNames(\"fragment\", plugin.getCustomCode(\"fragment\"));\n }\n this._defineNamesFromPlugins = defineNamesFromPlugins;\n return true;\n }\n /**\n * @internal\n */\n _activatePlugin(plugin) {\n if (this._activePlugins.indexOf(plugin) === -1) {\n this._activePlugins.push(plugin);\n this._activePlugins.sort((a, b) => a.priority - b.priority);\n this._material._callbackPluginEventIsReadyForSubMesh = this._handlePluginEventIsReadyForSubMesh.bind(this);\n this._material._callbackPluginEventPrepareDefinesBeforeAttributes = this._handlePluginEventPrepareDefinesBeforeAttributes.bind(this);\n this._material._callbackPluginEventPrepareDefines = this._handlePluginEventPrepareDefines.bind(this);\n this._material._callbackPluginEventBindForSubMesh = this._handlePluginEventBindForSubMesh.bind(this);\n if (plugin.registerForExtraEvents) {\n this._activePluginsForExtraEvents.push(plugin);\n this._activePluginsForExtraEvents.sort((a, b) => a.priority - b.priority);\n this._material._callbackPluginEventHasRenderTargetTextures = this._handlePluginEventHasRenderTargetTextures.bind(this);\n this._material._callbackPluginEventFillRenderTargetTextures = this._handlePluginEventFillRenderTargetTextures.bind(this);\n this._material._callbackPluginEventHardBindForSubMesh = this._handlePluginEventHardBindForSubMesh.bind(this);\n }\n }\n }\n /**\n * Gets a plugin from the list of plugins managed by this manager\n * @param name name of the plugin\n * @returns the plugin if found, else null\n */\n getPlugin(name) {\n for (let i = 0; i < this._plugins.length; ++i) {\n if (this._plugins[i].name === name) {\n return this._plugins[i];\n }\n }\n return null;\n }\n _handlePluginEventIsReadyForSubMesh(eventData) {\n let isReady = true;\n for (const plugin of this._activePlugins) {\n isReady = isReady && plugin.isReadyForSubMesh(eventData.defines, this._scene, this._engine, eventData.subMesh);\n }\n eventData.isReadyForSubMesh = isReady;\n }\n _handlePluginEventPrepareDefinesBeforeAttributes(eventData) {\n for (const plugin of this._activePlugins) {\n plugin.prepareDefinesBeforeAttributes(eventData.defines, this._scene, eventData.mesh);\n }\n }\n _handlePluginEventPrepareDefines(eventData) {\n for (const plugin of this._activePlugins) {\n plugin.prepareDefines(eventData.defines, this._scene, eventData.mesh);\n }\n }\n _handlePluginEventHardBindForSubMesh(eventData) {\n for (const plugin of this._activePluginsForExtraEvents) {\n plugin.hardBindForSubMesh(this._material._uniformBuffer, this._scene, this._engine, eventData.subMesh);\n }\n }\n _handlePluginEventBindForSubMesh(eventData) {\n for (const plugin of this._activePlugins) {\n plugin.bindForSubMesh(this._material._uniformBuffer, this._scene, this._engine, eventData.subMesh);\n }\n }\n _handlePluginEventHasRenderTargetTextures(eventData) {\n let hasRenderTargetTextures = false;\n for (const plugin of this._activePluginsForExtraEvents) {\n hasRenderTargetTextures = plugin.hasRenderTargetTextures();\n if (hasRenderTargetTextures) {\n break;\n }\n }\n eventData.hasRenderTargetTextures = hasRenderTargetTextures;\n }\n _handlePluginEventFillRenderTargetTextures(eventData) {\n for (const plugin of this._activePluginsForExtraEvents) {\n plugin.fillRenderTargetTextures(eventData.renderTargets);\n }\n }\n _handlePluginEvent(id, info) {\n var _a;\n switch (id) {\n case MaterialPluginEvent.GetActiveTextures: {\n const eventData = info;\n for (const plugin of this._activePlugins) {\n plugin.getActiveTextures(eventData.activeTextures);\n }\n break;\n }\n case MaterialPluginEvent.GetAnimatables: {\n const eventData = info;\n for (const plugin of this._activePlugins) {\n plugin.getAnimatables(eventData.animatables);\n }\n break;\n }\n case MaterialPluginEvent.HasTexture: {\n const eventData = info;\n let hasTexture = false;\n for (const plugin of this._activePlugins) {\n hasTexture = plugin.hasTexture(eventData.texture);\n if (hasTexture) {\n break;\n }\n }\n eventData.hasTexture = hasTexture;\n break;\n }\n case MaterialPluginEvent.Disposed: {\n const eventData = info;\n for (const plugin of this._plugins) {\n plugin.dispose(eventData.forceDisposeTextures);\n }\n break;\n }\n case MaterialPluginEvent.GetDefineNames: {\n const eventData = info;\n eventData.defineNames = this._defineNamesFromPlugins;\n break;\n }\n case MaterialPluginEvent.PrepareEffect: {\n const eventData = info;\n for (const plugin of this._activePlugins) {\n eventData.fallbackRank = plugin.addFallbacks(eventData.defines, eventData.fallbacks, eventData.fallbackRank);\n plugin.getAttributes(eventData.attributes, this._scene, eventData.mesh);\n }\n if (this._uniformList.length > 0) {\n eventData.uniforms.push(...this._uniformList);\n }\n if (this._samplerList.length > 0) {\n eventData.samplers.push(...this._samplerList);\n }\n if (this._uboList.length > 0) {\n eventData.uniformBuffersNames.push(...this._uboList);\n }\n eventData.customCode = this._injectCustomCode(eventData, eventData.customCode);\n break;\n }\n case MaterialPluginEvent.PrepareUniformBuffer: {\n const eventData = info;\n this._uboDeclaration = \"\";\n this._vertexDeclaration = \"\";\n this._fragmentDeclaration = \"\";\n this._uniformList = [];\n this._samplerList = [];\n this._uboList = [];\n for (const plugin of this._plugins) {\n const uniforms = plugin.getUniforms();\n if (uniforms) {\n if (uniforms.ubo) {\n for (const uniform of uniforms.ubo) {\n if (uniform.size && uniform.type) {\n const arraySize = (_a = uniform.arraySize) !== null && _a !== void 0 ? _a : 0;\n eventData.ubo.addUniform(uniform.name, uniform.size, arraySize);\n this._uboDeclaration += `${uniform.type} ${uniform.name}${arraySize > 0 ? `[${arraySize}]` : \"\"};\\n`;\n }\n this._uniformList.push(uniform.name);\n }\n }\n if (uniforms.vertex) {\n this._vertexDeclaration += uniforms.vertex + \"\\n\";\n }\n if (uniforms.fragment) {\n this._fragmentDeclaration += uniforms.fragment + \"\\n\";\n }\n }\n plugin.getSamplers(this._samplerList);\n plugin.getUniformBuffersNames(this._uboList);\n }\n break;\n }\n }\n }\n _collectPointNames(shaderType, customCode) {\n if (!customCode) {\n return;\n }\n for (const pointName in customCode) {\n if (!this._codeInjectionPoints[shaderType]) {\n this._codeInjectionPoints[shaderType] = {};\n }\n this._codeInjectionPoints[shaderType][pointName] = true;\n }\n }\n _injectCustomCode(eventData, existingCallback) {\n return (shaderType, code) => {\n var _a, _b;\n if (existingCallback) {\n code = existingCallback(shaderType, code);\n }\n if (this._uboDeclaration) {\n code = code.replace(\"#define ADDITIONAL_UBO_DECLARATION\", this._uboDeclaration);\n }\n if (this._vertexDeclaration) {\n code = code.replace(\"#define ADDITIONAL_VERTEX_DECLARATION\", this._vertexDeclaration);\n }\n if (this._fragmentDeclaration) {\n code = code.replace(\"#define ADDITIONAL_FRAGMENT_DECLARATION\", this._fragmentDeclaration);\n }\n const points = (_a = this._codeInjectionPoints) === null || _a === void 0 ? void 0 : _a[shaderType];\n if (!points) {\n return code;\n }\n let processorOptions = null;\n for (let pointName in points) {\n let injectedCode = \"\";\n for (const plugin of this._activePlugins) {\n let customCode = (_b = plugin.getCustomCode(shaderType)) === null || _b === void 0 ? void 0 : _b[pointName];\n if (!customCode) {\n continue;\n }\n if (plugin.resolveIncludes) {\n if (processorOptions === null) {\n const shaderLanguage = ShaderLanguage.GLSL;\n processorOptions = {\n defines: [],\n indexParameters: eventData.indexParameters,\n isFragment: false,\n shouldUseHighPrecisionShader: this._engine._shouldUseHighPrecisionShader,\n processor: undefined,\n supportsUniformBuffers: this._engine.supportsUniformBuffers,\n shadersRepository: ShaderStore.GetShadersRepository(shaderLanguage),\n includesShadersStore: ShaderStore.GetIncludesShadersStore(shaderLanguage),\n version: undefined,\n platformName: this._engine.shaderPlatformName,\n processingContext: undefined,\n isNDCHalfZRange: this._engine.isNDCHalfZRange,\n useReverseDepthBuffer: this._engine.useReverseDepthBuffer,\n processCodeAfterIncludes: undefined, // not used by _ProcessIncludes\n };\n }\n processorOptions.isFragment = shaderType === \"fragment\";\n ShaderProcessor._ProcessIncludes(customCode, processorOptions, (code) => (customCode = code));\n }\n injectedCode += customCode + \"\\n\";\n }\n if (injectedCode.length > 0) {\n if (pointName.charAt(0) === \"!\") {\n // pointName is a regular expression\n pointName = pointName.substring(1);\n let regexFlags = \"g\";\n if (pointName.charAt(0) === \"!\") {\n // no flags\n regexFlags = \"\";\n pointName = pointName.substring(1);\n }\n else {\n // get the flag(s)\n const matchOption = rxOption.exec(pointName);\n if (matchOption && matchOption.length >= 2) {\n regexFlags = matchOption[1];\n pointName = pointName.substring(regexFlags.length + 1);\n }\n }\n if (regexFlags.indexOf(\"g\") < 0) {\n // we force the \"g\" flag so that the regexp object is stateful!\n regexFlags += \"g\";\n }\n const sourceCode = code;\n const rx = new RegExp(pointName, regexFlags);\n let match = rx.exec(sourceCode);\n while (match !== null) {\n let newCode = injectedCode;\n for (let i = 0; i < match.length; ++i) {\n newCode = newCode.replace(\"$\" + i, match[i]);\n }\n code = code.replace(match[0], newCode);\n match = rx.exec(sourceCode);\n }\n }\n else {\n const fullPointName = \"#define \" + pointName;\n code = code.replace(fullPointName, \"\\n\" + injectedCode + \"\\n\" + fullPointName);\n }\n }\n }\n return code;\n };\n }\n}\n/** Map a plugin class name to a #define name (used in the vertex/fragment shaders as a marker of the plugin usage) */\nMaterialPluginManager._MaterialPluginClassToMainDefine = {};\nMaterialPluginManager._MaterialPluginCounter = 0;\n(() => {\n EngineStore.OnEnginesDisposedObservable.add(() => {\n UnregisterAllMaterialPlugins();\n });\n})();\nconst plugins = [];\nlet inited = false;\nlet observer = null;\n/**\n * Registers a new material plugin through a factory, or updates it. This makes the plugin available to all materials instantiated after its registration.\n * @param pluginName The plugin name\n * @param factory The factory function which allows to create the plugin\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function RegisterMaterialPlugin(pluginName, factory) {\n if (!inited) {\n observer = Material.OnEventObservable.add((material) => {\n for (const [, factory] of plugins) {\n factory(material);\n }\n }, MaterialPluginEvent.Created);\n inited = true;\n }\n const existing = plugins.filter(([name, _factory]) => name === pluginName);\n if (existing.length > 0) {\n existing[0][1] = factory;\n }\n else {\n plugins.push([pluginName, factory]);\n }\n}\n/**\n * Removes a material plugin from the list of global plugins.\n * @param pluginName The plugin name\n * @returns true if the plugin has been removed, else false\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function UnregisterMaterialPlugin(pluginName) {\n for (let i = 0; i < plugins.length; ++i) {\n if (plugins[i][0] === pluginName) {\n plugins.splice(i, 1);\n if (plugins.length === 0) {\n UnregisterAllMaterialPlugins();\n }\n return true;\n }\n }\n return false;\n}\n/**\n * Clear the list of global material plugins\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function UnregisterAllMaterialPlugins() {\n plugins.length = 0;\n inited = false;\n Material.OnEventObservable.remove(observer);\n observer = null;\n}\n//# sourceMappingURL=materialPluginManager.js.map","import { __decorate } from \"../tslib.es6.js\";\nimport { SerializationHelper, serialize } from \"../Misc/decorators.js\";\nimport { MaterialPluginManager } from \"./materialPluginManager.js\";\n\n/**\n * Base class for material plugins.\n * @since 5.0\n */\nexport class MaterialPluginBase {\n _enable(enable) {\n if (enable) {\n this._pluginManager._activatePlugin(this);\n }\n }\n /**\n * Creates a new material plugin\n * @param material parent material of the plugin\n * @param name name of the plugin\n * @param priority priority of the plugin\n * @param defines list of defines used by the plugin. The value of the property is the default value for this property\n * @param addToPluginList true to add the plugin to the list of plugins managed by the material plugin manager of the material (default: true)\n * @param enable true to enable the plugin (it is handy if the plugin does not handle properties to switch its current activation)\n * @param resolveIncludes Indicates that any #include directive in the plugin code must be replaced by the corresponding code (default: false)\n */\n constructor(material, name, priority, defines, addToPluginList = true, enable = false, resolveIncludes = false) {\n /**\n * Defines the priority of the plugin. Lower numbers run first.\n */\n this.priority = 500;\n /**\n * Indicates that any #include directive in the plugin code must be replaced by the corresponding code.\n */\n this.resolveIncludes = false;\n /**\n * Indicates that this plugin should be notified for the extra events (HasRenderTargetTextures / FillRenderTargetTextures / HardBindForSubMesh)\n */\n this.registerForExtraEvents = false;\n this._material = material;\n this.name = name;\n this.priority = priority;\n this.resolveIncludes = resolveIncludes;\n if (!material.pluginManager) {\n material.pluginManager = new MaterialPluginManager(material);\n material.onDisposeObservable.add(() => {\n material.pluginManager = undefined;\n });\n }\n this._pluginDefineNames = defines;\n this._pluginManager = material.pluginManager;\n if (addToPluginList) {\n this._pluginManager._addPlugin(this);\n }\n if (enable) {\n this._enable(true);\n }\n this.markAllDefinesAsDirty = material._dirtyCallbacks[63];\n }\n /**\n * Gets the current class name useful for serialization or dynamic coding.\n * @returns The class name.\n */\n getClassName() {\n return \"MaterialPluginBase\";\n }\n /**\n * Specifies that the submesh is ready to be used.\n * @param defines the list of \"defines\" to update.\n * @param scene defines the scene the material belongs to.\n * @param engine the engine this scene belongs to.\n * @param subMesh the submesh to check for readiness\n * @returns - boolean indicating that the submesh is ready or not.\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n isReadyForSubMesh(defines, scene, engine, subMesh) {\n return true;\n }\n /**\n * Binds the material data (this function is called even if mustRebind() returns false)\n * @param uniformBuffer defines the Uniform buffer to fill in.\n * @param scene defines the scene the material belongs to.\n * @param engine defines the engine the material belongs to.\n * @param subMesh the submesh to bind data for\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n hardBindForSubMesh(uniformBuffer, scene, engine, subMesh) { }\n /**\n * Binds the material data.\n * @param uniformBuffer defines the Uniform buffer to fill in.\n * @param scene defines the scene the material belongs to.\n * @param engine the engine this scene belongs to.\n * @param subMesh the submesh to bind data for\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n bindForSubMesh(uniformBuffer, scene, engine, subMesh) { }\n /**\n * Disposes the resources of the material.\n * @param forceDisposeTextures - Forces the disposal of all textures.\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n dispose(forceDisposeTextures) { }\n /**\n * Returns a list of custom shader code fragments to customize the shader.\n * @param shaderType \"vertex\" or \"fragment\"\n * @returns null if no code to be added, or a list of pointName =\\> code.\n * Note that `pointName` can also be a regular expression if it starts with a `!`.\n * In that case, the string found by the regular expression (if any) will be\n * replaced by the code provided.\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n getCustomCode(shaderType) {\n return null;\n }\n /**\n * Collects all defines.\n * @param defines The object to append to.\n */\n collectDefines(defines) {\n if (!this._pluginDefineNames) {\n return;\n }\n for (const key of Object.keys(this._pluginDefineNames)) {\n if (key[0] === \"_\") {\n continue;\n }\n const type = typeof this._pluginDefineNames[key];\n defines[key] = {\n type: type === \"number\" ? \"number\" : type === \"string\" ? \"string\" : type === \"boolean\" ? \"boolean\" : \"object\",\n default: this._pluginDefineNames[key],\n };\n }\n }\n /**\n * Sets the defines for the next rendering. Called before MaterialHelper.PrepareDefinesForAttributes is called.\n * @param defines the list of \"defines\" to update.\n * @param scene defines the scene to the material belongs to.\n * @param mesh the mesh being rendered\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n prepareDefinesBeforeAttributes(defines, scene, mesh) { }\n /**\n * Sets the defines for the next rendering\n * @param defines the list of \"defines\" to update.\n * @param scene defines the scene to the material belongs to.\n * @param mesh the mesh being rendered\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n prepareDefines(defines, scene, mesh) { }\n /**\n * Checks to see if a texture is used in the material.\n * @param texture - Base texture to use.\n * @returns - Boolean specifying if a texture is used in the material.\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n hasTexture(texture) {\n return false;\n }\n /**\n * Gets a boolean indicating that current material needs to register RTT\n * @returns true if this uses a render target otherwise false.\n */\n hasRenderTargetTextures() {\n return false;\n }\n /**\n * Fills the list of render target textures.\n * @param renderTargets the list of render targets to update\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n fillRenderTargetTextures(renderTargets) { }\n /**\n * Returns an array of the actively used textures.\n * @param activeTextures Array of BaseTextures\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n getActiveTextures(activeTextures) { }\n /**\n * Returns the animatable textures.\n * @param animatables Array of animatable textures.\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n getAnimatables(animatables) { }\n /**\n * Add fallbacks to the effect fallbacks list.\n * @param defines defines the Base texture to use.\n * @param fallbacks defines the current fallback list.\n * @param currentRank defines the current fallback rank.\n * @returns the new fallback rank.\n */\n addFallbacks(defines, fallbacks, currentRank) {\n return currentRank;\n }\n /**\n * Gets the samplers used by the plugin.\n * @param samplers list that the sampler names should be added to.\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n getSamplers(samplers) { }\n /**\n * Gets the attributes used by the plugin.\n * @param attributes list that the attribute names should be added to.\n * @param scene the scene that the material belongs to.\n * @param mesh the mesh being rendered.\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n getAttributes(attributes, scene, mesh) { }\n /**\n * Gets the uniform buffers names added by the plugin.\n * @param ubos list that the ubo names should be added to.\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n getUniformBuffersNames(ubos) { }\n /**\n * Gets the description of the uniforms to add to the ubo (if engine supports ubos) or to inject directly in the vertex/fragment shaders (if engine does not support ubos)\n * @returns the description of the uniforms\n */\n getUniforms() {\n return {};\n }\n /**\n * Makes a duplicate of the current configuration into another one.\n * @param plugin define the config where to copy the info\n */\n copyTo(plugin) {\n SerializationHelper.Clone(() => plugin, this);\n }\n /**\n * Serializes this plugin configuration.\n * @returns - An object with the serialized config.\n */\n serialize() {\n return SerializationHelper.Serialize(this);\n }\n /**\n * Parses a plugin configuration from a serialized object.\n * @param source - Serialized object.\n * @param scene Defines the scene we are parsing for\n * @param rootUrl Defines the rootUrl to load from\n */\n parse(source, scene, rootUrl) {\n SerializationHelper.Parse(() => this, source, scene, rootUrl);\n }\n}\n__decorate([\n serialize()\n], MaterialPluginBase.prototype, \"name\", void 0);\n__decorate([\n serialize()\n], MaterialPluginBase.prototype, \"priority\", void 0);\n__decorate([\n serialize()\n], MaterialPluginBase.prototype, \"resolveIncludes\", void 0);\n__decorate([\n serialize()\n], MaterialPluginBase.prototype, \"registerForExtraEvents\", void 0);\n//# sourceMappingURL=materialPluginBase.js.map","import { __decorate } from \"../tslib.es6.js\";\nimport { Material } from \"./material.js\";\nimport { serialize, expandToProperty, serializeAsTexture } from \"../Misc/decorators.js\";\nimport { MaterialFlags } from \"./materialFlags.js\";\nimport { MaterialHelper } from \"./materialHelper.js\";\nimport { MaterialDefines } from \"./materialDefines.js\";\nimport { MaterialPluginBase } from \"./materialPluginBase.js\";\n\n/**\n * @internal\n */\nexport class MaterialDetailMapDefines extends MaterialDefines {\n constructor() {\n super(...arguments);\n this.DETAIL = false;\n this.DETAILDIRECTUV = 0;\n this.DETAIL_NORMALBLENDMETHOD = 0;\n }\n}\n/**\n * Plugin that implements the detail map component of a material\n *\n * Inspired from:\n * Unity: https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@9.0/manual/Mask-Map-and-Detail-Map.html and https://docs.unity3d.com/Manual/StandardShaderMaterialParameterDetail.html\n * Unreal: https://docs.unrealengine.com/en-US/Engine/Rendering/Materials/HowTo/DetailTexturing/index.html\n * Cryengine: https://docs.cryengine.com/display/SDKDOC2/Detail+Maps\n */\nexport class DetailMapConfiguration extends MaterialPluginBase {\n /** @internal */\n _markAllSubMeshesAsTexturesDirty() {\n this._enable(this._isEnabled);\n this._internalMarkAllSubMeshesAsTexturesDirty();\n }\n constructor(material, addToPluginList = true) {\n super(material, \"DetailMap\", 140, new MaterialDetailMapDefines(), addToPluginList);\n this._texture = null;\n /**\n * Defines how strongly the detail diffuse/albedo channel is blended with the regular diffuse/albedo texture\n * Bigger values mean stronger blending\n */\n this.diffuseBlendLevel = 1;\n /**\n * Defines how strongly the detail roughness channel is blended with the regular roughness value\n * Bigger values mean stronger blending. Only used with PBR materials\n */\n this.roughnessBlendLevel = 1;\n /**\n * Defines how strong the bump effect from the detail map is\n * Bigger values mean stronger effect\n */\n this.bumpLevel = 1;\n this._normalBlendMethod = Material.MATERIAL_NORMALBLENDMETHOD_WHITEOUT;\n this._isEnabled = false;\n /**\n * Enable or disable the detail map on this material\n */\n this.isEnabled = false;\n this._internalMarkAllSubMeshesAsTexturesDirty = material._dirtyCallbacks[1];\n }\n isReadyForSubMesh(defines, scene, engine) {\n if (!this._isEnabled) {\n return true;\n }\n if (defines._areTexturesDirty && scene.texturesEnabled) {\n if (engine.getCaps().standardDerivatives && this._texture && MaterialFlags.DetailTextureEnabled) {\n // Detail texture cannot be not blocking.\n if (!this._texture.isReady()) {\n return false;\n }\n }\n }\n return true;\n }\n prepareDefines(defines, scene) {\n if (this._isEnabled) {\n defines.DETAIL_NORMALBLENDMETHOD = this._normalBlendMethod;\n const engine = scene.getEngine();\n if (defines._areTexturesDirty) {\n if (engine.getCaps().standardDerivatives && this._texture && MaterialFlags.DetailTextureEnabled && this._isEnabled) {\n MaterialHelper.PrepareDefinesForMergedUV(this._texture, defines, \"DETAIL\");\n defines.DETAIL_NORMALBLENDMETHOD = this._normalBlendMethod;\n }\n else {\n defines.DETAIL = false;\n }\n }\n }\n else {\n defines.DETAIL = false;\n }\n }\n bindForSubMesh(uniformBuffer, scene) {\n if (!this._isEnabled) {\n return;\n }\n const isFrozen = this._material.isFrozen;\n if (!uniformBuffer.useUbo || !isFrozen || !uniformBuffer.isSync) {\n if (this._texture && MaterialFlags.DetailTextureEnabled) {\n uniformBuffer.updateFloat4(\"vDetailInfos\", this._texture.coordinatesIndex, this.diffuseBlendLevel, this.bumpLevel, this.roughnessBlendLevel);\n MaterialHelper.BindTextureMatrix(this._texture, uniformBuffer, \"detail\");\n }\n }\n // Textures\n if (scene.texturesEnabled) {\n if (this._texture && MaterialFlags.DetailTextureEnabled) {\n uniformBuffer.setTexture(\"detailSampler\", this._texture);\n }\n }\n }\n hasTexture(texture) {\n if (this._texture === texture) {\n return true;\n }\n return false;\n }\n getActiveTextures(activeTextures) {\n if (this._texture) {\n activeTextures.push(this._texture);\n }\n }\n getAnimatables(animatables) {\n if (this._texture && this._texture.animations && this._texture.animations.length > 0) {\n animatables.push(this._texture);\n }\n }\n dispose(forceDisposeTextures) {\n var _a;\n if (forceDisposeTextures) {\n (_a = this._texture) === null || _a === void 0 ? void 0 : _a.dispose();\n }\n }\n getClassName() {\n return \"DetailMapConfiguration\";\n }\n getSamplers(samplers) {\n samplers.push(\"detailSampler\");\n }\n getUniforms() {\n return {\n ubo: [\n { name: \"vDetailInfos\", size: 4, type: \"vec4\" },\n { name: \"detailMatrix\", size: 16, type: \"mat4\" },\n ],\n };\n }\n}\n__decorate([\n serializeAsTexture(\"detailTexture\"),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], DetailMapConfiguration.prototype, \"texture\", void 0);\n__decorate([\n serialize()\n], DetailMapConfiguration.prototype, \"diffuseBlendLevel\", void 0);\n__decorate([\n serialize()\n], DetailMapConfiguration.prototype, \"roughnessBlendLevel\", void 0);\n__decorate([\n serialize()\n], DetailMapConfiguration.prototype, \"bumpLevel\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], DetailMapConfiguration.prototype, \"normalBlendMethod\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], DetailMapConfiguration.prototype, \"isEnabled\", void 0);\n//# sourceMappingURL=material.detailMapConfiguration.js.map","import { __decorate } from \"../tslib.es6.js\";\n/* eslint-disable @typescript-eslint/naming-convention */\nimport { serialize, SerializationHelper, serializeAsColor3, expandToProperty, serializeAsFresnelParameters, serializeAsTexture } from \"../Misc/decorators.js\";\nimport { SmartArray } from \"../Misc/smartArray.js\";\nimport { Scene } from \"../scene.js\";\nimport { Matrix } from \"../Maths/math.vector.js\";\nimport { Color3 } from \"../Maths/math.color.js\";\nimport { VertexBuffer } from \"../Buffers/buffer.js\";\nimport { PrePassConfiguration } from \"./prePassConfiguration.js\";\nimport { ImageProcessingConfiguration } from \"./imageProcessingConfiguration.js\";\nimport { Material } from \"../Materials/material.js\";\nimport { MaterialPluginEvent } from \"./materialPluginEvent.js\";\nimport { MaterialDefines } from \"../Materials/materialDefines.js\";\nimport { PushMaterial } from \"./pushMaterial.js\";\nimport { MaterialHelper } from \"./materialHelper.js\";\nimport { Texture } from \"../Materials/Textures/texture.js\";\nimport { RegisterClass } from \"../Misc/typeStore.js\";\nimport { MaterialFlags } from \"./materialFlags.js\";\nimport \"../Shaders/default.fragment.js\";\nimport \"../Shaders/default.vertex.js\";\n\nimport { EffectFallbacks } from \"./effectFallbacks.js\";\nimport { DetailMapConfiguration } from \"./material.detailMapConfiguration.js\";\nimport { addClipPlaneUniforms, bindClipPlane } from \"./clipPlaneMaterialHelper.js\";\nconst onCreatedEffectParameters = { effect: null, subMesh: null };\n/** @internal */\nexport class StandardMaterialDefines extends MaterialDefines {\n /**\n * Initializes the Standard Material defines.\n * @param externalProperties The external properties\n */\n constructor(externalProperties) {\n super(externalProperties);\n this.MAINUV1 = false;\n this.MAINUV2 = false;\n this.MAINUV3 = false;\n this.MAINUV4 = false;\n this.MAINUV5 = false;\n this.MAINUV6 = false;\n this.DIFFUSE = false;\n this.DIFFUSEDIRECTUV = 0;\n this.BAKED_VERTEX_ANIMATION_TEXTURE = false;\n this.AMBIENT = false;\n this.AMBIENTDIRECTUV = 0;\n this.OPACITY = false;\n this.OPACITYDIRECTUV = 0;\n this.OPACITYRGB = false;\n this.REFLECTION = false;\n this.EMISSIVE = false;\n this.EMISSIVEDIRECTUV = 0;\n this.SPECULAR = false;\n this.SPECULARDIRECTUV = 0;\n this.BUMP = false;\n this.BUMPDIRECTUV = 0;\n this.PARALLAX = false;\n this.PARALLAX_RHS = false;\n this.PARALLAXOCCLUSION = false;\n this.SPECULAROVERALPHA = false;\n this.CLIPPLANE = false;\n this.CLIPPLANE2 = false;\n this.CLIPPLANE3 = false;\n this.CLIPPLANE4 = false;\n this.CLIPPLANE5 = false;\n this.CLIPPLANE6 = false;\n this.ALPHATEST = false;\n this.DEPTHPREPASS = false;\n this.ALPHAFROMDIFFUSE = false;\n this.POINTSIZE = false;\n this.FOG = false;\n this.SPECULARTERM = false;\n this.DIFFUSEFRESNEL = false;\n this.OPACITYFRESNEL = false;\n this.REFLECTIONFRESNEL = false;\n this.REFRACTIONFRESNEL = false;\n this.EMISSIVEFRESNEL = false;\n this.FRESNEL = false;\n this.NORMAL = false;\n this.TANGENT = false;\n this.UV1 = false;\n this.UV2 = false;\n this.UV3 = false;\n this.UV4 = false;\n this.UV5 = false;\n this.UV6 = false;\n this.VERTEXCOLOR = false;\n this.VERTEXALPHA = false;\n this.NUM_BONE_INFLUENCERS = 0;\n this.BonesPerMesh = 0;\n this.BONETEXTURE = false;\n this.BONES_VELOCITY_ENABLED = false;\n this.INSTANCES = false;\n this.THIN_INSTANCES = false;\n this.INSTANCESCOLOR = false;\n this.GLOSSINESS = false;\n this.ROUGHNESS = false;\n this.EMISSIVEASILLUMINATION = false;\n this.LINKEMISSIVEWITHDIFFUSE = false;\n this.REFLECTIONFRESNELFROMSPECULAR = false;\n this.LIGHTMAP = false;\n this.LIGHTMAPDIRECTUV = 0;\n this.OBJECTSPACE_NORMALMAP = false;\n this.USELIGHTMAPASSHADOWMAP = false;\n this.REFLECTIONMAP_3D = false;\n this.REFLECTIONMAP_SPHERICAL = false;\n this.REFLECTIONMAP_PLANAR = false;\n this.REFLECTIONMAP_CUBIC = false;\n this.USE_LOCAL_REFLECTIONMAP_CUBIC = false;\n this.USE_LOCAL_REFRACTIONMAP_CUBIC = false;\n this.REFLECTIONMAP_PROJECTION = false;\n this.REFLECTIONMAP_SKYBOX = false;\n this.REFLECTIONMAP_EXPLICIT = false;\n this.REFLECTIONMAP_EQUIRECTANGULAR = false;\n this.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = false;\n this.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = false;\n this.REFLECTIONMAP_OPPOSITEZ = false;\n this.INVERTCUBICMAP = false;\n this.LOGARITHMICDEPTH = false;\n this.REFRACTION = false;\n this.REFRACTIONMAP_3D = false;\n this.REFLECTIONOVERALPHA = false;\n this.TWOSIDEDLIGHTING = false;\n this.SHADOWFLOAT = false;\n this.MORPHTARGETS = false;\n this.MORPHTARGETS_NORMAL = false;\n this.MORPHTARGETS_TANGENT = false;\n this.MORPHTARGETS_UV = false;\n this.NUM_MORPH_INFLUENCERS = 0;\n this.MORPHTARGETS_TEXTURE = false;\n this.NONUNIFORMSCALING = false; // https://playground.babylonjs.com#V6DWIH\n this.PREMULTIPLYALPHA = false; // https://playground.babylonjs.com#LNVJJ7\n this.ALPHATEST_AFTERALLALPHACOMPUTATIONS = false;\n this.ALPHABLEND = true;\n this.PREPASS = false;\n this.PREPASS_IRRADIANCE = false;\n this.PREPASS_IRRADIANCE_INDEX = -1;\n this.PREPASS_ALBEDO_SQRT = false;\n this.PREPASS_ALBEDO_SQRT_INDEX = -1;\n this.PREPASS_DEPTH = false;\n this.PREPASS_DEPTH_INDEX = -1;\n this.PREPASS_NORMAL = false;\n this.PREPASS_NORMAL_INDEX = -1;\n this.PREPASS_NORMAL_WORLDSPACE = false;\n this.PREPASS_POSITION = false;\n this.PREPASS_POSITION_INDEX = -1;\n this.PREPASS_VELOCITY = false;\n this.PREPASS_VELOCITY_INDEX = -1;\n this.PREPASS_REFLECTIVITY = false;\n this.PREPASS_REFLECTIVITY_INDEX = -1;\n this.SCENE_MRT_COUNT = 0;\n this.RGBDLIGHTMAP = false;\n this.RGBDREFLECTION = false;\n this.RGBDREFRACTION = false;\n this.IMAGEPROCESSING = false;\n this.VIGNETTE = false;\n this.VIGNETTEBLENDMODEMULTIPLY = false;\n this.VIGNETTEBLENDMODEOPAQUE = false;\n this.TONEMAPPING = false;\n this.TONEMAPPING_ACES = false;\n this.CONTRAST = false;\n this.COLORCURVES = false;\n this.COLORGRADING = false;\n this.COLORGRADING3D = false;\n this.SAMPLER3DGREENDEPTH = false;\n this.SAMPLER3DBGRMAP = false;\n this.DITHER = false;\n this.IMAGEPROCESSINGPOSTPROCESS = false;\n this.SKIPFINALCOLORCLAMP = false;\n this.MULTIVIEW = false;\n this.ORDER_INDEPENDENT_TRANSPARENCY = false;\n this.ORDER_INDEPENDENT_TRANSPARENCY_16BITS = false;\n this.CAMERA_ORTHOGRAPHIC = false;\n this.CAMERA_PERSPECTIVE = false;\n /**\n * If the reflection texture on this material is in linear color space\n * @internal\n */\n this.IS_REFLECTION_LINEAR = false;\n /**\n * If the refraction texture on this material is in linear color space\n * @internal\n */\n this.IS_REFRACTION_LINEAR = false;\n this.EXPOSURE = false;\n this.DECAL_AFTER_DETAIL = false;\n this.rebuild();\n }\n setReflectionMode(modeToEnable) {\n const modes = [\n \"REFLECTIONMAP_CUBIC\",\n \"REFLECTIONMAP_EXPLICIT\",\n \"REFLECTIONMAP_PLANAR\",\n \"REFLECTIONMAP_PROJECTION\",\n \"REFLECTIONMAP_PROJECTION\",\n \"REFLECTIONMAP_SKYBOX\",\n \"REFLECTIONMAP_SPHERICAL\",\n \"REFLECTIONMAP_EQUIRECTANGULAR\",\n \"REFLECTIONMAP_EQUIRECTANGULAR_FIXED\",\n \"REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED\",\n ];\n for (const mode of modes) {\n this[mode] = mode === modeToEnable;\n }\n }\n}\n/**\n * This is the default material used in Babylon. It is the best trade off between quality\n * and performances.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/materials_introduction\n */\nexport class StandardMaterial extends PushMaterial {\n /**\n * Gets the image processing configuration used either in this material.\n */\n get imageProcessingConfiguration() {\n return this._imageProcessingConfiguration;\n }\n /**\n * Sets the Default image processing configuration used either in the this material.\n *\n * If sets to null, the scene one is in use.\n */\n set imageProcessingConfiguration(value) {\n this._attachImageProcessingConfiguration(value);\n // Ensure the effect will be rebuilt.\n this._markAllSubMeshesAsTexturesDirty();\n }\n /**\n * Attaches a new image processing configuration to the Standard Material.\n * @param configuration\n */\n _attachImageProcessingConfiguration(configuration) {\n if (configuration === this._imageProcessingConfiguration) {\n return;\n }\n // Detaches observer\n if (this._imageProcessingConfiguration && this._imageProcessingObserver) {\n this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver);\n }\n // Pick the scene configuration if needed\n if (!configuration) {\n this._imageProcessingConfiguration = this.getScene().imageProcessingConfiguration;\n }\n else {\n this._imageProcessingConfiguration = configuration;\n }\n // Attaches observer\n if (this._imageProcessingConfiguration) {\n this._imageProcessingObserver = this._imageProcessingConfiguration.onUpdateParameters.add(() => {\n this._markAllSubMeshesAsImageProcessingDirty();\n });\n }\n }\n /**\n * Can this material render to prepass\n */\n get isPrePassCapable() {\n return !this.disableDepthWrite;\n }\n /**\n * Gets whether the color curves effect is enabled.\n */\n get cameraColorCurvesEnabled() {\n return this.imageProcessingConfiguration.colorCurvesEnabled;\n }\n /**\n * Sets whether the color curves effect is enabled.\n */\n set cameraColorCurvesEnabled(value) {\n this.imageProcessingConfiguration.colorCurvesEnabled = value;\n }\n /**\n * Gets whether the color grading effect is enabled.\n */\n get cameraColorGradingEnabled() {\n return this.imageProcessingConfiguration.colorGradingEnabled;\n }\n /**\n * Gets whether the color grading effect is enabled.\n */\n set cameraColorGradingEnabled(value) {\n this.imageProcessingConfiguration.colorGradingEnabled = value;\n }\n /**\n * Gets whether tonemapping is enabled or not.\n */\n get cameraToneMappingEnabled() {\n return this._imageProcessingConfiguration.toneMappingEnabled;\n }\n /**\n * Sets whether tonemapping is enabled or not\n */\n set cameraToneMappingEnabled(value) {\n this._imageProcessingConfiguration.toneMappingEnabled = value;\n }\n /**\n * The camera exposure used on this material.\n * This property is here and not in the camera to allow controlling exposure without full screen post process.\n * This corresponds to a photographic exposure.\n */\n get cameraExposure() {\n return this._imageProcessingConfiguration.exposure;\n }\n /**\n * The camera exposure used on this material.\n * This property is here and not in the camera to allow controlling exposure without full screen post process.\n * This corresponds to a photographic exposure.\n */\n set cameraExposure(value) {\n this._imageProcessingConfiguration.exposure = value;\n }\n /**\n * Gets The camera contrast used on this material.\n */\n get cameraContrast() {\n return this._imageProcessingConfiguration.contrast;\n }\n /**\n * Sets The camera contrast used on this material.\n */\n set cameraContrast(value) {\n this._imageProcessingConfiguration.contrast = value;\n }\n /**\n * Gets the Color Grading 2D Lookup Texture.\n */\n get cameraColorGradingTexture() {\n return this._imageProcessingConfiguration.colorGradingTexture;\n }\n /**\n * Sets the Color Grading 2D Lookup Texture.\n */\n set cameraColorGradingTexture(value) {\n this._imageProcessingConfiguration.colorGradingTexture = value;\n }\n /**\n * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).\n * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.\n * These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image;\n * corresponding to low luminance, medium luminance, and high luminance areas respectively.\n */\n get cameraColorCurves() {\n return this._imageProcessingConfiguration.colorCurves;\n }\n /**\n * The color grading curves provide additional color adjustment that is applied after any color grading transform (3D LUT).\n * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.\n * These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image;\n * corresponding to low luminance, medium luminance, and high luminance areas respectively.\n */\n set cameraColorCurves(value) {\n this._imageProcessingConfiguration.colorCurves = value;\n }\n /**\n * Can this material render to several textures at once\n */\n get canRenderToMRT() {\n return true;\n }\n /**\n * Instantiates a new standard material.\n * This is the default material used in Babylon. It is the best trade off between quality\n * and performances.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/materials_introduction\n * @param name Define the name of the material in the scene\n * @param scene Define the scene the material belong to\n */\n constructor(name, scene) {\n super(name, scene);\n this._diffuseTexture = null;\n this._ambientTexture = null;\n this._opacityTexture = null;\n this._reflectionTexture = null;\n this._emissiveTexture = null;\n this._specularTexture = null;\n this._bumpTexture = null;\n this._lightmapTexture = null;\n this._refractionTexture = null;\n /**\n * The color of the material lit by the environmental background lighting.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/materials_introduction#ambient-color-example\n */\n this.ambientColor = new Color3(0, 0, 0);\n /**\n * The basic color of the material as viewed under a light.\n */\n this.diffuseColor = new Color3(1, 1, 1);\n /**\n * Define how the color and intensity of the highlight given by the light in the material.\n */\n this.specularColor = new Color3(1, 1, 1);\n /**\n * Define the color of the material as if self lit.\n * This will be mixed in the final result even in the absence of light.\n */\n this.emissiveColor = new Color3(0, 0, 0);\n /**\n * Defines how sharp are the highlights in the material.\n * The bigger the value the sharper giving a more glossy feeling to the result.\n * Reversely, the smaller the value the blurrier giving a more rough feeling to the result.\n */\n this.specularPower = 64;\n this._useAlphaFromDiffuseTexture = false;\n this._useEmissiveAsIllumination = false;\n this._linkEmissiveWithDiffuse = false;\n this._useSpecularOverAlpha = false;\n this._useReflectionOverAlpha = false;\n this._disableLighting = false;\n this._useObjectSpaceNormalMap = false;\n this._useParallax = false;\n this._useParallaxOcclusion = false;\n /**\n * Apply a scaling factor that determine which \"depth\" the height map should reprensent. A value between 0.05 and 0.1 is reasonnable in Parallax, you can reach 0.2 using Parallax Occlusion.\n */\n this.parallaxScaleBias = 0.05;\n this._roughness = 0;\n /**\n * In case of refraction, define the value of the index of refraction.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/reflectionTexture#how-to-obtain-reflections-and-refractions\n */\n this.indexOfRefraction = 0.98;\n /**\n * Invert the refraction texture alongside the y axis.\n * It can be useful with procedural textures or probe for instance.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/reflectionTexture#how-to-obtain-reflections-and-refractions\n */\n this.invertRefractionY = true;\n /**\n * Defines the alpha limits in alpha test mode.\n */\n this.alphaCutOff = 0.4;\n this._useLightmapAsShadowmap = false;\n this._useReflectionFresnelFromSpecular = false;\n this._useGlossinessFromSpecularMapAlpha = false;\n this._maxSimultaneousLights = 4;\n this._invertNormalMapX = false;\n this._invertNormalMapY = false;\n this._twoSidedLighting = false;\n this._applyDecalMapAfterDetailMap = false;\n this._renderTargets = new SmartArray(16);\n this._worldViewProjectionMatrix = Matrix.Zero();\n this._globalAmbientColor = new Color3(0, 0, 0);\n this._cacheHasRenderTargetTextures = false;\n this.detailMap = new DetailMapConfiguration(this);\n // Setup the default processing configuration to the scene.\n this._attachImageProcessingConfiguration(null);\n this.prePassConfiguration = new PrePassConfiguration();\n this.getRenderTargetTextures = () => {\n this._renderTargets.reset();\n if (StandardMaterial.ReflectionTextureEnabled && this._reflectionTexture && this._reflectionTexture.isRenderTarget) {\n this._renderTargets.push(this._reflectionTexture);\n }\n if (StandardMaterial.RefractionTextureEnabled && this._refractionTexture && this._refractionTexture.isRenderTarget) {\n this._renderTargets.push(this._refractionTexture);\n }\n this._eventInfo.renderTargets = this._renderTargets;\n this._callbackPluginEventFillRenderTargetTextures(this._eventInfo);\n return this._renderTargets;\n };\n }\n /**\n * Gets a boolean indicating that current material needs to register RTT\n */\n get hasRenderTargetTextures() {\n if (StandardMaterial.ReflectionTextureEnabled && this._reflectionTexture && this._reflectionTexture.isRenderTarget) {\n return true;\n }\n if (StandardMaterial.RefractionTextureEnabled && this._refractionTexture && this._refractionTexture.isRenderTarget) {\n return true;\n }\n return this._cacheHasRenderTargetTextures;\n }\n /**\n * Gets the current class name of the material e.g. \"StandardMaterial\"\n * Mainly use in serialization.\n * @returns the class name\n */\n getClassName() {\n return \"StandardMaterial\";\n }\n /**\n * In case the depth buffer does not allow enough depth precision for your scene (might be the case in large scenes)\n * You can try switching to logarithmic depth.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/advanced/logarithmicDepthBuffer\n */\n get useLogarithmicDepth() {\n return this._useLogarithmicDepth;\n }\n set useLogarithmicDepth(value) {\n this._useLogarithmicDepth = value && this.getScene().getEngine().getCaps().fragmentDepthSupported;\n this._markAllSubMeshesAsMiscDirty();\n }\n /**\n * Specifies if the material will require alpha blending\n * @returns a boolean specifying if alpha blending is needed\n */\n needAlphaBlending() {\n if (this._disableAlphaBlending) {\n return false;\n }\n return (this.alpha < 1.0 ||\n this._opacityTexture != null ||\n this._shouldUseAlphaFromDiffuseTexture() ||\n (this._opacityFresnelParameters && this._opacityFresnelParameters.isEnabled));\n }\n /**\n * Specifies if this material should be rendered in alpha test mode\n * @returns a boolean specifying if an alpha test is needed.\n */\n needAlphaTesting() {\n if (this._forceAlphaTest) {\n return true;\n }\n return this._hasAlphaChannel() && (this._transparencyMode == null || this._transparencyMode === Material.MATERIAL_ALPHATEST);\n }\n /**\n * Specifies whether or not the alpha value of the diffuse texture should be used for alpha blending.\n */\n _shouldUseAlphaFromDiffuseTexture() {\n return this._diffuseTexture != null && this._diffuseTexture.hasAlpha && this._useAlphaFromDiffuseTexture && this._transparencyMode !== Material.MATERIAL_OPAQUE;\n }\n /**\n * Specifies whether or not there is a usable alpha channel for transparency.\n */\n _hasAlphaChannel() {\n return (this._diffuseTexture != null && this._diffuseTexture.hasAlpha) || this._opacityTexture != null;\n }\n /**\n * Get the texture used for alpha test purpose.\n * @returns the diffuse texture in case of the standard material.\n */\n getAlphaTestTexture() {\n return this._diffuseTexture;\n }\n /**\n * Get if the submesh is ready to be used and all its information available.\n * Child classes can use it to update shaders\n * @param mesh defines the mesh to check\n * @param subMesh defines which submesh to check\n * @param useInstances specifies that instances should be used\n * @returns a boolean indicating that the submesh is ready or not\n */\n isReadyForSubMesh(mesh, subMesh, useInstances = false) {\n if (!this._uniformBufferLayoutBuilt) {\n this.buildUniformLayout();\n }\n if (subMesh.effect && this.isFrozen) {\n if (subMesh.effect._wasPreviouslyReady && subMesh.effect._wasPreviouslyUsingInstances === useInstances) {\n return true;\n }\n }\n if (!subMesh.materialDefines) {\n this._callbackPluginEventGeneric(MaterialPluginEvent.GetDefineNames, this._eventInfo);\n subMesh.materialDefines = new StandardMaterialDefines(this._eventInfo.defineNames);\n }\n const scene = this.getScene();\n const defines = subMesh.materialDefines;\n if (this._isReadyForSubMesh(subMesh)) {\n return true;\n }\n const engine = scene.getEngine();\n // Lights\n defines._needNormals = MaterialHelper.PrepareDefinesForLights(scene, mesh, defines, true, this._maxSimultaneousLights, this._disableLighting);\n // Multiview\n MaterialHelper.PrepareDefinesForMultiview(scene, defines);\n // PrePass\n const oit = this.needAlphaBlendingForMesh(mesh) && this.getScene().useOrderIndependentTransparency;\n MaterialHelper.PrepareDefinesForPrePass(scene, defines, this.canRenderToMRT && !oit);\n // Order independant transparency\n MaterialHelper.PrepareDefinesForOIT(scene, defines, oit);\n // Textures\n if (defines._areTexturesDirty) {\n this._eventInfo.hasRenderTargetTextures = false;\n this._callbackPluginEventHasRenderTargetTextures(this._eventInfo);\n this._cacheHasRenderTargetTextures = this._eventInfo.hasRenderTargetTextures;\n defines._needUVs = false;\n for (let i = 1; i <= 6; ++i) {\n defines[\"MAINUV\" + i] = false;\n }\n if (scene.texturesEnabled) {\n defines.DIFFUSEDIRECTUV = 0;\n defines.BUMPDIRECTUV = 0;\n defines.AMBIENTDIRECTUV = 0;\n defines.OPACITYDIRECTUV = 0;\n defines.EMISSIVEDIRECTUV = 0;\n defines.SPECULARDIRECTUV = 0;\n defines.LIGHTMAPDIRECTUV = 0;\n if (this._diffuseTexture && StandardMaterial.DiffuseTextureEnabled) {\n if (!this._diffuseTexture.isReadyOrNotBlocking()) {\n return false;\n }\n else {\n MaterialHelper.PrepareDefinesForMergedUV(this._diffuseTexture, defines, \"DIFFUSE\");\n }\n }\n else {\n defines.DIFFUSE = false;\n }\n if (this._ambientTexture && StandardMaterial.AmbientTextureEnabled) {\n if (!this._ambientTexture.isReadyOrNotBlocking()) {\n return false;\n }\n else {\n MaterialHelper.PrepareDefinesForMergedUV(this._ambientTexture, defines, \"AMBIENT\");\n }\n }\n else {\n defines.AMBIENT = false;\n }\n if (this._opacityTexture && StandardMaterial.OpacityTextureEnabled) {\n if (!this._opacityTexture.isReadyOrNotBlocking()) {\n return false;\n }\n else {\n MaterialHelper.PrepareDefinesForMergedUV(this._opacityTexture, defines, \"OPACITY\");\n defines.OPACITYRGB = this._opacityTexture.getAlphaFromRGB;\n }\n }\n else {\n defines.OPACITY = false;\n }\n if (this._reflectionTexture && StandardMaterial.ReflectionTextureEnabled) {\n if (!this._reflectionTexture.isReadyOrNotBlocking()) {\n return false;\n }\n else {\n defines._needNormals = true;\n defines.REFLECTION = true;\n defines.ROUGHNESS = this._roughness > 0;\n defines.REFLECTIONOVERALPHA = this._useReflectionOverAlpha;\n defines.INVERTCUBICMAP = this._reflectionTexture.coordinatesMode === Texture.INVCUBIC_MODE;\n defines.REFLECTIONMAP_3D = this._reflectionTexture.isCube;\n defines.REFLECTIONMAP_OPPOSITEZ =\n defines.REFLECTIONMAP_3D && this.getScene().useRightHandedSystem ? !this._reflectionTexture.invertZ : this._reflectionTexture.invertZ;\n defines.RGBDREFLECTION = this._reflectionTexture.isRGBD;\n switch (this._reflectionTexture.coordinatesMode) {\n case Texture.EXPLICIT_MODE:\n defines.setReflectionMode(\"REFLECTIONMAP_EXPLICIT\");\n break;\n case Texture.PLANAR_MODE:\n defines.setReflectionMode(\"REFLECTIONMAP_PLANAR\");\n break;\n case Texture.PROJECTION_MODE:\n defines.setReflectionMode(\"REFLECTIONMAP_PROJECTION\");\n break;\n case Texture.SKYBOX_MODE:\n defines.setReflectionMode(\"REFLECTIONMAP_SKYBOX\");\n break;\n case Texture.SPHERICAL_MODE:\n defines.setReflectionMode(\"REFLECTIONMAP_SPHERICAL\");\n break;\n case Texture.EQUIRECTANGULAR_MODE:\n defines.setReflectionMode(\"REFLECTIONMAP_EQUIRECTANGULAR\");\n break;\n case Texture.FIXED_EQUIRECTANGULAR_MODE:\n defines.setReflectionMode(\"REFLECTIONMAP_EQUIRECTANGULAR_FIXED\");\n break;\n case Texture.FIXED_EQUIRECTANGULAR_MIRRORED_MODE:\n defines.setReflectionMode(\"REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED\");\n break;\n case Texture.CUBIC_MODE:\n case Texture.INVCUBIC_MODE:\n default:\n defines.setReflectionMode(\"REFLECTIONMAP_CUBIC\");\n break;\n }\n defines.USE_LOCAL_REFLECTIONMAP_CUBIC = this._reflectionTexture.boundingBoxSize ? true : false;\n }\n }\n else {\n defines.REFLECTION = false;\n defines.REFLECTIONMAP_OPPOSITEZ = false;\n }\n if (this._emissiveTexture && StandardMaterial.EmissiveTextureEnabled) {\n if (!this._emissiveTexture.isReadyOrNotBlocking()) {\n return false;\n }\n else {\n MaterialHelper.PrepareDefinesForMergedUV(this._emissiveTexture, defines, \"EMISSIVE\");\n }\n }\n else {\n defines.EMISSIVE = false;\n }\n if (this._lightmapTexture && StandardMaterial.LightmapTextureEnabled) {\n if (!this._lightmapTexture.isReadyOrNotBlocking()) {\n return false;\n }\n else {\n MaterialHelper.PrepareDefinesForMergedUV(this._lightmapTexture, defines, \"LIGHTMAP\");\n defines.USELIGHTMAPASSHADOWMAP = this._useLightmapAsShadowmap;\n defines.RGBDLIGHTMAP = this._lightmapTexture.isRGBD;\n }\n }\n else {\n defines.LIGHTMAP = false;\n }\n if (this._specularTexture && StandardMaterial.SpecularTextureEnabled) {\n if (!this._specularTexture.isReadyOrNotBlocking()) {\n return false;\n }\n else {\n MaterialHelper.PrepareDefinesForMergedUV(this._specularTexture, defines, \"SPECULAR\");\n defines.GLOSSINESS = this._useGlossinessFromSpecularMapAlpha;\n }\n }\n else {\n defines.SPECULAR = false;\n }\n if (scene.getEngine().getCaps().standardDerivatives && this._bumpTexture && StandardMaterial.BumpTextureEnabled) {\n // Bump texture can not be not blocking.\n if (!this._bumpTexture.isReady()) {\n return false;\n }\n else {\n MaterialHelper.PrepareDefinesForMergedUV(this._bumpTexture, defines, \"BUMP\");\n defines.PARALLAX = this._useParallax;\n defines.PARALLAX_RHS = scene.useRightHandedSystem;\n defines.PARALLAXOCCLUSION = this._useParallaxOcclusion;\n }\n defines.OBJECTSPACE_NORMALMAP = this._useObjectSpaceNormalMap;\n }\n else {\n defines.BUMP = false;\n defines.PARALLAX = false;\n defines.PARALLAX_RHS = false;\n defines.PARALLAXOCCLUSION = false;\n }\n if (this._refractionTexture && StandardMaterial.RefractionTextureEnabled) {\n if (!this._refractionTexture.isReadyOrNotBlocking()) {\n return false;\n }\n else {\n defines._needUVs = true;\n defines.REFRACTION = true;\n defines.REFRACTIONMAP_3D = this._refractionTexture.isCube;\n defines.RGBDREFRACTION = this._refractionTexture.isRGBD;\n defines.USE_LOCAL_REFRACTIONMAP_CUBIC = this._refractionTexture.boundingBoxSize ? true : false;\n }\n }\n else {\n defines.REFRACTION = false;\n }\n defines.TWOSIDEDLIGHTING = !this._backFaceCulling && this._twoSidedLighting;\n }\n else {\n defines.DIFFUSE = false;\n defines.AMBIENT = false;\n defines.OPACITY = false;\n defines.REFLECTION = false;\n defines.EMISSIVE = false;\n defines.LIGHTMAP = false;\n defines.BUMP = false;\n defines.REFRACTION = false;\n }\n defines.ALPHAFROMDIFFUSE = this._shouldUseAlphaFromDiffuseTexture();\n defines.EMISSIVEASILLUMINATION = this._useEmissiveAsIllumination;\n defines.LINKEMISSIVEWITHDIFFUSE = this._linkEmissiveWithDiffuse;\n defines.SPECULAROVERALPHA = this._useSpecularOverAlpha;\n defines.PREMULTIPLYALPHA = this.alphaMode === 7 || this.alphaMode === 8;\n defines.ALPHATEST_AFTERALLALPHACOMPUTATIONS = this.transparencyMode !== null;\n defines.ALPHABLEND = this.transparencyMode === null || this.needAlphaBlendingForMesh(mesh); // check on null for backward compatibility\n }\n this._eventInfo.isReadyForSubMesh = true;\n this._eventInfo.defines = defines;\n this._eventInfo.subMesh = subMesh;\n this._callbackPluginEventIsReadyForSubMesh(this._eventInfo);\n if (!this._eventInfo.isReadyForSubMesh) {\n return false;\n }\n if (defines._areImageProcessingDirty && this._imageProcessingConfiguration) {\n if (!this._imageProcessingConfiguration.isReady()) {\n return false;\n }\n this._imageProcessingConfiguration.prepareDefines(defines);\n defines.IS_REFLECTION_LINEAR = this.reflectionTexture != null && !this.reflectionTexture.gammaSpace;\n defines.IS_REFRACTION_LINEAR = this.refractionTexture != null && !this.refractionTexture.gammaSpace;\n }\n if (defines._areFresnelDirty) {\n if (StandardMaterial.FresnelEnabled) {\n // Fresnel\n if (this._diffuseFresnelParameters ||\n this._opacityFresnelParameters ||\n this._emissiveFresnelParameters ||\n this._refractionFresnelParameters ||\n this._reflectionFresnelParameters) {\n defines.DIFFUSEFRESNEL = this._diffuseFresnelParameters && this._diffuseFresnelParameters.isEnabled;\n defines.OPACITYFRESNEL = this._opacityFresnelParameters && this._opacityFresnelParameters.isEnabled;\n defines.REFLECTIONFRESNEL = this._reflectionFresnelParameters && this._reflectionFresnelParameters.isEnabled;\n defines.REFLECTIONFRESNELFROMSPECULAR = this._useReflectionFresnelFromSpecular;\n defines.REFRACTIONFRESNEL = this._refractionFresnelParameters && this._refractionFresnelParameters.isEnabled;\n defines.EMISSIVEFRESNEL = this._emissiveFresnelParameters && this._emissiveFresnelParameters.isEnabled;\n defines._needNormals = true;\n defines.FRESNEL = true;\n }\n }\n else {\n defines.FRESNEL = false;\n }\n }\n // Misc.\n MaterialHelper.PrepareDefinesForMisc(mesh, scene, this._useLogarithmicDepth, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh) || this._forceAlphaTest, defines, this._applyDecalMapAfterDetailMap);\n // Values that need to be evaluated on every frame\n MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, this, defines, useInstances, null, subMesh.getRenderingMesh().hasThinInstances);\n // External config\n this._eventInfo.defines = defines;\n this._eventInfo.mesh = mesh;\n this._callbackPluginEventPrepareDefinesBeforeAttributes(this._eventInfo);\n // Attribs\n MaterialHelper.PrepareDefinesForAttributes(mesh, defines, true, true, true);\n // External config\n this._callbackPluginEventPrepareDefines(this._eventInfo);\n // Get correct effect\n let forceWasNotReadyPreviously = false;\n if (defines.isDirty) {\n const lightDisposed = defines._areLightsDisposed;\n defines.markAsProcessed();\n // Fallbacks\n const fallbacks = new EffectFallbacks();\n if (defines.REFLECTION) {\n fallbacks.addFallback(0, \"REFLECTION\");\n }\n if (defines.SPECULAR) {\n fallbacks.addFallback(0, \"SPECULAR\");\n }\n if (defines.BUMP) {\n fallbacks.addFallback(0, \"BUMP\");\n }\n if (defines.PARALLAX) {\n fallbacks.addFallback(1, \"PARALLAX\");\n }\n if (defines.PARALLAX_RHS) {\n fallbacks.addFallback(1, \"PARALLAX_RHS\");\n }\n if (defines.PARALLAXOCCLUSION) {\n fallbacks.addFallback(0, \"PARALLAXOCCLUSION\");\n }\n if (defines.SPECULAROVERALPHA) {\n fallbacks.addFallback(0, \"SPECULAROVERALPHA\");\n }\n if (defines.FOG) {\n fallbacks.addFallback(1, \"FOG\");\n }\n if (defines.POINTSIZE) {\n fallbacks.addFallback(0, \"POINTSIZE\");\n }\n if (defines.LOGARITHMICDEPTH) {\n fallbacks.addFallback(0, \"LOGARITHMICDEPTH\");\n }\n MaterialHelper.HandleFallbacksForShadows(defines, fallbacks, this._maxSimultaneousLights);\n if (defines.SPECULARTERM) {\n fallbacks.addFallback(0, \"SPECULARTERM\");\n }\n if (defines.DIFFUSEFRESNEL) {\n fallbacks.addFallback(1, \"DIFFUSEFRESNEL\");\n }\n if (defines.OPACITYFRESNEL) {\n fallbacks.addFallback(2, \"OPACITYFRESNEL\");\n }\n if (defines.REFLECTIONFRESNEL) {\n fallbacks.addFallback(3, \"REFLECTIONFRESNEL\");\n }\n if (defines.EMISSIVEFRESNEL) {\n fallbacks.addFallback(4, \"EMISSIVEFRESNEL\");\n }\n if (defines.FRESNEL) {\n fallbacks.addFallback(4, \"FRESNEL\");\n }\n if (defines.MULTIVIEW) {\n fallbacks.addFallback(0, \"MULTIVIEW\");\n }\n //Attributes\n const attribs = [VertexBuffer.PositionKind];\n if (defines.NORMAL) {\n attribs.push(VertexBuffer.NormalKind);\n }\n if (defines.TANGENT) {\n attribs.push(VertexBuffer.TangentKind);\n }\n for (let i = 1; i <= 6; ++i) {\n if (defines[\"UV\" + i]) {\n attribs.push(`uv${i === 1 ? \"\" : i}`);\n }\n }\n if (defines.VERTEXCOLOR) {\n attribs.push(VertexBuffer.ColorKind);\n }\n MaterialHelper.PrepareAttributesForBones(attribs, mesh, defines, fallbacks);\n MaterialHelper.PrepareAttributesForInstances(attribs, defines);\n MaterialHelper.PrepareAttributesForMorphTargets(attribs, mesh, defines);\n MaterialHelper.PrepareAttributesForBakedVertexAnimation(attribs, mesh, defines);\n let shaderName = \"default\";\n const uniforms = [\n \"world\",\n \"view\",\n \"viewProjection\",\n \"vEyePosition\",\n \"vLightsType\",\n \"vAmbientColor\",\n \"vDiffuseColor\",\n \"vSpecularColor\",\n \"vEmissiveColor\",\n \"visibility\",\n \"vFogInfos\",\n \"vFogColor\",\n \"pointSize\",\n \"vDiffuseInfos\",\n \"vAmbientInfos\",\n \"vOpacityInfos\",\n \"vReflectionInfos\",\n \"vEmissiveInfos\",\n \"vSpecularInfos\",\n \"vBumpInfos\",\n \"vLightmapInfos\",\n \"vRefractionInfos\",\n \"mBones\",\n \"diffuseMatrix\",\n \"ambientMatrix\",\n \"opacityMatrix\",\n \"reflectionMatrix\",\n \"emissiveMatrix\",\n \"specularMatrix\",\n \"bumpMatrix\",\n \"normalMatrix\",\n \"lightmapMatrix\",\n \"refractionMatrix\",\n \"diffuseLeftColor\",\n \"diffuseRightColor\",\n \"opacityParts\",\n \"reflectionLeftColor\",\n \"reflectionRightColor\",\n \"emissiveLeftColor\",\n \"emissiveRightColor\",\n \"refractionLeftColor\",\n \"refractionRightColor\",\n \"vReflectionPosition\",\n \"vReflectionSize\",\n \"vRefractionPosition\",\n \"vRefractionSize\",\n \"logarithmicDepthConstant\",\n \"vTangentSpaceParams\",\n \"alphaCutOff\",\n \"boneTextureWidth\",\n \"morphTargetTextureInfo\",\n \"morphTargetTextureIndices\",\n ];\n const samplers = [\n \"diffuseSampler\",\n \"ambientSampler\",\n \"opacitySampler\",\n \"reflectionCubeSampler\",\n \"reflection2DSampler\",\n \"emissiveSampler\",\n \"specularSampler\",\n \"bumpSampler\",\n \"lightmapSampler\",\n \"refractionCubeSampler\",\n \"refraction2DSampler\",\n \"boneSampler\",\n \"morphTargets\",\n \"oitDepthSampler\",\n \"oitFrontColorSampler\",\n ];\n const uniformBuffers = [\"Material\", \"Scene\", \"Mesh\"];\n const indexParameters = { maxSimultaneousLights: this._maxSimultaneousLights, maxSimultaneousMorphTargets: defines.NUM_MORPH_INFLUENCERS };\n this._eventInfo.fallbacks = fallbacks;\n this._eventInfo.fallbackRank = 0;\n this._eventInfo.defines = defines;\n this._eventInfo.uniforms = uniforms;\n this._eventInfo.attributes = attribs;\n this._eventInfo.samplers = samplers;\n this._eventInfo.uniformBuffersNames = uniformBuffers;\n this._eventInfo.customCode = undefined;\n this._eventInfo.mesh = mesh;\n this._eventInfo.indexParameters = indexParameters;\n this._callbackPluginEventGeneric(MaterialPluginEvent.PrepareEffect, this._eventInfo);\n PrePassConfiguration.AddUniforms(uniforms);\n PrePassConfiguration.AddSamplers(samplers);\n if (ImageProcessingConfiguration) {\n ImageProcessingConfiguration.PrepareUniforms(uniforms, defines);\n ImageProcessingConfiguration.PrepareSamplers(samplers, defines);\n }\n MaterialHelper.PrepareUniformsAndSamplersList({\n uniformsNames: uniforms,\n uniformBuffersNames: uniformBuffers,\n samplers: samplers,\n defines: defines,\n maxSimultaneousLights: this._maxSimultaneousLights,\n });\n addClipPlaneUniforms(uniforms);\n const csnrOptions = {};\n if (this.customShaderNameResolve) {\n shaderName = this.customShaderNameResolve(shaderName, uniforms, uniformBuffers, samplers, defines, attribs, csnrOptions);\n }\n const join = defines.toString();\n const previousEffect = subMesh.effect;\n let effect = scene.getEngine().createEffect(shaderName, {\n attributes: attribs,\n uniformsNames: uniforms,\n uniformBuffersNames: uniformBuffers,\n samplers: samplers,\n defines: join,\n fallbacks: fallbacks,\n onCompiled: this.onCompiled,\n onError: this.onError,\n indexParameters,\n processFinalCode: csnrOptions.processFinalCode,\n processCodeAfterIncludes: this._eventInfo.customCode,\n multiTarget: defines.PREPASS,\n }, engine);\n this._eventInfo.customCode = undefined;\n if (effect) {\n if (this._onEffectCreatedObservable) {\n onCreatedEffectParameters.effect = effect;\n onCreatedEffectParameters.subMesh = subMesh;\n this._onEffectCreatedObservable.notifyObservers(onCreatedEffectParameters);\n }\n // Use previous effect while new one is compiling\n if (this.allowShaderHotSwapping && previousEffect && !effect.isReady()) {\n effect = previousEffect;\n defines.markAsUnprocessed();\n forceWasNotReadyPreviously = this.isFrozen;\n if (lightDisposed) {\n // re register in case it takes more than one frame.\n defines._areLightsDisposed = true;\n return false;\n }\n }\n else {\n scene.resetCachedMaterial();\n subMesh.setEffect(effect, defines, this._materialContext);\n }\n }\n }\n if (!subMesh.effect || !subMesh.effect.isReady()) {\n return false;\n }\n defines._renderId = scene.getRenderId();\n subMesh.effect._wasPreviouslyReady = forceWasNotReadyPreviously ? false : true;\n subMesh.effect._wasPreviouslyUsingInstances = useInstances;\n this._checkScenePerformancePriority();\n return true;\n }\n /**\n * Builds the material UBO layouts.\n * Used internally during the effect preparation.\n */\n buildUniformLayout() {\n // Order is important !\n const ubo = this._uniformBuffer;\n ubo.addUniform(\"diffuseLeftColor\", 4);\n ubo.addUniform(\"diffuseRightColor\", 4);\n ubo.addUniform(\"opacityParts\", 4);\n ubo.addUniform(\"reflectionLeftColor\", 4);\n ubo.addUniform(\"reflectionRightColor\", 4);\n ubo.addUniform(\"refractionLeftColor\", 4);\n ubo.addUniform(\"refractionRightColor\", 4);\n ubo.addUniform(\"emissiveLeftColor\", 4);\n ubo.addUniform(\"emissiveRightColor\", 4);\n ubo.addUniform(\"vDiffuseInfos\", 2);\n ubo.addUniform(\"vAmbientInfos\", 2);\n ubo.addUniform(\"vOpacityInfos\", 2);\n ubo.addUniform(\"vReflectionInfos\", 2);\n ubo.addUniform(\"vReflectionPosition\", 3);\n ubo.addUniform(\"vReflectionSize\", 3);\n ubo.addUniform(\"vEmissiveInfos\", 2);\n ubo.addUniform(\"vLightmapInfos\", 2);\n ubo.addUniform(\"vSpecularInfos\", 2);\n ubo.addUniform(\"vBumpInfos\", 3);\n ubo.addUniform(\"diffuseMatrix\", 16);\n ubo.addUniform(\"ambientMatrix\", 16);\n ubo.addUniform(\"opacityMatrix\", 16);\n ubo.addUniform(\"reflectionMatrix\", 16);\n ubo.addUniform(\"emissiveMatrix\", 16);\n ubo.addUniform(\"lightmapMatrix\", 16);\n ubo.addUniform(\"specularMatrix\", 16);\n ubo.addUniform(\"bumpMatrix\", 16);\n ubo.addUniform(\"vTangentSpaceParams\", 2);\n ubo.addUniform(\"pointSize\", 1);\n ubo.addUniform(\"alphaCutOff\", 1);\n ubo.addUniform(\"refractionMatrix\", 16);\n ubo.addUniform(\"vRefractionInfos\", 4);\n ubo.addUniform(\"vRefractionPosition\", 3);\n ubo.addUniform(\"vRefractionSize\", 3);\n ubo.addUniform(\"vSpecularColor\", 4);\n ubo.addUniform(\"vEmissiveColor\", 3);\n ubo.addUniform(\"vDiffuseColor\", 4);\n ubo.addUniform(\"vAmbientColor\", 3);\n super.buildUniformLayout();\n }\n /**\n * Binds the submesh to this material by preparing the effect and shader to draw\n * @param world defines the world transformation matrix\n * @param mesh defines the mesh containing the submesh\n * @param subMesh defines the submesh to bind the material to\n */\n bindForSubMesh(world, mesh, subMesh) {\n var _a;\n const scene = this.getScene();\n const defines = subMesh.materialDefines;\n if (!defines) {\n return;\n }\n const effect = subMesh.effect;\n if (!effect) {\n return;\n }\n this._activeEffect = effect;\n // Matrices Mesh.\n mesh.getMeshUniformBuffer().bindToEffect(effect, \"Mesh\");\n mesh.transferToEffect(world);\n // Binding unconditionally\n this._uniformBuffer.bindToEffect(effect, \"Material\");\n this.prePassConfiguration.bindForSubMesh(this._activeEffect, scene, mesh, world, this.isFrozen);\n this._eventInfo.subMesh = subMesh;\n this._callbackPluginEventHardBindForSubMesh(this._eventInfo);\n // Normal Matrix\n if (defines.OBJECTSPACE_NORMALMAP) {\n world.toNormalMatrix(this._normalMatrix);\n this.bindOnlyNormalMatrix(this._normalMatrix);\n }\n const mustRebind = effect._forceRebindOnNextCall || this._mustRebind(scene, effect, mesh.visibility);\n // Bones\n MaterialHelper.BindBonesParameters(mesh, effect);\n const ubo = this._uniformBuffer;\n if (mustRebind) {\n this.bindViewProjection(effect);\n if (!ubo.useUbo || !this.isFrozen || !ubo.isSync || effect._forceRebindOnNextCall) {\n if (StandardMaterial.FresnelEnabled && defines.FRESNEL) {\n // Fresnel\n if (this.diffuseFresnelParameters && this.diffuseFresnelParameters.isEnabled) {\n ubo.updateColor4(\"diffuseLeftColor\", this.diffuseFresnelParameters.leftColor, this.diffuseFresnelParameters.power);\n ubo.updateColor4(\"diffuseRightColor\", this.diffuseFresnelParameters.rightColor, this.diffuseFresnelParameters.bias);\n }\n if (this.opacityFresnelParameters && this.opacityFresnelParameters.isEnabled) {\n ubo.updateColor4(\"opacityParts\", new Color3(this.opacityFresnelParameters.leftColor.toLuminance(), this.opacityFresnelParameters.rightColor.toLuminance(), this.opacityFresnelParameters.bias), this.opacityFresnelParameters.power);\n }\n if (this.reflectionFresnelParameters && this.reflectionFresnelParameters.isEnabled) {\n ubo.updateColor4(\"reflectionLeftColor\", this.reflectionFresnelParameters.leftColor, this.reflectionFresnelParameters.power);\n ubo.updateColor4(\"reflectionRightColor\", this.reflectionFresnelParameters.rightColor, this.reflectionFresnelParameters.bias);\n }\n if (this.refractionFresnelParameters && this.refractionFresnelParameters.isEnabled) {\n ubo.updateColor4(\"refractionLeftColor\", this.refractionFresnelParameters.leftColor, this.refractionFresnelParameters.power);\n ubo.updateColor4(\"refractionRightColor\", this.refractionFresnelParameters.rightColor, this.refractionFresnelParameters.bias);\n }\n if (this.emissiveFresnelParameters && this.emissiveFresnelParameters.isEnabled) {\n ubo.updateColor4(\"emissiveLeftColor\", this.emissiveFresnelParameters.leftColor, this.emissiveFresnelParameters.power);\n ubo.updateColor4(\"emissiveRightColor\", this.emissiveFresnelParameters.rightColor, this.emissiveFresnelParameters.bias);\n }\n }\n // Textures\n if (scene.texturesEnabled) {\n if (this._diffuseTexture && StandardMaterial.DiffuseTextureEnabled) {\n ubo.updateFloat2(\"vDiffuseInfos\", this._diffuseTexture.coordinatesIndex, this._diffuseTexture.level);\n MaterialHelper.BindTextureMatrix(this._diffuseTexture, ubo, \"diffuse\");\n }\n if (this._ambientTexture && StandardMaterial.AmbientTextureEnabled) {\n ubo.updateFloat2(\"vAmbientInfos\", this._ambientTexture.coordinatesIndex, this._ambientTexture.level);\n MaterialHelper.BindTextureMatrix(this._ambientTexture, ubo, \"ambient\");\n }\n if (this._opacityTexture && StandardMaterial.OpacityTextureEnabled) {\n ubo.updateFloat2(\"vOpacityInfos\", this._opacityTexture.coordinatesIndex, this._opacityTexture.level);\n MaterialHelper.BindTextureMatrix(this._opacityTexture, ubo, \"opacity\");\n }\n if (this._hasAlphaChannel()) {\n ubo.updateFloat(\"alphaCutOff\", this.alphaCutOff);\n }\n if (this._reflectionTexture && StandardMaterial.ReflectionTextureEnabled) {\n ubo.updateFloat2(\"vReflectionInfos\", this._reflectionTexture.level, this.roughness);\n ubo.updateMatrix(\"reflectionMatrix\", this._reflectionTexture.getReflectionTextureMatrix());\n if (this._reflectionTexture.boundingBoxSize) {\n const cubeTexture = this._reflectionTexture;\n ubo.updateVector3(\"vReflectionPosition\", cubeTexture.boundingBoxPosition);\n ubo.updateVector3(\"vReflectionSize\", cubeTexture.boundingBoxSize);\n }\n }\n if (this._emissiveTexture && StandardMaterial.EmissiveTextureEnabled) {\n ubo.updateFloat2(\"vEmissiveInfos\", this._emissiveTexture.coordinatesIndex, this._emissiveTexture.level);\n MaterialHelper.BindTextureMatrix(this._emissiveTexture, ubo, \"emissive\");\n }\n if (this._lightmapTexture && StandardMaterial.LightmapTextureEnabled) {\n ubo.updateFloat2(\"vLightmapInfos\", this._lightmapTexture.coordinatesIndex, this._lightmapTexture.level);\n MaterialHelper.BindTextureMatrix(this._lightmapTexture, ubo, \"lightmap\");\n }\n if (this._specularTexture && StandardMaterial.SpecularTextureEnabled) {\n ubo.updateFloat2(\"vSpecularInfos\", this._specularTexture.coordinatesIndex, this._specularTexture.level);\n MaterialHelper.BindTextureMatrix(this._specularTexture, ubo, \"specular\");\n }\n if (this._bumpTexture && scene.getEngine().getCaps().standardDerivatives && StandardMaterial.BumpTextureEnabled) {\n ubo.updateFloat3(\"vBumpInfos\", this._bumpTexture.coordinatesIndex, 1.0 / this._bumpTexture.level, this.parallaxScaleBias);\n MaterialHelper.BindTextureMatrix(this._bumpTexture, ubo, \"bump\");\n if (scene._mirroredCameraPosition) {\n ubo.updateFloat2(\"vTangentSpaceParams\", this._invertNormalMapX ? 1.0 : -1.0, this._invertNormalMapY ? 1.0 : -1.0);\n }\n else {\n ubo.updateFloat2(\"vTangentSpaceParams\", this._invertNormalMapX ? -1.0 : 1.0, this._invertNormalMapY ? -1.0 : 1.0);\n }\n }\n if (this._refractionTexture && StandardMaterial.RefractionTextureEnabled) {\n let depth = 1.0;\n if (!this._refractionTexture.isCube) {\n ubo.updateMatrix(\"refractionMatrix\", this._refractionTexture.getReflectionTextureMatrix());\n if (this._refractionTexture.depth) {\n depth = this._refractionTexture.depth;\n }\n }\n ubo.updateFloat4(\"vRefractionInfos\", this._refractionTexture.level, this.indexOfRefraction, depth, this.invertRefractionY ? -1 : 1);\n if (this._refractionTexture.boundingBoxSize) {\n const cubeTexture = this._refractionTexture;\n ubo.updateVector3(\"vRefractionPosition\", cubeTexture.boundingBoxPosition);\n ubo.updateVector3(\"vRefractionSize\", cubeTexture.boundingBoxSize);\n }\n }\n }\n // Point size\n if (this.pointsCloud) {\n ubo.updateFloat(\"pointSize\", this.pointSize);\n }\n if (defines.SPECULARTERM) {\n ubo.updateColor4(\"vSpecularColor\", this.specularColor, this.specularPower);\n }\n ubo.updateColor3(\"vEmissiveColor\", StandardMaterial.EmissiveTextureEnabled ? this.emissiveColor : Color3.BlackReadOnly);\n ubo.updateColor4(\"vDiffuseColor\", this.diffuseColor, this.alpha);\n scene.ambientColor.multiplyToRef(this.ambientColor, this._globalAmbientColor);\n ubo.updateColor3(\"vAmbientColor\", this._globalAmbientColor);\n }\n // Textures\n if (scene.texturesEnabled) {\n if (this._diffuseTexture && StandardMaterial.DiffuseTextureEnabled) {\n effect.setTexture(\"diffuseSampler\", this._diffuseTexture);\n }\n if (this._ambientTexture && StandardMaterial.AmbientTextureEnabled) {\n effect.setTexture(\"ambientSampler\", this._ambientTexture);\n }\n if (this._opacityTexture && StandardMaterial.OpacityTextureEnabled) {\n effect.setTexture(\"opacitySampler\", this._opacityTexture);\n }\n if (this._reflectionTexture && StandardMaterial.ReflectionTextureEnabled) {\n if (this._reflectionTexture.isCube) {\n effect.setTexture(\"reflectionCubeSampler\", this._reflectionTexture);\n }\n else {\n effect.setTexture(\"reflection2DSampler\", this._reflectionTexture);\n }\n }\n if (this._emissiveTexture && StandardMaterial.EmissiveTextureEnabled) {\n effect.setTexture(\"emissiveSampler\", this._emissiveTexture);\n }\n if (this._lightmapTexture && StandardMaterial.LightmapTextureEnabled) {\n effect.setTexture(\"lightmapSampler\", this._lightmapTexture);\n }\n if (this._specularTexture && StandardMaterial.SpecularTextureEnabled) {\n effect.setTexture(\"specularSampler\", this._specularTexture);\n }\n if (this._bumpTexture && scene.getEngine().getCaps().standardDerivatives && StandardMaterial.BumpTextureEnabled) {\n effect.setTexture(\"bumpSampler\", this._bumpTexture);\n }\n if (this._refractionTexture && StandardMaterial.RefractionTextureEnabled) {\n if (this._refractionTexture.isCube) {\n effect.setTexture(\"refractionCubeSampler\", this._refractionTexture);\n }\n else {\n effect.setTexture(\"refraction2DSampler\", this._refractionTexture);\n }\n }\n }\n // OIT with depth peeling\n if (this.getScene().useOrderIndependentTransparency && this.needAlphaBlendingForMesh(mesh)) {\n this.getScene().depthPeelingRenderer.bind(effect);\n }\n this._eventInfo.subMesh = subMesh;\n this._callbackPluginEventBindForSubMesh(this._eventInfo);\n // Clip plane\n bindClipPlane(effect, this, scene);\n // Colors\n this.bindEyePosition(effect);\n }\n else if (scene.getEngine()._features.needToAlwaysBindUniformBuffers) {\n this._needToBindSceneUbo = true;\n }\n if (mustRebind || !this.isFrozen) {\n // Lights\n if (scene.lightsEnabled && !this._disableLighting) {\n MaterialHelper.BindLights(scene, mesh, effect, defines, this._maxSimultaneousLights);\n }\n // View\n if ((scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) ||\n this._reflectionTexture ||\n this._refractionTexture ||\n mesh.receiveShadows ||\n defines.PREPASS) {\n this.bindView(effect);\n }\n // Fog\n MaterialHelper.BindFogParameters(scene, mesh, effect);\n // Morph targets\n if (defines.NUM_MORPH_INFLUENCERS) {\n MaterialHelper.BindMorphTargetParameters(mesh, effect);\n }\n if (defines.BAKED_VERTEX_ANIMATION_TEXTURE) {\n (_a = mesh.bakedVertexAnimationManager) === null || _a === void 0 ? void 0 : _a.bind(effect, defines.INSTANCES);\n }\n // Log. depth\n if (this.useLogarithmicDepth) {\n MaterialHelper.BindLogDepth(defines, effect, scene);\n }\n // image processing\n if (this._imageProcessingConfiguration && !this._imageProcessingConfiguration.applyByPostProcess) {\n this._imageProcessingConfiguration.bind(this._activeEffect);\n }\n }\n this._afterBind(mesh, this._activeEffect);\n ubo.update();\n }\n /**\n * Get the list of animatables in the material.\n * @returns the list of animatables object used in the material\n */\n getAnimatables() {\n const results = super.getAnimatables();\n if (this._diffuseTexture && this._diffuseTexture.animations && this._diffuseTexture.animations.length > 0) {\n results.push(this._diffuseTexture);\n }\n if (this._ambientTexture && this._ambientTexture.animations && this._ambientTexture.animations.length > 0) {\n results.push(this._ambientTexture);\n }\n if (this._opacityTexture && this._opacityTexture.animations && this._opacityTexture.animations.length > 0) {\n results.push(this._opacityTexture);\n }\n if (this._reflectionTexture && this._reflectionTexture.animations && this._reflectionTexture.animations.length > 0) {\n results.push(this._reflectionTexture);\n }\n if (this._emissiveTexture && this._emissiveTexture.animations && this._emissiveTexture.animations.length > 0) {\n results.push(this._emissiveTexture);\n }\n if (this._specularTexture && this._specularTexture.animations && this._specularTexture.animations.length > 0) {\n results.push(this._specularTexture);\n }\n if (this._bumpTexture && this._bumpTexture.animations && this._bumpTexture.animations.length > 0) {\n results.push(this._bumpTexture);\n }\n if (this._lightmapTexture && this._lightmapTexture.animations && this._lightmapTexture.animations.length > 0) {\n results.push(this._lightmapTexture);\n }\n if (this._refractionTexture && this._refractionTexture.animations && this._refractionTexture.animations.length > 0) {\n results.push(this._refractionTexture);\n }\n return results;\n }\n /**\n * Gets the active textures from the material\n * @returns an array of textures\n */\n getActiveTextures() {\n const activeTextures = super.getActiveTextures();\n if (this._diffuseTexture) {\n activeTextures.push(this._diffuseTexture);\n }\n if (this._ambientTexture) {\n activeTextures.push(this._ambientTexture);\n }\n if (this._opacityTexture) {\n activeTextures.push(this._opacityTexture);\n }\n if (this._reflectionTexture) {\n activeTextures.push(this._reflectionTexture);\n }\n if (this._emissiveTexture) {\n activeTextures.push(this._emissiveTexture);\n }\n if (this._specularTexture) {\n activeTextures.push(this._specularTexture);\n }\n if (this._bumpTexture) {\n activeTextures.push(this._bumpTexture);\n }\n if (this._lightmapTexture) {\n activeTextures.push(this._lightmapTexture);\n }\n if (this._refractionTexture) {\n activeTextures.push(this._refractionTexture);\n }\n return activeTextures;\n }\n /**\n * Specifies if the material uses a texture\n * @param texture defines the texture to check against the material\n * @returns a boolean specifying if the material uses the texture\n */\n hasTexture(texture) {\n if (super.hasTexture(texture)) {\n return true;\n }\n if (this._diffuseTexture === texture) {\n return true;\n }\n if (this._ambientTexture === texture) {\n return true;\n }\n if (this._opacityTexture === texture) {\n return true;\n }\n if (this._reflectionTexture === texture) {\n return true;\n }\n if (this._emissiveTexture === texture) {\n return true;\n }\n if (this._specularTexture === texture) {\n return true;\n }\n if (this._bumpTexture === texture) {\n return true;\n }\n if (this._lightmapTexture === texture) {\n return true;\n }\n if (this._refractionTexture === texture) {\n return true;\n }\n return false;\n }\n /**\n * Disposes the material\n * @param forceDisposeEffect specifies if effects should be forcefully disposed\n * @param forceDisposeTextures specifies if textures should be forcefully disposed\n */\n dispose(forceDisposeEffect, forceDisposeTextures) {\n var _a, _b, _c, _d, _e, _f, _g, _h, _j;\n if (forceDisposeTextures) {\n (_a = this._diffuseTexture) === null || _a === void 0 ? void 0 : _a.dispose();\n (_b = this._ambientTexture) === null || _b === void 0 ? void 0 : _b.dispose();\n (_c = this._opacityTexture) === null || _c === void 0 ? void 0 : _c.dispose();\n (_d = this._reflectionTexture) === null || _d === void 0 ? void 0 : _d.dispose();\n (_e = this._emissiveTexture) === null || _e === void 0 ? void 0 : _e.dispose();\n (_f = this._specularTexture) === null || _f === void 0 ? void 0 : _f.dispose();\n (_g = this._bumpTexture) === null || _g === void 0 ? void 0 : _g.dispose();\n (_h = this._lightmapTexture) === null || _h === void 0 ? void 0 : _h.dispose();\n (_j = this._refractionTexture) === null || _j === void 0 ? void 0 : _j.dispose();\n }\n if (this._imageProcessingConfiguration && this._imageProcessingObserver) {\n this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver);\n }\n super.dispose(forceDisposeEffect, forceDisposeTextures);\n }\n /**\n * Makes a duplicate of the material, and gives it a new name\n * @param name defines the new name for the duplicated material\n * @param cloneTexturesOnlyOnce - if a texture is used in more than one channel (e.g diffuse and opacity), only clone it once and reuse it on the other channels. Default false.\n * @param rootUrl defines the root URL to use to load textures\n * @returns the cloned material\n */\n clone(name, cloneTexturesOnlyOnce = true, rootUrl = \"\") {\n const result = SerializationHelper.Clone(() => new StandardMaterial(name, this.getScene()), this, { cloneTexturesOnlyOnce });\n result.name = name;\n result.id = name;\n this.stencil.copyTo(result.stencil);\n this._clonePlugins(result, rootUrl);\n return result;\n }\n /**\n * Creates a standard material from parsed material data\n * @param source defines the JSON representation of the material\n * @param scene defines the hosting scene\n * @param rootUrl defines the root URL to use to load textures and relative dependencies\n * @returns a new standard material\n */\n static Parse(source, scene, rootUrl) {\n const material = SerializationHelper.Parse(() => new StandardMaterial(source.name, scene), source, scene, rootUrl);\n if (source.stencil) {\n material.stencil.parse(source.stencil, scene, rootUrl);\n }\n Material._parsePlugins(source, material, scene, rootUrl);\n return material;\n }\n // Flags used to enable or disable a type of texture for all Standard Materials\n /**\n * Are diffuse textures enabled in the application.\n */\n static get DiffuseTextureEnabled() {\n return MaterialFlags.DiffuseTextureEnabled;\n }\n static set DiffuseTextureEnabled(value) {\n MaterialFlags.DiffuseTextureEnabled = value;\n }\n /**\n * Are detail textures enabled in the application.\n */\n static get DetailTextureEnabled() {\n return MaterialFlags.DetailTextureEnabled;\n }\n static set DetailTextureEnabled(value) {\n MaterialFlags.DetailTextureEnabled = value;\n }\n /**\n * Are ambient textures enabled in the application.\n */\n static get AmbientTextureEnabled() {\n return MaterialFlags.AmbientTextureEnabled;\n }\n static set AmbientTextureEnabled(value) {\n MaterialFlags.AmbientTextureEnabled = value;\n }\n /**\n * Are opacity textures enabled in the application.\n */\n static get OpacityTextureEnabled() {\n return MaterialFlags.OpacityTextureEnabled;\n }\n static set OpacityTextureEnabled(value) {\n MaterialFlags.OpacityTextureEnabled = value;\n }\n /**\n * Are reflection textures enabled in the application.\n */\n static get ReflectionTextureEnabled() {\n return MaterialFlags.ReflectionTextureEnabled;\n }\n static set ReflectionTextureEnabled(value) {\n MaterialFlags.ReflectionTextureEnabled = value;\n }\n /**\n * Are emissive textures enabled in the application.\n */\n static get EmissiveTextureEnabled() {\n return MaterialFlags.EmissiveTextureEnabled;\n }\n static set EmissiveTextureEnabled(value) {\n MaterialFlags.EmissiveTextureEnabled = value;\n }\n /**\n * Are specular textures enabled in the application.\n */\n static get SpecularTextureEnabled() {\n return MaterialFlags.SpecularTextureEnabled;\n }\n static set SpecularTextureEnabled(value) {\n MaterialFlags.SpecularTextureEnabled = value;\n }\n /**\n * Are bump textures enabled in the application.\n */\n static get BumpTextureEnabled() {\n return MaterialFlags.BumpTextureEnabled;\n }\n static set BumpTextureEnabled(value) {\n MaterialFlags.BumpTextureEnabled = value;\n }\n /**\n * Are lightmap textures enabled in the application.\n */\n static get LightmapTextureEnabled() {\n return MaterialFlags.LightmapTextureEnabled;\n }\n static set LightmapTextureEnabled(value) {\n MaterialFlags.LightmapTextureEnabled = value;\n }\n /**\n * Are refraction textures enabled in the application.\n */\n static get RefractionTextureEnabled() {\n return MaterialFlags.RefractionTextureEnabled;\n }\n static set RefractionTextureEnabled(value) {\n MaterialFlags.RefractionTextureEnabled = value;\n }\n /**\n * Are color grading textures enabled in the application.\n */\n static get ColorGradingTextureEnabled() {\n return MaterialFlags.ColorGradingTextureEnabled;\n }\n static set ColorGradingTextureEnabled(value) {\n MaterialFlags.ColorGradingTextureEnabled = value;\n }\n /**\n * Are fresnels enabled in the application.\n */\n static get FresnelEnabled() {\n return MaterialFlags.FresnelEnabled;\n }\n static set FresnelEnabled(value) {\n MaterialFlags.FresnelEnabled = value;\n }\n}\n__decorate([\n serializeAsTexture(\"diffuseTexture\")\n], StandardMaterial.prototype, \"_diffuseTexture\", void 0);\n__decorate([\n expandToProperty(\"_markAllSubMeshesAsTexturesAndMiscDirty\")\n], StandardMaterial.prototype, \"diffuseTexture\", void 0);\n__decorate([\n serializeAsTexture(\"ambientTexture\")\n], StandardMaterial.prototype, \"_ambientTexture\", void 0);\n__decorate([\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], StandardMaterial.prototype, \"ambientTexture\", void 0);\n__decorate([\n serializeAsTexture(\"opacityTexture\")\n], StandardMaterial.prototype, \"_opacityTexture\", void 0);\n__decorate([\n expandToProperty(\"_markAllSubMeshesAsTexturesAndMiscDirty\")\n], StandardMaterial.prototype, \"opacityTexture\", void 0);\n__decorate([\n serializeAsTexture(\"reflectionTexture\")\n], StandardMaterial.prototype, \"_reflectionTexture\", void 0);\n__decorate([\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], StandardMaterial.prototype, \"reflectionTexture\", void 0);\n__decorate([\n serializeAsTexture(\"emissiveTexture\")\n], StandardMaterial.prototype, \"_emissiveTexture\", void 0);\n__decorate([\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], StandardMaterial.prototype, \"emissiveTexture\", void 0);\n__decorate([\n serializeAsTexture(\"specularTexture\")\n], StandardMaterial.prototype, \"_specularTexture\", void 0);\n__decorate([\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], StandardMaterial.prototype, \"specularTexture\", void 0);\n__decorate([\n serializeAsTexture(\"bumpTexture\")\n], StandardMaterial.prototype, \"_bumpTexture\", void 0);\n__decorate([\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], StandardMaterial.prototype, \"bumpTexture\", void 0);\n__decorate([\n serializeAsTexture(\"lightmapTexture\")\n], StandardMaterial.prototype, \"_lightmapTexture\", void 0);\n__decorate([\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], StandardMaterial.prototype, \"lightmapTexture\", void 0);\n__decorate([\n serializeAsTexture(\"refractionTexture\")\n], StandardMaterial.prototype, \"_refractionTexture\", void 0);\n__decorate([\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], StandardMaterial.prototype, \"refractionTexture\", void 0);\n__decorate([\n serializeAsColor3(\"ambient\")\n], StandardMaterial.prototype, \"ambientColor\", void 0);\n__decorate([\n serializeAsColor3(\"diffuse\")\n], StandardMaterial.prototype, \"diffuseColor\", void 0);\n__decorate([\n serializeAsColor3(\"specular\")\n], StandardMaterial.prototype, \"specularColor\", void 0);\n__decorate([\n serializeAsColor3(\"emissive\")\n], StandardMaterial.prototype, \"emissiveColor\", void 0);\n__decorate([\n serialize()\n], StandardMaterial.prototype, \"specularPower\", void 0);\n__decorate([\n serialize(\"useAlphaFromDiffuseTexture\")\n], StandardMaterial.prototype, \"_useAlphaFromDiffuseTexture\", void 0);\n__decorate([\n expandToProperty(\"_markAllSubMeshesAsTexturesAndMiscDirty\")\n], StandardMaterial.prototype, \"useAlphaFromDiffuseTexture\", void 0);\n__decorate([\n serialize(\"useEmissiveAsIllumination\")\n], StandardMaterial.prototype, \"_useEmissiveAsIllumination\", void 0);\n__decorate([\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], StandardMaterial.prototype, \"useEmissiveAsIllumination\", void 0);\n__decorate([\n serialize(\"linkEmissiveWithDiffuse\")\n], StandardMaterial.prototype, \"_linkEmissiveWithDiffuse\", void 0);\n__decorate([\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], StandardMaterial.prototype, \"linkEmissiveWithDiffuse\", void 0);\n__decorate([\n serialize(\"useSpecularOverAlpha\")\n], StandardMaterial.prototype, \"_useSpecularOverAlpha\", void 0);\n__decorate([\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], StandardMaterial.prototype, \"useSpecularOverAlpha\", void 0);\n__decorate([\n serialize(\"useReflectionOverAlpha\")\n], StandardMaterial.prototype, \"_useReflectionOverAlpha\", void 0);\n__decorate([\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], StandardMaterial.prototype, \"useReflectionOverAlpha\", void 0);\n__decorate([\n serialize(\"disableLighting\")\n], StandardMaterial.prototype, \"_disableLighting\", void 0);\n__decorate([\n expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\n], StandardMaterial.prototype, \"disableLighting\", void 0);\n__decorate([\n serialize(\"useObjectSpaceNormalMap\")\n], StandardMaterial.prototype, \"_useObjectSpaceNormalMap\", void 0);\n__decorate([\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], StandardMaterial.prototype, \"useObjectSpaceNormalMap\", void 0);\n__decorate([\n serialize(\"useParallax\")\n], StandardMaterial.prototype, \"_useParallax\", void 0);\n__decorate([\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], StandardMaterial.prototype, \"useParallax\", void 0);\n__decorate([\n serialize(\"useParallaxOcclusion\")\n], StandardMaterial.prototype, \"_useParallaxOcclusion\", void 0);\n__decorate([\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], StandardMaterial.prototype, \"useParallaxOcclusion\", void 0);\n__decorate([\n serialize()\n], StandardMaterial.prototype, \"parallaxScaleBias\", void 0);\n__decorate([\n serialize(\"roughness\")\n], StandardMaterial.prototype, \"_roughness\", void 0);\n__decorate([\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], StandardMaterial.prototype, \"roughness\", void 0);\n__decorate([\n serialize()\n], StandardMaterial.prototype, \"indexOfRefraction\", void 0);\n__decorate([\n serialize()\n], StandardMaterial.prototype, \"invertRefractionY\", void 0);\n__decorate([\n serialize()\n], StandardMaterial.prototype, \"alphaCutOff\", void 0);\n__decorate([\n serialize(\"useLightmapAsShadowmap\")\n], StandardMaterial.prototype, \"_useLightmapAsShadowmap\", void 0);\n__decorate([\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], StandardMaterial.prototype, \"useLightmapAsShadowmap\", void 0);\n__decorate([\n serializeAsFresnelParameters(\"diffuseFresnelParameters\")\n], StandardMaterial.prototype, \"_diffuseFresnelParameters\", void 0);\n__decorate([\n expandToProperty(\"_markAllSubMeshesAsFresnelDirty\")\n], StandardMaterial.prototype, \"diffuseFresnelParameters\", void 0);\n__decorate([\n serializeAsFresnelParameters(\"opacityFresnelParameters\")\n], StandardMaterial.prototype, \"_opacityFresnelParameters\", void 0);\n__decorate([\n expandToProperty(\"_markAllSubMeshesAsFresnelAndMiscDirty\")\n], StandardMaterial.prototype, \"opacityFresnelParameters\", void 0);\n__decorate([\n serializeAsFresnelParameters(\"reflectionFresnelParameters\")\n], StandardMaterial.prototype, \"_reflectionFresnelParameters\", void 0);\n__decorate([\n expandToProperty(\"_markAllSubMeshesAsFresnelDirty\")\n], StandardMaterial.prototype, \"reflectionFresnelParameters\", void 0);\n__decorate([\n serializeAsFresnelParameters(\"refractionFresnelParameters\")\n], StandardMaterial.prototype, \"_refractionFresnelParameters\", void 0);\n__decorate([\n expandToProperty(\"_markAllSubMeshesAsFresnelDirty\")\n], StandardMaterial.prototype, \"refractionFresnelParameters\", void 0);\n__decorate([\n serializeAsFresnelParameters(\"emissiveFresnelParameters\")\n], StandardMaterial.prototype, \"_emissiveFresnelParameters\", void 0);\n__decorate([\n expandToProperty(\"_markAllSubMeshesAsFresnelDirty\")\n], StandardMaterial.prototype, \"emissiveFresnelParameters\", void 0);\n__decorate([\n serialize(\"useReflectionFresnelFromSpecular\")\n], StandardMaterial.prototype, \"_useReflectionFresnelFromSpecular\", void 0);\n__decorate([\n expandToProperty(\"_markAllSubMeshesAsFresnelDirty\")\n], StandardMaterial.prototype, \"useReflectionFresnelFromSpecular\", void 0);\n__decorate([\n serialize(\"useGlossinessFromSpecularMapAlpha\")\n], StandardMaterial.prototype, \"_useGlossinessFromSpecularMapAlpha\", void 0);\n__decorate([\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], StandardMaterial.prototype, \"useGlossinessFromSpecularMapAlpha\", void 0);\n__decorate([\n serialize(\"maxSimultaneousLights\")\n], StandardMaterial.prototype, \"_maxSimultaneousLights\", void 0);\n__decorate([\n expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\n], StandardMaterial.prototype, \"maxSimultaneousLights\", void 0);\n__decorate([\n serialize(\"invertNormalMapX\")\n], StandardMaterial.prototype, \"_invertNormalMapX\", void 0);\n__decorate([\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], StandardMaterial.prototype, \"invertNormalMapX\", void 0);\n__decorate([\n serialize(\"invertNormalMapY\")\n], StandardMaterial.prototype, \"_invertNormalMapY\", void 0);\n__decorate([\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], StandardMaterial.prototype, \"invertNormalMapY\", void 0);\n__decorate([\n serialize(\"twoSidedLighting\")\n], StandardMaterial.prototype, \"_twoSidedLighting\", void 0);\n__decorate([\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], StandardMaterial.prototype, \"twoSidedLighting\", void 0);\n__decorate([\n serialize(\"applyDecalMapAfterDetailMap\")\n], StandardMaterial.prototype, \"_applyDecalMapAfterDetailMap\", void 0);\n__decorate([\n expandToProperty(\"_markAllSubMeshesAsMiscDirty\")\n], StandardMaterial.prototype, \"applyDecalMapAfterDetailMap\", void 0);\n__decorate([\n serialize()\n], StandardMaterial.prototype, \"useLogarithmicDepth\", null);\nRegisterClass(\"BABYLON.StandardMaterial\", StandardMaterial);\nScene.DefaultMaterialFactory = (scene) => {\n return new StandardMaterial(\"default material\", scene);\n};\n//# sourceMappingURL=standardMaterial.js.map","import { Observable } from \"../Misc/observable.js\";\nimport { Vector2, Vector3 } from \"../Maths/math.vector.js\";\nimport { Color3, Color4 } from \"../Maths/math.color.js\";\nimport { RegisterClass } from \"../Misc/typeStore.js\";\n/**\n * The action to be carried out following a trigger\n * @see https://doc.babylonjs.com/features/featuresDeepDive/events/actions#available-actions\n */\nexport class Action {\n /**\n * Creates a new Action\n * @param triggerOptions the trigger, with or without parameters, for the action\n * @param condition an optional determinant of action\n */\n constructor(\n /** the trigger, with or without parameters, for the action */\n triggerOptions, condition) {\n this.triggerOptions = triggerOptions;\n /**\n * An event triggered prior to action being executed.\n */\n this.onBeforeExecuteObservable = new Observable();\n if (triggerOptions.parameter) {\n this.trigger = triggerOptions.trigger;\n this._triggerParameter = triggerOptions.parameter;\n }\n else if (triggerOptions.trigger) {\n this.trigger = triggerOptions.trigger;\n }\n else {\n this.trigger = triggerOptions;\n }\n this._nextActiveAction = this;\n this._condition = condition;\n }\n /**\n * Internal only\n * @internal\n */\n _prepare() { }\n /**\n * Gets the trigger parameter\n * @returns the trigger parameter\n */\n getTriggerParameter() {\n return this._triggerParameter;\n }\n /**\n * Sets the trigger parameter\n * @param value defines the new trigger parameter\n */\n setTriggerParameter(value) {\n this._triggerParameter = value;\n }\n /**\n * Internal only - Returns if the current condition allows to run the action\n * @internal\n */\n _evaluateConditionForCurrentFrame() {\n const condition = this._condition;\n if (!condition) {\n return true;\n }\n const currentRenderId = this._actionManager.getScene().getRenderId();\n // We cache the current evaluation for the current frame\n if (condition._evaluationId !== currentRenderId) {\n condition._evaluationId = currentRenderId;\n condition._currentResult = condition.isValid();\n }\n return condition._currentResult;\n }\n /**\n * Internal only - executes current action event\n * @internal\n */\n _executeCurrent(evt) {\n const isConditionValid = this._evaluateConditionForCurrentFrame();\n if (!isConditionValid) {\n return;\n }\n this.onBeforeExecuteObservable.notifyObservers(this);\n this._nextActiveAction.execute(evt);\n this.skipToNextActiveAction();\n }\n /**\n * Execute placeholder for child classes\n * @param evt optional action event\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n execute(evt) { }\n /**\n * Skips to next active action\n */\n skipToNextActiveAction() {\n if (this._nextActiveAction._child) {\n if (!this._nextActiveAction._child._actionManager) {\n this._nextActiveAction._child._actionManager = this._actionManager;\n }\n this._nextActiveAction = this._nextActiveAction._child;\n }\n else {\n this._nextActiveAction = this;\n }\n }\n /**\n * Adds action to chain of actions, may be a DoNothingAction\n * @param action defines the next action to execute\n * @returns The action passed in\n * @see https://www.babylonjs-playground.com/#1T30HR#0\n */\n then(action) {\n this._child = action;\n action._actionManager = this._actionManager;\n action._prepare();\n return action;\n }\n /**\n * Internal only\n * @internal\n */\n _getProperty(propertyPath) {\n return this._actionManager._getProperty(propertyPath);\n }\n /**\n * @internal\n */\n _getEffectiveTarget(target, propertyPath) {\n return this._actionManager._getEffectiveTarget(target, propertyPath);\n }\n /**\n * Serialize placeholder for child classes\n * @param parent of child\n * @returns the serialized object\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n serialize(parent) { }\n /**\n * Internal only called by serialize\n * @internal\n */\n _serialize(serializedAction, parent) {\n const serializationObject = {\n type: 1,\n children: [],\n name: serializedAction.name,\n properties: serializedAction.properties || [],\n };\n // Serialize child\n if (this._child) {\n this._child.serialize(serializationObject);\n }\n // Check if \"this\" has a condition\n if (this._condition) {\n const serializedCondition = this._condition.serialize();\n serializedCondition.children.push(serializationObject);\n if (parent) {\n parent.children.push(serializedCondition);\n }\n return serializedCondition;\n }\n if (parent) {\n parent.children.push(serializationObject);\n }\n return serializationObject;\n }\n}\n/**\n * Internal only\n * @internal\n */\nAction._SerializeValueAsString = (value) => {\n if (typeof value === \"number\") {\n return value.toString();\n }\n if (typeof value === \"boolean\") {\n return value ? \"true\" : \"false\";\n }\n if (value instanceof Vector2) {\n return value.x + \", \" + value.y;\n }\n if (value instanceof Vector3) {\n return value.x + \", \" + value.y + \", \" + value.z;\n }\n if (value instanceof Color3) {\n return value.r + \", \" + value.g + \", \" + value.b;\n }\n if (value instanceof Color4) {\n return value.r + \", \" + value.g + \", \" + value.b + \", \" + value.a;\n }\n return value; // string\n};\n/**\n * Internal only\n * @internal\n */\nAction._GetTargetProperty = (target) => {\n return {\n name: \"target\",\n targetType: target._isMesh\n ? \"MeshProperties\"\n : target._isLight\n ? \"LightProperties\"\n : target._isCamera\n ? \"CameraProperties\"\n : target._isMaterial\n ? \"MaterialProperties\"\n : \"SceneProperties\",\n value: target._isScene ? \"Scene\" : target.name,\n };\n};\nRegisterClass(\"BABYLON.Action\", Action);\n//# sourceMappingURL=action.js.map","import { Action } from \"./action.js\";\nimport { RegisterClass } from \"../Misc/typeStore.js\";\n/**\n * A Condition applied to an Action\n */\nexport class Condition {\n /**\n * Creates a new Condition\n * @param actionManager the manager of the action the condition is applied to\n */\n constructor(actionManager) {\n this._actionManager = actionManager;\n }\n /**\n * Check if the current condition is valid\n * @returns a boolean\n */\n isValid() {\n return true;\n }\n /**\n * @internal\n */\n _getProperty(propertyPath) {\n return this._actionManager._getProperty(propertyPath);\n }\n /**\n * @internal\n */\n _getEffectiveTarget(target, propertyPath) {\n return this._actionManager._getEffectiveTarget(target, propertyPath);\n }\n /**\n * Serialize placeholder for child classes\n * @returns the serialized object\n */\n serialize() { }\n /**\n * @internal\n */\n _serialize(serializedCondition) {\n return {\n type: 2,\n children: [],\n name: serializedCondition.name,\n properties: serializedCondition.properties,\n };\n }\n}\n/**\n * Defines specific conditional operators as extensions of Condition\n */\nexport class ValueCondition extends Condition {\n /**\n * returns the number for IsEqual\n */\n static get IsEqual() {\n return ValueCondition._IsEqual;\n }\n /**\n * Returns the number for IsDifferent\n */\n static get IsDifferent() {\n return ValueCondition._IsDifferent;\n }\n /**\n * Returns the number for IsGreater\n */\n static get IsGreater() {\n return ValueCondition._IsGreater;\n }\n /**\n * Returns the number for IsLesser\n */\n static get IsLesser() {\n return ValueCondition._IsLesser;\n }\n /**\n * Creates a new ValueCondition\n * @param actionManager manager for the action the condition applies to\n * @param target for the action\n * @param propertyPath path to specify the property of the target the conditional operator uses\n * @param value the value compared by the conditional operator against the current value of the property\n * @param operator the conditional operator, default ValueCondition.IsEqual\n */\n constructor(actionManager, target, \n /** path to specify the property of the target the conditional operator uses */\n propertyPath, \n /** the value compared by the conditional operator against the current value of the property */\n value, \n /** the conditional operator, default ValueCondition.IsEqual */\n operator = ValueCondition.IsEqual) {\n super(actionManager);\n this.propertyPath = propertyPath;\n this.value = value;\n this.operator = operator;\n this._target = target;\n this._effectiveTarget = this._getEffectiveTarget(target, this.propertyPath);\n this._property = this._getProperty(this.propertyPath);\n }\n /**\n * Compares the given value with the property value for the specified conditional operator\n * @returns the result of the comparison\n */\n isValid() {\n switch (this.operator) {\n case ValueCondition.IsGreater:\n return this._effectiveTarget[this._property] > this.value;\n case ValueCondition.IsLesser:\n return this._effectiveTarget[this._property] < this.value;\n case ValueCondition.IsEqual:\n case ValueCondition.IsDifferent: {\n let check;\n if (this.value.equals) {\n check = this.value.equals(this._effectiveTarget[this._property]);\n }\n else {\n check = this.value === this._effectiveTarget[this._property];\n }\n return this.operator === ValueCondition.IsEqual ? check : !check;\n }\n }\n return false;\n }\n /**\n * Serialize the ValueCondition into a JSON compatible object\n * @returns serialization object\n */\n serialize() {\n return this._serialize({\n name: \"ValueCondition\",\n properties: [\n Action._GetTargetProperty(this._target),\n { name: \"propertyPath\", value: this.propertyPath },\n { name: \"value\", value: Action._SerializeValueAsString(this.value) },\n { name: \"operator\", value: ValueCondition.GetOperatorName(this.operator) },\n ],\n });\n }\n /**\n * Gets the name of the conditional operator for the ValueCondition\n * @param operator the conditional operator\n * @returns the name\n */\n static GetOperatorName(operator) {\n switch (operator) {\n case ValueCondition._IsEqual:\n return \"IsEqual\";\n case ValueCondition._IsDifferent:\n return \"IsDifferent\";\n case ValueCondition._IsGreater:\n return \"IsGreater\";\n case ValueCondition._IsLesser:\n return \"IsLesser\";\n default:\n return \"\";\n }\n }\n}\nValueCondition._IsEqual = 0;\nValueCondition._IsDifferent = 1;\nValueCondition._IsGreater = 2;\nValueCondition._IsLesser = 3;\n/**\n * Defines a predicate condition as an extension of Condition\n */\nexport class PredicateCondition extends Condition {\n /**\n * Creates a new PredicateCondition\n * @param actionManager manager for the action the condition applies to\n * @param predicate defines the predicate function used to validate the condition\n */\n constructor(actionManager, \n /** defines the predicate function used to validate the condition */\n predicate) {\n super(actionManager);\n this.predicate = predicate;\n }\n /**\n * @returns the validity of the predicate condition\n */\n isValid() {\n return this.predicate();\n }\n}\n/**\n * Defines a state condition as an extension of Condition\n */\nexport class StateCondition extends Condition {\n /**\n * Creates a new StateCondition\n * @param actionManager manager for the action the condition applies to\n * @param target of the condition\n * @param value to compare with target state\n */\n constructor(actionManager, target, \n /** Value to compare with target state */\n value) {\n super(actionManager);\n this.value = value;\n this._target = target;\n }\n /**\n * Gets a boolean indicating if the current condition is met\n * @returns the validity of the state\n */\n isValid() {\n return this._target.state === this.value;\n }\n /**\n * Serialize the StateCondition into a JSON compatible object\n * @returns serialization object\n */\n serialize() {\n return this._serialize({\n name: \"StateCondition\",\n properties: [Action._GetTargetProperty(this._target), { name: \"value\", value: this.value }],\n });\n }\n}\nRegisterClass(\"BABYLON.ValueCondition\", ValueCondition);\nRegisterClass(\"BABYLON.PredicateCondition\", PredicateCondition);\nRegisterClass(\"BABYLON.StateCondition\", StateCondition);\n//# sourceMappingURL=condition.js.map","import { Logger } from \"../Misc/logger.js\";\nimport { Vector3 } from \"../Maths/math.vector.js\";\nimport { Action } from \"./action.js\";\n\nimport { RegisterClass } from \"../Misc/typeStore.js\";\n/**\n * This defines an action responsible to toggle a boolean once triggered.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/events/actions\n */\nexport class SwitchBooleanAction extends Action {\n /**\n * Instantiate the action\n * @param triggerOptions defines the trigger options\n * @param target defines the object containing the boolean\n * @param propertyPath defines the path to the boolean property in the target object\n * @param condition defines the trigger related conditions\n */\n constructor(triggerOptions, target, propertyPath, condition) {\n super(triggerOptions, condition);\n this.propertyPath = propertyPath;\n this._target = this._effectiveTarget = target;\n }\n /** @internal */\n _prepare() {\n this._effectiveTarget = this._getEffectiveTarget(this._effectiveTarget, this.propertyPath);\n this._property = this._getProperty(this.propertyPath);\n }\n /**\n * Execute the action toggle the boolean value.\n */\n execute() {\n this._effectiveTarget[this._property] = !this._effectiveTarget[this._property];\n }\n /**\n * Serializes the actions and its related information.\n * @param parent defines the object to serialize in\n * @returns the serialized object\n */\n serialize(parent) {\n return super._serialize({\n name: \"SwitchBooleanAction\",\n properties: [Action._GetTargetProperty(this._target), { name: \"propertyPath\", value: this.propertyPath }],\n }, parent);\n }\n}\n/**\n * This defines an action responsible to set a the state field of the target\n * to a desired value once triggered.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/events/actions\n */\nexport class SetStateAction extends Action {\n /**\n * Instantiate the action\n * @param triggerOptions defines the trigger options\n * @param target defines the object containing the state property\n * @param value defines the value to store in the state field\n * @param condition defines the trigger related conditions\n */\n constructor(triggerOptions, target, value, condition) {\n super(triggerOptions, condition);\n this.value = value;\n this._target = target;\n }\n /**\n * Execute the action and store the value on the target state property.\n */\n execute() {\n this._target.state = this.value;\n }\n /**\n * Serializes the actions and its related information.\n * @param parent defines the object to serialize in\n * @returns the serialized object\n */\n serialize(parent) {\n return super._serialize({\n name: \"SetStateAction\",\n properties: [Action._GetTargetProperty(this._target), { name: \"value\", value: this.value }],\n }, parent);\n }\n}\n/**\n * This defines an action responsible to set a property of the target\n * to a desired value once triggered.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/events/actions\n */\nexport class SetValueAction extends Action {\n /**\n * Instantiate the action\n * @param triggerOptions defines the trigger options\n * @param target defines the object containing the property\n * @param propertyPath defines the path of the property to set in the target\n * @param value defines the value to set in the property\n * @param condition defines the trigger related conditions\n */\n constructor(triggerOptions, target, propertyPath, value, condition) {\n super(triggerOptions, condition);\n this.propertyPath = propertyPath;\n this.value = value;\n this._target = this._effectiveTarget = target;\n }\n /** @internal */\n _prepare() {\n this._effectiveTarget = this._getEffectiveTarget(this._effectiveTarget, this.propertyPath);\n this._property = this._getProperty(this.propertyPath);\n }\n /**\n * Execute the action and set the targeted property to the desired value.\n */\n execute() {\n this._effectiveTarget[this._property] = this.value;\n if (this._target.markAsDirty) {\n this._target.markAsDirty(this._property);\n }\n }\n /**\n * Serializes the actions and its related information.\n * @param parent defines the object to serialize in\n * @returns the serialized object\n */\n serialize(parent) {\n return super._serialize({\n name: \"SetValueAction\",\n properties: [\n Action._GetTargetProperty(this._target),\n { name: \"propertyPath\", value: this.propertyPath },\n { name: \"value\", value: Action._SerializeValueAsString(this.value) },\n ],\n }, parent);\n }\n}\n/**\n * This defines an action responsible to increment the target value\n * to a desired value once triggered.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/events/actions\n */\nexport class IncrementValueAction extends Action {\n /**\n * Instantiate the action\n * @param triggerOptions defines the trigger options\n * @param target defines the object containing the property\n * @param propertyPath defines the path of the property to increment in the target\n * @param value defines the value value we should increment the property by\n * @param condition defines the trigger related conditions\n */\n constructor(triggerOptions, target, propertyPath, value, condition) {\n super(triggerOptions, condition);\n this.propertyPath = propertyPath;\n this.value = value;\n this._target = this._effectiveTarget = target;\n }\n /** @internal */\n _prepare() {\n this._effectiveTarget = this._getEffectiveTarget(this._effectiveTarget, this.propertyPath);\n this._property = this._getProperty(this.propertyPath);\n if (typeof this._effectiveTarget[this._property] !== \"number\") {\n Logger.Warn(\"Warning: IncrementValueAction can only be used with number values\");\n }\n }\n /**\n * Execute the action and increment the target of the value amount.\n */\n execute() {\n this._effectiveTarget[this._property] += this.value;\n if (this._target.markAsDirty) {\n this._target.markAsDirty(this._property);\n }\n }\n /**\n * Serializes the actions and its related information.\n * @param parent defines the object to serialize in\n * @returns the serialized object\n */\n serialize(parent) {\n return super._serialize({\n name: \"IncrementValueAction\",\n properties: [\n Action._GetTargetProperty(this._target),\n { name: \"propertyPath\", value: this.propertyPath },\n { name: \"value\", value: Action._SerializeValueAsString(this.value) },\n ],\n }, parent);\n }\n}\n/**\n * This defines an action responsible to start an animation once triggered.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/events/actions\n */\nexport class PlayAnimationAction extends Action {\n /**\n * Instantiate the action\n * @param triggerOptions defines the trigger options\n * @param target defines the target animation or animation name\n * @param from defines from where the animation should start (animation frame)\n * @param to defines where the animation should stop (animation frame)\n * @param loop defines if the animation should loop or stop after the first play\n * @param condition defines the trigger related conditions\n */\n constructor(triggerOptions, target, from, to, loop, condition) {\n super(triggerOptions, condition);\n this.from = from;\n this.to = to;\n this.loop = loop;\n this._target = target;\n }\n /** @internal */\n _prepare() { }\n /**\n * Execute the action and play the animation.\n */\n execute() {\n const scene = this._actionManager.getScene();\n scene.beginAnimation(this._target, this.from, this.to, this.loop);\n }\n /**\n * Serializes the actions and its related information.\n * @param parent defines the object to serialize in\n * @returns the serialized object\n */\n serialize(parent) {\n return super._serialize({\n name: \"PlayAnimationAction\",\n properties: [\n Action._GetTargetProperty(this._target),\n { name: \"from\", value: String(this.from) },\n { name: \"to\", value: String(this.to) },\n { name: \"loop\", value: Action._SerializeValueAsString(this.loop) || false },\n ],\n }, parent);\n }\n}\n/**\n * This defines an action responsible to stop an animation once triggered.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/events/actions\n */\nexport class StopAnimationAction extends Action {\n /**\n * Instantiate the action\n * @param triggerOptions defines the trigger options\n * @param target defines the target animation or animation name\n * @param condition defines the trigger related conditions\n */\n constructor(triggerOptions, target, condition) {\n super(triggerOptions, condition);\n this._target = target;\n }\n /** @internal */\n _prepare() { }\n /**\n * Execute the action and stop the animation.\n */\n execute() {\n const scene = this._actionManager.getScene();\n scene.stopAnimation(this._target);\n }\n /**\n * Serializes the actions and its related information.\n * @param parent defines the object to serialize in\n * @returns the serialized object\n */\n serialize(parent) {\n return super._serialize({\n name: \"StopAnimationAction\",\n properties: [Action._GetTargetProperty(this._target)],\n }, parent);\n }\n}\n/**\n * This defines an action responsible that does nothing once triggered.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/events/actions\n */\nexport class DoNothingAction extends Action {\n /**\n * Instantiate the action\n * @param triggerOptions defines the trigger options\n * @param condition defines the trigger related conditions\n */\n constructor(triggerOptions = 0, condition) {\n super(triggerOptions, condition);\n }\n /**\n * Execute the action and do nothing.\n */\n execute() { }\n /**\n * Serializes the actions and its related information.\n * @param parent defines the object to serialize in\n * @returns the serialized object\n */\n serialize(parent) {\n return super._serialize({\n name: \"DoNothingAction\",\n properties: [],\n }, parent);\n }\n}\n/**\n * This defines an action responsible to trigger several actions once triggered.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/events/actions\n */\nexport class CombineAction extends Action {\n /**\n * Instantiate the action\n * @param triggerOptions defines the trigger options\n * @param children defines the list of aggregated animations to run\n * @param condition defines the trigger related conditions\n * @param enableChildrenConditions defines if the children actions conditions should be check before execution\n */\n constructor(triggerOptions, children, condition, enableChildrenConditions = true) {\n super(triggerOptions, condition);\n this.children = children;\n this.enableChildrenConditions = enableChildrenConditions;\n }\n /** @internal */\n _prepare() {\n for (let index = 0; index < this.children.length; index++) {\n this.children[index]._actionManager = this._actionManager;\n this.children[index]._prepare();\n }\n }\n /**\n * Execute the action and executes all the aggregated actions.\n * @param evt\n */\n execute(evt) {\n for (const action of this.children) {\n if (!this.enableChildrenConditions || action._evaluateConditionForCurrentFrame()) {\n action.execute(evt);\n }\n }\n }\n /**\n * Serializes the actions and its related information.\n * @param parent defines the object to serialize in\n * @returns the serialized object\n */\n serialize(parent) {\n const serializationObject = super._serialize({\n name: \"CombineAction\",\n properties: [],\n combine: [],\n }, parent);\n for (let i = 0; i < this.children.length; i++) {\n serializationObject.combine.push(this.children[i].serialize(null));\n }\n return serializationObject;\n }\n}\n/**\n * This defines an action responsible to run code (external event) once triggered.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/events/actions\n */\nexport class ExecuteCodeAction extends Action {\n /**\n * Instantiate the action\n * @param triggerOptions defines the trigger options\n * @param func defines the callback function to run\n * @param condition defines the trigger related conditions\n */\n constructor(triggerOptions, func, condition) {\n super(triggerOptions, condition);\n this.func = func;\n }\n /**\n * Execute the action and run the attached code.\n * @param evt\n */\n execute(evt) {\n this.func(evt);\n }\n}\n/**\n * This defines an action responsible to set the parent property of the target once triggered.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/events/actions\n */\nexport class SetParentAction extends Action {\n /**\n * Instantiate the action\n * @param triggerOptions defines the trigger options\n * @param target defines the target containing the parent property\n * @param parent defines from where the animation should start (animation frame)\n * @param condition defines the trigger related conditions\n */\n constructor(triggerOptions, target, parent, condition) {\n super(triggerOptions, condition);\n this._target = target;\n this._parent = parent;\n }\n /** @internal */\n _prepare() { }\n /**\n * Execute the action and set the parent property.\n */\n execute() {\n if (this._target.parent === this._parent) {\n return;\n }\n const invertParentWorldMatrix = this._parent.getWorldMatrix().clone();\n invertParentWorldMatrix.invert();\n this._target.position = Vector3.TransformCoordinates(this._target.position, invertParentWorldMatrix);\n this._target.parent = this._parent;\n }\n /**\n * Serializes the actions and its related information.\n * @param parent defines the object to serialize in\n * @returns the serialized object\n */\n serialize(parent) {\n return super._serialize({\n name: \"SetParentAction\",\n properties: [Action._GetTargetProperty(this._target), Action._GetTargetProperty(this._parent)],\n }, parent);\n }\n}\nRegisterClass(\"BABYLON.SetParentAction\", SetParentAction);\nRegisterClass(\"BABYLON.ExecuteCodeAction\", ExecuteCodeAction);\nRegisterClass(\"BABYLON.DoNothingAction\", DoNothingAction);\nRegisterClass(\"BABYLON.StopAnimationAction\", StopAnimationAction);\nRegisterClass(\"BABYLON.PlayAnimationAction\", PlayAnimationAction);\nRegisterClass(\"BABYLON.IncrementValueAction\", IncrementValueAction);\nRegisterClass(\"BABYLON.SetValueAction\", SetValueAction);\nRegisterClass(\"BABYLON.SetStateAction\", SetStateAction);\nRegisterClass(\"BABYLON.SetParentAction\", SetParentAction);\nRegisterClass(\"BABYLON.SwitchBooleanAction\", SwitchBooleanAction);\nRegisterClass(\"BABYLON.CombineAction\", CombineAction);\n//# sourceMappingURL=directActions.js.map","import { Vector3, Vector4 } from \"../Maths/math.vector.js\";\nimport { Color3, Color4 } from \"../Maths/math.color.js\";\nimport { Condition, ValueCondition } from \"./condition.js\";\nimport { Action } from \"./action.js\";\nimport { DoNothingAction } from \"./directActions.js\";\nimport { EngineStore } from \"../Engines/engineStore.js\";\nimport { Logger } from \"../Misc/logger.js\";\nimport { DeepCopier } from \"../Misc/deepCopier.js\";\nimport { GetClass } from \"../Misc/typeStore.js\";\nimport { AbstractActionManager } from \"./abstractActionManager.js\";\n\n/**\n * Action Manager manages all events to be triggered on a given mesh or the global scene.\n * A single scene can have many Action Managers to handle predefined actions on specific meshes.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/events/actions\n */\nexport class ActionManager extends AbstractActionManager {\n /**\n * Creates a new action manager\n * @param scene defines the hosting scene\n */\n constructor(scene) {\n super();\n scene = scene || EngineStore.LastCreatedScene;\n if (!scene) {\n return;\n }\n this._scene = scene;\n scene.actionManagers.push(this);\n }\n // Methods\n /**\n * Releases all associated resources\n */\n dispose() {\n const sceneIndex = this._scene.actionManagers.indexOf(this);\n for (let i = 0; i < this.actions.length; i++) {\n const action = this.actions[i];\n ActionManager.Triggers[action.trigger]--;\n if (ActionManager.Triggers[action.trigger] === 0) {\n delete ActionManager.Triggers[action.trigger];\n }\n }\n this.actions.length = 0;\n if (sceneIndex > -1) {\n this._scene.actionManagers.splice(sceneIndex, 1);\n }\n const ownerMeshes = this._scene.meshes.filter((m) => m.actionManager === this);\n for (const ownerMesh of ownerMeshes) {\n ownerMesh.actionManager = null;\n }\n }\n /**\n * Gets hosting scene\n * @returns the hosting scene\n */\n getScene() {\n return this._scene;\n }\n /**\n * Does this action manager handles actions of any of the given triggers\n * @param triggers defines the triggers to be tested\n * @returns a boolean indicating whether one (or more) of the triggers is handled\n */\n hasSpecificTriggers(triggers) {\n for (let index = 0; index < this.actions.length; index++) {\n const action = this.actions[index];\n if (triggers.indexOf(action.trigger) > -1) {\n return true;\n }\n }\n return false;\n }\n /**\n * Does this action manager handles actions of any of the given triggers. This function takes two arguments for\n * speed.\n * @param triggerA defines the trigger to be tested\n * @param triggerB defines the trigger to be tested\n * @returns a boolean indicating whether one (or more) of the triggers is handled\n */\n hasSpecificTriggers2(triggerA, triggerB) {\n for (let index = 0; index < this.actions.length; index++) {\n const action = this.actions[index];\n if (triggerA == action.trigger || triggerB == action.trigger) {\n return true;\n }\n }\n return false;\n }\n /**\n * Does this action manager handles actions of a given trigger\n * @param trigger defines the trigger to be tested\n * @param parameterPredicate defines an optional predicate to filter triggers by parameter\n * @returns whether the trigger is handled\n */\n hasSpecificTrigger(trigger, parameterPredicate) {\n for (let index = 0; index < this.actions.length; index++) {\n const action = this.actions[index];\n if (action.trigger === trigger) {\n if (parameterPredicate) {\n if (parameterPredicate(action.getTriggerParameter())) {\n return true;\n }\n }\n else {\n return true;\n }\n }\n }\n return false;\n }\n /**\n * Does this action manager has pointer triggers\n */\n get hasPointerTriggers() {\n for (let index = 0; index < this.actions.length; index++) {\n const action = this.actions[index];\n if (action.trigger >= ActionManager.OnPickTrigger && action.trigger <= ActionManager.OnPointerOutTrigger) {\n return true;\n }\n }\n return false;\n }\n /**\n * Does this action manager has pick triggers\n */\n get hasPickTriggers() {\n for (let index = 0; index < this.actions.length; index++) {\n const action = this.actions[index];\n if (action.trigger >= ActionManager.OnPickTrigger && action.trigger <= ActionManager.OnPickUpTrigger) {\n return true;\n }\n }\n return false;\n }\n /**\n * Registers an action to this action manager\n * @param action defines the action to be registered\n * @returns the action amended (prepared) after registration\n */\n registerAction(action) {\n if (action.trigger === ActionManager.OnEveryFrameTrigger) {\n if (this.getScene().actionManager !== this) {\n Logger.Warn(\"OnEveryFrameTrigger can only be used with scene.actionManager\");\n return null;\n }\n }\n this.actions.push(action);\n this.getScene()._registeredActions++;\n if (ActionManager.Triggers[action.trigger]) {\n ActionManager.Triggers[action.trigger]++;\n }\n else {\n ActionManager.Triggers[action.trigger] = 1;\n }\n action._actionManager = this;\n action._prepare();\n return action;\n }\n /**\n * Unregisters an action to this action manager\n * @param action defines the action to be unregistered\n * @returns a boolean indicating whether the action has been unregistered\n */\n unregisterAction(action) {\n const index = this.actions.indexOf(action);\n if (index !== -1) {\n this.actions.splice(index, 1);\n ActionManager.Triggers[action.trigger] -= 1;\n if (ActionManager.Triggers[action.trigger] === 0) {\n delete ActionManager.Triggers[action.trigger];\n }\n action._actionManager = null;\n this.getScene()._registeredActions--;\n return true;\n }\n return false;\n }\n /**\n * Process a specific trigger\n * @param trigger defines the trigger to process\n * @param evt defines the event details to be processed\n */\n processTrigger(trigger, evt) {\n for (let index = 0; index < this.actions.length; index++) {\n const action = this.actions[index];\n if (action.trigger === trigger) {\n if (evt) {\n if (trigger === ActionManager.OnKeyUpTrigger || trigger === ActionManager.OnKeyDownTrigger) {\n const parameter = action.getTriggerParameter();\n if (typeof parameter === \"function\") {\n if (!parameter(evt)) {\n continue;\n }\n }\n else if (parameter && parameter !== evt.sourceEvent.keyCode) {\n if (!parameter.toLowerCase) {\n continue;\n }\n const lowerCase = parameter.toLowerCase();\n if (lowerCase !== evt.sourceEvent.key) {\n const unicode = evt.sourceEvent.charCode ? evt.sourceEvent.charCode : evt.sourceEvent.keyCode;\n const actualkey = String.fromCharCode(unicode).toLowerCase();\n if (actualkey !== lowerCase) {\n continue;\n }\n }\n }\n }\n }\n action._executeCurrent(evt);\n }\n }\n }\n /**\n * @internal\n */\n _getEffectiveTarget(target, propertyPath) {\n const properties = propertyPath.split(\".\");\n for (let index = 0; index < properties.length - 1; index++) {\n target = target[properties[index]];\n }\n return target;\n }\n /**\n * @internal\n */\n _getProperty(propertyPath) {\n const properties = propertyPath.split(\".\");\n return properties[properties.length - 1];\n }\n /**\n * Serialize this manager to a JSON object\n * @param name defines the property name to store this manager\n * @returns a JSON representation of this manager\n */\n serialize(name) {\n const root = {\n children: new Array(),\n name: name,\n type: 3,\n properties: new Array(), // Empty for root but required\n };\n for (let i = 0; i < this.actions.length; i++) {\n const triggerObject = {\n type: 0,\n children: new Array(),\n name: ActionManager.GetTriggerName(this.actions[i].trigger),\n properties: new Array(),\n };\n const triggerOptions = this.actions[i].triggerOptions;\n if (triggerOptions && typeof triggerOptions !== \"number\") {\n if (triggerOptions.parameter instanceof Node) {\n triggerObject.properties.push(Action._GetTargetProperty(triggerOptions.parameter));\n }\n else if (typeof triggerOptions.parameter === \"object\") {\n const parameter = {};\n DeepCopier.DeepCopy(triggerOptions.parameter, parameter, [\"mesh\"]);\n if (triggerOptions.parameter && triggerOptions.parameter.mesh) {\n parameter._meshId = triggerOptions.parameter.mesh.id;\n }\n triggerObject.properties.push({ name: \"parameter\", targetType: null, value: parameter });\n }\n else {\n triggerObject.properties.push({ name: \"parameter\", targetType: null, value: triggerOptions.parameter });\n }\n }\n // Serialize child action, recursively\n this.actions[i].serialize(triggerObject);\n // Add serialized trigger\n root.children.push(triggerObject);\n }\n return root;\n }\n /**\n * Creates a new ActionManager from a JSON data\n * @param parsedActions defines the JSON data to read from\n * @param object defines the hosting mesh\n * @param scene defines the hosting scene\n */\n static Parse(parsedActions, object, scene) {\n const actionManager = new ActionManager(scene);\n if (object === null) {\n scene.actionManager = actionManager;\n }\n else {\n object.actionManager = actionManager;\n }\n // instantiate a new object\n const instantiate = (name, params) => {\n const internalClassType = GetClass(\"BABYLON.\" + name);\n return internalClassType && new internalClassType(...params);\n };\n const parseParameter = (name, value, target, propertyPath) => {\n if (propertyPath === null) {\n // String, boolean or float\n const floatValue = parseFloat(value);\n if (value === \"true\" || value === \"false\") {\n return value === \"true\";\n }\n else {\n return isNaN(floatValue) ? value : floatValue;\n }\n }\n const effectiveTarget = propertyPath.split(\".\");\n const values = value.split(\",\");\n // Get effective Target\n for (let i = 0; i < effectiveTarget.length; i++) {\n target = target[effectiveTarget[i]];\n }\n // Return appropriate value with its type\n if (typeof target === \"boolean\") {\n return values[0] === \"true\";\n }\n if (typeof target === \"string\") {\n return values[0];\n }\n // Parameters with multiple values such as Vector3 etc.\n const split = new Array();\n for (let i = 0; i < values.length; i++) {\n split.push(parseFloat(values[i]));\n }\n if (target instanceof Vector3) {\n return Vector3.FromArray(split);\n }\n if (target instanceof Vector4) {\n return Vector4.FromArray(split);\n }\n if (target instanceof Color3) {\n return Color3.FromArray(split);\n }\n if (target instanceof Color4) {\n return Color4.FromArray(split);\n }\n return parseFloat(values[0]);\n };\n // traverse graph per trigger\n const traverse = (parsedAction, trigger, condition, action, combineArray = null) => {\n if (parsedAction.detached) {\n return;\n }\n const parameters = new Array();\n let target = null;\n let propertyPath = null;\n const combine = parsedAction.combine && parsedAction.combine.length > 0;\n // Parameters\n if (parsedAction.type === 2) {\n parameters.push(actionManager);\n }\n else {\n parameters.push(trigger);\n }\n if (combine) {\n const actions = new Array();\n for (let j = 0; j < parsedAction.combine.length; j++) {\n traverse(parsedAction.combine[j], ActionManager.NothingTrigger, condition, action, actions);\n }\n parameters.push(actions);\n }\n else {\n for (let i = 0; i < parsedAction.properties.length; i++) {\n let value = parsedAction.properties[i].value;\n const name = parsedAction.properties[i].name;\n const targetType = parsedAction.properties[i].targetType;\n if (name === \"target\") {\n if (targetType === \"SceneProperties\") {\n value = target = scene;\n }\n else if (targetType === \"MaterialProperties\") {\n value = target = scene.getMaterialByName(value);\n }\n else {\n value = target = scene.getNodeByName(value);\n }\n }\n else if (name === \"parent\") {\n value = scene.getNodeByName(value);\n }\n else if (name === \"sound\") {\n // Can not externalize to component, so only checks for the presence off the API.\n if (scene.getSoundByName) {\n value = scene.getSoundByName(value);\n }\n }\n else if (name !== \"propertyPath\") {\n if (parsedAction.type === 2 && name === \"operator\") {\n value = ValueCondition[value];\n }\n else {\n value = parseParameter(name, value, target, name === \"value\" ? propertyPath : null);\n }\n }\n else {\n propertyPath = value;\n }\n parameters.push(value);\n }\n }\n if (combineArray === null) {\n parameters.push(condition);\n }\n else {\n parameters.push(null);\n }\n // If interpolate value action\n if (parsedAction.name === \"InterpolateValueAction\") {\n const param = parameters[parameters.length - 2];\n parameters[parameters.length - 1] = param;\n parameters[parameters.length - 2] = condition;\n }\n // Action or condition(s) and not CombineAction\n let newAction = instantiate(parsedAction.name, parameters);\n if (newAction instanceof Condition && condition !== null) {\n const nothing = new DoNothingAction(trigger, condition);\n if (action) {\n action.then(nothing);\n }\n else {\n actionManager.registerAction(nothing);\n }\n action = nothing;\n }\n if (combineArray === null) {\n if (newAction instanceof Condition) {\n condition = newAction;\n newAction = action;\n }\n else {\n condition = null;\n if (action) {\n action.then(newAction);\n }\n else {\n actionManager.registerAction(newAction);\n }\n }\n }\n else {\n combineArray.push(newAction);\n }\n for (let i = 0; i < parsedAction.children.length; i++) {\n traverse(parsedAction.children[i], trigger, condition, newAction, null);\n }\n };\n // triggers\n for (let i = 0; i < parsedActions.children.length; i++) {\n let triggerParams;\n const trigger = parsedActions.children[i];\n if (trigger.properties.length > 0) {\n const param = trigger.properties[0].value;\n const value = trigger.properties[0].targetType === null ? param : scene.getMeshByName(param);\n if (value._meshId) {\n value.mesh = scene.getMeshById(value._meshId);\n }\n triggerParams = { trigger: ActionManager[trigger.name], parameter: value };\n }\n else {\n triggerParams = ActionManager[trigger.name];\n }\n for (let j = 0; j < trigger.children.length; j++) {\n if (!trigger.detached) {\n traverse(trigger.children[j], triggerParams, null, null);\n }\n }\n }\n }\n /**\n * Get a trigger name by index\n * @param trigger defines the trigger index\n * @returns a trigger name\n */\n static GetTriggerName(trigger) {\n switch (trigger) {\n case 0:\n return \"NothingTrigger\";\n case 1:\n return \"OnPickTrigger\";\n case 2:\n return \"OnLeftPickTrigger\";\n case 3:\n return \"OnRightPickTrigger\";\n case 4:\n return \"OnCenterPickTrigger\";\n case 5:\n return \"OnPickDownTrigger\";\n case 6:\n return \"OnDoublePickTrigger\"; // start;\n case 7:\n return \"OnPickUpTrigger\";\n case 8:\n return \"OnLongPressTrigger\";\n case 9:\n return \"OnPointerOverTrigger\";\n case 10:\n return \"OnPointerOutTrigger\";\n case 11:\n return \"OnEveryFrameTrigger\";\n case 12:\n return \"OnIntersectionEnterTrigger\";\n case 13:\n return \"OnIntersectionExitTrigger\";\n case 14:\n return \"OnKeyDownTrigger\";\n case 15:\n return \"OnKeyUpTrigger\";\n case 16:\n return \"OnPickOutTrigger\";\n default:\n return \"\";\n }\n }\n}\n/**\n * Nothing\n * @see https://doc.babylonjs.com/features/featuresDeepDive/events/actions#triggers\n */\nActionManager.NothingTrigger = 0;\n/**\n * On pick\n * @see https://doc.babylonjs.com/features/featuresDeepDive/events/actions#triggers\n */\nActionManager.OnPickTrigger = 1;\n/**\n * On left pick\n * @see https://doc.babylonjs.com/features/featuresDeepDive/events/actions#triggers\n */\nActionManager.OnLeftPickTrigger = 2;\n/**\n * On right pick\n * @see https://doc.babylonjs.com/features/featuresDeepDive/events/actions#triggers\n */\nActionManager.OnRightPickTrigger = 3;\n/**\n * On center pick\n * @see https://doc.babylonjs.com/features/featuresDeepDive/events/actions#triggers\n */\nActionManager.OnCenterPickTrigger = 4;\n/**\n * On pick down\n * @see https://doc.babylonjs.com/features/featuresDeepDive/events/actions#triggers\n */\nActionManager.OnPickDownTrigger = 5;\n/**\n * On double pick\n * @see https://doc.babylonjs.com/features/featuresDeepDive/events/actions#triggers\n */\nActionManager.OnDoublePickTrigger = 6;\n/**\n * On pick up\n * @see https://doc.babylonjs.com/features/featuresDeepDive/events/actions#triggers\n */\nActionManager.OnPickUpTrigger = 7;\n/**\n * On pick out.\n * This trigger will only be raised if you also declared a OnPickDown\n * @see https://doc.babylonjs.com/features/featuresDeepDive/events/actions#triggers\n */\nActionManager.OnPickOutTrigger = 16;\n/**\n * On long press\n * @see https://doc.babylonjs.com/features/featuresDeepDive/events/actions#triggers\n */\nActionManager.OnLongPressTrigger = 8;\n/**\n * On pointer over\n * @see https://doc.babylonjs.com/features/featuresDeepDive/events/actions#triggers\n */\nActionManager.OnPointerOverTrigger = 9;\n/**\n * On pointer out\n * @see https://doc.babylonjs.com/features/featuresDeepDive/events/actions#triggers\n */\nActionManager.OnPointerOutTrigger = 10;\n/**\n * On every frame\n * @see https://doc.babylonjs.com/features/featuresDeepDive/events/actions#triggers\n */\nActionManager.OnEveryFrameTrigger = 11;\n/**\n * On intersection enter\n * @see https://doc.babylonjs.com/features/featuresDeepDive/events/actions#triggers\n */\nActionManager.OnIntersectionEnterTrigger = 12;\n/**\n * On intersection exit\n * @see https://doc.babylonjs.com/features/featuresDeepDive/events/actions#triggers\n */\nActionManager.OnIntersectionExitTrigger = 13;\n/**\n * On key down\n * @see https://doc.babylonjs.com/features/featuresDeepDive/events/actions#triggers\n */\nActionManager.OnKeyDownTrigger = 14;\n/**\n * On key up\n * @see https://doc.babylonjs.com/features/featuresDeepDive/events/actions#triggers\n */\nActionManager.OnKeyUpTrigger = 15;\n//# sourceMappingURL=actionManager.js.map","import { TmpVectors } from \"../../Maths/math.vector.js\";\nimport { Mesh, _CreationDataStorage } from \"../mesh.js\";\nimport { VertexBuffer } from \"../../Buffers/buffer.js\";\nimport { VertexData } from \"../mesh.vertexData.js\";\nimport { CompatibilityOptions } from \"../../Compat/compatibilityOptions.js\";\n/**\n * Creates the VertexData for a Ribbon\n * @param options an object used to set the following optional parameters for the ribbon, required but can be empty\n * * pathArray array of paths, each of which an array of successive Vector3\n * * closeArray creates a seam between the first and the last paths of the pathArray, optional, default false\n * * closePath creates a seam between the first and the last points of each path of the path array, optional, default false\n * * offset a positive integer, only used when pathArray contains a single path (offset = 10 means the point 1 is joined to the point 11), default rounded half size of the pathArray length\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\n * * invertUV swaps in the U and V coordinates when applying a texture, optional, default false\n * * uvs a linear array, of length 2 * number of vertices, of custom UV values, optional\n * * colors a linear array, of length 4 * number of vertices, of custom color values, optional\n * @param options.pathArray\n * @param options.closeArray\n * @param options.closePath\n * @param options.offset\n * @param options.sideOrientation\n * @param options.frontUVs\n * @param options.backUVs\n * @param options.invertUV\n * @param options.uvs\n * @param options.colors\n * @returns the VertexData of the ribbon\n */\nexport function CreateRibbonVertexData(options) {\n let pathArray = options.pathArray;\n const closeArray = options.closeArray || false;\n const closePath = options.closePath || false;\n const invertUV = options.invertUV || false;\n const defaultOffset = Math.floor(pathArray[0].length / 2);\n let offset = options.offset || defaultOffset;\n offset = offset > defaultOffset ? defaultOffset : Math.floor(offset); // offset max allowed : defaultOffset\n const sideOrientation = options.sideOrientation === 0 ? 0 : options.sideOrientation || VertexData.DEFAULTSIDE;\n const customUV = options.uvs;\n const customColors = options.colors;\n const positions = [];\n const indices = [];\n const normals = [];\n const uvs = [];\n const us = []; // us[path_id] = [uDist1, uDist2, uDist3 ... ] distances between points on path path_id\n const vs = []; // vs[i] = [vDist1, vDist2, vDist3, ... ] distances between points i of consecutive paths from pathArray\n const uTotalDistance = []; // uTotalDistance[p] : total distance of path p\n const vTotalDistance = []; // vTotalDistance[i] : total distance between points i of first and last path from pathArray\n let minlg; // minimal length among all paths from pathArray\n const lg = []; // array of path lengths : nb of vertex per path\n const idx = []; // array of path indexes : index of each path (first vertex) in the total vertex number\n let p; // path iterator\n let i; // point iterator\n let j; // point iterator\n // if single path in pathArray\n if (pathArray.length < 2) {\n const ar1 = [];\n const ar2 = [];\n for (i = 0; i < pathArray[0].length - offset; i++) {\n ar1.push(pathArray[0][i]);\n ar2.push(pathArray[0][i + offset]);\n }\n pathArray = [ar1, ar2];\n }\n // positions and horizontal distances (u)\n let idc = 0;\n const closePathCorr = closePath ? 1 : 0; // the final index will be +1 if closePath\n let path;\n let l;\n minlg = pathArray[0].length;\n let vectlg;\n let dist;\n for (p = 0; p < pathArray.length; p++) {\n uTotalDistance[p] = 0;\n us[p] = [0];\n path = pathArray[p];\n l = path.length;\n minlg = minlg < l ? minlg : l;\n j = 0;\n while (j < l) {\n positions.push(path[j].x, path[j].y, path[j].z);\n if (j > 0) {\n vectlg = path[j].subtract(path[j - 1]).length();\n dist = vectlg + uTotalDistance[p];\n us[p].push(dist);\n uTotalDistance[p] = dist;\n }\n j++;\n }\n if (closePath) {\n // an extra hidden vertex is added in the \"positions\" array\n j--;\n positions.push(path[0].x, path[0].y, path[0].z);\n vectlg = path[j].subtract(path[0]).length();\n dist = vectlg + uTotalDistance[p];\n us[p].push(dist);\n uTotalDistance[p] = dist;\n }\n lg[p] = l + closePathCorr;\n idx[p] = idc;\n idc += l + closePathCorr;\n }\n // vertical distances (v)\n let path1;\n let path2;\n let vertex1 = null;\n let vertex2 = null;\n for (i = 0; i < minlg + closePathCorr; i++) {\n vTotalDistance[i] = 0;\n vs[i] = [0];\n for (p = 0; p < pathArray.length - 1; p++) {\n path1 = pathArray[p];\n path2 = pathArray[p + 1];\n if (i === minlg) {\n // closePath\n vertex1 = path1[0];\n vertex2 = path2[0];\n }\n else {\n vertex1 = path1[i];\n vertex2 = path2[i];\n }\n vectlg = vertex2.subtract(vertex1).length();\n dist = vectlg + vTotalDistance[i];\n vs[i].push(dist);\n vTotalDistance[i] = dist;\n }\n if (closeArray && vertex2 && vertex1) {\n path1 = pathArray[p];\n path2 = pathArray[0];\n if (i === minlg) {\n // closePath\n vertex2 = path2[0];\n }\n vectlg = vertex2.subtract(vertex1).length();\n dist = vectlg + vTotalDistance[i];\n vTotalDistance[i] = dist;\n }\n }\n // uvs\n let u;\n let v;\n if (customUV) {\n for (p = 0; p < customUV.length; p++) {\n uvs.push(customUV[p].x, CompatibilityOptions.UseOpenGLOrientationForUV ? 1.0 - customUV[p].y : customUV[p].y);\n }\n }\n else {\n for (p = 0; p < pathArray.length; p++) {\n for (i = 0; i < minlg + closePathCorr; i++) {\n u = uTotalDistance[p] != 0.0 ? us[p][i] / uTotalDistance[p] : 0.0;\n v = vTotalDistance[i] != 0.0 ? vs[i][p] / vTotalDistance[i] : 0.0;\n if (invertUV) {\n uvs.push(v, u);\n }\n else {\n uvs.push(u, CompatibilityOptions.UseOpenGLOrientationForUV ? 1.0 - v : v);\n }\n }\n }\n }\n // indices\n p = 0; // path index\n let pi = 0; // positions array index\n let l1 = lg[p] - 1; // path1 length\n let l2 = lg[p + 1] - 1; // path2 length\n let min = l1 < l2 ? l1 : l2; // current path stop index\n let shft = idx[1] - idx[0]; // shift\n const path1nb = closeArray ? lg.length : lg.length - 1; // number of path1 to iterate\ton\n while (pi <= min && p < path1nb) {\n // stay under min and don't go over next to last path\n // draw two triangles between path1 (p1) and path2 (p2) : (p1.pi, p2.pi, p1.pi+1) and (p2.pi+1, p1.pi+1, p2.pi) clockwise\n indices.push(pi, pi + shft, pi + 1);\n indices.push(pi + shft + 1, pi + 1, pi + shft);\n pi += 1;\n if (pi === min) {\n // if end of one of two consecutive paths reached, go to next existing path\n p++;\n if (p === lg.length - 1) {\n // last path of pathArray reached <=> closeArray == true\n shft = idx[0] - idx[p];\n l1 = lg[p] - 1;\n l2 = lg[0] - 1;\n }\n else {\n shft = idx[p + 1] - idx[p];\n l1 = lg[p] - 1;\n l2 = lg[p + 1] - 1;\n }\n pi = idx[p];\n min = l1 < l2 ? l1 + pi : l2 + pi;\n }\n }\n // normals\n VertexData.ComputeNormals(positions, indices, normals);\n if (closePath) {\n // update both the first and last vertex normals to their average value\n let indexFirst = 0;\n let indexLast = 0;\n for (p = 0; p < pathArray.length; p++) {\n indexFirst = idx[p] * 3;\n if (p + 1 < pathArray.length) {\n indexLast = (idx[p + 1] - 1) * 3;\n }\n else {\n indexLast = normals.length - 3;\n }\n normals[indexFirst] = (normals[indexFirst] + normals[indexLast]) * 0.5;\n normals[indexFirst + 1] = (normals[indexFirst + 1] + normals[indexLast + 1]) * 0.5;\n normals[indexFirst + 2] = (normals[indexFirst + 2] + normals[indexLast + 2]) * 0.5;\n normals[indexLast] = normals[indexFirst];\n normals[indexLast + 1] = normals[indexFirst + 1];\n normals[indexLast + 2] = normals[indexFirst + 2];\n }\n }\n // sides\n VertexData._ComputeSides(sideOrientation, positions, indices, normals, uvs, options.frontUVs, options.backUVs);\n // Colors\n let colors = null;\n if (customColors) {\n colors = new Float32Array(customColors.length * 4);\n for (let c = 0; c < customColors.length; c++) {\n colors[c * 4] = customColors[c].r;\n colors[c * 4 + 1] = customColors[c].g;\n colors[c * 4 + 2] = customColors[c].b;\n colors[c * 4 + 3] = customColors[c].a;\n }\n }\n // Result\n const vertexData = new VertexData();\n const positions32 = new Float32Array(positions);\n const normals32 = new Float32Array(normals);\n const uvs32 = new Float32Array(uvs);\n vertexData.indices = indices;\n vertexData.positions = positions32;\n vertexData.normals = normals32;\n vertexData.uvs = uvs32;\n if (colors) {\n vertexData.set(colors, VertexBuffer.ColorKind);\n }\n if (closePath) {\n vertexData._idx = idx;\n }\n return vertexData;\n}\n/**\n * Creates a ribbon mesh. The ribbon is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters\n * * The parameter `pathArray` is a required array of paths, what are each an array of successive Vector3. The pathArray parameter depicts the ribbon geometry\n * * The parameter `closeArray` (boolean, default false) creates a seam between the first and the last paths of the path array\n * * The parameter `closePath` (boolean, default false) creates a seam between the first and the last points of each path of the path array\n * * The parameter `offset` (positive integer, default : rounded half size of the pathArray length), is taken in account only if the `pathArray` is containing a single path\n * * It's the offset to join the points from the same path. Ex : offset = 10 means the point 1 is joined to the point 11\n * * The optional parameter `instance` is an instance of an existing Ribbon object to be updated with the passed `pathArray` parameter : https://doc.babylonjs.com/features/featuresDeepDive/mesh/dynamicMeshMorph#ribbon\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation\n * * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture\n * * The parameter `uvs` is an optional flat array of `Vector2` to update/set each ribbon vertex with its own custom UV values instead of the computed ones\n * * The parameters `colors` is an optional flat array of `Color4` to set/update each ribbon vertex with its own custom color values\n * * Note that if you use the parameters `uvs` or `colors`, the passed arrays must be populated with the right number of elements, it is to say the number of ribbon vertices. Remember that if you set `closePath` to `true`, there's one extra vertex per path in the geometry\n * * Moreover, you can use the parameter `color` with `instance` (to update the ribbon), only if you previously used it at creation time\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\n * @param name defines the name of the mesh\n * @param options defines the options used to create the mesh\n * @param options.pathArray\n * @param options.closeArray\n * @param options.closePath\n * @param options.offset\n * @param options.updatable\n * @param options.sideOrientation\n * @param options.frontUVs\n * @param options.backUVs\n * @param options.instance\n * @param options.invertUV\n * @param options.uvs\n * @param options.colors\n * @param scene defines the hosting scene\n * @returns the ribbon mesh\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param/ribbon_extra\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param\n */\nexport function CreateRibbon(name, options, scene = null) {\n const pathArray = options.pathArray;\n const closeArray = options.closeArray;\n const closePath = options.closePath;\n const sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\n const instance = options.instance;\n const updatable = options.updatable;\n if (instance) {\n // existing ribbon instance update\n // positionFunction : ribbon case\n // only pathArray and sideOrientation parameters are taken into account for positions update\n const minimum = TmpVectors.Vector3[0].setAll(Number.MAX_VALUE);\n const maximum = TmpVectors.Vector3[1].setAll(-Number.MAX_VALUE);\n const positionFunction = (positions) => {\n let minlg = pathArray[0].length;\n const mesh = instance;\n let i = 0;\n const ns = mesh._originalBuilderSideOrientation === Mesh.DOUBLESIDE ? 2 : 1;\n for (let si = 1; si <= ns; ++si) {\n for (let p = 0; p < pathArray.length; ++p) {\n const path = pathArray[p];\n const l = path.length;\n minlg = minlg < l ? minlg : l;\n for (let j = 0; j < minlg; ++j) {\n const pathPoint = path[j];\n positions[i] = pathPoint.x;\n positions[i + 1] = pathPoint.y;\n positions[i + 2] = pathPoint.z;\n minimum.minimizeInPlaceFromFloats(pathPoint.x, pathPoint.y, pathPoint.z);\n maximum.maximizeInPlaceFromFloats(pathPoint.x, pathPoint.y, pathPoint.z);\n i += 3;\n }\n if (mesh._creationDataStorage && mesh._creationDataStorage.closePath) {\n const pathPoint = path[0];\n positions[i] = pathPoint.x;\n positions[i + 1] = pathPoint.y;\n positions[i + 2] = pathPoint.z;\n i += 3;\n }\n }\n }\n };\n const positions = instance.getVerticesData(VertexBuffer.PositionKind);\n positionFunction(positions);\n if (instance.hasBoundingInfo) {\n instance.getBoundingInfo().reConstruct(minimum, maximum, instance._worldMatrix);\n }\n else {\n instance.buildBoundingInfo(minimum, maximum, instance._worldMatrix);\n }\n instance.updateVerticesData(VertexBuffer.PositionKind, positions, false, false);\n if (options.colors) {\n const colors = instance.getVerticesData(VertexBuffer.ColorKind);\n for (let c = 0, colorIndex = 0; c < options.colors.length; c++, colorIndex += 4) {\n const color = options.colors[c];\n colors[colorIndex] = color.r;\n colors[colorIndex + 1] = color.g;\n colors[colorIndex + 2] = color.b;\n colors[colorIndex + 3] = color.a;\n }\n instance.updateVerticesData(VertexBuffer.ColorKind, colors, false, false);\n }\n if (options.uvs) {\n const uvs = instance.getVerticesData(VertexBuffer.UVKind);\n for (let i = 0; i < options.uvs.length; i++) {\n uvs[i * 2] = options.uvs[i].x;\n uvs[i * 2 + 1] = CompatibilityOptions.UseOpenGLOrientationForUV ? 1.0 - options.uvs[i].y : options.uvs[i].y;\n }\n instance.updateVerticesData(VertexBuffer.UVKind, uvs, false, false);\n }\n if (!instance.areNormalsFrozen || instance.isFacetDataEnabled) {\n const indices = instance.getIndices();\n const normals = instance.getVerticesData(VertexBuffer.NormalKind);\n const params = instance.isFacetDataEnabled ? instance.getFacetDataParameters() : null;\n VertexData.ComputeNormals(positions, indices, normals, params);\n if (instance._creationDataStorage && instance._creationDataStorage.closePath) {\n let indexFirst = 0;\n let indexLast = 0;\n for (let p = 0; p < pathArray.length; p++) {\n indexFirst = instance._creationDataStorage.idx[p] * 3;\n if (p + 1 < pathArray.length) {\n indexLast = (instance._creationDataStorage.idx[p + 1] - 1) * 3;\n }\n else {\n indexLast = normals.length - 3;\n }\n normals[indexFirst] = (normals[indexFirst] + normals[indexLast]) * 0.5;\n normals[indexFirst + 1] = (normals[indexFirst + 1] + normals[indexLast + 1]) * 0.5;\n normals[indexFirst + 2] = (normals[indexFirst + 2] + normals[indexLast + 2]) * 0.5;\n normals[indexLast] = normals[indexFirst];\n normals[indexLast + 1] = normals[indexFirst + 1];\n normals[indexLast + 2] = normals[indexFirst + 2];\n }\n }\n if (!instance.areNormalsFrozen) {\n instance.updateVerticesData(VertexBuffer.NormalKind, normals, false, false);\n }\n }\n return instance;\n }\n else {\n // new ribbon creation\n const ribbon = new Mesh(name, scene);\n ribbon._originalBuilderSideOrientation = sideOrientation;\n ribbon._creationDataStorage = new _CreationDataStorage();\n const vertexData = CreateRibbonVertexData(options);\n if (closePath) {\n ribbon._creationDataStorage.idx = vertexData._idx;\n }\n ribbon._creationDataStorage.closePath = closePath;\n ribbon._creationDataStorage.closeArray = closeArray;\n vertexData.applyToMesh(ribbon, updatable);\n return ribbon;\n }\n}\n/**\n * Class containing static functions to help procedurally build meshes\n * @deprecated use CreateRibbon directly\n */\nexport const RibbonBuilder = {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n CreateRibbon,\n};\nVertexData.CreateRibbon = CreateRibbonVertexData;\nMesh.CreateRibbon = (name, pathArray, closeArray = false, closePath, offset, scene, updatable = false, sideOrientation, instance) => {\n return CreateRibbon(name, {\n pathArray: pathArray,\n closeArray: closeArray,\n closePath: closePath,\n offset: offset,\n updatable: updatable,\n sideOrientation: sideOrientation,\n instance: instance,\n }, scene);\n};\n//# sourceMappingURL=ribbonBuilder.js.map","import { Mesh } from \"../mesh.js\";\nimport { VertexData } from \"../mesh.vertexData.js\";\nimport { CompatibilityOptions } from \"../../Compat/compatibilityOptions.js\";\n/**\n * Creates the VertexData of the Disc or regular Polygon\n * @param options an object used to set the following optional parameters for the disc, required but can be empty\n * * radius the radius of the disc, optional default 0.5\n * * tessellation the number of polygon sides, optional, default 64\n * * arc a number from 0 to 1, to create an unclosed polygon based on the fraction of the circumference given by the arc value, optional, default 1\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\n * @param options.radius\n * @param options.tessellation\n * @param options.arc\n * @param options.sideOrientation\n * @param options.frontUVs\n * @param options.backUVs\n * @returns the VertexData of the box\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function CreateDiscVertexData(options) {\n const positions = new Array();\n const indices = new Array();\n const normals = new Array();\n const uvs = new Array();\n const radius = options.radius || 0.5;\n const tessellation = options.tessellation || 64;\n const arc = options.arc && (options.arc <= 0 || options.arc > 1) ? 1.0 : options.arc || 1.0;\n const sideOrientation = options.sideOrientation === 0 ? 0 : options.sideOrientation || VertexData.DEFAULTSIDE;\n // positions and uvs\n positions.push(0, 0, 0); // disc center first\n uvs.push(0.5, 0.5);\n const theta = Math.PI * 2 * arc;\n const step = arc === 1 ? theta / tessellation : theta / (tessellation - 1);\n let a = 0;\n for (let t = 0; t < tessellation; t++) {\n const x = Math.cos(a);\n const y = Math.sin(a);\n const u = (x + 1) / 2;\n const v = (1 - y) / 2;\n positions.push(radius * x, radius * y, 0);\n uvs.push(u, CompatibilityOptions.UseOpenGLOrientationForUV ? 1 - v : v);\n a += step;\n }\n if (arc === 1) {\n positions.push(positions[3], positions[4], positions[5]); // close the circle\n uvs.push(uvs[2], CompatibilityOptions.UseOpenGLOrientationForUV ? 1 - uvs[3] : uvs[3]);\n }\n //indices\n const vertexNb = positions.length / 3;\n for (let i = 1; i < vertexNb - 1; i++) {\n indices.push(i + 1, 0, i);\n }\n // result\n VertexData.ComputeNormals(positions, indices, normals);\n VertexData._ComputeSides(sideOrientation, positions, indices, normals, uvs, options.frontUVs, options.backUVs);\n const vertexData = new VertexData();\n vertexData.indices = indices;\n vertexData.positions = positions;\n vertexData.normals = normals;\n vertexData.uvs = uvs;\n return vertexData;\n}\n/**\n * Creates a plane polygonal mesh. By default, this is a disc\n * * The parameter `radius` sets the radius size (float) of the polygon (default 0.5)\n * * The parameter `tessellation` sets the number of polygon sides (positive integer, default 64). So a tessellation valued to 3 will build a triangle, to 4 a square, etc\n * * You can create an unclosed polygon with the parameter `arc` (positive float, default 1), valued between 0 and 1, what is the ratio of the circumference : 2 x PI x ratio\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\n * @param name defines the name of the mesh\n * @param options defines the options used to create the mesh\n * @param options.radius\n * @param options.tessellation\n * @param options.arc\n * @param options.updatable\n * @param options.sideOrientation\n * @param options.frontUVs\n * @param options.backUVs\n * @param scene defines the hosting scene\n * @returns the plane polygonal mesh\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#disc-or-regular-polygon\n */\nexport function CreateDisc(name, options = {}, scene = null) {\n const disc = new Mesh(name, scene);\n options.sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\n disc._originalBuilderSideOrientation = options.sideOrientation;\n const vertexData = CreateDiscVertexData(options);\n vertexData.applyToMesh(disc, options.updatable);\n return disc;\n}\n/**\n * Class containing static functions to help procedurally build meshes\n * @deprecated please use CreateDisc directly\n */\nexport const DiscBuilder = {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n CreateDisc,\n};\nVertexData.CreateDisc = CreateDiscVertexData;\nMesh.CreateDisc = (name, radius, tessellation, scene = null, updatable, sideOrientation) => {\n const options = {\n radius,\n tessellation,\n sideOrientation,\n updatable,\n };\n return CreateDisc(name, options, scene);\n};\n//# sourceMappingURL=discBuilder.js.map","import { Vector3, Vector2, TmpVectors, Vector4 } from \"../Maths/math.vector.js\";\nimport { VertexBuffer } from \"../Buffers/buffer.js\";\nimport { Mesh } from \"../Meshes/mesh.js\";\nMesh._GroundMeshParser = (parsedMesh, scene) => {\n return GroundMesh.Parse(parsedMesh, scene);\n};\n/**\n * Mesh representing the ground\n */\nexport class GroundMesh extends Mesh {\n constructor(name, scene) {\n super(name, scene);\n /** If octree should be generated */\n this.generateOctree = false;\n }\n /**\n * \"GroundMesh\"\n * @returns \"GroundMesh\"\n */\n getClassName() {\n return \"GroundMesh\";\n }\n /**\n * The minimum of x and y subdivisions\n */\n get subdivisions() {\n return Math.min(this._subdivisionsX, this._subdivisionsY);\n }\n /**\n * X subdivisions\n */\n get subdivisionsX() {\n return this._subdivisionsX;\n }\n /**\n * Y subdivisions\n */\n get subdivisionsY() {\n return this._subdivisionsY;\n }\n /**\n * This function will divide the mesh into submeshes and update an octree to help to select the right submeshes\n * for rendering, picking and collision computations. Please note that you must have a decent number of submeshes\n * to get performance improvements when using an octree.\n * @param chunksCount the number of submeshes the mesh will be divided into\n * @param octreeBlocksSize the maximum size of the octree blocks (Default: 32)\n */\n optimize(chunksCount, octreeBlocksSize = 32) {\n this._subdivisionsX = chunksCount;\n this._subdivisionsY = chunksCount;\n this.subdivide(chunksCount);\n // Call the octree system optimization if it is defined.\n const thisAsAny = this;\n if (thisAsAny.createOrUpdateSubmeshesOctree) {\n thisAsAny.createOrUpdateSubmeshesOctree(octreeBlocksSize);\n }\n }\n /**\n * Returns a height (y) value in the World system :\n * the ground altitude at the coordinates (x, z) expressed in the World system.\n * @param x x coordinate\n * @param z z coordinate\n * @returns the ground y position if (x, z) are outside the ground surface.\n */\n getHeightAtCoordinates(x, z) {\n const world = this.getWorldMatrix();\n const invMat = TmpVectors.Matrix[5];\n world.invertToRef(invMat);\n const tmpVect = TmpVectors.Vector3[8];\n Vector3.TransformCoordinatesFromFloatsToRef(x, 0.0, z, invMat, tmpVect); // transform x,z in the mesh local space\n x = tmpVect.x;\n z = tmpVect.z;\n if (x < this._minX || x >= this._maxX || z <= this._minZ || z > this._maxZ) {\n return this.position.y;\n }\n if (!this._heightQuads || this._heightQuads.length == 0) {\n this._initHeightQuads();\n this._computeHeightQuads();\n }\n const facet = this._getFacetAt(x, z);\n const y = -(facet.x * x + facet.z * z + facet.w) / facet.y;\n // return y in the World system\n Vector3.TransformCoordinatesFromFloatsToRef(0.0, y, 0.0, world, tmpVect);\n return tmpVect.y;\n }\n /**\n * Returns a normalized vector (Vector3) orthogonal to the ground\n * at the ground coordinates (x, z) expressed in the World system.\n * @param x x coordinate\n * @param z z coordinate\n * @returns Vector3(0.0, 1.0, 0.0) if (x, z) are outside the ground surface.\n */\n getNormalAtCoordinates(x, z) {\n const normal = new Vector3(0.0, 1.0, 0.0);\n this.getNormalAtCoordinatesToRef(x, z, normal);\n return normal;\n }\n /**\n * Updates the Vector3 passed a reference with a normalized vector orthogonal to the ground\n * at the ground coordinates (x, z) expressed in the World system.\n * Doesn't update the reference Vector3 if (x, z) are outside the ground surface.\n * @param x x coordinate\n * @param z z coordinate\n * @param ref vector to store the result\n * @returns the GroundMesh.\n */\n getNormalAtCoordinatesToRef(x, z, ref) {\n const world = this.getWorldMatrix();\n const tmpMat = TmpVectors.Matrix[5];\n world.invertToRef(tmpMat);\n const tmpVect = TmpVectors.Vector3[8];\n Vector3.TransformCoordinatesFromFloatsToRef(x, 0.0, z, tmpMat, tmpVect); // transform x,z in the mesh local space\n x = tmpVect.x;\n z = tmpVect.z;\n if (x < this._minX || x > this._maxX || z < this._minZ || z > this._maxZ) {\n return this;\n }\n if (!this._heightQuads || this._heightQuads.length == 0) {\n this._initHeightQuads();\n this._computeHeightQuads();\n }\n const facet = this._getFacetAt(x, z);\n Vector3.TransformNormalFromFloatsToRef(facet.x, facet.y, facet.z, world, ref);\n return this;\n }\n /**\n * Force the heights to be recomputed for getHeightAtCoordinates() or getNormalAtCoordinates()\n * if the ground has been updated.\n * This can be used in the render loop.\n * @returns the GroundMesh.\n */\n updateCoordinateHeights() {\n if (!this._heightQuads || this._heightQuads.length == 0) {\n this._initHeightQuads();\n }\n this._computeHeightQuads();\n return this;\n }\n // Returns the element \"facet\" from the heightQuads array relative to (x, z) local coordinates\n _getFacetAt(x, z) {\n // retrieve col and row from x, z coordinates in the ground local system\n const col = Math.floor(((x + this._maxX) * this._subdivisionsX) / this._width);\n const row = Math.floor((-(z + this._maxZ) * this._subdivisionsY) / this._height + this._subdivisionsY);\n const quad = this._heightQuads[row * this._subdivisionsX + col];\n let facet;\n if (z < quad.slope.x * x + quad.slope.y) {\n facet = quad.facet1;\n }\n else {\n facet = quad.facet2;\n }\n return facet;\n }\n // Creates and populates the heightMap array with \"facet\" elements :\n // a quad is two triangular facets separated by a slope, so a \"facet\" element is 1 slope + 2 facets\n // slope : Vector2(c, h) = 2D diagonal line equation setting apart two triangular facets in a quad : z = cx + h\n // facet1 : Vector4(a, b, c, d) = first facet 3D plane equation : ax + by + cz + d = 0\n // facet2 : Vector4(a, b, c, d) = second facet 3D plane equation : ax + by + cz + d = 0\n // Returns the GroundMesh.\n _initHeightQuads() {\n const subdivisionsX = this._subdivisionsX;\n const subdivisionsY = this._subdivisionsY;\n this._heightQuads = new Array();\n for (let row = 0; row < subdivisionsY; row++) {\n for (let col = 0; col < subdivisionsX; col++) {\n const quad = { slope: Vector2.Zero(), facet1: new Vector4(0.0, 0.0, 0.0, 0.0), facet2: new Vector4(0.0, 0.0, 0.0, 0.0) };\n this._heightQuads[row * subdivisionsX + col] = quad;\n }\n }\n return this;\n }\n // Compute each quad element values and update the the heightMap array :\n // slope : Vector2(c, h) = 2D diagonal line equation setting apart two triangular facets in a quad : z = cx + h\n // facet1 : Vector4(a, b, c, d) = first facet 3D plane equation : ax + by + cz + d = 0\n // facet2 : Vector4(a, b, c, d) = second facet 3D plane equation : ax + by + cz + d = 0\n // Returns the GroundMesh.\n _computeHeightQuads() {\n const positions = this.getVerticesData(VertexBuffer.PositionKind);\n if (!positions) {\n return this;\n }\n const v1 = TmpVectors.Vector3[3];\n const v2 = TmpVectors.Vector3[2];\n const v3 = TmpVectors.Vector3[1];\n const v4 = TmpVectors.Vector3[0];\n const v1v2 = TmpVectors.Vector3[4];\n const v1v3 = TmpVectors.Vector3[5];\n const v1v4 = TmpVectors.Vector3[6];\n const norm1 = TmpVectors.Vector3[7];\n const norm2 = TmpVectors.Vector3[8];\n let i = 0;\n let j = 0;\n let k = 0;\n let cd = 0; // 2D slope coefficient : z = cd * x + h\n let h = 0;\n let d1 = 0; // facet plane equation : ax + by + cz + d = 0\n let d2 = 0;\n const subdivisionsX = this._subdivisionsX;\n const subdivisionsY = this._subdivisionsY;\n for (let row = 0; row < subdivisionsY; row++) {\n for (let col = 0; col < subdivisionsX; col++) {\n i = col * 3;\n j = row * (subdivisionsX + 1) * 3;\n k = (row + 1) * (subdivisionsX + 1) * 3;\n v1.x = positions[j + i];\n v1.y = positions[j + i + 1];\n v1.z = positions[j + i + 2];\n v2.x = positions[j + i + 3];\n v2.y = positions[j + i + 4];\n v2.z = positions[j + i + 5];\n v3.x = positions[k + i];\n v3.y = positions[k + i + 1];\n v3.z = positions[k + i + 2];\n v4.x = positions[k + i + 3];\n v4.y = positions[k + i + 4];\n v4.z = positions[k + i + 5];\n // 2D slope V1V4\n cd = (v4.z - v1.z) / (v4.x - v1.x);\n h = v1.z - cd * v1.x; // v1 belongs to the slope\n // facet equations :\n // we compute each facet normal vector\n // the equation of the facet plane is : norm.x * x + norm.y * y + norm.z * z + d = 0\n // we compute the value d by applying the equation to v1 which belongs to the plane\n // then we store the facet equation in a Vector4\n v2.subtractToRef(v1, v1v2);\n v3.subtractToRef(v1, v1v3);\n v4.subtractToRef(v1, v1v4);\n Vector3.CrossToRef(v1v4, v1v3, norm1); // caution : CrossToRef uses the Tmp class\n Vector3.CrossToRef(v1v2, v1v4, norm2);\n norm1.normalize();\n norm2.normalize();\n d1 = -(norm1.x * v1.x + norm1.y * v1.y + norm1.z * v1.z);\n d2 = -(norm2.x * v2.x + norm2.y * v2.y + norm2.z * v2.z);\n const quad = this._heightQuads[row * subdivisionsX + col];\n quad.slope.copyFromFloats(cd, h);\n quad.facet1.copyFromFloats(norm1.x, norm1.y, norm1.z, d1);\n quad.facet2.copyFromFloats(norm2.x, norm2.y, norm2.z, d2);\n }\n }\n return this;\n }\n /**\n * Serializes this ground mesh\n * @param serializationObject object to write serialization to\n */\n serialize(serializationObject) {\n super.serialize(serializationObject);\n serializationObject.subdivisionsX = this._subdivisionsX;\n serializationObject.subdivisionsY = this._subdivisionsY;\n serializationObject.minX = this._minX;\n serializationObject.maxX = this._maxX;\n serializationObject.minZ = this._minZ;\n serializationObject.maxZ = this._maxZ;\n serializationObject.width = this._width;\n serializationObject.height = this._height;\n }\n /**\n * Parses a serialized ground mesh\n * @param parsedMesh the serialized mesh\n * @param scene the scene to create the ground mesh in\n * @returns the created ground mesh\n */\n static Parse(parsedMesh, scene) {\n const result = new GroundMesh(parsedMesh.name, scene);\n result._subdivisionsX = parsedMesh.subdivisionsX || 1;\n result._subdivisionsY = parsedMesh.subdivisionsY || 1;\n result._minX = parsedMesh.minX;\n result._maxX = parsedMesh.maxX;\n result._minZ = parsedMesh.minZ;\n result._maxZ = parsedMesh.maxZ;\n result._width = parsedMesh.width;\n result._height = parsedMesh.height;\n return result;\n }\n}\n//# sourceMappingURL=groundMesh.js.map","import { Vector3 } from \"../../Maths/math.vector.js\";\nimport { Color3 } from \"../../Maths/math.color.js\";\nimport { Mesh } from \"../mesh.js\";\nimport { VertexData } from \"../mesh.vertexData.js\";\nimport { GroundMesh } from \"../groundMesh.js\";\nimport { Tools } from \"../../Misc/tools.js\";\nimport { EngineStore } from \"../../Engines/engineStore.js\";\nimport { Epsilon } from \"../../Maths/math.constants.js\";\nimport { CompatibilityOptions } from \"../../Compat/compatibilityOptions.js\";\n/**\n * Creates the VertexData for a Ground\n * @param options an object used to set the following optional parameters for the Ground, required but can be empty\n * - width the width (x direction) of the ground, optional, default 1\n * - height the height (z direction) of the ground, optional, default 1\n * - subdivisions the number of subdivisions per side, optional, default 1\n * @param options.width\n * @param options.height\n * @param options.subdivisions\n * @param options.subdivisionsX\n * @param options.subdivisionsY\n * @returns the VertexData of the Ground\n */\nexport function CreateGroundVertexData(options) {\n const indices = [];\n const positions = [];\n const normals = [];\n const uvs = [];\n let row, col;\n const width = options.width || 1;\n const height = options.height || 1;\n const subdivisionsX = (options.subdivisionsX || options.subdivisions || 1) | 0;\n const subdivisionsY = (options.subdivisionsY || options.subdivisions || 1) | 0;\n for (row = 0; row <= subdivisionsY; row++) {\n for (col = 0; col <= subdivisionsX; col++) {\n const position = new Vector3((col * width) / subdivisionsX - width / 2.0, 0, ((subdivisionsY - row) * height) / subdivisionsY - height / 2.0);\n const normal = new Vector3(0, 1.0, 0);\n positions.push(position.x, position.y, position.z);\n normals.push(normal.x, normal.y, normal.z);\n uvs.push(col / subdivisionsX, CompatibilityOptions.UseOpenGLOrientationForUV ? row / subdivisionsY : 1.0 - row / subdivisionsY);\n }\n }\n for (row = 0; row < subdivisionsY; row++) {\n for (col = 0; col < subdivisionsX; col++) {\n indices.push(col + 1 + (row + 1) * (subdivisionsX + 1));\n indices.push(col + 1 + row * (subdivisionsX + 1));\n indices.push(col + row * (subdivisionsX + 1));\n indices.push(col + (row + 1) * (subdivisionsX + 1));\n indices.push(col + 1 + (row + 1) * (subdivisionsX + 1));\n indices.push(col + row * (subdivisionsX + 1));\n }\n }\n // Result\n const vertexData = new VertexData();\n vertexData.indices = indices;\n vertexData.positions = positions;\n vertexData.normals = normals;\n vertexData.uvs = uvs;\n return vertexData;\n}\n/**\n * Creates the VertexData for a TiledGround by subdividing the ground into tiles\n * @param options an object used to set the following optional parameters for the Ground, required but can be empty\n * * xmin the ground minimum X coordinate, optional, default -1\n * * zmin the ground minimum Z coordinate, optional, default -1\n * * xmax the ground maximum X coordinate, optional, default 1\n * * zmax the ground maximum Z coordinate, optional, default 1\n * * subdivisions a javascript object {w: positive integer, h: positive integer}, `w` and `h` are the numbers of subdivisions on the ground width and height creating 'tiles', default {w: 6, h: 6}\n * * precision a javascript object {w: positive integer, h: positive integer}, `w` and `h` are the numbers of subdivisions on the tile width and height, default {w: 2, h: 2}\n * @param options.xmin\n * @param options.zmin\n * @param options.xmax\n * @param options.zmax\n * @param options.subdivisions\n * @param options.subdivisions.w\n * @param options.subdivisions.h\n * @param options.precision\n * @param options.precision.w\n * @param options.precision.h\n * @returns the VertexData of the TiledGround\n */\nexport function CreateTiledGroundVertexData(options) {\n const xmin = options.xmin !== undefined && options.xmin !== null ? options.xmin : -1.0;\n const zmin = options.zmin !== undefined && options.zmin !== null ? options.zmin : -1.0;\n const xmax = options.xmax !== undefined && options.xmax !== null ? options.xmax : 1.0;\n const zmax = options.zmax !== undefined && options.zmax !== null ? options.zmax : 1.0;\n const subdivisions = options.subdivisions || { w: 1, h: 1 };\n const precision = options.precision || { w: 1, h: 1 };\n const indices = new Array();\n const positions = new Array();\n const normals = new Array();\n const uvs = new Array();\n let row, col, tileRow, tileCol;\n subdivisions.h = subdivisions.h < 1 ? 1 : subdivisions.h;\n subdivisions.w = subdivisions.w < 1 ? 1 : subdivisions.w;\n precision.w = precision.w < 1 ? 1 : precision.w;\n precision.h = precision.h < 1 ? 1 : precision.h;\n const tileSize = {\n w: (xmax - xmin) / subdivisions.w,\n h: (zmax - zmin) / subdivisions.h,\n };\n function applyTile(xTileMin, zTileMin, xTileMax, zTileMax) {\n // Indices\n const base = positions.length / 3;\n const rowLength = precision.w + 1;\n for (row = 0; row < precision.h; row++) {\n for (col = 0; col < precision.w; col++) {\n const square = [base + col + row * rowLength, base + (col + 1) + row * rowLength, base + (col + 1) + (row + 1) * rowLength, base + col + (row + 1) * rowLength];\n indices.push(square[1]);\n indices.push(square[2]);\n indices.push(square[3]);\n indices.push(square[0]);\n indices.push(square[1]);\n indices.push(square[3]);\n }\n }\n // Position, normals and uvs\n const position = Vector3.Zero();\n const normal = new Vector3(0, 1.0, 0);\n for (row = 0; row <= precision.h; row++) {\n position.z = (row * (zTileMax - zTileMin)) / precision.h + zTileMin;\n for (col = 0; col <= precision.w; col++) {\n position.x = (col * (xTileMax - xTileMin)) / precision.w + xTileMin;\n position.y = 0;\n positions.push(position.x, position.y, position.z);\n normals.push(normal.x, normal.y, normal.z);\n uvs.push(col / precision.w, row / precision.h);\n }\n }\n }\n for (tileRow = 0; tileRow < subdivisions.h; tileRow++) {\n for (tileCol = 0; tileCol < subdivisions.w; tileCol++) {\n applyTile(xmin + tileCol * tileSize.w, zmin + tileRow * tileSize.h, xmin + (tileCol + 1) * tileSize.w, zmin + (tileRow + 1) * tileSize.h);\n }\n }\n // Result\n const vertexData = new VertexData();\n vertexData.indices = indices;\n vertexData.positions = positions;\n vertexData.normals = normals;\n vertexData.uvs = uvs;\n return vertexData;\n}\n/**\n * Creates the VertexData of the Ground designed from a heightmap\n * @param options an object used to set the following parameters for the Ground, required and provided by CreateGroundFromHeightMap\n * * width the width (x direction) of the ground\n * * height the height (z direction) of the ground\n * * subdivisions the number of subdivisions per side\n * * minHeight the minimum altitude on the ground, optional, default 0\n * * maxHeight the maximum altitude on the ground, optional default 1\n * * colorFilter the filter to apply to the image pixel colors to compute the height, optional Color3, default (0.3, 0.59, 0.11)\n * * buffer the array holding the image color data\n * * bufferWidth the width of image\n * * bufferHeight the height of image\n * * alphaFilter Remove any data where the alpha channel is below this value, defaults 0 (all data visible)\n * @param options.width\n * @param options.height\n * @param options.subdivisions\n * @param options.minHeight\n * @param options.maxHeight\n * @param options.colorFilter\n * @param options.buffer\n * @param options.bufferWidth\n * @param options.bufferHeight\n * @param options.alphaFilter\n * @returns the VertexData of the Ground designed from a heightmap\n */\nexport function CreateGroundFromHeightMapVertexData(options) {\n const indices = [];\n const positions = [];\n const normals = [];\n const uvs = [];\n let row, col;\n const filter = options.colorFilter || new Color3(0.3, 0.59, 0.11);\n const alphaFilter = options.alphaFilter || 0.0;\n let invert = false;\n if (options.minHeight > options.maxHeight) {\n invert = true;\n const temp = options.maxHeight;\n options.maxHeight = options.minHeight;\n options.minHeight = temp;\n }\n // Vertices\n for (row = 0; row <= options.subdivisions; row++) {\n for (col = 0; col <= options.subdivisions; col++) {\n const position = new Vector3((col * options.width) / options.subdivisions - options.width / 2.0, 0, ((options.subdivisions - row) * options.height) / options.subdivisions - options.height / 2.0);\n // Compute height\n const heightMapX = (((position.x + options.width / 2) / options.width) * (options.bufferWidth - 1)) | 0;\n const heightMapY = ((1.0 - (position.z + options.height / 2) / options.height) * (options.bufferHeight - 1)) | 0;\n const pos = (heightMapX + heightMapY * options.bufferWidth) * 4;\n let r = options.buffer[pos] / 255.0;\n let g = options.buffer[pos + 1] / 255.0;\n let b = options.buffer[pos + 2] / 255.0;\n const a = options.buffer[pos + 3] / 255.0;\n if (invert) {\n r = 1.0 - r;\n g = 1.0 - g;\n b = 1.0 - b;\n }\n const gradient = r * filter.r + g * filter.g + b * filter.b;\n // If our alpha channel is not within our filter then we will assign a 'special' height\n // Then when building the indices, we will ignore any vertex that is using the special height\n if (a >= alphaFilter) {\n position.y = options.minHeight + (options.maxHeight - options.minHeight) * gradient;\n }\n else {\n position.y = options.minHeight - Epsilon; // We can't have a height below minHeight, normally.\n }\n // Add vertex\n positions.push(position.x, position.y, position.z);\n normals.push(0, 0, 0);\n uvs.push(col / options.subdivisions, 1.0 - row / options.subdivisions);\n }\n }\n // Indices\n for (row = 0; row < options.subdivisions; row++) {\n for (col = 0; col < options.subdivisions; col++) {\n // Calculate Indices\n const idx1 = col + 1 + (row + 1) * (options.subdivisions + 1);\n const idx2 = col + 1 + row * (options.subdivisions + 1);\n const idx3 = col + row * (options.subdivisions + 1);\n const idx4 = col + (row + 1) * (options.subdivisions + 1);\n // Check that all indices are visible (based on our special height)\n // Only display the vertex if all Indices are visible\n // Positions are stored x,y,z for each vertex, hence the * 3 and + 1 for height\n const isVisibleIdx1 = positions[idx1 * 3 + 1] >= options.minHeight;\n const isVisibleIdx2 = positions[idx2 * 3 + 1] >= options.minHeight;\n const isVisibleIdx3 = positions[idx3 * 3 + 1] >= options.minHeight;\n if (isVisibleIdx1 && isVisibleIdx2 && isVisibleIdx3) {\n indices.push(idx1);\n indices.push(idx2);\n indices.push(idx3);\n }\n const isVisibleIdx4 = positions[idx4 * 3 + 1] >= options.minHeight;\n if (isVisibleIdx4 && isVisibleIdx1 && isVisibleIdx3) {\n indices.push(idx4);\n indices.push(idx1);\n indices.push(idx3);\n }\n }\n }\n // Normals\n VertexData.ComputeNormals(positions, indices, normals);\n // Result\n const vertexData = new VertexData();\n vertexData.indices = indices;\n vertexData.positions = positions;\n vertexData.normals = normals;\n vertexData.uvs = uvs;\n return vertexData;\n}\n/**\n * Creates a ground mesh\n * * The parameters `width` and `height` (floats, default 1) set the width and height sizes of the ground\n * * The parameter `subdivisions` (positive integer) sets the number of subdivisions per side\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\n * @param name defines the name of the mesh\n * @param options defines the options used to create the mesh\n * @param options.width\n * @param options.height\n * @param options.subdivisions\n * @param options.subdivisionsX\n * @param options.subdivisionsY\n * @param options.updatable\n * @param scene defines the hosting scene\n * @returns the ground mesh\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#ground\n */\nexport function CreateGround(name, options = {}, scene) {\n const ground = new GroundMesh(name, scene);\n ground._setReady(false);\n ground._subdivisionsX = options.subdivisionsX || options.subdivisions || 1;\n ground._subdivisionsY = options.subdivisionsY || options.subdivisions || 1;\n ground._width = options.width || 1;\n ground._height = options.height || 1;\n ground._maxX = ground._width / 2;\n ground._maxZ = ground._height / 2;\n ground._minX = -ground._maxX;\n ground._minZ = -ground._maxZ;\n const vertexData = CreateGroundVertexData(options);\n vertexData.applyToMesh(ground, options.updatable);\n ground._setReady(true);\n return ground;\n}\n/**\n * Creates a tiled ground mesh\n * * The parameters `xmin` and `xmax` (floats, default -1 and 1) set the ground minimum and maximum X coordinates\n * * The parameters `zmin` and `zmax` (floats, default -1 and 1) set the ground minimum and maximum Z coordinates\n * * The parameter `subdivisions` is a javascript object `{w: positive integer, h: positive integer}` (default `{w: 6, h: 6}`). `w` and `h` are the numbers of subdivisions on the ground width and height. Each subdivision is called a tile\n * * The parameter `precision` is a javascript object `{w: positive integer, h: positive integer}` (default `{w: 2, h: 2}`). `w` and `h` are the numbers of subdivisions on the ground width and height of each tile\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.\n * @param name defines the name of the mesh\n * @param options defines the options used to create the mesh\n * @param options.xmin\n * @param options.zmin\n * @param options.xmax\n * @param options.zmax\n * @param options.subdivisions\n * @param options.subdivisions.w\n * @param options.subdivisions.h\n * @param options.precision\n * @param options.precision.w\n * @param options.precision.h\n * @param options.updatable\n * @param scene defines the hosting scene\n * @returns the tiled ground mesh\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#tiled-ground\n */\nexport function CreateTiledGround(name, options, scene = null) {\n const tiledGround = new Mesh(name, scene);\n const vertexData = CreateTiledGroundVertexData(options);\n vertexData.applyToMesh(tiledGround, options.updatable);\n return tiledGround;\n}\n/**\n * Creates a ground mesh from a height map\n * * The parameter `url` sets the URL of the height map image resource.\n * * The parameters `width` and `height` (positive floats, default 10) set the ground width and height sizes.\n * * The parameter `subdivisions` (positive integer, default 1) sets the number of subdivision per side.\n * * The parameter `minHeight` (float, default 0) is the minimum altitude on the ground.\n * * The parameter `maxHeight` (float, default 1) is the maximum altitude on the ground.\n * * The parameter `colorFilter` (optional Color3, default (0.3, 0.59, 0.11) ) is the filter to apply to the image pixel colors to compute the height.\n * * The parameter `onReady` is a javascript callback function that will be called once the mesh is just built (the height map download can last some time).\n * * The parameter `alphaFilter` will filter any data where the alpha channel is below this value, defaults 0 (all data visible)\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.\n * @param name defines the name of the mesh\n * @param url defines the url to the height map\n * @param options defines the options used to create the mesh\n * @param options.width\n * @param options.height\n * @param options.subdivisions\n * @param options.minHeight\n * @param options.maxHeight\n * @param options.colorFilter\n * @param options.alphaFilter\n * @param options.updatable\n * @param options.onReady\n * @param scene defines the hosting scene\n * @returns the ground mesh\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set/height_map\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#ground-from-a-height-map\n */\nexport function CreateGroundFromHeightMap(name, url, options = {}, scene = null) {\n const width = options.width || 10.0;\n const height = options.height || 10.0;\n const subdivisions = options.subdivisions || 1 | 0;\n const minHeight = options.minHeight || 0.0;\n const maxHeight = options.maxHeight || 1.0;\n const filter = options.colorFilter || new Color3(0.3, 0.59, 0.11);\n const alphaFilter = options.alphaFilter || 0.0;\n const updatable = options.updatable;\n const onReady = options.onReady;\n scene = scene || EngineStore.LastCreatedScene;\n const ground = new GroundMesh(name, scene);\n ground._subdivisionsX = subdivisions;\n ground._subdivisionsY = subdivisions;\n ground._width = width;\n ground._height = height;\n ground._maxX = ground._width / 2.0;\n ground._maxZ = ground._height / 2.0;\n ground._minX = -ground._maxX;\n ground._minZ = -ground._maxZ;\n ground._setReady(false);\n const onload = (img) => {\n const bufferWidth = img.width;\n const bufferHeight = img.height;\n if (scene.isDisposed) {\n return;\n }\n const buffer = scene === null || scene === void 0 ? void 0 : scene.getEngine().resizeImageBitmap(img, bufferWidth, bufferHeight);\n const vertexData = CreateGroundFromHeightMapVertexData({\n width: width,\n height: height,\n subdivisions: subdivisions,\n minHeight: minHeight,\n maxHeight: maxHeight,\n colorFilter: filter,\n buffer: buffer,\n bufferWidth: bufferWidth,\n bufferHeight: bufferHeight,\n alphaFilter: alphaFilter,\n });\n vertexData.applyToMesh(ground, updatable);\n //execute ready callback, if set\n if (onReady) {\n onReady(ground);\n }\n ground._setReady(true);\n };\n Tools.LoadImage(url, onload, () => { }, scene.offlineProvider);\n return ground;\n}\n/**\n * Class containing static functions to help procedurally build meshes\n * @deprecated use the functions directly from the module\n */\nexport const GroundBuilder = {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n CreateGround,\n // eslint-disable-next-line @typescript-eslint/naming-convention\n CreateGroundFromHeightMap,\n // eslint-disable-next-line @typescript-eslint/naming-convention\n CreateTiledGround,\n};\nVertexData.CreateGround = CreateGroundVertexData;\nVertexData.CreateTiledGround = CreateTiledGroundVertexData;\nVertexData.CreateGroundFromHeightMap = CreateGroundFromHeightMapVertexData;\nMesh.CreateGround = (name, width, height, subdivisions, scene, updatable) => {\n const options = {\n width,\n height,\n subdivisions,\n updatable,\n };\n return CreateGround(name, options, scene);\n};\nMesh.CreateTiledGround = (name, xmin, zmin, xmax, zmax, subdivisions, precision, scene, updatable) => {\n const options = {\n xmin,\n zmin,\n xmax,\n zmax,\n subdivisions,\n precision,\n updatable,\n };\n return CreateTiledGround(name, options, scene);\n};\nMesh.CreateGroundFromHeightMap = (name, url, width, height, subdivisions, minHeight, maxHeight, scene, updatable, onReady, alphaFilter) => {\n const options = {\n width,\n height,\n subdivisions,\n minHeight,\n maxHeight,\n updatable,\n onReady,\n alphaFilter,\n };\n return CreateGroundFromHeightMap(name, url, options, scene);\n};\n//# sourceMappingURL=groundBuilder.js.map","import { Matrix, Vector4 } from \"../../Maths/math.vector.js\";\nimport { Color4 } from \"../../Maths/math.color.js\";\nimport { Mesh } from \"../mesh.js\";\nimport { VertexData } from \"../mesh.vertexData.js\";\nimport { CompatibilityOptions } from \"../../Compat/compatibilityOptions.js\";\nimport { CreateGroundVertexData } from \"./groundBuilder.js\";\n/**\n * Creates the VertexData for a box\n * @param options an object used to set the following optional parameters for the box, required but can be empty\n * * size sets the width, height and depth of the box to the value of size, optional default 1\n * * width sets the width (x direction) of the box, overwrites the width set by size, optional, default size\n * * height sets the height (y direction) of the box, overwrites the height set by size, optional, default size\n * * depth sets the depth (z direction) of the box, overwrites the depth set by size, optional, default size\n * * faceUV an array of 6 Vector4 elements used to set different images to each box side\n * * faceColors an array of 6 Color3 elements used to set different colors to each box side\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\n * @param options.size\n * @param options.width\n * @param options.height\n * @param options.depth\n * @param options.faceUV\n * @param options.faceColors\n * @param options.sideOrientation\n * @param options.frontUVs\n * @param options.backUVs\n * @param options.wrap\n * @param options.topBaseAt\n * @param options.bottomBaseAt\n * @returns the VertexData of the box\n */\nexport function CreateBoxVertexData(options) {\n const nbFaces = 6;\n let indices = [0, 1, 2, 0, 2, 3, 4, 5, 6, 4, 6, 7, 8, 9, 10, 8, 10, 11, 12, 13, 14, 12, 14, 15, 16, 17, 18, 16, 18, 19, 20, 21, 22, 20, 22, 23];\n const normals = [\n 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, 0, 1, 0, 0, 1, 0, 0,\n 1, 0, 0, 1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0,\n ];\n const uvs = [];\n let positions = [];\n const width = options.width || options.size || 1;\n const height = options.height || options.size || 1;\n const depth = options.depth || options.size || 1;\n const wrap = options.wrap || false;\n let topBaseAt = options.topBaseAt === void 0 ? 1 : options.topBaseAt;\n let bottomBaseAt = options.bottomBaseAt === void 0 ? 0 : options.bottomBaseAt;\n topBaseAt = (topBaseAt + 4) % 4; // places values as 0 to 3\n bottomBaseAt = (bottomBaseAt + 4) % 4; // places values as 0 to 3\n const topOrder = [2, 0, 3, 1];\n const bottomOrder = [2, 0, 1, 3];\n let topIndex = topOrder[topBaseAt];\n let bottomIndex = bottomOrder[bottomBaseAt];\n let basePositions = [\n 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1,\n 1, 1, -1, 1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, 1, -1, -1, -1, -1, -1, -1, -1, 1,\n ];\n if (wrap) {\n indices = [2, 3, 0, 2, 0, 1, 4, 5, 6, 4, 6, 7, 9, 10, 11, 9, 11, 8, 12, 14, 15, 12, 13, 14];\n basePositions = [\n -1, 1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, -1, -1,\n ];\n let topFaceBase = [\n [1, 1, 1],\n [-1, 1, 1],\n [-1, 1, -1],\n [1, 1, -1],\n ];\n let bottomFaceBase = [\n [-1, -1, 1],\n [1, -1, 1],\n [1, -1, -1],\n [-1, -1, -1],\n ];\n const topFaceOrder = [17, 18, 19, 16];\n const bottomFaceOrder = [22, 23, 20, 21];\n while (topIndex > 0) {\n topFaceBase.unshift(topFaceBase.pop());\n topFaceOrder.unshift(topFaceOrder.pop());\n topIndex--;\n }\n while (bottomIndex > 0) {\n bottomFaceBase.unshift(bottomFaceBase.pop());\n bottomFaceOrder.unshift(bottomFaceOrder.pop());\n bottomIndex--;\n }\n topFaceBase = topFaceBase.flat();\n bottomFaceBase = bottomFaceBase.flat();\n basePositions = basePositions.concat(topFaceBase).concat(bottomFaceBase);\n indices.push(topFaceOrder[0], topFaceOrder[2], topFaceOrder[3], topFaceOrder[0], topFaceOrder[1], topFaceOrder[2]);\n indices.push(bottomFaceOrder[0], bottomFaceOrder[2], bottomFaceOrder[3], bottomFaceOrder[0], bottomFaceOrder[1], bottomFaceOrder[2]);\n }\n const scaleArray = [width / 2, height / 2, depth / 2];\n positions = basePositions.reduce((accumulator, currentValue, currentIndex) => accumulator.concat(currentValue * scaleArray[currentIndex % 3]), []);\n const sideOrientation = options.sideOrientation === 0 ? 0 : options.sideOrientation || VertexData.DEFAULTSIDE;\n const faceUV = options.faceUV || new Array(6);\n const faceColors = options.faceColors;\n const colors = [];\n // default face colors and UV if undefined\n for (let f = 0; f < 6; f++) {\n if (faceUV[f] === undefined) {\n faceUV[f] = new Vector4(0, 0, 1, 1);\n }\n if (faceColors && faceColors[f] === undefined) {\n faceColors[f] = new Color4(1, 1, 1, 1);\n }\n }\n // Create each face in turn.\n for (let index = 0; index < nbFaces; index++) {\n uvs.push(faceUV[index].z, CompatibilityOptions.UseOpenGLOrientationForUV ? 1.0 - faceUV[index].w : faceUV[index].w);\n uvs.push(faceUV[index].x, CompatibilityOptions.UseOpenGLOrientationForUV ? 1.0 - faceUV[index].w : faceUV[index].w);\n uvs.push(faceUV[index].x, CompatibilityOptions.UseOpenGLOrientationForUV ? 1.0 - faceUV[index].y : faceUV[index].y);\n uvs.push(faceUV[index].z, CompatibilityOptions.UseOpenGLOrientationForUV ? 1.0 - faceUV[index].y : faceUV[index].y);\n if (faceColors) {\n for (let c = 0; c < 4; c++) {\n colors.push(faceColors[index].r, faceColors[index].g, faceColors[index].b, faceColors[index].a);\n }\n }\n }\n // sides\n VertexData._ComputeSides(sideOrientation, positions, indices, normals, uvs, options.frontUVs, options.backUVs);\n // Result\n const vertexData = new VertexData();\n vertexData.indices = indices;\n vertexData.positions = positions;\n vertexData.normals = normals;\n vertexData.uvs = uvs;\n if (faceColors) {\n const totalColors = sideOrientation === VertexData.DOUBLESIDE ? colors.concat(colors) : colors;\n vertexData.colors = totalColors;\n }\n return vertexData;\n}\n/**\n * Creates the VertexData for a segmented box\n * @param options an object used to set the following optional parameters for the box, required but can be empty\n * * size sets the width, height and depth of the box to the value of size, optional default 1\n * * width sets the width (x direction) of the box, overwrites the width set by size, optional, default size\n * * height sets the height (y direction) of the box, overwrites the height set by size, optional, default size\n * * depth sets the depth (z direction) of the box, overwrites the depth set by size, optional, default size\n * * segments sets the number of segments on the all axis (1 by default)\n * * widthSegments sets the number of segments on the x axis (1 by default)\n * * heightSegments sets the number of segments on the y axis (1 by default)\n * * depthSegments sets the number of segments on the z axis (1 by default)\n * @param options.size\n * @param options.width\n * @param options.height\n * @param options.depth\n * @param options.segments\n * @param options.widthSegments\n * @param options.heightSegments\n * @param options.depthSegments\n * @returns the VertexData of the box\n */\nexport function CreateSegmentedBoxVertexData(options) {\n const width = options.width || options.size || 1;\n const height = options.height || options.size || 1;\n const depth = options.depth || options.size || 1;\n const widthSegments = (options.widthSegments || options.segments || 1) | 0;\n const heightSegments = (options.heightSegments || options.segments || 1) | 0;\n const depthSegments = (options.depthSegments || options.segments || 1) | 0;\n const rotationMatrix = new Matrix();\n const translationMatrix = new Matrix();\n const transformMatrix = new Matrix();\n const bottomPlane = CreateGroundVertexData({ width: width, height: depth, subdivisionsX: widthSegments, subdivisionsY: depthSegments });\n Matrix.TranslationToRef(0, -height / 2, 0, translationMatrix);\n Matrix.RotationZToRef(Math.PI, rotationMatrix);\n rotationMatrix.multiplyToRef(translationMatrix, transformMatrix);\n bottomPlane.transform(transformMatrix);\n const topPlane = CreateGroundVertexData({ width: width, height: depth, subdivisionsX: widthSegments, subdivisionsY: depthSegments });\n Matrix.TranslationToRef(0, height / 2, 0, transformMatrix);\n topPlane.transform(transformMatrix);\n const negXPlane = CreateGroundVertexData({ width: height, height: depth, subdivisionsX: heightSegments, subdivisionsY: depthSegments });\n Matrix.TranslationToRef(-width / 2, 0, 0, translationMatrix);\n Matrix.RotationZToRef(Math.PI / 2, rotationMatrix);\n rotationMatrix.multiplyToRef(translationMatrix, transformMatrix);\n negXPlane.transform(transformMatrix);\n const posXPlane = CreateGroundVertexData({ width: height, height: depth, subdivisionsX: heightSegments, subdivisionsY: depthSegments });\n Matrix.TranslationToRef(width / 2, 0, 0, translationMatrix);\n Matrix.RotationZToRef(-Math.PI / 2, rotationMatrix);\n rotationMatrix.multiplyToRef(translationMatrix, transformMatrix);\n posXPlane.transform(transformMatrix);\n const negZPlane = CreateGroundVertexData({ width: width, height: height, subdivisionsX: widthSegments, subdivisionsY: heightSegments });\n Matrix.TranslationToRef(0, 0, -depth / 2, translationMatrix);\n Matrix.RotationXToRef(-Math.PI / 2, rotationMatrix);\n rotationMatrix.multiplyToRef(translationMatrix, transformMatrix);\n negZPlane.transform(transformMatrix);\n const posZPlane = CreateGroundVertexData({ width: width, height: height, subdivisionsX: widthSegments, subdivisionsY: heightSegments });\n Matrix.TranslationToRef(0, 0, depth / 2, translationMatrix);\n Matrix.RotationXToRef(Math.PI / 2, rotationMatrix);\n rotationMatrix.multiplyToRef(translationMatrix, transformMatrix);\n posZPlane.transform(transformMatrix);\n // Result\n bottomPlane.merge([topPlane, posXPlane, negXPlane, negZPlane, posZPlane], true);\n return bottomPlane;\n}\n/**\n * Creates a box mesh\n * * The parameter `size` sets the size (float) of each box side (default 1)\n * * You can set some different box dimensions by using the parameters `width`, `height` and `depth` (all by default have the same value of `size`)\n * * You can set different colors and different images to each box side by using the parameters `faceColors` (an array of 6 Color3 elements) and `faceUV` (an array of 6 Vector4 elements)\n * * Please read this tutorial : https://doc.babylonjs.com/features/featuresDeepDive/materials/using/texturePerBoxFace\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#box\n * @param name defines the name of the mesh\n * @param options defines the options used to create the mesh\n * @param options.size\n * @param options.width\n * @param options.height\n * @param options.depth\n * @param options.faceUV\n * @param options.faceColors\n * @param options.sideOrientation\n * @param options.frontUVs\n * @param options.backUVs\n * @param options.wrap\n * @param options.topBaseAt\n * @param options.bottomBaseAt\n * @param options.updatable\n * @param scene defines the hosting scene\n * @returns the box mesh\n */\nexport function CreateBox(name, options = {}, scene = null) {\n const box = new Mesh(name, scene);\n options.sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\n box._originalBuilderSideOrientation = options.sideOrientation;\n const vertexData = CreateBoxVertexData(options);\n vertexData.applyToMesh(box, options.updatable);\n return box;\n}\n/**\n * Class containing static functions to help procedurally build meshes\n * @deprecated please use CreateBox directly\n */\nexport const BoxBuilder = {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n CreateBox,\n};\n// Side effects\nVertexData.CreateBox = CreateBoxVertexData;\nMesh.CreateBox = (name, size, scene = null, updatable, sideOrientation) => {\n const options = {\n size,\n sideOrientation,\n updatable,\n };\n return CreateBox(name, options, scene);\n};\n//# sourceMappingURL=boxBuilder.js.map","import { Mesh } from \"../mesh.js\";\nimport { VertexData } from \"../mesh.vertexData.js\";\n/**\n * Creates the VertexData for a tiled plane\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set/tiled_plane\n * @param options an object used to set the following optional parameters for the tiled plane, required but can be empty\n * * pattern a limited pattern arrangement depending on the number\n * * size of the box\n * * width of the box, overwrites size\n * * height of the box, overwrites size\n * * tileSize sets the width, height and depth of the tile to the value of size, optional default 1\n * * tileWidth sets the width (x direction) of the tile, overwrites the width set by size, optional, default size\n * * tileHeight sets the height (y direction) of the tile, overwrites the height set by size, optional, default size\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\n * * alignHorizontal places whole tiles aligned to the center, left or right of a row\n * * alignVertical places whole tiles aligned to the center, left or right of a column\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\n * @param options.pattern\n * @param options.tileSize\n * @param options.tileWidth\n * @param options.tileHeight\n * @param options.size\n * @param options.width\n * @param options.height\n * @param options.alignHorizontal\n * @param options.alignVertical\n * @param options.sideOrientation\n * @param options.frontUVs\n * @param options.backUVs\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\n * @returns the VertexData of the tiled plane\n */\nexport function CreateTiledPlaneVertexData(options) {\n const flipTile = options.pattern || Mesh.NO_FLIP;\n const tileWidth = options.tileWidth || options.tileSize || 1;\n const tileHeight = options.tileHeight || options.tileSize || 1;\n const alignH = options.alignHorizontal || 0;\n const alignV = options.alignVertical || 0;\n const width = options.width || options.size || 1;\n const tilesX = Math.floor(width / tileWidth);\n let offsetX = width - tilesX * tileWidth;\n const height = options.height || options.size || 1;\n const tilesY = Math.floor(height / tileHeight);\n let offsetY = height - tilesY * tileHeight;\n const halfWidth = (tileWidth * tilesX) / 2;\n const halfHeight = (tileHeight * tilesY) / 2;\n let adjustX = 0;\n let adjustY = 0;\n let startX = 0;\n let startY = 0;\n let endX = 0;\n let endY = 0;\n //Part Tiles\n if (offsetX > 0 || offsetY > 0) {\n startX = -halfWidth;\n startY = -halfHeight;\n endX = halfWidth;\n endY = halfHeight;\n switch (alignH) {\n case Mesh.CENTER:\n offsetX /= 2;\n startX -= offsetX;\n endX += offsetX;\n break;\n case Mesh.LEFT:\n endX += offsetX;\n adjustX = -offsetX / 2;\n break;\n case Mesh.RIGHT:\n startX -= offsetX;\n adjustX = offsetX / 2;\n break;\n }\n switch (alignV) {\n case Mesh.CENTER:\n offsetY /= 2;\n startY -= offsetY;\n endY += offsetY;\n break;\n case Mesh.BOTTOM:\n endY += offsetY;\n adjustY = -offsetY / 2;\n break;\n case Mesh.TOP:\n startY -= offsetY;\n adjustY = offsetY / 2;\n break;\n }\n }\n const positions = [];\n const normals = [];\n const uvBase = [];\n uvBase[0] = [0, 0, 1, 0, 1, 1, 0, 1];\n uvBase[1] = [0, 0, 1, 0, 1, 1, 0, 1];\n if (flipTile === Mesh.ROTATE_TILE || flipTile === Mesh.ROTATE_ROW) {\n uvBase[1] = [1, 1, 0, 1, 0, 0, 1, 0];\n }\n if (flipTile === Mesh.FLIP_TILE || flipTile === Mesh.FLIP_ROW) {\n uvBase[1] = [1, 0, 0, 0, 0, 1, 1, 1];\n }\n if (flipTile === Mesh.FLIP_N_ROTATE_TILE || flipTile === Mesh.FLIP_N_ROTATE_ROW) {\n uvBase[1] = [0, 1, 1, 1, 1, 0, 0, 0];\n }\n let uvs = [];\n const colors = [];\n const indices = [];\n let index = 0;\n for (let y = 0; y < tilesY; y++) {\n for (let x = 0; x < tilesX; x++) {\n positions.push(-halfWidth + x * tileWidth + adjustX, -halfHeight + y * tileHeight + adjustY, 0);\n positions.push(-halfWidth + (x + 1) * tileWidth + adjustX, -halfHeight + y * tileHeight + adjustY, 0);\n positions.push(-halfWidth + (x + 1) * tileWidth + adjustX, -halfHeight + (y + 1) * tileHeight + adjustY, 0);\n positions.push(-halfWidth + x * tileWidth + adjustX, -halfHeight + (y + 1) * tileHeight + adjustY, 0);\n indices.push(index, index + 1, index + 3, index + 1, index + 2, index + 3);\n if (flipTile === Mesh.FLIP_TILE || flipTile === Mesh.ROTATE_TILE || flipTile === Mesh.FLIP_N_ROTATE_TILE) {\n uvs = uvs.concat(uvBase[((x % 2) + (y % 2)) % 2]);\n }\n else if (flipTile === Mesh.FLIP_ROW || flipTile === Mesh.ROTATE_ROW || flipTile === Mesh.FLIP_N_ROTATE_ROW) {\n uvs = uvs.concat(uvBase[y % 2]);\n }\n else {\n uvs = uvs.concat(uvBase[0]);\n }\n colors.push(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);\n normals.push(0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1);\n index += 4;\n }\n }\n //Part Tiles\n if (offsetX > 0 || offsetY > 0) {\n const partialBottomRow = offsetY > 0 && (alignV === Mesh.CENTER || alignV === Mesh.TOP);\n const partialTopRow = offsetY > 0 && (alignV === Mesh.CENTER || alignV === Mesh.BOTTOM);\n const partialLeftCol = offsetX > 0 && (alignH === Mesh.CENTER || alignH === Mesh.RIGHT);\n const partialRightCol = offsetX > 0 && (alignH === Mesh.CENTER || alignH === Mesh.LEFT);\n let uvPart = [];\n let a, b, c, d;\n //corners\n if (partialBottomRow && partialLeftCol) {\n //bottom left corner\n positions.push(startX + adjustX, startY + adjustY, 0);\n positions.push(-halfWidth + adjustX, startY + adjustY, 0);\n positions.push(-halfWidth + adjustX, startY + offsetY + adjustY, 0);\n positions.push(startX + adjustX, startY + offsetY + adjustY, 0);\n indices.push(index, index + 1, index + 3, index + 1, index + 2, index + 3);\n index += 4;\n a = 1 - offsetX / tileWidth;\n b = 1 - offsetY / tileHeight;\n c = 1;\n d = 1;\n uvPart = [a, b, c, b, c, d, a, d];\n if (flipTile === Mesh.ROTATE_ROW) {\n uvPart = [1 - a, 1 - b, 1 - c, 1 - b, 1 - c, 1 - d, 1 - a, 1 - d];\n }\n if (flipTile === Mesh.FLIP_ROW) {\n uvPart = [1 - a, b, 1 - c, b, 1 - c, d, 1 - a, d];\n }\n if (flipTile === Mesh.FLIP_N_ROTATE_ROW) {\n uvPart = [a, 1 - b, c, 1 - b, c, 1 - d, a, 1 - d];\n }\n uvs = uvs.concat(uvPart);\n colors.push(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);\n normals.push(0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1);\n }\n if (partialBottomRow && partialRightCol) {\n //bottom right corner\n positions.push(halfWidth + adjustX, startY + adjustY, 0);\n positions.push(endX + adjustX, startY + adjustY, 0);\n positions.push(endX + adjustX, startY + offsetY + adjustY, 0);\n positions.push(halfWidth + adjustX, startY + offsetY + adjustY, 0);\n indices.push(index, index + 1, index + 3, index + 1, index + 2, index + 3);\n index += 4;\n a = 0;\n b = 1 - offsetY / tileHeight;\n c = offsetX / tileWidth;\n d = 1;\n uvPart = [a, b, c, b, c, d, a, d];\n if (flipTile === Mesh.ROTATE_ROW || (flipTile === Mesh.ROTATE_TILE && tilesX % 2 === 0)) {\n uvPart = [1 - a, 1 - b, 1 - c, 1 - b, 1 - c, 1 - d, 1 - a, 1 - d];\n }\n if (flipTile === Mesh.FLIP_ROW || (flipTile === Mesh.FLIP_TILE && tilesX % 2 === 0)) {\n uvPart = [1 - a, b, 1 - c, b, 1 - c, d, 1 - a, d];\n }\n if (flipTile === Mesh.FLIP_N_ROTATE_ROW || (flipTile === Mesh.FLIP_N_ROTATE_TILE && tilesX % 2 === 0)) {\n uvPart = [a, 1 - b, c, 1 - b, c, 1 - d, a, 1 - d];\n }\n uvs = uvs.concat(uvPart);\n colors.push(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);\n normals.push(0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1);\n }\n if (partialTopRow && partialLeftCol) {\n //top left corner\n positions.push(startX + adjustX, halfHeight + adjustY, 0);\n positions.push(-halfWidth + adjustX, halfHeight + adjustY, 0);\n positions.push(-halfWidth + adjustX, endY + adjustY, 0);\n positions.push(startX + adjustX, endY + adjustY, 0);\n indices.push(index, index + 1, index + 3, index + 1, index + 2, index + 3);\n index += 4;\n a = 1 - offsetX / tileWidth;\n b = 0;\n c = 1;\n d = offsetY / tileHeight;\n uvPart = [a, b, c, b, c, d, a, d];\n if ((flipTile === Mesh.ROTATE_ROW && tilesY % 2 === 1) || (flipTile === Mesh.ROTATE_TILE && tilesY % 1 === 0)) {\n uvPart = [1 - a, 1 - b, 1 - c, 1 - b, 1 - c, 1 - d, 1 - a, 1 - d];\n }\n if ((flipTile === Mesh.FLIP_ROW && tilesY % 2 === 1) || (flipTile === Mesh.FLIP_TILE && tilesY % 2 === 0)) {\n uvPart = [1 - a, b, 1 - c, b, 1 - c, d, 1 - a, d];\n }\n if ((flipTile === Mesh.FLIP_N_ROTATE_ROW && tilesY % 2 === 1) || (flipTile === Mesh.FLIP_N_ROTATE_TILE && tilesY % 2 === 0)) {\n uvPart = [a, 1 - b, c, 1 - b, c, 1 - d, a, 1 - d];\n }\n uvs = uvs.concat(uvPart);\n colors.push(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);\n normals.push(0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1);\n }\n if (partialTopRow && partialRightCol) {\n //top right corner\n positions.push(halfWidth + adjustX, halfHeight + adjustY, 0);\n positions.push(endX + adjustX, halfHeight + adjustY, 0);\n positions.push(endX + adjustX, endY + adjustY, 0);\n positions.push(halfWidth + adjustX, endY + adjustY, 0);\n indices.push(index, index + 1, index + 3, index + 1, index + 2, index + 3);\n index += 4;\n a = 0;\n b = 0;\n c = offsetX / tileWidth;\n d = offsetY / tileHeight;\n uvPart = [a, b, c, b, c, d, a, d];\n if ((flipTile === Mesh.ROTATE_ROW && tilesY % 2 === 1) || (flipTile === Mesh.ROTATE_TILE && (tilesY + tilesX) % 2 === 1)) {\n uvPart = [1 - a, 1 - b, 1 - c, 1 - b, 1 - c, 1 - d, 1 - a, 1 - d];\n }\n if ((flipTile === Mesh.FLIP_ROW && tilesY % 2 === 1) || (flipTile === Mesh.FLIP_TILE && (tilesY + tilesX) % 2 === 1)) {\n uvPart = [1 - a, b, 1 - c, b, 1 - c, d, 1 - a, d];\n }\n if ((flipTile === Mesh.FLIP_N_ROTATE_ROW && tilesY % 2 === 1) || (flipTile === Mesh.FLIP_N_ROTATE_TILE && (tilesY + tilesX) % 2 === 1)) {\n uvPart = [a, 1 - b, c, 1 - b, c, 1 - d, a, 1 - d];\n }\n uvs = uvs.concat(uvPart);\n colors.push(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);\n normals.push(0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1);\n }\n //part rows\n if (partialBottomRow) {\n const uvBaseBR = [];\n a = 0;\n b = 1 - offsetY / tileHeight;\n c = 1;\n d = 1;\n uvBaseBR[0] = [a, b, c, b, c, d, a, d];\n uvBaseBR[1] = [a, b, c, b, c, d, a, d];\n if (flipTile === Mesh.ROTATE_TILE || flipTile === Mesh.ROTATE_ROW) {\n uvBaseBR[1] = [1 - a, 1 - b, 1 - c, 1 - b, 1 - c, 1 - d, 1 - a, 1 - d];\n }\n if (flipTile === Mesh.FLIP_TILE || flipTile === Mesh.FLIP_ROW) {\n uvBaseBR[1] = [1 - a, b, 1 - c, b, 1 - c, d, 1 - a, d];\n }\n if (flipTile === Mesh.FLIP_N_ROTATE_TILE || flipTile === Mesh.FLIP_N_ROTATE_ROW) {\n uvBaseBR[1] = [a, 1 - b, c, 1 - b, c, 1 - d, a, 1 - d];\n }\n for (let x = 0; x < tilesX; x++) {\n positions.push(-halfWidth + x * tileWidth + adjustX, startY + adjustY, 0);\n positions.push(-halfWidth + (x + 1) * tileWidth + adjustX, startY + adjustY, 0);\n positions.push(-halfWidth + (x + 1) * tileWidth + adjustX, startY + offsetY + adjustY, 0);\n positions.push(-halfWidth + x * tileWidth + adjustX, startY + offsetY + adjustY, 0);\n indices.push(index, index + 1, index + 3, index + 1, index + 2, index + 3);\n index += 4;\n if (flipTile === Mesh.FLIP_TILE || flipTile === Mesh.ROTATE_TILE || flipTile === Mesh.FLIP_N_ROTATE_TILE) {\n uvs = uvs.concat(uvBaseBR[(x + 1) % 2]);\n }\n else if (flipTile === Mesh.FLIP_ROW || flipTile === Mesh.ROTATE_ROW || flipTile === Mesh.FLIP_N_ROTATE_ROW) {\n uvs = uvs.concat(uvBaseBR[1]);\n }\n else {\n uvs = uvs.concat(uvBaseBR[0]);\n }\n colors.push(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);\n normals.push(0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1);\n }\n }\n if (partialTopRow) {\n const uvBaseTR = [];\n a = 0;\n b = 0;\n c = 1;\n d = offsetY / tileHeight;\n uvBaseTR[0] = [a, b, c, b, c, d, a, d];\n uvBaseTR[1] = [a, b, c, b, c, d, a, d];\n if (flipTile === Mesh.ROTATE_TILE || flipTile === Mesh.ROTATE_ROW) {\n uvBaseTR[1] = [1 - a, 1 - b, 1 - c, 1 - b, 1 - c, 1 - d, 1 - a, 1 - d];\n }\n if (flipTile === Mesh.FLIP_TILE || flipTile === Mesh.FLIP_ROW) {\n uvBaseTR[1] = [1 - a, b, 1 - c, b, 1 - c, d, 1 - a, d];\n }\n if (flipTile === Mesh.FLIP_N_ROTATE_TILE || flipTile === Mesh.FLIP_N_ROTATE_ROW) {\n uvBaseTR[1] = [a, 1 - b, c, 1 - b, c, 1 - d, a, 1 - d];\n }\n for (let x = 0; x < tilesX; x++) {\n positions.push(-halfWidth + x * tileWidth + adjustX, endY - offsetY + adjustY, 0);\n positions.push(-halfWidth + (x + 1) * tileWidth + adjustX, endY - offsetY + adjustY, 0);\n positions.push(-halfWidth + (x + 1) * tileWidth + adjustX, endY + adjustY, 0);\n positions.push(-halfWidth + x * tileWidth + adjustX, endY + adjustY, 0);\n indices.push(index, index + 1, index + 3, index + 1, index + 2, index + 3);\n index += 4;\n if (flipTile === Mesh.FLIP_TILE || flipTile === Mesh.ROTATE_TILE || flipTile === Mesh.FLIP_N_ROTATE_TILE) {\n uvs = uvs.concat(uvBaseTR[(x + tilesY) % 2]);\n }\n else if (flipTile === Mesh.FLIP_ROW || flipTile === Mesh.ROTATE_ROW || flipTile === Mesh.FLIP_N_ROTATE_ROW) {\n uvs = uvs.concat(uvBaseTR[tilesY % 2]);\n }\n else {\n uvs = uvs.concat(uvBaseTR[0]);\n }\n colors.push(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);\n normals.push(0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1);\n }\n }\n if (partialLeftCol) {\n const uvBaseLC = [];\n a = 1 - offsetX / tileWidth;\n b = 0;\n c = 1;\n d = 1;\n uvBaseLC[0] = [a, b, c, b, c, d, a, d];\n uvBaseLC[1] = [a, b, c, b, c, d, a, d];\n if (flipTile === Mesh.ROTATE_TILE || flipTile === Mesh.ROTATE_ROW) {\n uvBaseLC[1] = [1 - a, 1 - b, 1 - c, 1 - b, 1 - c, 1 - d, 1 - a, 1 - d];\n }\n if (flipTile === Mesh.FLIP_TILE || flipTile === Mesh.FLIP_ROW) {\n uvBaseLC[1] = [1 - a, b, 1 - c, b, 1 - c, d, 1 - a, d];\n }\n if (flipTile === Mesh.FLIP_N_ROTATE_TILE || flipTile === Mesh.FLIP_N_ROTATE_ROW) {\n uvBaseLC[1] = [a, 1 - b, c, 1 - b, c, 1 - d, a, 1 - d];\n }\n for (let y = 0; y < tilesY; y++) {\n positions.push(startX + adjustX, -halfHeight + y * tileHeight + adjustY, 0);\n positions.push(startX + offsetX + adjustX, -halfHeight + y * tileHeight + adjustY, 0);\n positions.push(startX + offsetX + adjustX, -halfHeight + (y + 1) * tileHeight + adjustY, 0);\n positions.push(startX + adjustX, -halfHeight + (y + 1) * tileHeight + adjustY, 0);\n indices.push(index, index + 1, index + 3, index + 1, index + 2, index + 3);\n index += 4;\n if (flipTile === Mesh.FLIP_TILE || flipTile === Mesh.ROTATE_TILE || flipTile === Mesh.FLIP_N_ROTATE_TILE) {\n uvs = uvs.concat(uvBaseLC[(y + 1) % 2]);\n }\n else if (flipTile === Mesh.FLIP_ROW || flipTile === Mesh.ROTATE_ROW || flipTile === Mesh.FLIP_N_ROTATE_ROW) {\n uvs = uvs.concat(uvBaseLC[y % 2]);\n }\n else {\n uvs = uvs.concat(uvBaseLC[0]);\n }\n colors.push(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);\n normals.push(0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1);\n }\n }\n if (partialRightCol) {\n const uvBaseRC = [];\n a = 0;\n b = 0;\n c = offsetX / tileHeight;\n d = 1;\n uvBaseRC[0] = [a, b, c, b, c, d, a, d];\n uvBaseRC[1] = [a, b, c, b, c, d, a, d];\n if (flipTile === Mesh.ROTATE_TILE || flipTile === Mesh.ROTATE_ROW) {\n uvBaseRC[1] = [1 - a, 1 - b, 1 - c, 1 - b, 1 - c, 1 - d, 1 - a, 1 - d];\n }\n if (flipTile === Mesh.FLIP_TILE || flipTile === Mesh.FLIP_ROW) {\n uvBaseRC[1] = [1 - a, b, 1 - c, b, 1 - c, d, 1 - a, d];\n }\n if (flipTile === Mesh.FLIP_N_ROTATE_TILE || flipTile === Mesh.FLIP_N_ROTATE_ROW) {\n uvBaseRC[1] = [a, 1 - b, c, 1 - b, c, 1 - d, a, 1 - d];\n }\n for (let y = 0; y < tilesY; y++) {\n positions.push(endX - offsetX + adjustX, -halfHeight + y * tileHeight + adjustY, 0);\n positions.push(endX + adjustX, -halfHeight + y * tileHeight + adjustY, 0);\n positions.push(endX + adjustX, -halfHeight + (y + 1) * tileHeight + adjustY, 0);\n positions.push(endX - offsetX + adjustX, -halfHeight + (y + 1) * tileHeight + adjustY, 0);\n indices.push(index, index + 1, index + 3, index + 1, index + 2, index + 3);\n index += 4;\n if (flipTile === Mesh.FLIP_TILE || flipTile === Mesh.ROTATE_TILE || flipTile === Mesh.FLIP_N_ROTATE_TILE) {\n uvs = uvs.concat(uvBaseRC[(y + tilesX) % 2]);\n }\n else if (flipTile === Mesh.FLIP_ROW || flipTile === Mesh.ROTATE_ROW || flipTile === Mesh.FLIP_N_ROTATE_ROW) {\n uvs = uvs.concat(uvBaseRC[y % 2]);\n }\n else {\n uvs = uvs.concat(uvBaseRC[0]);\n }\n colors.push(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);\n normals.push(0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1);\n }\n }\n }\n const sideOrientation = options.sideOrientation === 0 ? 0 : options.sideOrientation || VertexData.DEFAULTSIDE;\n // sides\n VertexData._ComputeSides(sideOrientation, positions, indices, normals, uvs, options.frontUVs, options.backUVs);\n // Result\n const vertexData = new VertexData();\n vertexData.indices = indices;\n vertexData.positions = positions;\n vertexData.normals = normals;\n vertexData.uvs = uvs;\n const totalColors = sideOrientation === VertexData.DOUBLESIDE ? colors.concat(colors) : colors;\n vertexData.colors = totalColors;\n return vertexData;\n}\n/**\n * Creates a tiled plane mesh\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set/tiled_plane\n * @param name defines the name of the mesh\n * @param options an object used to set the following optional parameters for the tiled plane, required but can be empty\n * * pattern a limited pattern arrangement depending on the number\n * * size of the box\n * * width of the box, overwrites size\n * * height of the box, overwrites size\n * * tileSize sets the width, height and depth of the tile to the value of size, optional default 1\n * * tileWidth sets the width (x direction) of the tile, overwrites the width set by size, optional, default size\n * * tileHeight sets the height (y direction) of the tile, overwrites the height set by size, optional, default size\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\n * * alignHorizontal places whole tiles aligned to the center, left or right of a row\n * * alignVertical places whole tiles aligned to the center, left or right of a column\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\n * @param options.pattern\n * @param options.tileSize\n * @param options.tileWidth\n * @param options.tileHeight\n * @param options.size\n * @param options.width\n * @param options.height\n * @param options.alignHorizontal\n * @param options.alignVertical\n * @param options.sideOrientation\n * @param options.frontUVs\n * @param options.backUVs\n * @param options.updatable\n * @param scene defines the hosting scene\n * @returns the box mesh\n */\nexport function CreateTiledPlane(name, options, scene = null) {\n const plane = new Mesh(name, scene);\n options.sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\n plane._originalBuilderSideOrientation = options.sideOrientation;\n const vertexData = CreateTiledPlaneVertexData(options);\n vertexData.applyToMesh(plane, options.updatable);\n return plane;\n}\n/**\n * Class containing static functions to help procedurally build meshes\n * @deprecated use CreateTiledPlane instead\n */\nexport const TiledPlaneBuilder = {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n CreateTiledPlane,\n};\nVertexData.CreateTiledPlane = CreateTiledPlaneVertexData;\n//# sourceMappingURL=tiledPlaneBuilder.js.map","import { Matrix, Vector3, Vector4 } from \"../../Maths/math.vector.js\";\nimport { Color4 } from \"../../Maths/math.color.js\";\nimport { Mesh } from \"../mesh.js\";\nimport { VertexData } from \"../mesh.vertexData.js\";\nimport { CreateTiledPlaneVertexData } from \"./tiledPlaneBuilder.js\";\nimport { CompatibilityOptions } from \"../../Compat/compatibilityOptions.js\";\n/**\n * Creates the VertexData for a tiled box\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set/tiled_box\n * @param options an object used to set the following optional parameters for the tiled box, required but can be empty\n * * pattern sets the rotation or reflection pattern for the tiles,\n * * size of the box\n * * width of the box, overwrites size\n * * height of the box, overwrites size\n * * depth of the box, overwrites size\n * * tileSize sets the size of a tile\n * * tileWidth sets the tile width and overwrites tileSize\n * * tileHeight sets the tile width and overwrites tileSize\n * * faceUV an array of 6 Vector4 elements used to set different images to each box side\n * * faceColors an array of 6 Color3 elements used to set different colors to each box side\n * * alignHorizontal places whole tiles aligned to the center, left or right of a row\n * * alignVertical places whole tiles aligned to the center, left or right of a column\n * @param options.pattern\n * @param options.size\n * @param options.width\n * @param options.height\n * @param options.depth\n * @param options.tileSize\n * @param options.tileWidth\n * @param options.tileHeight\n * @param options.faceUV\n * @param options.faceColors\n * @param options.alignHorizontal\n * @param options.alignVertical\n * @param options.sideOrientation\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\n * @returns the VertexData of the TiledBox\n */\nexport function CreateTiledBoxVertexData(options) {\n const nbFaces = 6;\n const faceUV = options.faceUV || new Array(6);\n const faceColors = options.faceColors;\n const flipTile = options.pattern || Mesh.NO_FLIP;\n const width = options.width || options.size || 1;\n const height = options.height || options.size || 1;\n const depth = options.depth || options.size || 1;\n const tileWidth = options.tileWidth || options.tileSize || 1;\n const tileHeight = options.tileHeight || options.tileSize || 1;\n const alignH = options.alignHorizontal || 0;\n const alignV = options.alignVertical || 0;\n const sideOrientation = options.sideOrientation === 0 ? 0 : options.sideOrientation || VertexData.DEFAULTSIDE;\n // default face colors and UV if undefined\n for (let f = 0; f < nbFaces; f++) {\n if (faceUV[f] === undefined) {\n faceUV[f] = new Vector4(0, 0, 1, 1);\n }\n if (faceColors && faceColors[f] === undefined) {\n faceColors[f] = new Color4(1, 1, 1, 1);\n }\n }\n const halfWidth = width / 2;\n const halfHeight = height / 2;\n const halfDepth = depth / 2;\n const faceVertexData = [];\n for (let f = 0; f < 2; f++) {\n //front and back\n faceVertexData[f] = CreateTiledPlaneVertexData({\n pattern: flipTile,\n tileWidth: tileWidth,\n tileHeight: tileHeight,\n width: width,\n height: height,\n alignVertical: alignV,\n alignHorizontal: alignH,\n sideOrientation: sideOrientation,\n });\n }\n for (let f = 2; f < 4; f++) {\n //sides\n faceVertexData[f] = CreateTiledPlaneVertexData({\n pattern: flipTile,\n tileWidth: tileWidth,\n tileHeight: tileHeight,\n width: depth,\n height: height,\n alignVertical: alignV,\n alignHorizontal: alignH,\n sideOrientation: sideOrientation,\n });\n }\n let baseAlignV = alignV;\n if (alignV === Mesh.BOTTOM) {\n baseAlignV = Mesh.TOP;\n }\n else if (alignV === Mesh.TOP) {\n baseAlignV = Mesh.BOTTOM;\n }\n for (let f = 4; f < 6; f++) {\n //top and bottom\n faceVertexData[f] = CreateTiledPlaneVertexData({\n pattern: flipTile,\n tileWidth: tileWidth,\n tileHeight: tileHeight,\n width: width,\n height: depth,\n alignVertical: baseAlignV,\n alignHorizontal: alignH,\n sideOrientation: sideOrientation,\n });\n }\n let positions = [];\n let normals = [];\n let uvs = [];\n let indices = [];\n const colors = [];\n const facePositions = [];\n const faceNormals = [];\n const newFaceUV = [];\n let lu = 0;\n let li = 0;\n for (let f = 0; f < nbFaces; f++) {\n const len = faceVertexData[f].positions.length;\n facePositions[f] = [];\n faceNormals[f] = [];\n for (let p = 0; p < len / 3; p++) {\n facePositions[f].push(new Vector3(faceVertexData[f].positions[3 * p], faceVertexData[f].positions[3 * p + 1], faceVertexData[f].positions[3 * p + 2]));\n faceNormals[f].push(new Vector3(faceVertexData[f].normals[3 * p], faceVertexData[f].normals[3 * p + 1], faceVertexData[f].normals[3 * p + 2]));\n }\n // uvs\n lu = faceVertexData[f].uvs.length;\n newFaceUV[f] = [];\n for (let i = 0; i < lu; i += 2) {\n newFaceUV[f][i] = faceUV[f].x + (faceUV[f].z - faceUV[f].x) * faceVertexData[f].uvs[i];\n newFaceUV[f][i + 1] = faceUV[f].y + (faceUV[f].w - faceUV[f].y) * faceVertexData[f].uvs[i + 1];\n if (CompatibilityOptions.UseOpenGLOrientationForUV) {\n newFaceUV[f][i + 1] = 1.0 - newFaceUV[f][i + 1];\n }\n }\n uvs = uvs.concat(newFaceUV[f]);\n indices = indices.concat(faceVertexData[f].indices.map((x) => x + li));\n li += facePositions[f].length;\n if (faceColors) {\n for (let c = 0; c < 4; c++) {\n colors.push(faceColors[f].r, faceColors[f].g, faceColors[f].b, faceColors[f].a);\n }\n }\n }\n const vec0 = new Vector3(0, 0, halfDepth);\n const mtrx0 = Matrix.RotationY(Math.PI);\n positions = facePositions[0]\n .map((entry) => Vector3.TransformNormal(entry, mtrx0).add(vec0))\n .map((entry) => [entry.x, entry.y, entry.z])\n .reduce((accumulator, currentValue) => accumulator.concat(currentValue), []);\n normals = faceNormals[0]\n .map((entry) => Vector3.TransformNormal(entry, mtrx0))\n .map((entry) => [entry.x, entry.y, entry.z])\n .reduce((accumulator, currentValue) => accumulator.concat(currentValue), []);\n positions = positions.concat(facePositions[1]\n .map((entry) => entry.subtract(vec0))\n .map((entry) => [entry.x, entry.y, entry.z])\n .reduce((accumulator, currentValue) => accumulator.concat(currentValue), []));\n normals = normals.concat(faceNormals[1].map((entry) => [entry.x, entry.y, entry.z]).reduce((accumulator, currentValue) => accumulator.concat(currentValue), []));\n const vec2 = new Vector3(halfWidth, 0, 0);\n const mtrx2 = Matrix.RotationY(-Math.PI / 2);\n positions = positions.concat(facePositions[2]\n .map((entry) => Vector3.TransformNormal(entry, mtrx2).add(vec2))\n .map((entry) => [entry.x, entry.y, entry.z])\n .reduce((accumulator, currentValue) => accumulator.concat(currentValue), []));\n normals = normals.concat(faceNormals[2]\n .map((entry) => Vector3.TransformNormal(entry, mtrx2))\n .map((entry) => [entry.x, entry.y, entry.z])\n .reduce((accumulator, currentValue) => accumulator.concat(currentValue), []));\n const mtrx3 = Matrix.RotationY(Math.PI / 2);\n positions = positions.concat(facePositions[3]\n .map((entry) => Vector3.TransformNormal(entry, mtrx3).subtract(vec2))\n .map((entry) => [entry.x, entry.y, entry.z])\n .reduce((accumulator, currentValue) => accumulator.concat(currentValue), []));\n normals = normals.concat(faceNormals[3]\n .map((entry) => Vector3.TransformNormal(entry, mtrx3))\n .map((entry) => [entry.x, entry.y, entry.z])\n .reduce((accumulator, currentValue) => accumulator.concat(currentValue), []));\n const vec4 = new Vector3(0, halfHeight, 0);\n const mtrx4 = Matrix.RotationX(Math.PI / 2);\n positions = positions.concat(facePositions[4]\n .map((entry) => Vector3.TransformNormal(entry, mtrx4).add(vec4))\n .map((entry) => [entry.x, entry.y, entry.z])\n .reduce((accumulator, currentValue) => accumulator.concat(currentValue), []));\n normals = normals.concat(faceNormals[4]\n .map((entry) => Vector3.TransformNormal(entry, mtrx4))\n .map((entry) => [entry.x, entry.y, entry.z])\n .reduce((accumulator, currentValue) => accumulator.concat(currentValue), []));\n const mtrx5 = Matrix.RotationX(-Math.PI / 2);\n positions = positions.concat(facePositions[5]\n .map((entry) => Vector3.TransformNormal(entry, mtrx5).subtract(vec4))\n .map((entry) => [entry.x, entry.y, entry.z])\n .reduce((accumulator, currentValue) => accumulator.concat(currentValue), []));\n normals = normals.concat(faceNormals[5]\n .map((entry) => Vector3.TransformNormal(entry, mtrx5))\n .map((entry) => [entry.x, entry.y, entry.z])\n .reduce((accumulator, currentValue) => accumulator.concat(currentValue), []));\n // sides\n VertexData._ComputeSides(sideOrientation, positions, indices, normals, uvs);\n // Result\n const vertexData = new VertexData();\n vertexData.indices = indices;\n vertexData.positions = positions;\n vertexData.normals = normals;\n vertexData.uvs = uvs;\n if (faceColors) {\n const totalColors = sideOrientation === VertexData.DOUBLESIDE ? colors.concat(colors) : colors;\n vertexData.colors = totalColors;\n }\n return vertexData;\n}\n/**\n * Creates a tiled box mesh\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set/tiled_box\n * @param name defines the name of the mesh\n * @param options an object used to set the following optional parameters for the tiled box, required but can be empty\n * * pattern sets the rotation or reflection pattern for the tiles,\n * * size of the box\n * * width of the box, overwrites size\n * * height of the box, overwrites size\n * * depth of the box, overwrites size\n * * tileSize sets the size of a tile\n * * tileWidth sets the tile width and overwrites tileSize\n * * tileHeight sets the tile width and overwrites tileSize\n * * faceUV an array of 6 Vector4 elements used to set different images to each box side\n * * faceColors an array of 6 Color3 elements used to set different colors to each box side\n * * alignHorizontal places whole tiles aligned to the center, left or right of a row\n * * alignVertical places whole tiles aligned to the center, left or right of a column\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\n * @param options.pattern\n * @param options.width\n * @param options.height\n * @param options.depth\n * @param options.tileSize\n * @param options.tileWidth\n * @param options.tileHeight\n * @param options.alignHorizontal\n * @param options.alignVertical\n * @param options.faceUV\n * @param options.faceColors\n * @param options.sideOrientation\n * @param options.updatable\n * @param scene defines the hosting scene\n * @returns the box mesh\n */\nexport function CreateTiledBox(name, options, scene = null) {\n const box = new Mesh(name, scene);\n options.sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\n box._originalBuilderSideOrientation = options.sideOrientation;\n const vertexData = CreateTiledBoxVertexData(options);\n vertexData.applyToMesh(box, options.updatable);\n return box;\n}\n/**\n * Class containing static functions to help procedurally build meshes\n * @deprecated use CreateTiledBox instead\n */\nexport const TiledBoxBuilder = {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n CreateTiledBox,\n};\nVertexData.CreateTiledBox = CreateTiledBoxVertexData;\n//# sourceMappingURL=tiledBoxBuilder.js.map","import { Vector3, Matrix } from \"../../Maths/math.vector.js\";\nimport { Mesh } from \"../mesh.js\";\nimport { VertexData } from \"../mesh.vertexData.js\";\nimport { CompatibilityOptions } from \"../../Compat/compatibilityOptions.js\";\n/**\n * Creates the VertexData for an ellipsoid, defaults to a sphere\n * @param options an object used to set the following optional parameters for the box, required but can be empty\n * * segments sets the number of horizontal strips optional, default 32\n * * diameter sets the axes dimensions, diameterX, diameterY and diameterZ to the value of diameter, optional default 1\n * * diameterX sets the diameterX (x direction) of the ellipsoid, overwrites the diameterX set by diameter, optional, default diameter\n * * diameterY sets the diameterY (y direction) of the ellipsoid, overwrites the diameterY set by diameter, optional, default diameter\n * * diameterZ sets the diameterZ (z direction) of the ellipsoid, overwrites the diameterZ set by diameter, optional, default diameter\n * * arc a number from 0 to 1, to create an unclosed ellipsoid based on the fraction of the circumference (latitude) given by the arc value, optional, default 1\n * * slice a number from 0 to 1, to create an unclosed ellipsoid based on the fraction of the height (latitude) given by the arc value, optional, default 1\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\n * @param options.segments\n * @param options.diameter\n * @param options.diameterX\n * @param options.diameterY\n * @param options.diameterZ\n * @param options.arc\n * @param options.slice\n * @param options.sideOrientation\n * @param options.frontUVs\n * @param options.backUVs\n * @param options.dedupTopBottomIndices\n * @returns the VertexData of the ellipsoid\n */\nexport function CreateSphereVertexData(options) {\n const segments = (options.segments || 32) | 0;\n const diameterX = options.diameterX || options.diameter || 1;\n const diameterY = options.diameterY || options.diameter || 1;\n const diameterZ = options.diameterZ || options.diameter || 1;\n const arc = options.arc && (options.arc <= 0 || options.arc > 1) ? 1.0 : options.arc || 1.0;\n const slice = options.slice && options.slice <= 0 ? 1.0 : options.slice || 1.0;\n const sideOrientation = options.sideOrientation === 0 ? 0 : options.sideOrientation || VertexData.DEFAULTSIDE;\n const dedupTopBottomIndices = !!options.dedupTopBottomIndices;\n const radius = new Vector3(diameterX / 2, diameterY / 2, diameterZ / 2);\n const totalZRotationSteps = 2 + segments;\n const totalYRotationSteps = 2 * totalZRotationSteps;\n const indices = [];\n const positions = [];\n const normals = [];\n const uvs = [];\n for (let zRotationStep = 0; zRotationStep <= totalZRotationSteps; zRotationStep++) {\n const normalizedZ = zRotationStep / totalZRotationSteps;\n const angleZ = normalizedZ * Math.PI * slice;\n for (let yRotationStep = 0; yRotationStep <= totalYRotationSteps; yRotationStep++) {\n const normalizedY = yRotationStep / totalYRotationSteps;\n const angleY = normalizedY * Math.PI * 2 * arc;\n const rotationZ = Matrix.RotationZ(-angleZ);\n const rotationY = Matrix.RotationY(angleY);\n const afterRotZ = Vector3.TransformCoordinates(Vector3.Up(), rotationZ);\n const complete = Vector3.TransformCoordinates(afterRotZ, rotationY);\n const vertex = complete.multiply(radius);\n const normal = complete.divide(radius).normalize();\n positions.push(vertex.x, vertex.y, vertex.z);\n normals.push(normal.x, normal.y, normal.z);\n uvs.push(normalizedY, CompatibilityOptions.UseOpenGLOrientationForUV ? 1.0 - normalizedZ : normalizedZ);\n }\n if (zRotationStep > 0) {\n const verticesCount = positions.length / 3;\n for (let firstIndex = verticesCount - 2 * (totalYRotationSteps + 1); firstIndex + totalYRotationSteps + 2 < verticesCount; firstIndex++) {\n if (dedupTopBottomIndices) {\n if (zRotationStep > 1) {\n indices.push(firstIndex);\n indices.push(firstIndex + 1);\n indices.push(firstIndex + totalYRotationSteps + 1);\n }\n if (zRotationStep < totalZRotationSteps || slice < 1.0) {\n indices.push(firstIndex + totalYRotationSteps + 1);\n indices.push(firstIndex + 1);\n indices.push(firstIndex + totalYRotationSteps + 2);\n }\n }\n else {\n indices.push(firstIndex);\n indices.push(firstIndex + 1);\n indices.push(firstIndex + totalYRotationSteps + 1);\n indices.push(firstIndex + totalYRotationSteps + 1);\n indices.push(firstIndex + 1);\n indices.push(firstIndex + totalYRotationSteps + 2);\n }\n }\n }\n }\n // Sides\n VertexData._ComputeSides(sideOrientation, positions, indices, normals, uvs, options.frontUVs, options.backUVs);\n // Result\n const vertexData = new VertexData();\n vertexData.indices = indices;\n vertexData.positions = positions;\n vertexData.normals = normals;\n vertexData.uvs = uvs;\n return vertexData;\n}\n/**\n * Creates a sphere mesh\n * * The parameter `diameter` sets the diameter size (float) of the sphere (default 1)\n * * You can set some different sphere dimensions, for instance to build an ellipsoid, by using the parameters `diameterX`, `diameterY` and `diameterZ` (all by default have the same value of `diameter`)\n * * The parameter `segments` sets the sphere number of horizontal stripes (positive integer, default 32)\n * * You can create an unclosed sphere with the parameter `arc` (positive float, default 1), valued between 0 and 1, what is the ratio of the circumference (latitude) : 2 x PI x ratio\n * * You can create an unclosed sphere on its height with the parameter `slice` (positive float, default1), valued between 0 and 1, what is the height ratio (longitude)\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\n * @param name defines the name of the mesh\n * @param options defines the options used to create the mesh\n * @param options.segments\n * @param options.diameter\n * @param options.diameterX\n * @param options.diameterY\n * @param options.diameterZ\n * @param options.arc\n * @param options.slice\n * @param options.sideOrientation\n * @param options.frontUVs\n * @param options.backUVs\n * @param options.updatable\n * @param scene defines the hosting scene\n * @returns the sphere mesh\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#sphere\n */\nexport function CreateSphere(name, options = {}, scene = null) {\n const sphere = new Mesh(name, scene);\n options.sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\n sphere._originalBuilderSideOrientation = options.sideOrientation;\n const vertexData = CreateSphereVertexData(options);\n vertexData.applyToMesh(sphere, options.updatable);\n return sphere;\n}\n/**\n * Class containing static functions to help procedurally build meshes\n * @deprecated use CreateSphere directly\n */\nexport const SphereBuilder = {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n CreateSphere,\n};\nVertexData.CreateSphere = CreateSphereVertexData;\nMesh.CreateSphere = (name, segments, diameter, scene, updatable, sideOrientation) => {\n const options = {\n segments: segments,\n diameterX: diameter,\n diameterY: diameter,\n diameterZ: diameter,\n sideOrientation: sideOrientation,\n updatable: updatable,\n };\n return CreateSphere(name, options, scene);\n};\n//# sourceMappingURL=sphereBuilder.js.map","import { Vector4, Vector3, Vector2 } from \"../../Maths/math.vector.js\";\nimport { Color4 } from \"../../Maths/math.color.js\";\nimport { Mesh } from \"../mesh.js\";\nimport { VertexData } from \"../mesh.vertexData.js\";\nimport { Scene } from \"../../scene.js\";\nimport { Axis } from \"../../Maths/math.axis.js\";\nimport { CompatibilityOptions } from \"../../Compat/compatibilityOptions.js\";\n/**\n * Creates the VertexData for a cylinder, cone or prism\n * @param options an object used to set the following optional parameters for the box, required but can be empty\n * * height sets the height (y direction) of the cylinder, optional, default 2\n * * diameterTop sets the diameter of the top of the cone, overwrites diameter, optional, default diameter\n * * diameterBottom sets the diameter of the bottom of the cone, overwrites diameter, optional, default diameter\n * * diameter sets the diameter of the top and bottom of the cone, optional default 1\n * * tessellation the number of prism sides, 3 for a triangular prism, optional, default 24\n * * subdivisions` the number of rings along the cylinder height, optional, default 1\n * * arc a number from 0 to 1, to create an unclosed cylinder based on the fraction of the circumference given by the arc value, optional, default 1\n * * faceColors an array of Color3 elements used to set different colors to the top, rings and bottom respectively\n * * faceUV an array of Vector4 elements used to set different images to the top, rings and bottom respectively\n * * hasRings when true makes each subdivision independently treated as a face for faceUV and faceColors, optional, default false\n * * enclose when true closes an open cylinder by adding extra flat faces between the height axis and vertical edges, think cut cake\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\n * @param options.height\n * @param options.diameterTop\n * @param options.diameterBottom\n * @param options.diameter\n * @param options.tessellation\n * @param options.subdivisions\n * @param options.arc\n * @param options.faceColors\n * @param options.faceUV\n * @param options.hasRings\n * @param options.enclose\n * @param options.cap\n * @param options.sideOrientation\n * @param options.frontUVs\n * @param options.backUVs\n * @returns the VertexData of the cylinder, cone or prism\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function CreateCylinderVertexData(options) {\n const height = options.height || 2;\n let diameterTop = options.diameterTop === 0 ? 0 : options.diameterTop || options.diameter || 1;\n let diameterBottom = options.diameterBottom === 0 ? 0 : options.diameterBottom || options.diameter || 1;\n diameterTop = diameterTop || 0.00001; // Prevent broken normals\n diameterBottom = diameterBottom || 0.00001; // Prevent broken normals\n const tessellation = (options.tessellation || 24) | 0;\n const subdivisions = (options.subdivisions || 1) | 0;\n const hasRings = options.hasRings ? true : false;\n const enclose = options.enclose ? true : false;\n const cap = options.cap === 0 ? 0 : options.cap || Mesh.CAP_ALL;\n const arc = options.arc && (options.arc <= 0 || options.arc > 1) ? 1.0 : options.arc || 1.0;\n const sideOrientation = options.sideOrientation === 0 ? 0 : options.sideOrientation || VertexData.DEFAULTSIDE;\n const faceUV = options.faceUV || new Array(3);\n const faceColors = options.faceColors;\n // default face colors and UV if undefined\n const quadNb = arc !== 1 && enclose ? 2 : 0;\n const ringNb = hasRings ? subdivisions : 1;\n const surfaceNb = 2 + (1 + quadNb) * ringNb;\n let f;\n for (f = 0; f < surfaceNb; f++) {\n if (faceColors && faceColors[f] === undefined) {\n faceColors[f] = new Color4(1, 1, 1, 1);\n }\n }\n for (f = 0; f < surfaceNb; f++) {\n if (faceUV && faceUV[f] === undefined) {\n faceUV[f] = new Vector4(0, 0, 1, 1);\n }\n }\n const indices = new Array();\n const positions = new Array();\n const normals = new Array();\n const uvs = new Array();\n const colors = new Array();\n const angleStep = (Math.PI * 2 * arc) / tessellation;\n let angle;\n let h;\n let radius;\n const tan = (diameterBottom - diameterTop) / 2 / height;\n const ringVertex = Vector3.Zero();\n const ringNormal = Vector3.Zero();\n const ringFirstVertex = Vector3.Zero();\n const ringFirstNormal = Vector3.Zero();\n const quadNormal = Vector3.Zero();\n const Y = Axis.Y;\n // positions, normals, uvs\n let i;\n let j;\n let r;\n let ringIdx = 1;\n let s = 1; // surface index\n let cs = 0;\n let v = 0;\n for (i = 0; i <= subdivisions; i++) {\n h = i / subdivisions;\n radius = (h * (diameterTop - diameterBottom) + diameterBottom) / 2;\n ringIdx = hasRings && i !== 0 && i !== subdivisions ? 2 : 1;\n for (r = 0; r < ringIdx; r++) {\n if (hasRings) {\n s += r;\n }\n if (enclose) {\n s += 2 * r;\n }\n for (j = 0; j <= tessellation; j++) {\n angle = j * angleStep;\n // position\n ringVertex.x = Math.cos(-angle) * radius;\n ringVertex.y = -height / 2 + h * height;\n ringVertex.z = Math.sin(-angle) * radius;\n // normal\n if (diameterTop === 0 && i === subdivisions) {\n // if no top cap, reuse former normals\n ringNormal.x = normals[normals.length - (tessellation + 1) * 3];\n ringNormal.y = normals[normals.length - (tessellation + 1) * 3 + 1];\n ringNormal.z = normals[normals.length - (tessellation + 1) * 3 + 2];\n }\n else {\n ringNormal.x = ringVertex.x;\n ringNormal.z = ringVertex.z;\n ringNormal.y = Math.sqrt(ringNormal.x * ringNormal.x + ringNormal.z * ringNormal.z) * tan;\n ringNormal.normalize();\n }\n // keep first ring vertex values for enclose\n if (j === 0) {\n ringFirstVertex.copyFrom(ringVertex);\n ringFirstNormal.copyFrom(ringNormal);\n }\n positions.push(ringVertex.x, ringVertex.y, ringVertex.z);\n normals.push(ringNormal.x, ringNormal.y, ringNormal.z);\n if (hasRings) {\n v = cs !== s ? faceUV[s].y : faceUV[s].w;\n }\n else {\n v = faceUV[s].y + (faceUV[s].w - faceUV[s].y) * h;\n }\n uvs.push(faceUV[s].x + ((faceUV[s].z - faceUV[s].x) * j) / tessellation, CompatibilityOptions.UseOpenGLOrientationForUV ? 1 - v : v);\n if (faceColors) {\n colors.push(faceColors[s].r, faceColors[s].g, faceColors[s].b, faceColors[s].a);\n }\n }\n // if enclose, add four vertices and their dedicated normals\n if (arc !== 1 && enclose) {\n positions.push(ringVertex.x, ringVertex.y, ringVertex.z);\n positions.push(0, ringVertex.y, 0);\n positions.push(0, ringVertex.y, 0);\n positions.push(ringFirstVertex.x, ringFirstVertex.y, ringFirstVertex.z);\n Vector3.CrossToRef(Y, ringNormal, quadNormal);\n quadNormal.normalize();\n normals.push(quadNormal.x, quadNormal.y, quadNormal.z, quadNormal.x, quadNormal.y, quadNormal.z);\n Vector3.CrossToRef(ringFirstNormal, Y, quadNormal);\n quadNormal.normalize();\n normals.push(quadNormal.x, quadNormal.y, quadNormal.z, quadNormal.x, quadNormal.y, quadNormal.z);\n if (hasRings) {\n v = cs !== s ? faceUV[s + 1].y : faceUV[s + 1].w;\n }\n else {\n v = faceUV[s + 1].y + (faceUV[s + 1].w - faceUV[s + 1].y) * h;\n }\n uvs.push(faceUV[s + 1].x, CompatibilityOptions.UseOpenGLOrientationForUV ? 1 - v : v);\n uvs.push(faceUV[s + 1].z, CompatibilityOptions.UseOpenGLOrientationForUV ? 1 - v : v);\n if (hasRings) {\n v = cs !== s ? faceUV[s + 2].y : faceUV[s + 2].w;\n }\n else {\n v = faceUV[s + 2].y + (faceUV[s + 2].w - faceUV[s + 2].y) * h;\n }\n uvs.push(faceUV[s + 2].x, CompatibilityOptions.UseOpenGLOrientationForUV ? 1 - v : v);\n uvs.push(faceUV[s + 2].z, CompatibilityOptions.UseOpenGLOrientationForUV ? 1 - v : v);\n if (faceColors) {\n colors.push(faceColors[s + 1].r, faceColors[s + 1].g, faceColors[s + 1].b, faceColors[s + 1].a);\n colors.push(faceColors[s + 1].r, faceColors[s + 1].g, faceColors[s + 1].b, faceColors[s + 1].a);\n colors.push(faceColors[s + 2].r, faceColors[s + 2].g, faceColors[s + 2].b, faceColors[s + 2].a);\n colors.push(faceColors[s + 2].r, faceColors[s + 2].g, faceColors[s + 2].b, faceColors[s + 2].a);\n }\n }\n if (cs !== s) {\n cs = s;\n }\n }\n }\n // indices\n const e = arc !== 1 && enclose ? tessellation + 4 : tessellation; // correction of number of iteration if enclose\n i = 0;\n for (s = 0; s < subdivisions; s++) {\n let i0 = 0;\n let i1 = 0;\n let i2 = 0;\n let i3 = 0;\n for (j = 0; j < tessellation; j++) {\n i0 = i * (e + 1) + j;\n i1 = (i + 1) * (e + 1) + j;\n i2 = i * (e + 1) + (j + 1);\n i3 = (i + 1) * (e + 1) + (j + 1);\n indices.push(i0, i1, i2);\n indices.push(i3, i2, i1);\n }\n if (arc !== 1 && enclose) {\n // if enclose, add two quads\n indices.push(i0 + 2, i1 + 2, i2 + 2);\n indices.push(i3 + 2, i2 + 2, i1 + 2);\n indices.push(i0 + 4, i1 + 4, i2 + 4);\n indices.push(i3 + 4, i2 + 4, i1 + 4);\n }\n i = hasRings ? i + 2 : i + 1;\n }\n // Caps\n const createCylinderCap = (isTop) => {\n const radius = isTop ? diameterTop / 2 : diameterBottom / 2;\n if (radius === 0) {\n return;\n }\n // Cap positions, normals & uvs\n let angle;\n let circleVector;\n let i;\n const u = isTop ? faceUV[surfaceNb - 1] : faceUV[0];\n let c = null;\n if (faceColors) {\n c = isTop ? faceColors[surfaceNb - 1] : faceColors[0];\n }\n // cap center\n const vbase = positions.length / 3;\n const offset = isTop ? height / 2 : -height / 2;\n const center = new Vector3(0, offset, 0);\n positions.push(center.x, center.y, center.z);\n normals.push(0, isTop ? 1 : -1, 0);\n const v = u.y + (u.w - u.y) * 0.5;\n uvs.push(u.x + (u.z - u.x) * 0.5, CompatibilityOptions.UseOpenGLOrientationForUV ? 1 - v : v);\n if (c) {\n colors.push(c.r, c.g, c.b, c.a);\n }\n const textureScale = new Vector2(0.5, 0.5);\n for (i = 0; i <= tessellation; i++) {\n angle = (Math.PI * 2 * i * arc) / tessellation;\n const cos = Math.cos(-angle);\n const sin = Math.sin(-angle);\n circleVector = new Vector3(cos * radius, offset, sin * radius);\n const textureCoordinate = new Vector2(cos * textureScale.x + 0.5, sin * textureScale.y + 0.5);\n positions.push(circleVector.x, circleVector.y, circleVector.z);\n normals.push(0, isTop ? 1 : -1, 0);\n const v = u.y + (u.w - u.y) * textureCoordinate.y;\n uvs.push(u.x + (u.z - u.x) * textureCoordinate.x, CompatibilityOptions.UseOpenGLOrientationForUV ? 1 - v : v);\n if (c) {\n colors.push(c.r, c.g, c.b, c.a);\n }\n }\n // Cap indices\n for (i = 0; i < tessellation; i++) {\n if (!isTop) {\n indices.push(vbase);\n indices.push(vbase + (i + 1));\n indices.push(vbase + (i + 2));\n }\n else {\n indices.push(vbase);\n indices.push(vbase + (i + 2));\n indices.push(vbase + (i + 1));\n }\n }\n };\n // add caps to geometry based on cap parameter\n if (cap === Mesh.CAP_START || cap === Mesh.CAP_ALL) {\n createCylinderCap(false);\n }\n if (cap === Mesh.CAP_END || cap === Mesh.CAP_ALL) {\n createCylinderCap(true);\n }\n // Sides\n VertexData._ComputeSides(sideOrientation, positions, indices, normals, uvs, options.frontUVs, options.backUVs);\n const vertexData = new VertexData();\n vertexData.indices = indices;\n vertexData.positions = positions;\n vertexData.normals = normals;\n vertexData.uvs = uvs;\n if (faceColors) {\n vertexData.colors = colors;\n }\n return vertexData;\n}\n/**\n * Creates a cylinder or a cone mesh\n * * The parameter `height` sets the height size (float) of the cylinder/cone (float, default 2).\n * * The parameter `diameter` sets the diameter of the top and bottom cap at once (float, default 1).\n * * The parameters `diameterTop` and `diameterBottom` overwrite the parameter `diameter` and set respectively the top cap and bottom cap diameter (floats, default 1). The parameter \"diameterBottom\" can't be zero.\n * * The parameter `tessellation` sets the number of cylinder sides (positive integer, default 24). Set it to 3 to get a prism for instance.\n * * The parameter `subdivisions` sets the number of rings along the cylinder height (positive integer, default 1).\n * * The parameter `hasRings` (boolean, default false) makes the subdivisions independent from each other, so they become different faces.\n * * The parameter `enclose` (boolean, default false) adds two extra faces per subdivision to a sliced cylinder to close it around its height axis.\n * * The parameter `cap` sets the way the cylinder is capped. Possible values : BABYLON.Mesh.NO_CAP, BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL (default).\n * * The parameter `arc` (float, default 1) is the ratio (max 1) to apply to the circumference to slice the cylinder.\n * * You can set different colors and different images to each box side by using the parameters `faceColors` (an array of n Color3 elements) and `faceUV` (an array of n Vector4 elements).\n * * The value of n is the number of cylinder faces. If the cylinder has only 1 subdivisions, n equals : top face + cylinder surface + bottom face = 3\n * * Now, if the cylinder has 5 independent subdivisions (hasRings = true), n equals : top face + 5 stripe surfaces + bottom face = 2 + 5 = 7\n * * Finally, if the cylinder has 5 independent subdivisions and is enclose, n equals : top face + 5 x (stripe surface + 2 closing faces) + bottom face = 2 + 5 * 3 = 17\n * * Each array (color or UVs) is always ordered the same way : the first element is the bottom cap, the last element is the top cap. The other elements are each a ring surface.\n * * If `enclose` is false, a ring surface is one element.\n * * If `enclose` is true, a ring surface is 3 successive elements in the array : the tubular surface, then the two closing faces.\n * * Example how to set colors and textures on a sliced cylinder : https://www.html5gamedevs.com/topic/17945-creating-a-closed-slice-of-a-cylinder/#comment-106379\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.\n * @param name defines the name of the mesh\n * @param options defines the options used to create the mesh\n * @param options.height\n * @param options.diameterTop\n * @param options.diameterBottom\n * @param options.diameter\n * @param options.tessellation\n * @param options.subdivisions\n * @param options.arc\n * @param options.faceColors\n * @param options.faceUV\n * @param options.updatable\n * @param options.hasRings\n * @param options.enclose\n * @param options.cap\n * @param options.sideOrientation\n * @param options.frontUVs\n * @param options.backUVs\n * @param scene defines the hosting scene\n * @returns the cylinder mesh\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#cylinder-or-cone\n */\nexport function CreateCylinder(name, options = {}, scene) {\n const cylinder = new Mesh(name, scene);\n options.sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\n cylinder._originalBuilderSideOrientation = options.sideOrientation;\n const vertexData = CreateCylinderVertexData(options);\n vertexData.applyToMesh(cylinder, options.updatable);\n return cylinder;\n}\n/**\n * Class containing static functions to help procedurally build meshes\n * @deprecated Please use CreateCylinder directly\n */\nexport const CylinderBuilder = {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n CreateCylinder,\n};\nVertexData.CreateCylinder = CreateCylinderVertexData;\nMesh.CreateCylinder = (name, height, diameterTop, diameterBottom, tessellation, subdivisions, scene, updatable, sideOrientation) => {\n if (scene === undefined || !(scene instanceof Scene)) {\n if (scene !== undefined) {\n sideOrientation = updatable || Mesh.DEFAULTSIDE;\n updatable = scene;\n }\n scene = subdivisions;\n subdivisions = 1;\n }\n const options = {\n height,\n diameterTop,\n diameterBottom,\n tessellation,\n subdivisions,\n sideOrientation,\n updatable,\n };\n return CreateCylinder(name, options, scene);\n};\n//# sourceMappingURL=cylinderBuilder.js.map","import { Matrix, Vector3, Vector2 } from \"../../Maths/math.vector.js\";\nimport { Mesh } from \"../mesh.js\";\nimport { VertexData } from \"../mesh.vertexData.js\";\nimport { CompatibilityOptions } from \"../../Compat/compatibilityOptions.js\";\n/**\n * Creates the VertexData for a torus\n * @param options an object used to set the following optional parameters for the box, required but can be empty\n * * diameter the diameter of the torus, optional default 1\n * * thickness the diameter of the tube forming the torus, optional default 0.5\n * * tessellation the number of prism sides, 3 for a triangular prism, optional, default 24\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\n * @param options.diameter\n * @param options.thickness\n * @param options.tessellation\n * @param options.sideOrientation\n * @param options.frontUVs\n * @param options.backUVs\n * @returns the VertexData of the torus\n */\nexport function CreateTorusVertexData(options) {\n const indices = [];\n const positions = [];\n const normals = [];\n const uvs = [];\n const diameter = options.diameter || 1;\n const thickness = options.thickness || 0.5;\n const tessellation = (options.tessellation || 16) | 0;\n const sideOrientation = options.sideOrientation === 0 ? 0 : options.sideOrientation || VertexData.DEFAULTSIDE;\n const stride = tessellation + 1;\n for (let i = 0; i <= tessellation; i++) {\n const u = i / tessellation;\n const outerAngle = (i * Math.PI * 2.0) / tessellation - Math.PI / 2.0;\n const transform = Matrix.Translation(diameter / 2.0, 0, 0).multiply(Matrix.RotationY(outerAngle));\n for (let j = 0; j <= tessellation; j++) {\n const v = 1 - j / tessellation;\n const innerAngle = (j * Math.PI * 2.0) / tessellation + Math.PI;\n const dx = Math.cos(innerAngle);\n const dy = Math.sin(innerAngle);\n // Create a vertex.\n let normal = new Vector3(dx, dy, 0);\n let position = normal.scale(thickness / 2);\n const textureCoordinate = new Vector2(u, v);\n position = Vector3.TransformCoordinates(position, transform);\n normal = Vector3.TransformNormal(normal, transform);\n positions.push(position.x, position.y, position.z);\n normals.push(normal.x, normal.y, normal.z);\n uvs.push(textureCoordinate.x, CompatibilityOptions.UseOpenGLOrientationForUV ? 1.0 - textureCoordinate.y : textureCoordinate.y);\n // And create indices for two triangles.\n const nextI = (i + 1) % stride;\n const nextJ = (j + 1) % stride;\n indices.push(i * stride + j);\n indices.push(i * stride + nextJ);\n indices.push(nextI * stride + j);\n indices.push(i * stride + nextJ);\n indices.push(nextI * stride + nextJ);\n indices.push(nextI * stride + j);\n }\n }\n // Sides\n VertexData._ComputeSides(sideOrientation, positions, indices, normals, uvs, options.frontUVs, options.backUVs);\n // Result\n const vertexData = new VertexData();\n vertexData.indices = indices;\n vertexData.positions = positions;\n vertexData.normals = normals;\n vertexData.uvs = uvs;\n return vertexData;\n}\n/**\n * Creates a torus mesh\n * * The parameter `diameter` sets the diameter size (float) of the torus (default 1)\n * * The parameter `thickness` sets the diameter size of the tube of the torus (float, default 0.5)\n * * The parameter `tessellation` sets the number of torus sides (positive integer, default 16)\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.\n * @param name defines the name of the mesh\n * @param options defines the options used to create the mesh\n * @param options.diameter\n * @param options.thickness\n * @param options.tessellation\n * @param options.updatable\n * @param options.sideOrientation\n * @param options.frontUVs\n * @param options.backUVs\n * @param scene defines the hosting scene\n * @returns the torus mesh\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#torus\n */\nexport function CreateTorus(name, options = {}, scene) {\n const torus = new Mesh(name, scene);\n options.sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\n torus._originalBuilderSideOrientation = options.sideOrientation;\n const vertexData = CreateTorusVertexData(options);\n vertexData.applyToMesh(torus, options.updatable);\n return torus;\n}\n/**\n * Class containing static functions to help procedurally build meshes\n * @deprecated use CreateTorus instead\n */\nexport const TorusBuilder = {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n CreateTorus,\n};\nVertexData.CreateTorus = CreateTorusVertexData;\nMesh.CreateTorus = (name, diameter, thickness, tessellation, scene, updatable, sideOrientation) => {\n const options = {\n diameter,\n thickness,\n tessellation,\n sideOrientation,\n updatable,\n };\n return CreateTorus(name, options, scene);\n};\n//# sourceMappingURL=torusBuilder.js.map","import { Vector3 } from \"../../Maths/math.vector.js\";\nimport { Mesh } from \"../mesh.js\";\nimport { VertexData } from \"../mesh.vertexData.js\";\nimport { CompatibilityOptions } from \"../../Compat/compatibilityOptions.js\";\n// based on http://code.google.com/p/away3d/source/browse/trunk/fp10/Away3D/src/away3d/primitives/TorusKnot.as?spec=svn2473&r=2473\n/**\n * Creates the VertexData for a TorusKnot\n * @param options an object used to set the following optional parameters for the TorusKnot, required but can be empty\n * * radius the radius of the torus knot, optional, default 2\n * * tube the thickness of the tube, optional, default 0.5\n * * radialSegments the number of sides on each tube segments, optional, default 32\n * * tubularSegments the number of tubes to decompose the knot into, optional, default 32\n * * p the number of windings around the z axis, optional, default 2\n * * q the number of windings around the x axis, optional, default 3\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\n * @param options.radius\n * @param options.tube\n * @param options.radialSegments\n * @param options.tubularSegments\n * @param options.p\n * @param options.q\n * @param options.sideOrientation\n * @param options.frontUVs\n * @param options.backUVs\n * @returns the VertexData of the Torus Knot\n */\nexport function CreateTorusKnotVertexData(options) {\n const indices = new Array();\n const positions = new Array();\n const normals = new Array();\n const uvs = new Array();\n const radius = options.radius || 2;\n const tube = options.tube || 0.5;\n const radialSegments = options.radialSegments || 32;\n const tubularSegments = options.tubularSegments || 32;\n const p = options.p || 2;\n const q = options.q || 3;\n const sideOrientation = options.sideOrientation === 0 ? 0 : options.sideOrientation || VertexData.DEFAULTSIDE;\n // Helper\n const getPos = (angle) => {\n const cu = Math.cos(angle);\n const su = Math.sin(angle);\n const quOverP = (q / p) * angle;\n const cs = Math.cos(quOverP);\n const tx = radius * (2 + cs) * 0.5 * cu;\n const ty = radius * (2 + cs) * su * 0.5;\n const tz = radius * Math.sin(quOverP) * 0.5;\n return new Vector3(tx, ty, tz);\n };\n // Vertices\n let i;\n let j;\n for (i = 0; i <= radialSegments; i++) {\n const modI = i % radialSegments;\n const u = (modI / radialSegments) * 2 * p * Math.PI;\n const p1 = getPos(u);\n const p2 = getPos(u + 0.01);\n const tang = p2.subtract(p1);\n let n = p2.add(p1);\n const bitan = Vector3.Cross(tang, n);\n n = Vector3.Cross(bitan, tang);\n bitan.normalize();\n n.normalize();\n for (j = 0; j < tubularSegments; j++) {\n const modJ = j % tubularSegments;\n const v = (modJ / tubularSegments) * 2 * Math.PI;\n const cx = -tube * Math.cos(v);\n const cy = tube * Math.sin(v);\n positions.push(p1.x + cx * n.x + cy * bitan.x);\n positions.push(p1.y + cx * n.y + cy * bitan.y);\n positions.push(p1.z + cx * n.z + cy * bitan.z);\n uvs.push(i / radialSegments);\n uvs.push(CompatibilityOptions.UseOpenGLOrientationForUV ? 1.0 - j / tubularSegments : j / tubularSegments);\n }\n }\n for (i = 0; i < radialSegments; i++) {\n for (j = 0; j < tubularSegments; j++) {\n const jNext = (j + 1) % tubularSegments;\n const a = i * tubularSegments + j;\n const b = (i + 1) * tubularSegments + j;\n const c = (i + 1) * tubularSegments + jNext;\n const d = i * tubularSegments + jNext;\n indices.push(d);\n indices.push(b);\n indices.push(a);\n indices.push(d);\n indices.push(c);\n indices.push(b);\n }\n }\n // Normals\n VertexData.ComputeNormals(positions, indices, normals);\n // Sides\n VertexData._ComputeSides(sideOrientation, positions, indices, normals, uvs, options.frontUVs, options.backUVs);\n // Result\n const vertexData = new VertexData();\n vertexData.indices = indices;\n vertexData.positions = positions;\n vertexData.normals = normals;\n vertexData.uvs = uvs;\n return vertexData;\n}\n/**\n * Creates a torus knot mesh\n * * The parameter `radius` sets the global radius size (float) of the torus knot (default 2)\n * * The parameter `radialSegments` sets the number of sides on each tube segments (positive integer, default 32)\n * * The parameter `tubularSegments` sets the number of tubes to decompose the knot into (positive integer, default 32)\n * * The parameters `p` and `q` are the number of windings on each axis (positive integers, default 2 and 3)\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.\n * @param name defines the name of the mesh\n * @param options defines the options used to create the mesh\n * @param options.radius\n * @param options.tube\n * @param options.radialSegments\n * @param options.tubularSegments\n * @param options.p\n * @param options.q\n * @param options.updatable\n * @param options.sideOrientation\n * @param options.frontUVs\n * @param options.backUVs\n * @param scene defines the hosting scene\n * @returns the torus knot mesh\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#torus-knot\n */\nexport function CreateTorusKnot(name, options = {}, scene) {\n const torusKnot = new Mesh(name, scene);\n options.sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\n torusKnot._originalBuilderSideOrientation = options.sideOrientation;\n const vertexData = CreateTorusKnotVertexData(options);\n vertexData.applyToMesh(torusKnot, options.updatable);\n return torusKnot;\n}\n/**\n * Class containing static functions to help procedurally build meshes\n * @deprecated use CreateTorusKnot instead\n */\nexport const TorusKnotBuilder = {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n CreateTorusKnot,\n};\nVertexData.CreateTorusKnot = CreateTorusKnotVertexData;\nMesh.CreateTorusKnot = (name, radius, tube, radialSegments, tubularSegments, p, q, scene, updatable, sideOrientation) => {\n const options = {\n radius,\n tube,\n radialSegments,\n tubularSegments,\n p,\n q,\n sideOrientation,\n updatable,\n };\n return CreateTorusKnot(name, options, scene);\n};\n//# sourceMappingURL=torusKnotBuilder.js.map","import { Matrix, TmpVectors } from \"../Maths/math.vector.js\";\nimport { Logger } from \"../Misc/logger.js\";\nimport { AbstractMesh } from \"../Meshes/abstractMesh.js\";\nimport { Mesh } from \"../Meshes/mesh.js\";\nimport { DeepCopier } from \"../Misc/deepCopier.js\";\nimport { TransformNode } from \"./transformNode.js\";\nimport { VertexBuffer } from \"../Buffers/buffer.js\";\nimport { Tools } from \"../Misc/tools.js\";\nMesh._instancedMeshFactory = (name, mesh) => {\n const instance = new InstancedMesh(name, mesh);\n if (mesh.instancedBuffers) {\n instance.instancedBuffers = {};\n for (const key in mesh.instancedBuffers) {\n instance.instancedBuffers[key] = mesh.instancedBuffers[key];\n }\n }\n return instance;\n};\n/**\n * Creates an instance based on a source mesh.\n */\nexport class InstancedMesh extends AbstractMesh {\n /**\n * Creates a new InstancedMesh object from the mesh source.\n * @param name defines the name of the instance\n * @param source the mesh to create the instance from\n */\n constructor(name, source) {\n super(name, source.getScene());\n /** @internal */\n this._indexInSourceMeshInstanceArray = -1;\n /** @internal */\n this._distanceToCamera = 0;\n source.addInstance(this);\n this._sourceMesh = source;\n this._unIndexed = source._unIndexed;\n this.position.copyFrom(source.position);\n this.rotation.copyFrom(source.rotation);\n this.scaling.copyFrom(source.scaling);\n if (source.rotationQuaternion) {\n this.rotationQuaternion = source.rotationQuaternion.clone();\n }\n this.animations = source.animations.slice();\n for (const range of source.getAnimationRanges()) {\n if (range != null) {\n this.createAnimationRange(range.name, range.from, range.to);\n }\n }\n this.infiniteDistance = source.infiniteDistance;\n this.setPivotMatrix(source.getPivotMatrix());\n this.refreshBoundingInfo(true, true);\n this._syncSubMeshes();\n }\n /**\n * Returns the string \"InstancedMesh\".\n */\n getClassName() {\n return \"InstancedMesh\";\n }\n /** Gets the list of lights affecting that mesh */\n get lightSources() {\n return this._sourceMesh._lightSources;\n }\n _resyncLightSources() {\n // Do nothing as all the work will be done by source mesh\n }\n _resyncLightSource() {\n // Do nothing as all the work will be done by source mesh\n }\n _removeLightSource() {\n // Do nothing as all the work will be done by source mesh\n }\n // Methods\n /**\n * If the source mesh receives shadows\n */\n get receiveShadows() {\n return this._sourceMesh.receiveShadows;\n }\n set receiveShadows(_value) {\n var _a;\n if (((_a = this._sourceMesh) === null || _a === void 0 ? void 0 : _a.receiveShadows) !== _value) {\n Tools.Warn(\"Setting receiveShadows on an instanced mesh has no effect\");\n }\n }\n /**\n * The material of the source mesh\n */\n get material() {\n return this._sourceMesh.material;\n }\n set material(_value) {\n var _a;\n if (((_a = this._sourceMesh) === null || _a === void 0 ? void 0 : _a.material) !== _value) {\n Tools.Warn(\"Setting material on an instanced mesh has no effect\");\n }\n }\n /**\n * Visibility of the source mesh\n */\n get visibility() {\n return this._sourceMesh.visibility;\n }\n set visibility(_value) {\n var _a;\n if (((_a = this._sourceMesh) === null || _a === void 0 ? void 0 : _a.visibility) !== _value) {\n Tools.Warn(\"Setting visibility on an instanced mesh has no effect\");\n }\n }\n /**\n * Skeleton of the source mesh\n */\n get skeleton() {\n return this._sourceMesh.skeleton;\n }\n set skeleton(_value) {\n var _a;\n if (((_a = this._sourceMesh) === null || _a === void 0 ? void 0 : _a.skeleton) !== _value) {\n Tools.Warn(\"Setting skeleton on an instanced mesh has no effect\");\n }\n }\n /**\n * Rendering ground id of the source mesh\n */\n get renderingGroupId() {\n return this._sourceMesh.renderingGroupId;\n }\n set renderingGroupId(value) {\n if (!this._sourceMesh || value === this._sourceMesh.renderingGroupId) {\n return;\n }\n //no-op with warning\n Logger.Warn(\"Note - setting renderingGroupId of an instanced mesh has no effect on the scene\");\n }\n /**\n * Returns the total number of vertices (integer).\n */\n getTotalVertices() {\n return this._sourceMesh ? this._sourceMesh.getTotalVertices() : 0;\n }\n /**\n * Returns a positive integer : the total number of indices in this mesh geometry.\n * @returns the number of indices or zero if the mesh has no geometry.\n */\n getTotalIndices() {\n return this._sourceMesh.getTotalIndices();\n }\n /**\n * The source mesh of the instance\n */\n get sourceMesh() {\n return this._sourceMesh;\n }\n /**\n * Creates a new InstancedMesh object from the mesh model.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/copies/instances\n * @param name defines the name of the new instance\n * @returns a new InstancedMesh\n */\n createInstance(name) {\n return this._sourceMesh.createInstance(name);\n }\n /**\n * Is this node ready to be used/rendered\n * @param completeCheck defines if a complete check (including materials and lights) has to be done (false by default)\n * @returns {boolean} is it ready\n */\n isReady(completeCheck = false) {\n return this._sourceMesh.isReady(completeCheck, true);\n }\n /**\n * Returns an array of integers or a typed array (Int32Array, Uint32Array, Uint16Array) populated with the mesh indices.\n * @param kind kind of verticies to retrieve (eg. positions, normals, uvs, etc.)\n * @param copyWhenShared If true (default false) and and if the mesh geometry is shared among some other meshes, the returned array is a copy of the internal one.\n * @param forceCopy defines a boolean forcing the copy of the buffer no matter what the value of copyWhenShared is\n * @returns a float array or a Float32Array of the requested kind of data : positions, normals, uvs, etc.\n */\n getVerticesData(kind, copyWhenShared, forceCopy) {\n return this._sourceMesh.getVerticesData(kind, copyWhenShared, forceCopy);\n }\n /**\n * Sets the vertex data of the mesh geometry for the requested `kind`.\n * If the mesh has no geometry, a new Geometry object is set to the mesh and then passed this vertex data.\n * The `data` are either a numeric array either a Float32Array.\n * The parameter `updatable` is passed as is to the underlying Geometry object constructor (if initially none) or updater.\n * The parameter `stride` is an optional positive integer, it is usually automatically deducted from the `kind` (3 for positions or normals, 2 for UV, etc).\n * Note that a new underlying VertexBuffer object is created each call.\n * If the `kind` is the `PositionKind`, the mesh BoundingInfo is renewed, so the bounding box and sphere, and the mesh World Matrix is recomputed.\n *\n * Possible `kind` values :\n * - VertexBuffer.PositionKind\n * - VertexBuffer.UVKind\n * - VertexBuffer.UV2Kind\n * - VertexBuffer.UV3Kind\n * - VertexBuffer.UV4Kind\n * - VertexBuffer.UV5Kind\n * - VertexBuffer.UV6Kind\n * - VertexBuffer.ColorKind\n * - VertexBuffer.MatricesIndicesKind\n * - VertexBuffer.MatricesIndicesExtraKind\n * - VertexBuffer.MatricesWeightsKind\n * - VertexBuffer.MatricesWeightsExtraKind\n *\n * Returns the Mesh.\n * @param kind\n * @param data\n * @param updatable\n * @param stride\n */\n setVerticesData(kind, data, updatable, stride) {\n if (this.sourceMesh) {\n this.sourceMesh.setVerticesData(kind, data, updatable, stride);\n }\n return this.sourceMesh;\n }\n /**\n * Updates the existing vertex data of the mesh geometry for the requested `kind`.\n * If the mesh has no geometry, it is simply returned as it is.\n * The `data` are either a numeric array either a Float32Array.\n * No new underlying VertexBuffer object is created.\n * If the `kind` is the `PositionKind` and if `updateExtends` is true, the mesh BoundingInfo is renewed, so the bounding box and sphere, and the mesh World Matrix is recomputed.\n * If the parameter `makeItUnique` is true, a new global geometry is created from this positions and is set to the mesh.\n *\n * Possible `kind` values :\n * - VertexBuffer.PositionKind\n * - VertexBuffer.UVKind\n * - VertexBuffer.UV2Kind\n * - VertexBuffer.UV3Kind\n * - VertexBuffer.UV4Kind\n * - VertexBuffer.UV5Kind\n * - VertexBuffer.UV6Kind\n * - VertexBuffer.ColorKind\n * - VertexBuffer.MatricesIndicesKind\n * - VertexBuffer.MatricesIndicesExtraKind\n * - VertexBuffer.MatricesWeightsKind\n * - VertexBuffer.MatricesWeightsExtraKind\n *\n * Returns the Mesh.\n * @param kind\n * @param data\n * @param updateExtends\n * @param makeItUnique\n */\n updateVerticesData(kind, data, updateExtends, makeItUnique) {\n if (this.sourceMesh) {\n this.sourceMesh.updateVerticesData(kind, data, updateExtends, makeItUnique);\n }\n return this.sourceMesh;\n }\n /**\n * Sets the mesh indices.\n * Expects an array populated with integers or a typed array (Int32Array, Uint32Array, Uint16Array).\n * If the mesh has no geometry, a new Geometry object is created and set to the mesh.\n * This method creates a new index buffer each call.\n * Returns the Mesh.\n * @param indices\n * @param totalVertices\n */\n setIndices(indices, totalVertices = null) {\n if (this.sourceMesh) {\n this.sourceMesh.setIndices(indices, totalVertices);\n }\n return this.sourceMesh;\n }\n /**\n * Boolean : True if the mesh owns the requested kind of data.\n * @param kind\n */\n isVerticesDataPresent(kind) {\n return this._sourceMesh.isVerticesDataPresent(kind);\n }\n /**\n * Returns an array of indices (IndicesArray).\n */\n getIndices() {\n return this._sourceMesh.getIndices();\n }\n get _positions() {\n return this._sourceMesh._positions;\n }\n /**\n * This method recomputes and sets a new BoundingInfo to the mesh unless it is locked.\n * This means the mesh underlying bounding box and sphere are recomputed.\n * @param applySkeleton defines whether to apply the skeleton before computing the bounding info\n * @param applyMorph defines whether to apply the morph target before computing the bounding info\n * @returns the current mesh\n */\n refreshBoundingInfo(applySkeleton = false, applyMorph = false) {\n if (this.hasBoundingInfo && this.getBoundingInfo().isLocked) {\n return this;\n }\n const bias = this._sourceMesh.geometry ? this._sourceMesh.geometry.boundingBias : null;\n this._refreshBoundingInfo(this._sourceMesh._getPositionData(applySkeleton, applyMorph), bias);\n return this;\n }\n /** @internal */\n _preActivate() {\n if (this._currentLOD) {\n this._currentLOD._preActivate();\n }\n return this;\n }\n /**\n * @internal\n */\n _activate(renderId, intermediateRendering) {\n super._activate(renderId, intermediateRendering);\n if (!this._sourceMesh.subMeshes) {\n Logger.Warn(\"Instances should only be created for meshes with geometry.\");\n }\n if (this._currentLOD) {\n const differentSign = this._currentLOD._getWorldMatrixDeterminant() >= 0 !== this._getWorldMatrixDeterminant() >= 0;\n if (differentSign) {\n this._internalAbstractMeshDataInfo._actAsRegularMesh = true;\n return true;\n }\n this._internalAbstractMeshDataInfo._actAsRegularMesh = false;\n this._currentLOD._registerInstanceForRenderId(this, renderId);\n if (intermediateRendering) {\n if (!this._currentLOD._internalAbstractMeshDataInfo._isActiveIntermediate) {\n this._currentLOD._internalAbstractMeshDataInfo._onlyForInstancesIntermediate = true;\n return true;\n }\n }\n else {\n if (!this._currentLOD._internalAbstractMeshDataInfo._isActive) {\n this._currentLOD._internalAbstractMeshDataInfo._onlyForInstances = true;\n return true;\n }\n }\n }\n return false;\n }\n /** @internal */\n _postActivate() {\n if (this._sourceMesh.edgesShareWithInstances && this._sourceMesh._edgesRenderer && this._sourceMesh._edgesRenderer.isEnabled && this._sourceMesh._renderingGroup) {\n // we are using the edge renderer of the source mesh\n this._sourceMesh._renderingGroup._edgesRenderers.pushNoDuplicate(this._sourceMesh._edgesRenderer);\n this._sourceMesh._edgesRenderer.customInstances.push(this.getWorldMatrix());\n }\n else if (this._edgesRenderer && this._edgesRenderer.isEnabled && this._sourceMesh._renderingGroup) {\n // we are using the edge renderer defined for this instance\n this._sourceMesh._renderingGroup._edgesRenderers.push(this._edgesRenderer);\n }\n }\n getWorldMatrix() {\n if (this._currentLOD && this._currentLOD.billboardMode !== TransformNode.BILLBOARDMODE_NONE && this._currentLOD._masterMesh !== this) {\n if (!this._billboardWorldMatrix) {\n this._billboardWorldMatrix = new Matrix();\n }\n const tempMaster = this._currentLOD._masterMesh;\n this._currentLOD._masterMesh = this;\n TmpVectors.Vector3[7].copyFrom(this._currentLOD.position);\n this._currentLOD.position.set(0, 0, 0);\n this._billboardWorldMatrix.copyFrom(this._currentLOD.computeWorldMatrix(true));\n this._currentLOD.position.copyFrom(TmpVectors.Vector3[7]);\n this._currentLOD._masterMesh = tempMaster;\n return this._billboardWorldMatrix;\n }\n return super.getWorldMatrix();\n }\n get isAnInstance() {\n return true;\n }\n /**\n * Returns the current associated LOD AbstractMesh.\n * @param camera\n */\n getLOD(camera) {\n if (!camera) {\n return this;\n }\n const sourceMeshLODLevels = this.sourceMesh.getLODLevels();\n if (!sourceMeshLODLevels || sourceMeshLODLevels.length === 0) {\n this._currentLOD = this.sourceMesh;\n }\n else {\n const boundingInfo = this.getBoundingInfo();\n this._currentLOD = this.sourceMesh.getLOD(camera, boundingInfo.boundingSphere);\n }\n return this._currentLOD;\n }\n /**\n * @internal\n */\n _preActivateForIntermediateRendering(renderId) {\n return this.sourceMesh._preActivateForIntermediateRendering(renderId);\n }\n /** @internal */\n _syncSubMeshes() {\n this.releaseSubMeshes();\n if (this._sourceMesh.subMeshes) {\n for (let index = 0; index < this._sourceMesh.subMeshes.length; index++) {\n this._sourceMesh.subMeshes[index].clone(this, this._sourceMesh);\n }\n }\n return this;\n }\n /** @internal */\n _generatePointsArray() {\n return this._sourceMesh._generatePointsArray();\n }\n /** @internal */\n _updateBoundingInfo() {\n if (this.hasBoundingInfo) {\n this.getBoundingInfo().update(this.worldMatrixFromCache);\n }\n else {\n this.buildBoundingInfo(this.absolutePosition, this.absolutePosition, this.worldMatrixFromCache);\n }\n this._updateSubMeshesBoundingInfo(this.worldMatrixFromCache);\n return this;\n }\n /**\n * Creates a new InstancedMesh from the current mesh.\n *\n * Returns the clone.\n * @param name the cloned mesh name\n * @param newParent the optional Node to parent the clone to.\n * @param doNotCloneChildren if `true` the model children aren't cloned.\n * @param newSourceMesh if set this mesh will be used as the source mesh instead of ths instance's one\n * @returns the clone\n */\n clone(name, newParent = null, doNotCloneChildren, newSourceMesh) {\n const result = (newSourceMesh || this._sourceMesh).createInstance(name);\n // Deep copy\n DeepCopier.DeepCopy(this, result, [\n \"name\",\n \"subMeshes\",\n \"uniqueId\",\n \"parent\",\n \"lightSources\",\n \"receiveShadows\",\n \"material\",\n \"visibility\",\n \"skeleton\",\n \"sourceMesh\",\n \"isAnInstance\",\n \"facetNb\",\n \"isFacetDataEnabled\",\n \"isBlocked\",\n \"useBones\",\n \"hasInstances\",\n \"collider\",\n \"edgesRenderer\",\n \"forward\",\n \"up\",\n \"right\",\n \"absolutePosition\",\n \"absoluteScaling\",\n \"absoluteRotationQuaternion\",\n \"isWorldMatrixFrozen\",\n \"nonUniformScaling\",\n \"behaviors\",\n \"worldMatrixFromCache\",\n \"hasThinInstances\",\n \"hasBoundingInfo\",\n ], []);\n // Bounding info\n this.refreshBoundingInfo();\n // Parent\n if (newParent) {\n result.parent = newParent;\n }\n if (!doNotCloneChildren) {\n // Children\n for (let index = 0; index < this.getScene().meshes.length; index++) {\n const mesh = this.getScene().meshes[index];\n if (mesh.parent === this) {\n mesh.clone(mesh.name, result);\n }\n }\n }\n result.computeWorldMatrix(true);\n this.onClonedObservable.notifyObservers(result);\n return result;\n }\n /**\n * Disposes the InstancedMesh.\n * Returns nothing.\n * @param doNotRecurse\n * @param disposeMaterialAndTextures\n */\n dispose(doNotRecurse, disposeMaterialAndTextures = false) {\n // Remove from mesh\n this._sourceMesh.removeInstance(this);\n super.dispose(doNotRecurse, disposeMaterialAndTextures);\n }\n /**\n * @internal\n */\n _serializeAsParent(serializationObject) {\n super._serializeAsParent(serializationObject);\n serializationObject.parentId = this._sourceMesh.uniqueId;\n serializationObject.parentInstanceIndex = this._indexInSourceMeshInstanceArray;\n }\n /**\n * Instantiate (when possible) or clone that node with its hierarchy\n * @param newParent defines the new parent to use for the instance (or clone)\n * @param options defines options to configure how copy is done\n * @param options.doNotInstantiate defines if the model must be instantiated or just cloned\n * @param options.newSourcedMesh newSourcedMesh the new source mesh for the instance (or clone)\n * @param onNewNodeCreated defines an option callback to call when a clone or an instance is created\n * @returns an instance (or a clone) of the current node with its hierarchy\n */\n instantiateHierarchy(newParent = null, options, onNewNodeCreated) {\n const clone = this.clone(\"Clone of \" + (this.name || this.id), newParent || this.parent, true, options && options.newSourcedMesh);\n if (clone) {\n if (onNewNodeCreated) {\n onNewNodeCreated(this, clone);\n }\n }\n for (const child of this.getChildTransformNodes(true)) {\n child.instantiateHierarchy(clone, options, onNewNodeCreated);\n }\n return clone;\n }\n}\nMesh.prototype.registerInstancedBuffer = function (kind, stride) {\n var _a, _b;\n // Remove existing one\n (_b = (_a = this._userInstancedBuffersStorage) === null || _a === void 0 ? void 0 : _a.vertexBuffers[kind]) === null || _b === void 0 ? void 0 : _b.dispose();\n // Creates the instancedBuffer field if not present\n if (!this.instancedBuffers) {\n this.instancedBuffers = {};\n for (const instance of this.instances) {\n instance.instancedBuffers = {};\n }\n if (!this._userInstancedBuffersStorage) {\n this._userInstancedBuffersStorage = {\n data: {},\n vertexBuffers: {},\n strides: {},\n sizes: {},\n vertexArrayObjects: this.getEngine().getCaps().vertexArrayObject ? {} : undefined,\n };\n }\n }\n // Creates an empty property for this kind\n this.instancedBuffers[kind] = null;\n this._userInstancedBuffersStorage.strides[kind] = stride;\n this._userInstancedBuffersStorage.sizes[kind] = stride * 32; // Initial size\n this._userInstancedBuffersStorage.data[kind] = new Float32Array(this._userInstancedBuffersStorage.sizes[kind]);\n this._userInstancedBuffersStorage.vertexBuffers[kind] = new VertexBuffer(this.getEngine(), this._userInstancedBuffersStorage.data[kind], kind, true, false, stride, true);\n for (const instance of this.instances) {\n instance.instancedBuffers[kind] = null;\n }\n this._invalidateInstanceVertexArrayObject();\n this._markSubMeshesAsAttributesDirty();\n};\nMesh.prototype._processInstancedBuffers = function (visibleInstances, renderSelf) {\n const instanceCount = visibleInstances ? visibleInstances.length : 0;\n for (const kind in this.instancedBuffers) {\n let size = this._userInstancedBuffersStorage.sizes[kind];\n const stride = this._userInstancedBuffersStorage.strides[kind];\n // Resize if required\n const expectedSize = (instanceCount + 1) * stride;\n while (size < expectedSize) {\n size *= 2;\n }\n if (this._userInstancedBuffersStorage.data[kind].length != size) {\n this._userInstancedBuffersStorage.data[kind] = new Float32Array(size);\n this._userInstancedBuffersStorage.sizes[kind] = size;\n if (this._userInstancedBuffersStorage.vertexBuffers[kind]) {\n this._userInstancedBuffersStorage.vertexBuffers[kind].dispose();\n this._userInstancedBuffersStorage.vertexBuffers[kind] = null;\n }\n }\n const data = this._userInstancedBuffersStorage.data[kind];\n // Update data buffer\n let offset = 0;\n if (renderSelf) {\n const value = this.instancedBuffers[kind];\n if (value.toArray) {\n value.toArray(data, offset);\n }\n else if (value.copyToArray) {\n value.copyToArray(data, offset);\n }\n else {\n data[offset] = value;\n }\n offset += stride;\n }\n for (let instanceIndex = 0; instanceIndex < instanceCount; instanceIndex++) {\n const instance = visibleInstances[instanceIndex];\n const value = instance.instancedBuffers[kind];\n if (value.toArray) {\n value.toArray(data, offset);\n }\n else if (value.copyToArray) {\n value.copyToArray(data, offset);\n }\n else {\n data[offset] = value;\n }\n offset += stride;\n }\n // Update vertex buffer\n if (!this._userInstancedBuffersStorage.vertexBuffers[kind]) {\n this._userInstancedBuffersStorage.vertexBuffers[kind] = new VertexBuffer(this.getEngine(), this._userInstancedBuffersStorage.data[kind], kind, true, false, stride, true);\n this._invalidateInstanceVertexArrayObject();\n }\n else {\n this._userInstancedBuffersStorage.vertexBuffers[kind].updateDirectly(data, 0);\n }\n }\n};\nMesh.prototype._invalidateInstanceVertexArrayObject = function () {\n if (!this._userInstancedBuffersStorage || this._userInstancedBuffersStorage.vertexArrayObjects === undefined) {\n return;\n }\n for (const kind in this._userInstancedBuffersStorage.vertexArrayObjects) {\n this.getEngine().releaseVertexArrayObject(this._userInstancedBuffersStorage.vertexArrayObjects[kind]);\n }\n this._userInstancedBuffersStorage.vertexArrayObjects = {};\n};\nMesh.prototype._disposeInstanceSpecificData = function () {\n if (this._instanceDataStorage.instancesBuffer) {\n this._instanceDataStorage.instancesBuffer.dispose();\n this._instanceDataStorage.instancesBuffer = null;\n }\n while (this.instances.length) {\n this.instances[0].dispose();\n }\n for (const kind in this.instancedBuffers) {\n if (this._userInstancedBuffersStorage.vertexBuffers[kind]) {\n this._userInstancedBuffersStorage.vertexBuffers[kind].dispose();\n }\n }\n this._invalidateInstanceVertexArrayObject();\n this.instancedBuffers = {};\n};\n//# sourceMappingURL=instancedMesh.js.map","import { SerializationHelper } from \"../Misc/decorators.js\";\nimport { Matrix, Vector3, Vector2, Vector4, Quaternion } from \"../Maths/math.vector.js\";\nimport { VertexBuffer } from \"../Buffers/buffer.js\";\nimport { Texture } from \"../Materials/Textures/texture.js\";\nimport { MaterialHelper } from \"./materialHelper.js\";\nimport { RegisterClass } from \"../Misc/typeStore.js\";\nimport { Color3, Color4 } from \"../Maths/math.color.js\";\nimport { EffectFallbacks } from \"./effectFallbacks.js\";\nimport { WebRequest } from \"../Misc/webRequest.js\";\nimport { PushMaterial } from \"./pushMaterial.js\";\nimport { EngineStore } from \"../Engines/engineStore.js\";\n\nimport { addClipPlaneUniforms, bindClipPlane, prepareStringDefinesForClipPlanes } from \"./clipPlaneMaterialHelper.js\";\nconst onCreatedEffectParameters = { effect: null, subMesh: null };\n/**\n * The ShaderMaterial object has the necessary methods to pass data from your scene to the Vertex and Fragment Shaders and returns a material that can be applied to any mesh.\n *\n * This returned material effects how the mesh will look based on the code in the shaders.\n *\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/shaders/shaderMaterial\n */\nexport class ShaderMaterial extends PushMaterial {\n /**\n * Instantiate a new shader material.\n * The ShaderMaterial object has the necessary methods to pass data from your scene to the Vertex and Fragment Shaders and returns a material that can be applied to any mesh.\n * This returned material effects how the mesh will look based on the code in the shaders.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/shaders/shaderMaterial\n * @param name Define the name of the material in the scene\n * @param scene Define the scene the material belongs to\n * @param shaderPath Defines the route to the shader code in one of three ways:\n * * object: \\{ vertex: \"custom\", fragment: \"custom\" \\}, used with Effect.ShadersStore[\"customVertexShader\"] and Effect.ShadersStore[\"customFragmentShader\"]\n * * object: \\{ vertexElement: \"vertexShaderCode\", fragmentElement: \"fragmentShaderCode\" \\}, used with shader code in script tags\n * * object: \\{ vertexSource: \"vertex shader code string\", fragmentSource: \"fragment shader code string\" \\} using with strings containing the shaders code\n * * string: \"./COMMON_NAME\", used with external files COMMON_NAME.vertex.fx and COMMON_NAME.fragment.fx in index.html folder.\n * @param options Define the options used to create the shader\n * @param storeEffectOnSubMeshes true to store effect on submeshes, false to store the effect directly in the material class.\n */\n constructor(name, scene, shaderPath, options = {}, storeEffectOnSubMeshes = true) {\n super(name, scene, storeEffectOnSubMeshes);\n this._textures = {};\n this._textureArrays = {};\n this._externalTextures = {};\n this._floats = {};\n this._ints = {};\n this._uints = {};\n this._floatsArrays = {};\n this._colors3 = {};\n this._colors3Arrays = {};\n this._colors4 = {};\n this._colors4Arrays = {};\n this._vectors2 = {};\n this._vectors3 = {};\n this._vectors4 = {};\n this._quaternions = {};\n this._quaternionsArrays = {};\n this._matrices = {};\n this._matrixArrays = {};\n this._matrices3x3 = {};\n this._matrices2x2 = {};\n this._vectors2Arrays = {};\n this._vectors3Arrays = {};\n this._vectors4Arrays = {};\n this._uniformBuffers = {};\n this._textureSamplers = {};\n this._storageBuffers = {};\n this._cachedWorldViewMatrix = new Matrix();\n this._cachedWorldViewProjectionMatrix = new Matrix();\n this._multiview = false;\n /**\n * @internal\n */\n this._materialHelperNeedsPreviousMatrices = false;\n this._shaderPath = shaderPath;\n this._options = Object.assign({ needAlphaBlending: false, needAlphaTesting: false, attributes: [\"position\", \"normal\", \"uv\"], uniforms: [\"worldViewProjection\"], uniformBuffers: [], samplers: [], externalTextures: [], samplerObjects: [], storageBuffers: [], defines: [], useClipPlane: false }, options);\n }\n /**\n * Gets the shader path used to define the shader code\n * It can be modified to trigger a new compilation\n */\n get shaderPath() {\n return this._shaderPath;\n }\n /**\n * Sets the shader path used to define the shader code\n * It can be modified to trigger a new compilation\n */\n set shaderPath(shaderPath) {\n this._shaderPath = shaderPath;\n }\n /**\n * Gets the options used to compile the shader.\n * They can be modified to trigger a new compilation\n */\n get options() {\n return this._options;\n }\n /**\n * is multiview set to true?\n */\n get isMultiview() {\n return this._multiview;\n }\n /**\n * Gets the current class name of the material e.g. \"ShaderMaterial\"\n * Mainly use in serialization.\n * @returns the class name\n */\n getClassName() {\n return \"ShaderMaterial\";\n }\n /**\n * Specifies if the material will require alpha blending\n * @returns a boolean specifying if alpha blending is needed\n */\n needAlphaBlending() {\n return this.alpha < 1.0 || this._options.needAlphaBlending;\n }\n /**\n * Specifies if this material should be rendered in alpha test mode\n * @returns a boolean specifying if an alpha test is needed.\n */\n needAlphaTesting() {\n return this._options.needAlphaTesting;\n }\n _checkUniform(uniformName) {\n if (this._options.uniforms.indexOf(uniformName) === -1) {\n this._options.uniforms.push(uniformName);\n }\n }\n /**\n * Set a texture in the shader.\n * @param name Define the name of the uniform samplers as defined in the shader\n * @param texture Define the texture to bind to this sampler\n * @returns the material itself allowing \"fluent\" like uniform updates\n */\n setTexture(name, texture) {\n if (this._options.samplers.indexOf(name) === -1) {\n this._options.samplers.push(name);\n }\n this._textures[name] = texture;\n return this;\n }\n /**\n * Set a texture array in the shader.\n * @param name Define the name of the uniform sampler array as defined in the shader\n * @param textures Define the list of textures to bind to this sampler\n * @returns the material itself allowing \"fluent\" like uniform updates\n */\n setTextureArray(name, textures) {\n if (this._options.samplers.indexOf(name) === -1) {\n this._options.samplers.push(name);\n }\n this._checkUniform(name);\n this._textureArrays[name] = textures;\n return this;\n }\n /**\n * Set an internal texture in the shader.\n * @param name Define the name of the uniform samplers as defined in the shader\n * @param texture Define the texture to bind to this sampler\n * @returns the material itself allowing \"fluent\" like uniform updates\n */\n setExternalTexture(name, texture) {\n if (this._options.externalTextures.indexOf(name) === -1) {\n this._options.externalTextures.push(name);\n }\n this._externalTextures[name] = texture;\n return this;\n }\n /**\n * Set a float in the shader.\n * @param name Define the name of the uniform as defined in the shader\n * @param value Define the value to give to the uniform\n * @returns the material itself allowing \"fluent\" like uniform updates\n */\n setFloat(name, value) {\n this._checkUniform(name);\n this._floats[name] = value;\n return this;\n }\n /**\n * Set a int in the shader.\n * @param name Define the name of the uniform as defined in the shader\n * @param value Define the value to give to the uniform\n * @returns the material itself allowing \"fluent\" like uniform updates\n */\n setInt(name, value) {\n this._checkUniform(name);\n this._ints[name] = value;\n return this;\n }\n /**\n * Set a unsigned int in the shader.\n * @param name Define the name of the uniform as defined in the shader\n * @param value Define the value to give to the uniform\n * @returns the material itself allowing \"fluent\" like uniform updates\n */\n setUInt(name, value) {\n this._checkUniform(name);\n this._uints[name] = value;\n return this;\n }\n /**\n * Set an array of floats in the shader.\n * @param name Define the name of the uniform as defined in the shader\n * @param value Define the value to give to the uniform\n * @returns the material itself allowing \"fluent\" like uniform updates\n */\n setFloats(name, value) {\n this._checkUniform(name);\n this._floatsArrays[name] = value;\n return this;\n }\n /**\n * Set a vec3 in the shader from a Color3.\n * @param name Define the name of the uniform as defined in the shader\n * @param value Define the value to give to the uniform\n * @returns the material itself allowing \"fluent\" like uniform updates\n */\n setColor3(name, value) {\n this._checkUniform(name);\n this._colors3[name] = value;\n return this;\n }\n /**\n * Set a vec3 array in the shader from a Color3 array.\n * @param name Define the name of the uniform as defined in the shader\n * @param value Define the value to give to the uniform\n * @returns the material itself allowing \"fluent\" like uniform updates\n */\n setColor3Array(name, value) {\n this._checkUniform(name);\n this._colors3Arrays[name] = value.reduce((arr, color) => {\n color.toArray(arr, arr.length);\n return arr;\n }, []);\n return this;\n }\n /**\n * Set a vec4 in the shader from a Color4.\n * @param name Define the name of the uniform as defined in the shader\n * @param value Define the value to give to the uniform\n * @returns the material itself allowing \"fluent\" like uniform updates\n */\n setColor4(name, value) {\n this._checkUniform(name);\n this._colors4[name] = value;\n return this;\n }\n /**\n * Set a vec4 array in the shader from a Color4 array.\n * @param name Define the name of the uniform as defined in the shader\n * @param value Define the value to give to the uniform\n * @returns the material itself allowing \"fluent\" like uniform updates\n */\n setColor4Array(name, value) {\n this._checkUniform(name);\n this._colors4Arrays[name] = value.reduce((arr, color) => {\n color.toArray(arr, arr.length);\n return arr;\n }, []);\n return this;\n }\n /**\n * Set a vec2 in the shader from a Vector2.\n * @param name Define the name of the uniform as defined in the shader\n * @param value Define the value to give to the uniform\n * @returns the material itself allowing \"fluent\" like uniform updates\n */\n setVector2(name, value) {\n this._checkUniform(name);\n this._vectors2[name] = value;\n return this;\n }\n /**\n * Set a vec3 in the shader from a Vector3.\n * @param name Define the name of the uniform as defined in the shader\n * @param value Define the value to give to the uniform\n * @returns the material itself allowing \"fluent\" like uniform updates\n */\n setVector3(name, value) {\n this._checkUniform(name);\n this._vectors3[name] = value;\n return this;\n }\n /**\n * Set a vec4 in the shader from a Vector4.\n * @param name Define the name of the uniform as defined in the shader\n * @param value Define the value to give to the uniform\n * @returns the material itself allowing \"fluent\" like uniform updates\n */\n setVector4(name, value) {\n this._checkUniform(name);\n this._vectors4[name] = value;\n return this;\n }\n /**\n * Set a vec4 in the shader from a Quaternion.\n * @param name Define the name of the uniform as defined in the shader\n * @param value Define the value to give to the uniform\n * @returns the material itself allowing \"fluent\" like uniform updates\n */\n setQuaternion(name, value) {\n this._checkUniform(name);\n this._quaternions[name] = value;\n return this;\n }\n /**\n * Set a vec4 array in the shader from a Quaternion array.\n * @param name Define the name of the uniform as defined in the shader\n * @param value Define the value to give to the uniform\n * @returns the material itself allowing \"fluent\" like uniform updates\n */\n setQuaternionArray(name, value) {\n this._checkUniform(name);\n this._quaternionsArrays[name] = value.reduce((arr, quaternion) => {\n quaternion.toArray(arr, arr.length);\n return arr;\n }, []);\n return this;\n }\n /**\n * Set a mat4 in the shader from a Matrix.\n * @param name Define the name of the uniform as defined in the shader\n * @param value Define the value to give to the uniform\n * @returns the material itself allowing \"fluent\" like uniform updates\n */\n setMatrix(name, value) {\n this._checkUniform(name);\n this._matrices[name] = value;\n return this;\n }\n /**\n * Set a float32Array in the shader from a matrix array.\n * @param name Define the name of the uniform as defined in the shader\n * @param value Define the value to give to the uniform\n * @returns the material itself allowing \"fluent\" like uniform updates\n */\n setMatrices(name, value) {\n this._checkUniform(name);\n const float32Array = new Float32Array(value.length * 16);\n for (let index = 0; index < value.length; index++) {\n const matrix = value[index];\n matrix.copyToArray(float32Array, index * 16);\n }\n this._matrixArrays[name] = float32Array;\n return this;\n }\n /**\n * Set a mat3 in the shader from a Float32Array.\n * @param name Define the name of the uniform as defined in the shader\n * @param value Define the value to give to the uniform\n * @returns the material itself allowing \"fluent\" like uniform updates\n */\n setMatrix3x3(name, value) {\n this._checkUniform(name);\n this._matrices3x3[name] = value;\n return this;\n }\n /**\n * Set a mat2 in the shader from a Float32Array.\n * @param name Define the name of the uniform as defined in the shader\n * @param value Define the value to give to the uniform\n * @returns the material itself allowing \"fluent\" like uniform updates\n */\n setMatrix2x2(name, value) {\n this._checkUniform(name);\n this._matrices2x2[name] = value;\n return this;\n }\n /**\n * Set a vec2 array in the shader from a number array.\n * @param name Define the name of the uniform as defined in the shader\n * @param value Define the value to give to the uniform\n * @returns the material itself allowing \"fluent\" like uniform updates\n */\n setArray2(name, value) {\n this._checkUniform(name);\n this._vectors2Arrays[name] = value;\n return this;\n }\n /**\n * Set a vec3 array in the shader from a number array.\n * @param name Define the name of the uniform as defined in the shader\n * @param value Define the value to give to the uniform\n * @returns the material itself allowing \"fluent\" like uniform updates\n */\n setArray3(name, value) {\n this._checkUniform(name);\n this._vectors3Arrays[name] = value;\n return this;\n }\n /**\n * Set a vec4 array in the shader from a number array.\n * @param name Define the name of the uniform as defined in the shader\n * @param value Define the value to give to the uniform\n * @returns the material itself allowing \"fluent\" like uniform updates\n */\n setArray4(name, value) {\n this._checkUniform(name);\n this._vectors4Arrays[name] = value;\n return this;\n }\n /**\n * Set a uniform buffer in the shader\n * @param name Define the name of the uniform as defined in the shader\n * @param buffer Define the value to give to the uniform\n * @returns the material itself allowing \"fluent\" like uniform updates\n */\n setUniformBuffer(name, buffer) {\n if (this._options.uniformBuffers.indexOf(name) === -1) {\n this._options.uniformBuffers.push(name);\n }\n this._uniformBuffers[name] = buffer;\n return this;\n }\n /**\n * Set a texture sampler in the shader\n * @param name Define the name of the uniform as defined in the shader\n * @param sampler Define the value to give to the uniform\n * @returns the material itself allowing \"fluent\" like uniform updates\n */\n setTextureSampler(name, sampler) {\n if (this._options.samplerObjects.indexOf(name) === -1) {\n this._options.samplerObjects.push(name);\n }\n this._textureSamplers[name] = sampler;\n return this;\n }\n /**\n * Set a storage buffer in the shader\n * @param name Define the name of the storage buffer as defined in the shader\n * @param buffer Define the value to give to the uniform\n * @returns the material itself allowing \"fluent\" like uniform updates\n */\n setStorageBuffer(name, buffer) {\n if (this._options.storageBuffers.indexOf(name) === -1) {\n this._options.storageBuffers.push(name);\n }\n this._storageBuffers[name] = buffer;\n return this;\n }\n /**\n * Adds, removes, or replaces the specified shader define and value.\n * * setDefine(\"MY_DEFINE\", true); // enables a boolean define\n * * setDefine(\"MY_DEFINE\", \"0.5\"); // adds \"#define MY_DEFINE 0.5\" to the shader (or sets and replaces the value of any existing define with that name)\n * * setDefine(\"MY_DEFINE\", false); // disables and removes the define\n * Note if the active defines do change, the shader will be recompiled and this can be expensive.\n * @param define the define name e.g., \"OUTPUT_TO_SRGB\" or \"#define OUTPUT_TO_SRGB\". If the define was passed into the constructor already, the version used should match that, and in either case, it should not include any appended value.\n * @param value either the value of the define (e.g. a numerical value) or for booleans, true if the define should be enabled or false if it should be disabled\n * @returns the material itself allowing \"fluent\" like uniform updates\n */\n setDefine(define, value) {\n // First remove any existing define with this name.\n const defineName = define.trimEnd() + \" \";\n const existingDefineIdx = this.options.defines.findIndex((x) => x === define || x.startsWith(defineName));\n if (existingDefineIdx >= 0) {\n this.options.defines.splice(existingDefineIdx, 1);\n }\n // Then add the new define value. (If it's a boolean value and false, don't add it.)\n if (typeof value !== \"boolean\" || value) {\n this.options.defines.push(defineName + value);\n }\n return this;\n }\n /**\n * Specifies that the submesh is ready to be used\n * @param mesh defines the mesh to check\n * @param subMesh defines which submesh to check\n * @param useInstances specifies that instances should be used\n * @returns a boolean indicating that the submesh is ready or not\n */\n isReadyForSubMesh(mesh, subMesh, useInstances) {\n return this.isReady(mesh, useInstances, subMesh);\n }\n /**\n * Checks if the material is ready to render the requested mesh\n * @param mesh Define the mesh to render\n * @param useInstances Define whether or not the material is used with instances\n * @param subMesh defines which submesh to render\n * @returns true if ready, otherwise false\n */\n isReady(mesh, useInstances, subMesh) {\n var _a, _b, _c, _d;\n const storeEffectOnSubMeshes = subMesh && this._storeEffectOnSubMeshes;\n if (this.isFrozen) {\n if (storeEffectOnSubMeshes) {\n if (subMesh.effect && subMesh.effect._wasPreviouslyReady) {\n return true;\n }\n }\n else {\n const effect = this._drawWrapper.effect;\n if (effect && effect._wasPreviouslyReady && effect._wasPreviouslyUsingInstances === useInstances) {\n return true;\n }\n }\n }\n const scene = this.getScene();\n const engine = scene.getEngine();\n // Instances\n const defines = [];\n const attribs = [];\n const fallbacks = new EffectFallbacks();\n let shaderName = this._shaderPath, uniforms = this._options.uniforms, uniformBuffers = this._options.uniformBuffers, samplers = this._options.samplers;\n // global multiview\n if (engine.getCaps().multiview && scene.activeCamera && scene.activeCamera.outputRenderTarget && scene.activeCamera.outputRenderTarget.getViewCount() > 1) {\n this._multiview = true;\n defines.push(\"#define MULTIVIEW\");\n if (this._options.uniforms.indexOf(\"viewProjection\") !== -1 && this._options.uniforms.indexOf(\"viewProjectionR\") === -1) {\n this._options.uniforms.push(\"viewProjectionR\");\n }\n }\n for (let index = 0; index < this._options.defines.length; index++) {\n const defineToAdd = this._options.defines[index].indexOf(\"#define\") === 0 ? this._options.defines[index] : `#define ${this._options.defines[index]}`;\n defines.push(defineToAdd);\n }\n for (let index = 0; index < this._options.attributes.length; index++) {\n attribs.push(this._options.attributes[index]);\n }\n if (mesh && mesh.isVerticesDataPresent(VertexBuffer.ColorKind)) {\n attribs.push(VertexBuffer.ColorKind);\n defines.push(\"#define VERTEXCOLOR\");\n }\n if (useInstances) {\n defines.push(\"#define INSTANCES\");\n MaterialHelper.PushAttributesForInstances(attribs, this._materialHelperNeedsPreviousMatrices);\n if (mesh === null || mesh === void 0 ? void 0 : mesh.hasThinInstances) {\n defines.push(\"#define THIN_INSTANCES\");\n if (mesh && mesh.isVerticesDataPresent(VertexBuffer.ColorInstanceKind)) {\n attribs.push(VertexBuffer.ColorInstanceKind);\n defines.push(\"#define INSTANCESCOLOR\");\n }\n }\n }\n // Bones\n if (mesh && mesh.useBones && mesh.computeBonesUsingShaders && mesh.skeleton) {\n attribs.push(VertexBuffer.MatricesIndicesKind);\n attribs.push(VertexBuffer.MatricesWeightsKind);\n if (mesh.numBoneInfluencers > 4) {\n attribs.push(VertexBuffer.MatricesIndicesExtraKind);\n attribs.push(VertexBuffer.MatricesWeightsExtraKind);\n }\n const skeleton = mesh.skeleton;\n defines.push(\"#define NUM_BONE_INFLUENCERS \" + mesh.numBoneInfluencers);\n fallbacks.addCPUSkinningFallback(0, mesh);\n if (skeleton.isUsingTextureForMatrices) {\n defines.push(\"#define BONETEXTURE\");\n if (this._options.uniforms.indexOf(\"boneTextureWidth\") === -1) {\n this._options.uniforms.push(\"boneTextureWidth\");\n }\n if (this._options.samplers.indexOf(\"boneSampler\") === -1) {\n this._options.samplers.push(\"boneSampler\");\n }\n }\n else {\n defines.push(\"#define BonesPerMesh \" + (skeleton.bones.length + 1));\n if (this._options.uniforms.indexOf(\"mBones\") === -1) {\n this._options.uniforms.push(\"mBones\");\n }\n }\n }\n else {\n defines.push(\"#define NUM_BONE_INFLUENCERS 0\");\n }\n // Morph\n let numInfluencers = 0;\n const manager = mesh ? mesh.morphTargetManager : null;\n if (manager) {\n const uv = manager.supportsUVs && defines.indexOf(\"#define UV1\") !== -1;\n const tangent = manager.supportsTangents && defines.indexOf(\"#define TANGENT\") !== -1;\n const normal = manager.supportsNormals && defines.indexOf(\"#define NORMAL\") !== -1;\n numInfluencers = manager.numInfluencers;\n if (uv) {\n defines.push(\"#define MORPHTARGETS_UV\");\n }\n if (tangent) {\n defines.push(\"#define MORPHTARGETS_TANGENT\");\n }\n if (normal) {\n defines.push(\"#define MORPHTARGETS_NORMAL\");\n }\n if (numInfluencers > 0) {\n defines.push(\"#define MORPHTARGETS\");\n }\n if (manager.isUsingTextureForTargets) {\n defines.push(\"#define MORPHTARGETS_TEXTURE\");\n if (this._options.uniforms.indexOf(\"morphTargetTextureIndices\") === -1) {\n this._options.uniforms.push(\"morphTargetTextureIndices\");\n }\n if (this._options.samplers.indexOf(\"morphTargets\") === -1) {\n this._options.samplers.push(\"morphTargets\");\n }\n }\n defines.push(\"#define NUM_MORPH_INFLUENCERS \" + numInfluencers);\n for (let index = 0; index < numInfluencers; index++) {\n attribs.push(VertexBuffer.PositionKind + index);\n if (normal) {\n attribs.push(VertexBuffer.NormalKind + index);\n }\n if (tangent) {\n attribs.push(VertexBuffer.TangentKind + index);\n }\n if (uv) {\n attribs.push(VertexBuffer.UVKind + \"_\" + index);\n }\n }\n if (numInfluencers > 0) {\n uniforms = uniforms.slice();\n uniforms.push(\"morphTargetInfluences\");\n uniforms.push(\"morphTargetTextureInfo\");\n uniforms.push(\"morphTargetTextureIndices\");\n }\n }\n else {\n defines.push(\"#define NUM_MORPH_INFLUENCERS 0\");\n }\n // Baked Vertex Animation\n if (mesh) {\n const bvaManager = mesh.bakedVertexAnimationManager;\n if (bvaManager && bvaManager.isEnabled) {\n defines.push(\"#define BAKED_VERTEX_ANIMATION_TEXTURE\");\n if (this._options.uniforms.indexOf(\"bakedVertexAnimationSettings\") === -1) {\n this._options.uniforms.push(\"bakedVertexAnimationSettings\");\n }\n if (this._options.uniforms.indexOf(\"bakedVertexAnimationTextureSizeInverted\") === -1) {\n this._options.uniforms.push(\"bakedVertexAnimationTextureSizeInverted\");\n }\n if (this._options.uniforms.indexOf(\"bakedVertexAnimationTime\") === -1) {\n this._options.uniforms.push(\"bakedVertexAnimationTime\");\n }\n if (this._options.samplers.indexOf(\"bakedVertexAnimationTexture\") === -1) {\n this._options.samplers.push(\"bakedVertexAnimationTexture\");\n }\n }\n MaterialHelper.PrepareAttributesForBakedVertexAnimation(attribs, mesh, defines);\n }\n // Textures\n for (const name in this._textures) {\n if (!this._textures[name].isReady()) {\n return false;\n }\n }\n // Alpha test\n if (mesh && this._shouldTurnAlphaTestOn(mesh)) {\n defines.push(\"#define ALPHATEST\");\n }\n // Clip planes\n if (this._options.useClipPlane !== false) {\n addClipPlaneUniforms(uniforms);\n prepareStringDefinesForClipPlanes(this, scene, defines);\n }\n if (this.customShaderNameResolve) {\n uniforms = uniforms.slice();\n uniformBuffers = uniformBuffers.slice();\n samplers = samplers.slice();\n shaderName = this.customShaderNameResolve(shaderName, uniforms, uniformBuffers, samplers, defines, attribs);\n }\n const drawWrapper = storeEffectOnSubMeshes ? subMesh._getDrawWrapper() : this._drawWrapper;\n const previousEffect = (_a = drawWrapper === null || drawWrapper === void 0 ? void 0 : drawWrapper.effect) !== null && _a !== void 0 ? _a : null;\n const previousDefines = (_b = drawWrapper === null || drawWrapper === void 0 ? void 0 : drawWrapper.defines) !== null && _b !== void 0 ? _b : null;\n const join = defines.join(\"\\n\");\n let effect = previousEffect;\n if (previousDefines !== join) {\n effect = engine.createEffect(shaderName, {\n attributes: attribs,\n uniformsNames: uniforms,\n uniformBuffersNames: uniformBuffers,\n samplers: samplers,\n defines: join,\n fallbacks: fallbacks,\n onCompiled: this.onCompiled,\n onError: this.onError,\n indexParameters: { maxSimultaneousMorphTargets: numInfluencers },\n shaderLanguage: this._options.shaderLanguage,\n }, engine);\n if (storeEffectOnSubMeshes) {\n subMesh.setEffect(effect, join, this._materialContext);\n }\n else if (drawWrapper) {\n drawWrapper.setEffect(effect, join);\n }\n if (this._onEffectCreatedObservable) {\n onCreatedEffectParameters.effect = effect;\n onCreatedEffectParameters.subMesh = (_c = subMesh !== null && subMesh !== void 0 ? subMesh : mesh === null || mesh === void 0 ? void 0 : mesh.subMeshes[0]) !== null && _c !== void 0 ? _c : null;\n this._onEffectCreatedObservable.notifyObservers(onCreatedEffectParameters);\n }\n }\n effect._wasPreviouslyUsingInstances = !!useInstances;\n if ((_d = !(effect === null || effect === void 0 ? void 0 : effect.isReady())) !== null && _d !== void 0 ? _d : true) {\n return false;\n }\n if (previousEffect !== effect) {\n scene.resetCachedMaterial();\n }\n effect._wasPreviouslyReady = true;\n return true;\n }\n /**\n * Binds the world matrix to the material\n * @param world defines the world transformation matrix\n * @param effectOverride - If provided, use this effect instead of internal effect\n */\n bindOnlyWorldMatrix(world, effectOverride) {\n const scene = this.getScene();\n const effect = effectOverride !== null && effectOverride !== void 0 ? effectOverride : this.getEffect();\n if (!effect) {\n return;\n }\n if (this._options.uniforms.indexOf(\"world\") !== -1) {\n effect.setMatrix(\"world\", world);\n }\n if (this._options.uniforms.indexOf(\"worldView\") !== -1) {\n world.multiplyToRef(scene.getViewMatrix(), this._cachedWorldViewMatrix);\n effect.setMatrix(\"worldView\", this._cachedWorldViewMatrix);\n }\n if (this._options.uniforms.indexOf(\"worldViewProjection\") !== -1) {\n world.multiplyToRef(scene.getTransformMatrix(), this._cachedWorldViewProjectionMatrix);\n effect.setMatrix(\"worldViewProjection\", this._cachedWorldViewProjectionMatrix);\n }\n }\n /**\n * Binds the submesh to this material by preparing the effect and shader to draw\n * @param world defines the world transformation matrix\n * @param mesh defines the mesh containing the submesh\n * @param subMesh defines the submesh to bind the material to\n */\n bindForSubMesh(world, mesh, subMesh) {\n var _a;\n this.bind(world, mesh, (_a = subMesh._drawWrapperOverride) === null || _a === void 0 ? void 0 : _a.effect, subMesh);\n }\n /**\n * Binds the material to the mesh\n * @param world defines the world transformation matrix\n * @param mesh defines the mesh to bind the material to\n * @param effectOverride - If provided, use this effect instead of internal effect\n * @param subMesh defines the submesh to bind the material to\n */\n bind(world, mesh, effectOverride, subMesh) {\n var _a;\n // Std values\n const storeEffectOnSubMeshes = subMesh && this._storeEffectOnSubMeshes;\n const effect = effectOverride !== null && effectOverride !== void 0 ? effectOverride : (storeEffectOnSubMeshes ? subMesh.effect : this.getEffect());\n if (!effect) {\n return;\n }\n this._activeEffect = effect;\n this.bindOnlyWorldMatrix(world, effectOverride);\n const uniformBuffers = this._options.uniformBuffers;\n let useSceneUBO = false;\n if (effect && uniformBuffers && uniformBuffers.length > 0 && this.getScene().getEngine().supportsUniformBuffers) {\n for (let i = 0; i < uniformBuffers.length; ++i) {\n const bufferName = uniformBuffers[i];\n switch (bufferName) {\n case \"Mesh\":\n if (mesh) {\n mesh.getMeshUniformBuffer().bindToEffect(effect, \"Mesh\");\n mesh.transferToEffect(world);\n }\n break;\n case \"Scene\":\n MaterialHelper.BindSceneUniformBuffer(effect, this.getScene().getSceneUniformBuffer());\n this.getScene().finalizeSceneUbo();\n useSceneUBO = true;\n break;\n }\n }\n }\n const mustRebind = mesh && storeEffectOnSubMeshes ? this._mustRebind(this.getScene(), effect, mesh.visibility) : this.getScene().getCachedMaterial() !== this;\n if (effect && mustRebind) {\n if (!useSceneUBO && this._options.uniforms.indexOf(\"view\") !== -1) {\n effect.setMatrix(\"view\", this.getScene().getViewMatrix());\n }\n if (!useSceneUBO && this._options.uniforms.indexOf(\"projection\") !== -1) {\n effect.setMatrix(\"projection\", this.getScene().getProjectionMatrix());\n }\n if (!useSceneUBO && this._options.uniforms.indexOf(\"viewProjection\") !== -1) {\n effect.setMatrix(\"viewProjection\", this.getScene().getTransformMatrix());\n if (this._multiview) {\n effect.setMatrix(\"viewProjectionR\", this.getScene()._transformMatrixR);\n }\n }\n if (this.getScene().activeCamera && this._options.uniforms.indexOf(\"cameraPosition\") !== -1) {\n effect.setVector3(\"cameraPosition\", this.getScene().activeCamera.globalPosition);\n }\n // Bones\n MaterialHelper.BindBonesParameters(mesh, effect);\n // Clip plane\n bindClipPlane(effect, this, this.getScene());\n let name;\n // Texture\n for (name in this._textures) {\n effect.setTexture(name, this._textures[name]);\n }\n // Texture arrays\n for (name in this._textureArrays) {\n effect.setTextureArray(name, this._textureArrays[name]);\n }\n // External texture\n for (name in this._externalTextures) {\n effect.setExternalTexture(name, this._externalTextures[name]);\n }\n // Int\n for (name in this._ints) {\n effect.setInt(name, this._ints[name]);\n }\n // UInt\n for (name in this._uints) {\n effect.setUInt(name, this._uints[name]);\n }\n // Float\n for (name in this._floats) {\n effect.setFloat(name, this._floats[name]);\n }\n // Floats\n for (name in this._floatsArrays) {\n effect.setArray(name, this._floatsArrays[name]);\n }\n // Color3\n for (name in this._colors3) {\n effect.setColor3(name, this._colors3[name]);\n }\n // Color3Array\n for (name in this._colors3Arrays) {\n effect.setArray3(name, this._colors3Arrays[name]);\n }\n // Color4\n for (name in this._colors4) {\n const color = this._colors4[name];\n effect.setFloat4(name, color.r, color.g, color.b, color.a);\n }\n // Color4Array\n for (name in this._colors4Arrays) {\n effect.setArray4(name, this._colors4Arrays[name]);\n }\n // Vector2\n for (name in this._vectors2) {\n effect.setVector2(name, this._vectors2[name]);\n }\n // Vector3\n for (name in this._vectors3) {\n effect.setVector3(name, this._vectors3[name]);\n }\n // Vector4\n for (name in this._vectors4) {\n effect.setVector4(name, this._vectors4[name]);\n }\n // Quaternion\n for (name in this._quaternions) {\n effect.setQuaternion(name, this._quaternions[name]);\n }\n // Matrix\n for (name in this._matrices) {\n effect.setMatrix(name, this._matrices[name]);\n }\n // MatrixArray\n for (name in this._matrixArrays) {\n effect.setMatrices(name, this._matrixArrays[name]);\n }\n // Matrix 3x3\n for (name in this._matrices3x3) {\n effect.setMatrix3x3(name, this._matrices3x3[name]);\n }\n // Matrix 2x2\n for (name in this._matrices2x2) {\n effect.setMatrix2x2(name, this._matrices2x2[name]);\n }\n // Vector2Array\n for (name in this._vectors2Arrays) {\n effect.setArray2(name, this._vectors2Arrays[name]);\n }\n // Vector3Array\n for (name in this._vectors3Arrays) {\n effect.setArray3(name, this._vectors3Arrays[name]);\n }\n // Vector4Array\n for (name in this._vectors4Arrays) {\n effect.setArray4(name, this._vectors4Arrays[name]);\n }\n // QuaternionArray\n for (name in this._quaternionsArrays) {\n effect.setArray4(name, this._quaternionsArrays[name]);\n }\n // Uniform buffers\n for (name in this._uniformBuffers) {\n const buffer = this._uniformBuffers[name].getBuffer();\n if (buffer) {\n effect.bindUniformBuffer(buffer, name);\n }\n }\n // Samplers\n for (name in this._textureSamplers) {\n effect.setTextureSampler(name, this._textureSamplers[name]);\n }\n // Storage buffers\n for (name in this._storageBuffers) {\n effect.setStorageBuffer(name, this._storageBuffers[name]);\n }\n }\n if (effect && mesh && (mustRebind || !this.isFrozen)) {\n // Morph targets\n const manager = mesh.morphTargetManager;\n if (manager && manager.numInfluencers > 0) {\n MaterialHelper.BindMorphTargetParameters(mesh, effect);\n }\n const bvaManager = mesh.bakedVertexAnimationManager;\n if (bvaManager && bvaManager.isEnabled) {\n (_a = mesh.bakedVertexAnimationManager) === null || _a === void 0 ? void 0 : _a.bind(effect, !!effect._wasPreviouslyUsingInstances);\n }\n }\n this._afterBind(mesh, effect);\n }\n /**\n * Gets the active textures from the material\n * @returns an array of textures\n */\n getActiveTextures() {\n const activeTextures = super.getActiveTextures();\n for (const name in this._textures) {\n activeTextures.push(this._textures[name]);\n }\n for (const name in this._textureArrays) {\n const array = this._textureArrays[name];\n for (let index = 0; index < array.length; index++) {\n activeTextures.push(array[index]);\n }\n }\n return activeTextures;\n }\n /**\n * Specifies if the material uses a texture\n * @param texture defines the texture to check against the material\n * @returns a boolean specifying if the material uses the texture\n */\n hasTexture(texture) {\n if (super.hasTexture(texture)) {\n return true;\n }\n for (const name in this._textures) {\n if (this._textures[name] === texture) {\n return true;\n }\n }\n for (const name in this._textureArrays) {\n const array = this._textureArrays[name];\n for (let index = 0; index < array.length; index++) {\n if (array[index] === texture) {\n return true;\n }\n }\n }\n return false;\n }\n /**\n * Makes a duplicate of the material, and gives it a new name\n * @param name defines the new name for the duplicated material\n * @returns the cloned material\n */\n clone(name) {\n const result = SerializationHelper.Clone(() => new ShaderMaterial(name, this.getScene(), this._shaderPath, this._options, this._storeEffectOnSubMeshes), this);\n result.name = name;\n result.id = name;\n // Shader code path\n if (typeof result._shaderPath === \"object\") {\n result._shaderPath = Object.assign({}, result._shaderPath);\n }\n // Options\n this._options = Object.assign({}, this._options);\n Object.keys(this._options).forEach((propName) => {\n const propValue = this._options[propName];\n if (Array.isArray(propValue)) {\n this._options[propName] = propValue.slice(0);\n }\n });\n // Stencil\n this.stencil.copyTo(result.stencil);\n // Texture\n for (const key in this._textures) {\n result.setTexture(key, this._textures[key]);\n }\n // TextureArray\n for (const key in this._textureArrays) {\n result.setTextureArray(key, this._textureArrays[key]);\n }\n // External texture\n for (const key in this._externalTextures) {\n result.setExternalTexture(key, this._externalTextures[key]);\n }\n // Int\n for (const key in this._ints) {\n result.setInt(key, this._ints[key]);\n }\n // UInt\n for (const key in this._uints) {\n result.setUInt(key, this._uints[key]);\n }\n // Float\n for (const key in this._floats) {\n result.setFloat(key, this._floats[key]);\n }\n // Floats\n for (const key in this._floatsArrays) {\n result.setFloats(key, this._floatsArrays[key]);\n }\n // Color3\n for (const key in this._colors3) {\n result.setColor3(key, this._colors3[key]);\n }\n // Color3Array\n for (const key in this._colors3Arrays) {\n result._colors3Arrays[key] = this._colors3Arrays[key];\n }\n // Color4\n for (const key in this._colors4) {\n result.setColor4(key, this._colors4[key]);\n }\n // Color4Array\n for (const key in this._colors4Arrays) {\n result._colors4Arrays[key] = this._colors4Arrays[key];\n }\n // Vector2\n for (const key in this._vectors2) {\n result.setVector2(key, this._vectors2[key]);\n }\n // Vector3\n for (const key in this._vectors3) {\n result.setVector3(key, this._vectors3[key]);\n }\n // Vector4\n for (const key in this._vectors4) {\n result.setVector4(key, this._vectors4[key]);\n }\n // Quaternion\n for (const key in this._quaternions) {\n result.setQuaternion(key, this._quaternions[key]);\n }\n // QuaternionArray\n for (const key in this._quaternionsArrays) {\n result._quaternionsArrays[key] = this._quaternionsArrays[key];\n }\n // Matrix\n for (const key in this._matrices) {\n result.setMatrix(key, this._matrices[key]);\n }\n // MatrixArray\n for (const key in this._matrixArrays) {\n result._matrixArrays[key] = this._matrixArrays[key].slice();\n }\n // Matrix 3x3\n for (const key in this._matrices3x3) {\n result.setMatrix3x3(key, this._matrices3x3[key]);\n }\n // Matrix 2x2\n for (const key in this._matrices2x2) {\n result.setMatrix2x2(key, this._matrices2x2[key]);\n }\n // Vector2Array\n for (const key in this._vectors2Arrays) {\n result.setArray2(key, this._vectors2Arrays[key]);\n }\n // Vector3Array\n for (const key in this._vectors3Arrays) {\n result.setArray3(key, this._vectors3Arrays[key]);\n }\n // Vector4Array\n for (const key in this._vectors4Arrays) {\n result.setArray4(key, this._vectors4Arrays[key]);\n }\n // Uniform buffers\n for (const key in this._uniformBuffers) {\n result.setUniformBuffer(key, this._uniformBuffers[key]);\n }\n // Samplers\n for (const key in this._textureSamplers) {\n result.setTextureSampler(key, this._textureSamplers[key]);\n }\n // Storag buffers\n for (const key in this._storageBuffers) {\n result.setStorageBuffer(key, this._storageBuffers[key]);\n }\n return result;\n }\n /**\n * Disposes the material\n * @param forceDisposeEffect specifies if effects should be forcefully disposed\n * @param forceDisposeTextures specifies if textures should be forcefully disposed\n * @param notBoundToMesh specifies if the material that is being disposed is known to be not bound to any mesh\n */\n dispose(forceDisposeEffect, forceDisposeTextures, notBoundToMesh) {\n if (forceDisposeTextures) {\n let name;\n for (name in this._textures) {\n this._textures[name].dispose();\n }\n for (name in this._textureArrays) {\n const array = this._textureArrays[name];\n for (let index = 0; index < array.length; index++) {\n array[index].dispose();\n }\n }\n }\n this._textures = {};\n super.dispose(forceDisposeEffect, forceDisposeTextures, notBoundToMesh);\n }\n /**\n * Serializes this material in a JSON representation\n * @returns the serialized material object\n */\n serialize() {\n const serializationObject = SerializationHelper.Serialize(this);\n serializationObject.customType = \"BABYLON.ShaderMaterial\";\n serializationObject.uniqueId = this.uniqueId;\n serializationObject.options = this._options;\n serializationObject.shaderPath = this._shaderPath;\n serializationObject.storeEffectOnSubMeshes = this._storeEffectOnSubMeshes;\n let name;\n // Stencil\n serializationObject.stencil = this.stencil.serialize();\n // Texture\n serializationObject.textures = {};\n for (name in this._textures) {\n serializationObject.textures[name] = this._textures[name].serialize();\n }\n // Texture arrays\n serializationObject.textureArrays = {};\n for (name in this._textureArrays) {\n serializationObject.textureArrays[name] = [];\n const array = this._textureArrays[name];\n for (let index = 0; index < array.length; index++) {\n serializationObject.textureArrays[name].push(array[index].serialize());\n }\n }\n // Int\n serializationObject.ints = {};\n for (name in this._ints) {\n serializationObject.ints[name] = this._ints[name];\n }\n // UInt\n serializationObject.uints = {};\n for (name in this._uints) {\n serializationObject.uints[name] = this._uints[name];\n }\n // Float\n serializationObject.floats = {};\n for (name in this._floats) {\n serializationObject.floats[name] = this._floats[name];\n }\n // Floats\n serializationObject.FloatArrays = {};\n for (name in this._floatsArrays) {\n serializationObject.FloatArrays[name] = this._floatsArrays[name];\n }\n // Color3\n serializationObject.colors3 = {};\n for (name in this._colors3) {\n serializationObject.colors3[name] = this._colors3[name].asArray();\n }\n // Color3 array\n serializationObject.colors3Arrays = {};\n for (name in this._colors3Arrays) {\n serializationObject.colors3Arrays[name] = this._colors3Arrays[name];\n }\n // Color4\n serializationObject.colors4 = {};\n for (name in this._colors4) {\n serializationObject.colors4[name] = this._colors4[name].asArray();\n }\n // Color4 array\n serializationObject.colors4Arrays = {};\n for (name in this._colors4Arrays) {\n serializationObject.colors4Arrays[name] = this._colors4Arrays[name];\n }\n // Vector2\n serializationObject.vectors2 = {};\n for (name in this._vectors2) {\n serializationObject.vectors2[name] = this._vectors2[name].asArray();\n }\n // Vector3\n serializationObject.vectors3 = {};\n for (name in this._vectors3) {\n serializationObject.vectors3[name] = this._vectors3[name].asArray();\n }\n // Vector4\n serializationObject.vectors4 = {};\n for (name in this._vectors4) {\n serializationObject.vectors4[name] = this._vectors4[name].asArray();\n }\n // Quaternion\n serializationObject.quaternions = {};\n for (name in this._quaternions) {\n serializationObject.quaternions[name] = this._quaternions[name].asArray();\n }\n // Matrix\n serializationObject.matrices = {};\n for (name in this._matrices) {\n serializationObject.matrices[name] = this._matrices[name].asArray();\n }\n // MatrixArray\n serializationObject.matrixArray = {};\n for (name in this._matrixArrays) {\n serializationObject.matrixArray[name] = this._matrixArrays[name];\n }\n // Matrix 3x3\n serializationObject.matrices3x3 = {};\n for (name in this._matrices3x3) {\n serializationObject.matrices3x3[name] = this._matrices3x3[name];\n }\n // Matrix 2x2\n serializationObject.matrices2x2 = {};\n for (name in this._matrices2x2) {\n serializationObject.matrices2x2[name] = this._matrices2x2[name];\n }\n // Vector2Array\n serializationObject.vectors2Arrays = {};\n for (name in this._vectors2Arrays) {\n serializationObject.vectors2Arrays[name] = this._vectors2Arrays[name];\n }\n // Vector3Array\n serializationObject.vectors3Arrays = {};\n for (name in this._vectors3Arrays) {\n serializationObject.vectors3Arrays[name] = this._vectors3Arrays[name];\n }\n // Vector4Array\n serializationObject.vectors4Arrays = {};\n for (name in this._vectors4Arrays) {\n serializationObject.vectors4Arrays[name] = this._vectors4Arrays[name];\n }\n // QuaternionArray\n serializationObject.quaternionsArrays = {};\n for (name in this._quaternionsArrays) {\n serializationObject.quaternionsArrays[name] = this._quaternionsArrays[name];\n }\n return serializationObject;\n }\n /**\n * Creates a shader material from parsed shader material data\n * @param source defines the JSON representation of the material\n * @param scene defines the hosting scene\n * @param rootUrl defines the root URL to use to load textures and relative dependencies\n * @returns a new material\n */\n static Parse(source, scene, rootUrl) {\n const material = SerializationHelper.Parse(() => new ShaderMaterial(source.name, scene, source.shaderPath, source.options, source.storeEffectOnSubMeshes), source, scene, rootUrl);\n let name;\n // Stencil\n if (source.stencil) {\n material.stencil.parse(source.stencil, scene, rootUrl);\n }\n // Texture\n for (name in source.textures) {\n material.setTexture(name, Texture.Parse(source.textures[name], scene, rootUrl));\n }\n // Texture arrays\n for (name in source.textureArrays) {\n const array = source.textureArrays[name];\n const textureArray = new Array();\n for (let index = 0; index < array.length; index++) {\n textureArray.push(Texture.Parse(array[index], scene, rootUrl));\n }\n material.setTextureArray(name, textureArray);\n }\n // Int\n for (name in source.ints) {\n material.setInt(name, source.ints[name]);\n }\n // UInt\n for (name in source.uints) {\n material.setUInt(name, source.uints[name]);\n }\n // Float\n for (name in source.floats) {\n material.setFloat(name, source.floats[name]);\n }\n // Floats\n for (name in source.floatsArrays) {\n material.setFloats(name, source.floatsArrays[name]);\n }\n // Color3\n for (name in source.colors3) {\n material.setColor3(name, Color3.FromArray(source.colors3[name]));\n }\n // Color3 arrays\n for (name in source.colors3Arrays) {\n const colors = source.colors3Arrays[name]\n .reduce((arr, num, i) => {\n if (i % 3 === 0) {\n arr.push([num]);\n }\n else {\n arr[arr.length - 1].push(num);\n }\n return arr;\n }, [])\n .map((color) => Color3.FromArray(color));\n material.setColor3Array(name, colors);\n }\n // Color4\n for (name in source.colors4) {\n material.setColor4(name, Color4.FromArray(source.colors4[name]));\n }\n // Color4 arrays\n for (name in source.colors4Arrays) {\n const colors = source.colors4Arrays[name]\n .reduce((arr, num, i) => {\n if (i % 4 === 0) {\n arr.push([num]);\n }\n else {\n arr[arr.length - 1].push(num);\n }\n return arr;\n }, [])\n .map((color) => Color4.FromArray(color));\n material.setColor4Array(name, colors);\n }\n // Vector2\n for (name in source.vectors2) {\n material.setVector2(name, Vector2.FromArray(source.vectors2[name]));\n }\n // Vector3\n for (name in source.vectors3) {\n material.setVector3(name, Vector3.FromArray(source.vectors3[name]));\n }\n // Vector4\n for (name in source.vectors4) {\n material.setVector4(name, Vector4.FromArray(source.vectors4[name]));\n }\n // Quaternion\n for (name in source.quaternions) {\n material.setQuaternion(name, Quaternion.FromArray(source.quaternions[name]));\n }\n // Matrix\n for (name in source.matrices) {\n material.setMatrix(name, Matrix.FromArray(source.matrices[name]));\n }\n // MatrixArray\n for (name in source.matrixArray) {\n material._matrixArrays[name] = new Float32Array(source.matrixArray[name]);\n }\n // Matrix 3x3\n for (name in source.matrices3x3) {\n material.setMatrix3x3(name, source.matrices3x3[name]);\n }\n // Matrix 2x2\n for (name in source.matrices2x2) {\n material.setMatrix2x2(name, source.matrices2x2[name]);\n }\n // Vector2Array\n for (name in source.vectors2Arrays) {\n material.setArray2(name, source.vectors2Arrays[name]);\n }\n // Vector3Array\n for (name in source.vectors3Arrays) {\n material.setArray3(name, source.vectors3Arrays[name]);\n }\n // Vector4Array\n for (name in source.vectors4Arrays) {\n material.setArray4(name, source.vectors4Arrays[name]);\n }\n // QuaternionArray\n for (name in source.quaternionsArrays) {\n material.setArray4(name, source.quaternionsArrays[name]);\n }\n return material;\n }\n /**\n * Creates a new ShaderMaterial from a snippet saved in a remote file\n * @param name defines the name of the ShaderMaterial to create (can be null or empty to use the one from the json data)\n * @param url defines the url to load from\n * @param scene defines the hosting scene\n * @param rootUrl defines the root URL to use to load textures and relative dependencies\n * @returns a promise that will resolve to the new ShaderMaterial\n */\n static ParseFromFileAsync(name, url, scene, rootUrl = \"\") {\n return new Promise((resolve, reject) => {\n const request = new WebRequest();\n request.addEventListener(\"readystatechange\", () => {\n if (request.readyState == 4) {\n if (request.status == 200) {\n const serializationObject = JSON.parse(request.responseText);\n const output = this.Parse(serializationObject, scene || EngineStore.LastCreatedScene, rootUrl);\n if (name) {\n output.name = name;\n }\n resolve(output);\n }\n else {\n reject(\"Unable to load the ShaderMaterial\");\n }\n }\n });\n request.open(\"GET\", url);\n request.send();\n });\n }\n /**\n * Creates a ShaderMaterial from a snippet saved by the Inspector\n * @param snippetId defines the snippet to load\n * @param scene defines the hosting scene\n * @param rootUrl defines the root URL to use to load textures and relative dependencies\n * @returns a promise that will resolve to the new ShaderMaterial\n */\n static ParseFromSnippetAsync(snippetId, scene, rootUrl = \"\") {\n return new Promise((resolve, reject) => {\n const request = new WebRequest();\n request.addEventListener(\"readystatechange\", () => {\n if (request.readyState == 4) {\n if (request.status == 200) {\n const snippet = JSON.parse(JSON.parse(request.responseText).jsonPayload);\n const serializationObject = JSON.parse(snippet.shaderMaterial);\n const output = this.Parse(serializationObject, scene || EngineStore.LastCreatedScene, rootUrl);\n output.snippetId = snippetId;\n resolve(output);\n }\n else {\n reject(\"Unable to load the snippet \" + snippetId);\n }\n }\n });\n request.open(\"GET\", this.SnippetUrl + \"/\" + snippetId.replace(/#/g, \"/\"));\n request.send();\n });\n }\n}\n/** Define the Url to load snippets */\nShaderMaterial.SnippetUrl = `https://snippet.babylonjs.com`;\n/**\n * Creates a ShaderMaterial from a snippet saved by the Inspector\n * @deprecated Please use ParseFromSnippetAsync instead\n * @param snippetId defines the snippet to load\n * @param scene defines the hosting scene\n * @param rootUrl defines the root URL to use to load textures and relative dependencies\n * @returns a promise that will resolve to the new ShaderMaterial\n */\nShaderMaterial.CreateFromSnippetAsync = ShaderMaterial.ParseFromSnippetAsync;\nRegisterClass(\"BABYLON.ShaderMaterial\", ShaderMaterial);\n//# sourceMappingURL=shaderMaterial.js.map","// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore.js\";\nimport \"./ShadersInclude/clipPlaneFragmentDeclaration.js\";\nimport \"./ShadersInclude/clipPlaneFragment.js\";\nconst name = \"colorPixelShader\";\nconst shader = `#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\n#define VERTEXCOLOR\nvarying vec4 vColor;\n#else\nuniform vec4 color;\n#endif\n#include\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\ngl_FragColor=vColor;\n#else\ngl_FragColor=color;\n#endif\n#define CUSTOM_FRAGMENT_MAIN_END\n}`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @internal */\nexport const colorPixelShader = { name, shader };\n//# sourceMappingURL=color.fragment.js.map","// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore.js\";\nimport \"./ShadersInclude/bonesDeclaration.js\";\nimport \"./ShadersInclude/bakedVertexAnimationDeclaration.js\";\nimport \"./ShadersInclude/clipPlaneVertexDeclaration.js\";\nimport \"./ShadersInclude/instancesDeclaration.js\";\nimport \"./ShadersInclude/instancesVertex.js\";\nimport \"./ShadersInclude/bonesVertex.js\";\nimport \"./ShadersInclude/bakedVertexAnimation.js\";\nimport \"./ShadersInclude/clipPlaneVertex.js\";\nimport \"./ShadersInclude/vertexColorMixing.js\";\nconst name = \"colorVertexShader\";\nconst shader = `attribute vec3 position;\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include\n#include\n#include\n#include\nuniform mat4 viewProjection;\n#ifdef MULTIVIEW\nuniform mat4 viewProjectionR;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vec4 vColor;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include\n#include\n#include\nvec4 worldPos=finalWorld*vec4(position,1.0);\n#ifdef MULTIVIEW\nif (gl_ViewID_OVR==0u) {gl_Position=viewProjection*worldPos;} else {gl_Position=viewProjectionR*worldPos;}\n#else\ngl_Position=viewProjection*worldPos;\n#endif\n#include\n#include\n#define CUSTOM_VERTEX_MAIN_END\n}`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @internal */\nexport const colorVertexShader = { name, shader };\n//# sourceMappingURL=color.vertex.js.map","import { Color3, Color4 } from \"../Maths/math.color.js\";\nimport { VertexBuffer } from \"../Buffers/buffer.js\";\nimport { Mesh } from \"../Meshes/mesh.js\";\nimport { InstancedMesh } from \"../Meshes/instancedMesh.js\";\nimport { Material } from \"../Materials/material.js\";\nimport { ShaderMaterial } from \"../Materials/shaderMaterial.js\";\nimport \"../Shaders/color.fragment.js\";\nimport \"../Shaders/color.vertex.js\";\nMesh._LinesMeshParser = (parsedMesh, scene) => {\n return LinesMesh.Parse(parsedMesh, scene);\n};\n/**\n * Line mesh\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param\n */\nexport class LinesMesh extends Mesh {\n _isShaderMaterial(shader) {\n return shader.getClassName() === \"ShaderMaterial\";\n }\n /**\n * Creates a new LinesMesh\n * @param name defines the name\n * @param scene defines the hosting scene\n * @param parent defines the parent mesh if any\n * @param source defines the optional source LinesMesh used to clone data from\n * @param doNotCloneChildren When cloning, skip cloning child meshes of source, default False.\n * When false, achieved by calling a clone(), also passing False.\n * This will make creation of children, recursive.\n * @param useVertexColor defines if this LinesMesh supports vertex color\n * @param useVertexAlpha defines if this LinesMesh supports vertex alpha\n * @param material material to use to draw the line. If not provided, will create a new one\n */\n constructor(name, scene = null, parent = null, source = null, doNotCloneChildren, \n /**\n * If vertex color should be applied to the mesh\n */\n useVertexColor, \n /**\n * If vertex alpha should be applied to the mesh\n */\n useVertexAlpha, material) {\n super(name, scene, parent, source, doNotCloneChildren);\n this.useVertexColor = useVertexColor;\n this.useVertexAlpha = useVertexAlpha;\n /**\n * Color of the line (Default: White)\n */\n this.color = new Color3(1, 1, 1);\n /**\n * Alpha of the line (Default: 1)\n */\n this.alpha = 1;\n if (source) {\n this.color = source.color.clone();\n this.alpha = source.alpha;\n this.useVertexColor = source.useVertexColor;\n this.useVertexAlpha = source.useVertexAlpha;\n }\n this.intersectionThreshold = 0.1;\n const defines = [];\n const options = {\n attributes: [VertexBuffer.PositionKind],\n uniforms: [\"world\", \"viewProjection\"],\n needAlphaBlending: true,\n defines: defines,\n useClipPlane: null,\n };\n if (useVertexAlpha === false) {\n options.needAlphaBlending = false;\n }\n else {\n options.defines.push(\"#define VERTEXALPHA\");\n }\n if (!useVertexColor) {\n options.uniforms.push(\"color\");\n this._color4 = new Color4();\n }\n else {\n options.defines.push(\"#define VERTEXCOLOR\");\n options.attributes.push(VertexBuffer.ColorKind);\n }\n if (material) {\n this.material = material;\n }\n else {\n this.material = new ShaderMaterial(\"colorShader\", this.getScene(), \"color\", options, false);\n this.material.doNotSerialize = true;\n }\n }\n isReady() {\n if (!this._lineMaterial.isReady(this, !!this._userInstancedBuffersStorage || this.hasThinInstances)) {\n return false;\n }\n return super.isReady();\n }\n /**\n * Returns the string \"LineMesh\"\n */\n getClassName() {\n return \"LinesMesh\";\n }\n /**\n * @internal\n */\n get material() {\n return this._lineMaterial;\n }\n /**\n * @internal\n */\n set material(value) {\n this._lineMaterial = value;\n this._lineMaterial.fillMode = Material.LineListDrawMode;\n }\n /**\n * @internal\n */\n get checkCollisions() {\n return false;\n }\n set checkCollisions(value) {\n // Just ignore it\n }\n /**\n * @internal\n */\n _bind(_subMesh, colorEffect) {\n if (!this._geometry) {\n return this;\n }\n // VBOs\n const indexToBind = this.isUnIndexed ? null : this._geometry.getIndexBuffer();\n if (!this._userInstancedBuffersStorage || this.hasThinInstances) {\n this._geometry._bind(colorEffect, indexToBind);\n }\n else {\n this._geometry._bind(colorEffect, indexToBind, this._userInstancedBuffersStorage.vertexBuffers, this._userInstancedBuffersStorage.vertexArrayObjects);\n }\n // Color\n if (!this.useVertexColor && this._isShaderMaterial(this._lineMaterial)) {\n const { r, g, b } = this.color;\n this._color4.set(r, g, b, this.alpha);\n this._lineMaterial.setColor4(\"color\", this._color4);\n }\n return this;\n }\n /**\n * @internal\n */\n _draw(subMesh, fillMode, instancesCount) {\n if (!this._geometry || !this._geometry.getVertexBuffers() || (!this._unIndexed && !this._geometry.getIndexBuffer())) {\n return this;\n }\n const engine = this.getScene().getEngine();\n // Draw order\n if (this._unIndexed) {\n engine.drawArraysType(Material.LineListDrawMode, subMesh.verticesStart, subMesh.verticesCount, instancesCount);\n }\n else {\n engine.drawElementsType(Material.LineListDrawMode, subMesh.indexStart, subMesh.indexCount, instancesCount);\n }\n return this;\n }\n /**\n * Disposes of the line mesh\n * @param doNotRecurse If children should be disposed\n * @param disposeMaterialAndTextures This parameter is not used by the LineMesh class\n * @param doNotDisposeMaterial If the material should not be disposed (default: false, meaning the material is disposed)\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n dispose(doNotRecurse, disposeMaterialAndTextures = false, doNotDisposeMaterial) {\n if (!doNotDisposeMaterial) {\n this._lineMaterial.dispose(false, false, true);\n }\n super.dispose(doNotRecurse);\n }\n /**\n * Returns a new LineMesh object cloned from the current one.\n * @param name\n * @param newParent\n * @param doNotCloneChildren\n */\n clone(name, newParent = null, doNotCloneChildren) {\n return new LinesMesh(name, this.getScene(), newParent, this, doNotCloneChildren);\n }\n /**\n * Creates a new InstancedLinesMesh object from the mesh model.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/copies/instances\n * @param name defines the name of the new instance\n * @returns a new InstancedLinesMesh\n */\n createInstance(name) {\n const instance = new InstancedLinesMesh(name, this);\n if (this.instancedBuffers) {\n instance.instancedBuffers = {};\n for (const key in this.instancedBuffers) {\n instance.instancedBuffers[key] = this.instancedBuffers[key];\n }\n }\n return instance;\n }\n /**\n * Serializes this ground mesh\n * @param serializationObject object to write serialization to\n */\n serialize(serializationObject) {\n super.serialize(serializationObject);\n serializationObject.color = this.color.asArray();\n serializationObject.alpha = this.alpha;\n }\n /**\n * Parses a serialized ground mesh\n * @param parsedMesh the serialized mesh\n * @param scene the scene to create the ground mesh in\n * @returns the created ground mesh\n */\n static Parse(parsedMesh, scene) {\n const result = new LinesMesh(parsedMesh.name, scene);\n result.color = Color3.FromArray(parsedMesh.color);\n result.alpha = parsedMesh.alpha;\n return result;\n }\n}\n/**\n * Creates an instance based on a source LinesMesh\n */\nexport class InstancedLinesMesh extends InstancedMesh {\n constructor(name, source) {\n super(name, source);\n this.intersectionThreshold = source.intersectionThreshold;\n }\n /**\n * Returns the string \"InstancedLinesMesh\".\n */\n getClassName() {\n return \"InstancedLinesMesh\";\n }\n}\n//# sourceMappingURL=linesMesh.js.map","/* eslint-disable @typescript-eslint/naming-convention */\nimport { Vector3 } from \"../../Maths/math.vector.js\";\nimport { _CreationDataStorage, Mesh } from \"../mesh.js\";\nimport { VertexData } from \"../mesh.vertexData.js\";\nimport { LinesMesh } from \"../../Meshes/linesMesh.js\";\nimport { VertexBuffer } from \"../../Buffers/buffer.js\";\nimport { Logger } from \"../../Misc/logger.js\";\n/**\n * Creates the VertexData of the LineSystem\n * @param options an object used to set the following optional parameters for the LineSystem, required but can be empty\n * - lines an array of lines, each line being an array of successive Vector3\n * - colors an array of line colors, each of the line colors being an array of successive Color4, one per line point\n * @param options.lines\n * @param options.colors\n * @returns the VertexData of the LineSystem\n */\nexport function CreateLineSystemVertexData(options) {\n const indices = [];\n const positions = [];\n const lines = options.lines;\n const colors = options.colors;\n const vertexColors = [];\n let idx = 0;\n for (let l = 0; l < lines.length; l++) {\n const points = lines[l];\n for (let index = 0; index < points.length; index++) {\n positions.push(points[index].x, points[index].y, points[index].z);\n if (colors) {\n const color = colors[l];\n vertexColors.push(color[index].r, color[index].g, color[index].b, color[index].a);\n }\n if (index > 0) {\n indices.push(idx - 1);\n indices.push(idx);\n }\n idx++;\n }\n }\n const vertexData = new VertexData();\n vertexData.indices = indices;\n vertexData.positions = positions;\n if (colors) {\n vertexData.colors = vertexColors;\n }\n return vertexData;\n}\n/**\n * Create the VertexData for a DashedLines\n * @param options an object used to set the following optional parameters for the DashedLines, required but can be empty\n * - points an array successive Vector3\n * - dashSize the size of the dashes relative to the dash number, optional, default 3\n * - gapSize the size of the gap between two successive dashes relative to the dash number, optional, default 1\n * - dashNb the intended total number of dashes, optional, default 200\n * @param options.points\n * @param options.dashSize\n * @param options.gapSize\n * @param options.dashNb\n * @returns the VertexData for the DashedLines\n */\nexport function CreateDashedLinesVertexData(options) {\n const dashSize = options.dashSize || 3;\n const gapSize = options.gapSize || 1;\n const dashNb = options.dashNb || 200;\n const points = options.points;\n const positions = new Array();\n const indices = new Array();\n const curvect = Vector3.Zero();\n let lg = 0;\n let nb = 0;\n let shft = 0;\n let dashshft = 0;\n let curshft = 0;\n let idx = 0;\n let i = 0;\n for (i = 0; i < points.length - 1; i++) {\n points[i + 1].subtractToRef(points[i], curvect);\n lg += curvect.length();\n }\n shft = lg / dashNb;\n dashshft = (dashSize * shft) / (dashSize + gapSize);\n for (i = 0; i < points.length - 1; i++) {\n points[i + 1].subtractToRef(points[i], curvect);\n nb = Math.floor(curvect.length() / shft);\n curvect.normalize();\n for (let j = 0; j < nb; j++) {\n curshft = shft * j;\n positions.push(points[i].x + curshft * curvect.x, points[i].y + curshft * curvect.y, points[i].z + curshft * curvect.z);\n positions.push(points[i].x + (curshft + dashshft) * curvect.x, points[i].y + (curshft + dashshft) * curvect.y, points[i].z + (curshft + dashshft) * curvect.z);\n indices.push(idx, idx + 1);\n idx += 2;\n }\n }\n // Result\n const vertexData = new VertexData();\n vertexData.positions = positions;\n vertexData.indices = indices;\n return vertexData;\n}\n/**\n * Creates a line system mesh. A line system is a pool of many lines gathered in a single mesh\n * * A line system mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of lines as an input parameter\n * * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineSystem to this static function\n * * The parameter `lines` is an array of lines, each line being an array of successive Vector3\n * * The optional parameter `instance` is an instance of an existing LineSystem object to be updated with the passed `lines` parameter\n * * The optional parameter `colors` is an array of line colors, each line colors being an array of successive Color4, one per line point\n * * The optional parameter `useVertexAlpha` is to be set to `false` (default `true`) when you don't need the alpha blending (faster)\n * * The optional parameter `material` is the material to use to draw the lines if provided. If not, a default material will be created\n * * Updating a simple Line mesh, you just need to update every line in the `lines` array : https://doc.babylonjs.com/features/featuresDeepDive/mesh/dynamicMeshMorph#lines-and-dashedlines\n * * When updating an instance, remember that only line point positions can change, not the number of points, neither the number of lines\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param#line-system\n * @param name defines the name of the new line system\n * @param options defines the options used to create the line system\n * @param options.lines\n * @param options.updatable\n * @param options.instance\n * @param options.colors\n * @param options.useVertexAlpha\n * @param options.material\n * @param scene defines the hosting scene\n * @returns a new line system mesh\n */\nexport function CreateLineSystem(name, options, scene = null) {\n const instance = options.instance;\n const lines = options.lines;\n const colors = options.colors;\n if (instance) {\n // lines update\n const positions = instance.getVerticesData(VertexBuffer.PositionKind);\n let vertexColor;\n let lineColors;\n if (colors) {\n vertexColor = instance.getVerticesData(VertexBuffer.ColorKind);\n }\n let i = 0;\n let c = 0;\n for (let l = 0; l < lines.length; l++) {\n const points = lines[l];\n for (let p = 0; p < points.length; p++) {\n positions[i] = points[p].x;\n positions[i + 1] = points[p].y;\n positions[i + 2] = points[p].z;\n if (colors && vertexColor) {\n lineColors = colors[l];\n vertexColor[c] = lineColors[p].r;\n vertexColor[c + 1] = lineColors[p].g;\n vertexColor[c + 2] = lineColors[p].b;\n vertexColor[c + 3] = lineColors[p].a;\n c += 4;\n }\n i += 3;\n }\n }\n instance.updateVerticesData(VertexBuffer.PositionKind, positions, false, false);\n if (colors && vertexColor) {\n instance.updateVerticesData(VertexBuffer.ColorKind, vertexColor, false, false);\n }\n return instance;\n }\n // line system creation\n const useVertexColor = colors ? true : false;\n const lineSystem = new LinesMesh(name, scene, null, undefined, undefined, useVertexColor, options.useVertexAlpha, options.material);\n const vertexData = CreateLineSystemVertexData(options);\n vertexData.applyToMesh(lineSystem, options.updatable);\n return lineSystem;\n}\n/**\n * Creates a line mesh\n * A line mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of points as an input parameter\n * * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineMesh to this static function\n * * The parameter `points` is an array successive Vector3\n * * The optional parameter `instance` is an instance of an existing LineMesh object to be updated with the passed `points` parameter : https://doc.babylonjs.com/features/featuresDeepDive/mesh/dynamicMeshMorph#lines-and-dashedlines\n * * The optional parameter `colors` is an array of successive Color4, one per line point\n * * The optional parameter `useVertexAlpha` is to be set to `false` (default `true`) when you don't need alpha blending (faster)\n * * The optional parameter `material` is the material to use to draw the lines if provided. If not, a default material will be created\n * * When updating an instance, remember that only point positions can change, not the number of points\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param#lines\n * @param name defines the name of the new line system\n * @param options defines the options used to create the line system\n * @param options.points\n * @param options.updatable\n * @param options.instance\n * @param options.colors\n * @param options.useVertexAlpha\n * @param options.material\n * @param scene defines the hosting scene\n * @returns a new line mesh\n */\nexport function CreateLines(name, options, scene = null) {\n const colors = options.colors ? [options.colors] : null;\n const lines = CreateLineSystem(name, { lines: [options.points], updatable: options.updatable, instance: options.instance, colors: colors, useVertexAlpha: options.useVertexAlpha, material: options.material }, scene);\n return lines;\n}\n/**\n * Creates a dashed line mesh\n * * A dashed line mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of points as an input parameter\n * * Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineMesh to this static function\n * * The parameter `points` is an array successive Vector3\n * * The parameter `dashNb` is the intended total number of dashes (positive integer, default 200)\n * * The parameter `dashSize` is the size of the dashes relatively the dash number (positive float, default 3)\n * * The parameter `gapSize` is the size of the gap between two successive dashes relatively the dash number (positive float, default 1)\n * * The optional parameter `instance` is an instance of an existing LineMesh object to be updated with the passed `points` parameter : https://doc.babylonjs.com/features/featuresDeepDive/mesh/dynamicMeshMorph#lines-and-dashedlines\n * * The optional parameter `useVertexAlpha` is to be set to `false` (default `true`) when you don't need the alpha blending (faster)\n * * The optional parameter `material` is the material to use to draw the lines if provided. If not, a default material will be created\n * * When updating an instance, remember that only point positions can change, not the number of points\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\n * @param name defines the name of the mesh\n * @param options defines the options used to create the mesh\n * @param options.points\n * @param options.dashSize\n * @param options.gapSize\n * @param options.dashNb\n * @param options.updatable\n * @param options.instance\n * @param options.useVertexAlpha\n * @param options.material\n * @param scene defines the hosting scene\n * @returns the dashed line mesh\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param#dashed-lines\n */\nexport function CreateDashedLines(name, options, scene = null) {\n const points = options.points;\n const instance = options.instance;\n const gapSize = options.gapSize || 1;\n const dashSize = options.dashSize || 3;\n if (instance) {\n // dashed lines update\n const positionFunction = (positions) => {\n const curvect = Vector3.Zero();\n const nbSeg = positions.length / 6;\n let lg = 0;\n let nb = 0;\n let shft = 0;\n let dashshft = 0;\n let curshft = 0;\n let p = 0;\n let i = 0;\n let j = 0;\n for (i = 0; i < points.length - 1; i++) {\n points[i + 1].subtractToRef(points[i], curvect);\n lg += curvect.length();\n }\n shft = lg / nbSeg;\n const dashSize = instance._creationDataStorage.dashSize;\n const gapSize = instance._creationDataStorage.gapSize;\n dashshft = (dashSize * shft) / (dashSize + gapSize);\n for (i = 0; i < points.length - 1; i++) {\n points[i + 1].subtractToRef(points[i], curvect);\n nb = Math.floor(curvect.length() / shft);\n curvect.normalize();\n j = 0;\n while (j < nb && p < positions.length) {\n curshft = shft * j;\n positions[p] = points[i].x + curshft * curvect.x;\n positions[p + 1] = points[i].y + curshft * curvect.y;\n positions[p + 2] = points[i].z + curshft * curvect.z;\n positions[p + 3] = points[i].x + (curshft + dashshft) * curvect.x;\n positions[p + 4] = points[i].y + (curshft + dashshft) * curvect.y;\n positions[p + 5] = points[i].z + (curshft + dashshft) * curvect.z;\n p += 6;\n j++;\n }\n }\n while (p < positions.length) {\n positions[p] = points[i].x;\n positions[p + 1] = points[i].y;\n positions[p + 2] = points[i].z;\n p += 3;\n }\n };\n if (options.dashNb || options.dashSize || options.gapSize || options.useVertexAlpha || options.material) {\n Logger.Warn(\"You have used an option other than points with the instance option. Please be aware that these other options will be ignored.\");\n }\n instance.updateMeshPositions(positionFunction, false);\n return instance;\n }\n // dashed lines creation\n const dashedLines = new LinesMesh(name, scene, null, undefined, undefined, undefined, options.useVertexAlpha, options.material);\n const vertexData = CreateDashedLinesVertexData(options);\n vertexData.applyToMesh(dashedLines, options.updatable);\n dashedLines._creationDataStorage = new _CreationDataStorage();\n dashedLines._creationDataStorage.dashSize = dashSize;\n dashedLines._creationDataStorage.gapSize = gapSize;\n return dashedLines;\n}\n/**\n * Class containing static functions to help procedurally build meshes\n * @deprecated use the functions directly from the module\n */\nexport const LinesBuilder = {\n CreateDashedLines,\n CreateLineSystem,\n CreateLines,\n};\nVertexData.CreateLineSystem = CreateLineSystemVertexData;\nVertexData.CreateDashedLines = CreateDashedLinesVertexData;\nMesh.CreateLines = (name, points, scene = null, updatable = false, instance = null) => {\n const options = {\n points,\n updatable,\n instance,\n };\n return CreateLines(name, options, scene);\n};\nMesh.CreateDashedLines = (name, points, dashSize, gapSize, dashNb, scene = null, updatable, instance) => {\n const options = {\n points,\n dashSize,\n gapSize,\n dashNb,\n updatable,\n instance,\n };\n return CreateDashedLines(name, options, scene);\n};\n//# sourceMappingURL=linesBuilder.js.map","import { Logger } from \"../Misc/logger.js\";\nimport { Vector3, Vector2 } from \"../Maths/math.vector.js\";\nimport { VertexBuffer } from \"../Buffers/buffer.js\";\nimport { Mesh } from \"../Meshes/mesh.js\";\nimport { VertexData } from \"../Meshes/mesh.vertexData.js\";\nimport { Path2 } from \"../Maths/math.path.js\";\nimport { Epsilon } from \"../Maths/math.constants.js\";\nimport { EngineStore } from \"../Engines/engineStore.js\";\n/**\n * Vector2 wth index property\n */\nclass IndexedVector2 extends Vector2 {\n constructor(original, \n /** Index of the vector2 */\n index) {\n super(original.x, original.y);\n this.index = index;\n }\n}\n/**\n * Defines points to create a polygon\n */\nclass PolygonPoints {\n constructor() {\n this.elements = new Array();\n }\n add(originalPoints) {\n const result = new Array();\n originalPoints.forEach((point) => {\n const newPoint = new IndexedVector2(point, this.elements.length);\n result.push(newPoint);\n this.elements.push(newPoint);\n });\n return result;\n }\n computeBounds() {\n const lmin = new Vector2(this.elements[0].x, this.elements[0].y);\n const lmax = new Vector2(this.elements[0].x, this.elements[0].y);\n this.elements.forEach((point) => {\n // x\n if (point.x < lmin.x) {\n lmin.x = point.x;\n }\n else if (point.x > lmax.x) {\n lmax.x = point.x;\n }\n // y\n if (point.y < lmin.y) {\n lmin.y = point.y;\n }\n else if (point.y > lmax.y) {\n lmax.y = point.y;\n }\n });\n return {\n min: lmin,\n max: lmax,\n width: lmax.x - lmin.x,\n height: lmax.y - lmin.y,\n };\n }\n}\n/**\n * Polygon\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param#non-regular-polygon\n */\nexport class Polygon {\n /**\n * Creates a rectangle\n * @param xmin bottom X coord\n * @param ymin bottom Y coord\n * @param xmax top X coord\n * @param ymax top Y coord\n * @returns points that make the resulting rectangle\n */\n static Rectangle(xmin, ymin, xmax, ymax) {\n return [new Vector2(xmin, ymin), new Vector2(xmax, ymin), new Vector2(xmax, ymax), new Vector2(xmin, ymax)];\n }\n /**\n * Creates a circle\n * @param radius radius of circle\n * @param cx scale in x\n * @param cy scale in y\n * @param numberOfSides number of sides that make up the circle\n * @returns points that make the resulting circle\n */\n static Circle(radius, cx = 0, cy = 0, numberOfSides = 32) {\n const result = new Array();\n let angle = 0;\n const increment = (Math.PI * 2) / numberOfSides;\n for (let i = 0; i < numberOfSides; i++) {\n result.push(new Vector2(cx + Math.cos(angle) * radius, cy + Math.sin(angle) * radius));\n angle -= increment;\n }\n return result;\n }\n /**\n * Creates a polygon from input string\n * @param input Input polygon data\n * @returns the parsed points\n */\n static Parse(input) {\n const floats = input\n .split(/[^-+eE.\\d]+/)\n .map(parseFloat)\n .filter((val) => !isNaN(val));\n let i;\n const result = [];\n for (i = 0; i < (floats.length & 0x7ffffffe); i += 2) {\n result.push(new Vector2(floats[i], floats[i + 1]));\n }\n return result;\n }\n /**\n * Starts building a polygon from x and y coordinates\n * @param x x coordinate\n * @param y y coordinate\n * @returns the started path2\n */\n static StartingAt(x, y) {\n return Path2.StartingAt(x, y);\n }\n}\n/**\n * Builds a polygon\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param/polyMeshBuilder\n */\nexport class PolygonMeshBuilder {\n _addToepoint(points) {\n for (const p of points) {\n this._epoints.push(p.x, p.y);\n }\n }\n /**\n * Creates a PolygonMeshBuilder\n * @param name name of the builder\n * @param contours Path of the polygon\n * @param scene scene to add to when creating the mesh\n * @param earcutInjection can be used to inject your own earcut reference\n */\n constructor(name, contours, scene, earcutInjection = earcut) {\n this._points = new PolygonPoints();\n this._outlinepoints = new PolygonPoints();\n this._holes = new Array();\n this._epoints = new Array();\n this._eholes = new Array();\n this.bjsEarcut = earcutInjection;\n this._name = name;\n this._scene = scene || EngineStore.LastCreatedScene;\n let points;\n if (contours instanceof Path2) {\n points = contours.getPoints();\n }\n else {\n points = contours;\n }\n this._addToepoint(points);\n this._points.add(points);\n this._outlinepoints.add(points);\n if (typeof this.bjsEarcut === \"undefined\") {\n Logger.Warn(\"Earcut was not found, the polygon will not be built.\");\n }\n }\n /**\n * Adds a hole within the polygon\n * @param hole Array of points defining the hole\n * @returns this\n */\n addHole(hole) {\n this._points.add(hole);\n const holepoints = new PolygonPoints();\n holepoints.add(hole);\n this._holes.push(holepoints);\n this._eholes.push(this._epoints.length / 2);\n this._addToepoint(hole);\n return this;\n }\n /**\n * Creates the polygon\n * @param updatable If the mesh should be updatable\n * @param depth The depth of the mesh created\n * @param smoothingThreshold Dot product threshold for smoothed normals\n * @returns the created mesh\n */\n build(updatable = false, depth = 0, smoothingThreshold = 2) {\n const result = new Mesh(this._name, this._scene);\n const vertexData = this.buildVertexData(depth, smoothingThreshold);\n result.setVerticesData(VertexBuffer.PositionKind, vertexData.positions, updatable);\n result.setVerticesData(VertexBuffer.NormalKind, vertexData.normals, updatable);\n result.setVerticesData(VertexBuffer.UVKind, vertexData.uvs, updatable);\n result.setIndices(vertexData.indices);\n return result;\n }\n /**\n * Creates the polygon\n * @param depth The depth of the mesh created\n * @param smoothingThreshold Dot product threshold for smoothed normals\n * @returns the created VertexData\n */\n buildVertexData(depth = 0, smoothingThreshold = 2) {\n const result = new VertexData();\n const normals = new Array();\n const positions = new Array();\n const uvs = new Array();\n const bounds = this._points.computeBounds();\n this._points.elements.forEach((p) => {\n normals.push(0, 1.0, 0);\n positions.push(p.x, 0, p.y);\n uvs.push((p.x - bounds.min.x) / bounds.width, (p.y - bounds.min.y) / bounds.height);\n });\n const indices = new Array();\n const res = this.bjsEarcut(this._epoints, this._eholes, 2);\n for (let i = 0; i < res.length; i++) {\n indices.push(res[i]);\n }\n if (depth > 0) {\n const positionscount = positions.length / 3; //get the current pointcount\n this._points.elements.forEach((p) => {\n //add the elements at the depth\n normals.push(0, -1.0, 0);\n positions.push(p.x, -depth, p.y);\n uvs.push(1 - (p.x - bounds.min.x) / bounds.width, 1 - (p.y - bounds.min.y) / bounds.height);\n });\n const totalCount = indices.length;\n for (let i = 0; i < totalCount; i += 3) {\n const i0 = indices[i + 0];\n const i1 = indices[i + 1];\n const i2 = indices[i + 2];\n indices.push(i2 + positionscount);\n indices.push(i1 + positionscount);\n indices.push(i0 + positionscount);\n }\n //Add the sides\n this._addSide(positions, normals, uvs, indices, bounds, this._outlinepoints, depth, false, smoothingThreshold);\n this._holes.forEach((hole) => {\n this._addSide(positions, normals, uvs, indices, bounds, hole, depth, true, smoothingThreshold);\n });\n }\n result.indices = indices;\n result.positions = positions;\n result.normals = normals;\n result.uvs = uvs;\n return result;\n }\n /**\n * Adds a side to the polygon\n * @param positions points that make the polygon\n * @param normals normals of the polygon\n * @param uvs uvs of the polygon\n * @param indices indices of the polygon\n * @param bounds bounds of the polygon\n * @param points points of the polygon\n * @param depth depth of the polygon\n * @param flip flip of the polygon\n * @param smoothingThreshold\n */\n _addSide(positions, normals, uvs, indices, bounds, points, depth, flip, smoothingThreshold) {\n let startIndex = positions.length / 3;\n let ulength = 0;\n for (let i = 0; i < points.elements.length; i++) {\n const p = points.elements[i];\n const p1 = points.elements[(i + 1) % points.elements.length];\n positions.push(p.x, 0, p.y);\n positions.push(p.x, -depth, p.y);\n positions.push(p1.x, 0, p1.y);\n positions.push(p1.x, -depth, p1.y);\n const p0 = points.elements[(i + points.elements.length - 1) % points.elements.length];\n const p2 = points.elements[(i + 2) % points.elements.length];\n let vc = new Vector3(-(p1.y - p.y), 0, p1.x - p.x);\n let vp = new Vector3(-(p.y - p0.y), 0, p.x - p0.x);\n let vn = new Vector3(-(p2.y - p1.y), 0, p2.x - p1.x);\n if (!flip) {\n vc = vc.scale(-1);\n vp = vp.scale(-1);\n vn = vn.scale(-1);\n }\n const vc_norm = vc.normalizeToNew();\n let vp_norm = vp.normalizeToNew();\n let vn_norm = vn.normalizeToNew();\n const dotp = Vector3.Dot(vp_norm, vc_norm);\n if (dotp > smoothingThreshold) {\n if (dotp < Epsilon - 1) {\n vp_norm = new Vector3(p.x, 0, p.y).subtract(new Vector3(p1.x, 0, p1.y)).normalize();\n }\n else {\n // cheap average weighed by side length\n vp_norm = vp.add(vc).normalize();\n }\n }\n else {\n vp_norm = vc_norm;\n }\n const dotn = Vector3.Dot(vn, vc);\n if (dotn > smoothingThreshold) {\n if (dotn < Epsilon - 1) {\n // back to back\n vn_norm = new Vector3(p1.x, 0, p1.y).subtract(new Vector3(p.x, 0, p.y)).normalize();\n }\n else {\n // cheap average weighed by side length\n vn_norm = vn.add(vc).normalize();\n }\n }\n else {\n vn_norm = vc_norm;\n }\n uvs.push(ulength / bounds.width, 0);\n uvs.push(ulength / bounds.width, 1);\n ulength += vc.length();\n uvs.push(ulength / bounds.width, 0);\n uvs.push(ulength / bounds.width, 1);\n normals.push(vp_norm.x, vp_norm.y, vp_norm.z);\n normals.push(vp_norm.x, vp_norm.y, vp_norm.z);\n normals.push(vn_norm.x, vn_norm.y, vn_norm.z);\n normals.push(vn_norm.x, vn_norm.y, vn_norm.z);\n if (!flip) {\n indices.push(startIndex);\n indices.push(startIndex + 1);\n indices.push(startIndex + 2);\n indices.push(startIndex + 1);\n indices.push(startIndex + 3);\n indices.push(startIndex + 2);\n }\n else {\n indices.push(startIndex);\n indices.push(startIndex + 2);\n indices.push(startIndex + 1);\n indices.push(startIndex + 1);\n indices.push(startIndex + 2);\n indices.push(startIndex + 3);\n }\n startIndex += 4;\n }\n }\n}\n//# sourceMappingURL=polygonMesh.js.map","import { Vector2, Vector4 } from \"../../Maths/math.vector.js\";\nimport { Color4 } from \"../../Maths/math.color.js\";\nimport { Mesh } from \"../mesh.js\";\nimport { VertexData } from \"../mesh.vertexData.js\";\nimport { PolygonMeshBuilder } from \"../polygonMesh.js\";\nimport { VertexBuffer } from \"../../Buffers/buffer.js\";\nimport { EngineStore } from \"../../Engines/engineStore.js\";\nimport { CompatibilityOptions } from \"../../Compat/compatibilityOptions.js\";\n/**\n * Creates the VertexData for an irregular Polygon in the XoZ plane using a mesh built by polygonTriangulation.build()\n * All parameters are provided by CreatePolygon as needed\n * @param polygon a mesh built from polygonTriangulation.build()\n * @param sideOrientation takes the values Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\n * @param fUV an array of Vector4 elements used to set different images to the top, rings and bottom respectively\n * @param fColors an array of Color3 elements used to set different colors to the top, rings and bottom respectively\n * @param frontUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\n * @param backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\n * @param wrp a boolean, default false, when true and fUVs used texture is wrapped around all sides, when false texture is applied side\n * @returns the VertexData of the Polygon\n */\nexport function CreatePolygonVertexData(polygon, sideOrientation, fUV, fColors, frontUVs, backUVs, wrp) {\n const faceUV = fUV || new Array(3);\n const faceColors = fColors;\n const colors = [];\n const wrap = wrp || false;\n // default face colors and UV if undefined\n for (let f = 0; f < 3; f++) {\n if (faceUV[f] === undefined) {\n faceUV[f] = new Vector4(0, 0, 1, 1);\n }\n if (faceColors && faceColors[f] === undefined) {\n faceColors[f] = new Color4(1, 1, 1, 1);\n }\n }\n const positions = polygon.getVerticesData(VertexBuffer.PositionKind);\n const normals = polygon.getVerticesData(VertexBuffer.NormalKind);\n const uvs = polygon.getVerticesData(VertexBuffer.UVKind);\n const indices = polygon.getIndices();\n const startIndex = positions.length / 9;\n let disp = 0;\n let distX = 0;\n let distZ = 0;\n let dist = 0;\n let totalLen = 0;\n const cumulate = [0];\n if (wrap) {\n for (let idx = startIndex; idx < positions.length / 3; idx += 4) {\n distX = positions[3 * (idx + 2)] - positions[3 * idx];\n distZ = positions[3 * (idx + 2) + 2] - positions[3 * idx + 2];\n dist = Math.sqrt(distX * distX + distZ * distZ);\n totalLen += dist;\n cumulate.push(totalLen);\n }\n }\n // set face colours and textures\n let idx = 0;\n let face = 0;\n for (let index = 0; index < normals.length; index += 3) {\n //Edge Face no. 1\n if (Math.abs(normals[index + 1]) < 0.001) {\n face = 1;\n }\n //Top Face no. 0\n if (Math.abs(normals[index + 1] - 1) < 0.001) {\n face = 0;\n }\n //Bottom Face no. 2\n if (Math.abs(normals[index + 1] + 1) < 0.001) {\n face = 2;\n }\n idx = index / 3;\n if (face === 1) {\n disp = idx - startIndex;\n if (disp % 4 < 1.5) {\n if (wrap) {\n uvs[2 * idx] = faceUV[face].x + ((faceUV[face].z - faceUV[face].x) * cumulate[Math.floor(disp / 4)]) / totalLen;\n }\n else {\n uvs[2 * idx] = faceUV[face].x;\n }\n }\n else {\n if (wrap) {\n uvs[2 * idx] = faceUV[face].x + ((faceUV[face].z - faceUV[face].x) * cumulate[Math.floor(disp / 4) + 1]) / totalLen;\n }\n else {\n uvs[2 * idx] = faceUV[face].z;\n }\n }\n if (disp % 2 === 0) {\n uvs[2 * idx + 1] = CompatibilityOptions.UseOpenGLOrientationForUV ? 1.0 - faceUV[face].w : faceUV[face].w;\n }\n else {\n uvs[2 * idx + 1] = CompatibilityOptions.UseOpenGLOrientationForUV ? 1.0 - faceUV[face].y : faceUV[face].y;\n }\n }\n else {\n uvs[2 * idx] = (1 - uvs[2 * idx]) * faceUV[face].x + uvs[2 * idx] * faceUV[face].z;\n uvs[2 * idx + 1] = (1 - uvs[2 * idx + 1]) * faceUV[face].y + uvs[2 * idx + 1] * faceUV[face].w;\n if (CompatibilityOptions.UseOpenGLOrientationForUV) {\n uvs[2 * idx + 1] = 1.0 - uvs[2 * idx + 1];\n }\n }\n if (faceColors) {\n colors.push(faceColors[face].r, faceColors[face].g, faceColors[face].b, faceColors[face].a);\n }\n }\n // sides\n VertexData._ComputeSides(sideOrientation, positions, indices, normals, uvs, frontUVs, backUVs);\n // Result\n const vertexData = new VertexData();\n vertexData.indices = indices;\n vertexData.positions = positions;\n vertexData.normals = normals;\n vertexData.uvs = uvs;\n if (faceColors) {\n const totalColors = sideOrientation === VertexData.DOUBLESIDE ? colors.concat(colors) : colors;\n vertexData.colors = totalColors;\n }\n return vertexData;\n}\n/**\n * Creates a polygon mesh\n * The polygon's shape will depend on the input parameters and is constructed parallel to a ground mesh\n * * The parameter `shape` is a required array of successive Vector3 representing the corners of the polygon in th XoZ plane, that is y = 0 for all vectors\n * * You can set the mesh side orientation with the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4)\n * * Remember you can only change the shape positions, not their number when updating a polygon\n * @param name defines the name of the mesh\n * @param options defines the options used to create the mesh\n * @param options.shape\n * @param options.holes\n * @param options.depth\n * @param options.smoothingThreshold\n * @param options.faceUV\n * @param options.faceColors\n * @param options.updatable\n * @param options.sideOrientation\n * @param options.frontUVs\n * @param options.backUVs\n * @param options.wrap\n * @param scene defines the hosting scene\n * @param earcutInjection can be used to inject your own earcut reference\n * @returns the polygon mesh\n */\nexport function CreatePolygon(name, options, scene = null, earcutInjection = earcut) {\n options.sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\n const shape = options.shape;\n const holes = options.holes || [];\n const depth = options.depth || 0;\n const smoothingThreshold = options.smoothingThreshold || 2;\n const contours = [];\n let hole = [];\n for (let i = 0; i < shape.length; i++) {\n contours[i] = new Vector2(shape[i].x, shape[i].z);\n }\n const epsilon = 0.00000001;\n if (contours[0].equalsWithEpsilon(contours[contours.length - 1], epsilon)) {\n contours.pop();\n }\n const polygonTriangulation = new PolygonMeshBuilder(name, contours, scene || EngineStore.LastCreatedScene, earcutInjection);\n for (let hNb = 0; hNb < holes.length; hNb++) {\n hole = [];\n for (let hPoint = 0; hPoint < holes[hNb].length; hPoint++) {\n hole.push(new Vector2(holes[hNb][hPoint].x, holes[hNb][hPoint].z));\n }\n polygonTriangulation.addHole(hole);\n }\n //updatability is set during applyToMesh; setting to true in triangulation build produces errors\n const polygon = polygonTriangulation.build(false, depth, smoothingThreshold);\n polygon._originalBuilderSideOrientation = options.sideOrientation;\n const vertexData = CreatePolygonVertexData(polygon, options.sideOrientation, options.faceUV, options.faceColors, options.frontUVs, options.backUVs, options.wrap);\n vertexData.applyToMesh(polygon, options.updatable);\n return polygon;\n}\n/**\n * Creates an extruded polygon mesh, with depth in the Y direction.\n * * You can set different colors and different images to the top, bottom and extruded side by using the parameters `faceColors` (an array of 3 Color3 elements) and `faceUV` (an array of 3 Vector4 elements)\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/texturePerBoxFace\n * @param name defines the name of the mesh\n * @param options defines the options used to create the mesh\n * @param options.shape\n * @param options.holes\n * @param options.depth\n * @param options.faceUV\n * @param options.faceColors\n * @param options.updatable\n * @param options.sideOrientation\n * @param options.frontUVs\n * @param options.backUVs\n * @param options.wrap\n * @param scene defines the hosting scene\n * @param earcutInjection can be used to inject your own earcut reference\n * @returns the polygon mesh\n */\nexport function ExtrudePolygon(name, options, scene = null, earcutInjection = earcut) {\n return CreatePolygon(name, options, scene, earcutInjection);\n}\n/**\n * Class containing static functions to help procedurally build meshes\n * @deprecated use the functions directly from the module\n */\nexport const PolygonBuilder = {\n ExtrudePolygon,\n CreatePolygon,\n};\nVertexData.CreatePolygon = CreatePolygonVertexData;\nMesh.CreatePolygon = (name, shape, scene, holes, updatable, sideOrientation, earcutInjection = earcut) => {\n const options = {\n shape: shape,\n holes: holes,\n updatable: updatable,\n sideOrientation: sideOrientation,\n };\n return CreatePolygon(name, options, scene, earcutInjection);\n};\nMesh.ExtrudePolygon = (name, shape, depth, scene, holes, updatable, sideOrientation, earcutInjection = earcut) => {\n const options = {\n shape: shape,\n holes: holes,\n depth: depth,\n updatable: updatable,\n sideOrientation: sideOrientation,\n };\n return ExtrudePolygon(name, options, scene, earcutInjection);\n};\n//# sourceMappingURL=polygonBuilder.js.map","import { Vector3, TmpVectors, Matrix } from \"../../Maths/math.vector.js\";\nimport { Mesh } from \"../mesh.js\";\nimport { CreateRibbon } from \"./ribbonBuilder.js\";\nimport { Path3D } from \"../../Maths/math.path.js\";\n/**\n * Creates an extruded shape mesh. The extrusion is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters.\n * * The parameter `shape` is a required array of successive Vector3. This array depicts the shape to be extruded in its local space : the shape must be designed in the xOy plane and will be extruded along the Z axis.\n * * The parameter `path` is a required array of successive Vector3. This is the axis curve the shape is extruded along.\n * * The parameter `rotation` (float, default 0 radians) is the angle value to rotate the shape each step (each path point), from the former step (so rotation added each step) along the curve.\n * * The parameter `scale` (float, default 1) is the value to scale the shape.\n * * The parameter `closeShape` (boolean, default false) closes the shape when true, since v5.0.0.\n * * The parameter `closePath` (boolean, default false) closes the path when true and no caps, since v5.0.0.\n * * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL\n * * The optional parameter `instance` is an instance of an existing ExtrudedShape object to be updated with the passed `shape`, `path`, `scale` or `rotation` parameters : https://doc.babylonjs.com/features/featuresDeepDive/mesh/dynamicMeshMorph#extruded-shape\n * * Remember you can only change the shape or path point positions, not their number when updating an extruded shape.\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation\n * * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture.\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.\n * * The optional parameter `firstNormal` (Vector3) defines the direction of the first normal of the supplied path. Consider using this for any path that is straight, and particular for paths in the xy plane.\n * * The optional `adjustFrame` (boolean, default false) will cause the internally generated Path3D tangents, normals, and binormals to be adjusted so that a) they are always well-defined, and b) they do not reverse from one path point to the next. This prevents the extruded shape from being flipped and/or rotated with resulting mesh self-intersections. This is primarily useful for straight paths that can reverse direction.\n * @param name defines the name of the mesh\n * @param options defines the options used to create the mesh\n * @param options.shape\n * @param options.path\n * @param options.scale\n * @param options.rotation\n * @param options.closeShape\n * @param options.closePath\n * @param options.cap\n * @param options.updatable\n * @param options.sideOrientation\n * @param options.frontUVs\n * @param options.backUVs\n * @param options.instance\n * @param options.invertUV\n * @param options.firstNormal\n * @param options.adjustFrame\n * @param scene defines the hosting scene\n * @returns the extruded shape mesh\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param#extruded-shapes\n */\nexport function ExtrudeShape(name, options, scene = null) {\n const path = options.path;\n const shape = options.shape;\n const scale = options.scale || 1;\n const rotation = options.rotation || 0;\n const cap = options.cap === 0 ? 0 : options.cap || Mesh.NO_CAP;\n const updatable = options.updatable;\n const sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\n const instance = options.instance || null;\n const invertUV = options.invertUV || false;\n const closeShape = options.closeShape || false;\n const closePath = options.closePath || false;\n return _ExtrudeShapeGeneric(name, shape, path, scale, rotation, null, null, closePath, closeShape, cap, false, scene, updatable ? true : false, sideOrientation, instance, invertUV, options.frontUVs || null, options.backUVs || null, options.firstNormal || null, options.adjustFrame ? true : false);\n}\n/**\n * Creates an custom extruded shape mesh.\n * The custom extrusion is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters.\n * * The parameter `shape` is a required array of successive Vector3. This array depicts the shape to be extruded in its local space : the shape must be designed in the xOy plane and will be extruded along the Z axis.\n * * The parameter `path` is a required array of successive Vector3. This is the axis curve the shape is extruded along.\n * * The parameter `rotationFunction` (JS function) is a custom Javascript function called on each path point. This function is passed the position i of the point in the path and the distance of this point from the beginning of the path\n * * It must returns a float value that will be the rotation in radians applied to the shape on each path point.\n * * The parameter `scaleFunction` (JS function) is a custom Javascript function called on each path point. This function is passed the position i of the point in the path and the distance of this point from the beginning of the path\n * * It must returns a float value that will be the scale value applied to the shape on each path point\n * * The parameter `closeShape` (boolean, default false) closes the shape when true, since v5.0.0.\n * * The parameter `closePath` (boolean, default false) closes the path when true and no caps, since v5.0.0.\n * * The parameter `ribbonClosePath` (boolean, default false) forces the extrusion underlying ribbon to close all the paths in its `pathArray` - depreciated in favor of closeShape\n * * The parameter `ribbonCloseArray` (boolean, default false) forces the extrusion underlying ribbon to close its `pathArray` - depreciated in favor of closePath\n * * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL\n * * The optional parameter `instance` is an instance of an existing ExtrudedShape object to be updated with the passed `shape`, `path`, `scale` or `rotation` parameters : https://doc.babylonjs.com/features/featuresDeepDive/mesh/dynamicMeshMorph#extruded-shape\n * * Remember you can only change the shape or path point positions, not their number when updating an extruded shape\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation\n * * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\n * * The optional parameter `firstNormal` (Vector3) defines the direction of the first normal of the supplied path. It should be supplied when the path is in the xy plane, and particularly if these sections are straight, because the underlying Path3D object will pick a normal in the xy plane that causes the extrusion to be collapsed into the plane. This should be used for any path that is straight.\n * * The optional `adjustFrame` (boolean, default false) will cause the internally generated Path3D tangents, normals, and binormals to be adjusted so that a) they are always well-defined, and b) they do not reverse from one path point to the next. This prevents the extruded shape from being flipped and/or rotated with resulting mesh self-intersections. This is primarily useful for straight paths that can reverse direction.\n * @param name defines the name of the mesh\n * @param options defines the options used to create the mesh\n * @param options.shape\n * @param options.path\n * @param options.scaleFunction\n * @param options.rotationFunction\n * @param options.ribbonCloseArray\n * @param options.ribbonClosePath\n * @param options.closeShape\n * @param options.closePath\n * @param options.cap\n * @param options.updatable\n * @param options.sideOrientation\n * @param options.frontUVs\n * @param options.backUVs\n * @param options.instance\n * @param options.invertUV\n * @param options.firstNormal\n * @param options.adjustFrame\n * @param scene defines the hosting scene\n * @returns the custom extruded shape mesh\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param#custom-extruded-shapes\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param#extruded-shapes\n */\nexport function ExtrudeShapeCustom(name, options, scene = null) {\n const path = options.path;\n const shape = options.shape;\n const scaleFunction = options.scaleFunction ||\n (() => {\n return 1;\n });\n const rotationFunction = options.rotationFunction ||\n (() => {\n return 0;\n });\n const ribbonCloseArray = options.closePath || options.ribbonCloseArray || false;\n const ribbonClosePath = options.closeShape || options.ribbonClosePath || false;\n const cap = options.cap === 0 ? 0 : options.cap || Mesh.NO_CAP;\n const updatable = options.updatable;\n const firstNormal = options.firstNormal || null;\n const adjustFrame = options.adjustFrame || false;\n const sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\n const instance = options.instance;\n const invertUV = options.invertUV || false;\n return _ExtrudeShapeGeneric(name, shape, path, null, null, scaleFunction, rotationFunction, ribbonCloseArray, ribbonClosePath, cap, true, scene, updatable ? true : false, sideOrientation, instance || null, invertUV, options.frontUVs || null, options.backUVs || null, firstNormal, adjustFrame);\n}\nfunction _ExtrudeShapeGeneric(name, shape, curve, scale, rotation, scaleFunction, rotateFunction, rbCA, rbCP, cap, custom, scene, updtbl, side, instance, invertUV, frontUVs, backUVs, firstNormal, adjustFrame) {\n // extrusion geometry\n const extrusionPathArray = (shape, curve, path3D, shapePaths, scale, rotation, scaleFunction, rotateFunction, cap, custom, adjustFrame) => {\n const tangents = path3D.getTangents();\n const normals = path3D.getNormals();\n const binormals = path3D.getBinormals();\n const distances = path3D.getDistances();\n if (adjustFrame) {\n /* fix tangents,normals, binormals */\n for (let i = 0; i < tangents.length; i++) {\n if (tangents[i].x == 0 && tangents[i].y == 0 && tangents[i].z == 0) {\n tangents[i].copyFrom(tangents[i - 1]);\n }\n if (normals[i].x == 0 && normals[i].y == 0 && normals[i].z == 0) {\n normals[i].copyFrom(normals[i - 1]);\n }\n if (binormals[i].x == 0 && binormals[i].y == 0 && binormals[i].z == 0) {\n binormals[i].copyFrom(binormals[i - 1]);\n }\n if (i > 0) {\n let v = tangents[i - 1];\n if (Vector3.Dot(v, tangents[i]) < 0) {\n tangents[i].scaleInPlace(-1);\n }\n v = normals[i - 1];\n if (Vector3.Dot(v, normals[i]) < 0) {\n normals[i].scaleInPlace(-1);\n }\n v = binormals[i - 1];\n if (Vector3.Dot(v, binormals[i]) < 0) {\n binormals[i].scaleInPlace(-1);\n }\n }\n }\n }\n let angle = 0;\n const returnScale = () => {\n return scale !== null ? scale : 1;\n };\n const returnRotation = () => {\n return rotation !== null ? rotation : 0;\n };\n const rotate = custom && rotateFunction ? rotateFunction : returnRotation;\n const scl = custom && scaleFunction ? scaleFunction : returnScale;\n let index = cap === Mesh.NO_CAP || cap === Mesh.CAP_END ? 0 : 2;\n const rotationMatrix = TmpVectors.Matrix[0];\n for (let i = 0; i < curve.length; i++) {\n const shapePath = new Array();\n const angleStep = rotate(i, distances[i]);\n const scaleRatio = scl(i, distances[i]);\n Matrix.RotationAxisToRef(tangents[i], angle, rotationMatrix);\n for (let p = 0; p < shape.length; p++) {\n const planed = tangents[i].scale(shape[p].z).add(normals[i].scale(shape[p].x)).add(binormals[i].scale(shape[p].y));\n const rotated = Vector3.Zero();\n Vector3.TransformCoordinatesToRef(planed, rotationMatrix, rotated);\n rotated.scaleInPlace(scaleRatio).addInPlace(curve[i]);\n shapePath[p] = rotated;\n }\n shapePaths[index] = shapePath;\n angle += angleStep;\n index++;\n }\n // cap\n const capPath = (shapePath) => {\n const pointCap = Array();\n const barycenter = Vector3.Zero();\n let i;\n for (i = 0; i < shapePath.length; i++) {\n barycenter.addInPlace(shapePath[i]);\n }\n barycenter.scaleInPlace(1.0 / shapePath.length);\n for (i = 0; i < shapePath.length; i++) {\n pointCap.push(barycenter);\n }\n return pointCap;\n };\n switch (cap) {\n case Mesh.NO_CAP:\n break;\n case Mesh.CAP_START:\n shapePaths[0] = capPath(shapePaths[2]);\n shapePaths[1] = shapePaths[2];\n break;\n case Mesh.CAP_END:\n shapePaths[index] = shapePaths[index - 1];\n shapePaths[index + 1] = capPath(shapePaths[index - 1]);\n break;\n case Mesh.CAP_ALL:\n shapePaths[0] = capPath(shapePaths[2]);\n shapePaths[1] = shapePaths[2];\n shapePaths[index] = shapePaths[index - 1];\n shapePaths[index + 1] = capPath(shapePaths[index - 1]);\n break;\n default:\n break;\n }\n return shapePaths;\n };\n let path3D;\n let pathArray;\n if (instance) {\n // instance update\n const storage = instance._creationDataStorage;\n path3D = firstNormal ? storage.path3D.update(curve, firstNormal) : storage.path3D.update(curve);\n pathArray = extrusionPathArray(shape, curve, storage.path3D, storage.pathArray, scale, rotation, scaleFunction, rotateFunction, storage.cap, custom, adjustFrame);\n instance = CreateRibbon(\"\", { pathArray, closeArray: false, closePath: false, offset: 0, updatable: false, sideOrientation: 0, instance }, scene || undefined);\n return instance;\n }\n // extruded shape creation\n path3D = firstNormal ? new Path3D(curve, firstNormal) : new Path3D(curve);\n const newShapePaths = new Array();\n cap = cap < 0 || cap > 3 ? 0 : cap;\n pathArray = extrusionPathArray(shape, curve, path3D, newShapePaths, scale, rotation, scaleFunction, rotateFunction, cap, custom, adjustFrame);\n const extrudedGeneric = CreateRibbon(name, {\n pathArray: pathArray,\n closeArray: rbCA,\n closePath: rbCP,\n updatable: updtbl,\n sideOrientation: side,\n invertUV: invertUV,\n frontUVs: frontUVs || undefined,\n backUVs: backUVs || undefined,\n }, scene);\n extrudedGeneric._creationDataStorage.pathArray = pathArray;\n extrudedGeneric._creationDataStorage.path3D = path3D;\n extrudedGeneric._creationDataStorage.cap = cap;\n return extrudedGeneric;\n}\n/**\n * Class containing static functions to help procedurally build meshes\n * @deprecated please use the functions directly from the module\n */\nexport const ShapeBuilder = {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n ExtrudeShape,\n // eslint-disable-next-line @typescript-eslint/naming-convention\n ExtrudeShapeCustom,\n};\nMesh.ExtrudeShape = (name, shape, path, scale, rotation, cap, scene = null, updatable, sideOrientation, instance) => {\n const options = {\n shape: shape,\n path: path,\n scale: scale,\n rotation: rotation,\n cap: cap === 0 ? 0 : cap || Mesh.NO_CAP,\n sideOrientation: sideOrientation,\n instance: instance,\n updatable: updatable,\n };\n return ExtrudeShape(name, options, scene);\n};\nMesh.ExtrudeShapeCustom = (name, shape, path, scaleFunction, rotationFunction, ribbonCloseArray, ribbonClosePath, cap, scene, updatable, sideOrientation, instance) => {\n const options = {\n shape: shape,\n path: path,\n scaleFunction: scaleFunction,\n rotationFunction: rotationFunction,\n ribbonCloseArray: ribbonCloseArray,\n ribbonClosePath: ribbonClosePath,\n cap: cap === 0 ? 0 : cap || Mesh.NO_CAP,\n sideOrientation: sideOrientation,\n instance: instance,\n updatable: updatable,\n };\n return ExtrudeShapeCustom(name, options, scene);\n};\n//# sourceMappingURL=shapeBuilder.js.map","import { Vector3 } from \"../../Maths/math.vector.js\";\nimport { Mesh } from \"../mesh.js\";\nimport { CreateRibbon } from \"./ribbonBuilder.js\";\n/**\n * Creates lathe mesh.\n * The lathe is a shape with a symmetry axis : a 2D model shape is rotated around this axis to design the lathe\n * * The parameter `shape` is a required array of successive Vector3. This array depicts the shape to be rotated in its local space : the shape must be designed in the xOy plane and will be rotated around the Y axis. It's usually a 2D shape, so the Vector3 z coordinates are often set to zero\n * * The parameter `radius` (positive float, default 1) is the radius value of the lathe\n * * The parameter `tessellation` (positive integer, default 64) is the side number of the lathe\n * * The parameter `clip` (positive integer, default 0) is the number of sides to not create without effecting the general shape of the sides\n * * The parameter `arc` (positive float, default 1) is the ratio of the lathe. 0.5 builds for instance half a lathe, so an opened shape\n * * The parameter `closed` (boolean, default true) opens/closes the lathe circumference. This should be set to false when used with the parameter \"arc\"\n * * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation\n * * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\n * @param name defines the name of the mesh\n * @param options defines the options used to create the mesh\n * @param options.shape\n * @param options.radius\n * @param options.tessellation\n * @param options.clip\n * @param options.arc\n * @param options.closed\n * @param options.updatable\n * @param options.sideOrientation\n * @param options.frontUVs\n * @param options.backUVs\n * @param options.cap\n * @param options.invertUV\n * @param scene defines the hosting scene\n * @returns the lathe mesh\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param#lathe\n */\nexport function CreateLathe(name, options, scene = null) {\n const arc = options.arc ? (options.arc <= 0 || options.arc > 1 ? 1.0 : options.arc) : 1.0;\n const closed = options.closed === undefined ? true : options.closed;\n const shape = options.shape;\n const radius = options.radius || 1;\n const tessellation = options.tessellation || 64;\n const clip = options.clip || 0;\n const updatable = options.updatable;\n const sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\n const cap = options.cap || Mesh.NO_CAP;\n const pi2 = Math.PI * 2;\n const paths = new Array();\n const invertUV = options.invertUV || false;\n let i = 0;\n let p = 0;\n const step = (pi2 / tessellation) * arc;\n let rotated;\n let path;\n for (i = 0; i <= tessellation - clip; i++) {\n path = [];\n if (cap == Mesh.CAP_START || cap == Mesh.CAP_ALL) {\n path.push(new Vector3(0, shape[0].y, 0));\n path.push(new Vector3(Math.cos(i * step) * shape[0].x * radius, shape[0].y, Math.sin(i * step) * shape[0].x * radius));\n }\n for (p = 0; p < shape.length; p++) {\n rotated = new Vector3(Math.cos(i * step) * shape[p].x * radius, shape[p].y, Math.sin(i * step) * shape[p].x * radius);\n path.push(rotated);\n }\n if (cap == Mesh.CAP_END || cap == Mesh.CAP_ALL) {\n path.push(new Vector3(Math.cos(i * step) * shape[shape.length - 1].x * radius, shape[shape.length - 1].y, Math.sin(i * step) * shape[shape.length - 1].x * radius));\n path.push(new Vector3(0, shape[shape.length - 1].y, 0));\n }\n paths.push(path);\n }\n // lathe ribbon\n const lathe = CreateRibbon(name, { pathArray: paths, closeArray: closed, sideOrientation: sideOrientation, updatable: updatable, invertUV: invertUV, frontUVs: options.frontUVs, backUVs: options.backUVs }, scene);\n return lathe;\n}\n/**\n * Class containing static functions to help procedurally build meshes\n * @deprecated use the function direction from the module\n */\nexport const LatheBuilder = {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n CreateLathe,\n};\nMesh.CreateLathe = (name, shape, radius, tessellation, scene, updatable, sideOrientation) => {\n const options = {\n shape: shape,\n radius: radius,\n tessellation: tessellation,\n sideOrientation: sideOrientation,\n updatable: updatable,\n };\n return CreateLathe(name, options, scene);\n};\n//# sourceMappingURL=latheBuilder.js.map","import { Mesh } from \"../mesh.js\";\nimport { VertexData } from \"../mesh.vertexData.js\";\nimport { CompatibilityOptions } from \"../../Compat/compatibilityOptions.js\";\n/**\n * Creates the VertexData for a Plane\n * @param options an object used to set the following optional parameters for the plane, required but can be empty\n * * size sets the width and height of the plane to the value of size, optional default 1\n * * width sets the width (x direction) of the plane, overwrites the width set by size, optional, default size\n * * height sets the height (y direction) of the plane, overwrites the height set by size, optional, default size\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\n * @param options.size\n * @param options.width\n * @param options.height\n * @param options.sideOrientation\n * @param options.frontUVs\n * @param options.backUVs\n * @returns the VertexData of the box\n */\nexport function CreatePlaneVertexData(options) {\n const indices = [];\n const positions = [];\n const normals = [];\n const uvs = [];\n const width = options.width || options.size || 1;\n const height = options.height || options.size || 1;\n const sideOrientation = options.sideOrientation === 0 ? 0 : options.sideOrientation || VertexData.DEFAULTSIDE;\n // Vertices\n const halfWidth = width / 2.0;\n const halfHeight = height / 2.0;\n positions.push(-halfWidth, -halfHeight, 0);\n normals.push(0, 0, -1.0);\n uvs.push(0.0, CompatibilityOptions.UseOpenGLOrientationForUV ? 1.0 : 0.0);\n positions.push(halfWidth, -halfHeight, 0);\n normals.push(0, 0, -1.0);\n uvs.push(1.0, CompatibilityOptions.UseOpenGLOrientationForUV ? 1.0 : 0.0);\n positions.push(halfWidth, halfHeight, 0);\n normals.push(0, 0, -1.0);\n uvs.push(1.0, CompatibilityOptions.UseOpenGLOrientationForUV ? 0.0 : 1.0);\n positions.push(-halfWidth, halfHeight, 0);\n normals.push(0, 0, -1.0);\n uvs.push(0.0, CompatibilityOptions.UseOpenGLOrientationForUV ? 0.0 : 1.0);\n // Indices\n indices.push(0);\n indices.push(1);\n indices.push(2);\n indices.push(0);\n indices.push(2);\n indices.push(3);\n // Sides\n VertexData._ComputeSides(sideOrientation, positions, indices, normals, uvs, options.frontUVs, options.backUVs);\n // Result\n const vertexData = new VertexData();\n vertexData.indices = indices;\n vertexData.positions = positions;\n vertexData.normals = normals;\n vertexData.uvs = uvs;\n return vertexData;\n}\n/**\n * Creates a plane mesh\n * * The parameter `size` sets the size (float) of both sides of the plane at once (default 1)\n * * You can set some different plane dimensions by using the parameters `width` and `height` (both by default have the same value of `size`)\n * * The parameter `sourcePlane` is a Plane instance. It builds a mesh plane from a Math plane\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\n * @param name defines the name of the mesh\n * @param options defines the options used to create the mesh\n * @param options.size\n * @param options.width\n * @param options.height\n * @param options.sideOrientation\n * @param options.frontUVs\n * @param options.backUVs\n * @param options.updatable\n * @param options.sourcePlane\n * @param scene defines the hosting scene\n * @returns the plane mesh\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#plane\n */\nexport function CreatePlane(name, options = {}, scene = null) {\n const plane = new Mesh(name, scene);\n options.sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\n plane._originalBuilderSideOrientation = options.sideOrientation;\n const vertexData = CreatePlaneVertexData(options);\n vertexData.applyToMesh(plane, options.updatable);\n if (options.sourcePlane) {\n plane.translate(options.sourcePlane.normal, -options.sourcePlane.d);\n plane.setDirection(options.sourcePlane.normal.scale(-1));\n }\n return plane;\n}\n/**\n * Class containing static functions to help procedurally build meshes\n * @deprecated use the function directly from the module\n */\nexport const PlaneBuilder = {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n CreatePlane,\n};\nVertexData.CreatePlane = CreatePlaneVertexData;\nMesh.CreatePlane = (name, size, scene, updatable, sideOrientation) => {\n const options = {\n size,\n width: size,\n height: size,\n sideOrientation,\n updatable,\n };\n return CreatePlane(name, options, scene);\n};\n//# sourceMappingURL=planeBuilder.js.map","import { Vector3, TmpVectors, Matrix } from \"../../Maths/math.vector.js\";\nimport { Mesh } from \"../mesh.js\";\nimport { CreateRibbon } from \"./ribbonBuilder.js\";\nimport { Path3D } from \"../../Maths/math.path.js\";\n/**\n * Creates a tube mesh.\n * The tube is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters\n * * The parameter `path` is a required array of successive Vector3. It is the curve used as the axis of the tube\n * * The parameter `radius` (positive float, default 1) sets the tube radius size\n * * The parameter `tessellation` (positive float, default 64) is the number of sides on the tubular surface\n * * The parameter `radiusFunction` (javascript function, default null) is a vanilla javascript function. If it is not null, it overrides the parameter `radius`\n * * This function is called on each point of the tube path and is passed the index `i` of the i-th point and the distance of this point from the first point of the path. It must return a radius value (positive float)\n * * The parameter `arc` (positive float, maximum 1, default 1) is the ratio to apply to the tube circumference : 2 x PI x arc\n * * The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL\n * * The optional parameter `instance` is an instance of an existing Tube object to be updated with the passed `pathArray` parameter. The `path`Array HAS to have the SAME number of points as the previous one: https://doc.babylonjs.com/features/featuresDeepDive/mesh/dynamicMeshMorph#tube\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation\n * * The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created. The NUMBER of points CAN'T CHANGE, only their positions.\n * @param name defines the name of the mesh\n * @param options defines the options used to create the mesh\n * @param options.path\n * @param options.radius\n * @param options.tessellation\n * @param options.radiusFunction\n * @param options.cap\n * @param options.arc\n * @param options.updatable\n * @param options.sideOrientation\n * @param options.frontUVs\n * @param options.backUVs\n * @param options.instance\n * @param options.invertUV\n * @param scene defines the hosting scene\n * @returns the tube mesh\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#tube\n */\nexport function CreateTube(name, options, scene = null) {\n const path = options.path;\n let instance = options.instance;\n let radius = 1.0;\n if (options.radius !== undefined) {\n radius = options.radius;\n }\n else if (instance) {\n radius = instance._creationDataStorage.radius;\n }\n const tessellation = options.tessellation || 64 | 0;\n const radiusFunction = options.radiusFunction || null;\n let cap = options.cap || Mesh.NO_CAP;\n const invertUV = options.invertUV || false;\n const updatable = options.updatable;\n const sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\n options.arc = options.arc && (options.arc <= 0.0 || options.arc > 1.0) ? 1.0 : options.arc || 1.0;\n // tube geometry\n const tubePathArray = (path, path3D, circlePaths, radius, tessellation, radiusFunction, cap, arc) => {\n const tangents = path3D.getTangents();\n const normals = path3D.getNormals();\n const distances = path3D.getDistances();\n const pi2 = Math.PI * 2;\n const step = (pi2 / tessellation) * arc;\n const returnRadius = () => radius;\n const radiusFunctionFinal = radiusFunction || returnRadius;\n let circlePath;\n let rad;\n let normal;\n let rotated;\n const rotationMatrix = TmpVectors.Matrix[0];\n let index = cap === Mesh.NO_CAP || cap === Mesh.CAP_END ? 0 : 2;\n for (let i = 0; i < path.length; i++) {\n rad = radiusFunctionFinal(i, distances[i]); // current radius\n circlePath = Array(); // current circle array\n normal = normals[i]; // current normal\n for (let t = 0; t < tessellation; t++) {\n Matrix.RotationAxisToRef(tangents[i], step * t, rotationMatrix);\n rotated = circlePath[t] ? circlePath[t] : Vector3.Zero();\n Vector3.TransformCoordinatesToRef(normal, rotationMatrix, rotated);\n rotated.scaleInPlace(rad).addInPlace(path[i]);\n circlePath[t] = rotated;\n }\n circlePaths[index] = circlePath;\n index++;\n }\n // cap\n const capPath = (nbPoints, pathIndex) => {\n const pointCap = Array();\n for (let i = 0; i < nbPoints; i++) {\n pointCap.push(path[pathIndex]);\n }\n return pointCap;\n };\n switch (cap) {\n case Mesh.NO_CAP:\n break;\n case Mesh.CAP_START:\n circlePaths[0] = capPath(tessellation, 0);\n circlePaths[1] = circlePaths[2].slice(0);\n break;\n case Mesh.CAP_END:\n circlePaths[index] = circlePaths[index - 1].slice(0);\n circlePaths[index + 1] = capPath(tessellation, path.length - 1);\n break;\n case Mesh.CAP_ALL:\n circlePaths[0] = capPath(tessellation, 0);\n circlePaths[1] = circlePaths[2].slice(0);\n circlePaths[index] = circlePaths[index - 1].slice(0);\n circlePaths[index + 1] = capPath(tessellation, path.length - 1);\n break;\n default:\n break;\n }\n return circlePaths;\n };\n let path3D;\n let pathArray;\n if (instance) {\n // tube update\n const storage = instance._creationDataStorage;\n const arc = options.arc || storage.arc;\n path3D = storage.path3D.update(path);\n pathArray = tubePathArray(path, path3D, storage.pathArray, radius, storage.tessellation, radiusFunction, storage.cap, arc);\n instance = CreateRibbon(\"\", { pathArray: pathArray, instance: instance });\n // Update mode, no need to recreate the storage.\n storage.path3D = path3D;\n storage.pathArray = pathArray;\n storage.arc = arc;\n storage.radius = radius;\n return instance;\n }\n // tube creation\n path3D = new Path3D(path);\n const newPathArray = new Array();\n cap = cap < 0 || cap > 3 ? 0 : cap;\n pathArray = tubePathArray(path, path3D, newPathArray, radius, tessellation, radiusFunction, cap, options.arc);\n const tube = CreateRibbon(name, {\n pathArray: pathArray,\n closePath: true,\n closeArray: false,\n updatable: updatable,\n sideOrientation: sideOrientation,\n invertUV: invertUV,\n frontUVs: options.frontUVs,\n backUVs: options.backUVs,\n }, scene);\n tube._creationDataStorage.pathArray = pathArray;\n tube._creationDataStorage.path3D = path3D;\n tube._creationDataStorage.tessellation = tessellation;\n tube._creationDataStorage.cap = cap;\n tube._creationDataStorage.arc = options.arc;\n tube._creationDataStorage.radius = radius;\n return tube;\n}\n/**\n * Class containing static functions to help procedurally build meshes\n * @deprecated use CreateTube directly\n */\nexport const TubeBuilder = {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n CreateTube,\n};\nMesh.CreateTube = (name, path, radius, tessellation, radiusFunction, cap, scene, updatable, sideOrientation, instance) => {\n const options = {\n path: path,\n radius: radius,\n tessellation: tessellation,\n radiusFunction: radiusFunction,\n arc: 1,\n cap: cap,\n updatable: updatable,\n sideOrientation: sideOrientation,\n instance: instance,\n };\n return CreateTube(name, options, scene);\n};\n//# sourceMappingURL=tubeBuilder.js.map","import { Vector4 } from \"../../Maths/math.vector.js\";\nimport { Color4 } from \"../../Maths/math.color.js\";\nimport { Mesh } from \"../mesh.js\";\nimport { VertexData } from \"../mesh.vertexData.js\";\nimport { CompatibilityOptions } from \"../../Compat/compatibilityOptions.js\";\n// inspired from // http://stemkoski.github.io/Three.js/Polyhedra.html\n/**\n * Creates the VertexData for a Polyhedron\n * @param options an object used to set the following optional parameters for the polyhedron, required but can be empty\n * * type provided types are:\n * * 0 : Tetrahedron, 1 : Octahedron, 2 : Dodecahedron, 3 : Icosahedron, 4 : Rhombicuboctahedron, 5 : Triangular Prism, 6 : Pentagonal Prism, 7 : Hexagonal Prism, 8 : Square Pyramid (J1)\n * * 9 : Pentagonal Pyramid (J2), 10 : Triangular Dipyramid (J12), 11 : Pentagonal Dipyramid (J13), 12 : Elongated Square Dipyramid (J15), 13 : Elongated Pentagonal Dipyramid (J16), 14 : Elongated Pentagonal Cupola (J20)\n * * size the size of the IcoSphere, optional default 1\n * * sizeX allows stretching in the x direction, optional, default size\n * * sizeY allows stretching in the y direction, optional, default size\n * * sizeZ allows stretching in the z direction, optional, default size\n * * custom a number that overwrites the type to create from an extended set of polyhedron from https://www.babylonjs-playground.com/#21QRSK#15 with minimised editor\n * * faceUV an array of Vector4 elements used to set different images to the top, rings and bottom respectively\n * * faceColors an array of Color3 elements used to set different colors to the top, rings and bottom respectively\n * * flat when true creates a flat shaded mesh, optional, default true\n * * subdivisions increasing the subdivisions increases the number of faces, optional, default 4\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\n * @param options.type\n * @param options.size\n * @param options.sizeX\n * @param options.sizeY\n * @param options.sizeZ\n * @param options.custom\n * @param options.faceUV\n * @param options.faceColors\n * @param options.flat\n * @param options.sideOrientation\n * @param options.frontUVs\n * @param options.backUVs\n * @returns the VertexData of the Polyhedron\n */\nexport function CreatePolyhedronVertexData(options) {\n // provided polyhedron types :\n // 0 : Tetrahedron, 1 : Octahedron, 2 : Dodecahedron, 3 : Icosahedron, 4 : Rhombicuboctahedron, 5 : Triangular Prism, 6 : Pentagonal Prism, 7 : Hexagonal Prism, 8 : Square Pyramid (J1)\n // 9 : Pentagonal Pyramid (J2), 10 : Triangular Dipyramid (J12), 11 : Pentagonal Dipyramid (J13), 12 : Elongated Square Dipyramid (J15), 13 : Elongated Pentagonal Dipyramid (J16), 14 : Elongated Pentagonal Cupola (J20)\n const polyhedra = [];\n polyhedra[0] = {\n vertex: [\n [0, 0, 1.732051],\n [1.632993, 0, -0.5773503],\n [-0.8164966, 1.414214, -0.5773503],\n [-0.8164966, -1.414214, -0.5773503],\n ],\n face: [\n [0, 1, 2],\n [0, 2, 3],\n [0, 3, 1],\n [1, 3, 2],\n ],\n };\n polyhedra[1] = {\n vertex: [\n [0, 0, 1.414214],\n [1.414214, 0, 0],\n [0, 1.414214, 0],\n [-1.414214, 0, 0],\n [0, -1.414214, 0],\n [0, 0, -1.414214],\n ],\n face: [\n [0, 1, 2],\n [0, 2, 3],\n [0, 3, 4],\n [0, 4, 1],\n [1, 4, 5],\n [1, 5, 2],\n [2, 5, 3],\n [3, 5, 4],\n ],\n };\n polyhedra[2] = {\n vertex: [\n [0, 0, 1.070466],\n [0.7136442, 0, 0.7978784],\n [-0.3568221, 0.618034, 0.7978784],\n [-0.3568221, -0.618034, 0.7978784],\n [0.7978784, 0.618034, 0.3568221],\n [0.7978784, -0.618034, 0.3568221],\n [-0.9341724, 0.381966, 0.3568221],\n [0.1362939, 1, 0.3568221],\n [0.1362939, -1, 0.3568221],\n [-0.9341724, -0.381966, 0.3568221],\n [0.9341724, 0.381966, -0.3568221],\n [0.9341724, -0.381966, -0.3568221],\n [-0.7978784, 0.618034, -0.3568221],\n [-0.1362939, 1, -0.3568221],\n [-0.1362939, -1, -0.3568221],\n [-0.7978784, -0.618034, -0.3568221],\n [0.3568221, 0.618034, -0.7978784],\n [0.3568221, -0.618034, -0.7978784],\n [-0.7136442, 0, -0.7978784],\n [0, 0, -1.070466],\n ],\n face: [\n [0, 1, 4, 7, 2],\n [0, 2, 6, 9, 3],\n [0, 3, 8, 5, 1],\n [1, 5, 11, 10, 4],\n [2, 7, 13, 12, 6],\n [3, 9, 15, 14, 8],\n [4, 10, 16, 13, 7],\n [5, 8, 14, 17, 11],\n [6, 12, 18, 15, 9],\n [10, 11, 17, 19, 16],\n [12, 13, 16, 19, 18],\n [14, 15, 18, 19, 17],\n ],\n };\n polyhedra[3] = {\n vertex: [\n [0, 0, 1.175571],\n [1.051462, 0, 0.5257311],\n [0.3249197, 1, 0.5257311],\n [-0.8506508, 0.618034, 0.5257311],\n [-0.8506508, -0.618034, 0.5257311],\n [0.3249197, -1, 0.5257311],\n [0.8506508, 0.618034, -0.5257311],\n [0.8506508, -0.618034, -0.5257311],\n [-0.3249197, 1, -0.5257311],\n [-1.051462, 0, -0.5257311],\n [-0.3249197, -1, -0.5257311],\n [0, 0, -1.175571],\n ],\n face: [\n [0, 1, 2],\n [0, 2, 3],\n [0, 3, 4],\n [0, 4, 5],\n [0, 5, 1],\n [1, 5, 7],\n [1, 7, 6],\n [1, 6, 2],\n [2, 6, 8],\n [2, 8, 3],\n [3, 8, 9],\n [3, 9, 4],\n [4, 9, 10],\n [4, 10, 5],\n [5, 10, 7],\n [6, 7, 11],\n [6, 11, 8],\n [7, 10, 11],\n [8, 11, 9],\n [9, 11, 10],\n ],\n };\n polyhedra[4] = {\n vertex: [\n [0, 0, 1.070722],\n [0.7148135, 0, 0.7971752],\n [-0.104682, 0.7071068, 0.7971752],\n [-0.6841528, 0.2071068, 0.7971752],\n [-0.104682, -0.7071068, 0.7971752],\n [0.6101315, 0.7071068, 0.5236279],\n [1.04156, 0.2071068, 0.1367736],\n [0.6101315, -0.7071068, 0.5236279],\n [-0.3574067, 1, 0.1367736],\n [-0.7888348, -0.5, 0.5236279],\n [-0.9368776, 0.5, 0.1367736],\n [-0.3574067, -1, 0.1367736],\n [0.3574067, 1, -0.1367736],\n [0.9368776, -0.5, -0.1367736],\n [0.7888348, 0.5, -0.5236279],\n [0.3574067, -1, -0.1367736],\n [-0.6101315, 0.7071068, -0.5236279],\n [-1.04156, -0.2071068, -0.1367736],\n [-0.6101315, -0.7071068, -0.5236279],\n [0.104682, 0.7071068, -0.7971752],\n [0.6841528, -0.2071068, -0.7971752],\n [0.104682, -0.7071068, -0.7971752],\n [-0.7148135, 0, -0.7971752],\n [0, 0, -1.070722],\n ],\n face: [\n [0, 2, 3],\n [1, 6, 5],\n [4, 9, 11],\n [7, 15, 13],\n [8, 16, 10],\n [12, 14, 19],\n [17, 22, 18],\n [20, 21, 23],\n [0, 1, 5, 2],\n [0, 3, 9, 4],\n [0, 4, 7, 1],\n [1, 7, 13, 6],\n [2, 5, 12, 8],\n [2, 8, 10, 3],\n [3, 10, 17, 9],\n [4, 11, 15, 7],\n [5, 6, 14, 12],\n [6, 13, 20, 14],\n [8, 12, 19, 16],\n [9, 17, 18, 11],\n [10, 16, 22, 17],\n [11, 18, 21, 15],\n [13, 15, 21, 20],\n [14, 20, 23, 19],\n [16, 19, 23, 22],\n [18, 22, 23, 21],\n ],\n };\n polyhedra[5] = {\n vertex: [\n [0, 0, 1.322876],\n [1.309307, 0, 0.1889822],\n [-0.9819805, 0.8660254, 0.1889822],\n [0.1636634, -1.299038, 0.1889822],\n [0.3273268, 0.8660254, -0.9449112],\n [-0.8183171, -0.4330127, -0.9449112],\n ],\n face: [\n [0, 3, 1],\n [2, 4, 5],\n [0, 1, 4, 2],\n [0, 2, 5, 3],\n [1, 3, 5, 4],\n ],\n };\n polyhedra[6] = {\n vertex: [\n [0, 0, 1.159953],\n [1.013464, 0, 0.5642542],\n [-0.3501431, 0.9510565, 0.5642542],\n [-0.7715208, -0.6571639, 0.5642542],\n [0.6633206, 0.9510565, -0.03144481],\n [0.8682979, -0.6571639, -0.3996071],\n [-1.121664, 0.2938926, -0.03144481],\n [-0.2348831, -1.063314, -0.3996071],\n [0.5181548, 0.2938926, -0.9953061],\n [-0.5850262, -0.112257, -0.9953061],\n ],\n face: [\n [0, 1, 4, 2],\n [0, 2, 6, 3],\n [1, 5, 8, 4],\n [3, 6, 9, 7],\n [5, 7, 9, 8],\n [0, 3, 7, 5, 1],\n [2, 4, 8, 9, 6],\n ],\n };\n polyhedra[7] = {\n vertex: [\n [0, 0, 1.118034],\n [0.8944272, 0, 0.6708204],\n [-0.2236068, 0.8660254, 0.6708204],\n [-0.7826238, -0.4330127, 0.6708204],\n [0.6708204, 0.8660254, 0.2236068],\n [1.006231, -0.4330127, -0.2236068],\n [-1.006231, 0.4330127, 0.2236068],\n [-0.6708204, -0.8660254, -0.2236068],\n [0.7826238, 0.4330127, -0.6708204],\n [0.2236068, -0.8660254, -0.6708204],\n [-0.8944272, 0, -0.6708204],\n [0, 0, -1.118034],\n ],\n face: [\n [0, 1, 4, 2],\n [0, 2, 6, 3],\n [1, 5, 8, 4],\n [3, 6, 10, 7],\n [5, 9, 11, 8],\n [7, 10, 11, 9],\n [0, 3, 7, 9, 5, 1],\n [2, 4, 8, 11, 10, 6],\n ],\n };\n polyhedra[8] = {\n vertex: [\n [-0.729665, 0.670121, 0.319155],\n [-0.655235, -0.29213, -0.754096],\n [-0.093922, -0.607123, 0.537818],\n [0.702196, 0.595691, 0.485187],\n [0.776626, -0.36656, -0.588064],\n ],\n face: [\n [1, 4, 2],\n [0, 1, 2],\n [3, 0, 2],\n [4, 3, 2],\n [4, 1, 0, 3],\n ],\n };\n polyhedra[9] = {\n vertex: [\n [-0.868849, -0.100041, 0.61257],\n [-0.329458, 0.976099, 0.28078],\n [-0.26629, -0.013796, -0.477654],\n [-0.13392, -1.034115, 0.229829],\n [0.738834, 0.707117, -0.307018],\n [0.859683, -0.535264, -0.338508],\n ],\n face: [\n [3, 0, 2],\n [5, 3, 2],\n [4, 5, 2],\n [1, 4, 2],\n [0, 1, 2],\n [0, 3, 5, 4, 1],\n ],\n };\n polyhedra[10] = {\n vertex: [\n [-0.610389, 0.243975, 0.531213],\n [-0.187812, -0.48795, -0.664016],\n [-0.187812, 0.9759, -0.664016],\n [0.187812, -0.9759, 0.664016],\n [0.798201, 0.243975, 0.132803],\n ],\n face: [\n [1, 3, 0],\n [3, 4, 0],\n [3, 1, 4],\n [0, 2, 1],\n [0, 4, 2],\n [2, 4, 1],\n ],\n };\n polyhedra[11] = {\n vertex: [\n [-1.028778, 0.392027, -0.048786],\n [-0.640503, -0.646161, 0.621837],\n [-0.125162, -0.395663, -0.540059],\n [0.004683, 0.888447, -0.651988],\n [0.125161, 0.395663, 0.540059],\n [0.632925, -0.791376, 0.433102],\n [1.031672, 0.157063, -0.354165],\n ],\n face: [\n [3, 2, 0],\n [2, 1, 0],\n [2, 5, 1],\n [0, 4, 3],\n [0, 1, 4],\n [4, 1, 5],\n [2, 3, 6],\n [3, 4, 6],\n [5, 2, 6],\n [4, 5, 6],\n ],\n };\n polyhedra[12] = {\n vertex: [\n [-0.669867, 0.334933, -0.529576],\n [-0.669867, 0.334933, 0.529577],\n [-0.4043, 1.212901, 0],\n [-0.334933, -0.669867, -0.529576],\n [-0.334933, -0.669867, 0.529577],\n [0.334933, 0.669867, -0.529576],\n [0.334933, 0.669867, 0.529577],\n [0.4043, -1.212901, 0],\n [0.669867, -0.334933, -0.529576],\n [0.669867, -0.334933, 0.529577],\n ],\n face: [\n [8, 9, 7],\n [6, 5, 2],\n [3, 8, 7],\n [5, 0, 2],\n [4, 3, 7],\n [0, 1, 2],\n [9, 4, 7],\n [1, 6, 2],\n [9, 8, 5, 6],\n [8, 3, 0, 5],\n [3, 4, 1, 0],\n [4, 9, 6, 1],\n ],\n };\n polyhedra[13] = {\n vertex: [\n [-0.931836, 0.219976, -0.264632],\n [-0.636706, 0.318353, 0.692816],\n [-0.613483, -0.735083, -0.264632],\n [-0.326545, 0.979634, 0],\n [-0.318353, -0.636706, 0.692816],\n [-0.159176, 0.477529, -0.856368],\n [0.159176, -0.477529, -0.856368],\n [0.318353, 0.636706, 0.692816],\n [0.326545, -0.979634, 0],\n [0.613482, 0.735082, -0.264632],\n [0.636706, -0.318353, 0.692816],\n [0.931835, -0.219977, -0.264632],\n ],\n face: [\n [11, 10, 8],\n [7, 9, 3],\n [6, 11, 8],\n [9, 5, 3],\n [2, 6, 8],\n [5, 0, 3],\n [4, 2, 8],\n [0, 1, 3],\n [10, 4, 8],\n [1, 7, 3],\n [10, 11, 9, 7],\n [11, 6, 5, 9],\n [6, 2, 0, 5],\n [2, 4, 1, 0],\n [4, 10, 7, 1],\n ],\n };\n polyhedra[14] = {\n vertex: [\n [-0.93465, 0.300459, -0.271185],\n [-0.838689, -0.260219, -0.516017],\n [-0.711319, 0.717591, 0.128359],\n [-0.710334, -0.156922, 0.080946],\n [-0.599799, 0.556003, -0.725148],\n [-0.503838, -0.004675, -0.969981],\n [-0.487004, 0.26021, 0.48049],\n [-0.460089, -0.750282, -0.512622],\n [-0.376468, 0.973135, -0.325605],\n [-0.331735, -0.646985, 0.084342],\n [-0.254001, 0.831847, 0.530001],\n [-0.125239, -0.494738, -0.966586],\n [0.029622, 0.027949, 0.730817],\n [0.056536, -0.982543, -0.262295],\n [0.08085, 1.087391, 0.076037],\n [0.125583, -0.532729, 0.485984],\n [0.262625, 0.599586, 0.780328],\n [0.391387, -0.726999, -0.716259],\n [0.513854, -0.868287, 0.139347],\n [0.597475, 0.85513, 0.326364],\n [0.641224, 0.109523, 0.783723],\n [0.737185, -0.451155, 0.538891],\n [0.848705, -0.612742, -0.314616],\n [0.976075, 0.365067, 0.32976],\n [1.072036, -0.19561, 0.084927],\n ],\n face: [\n [15, 18, 21],\n [12, 20, 16],\n [6, 10, 2],\n [3, 0, 1],\n [9, 7, 13],\n [2, 8, 4, 0],\n [0, 4, 5, 1],\n [1, 5, 11, 7],\n [7, 11, 17, 13],\n [13, 17, 22, 18],\n [18, 22, 24, 21],\n [21, 24, 23, 20],\n [20, 23, 19, 16],\n [16, 19, 14, 10],\n [10, 14, 8, 2],\n [15, 9, 13, 18],\n [12, 15, 21, 20],\n [6, 12, 16, 10],\n [3, 6, 2, 0],\n [9, 3, 1, 7],\n [9, 15, 12, 6, 3],\n [22, 17, 11, 5, 4, 8, 14, 19, 23, 24],\n ],\n };\n const type = options.type && (options.type < 0 || options.type >= polyhedra.length) ? 0 : options.type || 0;\n const size = options.size;\n const sizeX = options.sizeX || size || 1;\n const sizeY = options.sizeY || size || 1;\n const sizeZ = options.sizeZ || size || 1;\n const data = options.custom || polyhedra[type];\n const nbfaces = data.face.length;\n const faceUV = options.faceUV || new Array(nbfaces);\n const faceColors = options.faceColors;\n const flat = options.flat === undefined ? true : options.flat;\n const sideOrientation = options.sideOrientation === 0 ? 0 : options.sideOrientation || VertexData.DEFAULTSIDE;\n const positions = new Array();\n const indices = new Array();\n const normals = new Array();\n const uvs = new Array();\n const colors = new Array();\n let index = 0;\n let faceIdx = 0; // face cursor in the array \"indexes\"\n const indexes = new Array();\n let i = 0;\n let f = 0;\n let u, v, ang, x, y, tmp;\n // default face colors and UV if undefined\n if (flat) {\n for (f = 0; f < nbfaces; f++) {\n if (faceColors && faceColors[f] === undefined) {\n faceColors[f] = new Color4(1, 1, 1, 1);\n }\n if (faceUV && faceUV[f] === undefined) {\n faceUV[f] = new Vector4(0, 0, 1, 1);\n }\n }\n }\n if (!flat) {\n for (i = 0; i < data.vertex.length; i++) {\n positions.push(data.vertex[i][0] * sizeX, data.vertex[i][1] * sizeY, data.vertex[i][2] * sizeZ);\n uvs.push(0, CompatibilityOptions.UseOpenGLOrientationForUV ? 1.0 : 0);\n }\n for (f = 0; f < nbfaces; f++) {\n for (i = 0; i < data.face[f].length - 2; i++) {\n indices.push(data.face[f][0], data.face[f][i + 2], data.face[f][i + 1]);\n }\n }\n }\n else {\n for (f = 0; f < nbfaces; f++) {\n const fl = data.face[f].length; // number of vertices of the current face\n ang = (2 * Math.PI) / fl;\n x = 0.5 * Math.tan(ang / 2);\n y = 0.5;\n // positions, uvs, colors\n for (i = 0; i < fl; i++) {\n // positions\n positions.push(data.vertex[data.face[f][i]][0] * sizeX, data.vertex[data.face[f][i]][1] * sizeY, data.vertex[data.face[f][i]][2] * sizeZ);\n indexes.push(index);\n index++;\n // uvs\n u = faceUV[f].x + (faceUV[f].z - faceUV[f].x) * (0.5 + x);\n v = faceUV[f].y + (faceUV[f].w - faceUV[f].y) * (y - 0.5);\n uvs.push(u, CompatibilityOptions.UseOpenGLOrientationForUV ? 1.0 - v : v);\n tmp = x * Math.cos(ang) - y * Math.sin(ang);\n y = x * Math.sin(ang) + y * Math.cos(ang);\n x = tmp;\n // colors\n if (faceColors) {\n colors.push(faceColors[f].r, faceColors[f].g, faceColors[f].b, faceColors[f].a);\n }\n }\n // indices from indexes\n for (i = 0; i < fl - 2; i++) {\n indices.push(indexes[0 + faceIdx], indexes[i + 2 + faceIdx], indexes[i + 1 + faceIdx]);\n }\n faceIdx += fl;\n }\n }\n VertexData.ComputeNormals(positions, indices, normals);\n VertexData._ComputeSides(sideOrientation, positions, indices, normals, uvs, options.frontUVs, options.backUVs);\n const vertexData = new VertexData();\n vertexData.positions = positions;\n vertexData.indices = indices;\n vertexData.normals = normals;\n vertexData.uvs = uvs;\n if (faceColors && flat) {\n vertexData.colors = colors;\n }\n return vertexData;\n}\n/**\n * Creates a polyhedron mesh\n * * The parameter `type` (positive integer, max 14, default 0) sets the polyhedron type to build among the 15 embbeded types. Please refer to the type sheet in the tutorial to choose the wanted type\n * * The parameter `size` (positive float, default 1) sets the polygon size\n * * You can overwrite the `size` on each dimension bu using the parameters `sizeX`, `sizeY` or `sizeZ` (positive floats, default to `size` value)\n * * You can build other polyhedron types than the 15 embbeded ones by setting the parameter `custom` (`polyhedronObject`, default null). If you set the parameter `custom`, this overrides the parameter `type`\n * * A `polyhedronObject` is a formatted javascript object. You'll find a full file with pre-set polyhedra here : https://github.com/BabylonJS/Extensions/tree/master/Polyhedron\n * * You can set the color and the UV of each side of the polyhedron with the parameters `faceColors` (Color4, default `(1, 1, 1, 1)`) and faceUV (Vector4, default `(0, 0, 1, 1)`)\n * * To understand how to set `faceUV` or `faceColors`, please read this by considering the right number of faces of your polyhedron, instead of only 6 for the box : https://doc.babylonjs.com/features/featuresDeepDive/materials/using/texturePerBoxFace\n * * The parameter `flat` (boolean, default true). If set to false, it gives the polyhedron a single global face, so less vertices and shared normals. In this case, `faceColors` and `faceUV` are ignored\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\n * @param name defines the name of the mesh\n * @param options defines the options used to create the mesh\n * @param options.type\n * @param options.size\n * @param options.sizeX\n * @param options.sizeY\n * @param options.sizeZ\n * @param options.custom\n * @param options.faceUV\n * @param options.faceColors\n * @param options.flat\n * @param options.updatable\n * @param options.sideOrientation\n * @param options.frontUVs\n * @param options.backUVs\n * @param scene defines the hosting scene\n * @returns the polyhedron mesh\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/polyhedra\n */\nexport function CreatePolyhedron(name, options = {}, scene = null) {\n const polyhedron = new Mesh(name, scene);\n options.sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\n polyhedron._originalBuilderSideOrientation = options.sideOrientation;\n const vertexData = CreatePolyhedronVertexData(options);\n vertexData.applyToMesh(polyhedron, options.updatable);\n return polyhedron;\n}\n/**\n * Class containing static functions to help procedurally build meshes\n * @deprecated use the function directly from the module\n */\nexport const PolyhedronBuilder = {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n CreatePolyhedron,\n};\nVertexData.CreatePolyhedron = CreatePolyhedronVertexData;\nMesh.CreatePolyhedron = (name, options, scene) => {\n return CreatePolyhedron(name, options, scene);\n};\n//# sourceMappingURL=polyhedronBuilder.js.map","import { Vector3, Vector2 } from \"../../Maths/math.vector.js\";\nimport { Mesh } from \"../mesh.js\";\nimport { VertexData } from \"../mesh.vertexData.js\";\nimport { CompatibilityOptions } from \"../../Compat/compatibilityOptions.js\";\n/**\n * Creates the VertexData of the IcoSphere\n * @param options an object used to set the following optional parameters for the IcoSphere, required but can be empty\n * * radius the radius of the IcoSphere, optional default 1\n * * radiusX allows stretching in the x direction, optional, default radius\n * * radiusY allows stretching in the y direction, optional, default radius\n * * radiusZ allows stretching in the z direction, optional, default radius\n * * flat when true creates a flat shaded mesh, optional, default true\n * * subdivisions increasing the subdivisions increases the number of faces, optional, default 4\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\n * @param options.radius\n * @param options.radiusX\n * @param options.radiusY\n * @param options.radiusZ\n * @param options.flat\n * @param options.subdivisions\n * @param options.sideOrientation\n * @param options.frontUVs\n * @param options.backUVs\n * @returns the VertexData of the IcoSphere\n */\nexport function CreateIcoSphereVertexData(options) {\n const sideOrientation = options.sideOrientation || VertexData.DEFAULTSIDE;\n const radius = options.radius || 1;\n const flat = options.flat === undefined ? true : options.flat;\n const subdivisions = (options.subdivisions || 4) | 0;\n const radiusX = options.radiusX || radius;\n const radiusY = options.radiusY || radius;\n const radiusZ = options.radiusZ || radius;\n const t = (1 + Math.sqrt(5)) / 2;\n // 12 vertex x,y,z\n const icoVertices = [\n -1,\n t,\n -0,\n 1,\n t,\n 0,\n -1,\n -t,\n 0,\n 1,\n -t,\n 0,\n 0,\n -1,\n -t,\n 0,\n 1,\n -t,\n 0,\n -1,\n t,\n 0,\n 1,\n t,\n t,\n 0,\n 1,\n t,\n 0,\n -1,\n -t,\n 0,\n 1,\n -t,\n 0,\n -1, // v8-11\n ];\n // index of 3 vertex makes a face of icopshere\n const ico_indices = [\n 0, 11, 5, 0, 5, 1, 0, 1, 7, 0, 7, 10, 12, 22, 23, 1, 5, 20, 5, 11, 4, 23, 22, 13, 22, 18, 6, 7, 1, 8, 14, 21, 4, 14, 4, 2, 16, 13, 6, 15, 6, 19, 3, 8, 9, 4, 21, 5, 13, 17,\n 23, 6, 13, 22, 19, 6, 18, 9, 8, 1,\n ];\n // vertex for uv have aliased position, not for UV\n const vertices_unalias_id = [\n 0,\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10,\n 11,\n // vertex alias\n 0,\n 2,\n 3,\n 3,\n 3,\n 4,\n 7,\n 8,\n 9,\n 9,\n 10,\n 11, // 23: B + 12\n ];\n // uv as integer step (not pixels !)\n const ico_vertexuv = [\n 5,\n 1,\n 3,\n 1,\n 6,\n 4,\n 0,\n 0,\n 5,\n 3,\n 4,\n 2,\n 2,\n 2,\n 4,\n 0,\n 2,\n 0,\n 1,\n 1,\n 6,\n 0,\n 6,\n 2,\n // vertex alias (for same vertex on different faces)\n 0,\n 4,\n 3,\n 3,\n 4,\n 4,\n 3,\n 1,\n 4,\n 2,\n 4,\n 4,\n 0,\n 2,\n 1,\n 1,\n 2,\n 2,\n 3,\n 3,\n 1,\n 3,\n 2,\n 4, // 23: B + 12\n ];\n // Vertices[0, 1, ...9, A, B] : position on UV plane\n // '+' indicate duplicate position to be fixed (3,9:0,2,3,4,7,8,A,B)\n // First island of uv mapping\n // v = 4h 3+ 2\n // v = 3h 9+ 4\n // v = 2h 9+ 5 B\n // v = 1h 9 1 0\n // v = 0h 3 8 7 A\n // u = 0 1 2 3 4 5 6 *a\n // Second island of uv mapping\n // v = 4h 0+ B+ 4+\n // v = 3h A+ 2+\n // v = 2h 7+ 6 3+\n // v = 1h 8+ 3+\n // v = 0h\n // u = 0 1 2 3 4 5 6 *a\n // Face layout on texture UV mapping\n // ============\n // \\ 4 /\\ 16 / ======\n // \\ / \\ / /\\ 11 /\n // \\/ 7 \\/ / \\ /\n // ======= / 10 \\/\n // /\\ 17 /\\ =======\n // / \\ / \\ \\ 15 /\\\n // / 8 \\/ 12 \\ \\ / \\\n // ============ \\/ 6 \\\n // \\ 18 /\\ ============\n // \\ / \\ \\ 5 /\\ 0 /\n // \\/ 13 \\ \\ / \\ /\n // ======= \\/ 1 \\/\n // =============\n // /\\ 19 /\\ 2 /\\\n // / \\ / \\ / \\\n // / 14 \\/ 9 \\/ 3 \\\n // ===================\n // uv step is u:1 or 0.5, v:cos(30)=sqrt(3)/2, ratio approx is 84/97\n const ustep = 138 / 1024;\n const vstep = 239 / 1024;\n const uoffset = 60 / 1024;\n const voffset = 26 / 1024;\n // Second island should have margin, not to touch the first island\n // avoid any borderline artefact in pixel rounding\n const island_u_offset = -40 / 1024;\n const island_v_offset = +20 / 1024;\n // face is either island 0 or 1 :\n // second island is for faces : [4, 7, 8, 12, 13, 16, 17, 18]\n const island = [\n 0,\n 0,\n 0,\n 0,\n 1,\n 0,\n 0,\n 1,\n 1,\n 0,\n 0,\n 0,\n 1,\n 1,\n 0,\n 0,\n 1,\n 1,\n 1,\n 0, // 15 - 19\n ];\n const indices = new Array();\n const positions = new Array();\n const normals = new Array();\n const uvs = new Array();\n let current_indice = 0;\n // prepare array of 3 vector (empty) (to be worked in place, shared for each face)\n const face_vertex_pos = new Array(3);\n const face_vertex_uv = new Array(3);\n let v012;\n for (v012 = 0; v012 < 3; v012++) {\n face_vertex_pos[v012] = Vector3.Zero();\n face_vertex_uv[v012] = Vector2.Zero();\n }\n // create all with normals\n for (let face = 0; face < 20; face++) {\n // 3 vertex per face\n for (v012 = 0; v012 < 3; v012++) {\n // look up vertex 0,1,2 to its index in 0 to 11 (or 23 including alias)\n const v_id = ico_indices[3 * face + v012];\n // vertex have 3D position (x,y,z)\n face_vertex_pos[v012].copyFromFloats(icoVertices[3 * vertices_unalias_id[v_id]], icoVertices[3 * vertices_unalias_id[v_id] + 1], icoVertices[3 * vertices_unalias_id[v_id] + 2]);\n // Normalize to get normal\n face_vertex_pos[v012].normalize();\n // uv Coordinates from vertex ID\n face_vertex_uv[v012].copyFromFloats(ico_vertexuv[2 * v_id] * ustep + uoffset + island[face] * island_u_offset, ico_vertexuv[2 * v_id + 1] * vstep + voffset + island[face] * island_v_offset);\n }\n // Subdivide the face (interpolate pos, norm, uv)\n // - pos is linear interpolation, then projected to sphere (converge polyhedron to sphere)\n // - norm is linear interpolation of vertex corner normal\n // (to be checked if better to re-calc from face vertex, or if approximation is OK ??? )\n // - uv is linear interpolation\n //\n // Topology is as below for sub-divide by 2\n // vertex shown as v0,v1,v2\n // interp index is i1 to progress in range [v0,v1[\n // interp index is i2 to progress in range [v0,v2[\n // face index as (i1,i2) for /\\ : (i1,i2),(i1+1,i2),(i1,i2+1)\n // and (i1,i2)' for \\/ : (i1+1,i2),(i1+1,i2+1),(i1,i2+1)\n //\n //\n // i2 v2\n // ^ ^\n // / / \\\n // / / \\\n // / / \\\n // / / (0,1) \\\n // / #---------\\\n // / / \\ (0,0)'/ \\\n // / / \\ / \\\n // / / \\ / \\\n // / / (0,0) \\ / (1,0) \\\n // / #---------#---------\\\n // v0 v1\n //\n // --------------------> i1\n //\n // interp of (i1,i2):\n // along i2 : x0=lerp(v0,v2, i2/S) <---> x1=lerp(v1,v2, i2/S)\n // along i1 : lerp(x0,x1, i1/(S-i2))\n //\n // centroid of triangle is needed to get help normal computation\n // (c1,c2) are used for centroid location\n const interp_vertex = (i1, i2, c1, c2) => {\n // vertex is interpolated from\n // - face_vertex_pos[0..2]\n // - face_vertex_uv[0..2]\n const pos_x0 = Vector3.Lerp(face_vertex_pos[0], face_vertex_pos[2], i2 / subdivisions);\n const pos_x1 = Vector3.Lerp(face_vertex_pos[1], face_vertex_pos[2], i2 / subdivisions);\n const pos_interp = subdivisions === i2 ? face_vertex_pos[2] : Vector3.Lerp(pos_x0, pos_x1, i1 / (subdivisions - i2));\n pos_interp.normalize();\n let vertex_normal;\n if (flat) {\n // in flat mode, recalculate normal as face centroid normal\n const centroid_x0 = Vector3.Lerp(face_vertex_pos[0], face_vertex_pos[2], c2 / subdivisions);\n const centroid_x1 = Vector3.Lerp(face_vertex_pos[1], face_vertex_pos[2], c2 / subdivisions);\n vertex_normal = Vector3.Lerp(centroid_x0, centroid_x1, c1 / (subdivisions - c2));\n }\n else {\n // in smooth mode, recalculate normal from each single vertex position\n vertex_normal = new Vector3(pos_interp.x, pos_interp.y, pos_interp.z);\n }\n // Vertex normal need correction due to X,Y,Z radius scaling\n vertex_normal.x /= radiusX;\n vertex_normal.y /= radiusY;\n vertex_normal.z /= radiusZ;\n vertex_normal.normalize();\n const uv_x0 = Vector2.Lerp(face_vertex_uv[0], face_vertex_uv[2], i2 / subdivisions);\n const uv_x1 = Vector2.Lerp(face_vertex_uv[1], face_vertex_uv[2], i2 / subdivisions);\n const uv_interp = subdivisions === i2 ? face_vertex_uv[2] : Vector2.Lerp(uv_x0, uv_x1, i1 / (subdivisions - i2));\n positions.push(pos_interp.x * radiusX, pos_interp.y * radiusY, pos_interp.z * radiusZ);\n normals.push(vertex_normal.x, vertex_normal.y, vertex_normal.z);\n uvs.push(uv_interp.x, CompatibilityOptions.UseOpenGLOrientationForUV ? 1.0 - uv_interp.y : uv_interp.y);\n // push each vertex has member of a face\n // Same vertex can belong to multiple face, it is pushed multiple time (duplicate vertex are present)\n indices.push(current_indice);\n current_indice++;\n };\n for (let i2 = 0; i2 < subdivisions; i2++) {\n for (let i1 = 0; i1 + i2 < subdivisions; i1++) {\n // face : (i1,i2) for /\\ :\n // interp for : (i1,i2),(i1+1,i2),(i1,i2+1)\n interp_vertex(i1, i2, i1 + 1.0 / 3, i2 + 1.0 / 3);\n interp_vertex(i1 + 1, i2, i1 + 1.0 / 3, i2 + 1.0 / 3);\n interp_vertex(i1, i2 + 1, i1 + 1.0 / 3, i2 + 1.0 / 3);\n if (i1 + i2 + 1 < subdivisions) {\n // face : (i1,i2)' for \\/ :\n // interp for (i1+1,i2),(i1+1,i2+1),(i1,i2+1)\n interp_vertex(i1 + 1, i2, i1 + 2.0 / 3, i2 + 2.0 / 3);\n interp_vertex(i1 + 1, i2 + 1, i1 + 2.0 / 3, i2 + 2.0 / 3);\n interp_vertex(i1, i2 + 1, i1 + 2.0 / 3, i2 + 2.0 / 3);\n }\n }\n }\n }\n // Sides\n VertexData._ComputeSides(sideOrientation, positions, indices, normals, uvs, options.frontUVs, options.backUVs);\n // Result\n const vertexData = new VertexData();\n vertexData.indices = indices;\n vertexData.positions = positions;\n vertexData.normals = normals;\n vertexData.uvs = uvs;\n return vertexData;\n}\n/**\n * Creates a sphere based upon an icosahedron with 20 triangular faces which can be subdivided\n * * The parameter `radius` sets the radius size (float) of the icosphere (default 1)\n * * You can set some different icosphere dimensions, for instance to build an ellipsoid, by using the parameters `radiusX`, `radiusY` and `radiusZ` (all by default have the same value of `radius`)\n * * The parameter `subdivisions` sets the number of subdivisions (positive integer, default 4). The more subdivisions, the more faces on the icosphere whatever its size\n * * The parameter `flat` (boolean, default true) gives each side its own normals. Set it to false to get a smooth continuous light reflection on the surface\n * * You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE\n * * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4). Detail here : https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation\n * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created\n * @param name defines the name of the mesh\n * @param options defines the options used to create the mesh\n * @param options.radius\n * @param options.radiusX\n * @param options.radiusY\n * @param options.radiusZ\n * @param options.flat\n * @param options.subdivisions\n * @param options.sideOrientation\n * @param options.frontUVs\n * @param options.backUVs\n * @param options.updatable\n * @param scene defines the hosting scene\n * @returns the icosahedron mesh\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/polyhedra#icosphere\n */\nexport function CreateIcoSphere(name, options = {}, scene = null) {\n const sphere = new Mesh(name, scene);\n options.sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\n sphere._originalBuilderSideOrientation = options.sideOrientation;\n const vertexData = CreateIcoSphereVertexData(options);\n vertexData.applyToMesh(sphere, options.updatable);\n return sphere;\n}\n/**\n * Class containing static functions to help procedurally build meshes\n * @deprecated use the function directly from the module\n */\nexport const IcoSphereBuilder = {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n CreateIcoSphere,\n};\nVertexData.CreateIcoSphere = CreateIcoSphereVertexData;\nMesh.CreateIcoSphere = (name, options, scene) => {\n return CreateIcoSphere(name, options, scene);\n};\n//# sourceMappingURL=icoSphereBuilder.js.map","import { Vector3, Matrix, Vector2, TmpVectors } from \"../../Maths/math.vector.js\";\nimport { Scalar } from \"../../Maths/math.scalar.js\";\nimport { Mesh } from \"../mesh.js\";\nimport { VertexBuffer } from \"../../Buffers/buffer.js\";\nimport { VertexData } from \"../mesh.vertexData.js\";\nimport { CompatibilityOptions } from \"../../Compat/compatibilityOptions.js\";\nconst xpAxis = new Vector3(1, 0, 0);\nconst xnAxis = new Vector3(-1, 0, 0);\nconst ypAxis = new Vector3(0, 1, 0);\nconst ynAxis = new Vector3(0, -1, 0);\nconst zpAxis = new Vector3(0, 0, 1);\nconst znAxis = new Vector3(0, 0, -1);\n/** @internal */\nclass DecalVertex {\n constructor(position = Vector3.Zero(), normal = Vector3.Up(), uv = Vector2.Zero(), vertexIdx = 0, vertexIdxForBones = 0, localPositionOverride = null, localNormalOverride = null, matrixIndicesOverride = null, matrixWeightsOverride = null) {\n this.position = position;\n this.normal = normal;\n this.uv = uv;\n this.vertexIdx = vertexIdx;\n this.vertexIdxForBones = vertexIdxForBones;\n this.localPositionOverride = localPositionOverride;\n this.localNormalOverride = localNormalOverride;\n this.matrixIndicesOverride = matrixIndicesOverride;\n this.matrixWeightsOverride = matrixWeightsOverride;\n }\n clone() {\n var _a, _b, _c, _d;\n return new DecalVertex(this.position.clone(), this.normal.clone(), this.uv.clone(), this.vertexIdx, this.vertexIdxForBones, (_a = this.localPositionOverride) === null || _a === void 0 ? void 0 : _a.slice(), (_b = this.localNormalOverride) === null || _b === void 0 ? void 0 : _b.slice(), (_c = this.matrixIndicesOverride) === null || _c === void 0 ? void 0 : _c.slice(), (_d = this.matrixWeightsOverride) === null || _d === void 0 ? void 0 : _d.slice());\n }\n}\n/**\n * Creates a decal mesh.\n * A decal is a mesh usually applied as a model onto the surface of another mesh. So don't forget the parameter `sourceMesh` depicting the decal\n * * The parameter `position` (Vector3, default `(0, 0, 0)`) sets the position of the decal in World coordinates\n * * The parameter `normal` (Vector3, default `Vector3.Up`) sets the normal of the mesh where the decal is applied onto in World coordinates\n * * The parameter `size` (Vector3, default `(1, 1, 1)`) sets the decal scaling\n * * The parameter `angle` (float in radian, default 0) sets the angle to rotate the decal\n * * The parameter `captureUVS` defines if we need to capture the uvs or compute them\n * * The parameter `cullBackFaces` defines if the back faces should be removed from the decal mesh\n * * The parameter `localMode` defines that the computations should be done with the local mesh coordinates instead of the world space coordinates.\n * * Use this mode if you want the decal to be parented to the sourceMesh and move/rotate with it.\n * Note: Meshes with morph targets are not supported!\n * @param name defines the name of the mesh\n * @param sourceMesh defines the mesh where the decal must be applied\n * @param options defines the options used to create the mesh\n * @param options.position\n * @param options.normal\n * @param options.size\n * @param options.angle\n * @param options.captureUVS\n * @param options.cullBackFaces\n * @param options.localMode\n * @returns the decal mesh\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/decals\n */\nexport function CreateDecal(name, sourceMesh, options) {\n var _a, _b, _c, _d;\n const hasSkeleton = !!sourceMesh.skeleton;\n const useLocalComputation = options.localMode || hasSkeleton;\n const meshHasOverridenMaterial = sourceMesh.overrideMaterialSideOrientation !== null && sourceMesh.overrideMaterialSideOrientation !== undefined;\n const indices = sourceMesh.getIndices();\n const positions = hasSkeleton ? sourceMesh.getPositionData(true, true) : sourceMesh.getVerticesData(VertexBuffer.PositionKind);\n const normals = hasSkeleton ? sourceMesh.getNormalsData(true, true) : sourceMesh.getVerticesData(VertexBuffer.NormalKind);\n const localPositions = useLocalComputation ? (hasSkeleton ? sourceMesh.getVerticesData(VertexBuffer.PositionKind) : positions) : null;\n const localNormals = useLocalComputation ? (hasSkeleton ? sourceMesh.getVerticesData(VertexBuffer.NormalKind) : normals) : null;\n const uvs = sourceMesh.getVerticesData(VertexBuffer.UVKind);\n const matIndices = hasSkeleton ? sourceMesh.getVerticesData(VertexBuffer.MatricesIndicesKind) : null;\n const matWeights = hasSkeleton ? sourceMesh.getVerticesData(VertexBuffer.MatricesWeightsKind) : null;\n const matIndicesExtra = hasSkeleton ? sourceMesh.getVerticesData(VertexBuffer.MatricesIndicesExtraKind) : null;\n const matWeightsExtra = hasSkeleton ? sourceMesh.getVerticesData(VertexBuffer.MatricesWeightsExtraKind) : null;\n const position = options.position || Vector3.Zero();\n let normal = options.normal || Vector3.Up();\n const size = options.size || Vector3.One();\n const angle = options.angle || 0;\n // Getting correct rotation\n if (!normal) {\n const target = new Vector3(0, 0, 1);\n const camera = sourceMesh.getScene().activeCamera;\n const cameraWorldTarget = Vector3.TransformCoordinates(target, camera.getWorldMatrix());\n normal = camera.globalPosition.subtract(cameraWorldTarget);\n }\n const yaw = -Math.atan2(normal.z, normal.x) - Math.PI / 2;\n const len = Math.sqrt(normal.x * normal.x + normal.z * normal.z);\n const pitch = Math.atan2(normal.y, len);\n const vertexData = new VertexData();\n vertexData.indices = [];\n vertexData.positions = [];\n vertexData.normals = [];\n vertexData.uvs = [];\n vertexData.matricesIndices = hasSkeleton ? [] : null;\n vertexData.matricesWeights = hasSkeleton ? [] : null;\n vertexData.matricesIndicesExtra = matIndicesExtra ? [] : null;\n vertexData.matricesWeightsExtra = matWeightsExtra ? [] : null;\n let currentVertexDataIndex = 0;\n const extractDecalVector3 = (indexId, transformMatrix) => {\n const result = new DecalVertex();\n if (!indices || !positions || !normals) {\n return result;\n }\n const vertexId = indices[indexId];\n result.vertexIdx = vertexId * 3;\n result.vertexIdxForBones = vertexId * 4;\n // Send vector to decal local world\n result.position = new Vector3(positions[vertexId * 3], positions[vertexId * 3 + 1], positions[vertexId * 3 + 2]);\n Vector3.TransformCoordinatesToRef(result.position, transformMatrix, result.position);\n // Get normal\n result.normal = new Vector3(normals[vertexId * 3], normals[vertexId * 3 + 1], normals[vertexId * 3 + 2]);\n Vector3.TransformNormalToRef(result.normal, transformMatrix, result.normal);\n if (options.captureUVS && uvs) {\n const v = uvs[vertexId * 2 + 1];\n result.uv = new Vector2(uvs[vertexId * 2], CompatibilityOptions.UseOpenGLOrientationForUV ? 1 - v : v);\n }\n return result;\n };\n const emptyArray = [0, 0, 0, 0];\n // Inspired by https://github.com/mrdoob/three.js/blob/eee231960882f6f3b6113405f524956145148146/examples/js/geometries/DecalGeometry.js\n const clip = (vertices, axis) => {\n if (vertices.length === 0) {\n return vertices;\n }\n const clipSize = 0.5 * Math.abs(Vector3.Dot(size, axis));\n const indexOf = (arr, val, start, num) => {\n for (let i = 0; i < num; ++i) {\n if (arr[start + i] === val) {\n return start + i;\n }\n }\n return -1;\n };\n const clipVertices = (v0, v1) => {\n var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;\n const clipFactor = Vector3.GetClipFactor(v0.position, v1.position, axis, clipSize);\n let indices = emptyArray;\n let weights = emptyArray;\n if (matIndices && matWeights) {\n const mat0Index = v0.matrixIndicesOverride ? 0 : v0.vertexIdxForBones;\n const v0Indices = (_a = v0.matrixIndicesOverride) !== null && _a !== void 0 ? _a : matIndices;\n const v0Weights = (_b = v0.matrixWeightsOverride) !== null && _b !== void 0 ? _b : matWeights;\n const mat1Index = v1.matrixIndicesOverride ? 0 : v1.vertexIdxForBones;\n const v1Indices = (_c = v1.matrixIndicesOverride) !== null && _c !== void 0 ? _c : matIndices;\n const v1Weights = (_d = v1.matrixWeightsOverride) !== null && _d !== void 0 ? _d : matWeights;\n indices = [0, 0, 0, 0];\n weights = [0, 0, 0, 0];\n let index = 0;\n for (let i = 0; i < 4; ++i) {\n if (v0Weights[mat0Index + i] > 0) {\n const idx = indexOf(v1Indices, v0Indices[mat0Index + i], mat1Index, 4);\n indices[index] = v0Indices[mat0Index + i];\n weights[index] = Scalar.Lerp(v0Weights[mat0Index + i], idx >= 0 ? v1Weights[idx] : 0, clipFactor);\n index++;\n }\n }\n for (let i = 0; i < 4 && index < 4; ++i) {\n const ind = v1Indices[mat1Index + i];\n if (indexOf(v0Indices, ind, mat0Index, 4) !== -1)\n continue;\n indices[index] = ind;\n weights[index] = Scalar.Lerp(0, v1Weights[mat1Index + i], clipFactor);\n index++;\n }\n const sumw = weights[0] + weights[1] + weights[2] + weights[3];\n weights[0] /= sumw;\n weights[1] /= sumw;\n weights[2] /= sumw;\n weights[3] /= sumw;\n }\n const v0LocalPositionX = v0.localPositionOverride ? v0.localPositionOverride[0] : (_e = localPositions === null || localPositions === void 0 ? void 0 : localPositions[v0.vertexIdx]) !== null && _e !== void 0 ? _e : 0;\n const v0LocalPositionY = v0.localPositionOverride ? v0.localPositionOverride[1] : (_f = localPositions === null || localPositions === void 0 ? void 0 : localPositions[v0.vertexIdx + 1]) !== null && _f !== void 0 ? _f : 0;\n const v0LocalPositionZ = v0.localPositionOverride ? v0.localPositionOverride[2] : (_g = localPositions === null || localPositions === void 0 ? void 0 : localPositions[v0.vertexIdx + 2]) !== null && _g !== void 0 ? _g : 0;\n const v1LocalPositionX = v1.localPositionOverride ? v1.localPositionOverride[0] : (_h = localPositions === null || localPositions === void 0 ? void 0 : localPositions[v1.vertexIdx]) !== null && _h !== void 0 ? _h : 0;\n const v1LocalPositionY = v1.localPositionOverride ? v1.localPositionOverride[1] : (_j = localPositions === null || localPositions === void 0 ? void 0 : localPositions[v1.vertexIdx + 1]) !== null && _j !== void 0 ? _j : 0;\n const v1LocalPositionZ = v1.localPositionOverride ? v1.localPositionOverride[2] : (_k = localPositions === null || localPositions === void 0 ? void 0 : localPositions[v1.vertexIdx + 2]) !== null && _k !== void 0 ? _k : 0;\n const v0LocalNormalX = v0.localNormalOverride ? v0.localNormalOverride[0] : (_l = localNormals === null || localNormals === void 0 ? void 0 : localNormals[v0.vertexIdx]) !== null && _l !== void 0 ? _l : 0;\n const v0LocalNormalY = v0.localNormalOverride ? v0.localNormalOverride[1] : (_m = localNormals === null || localNormals === void 0 ? void 0 : localNormals[v0.vertexIdx + 1]) !== null && _m !== void 0 ? _m : 0;\n const v0LocalNormalZ = v0.localNormalOverride ? v0.localNormalOverride[2] : (_o = localNormals === null || localNormals === void 0 ? void 0 : localNormals[v0.vertexIdx + 2]) !== null && _o !== void 0 ? _o : 0;\n const v1LocalNormalX = v1.localNormalOverride ? v1.localNormalOverride[0] : (_p = localNormals === null || localNormals === void 0 ? void 0 : localNormals[v1.vertexIdx]) !== null && _p !== void 0 ? _p : 0;\n const v1LocalNormalY = v1.localNormalOverride ? v1.localNormalOverride[1] : (_q = localNormals === null || localNormals === void 0 ? void 0 : localNormals[v1.vertexIdx + 1]) !== null && _q !== void 0 ? _q : 0;\n const v1LocalNormalZ = v1.localNormalOverride ? v1.localNormalOverride[2] : (_r = localNormals === null || localNormals === void 0 ? void 0 : localNormals[v1.vertexIdx + 2]) !== null && _r !== void 0 ? _r : 0;\n const interpNormalX = v0LocalNormalX + (v1LocalNormalX - v0LocalNormalX) * clipFactor;\n const interpNormalY = v0LocalNormalY + (v1LocalNormalY - v0LocalNormalY) * clipFactor;\n const interpNormalZ = v0LocalNormalZ + (v1LocalNormalZ - v0LocalNormalZ) * clipFactor;\n const norm = Math.sqrt(interpNormalX * interpNormalX + interpNormalY * interpNormalY + interpNormalZ * interpNormalZ);\n return new DecalVertex(Vector3.Lerp(v0.position, v1.position, clipFactor), Vector3.Lerp(v0.normal, v1.normal, clipFactor).normalize(), Vector2.Lerp(v0.uv, v1.uv, clipFactor), -1, -1, localPositions\n ? [\n v0LocalPositionX + (v1LocalPositionX - v0LocalPositionX) * clipFactor,\n v0LocalPositionY + (v1LocalPositionY - v0LocalPositionY) * clipFactor,\n v0LocalPositionZ + (v1LocalPositionZ - v0LocalPositionZ) * clipFactor,\n ]\n : null, localNormals ? [interpNormalX / norm, interpNormalY / norm, interpNormalZ / norm] : null, indices, weights);\n };\n let clipResult = null;\n if (vertices.length > 3) {\n clipResult = new Array();\n }\n for (let index = 0; index < vertices.length; index += 3) {\n let total = 0;\n let nV1 = null;\n let nV2 = null;\n let nV3 = null;\n let nV4 = null;\n const d1 = Vector3.Dot(vertices[index].position, axis) - clipSize;\n const d2 = Vector3.Dot(vertices[index + 1].position, axis) - clipSize;\n const d3 = Vector3.Dot(vertices[index + 2].position, axis) - clipSize;\n const v1Out = d1 > 0;\n const v2Out = d2 > 0;\n const v3Out = d3 > 0;\n total = (v1Out ? 1 : 0) + (v2Out ? 1 : 0) + (v3Out ? 1 : 0);\n switch (total) {\n case 0:\n if (vertices.length > 3) {\n clipResult.push(vertices[index]);\n clipResult.push(vertices[index + 1]);\n clipResult.push(vertices[index + 2]);\n }\n else {\n clipResult = vertices;\n }\n break;\n case 1:\n clipResult = clipResult !== null && clipResult !== void 0 ? clipResult : new Array();\n if (v1Out) {\n nV1 = vertices[index + 1];\n nV2 = vertices[index + 2];\n nV3 = clipVertices(vertices[index], nV1);\n nV4 = clipVertices(vertices[index], nV2);\n }\n if (v2Out) {\n nV1 = vertices[index];\n nV2 = vertices[index + 2];\n nV3 = clipVertices(vertices[index + 1], nV1);\n nV4 = clipVertices(vertices[index + 1], nV2);\n clipResult.push(nV3);\n clipResult.push(nV2.clone());\n clipResult.push(nV1.clone());\n clipResult.push(nV2.clone());\n clipResult.push(nV3.clone());\n clipResult.push(nV4);\n break;\n }\n if (v3Out) {\n nV1 = vertices[index];\n nV2 = vertices[index + 1];\n nV3 = clipVertices(vertices[index + 2], nV1);\n nV4 = clipVertices(vertices[index + 2], nV2);\n }\n if (nV1 && nV2 && nV3 && nV4) {\n clipResult.push(nV1.clone());\n clipResult.push(nV2.clone());\n clipResult.push(nV3);\n clipResult.push(nV4);\n clipResult.push(nV3.clone());\n clipResult.push(nV2.clone());\n }\n break;\n case 2:\n clipResult = clipResult !== null && clipResult !== void 0 ? clipResult : new Array();\n if (!v1Out) {\n nV1 = vertices[index].clone();\n nV2 = clipVertices(nV1, vertices[index + 1]);\n nV3 = clipVertices(nV1, vertices[index + 2]);\n clipResult.push(nV1);\n clipResult.push(nV2);\n clipResult.push(nV3);\n }\n if (!v2Out) {\n nV1 = vertices[index + 1].clone();\n nV2 = clipVertices(nV1, vertices[index + 2]);\n nV3 = clipVertices(nV1, vertices[index]);\n clipResult.push(nV1);\n clipResult.push(nV2);\n clipResult.push(nV3);\n }\n if (!v3Out) {\n nV1 = vertices[index + 2].clone();\n nV2 = clipVertices(nV1, vertices[index]);\n nV3 = clipVertices(nV1, vertices[index + 1]);\n clipResult.push(nV1);\n clipResult.push(nV2);\n clipResult.push(nV3);\n }\n break;\n case 3:\n break;\n }\n }\n return clipResult;\n };\n const sourceMeshAsMesh = sourceMesh instanceof Mesh ? sourceMesh : null;\n const matrixData = sourceMeshAsMesh === null || sourceMeshAsMesh === void 0 ? void 0 : sourceMeshAsMesh._thinInstanceDataStorage.matrixData;\n const numMatrices = (sourceMeshAsMesh === null || sourceMeshAsMesh === void 0 ? void 0 : sourceMeshAsMesh.thinInstanceCount) || 1;\n const thinInstanceMatrix = TmpVectors.Matrix[0];\n thinInstanceMatrix.copyFrom(Matrix.IdentityReadOnly);\n for (let m = 0; m < numMatrices; ++m) {\n if ((sourceMeshAsMesh === null || sourceMeshAsMesh === void 0 ? void 0 : sourceMeshAsMesh.hasThinInstances) && matrixData) {\n const ofst = m * 16;\n thinInstanceMatrix.setRowFromFloats(0, matrixData[ofst + 0], matrixData[ofst + 1], matrixData[ofst + 2], matrixData[ofst + 3]);\n thinInstanceMatrix.setRowFromFloats(1, matrixData[ofst + 4], matrixData[ofst + 5], matrixData[ofst + 6], matrixData[ofst + 7]);\n thinInstanceMatrix.setRowFromFloats(2, matrixData[ofst + 8], matrixData[ofst + 9], matrixData[ofst + 10], matrixData[ofst + 11]);\n thinInstanceMatrix.setRowFromFloats(3, matrixData[ofst + 12], matrixData[ofst + 13], matrixData[ofst + 14], matrixData[ofst + 15]);\n }\n // Matrix\n const decalWorldMatrix = Matrix.RotationYawPitchRoll(yaw, pitch, angle).multiply(Matrix.Translation(position.x, position.y, position.z));\n const inverseDecalWorldMatrix = Matrix.Invert(decalWorldMatrix);\n const meshWorldMatrix = sourceMesh.getWorldMatrix();\n const transformMatrix = thinInstanceMatrix.multiply(meshWorldMatrix).multiply(inverseDecalWorldMatrix);\n const oneFaceVertices = new Array(3);\n for (let index = 0; index < indices.length; index += 3) {\n let faceVertices = oneFaceVertices;\n faceVertices[0] = extractDecalVector3(index, transformMatrix);\n if (meshHasOverridenMaterial && useLocalComputation) {\n faceVertices[1] = extractDecalVector3(index + 2, transformMatrix);\n faceVertices[2] = extractDecalVector3(index + 1, transformMatrix);\n }\n else {\n faceVertices[1] = extractDecalVector3(index + 1, transformMatrix);\n faceVertices[2] = extractDecalVector3(index + 2, transformMatrix);\n }\n if (options.cullBackFaces) {\n // If all the normals of the vertices of the face are pointing away from the view direction we discard the face.\n // As computations are done in the decal coordinate space, the viewDirection is (0,0,1), so when dot(vertexNormal, -viewDirection) <= 0 the vertex is culled\n if (-faceVertices[0].normal.z <= 0 && -faceVertices[1].normal.z <= 0 && -faceVertices[2].normal.z <= 0) {\n continue;\n }\n }\n // Clip\n faceVertices = clip(faceVertices, xpAxis);\n if (!faceVertices)\n continue;\n faceVertices = clip(faceVertices, xnAxis);\n if (!faceVertices)\n continue;\n faceVertices = clip(faceVertices, ypAxis);\n if (!faceVertices)\n continue;\n faceVertices = clip(faceVertices, ynAxis);\n if (!faceVertices)\n continue;\n faceVertices = clip(faceVertices, zpAxis);\n if (!faceVertices)\n continue;\n faceVertices = clip(faceVertices, znAxis);\n if (!faceVertices)\n continue;\n // Add UVs and get back to world\n for (let vIndex = 0; vIndex < faceVertices.length; vIndex++) {\n const vertex = faceVertices[vIndex];\n //TODO check for Int32Array | Uint32Array | Uint16Array\n vertexData.indices.push(currentVertexDataIndex);\n if (useLocalComputation) {\n if (vertex.localPositionOverride) {\n vertexData.positions[currentVertexDataIndex * 3] = vertex.localPositionOverride[0];\n vertexData.positions[currentVertexDataIndex * 3 + 1] = vertex.localPositionOverride[1];\n vertexData.positions[currentVertexDataIndex * 3 + 2] = vertex.localPositionOverride[2];\n }\n else if (localPositions) {\n vertexData.positions[currentVertexDataIndex * 3] = localPositions[vertex.vertexIdx];\n vertexData.positions[currentVertexDataIndex * 3 + 1] = localPositions[vertex.vertexIdx + 1];\n vertexData.positions[currentVertexDataIndex * 3 + 2] = localPositions[vertex.vertexIdx + 2];\n }\n if (vertex.localNormalOverride) {\n vertexData.normals[currentVertexDataIndex * 3] = vertex.localNormalOverride[0];\n vertexData.normals[currentVertexDataIndex * 3 + 1] = vertex.localNormalOverride[1];\n vertexData.normals[currentVertexDataIndex * 3 + 2] = vertex.localNormalOverride[2];\n }\n else if (localNormals) {\n vertexData.normals[currentVertexDataIndex * 3] = localNormals[vertex.vertexIdx];\n vertexData.normals[currentVertexDataIndex * 3 + 1] = localNormals[vertex.vertexIdx + 1];\n vertexData.normals[currentVertexDataIndex * 3 + 2] = localNormals[vertex.vertexIdx + 2];\n }\n }\n else {\n vertex.position.toArray(vertexData.positions, currentVertexDataIndex * 3);\n vertex.normal.toArray(vertexData.normals, currentVertexDataIndex * 3);\n }\n if (vertexData.matricesIndices && vertexData.matricesWeights) {\n if (vertex.matrixIndicesOverride) {\n vertexData.matricesIndices[currentVertexDataIndex * 4] = vertex.matrixIndicesOverride[0];\n vertexData.matricesIndices[currentVertexDataIndex * 4 + 1] = vertex.matrixIndicesOverride[1];\n vertexData.matricesIndices[currentVertexDataIndex * 4 + 2] = vertex.matrixIndicesOverride[2];\n vertexData.matricesIndices[currentVertexDataIndex * 4 + 3] = vertex.matrixIndicesOverride[3];\n }\n else {\n if (matIndices) {\n vertexData.matricesIndices[currentVertexDataIndex * 4] = matIndices[vertex.vertexIdxForBones];\n vertexData.matricesIndices[currentVertexDataIndex * 4 + 1] = matIndices[vertex.vertexIdxForBones + 1];\n vertexData.matricesIndices[currentVertexDataIndex * 4 + 2] = matIndices[vertex.vertexIdxForBones + 2];\n vertexData.matricesIndices[currentVertexDataIndex * 4 + 3] = matIndices[vertex.vertexIdxForBones + 3];\n }\n if (matIndicesExtra && vertexData.matricesIndicesExtra) {\n vertexData.matricesIndicesExtra[currentVertexDataIndex * 4] = matIndicesExtra[vertex.vertexIdxForBones];\n vertexData.matricesIndicesExtra[currentVertexDataIndex * 4 + 1] = matIndicesExtra[vertex.vertexIdxForBones + 1];\n vertexData.matricesIndicesExtra[currentVertexDataIndex * 4 + 2] = matIndicesExtra[vertex.vertexIdxForBones + 2];\n vertexData.matricesIndicesExtra[currentVertexDataIndex * 4 + 3] = matIndicesExtra[vertex.vertexIdxForBones + 3];\n }\n }\n if (vertex.matrixWeightsOverride) {\n vertexData.matricesWeights[currentVertexDataIndex * 4] = vertex.matrixWeightsOverride[0];\n vertexData.matricesWeights[currentVertexDataIndex * 4 + 1] = vertex.matrixWeightsOverride[1];\n vertexData.matricesWeights[currentVertexDataIndex * 4 + 2] = vertex.matrixWeightsOverride[2];\n vertexData.matricesWeights[currentVertexDataIndex * 4 + 3] = vertex.matrixWeightsOverride[3];\n }\n else {\n if (matWeights) {\n vertexData.matricesWeights[currentVertexDataIndex * 4] = matWeights[vertex.vertexIdxForBones];\n vertexData.matricesWeights[currentVertexDataIndex * 4 + 1] = matWeights[vertex.vertexIdxForBones + 1];\n vertexData.matricesWeights[currentVertexDataIndex * 4 + 2] = matWeights[vertex.vertexIdxForBones + 2];\n vertexData.matricesWeights[currentVertexDataIndex * 4 + 3] = matWeights[vertex.vertexIdxForBones + 3];\n }\n if (matWeightsExtra && vertexData.matricesWeightsExtra) {\n vertexData.matricesWeightsExtra[currentVertexDataIndex * 4] = matWeightsExtra[vertex.vertexIdxForBones];\n vertexData.matricesWeightsExtra[currentVertexDataIndex * 4 + 1] = matWeightsExtra[vertex.vertexIdxForBones + 1];\n vertexData.matricesWeightsExtra[currentVertexDataIndex * 4 + 2] = matWeightsExtra[vertex.vertexIdxForBones + 2];\n vertexData.matricesWeightsExtra[currentVertexDataIndex * 4 + 3] = matWeightsExtra[vertex.vertexIdxForBones + 3];\n }\n }\n }\n if (!options.captureUVS) {\n vertexData.uvs.push(0.5 + vertex.position.x / size.x);\n const v = 0.5 + vertex.position.y / size.y;\n vertexData.uvs.push(CompatibilityOptions.UseOpenGLOrientationForUV ? 1 - v : v);\n }\n else {\n vertex.uv.toArray(vertexData.uvs, currentVertexDataIndex * 2);\n }\n currentVertexDataIndex++;\n }\n }\n }\n // Avoid the \"Setting vertex data kind 'XXX' with an empty array\" warning when calling vertexData.applyToMesh\n if (vertexData.indices.length === 0)\n vertexData.indices = null;\n if (vertexData.positions.length === 0)\n vertexData.positions = null;\n if (vertexData.normals.length === 0)\n vertexData.normals = null;\n if (vertexData.uvs.length === 0)\n vertexData.uvs = null;\n if (((_a = vertexData.matricesIndices) === null || _a === void 0 ? void 0 : _a.length) === 0)\n vertexData.matricesIndices = null;\n if (((_b = vertexData.matricesWeights) === null || _b === void 0 ? void 0 : _b.length) === 0)\n vertexData.matricesWeights = null;\n if (((_c = vertexData.matricesIndicesExtra) === null || _c === void 0 ? void 0 : _c.length) === 0)\n vertexData.matricesIndicesExtra = null;\n if (((_d = vertexData.matricesWeightsExtra) === null || _d === void 0 ? void 0 : _d.length) === 0)\n vertexData.matricesWeightsExtra = null;\n // Return mesh\n const decal = new Mesh(name, sourceMesh.getScene());\n vertexData.applyToMesh(decal);\n if (useLocalComputation) {\n decal.skeleton = sourceMesh.skeleton;\n decal.parent = sourceMesh;\n }\n else {\n decal.position = position.clone();\n decal.rotation = new Vector3(pitch, yaw, angle);\n }\n decal.computeWorldMatrix(true);\n decal.refreshBoundingInfo(true, true);\n return decal;\n}\n/**\n * Class containing static functions to help procedurally build meshes\n * @deprecated use the function directly from the module\n */\nexport const DecalBuilder = {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n CreateDecal,\n};\nMesh.CreateDecal = (name, sourceMesh, position, normal, size, angle) => {\n const options = {\n position,\n normal,\n size,\n angle,\n };\n return CreateDecal(name, sourceMesh, options);\n};\n//# sourceMappingURL=decalBuilder.js.map","import { VertexData } from \"../mesh.vertexData.js\";\nimport { Vector2, Vector3, Matrix } from \"../../Maths/math.vector.js\";\nimport { Mesh } from \"../mesh.js\";\nimport { CompatibilityOptions } from \"../../Compat/compatibilityOptions.js\";\n/**\n * Scripts based off of https://github.com/maximeq/three-js-capsule-geometry/blob/master/src/CapsuleBufferGeometry.js\n * @param options the constructors options used to shape the mesh.\n * @returns the capsule VertexData\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set/capsule\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function CreateCapsuleVertexData(options = {\n subdivisions: 2,\n tessellation: 16,\n height: 1,\n radius: 0.25,\n capSubdivisions: 6,\n}) {\n const subdivisions = Math.max(options.subdivisions ? options.subdivisions : 2, 1) | 0;\n const tessellation = Math.max(options.tessellation ? options.tessellation : 16, 3) | 0;\n const height = Math.max(options.height ? options.height : 1, 0);\n const radius = Math.max(options.radius ? options.radius : 0.25, 0);\n const capDetail = Math.max(options.capSubdivisions ? options.capSubdivisions : 6, 1) | 0;\n const radialSegments = tessellation;\n const heightSegments = subdivisions;\n const radiusTop = Math.max(options.radiusTop ? options.radiusTop : radius, 0);\n const radiusBottom = Math.max(options.radiusBottom ? options.radiusBottom : radius, 0);\n const heightMinusCaps = height - (radiusTop + radiusBottom);\n const thetaStart = 0.0;\n const thetaLength = 2.0 * Math.PI;\n const capsTopSegments = Math.max(options.topCapSubdivisions ? options.topCapSubdivisions : capDetail, 1);\n const capsBottomSegments = Math.max(options.bottomCapSubdivisions ? options.bottomCapSubdivisions : capDetail, 1);\n const alpha = Math.acos((radiusBottom - radiusTop) / height);\n let indices = [];\n const vertices = [];\n const normals = [];\n const uvs = [];\n let index = 0;\n const indexArray = [], halfHeight = heightMinusCaps * 0.5;\n const pi2 = Math.PI * 0.5;\n let x, y;\n const normal = Vector3.Zero();\n const vertex = Vector3.Zero();\n const cosAlpha = Math.cos(alpha);\n const sinAlpha = Math.sin(alpha);\n const coneLength = new Vector2(radiusTop * sinAlpha, halfHeight + radiusTop * cosAlpha)\n .subtract(new Vector2(radiusBottom * sinAlpha, -halfHeight + radiusBottom * cosAlpha))\n .length();\n // Total length for v texture coord\n const vl = radiusTop * alpha + coneLength + radiusBottom * (pi2 - alpha);\n let v = 0;\n for (y = 0; y <= capsTopSegments; y++) {\n const indexRow = [];\n const a = pi2 - alpha * (y / capsTopSegments);\n v += (radiusTop * alpha) / capsTopSegments;\n const cosA = Math.cos(a);\n const sinA = Math.sin(a);\n // calculate the radius of the current row\n const _radius = cosA * radiusTop;\n for (x = 0; x <= radialSegments; x++) {\n const u = x / radialSegments;\n const theta = u * thetaLength + thetaStart;\n const sinTheta = Math.sin(theta);\n const cosTheta = Math.cos(theta);\n // vertex\n vertex.x = _radius * sinTheta;\n vertex.y = halfHeight + sinA * radiusTop;\n vertex.z = _radius * cosTheta;\n vertices.push(vertex.x, vertex.y, vertex.z);\n // normal\n normal.set(cosA * sinTheta, sinA, cosA * cosTheta);\n normals.push(normal.x, normal.y, normal.z);\n // uv\n uvs.push(u, CompatibilityOptions.UseOpenGLOrientationForUV ? v / vl : 1 - v / vl);\n // save index of vertex in respective row\n indexRow.push(index);\n // increase index\n index++;\n }\n // now save vertices of the row in our index array\n indexArray.push(indexRow);\n }\n const coneHeight = height - radiusTop - radiusBottom + cosAlpha * radiusTop - cosAlpha * radiusBottom;\n const slope = (sinAlpha * (radiusBottom - radiusTop)) / coneHeight;\n for (y = 1; y <= heightSegments; y++) {\n const indexRow = [];\n v += coneLength / heightSegments;\n // calculate the radius of the current row\n const _radius = sinAlpha * ((y * (radiusBottom - radiusTop)) / heightSegments + radiusTop);\n for (x = 0; x <= radialSegments; x++) {\n const u = x / radialSegments;\n const theta = u * thetaLength + thetaStart;\n const sinTheta = Math.sin(theta);\n const cosTheta = Math.cos(theta);\n // vertex\n vertex.x = _radius * sinTheta;\n vertex.y = halfHeight + cosAlpha * radiusTop - (y * coneHeight) / heightSegments;\n vertex.z = _radius * cosTheta;\n vertices.push(vertex.x, vertex.y, vertex.z);\n // normal\n normal.set(sinTheta, slope, cosTheta).normalize();\n normals.push(normal.x, normal.y, normal.z);\n // uv\n uvs.push(u, CompatibilityOptions.UseOpenGLOrientationForUV ? v / vl : 1 - v / vl);\n // save index of vertex in respective row\n indexRow.push(index);\n // increase index\n index++;\n }\n // now save vertices of the row in our index array\n indexArray.push(indexRow);\n }\n for (y = 1; y <= capsBottomSegments; y++) {\n const indexRow = [];\n const a = pi2 - alpha - (Math.PI - alpha) * (y / capsBottomSegments);\n v += (radiusBottom * alpha) / capsBottomSegments;\n const cosA = Math.cos(a);\n const sinA = Math.sin(a);\n // calculate the radius of the current row\n const _radius = cosA * radiusBottom;\n for (x = 0; x <= radialSegments; x++) {\n const u = x / radialSegments;\n const theta = u * thetaLength + thetaStart;\n const sinTheta = Math.sin(theta);\n const cosTheta = Math.cos(theta);\n // vertex\n vertex.x = _radius * sinTheta;\n vertex.y = -halfHeight + sinA * radiusBottom;\n vertex.z = _radius * cosTheta;\n vertices.push(vertex.x, vertex.y, vertex.z);\n // normal\n normal.set(cosA * sinTheta, sinA, cosA * cosTheta);\n normals.push(normal.x, normal.y, normal.z);\n // uv\n uvs.push(u, CompatibilityOptions.UseOpenGLOrientationForUV ? v / vl : 1 - v / vl);\n // save index of vertex in respective row\n indexRow.push(index);\n // increase index\n index++;\n }\n // now save vertices of the row in our index array\n indexArray.push(indexRow);\n }\n // generate indices\n for (x = 0; x < radialSegments; x++) {\n for (y = 0; y < capsTopSegments + heightSegments + capsBottomSegments; y++) {\n // we use the index array to access the correct indices\n const i1 = indexArray[y][x];\n const i2 = indexArray[y + 1][x];\n const i3 = indexArray[y + 1][x + 1];\n const i4 = indexArray[y][x + 1];\n // face one\n indices.push(i1);\n indices.push(i2);\n indices.push(i4);\n // face two\n indices.push(i2);\n indices.push(i3);\n indices.push(i4);\n }\n }\n indices = indices.reverse();\n if (options.orientation && !options.orientation.equals(Vector3.Up())) {\n const m = new Matrix();\n options.orientation\n .clone()\n .scale(Math.PI * 0.5)\n .cross(Vector3.Up())\n .toQuaternion()\n .toRotationMatrix(m);\n const v = Vector3.Zero();\n for (let i = 0; i < vertices.length; i += 3) {\n v.set(vertices[i], vertices[i + 1], vertices[i + 2]);\n Vector3.TransformCoordinatesToRef(v.clone(), m, v);\n vertices[i] = v.x;\n vertices[i + 1] = v.y;\n vertices[i + 2] = v.z;\n }\n }\n const vDat = new VertexData();\n vDat.positions = vertices;\n vDat.normals = normals;\n vDat.uvs = uvs;\n vDat.indices = indices;\n return vDat;\n}\n/**\n * Creates a capsule or a pill mesh\n * @param name defines the name of the mesh\n * @param options The constructors options.\n * @param scene The scene the mesh is scoped to.\n * @returns Capsule Mesh\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function CreateCapsule(name, options = {\n orientation: Vector3.Up(),\n subdivisions: 2,\n tessellation: 16,\n height: 1,\n radius: 0.25,\n capSubdivisions: 6,\n updatable: false,\n}, scene = null) {\n const capsule = new Mesh(name, scene);\n const vertexData = CreateCapsuleVertexData(options);\n vertexData.applyToMesh(capsule, options.updatable);\n return capsule;\n}\n/**\n * Class containing static functions to help procedurally build meshes\n * @deprecated please use CreateCapsule directly\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const CapsuleBuilder = {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n CreateCapsule,\n};\n/**\n * Creates a capsule or a pill mesh\n * @param name defines the name of the mesh.\n * @param options the constructors options used to shape the mesh.\n * @param scene defines the scene the mesh is scoped to.\n * @returns the capsule mesh\n * @see https://doc.babylonjs.com/how_to/capsule_shape\n */\nMesh.CreateCapsule = (name, options, scene) => {\n return CreateCapsule(name, options, scene);\n};\nVertexData.CreateCapsule = CreateCapsuleVertexData;\n//# sourceMappingURL=capsuleBuilder.js.map","import { Logger } from \"../Misc/logger.js\";\nimport { Vector3 } from \"./math.vector.js\";\n/**\n * Class representing an isovector a vector containing 2 INTEGER coordinates\n * x axis is horizontal\n * y axis is 60 deg counter clockwise from positive y axis\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport class _IsoVector {\n /**\n * Creates a new isovector from the given x and y coordinates\n * @param x defines the first coordinate, must be an integer\n * @param y defines the second coordinate, must be an integer\n */\n constructor(\n /** defines the first coordinate */\n x = 0, \n /** defines the second coordinate */\n y = 0) {\n this.x = x;\n this.y = y;\n if (x !== Math.floor(x)) {\n x === Math.floor(x);\n Logger.Warn(\"x is not an integer, floor(x) used\");\n }\n if (y !== Math.floor(y)) {\n y === Math.floor(y);\n Logger.Warn(\"y is not an integer, floor(y) used\");\n }\n }\n // Operators\n /**\n * Gets a new IsoVector copied from the IsoVector\n * @returns a new IsoVector\n */\n clone() {\n return new _IsoVector(this.x, this.y);\n }\n /**\n * Rotates one IsoVector 60 degrees counter clockwise about another\n * Please note that this is an in place operation\n * @param other an IsoVector a center of rotation\n * @returns the rotated IsoVector\n */\n rotate60About(other) {\n //other IsoVector\n const x = this.x;\n this.x = other.x + other.y - this.y;\n this.y = x + this.y - other.x;\n return this;\n }\n /**\n * Rotates one IsoVector 60 degrees clockwise about another\n * Please note that this is an in place operation\n * @param other an IsoVector as center of rotation\n * @returns the rotated IsoVector\n */\n rotateNeg60About(other) {\n const x = this.x;\n this.x = x + this.y - other.y;\n this.y = other.x + other.y - x;\n return this;\n }\n /**\n * For an equilateral triangle OAB with O at isovector (0, 0) and A at isovector (m, n)\n * Rotates one IsoVector 120 degrees counter clockwise about the center of the triangle\n * Please note that this is an in place operation\n * @param m integer a measure a Primary triangle of order (m, n) m > n\n * @param n >= 0 integer a measure for a Primary triangle of order (m, n)\n * @returns the rotated IsoVector\n */\n rotate120(m, n) {\n //m, n integers\n if (m !== Math.floor(m)) {\n m === Math.floor(m);\n Logger.Warn(\"m not an integer only floor(m) used\");\n }\n if (n !== Math.floor(n)) {\n n === Math.floor(n);\n Logger.Warn(\"n not an integer only floor(n) used\");\n }\n const x = this.x;\n this.x = m - x - this.y;\n this.y = n + x;\n return this;\n }\n /**\n * For an equilateral triangle OAB with O at isovector (0, 0) and A at isovector (m, n)\n * Rotates one IsoVector 120 degrees clockwise about the center of the triangle\n * Please note that this is an in place operation\n * @param m integer a measure a Primary triangle of order (m, n) m > n\n * @param n >= 0 integer a measure for a Primary triangle of order (m, n)\n * @returns the rotated IsoVector\n */\n rotateNeg120(m, n) {\n //m, n integers\n if (m !== Math.floor(m)) {\n m === Math.floor(m);\n Logger.Warn(\"m is not an integer, floor(m) used\");\n }\n if (n !== Math.floor(n)) {\n n === Math.floor(n);\n Logger.Warn(\"n is not an integer, floor(n) used\");\n }\n const x = this.x;\n this.x = this.y - n;\n this.y = m + n - x - this.y;\n return this;\n }\n /**\n * Transforms an IsoVector to one in Cartesian 3D space based on an isovector\n * @param origin an IsoVector\n * @param isoGridSize\n * @returns Point as a Vector3\n */\n toCartesianOrigin(origin, isoGridSize) {\n const point = Vector3.Zero();\n point.x = origin.x + 2 * this.x * isoGridSize + this.y * isoGridSize;\n point.y = origin.y + Math.sqrt(3) * this.y * isoGridSize;\n return point;\n }\n // Statics\n /**\n * Gets a new IsoVector(0, 0)\n * @returns a new IsoVector\n */\n static Zero() {\n return new _IsoVector(0, 0);\n }\n}\n//# sourceMappingURL=math.isovector.js.map","import { Vector3, TmpVectors } from \"../Maths/math.vector.js\";\nimport { Scalar } from \"../Maths/math.scalar.js\";\nimport { PHI } from \"../Maths/math.constants.js\";\nimport { _IsoVector } from \"../Maths/math.isovector.js\";\n/**\n * Class representing data for one face OAB of an equilateral icosahedron\n * When O is the isovector (0, 0), A is isovector (m, n)\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport class _PrimaryIsoTriangle {\n constructor() {\n this.cartesian = [];\n this.vertices = [];\n this.max = [];\n this.min = [];\n this.closestTo = [];\n this.innerFacets = [];\n this.isoVecsABOB = [];\n this.isoVecsOBOA = [];\n this.isoVecsBAOA = [];\n this.vertexTypes = [];\n // eslint-disable-next-line @typescript-eslint/naming-convention\n this.IDATA = new PolyhedronData(\"icosahedron\", \"Regular\", [\n [0, PHI, -1],\n [-PHI, 1, 0],\n [-1, 0, -PHI],\n [1, 0, -PHI],\n [PHI, 1, 0],\n [0, PHI, 1],\n [-1, 0, PHI],\n [-PHI, -1, 0],\n [0, -PHI, -1],\n [PHI, -1, 0],\n [1, 0, PHI],\n [0, -PHI, 1],\n ], [\n [0, 2, 1],\n [0, 3, 2],\n [0, 4, 3],\n [0, 5, 4],\n [0, 1, 5],\n [7, 6, 1],\n [8, 7, 2],\n [9, 8, 3],\n [10, 9, 4],\n [6, 10, 5],\n [2, 7, 1],\n [3, 8, 2],\n [4, 9, 3],\n [5, 10, 4],\n [1, 6, 5],\n [11, 6, 7],\n [11, 7, 8],\n [11, 8, 9],\n [11, 9, 10],\n [11, 10, 6],\n ]);\n }\n /**\n * Creates the PrimaryIsoTriangle Triangle OAB\n * @param m an integer\n * @param n an integer\n */\n //operators\n setIndices() {\n let indexCount = 12; // 12 vertices already assigned\n const vecToidx = {}; //maps iso-vectors to indexCount;\n const m = this.m;\n const n = this.n;\n let g = m; // hcf of m, n when n != 0\n let m1 = 1;\n let n1 = 0;\n if (n !== 0) {\n g = Scalar.HCF(m, n);\n }\n m1 = m / g;\n n1 = n / g;\n let fr; //face to the right of current face\n let rot; //rotation about which vertex for fr\n let O;\n let A;\n let B;\n const oVec = _IsoVector.Zero();\n const aVec = new _IsoVector(m, n);\n const bVec = new _IsoVector(-n, m + n);\n const oaVec = _IsoVector.Zero();\n const abVec = _IsoVector.Zero();\n const obVec = _IsoVector.Zero();\n let verts = [];\n let idx;\n let idxR;\n let isoId;\n let isoIdR;\n const closestTo = [];\n const vDist = this.vertByDist;\n const matchIdx = (f, fr, isoId, isoIdR) => {\n idx = f + \"|\" + isoId;\n idxR = fr + \"|\" + isoIdR;\n if (!(idx in vecToidx || idxR in vecToidx)) {\n vecToidx[idx] = indexCount;\n vecToidx[idxR] = indexCount;\n indexCount++;\n }\n else if (idx in vecToidx && !(idxR in vecToidx)) {\n vecToidx[idxR] = vecToidx[idx];\n }\n else if (idxR in vecToidx && !(idx in vecToidx)) {\n vecToidx[idx] = vecToidx[idxR];\n }\n if (vDist[isoId][0] > 2) {\n closestTo[vecToidx[idx]] = [-vDist[isoId][0], vDist[isoId][1], vecToidx[idx]];\n }\n else {\n closestTo[vecToidx[idx]] = [verts[vDist[isoId][0]], vDist[isoId][1], vecToidx[idx]];\n }\n };\n this.IDATA.edgematch = [\n [1, \"B\"],\n [2, \"B\"],\n [3, \"B\"],\n [4, \"B\"],\n [0, \"B\"],\n [10, \"O\", 14, \"A\"],\n [11, \"O\", 10, \"A\"],\n [12, \"O\", 11, \"A\"],\n [13, \"O\", 12, \"A\"],\n [14, \"O\", 13, \"A\"],\n [0, \"O\"],\n [1, \"O\"],\n [2, \"O\"],\n [3, \"O\"],\n [4, \"O\"],\n [19, \"B\", 5, \"A\"],\n [15, \"B\", 6, \"A\"],\n [16, \"B\", 7, \"A\"],\n [17, \"B\", 8, \"A\"],\n [18, \"B\", 9, \"A\"],\n ];\n /***edges AB to OB***** rotation about B*/\n for (let f = 0; f < 20; f++) {\n //f current face\n verts = this.IDATA.face[f];\n O = verts[2];\n A = verts[1];\n B = verts[0];\n isoId = oVec.x + \"|\" + oVec.y;\n idx = f + \"|\" + isoId;\n if (!(idx in vecToidx)) {\n vecToidx[idx] = O;\n closestTo[O] = [verts[vDist[isoId][0]], vDist[isoId][1]];\n }\n isoId = aVec.x + \"|\" + aVec.y;\n idx = f + \"|\" + isoId;\n if (!(idx in vecToidx)) {\n vecToidx[idx] = A;\n closestTo[A] = [verts[vDist[isoId][0]], vDist[isoId][1]];\n }\n isoId = bVec.x + \"|\" + bVec.y;\n idx = f + \"|\" + isoId;\n if (!(idx in vecToidx)) {\n vecToidx[idx] = B;\n closestTo[B] = [verts[vDist[isoId][0]], vDist[isoId][1]];\n }\n //for edge vertices\n fr = this.IDATA.edgematch[f][0];\n rot = this.IDATA.edgematch[f][1];\n if (rot === \"B\") {\n for (let i = 1; i < g; i++) {\n abVec.x = m - i * (m1 + n1);\n abVec.y = n + i * m1;\n obVec.x = -i * n1;\n obVec.y = i * (m1 + n1);\n isoId = abVec.x + \"|\" + abVec.y;\n isoIdR = obVec.x + \"|\" + obVec.y;\n matchIdx(f, fr, isoId, isoIdR);\n }\n }\n if (rot === \"O\") {\n for (let i = 1; i < g; i++) {\n obVec.x = -i * n1;\n obVec.y = i * (m1 + n1);\n oaVec.x = i * m1;\n oaVec.y = i * n1;\n isoId = obVec.x + \"|\" + obVec.y;\n isoIdR = oaVec.x + \"|\" + oaVec.y;\n matchIdx(f, fr, isoId, isoIdR);\n }\n }\n fr = this.IDATA.edgematch[f][2];\n rot = this.IDATA.edgematch[f][3];\n if (rot && rot === \"A\") {\n for (let i = 1; i < g; i++) {\n oaVec.x = i * m1;\n oaVec.y = i * n1;\n abVec.x = m - (g - i) * (m1 + n1); //reversed for BA\n abVec.y = n + (g - i) * m1; //reversed for BA\n isoId = oaVec.x + \"|\" + oaVec.y;\n isoIdR = abVec.x + \"|\" + abVec.y;\n matchIdx(f, fr, isoId, isoIdR);\n }\n }\n for (let i = 0; i < this.vertices.length; i++) {\n isoId = this.vertices[i].x + \"|\" + this.vertices[i].y;\n idx = f + \"|\" + isoId;\n if (!(idx in vecToidx)) {\n vecToidx[idx] = indexCount++;\n if (vDist[isoId][0] > 2) {\n closestTo[vecToidx[idx]] = [-vDist[isoId][0], vDist[isoId][1], vecToidx[idx]];\n }\n else {\n closestTo[vecToidx[idx]] = [verts[vDist[isoId][0]], vDist[isoId][1], vecToidx[idx]];\n }\n }\n }\n }\n this.closestTo = closestTo;\n this.vecToidx = vecToidx;\n }\n calcCoeffs() {\n const m = this.m;\n const n = this.n;\n const thirdR3 = Math.sqrt(3) / 3;\n const LSQD = m * m + n * n + m * n;\n this.coau = (m + n) / LSQD;\n this.cobu = -n / LSQD;\n this.coav = (-thirdR3 * (m - n)) / LSQD;\n this.cobv = (thirdR3 * (2 * m + n)) / LSQD;\n }\n createInnerFacets() {\n const m = this.m;\n const n = this.n;\n for (let y = 0; y < n + m + 1; y++) {\n for (let x = this.min[y]; x < this.max[y] + 1; x++) {\n if (x < this.max[y] && x < this.max[y + 1] + 1) {\n this.innerFacets.push([\"|\" + x + \"|\" + y, \"|\" + x + \"|\" + (y + 1), \"|\" + (x + 1) + \"|\" + y]);\n }\n if (y > 0 && x < this.max[y - 1] && x + 1 < this.max[y] + 1) {\n this.innerFacets.push([\"|\" + x + \"|\" + y, \"|\" + (x + 1) + \"|\" + y, \"|\" + (x + 1) + \"|\" + (y - 1)]);\n }\n }\n }\n }\n edgeVecsABOB() {\n const m = this.m;\n const n = this.n;\n const B = new _IsoVector(-n, m + n);\n for (let y = 1; y < m + n; y++) {\n const point = new _IsoVector(this.min[y], y);\n const prev = new _IsoVector(this.min[y - 1], y - 1);\n const next = new _IsoVector(this.min[y + 1], y + 1);\n const pointR = point.clone();\n const prevR = prev.clone();\n const nextR = next.clone();\n pointR.rotate60About(B);\n prevR.rotate60About(B);\n nextR.rotate60About(B);\n const maxPoint = new _IsoVector(this.max[pointR.y], pointR.y);\n const maxPrev = new _IsoVector(this.max[pointR.y - 1], pointR.y - 1);\n const maxLeftPrev = new _IsoVector(this.max[pointR.y - 1] - 1, pointR.y - 1);\n if (pointR.x !== maxPoint.x || pointR.y !== maxPoint.y) {\n if (pointR.x !== maxPrev.x) {\n // type2\n //up\n this.vertexTypes.push([1, 0, 0]);\n this.isoVecsABOB.push([point, maxPrev, maxLeftPrev]);\n //down\n this.vertexTypes.push([1, 0, 0]);\n this.isoVecsABOB.push([point, maxLeftPrev, maxPoint]);\n }\n else if (pointR.y === nextR.y) {\n // type1\n //up\n this.vertexTypes.push([1, 1, 0]);\n this.isoVecsABOB.push([point, prev, maxPrev]);\n //down\n this.vertexTypes.push([1, 0, 1]);\n this.isoVecsABOB.push([point, maxPrev, next]);\n }\n else {\n // type 0\n //up\n this.vertexTypes.push([1, 1, 0]);\n this.isoVecsABOB.push([point, prev, maxPrev]);\n //down\n this.vertexTypes.push([1, 0, 0]);\n this.isoVecsABOB.push([point, maxPrev, maxPoint]);\n }\n }\n }\n }\n mapABOBtoOBOA() {\n const point = new _IsoVector(0, 0);\n for (let i = 0; i < this.isoVecsABOB.length; i++) {\n const temp = [];\n for (let j = 0; j < 3; j++) {\n point.x = this.isoVecsABOB[i][j].x;\n point.y = this.isoVecsABOB[i][j].y;\n if (this.vertexTypes[i][j] === 0) {\n point.rotateNeg120(this.m, this.n);\n }\n temp.push(point.clone());\n }\n this.isoVecsOBOA.push(temp);\n }\n }\n mapABOBtoBAOA() {\n const point = new _IsoVector(0, 0);\n for (let i = 0; i < this.isoVecsABOB.length; i++) {\n const temp = [];\n for (let j = 0; j < 3; j++) {\n point.x = this.isoVecsABOB[i][j].x;\n point.y = this.isoVecsABOB[i][j].y;\n if (this.vertexTypes[i][j] === 1) {\n point.rotate120(this.m, this.n);\n }\n temp.push(point.clone());\n }\n this.isoVecsBAOA.push(temp);\n }\n }\n // eslint-disable-next-line @typescript-eslint/naming-convention\n MapToFace(faceNb, geodesicData) {\n const F = this.IDATA.face[faceNb];\n const oidx = F[2];\n const aidx = F[1];\n const bidx = F[0];\n const O = Vector3.FromArray(this.IDATA.vertex[oidx]);\n const A = Vector3.FromArray(this.IDATA.vertex[aidx]);\n const B = Vector3.FromArray(this.IDATA.vertex[bidx]);\n const OA = A.subtract(O);\n const OB = B.subtract(O);\n const x = OA.scale(this.coau).add(OB.scale(this.cobu));\n const y = OA.scale(this.coav).add(OB.scale(this.cobv));\n const mapped = [];\n let idx;\n let tempVec = TmpVectors.Vector3[0];\n for (let i = 0; i < this.cartesian.length; i++) {\n tempVec = x.scale(this.cartesian[i].x).add(y.scale(this.cartesian[i].y)).add(O);\n mapped[i] = [tempVec.x, tempVec.y, tempVec.z];\n idx = faceNb + \"|\" + this.vertices[i].x + \"|\" + this.vertices[i].y;\n geodesicData.vertex[this.vecToidx[idx]] = [tempVec.x, tempVec.y, tempVec.z];\n }\n }\n //statics\n /**Creates a primary triangle\n * @internal\n */\n build(m, n) {\n const vertices = new Array();\n const O = _IsoVector.Zero();\n const A = new _IsoVector(m, n);\n const B = new _IsoVector(-n, m + n);\n vertices.push(O, A, B);\n //max internal isoceles triangle vertices\n for (let y = n; y < m + 1; y++) {\n for (let x = 0; x < m + 1 - y; x++) {\n vertices.push(new _IsoVector(x, y));\n }\n }\n //shared vertices along edges when needed\n if (n > 0) {\n const g = Scalar.HCF(m, n);\n const m1 = m / g;\n const n1 = n / g;\n for (let i = 1; i < g; i++) {\n vertices.push(new _IsoVector(i * m1, i * n1)); //OA\n vertices.push(new _IsoVector(-i * n1, i * (m1 + n1))); //OB\n vertices.push(new _IsoVector(m - i * (m1 + n1), n + i * m1)); // AB\n }\n //lower rows vertices and their rotations\n const ratio = m / n;\n for (let y = 1; y < n; y++) {\n for (let x = 0; x < y * ratio; x++) {\n vertices.push(new _IsoVector(x, y));\n vertices.push(new _IsoVector(x, y).rotate120(m, n));\n vertices.push(new _IsoVector(x, y).rotateNeg120(m, n));\n }\n }\n }\n //order vertices by x and then y\n vertices.sort((a, b) => {\n return a.x - b.x;\n });\n vertices.sort((a, b) => {\n return a.y - b.y;\n });\n const min = new Array(m + n + 1);\n const max = new Array(m + n + 1);\n for (let i = 0; i < min.length; i++) {\n min[i] = Infinity;\n max[i] = -Infinity;\n }\n let y = 0;\n let x = 0;\n const len = vertices.length;\n for (let i = 0; i < len; i++) {\n x = vertices[i].x;\n y = vertices[i].y;\n min[y] = Math.min(x, min[y]);\n max[y] = Math.max(x, max[y]);\n }\n //calculates the distance of a vertex from a given primary vertex\n const distFrom = (vert, primVert) => {\n const v = vert.clone();\n if (primVert === \"A\") {\n v.rotateNeg120(m, n);\n }\n if (primVert === \"B\") {\n v.rotate120(m, n);\n }\n if (v.x < 0) {\n return v.y;\n }\n return v.x + v.y;\n };\n const cartesian = [];\n const distFromO = [];\n const distFromA = [];\n const distFromB = [];\n const vertByDist = {};\n const vertData = [];\n let closest = -1;\n let dist = -1;\n for (let i = 0; i < len; i++) {\n cartesian[i] = vertices[i].toCartesianOrigin(new _IsoVector(0, 0), 0.5);\n distFromO[i] = distFrom(vertices[i], \"O\");\n distFromA[i] = distFrom(vertices[i], \"A\");\n distFromB[i] = distFrom(vertices[i], \"B\");\n if (distFromO[i] === distFromA[i] && distFromA[i] === distFromB[i]) {\n closest = 3;\n dist = distFromO[i];\n }\n else if (distFromO[i] === distFromA[i]) {\n closest = 4;\n dist = distFromO[i];\n }\n else if (distFromA[i] === distFromB[i]) {\n closest = 5;\n dist = distFromA[i];\n }\n else if (distFromB[i] === distFromO[i]) {\n closest = 6;\n dist = distFromO[i];\n }\n if (distFromO[i] < distFromA[i] && distFromO[i] < distFromB[i]) {\n closest = 2;\n dist = distFromO[i];\n }\n if (distFromA[i] < distFromO[i] && distFromA[i] < distFromB[i]) {\n closest = 1;\n dist = distFromA[i];\n }\n if (distFromB[i] < distFromA[i] && distFromB[i] < distFromO[i]) {\n closest = 0;\n dist = distFromB[i];\n }\n vertData.push([closest, dist, vertices[i].x, vertices[i].y]);\n }\n vertData.sort((a, b) => {\n return a[2] - b[2];\n });\n vertData.sort((a, b) => {\n return a[3] - b[3];\n });\n vertData.sort((a, b) => {\n return a[1] - b[1];\n });\n vertData.sort((a, b) => {\n return a[0] - b[0];\n });\n for (let v = 0; v < vertData.length; v++) {\n vertByDist[vertData[v][2] + \"|\" + vertData[v][3]] = [vertData[v][0], vertData[v][1], v];\n }\n this.m = m;\n this.n = n;\n this.vertices = vertices;\n this.vertByDist = vertByDist;\n this.cartesian = cartesian;\n this.min = min;\n this.max = max;\n return this;\n }\n}\n/** Builds Polyhedron Data\n * @internal\n */\nexport class PolyhedronData {\n constructor(name, category, vertex, face) {\n this.name = name;\n this.category = category;\n this.vertex = vertex;\n this.face = face;\n }\n}\n/**\n * This class Extends the PolyhedronData Class to provide measures for a Geodesic Polyhedron\n */\nexport class GeodesicData extends PolyhedronData {\n /**\n * @internal\n */\n innerToData(face, primTri) {\n for (let i = 0; i < primTri.innerFacets.length; i++) {\n this.face.push(primTri.innerFacets[i].map((el) => primTri.vecToidx[face + el]));\n }\n }\n /**\n * @internal\n */\n mapABOBtoDATA(faceNb, primTri) {\n const fr = primTri.IDATA.edgematch[faceNb][0];\n for (let i = 0; i < primTri.isoVecsABOB.length; i++) {\n const temp = [];\n for (let j = 0; j < 3; j++) {\n if (primTri.vertexTypes[i][j] === 0) {\n temp.push(faceNb + \"|\" + primTri.isoVecsABOB[i][j].x + \"|\" + primTri.isoVecsABOB[i][j].y);\n }\n else {\n temp.push(fr + \"|\" + primTri.isoVecsABOB[i][j].x + \"|\" + primTri.isoVecsABOB[i][j].y);\n }\n }\n this.face.push([primTri.vecToidx[temp[0]], primTri.vecToidx[temp[1]], primTri.vecToidx[temp[2]]]);\n }\n }\n /**\n * @internal\n */\n mapOBOAtoDATA(faceNb, primTri) {\n const fr = primTri.IDATA.edgematch[faceNb][0];\n for (let i = 0; i < primTri.isoVecsOBOA.length; i++) {\n const temp = [];\n for (let j = 0; j < 3; j++) {\n if (primTri.vertexTypes[i][j] === 1) {\n temp.push(faceNb + \"|\" + primTri.isoVecsOBOA[i][j].x + \"|\" + primTri.isoVecsOBOA[i][j].y);\n }\n else {\n temp.push(fr + \"|\" + primTri.isoVecsOBOA[i][j].x + \"|\" + primTri.isoVecsOBOA[i][j].y);\n }\n }\n this.face.push([primTri.vecToidx[temp[0]], primTri.vecToidx[temp[1]], primTri.vecToidx[temp[2]]]);\n }\n }\n /**\n * @internal\n */\n mapBAOAtoDATA(faceNb, primTri) {\n const fr = primTri.IDATA.edgematch[faceNb][2];\n for (let i = 0; i < primTri.isoVecsBAOA.length; i++) {\n const temp = [];\n for (let j = 0; j < 3; j++) {\n if (primTri.vertexTypes[i][j] === 1) {\n temp.push(faceNb + \"|\" + primTri.isoVecsBAOA[i][j].x + \"|\" + primTri.isoVecsBAOA[i][j].y);\n }\n else {\n temp.push(fr + \"|\" + primTri.isoVecsBAOA[i][j].x + \"|\" + primTri.isoVecsBAOA[i][j].y);\n }\n }\n this.face.push([primTri.vecToidx[temp[0]], primTri.vecToidx[temp[1]], primTri.vecToidx[temp[2]]]);\n }\n }\n /**\n * @internal\n */\n orderData(primTri) {\n const nearTo = [];\n for (let i = 0; i < 13; i++) {\n nearTo[i] = [];\n }\n const close = primTri.closestTo;\n for (let i = 0; i < close.length; i++) {\n if (close[i][0] > -1) {\n if (close[i][1] > 0) {\n nearTo[close[i][0]].push([i, close[i][1]]);\n }\n }\n else {\n nearTo[12].push([i, close[i][0]]);\n }\n }\n const near = [];\n for (let i = 0; i < 12; i++) {\n near[i] = i;\n }\n let nearIndex = 12;\n for (let i = 0; i < 12; i++) {\n nearTo[i].sort((a, b) => {\n return a[1] - b[1];\n });\n for (let j = 0; j < nearTo[i].length; j++) {\n near[nearTo[i][j][0]] = nearIndex++;\n }\n }\n for (let j = 0; j < nearTo[12].length; j++) {\n near[nearTo[12][j][0]] = nearIndex++;\n }\n for (let i = 0; i < this.vertex.length; i++) {\n this.vertex[i].push(near[i]);\n }\n this.vertex.sort((a, b) => {\n return a[3] - b[3];\n });\n for (let i = 0; i < this.vertex.length; i++) {\n this.vertex[i].pop();\n }\n for (let i = 0; i < this.face.length; i++) {\n for (let j = 0; j < this.face[i].length; j++) {\n this.face[i][j] = near[this.face[i][j]];\n }\n }\n this.sharedNodes = nearTo[12].length;\n this.poleNodes = this.vertex.length - this.sharedNodes;\n }\n /**\n * @internal\n */\n setOrder(m, faces) {\n const adjVerts = [];\n const dualFaces = [];\n let face = faces.pop();\n dualFaces.push(face);\n let index = this.face[face].indexOf(m);\n index = (index + 2) % 3;\n let v = this.face[face][index];\n adjVerts.push(v);\n let f = 0;\n while (faces.length > 0) {\n face = faces[f];\n if (this.face[face].indexOf(v) > -1) {\n // v is a vertex of face f\n index = (this.face[face].indexOf(v) + 1) % 3;\n v = this.face[face][index];\n adjVerts.push(v);\n dualFaces.push(face);\n faces.splice(f, 1);\n f = 0;\n }\n else {\n f++;\n }\n }\n this.adjacentFaces.push(adjVerts);\n return dualFaces;\n }\n /**\n * @internal\n */\n toGoldbergPolyhedronData() {\n const goldbergPolyhedronData = new PolyhedronData(\"GeoDual\", \"Goldberg\", [], []);\n goldbergPolyhedronData.name = \"GD dual\";\n const verticesNb = this.vertex.length;\n const map = new Array(verticesNb);\n for (let v = 0; v < verticesNb; v++) {\n map[v] = [];\n }\n for (let f = 0; f < this.face.length; f++) {\n for (let i = 0; i < 3; i++) {\n map[this.face[f][i]].push(f);\n }\n }\n let cx = 0;\n let cy = 0;\n let cz = 0;\n let face = [];\n let vertex = [];\n this.adjacentFaces = [];\n for (let m = 0; m < map.length; m++) {\n goldbergPolyhedronData.face[m] = this.setOrder(m, map[m].concat([]));\n map[m].forEach((el) => {\n cx = 0;\n cy = 0;\n cz = 0;\n face = this.face[el];\n for (let i = 0; i < 3; i++) {\n vertex = this.vertex[face[i]];\n cx += vertex[0];\n cy += vertex[1];\n cz += vertex[2];\n }\n goldbergPolyhedronData.vertex[el] = [cx / 3, cy / 3, cz / 3];\n });\n }\n return goldbergPolyhedronData;\n }\n //statics\n /**Builds the data for a Geodesic Polyhedron from a primary triangle\n * @param primTri the primary triangle\n * @internal\n */\n static BuildGeodesicData(primTri) {\n const geodesicData = new GeodesicData(\"Geodesic-m-n\", \"Geodesic\", [\n [0, PHI, -1],\n [-PHI, 1, 0],\n [-1, 0, -PHI],\n [1, 0, -PHI],\n [PHI, 1, 0],\n [0, PHI, 1],\n [-1, 0, PHI],\n [-PHI, -1, 0],\n [0, -PHI, -1],\n [PHI, -1, 0],\n [1, 0, PHI],\n [0, -PHI, 1],\n ], []);\n primTri.setIndices();\n primTri.calcCoeffs();\n primTri.createInnerFacets();\n primTri.edgeVecsABOB();\n primTri.mapABOBtoOBOA();\n primTri.mapABOBtoBAOA();\n for (let f = 0; f < primTri.IDATA.face.length; f++) {\n primTri.MapToFace(f, geodesicData);\n geodesicData.innerToData(f, primTri);\n if (primTri.IDATA.edgematch[f][1] === \"B\") {\n geodesicData.mapABOBtoDATA(f, primTri);\n }\n if (primTri.IDATA.edgematch[f][1] === \"O\") {\n geodesicData.mapOBOAtoDATA(f, primTri);\n }\n if (primTri.IDATA.edgematch[f][3] === \"A\") {\n geodesicData.mapBAOAtoDATA(f, primTri);\n }\n }\n geodesicData.orderData(primTri);\n const radius = 1;\n geodesicData.vertex = geodesicData.vertex.map(function (el) {\n const a = el[0];\n const b = el[1];\n const c = el[2];\n const d = Math.sqrt(a * a + b * b + c * c);\n el[0] *= radius / d;\n el[1] *= radius / d;\n el[2] *= radius / d;\n return el;\n });\n return geodesicData;\n }\n}\n//# sourceMappingURL=geodesicMesh.js.map","import { CreatePolyhedron } from \"./polyhedronBuilder.js\";\nimport { Logger } from \"../../Misc/logger.js\";\nimport { _PrimaryIsoTriangle, GeodesicData } from \"../geodesicMesh.js\";\n/**\n * Creates the Mesh for a Geodesic Polyhedron\n * @see https://en.wikipedia.org/wiki/Geodesic_polyhedron\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/polyhedra/geodesic_poly\n * @param name defines the name of the mesh\n * @param options an object used to set the following optional parameters for the polyhedron, required but can be empty\n * * m number of horizontal steps along an isogrid\n * * n number of angled steps along an isogrid\n * * size the size of the Geodesic, optional default 1\n * * sizeX allows stretching in the x direction, optional, default size\n * * sizeY allows stretching in the y direction, optional, default size\n * * sizeZ allows stretching in the z direction, optional, default size\n * * faceUV an array of Vector4 elements used to set different images to the top, rings and bottom respectively\n * * faceColors an array of Color3 elements used to set different colors to the top, rings and bottom respectively\n * * flat when true creates a flat shaded mesh, optional, default true\n * * subdivisions increasing the subdivisions increases the number of faces, optional, default 4\n * * sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE\n * * frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)\n * * backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)\n * @param options.n\n * @param options.size\n * @param options.sizeX\n * @param options.sizeY\n * @param options.sizeZ\n * @param options.faceUV\n * @param options.faceColors\n * @param options.flat\n * @param options.updatable\n * @param options.sideOrientation\n * @param options.frontUVs\n * @param options.backUVs\n * @param options.m\n * @param scene defines the hosting scene\n * @returns Geodesic mesh\n */\nexport function CreateGeodesic(name, options, scene = null) {\n let m = options.m || 1;\n if (m !== Math.floor(m)) {\n m === Math.floor(m);\n Logger.Warn(\"m not an integer only floor(m) used\");\n }\n let n = options.n || 0;\n if (n !== Math.floor(n)) {\n n === Math.floor(n);\n Logger.Warn(\"n not an integer only floor(n) used\");\n }\n if (n > m) {\n const temp = n;\n n = m;\n m = temp;\n Logger.Warn(\"n > m therefore m and n swapped\");\n }\n const primTri = new _PrimaryIsoTriangle();\n primTri.build(m, n);\n const geodesicData = GeodesicData.BuildGeodesicData(primTri);\n const geoOptions = {\n custom: geodesicData,\n size: options.size,\n sizeX: options.sizeX,\n sizeY: options.sizeY,\n sizeZ: options.sizeZ,\n faceUV: options.faceUV,\n faceColors: options.faceColors,\n flat: options.flat,\n updatable: options.updatable,\n sideOrientation: options.sideOrientation,\n frontUVs: options.frontUVs,\n backUVs: options.backUVs,\n };\n const geodesic = CreatePolyhedron(name, geoOptions, scene);\n return geodesic;\n}\n//# sourceMappingURL=geodesicBuilder.js.map","import { Vector3 } from \"../Maths/math.vector.js\";\nimport { VertexBuffer } from \"../Buffers/buffer.js\";\nimport { Mesh } from \"../Meshes/mesh.js\";\nimport { Color4 } from \"../Maths/math.color.js\";\nimport { Logger } from \"../Misc/logger.js\";\nMesh._GoldbergMeshParser = (parsedMesh, scene) => {\n return GoldbergMesh.Parse(parsedMesh, scene);\n};\n/**\n * Mesh for a Goldberg Polyhedron which is made from 12 pentagonal and the rest hexagonal faces\n * @see https://en.wikipedia.org/wiki/Goldberg_polyhedron\n */\nexport class GoldbergMesh extends Mesh {\n constructor() {\n super(...arguments);\n /**\n * Defines the specific Goldberg data used in this mesh construction.\n */\n this.goldbergData = {\n faceColors: [],\n faceCenters: [],\n faceZaxis: [],\n faceXaxis: [],\n faceYaxis: [],\n nbSharedFaces: 0,\n nbUnsharedFaces: 0,\n nbFaces: 0,\n nbFacesAtPole: 0,\n adjacentFaces: [],\n };\n }\n /**\n * Gets the related Goldberg face from pole infos\n * @param poleOrShared Defines the pole index or the shared face index if the fromPole parameter is passed in\n * @param fromPole Defines an optional pole index to find the related info from\n * @returns the goldberg face number\n */\n relatedGoldbergFace(poleOrShared, fromPole) {\n if (fromPole === void 0) {\n if (poleOrShared > this.goldbergData.nbUnsharedFaces - 1) {\n Logger.Warn(\"Maximum number of unshared faces used\");\n poleOrShared = this.goldbergData.nbUnsharedFaces - 1;\n }\n return this.goldbergData.nbUnsharedFaces + poleOrShared;\n }\n if (poleOrShared > 11) {\n Logger.Warn(\"Last pole used\");\n poleOrShared = 11;\n }\n if (fromPole > this.goldbergData.nbFacesAtPole - 1) {\n Logger.Warn(\"Maximum number of faces at a pole used\");\n fromPole = this.goldbergData.nbFacesAtPole - 1;\n }\n return 12 + poleOrShared * this.goldbergData.nbFacesAtPole + fromPole;\n }\n _changeGoldbergFaceColors(colorRange) {\n for (let i = 0; i < colorRange.length; i++) {\n const min = colorRange[i][0];\n const max = colorRange[i][1];\n const col = colorRange[i][2];\n for (let f = min; f < max + 1; f++) {\n this.goldbergData.faceColors[f] = col;\n }\n }\n const newCols = [];\n for (let f = 0; f < 12; f++) {\n for (let i = 0; i < 5; i++) {\n newCols.push(this.goldbergData.faceColors[f].r, this.goldbergData.faceColors[f].g, this.goldbergData.faceColors[f].b, this.goldbergData.faceColors[f].a);\n }\n }\n for (let f = 12; f < this.goldbergData.faceColors.length; f++) {\n for (let i = 0; i < 6; i++) {\n newCols.push(this.goldbergData.faceColors[f].r, this.goldbergData.faceColors[f].g, this.goldbergData.faceColors[f].b, this.goldbergData.faceColors[f].a);\n }\n }\n return newCols;\n }\n /**\n * Set new goldberg face colors\n * @param colorRange the new color to apply to the mesh\n */\n setGoldbergFaceColors(colorRange) {\n const newCols = this._changeGoldbergFaceColors(colorRange);\n this.setVerticesData(VertexBuffer.ColorKind, newCols);\n }\n /**\n * Updates new goldberg face colors\n * @param colorRange the new color to apply to the mesh\n */\n updateGoldbergFaceColors(colorRange) {\n const newCols = this._changeGoldbergFaceColors(colorRange);\n this.updateVerticesData(VertexBuffer.ColorKind, newCols);\n }\n _changeGoldbergFaceUVs(uvRange) {\n const uvs = this.getVerticesData(VertexBuffer.UVKind);\n for (let i = 0; i < uvRange.length; i++) {\n const min = uvRange[i][0];\n const max = uvRange[i][1];\n const center = uvRange[i][2];\n const radius = uvRange[i][3];\n const angle = uvRange[i][4];\n const points5 = [];\n const points6 = [];\n let u;\n let v;\n for (let p = 0; p < 5; p++) {\n u = center.x + radius * Math.cos(angle + (p * Math.PI) / 2.5);\n v = center.y + radius * Math.sin(angle + (p * Math.PI) / 2.5);\n if (u < 0) {\n u = 0;\n }\n if (u > 1) {\n u = 1;\n }\n points5.push(u, v);\n }\n for (let p = 0; p < 6; p++) {\n u = center.x + radius * Math.cos(angle + (p * Math.PI) / 3);\n v = center.y + radius * Math.sin(angle + (p * Math.PI) / 3);\n if (u < 0) {\n u = 0;\n }\n if (u > 1) {\n u = 1;\n }\n points6.push(u, v);\n }\n for (let f = min; f < Math.min(12, max + 1); f++) {\n for (let p = 0; p < 5; p++) {\n uvs[10 * f + 2 * p] = points5[2 * p];\n uvs[10 * f + 2 * p + 1] = points5[2 * p + 1];\n }\n }\n for (let f = Math.max(12, min); f < max + 1; f++) {\n for (let p = 0; p < 6; p++) {\n //120 + 12 * (f - 12) = 12 * f - 24\n uvs[12 * f - 24 + 2 * p] = points6[2 * p];\n uvs[12 * f - 23 + 2 * p] = points6[2 * p + 1];\n }\n }\n }\n return uvs;\n }\n /**\n * set new goldberg face UVs\n * @param uvRange the new UVs to apply to the mesh\n */\n setGoldbergFaceUVs(uvRange) {\n const newUVs = this._changeGoldbergFaceUVs(uvRange);\n this.setVerticesData(VertexBuffer.UVKind, newUVs);\n }\n /**\n * Updates new goldberg face UVs\n * @param uvRange the new UVs to apply to the mesh\n */\n updateGoldbergFaceUVs(uvRange) {\n const newUVs = this._changeGoldbergFaceUVs(uvRange);\n this.updateVerticesData(VertexBuffer.UVKind, newUVs);\n }\n /**\n * Places a mesh on a particular face of the goldberg polygon\n * @param mesh Defines the mesh to position\n * @param face Defines the face to position onto\n * @param position Defines the position relative to the face we are positioning the mesh onto\n */\n placeOnGoldbergFaceAt(mesh, face, position) {\n const orientation = Vector3.RotationFromAxis(this.goldbergData.faceXaxis[face], this.goldbergData.faceYaxis[face], this.goldbergData.faceZaxis[face]);\n mesh.rotation = orientation;\n mesh.position = this.goldbergData.faceCenters[face]\n .add(this.goldbergData.faceXaxis[face].scale(position.x))\n .add(this.goldbergData.faceYaxis[face].scale(position.y))\n .add(this.goldbergData.faceZaxis[face].scale(position.z));\n }\n /**\n * Serialize current mesh\n * @param serializationObject defines the object which will receive the serialization data\n */\n serialize(serializationObject) {\n super.serialize(serializationObject);\n serializationObject.type = \"GoldbergMesh\";\n const goldbergData = {};\n goldbergData.adjacentFaces = this.goldbergData.adjacentFaces;\n goldbergData.nbSharedFaces = this.goldbergData.nbSharedFaces;\n goldbergData.nbUnsharedFaces = this.goldbergData.nbUnsharedFaces;\n goldbergData.nbFaces = this.goldbergData.nbFaces;\n goldbergData.nbFacesAtPole = this.goldbergData.nbFacesAtPole;\n if (this.goldbergData.faceColors) {\n goldbergData.faceColors = [];\n for (const color of this.goldbergData.faceColors) {\n goldbergData.faceColors.push(color.asArray());\n }\n }\n if (this.goldbergData.faceCenters) {\n goldbergData.faceCenters = [];\n for (const vector of this.goldbergData.faceCenters) {\n goldbergData.faceCenters.push(vector.asArray());\n }\n }\n if (this.goldbergData.faceZaxis) {\n goldbergData.faceZaxis = [];\n for (const vector of this.goldbergData.faceZaxis) {\n goldbergData.faceZaxis.push(vector.asArray());\n }\n }\n if (this.goldbergData.faceYaxis) {\n goldbergData.faceYaxis = [];\n for (const vector of this.goldbergData.faceYaxis) {\n goldbergData.faceYaxis.push(vector.asArray());\n }\n }\n if (this.goldbergData.faceXaxis) {\n goldbergData.faceXaxis = [];\n for (const vector of this.goldbergData.faceXaxis) {\n goldbergData.faceXaxis.push(vector.asArray());\n }\n }\n serializationObject.goldbergData = goldbergData;\n }\n /**\n * Parses a serialized goldberg mesh\n * @param parsedMesh the serialized mesh\n * @param scene the scene to create the goldberg mesh in\n * @returns the created goldberg mesh\n */\n static Parse(parsedMesh, scene) {\n const goldbergData = parsedMesh.goldbergData;\n goldbergData.faceColors = goldbergData.faceColors.map((el) => Color4.FromArray(el));\n goldbergData.faceCenters = goldbergData.faceCenters.map((el) => Vector3.FromArray(el));\n goldbergData.faceZaxis = goldbergData.faceZaxis.map((el) => Vector3.FromArray(el));\n goldbergData.faceXaxis = goldbergData.faceXaxis.map((el) => Vector3.FromArray(el));\n goldbergData.faceYaxis = goldbergData.faceYaxis.map((el) => Vector3.FromArray(el));\n const goldberg = new GoldbergMesh(parsedMesh.name, scene);\n goldberg.goldbergData = goldbergData;\n return goldberg;\n }\n}\n//# sourceMappingURL=goldbergMesh.js.map","import { Vector3 } from \"../../Maths/math.vector.js\";\nimport { Color4 } from \"../../Maths/math.color.js\";\nimport { Mesh } from \"../../Meshes/mesh.js\";\nimport { VertexData } from \"../mesh.vertexData.js\";\nimport { Logger } from \"../../Misc/logger.js\";\nimport { _PrimaryIsoTriangle, GeodesicData } from \"../geodesicMesh.js\";\nimport { GoldbergMesh } from \"../goldbergMesh.js\";\nimport { CompatibilityOptions } from \"../../Compat/compatibilityOptions.js\";\n/**\n * Creates the Mesh for a Goldberg Polyhedron\n * @param options an object used to set the following optional parameters for the polyhedron, required but can be empty\n * @param goldbergData polyhedronData defining the Goldberg polyhedron\n * @returns GoldbergSphere mesh\n */\nexport function CreateGoldbergVertexData(options, goldbergData) {\n const size = options.size;\n const sizeX = options.sizeX || size || 1;\n const sizeY = options.sizeY || size || 1;\n const sizeZ = options.sizeZ || size || 1;\n const sideOrientation = options.sideOrientation === 0 ? 0 : options.sideOrientation || VertexData.DEFAULTSIDE;\n const positions = new Array();\n const indices = new Array();\n const normals = new Array();\n const uvs = new Array();\n let minX = Infinity;\n let maxX = -Infinity;\n let minY = Infinity;\n let maxY = -Infinity;\n for (let v = 0; v < goldbergData.vertex.length; v++) {\n minX = Math.min(minX, goldbergData.vertex[v][0] * sizeX);\n maxX = Math.max(maxX, goldbergData.vertex[v][0] * sizeX);\n minY = Math.min(minY, goldbergData.vertex[v][1] * sizeY);\n maxY = Math.max(maxY, goldbergData.vertex[v][1] * sizeY);\n }\n let index = 0;\n for (let f = 0; f < goldbergData.face.length; f++) {\n const verts = goldbergData.face[f];\n const a = Vector3.FromArray(goldbergData.vertex[verts[0]]);\n const b = Vector3.FromArray(goldbergData.vertex[verts[2]]);\n const c = Vector3.FromArray(goldbergData.vertex[verts[1]]);\n const ba = b.subtract(a);\n const ca = c.subtract(a);\n const norm = Vector3.Cross(ca, ba).normalize();\n for (let v = 0; v < verts.length; v++) {\n normals.push(norm.x, norm.y, norm.z);\n const pdata = goldbergData.vertex[verts[v]];\n positions.push(pdata[0] * sizeX, pdata[1] * sizeY, pdata[2] * sizeZ);\n const vCoord = (pdata[1] * sizeY - minY) / (maxY - minY);\n uvs.push((pdata[0] * sizeX - minX) / (maxX - minX), CompatibilityOptions.UseOpenGLOrientationForUV ? 1 - vCoord : vCoord);\n }\n for (let v = 0; v < verts.length - 2; v++) {\n indices.push(index, index + v + 2, index + v + 1);\n }\n index += verts.length;\n }\n VertexData._ComputeSides(sideOrientation, positions, indices, normals, uvs);\n const vertexData = new VertexData();\n vertexData.positions = positions;\n vertexData.indices = indices;\n vertexData.normals = normals;\n vertexData.uvs = uvs;\n return vertexData;\n}\n/**\n * Creates the Mesh for a Goldberg Polyhedron which is made from 12 pentagonal and the rest hexagonal faces\n * @see https://en.wikipedia.org/wiki/Goldberg_polyhedron\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/polyhedra/goldberg_poly\n * @param name defines the name of the mesh\n * @param options an object used to set the following optional parameters for the polyhedron, required but can be empty\n * @param scene defines the hosting scene\n * @returns Goldberg mesh\n */\nexport function CreateGoldberg(name, options, scene = null) {\n const size = options.size;\n const sizeX = options.sizeX || size || 1;\n const sizeY = options.sizeY || size || 1;\n const sizeZ = options.sizeZ || size || 1;\n let m = options.m || 1;\n if (m !== Math.floor(m)) {\n m === Math.floor(m);\n Logger.Warn(\"m not an integer only floor(m) used\");\n }\n let n = options.n || 0;\n if (n !== Math.floor(n)) {\n n === Math.floor(n);\n Logger.Warn(\"n not an integer only floor(n) used\");\n }\n if (n > m) {\n const temp = n;\n n = m;\n m = temp;\n Logger.Warn(\"n > m therefore m and n swapped\");\n }\n const primTri = new _PrimaryIsoTriangle();\n primTri.build(m, n);\n const geodesicData = GeodesicData.BuildGeodesicData(primTri);\n const goldbergData = geodesicData.toGoldbergPolyhedronData();\n const goldberg = new GoldbergMesh(name, scene);\n options.sideOrientation = Mesh._GetDefaultSideOrientation(options.sideOrientation);\n goldberg._originalBuilderSideOrientation = options.sideOrientation;\n const vertexData = CreateGoldbergVertexData(options, goldbergData);\n vertexData.applyToMesh(goldberg, options.updatable);\n goldberg.goldbergData.nbSharedFaces = geodesicData.sharedNodes;\n goldberg.goldbergData.nbUnsharedFaces = geodesicData.poleNodes;\n goldberg.goldbergData.adjacentFaces = geodesicData.adjacentFaces;\n goldberg.goldbergData.nbFaces = goldberg.goldbergData.nbSharedFaces + goldberg.goldbergData.nbUnsharedFaces;\n goldberg.goldbergData.nbFacesAtPole = (goldberg.goldbergData.nbUnsharedFaces - 12) / 12;\n for (let f = 0; f < geodesicData.vertex.length; f++) {\n goldberg.goldbergData.faceCenters.push(Vector3.FromArray(geodesicData.vertex[f]));\n goldberg.goldbergData.faceCenters[f].x *= sizeX;\n goldberg.goldbergData.faceCenters[f].y *= sizeY;\n goldberg.goldbergData.faceCenters[f].z *= sizeZ;\n goldberg.goldbergData.faceColors.push(new Color4(1, 1, 1, 1));\n }\n for (let f = 0; f < goldbergData.face.length; f++) {\n const verts = goldbergData.face[f];\n const a = Vector3.FromArray(goldbergData.vertex[verts[0]]);\n const b = Vector3.FromArray(goldbergData.vertex[verts[2]]);\n const c = Vector3.FromArray(goldbergData.vertex[verts[1]]);\n const ba = b.subtract(a);\n const ca = c.subtract(a);\n const norm = Vector3.Cross(ca, ba).normalize();\n const z = Vector3.Cross(ca, norm).normalize();\n goldberg.goldbergData.faceXaxis.push(ca.normalize());\n goldberg.goldbergData.faceYaxis.push(norm);\n goldberg.goldbergData.faceZaxis.push(z);\n }\n return goldberg;\n}\n//# sourceMappingURL=goldbergBuilder.js.map","import { Path2 } from \"../../Maths/math.path.js\";\nimport { Vector3 } from \"../../Maths/math.vector.js\";\nimport { Mesh } from \"../mesh.js\";\nimport { ExtrudePolygon } from \"./polygonBuilder.js\";\n// Shape functions\nclass ShapePath {\n /** Create the ShapePath used to support glyphs */\n constructor(resolution) {\n this._paths = [];\n this._tempPaths = [];\n this._holes = [];\n this._resolution = resolution;\n }\n /** Move the virtual cursor to a coordinate */\n moveTo(x, y) {\n this._currentPath = new Path2(x, y);\n this._tempPaths.push(this._currentPath);\n }\n /** Draw a line from the virtual cursor to a given coordinate */\n lineTo(x, y) {\n this._currentPath.addLineTo(x, y);\n }\n /** Create a quadratic curve from the virtual cursor to a given coordinate */\n quadraticCurveTo(cpx, cpy, x, y) {\n this._currentPath.addQuadraticCurveTo(cpx, cpy, x, y, this._resolution);\n }\n /** Create a bezier curve from the virtual cursor to a given coordinate */\n bezierCurveTo(cpx1, cpy1, cpx2, cpy2, x, y) {\n this._currentPath.addBezierCurveTo(cpx1, cpy1, cpx2, cpy2, x, y, this._resolution);\n }\n /** Extract holes based on CW / CCW */\n extractHoles() {\n for (const path of this._tempPaths) {\n if (path.area() > 0) {\n this._holes.push(path);\n }\n else {\n this._paths.push(path);\n }\n }\n if (!this._paths.length && this._holes.length) {\n const temp = this._holes;\n this._holes = this._paths;\n this._paths = temp;\n }\n this._tempPaths.length = 0;\n }\n /** Gets the list of paths */\n get paths() {\n return this._paths;\n }\n /** Gets the list of holes */\n get holes() {\n return this._holes;\n }\n}\n// Utility functions\nfunction CreateShapePath(char, scale, offsetX, offsetY, resolution, fontData) {\n const glyph = fontData.glyphs[char] || fontData.glyphs[\"?\"];\n if (!glyph) {\n // return if there is no glyph data\n return null;\n }\n const shapePath = new ShapePath(resolution);\n if (glyph.o) {\n const outline = glyph.o.split(\" \");\n for (let i = 0, l = outline.length; i < l;) {\n const action = outline[i++];\n switch (action) {\n case \"m\": {\n // moveTo\n const x = parseInt(outline[i++]) * scale + offsetX;\n const y = parseInt(outline[i++]) * scale + offsetY;\n shapePath.moveTo(x, y);\n break;\n }\n case \"l\": {\n // lineTo\n const x = parseInt(outline[i++]) * scale + offsetX;\n const y = parseInt(outline[i++]) * scale + offsetY;\n shapePath.lineTo(x, y);\n break;\n }\n case \"q\": {\n // quadraticCurveTo\n const cpx = parseInt(outline[i++]) * scale + offsetX;\n const cpy = parseInt(outline[i++]) * scale + offsetY;\n const cpx1 = parseInt(outline[i++]) * scale + offsetX;\n const cpy1 = parseInt(outline[i++]) * scale + offsetY;\n shapePath.quadraticCurveTo(cpx1, cpy1, cpx, cpy);\n break;\n }\n case \"b\": {\n // bezierCurveTo\n const cpx = parseInt(outline[i++]) * scale + offsetX;\n const cpy = parseInt(outline[i++]) * scale + offsetY;\n const cpx1 = parseInt(outline[i++]) * scale + offsetX;\n const cpy1 = parseInt(outline[i++]) * scale + offsetY;\n const cpx2 = parseInt(outline[i++]) * scale + offsetX;\n const cpy2 = parseInt(outline[i++]) * scale + offsetY;\n shapePath.bezierCurveTo(cpx1, cpy1, cpx2, cpy2, cpx, cpy);\n break;\n }\n }\n }\n }\n // Extract holes (based on clockwise data)\n shapePath.extractHoles();\n return { offsetX: glyph.ha * scale, shapePath: shapePath };\n}\n/**\n * Creates shape paths from a text and font\n * @param text the text\n * @param size size of the font\n * @param resolution resolution of the font\n * @param fontData defines the font data (can be generated with http://gero3.github.io/facetype.js/)\n * @returns array of ShapePath objects\n */\nexport function CreateTextShapePaths(text, size, resolution, fontData) {\n const chars = Array.from(text);\n const scale = size / fontData.resolution;\n const line_height = (fontData.boundingBox.yMax - fontData.boundingBox.yMin + fontData.underlineThickness) * scale;\n const shapePaths = [];\n let offsetX = 0, offsetY = 0;\n for (let i = 0; i < chars.length; i++) {\n const char = chars[i];\n if (char === \"\\n\") {\n offsetX = 0;\n offsetY -= line_height;\n }\n else {\n const ret = CreateShapePath(char, scale, offsetX, offsetY, resolution, fontData);\n if (ret) {\n offsetX += ret.offsetX;\n shapePaths.push(ret.shapePath);\n }\n }\n }\n return shapePaths;\n}\n/**\n * Create a text mesh\n * @param name defines the name of the mesh\n * @param text defines the text to use to build the mesh\n * @param fontData defines the font data (can be generated with http://gero3.github.io/facetype.js/)\n * @param options defines options used to create the mesh\n * @param scene defines the hosting scene\n * @param earcutInjection can be used to inject your own earcut reference\n * @returns a new Mesh\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set/text\n */\nexport function CreateText(name, text, fontData, options = {\n size: 50,\n resolution: 8,\n depth: 1.0,\n}, scene = null, earcutInjection = earcut) {\n var _a, _b;\n // First we need to generate the paths\n const shapePaths = CreateTextShapePaths(text, options.size || 50, options.resolution || 8, fontData);\n // And extrude them\n const meshes = [];\n let letterIndex = 0;\n for (const shapePath of shapePaths) {\n if (!shapePath.paths.length) {\n continue;\n }\n const holes = shapePath.holes.slice(); // Copy it as we will update the copy\n for (const path of shapePath.paths) {\n const holeVectors = [];\n const shapeVectors = [];\n const points = path.getPoints();\n for (const point of points) {\n shapeVectors.push(new Vector3(point.x, 0, point.y)); // ExtrudePolygon expects data on the xz plane\n }\n // Holes\n const localHolesCopy = holes.slice();\n for (const hole of localHolesCopy) {\n const points = hole.getPoints();\n let found = false;\n for (const point of points) {\n if (path.isPointInside(point)) {\n found = true;\n break;\n }\n }\n if (!found) {\n continue;\n }\n const holePoints = [];\n for (const point of points) {\n holePoints.push(new Vector3(point.x, 0, point.y)); // ExtrudePolygon expects data on the xz plane\n }\n holeVectors.push(holePoints);\n // Remove the hole as it was already used\n holes.splice(holes.indexOf(hole), 1);\n }\n // There is at least a hole but it was unaffected\n if (!holeVectors.length && holes.length) {\n for (const hole of holes) {\n const points = hole.getPoints();\n const holePoints = [];\n for (const point of points) {\n holePoints.push(new Vector3(point.x, 0, point.y)); // ExtrudePolygon expects data on the xz plane\n }\n holeVectors.push(holePoints);\n }\n }\n // Extrusion!\n const mesh = ExtrudePolygon(name, {\n shape: shapeVectors,\n holes: holeVectors.length ? holeVectors : undefined,\n depth: options.depth || 1.0,\n faceUV: options.faceUV || ((_a = options.perLetterFaceUV) === null || _a === void 0 ? void 0 : _a.call(options, letterIndex)),\n faceColors: options.faceColors || ((_b = options.perLetterFaceColors) === null || _b === void 0 ? void 0 : _b.call(options, letterIndex)),\n sideOrientation: Mesh._GetDefaultSideOrientation(options.sideOrientation || Mesh.DOUBLESIDE),\n }, scene, earcutInjection);\n meshes.push(mesh);\n letterIndex++;\n }\n }\n // Then we can merge everyone into one single mesh\n const newMesh = Mesh.MergeMeshes(meshes, true, true);\n if (newMesh) {\n // Move pivot to center\n const bbox = newMesh === null || newMesh === void 0 ? void 0 : newMesh.getBoundingInfo();\n newMesh.position.x = -(bbox === null || bbox === void 0 ? void 0 : bbox.boundingBox.extendSizeWorld._x);\n newMesh.position.y = -(bbox === null || bbox === void 0 ? void 0 : bbox.boundingBox.extendSizeWorld._y);\n newMesh.position.z = -(bbox === null || bbox === void 0 ? void 0 : bbox.boundingBox.extendSizeWorld._z);\n newMesh.name = name;\n newMesh.rotation.x = -Math.PI / 2;\n newMesh.bakeCurrentTransformIntoVertices();\n }\n return newMesh;\n}\n//# sourceMappingURL=textBuilder.js.map","/* eslint-disable @typescript-eslint/naming-convention */\nimport { CreateRibbon } from \"./Builders/ribbonBuilder.js\";\nimport { CreateDisc } from \"./Builders/discBuilder.js\";\nimport { CreateBox } from \"./Builders/boxBuilder.js\";\nimport { CreateTiledBox } from \"./Builders/tiledBoxBuilder.js\";\nimport { CreateSphere } from \"./Builders/sphereBuilder.js\";\nimport { CreateCylinder } from \"./Builders/cylinderBuilder.js\";\nimport { CreateTorus } from \"./Builders/torusBuilder.js\";\nimport { CreateTorusKnot } from \"./Builders/torusKnotBuilder.js\";\nimport { CreateDashedLines, CreateLineSystem, CreateLines } from \"./Builders/linesBuilder.js\";\nimport { CreatePolygon, ExtrudePolygon } from \"./Builders/polygonBuilder.js\";\nimport { ExtrudeShape, ExtrudeShapeCustom } from \"./Builders/shapeBuilder.js\";\nimport { CreateLathe } from \"./Builders/latheBuilder.js\";\nimport { CreatePlane } from \"./Builders/planeBuilder.js\";\nimport { CreateTiledPlane } from \"./Builders/tiledPlaneBuilder.js\";\nimport { CreateGround, CreateGroundFromHeightMap, CreateTiledGround } from \"./Builders/groundBuilder.js\";\nimport { CreateTube } from \"./Builders/tubeBuilder.js\";\nimport { CreatePolyhedron } from \"./Builders/polyhedronBuilder.js\";\nimport { CreateIcoSphere } from \"./Builders/icoSphereBuilder.js\";\nimport { CreateDecal } from \"./Builders/decalBuilder.js\";\nimport { CreateCapsule } from \"./Builders/capsuleBuilder.js\";\nimport { CreateGeodesic } from \"./Builders/geodesicBuilder.js\";\nimport { CreateGoldberg } from \"./Builders/goldbergBuilder.js\";\nimport { CreateText } from \"./Builders/textBuilder.js\";\n/**\n * Class containing static functions to help procedurally build meshes\n */\nexport const MeshBuilder = {\n CreateBox,\n CreateTiledBox,\n CreateSphere,\n CreateDisc,\n CreateIcoSphere,\n CreateRibbon,\n CreateCylinder,\n CreateTorus,\n CreateTorusKnot,\n CreateLineSystem,\n CreateLines,\n CreateDashedLines,\n ExtrudeShape,\n ExtrudeShapeCustom,\n CreateLathe,\n CreateTiledPlane,\n CreatePlane,\n CreateGround,\n CreateTiledGround,\n CreateGroundFromHeightMap,\n CreatePolygon,\n ExtrudePolygon,\n CreateTube,\n CreatePolyhedron,\n CreateGeodesic,\n CreateGoldberg,\n CreateDecal,\n CreateCapsule,\n CreateText,\n};\n//# sourceMappingURL=meshBuilder.js.map","import { ArrayTools } from \"../Misc/arrayTools.js\";\nimport { Matrix, Vector3, TmpVectors } from \"../Maths/math.vector.js\";\nimport { PickingInfo } from \"../Collisions/pickingInfo.js\";\nimport { IntersectionInfo } from \"../Collisions/intersectionInfo.js\";\nimport { Scene } from \"../scene.js\";\nimport { Camera } from \"../Cameras/camera.js\";\nimport { EngineStore } from \"../Engines/engineStore.js\";\n/**\n * Class representing a ray with position and direction\n */\nexport class Ray {\n /**\n * Creates a new ray\n * @param origin origin point\n * @param direction direction\n * @param length length of the ray\n */\n constructor(\n /** origin point */\n origin, \n /** direction */\n direction, \n /** length of the ray */\n length = Number.MAX_VALUE) {\n this.origin = origin;\n this.direction = direction;\n this.length = length;\n }\n // Methods\n /**\n * Clone the current ray\n * @returns a new ray\n */\n clone() {\n return new Ray(this.origin.clone(), this.direction.clone(), this.length);\n }\n /**\n * Checks if the ray intersects a box\n * This does not account for the ray length by design to improve perfs.\n * @param minimum bound of the box\n * @param maximum bound of the box\n * @param intersectionTreshold extra extend to be added to the box in all direction\n * @returns if the box was hit\n */\n intersectsBoxMinMax(minimum, maximum, intersectionTreshold = 0) {\n const newMinimum = Ray._TmpVector3[0].copyFromFloats(minimum.x - intersectionTreshold, minimum.y - intersectionTreshold, minimum.z - intersectionTreshold);\n const newMaximum = Ray._TmpVector3[1].copyFromFloats(maximum.x + intersectionTreshold, maximum.y + intersectionTreshold, maximum.z + intersectionTreshold);\n let d = 0.0;\n let maxValue = Number.MAX_VALUE;\n let inv;\n let min;\n let max;\n let temp;\n if (Math.abs(this.direction.x) < 0.0000001) {\n if (this.origin.x < newMinimum.x || this.origin.x > newMaximum.x) {\n return false;\n }\n }\n else {\n inv = 1.0 / this.direction.x;\n min = (newMinimum.x - this.origin.x) * inv;\n max = (newMaximum.x - this.origin.x) * inv;\n if (max === -Infinity) {\n max = Infinity;\n }\n if (min > max) {\n temp = min;\n min = max;\n max = temp;\n }\n d = Math.max(min, d);\n maxValue = Math.min(max, maxValue);\n if (d > maxValue) {\n return false;\n }\n }\n if (Math.abs(this.direction.y) < 0.0000001) {\n if (this.origin.y < newMinimum.y || this.origin.y > newMaximum.y) {\n return false;\n }\n }\n else {\n inv = 1.0 / this.direction.y;\n min = (newMinimum.y - this.origin.y) * inv;\n max = (newMaximum.y - this.origin.y) * inv;\n if (max === -Infinity) {\n max = Infinity;\n }\n if (min > max) {\n temp = min;\n min = max;\n max = temp;\n }\n d = Math.max(min, d);\n maxValue = Math.min(max, maxValue);\n if (d > maxValue) {\n return false;\n }\n }\n if (Math.abs(this.direction.z) < 0.0000001) {\n if (this.origin.z < newMinimum.z || this.origin.z > newMaximum.z) {\n return false;\n }\n }\n else {\n inv = 1.0 / this.direction.z;\n min = (newMinimum.z - this.origin.z) * inv;\n max = (newMaximum.z - this.origin.z) * inv;\n if (max === -Infinity) {\n max = Infinity;\n }\n if (min > max) {\n temp = min;\n min = max;\n max = temp;\n }\n d = Math.max(min, d);\n maxValue = Math.min(max, maxValue);\n if (d > maxValue) {\n return false;\n }\n }\n return true;\n }\n /**\n * Checks if the ray intersects a box\n * This does not account for the ray lenght by design to improve perfs.\n * @param box the bounding box to check\n * @param intersectionTreshold extra extend to be added to the BoundingBox in all direction\n * @returns if the box was hit\n */\n intersectsBox(box, intersectionTreshold = 0) {\n return this.intersectsBoxMinMax(box.minimum, box.maximum, intersectionTreshold);\n }\n /**\n * If the ray hits a sphere\n * @param sphere the bounding sphere to check\n * @param intersectionTreshold extra extend to be added to the BoundingSphere in all direction\n * @returns true if it hits the sphere\n */\n intersectsSphere(sphere, intersectionTreshold = 0) {\n const x = sphere.center.x - this.origin.x;\n const y = sphere.center.y - this.origin.y;\n const z = sphere.center.z - this.origin.z;\n const pyth = x * x + y * y + z * z;\n const radius = sphere.radius + intersectionTreshold;\n const rr = radius * radius;\n if (pyth <= rr) {\n return true;\n }\n const dot = x * this.direction.x + y * this.direction.y + z * this.direction.z;\n if (dot < 0.0) {\n return false;\n }\n const temp = pyth - dot * dot;\n return temp <= rr;\n }\n /**\n * If the ray hits a triange\n * @param vertex0 triangle vertex\n * @param vertex1 triangle vertex\n * @param vertex2 triangle vertex\n * @returns intersection information if hit\n */\n intersectsTriangle(vertex0, vertex1, vertex2) {\n const edge1 = Ray._TmpVector3[0];\n const edge2 = Ray._TmpVector3[1];\n const pvec = Ray._TmpVector3[2];\n const tvec = Ray._TmpVector3[3];\n const qvec = Ray._TmpVector3[4];\n vertex1.subtractToRef(vertex0, edge1);\n vertex2.subtractToRef(vertex0, edge2);\n Vector3.CrossToRef(this.direction, edge2, pvec);\n const det = Vector3.Dot(edge1, pvec);\n if (det === 0) {\n return null;\n }\n const invdet = 1 / det;\n this.origin.subtractToRef(vertex0, tvec);\n const bv = Vector3.Dot(tvec, pvec) * invdet;\n if (bv < 0 || bv > 1.0) {\n return null;\n }\n Vector3.CrossToRef(tvec, edge1, qvec);\n const bw = Vector3.Dot(this.direction, qvec) * invdet;\n if (bw < 0 || bv + bw > 1.0) {\n return null;\n }\n //check if the distance is longer than the predefined length.\n const distance = Vector3.Dot(edge2, qvec) * invdet;\n if (distance > this.length) {\n return null;\n }\n return new IntersectionInfo(1 - bv - bw, bv, distance);\n }\n /**\n * Checks if ray intersects a plane\n * @param plane the plane to check\n * @returns the distance away it was hit\n */\n intersectsPlane(plane) {\n let distance;\n const result1 = Vector3.Dot(plane.normal, this.direction);\n if (Math.abs(result1) < 9.99999997475243e-7) {\n return null;\n }\n else {\n const result2 = Vector3.Dot(plane.normal, this.origin);\n distance = (-plane.d - result2) / result1;\n if (distance < 0.0) {\n if (distance < -9.99999997475243e-7) {\n return null;\n }\n else {\n return 0;\n }\n }\n return distance;\n }\n }\n /**\n * Calculate the intercept of a ray on a given axis\n * @param axis to check 'x' | 'y' | 'z'\n * @param offset from axis interception (i.e. an offset of 1y is intercepted above ground)\n * @returns a vector containing the coordinates where 'axis' is equal to zero (else offset), or null if there is no intercept.\n */\n intersectsAxis(axis, offset = 0) {\n switch (axis) {\n case \"y\": {\n const t = (this.origin.y - offset) / this.direction.y;\n if (t > 0) {\n return null;\n }\n return new Vector3(this.origin.x + this.direction.x * -t, offset, this.origin.z + this.direction.z * -t);\n }\n case \"x\": {\n const t = (this.origin.x - offset) / this.direction.x;\n if (t > 0) {\n return null;\n }\n return new Vector3(offset, this.origin.y + this.direction.y * -t, this.origin.z + this.direction.z * -t);\n }\n case \"z\": {\n const t = (this.origin.z - offset) / this.direction.z;\n if (t > 0) {\n return null;\n }\n return new Vector3(this.origin.x + this.direction.x * -t, this.origin.y + this.direction.y * -t, offset);\n }\n default:\n return null;\n }\n }\n /**\n * Checks if ray intersects a mesh. The ray is defined in WORLD space. A mesh triangle can be picked both from its front and back sides,\n * irrespective of orientation.\n * @param mesh the mesh to check\n * @param fastCheck defines if the first intersection will be used (and not the closest)\n * @param trianglePredicate defines an optional predicate used to select faces when a mesh intersection is detected\n * @param onlyBoundingInfo defines a boolean indicating if picking should only happen using bounding info (false by default)\n * @param worldToUse defines the world matrix to use to get the world coordinate of the intersection point\n * @param skipBoundingInfo a boolean indicating if we should skip the bounding info check\n * @returns picking info of the intersection\n */\n intersectsMesh(mesh, fastCheck, trianglePredicate, onlyBoundingInfo = false, worldToUse, skipBoundingInfo = false) {\n const tm = TmpVectors.Matrix[0];\n mesh.getWorldMatrix().invertToRef(tm);\n if (this._tmpRay) {\n Ray.TransformToRef(this, tm, this._tmpRay);\n }\n else {\n this._tmpRay = Ray.Transform(this, tm);\n }\n return mesh.intersects(this._tmpRay, fastCheck, trianglePredicate, onlyBoundingInfo, worldToUse, skipBoundingInfo);\n }\n /**\n * Checks if ray intersects a mesh\n * @param meshes the meshes to check\n * @param fastCheck defines if the first intersection will be used (and not the closest)\n * @param results array to store result in\n * @returns Array of picking infos\n */\n intersectsMeshes(meshes, fastCheck, results) {\n if (results) {\n results.length = 0;\n }\n else {\n results = [];\n }\n for (let i = 0; i < meshes.length; i++) {\n const pickInfo = this.intersectsMesh(meshes[i], fastCheck);\n if (pickInfo.hit) {\n results.push(pickInfo);\n }\n }\n results.sort(this._comparePickingInfo);\n return results;\n }\n _comparePickingInfo(pickingInfoA, pickingInfoB) {\n if (pickingInfoA.distance < pickingInfoB.distance) {\n return -1;\n }\n else if (pickingInfoA.distance > pickingInfoB.distance) {\n return 1;\n }\n else {\n return 0;\n }\n }\n /**\n * Intersection test between the ray and a given segment within a given tolerance (threshold)\n * @param sega the first point of the segment to test the intersection against\n * @param segb the second point of the segment to test the intersection against\n * @param threshold the tolerance margin, if the ray doesn't intersect the segment but is close to the given threshold, the intersection is successful\n * @returns the distance from the ray origin to the intersection point if there's intersection, or -1 if there's no intersection\n */\n intersectionSegment(sega, segb, threshold) {\n const o = this.origin;\n const u = TmpVectors.Vector3[0];\n const rsegb = TmpVectors.Vector3[1];\n const v = TmpVectors.Vector3[2];\n const w = TmpVectors.Vector3[3];\n segb.subtractToRef(sega, u);\n this.direction.scaleToRef(Ray._Rayl, v);\n o.addToRef(v, rsegb);\n sega.subtractToRef(o, w);\n const a = Vector3.Dot(u, u); // always >= 0\n const b = Vector3.Dot(u, v);\n const c = Vector3.Dot(v, v); // always >= 0\n const d = Vector3.Dot(u, w);\n const e = Vector3.Dot(v, w);\n const D = a * c - b * b; // always >= 0\n let sN, sD = D; // sc = sN / sD, default sD = D >= 0\n let tN, tD = D; // tc = tN / tD, default tD = D >= 0\n // compute the line parameters of the two closest points\n if (D < Ray._Smallnum) {\n // the lines are almost parallel\n sN = 0.0; // force using point P0 on segment S1\n sD = 1.0; // to prevent possible division by 0.0 later\n tN = e;\n tD = c;\n }\n else {\n // get the closest points on the infinite lines\n sN = b * e - c * d;\n tN = a * e - b * d;\n if (sN < 0.0) {\n // sc < 0 => the s=0 edge is visible\n sN = 0.0;\n tN = e;\n tD = c;\n }\n else if (sN > sD) {\n // sc > 1 => the s=1 edge is visible\n sN = sD;\n tN = e + b;\n tD = c;\n }\n }\n if (tN < 0.0) {\n // tc < 0 => the t=0 edge is visible\n tN = 0.0;\n // recompute sc for this edge\n if (-d < 0.0) {\n sN = 0.0;\n }\n else if (-d > a) {\n sN = sD;\n }\n else {\n sN = -d;\n sD = a;\n }\n }\n else if (tN > tD) {\n // tc > 1 => the t=1 edge is visible\n tN = tD;\n // recompute sc for this edge\n if (-d + b < 0.0) {\n sN = 0;\n }\n else if (-d + b > a) {\n sN = sD;\n }\n else {\n sN = -d + b;\n sD = a;\n }\n }\n // finally do the division to get sc and tc\n const sc = Math.abs(sN) < Ray._Smallnum ? 0.0 : sN / sD;\n const tc = Math.abs(tN) < Ray._Smallnum ? 0.0 : tN / tD;\n // get the difference of the two closest points\n const qtc = TmpVectors.Vector3[4];\n v.scaleToRef(tc, qtc);\n const qsc = TmpVectors.Vector3[5];\n u.scaleToRef(sc, qsc);\n qsc.addInPlace(w);\n const dP = TmpVectors.Vector3[6];\n qsc.subtractToRef(qtc, dP); // = S1(sc) - S2(tc)\n const isIntersected = tc > 0 && tc <= this.length && dP.lengthSquared() < threshold * threshold; // return intersection result\n if (isIntersected) {\n return qsc.length();\n }\n return -1;\n }\n /**\n * Update the ray from viewport position\n * @param x position\n * @param y y position\n * @param viewportWidth viewport width\n * @param viewportHeight viewport height\n * @param world world matrix\n * @param view view matrix\n * @param projection projection matrix\n * @param enableDistantPicking defines if picking should handle large values for mesh position/scaling (false by default)\n * @returns this ray updated\n */\n update(x, y, viewportWidth, viewportHeight, world, view, projection, enableDistantPicking = false) {\n if (enableDistantPicking) {\n // With world matrices having great values (like 8000000000 on 1 or more scaling or position axis),\n // multiplying view/projection/world and doing invert will result in loss of float precision in the matrix.\n // One way to fix it is to compute the ray with world at identity then transform the ray in object space.\n // This is slower (2 matrix inverts instead of 1) but precision is preserved.\n // This is hidden behind `EnableDistantPicking` flag (default is false)\n if (!Ray._RayDistant) {\n Ray._RayDistant = Ray.Zero();\n }\n Ray._RayDistant.unprojectRayToRef(x, y, viewportWidth, viewportHeight, Matrix.IdentityReadOnly, view, projection);\n const tm = TmpVectors.Matrix[0];\n world.invertToRef(tm);\n Ray.TransformToRef(Ray._RayDistant, tm, this);\n }\n else {\n this.unprojectRayToRef(x, y, viewportWidth, viewportHeight, world, view, projection);\n }\n return this;\n }\n // Statics\n /**\n * Creates a ray with origin and direction of 0,0,0\n * @returns the new ray\n */\n static Zero() {\n return new Ray(Vector3.Zero(), Vector3.Zero());\n }\n /**\n * Creates a new ray from screen space and viewport\n * @param x position\n * @param y y position\n * @param viewportWidth viewport width\n * @param viewportHeight viewport height\n * @param world world matrix\n * @param view view matrix\n * @param projection projection matrix\n * @returns new ray\n */\n static CreateNew(x, y, viewportWidth, viewportHeight, world, view, projection) {\n const result = Ray.Zero();\n return result.update(x, y, viewportWidth, viewportHeight, world, view, projection);\n }\n /**\n * Function will create a new transformed ray starting from origin and ending at the end point. Ray's length will be set, and ray will be\n * transformed to the given world matrix.\n * @param origin The origin point\n * @param end The end point\n * @param world a matrix to transform the ray to. Default is the identity matrix.\n * @returns the new ray\n */\n static CreateNewFromTo(origin, end, world = Matrix.IdentityReadOnly) {\n const direction = end.subtract(origin);\n const length = Math.sqrt(direction.x * direction.x + direction.y * direction.y + direction.z * direction.z);\n direction.normalize();\n return Ray.Transform(new Ray(origin, direction, length), world);\n }\n /**\n * Transforms a ray by a matrix\n * @param ray ray to transform\n * @param matrix matrix to apply\n * @returns the resulting new ray\n */\n static Transform(ray, matrix) {\n const result = new Ray(new Vector3(0, 0, 0), new Vector3(0, 0, 0));\n Ray.TransformToRef(ray, matrix, result);\n return result;\n }\n /**\n * Transforms a ray by a matrix\n * @param ray ray to transform\n * @param matrix matrix to apply\n * @param result ray to store result in\n */\n static TransformToRef(ray, matrix, result) {\n Vector3.TransformCoordinatesToRef(ray.origin, matrix, result.origin);\n Vector3.TransformNormalToRef(ray.direction, matrix, result.direction);\n result.length = ray.length;\n const dir = result.direction;\n const len = dir.length();\n if (!(len === 0 || len === 1)) {\n const num = 1.0 / len;\n dir.x *= num;\n dir.y *= num;\n dir.z *= num;\n result.length *= len;\n }\n }\n /**\n * Unproject a ray from screen space to object space\n * @param sourceX defines the screen space x coordinate to use\n * @param sourceY defines the screen space y coordinate to use\n * @param viewportWidth defines the current width of the viewport\n * @param viewportHeight defines the current height of the viewport\n * @param world defines the world matrix to use (can be set to Identity to go to world space)\n * @param view defines the view matrix to use\n * @param projection defines the projection matrix to use\n */\n unprojectRayToRef(sourceX, sourceY, viewportWidth, viewportHeight, world, view, projection) {\n const matrix = TmpVectors.Matrix[0];\n world.multiplyToRef(view, matrix);\n matrix.multiplyToRef(projection, matrix);\n matrix.invert();\n const engine = EngineStore.LastCreatedEngine;\n const nearScreenSource = TmpVectors.Vector3[0];\n nearScreenSource.x = (sourceX / viewportWidth) * 2 - 1;\n nearScreenSource.y = -((sourceY / viewportHeight) * 2 - 1);\n nearScreenSource.z = (engine === null || engine === void 0 ? void 0 : engine.useReverseDepthBuffer) ? 1 : (engine === null || engine === void 0 ? void 0 : engine.isNDCHalfZRange) ? 0 : -1;\n // far Z need to be close but < to 1 or camera projection matrix with maxZ = 0 will NaN\n const farScreenSource = TmpVectors.Vector3[1].copyFromFloats(nearScreenSource.x, nearScreenSource.y, 1.0 - 1e-8);\n const nearVec3 = TmpVectors.Vector3[2];\n const farVec3 = TmpVectors.Vector3[3];\n Vector3._UnprojectFromInvertedMatrixToRef(nearScreenSource, matrix, nearVec3);\n Vector3._UnprojectFromInvertedMatrixToRef(farScreenSource, matrix, farVec3);\n this.origin.copyFrom(nearVec3);\n farVec3.subtractToRef(nearVec3, this.direction);\n this.direction.normalize();\n }\n}\nRay._TmpVector3 = ArrayTools.BuildArray(6, Vector3.Zero);\nRay._RayDistant = Ray.Zero();\nRay._Smallnum = 0.00000001;\nRay._Rayl = 10e8;\nScene.prototype.createPickingRay = function (x, y, world, camera, cameraViewSpace = false) {\n const result = Ray.Zero();\n this.createPickingRayToRef(x, y, world, result, camera, cameraViewSpace);\n return result;\n};\nScene.prototype.createPickingRayToRef = function (x, y, world, result, camera, cameraViewSpace = false, enableDistantPicking = false) {\n const engine = this.getEngine();\n if (!camera) {\n if (!this.activeCamera) {\n return this;\n }\n camera = this.activeCamera;\n }\n const cameraViewport = camera.viewport;\n const viewport = cameraViewport.toGlobal(engine.getRenderWidth(), engine.getRenderHeight());\n // Moving coordinates to local viewport world\n x = x / engine.getHardwareScalingLevel() - viewport.x;\n y = y / engine.getHardwareScalingLevel() - (engine.getRenderHeight() - viewport.y - viewport.height);\n result.update(x, y, viewport.width, viewport.height, world ? world : Matrix.IdentityReadOnly, cameraViewSpace ? Matrix.IdentityReadOnly : camera.getViewMatrix(), camera.getProjectionMatrix(), enableDistantPicking);\n return this;\n};\nScene.prototype.createPickingRayInCameraSpace = function (x, y, camera) {\n const result = Ray.Zero();\n this.createPickingRayInCameraSpaceToRef(x, y, result, camera);\n return result;\n};\nScene.prototype.createPickingRayInCameraSpaceToRef = function (x, y, result, camera) {\n if (!PickingInfo) {\n return this;\n }\n const engine = this.getEngine();\n if (!camera) {\n if (!this.activeCamera) {\n throw new Error(\"Active camera not set\");\n }\n camera = this.activeCamera;\n }\n const cameraViewport = camera.viewport;\n const viewport = cameraViewport.toGlobal(engine.getRenderWidth(), engine.getRenderHeight());\n const identity = Matrix.Identity();\n // Moving coordinates to local viewport world\n x = x / engine.getHardwareScalingLevel() - viewport.x;\n y = y / engine.getHardwareScalingLevel() - (engine.getRenderHeight() - viewport.y - viewport.height);\n result.update(x, y, viewport.width, viewport.height, identity, identity, camera.getProjectionMatrix());\n return this;\n};\nScene.prototype._internalPickForMesh = function (pickingInfo, rayFunction, mesh, world, fastCheck, onlyBoundingInfo, trianglePredicate, skipBoundingInfo) {\n const ray = rayFunction(world, mesh.enableDistantPicking);\n const result = mesh.intersects(ray, fastCheck, trianglePredicate, onlyBoundingInfo, world, skipBoundingInfo);\n if (!result || !result.hit) {\n return null;\n }\n if (!fastCheck && pickingInfo != null && result.distance >= pickingInfo.distance) {\n return null;\n }\n return result;\n};\nScene.prototype._internalPick = function (rayFunction, predicate, fastCheck, onlyBoundingInfo, trianglePredicate) {\n let pickingInfo = null;\n const computeWorldMatrixForCamera = !!(this.activeCameras && this.activeCameras.length > 1 && this.cameraToUseForPointers !== this.activeCamera);\n const currentCamera = this.cameraToUseForPointers || this.activeCamera;\n for (let meshIndex = 0; meshIndex < this.meshes.length; meshIndex++) {\n const mesh = this.meshes[meshIndex];\n if (predicate) {\n if (!predicate(mesh)) {\n continue;\n }\n }\n else if (!mesh.isEnabled() || !mesh.isVisible || !mesh.isPickable) {\n continue;\n }\n const forceCompute = computeWorldMatrixForCamera && mesh.isWorldMatrixCameraDependent();\n const world = mesh.computeWorldMatrix(forceCompute, currentCamera);\n if (mesh.hasThinInstances && mesh.thinInstanceEnablePicking) {\n // first check if the ray intersects the whole bounding box/sphere of the mesh\n const result = this._internalPickForMesh(pickingInfo, rayFunction, mesh, world, true, true, trianglePredicate);\n if (result) {\n if (onlyBoundingInfo) {\n // the user only asked for a bounding info check so we can return\n return result;\n }\n const tmpMatrix = TmpVectors.Matrix[1];\n const thinMatrices = mesh.thinInstanceGetWorldMatrices();\n for (let index = 0; index < thinMatrices.length; index++) {\n const thinMatrix = thinMatrices[index];\n thinMatrix.multiplyToRef(world, tmpMatrix);\n const result = this._internalPickForMesh(pickingInfo, rayFunction, mesh, tmpMatrix, fastCheck, onlyBoundingInfo, trianglePredicate, true);\n if (result) {\n pickingInfo = result;\n pickingInfo.thinInstanceIndex = index;\n if (fastCheck) {\n return pickingInfo;\n }\n }\n }\n }\n }\n else {\n const result = this._internalPickForMesh(pickingInfo, rayFunction, mesh, world, fastCheck, onlyBoundingInfo, trianglePredicate);\n if (result) {\n pickingInfo = result;\n if (fastCheck) {\n return pickingInfo;\n }\n }\n }\n }\n return pickingInfo || new PickingInfo();\n};\nScene.prototype._internalMultiPick = function (rayFunction, predicate, trianglePredicate) {\n if (!PickingInfo) {\n return null;\n }\n const pickingInfos = new Array();\n const computeWorldMatrixForCamera = !!(this.activeCameras && this.activeCameras.length > 1 && this.cameraToUseForPointers !== this.activeCamera);\n const currentCamera = this.cameraToUseForPointers || this.activeCamera;\n for (let meshIndex = 0; meshIndex < this.meshes.length; meshIndex++) {\n const mesh = this.meshes[meshIndex];\n if (predicate) {\n if (!predicate(mesh)) {\n continue;\n }\n }\n else if (!mesh.isEnabled() || !mesh.isVisible || !mesh.isPickable) {\n continue;\n }\n const forceCompute = computeWorldMatrixForCamera && mesh.isWorldMatrixCameraDependent();\n const world = mesh.computeWorldMatrix(forceCompute, currentCamera);\n if (mesh.hasThinInstances && mesh.thinInstanceEnablePicking) {\n const result = this._internalPickForMesh(null, rayFunction, mesh, world, true, true, trianglePredicate);\n if (result) {\n const tmpMatrix = TmpVectors.Matrix[1];\n const thinMatrices = mesh.thinInstanceGetWorldMatrices();\n for (let index = 0; index < thinMatrices.length; index++) {\n const thinMatrix = thinMatrices[index];\n thinMatrix.multiplyToRef(world, tmpMatrix);\n const result = this._internalPickForMesh(null, rayFunction, mesh, tmpMatrix, false, false, trianglePredicate, true);\n if (result) {\n result.thinInstanceIndex = index;\n pickingInfos.push(result);\n }\n }\n }\n }\n else {\n const result = this._internalPickForMesh(null, rayFunction, mesh, world, false, false, trianglePredicate);\n if (result) {\n pickingInfos.push(result);\n }\n }\n }\n return pickingInfos;\n};\nScene.prototype.pickWithBoundingInfo = function (x, y, predicate, fastCheck, camera) {\n if (!PickingInfo) {\n return null;\n }\n const result = this._internalPick((world) => {\n if (!this._tempPickingRay) {\n this._tempPickingRay = Ray.Zero();\n }\n this.createPickingRayToRef(x, y, world, this._tempPickingRay, camera || null);\n return this._tempPickingRay;\n }, predicate, fastCheck, true);\n if (result) {\n result.ray = this.createPickingRay(x, y, Matrix.Identity(), camera || null);\n }\n return result;\n};\nObject.defineProperty(Scene.prototype, \"_pickingAvailable\", {\n get: () => true,\n enumerable: false,\n configurable: false,\n});\nScene.prototype.pick = function (x, y, predicate, fastCheck, camera, trianglePredicate, _enableDistantPicking = false) {\n const result = this._internalPick((world, enableDistantPicking) => {\n if (!this._tempPickingRay) {\n this._tempPickingRay = Ray.Zero();\n }\n this.createPickingRayToRef(x, y, world, this._tempPickingRay, camera || null, false, enableDistantPicking);\n return this._tempPickingRay;\n }, predicate, fastCheck, false, trianglePredicate);\n if (result) {\n result.ray = this.createPickingRay(x, y, Matrix.Identity(), camera || null);\n }\n return result;\n};\nScene.prototype.pickWithRay = function (ray, predicate, fastCheck, trianglePredicate) {\n const result = this._internalPick((world) => {\n if (!this._pickWithRayInverseMatrix) {\n this._pickWithRayInverseMatrix = Matrix.Identity();\n }\n world.invertToRef(this._pickWithRayInverseMatrix);\n if (!this._cachedRayForTransform) {\n this._cachedRayForTransform = Ray.Zero();\n }\n Ray.TransformToRef(ray, this._pickWithRayInverseMatrix, this._cachedRayForTransform);\n return this._cachedRayForTransform;\n }, predicate, fastCheck, false, trianglePredicate);\n if (result) {\n result.ray = ray;\n }\n return result;\n};\nScene.prototype.multiPick = function (x, y, predicate, camera, trianglePredicate) {\n return this._internalMultiPick((world) => this.createPickingRay(x, y, world, camera || null), predicate, trianglePredicate);\n};\nScene.prototype.multiPickWithRay = function (ray, predicate, trianglePredicate) {\n return this._internalMultiPick((world) => {\n if (!this._pickWithRayInverseMatrix) {\n this._pickWithRayInverseMatrix = Matrix.Identity();\n }\n world.invertToRef(this._pickWithRayInverseMatrix);\n if (!this._cachedRayForTransform) {\n this._cachedRayForTransform = Ray.Zero();\n }\n Ray.TransformToRef(ray, this._pickWithRayInverseMatrix, this._cachedRayForTransform);\n return this._cachedRayForTransform;\n }, predicate, trianglePredicate);\n};\nCamera.prototype.getForwardRay = function (length = 100, transform, origin) {\n return this.getForwardRayToRef(new Ray(Vector3.Zero(), Vector3.Zero(), length), length, transform, origin);\n};\nCamera.prototype.getForwardRayToRef = function (refRay, length = 100, transform, origin) {\n if (!transform) {\n transform = this.getWorldMatrix();\n }\n refRay.length = length;\n if (!origin) {\n refRay.origin.copyFrom(this.position);\n }\n else {\n refRay.origin.copyFrom(origin);\n }\n TmpVectors.Vector3[2].set(0, 0, this._scene.useRightHandedSystem ? -1 : 1);\n Vector3.TransformNormalToRef(TmpVectors.Vector3[2], transform, TmpVectors.Vector3[3]);\n Vector3.NormalizeToRef(TmpVectors.Vector3[3], refRay.direction);\n return refRay;\n};\n//# sourceMappingURL=ray.js.map","\n\n","// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore.js\";\nimport \"./ShadersInclude/helperFunctions.js\";\nconst name = \"rgbdDecodePixelShader\";\nconst shader = `varying vec2 vUV;uniform sampler2D textureSampler;\n#include\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) \n{gl_FragColor=vec4(fromRGBD(texture2D(textureSampler,vUV)),1.0);}`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @internal */\nexport const rgbdDecodePixelShader = { name, shader };\n//# sourceMappingURL=rgbdDecode.fragment.js.map","\nimport { PostProcess } from \"../PostProcesses/postProcess.js\";\nimport \"../Shaders/rgbdDecode.fragment.js\";\nimport \"../Engines/Extensions/engine.renderTarget.js\";\nimport { ApplyPostProcess } from \"./textureTools.js\";\n/**\n * Class used to host RGBD texture specific utilities\n */\nexport class RGBDTextureTools {\n /**\n * Expand the RGBD Texture from RGBD to Half Float if possible.\n * @param texture the texture to expand.\n */\n static ExpandRGBDTexture(texture) {\n const internalTexture = texture._texture;\n if (!internalTexture || !texture.isRGBD) {\n return;\n }\n // Gets everything ready.\n const engine = internalTexture.getEngine();\n const caps = engine.getCaps();\n const isReady = internalTexture.isReady;\n let expandTexture = false;\n // If half float available we can uncompress the texture\n if (caps.textureHalfFloatRender && caps.textureHalfFloatLinearFiltering) {\n expandTexture = true;\n internalTexture.type = 2;\n }\n // If full float available we can uncompress the texture\n else if (caps.textureFloatRender && caps.textureFloatLinearFiltering) {\n expandTexture = true;\n internalTexture.type = 1;\n }\n if (expandTexture) {\n // Do not use during decode.\n internalTexture.isReady = false;\n internalTexture._isRGBD = false;\n internalTexture.invertY = false;\n }\n const expandRGBDTexture = () => {\n // Expand the texture if possible\n if (expandTexture) {\n // Simply run through the decode PP.\n const rgbdPostProcess = new PostProcess(\"rgbdDecode\", \"rgbdDecode\", null, null, 1, null, 3, engine, false, undefined, internalTexture.type, undefined, null, false);\n rgbdPostProcess.externalTextureSamplerBinding = true;\n // Hold the output of the decoding.\n const expandedTexture = engine.createRenderTargetTexture(internalTexture.width, {\n generateDepthBuffer: false,\n generateMipMaps: false,\n generateStencilBuffer: false,\n samplingMode: internalTexture.samplingMode,\n type: internalTexture.type,\n format: 5,\n });\n rgbdPostProcess.getEffect().executeWhenCompiled(() => {\n // PP Render Pass\n rgbdPostProcess.onApply = (effect) => {\n effect._bindTexture(\"textureSampler\", internalTexture);\n effect.setFloat2(\"scale\", 1, 1);\n };\n texture.getScene().postProcessManager.directRender([rgbdPostProcess], expandedTexture, true);\n // Cleanup\n engine.restoreDefaultFramebuffer();\n engine._releaseTexture(internalTexture);\n if (rgbdPostProcess) {\n rgbdPostProcess.dispose();\n }\n // Internal Swap\n expandedTexture._swapAndDie(internalTexture);\n // Ready to get rolling again.\n internalTexture.isReady = true;\n });\n }\n };\n if (isReady) {\n expandRGBDTexture();\n }\n else {\n texture.onLoadObservable.addOnce(expandRGBDTexture);\n }\n }\n /**\n * Encode the texture to RGBD if possible.\n * @param internalTexture the texture to encode\n * @param scene the scene hosting the texture\n * @param outputTextureType type of the texture in which the encoding is performed\n * @returns a promise with the internalTexture having its texture replaced by the result of the processing\n */\n static EncodeTextureToRGBD(internalTexture, scene, outputTextureType = 0) {\n return ApplyPostProcess(\"rgbdEncode\", internalTexture, scene, outputTextureType, 1, 5);\n }\n}\n//# sourceMappingURL=rgbdTextureTools.js.map","// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore.js\";\nimport \"./ShadersInclude/helperFunctions.js\";\nconst name = \"rgbdEncodePixelShader\";\nconst shader = `varying vec2 vUV;uniform sampler2D textureSampler;\n#include\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) \n{gl_FragColor=toRGBD(texture2D(textureSampler,vUV).rgb);}`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @internal */\nexport const rgbdEncodePixelShader = { name, shader };\n//# sourceMappingURL=rgbdEncode.fragment.js.map","import { Tools } from \"./tools.js\";\nimport { Vector3 } from \"../Maths/math.vector.js\";\nimport { Scalar } from \"../Maths/math.scalar.js\";\nimport { SphericalPolynomial } from \"../Maths/sphericalPolynomial.js\";\nimport { InternalTexture, InternalTextureSource } from \"../Materials/Textures/internalTexture.js\";\nimport { BaseTexture } from \"../Materials/Textures/baseTexture.js\";\n\nimport { Scene } from \"../scene.js\";\nimport { PostProcess } from \"../PostProcesses/postProcess.js\";\nimport { Logger } from \"../Misc/logger.js\";\nimport { RGBDTextureTools } from \"./rgbdTextureTools.js\";\nimport \"../Engines/Extensions/engine.renderTargetCube.js\";\nimport \"../Engines/Extensions/engine.readTexture.js\";\nimport \"../Materials/Textures/baseTexture.polynomial.js\";\nimport \"../Shaders/rgbdEncode.fragment.js\";\nimport \"../Shaders/rgbdDecode.fragment.js\";\nimport { DumpTools } from \"../Misc/dumpTools.js\";\nconst DefaultEnvironmentTextureImageType = \"image/png\";\nconst CurrentVersion = 2;\n/**\n * Magic number identifying the env file.\n */\nconst MagicBytes = [0x86, 0x16, 0x87, 0x96, 0xf6, 0xd6, 0x96, 0x36];\n/**\n * Gets the environment info from an env file.\n * @param data The array buffer containing the .env bytes.\n * @returns the environment file info (the json header) if successfully parsed, normalized to the latest supported version.\n */\nexport function GetEnvInfo(data) {\n const dataView = new DataView(data.buffer, data.byteOffset, data.byteLength);\n let pos = 0;\n for (let i = 0; i < MagicBytes.length; i++) {\n if (dataView.getUint8(pos++) !== MagicBytes[i]) {\n Logger.Error(\"Not a babylon environment map\");\n return null;\n }\n }\n // Read json manifest - collect characters up to null terminator\n let manifestString = \"\";\n let charCode = 0x00;\n while ((charCode = dataView.getUint8(pos++))) {\n manifestString += String.fromCharCode(charCode);\n }\n let manifest = JSON.parse(manifestString);\n manifest = normalizeEnvInfo(manifest);\n if (manifest.specular) {\n // Extend the header with the position of the payload.\n manifest.specular.specularDataPosition = pos;\n // Fallback to 0.8 exactly if lodGenerationScale is not defined for backward compatibility.\n manifest.specular.lodGenerationScale = manifest.specular.lodGenerationScale || 0.8;\n }\n return manifest;\n}\n/**\n * Normalizes any supported version of the environment file info to the latest version\n * @param info environment file info on any supported version\n * @returns environment file info in the latest supported version\n * @private\n */\nexport function normalizeEnvInfo(info) {\n if (info.version > CurrentVersion) {\n throw new Error(`Unsupported babylon environment map version \"${info.version}\". Latest supported version is \"${CurrentVersion}\".`);\n }\n if (info.version === 2) {\n return info;\n }\n // Migrate a v1 info to v2\n info = Object.assign(Object.assign({}, info), { version: 2, imageType: DefaultEnvironmentTextureImageType });\n return info;\n}\n/**\n * Creates an environment texture from a loaded cube texture.\n * @param texture defines the cube texture to convert in env file\n * @param options options for the conversion process\n * @param options.imageType the mime type for the encoded images, with support for \"image/png\" (default) and \"image/webp\"\n * @param options.imageQuality the image quality of encoded WebP images.\n * @returns a promise containing the environment data if successful.\n */\nexport async function CreateEnvTextureAsync(texture, options = {}) {\n var _a, _b;\n const internalTexture = texture.getInternalTexture();\n if (!internalTexture) {\n return Promise.reject(\"The cube texture is invalid.\");\n }\n const imageType = (_a = options.imageType) !== null && _a !== void 0 ? _a : DefaultEnvironmentTextureImageType;\n const engine = internalTexture.getEngine();\n if (texture.textureType !== 2 &&\n texture.textureType !== 1 &&\n texture.textureType !== 0 &&\n texture.textureType !== 0 &&\n texture.textureType !== 7 &&\n texture.textureType !== -1) {\n return Promise.reject(\"The cube texture should allow HDR (Full Float or Half Float).\");\n }\n let textureType = 1;\n if (!engine.getCaps().textureFloatRender) {\n textureType = 2;\n if (!engine.getCaps().textureHalfFloatRender) {\n return Promise.reject(\"Env texture can only be created when the browser supports half float or full float rendering.\");\n }\n }\n // sphericalPolynomial is lazy loaded so simply accessing it should trigger the computation.\n texture.sphericalPolynomial;\n // Lets keep track of the polynomial promise so we can wait for it to be ready before generating the pixels.\n const sphericalPolynomialPromise = (_b = texture.getInternalTexture()) === null || _b === void 0 ? void 0 : _b._sphericalPolynomialPromise;\n const cubeWidth = internalTexture.width;\n const hostingScene = new Scene(engine);\n const specularTextures = {};\n // As we are going to readPixels the faces of the cube, make sure the drawing/update commands for the cube texture are fully sent to the GPU in case it is drawn for the first time in this very frame!\n engine.flushFramebuffer();\n // Read and collect all mipmaps data from the cube.\n const mipmapsCount = Scalar.ILog2(internalTexture.width);\n for (let i = 0; i <= mipmapsCount; i++) {\n const faceWidth = Math.pow(2, mipmapsCount - i);\n // All faces of the cube.\n for (let face = 0; face < 6; face++) {\n let faceData = await texture.readPixels(face, i, undefined, false);\n if (faceData && faceData.byteLength === faceData.length) {\n const faceDataFloat = new Float32Array(faceData.byteLength * 4);\n for (let i = 0; i < faceData.byteLength; i++) {\n faceDataFloat[i] = faceData[i] / 255;\n // Gamma to linear\n faceDataFloat[i] = Math.pow(faceDataFloat[i], 2.2);\n }\n faceData = faceDataFloat;\n }\n else if (faceData && texture.gammaSpace) {\n const floatData = faceData;\n for (let i = 0; i < floatData.length; i++) {\n // Gamma to linear\n floatData[i] = Math.pow(floatData[i], 2.2);\n }\n }\n const tempTexture = engine.createRawTexture(faceData, faceWidth, faceWidth, 5, false, true, 1, null, textureType);\n await RGBDTextureTools.EncodeTextureToRGBD(tempTexture, hostingScene, textureType);\n const rgbdEncodedData = await engine._readTexturePixels(tempTexture, faceWidth, faceWidth);\n const imageEncodedData = await DumpTools.DumpDataAsync(faceWidth, faceWidth, rgbdEncodedData, imageType, undefined, false, true, options.imageQuality);\n specularTextures[i * 6 + face] = imageEncodedData;\n tempTexture.dispose();\n }\n }\n // We can delete the hosting scene keeping track of all the creation objects\n hostingScene.dispose();\n // Ensure completion of the polynomial creation promise.\n if (sphericalPolynomialPromise) {\n await sphericalPolynomialPromise;\n }\n // Creates the json header for the env texture\n const info = {\n version: CurrentVersion,\n width: cubeWidth,\n imageType,\n irradiance: _CreateEnvTextureIrradiance(texture),\n specular: {\n mipmaps: [],\n lodGenerationScale: texture.lodGenerationScale,\n },\n };\n // Sets the specular image data information\n let position = 0;\n for (let i = 0; i <= mipmapsCount; i++) {\n for (let face = 0; face < 6; face++) {\n const byteLength = specularTextures[i * 6 + face].byteLength;\n info.specular.mipmaps.push({\n length: byteLength,\n position: position,\n });\n position += byteLength;\n }\n }\n // Encode the JSON as an array buffer\n const infoString = JSON.stringify(info);\n const infoBuffer = new ArrayBuffer(infoString.length + 1);\n const infoView = new Uint8Array(infoBuffer); // Limited to ascii subset matching unicode.\n for (let i = 0, strLen = infoString.length; i < strLen; i++) {\n infoView[i] = infoString.charCodeAt(i);\n }\n // Ends up with a null terminator for easier parsing\n infoView[infoString.length] = 0x00;\n // Computes the final required size and creates the storage\n const totalSize = MagicBytes.length + position + infoBuffer.byteLength;\n const finalBuffer = new ArrayBuffer(totalSize);\n const finalBufferView = new Uint8Array(finalBuffer);\n const dataView = new DataView(finalBuffer);\n // Copy the magic bytes identifying the file in\n let pos = 0;\n for (let i = 0; i < MagicBytes.length; i++) {\n dataView.setUint8(pos++, MagicBytes[i]);\n }\n // Add the json info\n finalBufferView.set(new Uint8Array(infoBuffer), pos);\n pos += infoBuffer.byteLength;\n // Finally inserts the texture data\n for (let i = 0; i <= mipmapsCount; i++) {\n for (let face = 0; face < 6; face++) {\n const dataBuffer = specularTextures[i * 6 + face];\n finalBufferView.set(new Uint8Array(dataBuffer), pos);\n pos += dataBuffer.byteLength;\n }\n }\n // Voila\n return finalBuffer;\n}\n/**\n * Creates a JSON representation of the spherical data.\n * @param texture defines the texture containing the polynomials\n * @returns the JSON representation of the spherical info\n */\nfunction _CreateEnvTextureIrradiance(texture) {\n const polynmials = texture.sphericalPolynomial;\n if (polynmials == null) {\n return null;\n }\n return {\n x: [polynmials.x.x, polynmials.x.y, polynmials.x.z],\n y: [polynmials.y.x, polynmials.y.y, polynmials.y.z],\n z: [polynmials.z.x, polynmials.z.y, polynmials.z.z],\n xx: [polynmials.xx.x, polynmials.xx.y, polynmials.xx.z],\n yy: [polynmials.yy.x, polynmials.yy.y, polynmials.yy.z],\n zz: [polynmials.zz.x, polynmials.zz.y, polynmials.zz.z],\n yz: [polynmials.yz.x, polynmials.yz.y, polynmials.yz.z],\n zx: [polynmials.zx.x, polynmials.zx.y, polynmials.zx.z],\n xy: [polynmials.xy.x, polynmials.xy.y, polynmials.xy.z],\n };\n}\n/**\n * Creates the ArrayBufferViews used for initializing environment texture image data.\n * @param data the image data\n * @param info parameters that determine what views will be created for accessing the underlying buffer\n * @returns the views described by info providing access to the underlying buffer\n */\nexport function CreateImageDataArrayBufferViews(data, info) {\n info = normalizeEnvInfo(info);\n const specularInfo = info.specular;\n // Double checks the enclosed info\n let mipmapsCount = Scalar.Log2(info.width);\n mipmapsCount = Math.round(mipmapsCount) + 1;\n if (specularInfo.mipmaps.length !== 6 * mipmapsCount) {\n throw new Error(`Unsupported specular mipmaps number \"${specularInfo.mipmaps.length}\"`);\n }\n const imageData = new Array(mipmapsCount);\n for (let i = 0; i < mipmapsCount; i++) {\n imageData[i] = new Array(6);\n for (let face = 0; face < 6; face++) {\n const imageInfo = specularInfo.mipmaps[i * 6 + face];\n imageData[i][face] = new Uint8Array(data.buffer, data.byteOffset + specularInfo.specularDataPosition + imageInfo.position, imageInfo.length);\n }\n }\n return imageData;\n}\n/**\n * Uploads the texture info contained in the env file to the GPU.\n * @param texture defines the internal texture to upload to\n * @param data defines the data to load\n * @param info defines the texture info retrieved through the GetEnvInfo method\n * @returns a promise\n */\nexport function UploadEnvLevelsAsync(texture, data, info) {\n info = normalizeEnvInfo(info);\n const specularInfo = info.specular;\n if (!specularInfo) {\n // Nothing else parsed so far\n return Promise.resolve();\n }\n texture._lodGenerationScale = specularInfo.lodGenerationScale;\n const imageData = CreateImageDataArrayBufferViews(data, info);\n return UploadLevelsAsync(texture, imageData, info.imageType);\n}\nfunction _OnImageReadyAsync(image, engine, expandTexture, rgbdPostProcess, url, face, i, generateNonLODTextures, lodTextures, cubeRtt, texture) {\n return new Promise((resolve, reject) => {\n if (expandTexture) {\n const tempTexture = engine.createTexture(null, true, true, null, 1, null, (message) => {\n reject(message);\n }, image);\n rgbdPostProcess.getEffect().executeWhenCompiled(() => {\n // Uncompress the data to a RTT\n rgbdPostProcess.externalTextureSamplerBinding = true;\n rgbdPostProcess.onApply = (effect) => {\n effect._bindTexture(\"textureSampler\", tempTexture);\n effect.setFloat2(\"scale\", 1, engine._features.needsInvertingBitmap && image instanceof ImageBitmap ? -1 : 1);\n };\n if (!engine.scenes.length) {\n return;\n }\n engine.scenes[0].postProcessManager.directRender([rgbdPostProcess], cubeRtt, true, face, i);\n // Cleanup\n engine.restoreDefaultFramebuffer();\n tempTexture.dispose();\n URL.revokeObjectURL(url);\n resolve();\n });\n }\n else {\n engine._uploadImageToTexture(texture, image, face, i);\n // Upload the face to the non lod texture support\n if (generateNonLODTextures) {\n const lodTexture = lodTextures[i];\n if (lodTexture) {\n engine._uploadImageToTexture(lodTexture._texture, image, face, 0);\n }\n }\n resolve();\n }\n });\n}\n/**\n * Uploads the levels of image data to the GPU.\n * @param texture defines the internal texture to upload to\n * @param imageData defines the array buffer views of image data [mipmap][face]\n * @param imageType the mime type of the image data\n * @returns a promise\n */\nexport function UploadLevelsAsync(texture, imageData, imageType = DefaultEnvironmentTextureImageType) {\n if (!Tools.IsExponentOfTwo(texture.width)) {\n throw new Error(\"Texture size must be a power of two\");\n }\n const mipmapsCount = Scalar.ILog2(texture.width) + 1;\n // Gets everything ready.\n const engine = texture.getEngine();\n let expandTexture = false;\n let generateNonLODTextures = false;\n let rgbdPostProcess = null;\n let cubeRtt = null;\n let lodTextures = null;\n const caps = engine.getCaps();\n texture.format = 5;\n texture.type = 0;\n texture.generateMipMaps = true;\n texture._cachedAnisotropicFilteringLevel = null;\n engine.updateTextureSamplingMode(3, texture);\n // Add extra process if texture lod is not supported\n if (!caps.textureLOD) {\n expandTexture = false;\n generateNonLODTextures = true;\n lodTextures = {};\n }\n // in webgl 1 there are no ways to either render or copy lod level information for float textures.\n else if (!engine._features.supportRenderAndCopyToLodForFloatTextures) {\n expandTexture = false;\n }\n // If half float available we can uncompress the texture\n else if (caps.textureHalfFloatRender && caps.textureHalfFloatLinearFiltering) {\n expandTexture = true;\n texture.type = 2;\n }\n // If full float available we can uncompress the texture\n else if (caps.textureFloatRender && caps.textureFloatLinearFiltering) {\n expandTexture = true;\n texture.type = 1;\n }\n // Expand the texture if possible\n if (expandTexture) {\n // Simply run through the decode PP\n rgbdPostProcess = new PostProcess(\"rgbdDecode\", \"rgbdDecode\", null, null, 1, null, 3, engine, false, undefined, texture.type, undefined, null, false);\n texture._isRGBD = false;\n texture.invertY = false;\n cubeRtt = engine.createRenderTargetCubeTexture(texture.width, {\n generateDepthBuffer: false,\n generateMipMaps: true,\n generateStencilBuffer: false,\n samplingMode: 3,\n type: texture.type,\n format: 5,\n });\n }\n else {\n texture._isRGBD = true;\n texture.invertY = true;\n // In case of missing support, applies the same patch than DDS files.\n if (generateNonLODTextures) {\n const mipSlices = 3;\n const scale = texture._lodGenerationScale;\n const offset = texture._lodGenerationOffset;\n for (let i = 0; i < mipSlices; i++) {\n //compute LOD from even spacing in smoothness (matching shader calculation)\n const smoothness = i / (mipSlices - 1);\n const roughness = 1 - smoothness;\n const minLODIndex = offset; // roughness = 0\n const maxLODIndex = (mipmapsCount - 1) * scale + offset; // roughness = 1 (mipmaps start from 0)\n const lodIndex = minLODIndex + (maxLODIndex - minLODIndex) * roughness;\n const mipmapIndex = Math.round(Math.min(Math.max(lodIndex, 0), maxLODIndex));\n const glTextureFromLod = new InternalTexture(engine, InternalTextureSource.Temp);\n glTextureFromLod.isCube = true;\n glTextureFromLod.invertY = true;\n glTextureFromLod.generateMipMaps = false;\n engine.updateTextureSamplingMode(2, glTextureFromLod);\n // Wrap in a base texture for easy binding.\n const lodTexture = new BaseTexture(null);\n lodTexture._isCube = true;\n lodTexture._texture = glTextureFromLod;\n lodTextures[mipmapIndex] = lodTexture;\n switch (i) {\n case 0:\n texture._lodTextureLow = lodTexture;\n break;\n case 1:\n texture._lodTextureMid = lodTexture;\n break;\n case 2:\n texture._lodTextureHigh = lodTexture;\n break;\n }\n }\n }\n }\n const promises = [];\n // All mipmaps up to provided number of images\n for (let i = 0; i < imageData.length; i++) {\n // All faces\n for (let face = 0; face < 6; face++) {\n // Constructs an image element from image data\n const bytes = imageData[i][face];\n const blob = new Blob([bytes], { type: imageType });\n const url = URL.createObjectURL(blob);\n let promise;\n if (typeof Image === \"undefined\" || engine._features.forceBitmapOverHTMLImageElement) {\n promise = engine.createImageBitmap(blob, { premultiplyAlpha: \"none\" }).then((img) => {\n return _OnImageReadyAsync(img, engine, expandTexture, rgbdPostProcess, url, face, i, generateNonLODTextures, lodTextures, cubeRtt, texture);\n });\n }\n else {\n const image = new Image();\n image.src = url;\n // Enqueue promise to upload to the texture.\n promise = new Promise((resolve, reject) => {\n image.onload = () => {\n _OnImageReadyAsync(image, engine, expandTexture, rgbdPostProcess, url, face, i, generateNonLODTextures, lodTextures, cubeRtt, texture)\n .then(() => resolve())\n .catch((reason) => {\n reject(reason);\n });\n };\n image.onerror = (error) => {\n reject(error);\n };\n });\n }\n promises.push(promise);\n }\n }\n // Fill remaining mipmaps with black textures.\n if (imageData.length < mipmapsCount) {\n let data;\n const size = Math.pow(2, mipmapsCount - 1 - imageData.length);\n const dataLength = size * size * 4;\n switch (texture.type) {\n case 0: {\n data = new Uint8Array(dataLength);\n break;\n }\n case 2: {\n data = new Uint16Array(dataLength);\n break;\n }\n case 1: {\n data = new Float32Array(dataLength);\n break;\n }\n }\n for (let i = imageData.length; i < mipmapsCount; i++) {\n for (let face = 0; face < 6; face++) {\n engine._uploadArrayBufferViewToTexture(texture, data, face, i);\n }\n }\n }\n // Once all done, finishes the cleanup and return\n return Promise.all(promises).then(() => {\n // Release temp RTT.\n if (cubeRtt) {\n engine._releaseTexture(texture);\n cubeRtt._swapAndDie(texture);\n }\n // Release temp Post Process.\n if (rgbdPostProcess) {\n rgbdPostProcess.dispose();\n }\n // Flag internal texture as ready in case they are in use.\n if (generateNonLODTextures) {\n if (texture._lodTextureHigh && texture._lodTextureHigh._texture) {\n texture._lodTextureHigh._texture.isReady = true;\n }\n if (texture._lodTextureMid && texture._lodTextureMid._texture) {\n texture._lodTextureMid._texture.isReady = true;\n }\n if (texture._lodTextureLow && texture._lodTextureLow._texture) {\n texture._lodTextureLow._texture.isReady = true;\n }\n }\n });\n}\n/**\n * Uploads spherical polynomials information to the texture.\n * @param texture defines the texture we are trying to upload the information to\n * @param info defines the environment texture info retrieved through the GetEnvInfo method\n */\nexport function UploadEnvSpherical(texture, info) {\n info = normalizeEnvInfo(info);\n const irradianceInfo = info.irradiance;\n if (!irradianceInfo) {\n return;\n }\n const sp = new SphericalPolynomial();\n Vector3.FromArrayToRef(irradianceInfo.x, 0, sp.x);\n Vector3.FromArrayToRef(irradianceInfo.y, 0, sp.y);\n Vector3.FromArrayToRef(irradianceInfo.z, 0, sp.z);\n Vector3.FromArrayToRef(irradianceInfo.xx, 0, sp.xx);\n Vector3.FromArrayToRef(irradianceInfo.yy, 0, sp.yy);\n Vector3.FromArrayToRef(irradianceInfo.zz, 0, sp.zz);\n Vector3.FromArrayToRef(irradianceInfo.yz, 0, sp.yz);\n Vector3.FromArrayToRef(irradianceInfo.zx, 0, sp.zx);\n Vector3.FromArrayToRef(irradianceInfo.xy, 0, sp.xy);\n texture._sphericalPolynomial = sp;\n}\n/**\n * @internal\n */\nexport function _UpdateRGBDAsync(internalTexture, data, sphericalPolynomial, lodScale, lodOffset) {\n const proxy = internalTexture\n .getEngine()\n .createRawCubeTexture(null, internalTexture.width, internalTexture.format, internalTexture.type, internalTexture.generateMipMaps, internalTexture.invertY, internalTexture.samplingMode, internalTexture._compression);\n const proxyPromise = UploadLevelsAsync(proxy, data).then(() => internalTexture);\n internalTexture.onRebuildCallback = (_internalTexture) => {\n return {\n proxy: proxyPromise,\n isReady: true,\n isAsync: true,\n };\n };\n internalTexture._source = InternalTextureSource.CubeRawRGBD;\n internalTexture._bufferViewArrayArray = data;\n internalTexture._lodGenerationScale = lodScale;\n internalTexture._lodGenerationOffset = lodOffset;\n internalTexture._sphericalPolynomial = sphericalPolynomial;\n return UploadLevelsAsync(internalTexture, data).then(() => {\n internalTexture.isReady = true;\n return internalTexture;\n });\n}\n/**\n * Sets of helpers addressing the serialization and deserialization of environment texture\n * stored in a BabylonJS env file.\n * Those files are usually stored as .env files.\n */\nexport const EnvironmentTextureTools = {\n /**\n * Gets the environment info from an env file.\n * @param data The array buffer containing the .env bytes.\n * @returns the environment file info (the json header) if successfully parsed, normalized to the latest supported version.\n */\n GetEnvInfo,\n /**\n * Creates an environment texture from a loaded cube texture.\n * @param texture defines the cube texture to convert in env file\n * @param options options for the conversion process\n * @param options.imageType the mime type for the encoded images, with support for \"image/png\" (default) and \"image/webp\"\n * @param options.imageQuality the image quality of encoded WebP images.\n * @returns a promise containing the environment data if successful.\n */\n CreateEnvTextureAsync,\n /**\n * Creates the ArrayBufferViews used for initializing environment texture image data.\n * @param data the image data\n * @param info parameters that determine what views will be created for accessing the underlying buffer\n * @returns the views described by info providing access to the underlying buffer\n */\n CreateImageDataArrayBufferViews,\n /**\n * Uploads the texture info contained in the env file to the GPU.\n * @param texture defines the internal texture to upload to\n * @param data defines the data to load\n * @param info defines the texture info retrieved through the GetEnvInfo method\n * @returns a promise\n */\n UploadEnvLevelsAsync,\n /**\n * Uploads the levels of image data to the GPU.\n * @param texture defines the internal texture to upload to\n * @param imageData defines the array buffer views of image data [mipmap][face]\n * @param imageType the mime type of the image data\n * @returns a promise\n */\n UploadLevelsAsync,\n /**\n * Uploads spherical polynomials information to the texture.\n * @param texture defines the texture we are trying to upload the information to\n * @param info defines the environment texture info retrieved through the GetEnvInfo method\n */\n UploadEnvSpherical,\n};\n//# sourceMappingURL=environmentTextureTools.js.map","import { GetEnvInfo, UploadEnvLevelsAsync, UploadEnvSpherical } from \"../../../Misc/environmentTextureTools.js\";\nimport { Engine } from \"../../../Engines/engine.js\";\n/**\n * Implementation of the ENV Texture Loader.\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport class _ENVTextureLoader {\n constructor() {\n /**\n * Defines whether the loader supports cascade loading the different faces.\n */\n this.supportCascades = false;\n }\n /**\n * This returns if the loader support the current file information.\n * @param extension defines the file extension of the file being loaded\n * @returns true if the loader can load the specified file\n */\n canLoad(extension) {\n return extension.endsWith(\".env\");\n }\n /**\n * Uploads the cube texture data to the WebGL texture. It has already been bound.\n * @param data contains the texture data\n * @param texture defines the BabylonJS internal texture\n * @param createPolynomials will be true if polynomials have been requested\n * @param onLoad defines the callback to trigger once the texture is ready\n * @param onError defines the callback to trigger in case of error\n */\n loadCubeData(data, texture, createPolynomials, onLoad, onError) {\n if (Array.isArray(data)) {\n return;\n }\n const info = GetEnvInfo(data);\n if (info) {\n texture.width = info.width;\n texture.height = info.width;\n try {\n UploadEnvSpherical(texture, info);\n UploadEnvLevelsAsync(texture, data, info).then(() => {\n texture.isReady = true;\n texture.onLoadedObservable.notifyObservers(texture);\n texture.onLoadedObservable.clear();\n if (onLoad) {\n onLoad();\n }\n }, (reason) => {\n onError === null || onError === void 0 ? void 0 : onError(\"Can not upload environment levels\", reason);\n });\n }\n catch (e) {\n onError === null || onError === void 0 ? void 0 : onError(\"Can not upload environment file\", e);\n }\n }\n else if (onError) {\n onError(\"Can not parse the environment file\", null);\n }\n }\n /**\n * Uploads the 2D texture data to the WebGL texture. It has already been bound once in the callback.\n */\n loadData() {\n throw \".env not supported in 2d.\";\n }\n}\n// Register the loader.\nEngine._TextureLoaders.push(new _ENVTextureLoader());\n//# sourceMappingURL=envTextureLoader.js.map","import { __decorate } from \"../tslib.es6.js\";\nimport { serialize, SerializationHelper, serializeAsColor3, expandToProperty } from \"../Misc/decorators.js\";\nimport { Vector3 } from \"../Maths/math.vector.js\";\nimport { Color3, TmpColors } from \"../Maths/math.color.js\";\nimport { Node } from \"../node.js\";\nimport { UniformBuffer } from \"../Materials/uniformBuffer.js\";\nimport { GetClass } from \"../Misc/typeStore.js\";\nimport { LightConstants } from \"./lightConstants.js\";\n/**\n * Base class of all the lights in Babylon. It groups all the generic information about lights.\n * Lights are used, as you would expect, to affect how meshes are seen, in terms of both illumination and colour.\n * All meshes allow light to pass through them unless shadow generation is activated. The default number of lights allowed is four but this can be increased.\n */\nexport class Light extends Node {\n /**\n * Defines how far from the source the light is impacting in scene units.\n * Note: Unused in PBR material as the distance light falloff is defined following the inverse squared falloff.\n */\n get range() {\n return this._range;\n }\n /**\n * Defines how far from the source the light is impacting in scene units.\n * Note: Unused in PBR material as the distance light falloff is defined following the inverse squared falloff.\n */\n set range(value) {\n this._range = value;\n this._inverseSquaredRange = 1.0 / (this.range * this.range);\n }\n /**\n * Gets the photometric scale used to interpret the intensity.\n * This is only relevant with PBR Materials where the light intensity can be defined in a physical way.\n */\n get intensityMode() {\n return this._intensityMode;\n }\n /**\n * Sets the photometric scale used to interpret the intensity.\n * This is only relevant with PBR Materials where the light intensity can be defined in a physical way.\n */\n set intensityMode(value) {\n this._intensityMode = value;\n this._computePhotometricScale();\n }\n /**\n * Gets the light radius used by PBR Materials to simulate soft area lights.\n */\n get radius() {\n return this._radius;\n }\n /**\n * sets the light radius used by PBR Materials to simulate soft area lights.\n */\n set radius(value) {\n this._radius = value;\n this._computePhotometricScale();\n }\n /**\n * Gets whether or not the shadows are enabled for this light. This can help turning off/on shadow without detaching\n * the current shadow generator.\n */\n get shadowEnabled() {\n return this._shadowEnabled;\n }\n /**\n * Sets whether or not the shadows are enabled for this light. This can help turning off/on shadow without detaching\n * the current shadow generator.\n */\n set shadowEnabled(value) {\n if (this._shadowEnabled === value) {\n return;\n }\n this._shadowEnabled = value;\n this._markMeshesAsLightDirty();\n }\n /**\n * Gets the only meshes impacted by this light.\n */\n get includedOnlyMeshes() {\n return this._includedOnlyMeshes;\n }\n /**\n * Sets the only meshes impacted by this light.\n */\n set includedOnlyMeshes(value) {\n this._includedOnlyMeshes = value;\n this._hookArrayForIncludedOnly(value);\n }\n /**\n * Gets the meshes not impacted by this light.\n */\n get excludedMeshes() {\n return this._excludedMeshes;\n }\n /**\n * Sets the meshes not impacted by this light.\n */\n set excludedMeshes(value) {\n this._excludedMeshes = value;\n this._hookArrayForExcluded(value);\n }\n /**\n * Gets the layer id use to find what meshes are not impacted by the light.\n * Inactive if 0\n */\n get excludeWithLayerMask() {\n return this._excludeWithLayerMask;\n }\n /**\n * Sets the layer id use to find what meshes are not impacted by the light.\n * Inactive if 0\n */\n set excludeWithLayerMask(value) {\n this._excludeWithLayerMask = value;\n this._resyncMeshes();\n }\n /**\n * Gets the layer id use to find what meshes are impacted by the light.\n * Inactive if 0\n */\n get includeOnlyWithLayerMask() {\n return this._includeOnlyWithLayerMask;\n }\n /**\n * Sets the layer id use to find what meshes are impacted by the light.\n * Inactive if 0\n */\n set includeOnlyWithLayerMask(value) {\n this._includeOnlyWithLayerMask = value;\n this._resyncMeshes();\n }\n /**\n * Gets the lightmap mode of this light (should be one of the constants defined by Light.LIGHTMAP_x)\n */\n get lightmapMode() {\n return this._lightmapMode;\n }\n /**\n * Sets the lightmap mode of this light (should be one of the constants defined by Light.LIGHTMAP_x)\n */\n set lightmapMode(value) {\n if (this._lightmapMode === value) {\n return;\n }\n this._lightmapMode = value;\n this._markMeshesAsLightDirty();\n }\n /**\n * Creates a Light object in the scene.\n * Documentation : https://doc.babylonjs.com/features/featuresDeepDive/lights/lights_introduction\n * @param name The friendly name of the light\n * @param scene The scene the light belongs too\n */\n constructor(name, scene) {\n super(name, scene);\n /**\n * Diffuse gives the basic color to an object.\n */\n this.diffuse = new Color3(1.0, 1.0, 1.0);\n /**\n * Specular produces a highlight color on an object.\n * Note: This is not affecting PBR materials.\n */\n this.specular = new Color3(1.0, 1.0, 1.0);\n /**\n * Defines the falloff type for this light. This lets overriding how punctual light are\n * falling off base on range or angle.\n * This can be set to any values in Light.FALLOFF_x.\n *\n * Note: This is only useful for PBR Materials at the moment. This could be extended if required to\n * other types of materials.\n */\n this.falloffType = Light.FALLOFF_DEFAULT;\n /**\n * Strength of the light.\n * Note: By default it is define in the framework own unit.\n * Note: In PBR materials the intensityMode can be use to chose what unit the intensity is defined in.\n */\n this.intensity = 1.0;\n this._range = Number.MAX_VALUE;\n this._inverseSquaredRange = 0;\n /**\n * Cached photometric scale default to 1.0 as the automatic intensity mode defaults to 1.0 for every type\n * of light.\n */\n this._photometricScale = 1.0;\n this._intensityMode = Light.INTENSITYMODE_AUTOMATIC;\n this._radius = 0.00001;\n /**\n * Defines the rendering priority of the lights. It can help in case of fallback or number of lights\n * exceeding the number allowed of the materials.\n */\n this.renderPriority = 0;\n this._shadowEnabled = true;\n this._excludeWithLayerMask = 0;\n this._includeOnlyWithLayerMask = 0;\n this._lightmapMode = 0;\n /**\n * Shadow generators associated to the light.\n * @internal Internal use only.\n */\n this._shadowGenerators = null;\n /**\n * @internal Internal use only.\n */\n this._excludedMeshesIds = new Array();\n /**\n * @internal Internal use only.\n */\n this._includedOnlyMeshesIds = new Array();\n /** @internal */\n this._isLight = true;\n this.getScene().addLight(this);\n this._uniformBuffer = new UniformBuffer(this.getScene().getEngine(), undefined, undefined, name);\n this._buildUniformLayout();\n this.includedOnlyMeshes = new Array();\n this.excludedMeshes = new Array();\n this._resyncMeshes();\n }\n /**\n * Sets the passed Effect \"effect\" with the Light textures.\n * @param effect The effect to update\n * @param lightIndex The index of the light in the effect to update\n * @returns The light\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n transferTexturesToEffect(effect, lightIndex) {\n // Do nothing by default.\n return this;\n }\n /**\n * Binds the lights information from the scene to the effect for the given mesh.\n * @param lightIndex Light index\n * @param scene The scene where the light belongs to\n * @param effect The effect we are binding the data to\n * @param useSpecular Defines if specular is supported\n * @param receiveShadows Defines if the effect (mesh) we bind the light for receives shadows\n */\n _bindLight(lightIndex, scene, effect, useSpecular, receiveShadows = true) {\n var _a;\n const iAsString = lightIndex.toString();\n let needUpdate = false;\n this._uniformBuffer.bindToEffect(effect, \"Light\" + iAsString);\n if (this._renderId !== scene.getRenderId() || this._lastUseSpecular !== useSpecular || !this._uniformBuffer.useUbo) {\n this._renderId = scene.getRenderId();\n this._lastUseSpecular = useSpecular;\n const scaledIntensity = this.getScaledIntensity();\n this.transferToEffect(effect, iAsString);\n this.diffuse.scaleToRef(scaledIntensity, TmpColors.Color3[0]);\n this._uniformBuffer.updateColor4(\"vLightDiffuse\", TmpColors.Color3[0], this.range, iAsString);\n if (useSpecular) {\n this.specular.scaleToRef(scaledIntensity, TmpColors.Color3[1]);\n this._uniformBuffer.updateColor4(\"vLightSpecular\", TmpColors.Color3[1], this.radius, iAsString);\n }\n needUpdate = true;\n }\n // Textures might still need to be rebound.\n this.transferTexturesToEffect(effect, iAsString);\n // Shadows\n if (scene.shadowsEnabled && this.shadowEnabled && receiveShadows) {\n const shadowGenerator = (_a = this.getShadowGenerator(scene.activeCamera)) !== null && _a !== void 0 ? _a : this.getShadowGenerator();\n if (shadowGenerator) {\n shadowGenerator.bindShadowLight(iAsString, effect);\n needUpdate = true;\n }\n }\n if (needUpdate) {\n this._uniformBuffer.update();\n }\n else {\n this._uniformBuffer.bindUniformBuffer();\n }\n }\n /**\n * Returns the string \"Light\".\n * @returns the class name\n */\n getClassName() {\n return \"Light\";\n }\n /**\n * Converts the light information to a readable string for debug purpose.\n * @param fullDetails Supports for multiple levels of logging within scene loading\n * @returns the human readable light info\n */\n toString(fullDetails) {\n let ret = \"Name: \" + this.name;\n ret += \", type: \" + [\"Point\", \"Directional\", \"Spot\", \"Hemispheric\"][this.getTypeID()];\n if (this.animations) {\n for (let i = 0; i < this.animations.length; i++) {\n ret += \", animation[0]: \" + this.animations[i].toString(fullDetails);\n }\n }\n return ret;\n }\n /** @internal */\n _syncParentEnabledState() {\n super._syncParentEnabledState();\n if (!this.isDisposed()) {\n this._resyncMeshes();\n }\n }\n /**\n * Set the enabled state of this node.\n * @param value - the new enabled state\n */\n setEnabled(value) {\n super.setEnabled(value);\n this._resyncMeshes();\n }\n /**\n * Returns the Light associated shadow generator if any.\n * @param camera Camera for which the shadow generator should be retrieved (default: null). If null, retrieves the default shadow generator\n * @returns the associated shadow generator.\n */\n getShadowGenerator(camera = null) {\n var _a;\n if (this._shadowGenerators === null) {\n return null;\n }\n return (_a = this._shadowGenerators.get(camera)) !== null && _a !== void 0 ? _a : null;\n }\n /**\n * Returns all the shadow generators associated to this light\n * @returns\n */\n getShadowGenerators() {\n return this._shadowGenerators;\n }\n /**\n * Returns a Vector3, the absolute light position in the World.\n * @returns the world space position of the light\n */\n getAbsolutePosition() {\n return Vector3.Zero();\n }\n /**\n * Specifies if the light will affect the passed mesh.\n * @param mesh The mesh to test against the light\n * @returns true the mesh is affected otherwise, false.\n */\n canAffectMesh(mesh) {\n if (!mesh) {\n return true;\n }\n if (this.includedOnlyMeshes && this.includedOnlyMeshes.length > 0 && this.includedOnlyMeshes.indexOf(mesh) === -1) {\n return false;\n }\n if (this.excludedMeshes && this.excludedMeshes.length > 0 && this.excludedMeshes.indexOf(mesh) !== -1) {\n return false;\n }\n if (this.includeOnlyWithLayerMask !== 0 && (this.includeOnlyWithLayerMask & mesh.layerMask) === 0) {\n return false;\n }\n if (this.excludeWithLayerMask !== 0 && this.excludeWithLayerMask & mesh.layerMask) {\n return false;\n }\n return true;\n }\n /**\n * Releases resources associated with this node.\n * @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)\n * @param disposeMaterialAndTextures Set to true to also dispose referenced materials and textures (false by default)\n */\n dispose(doNotRecurse, disposeMaterialAndTextures = false) {\n if (this._shadowGenerators) {\n const iterator = this._shadowGenerators.values();\n for (let key = iterator.next(); key.done !== true; key = iterator.next()) {\n const shadowGenerator = key.value;\n shadowGenerator.dispose();\n }\n this._shadowGenerators = null;\n }\n // Animations\n this.getScene().stopAnimation(this);\n if (this._parentContainer) {\n const index = this._parentContainer.lights.indexOf(this);\n if (index > -1) {\n this._parentContainer.lights.splice(index, 1);\n }\n this._parentContainer = null;\n }\n // Remove from meshes\n for (const mesh of this.getScene().meshes) {\n mesh._removeLightSource(this, true);\n }\n this._uniformBuffer.dispose();\n // Remove from scene\n this.getScene().removeLight(this);\n super.dispose(doNotRecurse, disposeMaterialAndTextures);\n }\n /**\n * Returns the light type ID (integer).\n * @returns The light Type id as a constant defines in Light.LIGHTTYPEID_x\n */\n getTypeID() {\n return 0;\n }\n /**\n * Returns the intensity scaled by the Photometric Scale according to the light type and intensity mode.\n * @returns the scaled intensity in intensity mode unit\n */\n getScaledIntensity() {\n return this._photometricScale * this.intensity;\n }\n /**\n * Returns a new Light object, named \"name\", from the current one.\n * @param name The name of the cloned light\n * @param newParent The parent of this light, if it has one\n * @returns the new created light\n */\n clone(name, newParent = null) {\n const constructor = Light.GetConstructorFromName(this.getTypeID(), name, this.getScene());\n if (!constructor) {\n return null;\n }\n const clonedLight = SerializationHelper.Clone(constructor, this);\n if (name) {\n clonedLight.name = name;\n }\n if (newParent) {\n clonedLight.parent = newParent;\n }\n clonedLight.setEnabled(this.isEnabled());\n this.onClonedObservable.notifyObservers(clonedLight);\n return clonedLight;\n }\n /**\n * Serializes the current light into a Serialization object.\n * @returns the serialized object.\n */\n serialize() {\n const serializationObject = SerializationHelper.Serialize(this);\n serializationObject.uniqueId = this.uniqueId;\n // Type\n serializationObject.type = this.getTypeID();\n // Parent\n if (this.parent) {\n this.parent._serializeAsParent(serializationObject);\n }\n // Inclusion / exclusions\n if (this.excludedMeshes.length > 0) {\n serializationObject.excludedMeshesIds = [];\n this.excludedMeshes.forEach((mesh) => {\n serializationObject.excludedMeshesIds.push(mesh.id);\n });\n }\n if (this.includedOnlyMeshes.length > 0) {\n serializationObject.includedOnlyMeshesIds = [];\n this.includedOnlyMeshes.forEach((mesh) => {\n serializationObject.includedOnlyMeshesIds.push(mesh.id);\n });\n }\n // Animations\n SerializationHelper.AppendSerializedAnimations(this, serializationObject);\n serializationObject.ranges = this.serializeAnimationRanges();\n serializationObject.isEnabled = this.isEnabled();\n return serializationObject;\n }\n /**\n * Creates a new typed light from the passed type (integer) : point light = 0, directional light = 1, spot light = 2, hemispheric light = 3.\n * This new light is named \"name\" and added to the passed scene.\n * @param type Type according to the types available in Light.LIGHTTYPEID_x\n * @param name The friendly name of the light\n * @param scene The scene the new light will belong to\n * @returns the constructor function\n */\n static GetConstructorFromName(type, name, scene) {\n const constructorFunc = Node.Construct(\"Light_Type_\" + type, name, scene);\n if (constructorFunc) {\n return constructorFunc;\n }\n // Default to no light for none present once.\n return null;\n }\n /**\n * Parses the passed \"parsedLight\" and returns a new instanced Light from this parsing.\n * @param parsedLight The JSON representation of the light\n * @param scene The scene to create the parsed light in\n * @returns the created light after parsing\n */\n static Parse(parsedLight, scene) {\n const constructor = Light.GetConstructorFromName(parsedLight.type, parsedLight.name, scene);\n if (!constructor) {\n return null;\n }\n const light = SerializationHelper.Parse(constructor, parsedLight, scene);\n // Inclusion / exclusions\n if (parsedLight.excludedMeshesIds) {\n light._excludedMeshesIds = parsedLight.excludedMeshesIds;\n }\n if (parsedLight.includedOnlyMeshesIds) {\n light._includedOnlyMeshesIds = parsedLight.includedOnlyMeshesIds;\n }\n // Parent\n if (parsedLight.parentId !== undefined) {\n light._waitingParentId = parsedLight.parentId;\n }\n if (parsedLight.parentInstanceIndex !== undefined) {\n light._waitingParentInstanceIndex = parsedLight.parentInstanceIndex;\n }\n // Falloff\n if (parsedLight.falloffType !== undefined) {\n light.falloffType = parsedLight.falloffType;\n }\n // Lightmaps\n if (parsedLight.lightmapMode !== undefined) {\n light.lightmapMode = parsedLight.lightmapMode;\n }\n // Animations\n if (parsedLight.animations) {\n for (let animationIndex = 0; animationIndex < parsedLight.animations.length; animationIndex++) {\n const parsedAnimation = parsedLight.animations[animationIndex];\n const internalClass = GetClass(\"BABYLON.Animation\");\n if (internalClass) {\n light.animations.push(internalClass.Parse(parsedAnimation));\n }\n }\n Node.ParseAnimationRanges(light, parsedLight, scene);\n }\n if (parsedLight.autoAnimate) {\n scene.beginAnimation(light, parsedLight.autoAnimateFrom, parsedLight.autoAnimateTo, parsedLight.autoAnimateLoop, parsedLight.autoAnimateSpeed || 1.0);\n }\n // Check if isEnabled is defined to be back compatible with prior serialized versions.\n if (parsedLight.isEnabled !== undefined) {\n light.setEnabled(parsedLight.isEnabled);\n }\n return light;\n }\n _hookArrayForExcluded(array) {\n const oldPush = array.push;\n array.push = (...items) => {\n const result = oldPush.apply(array, items);\n for (const item of items) {\n item._resyncLightSource(this);\n }\n return result;\n };\n const oldSplice = array.splice;\n array.splice = (index, deleteCount) => {\n const deleted = oldSplice.apply(array, [index, deleteCount]);\n for (const item of deleted) {\n item._resyncLightSource(this);\n }\n return deleted;\n };\n for (const item of array) {\n item._resyncLightSource(this);\n }\n }\n _hookArrayForIncludedOnly(array) {\n const oldPush = array.push;\n array.push = (...items) => {\n const result = oldPush.apply(array, items);\n this._resyncMeshes();\n return result;\n };\n const oldSplice = array.splice;\n array.splice = (index, deleteCount) => {\n const deleted = oldSplice.apply(array, [index, deleteCount]);\n this._resyncMeshes();\n return deleted;\n };\n this._resyncMeshes();\n }\n _resyncMeshes() {\n for (const mesh of this.getScene().meshes) {\n mesh._resyncLightSource(this);\n }\n }\n /**\n * Forces the meshes to update their light related information in their rendering used effects\n * @internal Internal Use Only\n */\n _markMeshesAsLightDirty() {\n for (const mesh of this.getScene().meshes) {\n if (mesh.lightSources.indexOf(this) !== -1) {\n mesh._markSubMeshesAsLightDirty();\n }\n }\n }\n /**\n * Recomputes the cached photometric scale if needed.\n */\n _computePhotometricScale() {\n this._photometricScale = this._getPhotometricScale();\n this.getScene().resetCachedMaterial();\n }\n /**\n * Returns the Photometric Scale according to the light type and intensity mode.\n */\n _getPhotometricScale() {\n let photometricScale = 0.0;\n const lightTypeID = this.getTypeID();\n //get photometric mode\n let photometricMode = this.intensityMode;\n if (photometricMode === Light.INTENSITYMODE_AUTOMATIC) {\n if (lightTypeID === Light.LIGHTTYPEID_DIRECTIONALLIGHT) {\n photometricMode = Light.INTENSITYMODE_ILLUMINANCE;\n }\n else {\n photometricMode = Light.INTENSITYMODE_LUMINOUSINTENSITY;\n }\n }\n //compute photometric scale\n switch (lightTypeID) {\n case Light.LIGHTTYPEID_POINTLIGHT:\n case Light.LIGHTTYPEID_SPOTLIGHT:\n switch (photometricMode) {\n case Light.INTENSITYMODE_LUMINOUSPOWER:\n photometricScale = 1.0 / (4.0 * Math.PI);\n break;\n case Light.INTENSITYMODE_LUMINOUSINTENSITY:\n photometricScale = 1.0;\n break;\n case Light.INTENSITYMODE_LUMINANCE:\n photometricScale = this.radius * this.radius;\n break;\n }\n break;\n case Light.LIGHTTYPEID_DIRECTIONALLIGHT:\n switch (photometricMode) {\n case Light.INTENSITYMODE_ILLUMINANCE:\n photometricScale = 1.0;\n break;\n case Light.INTENSITYMODE_LUMINANCE: {\n // When radius (and therefore solid angle) is non-zero a directional lights brightness can be specified via central (peak) luminance.\n // For a directional light the 'radius' defines the angular radius (in radians) rather than world-space radius (e.g. in metres).\n let apexAngleRadians = this.radius;\n // Impose a minimum light angular size to avoid the light becoming an infinitely small angular light source (i.e. a dirac delta function).\n apexAngleRadians = Math.max(apexAngleRadians, 0.001);\n const solidAngle = 2.0 * Math.PI * (1.0 - Math.cos(apexAngleRadians));\n photometricScale = solidAngle;\n break;\n }\n }\n break;\n case Light.LIGHTTYPEID_HEMISPHERICLIGHT:\n // No fall off in hemispheric light.\n photometricScale = 1.0;\n break;\n }\n return photometricScale;\n }\n /**\n * Reorder the light in the scene according to their defined priority.\n * @internal Internal Use Only\n */\n _reorderLightsInScene() {\n const scene = this.getScene();\n if (this._renderPriority != 0) {\n scene.requireLightSorting = true;\n }\n this.getScene().sortLightsByPriority();\n }\n}\n/**\n * Falloff Default: light is falling off following the material specification:\n * standard material is using standard falloff whereas pbr material can request special falloff per materials.\n */\nLight.FALLOFF_DEFAULT = LightConstants.FALLOFF_DEFAULT;\n/**\n * Falloff Physical: light is falling off following the inverse squared distance law.\n */\nLight.FALLOFF_PHYSICAL = LightConstants.FALLOFF_PHYSICAL;\n/**\n * Falloff gltf: light is falling off as described in the gltf moving to PBR document\n * to enhance interoperability with other engines.\n */\nLight.FALLOFF_GLTF = LightConstants.FALLOFF_GLTF;\n/**\n * Falloff Standard: light is falling off like in the standard material\n * to enhance interoperability with other materials.\n */\nLight.FALLOFF_STANDARD = LightConstants.FALLOFF_STANDARD;\n//lightmapMode Consts\n/**\n * If every light affecting the material is in this lightmapMode,\n * material.lightmapTexture adds or multiplies\n * (depends on material.useLightmapAsShadowmap)\n * after every other light calculations.\n */\nLight.LIGHTMAP_DEFAULT = LightConstants.LIGHTMAP_DEFAULT;\n/**\n * material.lightmapTexture as only diffuse lighting from this light\n * adds only specular lighting from this light\n * adds dynamic shadows\n */\nLight.LIGHTMAP_SPECULAR = LightConstants.LIGHTMAP_SPECULAR;\n/**\n * material.lightmapTexture as only lighting\n * no light calculation from this light\n * only adds dynamic shadows from this light\n */\nLight.LIGHTMAP_SHADOWSONLY = LightConstants.LIGHTMAP_SHADOWSONLY;\n// Intensity Mode Consts\n/**\n * Each light type uses the default quantity according to its type:\n * point/spot lights use luminous intensity\n * directional lights use illuminance\n */\nLight.INTENSITYMODE_AUTOMATIC = LightConstants.INTENSITYMODE_AUTOMATIC;\n/**\n * lumen (lm)\n */\nLight.INTENSITYMODE_LUMINOUSPOWER = LightConstants.INTENSITYMODE_LUMINOUSPOWER;\n/**\n * candela (lm/sr)\n */\nLight.INTENSITYMODE_LUMINOUSINTENSITY = LightConstants.INTENSITYMODE_LUMINOUSINTENSITY;\n/**\n * lux (lm/m^2)\n */\nLight.INTENSITYMODE_ILLUMINANCE = LightConstants.INTENSITYMODE_ILLUMINANCE;\n/**\n * nit (cd/m^2)\n */\nLight.INTENSITYMODE_LUMINANCE = LightConstants.INTENSITYMODE_LUMINANCE;\n// Light types ids const.\n/**\n * Light type const id of the point light.\n */\nLight.LIGHTTYPEID_POINTLIGHT = LightConstants.LIGHTTYPEID_POINTLIGHT;\n/**\n * Light type const id of the directional light.\n */\nLight.LIGHTTYPEID_DIRECTIONALLIGHT = LightConstants.LIGHTTYPEID_DIRECTIONALLIGHT;\n/**\n * Light type const id of the spot light.\n */\nLight.LIGHTTYPEID_SPOTLIGHT = LightConstants.LIGHTTYPEID_SPOTLIGHT;\n/**\n * Light type const id of the hemispheric light.\n */\nLight.LIGHTTYPEID_HEMISPHERICLIGHT = LightConstants.LIGHTTYPEID_HEMISPHERICLIGHT;\n__decorate([\n serializeAsColor3()\n], Light.prototype, \"diffuse\", void 0);\n__decorate([\n serializeAsColor3()\n], Light.prototype, \"specular\", void 0);\n__decorate([\n serialize()\n], Light.prototype, \"falloffType\", void 0);\n__decorate([\n serialize()\n], Light.prototype, \"intensity\", void 0);\n__decorate([\n serialize()\n], Light.prototype, \"range\", null);\n__decorate([\n serialize()\n], Light.prototype, \"intensityMode\", null);\n__decorate([\n serialize()\n], Light.prototype, \"radius\", null);\n__decorate([\n serialize()\n], Light.prototype, \"_renderPriority\", void 0);\n__decorate([\n expandToProperty(\"_reorderLightsInScene\")\n], Light.prototype, \"renderPriority\", void 0);\n__decorate([\n serialize(\"shadowEnabled\")\n], Light.prototype, \"_shadowEnabled\", void 0);\n__decorate([\n serialize(\"excludeWithLayerMask\")\n], Light.prototype, \"_excludeWithLayerMask\", void 0);\n__decorate([\n serialize(\"includeOnlyWithLayerMask\")\n], Light.prototype, \"_includeOnlyWithLayerMask\", void 0);\n__decorate([\n serialize(\"lightmapMode\")\n], Light.prototype, \"_lightmapMode\", void 0);\n//# sourceMappingURL=light.js.map","import { AbstractScene } from \"./abstractScene.js\";\nimport { Mesh } from \"./Meshes/mesh.js\";\nimport { TransformNode } from \"./Meshes/transformNode.js\";\nimport { Logger } from \"./Misc/logger.js\";\nimport { EngineStore } from \"./Engines/engineStore.js\";\nimport { InstancedMesh } from \"./Meshes/instancedMesh.js\";\nimport { Light } from \"./Lights/light.js\";\nimport { Camera } from \"./Cameras/camera.js\";\nimport { Tools } from \"./Misc/tools.js\";\n/**\n * Set of assets to keep when moving a scene into an asset container.\n */\nexport class KeepAssets extends AbstractScene {\n}\n/**\n * Class used to store the output of the AssetContainer.instantiateAllMeshesToScene function\n */\nexport class InstantiatedEntries {\n constructor() {\n /**\n * List of new root nodes (eg. nodes with no parent)\n */\n this.rootNodes = [];\n /**\n * List of new skeletons\n */\n this.skeletons = [];\n /**\n * List of new animation groups\n */\n this.animationGroups = [];\n }\n /**\n * Disposes the instantiated entries from the scene\n */\n dispose() {\n this.rootNodes.slice(0).forEach((o) => {\n o.dispose();\n });\n this.rootNodes.length = 0;\n this.skeletons.slice(0).forEach((o) => {\n o.dispose();\n });\n this.skeletons.length = 0;\n this.animationGroups.slice(0).forEach((o) => {\n o.dispose();\n });\n this.animationGroups.length = 0;\n }\n}\n/**\n * Container with a set of assets that can be added or removed from a scene.\n */\nexport class AssetContainer extends AbstractScene {\n /**\n * Instantiates an AssetContainer.\n * @param scene The scene the AssetContainer belongs to.\n */\n constructor(scene) {\n super();\n this._wasAddedToScene = false;\n scene = scene || EngineStore.LastCreatedScene;\n if (!scene) {\n return;\n }\n this.scene = scene;\n this[\"sounds\"] = [];\n this[\"effectLayers\"] = [];\n this[\"layers\"] = [];\n this[\"lensFlareSystems\"] = [];\n this[\"proceduralTextures\"] = [];\n this[\"reflectionProbes\"] = [];\n scene.onDisposeObservable.add(() => {\n if (!this._wasAddedToScene) {\n this.dispose();\n }\n });\n this._onContextRestoredObserver = scene.getEngine().onContextRestoredObservable.add(() => {\n for (const geometry of this.geometries) {\n geometry._rebuild();\n }\n for (const mesh of this.meshes) {\n mesh._rebuild();\n }\n for (const system of this.particleSystems) {\n system.rebuild();\n }\n for (const texture of this.textures) {\n texture._rebuild();\n }\n });\n }\n /**\n * Given a list of nodes, return a topological sorting of them.\n * @param nodes\n */\n _topologicalSort(nodes) {\n const nodesUidMap = new Map();\n for (const node of nodes) {\n nodesUidMap.set(node.uniqueId, node);\n }\n const dependencyGraph = {\n dependsOn: new Map(),\n dependedBy: new Map(), // given a node id, what are the ids of the nodes that depend on it\n };\n // Build the dependency graph given the list of nodes\n // First pass: Initialize the empty dependency graph\n for (const node of nodes) {\n const nodeId = node.uniqueId;\n dependencyGraph.dependsOn.set(nodeId, new Set());\n dependencyGraph.dependedBy.set(nodeId, new Set());\n }\n // Second pass: Populate the dependency graph. We assume that we\n // don't need to check for cycles here, as the scene graph cannot\n // contain cycles. Our graph also already contains all transitive\n // dependencies because getDescendants returns the transitive\n // dependencies by default.\n for (const node of nodes) {\n const nodeId = node.uniqueId;\n const dependsOn = dependencyGraph.dependsOn.get(nodeId);\n if (node instanceof InstancedMesh) {\n const masterMesh = node.sourceMesh;\n if (nodesUidMap.has(masterMesh.uniqueId)) {\n dependsOn.add(masterMesh.uniqueId);\n dependencyGraph.dependedBy.get(masterMesh.uniqueId).add(nodeId);\n }\n }\n const dependedBy = dependencyGraph.dependedBy.get(nodeId);\n for (const child of node.getDescendants()) {\n const childId = child.uniqueId;\n if (nodesUidMap.has(childId)) {\n dependedBy.add(childId);\n const childDependsOn = dependencyGraph.dependsOn.get(childId);\n childDependsOn.add(nodeId);\n }\n }\n }\n // Third pass: Topological sort\n const sortedNodes = [];\n // First: Find all nodes that have no dependencies\n const leaves = [];\n for (const node of nodes) {\n const nodeId = node.uniqueId;\n if (dependencyGraph.dependsOn.get(nodeId).size === 0) {\n leaves.push(node);\n nodesUidMap.delete(nodeId);\n }\n }\n const visitList = leaves;\n while (visitList.length > 0) {\n const nodeToVisit = visitList.shift();\n sortedNodes.push(nodeToVisit);\n // Remove the node from the dependency graph\n // When a node is visited, we know that dependsOn is empty.\n // So we only need to remove the node from dependedBy.\n const dependedByVisitedNode = dependencyGraph.dependedBy.get(nodeToVisit.uniqueId);\n // Array.from(x.values()) is to make the TS compiler happy\n for (const dependedByVisitedNodeId of Array.from(dependedByVisitedNode.values())) {\n const dependsOnDependedByVisitedNode = dependencyGraph.dependsOn.get(dependedByVisitedNodeId);\n dependsOnDependedByVisitedNode.delete(nodeToVisit.uniqueId);\n if (dependsOnDependedByVisitedNode.size === 0 && nodesUidMap.get(dependedByVisitedNodeId)) {\n visitList.push(nodesUidMap.get(dependedByVisitedNodeId));\n nodesUidMap.delete(dependedByVisitedNodeId);\n }\n }\n }\n if (nodesUidMap.size > 0) {\n console.error(\"SceneSerializer._topologicalSort: There were unvisited nodes:\");\n nodesUidMap.forEach((node) => console.error(node.name));\n }\n return sortedNodes;\n }\n _addNodeAndDescendantsToList(list, addedIds, rootNode, predicate) {\n if (!rootNode || (predicate && !predicate(rootNode)) || addedIds.has(rootNode.uniqueId)) {\n return;\n }\n list.push(rootNode);\n addedIds.add(rootNode.uniqueId);\n for (const child of rootNode.getDescendants(true)) {\n this._addNodeAndDescendantsToList(list, addedIds, child, predicate);\n }\n }\n /**\n * Check if a specific node is contained in this asset container.\n * @param node\n */\n _isNodeInContainer(node) {\n if (node instanceof Mesh && this.meshes.indexOf(node) !== -1) {\n return true;\n }\n if (node instanceof TransformNode && this.transformNodes.indexOf(node) !== -1) {\n return true;\n }\n if (node instanceof Light && this.lights.indexOf(node) !== -1) {\n return true;\n }\n if (node instanceof Camera && this.cameras.indexOf(node) !== -1) {\n return true;\n }\n return false;\n }\n /**\n * For every node in the scene, check if its parent node is also in the scene.\n */\n _isValidHierarchy() {\n for (const node of this.meshes) {\n if (node.parent && !this._isNodeInContainer(node.parent)) {\n Logger.Warn(`Node ${node.name} has a parent that is not in the container.`);\n return false;\n }\n }\n for (const node of this.transformNodes) {\n if (node.parent && !this._isNodeInContainer(node.parent)) {\n Logger.Warn(`Node ${node.name} has a parent that is not in the container.`);\n return false;\n }\n }\n for (const node of this.lights) {\n if (node.parent && !this._isNodeInContainer(node.parent)) {\n Logger.Warn(`Node ${node.name} has a parent that is not in the container.`);\n return false;\n }\n }\n for (const node of this.cameras) {\n if (node.parent && !this._isNodeInContainer(node.parent)) {\n Logger.Warn(`Node ${node.name} has a parent that is not in the container.`);\n return false;\n }\n }\n return true;\n }\n /**\n * Instantiate or clone all meshes and add the new ones to the scene.\n * Skeletons and animation groups will all be cloned\n * @param nameFunction defines an optional function used to get new names for clones\n * @param cloneMaterials defines an optional boolean that defines if materials must be cloned as well (false by default)\n * @param options defines an optional list of options to control how to instantiate / clone models\n * @param options.doNotInstantiate defines if the model must be instantiated or just cloned\n * @param options.predicate defines a predicate used to filter whih mesh to instantiate/clone\n * @returns a list of rootNodes, skeletons and animation groups that were duplicated\n */\n instantiateModelsToScene(nameFunction, cloneMaterials = false, options) {\n if (!this._isValidHierarchy()) {\n Tools.Warn(\"SceneSerializer.InstantiateModelsToScene: The Asset Container hierarchy is not valid.\");\n }\n const conversionMap = {};\n const storeMap = {};\n const result = new InstantiatedEntries();\n const alreadySwappedSkeletons = [];\n const alreadySwappedMaterials = [];\n const localOptions = Object.assign({ doNotInstantiate: true }, options);\n const onClone = (source, clone) => {\n conversionMap[source.uniqueId] = clone.uniqueId;\n storeMap[clone.uniqueId] = clone;\n if (nameFunction) {\n clone.name = nameFunction(source.name);\n }\n if (clone instanceof Mesh) {\n const clonedMesh = clone;\n if (clonedMesh.morphTargetManager) {\n const oldMorphTargetManager = source.morphTargetManager;\n clonedMesh.morphTargetManager = oldMorphTargetManager.clone();\n for (let index = 0; index < oldMorphTargetManager.numTargets; index++) {\n const oldTarget = oldMorphTargetManager.getTarget(index);\n const newTarget = clonedMesh.morphTargetManager.getTarget(index);\n conversionMap[oldTarget.uniqueId] = newTarget.uniqueId;\n storeMap[newTarget.uniqueId] = newTarget;\n }\n }\n }\n };\n const nodesToSort = [];\n const idsOnSortList = new Set();\n for (const transformNode of this.transformNodes) {\n if (transformNode.parent === null) {\n this._addNodeAndDescendantsToList(nodesToSort, idsOnSortList, transformNode, localOptions.predicate);\n }\n }\n for (const mesh of this.meshes) {\n if (mesh.parent === null) {\n this._addNodeAndDescendantsToList(nodesToSort, idsOnSortList, mesh, localOptions.predicate);\n }\n }\n // Topologically sort nodes by parenting/instancing relationships so that all resources are in place\n // when a given node is instantiated.\n const sortedNodes = this._topologicalSort(nodesToSort);\n const onNewCreated = (source, clone) => {\n onClone(source, clone);\n if (source.parent) {\n const replicatedParentId = conversionMap[source.parent.uniqueId];\n const replicatedParent = storeMap[replicatedParentId];\n if (replicatedParent) {\n clone.parent = replicatedParent;\n }\n else {\n clone.parent = source.parent;\n }\n }\n if (clone.position && source.position) {\n clone.position.copyFrom(source.position);\n }\n if (clone.rotationQuaternion && source.rotationQuaternion) {\n clone.rotationQuaternion.copyFrom(source.rotationQuaternion);\n }\n if (clone.rotation && source.rotation) {\n clone.rotation.copyFrom(source.rotation);\n }\n if (clone.scaling && source.scaling) {\n clone.scaling.copyFrom(source.scaling);\n }\n if (clone.material) {\n const mesh = clone;\n if (mesh.material) {\n if (cloneMaterials) {\n const sourceMaterial = source.material;\n if (alreadySwappedMaterials.indexOf(sourceMaterial) === -1) {\n let swap = sourceMaterial.clone(nameFunction ? nameFunction(sourceMaterial.name) : \"Clone of \" + sourceMaterial.name);\n alreadySwappedMaterials.push(sourceMaterial);\n conversionMap[sourceMaterial.uniqueId] = swap.uniqueId;\n storeMap[swap.uniqueId] = swap;\n if (sourceMaterial.getClassName() === \"MultiMaterial\") {\n const multi = sourceMaterial;\n for (const material of multi.subMaterials) {\n if (!material) {\n continue;\n }\n swap = material.clone(nameFunction ? nameFunction(material.name) : \"Clone of \" + material.name);\n alreadySwappedMaterials.push(material);\n conversionMap[material.uniqueId] = swap.uniqueId;\n storeMap[swap.uniqueId] = swap;\n }\n multi.subMaterials = multi.subMaterials.map((m) => m && storeMap[conversionMap[m.uniqueId]]);\n }\n }\n if (mesh.getClassName() !== \"InstancedMesh\") {\n mesh.material = storeMap[conversionMap[sourceMaterial.uniqueId]];\n }\n }\n else {\n if (mesh.material.getClassName() === \"MultiMaterial\") {\n if (this.scene.multiMaterials.indexOf(mesh.material) === -1) {\n this.scene.addMultiMaterial(mesh.material);\n }\n }\n else {\n if (this.scene.materials.indexOf(mesh.material) === -1) {\n this.scene.addMaterial(mesh.material);\n }\n }\n }\n }\n }\n if (clone.parent === null) {\n result.rootNodes.push(clone);\n }\n };\n sortedNodes.forEach((node) => {\n if (node.getClassName() === \"InstancedMesh\") {\n const instancedNode = node;\n const sourceMesh = instancedNode.sourceMesh;\n const replicatedSourceId = conversionMap[sourceMesh.uniqueId];\n const replicatedSource = typeof replicatedSourceId === \"number\" ? storeMap[replicatedSourceId] : sourceMesh;\n const replicatedInstancedNode = replicatedSource.createInstance(instancedNode.name);\n onNewCreated(instancedNode, replicatedInstancedNode);\n }\n else {\n // Mesh or TransformNode\n let canInstance = true;\n if (node.getClassName() === \"TransformNode\" ||\n node.getClassName() === \"Node\" ||\n node.skeleton ||\n !node.getTotalVertices ||\n node.getTotalVertices() === 0) {\n // Transform nodes, skinned meshes, and meshes with no vertices can never be instanced!\n canInstance = false;\n }\n else if (localOptions.doNotInstantiate) {\n if (typeof localOptions.doNotInstantiate === \"function\") {\n canInstance = !localOptions.doNotInstantiate(node);\n }\n else {\n canInstance = !localOptions.doNotInstantiate;\n }\n }\n const replicatedNode = canInstance ? node.createInstance(`instance of ${node.name}`) : node.clone(`Clone of ${node.name}`, null, true);\n if (!replicatedNode) {\n throw new Error(`Could not clone or instantiate node on Asset Container ${node.name}`);\n }\n onNewCreated(node, replicatedNode);\n }\n });\n this.skeletons.forEach((s) => {\n if (localOptions.predicate && !localOptions.predicate(s)) {\n return;\n }\n const clone = s.clone(nameFunction ? nameFunction(s.name) : \"Clone of \" + s.name);\n for (const m of this.meshes) {\n if (m.skeleton === s && !m.isAnInstance) {\n const copy = storeMap[conversionMap[m.uniqueId]];\n if (!copy || copy.isAnInstance) {\n continue;\n }\n copy.skeleton = clone;\n if (alreadySwappedSkeletons.indexOf(clone) !== -1) {\n continue;\n }\n alreadySwappedSkeletons.push(clone);\n // Check if bones are mesh linked\n for (const bone of clone.bones) {\n if (bone._linkedTransformNode) {\n bone._linkedTransformNode = storeMap[conversionMap[bone._linkedTransformNode.uniqueId]];\n }\n }\n }\n }\n result.skeletons.push(clone);\n });\n this.animationGroups.forEach((o) => {\n if (localOptions.predicate && !localOptions.predicate(o)) {\n return;\n }\n const clone = o.clone(nameFunction ? nameFunction(o.name) : \"Clone of \" + o.name, (oldTarget) => {\n const newTarget = storeMap[conversionMap[oldTarget.uniqueId]];\n return newTarget || oldTarget;\n });\n result.animationGroups.push(clone);\n });\n return result;\n }\n /**\n * Adds all the assets from the container to the scene.\n */\n addAllToScene() {\n if (this._wasAddedToScene) {\n return;\n }\n if (!this._isValidHierarchy()) {\n Tools.Warn(\"SceneSerializer.addAllToScene: The Asset Container hierarchy is not valid.\");\n }\n this._wasAddedToScene = true;\n this.addToScene(null);\n if (this.environmentTexture) {\n this.scene.environmentTexture = this.environmentTexture;\n }\n for (const component of this.scene._serializableComponents) {\n component.addFromContainer(this);\n }\n this.scene.getEngine().onContextRestoredObservable.remove(this._onContextRestoredObserver);\n this._onContextRestoredObserver = null;\n }\n /**\n * Adds assets from the container to the scene.\n * @param predicate defines a predicate used to select which entity will be added (can be null)\n */\n addToScene(predicate = null) {\n const addedNodes = [];\n this.cameras.forEach((o) => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.addCamera(o);\n addedNodes.push(o);\n });\n this.lights.forEach((o) => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.addLight(o);\n addedNodes.push(o);\n });\n this.meshes.forEach((o) => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.addMesh(o);\n addedNodes.push(o);\n });\n this.skeletons.forEach((o) => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.addSkeleton(o);\n });\n this.animations.forEach((o) => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.addAnimation(o);\n });\n this.animationGroups.forEach((o) => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.addAnimationGroup(o);\n });\n this.multiMaterials.forEach((o) => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.addMultiMaterial(o);\n });\n this.materials.forEach((o) => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.addMaterial(o);\n });\n this.morphTargetManagers.forEach((o) => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.addMorphTargetManager(o);\n });\n this.geometries.forEach((o) => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.addGeometry(o);\n });\n this.transformNodes.forEach((o) => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.addTransformNode(o);\n addedNodes.push(o);\n });\n this.actionManagers.forEach((o) => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.addActionManager(o);\n });\n this.textures.forEach((o) => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.addTexture(o);\n });\n this.reflectionProbes.forEach((o) => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.addReflectionProbe(o);\n });\n for (const addedNode of addedNodes) {\n // If node was added to the scene, but parent is not in the scene, break the relationship\n if (addedNode.parent && this.scene.getNodes().indexOf(addedNode.parent) === -1) {\n // Use setParent to keep transform if possible\n if (addedNode.setParent) {\n addedNode.setParent(null);\n }\n else {\n addedNode.parent = null;\n }\n }\n }\n }\n /**\n * Removes all the assets in the container from the scene\n */\n removeAllFromScene() {\n if (!this._isValidHierarchy()) {\n Tools.Warn(\"SceneSerializer.removeAllFromScene: The Asset Container hierarchy is not valid.\");\n }\n this._wasAddedToScene = false;\n this.removeFromScene(null);\n if (this.environmentTexture === this.scene.environmentTexture) {\n this.scene.environmentTexture = null;\n }\n for (const component of this.scene._serializableComponents) {\n component.removeFromContainer(this);\n }\n }\n /**\n * Removes assets in the container from the scene\n * @param predicate defines a predicate used to select which entity will be added (can be null)\n */\n removeFromScene(predicate = null) {\n this.cameras.forEach((o) => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.removeCamera(o);\n });\n this.lights.forEach((o) => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.removeLight(o);\n });\n this.meshes.forEach((o) => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.removeMesh(o);\n });\n this.skeletons.forEach((o) => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.removeSkeleton(o);\n });\n this.animations.forEach((o) => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.removeAnimation(o);\n });\n this.animationGroups.forEach((o) => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.removeAnimationGroup(o);\n });\n this.multiMaterials.forEach((o) => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.removeMultiMaterial(o);\n });\n this.materials.forEach((o) => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.removeMaterial(o);\n });\n this.morphTargetManagers.forEach((o) => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.removeMorphTargetManager(o);\n });\n this.geometries.forEach((o) => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.removeGeometry(o);\n });\n this.transformNodes.forEach((o) => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.removeTransformNode(o);\n });\n this.actionManagers.forEach((o) => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.removeActionManager(o);\n });\n this.textures.forEach((o) => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.removeTexture(o);\n });\n this.reflectionProbes.forEach((o) => {\n if (predicate && !predicate(o)) {\n return;\n }\n this.scene.removeReflectionProbe(o);\n });\n }\n /**\n * Disposes all the assets in the container\n */\n dispose() {\n this.cameras.slice(0).forEach((o) => {\n o.dispose();\n });\n this.cameras.length = 0;\n this.lights.slice(0).forEach((o) => {\n o.dispose();\n });\n this.lights.length = 0;\n this.meshes.slice(0).forEach((o) => {\n o.dispose();\n });\n this.meshes.length = 0;\n this.skeletons.slice(0).forEach((o) => {\n o.dispose();\n });\n this.skeletons.length = 0;\n this.animationGroups.slice(0).forEach((o) => {\n o.dispose();\n });\n this.animationGroups.length = 0;\n this.multiMaterials.slice(0).forEach((o) => {\n o.dispose();\n });\n this.multiMaterials.length = 0;\n this.materials.slice(0).forEach((o) => {\n o.dispose();\n });\n this.materials.length = 0;\n this.geometries.slice(0).forEach((o) => {\n o.dispose();\n });\n this.geometries.length = 0;\n this.transformNodes.slice(0).forEach((o) => {\n o.dispose();\n });\n this.transformNodes.length = 0;\n this.actionManagers.slice(0).forEach((o) => {\n o.dispose();\n });\n this.actionManagers.length = 0;\n this.textures.slice(0).forEach((o) => {\n o.dispose();\n });\n this.textures.length = 0;\n this.reflectionProbes.slice(0).forEach((o) => {\n o.dispose();\n });\n this.reflectionProbes.length = 0;\n this.morphTargetManagers.slice(0).forEach((o) => {\n o.dispose();\n });\n this.morphTargetManagers.length = 0;\n if (this.environmentTexture) {\n this.environmentTexture.dispose();\n this.environmentTexture = null;\n }\n for (const component of this.scene._serializableComponents) {\n component.removeFromContainer(this, true);\n }\n if (this._onContextRestoredObserver) {\n this.scene.getEngine().onContextRestoredObservable.remove(this._onContextRestoredObserver);\n this._onContextRestoredObserver = null;\n }\n }\n _moveAssets(sourceAssets, targetAssets, keepAssets) {\n if (!sourceAssets || !targetAssets) {\n return;\n }\n for (const asset of sourceAssets) {\n let move = true;\n if (keepAssets) {\n for (const keepAsset of keepAssets) {\n if (asset === keepAsset) {\n move = false;\n break;\n }\n }\n }\n if (move) {\n targetAssets.push(asset);\n asset._parentContainer = this;\n }\n }\n }\n /**\n * Removes all the assets contained in the scene and adds them to the container.\n * @param keepAssets Set of assets to keep in the scene. (default: empty)\n */\n moveAllFromScene(keepAssets) {\n this._wasAddedToScene = false;\n if (keepAssets === undefined) {\n keepAssets = new KeepAssets();\n }\n for (const key in this) {\n if (Object.prototype.hasOwnProperty.call(this, key)) {\n this[key] = this[key] || (key === \"_environmentTexture\" ? null : []);\n this._moveAssets(this.scene[key], this[key], keepAssets[key]);\n }\n }\n this.environmentTexture = this.scene.environmentTexture;\n this.removeAllFromScene();\n }\n /**\n * Adds all meshes in the asset container to a root mesh that can be used to position all the contained meshes. The root mesh is then added to the front of the meshes in the assetContainer.\n * @returns the root mesh\n */\n createRootMesh() {\n const rootMesh = new Mesh(\"assetContainerRootMesh\", this.scene);\n this.meshes.forEach((m) => {\n if (!m.parent) {\n rootMesh.addChild(m);\n }\n });\n this.meshes.unshift(rootMesh);\n return rootMesh;\n }\n /**\n * Merge animations (direct and animation groups) from this asset container into a scene\n * @param scene is the instance of BABYLON.Scene to append to (default: last created scene)\n * @param animatables set of animatables to retarget to a node from the scene\n * @param targetConverter defines a function used to convert animation targets from the asset container to the scene (default: search node by name)\n * @returns an array of the new AnimationGroup added to the scene (empty array if none)\n */\n mergeAnimationsTo(scene = EngineStore.LastCreatedScene, animatables, targetConverter = null) {\n if (!scene) {\n Logger.Error(\"No scene available to merge animations to\");\n return [];\n }\n const _targetConverter = targetConverter\n ? targetConverter\n : (target) => {\n let node = null;\n const targetProperty = target.animations.length ? target.animations[0].targetProperty : \"\";\n /*\n BabylonJS adds special naming to targets that are children of nodes.\n This name attempts to remove that special naming to get the parent nodes name in case the target\n can't be found in the node tree\n\n Ex: Torso_primitive0 likely points to a Mesh primitive. We take away primitive0 and are left with \"Torso\" which is the name\n of the primitive's parent.\n */\n const name = target.name.split(\".\").join(\"\").split(\"_primitive\")[0];\n switch (targetProperty) {\n case \"position\":\n case \"rotationQuaternion\":\n node = scene.getTransformNodeByName(target.name) || scene.getTransformNodeByName(name);\n break;\n case \"influence\":\n node = scene.getMorphTargetByName(target.name) || scene.getMorphTargetByName(name);\n break;\n default:\n node = scene.getNodeByName(target.name) || scene.getNodeByName(name);\n }\n return node;\n };\n // Copy new node animations\n const nodesInAC = this.getNodes();\n nodesInAC.forEach((nodeInAC) => {\n const nodeInScene = _targetConverter(nodeInAC);\n if (nodeInScene !== null) {\n // Remove old animations with same target property as a new one\n for (const animationInAC of nodeInAC.animations) {\n // Doing treatment on an array for safety measure\n const animationsWithSameProperty = nodeInScene.animations.filter((animationInScene) => {\n return animationInScene.targetProperty === animationInAC.targetProperty;\n });\n for (const animationWithSameProperty of animationsWithSameProperty) {\n const index = nodeInScene.animations.indexOf(animationWithSameProperty, 0);\n if (index > -1) {\n nodeInScene.animations.splice(index, 1);\n }\n }\n }\n // Append new animations\n nodeInScene.animations = nodeInScene.animations.concat(nodeInAC.animations);\n }\n });\n const newAnimationGroups = new Array();\n // Copy new animation groups\n this.animationGroups.slice().forEach((animationGroupInAC) => {\n // Clone the animation group and all its animatables\n newAnimationGroups.push(animationGroupInAC.clone(animationGroupInAC.name, _targetConverter));\n // Remove animatables related to the asset container\n animationGroupInAC.animatables.forEach((animatable) => {\n animatable.stop();\n });\n });\n // Retarget animatables\n animatables.forEach((animatable) => {\n const target = _targetConverter(animatable.target);\n if (target) {\n // Clone the animatable and retarget it\n scene.beginAnimation(target, animatable.fromFrame, animatable.toFrame, animatable.loopAnimation, animatable.speedRatio, animatable.onAnimationEnd ? animatable.onAnimationEnd : undefined, undefined, true, undefined, animatable.onAnimationLoop ? animatable.onAnimationLoop : undefined);\n // Stop animation for the target in the asset container\n scene.stopAnimation(animatable.target);\n }\n });\n return newAnimationGroups;\n }\n /**\n * @since 6.15.0\n * This method checks for any node that has no parent\n * and is not in the rootNodes array, and adds the node\n * there, if so.\n */\n populateRootNodes() {\n this.rootNodes.length = 0;\n this.meshes.forEach((m) => {\n if (!m.parent && this.rootNodes.indexOf(m) === -1) {\n this.rootNodes.push(m);\n }\n });\n this.transformNodes.forEach((t) => {\n if (!t.parent && this.rootNodes.indexOf(t) === -1) {\n this.rootNodes.push(t);\n }\n });\n this.lights.forEach((l) => {\n if (!l.parent && this.rootNodes.indexOf(l) === -1) {\n this.rootNodes.push(l);\n }\n });\n this.cameras.forEach((c) => {\n if (!c.parent && this.rootNodes.indexOf(c) === -1) {\n this.rootNodes.push(c);\n }\n });\n }\n}\n//# sourceMappingURL=assetContainer.js.map","import { Decode } from \"./stringTools.js\";\n/**\n * Utility class for reading from a data buffer\n */\nexport class DataReader {\n /**\n * Constructor\n * @param buffer The buffer to read\n */\n constructor(buffer) {\n /**\n * The current byte offset from the beginning of the data buffer.\n */\n this.byteOffset = 0;\n this.buffer = buffer;\n }\n /**\n * Loads the given byte length.\n * @param byteLength The byte length to load\n * @returns A promise that resolves when the load is complete\n */\n loadAsync(byteLength) {\n return this.buffer.readAsync(this.byteOffset, byteLength).then((data) => {\n this._dataView = new DataView(data.buffer, data.byteOffset, data.byteLength);\n this._dataByteOffset = 0;\n });\n }\n /**\n * Read a unsigned 32-bit integer from the currently loaded data range.\n * @returns The 32-bit integer read\n */\n readUint32() {\n const value = this._dataView.getUint32(this._dataByteOffset, true);\n this._dataByteOffset += 4;\n this.byteOffset += 4;\n return value;\n }\n /**\n * Read a byte array from the currently loaded data range.\n * @param byteLength The byte length to read\n * @returns The byte array read\n */\n readUint8Array(byteLength) {\n const value = new Uint8Array(this._dataView.buffer, this._dataView.byteOffset + this._dataByteOffset, byteLength);\n this._dataByteOffset += byteLength;\n this.byteOffset += byteLength;\n return value;\n }\n /**\n * Read a string from the currently loaded data range.\n * @param byteLength The byte length to read\n * @returns The string read\n */\n readString(byteLength) {\n return Decode(this.readUint8Array(byteLength));\n }\n /**\n * Skips the given byte length the currently loaded data range.\n * @param byteLength The byte length to skip\n */\n skipBytes(byteLength) {\n this._dataByteOffset += byteLength;\n this.byteOffset += byteLength;\n }\n}\n//# sourceMappingURL=dataReader.js.map","import { Tools } from \"@babylonjs/core/Misc/tools.js\";\nfunction validateAsync(data, rootUrl, fileName, getExternalResource) {\n const options = {\n externalResourceFunction: (uri) => getExternalResource(uri).then((value) => new Uint8Array(value)),\n };\n if (fileName) {\n options.uri = rootUrl === \"file:\" ? fileName : rootUrl + fileName;\n }\n return data instanceof ArrayBuffer ? GLTFValidator.validateBytes(new Uint8Array(data), options) : GLTFValidator.validateString(data, options);\n}\n/**\n * The worker function that gets converted to a blob url to pass into a worker.\n */\nfunction workerFunc() {\n const pendingExternalResources = [];\n onmessage = (message) => {\n const data = message.data;\n switch (data.id) {\n case \"init\": {\n importScripts(data.url);\n break;\n }\n case \"validate\": {\n validateAsync(data.data, data.rootUrl, data.fileName, (uri) => new Promise((resolve, reject) => {\n const index = pendingExternalResources.length;\n pendingExternalResources.push({ resolve, reject });\n postMessage({ id: \"getExternalResource\", index: index, uri: uri });\n })).then((value) => {\n postMessage({ id: \"validate.resolve\", value: value });\n }, (reason) => {\n postMessage({ id: \"validate.reject\", reason: reason });\n });\n break;\n }\n case \"getExternalResource.resolve\": {\n pendingExternalResources[data.index].resolve(data.value);\n break;\n }\n case \"getExternalResource.reject\": {\n pendingExternalResources[data.index].reject(data.reason);\n break;\n }\n }\n };\n}\n/**\n * glTF validation\n */\nexport class GLTFValidation {\n /**\n * Validate a glTF asset using the glTF-Validator.\n * @param data The JSON of a glTF or the array buffer of a binary glTF\n * @param rootUrl The root url for the glTF\n * @param fileName The file name for the glTF\n * @param getExternalResource The callback to get external resources for the glTF validator\n * @returns A promise that resolves with the glTF validation results once complete\n */\n static ValidateAsync(data, rootUrl, fileName, getExternalResource) {\n const dataCopy = ArrayBuffer.isView(data) ? data.slice().buffer : data;\n if (typeof Worker === \"function\") {\n return new Promise((resolve, reject) => {\n const workerContent = `${validateAsync}(${workerFunc})()`;\n const workerBlobUrl = URL.createObjectURL(new Blob([workerContent], { type: \"application/javascript\" }));\n const worker = new Worker(workerBlobUrl);\n const onError = (error) => {\n worker.removeEventListener(\"error\", onError);\n worker.removeEventListener(\"message\", onMessage);\n reject(error);\n };\n const onMessage = (message) => {\n const data = message.data;\n switch (data.id) {\n case \"getExternalResource\": {\n getExternalResource(data.uri).then((value) => {\n worker.postMessage({ id: \"getExternalResource.resolve\", index: data.index, value: value }, [value]);\n }, (reason) => {\n worker.postMessage({ id: \"getExternalResource.reject\", index: data.index, reason: reason });\n });\n break;\n }\n case \"validate.resolve\": {\n worker.removeEventListener(\"error\", onError);\n worker.removeEventListener(\"message\", onMessage);\n resolve(data.value);\n worker.terminate();\n break;\n }\n case \"validate.reject\": {\n worker.removeEventListener(\"error\", onError);\n worker.removeEventListener(\"message\", onMessage);\n reject(data.reason);\n worker.terminate();\n }\n }\n };\n worker.addEventListener(\"error\", onError);\n worker.addEventListener(\"message\", onMessage);\n worker.postMessage({ id: \"init\", url: this.Configuration.url });\n worker.postMessage({ id: \"validate\", data: dataCopy, rootUrl: rootUrl, fileName: fileName });\n });\n }\n else {\n if (!this._LoadScriptPromise) {\n this._LoadScriptPromise = Tools.LoadScriptAsync(this.Configuration.url);\n }\n return this._LoadScriptPromise.then(() => {\n return validateAsync(dataCopy, rootUrl, fileName, getExternalResource);\n });\n }\n }\n}\n/**\n * The configuration. Defaults to `{ url: \"https://preview.babylonjs.com/gltf_validator.js\" }`.\n */\nGLTFValidation.Configuration = {\n url: \"https://preview.babylonjs.com/gltf_validator.js\",\n};\n//# sourceMappingURL=glTFValidation.js.map","import { Observable } from \"@babylonjs/core/Misc/observable.js\";\nimport { Tools } from \"@babylonjs/core/Misc/tools.js\";\nimport { SceneLoader } from \"@babylonjs/core/Loading/sceneLoader.js\";\nimport { AssetContainer } from \"@babylonjs/core/assetContainer.js\";\nimport { Logger } from \"@babylonjs/core/Misc/logger.js\";\nimport { DataReader } from \"@babylonjs/core/Misc/dataReader.js\";\nimport { GLTFValidation } from \"./glTFValidation.js\";\nimport { DecodeBase64UrlToBinary } from \"@babylonjs/core/Misc/fileTools.js\";\nimport { RuntimeError, ErrorCodes } from \"@babylonjs/core/Misc/error.js\";\nfunction readAsync(arrayBuffer, byteOffset, byteLength) {\n try {\n return Promise.resolve(new Uint8Array(arrayBuffer, byteOffset, byteLength));\n }\n catch (e) {\n return Promise.reject(e);\n }\n}\nfunction readViewAsync(arrayBufferView, byteOffset, byteLength) {\n try {\n if (arrayBufferView.byteOffset + byteLength > arrayBufferView.byteLength) {\n throw new Error(\"Array length out of bounds.\");\n }\n return Promise.resolve(new Uint8Array(arrayBufferView.buffer, arrayBufferView.byteOffset + byteOffset, byteLength));\n }\n catch (e) {\n return Promise.reject(e);\n }\n}\n/**\n * Mode that determines the coordinate system to use.\n */\nexport var GLTFLoaderCoordinateSystemMode;\n(function (GLTFLoaderCoordinateSystemMode) {\n /**\n * Automatically convert the glTF right-handed data to the appropriate system based on the current coordinate system mode of the scene.\n */\n GLTFLoaderCoordinateSystemMode[GLTFLoaderCoordinateSystemMode[\"AUTO\"] = 0] = \"AUTO\";\n /**\n * Sets the useRightHandedSystem flag on the scene.\n */\n GLTFLoaderCoordinateSystemMode[GLTFLoaderCoordinateSystemMode[\"FORCE_RIGHT_HANDED\"] = 1] = \"FORCE_RIGHT_HANDED\";\n})(GLTFLoaderCoordinateSystemMode || (GLTFLoaderCoordinateSystemMode = {}));\n/**\n * Mode that determines what animations will start.\n */\nexport var GLTFLoaderAnimationStartMode;\n(function (GLTFLoaderAnimationStartMode) {\n /**\n * No animation will start.\n */\n GLTFLoaderAnimationStartMode[GLTFLoaderAnimationStartMode[\"NONE\"] = 0] = \"NONE\";\n /**\n * The first animation will start.\n */\n GLTFLoaderAnimationStartMode[GLTFLoaderAnimationStartMode[\"FIRST\"] = 1] = \"FIRST\";\n /**\n * All animations will start.\n */\n GLTFLoaderAnimationStartMode[GLTFLoaderAnimationStartMode[\"ALL\"] = 2] = \"ALL\";\n})(GLTFLoaderAnimationStartMode || (GLTFLoaderAnimationStartMode = {}));\n/**\n * Loader state.\n */\nexport var GLTFLoaderState;\n(function (GLTFLoaderState) {\n /**\n * The asset is loading.\n */\n GLTFLoaderState[GLTFLoaderState[\"LOADING\"] = 0] = \"LOADING\";\n /**\n * The asset is ready for rendering.\n */\n GLTFLoaderState[GLTFLoaderState[\"READY\"] = 1] = \"READY\";\n /**\n * The asset is completely loaded.\n */\n GLTFLoaderState[GLTFLoaderState[\"COMPLETE\"] = 2] = \"COMPLETE\";\n})(GLTFLoaderState || (GLTFLoaderState = {}));\n/**\n * File loader for loading glTF files into a scene.\n */\nexport class GLTFFileLoader {\n constructor() {\n // --------------\n // Common options\n // --------------\n /**\n * Raised when the asset has been parsed\n */\n this.onParsedObservable = new Observable();\n // ----------\n // V2 options\n // ----------\n /**\n * The coordinate system mode. Defaults to AUTO.\n */\n this.coordinateSystemMode = GLTFLoaderCoordinateSystemMode.AUTO;\n /**\n * The animation start mode. Defaults to FIRST.\n */\n this.animationStartMode = GLTFLoaderAnimationStartMode.FIRST;\n /**\n * Defines if the loader should compile materials before raising the success callback. Defaults to false.\n */\n this.compileMaterials = false;\n /**\n * Defines if the loader should also compile materials with clip planes. Defaults to false.\n */\n this.useClipPlane = false;\n /**\n * Defines if the loader should compile shadow generators before raising the success callback. Defaults to false.\n */\n this.compileShadowGenerators = false;\n /**\n * Defines if the Alpha blended materials are only applied as coverage.\n * If false, (default) The luminance of each pixel will reduce its opacity to simulate the behaviour of most physical materials.\n * If true, no extra effects are applied to transparent pixels.\n */\n this.transparencyAsCoverage = false;\n /**\n * Defines if the loader should use range requests when load binary glTF files from HTTP.\n * Enabling will disable offline support and glTF validator.\n * Defaults to false.\n */\n this.useRangeRequests = false;\n /**\n * Defines if the loader should create instances when multiple glTF nodes point to the same glTF mesh. Defaults to true.\n */\n this.createInstances = true;\n /**\n * Defines if the loader should always compute the bounding boxes of meshes and not use the min/max values from the position accessor. Defaults to false.\n */\n this.alwaysComputeBoundingBox = false;\n /**\n * If true, load all materials defined in the file, even if not used by any mesh. Defaults to false.\n */\n this.loadAllMaterials = false;\n /**\n * If true, load only the materials defined in the file. Defaults to false.\n */\n this.loadOnlyMaterials = false;\n /**\n * If true, do not load any materials defined in the file. Defaults to false.\n */\n this.skipMaterials = false;\n /**\n * If true, load the color (gamma encoded) textures into sRGB buffers (if supported by the GPU), which will yield more accurate results when sampling the texture. Defaults to true.\n */\n this.useSRGBBuffers = true;\n /**\n * When loading glTF animations, which are defined in seconds, target them to this FPS. Defaults to 60.\n */\n this.targetFps = 60;\n /**\n * Defines if the loader should always compute the nearest common ancestor of the skeleton joints instead of using `skin.skeleton`. Defaults to false.\n * Set this to true if loading assets with invalid `skin.skeleton` values.\n */\n this.alwaysComputeSkeletonRootNode = false;\n /**\n * Function called before loading a url referenced by the asset.\n * @param url\n */\n this.preprocessUrlAsync = (url) => Promise.resolve(url);\n /**\n * Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.\n * Note that the observable is raised as soon as the mesh object is created, meaning some data may not have been setup yet for this mesh (vertex data, morph targets, material, ...)\n */\n this.onMeshLoadedObservable = new Observable();\n /**\n * Callback raised when the loader creates a skin after parsing the glTF properties of the skin node.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/importers/glTF/glTFSkinning#ignoring-the-transform-of-the-skinned-mesh\n * @param node - the transform node that corresponds to the original glTF skin node used for animations\n * @param skinnedNode - the transform node that is the skinned mesh itself or the parent of the skinned meshes\n */\n this.onSkinLoadedObservable = new Observable();\n /**\n * Observable raised when the loader creates a texture after parsing the glTF properties of the texture.\n */\n this.onTextureLoadedObservable = new Observable();\n /**\n * Observable raised when the loader creates a material after parsing the glTF properties of the material.\n */\n this.onMaterialLoadedObservable = new Observable();\n /**\n * Observable raised when the loader creates a camera after parsing the glTF properties of the camera.\n */\n this.onCameraLoadedObservable = new Observable();\n /**\n * Observable raised when the asset is completely loaded, immediately before the loader is disposed.\n * For assets with LODs, raised when all of the LODs are complete.\n * For assets without LODs, raised when the model is complete, immediately after the loader resolves the returned promise.\n */\n this.onCompleteObservable = new Observable();\n /**\n * Observable raised when an error occurs.\n */\n this.onErrorObservable = new Observable();\n /**\n * Observable raised after the loader is disposed.\n */\n this.onDisposeObservable = new Observable();\n /**\n * Observable raised after a loader extension is created.\n * Set additional options for a loader extension in this event.\n */\n this.onExtensionLoadedObservable = new Observable();\n /**\n * Defines if the loader should validate the asset.\n */\n this.validate = false;\n /**\n * Observable raised after validation when validate is set to true. The event data is the result of the validation.\n */\n this.onValidatedObservable = new Observable();\n this._loader = null;\n this._state = null;\n this._requests = new Array();\n /**\n * Name of the loader (\"gltf\")\n */\n this.name = \"gltf\";\n /** @internal */\n this.extensions = {\n \".gltf\": { isBinary: false },\n \".glb\": { isBinary: true },\n };\n /**\n * Observable raised when the loader state changes.\n */\n this.onLoaderStateChangedObservable = new Observable();\n this._logIndentLevel = 0;\n this._loggingEnabled = false;\n /** @internal */\n this._log = this._logDisabled;\n this._capturePerformanceCounters = false;\n /** @internal */\n this._startPerformanceCounter = this._startPerformanceCounterDisabled;\n /** @internal */\n this._endPerformanceCounter = this._endPerformanceCounterDisabled;\n }\n /**\n * Raised when the asset has been parsed\n */\n set onParsed(callback) {\n if (this._onParsedObserver) {\n this.onParsedObservable.remove(this._onParsedObserver);\n }\n this._onParsedObserver = this.onParsedObservable.add(callback);\n }\n /**\n * Callback raised when the loader creates a mesh after parsing the glTF properties of the mesh.\n * Note that the callback is called as soon as the mesh object is created, meaning some data may not have been setup yet for this mesh (vertex data, morph targets, material, ...)\n */\n set onMeshLoaded(callback) {\n if (this._onMeshLoadedObserver) {\n this.onMeshLoadedObservable.remove(this._onMeshLoadedObserver);\n }\n this._onMeshLoadedObserver = this.onMeshLoadedObservable.add(callback);\n }\n /**\n * Callback raised when the loader creates a texture after parsing the glTF properties of the texture.\n */\n set onTextureLoaded(callback) {\n if (this._onTextureLoadedObserver) {\n this.onTextureLoadedObservable.remove(this._onTextureLoadedObserver);\n }\n this._onTextureLoadedObserver = this.onTextureLoadedObservable.add(callback);\n }\n /**\n * Callback raised when the loader creates a material after parsing the glTF properties of the material.\n */\n set onMaterialLoaded(callback) {\n if (this._onMaterialLoadedObserver) {\n this.onMaterialLoadedObservable.remove(this._onMaterialLoadedObserver);\n }\n this._onMaterialLoadedObserver = this.onMaterialLoadedObservable.add(callback);\n }\n /**\n * Callback raised when the loader creates a camera after parsing the glTF properties of the camera.\n */\n set onCameraLoaded(callback) {\n if (this._onCameraLoadedObserver) {\n this.onCameraLoadedObservable.remove(this._onCameraLoadedObserver);\n }\n this._onCameraLoadedObserver = this.onCameraLoadedObservable.add(callback);\n }\n /**\n * Callback raised when the asset is completely loaded, immediately before the loader is disposed.\n * For assets with LODs, raised when all of the LODs are complete.\n * For assets without LODs, raised when the model is complete, immediately after the loader resolves the returned promise.\n */\n set onComplete(callback) {\n if (this._onCompleteObserver) {\n this.onCompleteObservable.remove(this._onCompleteObserver);\n }\n this._onCompleteObserver = this.onCompleteObservable.add(callback);\n }\n /**\n * Callback raised when an error occurs.\n */\n set onError(callback) {\n if (this._onErrorObserver) {\n this.onErrorObservable.remove(this._onErrorObserver);\n }\n this._onErrorObserver = this.onErrorObservable.add(callback);\n }\n /**\n * Callback raised after the loader is disposed.\n */\n set onDispose(callback) {\n if (this._onDisposeObserver) {\n this.onDisposeObservable.remove(this._onDisposeObserver);\n }\n this._onDisposeObserver = this.onDisposeObservable.add(callback);\n }\n /**\n * Callback raised after a loader extension is created.\n */\n set onExtensionLoaded(callback) {\n if (this._onExtensionLoadedObserver) {\n this.onExtensionLoadedObservable.remove(this._onExtensionLoadedObserver);\n }\n this._onExtensionLoadedObserver = this.onExtensionLoadedObservable.add(callback);\n }\n /**\n * Defines if the loader logging is enabled.\n */\n get loggingEnabled() {\n return this._loggingEnabled;\n }\n set loggingEnabled(value) {\n if (this._loggingEnabled === value) {\n return;\n }\n this._loggingEnabled = value;\n if (this._loggingEnabled) {\n this._log = this._logEnabled;\n }\n else {\n this._log = this._logDisabled;\n }\n }\n /**\n * Defines if the loader should capture performance counters.\n */\n get capturePerformanceCounters() {\n return this._capturePerformanceCounters;\n }\n set capturePerformanceCounters(value) {\n if (this._capturePerformanceCounters === value) {\n return;\n }\n this._capturePerformanceCounters = value;\n if (this._capturePerformanceCounters) {\n this._startPerformanceCounter = this._startPerformanceCounterEnabled;\n this._endPerformanceCounter = this._endPerformanceCounterEnabled;\n }\n else {\n this._startPerformanceCounter = this._startPerformanceCounterDisabled;\n this._endPerformanceCounter = this._endPerformanceCounterDisabled;\n }\n }\n /**\n * Callback raised after a loader extension is created.\n */\n set onValidated(callback) {\n if (this._onValidatedObserver) {\n this.onValidatedObservable.remove(this._onValidatedObserver);\n }\n this._onValidatedObserver = this.onValidatedObservable.add(callback);\n }\n /**\n * Disposes the loader, releases resources during load, and cancels any outstanding requests.\n */\n dispose() {\n if (this._loader) {\n this._loader.dispose();\n this._loader = null;\n }\n for (const request of this._requests) {\n request.abort();\n }\n this._requests.length = 0;\n delete this._progressCallback;\n this.preprocessUrlAsync = (url) => Promise.resolve(url);\n this.onMeshLoadedObservable.clear();\n this.onSkinLoadedObservable.clear();\n this.onTextureLoadedObservable.clear();\n this.onMaterialLoadedObservable.clear();\n this.onCameraLoadedObservable.clear();\n this.onCompleteObservable.clear();\n this.onExtensionLoadedObservable.clear();\n this.onDisposeObservable.notifyObservers(undefined);\n this.onDisposeObservable.clear();\n }\n /**\n * @internal\n */\n loadFile(scene, fileOrUrl, rootUrl, onSuccess, onProgress, useArrayBuffer, onError, name) {\n if (ArrayBuffer.isView(fileOrUrl)) {\n this._loadBinary(scene, fileOrUrl, rootUrl, onSuccess, onError, name);\n return null;\n }\n this._progressCallback = onProgress;\n const fileName = fileOrUrl.name || Tools.GetFilename(fileOrUrl);\n if (useArrayBuffer) {\n if (this.useRangeRequests) {\n if (this.validate) {\n Logger.Warn(\"glTF validation is not supported when range requests are enabled\");\n }\n const fileRequest = {\n abort: () => { },\n onCompleteObservable: new Observable(),\n };\n const dataBuffer = {\n readAsync: (byteOffset, byteLength) => {\n return new Promise((resolve, reject) => {\n this._loadFile(scene, fileOrUrl, (data) => {\n resolve(new Uint8Array(data));\n }, true, (error) => {\n reject(error);\n }, (webRequest) => {\n webRequest.setRequestHeader(\"Range\", `bytes=${byteOffset}-${byteOffset + byteLength - 1}`);\n });\n });\n },\n byteLength: 0,\n };\n this._unpackBinaryAsync(new DataReader(dataBuffer)).then((loaderData) => {\n fileRequest.onCompleteObservable.notifyObservers(fileRequest);\n onSuccess(loaderData);\n }, onError ? (error) => onError(undefined, error) : undefined);\n return fileRequest;\n }\n return this._loadFile(scene, fileOrUrl, (data) => {\n this._validate(scene, new Uint8Array(data), rootUrl, fileName);\n this._unpackBinaryAsync(new DataReader({\n readAsync: (byteOffset, byteLength) => readAsync(data, byteOffset, byteLength),\n byteLength: data.byteLength,\n })).then((loaderData) => {\n onSuccess(loaderData);\n }, onError ? (error) => onError(undefined, error) : undefined);\n }, true, onError);\n }\n return this._loadFile(scene, fileOrUrl, (data) => {\n this._validate(scene, new Uint8Array(data), rootUrl, fileName);\n onSuccess({ json: this._parseJson(data) });\n }, useArrayBuffer, onError);\n }\n /**\n * @internal\n */\n _loadBinary(scene, data, rootUrl, onSuccess, onError, fileName) {\n this._validate(scene, data, rootUrl, fileName);\n this._unpackBinaryAsync(new DataReader({\n readAsync: (byteOffset, byteLength) => readViewAsync(data, byteOffset, byteLength),\n byteLength: data.byteLength,\n })).then((loaderData) => {\n onSuccess(loaderData);\n }, onError ? (error) => onError(undefined, error) : undefined);\n }\n /**\n * @internal\n */\n importMeshAsync(meshesNames, scene, data, rootUrl, onProgress, fileName) {\n return Promise.resolve().then(() => {\n this.onParsedObservable.notifyObservers(data);\n this.onParsedObservable.clear();\n this._log(`Loading ${fileName || \"\"}`);\n this._loader = this._getLoader(data);\n return this._loader.importMeshAsync(meshesNames, scene, null, data, rootUrl, onProgress, fileName);\n });\n }\n /**\n * @internal\n */\n loadAsync(scene, data, rootUrl, onProgress, fileName) {\n return Promise.resolve().then(() => {\n this.onParsedObservable.notifyObservers(data);\n this.onParsedObservable.clear();\n this._log(`Loading ${fileName || \"\"}`);\n this._loader = this._getLoader(data);\n return this._loader.loadAsync(scene, data, rootUrl, onProgress, fileName);\n });\n }\n /**\n * @internal\n */\n loadAssetContainerAsync(scene, data, rootUrl, onProgress, fileName) {\n return Promise.resolve().then(() => {\n this.onParsedObservable.notifyObservers(data);\n this.onParsedObservable.clear();\n this._log(`Loading ${fileName || \"\"}`);\n this._loader = this._getLoader(data);\n // Prepare the asset container.\n const container = new AssetContainer(scene);\n // Get materials/textures when loading to add to container\n const materials = [];\n this.onMaterialLoadedObservable.add((material) => {\n materials.push(material);\n });\n const textures = [];\n this.onTextureLoadedObservable.add((texture) => {\n textures.push(texture);\n });\n const cameras = [];\n this.onCameraLoadedObservable.add((camera) => {\n cameras.push(camera);\n });\n const morphTargetManagers = [];\n this.onMeshLoadedObservable.add((mesh) => {\n if (mesh.morphTargetManager) {\n morphTargetManagers.push(mesh.morphTargetManager);\n }\n });\n return this._loader.importMeshAsync(null, scene, container, data, rootUrl, onProgress, fileName).then((result) => {\n Array.prototype.push.apply(container.geometries, result.geometries);\n Array.prototype.push.apply(container.meshes, result.meshes);\n Array.prototype.push.apply(container.particleSystems, result.particleSystems);\n Array.prototype.push.apply(container.skeletons, result.skeletons);\n Array.prototype.push.apply(container.animationGroups, result.animationGroups);\n Array.prototype.push.apply(container.materials, materials);\n Array.prototype.push.apply(container.textures, textures);\n Array.prototype.push.apply(container.lights, result.lights);\n Array.prototype.push.apply(container.transformNodes, result.transformNodes);\n Array.prototype.push.apply(container.cameras, cameras);\n Array.prototype.push.apply(container.morphTargetManagers, morphTargetManagers);\n return container;\n });\n });\n }\n /**\n * @internal\n */\n canDirectLoad(data) {\n return ((data.indexOf(\"asset\") !== -1 && data.indexOf(\"version\") !== -1) ||\n data.startsWith(\"data:base64,\" + GLTFFileLoader._MagicBase64Encoded) || // this is technically incorrect, but will continue to support for backcompat.\n data.startsWith(\"data:;base64,\" + GLTFFileLoader._MagicBase64Encoded) ||\n data.startsWith(\"data:application/octet-stream;base64,\" + GLTFFileLoader._MagicBase64Encoded) ||\n data.startsWith(\"data:model/gltf-binary;base64,\" + GLTFFileLoader._MagicBase64Encoded));\n }\n /**\n * @internal\n */\n directLoad(scene, data) {\n if (data.startsWith(\"base64,\" + GLTFFileLoader._MagicBase64Encoded) || // this is technically incorrect, but will continue to support for backcompat.\n data.startsWith(\";base64,\" + GLTFFileLoader._MagicBase64Encoded) ||\n data.startsWith(\"application/octet-stream;base64,\" + GLTFFileLoader._MagicBase64Encoded) ||\n data.startsWith(\"model/gltf-binary;base64,\" + GLTFFileLoader._MagicBase64Encoded)) {\n const arrayBuffer = DecodeBase64UrlToBinary(data);\n this._validate(scene, new Uint8Array(arrayBuffer));\n return this._unpackBinaryAsync(new DataReader({\n readAsync: (byteOffset, byteLength) => readAsync(arrayBuffer, byteOffset, byteLength),\n byteLength: arrayBuffer.byteLength,\n }));\n }\n this._validate(scene, data);\n return Promise.resolve({ json: this._parseJson(data) });\n }\n /** @internal */\n createPlugin() {\n return new GLTFFileLoader();\n }\n /**\n * The loader state or null if the loader is not active.\n */\n get loaderState() {\n return this._state;\n }\n /**\n * Returns a promise that resolves when the asset is completely loaded.\n * @returns a promise that resolves when the asset is completely loaded.\n */\n whenCompleteAsync() {\n return new Promise((resolve, reject) => {\n this.onCompleteObservable.addOnce(() => {\n resolve();\n });\n this.onErrorObservable.addOnce((reason) => {\n reject(reason);\n });\n });\n }\n /**\n * @internal\n */\n _setState(state) {\n if (this._state === state) {\n return;\n }\n this._state = state;\n this.onLoaderStateChangedObservable.notifyObservers(this._state);\n this._log(GLTFLoaderState[this._state]);\n }\n /**\n * @internal\n */\n _loadFile(scene, fileOrUrl, onSuccess, useArrayBuffer, onError, onOpened) {\n const request = scene._loadFile(fileOrUrl, onSuccess, (event) => {\n this._onProgress(event, request);\n }, true, useArrayBuffer, onError, onOpened);\n request.onCompleteObservable.add((request) => {\n this._requests.splice(this._requests.indexOf(request), 1);\n });\n this._requests.push(request);\n return request;\n }\n _onProgress(event, request) {\n if (!this._progressCallback) {\n return;\n }\n request._lengthComputable = event.lengthComputable;\n request._loaded = event.loaded;\n request._total = event.total;\n let lengthComputable = true;\n let loaded = 0;\n let total = 0;\n for (const request of this._requests) {\n if (request._lengthComputable === undefined || request._loaded === undefined || request._total === undefined) {\n return;\n }\n lengthComputable = lengthComputable && request._lengthComputable;\n loaded += request._loaded;\n total += request._total;\n }\n this._progressCallback({\n lengthComputable: lengthComputable,\n loaded: loaded,\n total: lengthComputable ? total : 0,\n });\n }\n _validate(scene, data, rootUrl = \"\", fileName = \"\") {\n if (!this.validate) {\n return;\n }\n this._startPerformanceCounter(\"Validate JSON\");\n GLTFValidation.ValidateAsync(data, rootUrl, fileName, (uri) => {\n return this.preprocessUrlAsync(rootUrl + uri).then((url) => scene._loadFileAsync(url, undefined, true, true));\n }).then((result) => {\n this._endPerformanceCounter(\"Validate JSON\");\n this.onValidatedObservable.notifyObservers(result);\n this.onValidatedObservable.clear();\n }, (reason) => {\n this._endPerformanceCounter(\"Validate JSON\");\n Tools.Warn(`Failed to validate: ${reason.message}`);\n this.onValidatedObservable.clear();\n });\n }\n _getLoader(loaderData) {\n const asset = loaderData.json.asset || {};\n this._log(`Asset version: ${asset.version}`);\n asset.minVersion && this._log(`Asset minimum version: ${asset.minVersion}`);\n asset.generator && this._log(`Asset generator: ${asset.generator}`);\n const version = GLTFFileLoader._parseVersion(asset.version);\n if (!version) {\n throw new Error(\"Invalid version: \" + asset.version);\n }\n if (asset.minVersion !== undefined) {\n const minVersion = GLTFFileLoader._parseVersion(asset.minVersion);\n if (!minVersion) {\n throw new Error(\"Invalid minimum version: \" + asset.minVersion);\n }\n if (GLTFFileLoader._compareVersion(minVersion, { major: 2, minor: 0 }) > 0) {\n throw new Error(\"Incompatible minimum version: \" + asset.minVersion);\n }\n }\n const createLoaders = {\n 1: GLTFFileLoader._CreateGLTF1Loader,\n 2: GLTFFileLoader._CreateGLTF2Loader,\n };\n const createLoader = createLoaders[version.major];\n if (!createLoader) {\n throw new Error(\"Unsupported version: \" + asset.version);\n }\n return createLoader(this);\n }\n _parseJson(json) {\n this._startPerformanceCounter(\"Parse JSON\");\n this._log(`JSON length: ${json.length}`);\n const parsed = JSON.parse(json);\n this._endPerformanceCounter(\"Parse JSON\");\n return parsed;\n }\n _unpackBinaryAsync(dataReader) {\n this._startPerformanceCounter(\"Unpack Binary\");\n // Read magic + version + length + json length + json format\n return dataReader.loadAsync(20).then(() => {\n const Binary = {\n Magic: 0x46546c67,\n };\n const magic = dataReader.readUint32();\n if (magic !== Binary.Magic) {\n throw new RuntimeError(\"Unexpected magic: \" + magic, ErrorCodes.GLTFLoaderUnexpectedMagicError);\n }\n const version = dataReader.readUint32();\n if (this.loggingEnabled) {\n this._log(`Binary version: ${version}`);\n }\n const length = dataReader.readUint32();\n if (!this.useRangeRequests && length !== dataReader.buffer.byteLength) {\n Logger.Warn(`Length in header does not match actual data length: ${length} != ${dataReader.buffer.byteLength}`);\n }\n let unpacked;\n switch (version) {\n case 1: {\n unpacked = this._unpackBinaryV1Async(dataReader, length);\n break;\n }\n case 2: {\n unpacked = this._unpackBinaryV2Async(dataReader, length);\n break;\n }\n default: {\n throw new Error(\"Unsupported version: \" + version);\n }\n }\n this._endPerformanceCounter(\"Unpack Binary\");\n return unpacked;\n });\n }\n _unpackBinaryV1Async(dataReader, length) {\n const ContentFormat = {\n JSON: 0,\n };\n const contentLength = dataReader.readUint32();\n const contentFormat = dataReader.readUint32();\n if (contentFormat !== ContentFormat.JSON) {\n throw new Error(`Unexpected content format: ${contentFormat}`);\n }\n const bodyLength = length - dataReader.byteOffset;\n const data = { json: this._parseJson(dataReader.readString(contentLength)), bin: null };\n if (bodyLength !== 0) {\n const startByteOffset = dataReader.byteOffset;\n data.bin = {\n readAsync: (byteOffset, byteLength) => dataReader.buffer.readAsync(startByteOffset + byteOffset, byteLength),\n byteLength: bodyLength,\n };\n }\n return Promise.resolve(data);\n }\n _unpackBinaryV2Async(dataReader, length) {\n const ChunkFormat = {\n JSON: 0x4e4f534a,\n BIN: 0x004e4942,\n };\n // Read the JSON chunk header.\n const chunkLength = dataReader.readUint32();\n const chunkFormat = dataReader.readUint32();\n if (chunkFormat !== ChunkFormat.JSON) {\n throw new Error(\"First chunk format is not JSON\");\n }\n // Bail if there are no other chunks.\n if (dataReader.byteOffset + chunkLength === length) {\n return dataReader.loadAsync(chunkLength).then(() => {\n return { json: this._parseJson(dataReader.readString(chunkLength)), bin: null };\n });\n }\n // Read the JSON chunk and the length and type of the next chunk.\n return dataReader.loadAsync(chunkLength + 8).then(() => {\n const data = { json: this._parseJson(dataReader.readString(chunkLength)), bin: null };\n const readAsync = () => {\n const chunkLength = dataReader.readUint32();\n const chunkFormat = dataReader.readUint32();\n switch (chunkFormat) {\n case ChunkFormat.JSON: {\n throw new Error(\"Unexpected JSON chunk\");\n }\n case ChunkFormat.BIN: {\n const startByteOffset = dataReader.byteOffset;\n data.bin = {\n readAsync: (byteOffset, byteLength) => dataReader.buffer.readAsync(startByteOffset + byteOffset, byteLength),\n byteLength: chunkLength,\n };\n dataReader.skipBytes(chunkLength);\n break;\n }\n default: {\n // ignore unrecognized chunkFormat\n dataReader.skipBytes(chunkLength);\n break;\n }\n }\n if (dataReader.byteOffset !== length) {\n return dataReader.loadAsync(8).then(readAsync);\n }\n return Promise.resolve(data);\n };\n return readAsync();\n });\n }\n static _parseVersion(version) {\n if (version === \"1.0\" || version === \"1.0.1\") {\n return {\n major: 1,\n minor: 0,\n };\n }\n const match = (version + \"\").match(/^(\\d+)\\.(\\d+)/);\n if (!match) {\n return null;\n }\n return {\n major: parseInt(match[1]),\n minor: parseInt(match[2]),\n };\n }\n static _compareVersion(a, b) {\n if (a.major > b.major) {\n return 1;\n }\n if (a.major < b.major) {\n return -1;\n }\n if (a.minor > b.minor) {\n return 1;\n }\n if (a.minor < b.minor) {\n return -1;\n }\n return 0;\n }\n /**\n * @internal\n */\n _logOpen(message) {\n this._log(message);\n this._logIndentLevel++;\n }\n /** @internal */\n _logClose() {\n --this._logIndentLevel;\n }\n _logEnabled(message) {\n const spaces = GLTFFileLoader._logSpaces.substr(0, this._logIndentLevel * 2);\n Logger.Log(`${spaces}${message}`);\n }\n _logDisabled(message) { }\n _startPerformanceCounterEnabled(counterName) {\n Tools.StartPerformanceCounter(counterName);\n }\n _startPerformanceCounterDisabled(counterName) { }\n _endPerformanceCounterEnabled(counterName) {\n Tools.EndPerformanceCounter(counterName);\n }\n _endPerformanceCounterDisabled(counterName) { }\n}\n// ----------\n// V1 options\n// ----------\n/**\n * Set this property to false to disable incremental loading which delays the loader from calling the success callback until after loading the meshes and shaders.\n * Textures always loads asynchronously. For example, the success callback can compute the bounding information of the loaded meshes when incremental loading is disabled.\n * Defaults to true.\n * @internal\n */\nGLTFFileLoader.IncrementalLoading = true;\n/**\n * Set this property to true in order to work with homogeneous coordinates, available with some converters and exporters.\n * Defaults to false. See https://en.wikipedia.org/wiki/Homogeneous_coordinates.\n * @internal\n */\nGLTFFileLoader.HomogeneousCoordinates = false;\nGLTFFileLoader._MagicBase64Encoded = \"Z2xURg\"; // \"glTF\" base64 encoded (without the quotes!)\nGLTFFileLoader._logSpaces = \" \";\nif (SceneLoader) {\n SceneLoader.RegisterPlugin(new GLTFFileLoader());\n}\n//# sourceMappingURL=glTFFileLoader.js.map","/**\n * Enums\n * @internal\n */\nexport var EComponentType;\n(function (EComponentType) {\n EComponentType[EComponentType[\"BYTE\"] = 5120] = \"BYTE\";\n EComponentType[EComponentType[\"UNSIGNED_BYTE\"] = 5121] = \"UNSIGNED_BYTE\";\n EComponentType[EComponentType[\"SHORT\"] = 5122] = \"SHORT\";\n EComponentType[EComponentType[\"UNSIGNED_SHORT\"] = 5123] = \"UNSIGNED_SHORT\";\n EComponentType[EComponentType[\"FLOAT\"] = 5126] = \"FLOAT\";\n})(EComponentType || (EComponentType = {}));\n/** @internal */\nexport var EShaderType;\n(function (EShaderType) {\n EShaderType[EShaderType[\"FRAGMENT\"] = 35632] = \"FRAGMENT\";\n EShaderType[EShaderType[\"VERTEX\"] = 35633] = \"VERTEX\";\n})(EShaderType || (EShaderType = {}));\n/** @internal */\nexport var EParameterType;\n(function (EParameterType) {\n EParameterType[EParameterType[\"BYTE\"] = 5120] = \"BYTE\";\n EParameterType[EParameterType[\"UNSIGNED_BYTE\"] = 5121] = \"UNSIGNED_BYTE\";\n EParameterType[EParameterType[\"SHORT\"] = 5122] = \"SHORT\";\n EParameterType[EParameterType[\"UNSIGNED_SHORT\"] = 5123] = \"UNSIGNED_SHORT\";\n EParameterType[EParameterType[\"INT\"] = 5124] = \"INT\";\n EParameterType[EParameterType[\"UNSIGNED_INT\"] = 5125] = \"UNSIGNED_INT\";\n EParameterType[EParameterType[\"FLOAT\"] = 5126] = \"FLOAT\";\n EParameterType[EParameterType[\"FLOAT_VEC2\"] = 35664] = \"FLOAT_VEC2\";\n EParameterType[EParameterType[\"FLOAT_VEC3\"] = 35665] = \"FLOAT_VEC3\";\n EParameterType[EParameterType[\"FLOAT_VEC4\"] = 35666] = \"FLOAT_VEC4\";\n EParameterType[EParameterType[\"INT_VEC2\"] = 35667] = \"INT_VEC2\";\n EParameterType[EParameterType[\"INT_VEC3\"] = 35668] = \"INT_VEC3\";\n EParameterType[EParameterType[\"INT_VEC4\"] = 35669] = \"INT_VEC4\";\n EParameterType[EParameterType[\"BOOL\"] = 35670] = \"BOOL\";\n EParameterType[EParameterType[\"BOOL_VEC2\"] = 35671] = \"BOOL_VEC2\";\n EParameterType[EParameterType[\"BOOL_VEC3\"] = 35672] = \"BOOL_VEC3\";\n EParameterType[EParameterType[\"BOOL_VEC4\"] = 35673] = \"BOOL_VEC4\";\n EParameterType[EParameterType[\"FLOAT_MAT2\"] = 35674] = \"FLOAT_MAT2\";\n EParameterType[EParameterType[\"FLOAT_MAT3\"] = 35675] = \"FLOAT_MAT3\";\n EParameterType[EParameterType[\"FLOAT_MAT4\"] = 35676] = \"FLOAT_MAT4\";\n EParameterType[EParameterType[\"SAMPLER_2D\"] = 35678] = \"SAMPLER_2D\";\n})(EParameterType || (EParameterType = {}));\n/** @internal */\nexport var ETextureWrapMode;\n(function (ETextureWrapMode) {\n ETextureWrapMode[ETextureWrapMode[\"CLAMP_TO_EDGE\"] = 33071] = \"CLAMP_TO_EDGE\";\n ETextureWrapMode[ETextureWrapMode[\"MIRRORED_REPEAT\"] = 33648] = \"MIRRORED_REPEAT\";\n ETextureWrapMode[ETextureWrapMode[\"REPEAT\"] = 10497] = \"REPEAT\";\n})(ETextureWrapMode || (ETextureWrapMode = {}));\n/** @internal */\nexport var ETextureFilterType;\n(function (ETextureFilterType) {\n ETextureFilterType[ETextureFilterType[\"NEAREST\"] = 9728] = \"NEAREST\";\n ETextureFilterType[ETextureFilterType[\"LINEAR\"] = 9728] = \"LINEAR\";\n ETextureFilterType[ETextureFilterType[\"NEAREST_MIPMAP_NEAREST\"] = 9984] = \"NEAREST_MIPMAP_NEAREST\";\n ETextureFilterType[ETextureFilterType[\"LINEAR_MIPMAP_NEAREST\"] = 9985] = \"LINEAR_MIPMAP_NEAREST\";\n ETextureFilterType[ETextureFilterType[\"NEAREST_MIPMAP_LINEAR\"] = 9986] = \"NEAREST_MIPMAP_LINEAR\";\n ETextureFilterType[ETextureFilterType[\"LINEAR_MIPMAP_LINEAR\"] = 9987] = \"LINEAR_MIPMAP_LINEAR\";\n})(ETextureFilterType || (ETextureFilterType = {}));\n/** @internal */\nexport var ETextureFormat;\n(function (ETextureFormat) {\n ETextureFormat[ETextureFormat[\"ALPHA\"] = 6406] = \"ALPHA\";\n ETextureFormat[ETextureFormat[\"RGB\"] = 6407] = \"RGB\";\n ETextureFormat[ETextureFormat[\"RGBA\"] = 6408] = \"RGBA\";\n ETextureFormat[ETextureFormat[\"LUMINANCE\"] = 6409] = \"LUMINANCE\";\n ETextureFormat[ETextureFormat[\"LUMINANCE_ALPHA\"] = 6410] = \"LUMINANCE_ALPHA\";\n})(ETextureFormat || (ETextureFormat = {}));\n/** @internal */\nexport var ECullingType;\n(function (ECullingType) {\n ECullingType[ECullingType[\"FRONT\"] = 1028] = \"FRONT\";\n ECullingType[ECullingType[\"BACK\"] = 1029] = \"BACK\";\n ECullingType[ECullingType[\"FRONT_AND_BACK\"] = 1032] = \"FRONT_AND_BACK\";\n})(ECullingType || (ECullingType = {}));\n/** @internal */\nexport var EBlendingFunction;\n(function (EBlendingFunction) {\n EBlendingFunction[EBlendingFunction[\"ZERO\"] = 0] = \"ZERO\";\n EBlendingFunction[EBlendingFunction[\"ONE\"] = 1] = \"ONE\";\n EBlendingFunction[EBlendingFunction[\"SRC_COLOR\"] = 768] = \"SRC_COLOR\";\n EBlendingFunction[EBlendingFunction[\"ONE_MINUS_SRC_COLOR\"] = 769] = \"ONE_MINUS_SRC_COLOR\";\n EBlendingFunction[EBlendingFunction[\"DST_COLOR\"] = 774] = \"DST_COLOR\";\n EBlendingFunction[EBlendingFunction[\"ONE_MINUS_DST_COLOR\"] = 775] = \"ONE_MINUS_DST_COLOR\";\n EBlendingFunction[EBlendingFunction[\"SRC_ALPHA\"] = 770] = \"SRC_ALPHA\";\n EBlendingFunction[EBlendingFunction[\"ONE_MINUS_SRC_ALPHA\"] = 771] = \"ONE_MINUS_SRC_ALPHA\";\n EBlendingFunction[EBlendingFunction[\"DST_ALPHA\"] = 772] = \"DST_ALPHA\";\n EBlendingFunction[EBlendingFunction[\"ONE_MINUS_DST_ALPHA\"] = 773] = \"ONE_MINUS_DST_ALPHA\";\n EBlendingFunction[EBlendingFunction[\"CONSTANT_COLOR\"] = 32769] = \"CONSTANT_COLOR\";\n EBlendingFunction[EBlendingFunction[\"ONE_MINUS_CONSTANT_COLOR\"] = 32770] = \"ONE_MINUS_CONSTANT_COLOR\";\n EBlendingFunction[EBlendingFunction[\"CONSTANT_ALPHA\"] = 32771] = \"CONSTANT_ALPHA\";\n EBlendingFunction[EBlendingFunction[\"ONE_MINUS_CONSTANT_ALPHA\"] = 32772] = \"ONE_MINUS_CONSTANT_ALPHA\";\n EBlendingFunction[EBlendingFunction[\"SRC_ALPHA_SATURATE\"] = 776] = \"SRC_ALPHA_SATURATE\";\n})(EBlendingFunction || (EBlendingFunction = {}));\n//# sourceMappingURL=glTFLoaderInterfaces.js.map","import { __decorate } from \"../../tslib.es6.js\";\nimport { serialize } from \"../../Misc/decorators.js\";\nimport { CameraInputTypes } from \"../../Cameras/cameraInputsManager.js\";\nimport { KeyboardEventTypes } from \"../../Events/keyboardEvents.js\";\nimport { Vector3 } from \"../../Maths/math.vector.js\";\nimport { Tools } from \"../../Misc/tools.js\";\n/**\n * Manage the keyboard inputs to control the movement of a free camera.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/customizingCameraInputs\n */\nexport class FreeCameraKeyboardMoveInput {\n constructor() {\n /**\n * Gets or Set the list of keyboard keys used to control the forward move of the camera.\n */\n this.keysUp = [38];\n /**\n * Gets or Set the list of keyboard keys used to control the upward move of the camera.\n */\n this.keysUpward = [33];\n /**\n * Gets or Set the list of keyboard keys used to control the backward move of the camera.\n */\n this.keysDown = [40];\n /**\n * Gets or Set the list of keyboard keys used to control the downward move of the camera.\n */\n this.keysDownward = [34];\n /**\n * Gets or Set the list of keyboard keys used to control the left strafe move of the camera.\n */\n this.keysLeft = [37];\n /**\n * Gets or Set the list of keyboard keys used to control the right strafe move of the camera.\n */\n this.keysRight = [39];\n /**\n * Defines the pointer angular sensibility along the X and Y axis or how fast is the camera rotating.\n */\n this.rotationSpeed = 0.5;\n /**\n * Gets or Set the list of keyboard keys used to control the left rotation move of the camera.\n */\n this.keysRotateLeft = [];\n /**\n * Gets or Set the list of keyboard keys used to control the right rotation move of the camera.\n */\n this.keysRotateRight = [];\n /**\n * Gets or Set the list of keyboard keys used to control the up rotation move of the camera.\n */\n this.keysRotateUp = [];\n /**\n * Gets or Set the list of keyboard keys used to control the down rotation move of the camera.\n */\n this.keysRotateDown = [];\n this._keys = new Array();\n }\n /**\n * Attach the input controls to a specific dom element to get the input from.\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\n */\n attachControl(noPreventDefault) {\n // eslint-disable-next-line prefer-rest-params\n noPreventDefault = Tools.BackCompatCameraNoPreventDefault(arguments);\n if (this._onCanvasBlurObserver) {\n return;\n }\n this._scene = this.camera.getScene();\n this._engine = this._scene.getEngine();\n this._onCanvasBlurObserver = this._engine.onCanvasBlurObservable.add(() => {\n this._keys.length = 0;\n });\n this._onKeyboardObserver = this._scene.onKeyboardObservable.add((info) => {\n const evt = info.event;\n if (!evt.metaKey) {\n if (info.type === KeyboardEventTypes.KEYDOWN) {\n if (this.keysUp.indexOf(evt.keyCode) !== -1 ||\n this.keysDown.indexOf(evt.keyCode) !== -1 ||\n this.keysLeft.indexOf(evt.keyCode) !== -1 ||\n this.keysRight.indexOf(evt.keyCode) !== -1 ||\n this.keysUpward.indexOf(evt.keyCode) !== -1 ||\n this.keysDownward.indexOf(evt.keyCode) !== -1 ||\n this.keysRotateLeft.indexOf(evt.keyCode) !== -1 ||\n this.keysRotateRight.indexOf(evt.keyCode) !== -1 ||\n this.keysRotateUp.indexOf(evt.keyCode) !== -1 ||\n this.keysRotateDown.indexOf(evt.keyCode) !== -1) {\n const index = this._keys.indexOf(evt.keyCode);\n if (index === -1) {\n this._keys.push(evt.keyCode);\n }\n if (!noPreventDefault) {\n evt.preventDefault();\n }\n }\n }\n else {\n if (this.keysUp.indexOf(evt.keyCode) !== -1 ||\n this.keysDown.indexOf(evt.keyCode) !== -1 ||\n this.keysLeft.indexOf(evt.keyCode) !== -1 ||\n this.keysRight.indexOf(evt.keyCode) !== -1 ||\n this.keysUpward.indexOf(evt.keyCode) !== -1 ||\n this.keysDownward.indexOf(evt.keyCode) !== -1 ||\n this.keysRotateLeft.indexOf(evt.keyCode) !== -1 ||\n this.keysRotateRight.indexOf(evt.keyCode) !== -1 ||\n this.keysRotateUp.indexOf(evt.keyCode) !== -1 ||\n this.keysRotateDown.indexOf(evt.keyCode) !== -1) {\n const index = this._keys.indexOf(evt.keyCode);\n if (index >= 0) {\n this._keys.splice(index, 1);\n }\n if (!noPreventDefault) {\n evt.preventDefault();\n }\n }\n }\n }\n });\n }\n /**\n * Detach the current controls from the specified dom element.\n */\n detachControl() {\n if (this._scene) {\n if (this._onKeyboardObserver) {\n this._scene.onKeyboardObservable.remove(this._onKeyboardObserver);\n }\n if (this._onCanvasBlurObserver) {\n this._engine.onCanvasBlurObservable.remove(this._onCanvasBlurObserver);\n }\n this._onKeyboardObserver = null;\n this._onCanvasBlurObserver = null;\n }\n this._keys.length = 0;\n }\n /**\n * Update the current camera state depending on the inputs that have been used this frame.\n * This is a dynamically created lambda to avoid the performance penalty of looping for inputs in the render loop.\n */\n checkInputs() {\n if (this._onKeyboardObserver) {\n const camera = this.camera;\n // Keyboard\n for (let index = 0; index < this._keys.length; index++) {\n const keyCode = this._keys[index];\n const speed = camera._computeLocalCameraSpeed();\n if (this.keysLeft.indexOf(keyCode) !== -1) {\n camera._localDirection.copyFromFloats(-speed, 0, 0);\n }\n else if (this.keysUp.indexOf(keyCode) !== -1) {\n camera._localDirection.copyFromFloats(0, 0, speed);\n }\n else if (this.keysRight.indexOf(keyCode) !== -1) {\n camera._localDirection.copyFromFloats(speed, 0, 0);\n }\n else if (this.keysDown.indexOf(keyCode) !== -1) {\n camera._localDirection.copyFromFloats(0, 0, -speed);\n }\n else if (this.keysUpward.indexOf(keyCode) !== -1) {\n camera._localDirection.copyFromFloats(0, speed, 0);\n }\n else if (this.keysDownward.indexOf(keyCode) !== -1) {\n camera._localDirection.copyFromFloats(0, -speed, 0);\n }\n else if (this.keysRotateLeft.indexOf(keyCode) !== -1) {\n camera._localDirection.copyFromFloats(0, 0, 0);\n camera.cameraRotation.y -= this._getLocalRotation();\n }\n else if (this.keysRotateRight.indexOf(keyCode) !== -1) {\n camera._localDirection.copyFromFloats(0, 0, 0);\n camera.cameraRotation.y += this._getLocalRotation();\n }\n else if (this.keysRotateUp.indexOf(keyCode) !== -1) {\n camera._localDirection.copyFromFloats(0, 0, 0);\n camera.cameraRotation.x -= this._getLocalRotation();\n }\n else if (this.keysRotateDown.indexOf(keyCode) !== -1) {\n camera._localDirection.copyFromFloats(0, 0, 0);\n camera.cameraRotation.x += this._getLocalRotation();\n }\n if (camera.getScene().useRightHandedSystem) {\n camera._localDirection.z *= -1;\n }\n camera.getViewMatrix().invertToRef(camera._cameraTransformMatrix);\n Vector3.TransformNormalToRef(camera._localDirection, camera._cameraTransformMatrix, camera._transformedDirection);\n camera.cameraDirection.addInPlace(camera._transformedDirection);\n }\n }\n }\n /**\n * Gets the class name of the current input.\n * @returns the class name\n */\n getClassName() {\n return \"FreeCameraKeyboardMoveInput\";\n }\n /** @internal */\n _onLostFocus() {\n this._keys.length = 0;\n }\n /**\n * Get the friendly name associated with the input class.\n * @returns the input friendly name\n */\n getSimpleName() {\n return \"keyboard\";\n }\n _getLocalRotation() {\n const handednessMultiplier = this.camera._calculateHandednessMultiplier();\n const rotation = ((this.rotationSpeed * this._engine.getDeltaTime()) / 1000) * handednessMultiplier;\n return rotation;\n }\n}\n__decorate([\n serialize()\n], FreeCameraKeyboardMoveInput.prototype, \"keysUp\", void 0);\n__decorate([\n serialize()\n], FreeCameraKeyboardMoveInput.prototype, \"keysUpward\", void 0);\n__decorate([\n serialize()\n], FreeCameraKeyboardMoveInput.prototype, \"keysDown\", void 0);\n__decorate([\n serialize()\n], FreeCameraKeyboardMoveInput.prototype, \"keysDownward\", void 0);\n__decorate([\n serialize()\n], FreeCameraKeyboardMoveInput.prototype, \"keysLeft\", void 0);\n__decorate([\n serialize()\n], FreeCameraKeyboardMoveInput.prototype, \"keysRight\", void 0);\n__decorate([\n serialize()\n], FreeCameraKeyboardMoveInput.prototype, \"rotationSpeed\", void 0);\n__decorate([\n serialize()\n], FreeCameraKeyboardMoveInput.prototype, \"keysRotateLeft\", void 0);\n__decorate([\n serialize()\n], FreeCameraKeyboardMoveInput.prototype, \"keysRotateRight\", void 0);\n__decorate([\n serialize()\n], FreeCameraKeyboardMoveInput.prototype, \"keysRotateUp\", void 0);\n__decorate([\n serialize()\n], FreeCameraKeyboardMoveInput.prototype, \"keysRotateDown\", void 0);\nCameraInputTypes[\"FreeCameraKeyboardMoveInput\"] = FreeCameraKeyboardMoveInput;\n//# sourceMappingURL=freeCameraKeyboardMoveInput.js.map","import { __decorate } from \"../../tslib.es6.js\";\nimport { Observable } from \"../../Misc/observable.js\";\nimport { serialize } from \"../../Misc/decorators.js\";\nimport { CameraInputTypes } from \"../../Cameras/cameraInputsManager.js\";\nimport { PointerEventTypes } from \"../../Events/pointerEvents.js\";\nimport { Tools } from \"../../Misc/tools.js\";\n/**\n * Manage the mouse inputs to control the movement of a free camera.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/customizingCameraInputs\n */\nexport class FreeCameraMouseInput {\n /**\n * Manage the mouse inputs to control the movement of a free camera.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/customizingCameraInputs\n * @param touchEnabled Defines if touch is enabled or not\n */\n constructor(\n /**\n * Define if touch is enabled in the mouse input\n */\n touchEnabled = true) {\n this.touchEnabled = touchEnabled;\n /**\n * Defines the buttons associated with the input to handle camera move.\n */\n this.buttons = [0, 1, 2];\n /**\n * Defines the pointer angular sensibility along the X and Y axis or how fast is the camera rotating.\n */\n this.angularSensibility = 2000.0;\n this._previousPosition = null;\n /**\n * Observable for when a pointer move event occurs containing the move offset\n */\n this.onPointerMovedObservable = new Observable();\n /**\n * @internal\n * If the camera should be rotated automatically based on pointer movement\n */\n this._allowCameraRotation = true;\n this._currentActiveButton = -1;\n this._activePointerId = -1;\n }\n /**\n * Attach the input controls to a specific dom element to get the input from.\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\n */\n attachControl(noPreventDefault) {\n // eslint-disable-next-line prefer-rest-params\n noPreventDefault = Tools.BackCompatCameraNoPreventDefault(arguments);\n const engine = this.camera.getEngine();\n const element = engine.getInputElement();\n if (!this._pointerInput) {\n this._pointerInput = (p) => {\n const evt = p.event;\n const isTouch = evt.pointerType === \"touch\";\n if (engine.isInVRExclusivePointerMode) {\n return;\n }\n if (!this.touchEnabled && isTouch) {\n return;\n }\n if (p.type !== PointerEventTypes.POINTERMOVE && this.buttons.indexOf(evt.button) === -1) {\n return;\n }\n const srcElement = evt.target;\n if (p.type === PointerEventTypes.POINTERDOWN) {\n // If the input is touch with more than one touch OR if the input is mouse and there is already an active button, return\n if ((isTouch && this._activePointerId !== -1) || (!isTouch && this._currentActiveButton !== -1)) {\n return;\n }\n this._activePointerId = evt.pointerId;\n try {\n srcElement === null || srcElement === void 0 ? void 0 : srcElement.setPointerCapture(evt.pointerId);\n }\n catch (e) {\n //Nothing to do with the error. Execution will continue.\n }\n if (this._currentActiveButton === -1) {\n this._currentActiveButton = evt.button;\n }\n this._previousPosition = {\n x: evt.clientX,\n y: evt.clientY,\n };\n if (!noPreventDefault) {\n evt.preventDefault();\n element && element.focus();\n }\n // This is required to move while pointer button is down\n if (engine.isPointerLock && this._onMouseMove) {\n this._onMouseMove(p.event);\n }\n }\n else if (p.type === PointerEventTypes.POINTERUP) {\n // If input is touch with a different touch id OR if input is mouse with a different button, return\n if ((isTouch && this._activePointerId !== evt.pointerId) || (!isTouch && this._currentActiveButton !== evt.button)) {\n return;\n }\n try {\n srcElement === null || srcElement === void 0 ? void 0 : srcElement.releasePointerCapture(evt.pointerId);\n }\n catch (e) {\n //Nothing to do with the error.\n }\n this._currentActiveButton = -1;\n this._previousPosition = null;\n if (!noPreventDefault) {\n evt.preventDefault();\n }\n this._activePointerId = -1;\n }\n else if (p.type === PointerEventTypes.POINTERMOVE && (this._activePointerId === evt.pointerId || !isTouch)) {\n if (engine.isPointerLock && this._onMouseMove) {\n this._onMouseMove(p.event);\n }\n else if (this._previousPosition) {\n const handednessMultiplier = this.camera._calculateHandednessMultiplier();\n const offsetX = (evt.clientX - this._previousPosition.x) * handednessMultiplier;\n const offsetY = evt.clientY - this._previousPosition.y;\n if (this._allowCameraRotation) {\n this.camera.cameraRotation.y += offsetX / this.angularSensibility;\n this.camera.cameraRotation.x += offsetY / this.angularSensibility;\n }\n this.onPointerMovedObservable.notifyObservers({ offsetX: offsetX, offsetY: offsetY });\n this._previousPosition = {\n x: evt.clientX,\n y: evt.clientY,\n };\n if (!noPreventDefault) {\n evt.preventDefault();\n }\n }\n }\n };\n }\n this._onMouseMove = (evt) => {\n if (!engine.isPointerLock) {\n return;\n }\n if (engine.isInVRExclusivePointerMode) {\n return;\n }\n const handednessMultiplier = this.camera._calculateHandednessMultiplier();\n const offsetX = evt.movementX * handednessMultiplier;\n this.camera.cameraRotation.y += offsetX / this.angularSensibility;\n const offsetY = evt.movementY;\n this.camera.cameraRotation.x += offsetY / this.angularSensibility;\n this._previousPosition = null;\n if (!noPreventDefault) {\n evt.preventDefault();\n }\n };\n this._observer = this.camera\n .getScene()\n ._inputManager._addCameraPointerObserver(this._pointerInput, PointerEventTypes.POINTERDOWN | PointerEventTypes.POINTERUP | PointerEventTypes.POINTERMOVE);\n if (element) {\n this._contextMenuBind = this.onContextMenu.bind(this);\n element.addEventListener(\"contextmenu\", this._contextMenuBind, false); // TODO: We need to figure out how to handle this for Native\n }\n }\n /**\n * Called on JS contextmenu event.\n * Override this method to provide functionality.\n * @param evt\n */\n onContextMenu(evt) {\n evt.preventDefault();\n }\n /**\n * Detach the current controls from the specified dom element.\n */\n detachControl() {\n if (this._observer) {\n this.camera.getScene()._inputManager._removeCameraPointerObserver(this._observer);\n if (this._contextMenuBind) {\n const engine = this.camera.getEngine();\n const element = engine.getInputElement();\n element && element.removeEventListener(\"contextmenu\", this._contextMenuBind);\n }\n if (this.onPointerMovedObservable) {\n this.onPointerMovedObservable.clear();\n }\n this._observer = null;\n this._onMouseMove = null;\n this._previousPosition = null;\n }\n this._activePointerId = -1;\n this._currentActiveButton = -1;\n }\n /**\n * Gets the class name of the current input.\n * @returns the class name\n */\n getClassName() {\n return \"FreeCameraMouseInput\";\n }\n /**\n * Get the friendly name associated with the input class.\n * @returns the input friendly name\n */\n getSimpleName() {\n return \"mouse\";\n }\n}\n__decorate([\n serialize()\n], FreeCameraMouseInput.prototype, \"buttons\", void 0);\n__decorate([\n serialize()\n], FreeCameraMouseInput.prototype, \"angularSensibility\", void 0);\nCameraInputTypes[\"FreeCameraMouseInput\"] = FreeCameraMouseInput;\n//# sourceMappingURL=freeCameraMouseInput.js.map","import { __decorate } from \"../../tslib.es6.js\";\nimport { serialize } from \"../../Misc/decorators.js\";\nimport { Observable } from \"../../Misc/observable.js\";\nimport { PointerEventTypes } from \"../../Events/pointerEvents.js\";\nimport { EventConstants } from \"../../Events/deviceInputEvents.js\";\nimport { Tools } from \"../../Misc/tools.js\";\n/**\n * Base class for mouse wheel input..\n * See FollowCameraMouseWheelInput in src/Cameras/Inputs/freeCameraMouseWheelInput.ts\n * for example usage.\n */\nexport class BaseCameraMouseWheelInput {\n constructor() {\n /**\n * How fast is the camera moves in relation to X axis mouseWheel events.\n * Use negative value to reverse direction.\n */\n this.wheelPrecisionX = 3.0;\n /**\n * How fast is the camera moves in relation to Y axis mouseWheel events.\n * Use negative value to reverse direction.\n */\n this.wheelPrecisionY = 3.0;\n /**\n * How fast is the camera moves in relation to Z axis mouseWheel events.\n * Use negative value to reverse direction.\n */\n this.wheelPrecisionZ = 3.0;\n /**\n * Observable for when a mouse wheel move event occurs.\n */\n this.onChangedObservable = new Observable();\n /**\n * Incremental value of multiple mouse wheel movements of the X axis.\n * Should be zero-ed when read.\n */\n this._wheelDeltaX = 0;\n /**\n * Incremental value of multiple mouse wheel movements of the Y axis.\n * Should be zero-ed when read.\n */\n this._wheelDeltaY = 0;\n /**\n * Incremental value of multiple mouse wheel movements of the Z axis.\n * Should be zero-ed when read.\n */\n this._wheelDeltaZ = 0;\n /**\n * Firefox uses a different scheme to report scroll distances to other\n * browsers. Rather than use complicated methods to calculate the exact\n * multiple we need to apply, let's just cheat and use a constant.\n * https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent/deltaMode\n * https://stackoverflow.com/questions/20110224/what-is-the-height-of-a-line-in-a-wheel-event-deltamode-dom-delta-line\n */\n this._ffMultiplier = 12;\n /**\n * Different event attributes for wheel data fall into a few set ranges.\n * Some relevant but dated date here:\n * https://stackoverflow.com/questions/5527601/normalizing-mousewheel-speed-across-browsers\n */\n this._normalize = 120;\n }\n /**\n * Attach the input controls to a specific dom element to get the input from.\n * @param noPreventDefault Defines whether event caught by the controls\n * should call preventdefault().\n * (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\n */\n attachControl(noPreventDefault) {\n noPreventDefault = Tools.BackCompatCameraNoPreventDefault(arguments);\n this._wheel = (pointer) => {\n // sanity check - this should be a PointerWheel event.\n if (pointer.type !== PointerEventTypes.POINTERWHEEL) {\n return;\n }\n const event = pointer.event;\n const platformScale = event.deltaMode === EventConstants.DOM_DELTA_LINE ? this._ffMultiplier : 1; // If this happens to be set to DOM_DELTA_LINE, adjust accordingly\n this._wheelDeltaX += (this.wheelPrecisionX * platformScale * event.deltaX) / this._normalize;\n this._wheelDeltaY -= (this.wheelPrecisionY * platformScale * event.deltaY) / this._normalize;\n this._wheelDeltaZ += (this.wheelPrecisionZ * platformScale * event.deltaZ) / this._normalize;\n if (event.preventDefault) {\n if (!noPreventDefault) {\n event.preventDefault();\n }\n }\n };\n this._observer = this.camera.getScene()._inputManager._addCameraPointerObserver(this._wheel, PointerEventTypes.POINTERWHEEL);\n }\n /**\n * Detach the current controls from the specified dom element.\n */\n detachControl() {\n if (this._observer) {\n this.camera.getScene()._inputManager._removeCameraPointerObserver(this._observer);\n this._observer = null;\n this._wheel = null;\n }\n if (this.onChangedObservable) {\n this.onChangedObservable.clear();\n }\n }\n /**\n * Called for each rendered frame.\n */\n checkInputs() {\n this.onChangedObservable.notifyObservers({\n wheelDeltaX: this._wheelDeltaX,\n wheelDeltaY: this._wheelDeltaY,\n wheelDeltaZ: this._wheelDeltaZ,\n });\n // Clear deltas.\n this._wheelDeltaX = 0;\n this._wheelDeltaY = 0;\n this._wheelDeltaZ = 0;\n }\n /**\n * Gets the class name of the current input.\n * @returns the class name\n */\n getClassName() {\n return \"BaseCameraMouseWheelInput\";\n }\n /**\n * Get the friendly name associated with the input class.\n * @returns the input friendly name\n */\n getSimpleName() {\n return \"mousewheel\";\n }\n}\n__decorate([\n serialize()\n], BaseCameraMouseWheelInput.prototype, \"wheelPrecisionX\", void 0);\n__decorate([\n serialize()\n], BaseCameraMouseWheelInput.prototype, \"wheelPrecisionY\", void 0);\n__decorate([\n serialize()\n], BaseCameraMouseWheelInput.prototype, \"wheelPrecisionZ\", void 0);\n//# sourceMappingURL=BaseCameraMouseWheelInput.js.map","import { __decorate } from \"../../tslib.es6.js\";\nimport { serialize } from \"../../Misc/decorators.js\";\nimport { CameraInputTypes } from \"../../Cameras/cameraInputsManager.js\";\nimport { BaseCameraMouseWheelInput } from \"../../Cameras/Inputs/BaseCameraMouseWheelInput.js\";\nimport { Matrix, Vector3 } from \"../../Maths/math.vector.js\";\nimport { Coordinate } from \"../../Maths/math.axis.js\";\n// eslint-disable-next-line @typescript-eslint/naming-convention\nvar _CameraProperty;\n(function (_CameraProperty) {\n _CameraProperty[_CameraProperty[\"MoveRelative\"] = 0] = \"MoveRelative\";\n _CameraProperty[_CameraProperty[\"RotateRelative\"] = 1] = \"RotateRelative\";\n _CameraProperty[_CameraProperty[\"MoveScene\"] = 2] = \"MoveScene\";\n})(_CameraProperty || (_CameraProperty = {}));\n/**\n * Manage the mouse wheel inputs to control a free camera.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/customizingCameraInputs\n */\nexport class FreeCameraMouseWheelInput extends BaseCameraMouseWheelInput {\n constructor() {\n super(...arguments);\n this._moveRelative = Vector3.Zero();\n this._rotateRelative = Vector3.Zero();\n this._moveScene = Vector3.Zero();\n /**\n * These are set to the desired default behaviour.\n */\n this._wheelXAction = _CameraProperty.MoveRelative;\n this._wheelXActionCoordinate = Coordinate.X;\n this._wheelYAction = _CameraProperty.MoveRelative;\n this._wheelYActionCoordinate = Coordinate.Z;\n this._wheelZAction = null;\n this._wheelZActionCoordinate = null;\n }\n /**\n * Gets the class name of the current input.\n * @returns the class name\n */\n getClassName() {\n return \"FreeCameraMouseWheelInput\";\n }\n /**\n * Set which movement axis (relative to camera's orientation) the mouse\n * wheel's X axis controls.\n * @param axis The axis to be moved. Set null to clear.\n */\n set wheelXMoveRelative(axis) {\n if (axis === null && this._wheelXAction !== _CameraProperty.MoveRelative) {\n // Attempting to clear different _wheelXAction.\n return;\n }\n this._wheelXAction = _CameraProperty.MoveRelative;\n this._wheelXActionCoordinate = axis;\n }\n /**\n * Get the configured movement axis (relative to camera's orientation) the\n * mouse wheel's X axis controls.\n * @returns The configured axis or null if none.\n */\n get wheelXMoveRelative() {\n if (this._wheelXAction !== _CameraProperty.MoveRelative) {\n return null;\n }\n return this._wheelXActionCoordinate;\n }\n /**\n * Set which movement axis (relative to camera's orientation) the mouse\n * wheel's Y axis controls.\n * @param axis The axis to be moved. Set null to clear.\n */\n set wheelYMoveRelative(axis) {\n if (axis === null && this._wheelYAction !== _CameraProperty.MoveRelative) {\n // Attempting to clear different _wheelYAction.\n return;\n }\n this._wheelYAction = _CameraProperty.MoveRelative;\n this._wheelYActionCoordinate = axis;\n }\n /**\n * Get the configured movement axis (relative to camera's orientation) the\n * mouse wheel's Y axis controls.\n * @returns The configured axis or null if none.\n */\n get wheelYMoveRelative() {\n if (this._wheelYAction !== _CameraProperty.MoveRelative) {\n return null;\n }\n return this._wheelYActionCoordinate;\n }\n /**\n * Set which movement axis (relative to camera's orientation) the mouse\n * wheel's Z axis controls.\n * @param axis The axis to be moved. Set null to clear.\n */\n set wheelZMoveRelative(axis) {\n if (axis === null && this._wheelZAction !== _CameraProperty.MoveRelative) {\n // Attempting to clear different _wheelZAction.\n return;\n }\n this._wheelZAction = _CameraProperty.MoveRelative;\n this._wheelZActionCoordinate = axis;\n }\n /**\n * Get the configured movement axis (relative to camera's orientation) the\n * mouse wheel's Z axis controls.\n * @returns The configured axis or null if none.\n */\n get wheelZMoveRelative() {\n if (this._wheelZAction !== _CameraProperty.MoveRelative) {\n return null;\n }\n return this._wheelZActionCoordinate;\n }\n /**\n * Set which rotation axis (relative to camera's orientation) the mouse\n * wheel's X axis controls.\n * @param axis The axis to be moved. Set null to clear.\n */\n set wheelXRotateRelative(axis) {\n if (axis === null && this._wheelXAction !== _CameraProperty.RotateRelative) {\n // Attempting to clear different _wheelXAction.\n return;\n }\n this._wheelXAction = _CameraProperty.RotateRelative;\n this._wheelXActionCoordinate = axis;\n }\n /**\n * Get the configured rotation axis (relative to camera's orientation) the\n * mouse wheel's X axis controls.\n * @returns The configured axis or null if none.\n */\n get wheelXRotateRelative() {\n if (this._wheelXAction !== _CameraProperty.RotateRelative) {\n return null;\n }\n return this._wheelXActionCoordinate;\n }\n /**\n * Set which rotation axis (relative to camera's orientation) the mouse\n * wheel's Y axis controls.\n * @param axis The axis to be moved. Set null to clear.\n */\n set wheelYRotateRelative(axis) {\n if (axis === null && this._wheelYAction !== _CameraProperty.RotateRelative) {\n // Attempting to clear different _wheelYAction.\n return;\n }\n this._wheelYAction = _CameraProperty.RotateRelative;\n this._wheelYActionCoordinate = axis;\n }\n /**\n * Get the configured rotation axis (relative to camera's orientation) the\n * mouse wheel's Y axis controls.\n * @returns The configured axis or null if none.\n */\n get wheelYRotateRelative() {\n if (this._wheelYAction !== _CameraProperty.RotateRelative) {\n return null;\n }\n return this._wheelYActionCoordinate;\n }\n /**\n * Set which rotation axis (relative to camera's orientation) the mouse\n * wheel's Z axis controls.\n * @param axis The axis to be moved. Set null to clear.\n */\n set wheelZRotateRelative(axis) {\n if (axis === null && this._wheelZAction !== _CameraProperty.RotateRelative) {\n // Attempting to clear different _wheelZAction.\n return;\n }\n this._wheelZAction = _CameraProperty.RotateRelative;\n this._wheelZActionCoordinate = axis;\n }\n /**\n * Get the configured rotation axis (relative to camera's orientation) the\n * mouse wheel's Z axis controls.\n * @returns The configured axis or null if none.\n */\n get wheelZRotateRelative() {\n if (this._wheelZAction !== _CameraProperty.RotateRelative) {\n return null;\n }\n return this._wheelZActionCoordinate;\n }\n /**\n * Set which movement axis (relative to the scene) the mouse wheel's X axis\n * controls.\n * @param axis The axis to be moved. Set null to clear.\n */\n set wheelXMoveScene(axis) {\n if (axis === null && this._wheelXAction !== _CameraProperty.MoveScene) {\n // Attempting to clear different _wheelXAction.\n return;\n }\n this._wheelXAction = _CameraProperty.MoveScene;\n this._wheelXActionCoordinate = axis;\n }\n /**\n * Get the configured movement axis (relative to the scene) the mouse wheel's\n * X axis controls.\n * @returns The configured axis or null if none.\n */\n get wheelXMoveScene() {\n if (this._wheelXAction !== _CameraProperty.MoveScene) {\n return null;\n }\n return this._wheelXActionCoordinate;\n }\n /**\n * Set which movement axis (relative to the scene) the mouse wheel's Y axis\n * controls.\n * @param axis The axis to be moved. Set null to clear.\n */\n set wheelYMoveScene(axis) {\n if (axis === null && this._wheelYAction !== _CameraProperty.MoveScene) {\n // Attempting to clear different _wheelYAction.\n return;\n }\n this._wheelYAction = _CameraProperty.MoveScene;\n this._wheelYActionCoordinate = axis;\n }\n /**\n * Get the configured movement axis (relative to the scene) the mouse wheel's\n * Y axis controls.\n * @returns The configured axis or null if none.\n */\n get wheelYMoveScene() {\n if (this._wheelYAction !== _CameraProperty.MoveScene) {\n return null;\n }\n return this._wheelYActionCoordinate;\n }\n /**\n * Set which movement axis (relative to the scene) the mouse wheel's Z axis\n * controls.\n * @param axis The axis to be moved. Set null to clear.\n */\n set wheelZMoveScene(axis) {\n if (axis === null && this._wheelZAction !== _CameraProperty.MoveScene) {\n // Attempting to clear different _wheelZAction.\n return;\n }\n this._wheelZAction = _CameraProperty.MoveScene;\n this._wheelZActionCoordinate = axis;\n }\n /**\n * Get the configured movement axis (relative to the scene) the mouse wheel's\n * Z axis controls.\n * @returns The configured axis or null if none.\n */\n get wheelZMoveScene() {\n if (this._wheelZAction !== _CameraProperty.MoveScene) {\n return null;\n }\n return this._wheelZActionCoordinate;\n }\n /**\n * Called for each rendered frame.\n */\n checkInputs() {\n if (this._wheelDeltaX === 0 && this._wheelDeltaY === 0 && this._wheelDeltaZ == 0) {\n return;\n }\n // Clear the camera properties that we might be updating.\n this._moveRelative.setAll(0);\n this._rotateRelative.setAll(0);\n this._moveScene.setAll(0);\n // Set the camera properties that are to be updated.\n this._updateCamera();\n if (this.camera.getScene().useRightHandedSystem) {\n // TODO: Does this need done for worldUpdate too?\n this._moveRelative.z *= -1;\n }\n // Convert updates relative to camera to world position update.\n const cameraTransformMatrix = Matrix.Zero();\n this.camera.getViewMatrix().invertToRef(cameraTransformMatrix);\n const transformedDirection = Vector3.Zero();\n Vector3.TransformNormalToRef(this._moveRelative, cameraTransformMatrix, transformedDirection);\n // Apply updates to camera position.\n this.camera.cameraRotation.x += this._rotateRelative.x / 200;\n this.camera.cameraRotation.y += this._rotateRelative.y / 200;\n this.camera.cameraDirection.addInPlace(transformedDirection);\n this.camera.cameraDirection.addInPlace(this._moveScene);\n // Call the base class implementation to handle observers and do cleanup.\n super.checkInputs();\n }\n /**\n * Update the camera according to any configured properties for the 3\n * mouse-wheel axis.\n */\n _updateCamera() {\n // Do the camera updates for each of the 3 touch-wheel axis.\n this._updateCameraProperty(this._wheelDeltaX, this._wheelXAction, this._wheelXActionCoordinate);\n this._updateCameraProperty(this._wheelDeltaY, this._wheelYAction, this._wheelYActionCoordinate);\n this._updateCameraProperty(this._wheelDeltaZ, this._wheelZAction, this._wheelZActionCoordinate);\n }\n /**\n * Update one property of the camera.\n * @param value\n * @param cameraProperty\n * @param coordinate\n */\n _updateCameraProperty(\n /* Mouse-wheel delta. */\n value, \n /* Camera property to be changed. */\n cameraProperty, \n /* Axis of Camera property to be changed. */\n coordinate) {\n if (value === 0) {\n // Mouse wheel has not moved.\n return;\n }\n if (cameraProperty === null || coordinate === null) {\n // Mouse wheel axis not configured.\n return;\n }\n let action = null;\n switch (cameraProperty) {\n case _CameraProperty.MoveRelative:\n action = this._moveRelative;\n break;\n case _CameraProperty.RotateRelative:\n action = this._rotateRelative;\n break;\n case _CameraProperty.MoveScene:\n action = this._moveScene;\n break;\n }\n switch (coordinate) {\n case Coordinate.X:\n action.set(value, 0, 0);\n break;\n case Coordinate.Y:\n action.set(0, value, 0);\n break;\n case Coordinate.Z:\n action.set(0, 0, value);\n break;\n }\n }\n}\n__decorate([\n serialize()\n], FreeCameraMouseWheelInput.prototype, \"wheelXMoveRelative\", null);\n__decorate([\n serialize()\n], FreeCameraMouseWheelInput.prototype, \"wheelYMoveRelative\", null);\n__decorate([\n serialize()\n], FreeCameraMouseWheelInput.prototype, \"wheelZMoveRelative\", null);\n__decorate([\n serialize()\n], FreeCameraMouseWheelInput.prototype, \"wheelXRotateRelative\", null);\n__decorate([\n serialize()\n], FreeCameraMouseWheelInput.prototype, \"wheelYRotateRelative\", null);\n__decorate([\n serialize()\n], FreeCameraMouseWheelInput.prototype, \"wheelZRotateRelative\", null);\n__decorate([\n serialize()\n], FreeCameraMouseWheelInput.prototype, \"wheelXMoveScene\", null);\n__decorate([\n serialize()\n], FreeCameraMouseWheelInput.prototype, \"wheelYMoveScene\", null);\n__decorate([\n serialize()\n], FreeCameraMouseWheelInput.prototype, \"wheelZMoveScene\", null);\nCameraInputTypes[\"FreeCameraMouseWheelInput\"] = FreeCameraMouseWheelInput;\n//# sourceMappingURL=freeCameraMouseWheelInput.js.map","import { __decorate } from \"../../tslib.es6.js\";\nimport { serialize } from \"../../Misc/decorators.js\";\nimport { CameraInputTypes } from \"../../Cameras/cameraInputsManager.js\";\nimport { PointerEventTypes } from \"../../Events/pointerEvents.js\";\nimport { Matrix, Vector3 } from \"../../Maths/math.vector.js\";\nimport { Tools } from \"../../Misc/tools.js\";\n/**\n * Manage the touch inputs to control the movement of a free camera.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/customizingCameraInputs\n */\nexport class FreeCameraTouchInput {\n /**\n * Manage the touch inputs to control the movement of a free camera.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/customizingCameraInputs\n * @param allowMouse Defines if mouse events can be treated as touch events\n */\n constructor(\n /**\n * Define if mouse events can be treated as touch events\n */\n allowMouse = false) {\n this.allowMouse = allowMouse;\n /**\n * Defines the touch sensibility for rotation.\n * The lower the faster.\n */\n this.touchAngularSensibility = 200000.0;\n /**\n * Defines the touch sensibility for move.\n * The lower the faster.\n */\n this.touchMoveSensibility = 250.0;\n /**\n * Swap touch actions so that one touch is used for rotation and multiple for movement\n */\n this.singleFingerRotate = false;\n this._offsetX = null;\n this._offsetY = null;\n this._pointerPressed = new Array();\n this._isSafari = Tools.IsSafari();\n }\n /**\n * Attach the input controls to a specific dom element to get the input from.\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\n */\n attachControl(noPreventDefault) {\n // eslint-disable-next-line prefer-rest-params\n noPreventDefault = Tools.BackCompatCameraNoPreventDefault(arguments);\n let previousPosition = null;\n if (this._pointerInput === undefined) {\n this._onLostFocus = () => {\n this._offsetX = null;\n this._offsetY = null;\n };\n this._pointerInput = (p) => {\n const evt = p.event;\n const isMouseEvent = evt.pointerType === \"mouse\" || (this._isSafari && typeof evt.pointerType === \"undefined\");\n if (!this.allowMouse && isMouseEvent) {\n return;\n }\n if (p.type === PointerEventTypes.POINTERDOWN) {\n if (!noPreventDefault) {\n evt.preventDefault();\n }\n this._pointerPressed.push(evt.pointerId);\n if (this._pointerPressed.length !== 1) {\n return;\n }\n previousPosition = {\n x: evt.clientX,\n y: evt.clientY,\n };\n }\n else if (p.type === PointerEventTypes.POINTERUP) {\n if (!noPreventDefault) {\n evt.preventDefault();\n }\n const index = this._pointerPressed.indexOf(evt.pointerId);\n if (index === -1) {\n return;\n }\n this._pointerPressed.splice(index, 1);\n if (index != 0) {\n return;\n }\n previousPosition = null;\n this._offsetX = null;\n this._offsetY = null;\n }\n else if (p.type === PointerEventTypes.POINTERMOVE) {\n if (!noPreventDefault) {\n evt.preventDefault();\n }\n if (!previousPosition) {\n return;\n }\n const index = this._pointerPressed.indexOf(evt.pointerId);\n if (index != 0) {\n return;\n }\n this._offsetX = evt.clientX - previousPosition.x;\n this._offsetY = -(evt.clientY - previousPosition.y);\n }\n };\n }\n this._observer = this.camera\n .getScene()\n ._inputManager._addCameraPointerObserver(this._pointerInput, PointerEventTypes.POINTERDOWN | PointerEventTypes.POINTERUP | PointerEventTypes.POINTERMOVE);\n if (this._onLostFocus) {\n const engine = this.camera.getEngine();\n const element = engine.getInputElement();\n element && element.addEventListener(\"blur\", this._onLostFocus);\n }\n }\n /**\n * Detach the current controls from the specified dom element.\n */\n detachControl() {\n if (this._pointerInput) {\n if (this._observer) {\n this.camera.getScene()._inputManager._removeCameraPointerObserver(this._observer);\n this._observer = null;\n }\n if (this._onLostFocus) {\n const engine = this.camera.getEngine();\n const element = engine.getInputElement();\n element && element.removeEventListener(\"blur\", this._onLostFocus);\n this._onLostFocus = null;\n }\n this._pointerPressed.length = 0;\n this._offsetX = null;\n this._offsetY = null;\n }\n }\n /**\n * Update the current camera state depending on the inputs that have been used this frame.\n * This is a dynamically created lambda to avoid the performance penalty of looping for inputs in the render loop.\n */\n checkInputs() {\n if (this._offsetX === null || this._offsetY === null) {\n return;\n }\n if (this._offsetX === 0 && this._offsetY === 0) {\n return;\n }\n const camera = this.camera;\n const handednessMultiplier = camera._calculateHandednessMultiplier();\n camera.cameraRotation.y = (handednessMultiplier * this._offsetX) / this.touchAngularSensibility;\n const rotateCamera = (this.singleFingerRotate && this._pointerPressed.length === 1) || (!this.singleFingerRotate && this._pointerPressed.length > 1);\n if (rotateCamera) {\n camera.cameraRotation.x = -this._offsetY / this.touchAngularSensibility;\n }\n else {\n const speed = camera._computeLocalCameraSpeed();\n const direction = new Vector3(0, 0, this.touchMoveSensibility !== 0 ? (speed * this._offsetY) / this.touchMoveSensibility : 0);\n Matrix.RotationYawPitchRollToRef(camera.rotation.y, camera.rotation.x, 0, camera._cameraRotationMatrix);\n camera.cameraDirection.addInPlace(Vector3.TransformCoordinates(direction, camera._cameraRotationMatrix));\n }\n }\n /**\n * Gets the class name of the current input.\n * @returns the class name\n */\n getClassName() {\n return \"FreeCameraTouchInput\";\n }\n /**\n * Get the friendly name associated with the input class.\n * @returns the input friendly name\n */\n getSimpleName() {\n return \"touch\";\n }\n}\n__decorate([\n serialize()\n], FreeCameraTouchInput.prototype, \"touchAngularSensibility\", void 0);\n__decorate([\n serialize()\n], FreeCameraTouchInput.prototype, \"touchMoveSensibility\", void 0);\nCameraInputTypes[\"FreeCameraTouchInput\"] = FreeCameraTouchInput;\n//# sourceMappingURL=freeCameraTouchInput.js.map","import { CameraInputsManager } from \"./cameraInputsManager.js\";\nimport { FreeCameraKeyboardMoveInput } from \"../Cameras/Inputs/freeCameraKeyboardMoveInput.js\";\nimport { FreeCameraMouseInput } from \"../Cameras/Inputs/freeCameraMouseInput.js\";\nimport { FreeCameraMouseWheelInput } from \"../Cameras/Inputs/freeCameraMouseWheelInput.js\";\nimport { FreeCameraTouchInput } from \"../Cameras/Inputs/freeCameraTouchInput.js\";\n/**\n * Default Inputs manager for the FreeCamera.\n * It groups all the default supported inputs for ease of use.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/customizingCameraInputs\n */\nexport class FreeCameraInputsManager extends CameraInputsManager {\n /**\n * Instantiates a new FreeCameraInputsManager.\n * @param camera Defines the camera the inputs belong to\n */\n constructor(camera) {\n super(camera);\n /**\n * @internal\n */\n this._mouseInput = null;\n /**\n * @internal\n */\n this._mouseWheelInput = null;\n }\n /**\n * Add keyboard input support to the input manager.\n * @returns the current input manager\n */\n addKeyboard() {\n this.add(new FreeCameraKeyboardMoveInput());\n return this;\n }\n /**\n * Add mouse input support to the input manager.\n * @param touchEnabled if the FreeCameraMouseInput should support touch (default: true)\n * @returns the current input manager\n */\n addMouse(touchEnabled = true) {\n if (!this._mouseInput) {\n this._mouseInput = new FreeCameraMouseInput(touchEnabled);\n this.add(this._mouseInput);\n }\n return this;\n }\n /**\n * Removes the mouse input support from the manager\n * @returns the current input manager\n */\n removeMouse() {\n if (this._mouseInput) {\n this.remove(this._mouseInput);\n }\n return this;\n }\n /**\n * Add mouse wheel input support to the input manager.\n * @returns the current input manager\n */\n addMouseWheel() {\n if (!this._mouseWheelInput) {\n this._mouseWheelInput = new FreeCameraMouseWheelInput();\n this.add(this._mouseWheelInput);\n }\n return this;\n }\n /**\n * Removes the mouse wheel input support from the manager\n * @returns the current input manager\n */\n removeMouseWheel() {\n if (this._mouseWheelInput) {\n this.remove(this._mouseWheelInput);\n }\n return this;\n }\n /**\n * Add touch input support to the input manager.\n * @returns the current input manager\n */\n addTouch() {\n this.add(new FreeCameraTouchInput());\n return this;\n }\n /**\n * Remove all attached input methods from a camera\n */\n clear() {\n super.clear();\n this._mouseInput = null;\n }\n}\n//# sourceMappingURL=freeCameraInputsManager.js.map","import { __decorate } from \"../tslib.es6.js\";\nimport { serializeAsVector3, serialize } from \"../Misc/decorators.js\";\nimport { Vector3, Vector2 } from \"../Maths/math.vector.js\";\nimport { Engine } from \"../Engines/engine.js\";\nimport { TargetCamera } from \"./targetCamera.js\";\nimport { FreeCameraInputsManager } from \"./freeCameraInputsManager.js\";\nimport { Tools } from \"../Misc/tools.js\";\n/**\n * This represents a free type of camera. It can be useful in First Person Shooter game for instance.\n * Please consider using the new UniversalCamera instead as it adds more functionality like the gamepad.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/camera_introduction#universal-camera\n */\nexport class FreeCamera extends TargetCamera {\n /**\n * Gets the input sensibility for a mouse input. (default is 2000.0)\n * Higher values reduce sensitivity.\n */\n get angularSensibility() {\n const mouse = this.inputs.attached[\"mouse\"];\n if (mouse) {\n return mouse.angularSensibility;\n }\n return 0;\n }\n /**\n * Sets the input sensibility for a mouse input. (default is 2000.0)\n * Higher values reduce sensitivity.\n */\n set angularSensibility(value) {\n const mouse = this.inputs.attached[\"mouse\"];\n if (mouse) {\n mouse.angularSensibility = value;\n }\n }\n /**\n * Gets or Set the list of keyboard keys used to control the forward move of the camera.\n */\n get keysUp() {\n const keyboard = this.inputs.attached[\"keyboard\"];\n if (keyboard) {\n return keyboard.keysUp;\n }\n return [];\n }\n set keysUp(value) {\n const keyboard = this.inputs.attached[\"keyboard\"];\n if (keyboard) {\n keyboard.keysUp = value;\n }\n }\n /**\n * Gets or Set the list of keyboard keys used to control the upward move of the camera.\n */\n get keysUpward() {\n const keyboard = this.inputs.attached[\"keyboard\"];\n if (keyboard) {\n return keyboard.keysUpward;\n }\n return [];\n }\n set keysUpward(value) {\n const keyboard = this.inputs.attached[\"keyboard\"];\n if (keyboard) {\n keyboard.keysUpward = value;\n }\n }\n /**\n * Gets or Set the list of keyboard keys used to control the backward move of the camera.\n */\n get keysDown() {\n const keyboard = this.inputs.attached[\"keyboard\"];\n if (keyboard) {\n return keyboard.keysDown;\n }\n return [];\n }\n set keysDown(value) {\n const keyboard = this.inputs.attached[\"keyboard\"];\n if (keyboard) {\n keyboard.keysDown = value;\n }\n }\n /**\n * Gets or Set the list of keyboard keys used to control the downward move of the camera.\n */\n get keysDownward() {\n const keyboard = this.inputs.attached[\"keyboard\"];\n if (keyboard) {\n return keyboard.keysDownward;\n }\n return [];\n }\n set keysDownward(value) {\n const keyboard = this.inputs.attached[\"keyboard\"];\n if (keyboard) {\n keyboard.keysDownward = value;\n }\n }\n /**\n * Gets or Set the list of keyboard keys used to control the left strafe move of the camera.\n */\n get keysLeft() {\n const keyboard = this.inputs.attached[\"keyboard\"];\n if (keyboard) {\n return keyboard.keysLeft;\n }\n return [];\n }\n set keysLeft(value) {\n const keyboard = this.inputs.attached[\"keyboard\"];\n if (keyboard) {\n keyboard.keysLeft = value;\n }\n }\n /**\n * Gets or Set the list of keyboard keys used to control the right strafe move of the camera.\n */\n get keysRight() {\n const keyboard = this.inputs.attached[\"keyboard\"];\n if (keyboard) {\n return keyboard.keysRight;\n }\n return [];\n }\n set keysRight(value) {\n const keyboard = this.inputs.attached[\"keyboard\"];\n if (keyboard) {\n keyboard.keysRight = value;\n }\n }\n /**\n * Gets or Set the list of keyboard keys used to control the left rotation move of the camera.\n */\n get keysRotateLeft() {\n const keyboard = this.inputs.attached[\"keyboard\"];\n if (keyboard) {\n return keyboard.keysRotateLeft;\n }\n return [];\n }\n set keysRotateLeft(value) {\n const keyboard = this.inputs.attached[\"keyboard\"];\n if (keyboard) {\n keyboard.keysRotateLeft = value;\n }\n }\n /**\n * Gets or Set the list of keyboard keys used to control the right rotation move of the camera.\n */\n get keysRotateRight() {\n const keyboard = this.inputs.attached[\"keyboard\"];\n if (keyboard) {\n return keyboard.keysRotateRight;\n }\n return [];\n }\n set keysRotateRight(value) {\n const keyboard = this.inputs.attached[\"keyboard\"];\n if (keyboard) {\n keyboard.keysRotateRight = value;\n }\n }\n /**\n * Gets or Set the list of keyboard keys used to control the up rotation move of the camera.\n */\n get keysRotateUp() {\n const keyboard = this.inputs.attached[\"keyboard\"];\n if (keyboard) {\n return keyboard.keysRotateUp;\n }\n return [];\n }\n set keysRotateUp(value) {\n const keyboard = this.inputs.attached[\"keyboard\"];\n if (keyboard) {\n keyboard.keysRotateUp = value;\n }\n }\n /**\n * Gets or Set the list of keyboard keys used to control the down rotation move of the camera.\n */\n get keysRotateDown() {\n const keyboard = this.inputs.attached[\"keyboard\"];\n if (keyboard) {\n return keyboard.keysRotateDown;\n }\n return [];\n }\n set keysRotateDown(value) {\n const keyboard = this.inputs.attached[\"keyboard\"];\n if (keyboard) {\n keyboard.keysRotateDown = value;\n }\n }\n /**\n * Instantiates a Free Camera.\n * This represents a free type of camera. It can be useful in First Person Shooter game for instance.\n * Please consider using the new UniversalCamera instead as it adds more functionality like touch to this camera.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/camera_introduction#universal-camera\n * @param name Define the name of the camera in the scene\n * @param position Define the start position of the camera in the scene\n * @param scene Define the scene the camera belongs to\n * @param setActiveOnSceneIfNoneActive Defines whether the camera should be marked as active if not other active cameras have been defined\n */\n constructor(name, position, scene, setActiveOnSceneIfNoneActive = true) {\n super(name, position, scene, setActiveOnSceneIfNoneActive);\n /**\n * Define the collision ellipsoid of the camera.\n * This is helpful to simulate a camera body like the player body around the camera\n * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/camera_collisions#arcrotatecamera\n */\n this.ellipsoid = new Vector3(0.5, 1, 0.5);\n /**\n * Define an offset for the position of the ellipsoid around the camera.\n * This can be helpful to determine the center of the body near the gravity center of the body\n * instead of its head.\n */\n this.ellipsoidOffset = new Vector3(0, 0, 0);\n /**\n * Enable or disable collisions of the camera with the rest of the scene objects.\n */\n this.checkCollisions = false;\n /**\n * Enable or disable gravity on the camera.\n */\n this.applyGravity = false;\n this._needMoveForGravity = false;\n this._oldPosition = Vector3.Zero();\n this._diffPosition = Vector3.Zero();\n this._newPosition = Vector3.Zero();\n // Collisions\n this._collisionMask = -1;\n this._onCollisionPositionChange = (collisionId, newPosition, collidedMesh = null) => {\n this._newPosition.copyFrom(newPosition);\n this._newPosition.subtractToRef(this._oldPosition, this._diffPosition);\n if (this._diffPosition.length() > Engine.CollisionsEpsilon) {\n this.position.addToRef(this._diffPosition, this._deferredPositionUpdate);\n if (!this._deferOnly) {\n this.position.copyFrom(this._deferredPositionUpdate);\n }\n else {\n this._deferredUpdated = true;\n }\n // call onCollide, if defined. Note that in case of deferred update, the actual position change might happen in the next frame.\n if (this.onCollide && collidedMesh) {\n this.onCollide(collidedMesh);\n }\n }\n };\n this.inputs = new FreeCameraInputsManager(this);\n this.inputs.addKeyboard().addMouse();\n }\n /**\n * Attached controls to the current camera.\n * @param ignored defines an ignored parameter kept for backward compatibility.\n * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)\n */\n attachControl(ignored, noPreventDefault) {\n // eslint-disable-next-line prefer-rest-params\n noPreventDefault = Tools.BackCompatCameraNoPreventDefault(arguments);\n this.inputs.attachElement(noPreventDefault);\n }\n /**\n * Detach the current controls from the specified dom element.\n */\n detachControl() {\n this.inputs.detachElement();\n this.cameraDirection = new Vector3(0, 0, 0);\n this.cameraRotation = new Vector2(0, 0);\n }\n /**\n * Define a collision mask to limit the list of object the camera can collide with\n */\n get collisionMask() {\n return this._collisionMask;\n }\n set collisionMask(mask) {\n this._collisionMask = !isNaN(mask) ? mask : -1;\n }\n /**\n * @internal\n */\n _collideWithWorld(displacement) {\n let globalPosition;\n if (this.parent) {\n globalPosition = Vector3.TransformCoordinates(this.position, this.parent.getWorldMatrix());\n }\n else {\n globalPosition = this.position;\n }\n globalPosition.subtractFromFloatsToRef(0, this.ellipsoid.y, 0, this._oldPosition);\n this._oldPosition.addInPlace(this.ellipsoidOffset);\n const coordinator = this.getScene().collisionCoordinator;\n if (!this._collider) {\n this._collider = coordinator.createCollider();\n }\n this._collider._radius = this.ellipsoid;\n this._collider.collisionMask = this._collisionMask;\n //no need for clone, as long as gravity is not on.\n let actualDisplacement = displacement;\n //add gravity to the direction to prevent the dual-collision checking\n if (this.applyGravity) {\n //this prevents mending with cameraDirection, a global variable of the free camera class.\n actualDisplacement = displacement.add(this.getScene().gravity);\n }\n coordinator.getNewPosition(this._oldPosition, actualDisplacement, this._collider, 3, null, this._onCollisionPositionChange, this.uniqueId);\n }\n /** @internal */\n _checkInputs() {\n if (!this._localDirection) {\n this._localDirection = Vector3.Zero();\n this._transformedDirection = Vector3.Zero();\n }\n this.inputs.checkInputs();\n super._checkInputs();\n }\n /**\n * Enable movement without a user input. This allows gravity to always be applied.\n */\n set needMoveForGravity(value) {\n this._needMoveForGravity = value;\n }\n /**\n * When true, gravity is applied whether there is user input or not.\n */\n get needMoveForGravity() {\n return this._needMoveForGravity;\n }\n /** @internal */\n _decideIfNeedsToMove() {\n return this._needMoveForGravity || Math.abs(this.cameraDirection.x) > 0 || Math.abs(this.cameraDirection.y) > 0 || Math.abs(this.cameraDirection.z) > 0;\n }\n /** @internal */\n _updatePosition() {\n if (this.checkCollisions && this.getScene().collisionsEnabled) {\n this._collideWithWorld(this.cameraDirection);\n }\n else {\n super._updatePosition();\n }\n }\n /**\n * Destroy the camera and release the current resources hold by it.\n */\n dispose() {\n this.inputs.clear();\n super.dispose();\n }\n /**\n * Gets the current object class name.\n * @returns the class name\n */\n getClassName() {\n return \"FreeCamera\";\n }\n}\n__decorate([\n serializeAsVector3()\n], FreeCamera.prototype, \"ellipsoid\", void 0);\n__decorate([\n serializeAsVector3()\n], FreeCamera.prototype, \"ellipsoidOffset\", void 0);\n__decorate([\n serialize()\n], FreeCamera.prototype, \"checkCollisions\", void 0);\n__decorate([\n serialize()\n], FreeCamera.prototype, \"applyGravity\", void 0);\n//# sourceMappingURL=freeCamera.js.map","import { Bone } from \"./bone.js\";\nimport { Observable } from \"../Misc/observable.js\";\nimport { Vector3, Matrix, TmpVectors } from \"../Maths/math.vector.js\";\nimport { RawTexture } from \"../Materials/Textures/rawTexture.js\";\nimport { Animation } from \"../Animations/animation.js\";\nimport { AnimationRange } from \"../Animations/animationRange.js\";\nimport { EngineStore } from \"../Engines/engineStore.js\";\n\nimport { Logger } from \"../Misc/logger.js\";\nimport { DeepCopier } from \"../Misc/deepCopier.js\";\n/**\n * Class used to handle skinning animations\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/bonesSkeletons\n */\nexport class Skeleton {\n /**\n * Gets or sets a boolean indicating that bone matrices should be stored as a texture instead of using shader uniforms (default is true).\n * Please note that this option is not available if the hardware does not support it\n */\n get useTextureToStoreBoneMatrices() {\n return this._useTextureToStoreBoneMatrices;\n }\n set useTextureToStoreBoneMatrices(value) {\n this._useTextureToStoreBoneMatrices = value;\n this._markAsDirty();\n }\n /**\n * Gets or sets the animation properties override\n */\n get animationPropertiesOverride() {\n if (!this._animationPropertiesOverride) {\n return this._scene.animationPropertiesOverride;\n }\n return this._animationPropertiesOverride;\n }\n set animationPropertiesOverride(value) {\n this._animationPropertiesOverride = value;\n }\n /**\n * Gets a boolean indicating that the skeleton effectively stores matrices into a texture\n */\n get isUsingTextureForMatrices() {\n return this.useTextureToStoreBoneMatrices && this._canUseTextureForBones;\n }\n /**\n * Gets the unique ID of this skeleton\n */\n get uniqueId() {\n return this._uniqueId;\n }\n /**\n * Creates a new skeleton\n * @param name defines the skeleton name\n * @param id defines the skeleton Id\n * @param scene defines the hosting scene\n */\n constructor(\n /** defines the skeleton name */\n name, \n /** defines the skeleton Id */\n id, scene) {\n this.name = name;\n this.id = id;\n /**\n * Defines the list of child bones\n */\n this.bones = new Array();\n /**\n * Defines a boolean indicating if the root matrix is provided by meshes or by the current skeleton (this is the default value)\n */\n this.needInitialSkinMatrix = false;\n this._isDirty = true;\n this._meshesWithPoseMatrix = new Array();\n this._identity = Matrix.Identity();\n this._currentRenderId = -1;\n this._ranges = {};\n this._absoluteTransformIsDirty = true;\n this._canUseTextureForBones = false;\n this._uniqueId = 0;\n /** @internal */\n this._numBonesWithLinkedTransformNode = 0;\n /** @internal */\n this._hasWaitingData = null;\n /** @internal */\n this._parentContainer = null;\n /**\n * Specifies if the skeleton should be serialized\n */\n this.doNotSerialize = false;\n this._useTextureToStoreBoneMatrices = true;\n this._animationPropertiesOverride = null;\n // Events\n /**\n * An observable triggered before computing the skeleton's matrices\n */\n this.onBeforeComputeObservable = new Observable();\n this.bones = [];\n this._scene = scene || EngineStore.LastCreatedScene;\n this._uniqueId = this._scene.getUniqueId();\n this._scene.addSkeleton(this);\n //make sure it will recalculate the matrix next time prepare is called.\n this._isDirty = true;\n const engineCaps = this._scene.getEngine().getCaps();\n this._canUseTextureForBones = engineCaps.textureFloat && engineCaps.maxVertexTextureImageUnits > 0;\n }\n /**\n * Gets the current object class name.\n * @returns the class name\n */\n getClassName() {\n return \"Skeleton\";\n }\n /**\n * Returns an array containing the root bones\n * @returns an array containing the root bones\n */\n getChildren() {\n return this.bones.filter((b) => !b.getParent());\n }\n // Members\n /**\n * Gets the list of transform matrices to send to shaders (one matrix per bone)\n * @param mesh defines the mesh to use to get the root matrix (if needInitialSkinMatrix === true)\n * @returns a Float32Array containing matrices data\n */\n getTransformMatrices(mesh) {\n if (this.needInitialSkinMatrix) {\n if (!mesh._bonesTransformMatrices) {\n this.prepare();\n }\n return mesh._bonesTransformMatrices;\n }\n if (!this._transformMatrices || this._isDirty) {\n this.prepare();\n }\n return this._transformMatrices;\n }\n /**\n * Gets the list of transform matrices to send to shaders inside a texture (one matrix per bone)\n * @param mesh defines the mesh to use to get the root matrix (if needInitialSkinMatrix === true)\n * @returns a raw texture containing the data\n */\n getTransformMatrixTexture(mesh) {\n if (this.needInitialSkinMatrix && mesh._transformMatrixTexture) {\n return mesh._transformMatrixTexture;\n }\n return this._transformMatrixTexture;\n }\n /**\n * Gets the current hosting scene\n * @returns a scene object\n */\n getScene() {\n return this._scene;\n }\n // Methods\n /**\n * Gets a string representing the current skeleton data\n * @param fullDetails defines a boolean indicating if we want a verbose version\n * @returns a string representing the current skeleton data\n */\n toString(fullDetails) {\n let ret = `Name: ${this.name}, nBones: ${this.bones.length}`;\n ret += `, nAnimationRanges: ${this._ranges ? Object.keys(this._ranges).length : \"none\"}`;\n if (fullDetails) {\n ret += \", Ranges: {\";\n let first = true;\n for (const name in this._ranges) {\n if (first) {\n ret += \", \";\n first = false;\n }\n ret += name;\n }\n ret += \"}\";\n }\n return ret;\n }\n /**\n * Get bone's index searching by name\n * @param name defines bone's name to search for\n * @returns the indice of the bone. Returns -1 if not found\n */\n getBoneIndexByName(name) {\n for (let boneIndex = 0, cache = this.bones.length; boneIndex < cache; boneIndex++) {\n if (this.bones[boneIndex].name === name) {\n return boneIndex;\n }\n }\n return -1;\n }\n /**\n * Create a new animation range\n * @param name defines the name of the range\n * @param from defines the start key\n * @param to defines the end key\n */\n createAnimationRange(name, from, to) {\n // check name not already in use\n if (!this._ranges[name]) {\n this._ranges[name] = new AnimationRange(name, from, to);\n for (let i = 0, nBones = this.bones.length; i < nBones; i++) {\n if (this.bones[i].animations[0]) {\n this.bones[i].animations[0].createRange(name, from, to);\n }\n }\n }\n }\n /**\n * Delete a specific animation range\n * @param name defines the name of the range\n * @param deleteFrames defines if frames must be removed as well\n */\n deleteAnimationRange(name, deleteFrames = true) {\n for (let i = 0, nBones = this.bones.length; i < nBones; i++) {\n if (this.bones[i].animations[0]) {\n this.bones[i].animations[0].deleteRange(name, deleteFrames);\n }\n }\n this._ranges[name] = null; // said much faster than 'delete this._range[name]'\n }\n /**\n * Gets a specific animation range\n * @param name defines the name of the range to look for\n * @returns the requested animation range or null if not found\n */\n getAnimationRange(name) {\n return this._ranges[name] || null;\n }\n /**\n * Gets the list of all animation ranges defined on this skeleton\n * @returns an array\n */\n getAnimationRanges() {\n const animationRanges = [];\n let name;\n for (name in this._ranges) {\n animationRanges.push(this._ranges[name]);\n }\n return animationRanges;\n }\n /**\n * Copy animation range from a source skeleton.\n * This is not for a complete retargeting, only between very similar skeleton's with only possible bone length differences\n * @param source defines the source skeleton\n * @param name defines the name of the range to copy\n * @param rescaleAsRequired defines if rescaling must be applied if required\n * @returns true if operation was successful\n */\n copyAnimationRange(source, name, rescaleAsRequired = false) {\n if (this._ranges[name] || !source.getAnimationRange(name)) {\n return false;\n }\n let ret = true;\n const frameOffset = this._getHighestAnimationFrame() + 1;\n // make a dictionary of source skeleton's bones, so exact same order or doubly nested loop is not required\n const boneDict = {};\n const sourceBones = source.bones;\n let nBones;\n let i;\n for (i = 0, nBones = sourceBones.length; i < nBones; i++) {\n boneDict[sourceBones[i].name] = sourceBones[i];\n }\n if (this.bones.length !== sourceBones.length) {\n Logger.Warn(`copyAnimationRange: this rig has ${this.bones.length} bones, while source as ${sourceBones.length}`);\n ret = false;\n }\n const skelDimensionsRatio = rescaleAsRequired && this.dimensionsAtRest && source.dimensionsAtRest ? this.dimensionsAtRest.divide(source.dimensionsAtRest) : null;\n for (i = 0, nBones = this.bones.length; i < nBones; i++) {\n const boneName = this.bones[i].name;\n const sourceBone = boneDict[boneName];\n if (sourceBone) {\n ret = ret && this.bones[i].copyAnimationRange(sourceBone, name, frameOffset, rescaleAsRequired, skelDimensionsRatio);\n }\n else {\n Logger.Warn(\"copyAnimationRange: not same rig, missing source bone \" + boneName);\n ret = false;\n }\n }\n // do not call createAnimationRange(), since it also is done to bones, which was already done\n const range = source.getAnimationRange(name);\n if (range) {\n this._ranges[name] = new AnimationRange(name, range.from + frameOffset, range.to + frameOffset);\n }\n return ret;\n }\n /**\n * Forces the skeleton to go to rest pose\n */\n returnToRest() {\n for (const bone of this.bones) {\n if (bone._index !== -1) {\n bone.returnToRest();\n }\n }\n }\n _getHighestAnimationFrame() {\n let ret = 0;\n for (let i = 0, nBones = this.bones.length; i < nBones; i++) {\n if (this.bones[i].animations[0]) {\n const highest = this.bones[i].animations[0].getHighestFrame();\n if (ret < highest) {\n ret = highest;\n }\n }\n }\n return ret;\n }\n /**\n * Begin a specific animation range\n * @param name defines the name of the range to start\n * @param loop defines if looping must be turned on (false by default)\n * @param speedRatio defines the speed ratio to apply (1 by default)\n * @param onAnimationEnd defines a callback which will be called when animation will end\n * @returns a new animatable\n */\n beginAnimation(name, loop, speedRatio, onAnimationEnd) {\n const range = this.getAnimationRange(name);\n if (!range) {\n return null;\n }\n return this._scene.beginAnimation(this, range.from, range.to, loop, speedRatio, onAnimationEnd);\n }\n /**\n * Convert the keyframes for a range of animation on a skeleton to be relative to a given reference frame.\n * @param skeleton defines the Skeleton containing the animation range to convert\n * @param referenceFrame defines the frame that keyframes in the range will be relative to\n * @param range defines the name of the AnimationRange belonging to the Skeleton to convert\n * @returns the original skeleton\n */\n static MakeAnimationAdditive(skeleton, referenceFrame = 0, range) {\n const rangeValue = skeleton.getAnimationRange(range);\n // We can't make a range additive if it doesn't exist\n if (!rangeValue) {\n return null;\n }\n // Find any current scene-level animatable belonging to the target that matches the range\n const sceneAnimatables = skeleton._scene.getAllAnimatablesByTarget(skeleton);\n let rangeAnimatable = null;\n for (let index = 0; index < sceneAnimatables.length; index++) {\n const sceneAnimatable = sceneAnimatables[index];\n if (sceneAnimatable.fromFrame === (rangeValue === null || rangeValue === void 0 ? void 0 : rangeValue.from) && sceneAnimatable.toFrame === (rangeValue === null || rangeValue === void 0 ? void 0 : rangeValue.to)) {\n rangeAnimatable = sceneAnimatable;\n break;\n }\n }\n // Convert the animations belonging to the skeleton to additive keyframes\n const animatables = skeleton.getAnimatables();\n for (let index = 0; index < animatables.length; index++) {\n const animatable = animatables[index];\n const animations = animatable.animations;\n if (!animations) {\n continue;\n }\n for (let animIndex = 0; animIndex < animations.length; animIndex++) {\n Animation.MakeAnimationAdditive(animations[animIndex], referenceFrame, range);\n }\n }\n // Mark the scene-level animatable as additive\n if (rangeAnimatable) {\n rangeAnimatable.isAdditive = true;\n }\n return skeleton;\n }\n /** @internal */\n _markAsDirty() {\n this._isDirty = true;\n this._absoluteTransformIsDirty = true;\n }\n /**\n * @internal\n */\n _registerMeshWithPoseMatrix(mesh) {\n this._meshesWithPoseMatrix.push(mesh);\n }\n /**\n * @internal\n */\n _unregisterMeshWithPoseMatrix(mesh) {\n const index = this._meshesWithPoseMatrix.indexOf(mesh);\n if (index > -1) {\n this._meshesWithPoseMatrix.splice(index, 1);\n }\n }\n _computeTransformMatrices(targetMatrix, initialSkinMatrix) {\n this.onBeforeComputeObservable.notifyObservers(this);\n for (let index = 0; index < this.bones.length; index++) {\n const bone = this.bones[index];\n bone._childUpdateId++;\n const parentBone = bone.getParent();\n if (parentBone) {\n bone.getLocalMatrix().multiplyToRef(parentBone.getFinalMatrix(), bone.getFinalMatrix());\n }\n else {\n if (initialSkinMatrix) {\n bone.getLocalMatrix().multiplyToRef(initialSkinMatrix, bone.getFinalMatrix());\n }\n else {\n bone.getFinalMatrix().copyFrom(bone.getLocalMatrix());\n }\n }\n if (bone._index !== -1) {\n const mappedIndex = bone._index === null ? index : bone._index;\n bone.getAbsoluteInverseBindMatrix().multiplyToArray(bone.getFinalMatrix(), targetMatrix, mappedIndex * 16);\n }\n }\n this._identity.copyToArray(targetMatrix, this.bones.length * 16);\n }\n /**\n * Build all resources required to render a skeleton\n * @param dontCheckFrameId defines a boolean indicating if prepare should be run without checking first the current frame id (default: false)\n */\n prepare(dontCheckFrameId = false) {\n if (!dontCheckFrameId) {\n const currentRenderId = this.getScene().getRenderId();\n if (this._currentRenderId === currentRenderId) {\n return;\n }\n this._currentRenderId = currentRenderId;\n }\n // Update the local matrix of bones with linked transform nodes.\n if (this._numBonesWithLinkedTransformNode > 0) {\n for (const bone of this.bones) {\n if (bone._linkedTransformNode) {\n const node = bone._linkedTransformNode;\n bone.position = node.position;\n if (node.rotationQuaternion) {\n bone.rotationQuaternion = node.rotationQuaternion;\n }\n else {\n bone.rotation = node.rotation;\n }\n bone.scaling = node.scaling;\n }\n }\n }\n if (this.needInitialSkinMatrix) {\n for (const mesh of this._meshesWithPoseMatrix) {\n const poseMatrix = mesh.getPoseMatrix();\n let needsUpdate = this._isDirty;\n if (!mesh._bonesTransformMatrices || mesh._bonesTransformMatrices.length !== 16 * (this.bones.length + 1)) {\n mesh._bonesTransformMatrices = new Float32Array(16 * (this.bones.length + 1));\n needsUpdate = true;\n }\n if (!needsUpdate) {\n continue;\n }\n if (this._synchronizedWithMesh !== mesh) {\n this._synchronizedWithMesh = mesh;\n // Prepare bones\n for (const bone of this.bones) {\n if (!bone.getParent()) {\n const matrix = bone.getBindMatrix();\n matrix.multiplyToRef(poseMatrix, TmpVectors.Matrix[1]);\n bone._updateAbsoluteBindMatrices(TmpVectors.Matrix[1]);\n }\n }\n if (this.isUsingTextureForMatrices) {\n const textureWidth = (this.bones.length + 1) * 4;\n if (!mesh._transformMatrixTexture || mesh._transformMatrixTexture.getSize().width !== textureWidth) {\n if (mesh._transformMatrixTexture) {\n mesh._transformMatrixTexture.dispose();\n }\n mesh._transformMatrixTexture = RawTexture.CreateRGBATexture(mesh._bonesTransformMatrices, (this.bones.length + 1) * 4, 1, this._scene, false, false, 1, 1);\n }\n }\n }\n this._computeTransformMatrices(mesh._bonesTransformMatrices, poseMatrix);\n if (this.isUsingTextureForMatrices && mesh._transformMatrixTexture) {\n mesh._transformMatrixTexture.update(mesh._bonesTransformMatrices);\n }\n }\n }\n else {\n if (!this._isDirty) {\n return;\n }\n if (!this._transformMatrices || this._transformMatrices.length !== 16 * (this.bones.length + 1)) {\n this._transformMatrices = new Float32Array(16 * (this.bones.length + 1));\n if (this.isUsingTextureForMatrices) {\n if (this._transformMatrixTexture) {\n this._transformMatrixTexture.dispose();\n }\n this._transformMatrixTexture = RawTexture.CreateRGBATexture(this._transformMatrices, (this.bones.length + 1) * 4, 1, this._scene, false, false, 1, 1);\n }\n }\n this._computeTransformMatrices(this._transformMatrices, null);\n if (this.isUsingTextureForMatrices && this._transformMatrixTexture) {\n this._transformMatrixTexture.update(this._transformMatrices);\n }\n }\n this._isDirty = false;\n }\n /**\n * Gets the list of animatables currently running for this skeleton\n * @returns an array of animatables\n */\n getAnimatables() {\n if (!this._animatables || this._animatables.length !== this.bones.length) {\n this._animatables = [];\n for (let index = 0; index < this.bones.length; index++) {\n this._animatables.push(this.bones[index]);\n }\n }\n return this._animatables;\n }\n /**\n * Clone the current skeleton\n * @param name defines the name of the new skeleton\n * @param id defines the id of the new skeleton\n * @returns the new skeleton\n */\n clone(name, id) {\n const result = new Skeleton(name, id || name, this._scene);\n result.needInitialSkinMatrix = this.needInitialSkinMatrix;\n for (let index = 0; index < this.bones.length; index++) {\n const source = this.bones[index];\n let parentBone = null;\n const parent = source.getParent();\n if (parent) {\n const parentIndex = this.bones.indexOf(parent);\n parentBone = result.bones[parentIndex];\n }\n const bone = new Bone(source.name, result, parentBone, source.getBindMatrix().clone(), source.getRestMatrix().clone());\n bone._index = source._index;\n if (source._linkedTransformNode) {\n bone.linkTransformNode(source._linkedTransformNode);\n }\n DeepCopier.DeepCopy(source.animations, bone.animations);\n }\n if (this._ranges) {\n result._ranges = {};\n for (const rangeName in this._ranges) {\n const range = this._ranges[rangeName];\n if (range) {\n result._ranges[rangeName] = range.clone();\n }\n }\n }\n this._isDirty = true;\n result.prepare(true);\n return result;\n }\n /**\n * Enable animation blending for this skeleton\n * @param blendingSpeed defines the blending speed to apply\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#animation-blending\n */\n enableBlending(blendingSpeed = 0.01) {\n this.bones.forEach((bone) => {\n bone.animations.forEach((animation) => {\n animation.enableBlending = true;\n animation.blendingSpeed = blendingSpeed;\n });\n });\n }\n /**\n * Releases all resources associated with the current skeleton\n */\n dispose() {\n this._meshesWithPoseMatrix.length = 0;\n // Animations\n this.getScene().stopAnimation(this);\n // Remove from scene\n this.getScene().removeSkeleton(this);\n if (this._parentContainer) {\n const index = this._parentContainer.skeletons.indexOf(this);\n if (index > -1) {\n this._parentContainer.skeletons.splice(index, 1);\n }\n this._parentContainer = null;\n }\n if (this._transformMatrixTexture) {\n this._transformMatrixTexture.dispose();\n this._transformMatrixTexture = null;\n }\n }\n /**\n * Serialize the skeleton in a JSON object\n * @returns a JSON object\n */\n serialize() {\n var _a;\n const serializationObject = {};\n serializationObject.name = this.name;\n serializationObject.id = this.id;\n if (this.dimensionsAtRest) {\n serializationObject.dimensionsAtRest = this.dimensionsAtRest.asArray();\n }\n serializationObject.bones = [];\n serializationObject.needInitialSkinMatrix = this.needInitialSkinMatrix;\n for (let index = 0; index < this.bones.length; index++) {\n const bone = this.bones[index];\n const parent = bone.getParent();\n const serializedBone = {\n parentBoneIndex: parent ? this.bones.indexOf(parent) : -1,\n index: bone.getIndex(),\n name: bone.name,\n id: bone.id,\n matrix: bone.getBindMatrix().toArray(),\n rest: bone.getRestMatrix().toArray(),\n linkedTransformNodeId: (_a = bone.getTransformNode()) === null || _a === void 0 ? void 0 : _a.id,\n };\n serializationObject.bones.push(serializedBone);\n if (bone.length) {\n serializedBone.length = bone.length;\n }\n if (bone.metadata) {\n serializedBone.metadata = bone.metadata;\n }\n if (bone.animations && bone.animations.length > 0) {\n serializedBone.animation = bone.animations[0].serialize();\n }\n serializationObject.ranges = [];\n for (const name in this._ranges) {\n const source = this._ranges[name];\n if (!source) {\n continue;\n }\n const range = {};\n range.name = name;\n range.from = source.from;\n range.to = source.to;\n serializationObject.ranges.push(range);\n }\n }\n return serializationObject;\n }\n /**\n * Creates a new skeleton from serialized data\n * @param parsedSkeleton defines the serialized data\n * @param scene defines the hosting scene\n * @returns a new skeleton\n */\n static Parse(parsedSkeleton, scene) {\n const skeleton = new Skeleton(parsedSkeleton.name, parsedSkeleton.id, scene);\n if (parsedSkeleton.dimensionsAtRest) {\n skeleton.dimensionsAtRest = Vector3.FromArray(parsedSkeleton.dimensionsAtRest);\n }\n skeleton.needInitialSkinMatrix = parsedSkeleton.needInitialSkinMatrix;\n let index;\n for (index = 0; index < parsedSkeleton.bones.length; index++) {\n const parsedBone = parsedSkeleton.bones[index];\n const parsedBoneIndex = parsedSkeleton.bones[index].index;\n let parentBone = null;\n if (parsedBone.parentBoneIndex > -1) {\n parentBone = skeleton.bones[parsedBone.parentBoneIndex];\n }\n const rest = parsedBone.rest ? Matrix.FromArray(parsedBone.rest) : null;\n const bone = new Bone(parsedBone.name, skeleton, parentBone, Matrix.FromArray(parsedBone.matrix), rest, null, parsedBoneIndex);\n if (parsedBone.id !== undefined && parsedBone.id !== null) {\n bone.id = parsedBone.id;\n }\n if (parsedBone.length) {\n bone.length = parsedBone.length;\n }\n if (parsedBone.metadata) {\n bone.metadata = parsedBone.metadata;\n }\n if (parsedBone.animation) {\n bone.animations.push(Animation.Parse(parsedBone.animation));\n }\n if (parsedBone.linkedTransformNodeId !== undefined && parsedBone.linkedTransformNodeId !== null) {\n skeleton._hasWaitingData = true;\n bone._waitingTransformNodeId = parsedBone.linkedTransformNodeId;\n }\n }\n // placed after bones, so createAnimationRange can cascade down\n if (parsedSkeleton.ranges) {\n for (index = 0; index < parsedSkeleton.ranges.length; index++) {\n const data = parsedSkeleton.ranges[index];\n skeleton.createAnimationRange(data.name, data.from, data.to);\n }\n }\n return skeleton;\n }\n /**\n * Compute all node absolute matrices\n * @param forceUpdate defines if computation must be done even if cache is up to date\n */\n computeAbsoluteMatrices(forceUpdate = false) {\n if (this._absoluteTransformIsDirty || forceUpdate) {\n this.bones[0].computeAbsoluteMatrices();\n this._absoluteTransformIsDirty = false;\n }\n }\n /**\n * Compute all node absolute matrices\n * @param forceUpdate defines if computation must be done even if cache is up to date\n * @deprecated Please use computeAbsoluteMatrices instead\n */\n computeAbsoluteTransforms(forceUpdate = false) {\n this.computeAbsoluteMatrices(forceUpdate);\n }\n /**\n * Gets the root pose matrix\n * @returns a matrix\n */\n getPoseMatrix() {\n let poseMatrix = null;\n if (this._meshesWithPoseMatrix.length > 0) {\n poseMatrix = this._meshesWithPoseMatrix[0].getPoseMatrix();\n }\n return poseMatrix;\n }\n /**\n * Sorts bones per internal index\n */\n sortBones() {\n const bones = new Array();\n const visited = new Array(this.bones.length);\n for (let index = 0; index < this.bones.length; index++) {\n this._sortBones(index, bones, visited);\n }\n this.bones = bones;\n }\n _sortBones(index, bones, visited) {\n if (visited[index]) {\n return;\n }\n visited[index] = true;\n const bone = this.bones[index];\n if (!bone)\n return;\n if (bone._index === undefined) {\n bone._index = index;\n }\n const parentBone = bone.getParent();\n if (parentBone) {\n this._sortBones(this.bones.indexOf(parentBone), bones, visited);\n }\n bones.push(bone);\n }\n /**\n * Set the current local matrix as the restPose for all bones in the skeleton.\n */\n setCurrentPoseAsRest() {\n this.bones.forEach((b) => {\n b.setCurrentPoseAsRest();\n });\n }\n}\n//# sourceMappingURL=skeleton.js.map","import { __decorate } from \"../tslib.es6.js\";\nimport { serializeAsColor3, serializeAsVector3 } from \"../Misc/decorators.js\";\nimport { Matrix, Vector3 } from \"../Maths/math.vector.js\";\nimport { Color3 } from \"../Maths/math.color.js\";\nimport { Node } from \"../node.js\";\nimport { Light } from \"./light.js\";\nNode.AddNodeConstructor(\"Light_Type_3\", (name, scene) => {\n return () => new HemisphericLight(name, Vector3.Zero(), scene);\n});\n/**\n * The HemisphericLight simulates the ambient environment light,\n * so the passed direction is the light reflection direction, not the incoming direction.\n */\nexport class HemisphericLight extends Light {\n /**\n * Creates a HemisphericLight object in the scene according to the passed direction (Vector3).\n * The HemisphericLight simulates the ambient environment light, so the passed direction is the light reflection direction, not the incoming direction.\n * The HemisphericLight can't cast shadows.\n * Documentation : https://doc.babylonjs.com/features/featuresDeepDive/lights/lights_introduction\n * @param name The friendly name of the light\n * @param direction The direction of the light reflection\n * @param scene The scene the light belongs to\n */\n constructor(name, direction, scene) {\n super(name, scene);\n /**\n * The groundColor is the light in the opposite direction to the one specified during creation.\n * You can think of the diffuse and specular light as coming from the centre of the object in the given direction and the groundColor light in the opposite direction.\n */\n this.groundColor = new Color3(0.0, 0.0, 0.0);\n this.direction = direction || Vector3.Up();\n }\n _buildUniformLayout() {\n this._uniformBuffer.addUniform(\"vLightData\", 4);\n this._uniformBuffer.addUniform(\"vLightDiffuse\", 4);\n this._uniformBuffer.addUniform(\"vLightSpecular\", 4);\n this._uniformBuffer.addUniform(\"vLightGround\", 3);\n this._uniformBuffer.addUniform(\"shadowsInfo\", 3);\n this._uniformBuffer.addUniform(\"depthValues\", 2);\n this._uniformBuffer.create();\n }\n /**\n * Returns the string \"HemisphericLight\".\n * @returns The class name\n */\n getClassName() {\n return \"HemisphericLight\";\n }\n /**\n * Sets the HemisphericLight direction towards the passed target (Vector3).\n * Returns the updated direction.\n * @param target The target the direction should point to\n * @returns The computed direction\n */\n setDirectionToTarget(target) {\n this.direction = Vector3.Normalize(target.subtract(Vector3.Zero()));\n return this.direction;\n }\n /**\n * Returns the shadow generator associated to the light.\n * @returns Always null for hemispheric lights because it does not support shadows.\n */\n getShadowGenerator() {\n return null;\n }\n /**\n * Sets the passed Effect object with the HemisphericLight normalized direction and color and the passed name (string).\n * @param _effect The effect to update\n * @param lightIndex The index of the light in the effect to update\n * @returns The hemispheric light\n */\n transferToEffect(_effect, lightIndex) {\n const normalizeDirection = Vector3.Normalize(this.direction);\n this._uniformBuffer.updateFloat4(\"vLightData\", normalizeDirection.x, normalizeDirection.y, normalizeDirection.z, 0.0, lightIndex);\n this._uniformBuffer.updateColor3(\"vLightGround\", this.groundColor.scale(this.intensity), lightIndex);\n return this;\n }\n transferToNodeMaterialEffect(effect, lightDataUniformName) {\n const normalizeDirection = Vector3.Normalize(this.direction);\n effect.setFloat3(lightDataUniformName, normalizeDirection.x, normalizeDirection.y, normalizeDirection.z);\n return this;\n }\n /**\n * Computes the world matrix of the node\n * @returns the world matrix\n */\n computeWorldMatrix() {\n if (!this._worldMatrix) {\n this._worldMatrix = Matrix.Identity();\n }\n return this._worldMatrix;\n }\n /**\n * Returns the integer 3.\n * @returns The light Type id as a constant defines in Light.LIGHTTYPEID_x\n */\n getTypeID() {\n return Light.LIGHTTYPEID_HEMISPHERICLIGHT;\n }\n /**\n * Prepares the list of defines specific to the light type.\n * @param defines the list of defines\n * @param lightIndex defines the index of the light for the effect\n */\n prepareLightSpecificDefines(defines, lightIndex) {\n defines[\"HEMILIGHT\" + lightIndex] = true;\n }\n}\n__decorate([\n serializeAsColor3()\n], HemisphericLight.prototype, \"groundColor\", void 0);\n__decorate([\n serializeAsVector3()\n], HemisphericLight.prototype, \"direction\", void 0);\n//# sourceMappingURL=hemisphericLight.js.map","import { __decorate } from \"../tslib.es6.js\";\nimport { serialize, serializeAsVector3 } from \"../Misc/decorators.js\";\nimport { Matrix, Vector3 } from \"../Maths/math.vector.js\";\nimport { Light } from \"./light.js\";\nimport { Axis } from \"../Maths/math.axis.js\";\n/**\n * Base implementation IShadowLight\n * It groups all the common behaviour in order to reduce duplication and better follow the DRY pattern.\n */\nexport class ShadowLight extends Light {\n constructor() {\n super(...arguments);\n this._needProjectionMatrixCompute = true;\n }\n _setPosition(value) {\n this._position = value;\n }\n /**\n * Sets the position the shadow will be casted from. Also use as the light position for both\n * point and spot lights.\n */\n get position() {\n return this._position;\n }\n /**\n * Sets the position the shadow will be casted from. Also use as the light position for both\n * point and spot lights.\n */\n set position(value) {\n this._setPosition(value);\n }\n _setDirection(value) {\n this._direction = value;\n }\n /**\n * In 2d mode (needCube being false), gets the direction used to cast the shadow.\n * Also use as the light direction on spot and directional lights.\n */\n get direction() {\n return this._direction;\n }\n /**\n * In 2d mode (needCube being false), sets the direction used to cast the shadow.\n * Also use as the light direction on spot and directional lights.\n */\n set direction(value) {\n this._setDirection(value);\n }\n /**\n * Gets the shadow projection clipping minimum z value.\n */\n get shadowMinZ() {\n return this._shadowMinZ;\n }\n /**\n * Sets the shadow projection clipping minimum z value.\n */\n set shadowMinZ(value) {\n this._shadowMinZ = value;\n this.forceProjectionMatrixCompute();\n }\n /**\n * Sets the shadow projection clipping maximum z value.\n */\n get shadowMaxZ() {\n return this._shadowMaxZ;\n }\n /**\n * Gets the shadow projection clipping maximum z value.\n */\n set shadowMaxZ(value) {\n this._shadowMaxZ = value;\n this.forceProjectionMatrixCompute();\n }\n /**\n * Computes the transformed information (transformedPosition and transformedDirection in World space) of the current light\n * @returns true if the information has been computed, false if it does not need to (no parenting)\n */\n computeTransformedInformation() {\n if (this.parent && this.parent.getWorldMatrix) {\n if (!this.transformedPosition) {\n this.transformedPosition = Vector3.Zero();\n }\n Vector3.TransformCoordinatesToRef(this.position, this.parent.getWorldMatrix(), this.transformedPosition);\n // In case the direction is present.\n if (this.direction) {\n if (!this.transformedDirection) {\n this.transformedDirection = Vector3.Zero();\n }\n Vector3.TransformNormalToRef(this.direction, this.parent.getWorldMatrix(), this.transformedDirection);\n }\n return true;\n }\n return false;\n }\n /**\n * Return the depth scale used for the shadow map.\n * @returns the depth scale.\n */\n getDepthScale() {\n return 50.0;\n }\n /**\n * Get the direction to use to render the shadow map. In case of cube texture, the face index can be passed.\n * @param faceIndex The index of the face we are computed the direction to generate shadow\n * @returns The set direction in 2d mode otherwise the direction to the cubemap face if needCube() is true\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n getShadowDirection(faceIndex) {\n return this.transformedDirection ? this.transformedDirection : this.direction;\n }\n /**\n * Returns the ShadowLight absolute position in the World.\n * @returns the position vector in world space\n */\n getAbsolutePosition() {\n return this.transformedPosition ? this.transformedPosition : this.position;\n }\n /**\n * Sets the ShadowLight direction toward the passed target.\n * @param target The point to target in local space\n * @returns the updated ShadowLight direction\n */\n setDirectionToTarget(target) {\n this.direction = Vector3.Normalize(target.subtract(this.position));\n return this.direction;\n }\n /**\n * Returns the light rotation in euler definition.\n * @returns the x y z rotation in local space.\n */\n getRotation() {\n this.direction.normalize();\n const xaxis = Vector3.Cross(this.direction, Axis.Y);\n const yaxis = Vector3.Cross(xaxis, this.direction);\n return Vector3.RotationFromAxis(xaxis, yaxis, this.direction);\n }\n /**\n * Returns whether or not the shadow generation require a cube texture or a 2d texture.\n * @returns true if a cube texture needs to be use\n */\n needCube() {\n return false;\n }\n /**\n * Detects if the projection matrix requires to be recomputed this frame.\n * @returns true if it requires to be recomputed otherwise, false.\n */\n needProjectionMatrixCompute() {\n return this._needProjectionMatrixCompute;\n }\n /**\n * Forces the shadow generator to recompute the projection matrix even if position and direction did not changed.\n */\n forceProjectionMatrixCompute() {\n this._needProjectionMatrixCompute = true;\n }\n /** @internal */\n _initCache() {\n super._initCache();\n this._cache.position = Vector3.Zero();\n }\n /** @internal */\n _isSynchronized() {\n if (!this._cache.position.equals(this.position)) {\n return false;\n }\n return true;\n }\n /**\n * Computes the world matrix of the node\n * @param force defines if the cache version should be invalidated forcing the world matrix to be created from scratch\n * @returns the world matrix\n */\n computeWorldMatrix(force) {\n if (!force && this.isSynchronized()) {\n this._currentRenderId = this.getScene().getRenderId();\n return this._worldMatrix;\n }\n this._updateCache();\n this._cache.position.copyFrom(this.position);\n if (!this._worldMatrix) {\n this._worldMatrix = Matrix.Identity();\n }\n Matrix.TranslationToRef(this.position.x, this.position.y, this.position.z, this._worldMatrix);\n if (this.parent && this.parent.getWorldMatrix) {\n this._worldMatrix.multiplyToRef(this.parent.getWorldMatrix(), this._worldMatrix);\n this._markSyncedWithParent();\n }\n // Cache the determinant\n this._worldMatrixDeterminantIsDirty = true;\n return this._worldMatrix;\n }\n /**\n * Gets the minZ used for shadow according to both the scene and the light.\n * @param activeCamera The camera we are returning the min for\n * @returns the depth min z\n */\n getDepthMinZ(activeCamera) {\n return this.shadowMinZ !== undefined ? this.shadowMinZ : activeCamera.minZ;\n }\n /**\n * Gets the maxZ used for shadow according to both the scene and the light.\n * @param activeCamera The camera we are returning the max for\n * @returns the depth max z\n */\n getDepthMaxZ(activeCamera) {\n return this.shadowMaxZ !== undefined ? this.shadowMaxZ : activeCamera.maxZ;\n }\n /**\n * Sets the shadow projection matrix in parameter to the generated projection matrix.\n * @param matrix The matrix to updated with the projection information\n * @param viewMatrix The transform matrix of the light\n * @param renderList The list of mesh to render in the map\n * @returns The current light\n */\n setShadowProjectionMatrix(matrix, viewMatrix, renderList) {\n if (this.customProjectionMatrixBuilder) {\n this.customProjectionMatrixBuilder(viewMatrix, renderList, matrix);\n }\n else {\n this._setDefaultShadowProjectionMatrix(matrix, viewMatrix, renderList);\n }\n return this;\n }\n /** @internal */\n _syncParentEnabledState() {\n super._syncParentEnabledState();\n if (!this.parent || !this.parent.getWorldMatrix) {\n this.transformedPosition = null;\n this.transformedDirection = null;\n }\n }\n}\n__decorate([\n serializeAsVector3()\n], ShadowLight.prototype, \"position\", null);\n__decorate([\n serializeAsVector3()\n], ShadowLight.prototype, \"direction\", null);\n__decorate([\n serialize()\n], ShadowLight.prototype, \"shadowMinZ\", null);\n__decorate([\n serialize()\n], ShadowLight.prototype, \"shadowMaxZ\", null);\n//# sourceMappingURL=shadowLight.js.map","import { __decorate } from \"../tslib.es6.js\";\nimport { serialize } from \"../Misc/decorators.js\";\nimport { Matrix, Vector3 } from \"../Maths/math.vector.js\";\nimport { Node } from \"../node.js\";\nimport { Light } from \"./light.js\";\nimport { ShadowLight } from \"./shadowLight.js\";\nNode.AddNodeConstructor(\"Light_Type_1\", (name, scene) => {\n return () => new DirectionalLight(name, Vector3.Zero(), scene);\n});\n/**\n * A directional light is defined by a direction (what a surprise!).\n * The light is emitted from everywhere in the specified direction, and has an infinite range.\n * An example of a directional light is when a distance planet is lit by the apparently parallel lines of light from its sun. Light in a downward direction will light the top of an object.\n * Documentation: https://doc.babylonjs.com/features/featuresDeepDive/lights/lights_introduction\n */\nexport class DirectionalLight extends ShadowLight {\n /**\n * Fix frustum size for the shadow generation. This is disabled if the value is 0.\n */\n get shadowFrustumSize() {\n return this._shadowFrustumSize;\n }\n /**\n * Specifies a fix frustum size for the shadow generation.\n */\n set shadowFrustumSize(value) {\n this._shadowFrustumSize = value;\n this.forceProjectionMatrixCompute();\n }\n /**\n * Gets the shadow projection scale against the optimal computed one.\n * 0.1 by default which means that the projection window is increase by 10% from the optimal size.\n * This does not impact in fixed frustum size (shadowFrustumSize being set)\n */\n get shadowOrthoScale() {\n return this._shadowOrthoScale;\n }\n /**\n * Sets the shadow projection scale against the optimal computed one.\n * 0.1 by default which means that the projection window is increase by 10% from the optimal size.\n * This does not impact in fixed frustum size (shadowFrustumSize being set)\n */\n set shadowOrthoScale(value) {\n this._shadowOrthoScale = value;\n this.forceProjectionMatrixCompute();\n }\n /**\n * Gets or sets the orthoLeft property used to build the light frustum\n */\n get orthoLeft() {\n return this._orthoLeft;\n }\n set orthoLeft(left) {\n this._orthoLeft = left;\n }\n /**\n * Gets or sets the orthoRight property used to build the light frustum\n */\n get orthoRight() {\n return this._orthoRight;\n }\n set orthoRight(right) {\n this._orthoRight = right;\n }\n /**\n * Gets or sets the orthoTop property used to build the light frustum\n */\n get orthoTop() {\n return this._orthoTop;\n }\n set orthoTop(top) {\n this._orthoTop = top;\n }\n /**\n * Gets or sets the orthoBottom property used to build the light frustum\n */\n get orthoBottom() {\n return this._orthoBottom;\n }\n set orthoBottom(bottom) {\n this._orthoBottom = bottom;\n }\n /**\n * Creates a DirectionalLight object in the scene, oriented towards the passed direction (Vector3).\n * The directional light is emitted from everywhere in the given direction.\n * It can cast shadows.\n * Documentation : https://doc.babylonjs.com/features/featuresDeepDive/lights/lights_introduction\n * @param name The friendly name of the light\n * @param direction The direction of the light\n * @param scene The scene the light belongs to\n */\n constructor(name, direction, scene) {\n super(name, scene);\n this._shadowFrustumSize = 0;\n this._shadowOrthoScale = 0.1;\n /**\n * Automatically compute the projection matrix to best fit (including all the casters)\n * on each frame.\n */\n this.autoUpdateExtends = true;\n /**\n * Automatically compute the shadowMinZ and shadowMaxZ for the projection matrix to best fit (including all the casters)\n * on each frame. autoUpdateExtends must be set to true for this to work\n */\n this.autoCalcShadowZBounds = false;\n // Cache\n this._orthoLeft = Number.MAX_VALUE;\n this._orthoRight = Number.MIN_VALUE;\n this._orthoTop = Number.MIN_VALUE;\n this._orthoBottom = Number.MAX_VALUE;\n this.position = direction.scale(-1.0);\n this.direction = direction;\n }\n /**\n * Returns the string \"DirectionalLight\".\n * @returns The class name\n */\n getClassName() {\n return \"DirectionalLight\";\n }\n /**\n * Returns the integer 1.\n * @returns The light Type id as a constant defines in Light.LIGHTTYPEID_x\n */\n getTypeID() {\n return Light.LIGHTTYPEID_DIRECTIONALLIGHT;\n }\n /**\n * Sets the passed matrix \"matrix\" as projection matrix for the shadows cast by the light according to the passed view matrix.\n * Returns the DirectionalLight Shadow projection matrix.\n * @param matrix\n * @param viewMatrix\n * @param renderList\n */\n _setDefaultShadowProjectionMatrix(matrix, viewMatrix, renderList) {\n if (this.shadowFrustumSize > 0) {\n this._setDefaultFixedFrustumShadowProjectionMatrix(matrix);\n }\n else {\n this._setDefaultAutoExtendShadowProjectionMatrix(matrix, viewMatrix, renderList);\n }\n }\n /**\n * Sets the passed matrix \"matrix\" as fixed frustum projection matrix for the shadows cast by the light according to the passed view matrix.\n * Returns the DirectionalLight Shadow projection matrix.\n * @param matrix\n */\n _setDefaultFixedFrustumShadowProjectionMatrix(matrix) {\n const activeCamera = this.getScene().activeCamera;\n if (!activeCamera) {\n return;\n }\n Matrix.OrthoLHToRef(this.shadowFrustumSize, this.shadowFrustumSize, this.shadowMinZ !== undefined ? this.shadowMinZ : activeCamera.minZ, this.shadowMaxZ !== undefined ? this.shadowMaxZ : activeCamera.maxZ, matrix, this.getScene().getEngine().isNDCHalfZRange);\n }\n /**\n * Sets the passed matrix \"matrix\" as auto extend projection matrix for the shadows cast by the light according to the passed view matrix.\n * Returns the DirectionalLight Shadow projection matrix.\n * @param matrix\n * @param viewMatrix\n * @param renderList\n */\n _setDefaultAutoExtendShadowProjectionMatrix(matrix, viewMatrix, renderList) {\n const activeCamera = this.getScene().activeCamera;\n if (!activeCamera) {\n return;\n }\n // Check extends\n if (this.autoUpdateExtends || this._orthoLeft === Number.MAX_VALUE) {\n const tempVector3 = Vector3.Zero();\n this._orthoLeft = Number.MAX_VALUE;\n this._orthoRight = -Number.MAX_VALUE;\n this._orthoTop = -Number.MAX_VALUE;\n this._orthoBottom = Number.MAX_VALUE;\n let shadowMinZ = Number.MAX_VALUE;\n let shadowMaxZ = -Number.MAX_VALUE;\n for (let meshIndex = 0; meshIndex < renderList.length; meshIndex++) {\n const mesh = renderList[meshIndex];\n if (!mesh) {\n continue;\n }\n const boundingInfo = mesh.getBoundingInfo();\n const boundingBox = boundingInfo.boundingBox;\n for (let index = 0; index < boundingBox.vectorsWorld.length; index++) {\n Vector3.TransformCoordinatesToRef(boundingBox.vectorsWorld[index], viewMatrix, tempVector3);\n if (tempVector3.x < this._orthoLeft) {\n this._orthoLeft = tempVector3.x;\n }\n if (tempVector3.y < this._orthoBottom) {\n this._orthoBottom = tempVector3.y;\n }\n if (tempVector3.x > this._orthoRight) {\n this._orthoRight = tempVector3.x;\n }\n if (tempVector3.y > this._orthoTop) {\n this._orthoTop = tempVector3.y;\n }\n if (this.autoCalcShadowZBounds) {\n if (tempVector3.z < shadowMinZ) {\n shadowMinZ = tempVector3.z;\n }\n if (tempVector3.z > shadowMaxZ) {\n shadowMaxZ = tempVector3.z;\n }\n }\n }\n }\n if (this.autoCalcShadowZBounds) {\n this._shadowMinZ = shadowMinZ;\n this._shadowMaxZ = shadowMaxZ;\n }\n }\n const xOffset = this._orthoRight - this._orthoLeft;\n const yOffset = this._orthoTop - this._orthoBottom;\n const minZ = this.shadowMinZ !== undefined ? this.shadowMinZ : activeCamera.minZ;\n const maxZ = this.shadowMaxZ !== undefined ? this.shadowMaxZ : activeCamera.maxZ;\n const useReverseDepthBuffer = this.getScene().getEngine().useReverseDepthBuffer;\n Matrix.OrthoOffCenterLHToRef(this._orthoLeft - xOffset * this.shadowOrthoScale, this._orthoRight + xOffset * this.shadowOrthoScale, this._orthoBottom - yOffset * this.shadowOrthoScale, this._orthoTop + yOffset * this.shadowOrthoScale, useReverseDepthBuffer ? maxZ : minZ, useReverseDepthBuffer ? minZ : maxZ, matrix, this.getScene().getEngine().isNDCHalfZRange);\n }\n _buildUniformLayout() {\n this._uniformBuffer.addUniform(\"vLightData\", 4);\n this._uniformBuffer.addUniform(\"vLightDiffuse\", 4);\n this._uniformBuffer.addUniform(\"vLightSpecular\", 4);\n this._uniformBuffer.addUniform(\"shadowsInfo\", 3);\n this._uniformBuffer.addUniform(\"depthValues\", 2);\n this._uniformBuffer.create();\n }\n /**\n * Sets the passed Effect object with the DirectionalLight transformed position (or position if not parented) and the passed name.\n * @param effect The effect to update\n * @param lightIndex The index of the light in the effect to update\n * @returns The directional light\n */\n transferToEffect(effect, lightIndex) {\n if (this.computeTransformedInformation()) {\n this._uniformBuffer.updateFloat4(\"vLightData\", this.transformedDirection.x, this.transformedDirection.y, this.transformedDirection.z, 1, lightIndex);\n return this;\n }\n this._uniformBuffer.updateFloat4(\"vLightData\", this.direction.x, this.direction.y, this.direction.z, 1, lightIndex);\n return this;\n }\n transferToNodeMaterialEffect(effect, lightDataUniformName) {\n if (this.computeTransformedInformation()) {\n effect.setFloat3(lightDataUniformName, this.transformedDirection.x, this.transformedDirection.y, this.transformedDirection.z);\n return this;\n }\n effect.setFloat3(lightDataUniformName, this.direction.x, this.direction.y, this.direction.z);\n return this;\n }\n /**\n * Gets the minZ used for shadow according to both the scene and the light.\n *\n * Values are fixed on directional lights as it relies on an ortho projection hence the need to convert being\n * -1 and 1 to 0 and 1 doing (depth + min) / (min + max) -> (depth + 1) / (1 + 1) -> (depth * 0.5) + 0.5.\n * (when not using reverse depth buffer / NDC half Z range)\n * @param activeCamera The camera we are returning the min for\n * @returns the depth min z\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n getDepthMinZ(activeCamera) {\n const engine = this._scene.getEngine();\n return !engine.useReverseDepthBuffer && engine.isNDCHalfZRange ? 0 : 1;\n }\n /**\n * Gets the maxZ used for shadow according to both the scene and the light.\n *\n * Values are fixed on directional lights as it relies on an ortho projection hence the need to convert being\n * -1 and 1 to 0 and 1 doing (depth + min) / (min + max) -> (depth + 1) / (1 + 1) -> (depth * 0.5) + 0.5.\n * (when not using reverse depth buffer / NDC half Z range)\n * @param activeCamera The camera we are returning the max for\n * @returns the depth max z\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n getDepthMaxZ(activeCamera) {\n const engine = this._scene.getEngine();\n return engine.useReverseDepthBuffer && engine.isNDCHalfZRange ? 0 : 1;\n }\n /**\n * Prepares the list of defines specific to the light type.\n * @param defines the list of defines\n * @param lightIndex defines the index of the light for the effect\n */\n prepareLightSpecificDefines(defines, lightIndex) {\n defines[\"DIRLIGHT\" + lightIndex] = true;\n }\n}\n__decorate([\n serialize()\n], DirectionalLight.prototype, \"shadowFrustumSize\", null);\n__decorate([\n serialize()\n], DirectionalLight.prototype, \"shadowOrthoScale\", null);\n__decorate([\n serialize()\n], DirectionalLight.prototype, \"autoUpdateExtends\", void 0);\n__decorate([\n serialize()\n], DirectionalLight.prototype, \"autoCalcShadowZBounds\", void 0);\n__decorate([\n serialize(\"orthoLeft\")\n], DirectionalLight.prototype, \"_orthoLeft\", void 0);\n__decorate([\n serialize(\"orthoRight\")\n], DirectionalLight.prototype, \"_orthoRight\", void 0);\n__decorate([\n serialize(\"orthoTop\")\n], DirectionalLight.prototype, \"_orthoTop\", void 0);\n__decorate([\n serialize(\"orthoBottom\")\n], DirectionalLight.prototype, \"_orthoBottom\", void 0);\n//# sourceMappingURL=directionalLight.js.map","import { __decorate } from \"../tslib.es6.js\";\nimport { serialize } from \"../Misc/decorators.js\";\nimport { Matrix, Vector3 } from \"../Maths/math.vector.js\";\nimport { Node } from \"../node.js\";\nimport { Light } from \"./light.js\";\nimport { ShadowLight } from \"./shadowLight.js\";\nNode.AddNodeConstructor(\"Light_Type_0\", (name, scene) => {\n return () => new PointLight(name, Vector3.Zero(), scene);\n});\n/**\n * A point light is a light defined by an unique point in world space.\n * The light is emitted in every direction from this point.\n * A good example of a point light is a standard light bulb.\n * Documentation: https://doc.babylonjs.com/features/featuresDeepDive/lights/lights_introduction\n */\nexport class PointLight extends ShadowLight {\n /**\n * Getter: In case of direction provided, the shadow will not use a cube texture but simulate a spot shadow as a fallback\n * This specifies what angle the shadow will use to be created.\n *\n * It default to 90 degrees to work nicely with the cube texture generation for point lights shadow maps.\n */\n get shadowAngle() {\n return this._shadowAngle;\n }\n /**\n * Setter: In case of direction provided, the shadow will not use a cube texture but simulate a spot shadow as a fallback\n * This specifies what angle the shadow will use to be created.\n *\n * It default to 90 degrees to work nicely with the cube texture generation for point lights shadow maps.\n */\n set shadowAngle(value) {\n this._shadowAngle = value;\n this.forceProjectionMatrixCompute();\n }\n /**\n * Gets the direction if it has been set.\n * In case of direction provided, the shadow will not use a cube texture but simulate a spot shadow as a fallback\n */\n get direction() {\n return this._direction;\n }\n /**\n * In case of direction provided, the shadow will not use a cube texture but simulate a spot shadow as a fallback\n */\n set direction(value) {\n const previousNeedCube = this.needCube();\n this._direction = value;\n if (this.needCube() !== previousNeedCube && this._shadowGenerators) {\n const iterator = this._shadowGenerators.values();\n for (let key = iterator.next(); key.done !== true; key = iterator.next()) {\n const shadowGenerator = key.value;\n shadowGenerator.recreateShadowMap();\n }\n }\n }\n /**\n * Creates a PointLight object from the passed name and position (Vector3) and adds it in the scene.\n * A PointLight emits the light in every direction.\n * It can cast shadows.\n * If the scene camera is already defined and you want to set your PointLight at the camera position, just set it :\n * ```javascript\n * var pointLight = new PointLight(\"pl\", camera.position, scene);\n * ```\n * Documentation : https://doc.babylonjs.com/features/featuresDeepDive/lights/lights_introduction\n * @param name The light friendly name\n * @param position The position of the point light in the scene\n * @param scene The scene the lights belongs to\n */\n constructor(name, position, scene) {\n super(name, scene);\n this._shadowAngle = Math.PI / 2;\n this.position = position;\n }\n /**\n * Returns the string \"PointLight\"\n * @returns the class name\n */\n getClassName() {\n return \"PointLight\";\n }\n /**\n * Returns the integer 0.\n * @returns The light Type id as a constant defines in Light.LIGHTTYPEID_x\n */\n getTypeID() {\n return Light.LIGHTTYPEID_POINTLIGHT;\n }\n /**\n * Specifies whether or not the shadowmap should be a cube texture.\n * @returns true if the shadowmap needs to be a cube texture.\n */\n needCube() {\n return !this.direction;\n }\n /**\n * Returns a new Vector3 aligned with the PointLight cube system according to the passed cube face index (integer).\n * @param faceIndex The index of the face we are computed the direction to generate shadow\n * @returns The set direction in 2d mode otherwise the direction to the cubemap face if needCube() is true\n */\n getShadowDirection(faceIndex) {\n if (this.direction) {\n return super.getShadowDirection(faceIndex);\n }\n else {\n switch (faceIndex) {\n case 0:\n return new Vector3(1.0, 0.0, 0.0);\n case 1:\n return new Vector3(-1.0, 0.0, 0.0);\n case 2:\n return new Vector3(0.0, -1.0, 0.0);\n case 3:\n return new Vector3(0.0, 1.0, 0.0);\n case 4:\n return new Vector3(0.0, 0.0, 1.0);\n case 5:\n return new Vector3(0.0, 0.0, -1.0);\n }\n }\n return Vector3.Zero();\n }\n /**\n * Sets the passed matrix \"matrix\" as a left-handed perspective projection matrix with the following settings :\n * - fov = PI / 2\n * - aspect ratio : 1.0\n * - z-near and far equal to the active camera minZ and maxZ.\n * Returns the PointLight.\n * @param matrix\n * @param viewMatrix\n * @param renderList\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _setDefaultShadowProjectionMatrix(matrix, viewMatrix, renderList) {\n const activeCamera = this.getScene().activeCamera;\n if (!activeCamera) {\n return;\n }\n const minZ = this.shadowMinZ !== undefined ? this.shadowMinZ : activeCamera.minZ;\n const maxZ = this.shadowMaxZ !== undefined ? this.shadowMaxZ : activeCamera.maxZ;\n const useReverseDepthBuffer = this.getScene().getEngine().useReverseDepthBuffer;\n Matrix.PerspectiveFovLHToRef(this.shadowAngle, 1.0, useReverseDepthBuffer ? maxZ : minZ, useReverseDepthBuffer ? minZ : maxZ, matrix, true, this._scene.getEngine().isNDCHalfZRange, undefined, useReverseDepthBuffer);\n }\n _buildUniformLayout() {\n this._uniformBuffer.addUniform(\"vLightData\", 4);\n this._uniformBuffer.addUniform(\"vLightDiffuse\", 4);\n this._uniformBuffer.addUniform(\"vLightSpecular\", 4);\n this._uniformBuffer.addUniform(\"vLightFalloff\", 4);\n this._uniformBuffer.addUniform(\"shadowsInfo\", 3);\n this._uniformBuffer.addUniform(\"depthValues\", 2);\n this._uniformBuffer.create();\n }\n /**\n * Sets the passed Effect \"effect\" with the PointLight transformed position (or position, if none) and passed name (string).\n * @param effect The effect to update\n * @param lightIndex The index of the light in the effect to update\n * @returns The point light\n */\n transferToEffect(effect, lightIndex) {\n if (this.computeTransformedInformation()) {\n this._uniformBuffer.updateFloat4(\"vLightData\", this.transformedPosition.x, this.transformedPosition.y, this.transformedPosition.z, 0.0, lightIndex);\n }\n else {\n this._uniformBuffer.updateFloat4(\"vLightData\", this.position.x, this.position.y, this.position.z, 0, lightIndex);\n }\n this._uniformBuffer.updateFloat4(\"vLightFalloff\", this.range, this._inverseSquaredRange, 0, 0, lightIndex);\n return this;\n }\n transferToNodeMaterialEffect(effect, lightDataUniformName) {\n if (this.computeTransformedInformation()) {\n effect.setFloat3(lightDataUniformName, this.transformedPosition.x, this.transformedPosition.y, this.transformedPosition.z);\n }\n else {\n effect.setFloat3(lightDataUniformName, this.position.x, this.position.y, this.position.z);\n }\n return this;\n }\n /**\n * Prepares the list of defines specific to the light type.\n * @param defines the list of defines\n * @param lightIndex defines the index of the light for the effect\n */\n prepareLightSpecificDefines(defines, lightIndex) {\n defines[\"POINTLIGHT\" + lightIndex] = true;\n }\n}\n__decorate([\n serialize()\n], PointLight.prototype, \"shadowAngle\", null);\n//# sourceMappingURL=pointLight.js.map","import { __decorate } from \"../tslib.es6.js\";\nimport { serialize, serializeAsTexture } from \"../Misc/decorators.js\";\nimport { Matrix, Vector3 } from \"../Maths/math.vector.js\";\nimport { Node } from \"../node.js\";\nimport { Light } from \"./light.js\";\nimport { ShadowLight } from \"./shadowLight.js\";\nimport { Texture } from \"../Materials/Textures/texture.js\";\nNode.AddNodeConstructor(\"Light_Type_2\", (name, scene) => {\n return () => new SpotLight(name, Vector3.Zero(), Vector3.Zero(), 0, 0, scene);\n});\n/**\n * A spot light is defined by a position, a direction, an angle, and an exponent.\n * These values define a cone of light starting from the position, emitting toward the direction.\n * The angle, in radians, defines the size (field of illumination) of the spotlight's conical beam,\n * and the exponent defines the speed of the decay of the light with distance (reach).\n * Documentation: https://doc.babylonjs.com/features/featuresDeepDive/lights/lights_introduction\n */\nexport class SpotLight extends ShadowLight {\n /**\n * Gets the cone angle of the spot light in Radians.\n */\n get angle() {\n return this._angle;\n }\n /**\n * Sets the cone angle of the spot light in Radians.\n */\n set angle(value) {\n this._angle = value;\n this._cosHalfAngle = Math.cos(value * 0.5);\n this._projectionTextureProjectionLightDirty = true;\n this.forceProjectionMatrixCompute();\n this._computeAngleValues();\n }\n /**\n * Only used in gltf falloff mode, this defines the angle where\n * the directional falloff will start before cutting at angle which could be seen\n * as outer angle.\n */\n get innerAngle() {\n return this._innerAngle;\n }\n /**\n * Only used in gltf falloff mode, this defines the angle where\n * the directional falloff will start before cutting at angle which could be seen\n * as outer angle.\n */\n set innerAngle(value) {\n this._innerAngle = value;\n this._computeAngleValues();\n }\n /**\n * Allows scaling the angle of the light for shadow generation only.\n */\n get shadowAngleScale() {\n return this._shadowAngleScale;\n }\n /**\n * Allows scaling the angle of the light for shadow generation only.\n */\n set shadowAngleScale(value) {\n this._shadowAngleScale = value;\n this.forceProjectionMatrixCompute();\n }\n /**\n * Allows reading the projection texture\n */\n get projectionTextureMatrix() {\n return this._projectionTextureMatrix;\n }\n /**\n * Gets the near clip of the Spotlight for texture projection.\n */\n get projectionTextureLightNear() {\n return this._projectionTextureLightNear;\n }\n /**\n * Sets the near clip of the Spotlight for texture projection.\n */\n set projectionTextureLightNear(value) {\n this._projectionTextureLightNear = value;\n this._projectionTextureProjectionLightDirty = true;\n }\n /**\n * Gets the far clip of the Spotlight for texture projection.\n */\n get projectionTextureLightFar() {\n return this._projectionTextureLightFar;\n }\n /**\n * Sets the far clip of the Spotlight for texture projection.\n */\n set projectionTextureLightFar(value) {\n this._projectionTextureLightFar = value;\n this._projectionTextureProjectionLightDirty = true;\n }\n /**\n * Gets the Up vector of the Spotlight for texture projection.\n */\n get projectionTextureUpDirection() {\n return this._projectionTextureUpDirection;\n }\n /**\n * Sets the Up vector of the Spotlight for texture projection.\n */\n set projectionTextureUpDirection(value) {\n this._projectionTextureUpDirection = value;\n this._projectionTextureProjectionLightDirty = true;\n }\n /**\n * Gets the projection texture of the light.\n */\n get projectionTexture() {\n return this._projectionTexture;\n }\n /**\n * Sets the projection texture of the light.\n */\n set projectionTexture(value) {\n if (this._projectionTexture === value) {\n return;\n }\n this._projectionTexture = value;\n this._projectionTextureDirty = true;\n if (this._projectionTexture && !this._projectionTexture.isReady()) {\n if (SpotLight._IsProceduralTexture(this._projectionTexture)) {\n this._projectionTexture.getEffect().executeWhenCompiled(() => {\n this._markMeshesAsLightDirty();\n });\n }\n else if (SpotLight._IsTexture(this._projectionTexture)) {\n this._projectionTexture.onLoadObservable.addOnce(() => {\n this._markMeshesAsLightDirty();\n });\n }\n }\n }\n static _IsProceduralTexture(texture) {\n return texture.onGeneratedObservable !== undefined;\n }\n static _IsTexture(texture) {\n return texture.onLoadObservable !== undefined;\n }\n /**\n * Gets or sets the light projection matrix as used by the projection texture\n */\n get projectionTextureProjectionLightMatrix() {\n return this._projectionTextureProjectionLightMatrix;\n }\n set projectionTextureProjectionLightMatrix(projection) {\n this._projectionTextureProjectionLightMatrix = projection;\n this._projectionTextureProjectionLightDirty = false;\n this._projectionTextureDirty = true;\n }\n /**\n * Creates a SpotLight object in the scene. A spot light is a simply light oriented cone.\n * It can cast shadows.\n * Documentation : https://doc.babylonjs.com/features/featuresDeepDive/lights/lights_introduction\n * @param name The light friendly name\n * @param position The position of the spot light in the scene\n * @param direction The direction of the light in the scene\n * @param angle The cone angle of the light in Radians\n * @param exponent The light decay speed with the distance from the emission spot\n * @param scene The scene the lights belongs to\n */\n constructor(name, position, direction, angle, exponent, scene) {\n super(name, scene);\n this._innerAngle = 0;\n this._projectionTextureMatrix = Matrix.Zero();\n this._projectionTextureLightNear = 1e-6;\n this._projectionTextureLightFar = 1000.0;\n this._projectionTextureUpDirection = Vector3.Up();\n this._projectionTextureViewLightDirty = true;\n this._projectionTextureProjectionLightDirty = true;\n this._projectionTextureDirty = true;\n this._projectionTextureViewTargetVector = Vector3.Zero();\n this._projectionTextureViewLightMatrix = Matrix.Zero();\n this._projectionTextureProjectionLightMatrix = Matrix.Zero();\n this._projectionTextureScalingMatrix = Matrix.FromValues(0.5, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.5, 0.5, 0.5, 1.0);\n this.position = position;\n this.direction = direction;\n this.angle = angle;\n this.exponent = exponent;\n }\n /**\n * Returns the string \"SpotLight\".\n * @returns the class name\n */\n getClassName() {\n return \"SpotLight\";\n }\n /**\n * Returns the integer 2.\n * @returns The light Type id as a constant defines in Light.LIGHTTYPEID_x\n */\n getTypeID() {\n return Light.LIGHTTYPEID_SPOTLIGHT;\n }\n /**\n * Overrides the direction setter to recompute the projection texture view light Matrix.\n * @param value\n */\n _setDirection(value) {\n super._setDirection(value);\n this._projectionTextureViewLightDirty = true;\n }\n /**\n * Overrides the position setter to recompute the projection texture view light Matrix.\n * @param value\n */\n _setPosition(value) {\n super._setPosition(value);\n this._projectionTextureViewLightDirty = true;\n }\n /**\n * Sets the passed matrix \"matrix\" as perspective projection matrix for the shadows and the passed view matrix with the fov equal to the SpotLight angle and and aspect ratio of 1.0.\n * Returns the SpotLight.\n * @param matrix\n * @param viewMatrix\n * @param renderList\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _setDefaultShadowProjectionMatrix(matrix, viewMatrix, renderList) {\n const activeCamera = this.getScene().activeCamera;\n if (!activeCamera) {\n return;\n }\n this._shadowAngleScale = this._shadowAngleScale || 1;\n const angle = this._shadowAngleScale * this._angle;\n const minZ = this.shadowMinZ !== undefined ? this.shadowMinZ : activeCamera.minZ;\n const maxZ = this.shadowMaxZ !== undefined ? this.shadowMaxZ : activeCamera.maxZ;\n const useReverseDepthBuffer = this.getScene().getEngine().useReverseDepthBuffer;\n Matrix.PerspectiveFovLHToRef(angle, 1.0, useReverseDepthBuffer ? maxZ : minZ, useReverseDepthBuffer ? minZ : maxZ, matrix, true, this._scene.getEngine().isNDCHalfZRange, undefined, useReverseDepthBuffer);\n }\n _computeProjectionTextureViewLightMatrix() {\n this._projectionTextureViewLightDirty = false;\n this._projectionTextureDirty = true;\n this.getAbsolutePosition().addToRef(this.direction, this._projectionTextureViewTargetVector);\n Matrix.LookAtLHToRef(this.getAbsolutePosition(), this._projectionTextureViewTargetVector, this._projectionTextureUpDirection, this._projectionTextureViewLightMatrix);\n }\n _computeProjectionTextureProjectionLightMatrix() {\n this._projectionTextureProjectionLightDirty = false;\n this._projectionTextureDirty = true;\n const lightFar = this.projectionTextureLightFar;\n const lightNear = this.projectionTextureLightNear;\n const P = lightFar / (lightFar - lightNear);\n const Q = -P * lightNear;\n const S = 1.0 / Math.tan(this._angle / 2.0);\n const A = 1.0;\n Matrix.FromValuesToRef(S / A, 0.0, 0.0, 0.0, 0.0, S, 0.0, 0.0, 0.0, 0.0, P, 1.0, 0.0, 0.0, Q, 0.0, this._projectionTextureProjectionLightMatrix);\n }\n /**\n * Main function for light texture projection matrix computing.\n */\n _computeProjectionTextureMatrix() {\n this._projectionTextureDirty = false;\n this._projectionTextureViewLightMatrix.multiplyToRef(this._projectionTextureProjectionLightMatrix, this._projectionTextureMatrix);\n if (this._projectionTexture instanceof Texture) {\n const u = this._projectionTexture.uScale / 2.0;\n const v = this._projectionTexture.vScale / 2.0;\n Matrix.FromValuesToRef(u, 0.0, 0.0, 0.0, 0.0, v, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.5, 0.5, 0.5, 1.0, this._projectionTextureScalingMatrix);\n }\n this._projectionTextureMatrix.multiplyToRef(this._projectionTextureScalingMatrix, this._projectionTextureMatrix);\n }\n _buildUniformLayout() {\n this._uniformBuffer.addUniform(\"vLightData\", 4);\n this._uniformBuffer.addUniform(\"vLightDiffuse\", 4);\n this._uniformBuffer.addUniform(\"vLightSpecular\", 4);\n this._uniformBuffer.addUniform(\"vLightDirection\", 3);\n this._uniformBuffer.addUniform(\"vLightFalloff\", 4);\n this._uniformBuffer.addUniform(\"shadowsInfo\", 3);\n this._uniformBuffer.addUniform(\"depthValues\", 2);\n this._uniformBuffer.create();\n }\n _computeAngleValues() {\n this._lightAngleScale = 1.0 / Math.max(0.001, Math.cos(this._innerAngle * 0.5) - this._cosHalfAngle);\n this._lightAngleOffset = -this._cosHalfAngle * this._lightAngleScale;\n }\n /**\n * Sets the passed Effect \"effect\" with the Light textures.\n * @param effect The effect to update\n * @param lightIndex The index of the light in the effect to update\n * @returns The light\n */\n transferTexturesToEffect(effect, lightIndex) {\n if (this.projectionTexture && this.projectionTexture.isReady()) {\n if (this._projectionTextureViewLightDirty) {\n this._computeProjectionTextureViewLightMatrix();\n }\n if (this._projectionTextureProjectionLightDirty) {\n this._computeProjectionTextureProjectionLightMatrix();\n }\n if (this._projectionTextureDirty) {\n this._computeProjectionTextureMatrix();\n }\n effect.setMatrix(\"textureProjectionMatrix\" + lightIndex, this._projectionTextureMatrix);\n effect.setTexture(\"projectionLightSampler\" + lightIndex, this.projectionTexture);\n }\n return this;\n }\n /**\n * Sets the passed Effect object with the SpotLight transformed position (or position if not parented) and normalized direction.\n * @param effect The effect to update\n * @param lightIndex The index of the light in the effect to update\n * @returns The spot light\n */\n transferToEffect(effect, lightIndex) {\n let normalizeDirection;\n if (this.computeTransformedInformation()) {\n this._uniformBuffer.updateFloat4(\"vLightData\", this.transformedPosition.x, this.transformedPosition.y, this.transformedPosition.z, this.exponent, lightIndex);\n normalizeDirection = Vector3.Normalize(this.transformedDirection);\n }\n else {\n this._uniformBuffer.updateFloat4(\"vLightData\", this.position.x, this.position.y, this.position.z, this.exponent, lightIndex);\n normalizeDirection = Vector3.Normalize(this.direction);\n }\n this._uniformBuffer.updateFloat4(\"vLightDirection\", normalizeDirection.x, normalizeDirection.y, normalizeDirection.z, this._cosHalfAngle, lightIndex);\n this._uniformBuffer.updateFloat4(\"vLightFalloff\", this.range, this._inverseSquaredRange, this._lightAngleScale, this._lightAngleOffset, lightIndex);\n return this;\n }\n transferToNodeMaterialEffect(effect, lightDataUniformName) {\n let normalizeDirection;\n if (this.computeTransformedInformation()) {\n normalizeDirection = Vector3.Normalize(this.transformedDirection);\n }\n else {\n normalizeDirection = Vector3.Normalize(this.direction);\n }\n if (this.getScene().useRightHandedSystem) {\n effect.setFloat3(lightDataUniformName, -normalizeDirection.x, -normalizeDirection.y, -normalizeDirection.z);\n }\n else {\n effect.setFloat3(lightDataUniformName, normalizeDirection.x, normalizeDirection.y, normalizeDirection.z);\n }\n return this;\n }\n /**\n * Disposes the light and the associated resources.\n */\n dispose() {\n super.dispose();\n if (this._projectionTexture) {\n this._projectionTexture.dispose();\n }\n }\n /**\n * Gets the minZ used for shadow according to both the scene and the light.\n * @param activeCamera The camera we are returning the min for\n * @returns the depth min z\n */\n getDepthMinZ(activeCamera) {\n const engine = this._scene.getEngine();\n const minZ = this.shadowMinZ !== undefined ? this.shadowMinZ : activeCamera.minZ;\n return engine.useReverseDepthBuffer && engine.isNDCHalfZRange ? minZ : this._scene.getEngine().isNDCHalfZRange ? 0 : minZ;\n }\n /**\n * Gets the maxZ used for shadow according to both the scene and the light.\n * @param activeCamera The camera we are returning the max for\n * @returns the depth max z\n */\n getDepthMaxZ(activeCamera) {\n const engine = this._scene.getEngine();\n const maxZ = this.shadowMaxZ !== undefined ? this.shadowMaxZ : activeCamera.maxZ;\n return engine.useReverseDepthBuffer && engine.isNDCHalfZRange ? 0 : maxZ;\n }\n /**\n * Prepares the list of defines specific to the light type.\n * @param defines the list of defines\n * @param lightIndex defines the index of the light for the effect\n */\n prepareLightSpecificDefines(defines, lightIndex) {\n defines[\"SPOTLIGHT\" + lightIndex] = true;\n defines[\"PROJECTEDLIGHTTEXTURE\" + lightIndex] = this.projectionTexture && this.projectionTexture.isReady() ? true : false;\n }\n}\n__decorate([\n serialize()\n], SpotLight.prototype, \"angle\", null);\n__decorate([\n serialize()\n], SpotLight.prototype, \"innerAngle\", null);\n__decorate([\n serialize()\n], SpotLight.prototype, \"shadowAngleScale\", null);\n__decorate([\n serialize()\n], SpotLight.prototype, \"exponent\", void 0);\n__decorate([\n serialize()\n], SpotLight.prototype, \"projectionTextureLightNear\", null);\n__decorate([\n serialize()\n], SpotLight.prototype, \"projectionTextureLightFar\", null);\n__decorate([\n serialize()\n], SpotLight.prototype, \"projectionTextureUpDirection\", null);\n__decorate([\n serializeAsTexture(\"projectedLightTexture\")\n], SpotLight.prototype, \"_projectionTexture\", void 0);\n//# sourceMappingURL=spotLight.js.map","import { EParameterType, ETextureWrapMode, ETextureFilterType, EComponentType } from \"./glTFLoaderInterfaces.js\";\nimport { Vector2, Vector3, Vector4, Matrix } from \"@babylonjs/core/Maths/math.vector.js\";\nimport { Color4 } from \"@babylonjs/core/Maths/math.color.js\";\nimport { Effect } from \"@babylonjs/core/Materials/effect.js\";\nimport { ShaderMaterial } from \"@babylonjs/core/Materials/shaderMaterial.js\";\nimport { Texture } from \"@babylonjs/core/Materials/Textures/texture.js\";\n/**\n * Utils functions for GLTF\n * @internal\n * @deprecated\n */\nexport class GLTFUtils {\n /**\n * Sets the given \"parameter\" matrix\n * @param scene the Scene object\n * @param source the source node where to pick the matrix\n * @param parameter the GLTF technique parameter\n * @param uniformName the name of the shader's uniform\n * @param shaderMaterial the shader material\n */\n static SetMatrix(scene, source, parameter, uniformName, shaderMaterial) {\n let mat = null;\n if (parameter.semantic === \"MODEL\") {\n mat = source.getWorldMatrix();\n }\n else if (parameter.semantic === \"PROJECTION\") {\n mat = scene.getProjectionMatrix();\n }\n else if (parameter.semantic === \"VIEW\") {\n mat = scene.getViewMatrix();\n }\n else if (parameter.semantic === \"MODELVIEWINVERSETRANSPOSE\") {\n mat = Matrix.Transpose(source.getWorldMatrix().multiply(scene.getViewMatrix()).invert());\n }\n else if (parameter.semantic === \"MODELVIEW\") {\n mat = source.getWorldMatrix().multiply(scene.getViewMatrix());\n }\n else if (parameter.semantic === \"MODELVIEWPROJECTION\") {\n mat = source.getWorldMatrix().multiply(scene.getTransformMatrix());\n }\n else if (parameter.semantic === \"MODELINVERSE\") {\n mat = source.getWorldMatrix().invert();\n }\n else if (parameter.semantic === \"VIEWINVERSE\") {\n mat = scene.getViewMatrix().invert();\n }\n else if (parameter.semantic === \"PROJECTIONINVERSE\") {\n mat = scene.getProjectionMatrix().invert();\n }\n else if (parameter.semantic === \"MODELVIEWINVERSE\") {\n mat = source.getWorldMatrix().multiply(scene.getViewMatrix()).invert();\n }\n else if (parameter.semantic === \"MODELVIEWPROJECTIONINVERSE\") {\n mat = source.getWorldMatrix().multiply(scene.getTransformMatrix()).invert();\n }\n else if (parameter.semantic === \"MODELINVERSETRANSPOSE\") {\n mat = Matrix.Transpose(source.getWorldMatrix().invert());\n }\n if (mat) {\n switch (parameter.type) {\n case EParameterType.FLOAT_MAT2:\n shaderMaterial.setMatrix2x2(uniformName, Matrix.GetAsMatrix2x2(mat));\n break;\n case EParameterType.FLOAT_MAT3:\n shaderMaterial.setMatrix3x3(uniformName, Matrix.GetAsMatrix3x3(mat));\n break;\n case EParameterType.FLOAT_MAT4:\n shaderMaterial.setMatrix(uniformName, mat);\n break;\n default:\n break;\n }\n }\n }\n /**\n * Sets the given \"parameter\" matrix\n * @param shaderMaterial the shader material\n * @param uniform the name of the shader's uniform\n * @param value the value of the uniform\n * @param type the uniform's type (EParameterType FLOAT, VEC2, VEC3 or VEC4)\n */\n static SetUniform(shaderMaterial, uniform, value, type) {\n switch (type) {\n case EParameterType.FLOAT:\n shaderMaterial.setFloat(uniform, value);\n return true;\n case EParameterType.FLOAT_VEC2:\n shaderMaterial.setVector2(uniform, Vector2.FromArray(value));\n return true;\n case EParameterType.FLOAT_VEC3:\n shaderMaterial.setVector3(uniform, Vector3.FromArray(value));\n return true;\n case EParameterType.FLOAT_VEC4:\n shaderMaterial.setVector4(uniform, Vector4.FromArray(value));\n return true;\n default:\n return false;\n }\n }\n /**\n * Returns the wrap mode of the texture\n * @param mode the mode value\n */\n static GetWrapMode(mode) {\n switch (mode) {\n case ETextureWrapMode.CLAMP_TO_EDGE:\n return Texture.CLAMP_ADDRESSMODE;\n case ETextureWrapMode.MIRRORED_REPEAT:\n return Texture.MIRROR_ADDRESSMODE;\n case ETextureWrapMode.REPEAT:\n return Texture.WRAP_ADDRESSMODE;\n default:\n return Texture.WRAP_ADDRESSMODE;\n }\n }\n /**\n * Returns the byte stride giving an accessor\n * @param accessor the GLTF accessor objet\n */\n static GetByteStrideFromType(accessor) {\n // Needs this function since \"byteStride\" isn't requiered in glTF format\n const type = accessor.type;\n switch (type) {\n case \"VEC2\":\n return 2;\n case \"VEC3\":\n return 3;\n case \"VEC4\":\n return 4;\n case \"MAT2\":\n return 4;\n case \"MAT3\":\n return 9;\n case \"MAT4\":\n return 16;\n default:\n return 1;\n }\n }\n /**\n * Returns the texture filter mode giving a mode value\n * @param mode the filter mode value\n * @returns the filter mode (TODO - needs to be a type?)\n */\n static GetTextureFilterMode(mode) {\n switch (mode) {\n case ETextureFilterType.LINEAR:\n case ETextureFilterType.LINEAR_MIPMAP_NEAREST:\n case ETextureFilterType.LINEAR_MIPMAP_LINEAR:\n return Texture.TRILINEAR_SAMPLINGMODE;\n case ETextureFilterType.NEAREST:\n case ETextureFilterType.NEAREST_MIPMAP_NEAREST:\n return Texture.NEAREST_SAMPLINGMODE;\n default:\n return Texture.BILINEAR_SAMPLINGMODE;\n }\n }\n static GetBufferFromBufferView(gltfRuntime, bufferView, byteOffset, byteLength, componentType) {\n byteOffset = bufferView.byteOffset + byteOffset;\n const loadedBufferView = gltfRuntime.loadedBufferViews[bufferView.buffer];\n if (byteOffset + byteLength > loadedBufferView.byteLength) {\n throw new Error(\"Buffer access is out of range\");\n }\n const buffer = loadedBufferView.buffer;\n byteOffset += loadedBufferView.byteOffset;\n switch (componentType) {\n case EComponentType.BYTE:\n return new Int8Array(buffer, byteOffset, byteLength);\n case EComponentType.UNSIGNED_BYTE:\n return new Uint8Array(buffer, byteOffset, byteLength);\n case EComponentType.SHORT:\n return new Int16Array(buffer, byteOffset, byteLength);\n case EComponentType.UNSIGNED_SHORT:\n return new Uint16Array(buffer, byteOffset, byteLength);\n default:\n return new Float32Array(buffer, byteOffset, byteLength);\n }\n }\n /**\n * Returns a buffer from its accessor\n * @param gltfRuntime the GLTF runtime\n * @param accessor the GLTF accessor\n */\n static GetBufferFromAccessor(gltfRuntime, accessor) {\n const bufferView = gltfRuntime.bufferViews[accessor.bufferView];\n const byteLength = accessor.count * GLTFUtils.GetByteStrideFromType(accessor);\n return GLTFUtils.GetBufferFromBufferView(gltfRuntime, bufferView, accessor.byteOffset, byteLength, accessor.componentType);\n }\n /**\n * Decodes a buffer view into a string\n * @param view the buffer view\n */\n static DecodeBufferToText(view) {\n let result = \"\";\n const length = view.byteLength;\n for (let i = 0; i < length; ++i) {\n result += String.fromCharCode(view[i]);\n }\n return result;\n }\n /**\n * Returns the default material of gltf. Related to\n * https://github.com/KhronosGroup/glTF/tree/master/specification/1.0#appendix-a-default-material\n * @param scene the Babylon.js scene\n */\n static GetDefaultMaterial(scene) {\n if (!GLTFUtils._DefaultMaterial) {\n Effect.ShadersStore[\"GLTFDefaultMaterialVertexShader\"] = [\n \"precision highp float;\",\n \"\",\n \"uniform mat4 worldView;\",\n \"uniform mat4 projection;\",\n \"\",\n \"attribute vec3 position;\",\n \"\",\n \"void main(void)\",\n \"{\",\n \" gl_Position = projection * worldView * vec4(position, 1.0);\",\n \"}\",\n ].join(\"\\n\");\n Effect.ShadersStore[\"GLTFDefaultMaterialPixelShader\"] = [\n \"precision highp float;\",\n \"\",\n \"uniform vec4 u_emission;\",\n \"\",\n \"void main(void)\",\n \"{\",\n \" gl_FragColor = u_emission;\",\n \"}\",\n ].join(\"\\n\");\n const shaderPath = {\n vertex: \"GLTFDefaultMaterial\",\n fragment: \"GLTFDefaultMaterial\",\n };\n const options = {\n attributes: [\"position\"],\n uniforms: [\"worldView\", \"projection\", \"u_emission\"],\n samplers: new Array(),\n needAlphaBlending: false,\n };\n GLTFUtils._DefaultMaterial = new ShaderMaterial(\"GLTFDefaultMaterial\", scene, shaderPath, options);\n GLTFUtils._DefaultMaterial.setColor4(\"u_emission\", new Color4(0.5, 0.5, 0.5, 1.0));\n }\n return GLTFUtils._DefaultMaterial;\n }\n}\n// The GLTF default material\nGLTFUtils._DefaultMaterial = null;\n//# sourceMappingURL=glTFLoaderUtils.js.map","/* eslint-disable @typescript-eslint/naming-convention */\n/** Defines the cross module used constants to avoid circular dependencies */\nexport class Constants {\n}\n/** Defines that alpha blending is disabled */\nConstants.ALPHA_DISABLE = 0;\n/** Defines that alpha blending is SRC ALPHA * SRC + DEST */\nConstants.ALPHA_ADD = 1;\n/** Defines that alpha blending is SRC ALPHA * SRC + (1 - SRC ALPHA) * DEST */\nConstants.ALPHA_COMBINE = 2;\n/** Defines that alpha blending is DEST - SRC * DEST */\nConstants.ALPHA_SUBTRACT = 3;\n/** Defines that alpha blending is SRC * DEST */\nConstants.ALPHA_MULTIPLY = 4;\n/** Defines that alpha blending is SRC ALPHA * SRC + (1 - SRC) * DEST */\nConstants.ALPHA_MAXIMIZED = 5;\n/** Defines that alpha blending is SRC + DEST */\nConstants.ALPHA_ONEONE = 6;\n/** Defines that alpha blending is SRC + (1 - SRC ALPHA) * DEST */\nConstants.ALPHA_PREMULTIPLIED = 7;\n/**\n * Defines that alpha blending is SRC + (1 - SRC ALPHA) * DEST\n * Alpha will be set to (1 - SRC ALPHA) * DEST ALPHA\n */\nConstants.ALPHA_PREMULTIPLIED_PORTERDUFF = 8;\n/** Defines that alpha blending is CST * SRC + (1 - CST) * DEST */\nConstants.ALPHA_INTERPOLATE = 9;\n/**\n * Defines that alpha blending is SRC + (1 - SRC) * DEST\n * Alpha will be set to SRC ALPHA + (1 - SRC ALPHA) * DEST ALPHA\n */\nConstants.ALPHA_SCREENMODE = 10;\n/**\n * Defines that alpha blending is SRC + DST\n * Alpha will be set to SRC ALPHA + DST ALPHA\n */\nConstants.ALPHA_ONEONE_ONEONE = 11;\n/**\n * Defines that alpha blending is SRC * DST ALPHA + DST\n * Alpha will be set to 0\n */\nConstants.ALPHA_ALPHATOCOLOR = 12;\n/**\n * Defines that alpha blending is SRC * (1 - DST) + DST * (1 - SRC)\n */\nConstants.ALPHA_REVERSEONEMINUS = 13;\n/**\n * Defines that alpha blending is SRC + DST * (1 - SRC ALPHA)\n * Alpha will be set to SRC ALPHA + DST ALPHA * (1 - SRC ALPHA)\n */\nConstants.ALPHA_SRC_DSTONEMINUSSRCALPHA = 14;\n/**\n * Defines that alpha blending is SRC + DST\n * Alpha will be set to SRC ALPHA\n */\nConstants.ALPHA_ONEONE_ONEZERO = 15;\n/**\n * Defines that alpha blending is SRC * (1 - DST) + DST * (1 - SRC)\n * Alpha will be set to DST ALPHA\n */\nConstants.ALPHA_EXCLUSION = 16;\n/**\n * Defines that alpha blending is SRC * SRC ALPHA + DST * (1 - SRC ALPHA)\n * Alpha will be set to SRC ALPHA + (1 - SRC ALPHA) * DST ALPHA\n */\nConstants.ALPHA_LAYER_ACCUMULATE = 17;\n/** Defines that alpha blending equation a SUM */\nConstants.ALPHA_EQUATION_ADD = 0;\n/** Defines that alpha blending equation a SUBSTRACTION */\nConstants.ALPHA_EQUATION_SUBSTRACT = 1;\n/** Defines that alpha blending equation a REVERSE SUBSTRACTION */\nConstants.ALPHA_EQUATION_REVERSE_SUBTRACT = 2;\n/** Defines that alpha blending equation a MAX operation */\nConstants.ALPHA_EQUATION_MAX = 3;\n/** Defines that alpha blending equation a MIN operation */\nConstants.ALPHA_EQUATION_MIN = 4;\n/**\n * Defines that alpha blending equation a DARKEN operation:\n * It takes the min of the src and sums the alpha channels.\n */\nConstants.ALPHA_EQUATION_DARKEN = 5;\n/** Defines that the resource is not delayed*/\nConstants.DELAYLOADSTATE_NONE = 0;\n/** Defines that the resource was successfully delay loaded */\nConstants.DELAYLOADSTATE_LOADED = 1;\n/** Defines that the resource is currently delay loading */\nConstants.DELAYLOADSTATE_LOADING = 2;\n/** Defines that the resource is delayed and has not started loading */\nConstants.DELAYLOADSTATE_NOTLOADED = 4;\n// Depth or Stencil test Constants.\n/** Passed to depthFunction or stencilFunction to specify depth or stencil tests will never pass. i.e. Nothing will be drawn */\nConstants.NEVER = 0x0200;\n/** Passed to depthFunction or stencilFunction to specify depth or stencil tests will always pass. i.e. Pixels will be drawn in the order they are drawn */\nConstants.ALWAYS = 0x0207;\n/** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is less than the stored value */\nConstants.LESS = 0x0201;\n/** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is equals to the stored value */\nConstants.EQUAL = 0x0202;\n/** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is less than or equal to the stored value */\nConstants.LEQUAL = 0x0203;\n/** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is greater than the stored value */\nConstants.GREATER = 0x0204;\n/** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is greater than or equal to the stored value */\nConstants.GEQUAL = 0x0206;\n/** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is not equal to the stored value */\nConstants.NOTEQUAL = 0x0205;\n// Stencil Actions Constants.\n/** Passed to stencilOperation to specify that stencil value must be kept */\nConstants.KEEP = 0x1e00;\n/** Passed to stencilOperation to specify that stencil value must be zero */\nConstants.ZERO = 0x0000;\n/** Passed to stencilOperation to specify that stencil value must be replaced */\nConstants.REPLACE = 0x1e01;\n/** Passed to stencilOperation to specify that stencil value must be incremented */\nConstants.INCR = 0x1e02;\n/** Passed to stencilOperation to specify that stencil value must be decremented */\nConstants.DECR = 0x1e03;\n/** Passed to stencilOperation to specify that stencil value must be inverted */\nConstants.INVERT = 0x150a;\n/** Passed to stencilOperation to specify that stencil value must be incremented with wrapping */\nConstants.INCR_WRAP = 0x8507;\n/** Passed to stencilOperation to specify that stencil value must be decremented with wrapping */\nConstants.DECR_WRAP = 0x8508;\n/** Texture is not repeating outside of 0..1 UVs */\nConstants.TEXTURE_CLAMP_ADDRESSMODE = 0;\n/** Texture is repeating outside of 0..1 UVs */\nConstants.TEXTURE_WRAP_ADDRESSMODE = 1;\n/** Texture is repeating and mirrored */\nConstants.TEXTURE_MIRROR_ADDRESSMODE = 2;\n/** Flag to create a storage texture */\nConstants.TEXTURE_CREATIONFLAG_STORAGE = 1;\n/** ALPHA */\nConstants.TEXTUREFORMAT_ALPHA = 0;\n/** LUMINANCE */\nConstants.TEXTUREFORMAT_LUMINANCE = 1;\n/** LUMINANCE_ALPHA */\nConstants.TEXTUREFORMAT_LUMINANCE_ALPHA = 2;\n/** RGB */\nConstants.TEXTUREFORMAT_RGB = 4;\n/** RGBA */\nConstants.TEXTUREFORMAT_RGBA = 5;\n/** RED */\nConstants.TEXTUREFORMAT_RED = 6;\n/** RED (2nd reference) */\nConstants.TEXTUREFORMAT_R = 6;\n/** RG */\nConstants.TEXTUREFORMAT_RG = 7;\n/** RED_INTEGER */\nConstants.TEXTUREFORMAT_RED_INTEGER = 8;\n/** RED_INTEGER (2nd reference) */\nConstants.TEXTUREFORMAT_R_INTEGER = 8;\n/** RG_INTEGER */\nConstants.TEXTUREFORMAT_RG_INTEGER = 9;\n/** RGB_INTEGER */\nConstants.TEXTUREFORMAT_RGB_INTEGER = 10;\n/** RGBA_INTEGER */\nConstants.TEXTUREFORMAT_RGBA_INTEGER = 11;\n/** BGRA */\nConstants.TEXTUREFORMAT_BGRA = 12;\n/** Depth 24 bits + Stencil 8 bits */\nConstants.TEXTUREFORMAT_DEPTH24_STENCIL8 = 13;\n/** Depth 32 bits float */\nConstants.TEXTUREFORMAT_DEPTH32_FLOAT = 14;\n/** Depth 16 bits */\nConstants.TEXTUREFORMAT_DEPTH16 = 15;\n/** Depth 24 bits */\nConstants.TEXTUREFORMAT_DEPTH24 = 16;\n/** Depth 24 bits unorm + Stencil 8 bits */\nConstants.TEXTUREFORMAT_DEPTH24UNORM_STENCIL8 = 17;\n/** Depth 32 bits float + Stencil 8 bits */\nConstants.TEXTUREFORMAT_DEPTH32FLOAT_STENCIL8 = 18;\n/** Stencil 8 bits */\nConstants.TEXTUREFORMAT_STENCIL8 = 19;\n/** Compressed BC7 */\nConstants.TEXTUREFORMAT_COMPRESSED_RGBA_BPTC_UNORM = 36492;\n/** Compressed BC7 (SRGB) */\nConstants.TEXTUREFORMAT_COMPRESSED_SRGB_ALPHA_BPTC_UNORM = 36493;\n/** Compressed BC6 unsigned float */\nConstants.TEXTUREFORMAT_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT = 36495;\n/** Compressed BC6 signed float */\nConstants.TEXTUREFORMAT_COMPRESSED_RGB_BPTC_SIGNED_FLOAT = 36494;\n/** Compressed BC3 */\nConstants.TEXTUREFORMAT_COMPRESSED_RGBA_S3TC_DXT5 = 33779;\n/** Compressed BC3 (SRGB) */\nConstants.TEXTUREFORMAT_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT = 35919;\n/** Compressed BC2 */\nConstants.TEXTUREFORMAT_COMPRESSED_RGBA_S3TC_DXT3 = 33778;\n/** Compressed BC2 (SRGB) */\nConstants.TEXTUREFORMAT_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT = 35918;\n/** Compressed BC1 (RGBA) */\nConstants.TEXTUREFORMAT_COMPRESSED_RGBA_S3TC_DXT1 = 33777;\n/** Compressed BC1 (RGB) */\nConstants.TEXTUREFORMAT_COMPRESSED_RGB_S3TC_DXT1 = 33776;\n/** Compressed BC1 (SRGB+A) */\nConstants.TEXTUREFORMAT_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT = 35917;\n/** Compressed BC1 (SRGB) */\nConstants.TEXTUREFORMAT_COMPRESSED_SRGB_S3TC_DXT1_EXT = 35916;\n/** Compressed ASTC 4x4 */\nConstants.TEXTUREFORMAT_COMPRESSED_RGBA_ASTC_4x4 = 37808;\n/** Compressed ASTC 4x4 (SRGB) */\nConstants.TEXTUREFORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR = 37840;\n/** Compressed ETC1 (RGB) */\nConstants.TEXTUREFORMAT_COMPRESSED_RGB_ETC1_WEBGL = 36196;\n/** Compressed ETC2 (RGB) */\nConstants.TEXTUREFORMAT_COMPRESSED_RGB8_ETC2 = 37492;\n/** Compressed ETC2 (SRGB) */\nConstants.TEXTUREFORMAT_COMPRESSED_SRGB8_ETC2 = 37493;\n/** Compressed ETC2 (RGB+A1) */\nConstants.TEXTUREFORMAT_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 37494;\n/** Compressed ETC2 (SRGB+A1)*/\nConstants.TEXTUREFORMAT_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 37495;\n/** Compressed ETC2 (RGB+A) */\nConstants.TEXTUREFORMAT_COMPRESSED_RGBA8_ETC2_EAC = 37496;\n/** Compressed ETC2 (SRGB+1) */\nConstants.TEXTUREFORMAT_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC = 37497;\n/** UNSIGNED_BYTE */\nConstants.TEXTURETYPE_UNSIGNED_BYTE = 0;\n/** UNSIGNED_BYTE (2nd reference) */\nConstants.TEXTURETYPE_UNSIGNED_INT = 0;\n/** FLOAT */\nConstants.TEXTURETYPE_FLOAT = 1;\n/** HALF_FLOAT */\nConstants.TEXTURETYPE_HALF_FLOAT = 2;\n/** BYTE */\nConstants.TEXTURETYPE_BYTE = 3;\n/** SHORT */\nConstants.TEXTURETYPE_SHORT = 4;\n/** UNSIGNED_SHORT */\nConstants.TEXTURETYPE_UNSIGNED_SHORT = 5;\n/** INT */\nConstants.TEXTURETYPE_INT = 6;\n/** UNSIGNED_INT */\nConstants.TEXTURETYPE_UNSIGNED_INTEGER = 7;\n/** UNSIGNED_SHORT_4_4_4_4 */\nConstants.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4 = 8;\n/** UNSIGNED_SHORT_5_5_5_1 */\nConstants.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1 = 9;\n/** UNSIGNED_SHORT_5_6_5 */\nConstants.TEXTURETYPE_UNSIGNED_SHORT_5_6_5 = 10;\n/** UNSIGNED_INT_2_10_10_10_REV */\nConstants.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV = 11;\n/** UNSIGNED_INT_24_8 */\nConstants.TEXTURETYPE_UNSIGNED_INT_24_8 = 12;\n/** UNSIGNED_INT_10F_11F_11F_REV */\nConstants.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV = 13;\n/** UNSIGNED_INT_5_9_9_9_REV */\nConstants.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV = 14;\n/** FLOAT_32_UNSIGNED_INT_24_8_REV */\nConstants.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV = 15;\n/** UNDEFINED */\nConstants.TEXTURETYPE_UNDEFINED = 16;\n/** 2D Texture target*/\nConstants.TEXTURE_2D = 3553;\n/** 2D Array Texture target */\nConstants.TEXTURE_2D_ARRAY = 35866;\n/** Cube Map Texture target */\nConstants.TEXTURE_CUBE_MAP = 34067;\n/** Cube Map Array Texture target */\nConstants.TEXTURE_CUBE_MAP_ARRAY = 0xdeadbeef;\n/** 3D Texture target */\nConstants.TEXTURE_3D = 32879;\n/** nearest is mag = nearest and min = nearest and no mip */\nConstants.TEXTURE_NEAREST_SAMPLINGMODE = 1;\n/** mag = nearest and min = nearest and mip = none */\nConstants.TEXTURE_NEAREST_NEAREST = 1;\n/** Bilinear is mag = linear and min = linear and no mip */\nConstants.TEXTURE_BILINEAR_SAMPLINGMODE = 2;\n/** mag = linear and min = linear and mip = none */\nConstants.TEXTURE_LINEAR_LINEAR = 2;\n/** Trilinear is mag = linear and min = linear and mip = linear */\nConstants.TEXTURE_TRILINEAR_SAMPLINGMODE = 3;\n/** Trilinear is mag = linear and min = linear and mip = linear */\nConstants.TEXTURE_LINEAR_LINEAR_MIPLINEAR = 3;\n/** mag = nearest and min = nearest and mip = nearest */\nConstants.TEXTURE_NEAREST_NEAREST_MIPNEAREST = 4;\n/** mag = nearest and min = linear and mip = nearest */\nConstants.TEXTURE_NEAREST_LINEAR_MIPNEAREST = 5;\n/** mag = nearest and min = linear and mip = linear */\nConstants.TEXTURE_NEAREST_LINEAR_MIPLINEAR = 6;\n/** mag = nearest and min = linear and mip = none */\nConstants.TEXTURE_NEAREST_LINEAR = 7;\n/** nearest is mag = nearest and min = nearest and mip = linear */\nConstants.TEXTURE_NEAREST_NEAREST_MIPLINEAR = 8;\n/** mag = linear and min = nearest and mip = nearest */\nConstants.TEXTURE_LINEAR_NEAREST_MIPNEAREST = 9;\n/** mag = linear and min = nearest and mip = linear */\nConstants.TEXTURE_LINEAR_NEAREST_MIPLINEAR = 10;\n/** Bilinear is mag = linear and min = linear and mip = nearest */\nConstants.TEXTURE_LINEAR_LINEAR_MIPNEAREST = 11;\n/** mag = linear and min = nearest and mip = none */\nConstants.TEXTURE_LINEAR_NEAREST = 12;\n/** Explicit coordinates mode */\nConstants.TEXTURE_EXPLICIT_MODE = 0;\n/** Spherical coordinates mode */\nConstants.TEXTURE_SPHERICAL_MODE = 1;\n/** Planar coordinates mode */\nConstants.TEXTURE_PLANAR_MODE = 2;\n/** Cubic coordinates mode */\nConstants.TEXTURE_CUBIC_MODE = 3;\n/** Projection coordinates mode */\nConstants.TEXTURE_PROJECTION_MODE = 4;\n/** Skybox coordinates mode */\nConstants.TEXTURE_SKYBOX_MODE = 5;\n/** Inverse Cubic coordinates mode */\nConstants.TEXTURE_INVCUBIC_MODE = 6;\n/** Equirectangular coordinates mode */\nConstants.TEXTURE_EQUIRECTANGULAR_MODE = 7;\n/** Equirectangular Fixed coordinates mode */\nConstants.TEXTURE_FIXED_EQUIRECTANGULAR_MODE = 8;\n/** Equirectangular Fixed Mirrored coordinates mode */\nConstants.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE = 9;\n/** Offline (baking) quality for texture filtering */\nConstants.TEXTURE_FILTERING_QUALITY_OFFLINE = 4096;\n/** High quality for texture filtering */\nConstants.TEXTURE_FILTERING_QUALITY_HIGH = 64;\n/** Medium quality for texture filtering */\nConstants.TEXTURE_FILTERING_QUALITY_MEDIUM = 16;\n/** Low quality for texture filtering */\nConstants.TEXTURE_FILTERING_QUALITY_LOW = 8;\n// Texture rescaling mode\n/** Defines that texture rescaling will use a floor to find the closer power of 2 size */\nConstants.SCALEMODE_FLOOR = 1;\n/** Defines that texture rescaling will look for the nearest power of 2 size */\nConstants.SCALEMODE_NEAREST = 2;\n/** Defines that texture rescaling will use a ceil to find the closer power of 2 size */\nConstants.SCALEMODE_CEILING = 3;\n/**\n * The dirty texture flag value\n */\nConstants.MATERIAL_TextureDirtyFlag = 1;\n/**\n * The dirty light flag value\n */\nConstants.MATERIAL_LightDirtyFlag = 2;\n/**\n * The dirty fresnel flag value\n */\nConstants.MATERIAL_FresnelDirtyFlag = 4;\n/**\n * The dirty attribute flag value\n */\nConstants.MATERIAL_AttributesDirtyFlag = 8;\n/**\n * The dirty misc flag value\n */\nConstants.MATERIAL_MiscDirtyFlag = 16;\n/**\n * The dirty prepass flag value\n */\nConstants.MATERIAL_PrePassDirtyFlag = 32;\n/**\n * The all dirty flag value\n */\nConstants.MATERIAL_AllDirtyFlag = 63;\n/**\n * Returns the triangle fill mode\n */\nConstants.MATERIAL_TriangleFillMode = 0;\n/**\n * Returns the wireframe mode\n */\nConstants.MATERIAL_WireFrameFillMode = 1;\n/**\n * Returns the point fill mode\n */\nConstants.MATERIAL_PointFillMode = 2;\n/**\n * Returns the point list draw mode\n */\nConstants.MATERIAL_PointListDrawMode = 3;\n/**\n * Returns the line list draw mode\n */\nConstants.MATERIAL_LineListDrawMode = 4;\n/**\n * Returns the line loop draw mode\n */\nConstants.MATERIAL_LineLoopDrawMode = 5;\n/**\n * Returns the line strip draw mode\n */\nConstants.MATERIAL_LineStripDrawMode = 6;\n/**\n * Returns the triangle strip draw mode\n */\nConstants.MATERIAL_TriangleStripDrawMode = 7;\n/**\n * Returns the triangle fan draw mode\n */\nConstants.MATERIAL_TriangleFanDrawMode = 8;\n/**\n * Stores the clock-wise side orientation\n */\nConstants.MATERIAL_ClockWiseSideOrientation = 0;\n/**\n * Stores the counter clock-wise side orientation\n */\nConstants.MATERIAL_CounterClockWiseSideOrientation = 1;\n/**\n * Nothing\n * @see https://doc.babylonjs.com/features/featuresDeepDive/events/actions#triggers\n */\nConstants.ACTION_NothingTrigger = 0;\n/**\n * On pick\n * @see https://doc.babylonjs.com/features/featuresDeepDive/events/actions#triggers\n */\nConstants.ACTION_OnPickTrigger = 1;\n/**\n * On left pick\n * @see https://doc.babylonjs.com/features/featuresDeepDive/events/actions#triggers\n */\nConstants.ACTION_OnLeftPickTrigger = 2;\n/**\n * On right pick\n * @see https://doc.babylonjs.com/features/featuresDeepDive/events/actions#triggers\n */\nConstants.ACTION_OnRightPickTrigger = 3;\n/**\n * On center pick\n * @see https://doc.babylonjs.com/features/featuresDeepDive/events/actions#triggers\n */\nConstants.ACTION_OnCenterPickTrigger = 4;\n/**\n * On pick down\n * @see https://doc.babylonjs.com/features/featuresDeepDive/events/actions#triggers\n */\nConstants.ACTION_OnPickDownTrigger = 5;\n/**\n * On double pick\n * @see https://doc.babylonjs.com/features/featuresDeepDive/events/actions#triggers\n */\nConstants.ACTION_OnDoublePickTrigger = 6;\n/**\n * On pick up\n * @see https://doc.babylonjs.com/features/featuresDeepDive/events/actions#triggers\n */\nConstants.ACTION_OnPickUpTrigger = 7;\n/**\n * On pick out.\n * This trigger will only be raised if you also declared a OnPickDown\n * @see https://doc.babylonjs.com/features/featuresDeepDive/events/actions#triggers\n */\nConstants.ACTION_OnPickOutTrigger = 16;\n/**\n * On long press\n * @see https://doc.babylonjs.com/features/featuresDeepDive/events/actions#triggers\n */\nConstants.ACTION_OnLongPressTrigger = 8;\n/**\n * On pointer over\n * @see https://doc.babylonjs.com/features/featuresDeepDive/events/actions#triggers\n */\nConstants.ACTION_OnPointerOverTrigger = 9;\n/**\n * On pointer out\n * @see https://doc.babylonjs.com/features/featuresDeepDive/events/actions#triggers\n */\nConstants.ACTION_OnPointerOutTrigger = 10;\n/**\n * On every frame\n * @see https://doc.babylonjs.com/features/featuresDeepDive/events/actions#triggers\n */\nConstants.ACTION_OnEveryFrameTrigger = 11;\n/**\n * On intersection enter\n * @see https://doc.babylonjs.com/features/featuresDeepDive/events/actions#triggers\n */\nConstants.ACTION_OnIntersectionEnterTrigger = 12;\n/**\n * On intersection exit\n * @see https://doc.babylonjs.com/features/featuresDeepDive/events/actions#triggers\n */\nConstants.ACTION_OnIntersectionExitTrigger = 13;\n/**\n * On key down\n * @see https://doc.babylonjs.com/features/featuresDeepDive/events/actions#triggers\n */\nConstants.ACTION_OnKeyDownTrigger = 14;\n/**\n * On key up\n * @see https://doc.babylonjs.com/features/featuresDeepDive/events/actions#triggers\n */\nConstants.ACTION_OnKeyUpTrigger = 15;\n/**\n * Billboard mode will only apply to Y axis\n */\nConstants.PARTICLES_BILLBOARDMODE_Y = 2;\n/**\n * Billboard mode will apply to all axes\n */\nConstants.PARTICLES_BILLBOARDMODE_ALL = 7;\n/**\n * Special billboard mode where the particle will be biilboard to the camera but rotated to align with direction\n */\nConstants.PARTICLES_BILLBOARDMODE_STRETCHED = 8;\n/**\n * Special billboard mode where the particle will be billboard to the camera but only around the axis of the direction of particle emission\n */\nConstants.PARTICLES_BILLBOARDMODE_STRETCHED_LOCAL = 9;\n/** Default culling strategy : this is an exclusion test and it's the more accurate.\n * Test order :\n * Is the bounding sphere outside the frustum ?\n * If not, are the bounding box vertices outside the frustum ?\n * It not, then the cullable object is in the frustum.\n */\nConstants.MESHES_CULLINGSTRATEGY_STANDARD = 0;\n/** Culling strategy : Bounding Sphere Only.\n * This is an exclusion test. It's faster than the standard strategy because the bounding box is not tested.\n * It's also less accurate than the standard because some not visible objects can still be selected.\n * Test : is the bounding sphere outside the frustum ?\n * If not, then the cullable object is in the frustum.\n */\nConstants.MESHES_CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY = 1;\n/** Culling strategy : Optimistic Inclusion.\n * This in an inclusion test first, then the standard exclusion test.\n * This can be faster when a cullable object is expected to be almost always in the camera frustum.\n * This could also be a little slower than the standard test when the tested object center is not the frustum but one of its bounding box vertex is still inside.\n * Anyway, it's as accurate as the standard strategy.\n * Test :\n * Is the cullable object bounding sphere center in the frustum ?\n * If not, apply the default culling strategy.\n */\nConstants.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION = 2;\n/** Culling strategy : Optimistic Inclusion then Bounding Sphere Only.\n * This in an inclusion test first, then the bounding sphere only exclusion test.\n * This can be the fastest test when a cullable object is expected to be almost always in the camera frustum.\n * This could also be a little slower than the BoundingSphereOnly strategy when the tested object center is not in the frustum but its bounding sphere still intersects it.\n * It's less accurate than the standard strategy and as accurate as the BoundingSphereOnly strategy.\n * Test :\n * Is the cullable object bounding sphere center in the frustum ?\n * If not, apply the Bounding Sphere Only strategy. No Bounding Box is tested here.\n */\nConstants.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY = 3;\n/**\n * No logging while loading\n */\nConstants.SCENELOADER_NO_LOGGING = 0;\n/**\n * Minimal logging while loading\n */\nConstants.SCENELOADER_MINIMAL_LOGGING = 1;\n/**\n * Summary logging while loading\n */\nConstants.SCENELOADER_SUMMARY_LOGGING = 2;\n/**\n * Detailed logging while loading\n */\nConstants.SCENELOADER_DETAILED_LOGGING = 3;\n/**\n * Constant used to retrieve the irradiance texture index in the textures array in the prepass\n * using getIndex(Constants.PREPASS_IRRADIANCE_TEXTURE_TYPE)\n */\nConstants.PREPASS_IRRADIANCE_TEXTURE_TYPE = 0;\n/**\n * Constant used to retrieve the position texture index in the textures array in the prepass\n * using getIndex(Constants.PREPASS_POSITION_TEXTURE_INDEX)\n */\nConstants.PREPASS_POSITION_TEXTURE_TYPE = 1;\n/**\n * Constant used to retrieve the velocity texture index in the textures array in the prepass\n * using getIndex(Constants.PREPASS_VELOCITY_TEXTURE_INDEX)\n */\nConstants.PREPASS_VELOCITY_TEXTURE_TYPE = 2;\n/**\n * Constant used to retrieve the reflectivity texture index in the textures array in the prepass\n * using the getIndex(Constants.PREPASS_REFLECTIVITY_TEXTURE_TYPE)\n */\nConstants.PREPASS_REFLECTIVITY_TEXTURE_TYPE = 3;\n/**\n * Constant used to retrieve the lit color texture index in the textures array in the prepass\n * using the getIndex(Constants.PREPASS_COLOR_TEXTURE_TYPE)\n */\nConstants.PREPASS_COLOR_TEXTURE_TYPE = 4;\n/**\n * Constant used to retrieve depth index in the textures array in the prepass\n * using the getIndex(Constants.PREPASS_DEPTH_TEXTURE_TYPE)\n */\nConstants.PREPASS_DEPTH_TEXTURE_TYPE = 5;\n/**\n * Constant used to retrieve normal index in the textures array in the prepass\n * using the getIndex(Constants.PREPASS_NORMAL_TEXTURE_TYPE)\n */\nConstants.PREPASS_NORMAL_TEXTURE_TYPE = 6;\n/**\n * Constant used to retrieve albedo index in the textures array in the prepass\n * using the getIndex(Constants.PREPASS_ALBEDO_SQRT_TEXTURE_TYPE)\n */\nConstants.PREPASS_ALBEDO_SQRT_TEXTURE_TYPE = 7;\n/** Flag to create a readable buffer (the buffer can be the source of a copy) */\nConstants.BUFFER_CREATIONFLAG_READ = 1;\n/** Flag to create a writable buffer (the buffer can be the destination of a copy) */\nConstants.BUFFER_CREATIONFLAG_WRITE = 2;\n/** Flag to create a readable and writable buffer */\nConstants.BUFFER_CREATIONFLAG_READWRITE = 3;\n/** Flag to create a buffer suitable to be used as a uniform buffer */\nConstants.BUFFER_CREATIONFLAG_UNIFORM = 4;\n/** Flag to create a buffer suitable to be used as a vertex buffer */\nConstants.BUFFER_CREATIONFLAG_VERTEX = 8;\n/** Flag to create a buffer suitable to be used as an index buffer */\nConstants.BUFFER_CREATIONFLAG_INDEX = 16;\n/** Flag to create a buffer suitable to be used as a storage buffer */\nConstants.BUFFER_CREATIONFLAG_STORAGE = 32;\n/**\n * Prefixes used by the engine for sub mesh draw wrappers\n */\n/** @internal */\nConstants.RENDERPASS_MAIN = 0;\n/**\n * Constant used as key code for Alt key\n */\nConstants.INPUT_ALT_KEY = 18;\n/**\n * Constant used as key code for Ctrl key\n */\nConstants.INPUT_CTRL_KEY = 17;\n/**\n * Constant used as key code for Meta key (Left Win, Left Cmd)\n */\nConstants.INPUT_META_KEY1 = 91;\n/**\n * Constant used as key code for Meta key (Right Win)\n */\nConstants.INPUT_META_KEY2 = 92;\n/**\n * Constant used as key code for Meta key (Right Win, Right Cmd)\n */\nConstants.INPUT_META_KEY3 = 93;\n/**\n * Constant used as key code for Shift key\n */\nConstants.INPUT_SHIFT_KEY = 16;\n/** Standard snapshot rendering. In this mode, some form of dynamic behavior is possible (for eg, uniform buffers are still updated) */\nConstants.SNAPSHOTRENDERING_STANDARD = 0;\n/** Fast snapshot rendering. In this mode, everything is static and only some limited form of dynamic behaviour is possible */\nConstants.SNAPSHOTRENDERING_FAST = 1;\n/**\n * This is the default projection mode used by the cameras.\n * It helps recreating a feeling of perspective and better appreciate depth.\n * This is the best way to simulate real life cameras.\n */\nConstants.PERSPECTIVE_CAMERA = 0;\n/**\n * This helps creating camera with an orthographic mode.\n * Orthographic is commonly used in engineering as a means to produce object specifications that communicate dimensions unambiguously, each line of 1 unit length (cm, meter..whatever) will appear to have the same length everywhere on the drawing. This allows the drafter to dimension only a subset of lines and let the reader know that other lines of that length on the drawing are also that length in reality. Every parallel line in the drawing is also parallel in the object.\n */\nConstants.ORTHOGRAPHIC_CAMERA = 1;\n/**\n * This is the default FOV mode for perspective cameras.\n * This setting aligns the upper and lower bounds of the viewport to the upper and lower bounds of the camera frustum.\n */\nConstants.FOVMODE_VERTICAL_FIXED = 0;\n/**\n * This setting aligns the left and right bounds of the viewport to the left and right bounds of the camera frustum.\n */\nConstants.FOVMODE_HORIZONTAL_FIXED = 1;\n/**\n * This specifies there is no need for a camera rig.\n * Basically only one eye is rendered corresponding to the camera.\n */\nConstants.RIG_MODE_NONE = 0;\n/**\n * Simulates a camera Rig with one blue eye and one red eye.\n * This can be use with 3d blue and red glasses.\n */\nConstants.RIG_MODE_STEREOSCOPIC_ANAGLYPH = 10;\n/**\n * Defines that both eyes of the camera will be rendered side by side with a parallel target.\n */\nConstants.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL = 11;\n/**\n * Defines that both eyes of the camera will be rendered side by side with a none parallel target.\n */\nConstants.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED = 12;\n/**\n * Defines that both eyes of the camera will be rendered over under each other.\n */\nConstants.RIG_MODE_STEREOSCOPIC_OVERUNDER = 13;\n/**\n * Defines that both eyes of the camera will be rendered on successive lines interlaced for passive 3d monitors.\n */\nConstants.RIG_MODE_STEREOSCOPIC_INTERLACED = 14;\n/**\n * Defines that both eyes of the camera should be renderered in a VR mode (carbox).\n */\nConstants.RIG_MODE_VR = 20;\n/**\n * Defines that both eyes of the camera should be renderered in a VR mode (webVR).\n */\nConstants.RIG_MODE_WEBVR = 21;\n/**\n * Custom rig mode allowing rig cameras to be populated manually with any number of cameras\n */\nConstants.RIG_MODE_CUSTOM = 22;\n/**\n * Maximum number of uv sets supported\n */\nConstants.MAX_SUPPORTED_UV_SETS = 6;\n/**\n * GL constants\n */\n/** Alpha blend equation: ADD */\nConstants.GL_ALPHA_EQUATION_ADD = 0x8006;\n/** Alpha equation: MIN */\nConstants.GL_ALPHA_EQUATION_MIN = 0x8007;\n/** Alpha equation: MAX */\nConstants.GL_ALPHA_EQUATION_MAX = 0x8008;\n/** Alpha equation: SUBTRACT */\nConstants.GL_ALPHA_EQUATION_SUBTRACT = 0x800a;\n/** Alpha equation: REVERSE_SUBTRACT */\nConstants.GL_ALPHA_EQUATION_REVERSE_SUBTRACT = 0x800b;\n/** Alpha blend function: SRC */\nConstants.GL_ALPHA_FUNCTION_SRC = 0x0300;\n/** Alpha blend function: ONE_MINUS_SRC */\nConstants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_COLOR = 0x0301;\n/** Alpha blend function: SRC_ALPHA */\nConstants.GL_ALPHA_FUNCTION_SRC_ALPHA = 0x0302;\n/** Alpha blend function: ONE_MINUS_SRC_ALPHA */\nConstants.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_ALPHA = 0x0303;\n/** Alpha blend function: DST_ALPHA */\nConstants.GL_ALPHA_FUNCTION_DST_ALPHA = 0x0304;\n/** Alpha blend function: ONE_MINUS_DST_ALPHA */\nConstants.GL_ALPHA_FUNCTION_ONE_MINUS_DST_ALPHA = 0x0305;\n/** Alpha blend function: ONE_MINUS_DST */\nConstants.GL_ALPHA_FUNCTION_DST_COLOR = 0x0306;\n/** Alpha blend function: ONE_MINUS_DST */\nConstants.GL_ALPHA_FUNCTION_ONE_MINUS_DST_COLOR = 0x0307;\n/** Alpha blend function: SRC_ALPHA_SATURATED */\nConstants.GL_ALPHA_FUNCTION_SRC_ALPHA_SATURATED = 0x0308;\n/** Alpha blend function: CONSTANT */\nConstants.GL_ALPHA_FUNCTION_CONSTANT_COLOR = 0x8001;\n/** Alpha blend function: ONE_MINUS_CONSTANT */\nConstants.GL_ALPHA_FUNCTION_ONE_MINUS_CONSTANT_COLOR = 0x8002;\n/** Alpha blend function: CONSTANT_ALPHA */\nConstants.GL_ALPHA_FUNCTION_CONSTANT_ALPHA = 0x8003;\n/** Alpha blend function: ONE_MINUS_CONSTANT_ALPHA */\nConstants.GL_ALPHA_FUNCTION_ONE_MINUS_CONSTANT_ALPHA = 0x8004;\n/** URL to the snippet server. Points to the public snippet server by default */\nConstants.SnippetUrl = \"https://snippet.babylonjs.com\";\n//# sourceMappingURL=constants.js.map","import { EParameterType, ETextureFilterType, ECullingType, EBlendingFunction, EShaderType } from \"./glTFLoaderInterfaces.js\";\nimport { Quaternion, Vector3, Matrix } from \"@babylonjs/core/Maths/math.vector.js\";\nimport { Color3 } from \"@babylonjs/core/Maths/math.color.js\";\nimport { Tools } from \"@babylonjs/core/Misc/tools.js\";\nimport { Camera } from \"@babylonjs/core/Cameras/camera.js\";\nimport { FreeCamera } from \"@babylonjs/core/Cameras/freeCamera.js\";\nimport { Animation } from \"@babylonjs/core/Animations/animation.js\";\nimport { Bone } from \"@babylonjs/core/Bones/bone.js\";\nimport { Skeleton } from \"@babylonjs/core/Bones/skeleton.js\";\nimport { Effect } from \"@babylonjs/core/Materials/effect.js\";\nimport { Material } from \"@babylonjs/core/Materials/material.js\";\nimport { MultiMaterial } from \"@babylonjs/core/Materials/multiMaterial.js\";\nimport { StandardMaterial } from \"@babylonjs/core/Materials/standardMaterial.js\";\nimport { ShaderMaterial } from \"@babylonjs/core/Materials/shaderMaterial.js\";\nimport { Texture } from \"@babylonjs/core/Materials/Textures/texture.js\";\nimport { VertexData } from \"@babylonjs/core/Meshes/mesh.vertexData.js\";\nimport { VertexBuffer } from \"@babylonjs/core/Buffers/buffer.js\";\nimport { Geometry } from \"@babylonjs/core/Meshes/geometry.js\";\nimport { SubMesh } from \"@babylonjs/core/Meshes/subMesh.js\";\nimport { AbstractMesh } from \"@babylonjs/core/Meshes/abstractMesh.js\";\nimport { Mesh } from \"@babylonjs/core/Meshes/mesh.js\";\nimport { HemisphericLight } from \"@babylonjs/core/Lights/hemisphericLight.js\";\nimport { DirectionalLight } from \"@babylonjs/core/Lights/directionalLight.js\";\nimport { PointLight } from \"@babylonjs/core/Lights/pointLight.js\";\nimport { SpotLight } from \"@babylonjs/core/Lights/spotLight.js\";\nimport { GLTFUtils } from \"./glTFLoaderUtils.js\";\nimport { GLTFFileLoader } from \"../glTFFileLoader.js\";\nimport { Constants } from \"@babylonjs/core/Engines/constants.js\";\n/**\n * Tokenizer. Used for shaders compatibility\n * Automatically map world, view, projection, worldViewProjection, attributes and so on\n */\nvar ETokenType;\n(function (ETokenType) {\n ETokenType[ETokenType[\"IDENTIFIER\"] = 1] = \"IDENTIFIER\";\n ETokenType[ETokenType[\"UNKNOWN\"] = 2] = \"UNKNOWN\";\n ETokenType[ETokenType[\"END_OF_INPUT\"] = 3] = \"END_OF_INPUT\";\n})(ETokenType || (ETokenType = {}));\nclass Tokenizer {\n constructor(toParse) {\n this._pos = 0;\n this.currentToken = ETokenType.UNKNOWN;\n this.currentIdentifier = \"\";\n this.currentString = \"\";\n this.isLetterOrDigitPattern = /^[a-zA-Z0-9]+$/;\n this._toParse = toParse;\n this._maxPos = toParse.length;\n }\n getNextToken() {\n if (this.isEnd()) {\n return ETokenType.END_OF_INPUT;\n }\n this.currentString = this.read();\n this.currentToken = ETokenType.UNKNOWN;\n if (this.currentString === \"_\" || this.isLetterOrDigitPattern.test(this.currentString)) {\n this.currentToken = ETokenType.IDENTIFIER;\n this.currentIdentifier = this.currentString;\n while (!this.isEnd() && (this.isLetterOrDigitPattern.test((this.currentString = this.peek())) || this.currentString === \"_\")) {\n this.currentIdentifier += this.currentString;\n this.forward();\n }\n }\n return this.currentToken;\n }\n peek() {\n return this._toParse[this._pos];\n }\n read() {\n return this._toParse[this._pos++];\n }\n forward() {\n this._pos++;\n }\n isEnd() {\n return this._pos >= this._maxPos;\n }\n}\n/**\n * Values\n */\nconst glTFTransforms = [\"MODEL\", \"VIEW\", \"PROJECTION\", \"MODELVIEW\", \"MODELVIEWPROJECTION\", \"JOINTMATRIX\"];\nconst babylonTransforms = [\"world\", \"view\", \"projection\", \"worldView\", \"worldViewProjection\", \"mBones\"];\nconst glTFAnimationPaths = [\"translation\", \"rotation\", \"scale\"];\nconst babylonAnimationPaths = [\"position\", \"rotationQuaternion\", \"scaling\"];\n/**\n * Parse\n * @param parsedBuffers\n * @param gltfRuntime\n */\nconst parseBuffers = (parsedBuffers, gltfRuntime) => {\n for (const buf in parsedBuffers) {\n const parsedBuffer = parsedBuffers[buf];\n gltfRuntime.buffers[buf] = parsedBuffer;\n gltfRuntime.buffersCount++;\n }\n};\nconst parseShaders = (parsedShaders, gltfRuntime) => {\n for (const sha in parsedShaders) {\n const parsedShader = parsedShaders[sha];\n gltfRuntime.shaders[sha] = parsedShader;\n gltfRuntime.shaderscount++;\n }\n};\nconst parseObject = (parsedObjects, runtimeProperty, gltfRuntime) => {\n for (const object in parsedObjects) {\n const parsedObject = parsedObjects[object];\n gltfRuntime[runtimeProperty][object] = parsedObject;\n }\n};\n/**\n * Utils\n * @param buffer\n */\nconst normalizeUVs = (buffer) => {\n if (!buffer) {\n return;\n }\n for (let i = 0; i < buffer.length / 2; i++) {\n buffer[i * 2 + 1] = 1.0 - buffer[i * 2 + 1];\n }\n};\nconst getAttribute = (attributeParameter) => {\n if (attributeParameter.semantic === \"NORMAL\") {\n return \"normal\";\n }\n else if (attributeParameter.semantic === \"POSITION\") {\n return \"position\";\n }\n else if (attributeParameter.semantic === \"JOINT\") {\n return \"matricesIndices\";\n }\n else if (attributeParameter.semantic === \"WEIGHT\") {\n return \"matricesWeights\";\n }\n else if (attributeParameter.semantic === \"COLOR\") {\n return \"color\";\n }\n else if (attributeParameter.semantic && attributeParameter.semantic.indexOf(\"TEXCOORD_\") !== -1) {\n const channel = Number(attributeParameter.semantic.split(\"_\")[1]);\n return \"uv\" + (channel === 0 ? \"\" : channel + 1);\n }\n return null;\n};\n/**\n * Loads and creates animations\n * @param gltfRuntime\n */\nconst loadAnimations = (gltfRuntime) => {\n for (const anim in gltfRuntime.animations) {\n const animation = gltfRuntime.animations[anim];\n if (!animation.channels || !animation.samplers) {\n continue;\n }\n let lastAnimation = null;\n for (let i = 0; i < animation.channels.length; i++) {\n // Get parameters and load buffers\n const channel = animation.channels[i];\n const sampler = animation.samplers[channel.sampler];\n if (!sampler) {\n continue;\n }\n let inputData = null;\n let outputData = null;\n if (animation.parameters) {\n inputData = animation.parameters[sampler.input];\n outputData = animation.parameters[sampler.output];\n }\n else {\n inputData = sampler.input;\n outputData = sampler.output;\n }\n const bufferInput = GLTFUtils.GetBufferFromAccessor(gltfRuntime, gltfRuntime.accessors[inputData]);\n const bufferOutput = GLTFUtils.GetBufferFromAccessor(gltfRuntime, gltfRuntime.accessors[outputData]);\n const targetId = channel.target.id;\n let targetNode = gltfRuntime.scene.getNodeById(targetId);\n if (targetNode === null) {\n targetNode = gltfRuntime.scene.getNodeByName(targetId);\n }\n if (targetNode === null) {\n Tools.Warn(\"Creating animation named \" + anim + \". But cannot find node named \" + targetId + \" to attach to\");\n continue;\n }\n const isBone = targetNode instanceof Bone;\n // Get target path (position, rotation or scaling)\n let targetPath = channel.target.path;\n const targetPathIndex = glTFAnimationPaths.indexOf(targetPath);\n if (targetPathIndex !== -1) {\n targetPath = babylonAnimationPaths[targetPathIndex];\n }\n // Determine animation type\n let animationType = Animation.ANIMATIONTYPE_MATRIX;\n if (!isBone) {\n if (targetPath === \"rotationQuaternion\") {\n animationType = Animation.ANIMATIONTYPE_QUATERNION;\n targetNode.rotationQuaternion = new Quaternion();\n }\n else {\n animationType = Animation.ANIMATIONTYPE_VECTOR3;\n }\n }\n // Create animation and key frames\n let babylonAnimation = null;\n const keys = [];\n let arrayOffset = 0;\n let modifyKey = false;\n if (isBone && lastAnimation && lastAnimation.getKeys().length === bufferInput.length) {\n babylonAnimation = lastAnimation;\n modifyKey = true;\n }\n if (!modifyKey) {\n gltfRuntime.scene._blockEntityCollection = !!gltfRuntime.assetContainer;\n babylonAnimation = new Animation(anim, isBone ? \"_matrix\" : targetPath, 1, animationType, Animation.ANIMATIONLOOPMODE_CYCLE);\n gltfRuntime.scene._blockEntityCollection = false;\n }\n // For each frame\n for (let j = 0; j < bufferInput.length; j++) {\n let value = null;\n if (targetPath === \"rotationQuaternion\") {\n // VEC4\n value = Quaternion.FromArray([bufferOutput[arrayOffset], bufferOutput[arrayOffset + 1], bufferOutput[arrayOffset + 2], bufferOutput[arrayOffset + 3]]);\n arrayOffset += 4;\n }\n else {\n // Position and scaling are VEC3\n value = Vector3.FromArray([bufferOutput[arrayOffset], bufferOutput[arrayOffset + 1], bufferOutput[arrayOffset + 2]]);\n arrayOffset += 3;\n }\n if (isBone) {\n const bone = targetNode;\n let translation = Vector3.Zero();\n let rotationQuaternion = new Quaternion();\n let scaling = Vector3.Zero();\n // Warning on decompose\n let mat = bone.getBaseMatrix();\n if (modifyKey && lastAnimation) {\n mat = lastAnimation.getKeys()[j].value;\n }\n mat.decompose(scaling, rotationQuaternion, translation);\n if (targetPath === \"position\") {\n translation = value;\n }\n else if (targetPath === \"rotationQuaternion\") {\n rotationQuaternion = value;\n }\n else {\n scaling = value;\n }\n value = Matrix.Compose(scaling, rotationQuaternion, translation);\n }\n if (!modifyKey) {\n keys.push({\n frame: bufferInput[j],\n value: value,\n });\n }\n else if (lastAnimation) {\n lastAnimation.getKeys()[j].value = value;\n }\n }\n // Finish\n if (!modifyKey && babylonAnimation) {\n babylonAnimation.setKeys(keys);\n targetNode.animations.push(babylonAnimation);\n }\n lastAnimation = babylonAnimation;\n gltfRuntime.scene.stopAnimation(targetNode);\n gltfRuntime.scene.beginAnimation(targetNode, 0, bufferInput[bufferInput.length - 1], true, 1.0);\n }\n }\n};\n/**\n * Returns the bones transformation matrix\n * @param node\n */\nconst configureBoneTransformation = (node) => {\n let mat = null;\n if (node.translation || node.rotation || node.scale) {\n const scale = Vector3.FromArray(node.scale || [1, 1, 1]);\n const rotation = Quaternion.FromArray(node.rotation || [0, 0, 0, 1]);\n const position = Vector3.FromArray(node.translation || [0, 0, 0]);\n mat = Matrix.Compose(scale, rotation, position);\n }\n else {\n mat = Matrix.FromArray(node.matrix);\n }\n return mat;\n};\n/**\n * Returns the parent bone\n * @param gltfRuntime\n * @param skins\n * @param jointName\n * @param newSkeleton\n */\nconst getParentBone = (gltfRuntime, skins, jointName, newSkeleton) => {\n // Try to find\n for (let i = 0; i < newSkeleton.bones.length; i++) {\n if (newSkeleton.bones[i].name === jointName) {\n return newSkeleton.bones[i];\n }\n }\n // Not found, search in gltf nodes\n const nodes = gltfRuntime.nodes;\n for (const nde in nodes) {\n const node = nodes[nde];\n if (!node.jointName) {\n continue;\n }\n const children = node.children;\n for (let i = 0; i < children.length; i++) {\n const child = gltfRuntime.nodes[children[i]];\n if (!child.jointName) {\n continue;\n }\n if (child.jointName === jointName) {\n const mat = configureBoneTransformation(node);\n const bone = new Bone(node.name || \"\", newSkeleton, getParentBone(gltfRuntime, skins, node.jointName, newSkeleton), mat);\n bone.id = nde;\n return bone;\n }\n }\n }\n return null;\n};\n/**\n * Returns the appropriate root node\n * @param nodesToRoot\n * @param id\n */\nconst getNodeToRoot = (nodesToRoot, id) => {\n for (let i = 0; i < nodesToRoot.length; i++) {\n const nodeToRoot = nodesToRoot[i];\n for (let j = 0; j < nodeToRoot.node.children.length; j++) {\n const child = nodeToRoot.node.children[j];\n if (child === id) {\n return nodeToRoot.bone;\n }\n }\n }\n return null;\n};\n/**\n * Returns the node with the joint name\n * @param gltfRuntime\n * @param jointName\n */\nconst getJointNode = (gltfRuntime, jointName) => {\n const nodes = gltfRuntime.nodes;\n let node = nodes[jointName];\n if (node) {\n return {\n node: node,\n id: jointName,\n };\n }\n for (const nde in nodes) {\n node = nodes[nde];\n if (node.jointName === jointName) {\n return {\n node: node,\n id: nde,\n };\n }\n }\n return null;\n};\n/**\n * Checks if a nodes is in joints\n * @param skins\n * @param id\n */\nconst nodeIsInJoints = (skins, id) => {\n for (let i = 0; i < skins.jointNames.length; i++) {\n if (skins.jointNames[i] === id) {\n return true;\n }\n }\n return false;\n};\n/**\n * Fills the nodes to root for bones and builds hierarchy\n * @param gltfRuntime\n * @param newSkeleton\n * @param skins\n * @param nodesToRoot\n */\nconst getNodesToRoot = (gltfRuntime, newSkeleton, skins, nodesToRoot) => {\n // Creates nodes for root\n for (const nde in gltfRuntime.nodes) {\n const node = gltfRuntime.nodes[nde];\n const id = nde;\n if (!node.jointName || nodeIsInJoints(skins, node.jointName)) {\n continue;\n }\n // Create node to root bone\n const mat = configureBoneTransformation(node);\n const bone = new Bone(node.name || \"\", newSkeleton, null, mat);\n bone.id = id;\n nodesToRoot.push({ bone: bone, node: node, id: id });\n }\n // Parenting\n for (let i = 0; i < nodesToRoot.length; i++) {\n const nodeToRoot = nodesToRoot[i];\n const children = nodeToRoot.node.children;\n for (let j = 0; j < children.length; j++) {\n let child = null;\n for (let k = 0; k < nodesToRoot.length; k++) {\n if (nodesToRoot[k].id === children[j]) {\n child = nodesToRoot[k];\n break;\n }\n }\n if (child) {\n child.bone._parent = nodeToRoot.bone;\n nodeToRoot.bone.children.push(child.bone);\n }\n }\n }\n};\n/**\n * Imports a skeleton\n * @param gltfRuntime\n * @param skins\n * @param mesh\n * @param newSkeleton\n */\nconst importSkeleton = (gltfRuntime, skins, mesh, newSkeleton) => {\n if (!newSkeleton) {\n newSkeleton = new Skeleton(skins.name || \"\", \"\", gltfRuntime.scene);\n }\n if (!skins.babylonSkeleton) {\n return newSkeleton;\n }\n // Find the root bones\n const nodesToRoot = [];\n const nodesToRootToAdd = [];\n getNodesToRoot(gltfRuntime, newSkeleton, skins, nodesToRoot);\n newSkeleton.bones = [];\n // Joints\n for (let i = 0; i < skins.jointNames.length; i++) {\n const jointNode = getJointNode(gltfRuntime, skins.jointNames[i]);\n if (!jointNode) {\n continue;\n }\n const node = jointNode.node;\n if (!node) {\n Tools.Warn(\"Joint named \" + skins.jointNames[i] + \" does not exist\");\n continue;\n }\n const id = jointNode.id;\n // Optimize, if the bone already exists...\n const existingBone = gltfRuntime.scene.getBoneById(id);\n if (existingBone) {\n newSkeleton.bones.push(existingBone);\n continue;\n }\n // Search for parent bone\n let foundBone = false;\n let parentBone = null;\n for (let j = 0; j < i; j++) {\n const jointNode = getJointNode(gltfRuntime, skins.jointNames[j]);\n if (!jointNode) {\n continue;\n }\n const joint = jointNode.node;\n if (!joint) {\n Tools.Warn(\"Joint named \" + skins.jointNames[j] + \" does not exist when looking for parent\");\n continue;\n }\n const children = joint.children;\n if (!children) {\n continue;\n }\n foundBone = false;\n for (let k = 0; k < children.length; k++) {\n if (children[k] === id) {\n parentBone = getParentBone(gltfRuntime, skins, skins.jointNames[j], newSkeleton);\n foundBone = true;\n break;\n }\n }\n if (foundBone) {\n break;\n }\n }\n // Create bone\n const mat = configureBoneTransformation(node);\n if (!parentBone && nodesToRoot.length > 0) {\n parentBone = getNodeToRoot(nodesToRoot, id);\n if (parentBone) {\n if (nodesToRootToAdd.indexOf(parentBone) === -1) {\n nodesToRootToAdd.push(parentBone);\n }\n }\n }\n const bone = new Bone(node.jointName || \"\", newSkeleton, parentBone, mat);\n bone.id = id;\n }\n // Polish\n const bones = newSkeleton.bones;\n newSkeleton.bones = [];\n for (let i = 0; i < skins.jointNames.length; i++) {\n const jointNode = getJointNode(gltfRuntime, skins.jointNames[i]);\n if (!jointNode) {\n continue;\n }\n for (let j = 0; j < bones.length; j++) {\n if (bones[j].id === jointNode.id) {\n newSkeleton.bones.push(bones[j]);\n break;\n }\n }\n }\n newSkeleton.prepare();\n // Finish\n for (let i = 0; i < nodesToRootToAdd.length; i++) {\n newSkeleton.bones.push(nodesToRootToAdd[i]);\n }\n return newSkeleton;\n};\n/**\n * Imports a mesh and its geometries\n * @param gltfRuntime\n * @param node\n * @param meshes\n * @param id\n * @param newMesh\n */\nconst importMesh = (gltfRuntime, node, meshes, id, newMesh) => {\n if (!newMesh) {\n gltfRuntime.scene._blockEntityCollection = !!gltfRuntime.assetContainer;\n newMesh = new Mesh(node.name || \"\", gltfRuntime.scene);\n newMesh._parentContainer = gltfRuntime.assetContainer;\n gltfRuntime.scene._blockEntityCollection = false;\n newMesh.id = id;\n }\n if (!node.babylonNode) {\n return newMesh;\n }\n const subMaterials = [];\n let vertexData = null;\n const verticesStarts = new Array();\n const verticesCounts = new Array();\n const indexStarts = new Array();\n const indexCounts = new Array();\n for (let meshIndex = 0; meshIndex < meshes.length; meshIndex++) {\n const meshId = meshes[meshIndex];\n const mesh = gltfRuntime.meshes[meshId];\n if (!mesh) {\n continue;\n }\n // Positions, normals and UVs\n for (let i = 0; i < mesh.primitives.length; i++) {\n // Temporary vertex data\n const tempVertexData = new VertexData();\n const primitive = mesh.primitives[i];\n if (primitive.mode !== 4) {\n // continue;\n }\n const attributes = primitive.attributes;\n let accessor = null;\n let buffer = null;\n // Set positions, normal and uvs\n for (const semantic in attributes) {\n // Link accessor and buffer view\n accessor = gltfRuntime.accessors[attributes[semantic]];\n buffer = GLTFUtils.GetBufferFromAccessor(gltfRuntime, accessor);\n if (semantic === \"NORMAL\") {\n tempVertexData.normals = new Float32Array(buffer.length);\n tempVertexData.normals.set(buffer);\n }\n else if (semantic === \"POSITION\") {\n if (GLTFFileLoader.HomogeneousCoordinates) {\n tempVertexData.positions = new Float32Array(buffer.length - buffer.length / 4);\n for (let j = 0; j < buffer.length; j += 4) {\n tempVertexData.positions[j] = buffer[j];\n tempVertexData.positions[j + 1] = buffer[j + 1];\n tempVertexData.positions[j + 2] = buffer[j + 2];\n }\n }\n else {\n tempVertexData.positions = new Float32Array(buffer.length);\n tempVertexData.positions.set(buffer);\n }\n verticesCounts.push(tempVertexData.positions.length);\n }\n else if (semantic.indexOf(\"TEXCOORD_\") !== -1) {\n const channel = Number(semantic.split(\"_\")[1]);\n const uvKind = VertexBuffer.UVKind + (channel === 0 ? \"\" : channel + 1);\n const uvs = new Float32Array(buffer.length);\n uvs.set(buffer);\n normalizeUVs(uvs);\n tempVertexData.set(uvs, uvKind);\n }\n else if (semantic === \"JOINT\") {\n tempVertexData.matricesIndices = new Float32Array(buffer.length);\n tempVertexData.matricesIndices.set(buffer);\n }\n else if (semantic === \"WEIGHT\") {\n tempVertexData.matricesWeights = new Float32Array(buffer.length);\n tempVertexData.matricesWeights.set(buffer);\n }\n else if (semantic === \"COLOR\") {\n tempVertexData.colors = new Float32Array(buffer.length);\n tempVertexData.colors.set(buffer);\n }\n }\n // Indices\n accessor = gltfRuntime.accessors[primitive.indices];\n if (accessor) {\n buffer = GLTFUtils.GetBufferFromAccessor(gltfRuntime, accessor);\n tempVertexData.indices = new Int32Array(buffer.length);\n tempVertexData.indices.set(buffer);\n indexCounts.push(tempVertexData.indices.length);\n }\n else {\n // Set indices on the fly\n const indices = [];\n for (let j = 0; j < tempVertexData.positions.length / 3; j++) {\n indices.push(j);\n }\n tempVertexData.indices = new Int32Array(indices);\n indexCounts.push(tempVertexData.indices.length);\n }\n if (!vertexData) {\n vertexData = tempVertexData;\n }\n else {\n vertexData.merge(tempVertexData);\n }\n // Sub material\n const material = gltfRuntime.scene.getMaterialById(primitive.material);\n subMaterials.push(material === null ? GLTFUtils.GetDefaultMaterial(gltfRuntime.scene) : material);\n // Update vertices start and index start\n verticesStarts.push(verticesStarts.length === 0 ? 0 : verticesStarts[verticesStarts.length - 1] + verticesCounts[verticesCounts.length - 2]);\n indexStarts.push(indexStarts.length === 0 ? 0 : indexStarts[indexStarts.length - 1] + indexCounts[indexCounts.length - 2]);\n }\n }\n let material;\n gltfRuntime.scene._blockEntityCollection = !!gltfRuntime.assetContainer;\n if (subMaterials.length > 1) {\n material = new MultiMaterial(\"multimat\" + id, gltfRuntime.scene);\n material.subMaterials = subMaterials;\n }\n else {\n material = new StandardMaterial(\"multimat\" + id, gltfRuntime.scene);\n }\n if (subMaterials.length === 1) {\n material = subMaterials[0];\n }\n material._parentContainer = gltfRuntime.assetContainer;\n if (!newMesh.material) {\n newMesh.material = material;\n }\n // Apply geometry\n new Geometry(id, gltfRuntime.scene, vertexData, false, newMesh);\n newMesh.computeWorldMatrix(true);\n gltfRuntime.scene._blockEntityCollection = false;\n // Apply submeshes\n newMesh.subMeshes = [];\n let index = 0;\n for (let meshIndex = 0; meshIndex < meshes.length; meshIndex++) {\n const meshId = meshes[meshIndex];\n const mesh = gltfRuntime.meshes[meshId];\n if (!mesh) {\n continue;\n }\n for (let i = 0; i < mesh.primitives.length; i++) {\n if (mesh.primitives[i].mode !== 4) {\n //continue;\n }\n SubMesh.AddToMesh(index, verticesStarts[index], verticesCounts[index], indexStarts[index], indexCounts[index], newMesh, newMesh, true);\n index++;\n }\n }\n // Finish\n return newMesh;\n};\n/**\n * Configure node transformation from position, rotation and scaling\n * @param newNode\n * @param position\n * @param rotation\n * @param scaling\n */\nconst configureNode = (newNode, position, rotation, scaling) => {\n if (newNode.position) {\n newNode.position = position;\n }\n if (newNode.rotationQuaternion || newNode.rotation) {\n newNode.rotationQuaternion = rotation;\n }\n if (newNode.scaling) {\n newNode.scaling = scaling;\n }\n};\n/**\n * Configures node from transformation matrix\n * @param newNode\n * @param node\n */\nconst configureNodeFromMatrix = (newNode, node) => {\n if (node.matrix) {\n const position = new Vector3(0, 0, 0);\n const rotation = new Quaternion();\n const scaling = new Vector3(0, 0, 0);\n const mat = Matrix.FromArray(node.matrix);\n mat.decompose(scaling, rotation, position);\n configureNode(newNode, position, rotation, scaling);\n }\n else if (node.translation && node.rotation && node.scale) {\n configureNode(newNode, Vector3.FromArray(node.translation), Quaternion.FromArray(node.rotation), Vector3.FromArray(node.scale));\n }\n newNode.computeWorldMatrix(true);\n};\n/**\n * Imports a node\n * @param gltfRuntime\n * @param node\n * @param id\n */\nconst importNode = (gltfRuntime, node, id) => {\n let lastNode = null;\n if (gltfRuntime.importOnlyMeshes && (node.skin || node.meshes)) {\n if (gltfRuntime.importMeshesNames && gltfRuntime.importMeshesNames.length > 0 && gltfRuntime.importMeshesNames.indexOf(node.name || \"\") === -1) {\n return null;\n }\n }\n // Meshes\n if (node.skin) {\n if (node.meshes) {\n const skin = gltfRuntime.skins[node.skin];\n const newMesh = importMesh(gltfRuntime, node, node.meshes, id, node.babylonNode);\n newMesh.skeleton = gltfRuntime.scene.getLastSkeletonById(node.skin);\n if (newMesh.skeleton === null) {\n newMesh.skeleton = importSkeleton(gltfRuntime, skin, newMesh, skin.babylonSkeleton);\n if (!skin.babylonSkeleton) {\n skin.babylonSkeleton = newMesh.skeleton;\n }\n }\n lastNode = newMesh;\n }\n }\n else if (node.meshes) {\n /**\n * Improve meshes property\n */\n const newMesh = importMesh(gltfRuntime, node, node.mesh ? [node.mesh] : node.meshes, id, node.babylonNode);\n lastNode = newMesh;\n }\n // Lights\n else if (node.light && !node.babylonNode && !gltfRuntime.importOnlyMeshes) {\n const light = gltfRuntime.lights[node.light];\n if (light) {\n if (light.type === \"ambient\") {\n const ambienLight = light[light.type];\n const hemiLight = new HemisphericLight(node.light, Vector3.Zero(), gltfRuntime.scene);\n hemiLight.name = node.name || \"\";\n if (ambienLight.color) {\n hemiLight.diffuse = Color3.FromArray(ambienLight.color);\n }\n lastNode = hemiLight;\n }\n else if (light.type === \"directional\") {\n const directionalLight = light[light.type];\n const dirLight = new DirectionalLight(node.light, Vector3.Zero(), gltfRuntime.scene);\n dirLight.name = node.name || \"\";\n if (directionalLight.color) {\n dirLight.diffuse = Color3.FromArray(directionalLight.color);\n }\n lastNode = dirLight;\n }\n else if (light.type === \"point\") {\n const pointLight = light[light.type];\n const ptLight = new PointLight(node.light, Vector3.Zero(), gltfRuntime.scene);\n ptLight.name = node.name || \"\";\n if (pointLight.color) {\n ptLight.diffuse = Color3.FromArray(pointLight.color);\n }\n lastNode = ptLight;\n }\n else if (light.type === \"spot\") {\n const spotLight = light[light.type];\n const spLight = new SpotLight(node.light, Vector3.Zero(), Vector3.Zero(), 0, 0, gltfRuntime.scene);\n spLight.name = node.name || \"\";\n if (spotLight.color) {\n spLight.diffuse = Color3.FromArray(spotLight.color);\n }\n if (spotLight.fallOfAngle) {\n spLight.angle = spotLight.fallOfAngle;\n }\n if (spotLight.fallOffExponent) {\n spLight.exponent = spotLight.fallOffExponent;\n }\n lastNode = spLight;\n }\n }\n }\n // Cameras\n else if (node.camera && !node.babylonNode && !gltfRuntime.importOnlyMeshes) {\n const camera = gltfRuntime.cameras[node.camera];\n if (camera) {\n gltfRuntime.scene._blockEntityCollection = !!gltfRuntime.assetContainer;\n if (camera.type === \"orthographic\") {\n const orthoCamera = new FreeCamera(node.camera, Vector3.Zero(), gltfRuntime.scene, false);\n orthoCamera.name = node.name || \"\";\n orthoCamera.mode = Camera.ORTHOGRAPHIC_CAMERA;\n orthoCamera.attachControl();\n lastNode = orthoCamera;\n orthoCamera._parentContainer = gltfRuntime.assetContainer;\n }\n else if (camera.type === \"perspective\") {\n const perspectiveCamera = camera[camera.type];\n const persCamera = new FreeCamera(node.camera, Vector3.Zero(), gltfRuntime.scene, false);\n persCamera.name = node.name || \"\";\n persCamera.attachControl();\n if (!perspectiveCamera.aspectRatio) {\n perspectiveCamera.aspectRatio = gltfRuntime.scene.getEngine().getRenderWidth() / gltfRuntime.scene.getEngine().getRenderHeight();\n }\n if (perspectiveCamera.znear && perspectiveCamera.zfar) {\n persCamera.maxZ = perspectiveCamera.zfar;\n persCamera.minZ = perspectiveCamera.znear;\n }\n lastNode = persCamera;\n persCamera._parentContainer = gltfRuntime.assetContainer;\n }\n gltfRuntime.scene._blockEntityCollection = false;\n }\n }\n // Empty node\n if (!node.jointName) {\n if (node.babylonNode) {\n return node.babylonNode;\n }\n else if (lastNode === null) {\n gltfRuntime.scene._blockEntityCollection = !!gltfRuntime.assetContainer;\n const dummy = new Mesh(node.name || \"\", gltfRuntime.scene);\n dummy._parentContainer = gltfRuntime.assetContainer;\n gltfRuntime.scene._blockEntityCollection = false;\n node.babylonNode = dummy;\n lastNode = dummy;\n }\n }\n if (lastNode !== null) {\n if (node.matrix && lastNode instanceof Mesh) {\n configureNodeFromMatrix(lastNode, node);\n }\n else {\n const translation = node.translation || [0, 0, 0];\n const rotation = node.rotation || [0, 0, 0, 1];\n const scale = node.scale || [1, 1, 1];\n configureNode(lastNode, Vector3.FromArray(translation), Quaternion.FromArray(rotation), Vector3.FromArray(scale));\n }\n lastNode.updateCache(true);\n node.babylonNode = lastNode;\n }\n return lastNode;\n};\n/**\n * Traverses nodes and creates them\n * @param gltfRuntime\n * @param id\n * @param parent\n * @param meshIncluded\n */\nconst traverseNodes = (gltfRuntime, id, parent, meshIncluded = false) => {\n const node = gltfRuntime.nodes[id];\n let newNode = null;\n if (gltfRuntime.importOnlyMeshes && !meshIncluded && gltfRuntime.importMeshesNames) {\n if (gltfRuntime.importMeshesNames.indexOf(node.name || \"\") !== -1 || gltfRuntime.importMeshesNames.length === 0) {\n meshIncluded = true;\n }\n else {\n meshIncluded = false;\n }\n }\n else {\n meshIncluded = true;\n }\n if (!node.jointName && meshIncluded) {\n newNode = importNode(gltfRuntime, node, id);\n if (newNode !== null) {\n newNode.id = id;\n newNode.parent = parent;\n }\n }\n if (node.children) {\n for (let i = 0; i < node.children.length; i++) {\n traverseNodes(gltfRuntime, node.children[i], newNode, meshIncluded);\n }\n }\n};\n/**\n * do stuff after buffers, shaders are loaded (e.g. hook up materials, load animations, etc.)\n * @param gltfRuntime\n */\nconst postLoad = (gltfRuntime) => {\n // Nodes\n let currentScene = gltfRuntime.currentScene;\n if (currentScene) {\n for (let i = 0; i < currentScene.nodes.length; i++) {\n traverseNodes(gltfRuntime, currentScene.nodes[i], null);\n }\n }\n else {\n for (const thing in gltfRuntime.scenes) {\n currentScene = gltfRuntime.scenes[thing];\n for (let i = 0; i < currentScene.nodes.length; i++) {\n traverseNodes(gltfRuntime, currentScene.nodes[i], null);\n }\n }\n }\n // Set animations\n loadAnimations(gltfRuntime);\n for (let i = 0; i < gltfRuntime.scene.skeletons.length; i++) {\n const skeleton = gltfRuntime.scene.skeletons[i];\n gltfRuntime.scene.beginAnimation(skeleton, 0, Number.MAX_VALUE, true, 1.0);\n }\n};\n/**\n * onBind shaderrs callback to set uniforms and matrices\n * @param mesh\n * @param gltfRuntime\n * @param unTreatedUniforms\n * @param shaderMaterial\n * @param technique\n * @param material\n * @param onSuccess\n */\nconst onBindShaderMaterial = (mesh, gltfRuntime, unTreatedUniforms, shaderMaterial, technique, material, onSuccess) => {\n const materialValues = material.values || technique.parameters;\n for (const unif in unTreatedUniforms) {\n const uniform = unTreatedUniforms[unif];\n const type = uniform.type;\n if (type === EParameterType.FLOAT_MAT2 || type === EParameterType.FLOAT_MAT3 || type === EParameterType.FLOAT_MAT4) {\n if (uniform.semantic && !uniform.source && !uniform.node) {\n GLTFUtils.SetMatrix(gltfRuntime.scene, mesh, uniform, unif, shaderMaterial.getEffect());\n }\n else if (uniform.semantic && (uniform.source || uniform.node)) {\n let source = gltfRuntime.scene.getNodeByName(uniform.source || uniform.node || \"\");\n if (source === null) {\n source = gltfRuntime.scene.getNodeById(uniform.source || uniform.node || \"\");\n }\n if (source === null) {\n continue;\n }\n GLTFUtils.SetMatrix(gltfRuntime.scene, source, uniform, unif, shaderMaterial.getEffect());\n }\n }\n else {\n const value = materialValues[technique.uniforms[unif]];\n if (!value) {\n continue;\n }\n if (type === EParameterType.SAMPLER_2D) {\n const texture = gltfRuntime.textures[material.values ? value : uniform.value].babylonTexture;\n if (texture === null || texture === undefined) {\n continue;\n }\n shaderMaterial.getEffect().setTexture(unif, texture);\n }\n else {\n GLTFUtils.SetUniform(shaderMaterial.getEffect(), unif, value, type);\n }\n }\n }\n onSuccess(shaderMaterial);\n};\n/**\n * Prepare uniforms to send the only one time\n * Loads the appropriate textures\n * @param gltfRuntime\n * @param shaderMaterial\n * @param technique\n * @param material\n */\nconst prepareShaderMaterialUniforms = (gltfRuntime, shaderMaterial, technique, material, unTreatedUniforms) => {\n const materialValues = material.values || technique.parameters;\n const techniqueUniforms = technique.uniforms;\n /**\n * Prepare values here (not matrices)\n */\n for (const unif in unTreatedUniforms) {\n const uniform = unTreatedUniforms[unif];\n const type = uniform.type;\n let value = materialValues[techniqueUniforms[unif]];\n if (value === undefined) {\n // In case the value is the same for all materials\n value = uniform.value;\n }\n if (!value) {\n continue;\n }\n const onLoadTexture = (uniformName) => {\n return (texture) => {\n if (uniform.value && uniformName) {\n // Static uniform\n shaderMaterial.setTexture(uniformName, texture);\n delete unTreatedUniforms[uniformName];\n }\n };\n };\n // Texture (sampler2D)\n if (type === EParameterType.SAMPLER_2D) {\n GLTFLoaderExtension.LoadTextureAsync(gltfRuntime, material.values ? value : uniform.value, onLoadTexture(unif), () => onLoadTexture(null));\n }\n // Others\n else {\n if (uniform.value && GLTFUtils.SetUniform(shaderMaterial, unif, material.values ? value : uniform.value, type)) {\n // Static uniform\n delete unTreatedUniforms[unif];\n }\n }\n }\n};\n/**\n * Shader compilation failed\n * @param program\n * @param shaderMaterial\n * @param onError\n */\nconst onShaderCompileError = (program, shaderMaterial, onError) => {\n return (effect, error) => {\n shaderMaterial.dispose(true);\n onError(\"Cannot compile program named \" + program.name + \". Error: \" + error + \". Default material will be applied\");\n };\n};\n/**\n * Shader compilation success\n * @param gltfRuntime\n * @param shaderMaterial\n * @param technique\n * @param material\n * @param unTreatedUniforms\n * @param onSuccess\n */\nconst onShaderCompileSuccess = (gltfRuntime, shaderMaterial, technique, material, unTreatedUniforms, onSuccess) => {\n return (_) => {\n prepareShaderMaterialUniforms(gltfRuntime, shaderMaterial, technique, material, unTreatedUniforms);\n shaderMaterial.onBind = (mesh) => {\n onBindShaderMaterial(mesh, gltfRuntime, unTreatedUniforms, shaderMaterial, technique, material, onSuccess);\n };\n };\n};\n/**\n * Returns the appropriate uniform if already handled by babylon\n * @param tokenizer\n * @param technique\n */\nconst parseShaderUniforms = (tokenizer, technique, unTreatedUniforms) => {\n for (const unif in technique.uniforms) {\n const uniform = technique.uniforms[unif];\n const uniformParameter = technique.parameters[uniform];\n if (tokenizer.currentIdentifier === unif) {\n if (uniformParameter.semantic && !uniformParameter.source && !uniformParameter.node) {\n const transformIndex = glTFTransforms.indexOf(uniformParameter.semantic);\n if (transformIndex !== -1) {\n delete unTreatedUniforms[unif];\n return babylonTransforms[transformIndex];\n }\n }\n }\n }\n return tokenizer.currentIdentifier;\n};\n/**\n * All shaders loaded. Create materials one by one\n * @param gltfRuntime\n */\nconst importMaterials = (gltfRuntime) => {\n // Create materials\n for (const mat in gltfRuntime.materials) {\n GLTFLoaderExtension.LoadMaterialAsync(gltfRuntime, mat, () => { }, () => { });\n }\n};\n/**\n * Implementation of the base glTF spec\n * @internal\n */\nexport class GLTFLoaderBase {\n static CreateRuntime(parsedData, scene, rootUrl) {\n const gltfRuntime = {\n extensions: {},\n accessors: {},\n buffers: {},\n bufferViews: {},\n meshes: {},\n lights: {},\n cameras: {},\n nodes: {},\n images: {},\n textures: {},\n shaders: {},\n programs: {},\n samplers: {},\n techniques: {},\n materials: {},\n animations: {},\n skins: {},\n extensionsUsed: [],\n scenes: {},\n buffersCount: 0,\n shaderscount: 0,\n scene: scene,\n rootUrl: rootUrl,\n loadedBufferCount: 0,\n loadedBufferViews: {},\n loadedShaderCount: 0,\n importOnlyMeshes: false,\n dummyNodes: [],\n assetContainer: null,\n };\n // Parse\n if (parsedData.extensions) {\n parseObject(parsedData.extensions, \"extensions\", gltfRuntime);\n }\n if (parsedData.extensionsUsed) {\n parseObject(parsedData.extensionsUsed, \"extensionsUsed\", gltfRuntime);\n }\n if (parsedData.buffers) {\n parseBuffers(parsedData.buffers, gltfRuntime);\n }\n if (parsedData.bufferViews) {\n parseObject(parsedData.bufferViews, \"bufferViews\", gltfRuntime);\n }\n if (parsedData.accessors) {\n parseObject(parsedData.accessors, \"accessors\", gltfRuntime);\n }\n if (parsedData.meshes) {\n parseObject(parsedData.meshes, \"meshes\", gltfRuntime);\n }\n if (parsedData.lights) {\n parseObject(parsedData.lights, \"lights\", gltfRuntime);\n }\n if (parsedData.cameras) {\n parseObject(parsedData.cameras, \"cameras\", gltfRuntime);\n }\n if (parsedData.nodes) {\n parseObject(parsedData.nodes, \"nodes\", gltfRuntime);\n }\n if (parsedData.images) {\n parseObject(parsedData.images, \"images\", gltfRuntime);\n }\n if (parsedData.textures) {\n parseObject(parsedData.textures, \"textures\", gltfRuntime);\n }\n if (parsedData.shaders) {\n parseShaders(parsedData.shaders, gltfRuntime);\n }\n if (parsedData.programs) {\n parseObject(parsedData.programs, \"programs\", gltfRuntime);\n }\n if (parsedData.samplers) {\n parseObject(parsedData.samplers, \"samplers\", gltfRuntime);\n }\n if (parsedData.techniques) {\n parseObject(parsedData.techniques, \"techniques\", gltfRuntime);\n }\n if (parsedData.materials) {\n parseObject(parsedData.materials, \"materials\", gltfRuntime);\n }\n if (parsedData.animations) {\n parseObject(parsedData.animations, \"animations\", gltfRuntime);\n }\n if (parsedData.skins) {\n parseObject(parsedData.skins, \"skins\", gltfRuntime);\n }\n if (parsedData.scenes) {\n gltfRuntime.scenes = parsedData.scenes;\n }\n if (parsedData.scene && parsedData.scenes) {\n gltfRuntime.currentScene = parsedData.scenes[parsedData.scene];\n }\n return gltfRuntime;\n }\n static LoadBufferAsync(gltfRuntime, id, onSuccess, onError, onProgress) {\n const buffer = gltfRuntime.buffers[id];\n if (Tools.IsBase64(buffer.uri)) {\n setTimeout(() => onSuccess(new Uint8Array(Tools.DecodeBase64(buffer.uri))));\n }\n else {\n Tools.LoadFile(gltfRuntime.rootUrl + buffer.uri, (data) => onSuccess(new Uint8Array(data)), onProgress, undefined, true, (request) => {\n if (request) {\n onError(request.status + \" \" + request.statusText);\n }\n });\n }\n }\n static LoadTextureBufferAsync(gltfRuntime, id, onSuccess, onError) {\n const texture = gltfRuntime.textures[id];\n if (!texture || !texture.source) {\n onError(\"\");\n return;\n }\n if (texture.babylonTexture) {\n onSuccess(null);\n return;\n }\n const source = gltfRuntime.images[texture.source];\n if (Tools.IsBase64(source.uri)) {\n setTimeout(() => onSuccess(new Uint8Array(Tools.DecodeBase64(source.uri))));\n }\n else {\n Tools.LoadFile(gltfRuntime.rootUrl + source.uri, (data) => onSuccess(new Uint8Array(data)), undefined, undefined, true, (request) => {\n if (request) {\n onError(request.status + \" \" + request.statusText);\n }\n });\n }\n }\n static CreateTextureAsync(gltfRuntime, id, buffer, onSuccess) {\n const texture = gltfRuntime.textures[id];\n if (texture.babylonTexture) {\n onSuccess(texture.babylonTexture);\n return;\n }\n const sampler = gltfRuntime.samplers[texture.sampler];\n const createMipMaps = sampler.minFilter === ETextureFilterType.NEAREST_MIPMAP_NEAREST ||\n sampler.minFilter === ETextureFilterType.NEAREST_MIPMAP_LINEAR ||\n sampler.minFilter === ETextureFilterType.LINEAR_MIPMAP_NEAREST ||\n sampler.minFilter === ETextureFilterType.LINEAR_MIPMAP_LINEAR;\n const samplingMode = Texture.BILINEAR_SAMPLINGMODE;\n const blob = buffer == null ? new Blob() : new Blob([buffer]);\n const blobURL = URL.createObjectURL(blob);\n const revokeBlobURL = () => URL.revokeObjectURL(blobURL);\n const newTexture = new Texture(blobURL, gltfRuntime.scene, !createMipMaps, true, samplingMode, revokeBlobURL, revokeBlobURL);\n if (sampler.wrapS !== undefined) {\n newTexture.wrapU = GLTFUtils.GetWrapMode(sampler.wrapS);\n }\n if (sampler.wrapT !== undefined) {\n newTexture.wrapV = GLTFUtils.GetWrapMode(sampler.wrapT);\n }\n newTexture.name = id;\n texture.babylonTexture = newTexture;\n onSuccess(newTexture);\n }\n static LoadShaderStringAsync(gltfRuntime, id, onSuccess, onError) {\n const shader = gltfRuntime.shaders[id];\n if (Tools.IsBase64(shader.uri)) {\n const shaderString = atob(shader.uri.split(\",\")[1]);\n if (onSuccess) {\n onSuccess(shaderString);\n }\n }\n else {\n Tools.LoadFile(gltfRuntime.rootUrl + shader.uri, onSuccess, undefined, undefined, false, (request) => {\n if (request && onError) {\n onError(request.status + \" \" + request.statusText);\n }\n });\n }\n }\n static LoadMaterialAsync(gltfRuntime, id, onSuccess, onError) {\n const material = gltfRuntime.materials[id];\n if (!material.technique) {\n if (onError) {\n onError(\"No technique found.\");\n }\n return;\n }\n const technique = gltfRuntime.techniques[material.technique];\n if (!technique) {\n gltfRuntime.scene._blockEntityCollection = !!gltfRuntime.assetContainer;\n const defaultMaterial = new StandardMaterial(id, gltfRuntime.scene);\n defaultMaterial._parentContainer = gltfRuntime.assetContainer;\n gltfRuntime.scene._blockEntityCollection = false;\n defaultMaterial.diffuseColor = new Color3(0.5, 0.5, 0.5);\n defaultMaterial.sideOrientation = Material.CounterClockWiseSideOrientation;\n onSuccess(defaultMaterial);\n return;\n }\n const program = gltfRuntime.programs[technique.program];\n const states = technique.states;\n const vertexShader = Effect.ShadersStore[program.vertexShader + \"VertexShader\"];\n const pixelShader = Effect.ShadersStore[program.fragmentShader + \"PixelShader\"];\n let newVertexShader = \"\";\n let newPixelShader = \"\";\n const vertexTokenizer = new Tokenizer(vertexShader);\n const pixelTokenizer = new Tokenizer(pixelShader);\n const unTreatedUniforms = {};\n const uniforms = [];\n const attributes = [];\n const samplers = [];\n // Fill uniform, sampler2D and attributes\n for (const unif in technique.uniforms) {\n const uniform = technique.uniforms[unif];\n const uniformParameter = technique.parameters[uniform];\n unTreatedUniforms[unif] = uniformParameter;\n if (uniformParameter.semantic && !uniformParameter.node && !uniformParameter.source) {\n const transformIndex = glTFTransforms.indexOf(uniformParameter.semantic);\n if (transformIndex !== -1) {\n uniforms.push(babylonTransforms[transformIndex]);\n delete unTreatedUniforms[unif];\n }\n else {\n uniforms.push(unif);\n }\n }\n else if (uniformParameter.type === EParameterType.SAMPLER_2D) {\n samplers.push(unif);\n }\n else {\n uniforms.push(unif);\n }\n }\n for (const attr in technique.attributes) {\n const attribute = technique.attributes[attr];\n const attributeParameter = technique.parameters[attribute];\n if (attributeParameter.semantic) {\n const name = getAttribute(attributeParameter);\n if (name) {\n attributes.push(name);\n }\n }\n }\n // Configure vertex shader\n while (!vertexTokenizer.isEnd() && vertexTokenizer.getNextToken()) {\n const tokenType = vertexTokenizer.currentToken;\n if (tokenType !== ETokenType.IDENTIFIER) {\n newVertexShader += vertexTokenizer.currentString;\n continue;\n }\n let foundAttribute = false;\n for (const attr in technique.attributes) {\n const attribute = technique.attributes[attr];\n const attributeParameter = technique.parameters[attribute];\n if (vertexTokenizer.currentIdentifier === attr && attributeParameter.semantic) {\n newVertexShader += getAttribute(attributeParameter);\n foundAttribute = true;\n break;\n }\n }\n if (foundAttribute) {\n continue;\n }\n newVertexShader += parseShaderUniforms(vertexTokenizer, technique, unTreatedUniforms);\n }\n // Configure pixel shader\n while (!pixelTokenizer.isEnd() && pixelTokenizer.getNextToken()) {\n const tokenType = pixelTokenizer.currentToken;\n if (tokenType !== ETokenType.IDENTIFIER) {\n newPixelShader += pixelTokenizer.currentString;\n continue;\n }\n newPixelShader += parseShaderUniforms(pixelTokenizer, technique, unTreatedUniforms);\n }\n // Create shader material\n const shaderPath = {\n vertex: program.vertexShader + id,\n fragment: program.fragmentShader + id,\n };\n const options = {\n attributes: attributes,\n uniforms: uniforms,\n samplers: samplers,\n needAlphaBlending: states && states.enable && states.enable.indexOf(3042) !== -1,\n };\n Effect.ShadersStore[program.vertexShader + id + \"VertexShader\"] = newVertexShader;\n Effect.ShadersStore[program.fragmentShader + id + \"PixelShader\"] = newPixelShader;\n const shaderMaterial = new ShaderMaterial(id, gltfRuntime.scene, shaderPath, options);\n shaderMaterial.onError = onShaderCompileError(program, shaderMaterial, onError);\n shaderMaterial.onCompiled = onShaderCompileSuccess(gltfRuntime, shaderMaterial, technique, material, unTreatedUniforms, onSuccess);\n shaderMaterial.sideOrientation = Material.CounterClockWiseSideOrientation;\n if (states && states.functions) {\n const functions = states.functions;\n if (functions.cullFace && functions.cullFace[0] !== ECullingType.BACK) {\n shaderMaterial.backFaceCulling = false;\n }\n const blendFunc = functions.blendFuncSeparate;\n if (blendFunc) {\n if (blendFunc[0] === EBlendingFunction.SRC_ALPHA &&\n blendFunc[1] === EBlendingFunction.ONE_MINUS_SRC_ALPHA &&\n blendFunc[2] === EBlendingFunction.ONE &&\n blendFunc[3] === EBlendingFunction.ONE) {\n shaderMaterial.alphaMode = Constants.ALPHA_COMBINE;\n }\n else if (blendFunc[0] === EBlendingFunction.ONE &&\n blendFunc[1] === EBlendingFunction.ONE &&\n blendFunc[2] === EBlendingFunction.ZERO &&\n blendFunc[3] === EBlendingFunction.ONE) {\n shaderMaterial.alphaMode = Constants.ALPHA_ONEONE;\n }\n else if (blendFunc[0] === EBlendingFunction.SRC_ALPHA &&\n blendFunc[1] === EBlendingFunction.ONE &&\n blendFunc[2] === EBlendingFunction.ZERO &&\n blendFunc[3] === EBlendingFunction.ONE) {\n shaderMaterial.alphaMode = Constants.ALPHA_ADD;\n }\n else if (blendFunc[0] === EBlendingFunction.ZERO &&\n blendFunc[1] === EBlendingFunction.ONE_MINUS_SRC_COLOR &&\n blendFunc[2] === EBlendingFunction.ONE &&\n blendFunc[3] === EBlendingFunction.ONE) {\n shaderMaterial.alphaMode = Constants.ALPHA_SUBTRACT;\n }\n else if (blendFunc[0] === EBlendingFunction.DST_COLOR &&\n blendFunc[1] === EBlendingFunction.ZERO &&\n blendFunc[2] === EBlendingFunction.ONE &&\n blendFunc[3] === EBlendingFunction.ONE) {\n shaderMaterial.alphaMode = Constants.ALPHA_MULTIPLY;\n }\n else if (blendFunc[0] === EBlendingFunction.SRC_ALPHA &&\n blendFunc[1] === EBlendingFunction.ONE_MINUS_SRC_COLOR &&\n blendFunc[2] === EBlendingFunction.ONE &&\n blendFunc[3] === EBlendingFunction.ONE) {\n shaderMaterial.alphaMode = Constants.ALPHA_MAXIMIZED;\n }\n }\n }\n }\n}\n/**\n * glTF V1 Loader\n * @internal\n * @deprecated\n */\nexport class GLTFLoader {\n static RegisterExtension(extension) {\n if (GLTFLoader.Extensions[extension.name]) {\n Tools.Error('Tool with the same name \"' + extension.name + '\" already exists');\n return;\n }\n GLTFLoader.Extensions[extension.name] = extension;\n }\n dispose() {\n // do nothing\n }\n _importMeshAsync(meshesNames, scene, data, rootUrl, assetContainer, onSuccess, onProgress, onError) {\n scene.useRightHandedSystem = true;\n GLTFLoaderExtension.LoadRuntimeAsync(scene, data, rootUrl, (gltfRuntime) => {\n gltfRuntime.assetContainer = assetContainer;\n gltfRuntime.importOnlyMeshes = true;\n if (meshesNames === \"\") {\n gltfRuntime.importMeshesNames = [];\n }\n else if (typeof meshesNames === \"string\") {\n gltfRuntime.importMeshesNames = [meshesNames];\n }\n else if (meshesNames && !(meshesNames instanceof Array)) {\n gltfRuntime.importMeshesNames = [meshesNames];\n }\n else {\n gltfRuntime.importMeshesNames = [];\n Tools.Warn(\"Argument meshesNames must be of type string or string[]\");\n }\n // Create nodes\n this._createNodes(gltfRuntime);\n const meshes = new Array();\n const skeletons = new Array();\n // Fill arrays of meshes and skeletons\n for (const nde in gltfRuntime.nodes) {\n const node = gltfRuntime.nodes[nde];\n if (node.babylonNode instanceof AbstractMesh) {\n meshes.push(node.babylonNode);\n }\n }\n for (const skl in gltfRuntime.skins) {\n const skin = gltfRuntime.skins[skl];\n if (skin.babylonSkeleton instanceof Skeleton) {\n skeletons.push(skin.babylonSkeleton);\n }\n }\n // Load buffers, shaders, materials, etc.\n this._loadBuffersAsync(gltfRuntime, () => {\n this._loadShadersAsync(gltfRuntime, () => {\n importMaterials(gltfRuntime);\n postLoad(gltfRuntime);\n if (!GLTFFileLoader.IncrementalLoading && onSuccess) {\n onSuccess(meshes, skeletons);\n }\n });\n });\n if (GLTFFileLoader.IncrementalLoading && onSuccess) {\n onSuccess(meshes, skeletons);\n }\n }, onError);\n return true;\n }\n /**\n * Imports one or more meshes from a loaded gltf file and adds them to the scene\n * @param meshesNames a string or array of strings of the mesh names that should be loaded from the file\n * @param scene the scene the meshes should be added to\n * @param assetContainer defines the asset container to use (can be null)\n * @param data gltf data containing information of the meshes in a loaded file\n * @param rootUrl root url to load from\n * @param onProgress event that fires when loading progress has occured\n * @returns a promise containg the loaded meshes, particles, skeletons and animations\n */\n importMeshAsync(meshesNames, scene, assetContainer, data, rootUrl, onProgress) {\n return new Promise((resolve, reject) => {\n this._importMeshAsync(meshesNames, scene, data, rootUrl, assetContainer, (meshes, skeletons) => {\n resolve({\n meshes: meshes,\n particleSystems: [],\n skeletons: skeletons,\n animationGroups: [],\n lights: [],\n transformNodes: [],\n geometries: [],\n });\n }, onProgress, (message) => {\n reject(new Error(message));\n });\n });\n }\n _loadAsync(scene, data, rootUrl, onSuccess, onProgress, onError) {\n scene.useRightHandedSystem = true;\n GLTFLoaderExtension.LoadRuntimeAsync(scene, data, rootUrl, (gltfRuntime) => {\n // Load runtime extensios\n GLTFLoaderExtension.LoadRuntimeExtensionsAsync(gltfRuntime, () => {\n // Create nodes\n this._createNodes(gltfRuntime);\n // Load buffers, shaders, materials, etc.\n this._loadBuffersAsync(gltfRuntime, () => {\n this._loadShadersAsync(gltfRuntime, () => {\n importMaterials(gltfRuntime);\n postLoad(gltfRuntime);\n if (!GLTFFileLoader.IncrementalLoading) {\n onSuccess();\n }\n });\n });\n if (GLTFFileLoader.IncrementalLoading) {\n onSuccess();\n }\n }, onError);\n }, onError);\n }\n /**\n * Imports all objects from a loaded gltf file and adds them to the scene\n * @param scene the scene the objects should be added to\n * @param data gltf data containing information of the meshes in a loaded file\n * @param rootUrl root url to load from\n * @param onProgress event that fires when loading progress has occured\n * @returns a promise which completes when objects have been loaded to the scene\n */\n loadAsync(scene, data, rootUrl, onProgress) {\n return new Promise((resolve, reject) => {\n this._loadAsync(scene, data, rootUrl, () => {\n resolve();\n }, onProgress, (message) => {\n reject(new Error(message));\n });\n });\n }\n _loadShadersAsync(gltfRuntime, onload) {\n let hasShaders = false;\n const processShader = (sha, shader) => {\n GLTFLoaderExtension.LoadShaderStringAsync(gltfRuntime, sha, (shaderString) => {\n if (shaderString instanceof ArrayBuffer) {\n return;\n }\n gltfRuntime.loadedShaderCount++;\n if (shaderString) {\n Effect.ShadersStore[sha + (shader.type === EShaderType.VERTEX ? \"VertexShader\" : \"PixelShader\")] = shaderString;\n }\n if (gltfRuntime.loadedShaderCount === gltfRuntime.shaderscount) {\n onload();\n }\n }, () => {\n Tools.Error(\"Error when loading shader program named \" + sha + \" located at \" + shader.uri);\n });\n };\n for (const sha in gltfRuntime.shaders) {\n hasShaders = true;\n const shader = gltfRuntime.shaders[sha];\n if (shader) {\n processShader.bind(this, sha, shader)();\n }\n else {\n Tools.Error(\"No shader named: \" + sha);\n }\n }\n if (!hasShaders) {\n onload();\n }\n }\n _loadBuffersAsync(gltfRuntime, onLoad) {\n let hasBuffers = false;\n const processBuffer = (buf, buffer) => {\n GLTFLoaderExtension.LoadBufferAsync(gltfRuntime, buf, (bufferView) => {\n gltfRuntime.loadedBufferCount++;\n if (bufferView) {\n if (bufferView.byteLength != gltfRuntime.buffers[buf].byteLength) {\n Tools.Error(\"Buffer named \" + buf + \" is length \" + bufferView.byteLength + \". Expected: \" + buffer.byteLength); // Improve error message\n }\n gltfRuntime.loadedBufferViews[buf] = bufferView;\n }\n if (gltfRuntime.loadedBufferCount === gltfRuntime.buffersCount) {\n onLoad();\n }\n }, () => {\n Tools.Error(\"Error when loading buffer named \" + buf + \" located at \" + buffer.uri);\n });\n };\n for (const buf in gltfRuntime.buffers) {\n hasBuffers = true;\n const buffer = gltfRuntime.buffers[buf];\n if (buffer) {\n processBuffer.bind(this, buf, buffer)();\n }\n else {\n Tools.Error(\"No buffer named: \" + buf);\n }\n }\n if (!hasBuffers) {\n onLoad();\n }\n }\n _createNodes(gltfRuntime) {\n let currentScene = gltfRuntime.currentScene;\n if (currentScene) {\n // Only one scene even if multiple scenes are defined\n for (let i = 0; i < currentScene.nodes.length; i++) {\n traverseNodes(gltfRuntime, currentScene.nodes[i], null);\n }\n }\n else {\n // Load all scenes\n for (const thing in gltfRuntime.scenes) {\n currentScene = gltfRuntime.scenes[thing];\n for (let i = 0; i < currentScene.nodes.length; i++) {\n traverseNodes(gltfRuntime, currentScene.nodes[i], null);\n }\n }\n }\n }\n}\nGLTFLoader.Extensions = {};\n/** @internal */\nexport class GLTFLoaderExtension {\n constructor(name) {\n this._name = name;\n }\n get name() {\n return this._name;\n }\n /**\n * Defines an override for loading the runtime\n * Return true to stop further extensions from loading the runtime\n * @param scene\n * @param data\n * @param rootUrl\n * @param onSuccess\n * @param onError\n */\n loadRuntimeAsync(scene, data, rootUrl, onSuccess, onError) {\n return false;\n }\n /**\n * Defines an onverride for creating gltf runtime\n * Return true to stop further extensions from creating the runtime\n * @param gltfRuntime\n * @param onSuccess\n * @param onError\n */\n loadRuntimeExtensionsAsync(gltfRuntime, onSuccess, onError) {\n return false;\n }\n /**\n * Defines an override for loading buffers\n * Return true to stop further extensions from loading this buffer\n * @param gltfRuntime\n * @param id\n * @param onSuccess\n * @param onError\n * @param onProgress\n */\n loadBufferAsync(gltfRuntime, id, onSuccess, onError, onProgress) {\n return false;\n }\n /**\n * Defines an override for loading texture buffers\n * Return true to stop further extensions from loading this texture data\n * @param gltfRuntime\n * @param id\n * @param onSuccess\n * @param onError\n */\n loadTextureBufferAsync(gltfRuntime, id, onSuccess, onError) {\n return false;\n }\n /**\n * Defines an override for creating textures\n * Return true to stop further extensions from loading this texture\n * @param gltfRuntime\n * @param id\n * @param buffer\n * @param onSuccess\n * @param onError\n */\n createTextureAsync(gltfRuntime, id, buffer, onSuccess, onError) {\n return false;\n }\n /**\n * Defines an override for loading shader strings\n * Return true to stop further extensions from loading this shader data\n * @param gltfRuntime\n * @param id\n * @param onSuccess\n * @param onError\n */\n loadShaderStringAsync(gltfRuntime, id, onSuccess, onError) {\n return false;\n }\n /**\n * Defines an override for loading materials\n * Return true to stop further extensions from loading this material\n * @param gltfRuntime\n * @param id\n * @param onSuccess\n * @param onError\n */\n loadMaterialAsync(gltfRuntime, id, onSuccess, onError) {\n return false;\n }\n // ---------\n // Utilities\n // ---------\n static LoadRuntimeAsync(scene, data, rootUrl, onSuccess, onError) {\n GLTFLoaderExtension._ApplyExtensions((loaderExtension) => {\n return loaderExtension.loadRuntimeAsync(scene, data, rootUrl, onSuccess, onError);\n }, () => {\n setTimeout(() => {\n if (!onSuccess) {\n return;\n }\n onSuccess(GLTFLoaderBase.CreateRuntime(data.json, scene, rootUrl));\n });\n });\n }\n static LoadRuntimeExtensionsAsync(gltfRuntime, onSuccess, onError) {\n GLTFLoaderExtension._ApplyExtensions((loaderExtension) => {\n return loaderExtension.loadRuntimeExtensionsAsync(gltfRuntime, onSuccess, onError);\n }, () => {\n setTimeout(() => {\n onSuccess();\n });\n });\n }\n static LoadBufferAsync(gltfRuntime, id, onSuccess, onError, onProgress) {\n GLTFLoaderExtension._ApplyExtensions((loaderExtension) => {\n return loaderExtension.loadBufferAsync(gltfRuntime, id, onSuccess, onError, onProgress);\n }, () => {\n GLTFLoaderBase.LoadBufferAsync(gltfRuntime, id, onSuccess, onError, onProgress);\n });\n }\n static LoadTextureAsync(gltfRuntime, id, onSuccess, onError) {\n GLTFLoaderExtension._LoadTextureBufferAsync(gltfRuntime, id, (buffer) => {\n if (buffer) {\n GLTFLoaderExtension._CreateTextureAsync(gltfRuntime, id, buffer, onSuccess, onError);\n }\n }, onError);\n }\n static LoadShaderStringAsync(gltfRuntime, id, onSuccess, onError) {\n GLTFLoaderExtension._ApplyExtensions((loaderExtension) => {\n return loaderExtension.loadShaderStringAsync(gltfRuntime, id, onSuccess, onError);\n }, () => {\n GLTFLoaderBase.LoadShaderStringAsync(gltfRuntime, id, onSuccess, onError);\n });\n }\n static LoadMaterialAsync(gltfRuntime, id, onSuccess, onError) {\n GLTFLoaderExtension._ApplyExtensions((loaderExtension) => {\n return loaderExtension.loadMaterialAsync(gltfRuntime, id, onSuccess, onError);\n }, () => {\n GLTFLoaderBase.LoadMaterialAsync(gltfRuntime, id, onSuccess, onError);\n });\n }\n static _LoadTextureBufferAsync(gltfRuntime, id, onSuccess, onError) {\n GLTFLoaderExtension._ApplyExtensions((loaderExtension) => {\n return loaderExtension.loadTextureBufferAsync(gltfRuntime, id, onSuccess, onError);\n }, () => {\n GLTFLoaderBase.LoadTextureBufferAsync(gltfRuntime, id, onSuccess, onError);\n });\n }\n static _CreateTextureAsync(gltfRuntime, id, buffer, onSuccess, onError) {\n GLTFLoaderExtension._ApplyExtensions((loaderExtension) => {\n return loaderExtension.createTextureAsync(gltfRuntime, id, buffer, onSuccess, onError);\n }, () => {\n GLTFLoaderBase.CreateTextureAsync(gltfRuntime, id, buffer, onSuccess);\n });\n }\n static _ApplyExtensions(func, defaultFunc) {\n for (const extensionName in GLTFLoader.Extensions) {\n const loaderExtension = GLTFLoader.Extensions[extensionName];\n if (func(loaderExtension)) {\n return;\n }\n }\n defaultFunc();\n }\n}\nGLTFFileLoader._CreateGLTF1Loader = () => new GLTFLoader();\n//# sourceMappingURL=glTFLoader.js.map","import { GLTFLoaderExtension, GLTFLoader, GLTFLoaderBase } from \"./glTFLoader.js\";\nimport { GLTFUtils } from \"./glTFLoaderUtils.js\";\nimport { EComponentType } from \"./glTFLoaderInterfaces.js\";\nconst BinaryExtensionBufferName = \"binary_glTF\";\n/**\n * @internal\n * @deprecated\n */\nexport class GLTFBinaryExtension extends GLTFLoaderExtension {\n constructor() {\n super(\"KHR_binary_glTF\");\n }\n loadRuntimeAsync(scene, data, rootUrl, onSuccess) {\n const extensionsUsed = data.json.extensionsUsed;\n if (!extensionsUsed || extensionsUsed.indexOf(this.name) === -1 || !data.bin) {\n return false;\n }\n this._bin = data.bin;\n onSuccess(GLTFLoaderBase.CreateRuntime(data.json, scene, rootUrl));\n return true;\n }\n loadBufferAsync(gltfRuntime, id, onSuccess, onError) {\n if (gltfRuntime.extensionsUsed.indexOf(this.name) === -1) {\n return false;\n }\n if (id !== BinaryExtensionBufferName) {\n return false;\n }\n this._bin.readAsync(0, this._bin.byteLength).then(onSuccess, (error) => onError(error.message));\n return true;\n }\n loadTextureBufferAsync(gltfRuntime, id, onSuccess) {\n const texture = gltfRuntime.textures[id];\n const source = gltfRuntime.images[texture.source];\n if (!source.extensions || !(this.name in source.extensions)) {\n return false;\n }\n const sourceExt = source.extensions[this.name];\n const bufferView = gltfRuntime.bufferViews[sourceExt.bufferView];\n const buffer = GLTFUtils.GetBufferFromBufferView(gltfRuntime, bufferView, 0, bufferView.byteLength, EComponentType.UNSIGNED_BYTE);\n onSuccess(buffer);\n return true;\n }\n loadShaderStringAsync(gltfRuntime, id, onSuccess) {\n const shader = gltfRuntime.shaders[id];\n if (!shader.extensions || !(this.name in shader.extensions)) {\n return false;\n }\n const binaryExtensionShader = shader.extensions[this.name];\n const bufferView = gltfRuntime.bufferViews[binaryExtensionShader.bufferView];\n const shaderBytes = GLTFUtils.GetBufferFromBufferView(gltfRuntime, bufferView, 0, bufferView.byteLength, EComponentType.UNSIGNED_BYTE);\n setTimeout(() => {\n const shaderString = GLTFUtils.DecodeBufferToText(shaderBytes);\n onSuccess(shaderString);\n });\n return true;\n }\n}\nGLTFLoader.RegisterExtension(new GLTFBinaryExtension());\n//# sourceMappingURL=glTFBinaryExtension.js.map","import { GLTFLoaderExtension, GLTFLoaderBase, GLTFLoader } from \"./glTFLoader.js\";\nimport { Vector3 } from \"@babylonjs/core/Maths/math.vector.js\";\nimport { Color3 } from \"@babylonjs/core/Maths/math.color.js\";\nimport { Tools } from \"@babylonjs/core/Misc/tools.js\";\nimport { Material } from \"@babylonjs/core/Materials/material.js\";\nimport { StandardMaterial } from \"@babylonjs/core/Materials/standardMaterial.js\";\nimport { HemisphericLight } from \"@babylonjs/core/Lights/hemisphericLight.js\";\nimport { DirectionalLight } from \"@babylonjs/core/Lights/directionalLight.js\";\nimport { PointLight } from \"@babylonjs/core/Lights/pointLight.js\";\nimport { SpotLight } from \"@babylonjs/core/Lights/spotLight.js\";\n/**\n * @internal\n * @deprecated\n */\nexport class GLTFMaterialsCommonExtension extends GLTFLoaderExtension {\n constructor() {\n super(\"KHR_materials_common\");\n }\n loadRuntimeExtensionsAsync(gltfRuntime) {\n if (!gltfRuntime.extensions) {\n return false;\n }\n const extension = gltfRuntime.extensions[this.name];\n if (!extension) {\n return false;\n }\n // Create lights\n const lights = extension.lights;\n if (lights) {\n for (const thing in lights) {\n const light = lights[thing];\n switch (light.type) {\n case \"ambient\": {\n const ambientLight = new HemisphericLight(light.name, new Vector3(0, 1, 0), gltfRuntime.scene);\n const ambient = light.ambient;\n if (ambient) {\n ambientLight.diffuse = Color3.FromArray(ambient.color || [1, 1, 1]);\n }\n break;\n }\n case \"point\": {\n const pointLight = new PointLight(light.name, new Vector3(10, 10, 10), gltfRuntime.scene);\n const point = light.point;\n if (point) {\n pointLight.diffuse = Color3.FromArray(point.color || [1, 1, 1]);\n }\n break;\n }\n case \"directional\": {\n const dirLight = new DirectionalLight(light.name, new Vector3(0, -1, 0), gltfRuntime.scene);\n const directional = light.directional;\n if (directional) {\n dirLight.diffuse = Color3.FromArray(directional.color || [1, 1, 1]);\n }\n break;\n }\n case \"spot\": {\n const spot = light.spot;\n if (spot) {\n const spotLight = new SpotLight(light.name, new Vector3(0, 10, 0), new Vector3(0, -1, 0), spot.fallOffAngle || Math.PI, spot.fallOffExponent || 0.0, gltfRuntime.scene);\n spotLight.diffuse = Color3.FromArray(spot.color || [1, 1, 1]);\n }\n break;\n }\n default:\n Tools.Warn('GLTF Material Common extension: light type \"' + light.type + \"” not supported\");\n break;\n }\n }\n }\n return false;\n }\n loadMaterialAsync(gltfRuntime, id, onSuccess, onError) {\n const material = gltfRuntime.materials[id];\n if (!material || !material.extensions) {\n return false;\n }\n const extension = material.extensions[this.name];\n if (!extension) {\n return false;\n }\n const standardMaterial = new StandardMaterial(id, gltfRuntime.scene);\n standardMaterial.sideOrientation = Material.CounterClockWiseSideOrientation;\n if (extension.technique === \"CONSTANT\") {\n standardMaterial.disableLighting = true;\n }\n standardMaterial.backFaceCulling = extension.doubleSided === undefined ? false : !extension.doubleSided;\n standardMaterial.alpha = extension.values.transparency === undefined ? 1.0 : extension.values.transparency;\n standardMaterial.specularPower = extension.values.shininess === undefined ? 0.0 : extension.values.shininess;\n // Ambient\n if (typeof extension.values.ambient === \"string\") {\n this._loadTexture(gltfRuntime, extension.values.ambient, standardMaterial, \"ambientTexture\", onError);\n }\n else {\n standardMaterial.ambientColor = Color3.FromArray(extension.values.ambient || [0, 0, 0]);\n }\n // Diffuse\n if (typeof extension.values.diffuse === \"string\") {\n this._loadTexture(gltfRuntime, extension.values.diffuse, standardMaterial, \"diffuseTexture\", onError);\n }\n else {\n standardMaterial.diffuseColor = Color3.FromArray(extension.values.diffuse || [0, 0, 0]);\n }\n // Emission\n if (typeof extension.values.emission === \"string\") {\n this._loadTexture(gltfRuntime, extension.values.emission, standardMaterial, \"emissiveTexture\", onError);\n }\n else {\n standardMaterial.emissiveColor = Color3.FromArray(extension.values.emission || [0, 0, 0]);\n }\n // Specular\n if (typeof extension.values.specular === \"string\") {\n this._loadTexture(gltfRuntime, extension.values.specular, standardMaterial, \"specularTexture\", onError);\n }\n else {\n standardMaterial.specularColor = Color3.FromArray(extension.values.specular || [0, 0, 0]);\n }\n return true;\n }\n _loadTexture(gltfRuntime, id, material, propertyPath, onError) {\n // Create buffer from texture url\n GLTFLoaderBase.LoadTextureBufferAsync(gltfRuntime, id, (buffer) => {\n // Create texture from buffer\n GLTFLoaderBase.CreateTextureAsync(gltfRuntime, id, buffer, (texture) => (material[propertyPath] = texture));\n }, onError);\n }\n}\nGLTFLoader.RegisterExtension(new GLTFMaterialsCommonExtension());\n//# sourceMappingURL=glTFMaterialsCommonExtension.js.map","/**\n * Wrapper class for promise with external resolve and reject.\n */\nexport class Deferred {\n /**\n * The resolve method of the promise associated with this deferred object.\n */\n get resolve() {\n return this._resolve;\n }\n /**\n * The reject method of the promise associated with this deferred object.\n */\n get reject() {\n return this._reject;\n }\n /**\n * Constructor for this deferred object.\n */\n constructor() {\n this.promise = new Promise((resolve, reject) => {\n this._resolve = resolve;\n this._reject = reject;\n });\n }\n}\n//# sourceMappingURL=deferred.js.map","import { Animation } from \"./animation.js\";\nimport { Observable } from \"../Misc/observable.js\";\nimport { EngineStore } from \"../Engines/engineStore.js\";\nimport { Tags } from \"../Misc/tags.js\";\n/**\n * This class defines the direct association between an animation and a target\n */\nexport class TargetedAnimation {\n /**\n * Returns the string \"TargetedAnimation\"\n * @returns \"TargetedAnimation\"\n */\n getClassName() {\n return \"TargetedAnimation\";\n }\n /**\n * Serialize the object\n * @returns the JSON object representing the current entity\n */\n serialize() {\n const serializationObject = {};\n serializationObject.animation = this.animation.serialize();\n serializationObject.targetId = this.target.id;\n return serializationObject;\n }\n}\n/**\n * Use this class to create coordinated animations on multiple targets\n */\nexport class AnimationGroup {\n /**\n * Makes sure that the animations are either played or stopped according to the animation group mask.\n * Note however that the call won't have any effect if the animation group has not been started yet.\n * You should call this function if you modify the mask after the animation group has been started.\n */\n syncWithMask() {\n if (!this.mask) {\n return;\n }\n for (let i = 0; i < this._animatables.length; ++i) {\n const animatable = this._animatables[i];\n if (this.mask.retainsTarget(animatable.target.name)) {\n if (animatable.paused) {\n animatable.restart();\n }\n }\n else {\n if (!animatable.paused) {\n animatable.pause();\n }\n }\n }\n }\n /**\n * Removes all animations for the targets not retained by the animation group mask.\n * Use this function if you know you won't need those animations anymore and if you want to free memory.\n */\n removeUnmaskedAnimations() {\n if (!this.mask) {\n return;\n }\n // Removes all animatables (in case the animation group has already been started)\n for (let i = 0; i < this._animatables.length; ++i) {\n const animatable = this._animatables[i];\n if (!this.mask.retainsTarget(animatable.target.name)) {\n animatable.stop();\n this._animatables.splice(i, 1);\n --i;\n }\n }\n // Removes the targeted animations\n for (let index = 0; index < this._targetedAnimations.length; index++) {\n const targetedAnimation = this._targetedAnimations[index];\n if (!this.mask.retainsTarget(targetedAnimation.target.name)) {\n this._targetedAnimations.splice(index, 1);\n --index;\n }\n }\n }\n /**\n * Gets the first frame\n */\n get from() {\n return this._from;\n }\n /**\n * Gets the last frame\n */\n get to() {\n return this._to;\n }\n /**\n * Define if the animations are started\n */\n get isStarted() {\n return this._isStarted;\n }\n /**\n * Gets a value indicating that the current group is playing\n */\n get isPlaying() {\n return this._isStarted && !this._isPaused;\n }\n /**\n * Gets or sets the speed ratio to use for all animations\n */\n get speedRatio() {\n return this._speedRatio;\n }\n /**\n * Gets or sets the speed ratio to use for all animations\n */\n set speedRatio(value) {\n if (this._speedRatio === value) {\n return;\n }\n this._speedRatio = value;\n for (let index = 0; index < this._animatables.length; index++) {\n const animatable = this._animatables[index];\n animatable.speedRatio = this._speedRatio;\n }\n }\n /**\n * Gets or sets if all animations should loop or not\n */\n get loopAnimation() {\n return this._loopAnimation;\n }\n set loopAnimation(value) {\n if (this._loopAnimation === value) {\n return;\n }\n this._loopAnimation = value;\n for (let index = 0; index < this._animatables.length; index++) {\n const animatable = this._animatables[index];\n animatable.loopAnimation = this._loopAnimation;\n }\n }\n /**\n * Gets or sets if all animations should be evaluated additively\n */\n get isAdditive() {\n return this._isAdditive;\n }\n set isAdditive(value) {\n if (this._isAdditive === value) {\n return;\n }\n this._isAdditive = value;\n for (let index = 0; index < this._animatables.length; index++) {\n const animatable = this._animatables[index];\n animatable.isAdditive = this._isAdditive;\n }\n }\n /**\n * Gets or sets the weight to apply to all animations of the group\n */\n get weight() {\n return this._weight;\n }\n set weight(value) {\n if (this._weight === value) {\n return;\n }\n this._weight = value;\n this.setWeightForAllAnimatables(this._weight);\n }\n /**\n * Gets the targeted animations for this animation group\n */\n get targetedAnimations() {\n return this._targetedAnimations;\n }\n /**\n * returning the list of animatables controlled by this animation group.\n */\n get animatables() {\n return this._animatables;\n }\n /**\n * Gets the list of target animations\n */\n get children() {\n return this._targetedAnimations;\n }\n /**\n * Gets or sets the order of play of the animation group (default: 0)\n */\n get playOrder() {\n return this._playOrder;\n }\n set playOrder(value) {\n if (this._playOrder === value) {\n return;\n }\n this._playOrder = value;\n if (this._animatables.length > 0) {\n for (let i = 0; i < this._animatables.length; i++) {\n this._animatables[i].playOrder = this._playOrder;\n }\n this._scene.sortActiveAnimatables();\n }\n }\n /**\n * Allows the animations of the animation group to blend with current running animations\n * Note that a null value means that each animation will use their own existing blending configuration (Animation.enableBlending)\n */\n get enableBlending() {\n return this._enableBlending;\n }\n set enableBlending(value) {\n if (this._enableBlending === value) {\n return;\n }\n this._enableBlending = value;\n if (value !== null) {\n for (let i = 0; i < this._targetedAnimations.length; ++i) {\n this._targetedAnimations[i].animation.enableBlending = value;\n }\n }\n }\n /**\n * Gets or sets the animation blending speed\n * Note that a null value means that each animation will use their own existing blending configuration (Animation.blendingSpeed)\n */\n get blendingSpeed() {\n return this._blendingSpeed;\n }\n set blendingSpeed(value) {\n if (this._blendingSpeed === value) {\n return;\n }\n this._blendingSpeed = value;\n if (value !== null) {\n for (let i = 0; i < this._targetedAnimations.length; ++i) {\n this._targetedAnimations[i].animation.blendingSpeed = value;\n }\n }\n }\n /**\n * Merge the array of animation groups into a new animation group\n * @param animationGroups List of animation groups to merge\n * @param disposeSource If true, animation groups will be disposed after being merged (default: true)\n * @param normalize If true, animation groups will be normalized before being merged, so that all animations have the same \"from\" and \"to\" frame (default: false)\n * @param weight Weight for the new animation group. If not provided, it will inherit the weight from the first animation group of the array\n * @returns The new animation group or null if no animation groups were passed\n */\n static MergeAnimationGroups(animationGroups, disposeSource = true, normalize = false, weight) {\n if (animationGroups.length === 0) {\n return null;\n }\n weight = weight !== null && weight !== void 0 ? weight : animationGroups[0].weight;\n let beginFrame = Number.MAX_VALUE;\n let endFrame = -Number.MAX_VALUE;\n if (normalize) {\n for (const animationGroup of animationGroups) {\n if (animationGroup.from < beginFrame) {\n beginFrame = animationGroup.from;\n }\n if (animationGroup.to > endFrame) {\n endFrame = animationGroup.to;\n }\n }\n }\n const mergedAnimationGroup = new AnimationGroup(animationGroups[0].name + \"_merged\", animationGroups[0]._scene, weight);\n for (const animationGroup of animationGroups) {\n if (normalize) {\n animationGroup.normalize(beginFrame, endFrame);\n }\n for (const targetedAnimation of animationGroup.targetedAnimations) {\n mergedAnimationGroup.addTargetedAnimation(targetedAnimation.animation, targetedAnimation.target);\n }\n if (disposeSource) {\n animationGroup.dispose();\n }\n }\n return mergedAnimationGroup;\n }\n /**\n * Instantiates a new Animation Group.\n * This helps managing several animations at once.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/groupAnimations\n * @param name Defines the name of the group\n * @param scene Defines the scene the group belongs to\n * @param weight Defines the weight to use for animations in the group (-1.0 by default, meaning \"no weight\")\n * @param playOrder Defines the order of play of the animation group (default is 0)\n */\n constructor(\n /** The name of the animation group */\n name, scene = null, weight = -1, playOrder = 0) {\n this.name = name;\n this._targetedAnimations = new Array();\n this._animatables = new Array();\n this._from = Number.MAX_VALUE;\n this._to = -Number.MAX_VALUE;\n this._speedRatio = 1;\n this._loopAnimation = false;\n this._isAdditive = false;\n this._weight = -1;\n this._playOrder = 0;\n this._enableBlending = null;\n this._blendingSpeed = null;\n /** @internal */\n this._parentContainer = null;\n /**\n * This observable will notify when one animation have ended\n */\n this.onAnimationEndObservable = new Observable();\n /**\n * Observer raised when one animation loops\n */\n this.onAnimationLoopObservable = new Observable();\n /**\n * Observer raised when all animations have looped\n */\n this.onAnimationGroupLoopObservable = new Observable();\n /**\n * This observable will notify when all animations have ended.\n */\n this.onAnimationGroupEndObservable = new Observable();\n /**\n * This observable will notify when all animations have paused.\n */\n this.onAnimationGroupPauseObservable = new Observable();\n /**\n * This observable will notify when all animations are playing.\n */\n this.onAnimationGroupPlayObservable = new Observable();\n /**\n * Gets or sets an object used to store user defined information for the node\n */\n this.metadata = null;\n this._animationLoopFlags = [];\n this._scene = scene || EngineStore.LastCreatedScene;\n this._weight = weight;\n this._playOrder = playOrder;\n this.uniqueId = this._scene.getUniqueId();\n this._scene.addAnimationGroup(this);\n }\n /**\n * Add an animation (with its target) in the group\n * @param animation defines the animation we want to add\n * @param target defines the target of the animation\n * @returns the TargetedAnimation object\n */\n addTargetedAnimation(animation, target) {\n const targetedAnimation = new TargetedAnimation();\n targetedAnimation.animation = animation;\n targetedAnimation.target = target;\n const keys = animation.getKeys();\n if (this._from > keys[0].frame) {\n this._from = keys[0].frame;\n }\n if (this._to < keys[keys.length - 1].frame) {\n this._to = keys[keys.length - 1].frame;\n }\n if (this._enableBlending !== null) {\n animation.enableBlending = this._enableBlending;\n }\n if (this._blendingSpeed !== null) {\n animation.blendingSpeed = this._blendingSpeed;\n }\n this._targetedAnimations.push(targetedAnimation);\n return targetedAnimation;\n }\n /**\n * Remove an animation from the group\n * @param animation defines the animation we want to remove\n */\n removeTargetedAnimation(animation) {\n for (let index = this._targetedAnimations.length - 1; index > -1; index--) {\n const targetedAnimation = this._targetedAnimations[index];\n if (targetedAnimation.animation === animation) {\n this._targetedAnimations.splice(index, 1);\n }\n }\n }\n /**\n * This function will normalize every animation in the group to make sure they all go from beginFrame to endFrame\n * It can add constant keys at begin or end\n * @param beginFrame defines the new begin frame for all animations or the smallest begin frame of all animations if null (defaults to null)\n * @param endFrame defines the new end frame for all animations or the largest end frame of all animations if null (defaults to null)\n * @returns the animation group\n */\n normalize(beginFrame = null, endFrame = null) {\n if (beginFrame == null) {\n beginFrame = this._from;\n }\n if (endFrame == null) {\n endFrame = this._to;\n }\n for (let index = 0; index < this._targetedAnimations.length; index++) {\n const targetedAnimation = this._targetedAnimations[index];\n const keys = targetedAnimation.animation.getKeys();\n const startKey = keys[0];\n const endKey = keys[keys.length - 1];\n if (startKey.frame > beginFrame) {\n const newKey = {\n frame: beginFrame,\n value: startKey.value,\n inTangent: startKey.inTangent,\n outTangent: startKey.outTangent,\n interpolation: startKey.interpolation,\n };\n keys.splice(0, 0, newKey);\n }\n if (endKey.frame < endFrame) {\n const newKey = {\n frame: endFrame,\n value: endKey.value,\n inTangent: endKey.inTangent,\n outTangent: endKey.outTangent,\n interpolation: endKey.interpolation,\n };\n keys.push(newKey);\n }\n }\n this._from = beginFrame;\n this._to = endFrame;\n return this;\n }\n _processLoop(animatable, targetedAnimation, index) {\n animatable.onAnimationLoop = () => {\n this.onAnimationLoopObservable.notifyObservers(targetedAnimation);\n if (this._animationLoopFlags[index]) {\n return;\n }\n this._animationLoopFlags[index] = true;\n this._animationLoopCount++;\n if (this._animationLoopCount === this._targetedAnimations.length) {\n this.onAnimationGroupLoopObservable.notifyObservers(this);\n this._animationLoopCount = 0;\n this._animationLoopFlags.length = 0;\n }\n };\n }\n /**\n * Start all animations on given targets\n * @param loop defines if animations must loop\n * @param speedRatio defines the ratio to apply to animation speed (1 by default)\n * @param from defines the from key (optional)\n * @param to defines the to key (optional)\n * @param isAdditive defines the additive state for the resulting animatables (optional)\n * @returns the current animation group\n */\n start(loop = false, speedRatio = 1, from, to, isAdditive) {\n if (this._isStarted || this._targetedAnimations.length === 0) {\n return this;\n }\n this._loopAnimation = loop;\n this._animationLoopCount = 0;\n this._animationLoopFlags.length = 0;\n for (let index = 0; index < this._targetedAnimations.length; index++) {\n const targetedAnimation = this._targetedAnimations[index];\n const animatable = this._scene.beginDirectAnimation(targetedAnimation.target, [targetedAnimation.animation], from !== undefined ? from : this._from, to !== undefined ? to : this._to, loop, speedRatio, undefined, undefined, isAdditive !== undefined ? isAdditive : this._isAdditive);\n animatable.weight = this._weight;\n animatable.playOrder = this._playOrder;\n animatable.onAnimationEnd = () => {\n this.onAnimationEndObservable.notifyObservers(targetedAnimation);\n this._checkAnimationGroupEnded(animatable);\n };\n this._processLoop(animatable, targetedAnimation, index);\n this._animatables.push(animatable);\n }\n this.syncWithMask();\n this._scene.sortActiveAnimatables();\n this._speedRatio = speedRatio;\n this._isStarted = true;\n this._isPaused = false;\n this.onAnimationGroupPlayObservable.notifyObservers(this);\n return this;\n }\n /**\n * Pause all animations\n * @returns the animation group\n */\n pause() {\n if (!this._isStarted) {\n return this;\n }\n this._isPaused = true;\n for (let index = 0; index < this._animatables.length; index++) {\n const animatable = this._animatables[index];\n animatable.pause();\n }\n this.onAnimationGroupPauseObservable.notifyObservers(this);\n return this;\n }\n /**\n * Play all animations to initial state\n * This function will start() the animations if they were not started or will restart() them if they were paused\n * @param loop defines if animations must loop\n * @returns the animation group\n */\n play(loop) {\n // only if all animatables are ready and exist\n if (this.isStarted && this._animatables.length === this._targetedAnimations.length) {\n if (loop !== undefined) {\n this.loopAnimation = loop;\n }\n this.restart();\n }\n else {\n this.stop();\n this.start(loop, this._speedRatio);\n }\n this._isPaused = false;\n return this;\n }\n /**\n * Reset all animations to initial state\n * @returns the animation group\n */\n reset() {\n if (!this._isStarted) {\n this.play();\n this.goToFrame(0);\n this.stop();\n return this;\n }\n for (let index = 0; index < this._animatables.length; index++) {\n const animatable = this._animatables[index];\n animatable.reset();\n }\n return this;\n }\n /**\n * Restart animations from key 0\n * @returns the animation group\n */\n restart() {\n if (!this._isStarted) {\n return this;\n }\n for (let index = 0; index < this._animatables.length; index++) {\n const animatable = this._animatables[index];\n animatable.restart();\n }\n this.onAnimationGroupPlayObservable.notifyObservers(this);\n return this;\n }\n /**\n * Stop all animations\n * @returns the animation group\n */\n stop() {\n if (!this._isStarted) {\n return this;\n }\n const list = this._animatables.slice();\n for (let index = 0; index < list.length; index++) {\n list[index].stop(undefined, undefined, true);\n }\n // We will take care of removing all stopped animatables\n let curIndex = 0;\n for (let index = 0; index < this._scene._activeAnimatables.length; index++) {\n const animatable = this._scene._activeAnimatables[index];\n if (animatable._runtimeAnimations.length > 0) {\n this._scene._activeAnimatables[curIndex++] = animatable;\n }\n }\n this._scene._activeAnimatables.length = curIndex;\n this._isStarted = false;\n return this;\n }\n /**\n * Set animation weight for all animatables\n *\n * @since 6.12.4\n * You can pass the weight to the AnimationGroup constructor, or use the weight property to set it after the group has been created,\n * making it easier to define the overall animation weight than calling setWeightForAllAnimatables() after the animation group has been started\n * @param weight defines the weight to use\n * @returns the animationGroup\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#animation-weights\n */\n setWeightForAllAnimatables(weight) {\n for (let index = 0; index < this._animatables.length; index++) {\n const animatable = this._animatables[index];\n animatable.weight = weight;\n }\n return this;\n }\n /**\n * Synchronize and normalize all animatables with a source animatable\n * @param root defines the root animatable to synchronize with (null to stop synchronizing)\n * @returns the animationGroup\n * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#animation-weights\n */\n syncAllAnimationsWith(root) {\n for (let index = 0; index < this._animatables.length; index++) {\n const animatable = this._animatables[index];\n animatable.syncWith(root);\n }\n return this;\n }\n /**\n * Goes to a specific frame in this animation group\n * @param frame the frame number to go to\n * @returns the animationGroup\n */\n goToFrame(frame) {\n if (!this._isStarted) {\n return this;\n }\n for (let index = 0; index < this._animatables.length; index++) {\n const animatable = this._animatables[index];\n animatable.goToFrame(frame);\n }\n return this;\n }\n /**\n * Dispose all associated resources\n */\n dispose() {\n this._targetedAnimations.length = 0;\n this._animatables.length = 0;\n // Remove from scene\n const index = this._scene.animationGroups.indexOf(this);\n if (index > -1) {\n this._scene.animationGroups.splice(index, 1);\n }\n if (this._parentContainer) {\n const index = this._parentContainer.animationGroups.indexOf(this);\n if (index > -1) {\n this._parentContainer.animationGroups.splice(index, 1);\n }\n this._parentContainer = null;\n }\n this.onAnimationEndObservable.clear();\n this.onAnimationGroupEndObservable.clear();\n this.onAnimationGroupPauseObservable.clear();\n this.onAnimationGroupPlayObservable.clear();\n this.onAnimationLoopObservable.clear();\n this.onAnimationGroupLoopObservable.clear();\n }\n _checkAnimationGroupEnded(animatable) {\n // animatable should be taken out of the array\n const idx = this._animatables.indexOf(animatable);\n if (idx > -1) {\n this._animatables.splice(idx, 1);\n }\n // all animatables were removed? animation group ended!\n if (this._animatables.length === 0) {\n this._isStarted = false;\n this.onAnimationGroupEndObservable.notifyObservers(this);\n }\n }\n /**\n * Clone the current animation group and returns a copy\n * @param newName defines the name of the new group\n * @param targetConverter defines an optional function used to convert current animation targets to new ones\n * @param cloneAnimations defines if the animations should be cloned or referenced\n * @returns the new animation group\n */\n clone(newName, targetConverter, cloneAnimations = false) {\n const newGroup = new AnimationGroup(newName || this.name, this._scene, this._weight, this._playOrder);\n newGroup._from = this.from;\n newGroup._to = this.to;\n newGroup._speedRatio = this.speedRatio;\n newGroup._loopAnimation = this.loopAnimation;\n newGroup._isAdditive = this.isAdditive;\n newGroup._enableBlending = this.enableBlending;\n newGroup._blendingSpeed = this.blendingSpeed;\n newGroup.metadata = this.metadata;\n newGroup.mask = this.mask;\n for (const targetAnimation of this._targetedAnimations) {\n newGroup.addTargetedAnimation(cloneAnimations ? targetAnimation.animation.clone() : targetAnimation.animation, targetConverter ? targetConverter(targetAnimation.target) : targetAnimation.target);\n }\n return newGroup;\n }\n /**\n * Serializes the animationGroup to an object\n * @returns Serialized object\n */\n serialize() {\n const serializationObject = {};\n serializationObject.name = this.name;\n serializationObject.from = this.from;\n serializationObject.to = this.to;\n serializationObject.speedRatio = this.speedRatio;\n serializationObject.loopAnimation = this.loopAnimation;\n serializationObject.isAdditive = this.isAdditive;\n serializationObject.weight = this.weight;\n serializationObject.playOrder = this.playOrder;\n serializationObject.enableBlending = this.enableBlending;\n serializationObject.blendingSpeed = this.blendingSpeed;\n serializationObject.targetedAnimations = [];\n for (let targetedAnimationIndex = 0; targetedAnimationIndex < this.targetedAnimations.length; targetedAnimationIndex++) {\n const targetedAnimation = this.targetedAnimations[targetedAnimationIndex];\n serializationObject.targetedAnimations[targetedAnimationIndex] = targetedAnimation.serialize();\n }\n if (Tags && Tags.HasTags(this)) {\n serializationObject.tags = Tags.GetTags(this);\n }\n // Metadata\n if (this.metadata) {\n serializationObject.metadata = this.metadata;\n }\n return serializationObject;\n }\n // Statics\n /**\n * Returns a new AnimationGroup object parsed from the source provided.\n * @param parsedAnimationGroup defines the source\n * @param scene defines the scene that will receive the animationGroup\n * @returns a new AnimationGroup\n */\n static Parse(parsedAnimationGroup, scene) {\n const animationGroup = new AnimationGroup(parsedAnimationGroup.name, scene, parsedAnimationGroup.weight, parsedAnimationGroup.playOrder);\n for (let i = 0; i < parsedAnimationGroup.targetedAnimations.length; i++) {\n const targetedAnimation = parsedAnimationGroup.targetedAnimations[i];\n const animation = Animation.Parse(targetedAnimation.animation);\n const id = targetedAnimation.targetId;\n if (targetedAnimation.animation.property === \"influence\") {\n // morph target animation\n const morphTarget = scene.getMorphTargetById(id);\n if (morphTarget) {\n animationGroup.addTargetedAnimation(animation, morphTarget);\n }\n }\n else {\n const targetNode = scene.getNodeById(id);\n if (targetNode != null) {\n animationGroup.addTargetedAnimation(animation, targetNode);\n }\n }\n }\n if (Tags) {\n Tags.AddTagsTo(animationGroup, parsedAnimationGroup.tags);\n }\n if (parsedAnimationGroup.from !== null && parsedAnimationGroup.to !== null) {\n animationGroup.normalize(parsedAnimationGroup.from, parsedAnimationGroup.to);\n }\n if (parsedAnimationGroup.speedRatio !== undefined) {\n animationGroup._speedRatio = parsedAnimationGroup.speedRatio;\n }\n if (parsedAnimationGroup.loopAnimation !== undefined) {\n animationGroup._loopAnimation = parsedAnimationGroup.loopAnimation;\n }\n if (parsedAnimationGroup.isAdditive !== undefined) {\n animationGroup._isAdditive = parsedAnimationGroup.isAdditive;\n }\n if (parsedAnimationGroup.weight !== undefined) {\n animationGroup._weight = parsedAnimationGroup.weight;\n }\n if (parsedAnimationGroup.playOrder !== undefined) {\n animationGroup._playOrder = parsedAnimationGroup.playOrder;\n }\n if (parsedAnimationGroup.enableBlending !== undefined) {\n animationGroup._enableBlending = parsedAnimationGroup.enableBlending;\n }\n if (parsedAnimationGroup.blendingSpeed !== undefined) {\n animationGroup._blendingSpeed = parsedAnimationGroup.blendingSpeed;\n }\n if (parsedAnimationGroup.metadata !== undefined) {\n animationGroup.metadata = parsedAnimationGroup.metadata;\n }\n return animationGroup;\n }\n /** @internal */\n static MakeAnimationAdditive(sourceAnimationGroup, referenceFrameOrOptions, range, cloneOriginal = false, clonedName) {\n let options;\n if (typeof referenceFrameOrOptions === \"object\") {\n options = referenceFrameOrOptions;\n }\n else {\n options = {\n referenceFrame: referenceFrameOrOptions,\n range: range,\n cloneOriginalAnimationGroup: cloneOriginal,\n clonedAnimationName: clonedName,\n };\n }\n let animationGroup = sourceAnimationGroup;\n if (options.cloneOriginalAnimationGroup) {\n animationGroup = sourceAnimationGroup.clone(options.clonedAnimationGroupName || animationGroup.name);\n }\n const targetedAnimations = animationGroup.targetedAnimations;\n for (let index = 0; index < targetedAnimations.length; index++) {\n const targetedAnimation = targetedAnimations[index];\n targetedAnimation.animation = Animation.MakeAnimationAdditive(targetedAnimation.animation, options);\n }\n animationGroup.isAdditive = true;\n if (options.clipKeys) {\n // We need to recalculate the from/to frames for the animation group because some keys may have been removed\n let from = Number.MAX_VALUE;\n let to = -Number.MAX_VALUE;\n const targetedAnimations = animationGroup.targetedAnimations;\n for (let index = 0; index < targetedAnimations.length; index++) {\n const targetedAnimation = targetedAnimations[index];\n const animation = targetedAnimation.animation;\n const keys = animation.getKeys();\n if (from > keys[0].frame) {\n from = keys[0].frame;\n }\n if (to < keys[keys.length - 1].frame) {\n to = keys[keys.length - 1].frame;\n }\n }\n animationGroup._from = from;\n animationGroup._to = to;\n }\n return animationGroup;\n }\n /**\n * Creates a new animation, keeping only the keys that are inside a given key range\n * @param sourceAnimationGroup defines the animation group on which to operate\n * @param fromKey defines the lower bound of the range\n * @param toKey defines the upper bound of the range\n * @param name defines the name of the new animation group. If not provided, use the same name as animationGroup\n * @param dontCloneAnimations defines whether or not the animations should be cloned before clipping the keys. Default is false, so animations will be cloned\n * @returns a new animation group stripped from all the keys outside the given range\n */\n static ClipKeys(sourceAnimationGroup, fromKey, toKey, name, dontCloneAnimations) {\n const animationGroup = sourceAnimationGroup.clone(name || sourceAnimationGroup.name);\n return AnimationGroup.ClipKeysInPlace(animationGroup, fromKey, toKey, dontCloneAnimations);\n }\n /**\n * Updates an existing animation, keeping only the keys that are inside a given key range\n * @param animationGroup defines the animation group on which to operate\n * @param fromKey defines the lower bound of the range\n * @param toKey defines the upper bound of the range\n * @param dontCloneAnimations defines whether or not the animations should be cloned before clipping the keys. Default is false, so animations will be cloned\n * @returns the animationGroup stripped from all the keys outside the given range\n */\n static ClipKeysInPlace(animationGroup, fromKey, toKey, dontCloneAnimations) {\n return AnimationGroup.ClipInPlace(animationGroup, fromKey, toKey, dontCloneAnimations, false);\n }\n /**\n * Creates a new animation, keeping only the frames that are inside a given frame range\n * @param sourceAnimationGroup defines the animation group on which to operate\n * @param fromFrame defines the lower bound of the range\n * @param toFrame defines the upper bound of the range\n * @param name defines the name of the new animation group. If not provided, use the same name as animationGroup\n * @param dontCloneAnimations defines whether or not the animations should be cloned before clipping the frames. Default is false, so animations will be cloned\n * @returns a new animation group stripped from all the frames outside the given range\n */\n static ClipFrames(sourceAnimationGroup, fromFrame, toFrame, name, dontCloneAnimations) {\n const animationGroup = sourceAnimationGroup.clone(name || sourceAnimationGroup.name);\n return AnimationGroup.ClipFramesInPlace(animationGroup, fromFrame, toFrame, dontCloneAnimations);\n }\n /**\n * Updates an existing animation, keeping only the frames that are inside a given frame range\n * @param animationGroup defines the animation group on which to operate\n * @param fromFrame defines the lower bound of the range\n * @param toFrame defines the upper bound of the range\n * @param dontCloneAnimations defines whether or not the animations should be cloned before clipping the frames. Default is false, so animations will be cloned\n * @returns the animationGroup stripped from all the frames outside the given range\n */\n static ClipFramesInPlace(animationGroup, fromFrame, toFrame, dontCloneAnimations) {\n return AnimationGroup.ClipInPlace(animationGroup, fromFrame, toFrame, dontCloneAnimations, true);\n }\n /**\n * Updates an existing animation, keeping only the keys that are inside a given key or frame range\n * @param animationGroup defines the animation group on which to operate\n * @param start defines the lower bound of the range\n * @param end defines the upper bound of the range\n * @param dontCloneAnimations defines whether or not the animations should be cloned before clipping the keys. Default is false, so animations will be cloned\n * @param useFrame defines if the range is defined by frame numbers or key indices (default is false which means use key indices)\n * @returns the animationGroup stripped from all the keys outside the given range\n */\n static ClipInPlace(animationGroup, start, end, dontCloneAnimations, useFrame = false) {\n let from = Number.MAX_VALUE;\n let to = -Number.MAX_VALUE;\n const targetedAnimations = animationGroup.targetedAnimations;\n for (let index = 0; index < targetedAnimations.length; index++) {\n const targetedAnimation = targetedAnimations[index];\n const animation = dontCloneAnimations ? targetedAnimation.animation : targetedAnimation.animation.clone();\n if (useFrame) {\n // Make sure we have keys corresponding to the bounds of the frame range\n animation.createKeyForFrame(start);\n animation.createKeyForFrame(end);\n }\n const keys = animation.getKeys();\n const newKeys = [];\n let startFrame = Number.MAX_VALUE;\n for (let k = 0; k < keys.length; k++) {\n const key = keys[k];\n if ((!useFrame && k >= start && k <= end) || (useFrame && key.frame >= start && key.frame <= end)) {\n const newKey = {\n frame: key.frame,\n value: key.value.clone ? key.value.clone() : key.value,\n inTangent: key.inTangent,\n outTangent: key.outTangent,\n interpolation: key.interpolation,\n lockedTangent: key.lockedTangent,\n };\n if (startFrame === Number.MAX_VALUE) {\n startFrame = newKey.frame;\n }\n newKey.frame -= startFrame;\n newKeys.push(newKey);\n }\n }\n if (newKeys.length === 0) {\n targetedAnimations.splice(index, 1);\n index--;\n continue;\n }\n if (from > newKeys[0].frame) {\n from = newKeys[0].frame;\n }\n if (to < newKeys[newKeys.length - 1].frame) {\n to = newKeys[newKeys.length - 1].frame;\n }\n animation.setKeys(newKeys, true);\n targetedAnimation.animation = animation; // in case the animation has been cloned\n }\n animationGroup._from = from;\n animationGroup._to = to;\n return animationGroup;\n }\n /**\n * Returns the string \"AnimationGroup\"\n * @returns \"AnimationGroup\"\n */\n getClassName() {\n return \"AnimationGroup\";\n }\n /**\n * Creates a detailed string about the object\n * @param fullDetails defines if the output string will support multiple levels of logging within scene loading\n * @returns a string representing the object\n */\n toString(fullDetails) {\n let ret = \"Name: \" + this.name;\n ret += \", type: \" + this.getClassName();\n if (fullDetails) {\n ret += \", from: \" + this._from;\n ret += \", to: \" + this._to;\n ret += \", isStarted: \" + this._isStarted;\n ret += \", speedRatio: \" + this._speedRatio;\n ret += \", targetedAnimations length: \" + this._targetedAnimations.length;\n ret += \", animatables length: \" + this._animatables;\n }\n return ret;\n }\n}\n//# sourceMappingURL=animationGroup.js.map","import { Texture } from \"../Materials/Textures/texture.js\";\nimport { RGBDTextureTools } from \"./rgbdTextureTools.js\";\nimport { Tools } from \"./tools.js\";\n// eslint-disable-next-line @typescript-eslint/naming-convention\nconst _environmentBRDFBase64Texture = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAgAElEQVR42u29yY5tWXIlZnbuiSaTbZFUkZRKrCKhElASQA0EoQABgn6hJvoXzfUP+gP9hWb6Bg00IgRoQJaKqUxmZmTEe8/v0uB2u7Fm2T7HIyIrnz88uPvt3f2a2WrMbOvf/u3PvvzP/sUf/N6//i8vf/lv/3v5H//d//Sb//Uq/5u8yf8hV/m/5Cp/L1f5hVzlG7nKJ7mKyJuIXN/hPwqXI/g++zq6rPI5u8z+WqfLre+zy7PrVv9L8brsMiGvk8XLmM/sdfHXal4e3ad6GXPdyu2ij8u/+uv/5cuf/OSLfdtEfvUr+dnf/d0X//t3H/7bf/hP//N/928h/0Yg/4VA/kogfyGQP5Wr/IFAvhbIlwK5CGQTPP+9z5uPeePJSW+yo2+s/GtN30Rnv1E+f5zxof9R/lSXv/nr//mrr3+i+5dfyX7ZZQP07Tffys//8R/l/9TtX7790T/7r/8G8pdy+/8XAvnnAvkzgfwzgfyxQP5AIL8vkJ8K5KsmMVzu1U7p5PA5AXxOAJ8TwPf7sX/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90BMEzFYHdg2GAgeYVHMMJIBTA7EFTx/5fpgTFXz9w/en0ZjD8kCDoKPNGwlB01BmoWQbh+AxR689mBponGJOr9OwmMu3dtJ/ylW1Tik4ElUPmR9RqII+pVhD9ychABMQ51gOIZg+/G+5mGIzLB1JJC5WhzYjhJ7IWmLDpA8jzsAafUPkB2WnFBF4iSxkq1ty7f25rv/+EQLOxs2oUdTSA9HIR9swdBlCcFe9owPC3XWDDC0ISVzsEVbSCF/sWdA5Fu4HJqankp2SeQCYYrImNalfmhpVxYrGkUS4LeSUjg8dD7+D7w/ybIfy7vlB9/HJ978zr7/45Qgajzj+4EjIK/ULHPRAOlKr/aG0AFcqCyu0GcW45Igh6JMJmhA49/U+cEssHNJhtXDC1MOya3j/sAiAGcrEtqtgjBD6wEzSDc7D8o6C8rIqAZyPk+NQoNLAZ1hR64Yl1FBY648smUYKnSg1Xwk/0DyRyArByMUobyByhCcPnOaPyoegREFS4jNfYAw+IHCjdC1J2WDZBke/OyN85J24WiXwDYPoJyYuCD238ulvuzwt6KgHf0shWKsqCFFGjB/w8HU8eeTED9wAAAAABJRU5ErkJggg==\";\nlet _instanceNumber = 0;\n/**\n * Gets a default environment BRDF for MS-BRDF Height Correlated BRDF\n * @param scene defines the hosting scene\n * @returns the environment BRDF texture\n */\nexport const GetEnvironmentBRDFTexture = (scene) => {\n if (!scene.environmentBRDFTexture) {\n // Forces Delayed Texture Loading to prevent undefined error whilst setting RGBD values.\n const useDelayedTextureLoading = scene.useDelayedTextureLoading;\n scene.useDelayedTextureLoading = false;\n const previousState = scene._blockEntityCollection;\n scene._blockEntityCollection = false;\n const texture = Texture.CreateFromBase64String(_environmentBRDFBase64Texture, \"EnvironmentBRDFTexture\" + _instanceNumber++, scene, true, false, Texture.BILINEAR_SAMPLINGMODE);\n scene._blockEntityCollection = previousState;\n // BRDF Texture should not be cached here due to pre processing and redundant scene caches.\n const texturesCache = scene.getEngine().getLoadedTexturesCache();\n const index = texturesCache.indexOf(texture.getInternalTexture());\n if (index !== -1) {\n texturesCache.splice(index, 1);\n }\n texture.isRGBD = true;\n texture.wrapU = Texture.CLAMP_ADDRESSMODE;\n texture.wrapV = Texture.CLAMP_ADDRESSMODE;\n scene.environmentBRDFTexture = texture;\n scene.useDelayedTextureLoading = useDelayedTextureLoading;\n RGBDTextureTools.ExpandRGBDTexture(texture);\n const observer = scene.getEngine().onContextRestoredObservable.add(() => {\n texture.isRGBD = true;\n const checkReady = () => {\n if (texture.isReady()) {\n RGBDTextureTools.ExpandRGBDTexture(texture);\n }\n else {\n Tools.SetImmediate(checkReady);\n }\n };\n checkReady();\n });\n scene.onDisposeObservable.add(() => {\n scene.getEngine().onContextRestoredObservable.remove(observer);\n });\n }\n return scene.environmentBRDFTexture;\n};\n/**\n * Class used to host texture specific utilities\n */\nexport const BRDFTextureTools = {\n /**\n * Gets a default environment BRDF for MS-BRDF Height Correlated BRDF\n * @param scene defines the hosting scene\n * @returns the environment BRDF texture\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n GetEnvironmentBRDFTexture,\n};\n//# sourceMappingURL=brdfTextureTools.js.map","import { __decorate } from \"../../tslib.es6.js\";\n/* eslint-disable @typescript-eslint/naming-convention */\n\nimport { serialize, expandToProperty } from \"../../Misc/decorators.js\";\nimport { MaterialDefines } from \"../materialDefines.js\";\nimport { MaterialPluginBase } from \"../materialPluginBase.js\";\n/**\n * @internal\n */\nexport class MaterialBRDFDefines extends MaterialDefines {\n constructor() {\n super(...arguments);\n this.BRDF_V_HEIGHT_CORRELATED = false;\n this.MS_BRDF_ENERGY_CONSERVATION = false;\n this.SPHERICAL_HARMONICS = false;\n this.SPECULAR_GLOSSINESS_ENERGY_CONSERVATION = false;\n }\n}\n/**\n * Plugin that implements the BRDF component of the PBR material\n */\nexport class PBRBRDFConfiguration extends MaterialPluginBase {\n /** @internal */\n _markAllSubMeshesAsMiscDirty() {\n this._internalMarkAllSubMeshesAsMiscDirty();\n }\n constructor(material, addToPluginList = true) {\n super(material, \"PBRBRDF\", 90, new MaterialBRDFDefines(), addToPluginList);\n this._useEnergyConservation = PBRBRDFConfiguration.DEFAULT_USE_ENERGY_CONSERVATION;\n /**\n * Defines if the material uses energy conservation.\n */\n this.useEnergyConservation = PBRBRDFConfiguration.DEFAULT_USE_ENERGY_CONSERVATION;\n this._useSmithVisibilityHeightCorrelated = PBRBRDFConfiguration.DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED;\n /**\n * LEGACY Mode set to false\n * Defines if the material uses height smith correlated visibility term.\n * If you intent to not use our default BRDF, you need to load a separate BRDF Texture for the PBR\n * You can either load https://assets.babylonjs.com/environments/uncorrelatedBRDF.png\n * or https://assets.babylonjs.com/environments/uncorrelatedBRDF.dds to have more precision\n * Not relying on height correlated will also disable energy conservation.\n */\n this.useSmithVisibilityHeightCorrelated = PBRBRDFConfiguration.DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED;\n this._useSphericalHarmonics = PBRBRDFConfiguration.DEFAULT_USE_SPHERICAL_HARMONICS;\n /**\n * LEGACY Mode set to false\n * Defines if the material uses spherical harmonics vs spherical polynomials for the\n * diffuse part of the IBL.\n * The harmonics despite a tiny bigger cost has been proven to provide closer results\n * to the ground truth.\n */\n this.useSphericalHarmonics = PBRBRDFConfiguration.DEFAULT_USE_SPHERICAL_HARMONICS;\n this._useSpecularGlossinessInputEnergyConservation = PBRBRDFConfiguration.DEFAULT_USE_SPECULAR_GLOSSINESS_INPUT_ENERGY_CONSERVATION;\n /**\n * Defines if the material uses energy conservation, when the specular workflow is active.\n * If activated, the albedo color is multiplied with (1. - maxChannel(specular color)).\n * If deactivated, a material is only physically plausible, when (albedo color + specular color) < 1.\n * In the deactivated case, the material author has to ensure energy conservation, for a physically plausible rendering.\n */\n this.useSpecularGlossinessInputEnergyConservation = PBRBRDFConfiguration.DEFAULT_USE_SPECULAR_GLOSSINESS_INPUT_ENERGY_CONSERVATION;\n this._internalMarkAllSubMeshesAsMiscDirty = material._dirtyCallbacks[16];\n this._enable(true);\n }\n prepareDefines(defines) {\n defines.BRDF_V_HEIGHT_CORRELATED = this._useSmithVisibilityHeightCorrelated;\n defines.MS_BRDF_ENERGY_CONSERVATION = this._useEnergyConservation && this._useSmithVisibilityHeightCorrelated;\n defines.SPHERICAL_HARMONICS = this._useSphericalHarmonics;\n defines.SPECULAR_GLOSSINESS_ENERGY_CONSERVATION = this._useSpecularGlossinessInputEnergyConservation;\n }\n getClassName() {\n return \"PBRBRDFConfiguration\";\n }\n}\n/**\n * Default value used for the energy conservation.\n * This should only be changed to adapt to the type of texture in scene.environmentBRDFTexture.\n */\nPBRBRDFConfiguration.DEFAULT_USE_ENERGY_CONSERVATION = true;\n/**\n * Default value used for the Smith Visibility Height Correlated mode.\n * This should only be changed to adapt to the type of texture in scene.environmentBRDFTexture.\n */\nPBRBRDFConfiguration.DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED = true;\n/**\n * Default value used for the IBL diffuse part.\n * This can help switching back to the polynomials mode globally which is a tiny bit\n * less GPU intensive at the drawback of a lower quality.\n */\nPBRBRDFConfiguration.DEFAULT_USE_SPHERICAL_HARMONICS = true;\n/**\n * Default value used for activating energy conservation for the specular workflow.\n * If activated, the albedo color is multiplied with (1. - maxChannel(specular color)).\n * If deactivated, a material is only physically plausible, when (albedo color + specular color) < 1.\n */\nPBRBRDFConfiguration.DEFAULT_USE_SPECULAR_GLOSSINESS_INPUT_ENERGY_CONSERVATION = true;\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsMiscDirty\")\n], PBRBRDFConfiguration.prototype, \"useEnergyConservation\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsMiscDirty\")\n], PBRBRDFConfiguration.prototype, \"useSmithVisibilityHeightCorrelated\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsMiscDirty\")\n], PBRBRDFConfiguration.prototype, \"useSphericalHarmonics\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsMiscDirty\")\n], PBRBRDFConfiguration.prototype, \"useSpecularGlossinessInputEnergyConservation\", void 0);\n//# sourceMappingURL=pbrBRDFConfiguration.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nimport \"./decalFragmentDeclaration.js\";\nconst name = \"pbrFragmentDeclaration\";\nconst shader = `uniform vec4 vEyePosition;uniform vec3 vReflectionColor;uniform vec4 vAlbedoColor;uniform vec4 vLightingIntensity;uniform vec4 vReflectivityColor;uniform vec4 vMetallicReflectanceFactors;uniform vec3 vEmissiveColor;uniform float visibility;uniform vec3 vAmbientColor;\n#ifdef ALBEDO\nuniform vec2 vAlbedoInfos;\n#endif\n#ifdef AMBIENT\nuniform vec4 vAmbientInfos;\n#endif\n#ifdef BUMP\nuniform vec3 vBumpInfos;uniform vec2 vTangentSpaceParams;\n#endif\n#ifdef OPACITY\nuniform vec2 vOpacityInfos;\n#endif\n#ifdef EMISSIVE\nuniform vec2 vEmissiveInfos;\n#endif\n#ifdef LIGHTMAP\nuniform vec2 vLightmapInfos;\n#endif\n#ifdef REFLECTIVITY\nuniform vec3 vReflectivityInfos;\n#endif\n#ifdef MICROSURFACEMAP\nuniform vec2 vMicroSurfaceSamplerInfos;\n#endif\n#if defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_PROJECTION) || defined(SS_REFRACTION) || defined(PREPASS)\nuniform mat4 view;\n#endif\n#ifdef REFLECTION\nuniform vec2 vReflectionInfos;\n#ifdef REALTIME_FILTERING\nuniform vec2 vReflectionFilteringInfo;\n#endif\nuniform mat4 reflectionMatrix;uniform vec3 vReflectionMicrosurfaceInfos;\n#if defined(USE_LOCAL_REFLECTIONMAP_CUBIC) && defined(REFLECTIONMAP_CUBIC)\nuniform vec3 vReflectionPosition;uniform vec3 vReflectionSize; \n#endif\n#endif\n#if defined(SS_REFRACTION) && defined(SS_USE_LOCAL_REFRACTIONMAP_CUBIC)\nuniform vec3 vRefractionPosition;uniform vec3 vRefractionSize; \n#endif\n#ifdef CLEARCOAT\nuniform vec2 vClearCoatParams;uniform vec4 vClearCoatRefractionParams;\n#if defined(CLEARCOAT_TEXTURE) || defined(CLEARCOAT_TEXTURE_ROUGHNESS)\nuniform vec4 vClearCoatInfos;\n#endif\n#ifdef CLEARCOAT_TEXTURE\nuniform mat4 clearCoatMatrix;\n#endif\n#ifdef CLEARCOAT_TEXTURE_ROUGHNESS\nuniform mat4 clearCoatRoughnessMatrix;\n#endif\n#ifdef CLEARCOAT_BUMP\nuniform vec2 vClearCoatBumpInfos;uniform vec2 vClearCoatTangentSpaceParams;uniform mat4 clearCoatBumpMatrix;\n#endif\n#ifdef CLEARCOAT_TINT\nuniform vec4 vClearCoatTintParams;uniform float clearCoatColorAtDistance;\n#ifdef CLEARCOAT_TINT_TEXTURE\nuniform vec2 vClearCoatTintInfos;uniform mat4 clearCoatTintMatrix;\n#endif\n#endif\n#endif\n#ifdef IRIDESCENCE\nuniform vec4 vIridescenceParams;\n#if defined(IRIDESCENCE_TEXTURE) || defined(IRIDESCENCE_THICKNESS_TEXTURE)\nuniform vec4 vIridescenceInfos;\n#endif\n#ifdef IRIDESCENCE_TEXTURE\nuniform mat4 iridescenceMatrix;\n#endif\n#ifdef IRIDESCENCE_THICKNESS_TEXTURE\nuniform mat4 iridescenceThicknessMatrix;\n#endif\n#endif\n#ifdef ANISOTROPIC\nuniform vec3 vAnisotropy;\n#ifdef ANISOTROPIC_TEXTURE\nuniform vec2 vAnisotropyInfos;uniform mat4 anisotropyMatrix;\n#endif\n#endif\n#ifdef SHEEN\nuniform vec4 vSheenColor;\n#ifdef SHEEN_ROUGHNESS\nuniform float vSheenRoughness;\n#endif\n#if defined(SHEEN_TEXTURE) || defined(SHEEN_TEXTURE_ROUGHNESS)\nuniform vec4 vSheenInfos;\n#endif\n#ifdef SHEEN_TEXTURE\nuniform mat4 sheenMatrix;\n#endif\n#ifdef SHEEN_TEXTURE_ROUGHNESS\nuniform mat4 sheenRoughnessMatrix;\n#endif\n#endif\n#ifdef SUBSURFACE\n#ifdef SS_REFRACTION\nuniform vec4 vRefractionMicrosurfaceInfos;uniform vec4 vRefractionInfos;uniform mat4 refractionMatrix;\n#ifdef REALTIME_FILTERING\nuniform vec2 vRefractionFilteringInfo;\n#endif\n#endif\n#ifdef SS_THICKNESSANDMASK_TEXTURE\nuniform vec2 vThicknessInfos;uniform mat4 thicknessMatrix;\n#endif\n#ifdef SS_REFRACTIONINTENSITY_TEXTURE\nuniform vec2 vRefractionIntensityInfos;uniform mat4 refractionIntensityMatrix;\n#endif\n#ifdef SS_TRANSLUCENCYINTENSITY_TEXTURE\nuniform vec2 vTranslucencyIntensityInfos;uniform mat4 translucencyIntensityMatrix;\n#endif\nuniform vec2 vThicknessParam;uniform vec3 vDiffusionDistance;uniform vec4 vTintColor;uniform vec3 vSubSurfaceIntensity;\n#endif\n#ifdef PREPASS\n#ifdef SS_SCATTERING\nuniform float scatteringDiffusionProfile;\n#endif\n#endif\n#if DEBUGMODE>0\nuniform vec2 vDebugMode;\n#endif\n#ifdef DETAIL\nuniform vec4 vDetailInfos;\n#endif\n#include\n#ifdef USESPHERICALFROMREFLECTIONMAP\n#ifdef SPHERICAL_HARMONICS\nuniform vec3 vSphericalL00;uniform vec3 vSphericalL1_1;uniform vec3 vSphericalL10;uniform vec3 vSphericalL11;uniform vec3 vSphericalL2_2;uniform vec3 vSphericalL2_1;uniform vec3 vSphericalL20;uniform vec3 vSphericalL21;uniform vec3 vSphericalL22;\n#else\nuniform vec3 vSphericalX;uniform vec3 vSphericalY;uniform vec3 vSphericalZ;uniform vec3 vSphericalXX_ZZ;uniform vec3 vSphericalYY_ZZ;uniform vec3 vSphericalZZ;uniform vec3 vSphericalXY;uniform vec3 vSphericalYZ;uniform vec3 vSphericalZX;\n#endif\n#endif\n#define ADDITIONAL_FRAGMENT_DECLARATION\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const pbrFragmentDeclaration = { name, shader };\n//# sourceMappingURL=pbrFragmentDeclaration.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nimport \"./sceneUboDeclaration.js\";\nimport \"./meshUboDeclaration.js\";\nconst name = \"pbrUboDeclaration\";\nconst shader = `layout(std140,column_major) uniform;uniform Material {vec2 vAlbedoInfos;vec4 vAmbientInfos;vec2 vOpacityInfos;vec2 vEmissiveInfos;vec2 vLightmapInfos;vec3 vReflectivityInfos;vec2 vMicroSurfaceSamplerInfos;vec2 vReflectionInfos;vec2 vReflectionFilteringInfo;vec3 vReflectionPosition;vec3 vReflectionSize;vec3 vBumpInfos;mat4 albedoMatrix;mat4 ambientMatrix;mat4 opacityMatrix;mat4 emissiveMatrix;mat4 lightmapMatrix;mat4 reflectivityMatrix;mat4 microSurfaceSamplerMatrix;mat4 bumpMatrix;vec2 vTangentSpaceParams;mat4 reflectionMatrix;vec3 vReflectionColor;vec4 vAlbedoColor;vec4 vLightingIntensity;vec3 vReflectionMicrosurfaceInfos;float pointSize;vec4 vReflectivityColor;vec3 vEmissiveColor;vec3 vAmbientColor;vec2 vDebugMode;vec4 vMetallicReflectanceFactors;vec2 vMetallicReflectanceInfos;mat4 metallicReflectanceMatrix;vec2 vReflectanceInfos;mat4 reflectanceMatrix;vec3 vSphericalL00;vec3 vSphericalL1_1;vec3 vSphericalL10;vec3 vSphericalL11;vec3 vSphericalL2_2;vec3 vSphericalL2_1;vec3 vSphericalL20;vec3 vSphericalL21;vec3 vSphericalL22;vec3 vSphericalX;vec3 vSphericalY;vec3 vSphericalZ;vec3 vSphericalXX_ZZ;vec3 vSphericalYY_ZZ;vec3 vSphericalZZ;vec3 vSphericalXY;vec3 vSphericalYZ;vec3 vSphericalZX;\n#define ADDITIONAL_UBO_DECLARATION\n};\n#include\n#include\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const pbrUboDeclaration = { name, shader };\n//# sourceMappingURL=pbrUboDeclaration.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nimport \"./mainUVVaryingDeclaration.js\";\nconst name = \"pbrFragmentExtraDeclaration\";\nconst shader = `varying vec3 vPositionW;\n#if DEBUGMODE>0\nvarying vec4 vClipSpacePosition;\n#endif\n#include[1..7]\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)\nvarying vec3 vEnvironmentIrradiance;\n#endif\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vec4 vColor;\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const pbrFragmentExtraDeclaration = { name, shader };\n//# sourceMappingURL=pbrFragmentExtraDeclaration.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"samplerFragmentAlternateDeclaration\";\nconst shader = `#ifdef _DEFINENAME_\n#if _DEFINENAME_DIRECTUV==1\n#define v_VARYINGNAME_UV vMainUV1\n#elif _DEFINENAME_DIRECTUV==2\n#define v_VARYINGNAME_UV vMainUV2\n#elif _DEFINENAME_DIRECTUV==3\n#define v_VARYINGNAME_UV vMainUV3\n#elif _DEFINENAME_DIRECTUV==4\n#define v_VARYINGNAME_UV vMainUV4\n#elif _DEFINENAME_DIRECTUV==5\n#define v_VARYINGNAME_UV vMainUV5\n#elif _DEFINENAME_DIRECTUV==6\n#define v_VARYINGNAME_UV vMainUV6\n#else\nvarying vec2 v_VARYINGNAME_UV;\n#endif\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const samplerFragmentAlternateDeclaration = { name, shader };\n//# sourceMappingURL=samplerFragmentAlternateDeclaration.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nimport \"./samplerFragmentDeclaration.js\";\nimport \"./samplerFragmentAlternateDeclaration.js\";\nconst name = \"pbrFragmentSamplersDeclaration\";\nconst shader = `#include(_DEFINENAME_,ALBEDO,_VARYINGNAME_,Albedo,_SAMPLERNAME_,albedo)\n#include(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient,_SAMPLERNAME_,ambient)\n#include(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity,_SAMPLERNAME_,opacity)\n#include(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive,_SAMPLERNAME_,emissive)\n#include(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap,_SAMPLERNAME_,lightmap)\n#include(_DEFINENAME_,REFLECTIVITY,_VARYINGNAME_,Reflectivity,_SAMPLERNAME_,reflectivity)\n#include(_DEFINENAME_,MICROSURFACEMAP,_VARYINGNAME_,MicroSurfaceSampler,_SAMPLERNAME_,microSurface)\n#include(_DEFINENAME_,METALLIC_REFLECTANCE,_VARYINGNAME_,MetallicReflectance,_SAMPLERNAME_,metallicReflectance)\n#include(_DEFINENAME_,REFLECTANCE,_VARYINGNAME_,Reflectance,_SAMPLERNAME_,reflectance)\n#include(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal,_SAMPLERNAME_,decal)\n#ifdef CLEARCOAT\n#include(_DEFINENAME_,CLEARCOAT_TEXTURE,_VARYINGNAME_,ClearCoat,_SAMPLERNAME_,clearCoat)\n#include(_DEFINENAME_,CLEARCOAT_TEXTURE_ROUGHNESS,_VARYINGNAME_,ClearCoatRoughness)\n#if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && !defined(CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL)\nuniform sampler2D clearCoatRoughnessSampler;\n#endif\n#include(_DEFINENAME_,CLEARCOAT_BUMP,_VARYINGNAME_,ClearCoatBump,_SAMPLERNAME_,clearCoatBump)\n#include(_DEFINENAME_,CLEARCOAT_TINT_TEXTURE,_VARYINGNAME_,ClearCoatTint,_SAMPLERNAME_,clearCoatTint)\n#endif\n#ifdef IRIDESCENCE\n#include(_DEFINENAME_,IRIDESCENCE_TEXTURE,_VARYINGNAME_,Iridescence,_SAMPLERNAME_,iridescence)\n#include(_DEFINENAME_,IRIDESCENCE_THICKNESS_TEXTURE,_VARYINGNAME_,IridescenceThickness,_SAMPLERNAME_,iridescenceThickness)\n#endif\n#ifdef SHEEN\n#include(_DEFINENAME_,SHEEN_TEXTURE,_VARYINGNAME_,Sheen,_SAMPLERNAME_,sheen)\n#include(_DEFINENAME_,SHEEN_TEXTURE_ROUGHNESS,_VARYINGNAME_,SheenRoughness)\n#if defined(SHEEN_ROUGHNESS) && defined(SHEEN_TEXTURE_ROUGHNESS) && !defined(SHEEN_TEXTURE_ROUGHNESS_IDENTICAL)\nuniform sampler2D sheenRoughnessSampler;\n#endif\n#endif\n#ifdef ANISOTROPIC\n#include(_DEFINENAME_,ANISOTROPIC_TEXTURE,_VARYINGNAME_,Anisotropy,_SAMPLERNAME_,anisotropy)\n#endif\n#ifdef REFLECTION\n#ifdef REFLECTIONMAP_3D\n#define sampleReflection(s,c) textureCube(s,c)\nuniform samplerCube reflectionSampler;\n#ifdef LODBASEDMICROSFURACE\n#define sampleReflectionLod(s,c,l) textureCubeLodEXT(s,c,l)\n#else\nuniform samplerCube reflectionSamplerLow;uniform samplerCube reflectionSamplerHigh;\n#endif\n#ifdef USEIRRADIANCEMAP\nuniform samplerCube irradianceSampler;\n#endif\n#else\n#define sampleReflection(s,c) texture2D(s,c)\nuniform sampler2D reflectionSampler;\n#ifdef LODBASEDMICROSFURACE\n#define sampleReflectionLod(s,c,l) texture2DLodEXT(s,c,l)\n#else\nuniform sampler2D reflectionSamplerLow;uniform sampler2D reflectionSamplerHigh;\n#endif\n#ifdef USEIRRADIANCEMAP\nuniform sampler2D irradianceSampler;\n#endif\n#endif\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#else\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vec3 vDirectionW;\n#endif\n#endif\n#endif\n#ifdef ENVIRONMENTBRDF\nuniform sampler2D environmentBrdfSampler;\n#endif\n#ifdef SUBSURFACE\n#ifdef SS_REFRACTION\n#ifdef SS_REFRACTIONMAP_3D\n#define sampleRefraction(s,c) textureCube(s,c)\nuniform samplerCube refractionSampler;\n#ifdef LODBASEDMICROSFURACE\n#define sampleRefractionLod(s,c,l) textureCubeLodEXT(s,c,l)\n#else\nuniform samplerCube refractionSamplerLow;uniform samplerCube refractionSamplerHigh;\n#endif\n#else\n#define sampleRefraction(s,c) texture2D(s,c)\nuniform sampler2D refractionSampler;\n#ifdef LODBASEDMICROSFURACE\n#define sampleRefractionLod(s,c,l) texture2DLodEXT(s,c,l)\n#else\nuniform sampler2D refractionSamplerLow;uniform sampler2D refractionSamplerHigh;\n#endif\n#endif\n#endif\n#include(_DEFINENAME_,SS_THICKNESSANDMASK_TEXTURE,_VARYINGNAME_,Thickness,_SAMPLERNAME_,thickness)\n#include(_DEFINENAME_,SS_REFRACTIONINTENSITY_TEXTURE,_VARYINGNAME_,RefractionIntensity,_SAMPLERNAME_,refractionIntensity)\n#include(_DEFINENAME_,SS_TRANSLUCENCYINTENSITY_TEXTURE,_VARYINGNAME_,TranslucencyIntensity,_SAMPLERNAME_,translucencyIntensity)\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const pbrFragmentSamplersDeclaration = { name, shader };\n//# sourceMappingURL=pbrFragmentSamplersDeclaration.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"subSurfaceScatteringFunctions\";\nconst shader = `bool testLightingForSSS(float diffusionProfile)\n{return diffusionProfile<1.;}`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const subSurfaceScatteringFunctions = { name, shader };\n//# sourceMappingURL=subSurfaceScatteringFunctions.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"pbrHelperFunctions\";\nconst shader = `#define RECIPROCAL_PI2 0.15915494\n#define RECIPROCAL_PI 0.31830988618\n#define MINIMUMVARIANCE 0.0005\nfloat convertRoughnessToAverageSlope(float roughness)\n{return square(roughness)+MINIMUMVARIANCE;}\nfloat fresnelGrazingReflectance(float reflectance0) {float reflectance90=saturate(reflectance0*25.0);return reflectance90;}\nvec2 getAARoughnessFactors(vec3 normalVector) {\n#ifdef SPECULARAA\nvec3 nDfdx=dFdx(normalVector.xyz);vec3 nDfdy=dFdy(normalVector.xyz);float slopeSquare=max(dot(nDfdx,nDfdx),dot(nDfdy,nDfdy));float geometricRoughnessFactor=pow(saturate(slopeSquare),0.333);float geometricAlphaGFactor=sqrt(slopeSquare);geometricAlphaGFactor*=0.75;return vec2(geometricRoughnessFactor,geometricAlphaGFactor);\n#else\nreturn vec2(0.);\n#endif\n}\n#ifdef ANISOTROPIC\n#ifdef ANISOTROPIC_LEGACY\nvec2 getAnisotropicRoughness(float alphaG,float anisotropy) {float alphaT=max(alphaG*(1.0+anisotropy),MINIMUMVARIANCE);float alphaB=max(alphaG*(1.0-anisotropy),MINIMUMVARIANCE);return vec2(alphaT,alphaB);}\nvec3 getAnisotropicBentNormals(const vec3 T,const vec3 B,const vec3 N,const vec3 V,float anisotropy,float roughness) {vec3 anisotropicFrameDirection=anisotropy>=0.0 ? B : T;vec3 anisotropicFrameTangent=cross(normalize(anisotropicFrameDirection),V);vec3 anisotropicFrameNormal=cross(anisotropicFrameTangent,anisotropicFrameDirection);vec3 anisotropicNormal=normalize(mix(N,anisotropicFrameNormal,abs(anisotropy)));return anisotropicNormal;}\n#else\nvec2 getAnisotropicRoughness(float alphaG,float anisotropy) {float alphaT=max(mix(alphaG,1.0,anisotropy*anisotropy),MINIMUMVARIANCE);float alphaB=max(alphaG,MINIMUMVARIANCE);return vec2(alphaT,alphaB);}\nvec3 getAnisotropicBentNormals(const vec3 T,const vec3 B,const vec3 N,const vec3 V,float anisotropy,float roughness) {vec3 bentNormal=cross(B,V);bentNormal=normalize(cross(bentNormal,B));float a=square(square(1.0-anisotropy*(1.0-roughness)));bentNormal=normalize(mix(bentNormal,N,a));return bentNormal;}\n#endif\n#endif\n#if defined(CLEARCOAT) || defined(SS_REFRACTION)\nvec3 cocaLambert(vec3 alpha,float distance) {return exp(-alpha*distance);}\nvec3 cocaLambert(float NdotVRefract,float NdotLRefract,vec3 alpha,float thickness) {return cocaLambert(alpha,(thickness*((NdotLRefract+NdotVRefract)/(NdotLRefract*NdotVRefract))));}\nvec3 computeColorAtDistanceInMedia(vec3 color,float distance) {return -log(color)/distance;}\nvec3 computeClearCoatAbsorption(float NdotVRefract,float NdotLRefract,vec3 clearCoatColor,float clearCoatThickness,float clearCoatIntensity) {vec3 clearCoatAbsorption=mix(vec3(1.0),\ncocaLambert(NdotVRefract,NdotLRefract,clearCoatColor,clearCoatThickness),\nclearCoatIntensity);return clearCoatAbsorption;}\n#endif\n#ifdef MICROSURFACEAUTOMATIC\nfloat computeDefaultMicroSurface(float microSurface,vec3 reflectivityColor)\n{const float kReflectivityNoAlphaWorkflow_SmoothnessMax=0.95;float reflectivityLuminance=getLuminance(reflectivityColor);float reflectivityLuma=sqrt(reflectivityLuminance);microSurface=reflectivityLuma*kReflectivityNoAlphaWorkflow_SmoothnessMax;return microSurface;}\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const pbrHelperFunctions = { name, shader };\n//# sourceMappingURL=pbrHelperFunctions.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"harmonicsFunctions\";\nconst shader = `#ifdef USESPHERICALFROMREFLECTIONMAP\n#ifdef SPHERICAL_HARMONICS\nvec3 computeEnvironmentIrradiance(vec3 normal) {return vSphericalL00\n+ vSphericalL1_1*(normal.y)\n+ vSphericalL10*(normal.z)\n+ vSphericalL11*(normal.x)\n+ vSphericalL2_2*(normal.y*normal.x)\n+ vSphericalL2_1*(normal.y*normal.z)\n+ vSphericalL20*((3.0*normal.z*normal.z)-1.0)\n+ vSphericalL21*(normal.z*normal.x)\n+ vSphericalL22*(normal.x*normal.x-(normal.y*normal.y));}\n#else\nvec3 computeEnvironmentIrradiance(vec3 normal) {float Nx=normal.x;float Ny=normal.y;float Nz=normal.z;vec3 C1=vSphericalZZ.rgb;vec3 Cx=vSphericalX.rgb;vec3 Cy=vSphericalY.rgb;vec3 Cz=vSphericalZ.rgb;vec3 Cxx_zz=vSphericalXX_ZZ.rgb;vec3 Cyy_zz=vSphericalYY_ZZ.rgb;vec3 Cxy=vSphericalXY.rgb;vec3 Cyz=vSphericalYZ.rgb;vec3 Czx=vSphericalZX.rgb;vec3 a1=Cyy_zz*Ny+Cy;vec3 a2=Cyz*Nz+a1;vec3 b1=Czx*Nz+Cx;vec3 b2=Cxy*Ny+b1;vec3 b3=Cxx_zz*Nx+b2;vec3 t1=Cz *Nz+C1;vec3 t2=a2 *Ny+t1;vec3 t3=b3 *Nx+t2;return t3;}\n#endif\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const harmonicsFunctions = { name, shader };\n//# sourceMappingURL=harmonicsFunctions.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"pbrDirectLightingSetupFunctions\";\nconst shader = `struct preLightingInfo\n{vec3 lightOffset;float lightDistanceSquared;float lightDistance;float attenuation;vec3 L;vec3 H;float NdotV;float NdotLUnclamped;float NdotL;float VdotH;float roughness;\n#ifdef IRIDESCENCE\nfloat iridescenceIntensity;\n#endif\n};preLightingInfo computePointAndSpotPreLightingInfo(vec4 lightData,vec3 V,vec3 N) {preLightingInfo result;result.lightOffset=lightData.xyz-vPositionW;result.lightDistanceSquared=dot(result.lightOffset,result.lightOffset);result.lightDistance=sqrt(result.lightDistanceSquared);result.L=normalize(result.lightOffset);result.H=normalize(V+result.L);result.VdotH=saturate(dot(V,result.H));result.NdotLUnclamped=dot(N,result.L);result.NdotL=saturateEps(result.NdotLUnclamped);return result;}\npreLightingInfo computeDirectionalPreLightingInfo(vec4 lightData,vec3 V,vec3 N) {preLightingInfo result;result.lightDistance=length(-lightData.xyz);result.L=normalize(-lightData.xyz);result.H=normalize(V+result.L);result.VdotH=saturate(dot(V,result.H));result.NdotLUnclamped=dot(N,result.L);result.NdotL=saturateEps(result.NdotLUnclamped);return result;}\npreLightingInfo computeHemisphericPreLightingInfo(vec4 lightData,vec3 V,vec3 N) {preLightingInfo result;result.NdotL=dot(N,lightData.xyz)*0.5+0.5;result.NdotL=saturateEps(result.NdotL);result.NdotLUnclamped=result.NdotL;\n#ifdef SPECULARTERM\nresult.L=normalize(lightData.xyz);result.H=normalize(V+result.L);result.VdotH=saturate(dot(V,result.H));\n#endif\nreturn result;}`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const pbrDirectLightingSetupFunctions = { name, shader };\n//# sourceMappingURL=pbrDirectLightingSetupFunctions.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"pbrDirectLightingFalloffFunctions\";\nconst shader = `float computeDistanceLightFalloff_Standard(vec3 lightOffset,float range)\n{return max(0.,1.0-length(lightOffset)/range);}\nfloat computeDistanceLightFalloff_Physical(float lightDistanceSquared)\n{return 1.0/maxEps(lightDistanceSquared);}\nfloat computeDistanceLightFalloff_GLTF(float lightDistanceSquared,float inverseSquaredRange)\n{float lightDistanceFalloff=1.0/maxEps(lightDistanceSquared);float factor=lightDistanceSquared*inverseSquaredRange;float attenuation=saturate(1.0-factor*factor);attenuation*=attenuation;lightDistanceFalloff*=attenuation;return lightDistanceFalloff;}\nfloat computeDistanceLightFalloff(vec3 lightOffset,float lightDistanceSquared,float range,float inverseSquaredRange)\n{\n#ifdef USEPHYSICALLIGHTFALLOFF\nreturn computeDistanceLightFalloff_Physical(lightDistanceSquared);\n#elif defined(USEGLTFLIGHTFALLOFF)\nreturn computeDistanceLightFalloff_GLTF(lightDistanceSquared,inverseSquaredRange);\n#else\nreturn computeDistanceLightFalloff_Standard(lightOffset,range);\n#endif\n}\nfloat computeDirectionalLightFalloff_Standard(vec3 lightDirection,vec3 directionToLightCenterW,float cosHalfAngle,float exponent)\n{float falloff=0.0;float cosAngle=maxEps(dot(-lightDirection,directionToLightCenterW));if (cosAngle>=cosHalfAngle)\n{falloff=max(0.,pow(cosAngle,exponent));}\nreturn falloff;}\nfloat computeDirectionalLightFalloff_Physical(vec3 lightDirection,vec3 directionToLightCenterW,float cosHalfAngle)\n{const float kMinusLog2ConeAngleIntensityRatio=6.64385618977; \nfloat concentrationKappa=kMinusLog2ConeAngleIntensityRatio/(1.0-cosHalfAngle);vec4 lightDirectionSpreadSG=vec4(-lightDirection*concentrationKappa,-concentrationKappa);float falloff=exp2(dot(vec4(directionToLightCenterW,1.0),lightDirectionSpreadSG));return falloff;}\nfloat computeDirectionalLightFalloff_GLTF(vec3 lightDirection,vec3 directionToLightCenterW,float lightAngleScale,float lightAngleOffset)\n{float cd=dot(-lightDirection,directionToLightCenterW);float falloff=saturate(cd*lightAngleScale+lightAngleOffset);falloff*=falloff;return falloff;}\nfloat computeDirectionalLightFalloff(vec3 lightDirection,vec3 directionToLightCenterW,float cosHalfAngle,float exponent,float lightAngleScale,float lightAngleOffset)\n{\n#ifdef USEPHYSICALLIGHTFALLOFF\nreturn computeDirectionalLightFalloff_Physical(lightDirection,directionToLightCenterW,cosHalfAngle);\n#elif defined(USEGLTFLIGHTFALLOFF)\nreturn computeDirectionalLightFalloff_GLTF(lightDirection,directionToLightCenterW,lightAngleScale,lightAngleOffset);\n#else\nreturn computeDirectionalLightFalloff_Standard(lightDirection,directionToLightCenterW,cosHalfAngle,exponent);\n#endif\n}`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const pbrDirectLightingFalloffFunctions = { name, shader };\n//# sourceMappingURL=pbrDirectLightingFalloffFunctions.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"pbrDirectLightingFunctions\";\nconst shader = `#define CLEARCOATREFLECTANCE90 1.0\nstruct lightingInfo\n{vec3 diffuse;\n#ifdef SPECULARTERM\nvec3 specular;\n#endif\n#ifdef CLEARCOAT\nvec4 clearCoat;\n#endif\n#ifdef SHEEN\nvec3 sheen;\n#endif\n};float adjustRoughnessFromLightProperties(float roughness,float lightRadius,float lightDistance) {\n#if defined(USEPHYSICALLIGHTFALLOFF) || defined(USEGLTFLIGHTFALLOFF)\nfloat lightRoughness=lightRadius/lightDistance;float totalRoughness=saturate(lightRoughness+roughness);return totalRoughness;\n#else\nreturn roughness;\n#endif\n}\nvec3 computeHemisphericDiffuseLighting(preLightingInfo info,vec3 lightColor,vec3 groundColor) {return mix(groundColor,lightColor,info.NdotL);}\nvec3 computeDiffuseLighting(preLightingInfo info,vec3 lightColor) {float diffuseTerm=diffuseBRDF_Burley(info.NdotL,info.NdotV,info.VdotH,info.roughness);return diffuseTerm*info.attenuation*info.NdotL*lightColor;}\n#define inline\nvec3 computeProjectionTextureDiffuseLighting(sampler2D projectionLightSampler,mat4 textureProjectionMatrix){vec4 strq=textureProjectionMatrix*vec4(vPositionW,1.0);strq/=strq.w;vec3 textureColor=texture2D(projectionLightSampler,strq.xy).rgb;return toLinearSpace(textureColor);}\n#ifdef SS_TRANSLUCENCY\nvec3 computeDiffuseAndTransmittedLighting(preLightingInfo info,vec3 lightColor,vec3 transmittance) {float NdotL=absEps(info.NdotLUnclamped);float wrapNdotL=computeWrappedDiffuseNdotL(NdotL,0.02);float trAdapt=step(0.,info.NdotLUnclamped);vec3 transmittanceNdotL=mix(transmittance*wrapNdotL,vec3(wrapNdotL),trAdapt);float diffuseTerm=diffuseBRDF_Burley(NdotL,info.NdotV,info.VdotH,info.roughness);return diffuseTerm*transmittanceNdotL*info.attenuation*lightColor;}\n#endif\n#ifdef SPECULARTERM\nvec3 computeSpecularLighting(preLightingInfo info,vec3 N,vec3 reflectance0,vec3 reflectance90,float geometricRoughnessFactor,vec3 lightColor) {float NdotH=saturateEps(dot(N,info.H));float roughness=max(info.roughness,geometricRoughnessFactor);float alphaG=convertRoughnessToAverageSlope(roughness);vec3 fresnel=fresnelSchlickGGX(info.VdotH,reflectance0,reflectance90);\n#ifdef IRIDESCENCE\nfresnel=mix(fresnel,reflectance0,info.iridescenceIntensity);\n#endif\nfloat distribution=normalDistributionFunction_TrowbridgeReitzGGX(NdotH,alphaG);\n#ifdef BRDF_V_HEIGHT_CORRELATED\nfloat smithVisibility=smithVisibility_GGXCorrelated(info.NdotL,info.NdotV,alphaG);\n#else\nfloat smithVisibility=smithVisibility_TrowbridgeReitzGGXFast(info.NdotL,info.NdotV,alphaG);\n#endif\nvec3 specTerm=fresnel*distribution*smithVisibility;return specTerm*info.attenuation*info.NdotL*lightColor;}\n#endif\n#ifdef ANISOTROPIC\nvec3 computeAnisotropicSpecularLighting(preLightingInfo info,vec3 V,vec3 N,vec3 T,vec3 B,float anisotropy,vec3 reflectance0,vec3 reflectance90,float geometricRoughnessFactor,vec3 lightColor) {float NdotH=saturateEps(dot(N,info.H));float TdotH=dot(T,info.H);float BdotH=dot(B,info.H);float TdotV=dot(T,V);float BdotV=dot(B,V);float TdotL=dot(T,info.L);float BdotL=dot(B,info.L);float alphaG=convertRoughnessToAverageSlope(info.roughness);vec2 alphaTB=getAnisotropicRoughness(alphaG,anisotropy);alphaTB=max(alphaTB,square(geometricRoughnessFactor));vec3 fresnel=fresnelSchlickGGX(info.VdotH,reflectance0,reflectance90);\n#ifdef IRIDESCENCE\nfresnel=mix(fresnel,reflectance0,info.iridescenceIntensity);\n#endif\nfloat distribution=normalDistributionFunction_BurleyGGX_Anisotropic(NdotH,TdotH,BdotH,alphaTB);float smithVisibility=smithVisibility_GGXCorrelated_Anisotropic(info.NdotL,info.NdotV,TdotV,BdotV,TdotL,BdotL,alphaTB);vec3 specTerm=fresnel*distribution*smithVisibility;return specTerm*info.attenuation*info.NdotL*lightColor;}\n#endif\n#ifdef CLEARCOAT\nvec4 computeClearCoatLighting(preLightingInfo info,vec3 Ncc,float geometricRoughnessFactor,float clearCoatIntensity,vec3 lightColor) {float NccdotL=saturateEps(dot(Ncc,info.L));float NccdotH=saturateEps(dot(Ncc,info.H));float clearCoatRoughness=max(info.roughness,geometricRoughnessFactor);float alphaG=convertRoughnessToAverageSlope(clearCoatRoughness);float fresnel=fresnelSchlickGGX(info.VdotH,vClearCoatRefractionParams.x,CLEARCOATREFLECTANCE90);fresnel*=clearCoatIntensity;float distribution=normalDistributionFunction_TrowbridgeReitzGGX(NccdotH,alphaG);float kelemenVisibility=visibility_Kelemen(info.VdotH);float clearCoatTerm=fresnel*distribution*kelemenVisibility;return vec4(\nclearCoatTerm*info.attenuation*NccdotL*lightColor,\n1.0-fresnel\n);}\nvec3 computeClearCoatLightingAbsorption(float NdotVRefract,vec3 L,vec3 Ncc,vec3 clearCoatColor,float clearCoatThickness,float clearCoatIntensity) {vec3 LRefract=-refract(L,Ncc,vClearCoatRefractionParams.y);float NdotLRefract=saturateEps(dot(Ncc,LRefract));vec3 absorption=computeClearCoatAbsorption(NdotVRefract,NdotLRefract,clearCoatColor,clearCoatThickness,clearCoatIntensity);return absorption;}\n#endif\n#ifdef SHEEN\nvec3 computeSheenLighting(preLightingInfo info,vec3 N,vec3 reflectance0,vec3 reflectance90,float geometricRoughnessFactor,vec3 lightColor) {float NdotH=saturateEps(dot(N,info.H));float roughness=max(info.roughness,geometricRoughnessFactor);float alphaG=convertRoughnessToAverageSlope(roughness);float fresnel=1.;float distribution=normalDistributionFunction_CharlieSheen(NdotH,alphaG);/*#ifdef SHEEN_SOFTER\nfloat visibility=visibility_CharlieSheen(info.NdotL,info.NdotV,alphaG);\n#else */\nfloat visibility=visibility_Ashikhmin(info.NdotL,info.NdotV);/* #endif */\nfloat sheenTerm=fresnel*distribution*visibility;return sheenTerm*info.attenuation*info.NdotL*lightColor;}\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const pbrDirectLightingFunctions = { name, shader };\n//# sourceMappingURL=pbrDirectLightingFunctions.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"pbrIBLFunctions\";\nconst shader = `#if defined(REFLECTION) || defined(SS_REFRACTION)\nfloat getLodFromAlphaG(float cubeMapDimensionPixels,float microsurfaceAverageSlope) {float microsurfaceAverageSlopeTexels=cubeMapDimensionPixels*microsurfaceAverageSlope;float lod=log2(microsurfaceAverageSlopeTexels);return lod;}\nfloat getLinearLodFromRoughness(float cubeMapDimensionPixels,float roughness) {float lod=log2(cubeMapDimensionPixels)*roughness;return lod;}\n#endif\n#if defined(ENVIRONMENTBRDF) && defined(RADIANCEOCCLUSION)\nfloat environmentRadianceOcclusion(float ambientOcclusion,float NdotVUnclamped) {float temp=NdotVUnclamped+ambientOcclusion;return saturate(square(temp)-1.0+ambientOcclusion);}\n#endif\n#if defined(ENVIRONMENTBRDF) && defined(HORIZONOCCLUSION)\nfloat environmentHorizonOcclusion(vec3 view,vec3 normal,vec3 geometricNormal) {vec3 reflection=reflect(view,normal);float temp=saturate(1.0+1.1*dot(reflection,geometricNormal));return square(temp);}\n#endif\n#if defined(LODINREFLECTIONALPHA) || defined(SS_LODINREFRACTIONALPHA)\n#define UNPACK_LOD(x) (1.0-x)*255.0\nfloat getLodFromAlphaG(float cubeMapDimensionPixels,float alphaG,float NdotV) {float microsurfaceAverageSlope=alphaG;microsurfaceAverageSlope*=sqrt(abs(NdotV));return getLodFromAlphaG(cubeMapDimensionPixels,microsurfaceAverageSlope);}\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const pbrIBLFunctions = { name, shader };\n//# sourceMappingURL=pbrIBLFunctions.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nimport \"./decalFragment.js\";\nconst name = \"pbrBlockAlbedoOpacity\";\nconst shader = `struct albedoOpacityOutParams\n{vec3 surfaceAlbedo;float alpha;};\n#define pbr_inline\nvoid albedoOpacityBlock(\nin vec4 vAlbedoColor,\n#ifdef ALBEDO\nin vec4 albedoTexture,\nin vec2 albedoInfos,\n#endif\n#ifdef OPACITY\nin vec4 opacityMap,\nin vec2 vOpacityInfos,\n#endif\n#ifdef DETAIL\nin vec4 detailColor,\nin vec4 vDetailInfos,\n#endif\n#ifdef DECAL\nin vec4 decalColor,\nin vec4 vDecalInfos,\n#endif\nout albedoOpacityOutParams outParams\n)\n{vec3 surfaceAlbedo=vAlbedoColor.rgb;float alpha=vAlbedoColor.a;\n#ifdef ALBEDO\n#if defined(ALPHAFROMALBEDO) || defined(ALPHATEST)\nalpha*=albedoTexture.a;\n#endif\n#ifdef GAMMAALBEDO\nsurfaceAlbedo*=toLinearSpace(albedoTexture.rgb);\n#else\nsurfaceAlbedo*=albedoTexture.rgb;\n#endif\nsurfaceAlbedo*=albedoInfos.y;\n#endif\n#ifndef DECAL_AFTER_DETAIL\n#include\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nsurfaceAlbedo*=vColor.rgb;\n#endif\n#ifdef DETAIL\nfloat detailAlbedo=2.0*mix(0.5,detailColor.r,vDetailInfos.y);surfaceAlbedo.rgb=surfaceAlbedo.rgb*detailAlbedo*detailAlbedo; \n#endif\n#ifdef DECAL_AFTER_DETAIL\n#include\n#endif\n#define CUSTOM_FRAGMENT_UPDATE_ALBEDO\n#ifdef OPACITY\n#ifdef OPACITYRGB\nalpha=getLuminance(opacityMap.rgb);\n#else\nalpha*=opacityMap.a;\n#endif\nalpha*=vOpacityInfos.y;\n#endif\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=vColor.a;\n#endif\n#if !defined(SS_LINKREFRACTIONTOTRANSPARENCY) && !defined(ALPHAFRESNEL)\n#ifdef ALPHATEST \n#if DEBUGMODE != 88\nif (alpha0\n#ifdef METALLICWORKFLOW\nvec2 metallicRoughness;\n#ifdef REFLECTIVITY\nvec4 surfaceMetallicColorMap;\n#endif\n#ifndef FROSTBITE_REFLECTANCE\nvec3 metallicF0;\n#endif\n#else\n#ifdef REFLECTIVITY\nvec4 surfaceReflectivityColorMap;\n#endif\n#endif\n#endif\n};\n#define pbr_inline\nvoid reflectivityBlock(\nin vec4 vReflectivityColor,\n#ifdef METALLICWORKFLOW\nin vec3 surfaceAlbedo,\nin vec4 metallicReflectanceFactors,\n#endif\n#ifdef REFLECTIVITY\nin vec3 reflectivityInfos,\nin vec4 surfaceMetallicOrReflectivityColorMap,\n#endif\n#if defined(METALLICWORKFLOW) && defined(REFLECTIVITY) && defined(AOSTOREINMETALMAPRED)\nin vec3 ambientOcclusionColorIn,\n#endif\n#ifdef MICROSURFACEMAP\nin vec4 microSurfaceTexel,\n#endif\n#ifdef DETAIL\nin vec4 detailColor,\nin vec4 vDetailInfos,\n#endif\nout reflectivityOutParams outParams\n)\n{float microSurface=vReflectivityColor.a;vec3 surfaceReflectivityColor=vReflectivityColor.rgb;\n#ifdef METALLICWORKFLOW\nvec2 metallicRoughness=surfaceReflectivityColor.rg;\n#ifdef REFLECTIVITY\n#if DEBUGMODE>0\noutParams.surfaceMetallicColorMap=surfaceMetallicOrReflectivityColorMap;\n#endif\n#ifdef AOSTOREINMETALMAPRED\nvec3 aoStoreInMetalMap=vec3(surfaceMetallicOrReflectivityColorMap.r,surfaceMetallicOrReflectivityColorMap.r,surfaceMetallicOrReflectivityColorMap.r);outParams.ambientOcclusionColor=mix(ambientOcclusionColorIn,aoStoreInMetalMap,reflectivityInfos.z);\n#endif\n#ifdef METALLNESSSTOREINMETALMAPBLUE\nmetallicRoughness.r*=surfaceMetallicOrReflectivityColorMap.b;\n#else\nmetallicRoughness.r*=surfaceMetallicOrReflectivityColorMap.r;\n#endif\n#ifdef ROUGHNESSSTOREINMETALMAPALPHA\nmetallicRoughness.g*=surfaceMetallicOrReflectivityColorMap.a;\n#else\n#ifdef ROUGHNESSSTOREINMETALMAPGREEN\nmetallicRoughness.g*=surfaceMetallicOrReflectivityColorMap.g;\n#endif\n#endif\n#endif\n#ifdef DETAIL\nfloat detailRoughness=mix(0.5,detailColor.b,vDetailInfos.w);float loLerp=mix(0.,metallicRoughness.g,detailRoughness*2.);float hiLerp=mix(metallicRoughness.g,1.,(detailRoughness-0.5)*2.);metallicRoughness.g=mix(loLerp,hiLerp,step(detailRoughness,0.5));\n#endif\n#ifdef MICROSURFACEMAP\nmetallicRoughness.g*=microSurfaceTexel.r;\n#endif\n#if DEBUGMODE>0\noutParams.metallicRoughness=metallicRoughness;\n#endif\n#define CUSTOM_FRAGMENT_UPDATE_METALLICROUGHNESS\nmicroSurface=1.0-metallicRoughness.g;vec3 baseColor=surfaceAlbedo;\n#ifdef FROSTBITE_REFLECTANCE\noutParams.surfaceAlbedo=baseColor.rgb*(1.0-metallicRoughness.r);surfaceReflectivityColor=mix(0.16*reflectance*reflectance,baseColor,metallicRoughness.r);\n#else\nvec3 metallicF0=metallicReflectanceFactors.rgb;\n#if DEBUGMODE>0\noutParams.metallicF0=metallicF0;\n#endif\noutParams.surfaceAlbedo=mix(baseColor.rgb*(1.0-metallicF0),vec3(0.,0.,0.),metallicRoughness.r);surfaceReflectivityColor=mix(metallicF0,baseColor,metallicRoughness.r);\n#endif\n#else\n#ifdef REFLECTIVITY\nsurfaceReflectivityColor*=surfaceMetallicOrReflectivityColorMap.rgb;\n#if DEBUGMODE>0\noutParams.surfaceReflectivityColorMap=surfaceMetallicOrReflectivityColorMap;\n#endif\n#ifdef MICROSURFACEFROMREFLECTIVITYMAP\nmicroSurface*=surfaceMetallicOrReflectivityColorMap.a;microSurface*=reflectivityInfos.z;\n#else\n#ifdef MICROSURFACEAUTOMATIC\nmicroSurface*=computeDefaultMicroSurface(microSurface,surfaceReflectivityColor);\n#endif\n#ifdef MICROSURFACEMAP\nmicroSurface*=microSurfaceTexel.r;\n#endif\n#define CUSTOM_FRAGMENT_UPDATE_MICROSURFACE\n#endif\n#endif\n#endif\nmicroSurface=saturate(microSurface);float roughness=1.-microSurface;outParams.microSurface=microSurface;outParams.roughness=roughness;outParams.surfaceReflectivityColor=surfaceReflectivityColor;}\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const pbrBlockReflectivity = { name, shader };\n//# sourceMappingURL=pbrBlockReflectivity.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"pbrBlockAmbientOcclusion\";\nconst shader = `struct ambientOcclusionOutParams\n{vec3 ambientOcclusionColor;\n#if DEBUGMODE>0 && defined(AMBIENT)\nvec3 ambientOcclusionColorMap;\n#endif\n};\n#define pbr_inline\nvoid ambientOcclusionBlock(\n#ifdef AMBIENT\nin vec3 ambientOcclusionColorMap_,\nin vec4 vAmbientInfos,\n#endif\nout ambientOcclusionOutParams outParams\n)\n{vec3 ambientOcclusionColor=vec3(1.,1.,1.);\n#ifdef AMBIENT\nvec3 ambientOcclusionColorMap=ambientOcclusionColorMap_*vAmbientInfos.y;\n#ifdef AMBIENTINGRAYSCALE\nambientOcclusionColorMap=vec3(ambientOcclusionColorMap.r,ambientOcclusionColorMap.r,ambientOcclusionColorMap.r);\n#endif\nambientOcclusionColor=mix(ambientOcclusionColor,ambientOcclusionColorMap,vAmbientInfos.z);\n#if DEBUGMODE>0\noutParams.ambientOcclusionColorMap=ambientOcclusionColorMap;\n#endif\n#endif\noutParams.ambientOcclusionColor=ambientOcclusionColor;}\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const pbrBlockAmbientOcclusion = { name, shader };\n//# sourceMappingURL=pbrBlockAmbientOcclusion.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"pbrBlockAlphaFresnel\";\nconst shader = `#ifdef ALPHAFRESNEL\n#if defined(ALPHATEST) || defined(ALPHABLEND)\nstruct alphaFresnelOutParams\n{float alpha;};\n#define pbr_inline\nvoid alphaFresnelBlock(\nin vec3 normalW,\nin vec3 viewDirectionW,\nin float alpha,\nin float microSurface,\nout alphaFresnelOutParams outParams\n)\n{float opacityPerceptual=alpha;\n#ifdef LINEARALPHAFRESNEL\nfloat opacity0=opacityPerceptual;\n#else\nfloat opacity0=opacityPerceptual*opacityPerceptual;\n#endif\nfloat opacity90=fresnelGrazingReflectance(opacity0);vec3 normalForward=faceforward(normalW,-viewDirectionW,normalW);outParams.alpha=getReflectanceFromAnalyticalBRDFLookup_Jones(saturate(dot(viewDirectionW,normalForward)),vec3(opacity0),vec3(opacity90),sqrt(microSurface)).x;\n#ifdef ALPHATEST\nif (outParams.alpha0 && defined(ANISOTROPIC_TEXTURE)\nvec3 anisotropyMapData;\n#endif\n};\n#define pbr_inline\nvoid anisotropicBlock(\nin vec3 vAnisotropy,\nin float roughness,\n#ifdef ANISOTROPIC_TEXTURE\nin vec3 anisotropyMapData,\n#endif\nin mat3 TBN,\nin vec3 normalW,\nin vec3 viewDirectionW,\nout anisotropicOutParams outParams\n)\n{float anisotropy=vAnisotropy.b;vec3 anisotropyDirection=vec3(vAnisotropy.xy,0.);\n#ifdef ANISOTROPIC_TEXTURE\nanisotropy*=anisotropyMapData.b;\n#if DEBUGMODE>0\noutParams.anisotropyMapData=anisotropyMapData;\n#endif\nanisotropyMapData.rg=anisotropyMapData.rg*2.0-1.0;\n#ifdef ANISOTROPIC_LEGACY\nanisotropyDirection.rg*=anisotropyMapData.rg;\n#else\nanisotropyDirection.xy=mat2(anisotropyDirection.x,anisotropyDirection.y,-anisotropyDirection.y,anisotropyDirection.x)*normalize(anisotropyMapData.rg);\n#endif\n#endif\nmat3 anisoTBN=mat3(normalize(TBN[0]),normalize(TBN[1]),normalize(TBN[2]));vec3 anisotropicTangent=normalize(anisoTBN*anisotropyDirection);vec3 anisotropicBitangent=normalize(cross(anisoTBN[2],anisotropicTangent));outParams.anisotropy=anisotropy;outParams.anisotropicTangent=anisotropicTangent;outParams.anisotropicBitangent=anisotropicBitangent;outParams.anisotropicNormal=getAnisotropicBentNormals(anisotropicTangent,anisotropicBitangent,normalW,viewDirectionW,anisotropy,roughness);}\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const pbrBlockAnisotropic = { name, shader };\n//# sourceMappingURL=pbrBlockAnisotropic.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"pbrBlockReflection\";\nconst shader = `#ifdef REFLECTION\nstruct reflectionOutParams\n{vec4 environmentRadiance;vec3 environmentIrradiance;\n#ifdef REFLECTIONMAP_3D\nvec3 reflectionCoords;\n#else\nvec2 reflectionCoords;\n#endif\n#ifdef SS_TRANSLUCENCY\n#ifdef USESPHERICALFROMREFLECTIONMAP\n#if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)\nvec3 irradianceVector;\n#endif\n#endif\n#endif\n};\n#define pbr_inline\nvoid createReflectionCoords(\nin vec3 vPositionW,\nin vec3 normalW,\n#ifdef ANISOTROPIC\nin anisotropicOutParams anisotropicOut,\n#endif\n#ifdef REFLECTIONMAP_3D\nout vec3 reflectionCoords\n#else\nout vec2 reflectionCoords\n#endif\n)\n{\n#ifdef ANISOTROPIC\nvec3 reflectionVector=computeReflectionCoords(vec4(vPositionW,1.0),anisotropicOut.anisotropicNormal);\n#else\nvec3 reflectionVector=computeReflectionCoords(vec4(vPositionW,1.0),normalW);\n#endif\n#ifdef REFLECTIONMAP_OPPOSITEZ\nreflectionVector.z*=-1.0;\n#endif\n#ifdef REFLECTIONMAP_3D\nreflectionCoords=reflectionVector;\n#else\nreflectionCoords=reflectionVector.xy;\n#ifdef REFLECTIONMAP_PROJECTION\nreflectionCoords/=reflectionVector.z;\n#endif\nreflectionCoords.y=1.0-reflectionCoords.y;\n#endif\n}\n#define pbr_inline\n#define inline\nvoid sampleReflectionTexture(\nin float alphaG,\nin vec3 vReflectionMicrosurfaceInfos,\nin vec2 vReflectionInfos,\nin vec3 vReflectionColor,\n#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)\nin float NdotVUnclamped,\n#endif\n#ifdef LINEARSPECULARREFLECTION\nin float roughness,\n#endif\n#ifdef REFLECTIONMAP_3D\nin samplerCube reflectionSampler,\nconst vec3 reflectionCoords,\n#else\nin sampler2D reflectionSampler,\nconst vec2 reflectionCoords,\n#endif\n#ifndef LODBASEDMICROSFURACE\n#ifdef REFLECTIONMAP_3D\nin samplerCube reflectionSamplerLow,\nin samplerCube reflectionSamplerHigh,\n#else\nin sampler2D reflectionSamplerLow,\nin sampler2D reflectionSamplerHigh,\n#endif\n#endif\n#ifdef REALTIME_FILTERING\nin vec2 vReflectionFilteringInfo,\n#endif\nout vec4 environmentRadiance\n)\n{\n#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)\nfloat reflectionLOD=getLodFromAlphaG(vReflectionMicrosurfaceInfos.x,alphaG,NdotVUnclamped);\n#elif defined(LINEARSPECULARREFLECTION)\nfloat reflectionLOD=getLinearLodFromRoughness(vReflectionMicrosurfaceInfos.x,roughness);\n#else\nfloat reflectionLOD=getLodFromAlphaG(vReflectionMicrosurfaceInfos.x,alphaG);\n#endif\n#ifdef LODBASEDMICROSFURACE\nreflectionLOD=reflectionLOD*vReflectionMicrosurfaceInfos.y+vReflectionMicrosurfaceInfos.z;\n#ifdef LODINREFLECTIONALPHA\nfloat automaticReflectionLOD=UNPACK_LOD(sampleReflection(reflectionSampler,reflectionCoords).a);float requestedReflectionLOD=max(automaticReflectionLOD,reflectionLOD);\n#else\nfloat requestedReflectionLOD=reflectionLOD;\n#endif\n#ifdef REALTIME_FILTERING\nenvironmentRadiance=vec4(radiance(alphaG,reflectionSampler,reflectionCoords,vReflectionFilteringInfo),1.0);\n#else\nenvironmentRadiance=sampleReflectionLod(reflectionSampler,reflectionCoords,reflectionLOD);\n#endif\n#else\nfloat lodReflectionNormalized=saturate(reflectionLOD/log2(vReflectionMicrosurfaceInfos.x));float lodReflectionNormalizedDoubled=lodReflectionNormalized*2.0;vec4 environmentMid=sampleReflection(reflectionSampler,reflectionCoords);if (lodReflectionNormalizedDoubled<1.0){environmentRadiance=mix(\nsampleReflection(reflectionSamplerHigh,reflectionCoords),\nenvironmentMid,\nlodReflectionNormalizedDoubled\n);} else {environmentRadiance=mix(\nenvironmentMid,\nsampleReflection(reflectionSamplerLow,reflectionCoords),\nlodReflectionNormalizedDoubled-1.0\n);}\n#endif\n#ifdef RGBDREFLECTION\nenvironmentRadiance.rgb=fromRGBD(environmentRadiance);\n#endif\n#ifdef GAMMAREFLECTION\nenvironmentRadiance.rgb=toLinearSpace(environmentRadiance.rgb);\n#endif\nenvironmentRadiance.rgb*=vReflectionInfos.x;environmentRadiance.rgb*=vReflectionColor.rgb;}\n#define pbr_inline\n#define inline\nvoid reflectionBlock(\nin vec3 vPositionW,\nin vec3 normalW,\nin float alphaG,\nin vec3 vReflectionMicrosurfaceInfos,\nin vec2 vReflectionInfos,\nin vec3 vReflectionColor,\n#ifdef ANISOTROPIC\nin anisotropicOutParams anisotropicOut,\n#endif\n#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)\nin float NdotVUnclamped,\n#endif\n#ifdef LINEARSPECULARREFLECTION\nin float roughness,\n#endif\n#ifdef REFLECTIONMAP_3D\nin samplerCube reflectionSampler,\n#else\nin sampler2D reflectionSampler,\n#endif\n#if defined(NORMAL) && defined(USESPHERICALINVERTEX)\nin vec3 vEnvironmentIrradiance,\n#endif\n#ifdef USESPHERICALFROMREFLECTIONMAP\n#if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)\nin mat4 reflectionMatrix,\n#endif\n#endif\n#ifdef USEIRRADIANCEMAP\n#ifdef REFLECTIONMAP_3D\nin samplerCube irradianceSampler,\n#else\nin sampler2D irradianceSampler,\n#endif\n#endif\n#ifndef LODBASEDMICROSFURACE\n#ifdef REFLECTIONMAP_3D\nin samplerCube reflectionSamplerLow,\nin samplerCube reflectionSamplerHigh,\n#else\nin sampler2D reflectionSamplerLow,\nin sampler2D reflectionSamplerHigh,\n#endif\n#endif\n#ifdef REALTIME_FILTERING\nin vec2 vReflectionFilteringInfo,\n#endif\nout reflectionOutParams outParams\n)\n{vec4 environmentRadiance=vec4(0.,0.,0.,0.);\n#ifdef REFLECTIONMAP_3D\nvec3 reflectionCoords=vec3(0.);\n#else\nvec2 reflectionCoords=vec2(0.);\n#endif\ncreateReflectionCoords(\nvPositionW,\nnormalW,\n#ifdef ANISOTROPIC\nanisotropicOut,\n#endif\nreflectionCoords\n);sampleReflectionTexture(\nalphaG,\nvReflectionMicrosurfaceInfos,\nvReflectionInfos,\nvReflectionColor,\n#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)\nNdotVUnclamped,\n#endif\n#ifdef LINEARSPECULARREFLECTION\nroughness,\n#endif\n#ifdef REFLECTIONMAP_3D\nreflectionSampler,\nreflectionCoords,\n#else\nreflectionSampler,\nreflectionCoords,\n#endif\n#ifndef LODBASEDMICROSFURACE\nreflectionSamplerLow,\nreflectionSamplerHigh,\n#endif\n#ifdef REALTIME_FILTERING\nvReflectionFilteringInfo,\n#endif\nenvironmentRadiance\n);vec3 environmentIrradiance=vec3(0.,0.,0.);\n#ifdef USESPHERICALFROMREFLECTIONMAP\n#if defined(NORMAL) && defined(USESPHERICALINVERTEX)\nenvironmentIrradiance=vEnvironmentIrradiance;\n#else\n#ifdef ANISOTROPIC\nvec3 irradianceVector=vec3(reflectionMatrix*vec4(anisotropicOut.anisotropicNormal,0)).xyz;\n#else\nvec3 irradianceVector=vec3(reflectionMatrix*vec4(normalW,0)).xyz;\n#endif\n#ifdef REFLECTIONMAP_OPPOSITEZ\nirradianceVector.z*=-1.0;\n#endif\n#ifdef INVERTCUBICMAP\nirradianceVector.y*=-1.0;\n#endif\n#if defined(REALTIME_FILTERING)\nenvironmentIrradiance=irradiance(reflectionSampler,irradianceVector,vReflectionFilteringInfo);\n#else\nenvironmentIrradiance=computeEnvironmentIrradiance(irradianceVector);\n#endif\n#ifdef SS_TRANSLUCENCY\noutParams.irradianceVector=irradianceVector;\n#endif\n#endif\n#elif defined(USEIRRADIANCEMAP)\nvec4 environmentIrradiance4=sampleReflection(irradianceSampler,reflectionCoords);environmentIrradiance=environmentIrradiance4.rgb;\n#ifdef RGBDREFLECTION\nenvironmentIrradiance.rgb=fromRGBD(environmentIrradiance4);\n#endif\n#ifdef GAMMAREFLECTION\nenvironmentIrradiance.rgb=toLinearSpace(environmentIrradiance.rgb);\n#endif\n#endif\nenvironmentIrradiance*=vReflectionColor.rgb;outParams.environmentRadiance=environmentRadiance;outParams.environmentIrradiance=environmentIrradiance;outParams.reflectionCoords=reflectionCoords;}\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const pbrBlockReflection = { name, shader };\n//# sourceMappingURL=pbrBlockReflection.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"pbrBlockSheen\";\nconst shader = `#ifdef SHEEN\nstruct sheenOutParams\n{float sheenIntensity;vec3 sheenColor;float sheenRoughness;\n#ifdef SHEEN_LINKWITHALBEDO\nvec3 surfaceAlbedo;\n#endif\n#if defined(ENVIRONMENTBRDF) && defined(SHEEN_ALBEDOSCALING)\nfloat sheenAlbedoScaling;\n#endif\n#if defined(REFLECTION) && defined(ENVIRONMENTBRDF)\nvec3 finalSheenRadianceScaled;\n#endif\n#if DEBUGMODE>0\n#ifdef SHEEN_TEXTURE\nvec4 sheenMapData;\n#endif\n#if defined(REFLECTION) && defined(ENVIRONMENTBRDF)\nvec3 sheenEnvironmentReflectance;\n#endif\n#endif\n};\n#define pbr_inline\n#define inline\nvoid sheenBlock(\nin vec4 vSheenColor,\n#ifdef SHEEN_ROUGHNESS\nin float vSheenRoughness,\n#if defined(SHEEN_TEXTURE_ROUGHNESS) && !defined(SHEEN_TEXTURE_ROUGHNESS_IDENTICAL) && !defined(SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE)\nin vec4 sheenMapRoughnessData,\n#endif\n#endif\nin float roughness,\n#ifdef SHEEN_TEXTURE\nin vec4 sheenMapData,\nin float sheenMapLevel,\n#endif\nin float reflectance,\n#ifdef SHEEN_LINKWITHALBEDO\nin vec3 baseColor,\nin vec3 surfaceAlbedo,\n#endif\n#ifdef ENVIRONMENTBRDF\nin float NdotV,\nin vec3 environmentBrdf,\n#endif\n#if defined(REFLECTION) && defined(ENVIRONMENTBRDF)\nin vec2 AARoughnessFactors,\nin vec3 vReflectionMicrosurfaceInfos,\nin vec2 vReflectionInfos,\nin vec3 vReflectionColor,\nin vec4 vLightingIntensity,\n#ifdef REFLECTIONMAP_3D\nin samplerCube reflectionSampler,\nin vec3 reflectionCoords,\n#else\nin sampler2D reflectionSampler,\nin vec2 reflectionCoords,\n#endif\nin float NdotVUnclamped,\n#ifndef LODBASEDMICROSFURACE\n#ifdef REFLECTIONMAP_3D\nin samplerCube reflectionSamplerLow,\nin samplerCube reflectionSamplerHigh,\n#else\nin sampler2D reflectionSamplerLow,\nin sampler2D reflectionSamplerHigh,\n#endif\n#endif\n#ifdef REALTIME_FILTERING\nin vec2 vReflectionFilteringInfo,\n#endif\n#if !defined(REFLECTIONMAP_SKYBOX) && defined(RADIANCEOCCLUSION)\nin float seo,\n#endif\n#if !defined(REFLECTIONMAP_SKYBOX) && defined(HORIZONOCCLUSION) && defined(BUMP) && defined(REFLECTIONMAP_3D)\nin float eho,\n#endif\n#endif\nout sheenOutParams outParams\n)\n{float sheenIntensity=vSheenColor.a;\n#ifdef SHEEN_TEXTURE\n#if DEBUGMODE>0\noutParams.sheenMapData=sheenMapData;\n#endif\n#endif\n#ifdef SHEEN_LINKWITHALBEDO\nfloat sheenFactor=pow5(1.0-sheenIntensity);vec3 sheenColor=baseColor.rgb*(1.0-sheenFactor);float sheenRoughness=sheenIntensity;outParams.surfaceAlbedo=surfaceAlbedo*sheenFactor;\n#ifdef SHEEN_TEXTURE\nsheenIntensity*=sheenMapData.a;\n#endif\n#else\nvec3 sheenColor=vSheenColor.rgb;\n#ifdef SHEEN_TEXTURE\n#ifdef SHEEN_GAMMATEXTURE\nsheenColor.rgb*=toLinearSpace(sheenMapData.rgb);\n#else\nsheenColor.rgb*=sheenMapData.rgb;\n#endif\nsheenColor.rgb*=sheenMapLevel;\n#endif\n#ifdef SHEEN_ROUGHNESS\nfloat sheenRoughness=vSheenRoughness;\n#ifdef SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE\n#if defined(SHEEN_TEXTURE)\nsheenRoughness*=sheenMapData.a;\n#endif\n#elif defined(SHEEN_TEXTURE_ROUGHNESS)\n#ifdef SHEEN_TEXTURE_ROUGHNESS_IDENTICAL\nsheenRoughness*=sheenMapData.a;\n#else\nsheenRoughness*=sheenMapRoughnessData.a;\n#endif\n#endif\n#else\nfloat sheenRoughness=roughness;\n#ifdef SHEEN_TEXTURE\nsheenIntensity*=sheenMapData.a;\n#endif\n#endif\n#if !defined(SHEEN_ALBEDOSCALING)\nsheenIntensity*=(1.-reflectance);\n#endif\nsheenColor*=sheenIntensity;\n#endif\n#ifdef ENVIRONMENTBRDF\n/*#ifdef SHEEN_SOFTER\nvec3 environmentSheenBrdf=vec3(0.,0.,getBRDFLookupCharlieSheen(NdotV,sheenRoughness));\n#else*/\n#ifdef SHEEN_ROUGHNESS\nvec3 environmentSheenBrdf=getBRDFLookup(NdotV,sheenRoughness);\n#else\nvec3 environmentSheenBrdf=environmentBrdf;\n#endif\n/*#endif*/\n#endif\n#if defined(REFLECTION) && defined(ENVIRONMENTBRDF)\nfloat sheenAlphaG=convertRoughnessToAverageSlope(sheenRoughness);\n#ifdef SPECULARAA\nsheenAlphaG+=AARoughnessFactors.y;\n#endif\nvec4 environmentSheenRadiance=vec4(0.,0.,0.,0.);sampleReflectionTexture(\nsheenAlphaG,\nvReflectionMicrosurfaceInfos,\nvReflectionInfos,\nvReflectionColor,\n#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)\nNdotVUnclamped,\n#endif\n#ifdef LINEARSPECULARREFLECTION\nsheenRoughness,\n#endif\nreflectionSampler,\nreflectionCoords,\n#ifndef LODBASEDMICROSFURACE\nreflectionSamplerLow,\nreflectionSamplerHigh,\n#endif\n#ifdef REALTIME_FILTERING\nvReflectionFilteringInfo,\n#endif\nenvironmentSheenRadiance\n);vec3 sheenEnvironmentReflectance=getSheenReflectanceFromBRDFLookup(sheenColor,environmentSheenBrdf);\n#if !defined(REFLECTIONMAP_SKYBOX) && defined(RADIANCEOCCLUSION)\nsheenEnvironmentReflectance*=seo;\n#endif\n#if !defined(REFLECTIONMAP_SKYBOX) && defined(HORIZONOCCLUSION) && defined(BUMP) && defined(REFLECTIONMAP_3D)\nsheenEnvironmentReflectance*=eho;\n#endif\n#if DEBUGMODE>0\noutParams.sheenEnvironmentReflectance=sheenEnvironmentReflectance;\n#endif\noutParams.finalSheenRadianceScaled=\nenvironmentSheenRadiance.rgb *\nsheenEnvironmentReflectance *\nvLightingIntensity.z;\n#endif\n#if defined(ENVIRONMENTBRDF) && defined(SHEEN_ALBEDOSCALING)\noutParams.sheenAlbedoScaling=1.0-sheenIntensity*max(max(sheenColor.r,sheenColor.g),sheenColor.b)*environmentSheenBrdf.b;\n#endif\noutParams.sheenIntensity=sheenIntensity;outParams.sheenColor=sheenColor;outParams.sheenRoughness=sheenRoughness;}\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const pbrBlockSheen = { name, shader };\n//# sourceMappingURL=pbrBlockSheen.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"pbrBlockClearcoat\";\nconst shader = `struct clearcoatOutParams\n{vec3 specularEnvironmentR0;float conservationFactor;vec3 clearCoatNormalW;vec2 clearCoatAARoughnessFactors;float clearCoatIntensity;float clearCoatRoughness;\n#ifdef REFLECTION\nvec3 finalClearCoatRadianceScaled;\n#endif\n#ifdef CLEARCOAT_TINT\nvec3 absorption;float clearCoatNdotVRefract;vec3 clearCoatColor;float clearCoatThickness;\n#endif\n#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)\nvec3 energyConservationFactorClearCoat;\n#endif\n#if DEBUGMODE>0\n#ifdef CLEARCOAT_BUMP\nmat3 TBNClearCoat;\n#endif\n#ifdef CLEARCOAT_TEXTURE\nvec2 clearCoatMapData;\n#endif\n#if defined(CLEARCOAT_TINT) && defined(CLEARCOAT_TINT_TEXTURE)\nvec4 clearCoatTintMapData;\n#endif\n#ifdef REFLECTION\nvec4 environmentClearCoatRadiance;vec3 clearCoatEnvironmentReflectance;\n#endif\nfloat clearCoatNdotV;\n#endif\n};\n#ifdef CLEARCOAT\n#define pbr_inline\n#define inline\nvoid clearcoatBlock(\nin vec3 vPositionW,\nin vec3 geometricNormalW,\nin vec3 viewDirectionW,\nin vec2 vClearCoatParams,\n#if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && !defined(CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL) && !defined(CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE)\nin vec4 clearCoatMapRoughnessData,\n#endif\nin vec3 specularEnvironmentR0,\n#ifdef CLEARCOAT_TEXTURE\nin vec2 clearCoatMapData,\n#endif\n#ifdef CLEARCOAT_TINT\nin vec4 vClearCoatTintParams,\nin float clearCoatColorAtDistance,\nin vec4 vClearCoatRefractionParams,\n#ifdef CLEARCOAT_TINT_TEXTURE\nin vec4 clearCoatTintMapData,\n#endif\n#endif\n#ifdef CLEARCOAT_BUMP\nin vec2 vClearCoatBumpInfos,\nin vec4 clearCoatBumpMapData,\nin vec2 vClearCoatBumpUV,\n#if defined(TANGENT) && defined(NORMAL)\nin mat3 vTBN,\n#else\nin vec2 vClearCoatTangentSpaceParams,\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\nin mat4 normalMatrix,\n#endif\n#endif\n#if defined(FORCENORMALFORWARD) && defined(NORMAL)\nin vec3 faceNormal,\n#endif\n#ifdef REFLECTION\nin vec3 vReflectionMicrosurfaceInfos,\nin vec2 vReflectionInfos,\nin vec3 vReflectionColor,\nin vec4 vLightingIntensity,\n#ifdef REFLECTIONMAP_3D\nin samplerCube reflectionSampler,\n#else\nin sampler2D reflectionSampler,\n#endif\n#ifndef LODBASEDMICROSFURACE\n#ifdef REFLECTIONMAP_3D\nin samplerCube reflectionSamplerLow,\nin samplerCube reflectionSamplerHigh,\n#else\nin sampler2D reflectionSamplerLow,\nin sampler2D reflectionSamplerHigh,\n#endif\n#endif\n#ifdef REALTIME_FILTERING\nin vec2 vReflectionFilteringInfo,\n#endif\n#endif\n#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\n#ifdef RADIANCEOCCLUSION\nin float ambientMonochrome,\n#endif\n#endif\n#if defined(CLEARCOAT_BUMP) || defined(TWOSIDEDLIGHTING)\nin float frontFacingMultiplier,\n#endif\nout clearcoatOutParams outParams\n)\n{float clearCoatIntensity=vClearCoatParams.x;float clearCoatRoughness=vClearCoatParams.y;\n#ifdef CLEARCOAT_TEXTURE\nclearCoatIntensity*=clearCoatMapData.x;\n#ifdef CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE\nclearCoatRoughness*=clearCoatMapData.y;\n#endif\n#if DEBUGMODE>0\noutParams.clearCoatMapData=clearCoatMapData;\n#endif\n#endif\n#if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && !defined(CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE)\n#ifdef CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL\nclearCoatRoughness*=clearCoatMapData.y;\n#else\nclearCoatRoughness*=clearCoatMapRoughnessData.y;\n#endif\n#endif\noutParams.clearCoatIntensity=clearCoatIntensity;outParams.clearCoatRoughness=clearCoatRoughness;\n#ifdef CLEARCOAT_TINT\nvec3 clearCoatColor=vClearCoatTintParams.rgb;float clearCoatThickness=vClearCoatTintParams.a;\n#ifdef CLEARCOAT_TINT_TEXTURE\n#ifdef CLEARCOAT_TINT_GAMMATEXTURE\nclearCoatColor*=toLinearSpace(clearCoatTintMapData.rgb);\n#else\nclearCoatColor*=clearCoatTintMapData.rgb;\n#endif\nclearCoatThickness*=clearCoatTintMapData.a;\n#if DEBUGMODE>0\noutParams.clearCoatTintMapData=clearCoatTintMapData;\n#endif\n#endif\noutParams.clearCoatColor=computeColorAtDistanceInMedia(clearCoatColor,clearCoatColorAtDistance);outParams.clearCoatThickness=clearCoatThickness;\n#endif\n#ifdef CLEARCOAT_REMAP_F0\nvec3 specularEnvironmentR0Updated=getR0RemappedForClearCoat(specularEnvironmentR0);\n#else\nvec3 specularEnvironmentR0Updated=specularEnvironmentR0;\n#endif\noutParams.specularEnvironmentR0=mix(specularEnvironmentR0,specularEnvironmentR0Updated,clearCoatIntensity);vec3 clearCoatNormalW=geometricNormalW;\n#ifdef CLEARCOAT_BUMP\n#ifdef NORMALXYSCALE\nfloat clearCoatNormalScale=1.0;\n#else\nfloat clearCoatNormalScale=vClearCoatBumpInfos.y;\n#endif\n#if defined(TANGENT) && defined(NORMAL)\nmat3 TBNClearCoat=vTBN;\n#else\nvec2 TBNClearCoatUV=vClearCoatBumpUV*frontFacingMultiplier;mat3 TBNClearCoat=cotangent_frame(clearCoatNormalW*clearCoatNormalScale,vPositionW,TBNClearCoatUV,vClearCoatTangentSpaceParams);\n#endif\n#if DEBUGMODE>0\noutParams.TBNClearCoat=TBNClearCoat;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\nclearCoatNormalW=normalize(clearCoatBumpMapData.xyz *2.0-1.0);clearCoatNormalW=normalize(mat3(normalMatrix)*clearCoatNormalW);\n#else\nclearCoatNormalW=perturbNormal(TBNClearCoat,clearCoatBumpMapData.xyz,vClearCoatBumpInfos.y);\n#endif\n#endif\n#if defined(FORCENORMALFORWARD) && defined(NORMAL)\nclearCoatNormalW*=sign(dot(clearCoatNormalW,faceNormal));\n#endif\n#if defined(TWOSIDEDLIGHTING) && defined(NORMAL)\nclearCoatNormalW=clearCoatNormalW*frontFacingMultiplier;\n#endif\noutParams.clearCoatNormalW=clearCoatNormalW;outParams.clearCoatAARoughnessFactors=getAARoughnessFactors(clearCoatNormalW.xyz);float clearCoatNdotVUnclamped=dot(clearCoatNormalW,viewDirectionW);float clearCoatNdotV=absEps(clearCoatNdotVUnclamped);\n#if DEBUGMODE>0\noutParams.clearCoatNdotV=clearCoatNdotV;\n#endif\n#ifdef CLEARCOAT_TINT\nvec3 clearCoatVRefract=refract(-viewDirectionW,clearCoatNormalW,vClearCoatRefractionParams.y);outParams.clearCoatNdotVRefract=absEps(dot(clearCoatNormalW,clearCoatVRefract));\n#endif\n#if defined(ENVIRONMENTBRDF) && (!defined(REFLECTIONMAP_SKYBOX) || defined(MS_BRDF_ENERGY_CONSERVATION))\nvec3 environmentClearCoatBrdf=getBRDFLookup(clearCoatNdotV,clearCoatRoughness);\n#endif\n#if defined(REFLECTION)\nfloat clearCoatAlphaG=convertRoughnessToAverageSlope(clearCoatRoughness);\n#ifdef SPECULARAA\nclearCoatAlphaG+=outParams.clearCoatAARoughnessFactors.y;\n#endif\nvec4 environmentClearCoatRadiance=vec4(0.,0.,0.,0.);vec3 clearCoatReflectionVector=computeReflectionCoords(vec4(vPositionW,1.0),clearCoatNormalW);\n#ifdef REFLECTIONMAP_OPPOSITEZ\nclearCoatReflectionVector.z*=-1.0;\n#endif\n#ifdef REFLECTIONMAP_3D\nvec3 clearCoatReflectionCoords=clearCoatReflectionVector;\n#else\nvec2 clearCoatReflectionCoords=clearCoatReflectionVector.xy;\n#ifdef REFLECTIONMAP_PROJECTION\nclearCoatReflectionCoords/=clearCoatReflectionVector.z;\n#endif\nclearCoatReflectionCoords.y=1.0-clearCoatReflectionCoords.y;\n#endif\nsampleReflectionTexture(\nclearCoatAlphaG,\nvReflectionMicrosurfaceInfos,\nvReflectionInfos,\nvReflectionColor,\n#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)\nclearCoatNdotVUnclamped,\n#endif\n#ifdef LINEARSPECULARREFLECTION\nclearCoatRoughness,\n#endif\nreflectionSampler,\nclearCoatReflectionCoords,\n#ifndef LODBASEDMICROSFURACE\nreflectionSamplerLow,\nreflectionSamplerHigh,\n#endif\n#ifdef REALTIME_FILTERING\nvReflectionFilteringInfo,\n#endif\nenvironmentClearCoatRadiance\n);\n#if DEBUGMODE>0\noutParams.environmentClearCoatRadiance=environmentClearCoatRadiance;\n#endif\n#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\nvec3 clearCoatEnvironmentReflectance=getReflectanceFromBRDFLookup(vec3(vClearCoatRefractionParams.x),environmentClearCoatBrdf);\n#ifdef HORIZONOCCLUSION\n#ifdef BUMP\n#ifdef REFLECTIONMAP_3D\nfloat clearCoatEho=environmentHorizonOcclusion(-viewDirectionW,clearCoatNormalW,geometricNormalW);clearCoatEnvironmentReflectance*=clearCoatEho;\n#endif\n#endif\n#endif\n#else\nvec3 clearCoatEnvironmentReflectance=getReflectanceFromAnalyticalBRDFLookup_Jones(clearCoatNdotV,vec3(1.),vec3(1.),sqrt(1.-clearCoatRoughness));\n#endif\nclearCoatEnvironmentReflectance*=clearCoatIntensity;\n#if DEBUGMODE>0\noutParams.clearCoatEnvironmentReflectance=clearCoatEnvironmentReflectance;\n#endif\noutParams.finalClearCoatRadianceScaled=\nenvironmentClearCoatRadiance.rgb *\nclearCoatEnvironmentReflectance *\nvLightingIntensity.z;\n#endif\n#if defined(CLEARCOAT_TINT)\noutParams.absorption=computeClearCoatAbsorption(outParams.clearCoatNdotVRefract,outParams.clearCoatNdotVRefract,outParams.clearCoatColor,clearCoatThickness,clearCoatIntensity);\n#endif\nfloat fresnelIBLClearCoat=fresnelSchlickGGX(clearCoatNdotV,vClearCoatRefractionParams.x,CLEARCOATREFLECTANCE90);fresnelIBLClearCoat*=clearCoatIntensity;outParams.conservationFactor=(1.-fresnelIBLClearCoat);\n#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)\noutParams.energyConservationFactorClearCoat=getEnergyConservationFactor(outParams.specularEnvironmentR0,environmentClearCoatBrdf);\n#endif\n}\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const pbrBlockClearcoat = { name, shader };\n//# sourceMappingURL=pbrBlockClearcoat.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"pbrBlockIridescence\";\nconst shader = `struct iridescenceOutParams\n{float iridescenceIntensity;float iridescenceIOR;float iridescenceThickness;vec3 specularEnvironmentR0;};\n#ifdef IRIDESCENCE\n#define pbr_inline\n#define inline\nvoid iridescenceBlock(\nin vec4 vIridescenceParams,\nin float viewAngle,\nin vec3 specularEnvironmentR0,\n#ifdef IRIDESCENCE_TEXTURE\nin vec2 iridescenceMapData,\n#endif\n#ifdef IRIDESCENCE_THICKNESS_TEXTURE\nin vec2 iridescenceThicknessMapData,\n#endif\n#ifdef CLEARCOAT\nin float NdotVUnclamped,\n#ifdef CLEARCOAT_TEXTURE\nin vec2 clearCoatMapData,\n#endif\n#endif\nout iridescenceOutParams outParams\n)\n{float iridescenceIntensity=vIridescenceParams.x;float iridescenceIOR=vIridescenceParams.y;float iridescenceThicknessMin=vIridescenceParams.z;float iridescenceThicknessMax=vIridescenceParams.w;float iridescenceThicknessWeight=1.;\n#ifdef IRIDESCENCE_TEXTURE\niridescenceIntensity*=iridescenceMapData.x;\n#ifdef IRIDESCENCE_USE_THICKNESS_FROM_MAINTEXTURE\niridescenceThicknessWeight=iridescenceMapData.g;\n#endif\n#endif\n#if defined(IRIDESCENCE_THICKNESS_TEXTURE)\niridescenceThicknessWeight=iridescenceThicknessMapData.g;\n#endif\nfloat iridescenceThickness=mix(iridescenceThicknessMin,iridescenceThicknessMax,iridescenceThicknessWeight);float topIor=1.; \n#ifdef CLEARCOAT\nfloat clearCoatIntensity=vClearCoatParams.x;\n#ifdef CLEARCOAT_TEXTURE\nclearCoatIntensity*=clearCoatMapData.x;\n#endif\ntopIor=mix(1.0,vClearCoatRefractionParams.w-1.,clearCoatIntensity);viewAngle=sqrt(1.0+square(1.0/topIor)*(square(NdotVUnclamped)-1.0));\n#endif\nvec3 iridescenceFresnel=evalIridescence(topIor,iridescenceIOR,viewAngle,iridescenceThickness,specularEnvironmentR0);outParams.specularEnvironmentR0=mix(specularEnvironmentR0,iridescenceFresnel,iridescenceIntensity);outParams.iridescenceIntensity=iridescenceIntensity;outParams.iridescenceThickness=iridescenceThickness;outParams.iridescenceIOR=iridescenceIOR;}\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const pbrBlockIridescence = { name, shader };\n//# sourceMappingURL=pbrBlockIridescence.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"pbrBlockSubSurface\";\nconst shader = `struct subSurfaceOutParams\n{vec3 specularEnvironmentReflectance;\n#ifdef SS_REFRACTION\nvec3 finalRefraction;vec3 surfaceAlbedo;\n#ifdef SS_LINKREFRACTIONTOTRANSPARENCY\nfloat alpha;\n#endif\n#ifdef REFLECTION\nfloat refractionFactorForIrradiance;\n#endif\n#endif\n#ifdef SS_TRANSLUCENCY\nvec3 transmittance;float translucencyIntensity;\n#ifdef REFLECTION\nvec3 refractionIrradiance;\n#endif\n#endif\n#if DEBUGMODE>0\n#ifdef SS_THICKNESSANDMASK_TEXTURE\nvec4 thicknessMap;\n#endif\n#ifdef SS_REFRACTION\nvec4 environmentRefraction;vec3 refractionTransmittance;\n#endif\n#endif\n};\n#ifdef SUBSURFACE\n#define pbr_inline\n#define inline\nvoid subSurfaceBlock(\nin vec3 vSubSurfaceIntensity,\nin vec2 vThicknessParam,\nin vec4 vTintColor,\nin vec3 normalW,\nin vec3 specularEnvironmentReflectance,\n#ifdef SS_THICKNESSANDMASK_TEXTURE\nin vec4 thicknessMap,\n#endif\n#ifdef SS_REFRACTIONINTENSITY_TEXTURE\nin vec4 refractionIntensityMap,\n#endif\n#ifdef SS_TRANSLUCENCYINTENSITY_TEXTURE\nin vec4 translucencyIntensityMap,\n#endif\n#ifdef REFLECTION\n#ifdef SS_TRANSLUCENCY\nin mat4 reflectionMatrix,\n#ifdef USESPHERICALFROMREFLECTIONMAP\n#if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)\nin vec3 irradianceVector_,\n#endif\n#if defined(REALTIME_FILTERING)\nin samplerCube reflectionSampler,\nin vec2 vReflectionFilteringInfo,\n#endif\n#endif\n#ifdef USEIRRADIANCEMAP\n#ifdef REFLECTIONMAP_3D\nin samplerCube irradianceSampler,\n#else\nin sampler2D irradianceSampler,\n#endif\n#endif\n#endif\n#endif\n#if defined(SS_REFRACTION) || defined(SS_TRANSLUCENCY)\nin vec3 surfaceAlbedo,\n#endif\n#ifdef SS_REFRACTION\nin vec3 vPositionW,\nin vec3 viewDirectionW,\nin mat4 view,\nin vec4 vRefractionInfos,\nin mat4 refractionMatrix,\nin vec4 vRefractionMicrosurfaceInfos,\nin vec4 vLightingIntensity,\n#ifdef SS_LINKREFRACTIONTOTRANSPARENCY\nin float alpha,\n#endif\n#ifdef SS_LODINREFRACTIONALPHA\nin float NdotVUnclamped,\n#endif\n#ifdef SS_LINEARSPECULARREFRACTION\nin float roughness,\n#endif\nin float alphaG,\n#ifdef SS_REFRACTIONMAP_3D\nin samplerCube refractionSampler,\n#ifndef LODBASEDMICROSFURACE\nin samplerCube refractionSamplerLow,\nin samplerCube refractionSamplerHigh,\n#endif\n#else\nin sampler2D refractionSampler,\n#ifndef LODBASEDMICROSFURACE\nin sampler2D refractionSamplerLow,\nin sampler2D refractionSamplerHigh,\n#endif\n#endif\n#ifdef ANISOTROPIC\nin anisotropicOutParams anisotropicOut,\n#endif\n#ifdef REALTIME_FILTERING\nin vec2 vRefractionFilteringInfo,\n#endif\n#ifdef SS_USE_LOCAL_REFRACTIONMAP_CUBIC\nin vec3 refractionPosition,\nin vec3 refractionSize,\n#endif\n#endif\n#ifdef SS_TRANSLUCENCY\nin vec3 vDiffusionDistance,\n#endif\nout subSurfaceOutParams outParams\n)\n{outParams.specularEnvironmentReflectance=specularEnvironmentReflectance;\n#ifdef SS_REFRACTION\nfloat refractionIntensity=vSubSurfaceIntensity.x;\n#ifdef SS_LINKREFRACTIONTOTRANSPARENCY\nrefractionIntensity*=(1.0-alpha);outParams.alpha=1.0;\n#endif\n#endif\n#ifdef SS_TRANSLUCENCY\nfloat translucencyIntensity=vSubSurfaceIntensity.y;\n#endif\n#ifdef SS_THICKNESSANDMASK_TEXTURE\n#if defined(SS_USE_GLTF_TEXTURES)\nfloat thickness=thicknessMap.g*vThicknessParam.y+vThicknessParam.x;\n#else\nfloat thickness=thicknessMap.r*vThicknessParam.y+vThicknessParam.x;\n#endif\n#if DEBUGMODE>0\noutParams.thicknessMap=thicknessMap;\n#endif\n#ifdef SS_MASK_FROM_THICKNESS_TEXTURE\n#if defined(SS_REFRACTION) && defined(SS_REFRACTION_USE_INTENSITY_FROM_TEXTURE)\n#if defined(SS_USE_GLTF_TEXTURES)\nrefractionIntensity*=thicknessMap.r;\n#else\nrefractionIntensity*=thicknessMap.g;\n#endif\n#endif\n#if defined(SS_TRANSLUCENCY) && defined(SS_TRANSLUCENCY_USE_INTENSITY_FROM_TEXTURE)\ntranslucencyIntensity*=thicknessMap.b;\n#endif\n#endif\n#else\nfloat thickness=vThicknessParam.y;\n#endif\n#ifdef SS_REFRACTIONINTENSITY_TEXTURE\n#ifdef SS_USE_GLTF_TEXTURES\nrefractionIntensity*=refractionIntensityMap.r;\n#else\nrefractionIntensity*=refractionIntensityMap.g;\n#endif\n#endif\n#ifdef SS_TRANSLUCENCYINTENSITY_TEXTURE\ntranslucencyIntensity*=translucencyIntensityMap.b;\n#endif\n#ifdef SS_TRANSLUCENCY\nthickness=maxEps(thickness);vec3 transmittance=transmittanceBRDF_Burley(vTintColor.rgb,vDiffusionDistance,thickness);transmittance*=translucencyIntensity;outParams.transmittance=transmittance;outParams.translucencyIntensity=translucencyIntensity;\n#endif\n#ifdef SS_REFRACTION\nvec4 environmentRefraction=vec4(0.,0.,0.,0.);\n#ifdef ANISOTROPIC\nvec3 refractionVector=refract(-viewDirectionW,anisotropicOut.anisotropicNormal,vRefractionInfos.y);\n#else\nvec3 refractionVector=refract(-viewDirectionW,normalW,vRefractionInfos.y);\n#endif\n#ifdef SS_REFRACTIONMAP_OPPOSITEZ\nrefractionVector.z*=-1.0;\n#endif\n#ifdef SS_REFRACTIONMAP_3D\n#ifdef SS_USE_LOCAL_REFRACTIONMAP_CUBIC\nrefractionVector=parallaxCorrectNormal(vPositionW,refractionVector,refractionSize,refractionPosition);\n#endif\nrefractionVector.y=refractionVector.y*vRefractionInfos.w;vec3 refractionCoords=refractionVector;refractionCoords=vec3(refractionMatrix*vec4(refractionCoords,0));\n#else\n#ifdef SS_USE_THICKNESS_AS_DEPTH\nvec3 vRefractionUVW=vec3(refractionMatrix*(view*vec4(vPositionW+refractionVector*thickness,1.0)));\n#else\nvec3 vRefractionUVW=vec3(refractionMatrix*(view*vec4(vPositionW+refractionVector*vRefractionInfos.z,1.0)));\n#endif\nvec2 refractionCoords=vRefractionUVW.xy/vRefractionUVW.z;refractionCoords.y=1.0-refractionCoords.y;\n#endif\n#ifdef SS_HAS_THICKNESS\nfloat ior=vRefractionInfos.y;\n#else\nfloat ior=vRefractionMicrosurfaceInfos.w;\n#endif\n#ifdef SS_LODINREFRACTIONALPHA\nfloat refractionAlphaG=alphaG;refractionAlphaG=mix(alphaG,0.0,clamp(ior*3.0-2.0,0.0,1.0));float refractionLOD=getLodFromAlphaG(vRefractionMicrosurfaceInfos.x,refractionAlphaG,NdotVUnclamped);\n#elif defined(SS_LINEARSPECULARREFRACTION)\nfloat refractionRoughness=alphaG;refractionRoughness=mix(alphaG,0.0,clamp(ior*3.0-2.0,0.0,1.0));float refractionLOD=getLinearLodFromRoughness(vRefractionMicrosurfaceInfos.x,refractionRoughness);\n#else\nfloat refractionAlphaG=alphaG;refractionAlphaG=mix(alphaG,0.0,clamp(ior*3.0-2.0,0.0,1.0));float refractionLOD=getLodFromAlphaG(vRefractionMicrosurfaceInfos.x,refractionAlphaG);\n#endif\n#ifdef LODBASEDMICROSFURACE\nrefractionLOD=refractionLOD*vRefractionMicrosurfaceInfos.y+vRefractionMicrosurfaceInfos.z;\n#ifdef SS_LODINREFRACTIONALPHA\nfloat automaticRefractionLOD=UNPACK_LOD(sampleRefraction(refractionSampler,refractionCoords).a);float requestedRefractionLOD=max(automaticRefractionLOD,refractionLOD);\n#else\nfloat requestedRefractionLOD=refractionLOD;\n#endif\n#if defined(REALTIME_FILTERING) && defined(SS_REFRACTIONMAP_3D)\nenvironmentRefraction=vec4(radiance(alphaG,refractionSampler,refractionCoords,vRefractionFilteringInfo),1.0);\n#else\nenvironmentRefraction=sampleRefractionLod(refractionSampler,refractionCoords,requestedRefractionLOD);\n#endif\n#else\nfloat lodRefractionNormalized=saturate(refractionLOD/log2(vRefractionMicrosurfaceInfos.x));float lodRefractionNormalizedDoubled=lodRefractionNormalized*2.0;vec4 environmentRefractionMid=sampleRefraction(refractionSampler,refractionCoords);if (lodRefractionNormalizedDoubled<1.0){environmentRefraction=mix(\nsampleRefraction(refractionSamplerHigh,refractionCoords),\nenvironmentRefractionMid,\nlodRefractionNormalizedDoubled\n);} else {environmentRefraction=mix(\nenvironmentRefractionMid,\nsampleRefraction(refractionSamplerLow,refractionCoords),\nlodRefractionNormalizedDoubled-1.0\n);}\n#endif\n#ifdef SS_RGBDREFRACTION\nenvironmentRefraction.rgb=fromRGBD(environmentRefraction);\n#endif\n#ifdef SS_GAMMAREFRACTION\nenvironmentRefraction.rgb=toLinearSpace(environmentRefraction.rgb);\n#endif\nenvironmentRefraction.rgb*=vRefractionInfos.x;\n#endif\n#ifdef SS_REFRACTION\nvec3 refractionTransmittance=vec3(refractionIntensity);\n#ifdef SS_THICKNESSANDMASK_TEXTURE\nvec3 volumeAlbedo=computeColorAtDistanceInMedia(vTintColor.rgb,vTintColor.w);refractionTransmittance*=cocaLambert(volumeAlbedo,thickness);\n#elif defined(SS_LINKREFRACTIONTOTRANSPARENCY)\nfloat maxChannel=max(max(surfaceAlbedo.r,surfaceAlbedo.g),surfaceAlbedo.b);vec3 volumeAlbedo=saturate(maxChannel*surfaceAlbedo);environmentRefraction.rgb*=volumeAlbedo;\n#else\nvec3 volumeAlbedo=computeColorAtDistanceInMedia(vTintColor.rgb,vTintColor.w);refractionTransmittance*=cocaLambert(volumeAlbedo,vThicknessParam.y);\n#endif\n#ifdef SS_ALBEDOFORREFRACTIONTINT\nenvironmentRefraction.rgb*=surfaceAlbedo.rgb;\n#endif\noutParams.surfaceAlbedo=surfaceAlbedo*(1.-refractionIntensity);\n#ifdef REFLECTION\noutParams.refractionFactorForIrradiance=(1.-refractionIntensity);\n#endif\n#ifdef UNUSED_MULTIPLEBOUNCES\nvec3 bounceSpecularEnvironmentReflectance=(2.0*specularEnvironmentReflectance)/(1.0+specularEnvironmentReflectance);outParams.specularEnvironmentReflectance=mix(bounceSpecularEnvironmentReflectance,specularEnvironmentReflectance,refractionIntensity);\n#endif\nrefractionTransmittance*=1.0-outParams.specularEnvironmentReflectance;\n#if DEBUGMODE>0\noutParams.refractionTransmittance=refractionTransmittance;\n#endif\noutParams.finalRefraction=environmentRefraction.rgb*refractionTransmittance*vLightingIntensity.z;\n#if DEBUGMODE>0\noutParams.environmentRefraction=environmentRefraction;\n#endif\n#endif\n#if defined(REFLECTION) && defined(SS_TRANSLUCENCY)\n#if defined(NORMAL) && defined(USESPHERICALINVERTEX) || !defined(USESPHERICALFROMREFLECTIONMAP)\nvec3 irradianceVector=vec3(reflectionMatrix*vec4(normalW,0)).xyz;\n#ifdef REFLECTIONMAP_OPPOSITEZ\nirradianceVector.z*=-1.0;\n#endif\n#ifdef INVERTCUBICMAP\nirradianceVector.y*=-1.0;\n#endif\n#else\nvec3 irradianceVector=irradianceVector_;\n#endif\n#if defined(USESPHERICALFROMREFLECTIONMAP)\n#if defined(REALTIME_FILTERING)\nvec3 refractionIrradiance=irradiance(reflectionSampler,-irradianceVector,vReflectionFilteringInfo);\n#else\nvec3 refractionIrradiance=computeEnvironmentIrradiance(-irradianceVector);\n#endif\n#elif defined(USEIRRADIANCEMAP)\n#ifdef REFLECTIONMAP_3D\nvec3 irradianceCoords=irradianceVector;\n#else\nvec2 irradianceCoords=irradianceVector.xy;\n#ifdef REFLECTIONMAP_PROJECTION\nirradianceCoords/=irradianceVector.z;\n#endif\nirradianceCoords.y=1.0-irradianceCoords.y;\n#endif\nvec4 refractionIrradiance=sampleReflection(irradianceSampler,-irradianceCoords);\n#ifdef RGBDREFLECTION\nrefractionIrradiance.rgb=fromRGBD(refractionIrradiance);\n#endif\n#ifdef GAMMAREFLECTION\nrefractionIrradiance.rgb=toLinearSpace(refractionIrradiance.rgb);\n#endif\n#else\nvec4 refractionIrradiance=vec4(0.);\n#endif\nrefractionIrradiance.rgb*=transmittance;\n#ifdef SS_ALBEDOFORTRANSLUCENCYTINT\nrefractionIrradiance.rgb*=surfaceAlbedo.rgb;\n#endif\noutParams.refractionIrradiance=refractionIrradiance.rgb;\n#endif\n}\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const pbrBlockSubSurface = { name, shader };\n//# sourceMappingURL=pbrBlockSubSurface.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"pbrBlockNormalGeometric\";\nconst shader = `vec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=normalize(cross(dFdx(vPositionW),dFdy(vPositionW)))*vEyePosition.w;\n#endif\nvec3 geometricNormalW=normalW;\n#if defined(TWOSIDEDLIGHTING) && defined(NORMAL)\ngeometricNormalW=gl_FrontFacing ? geometricNormalW : -geometricNormalW;\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const pbrBlockNormalGeometric = { name, shader };\n//# sourceMappingURL=pbrBlockNormalGeometric.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"pbrBlockNormalFinal\";\nconst shader = `#if defined(FORCENORMALFORWARD) && defined(NORMAL)\nvec3 faceNormal=normalize(cross(dFdx(vPositionW),dFdy(vPositionW)))*vEyePosition.w;\n#if defined(TWOSIDEDLIGHTING)\nfaceNormal=gl_FrontFacing ? faceNormal : -faceNormal;\n#endif\nnormalW*=sign(dot(normalW,faceNormal));\n#endif\n#if defined(TWOSIDEDLIGHTING) && defined(NORMAL)\nnormalW=gl_FrontFacing ? normalW : -normalW;\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const pbrBlockNormalFinal = { name, shader };\n//# sourceMappingURL=pbrBlockNormalFinal.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"pbrBlockLightmapInit\";\nconst shader = `#ifdef LIGHTMAP\nvec4 lightmapColor=texture2D(lightmapSampler,vLightmapUV+uvOffset);\n#ifdef RGBDLIGHTMAP\nlightmapColor.rgb=fromRGBD(lightmapColor);\n#endif\n#ifdef GAMMALIGHTMAP\nlightmapColor.rgb=toLinearSpace(lightmapColor.rgb);\n#endif\nlightmapColor.rgb*=vLightmapInfos.y;\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const pbrBlockLightmapInit = { name, shader };\n//# sourceMappingURL=pbrBlockLightmapInit.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"pbrBlockGeometryInfo\";\nconst shader = `float NdotVUnclamped=dot(normalW,viewDirectionW);float NdotV=absEps(NdotVUnclamped);float alphaG=convertRoughnessToAverageSlope(roughness);vec2 AARoughnessFactors=getAARoughnessFactors(normalW.xyz);\n#ifdef SPECULARAA\nalphaG+=AARoughnessFactors.y;\n#endif\n#if defined(ENVIRONMENTBRDF)\nvec3 environmentBrdf=getBRDFLookup(NdotV,roughness);\n#endif\n#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\n#ifdef RADIANCEOCCLUSION\n#ifdef AMBIENTINGRAYSCALE\nfloat ambientMonochrome=aoOut.ambientOcclusionColor.r;\n#else\nfloat ambientMonochrome=getLuminance(aoOut.ambientOcclusionColor);\n#endif\nfloat seo=environmentRadianceOcclusion(ambientMonochrome,NdotVUnclamped);\n#endif\n#ifdef HORIZONOCCLUSION\n#ifdef BUMP\n#ifdef REFLECTIONMAP_3D\nfloat eho=environmentHorizonOcclusion(-viewDirectionW,normalW,geometricNormalW);\n#endif\n#endif\n#endif\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const pbrBlockGeometryInfo = { name, shader };\n//# sourceMappingURL=pbrBlockGeometryInfo.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"pbrBlockReflectance0\";\nconst shader = `float reflectance=max(max(reflectivityOut.surfaceReflectivityColor.r,reflectivityOut.surfaceReflectivityColor.g),reflectivityOut.surfaceReflectivityColor.b);vec3 specularEnvironmentR0=reflectivityOut.surfaceReflectivityColor.rgb;\n#ifdef METALLICWORKFLOW\nvec3 specularEnvironmentR90=vec3(metallicReflectanceFactors.a);\n#else \nvec3 specularEnvironmentR90=vec3(1.0,1.0,1.0);\n#endif\n#ifdef ALPHAFRESNEL\nfloat reflectance90=fresnelGrazingReflectance(reflectance);specularEnvironmentR90=specularEnvironmentR90*reflectance90;\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const pbrBlockReflectance0 = { name, shader };\n//# sourceMappingURL=pbrBlockReflectance0.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"pbrBlockReflectance\";\nconst shader = `#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\nvec3 specularEnvironmentReflectance=getReflectanceFromBRDFLookup(clearcoatOut.specularEnvironmentR0,specularEnvironmentR90,environmentBrdf);\n#ifdef RADIANCEOCCLUSION\nspecularEnvironmentReflectance*=seo;\n#endif\n#ifdef HORIZONOCCLUSION\n#ifdef BUMP\n#ifdef REFLECTIONMAP_3D\nspecularEnvironmentReflectance*=eho;\n#endif\n#endif\n#endif\n#else\nvec3 specularEnvironmentReflectance=getReflectanceFromAnalyticalBRDFLookup_Jones(NdotV,clearcoatOut.specularEnvironmentR0,specularEnvironmentR90,sqrt(microSurface));\n#endif\n#ifdef CLEARCOAT\nspecularEnvironmentReflectance*=clearcoatOut.conservationFactor;\n#if defined(CLEARCOAT_TINT)\nspecularEnvironmentReflectance*=clearcoatOut.absorption;\n#endif\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const pbrBlockReflectance = { name, shader };\n//# sourceMappingURL=pbrBlockReflectance.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"pbrBlockDirectLighting\";\nconst shader = `vec3 diffuseBase=vec3(0.,0.,0.);\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif\n#ifdef CLEARCOAT\nvec3 clearCoatBase=vec3(0.,0.,0.);\n#endif\n#ifdef SHEEN\nvec3 sheenBase=vec3(0.,0.,0.);\n#endif\npreLightingInfo preInfo;lightingInfo info;float shadow=1.; \nfloat aggShadow=0.;float numLights=0.;\n#if defined(CLEARCOAT) && defined(CLEARCOAT_TINT)\nvec3 absorption=vec3(0.);\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const pbrBlockDirectLighting = { name, shader };\n//# sourceMappingURL=pbrBlockDirectLighting.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"pbrBlockFinalLitComponents\";\nconst shader = `aggShadow=aggShadow/numLights;\n#if defined(ENVIRONMENTBRDF)\n#ifdef MS_BRDF_ENERGY_CONSERVATION\nvec3 energyConservationFactor=getEnergyConservationFactor(clearcoatOut.specularEnvironmentR0,environmentBrdf);\n#endif\n#endif\n#ifndef METALLICWORKFLOW\n#ifdef SPECULAR_GLOSSINESS_ENERGY_CONSERVATION\nsurfaceAlbedo.rgb=(1.-reflectance)*surfaceAlbedo.rgb;\n#endif\n#endif\n#if defined(SHEEN) && defined(SHEEN_ALBEDOSCALING) && defined(ENVIRONMENTBRDF)\nsurfaceAlbedo.rgb=sheenOut.sheenAlbedoScaling*surfaceAlbedo.rgb;\n#endif\n#ifdef REFLECTION\nvec3 finalIrradiance=reflectionOut.environmentIrradiance;\n#if defined(CLEARCOAT)\nfinalIrradiance*=clearcoatOut.conservationFactor;\n#if defined(CLEARCOAT_TINT)\nfinalIrradiance*=clearcoatOut.absorption;\n#endif\n#endif\n#if defined(SS_REFRACTION)\nfinalIrradiance*=subSurfaceOut.refractionFactorForIrradiance;\n#endif\n#if defined(SS_TRANSLUCENCY)\nfinalIrradiance*=(1.0-subSurfaceOut.translucencyIntensity);finalIrradiance+=subSurfaceOut.refractionIrradiance;\n#endif\nfinalIrradiance*=surfaceAlbedo.rgb;finalIrradiance*=vLightingIntensity.z;finalIrradiance*=aoOut.ambientOcclusionColor;\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase;finalSpecular=max(finalSpecular,0.0);vec3 finalSpecularScaled=finalSpecular*vLightingIntensity.x*vLightingIntensity.w;\n#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)\nfinalSpecularScaled*=energyConservationFactor;\n#endif\n#if defined(SHEEN) && defined(ENVIRONMENTBRDF) && defined(SHEEN_ALBEDOSCALING)\nfinalSpecularScaled*=sheenOut.sheenAlbedoScaling;\n#endif\n#endif\n#ifdef REFLECTION\nvec3 finalRadiance=reflectionOut.environmentRadiance.rgb;finalRadiance*=subSurfaceOut.specularEnvironmentReflectance;vec3 finalRadianceScaled=finalRadiance*vLightingIntensity.z;\n#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)\nfinalRadianceScaled*=energyConservationFactor;\n#endif\n#if defined(SHEEN) && defined(ENVIRONMENTBRDF) && defined(SHEEN_ALBEDOSCALING)\nfinalRadianceScaled*=sheenOut.sheenAlbedoScaling;\n#endif\n#endif\n#ifdef SHEEN\nvec3 finalSheen=sheenBase*sheenOut.sheenColor;finalSheen=max(finalSheen,0.0);vec3 finalSheenScaled=finalSheen*vLightingIntensity.x*vLightingIntensity.w;\n#if defined(CLEARCOAT) && defined(REFLECTION) && defined(ENVIRONMENTBRDF)\nsheenOut.finalSheenRadianceScaled*=clearcoatOut.conservationFactor;\n#if defined(CLEARCOAT_TINT)\nsheenOut.finalSheenRadianceScaled*=clearcoatOut.absorption;\n#endif\n#endif\n#endif\n#ifdef CLEARCOAT\nvec3 finalClearCoat=clearCoatBase;finalClearCoat=max(finalClearCoat,0.0);vec3 finalClearCoatScaled=finalClearCoat*vLightingIntensity.x*vLightingIntensity.w;\n#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)\nfinalClearCoatScaled*=clearcoatOut.energyConservationFactorClearCoat;\n#endif\n#ifdef SS_REFRACTION\nsubSurfaceOut.finalRefraction*=clearcoatOut.conservationFactor;\n#ifdef CLEARCOAT_TINT\nsubSurfaceOut.finalRefraction*=clearcoatOut.absorption;\n#endif\n#endif\n#endif\n#ifdef ALPHABLEND\nfloat luminanceOverAlpha=0.0;\n#if defined(REFLECTION) && defined(RADIANCEOVERALPHA)\nluminanceOverAlpha+=getLuminance(finalRadianceScaled);\n#if defined(CLEARCOAT)\nluminanceOverAlpha+=getLuminance(clearcoatOut.finalClearCoatRadianceScaled);\n#endif\n#endif\n#if defined(SPECULARTERM) && defined(SPECULAROVERALPHA)\nluminanceOverAlpha+=getLuminance(finalSpecularScaled);\n#endif\n#if defined(CLEARCOAT) && defined(CLEARCOATOVERALPHA)\nluminanceOverAlpha+=getLuminance(finalClearCoatScaled);\n#endif\n#if defined(RADIANCEOVERALPHA) || defined(SPECULAROVERALPHA) || defined(CLEARCOATOVERALPHA)\nalpha=saturate(alpha+luminanceOverAlpha*luminanceOverAlpha);\n#endif\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const pbrBlockFinalLitComponents = { name, shader };\n//# sourceMappingURL=pbrBlockFinalLitComponents.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"pbrBlockFinalUnlitComponents\";\nconst shader = `vec3 finalDiffuse=diffuseBase;finalDiffuse*=surfaceAlbedo.rgb;finalDiffuse=max(finalDiffuse,0.0);finalDiffuse*=vLightingIntensity.x;vec3 finalAmbient=vAmbientColor;finalAmbient*=surfaceAlbedo.rgb;vec3 finalEmissive=vEmissiveColor;\n#ifdef EMISSIVE\nvec3 emissiveColorTex=texture2D(emissiveSampler,vEmissiveUV+uvOffset).rgb;\n#ifdef GAMMAEMISSIVE\nfinalEmissive*=toLinearSpace(emissiveColorTex.rgb);\n#else\nfinalEmissive*=emissiveColorTex.rgb;\n#endif\nfinalEmissive*= vEmissiveInfos.y;\n#endif\nfinalEmissive*=vLightingIntensity.y;\n#ifdef AMBIENT\nvec3 ambientOcclusionForDirectDiffuse=mix(vec3(1.),aoOut.ambientOcclusionColor,vAmbientInfos.w);\n#else\nvec3 ambientOcclusionForDirectDiffuse=aoOut.ambientOcclusionColor;\n#endif\nfinalAmbient*=aoOut.ambientOcclusionColor;finalDiffuse*=ambientOcclusionForDirectDiffuse;\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const pbrBlockFinalUnlitComponents = { name, shader };\n//# sourceMappingURL=pbrBlockFinalUnlitComponents.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"pbrBlockFinalColorComposition\";\nconst shader = `vec4 finalColor=vec4(\n#ifndef UNLIT\n#ifdef REFLECTION\nfinalIrradiance +\n#endif\n#ifdef SPECULARTERM\nfinalSpecularScaled +\n#endif\n#ifdef SHEEN\nfinalSheenScaled +\n#endif\n#ifdef CLEARCOAT\nfinalClearCoatScaled +\n#endif\n#ifdef REFLECTION\nfinalRadianceScaled +\n#if defined(SHEEN) && defined(ENVIRONMENTBRDF)\nsheenOut.finalSheenRadianceScaled +\n#endif\n#ifdef CLEARCOAT\nclearcoatOut.finalClearCoatRadianceScaled +\n#endif\n#endif\n#ifdef SS_REFRACTION\nsubSurfaceOut.finalRefraction +\n#endif\n#endif\nfinalAmbient +\nfinalDiffuse,\nalpha);\n#ifdef LIGHTMAP\n#ifndef LIGHTMAPEXCLUDED\n#ifdef USELIGHTMAPASSHADOWMAP\nfinalColor.rgb*=lightmapColor.rgb;\n#else\nfinalColor.rgb+=lightmapColor.rgb;\n#endif\n#endif\n#endif\nfinalColor.rgb+=finalEmissive;\n#define CUSTOM_FRAGMENT_BEFORE_FOG\nfinalColor=max(finalColor,0.0);\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const pbrBlockFinalColorComposition = { name, shader };\n//# sourceMappingURL=pbrBlockFinalColorComposition.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"pbrBlockImageProcessing\";\nconst shader = `#if defined(IMAGEPROCESSINGPOSTPROCESS) || defined(SS_SCATTERING)\n#if !defined(SKIPFINALCOLORCLAMP)\nfinalColor.rgb=clamp(finalColor.rgb,0.,30.0);\n#endif\n#else\nfinalColor=applyImageProcessing(finalColor);\n#endif\nfinalColor.a*=visibility;\n#ifdef PREMULTIPLYALPHA\nfinalColor.rgb*=finalColor.a;\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const pbrBlockImageProcessing = { name, shader };\n//# sourceMappingURL=pbrBlockImageProcessing.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"pbrDebug\";\nconst shader = `#if DEBUGMODE>0\nif (vClipSpacePosition.x/vClipSpacePosition.w>=vDebugMode.x) {\n#if DEBUGMODE==1\ngl_FragColor.rgb=vPositionW.rgb;\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE==2 && defined(NORMAL)\ngl_FragColor.rgb=vNormalW.rgb;\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE==3 && defined(BUMP) || DEBUGMODE==3 && defined(PARALLAX) || DEBUGMODE==3 && defined(ANISOTROPIC)\ngl_FragColor.rgb=TBN[0];\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE==4 && defined(BUMP) || DEBUGMODE==4 && defined(PARALLAX) || DEBUGMODE==4 && defined(ANISOTROPIC)\ngl_FragColor.rgb=TBN[1];\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE==5\ngl_FragColor.rgb=normalW;\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE==6 && defined(MAINUV1)\ngl_FragColor.rgb=vec3(vMainUV1,0.0);\n#elif DEBUGMODE==7 && defined(MAINUV2)\ngl_FragColor.rgb=vec3(vMainUV2,0.0);\n#elif DEBUGMODE==8 && defined(CLEARCOAT) && defined(CLEARCOAT_BUMP)\ngl_FragColor.rgb=clearcoatOut.TBNClearCoat[0];\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE==9 && defined(CLEARCOAT) && defined(CLEARCOAT_BUMP)\ngl_FragColor.rgb=clearcoatOut.TBNClearCoat[1];\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE==10 && defined(CLEARCOAT)\ngl_FragColor.rgb=clearcoatOut.clearCoatNormalW;\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE==11 && defined(ANISOTROPIC)\ngl_FragColor.rgb=anisotropicOut.anisotropicNormal;\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE==12 && defined(ANISOTROPIC)\ngl_FragColor.rgb=anisotropicOut.anisotropicTangent;\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE==13 && defined(ANISOTROPIC)\ngl_FragColor.rgb=anisotropicOut.anisotropicBitangent;\n#define DEBUGMODE_NORMALIZE\n#elif DEBUGMODE==20 && defined(ALBEDO)\ngl_FragColor.rgb=albedoTexture.rgb;\n#ifndef GAMMAALBEDO\n#define DEBUGMODE_GAMMA\n#endif\n#elif DEBUGMODE==21 && defined(AMBIENT)\ngl_FragColor.rgb=aoOut.ambientOcclusionColorMap.rgb;\n#elif DEBUGMODE==22 && defined(OPACITY)\ngl_FragColor.rgb=opacityMap.rgb;\n#elif DEBUGMODE==23 && defined(EMISSIVE)\ngl_FragColor.rgb=emissiveColorTex.rgb;\n#ifndef GAMMAEMISSIVE\n#define DEBUGMODE_GAMMA\n#endif\n#elif DEBUGMODE==24 && defined(LIGHTMAP)\ngl_FragColor.rgb=lightmapColor.rgb;\n#ifndef GAMMALIGHTMAP\n#define DEBUGMODE_GAMMA\n#endif\n#elif DEBUGMODE==25 && defined(REFLECTIVITY) && defined(METALLICWORKFLOW)\ngl_FragColor.rgb=reflectivityOut.surfaceMetallicColorMap.rgb;\n#elif DEBUGMODE==26 && defined(REFLECTIVITY) && !defined(METALLICWORKFLOW)\ngl_FragColor.rgb=reflectivityOut.surfaceReflectivityColorMap.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==27 && defined(CLEARCOAT) && defined(CLEARCOAT_TEXTURE)\ngl_FragColor.rgb=vec3(clearcoatOut.clearCoatMapData.rg,0.0);\n#elif DEBUGMODE==28 && defined(CLEARCOAT) && defined(CLEARCOAT_TINT) && defined(CLEARCOAT_TINT_TEXTURE)\ngl_FragColor.rgb=clearcoatOut.clearCoatTintMapData.rgb;\n#elif DEBUGMODE==29 && defined(SHEEN) && defined(SHEEN_TEXTURE)\ngl_FragColor.rgb=sheenOut.sheenMapData.rgb;\n#elif DEBUGMODE==30 && defined(ANISOTROPIC) && defined(ANISOTROPIC_TEXTURE)\ngl_FragColor.rgb=anisotropicOut.anisotropyMapData.rgb;\n#elif DEBUGMODE==31 && defined(SUBSURFACE) && defined(SS_THICKNESSANDMASK_TEXTURE)\ngl_FragColor.rgb=subSurfaceOut.thicknessMap.rgb;\n#elif DEBUGMODE==32 && defined(BUMP)\ngl_FragColor.rgb=texture2D(bumpSampler,vBumpUV).rgb;\n#elif DEBUGMODE==40 && defined(SS_REFRACTION)\ngl_FragColor.rgb=subSurfaceOut.environmentRefraction.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==41 && defined(REFLECTION)\ngl_FragColor.rgb=reflectionOut.environmentRadiance.rgb;\n#ifndef GAMMAREFLECTION\n#define DEBUGMODE_GAMMA\n#endif\n#elif DEBUGMODE==42 && defined(CLEARCOAT) && defined(REFLECTION)\ngl_FragColor.rgb=clearcoatOut.environmentClearCoatRadiance.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==50\ngl_FragColor.rgb=diffuseBase.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==51 && defined(SPECULARTERM)\ngl_FragColor.rgb=specularBase.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==52 && defined(CLEARCOAT)\ngl_FragColor.rgb=clearCoatBase.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==53 && defined(SHEEN)\ngl_FragColor.rgb=sheenBase.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==54 && defined(REFLECTION)\ngl_FragColor.rgb=reflectionOut.environmentIrradiance.rgb;\n#ifndef GAMMAREFLECTION\n#define DEBUGMODE_GAMMA\n#endif\n#elif DEBUGMODE==60\ngl_FragColor.rgb=surfaceAlbedo.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==61\ngl_FragColor.rgb=clearcoatOut.specularEnvironmentR0;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==62 && defined(METALLICWORKFLOW)\ngl_FragColor.rgb=vec3(reflectivityOut.metallicRoughness.r);\n#elif DEBUGMODE==71 && defined(METALLICWORKFLOW)\ngl_FragColor.rgb=reflectivityOut.metallicF0;\n#elif DEBUGMODE==63\ngl_FragColor.rgb=vec3(roughness);\n#elif DEBUGMODE==64\ngl_FragColor.rgb=vec3(alphaG);\n#elif DEBUGMODE==65\ngl_FragColor.rgb=vec3(NdotV);\n#elif DEBUGMODE==66 && defined(CLEARCOAT) && defined(CLEARCOAT_TINT)\ngl_FragColor.rgb=clearcoatOut.clearCoatColor.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==67 && defined(CLEARCOAT)\ngl_FragColor.rgb=vec3(clearcoatOut.clearCoatRoughness);\n#elif DEBUGMODE==68 && defined(CLEARCOAT)\ngl_FragColor.rgb=vec3(clearcoatOut.clearCoatNdotV);\n#elif DEBUGMODE==69 && defined(SUBSURFACE) && defined(SS_TRANSLUCENCY)\ngl_FragColor.rgb=subSurfaceOut.transmittance;\n#elif DEBUGMODE==70 && defined(SUBSURFACE) && defined(SS_REFRACTION)\ngl_FragColor.rgb=subSurfaceOut.refractionTransmittance;\n#elif DEBUGMODE==72\ngl_FragColor.rgb=vec3(microSurface);\n#elif DEBUGMODE==73\ngl_FragColor.rgb=vAlbedoColor.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==74 && !defined(METALLICWORKFLOW)\ngl_FragColor.rgb=vReflectivityColor.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==75\ngl_FragColor.rgb=vEmissiveColor.rgb;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==80 && defined(RADIANCEOCCLUSION)\ngl_FragColor.rgb=vec3(seo);\n#elif DEBUGMODE==81 && defined(HORIZONOCCLUSION)\ngl_FragColor.rgb=vec3(eho);\n#elif DEBUGMODE==82 && defined(MS_BRDF_ENERGY_CONSERVATION)\ngl_FragColor.rgb=vec3(energyConservationFactor);\n#elif DEBUGMODE==83 && defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\ngl_FragColor.rgb=specularEnvironmentReflectance;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==84 && defined(CLEARCOAT) && defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\ngl_FragColor.rgb=clearcoatOut.clearCoatEnvironmentReflectance;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==85 && defined(SHEEN) && defined(REFLECTION)\ngl_FragColor.rgb=sheenOut.sheenEnvironmentReflectance;\n#define DEBUGMODE_GAMMA\n#elif DEBUGMODE==86 && defined(ALPHABLEND)\ngl_FragColor.rgb=vec3(luminanceOverAlpha);\n#elif DEBUGMODE==87\ngl_FragColor.rgb=vec3(alpha);\n#elif DEBUGMODE==88 && defined(ALBEDO)\ngl_FragColor.rgb=vec3(albedoTexture.a);\n#else\nfloat stripeWidth=30.;float stripePos=floor((gl_FragCoord.x+gl_FragCoord.y)/stripeWidth);float whichColor=mod(stripePos,2.);vec3 color1=vec3(.6,.2,.2);vec3 color2=vec3(.3,.1,.1);gl_FragColor.rgb=mix(color1,color2,whichColor);\n#endif\ngl_FragColor.rgb*=vDebugMode.y;\n#ifdef DEBUGMODE_NORMALIZE\ngl_FragColor.rgb=normalize(gl_FragColor.rgb)*0.5+0.5;\n#endif\n#ifdef DEBUGMODE_GAMMA\ngl_FragColor.rgb=toGammaSpace(gl_FragColor.rgb);\n#endif\ngl_FragColor.a=1.0;\n#ifdef PREPASS\ngl_FragData[0]=toLinearSpace(gl_FragColor); \ngl_FragData[1]=vec4(0.,0.,0.,0.); \n#endif\n#ifdef DEBUGMODE_FORCERETURN\nreturn;\n#endif\n}\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const pbrDebug = { name, shader };\n//# sourceMappingURL=pbrDebug.js.map","// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore.js\";\nimport \"./ShadersInclude/prePassDeclaration.js\";\nimport \"./ShadersInclude/oitDeclaration.js\";\nimport \"./ShadersInclude/pbrFragmentDeclaration.js\";\nimport \"./ShadersInclude/pbrUboDeclaration.js\";\nimport \"./ShadersInclude/pbrFragmentExtraDeclaration.js\";\nimport \"./ShadersInclude/lightFragmentDeclaration.js\";\nimport \"./ShadersInclude/lightUboDeclaration.js\";\nimport \"./ShadersInclude/pbrFragmentSamplersDeclaration.js\";\nimport \"./ShadersInclude/imageProcessingDeclaration.js\";\nimport \"./ShadersInclude/clipPlaneFragmentDeclaration.js\";\nimport \"./ShadersInclude/logDepthDeclaration.js\";\nimport \"./ShadersInclude/fogFragmentDeclaration.js\";\nimport \"./ShadersInclude/helperFunctions.js\";\nimport \"./ShadersInclude/subSurfaceScatteringFunctions.js\";\nimport \"./ShadersInclude/importanceSampling.js\";\nimport \"./ShadersInclude/pbrHelperFunctions.js\";\nimport \"./ShadersInclude/imageProcessingFunctions.js\";\nimport \"./ShadersInclude/shadowsFragmentFunctions.js\";\nimport \"./ShadersInclude/harmonicsFunctions.js\";\nimport \"./ShadersInclude/pbrDirectLightingSetupFunctions.js\";\nimport \"./ShadersInclude/pbrDirectLightingFalloffFunctions.js\";\nimport \"./ShadersInclude/pbrBRDFFunctions.js\";\nimport \"./ShadersInclude/hdrFilteringFunctions.js\";\nimport \"./ShadersInclude/pbrDirectLightingFunctions.js\";\nimport \"./ShadersInclude/pbrIBLFunctions.js\";\nimport \"./ShadersInclude/bumpFragmentMainFunctions.js\";\nimport \"./ShadersInclude/bumpFragmentFunctions.js\";\nimport \"./ShadersInclude/reflectionFunction.js\";\nimport \"./ShadersInclude/pbrBlockAlbedoOpacity.js\";\nimport \"./ShadersInclude/pbrBlockReflectivity.js\";\nimport \"./ShadersInclude/pbrBlockAmbientOcclusion.js\";\nimport \"./ShadersInclude/pbrBlockAlphaFresnel.js\";\nimport \"./ShadersInclude/pbrBlockAnisotropic.js\";\nimport \"./ShadersInclude/pbrBlockReflection.js\";\nimport \"./ShadersInclude/pbrBlockSheen.js\";\nimport \"./ShadersInclude/pbrBlockClearcoat.js\";\nimport \"./ShadersInclude/pbrBlockIridescence.js\";\nimport \"./ShadersInclude/pbrBlockSubSurface.js\";\nimport \"./ShadersInclude/clipPlaneFragment.js\";\nimport \"./ShadersInclude/pbrBlockNormalGeometric.js\";\nimport \"./ShadersInclude/bumpFragment.js\";\nimport \"./ShadersInclude/pbrBlockNormalFinal.js\";\nimport \"./ShadersInclude/depthPrePass.js\";\nimport \"./ShadersInclude/pbrBlockLightmapInit.js\";\nimport \"./ShadersInclude/pbrBlockGeometryInfo.js\";\nimport \"./ShadersInclude/pbrBlockReflectance0.js\";\nimport \"./ShadersInclude/pbrBlockReflectance.js\";\nimport \"./ShadersInclude/pbrBlockDirectLighting.js\";\nimport \"./ShadersInclude/lightFragment.js\";\nimport \"./ShadersInclude/pbrBlockFinalLitComponents.js\";\nimport \"./ShadersInclude/pbrBlockFinalUnlitComponents.js\";\nimport \"./ShadersInclude/pbrBlockFinalColorComposition.js\";\nimport \"./ShadersInclude/logDepthFragment.js\";\nimport \"./ShadersInclude/fogFragment.js\";\nimport \"./ShadersInclude/pbrBlockImageProcessing.js\";\nimport \"./ShadersInclude/oitFragment.js\";\nimport \"./ShadersInclude/pbrDebug.js\";\nconst name = \"pbrPixelShader\";\nconst shader = `#if defined(BUMP) || !defined(NORMAL) || defined(FORCENORMALFORWARD) || defined(SPECULARAA) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC)\n#extension GL_OES_standard_derivatives : enable\n#endif\n#ifdef LODBASEDMICROSFURACE\n#extension GL_EXT_shader_texture_lod : enable\n#endif\n#define CUSTOM_FRAGMENT_BEGIN\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n#include[SCENE_MRT_COUNT]\nprecision highp float;\n#include\n#ifndef FROMLINEARSPACE\n#define FROMLINEARSPACE\n#endif\n#include<__decl__pbrFragment>\n#include\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#ifdef REFLECTION\n#include\n#endif\n#define CUSTOM_FRAGMENT_DEFINITIONS\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\n#include\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include\n#include\n#include\n#include\nalbedoOpacityOutParams albedoOpacityOut;\n#ifdef ALBEDO\nvec4 albedoTexture=texture2D(albedoSampler,vAlbedoUV+uvOffset);\n#endif\n#ifdef OPACITY\nvec4 opacityMap=texture2D(opacitySampler,vOpacityUV+uvOffset);\n#endif\n#ifdef DECAL\nvec4 decalColor=texture2D(decalSampler,vDecalUV+uvOffset);\n#endif\nalbedoOpacityBlock(\nvAlbedoColor,\n#ifdef ALBEDO\nalbedoTexture,\nvAlbedoInfos,\n#endif\n#ifdef OPACITY\nopacityMap,\nvOpacityInfos,\n#endif\n#ifdef DETAIL\ndetailColor,\nvDetailInfos,\n#endif\n#ifdef DECAL\ndecalColor,\nvDecalInfos,\n#endif\nalbedoOpacityOut\n);vec3 surfaceAlbedo=albedoOpacityOut.surfaceAlbedo;float alpha=albedoOpacityOut.alpha;\n#define CUSTOM_FRAGMENT_UPDATE_ALPHA\n#include\n#define CUSTOM_FRAGMENT_BEFORE_LIGHTS\nambientOcclusionOutParams aoOut;\n#ifdef AMBIENT\nvec3 ambientOcclusionColorMap=texture2D(ambientSampler,vAmbientUV+uvOffset).rgb;\n#endif\nambientOcclusionBlock(\n#ifdef AMBIENT\nambientOcclusionColorMap,\nvAmbientInfos,\n#endif\naoOut\n);\n#include\n#ifdef UNLIT\nvec3 diffuseBase=vec3(1.,1.,1.);\n#else\nvec3 baseColor=surfaceAlbedo;reflectivityOutParams reflectivityOut;\n#if defined(REFLECTIVITY)\nvec4 surfaceMetallicOrReflectivityColorMap=texture2D(reflectivitySampler,vReflectivityUV+uvOffset);vec4 baseReflectivity=surfaceMetallicOrReflectivityColorMap;\n#ifndef METALLICWORKFLOW\n#ifdef REFLECTIVITY_GAMMA\nsurfaceMetallicOrReflectivityColorMap=toLinearSpace(surfaceMetallicOrReflectivityColorMap);\n#endif\nsurfaceMetallicOrReflectivityColorMap.rgb*=vReflectivityInfos.y;\n#endif\n#endif\n#if defined(MICROSURFACEMAP)\nvec4 microSurfaceTexel=texture2D(microSurfaceSampler,vMicroSurfaceSamplerUV+uvOffset)*vMicroSurfaceSamplerInfos.y;\n#endif\n#ifdef METALLICWORKFLOW\nvec4 metallicReflectanceFactors=vMetallicReflectanceFactors;\n#ifdef REFLECTANCE\nvec4 reflectanceFactorsMap=texture2D(reflectanceSampler,vReflectanceUV+uvOffset);\n#ifdef REFLECTANCE_GAMMA\nreflectanceFactorsMap=toLinearSpace(reflectanceFactorsMap);\n#endif\nmetallicReflectanceFactors.rgb*=reflectanceFactorsMap.rgb;\n#endif\n#ifdef METALLIC_REFLECTANCE\nvec4 metallicReflectanceFactorsMap=texture2D(metallicReflectanceSampler,vMetallicReflectanceUV+uvOffset);\n#ifdef METALLIC_REFLECTANCE_GAMMA\nmetallicReflectanceFactorsMap=toLinearSpace(metallicReflectanceFactorsMap);\n#endif\n#ifndef METALLIC_REFLECTANCE_USE_ALPHA_ONLY\nmetallicReflectanceFactors.rgb*=metallicReflectanceFactorsMap.rgb;\n#endif\nmetallicReflectanceFactors*=metallicReflectanceFactorsMap.a;\n#endif\n#endif\nreflectivityBlock(\nvReflectivityColor,\n#ifdef METALLICWORKFLOW\nsurfaceAlbedo,\nmetallicReflectanceFactors,\n#endif\n#ifdef REFLECTIVITY\nvReflectivityInfos,\nsurfaceMetallicOrReflectivityColorMap,\n#endif\n#if defined(METALLICWORKFLOW) && defined(REFLECTIVITY) && defined(AOSTOREINMETALMAPRED)\naoOut.ambientOcclusionColor,\n#endif\n#ifdef MICROSURFACEMAP\nmicroSurfaceTexel,\n#endif\n#ifdef DETAIL\ndetailColor,\nvDetailInfos,\n#endif\nreflectivityOut\n);float microSurface=reflectivityOut.microSurface;float roughness=reflectivityOut.roughness;\n#ifdef METALLICWORKFLOW\nsurfaceAlbedo=reflectivityOut.surfaceAlbedo;\n#endif\n#if defined(METALLICWORKFLOW) && defined(REFLECTIVITY) && defined(AOSTOREINMETALMAPRED)\naoOut.ambientOcclusionColor=reflectivityOut.ambientOcclusionColor;\n#endif\n#ifdef ALPHAFRESNEL\n#if defined(ALPHATEST) || defined(ALPHABLEND)\nalphaFresnelOutParams alphaFresnelOut;alphaFresnelBlock(\nnormalW,\nviewDirectionW,\nalpha,\nmicroSurface,\nalphaFresnelOut\n);alpha=alphaFresnelOut.alpha;\n#endif\n#endif\n#include\n#ifdef ANISOTROPIC\nanisotropicOutParams anisotropicOut;\n#ifdef ANISOTROPIC_TEXTURE\nvec3 anisotropyMapData=texture2D(anisotropySampler,vAnisotropyUV+uvOffset).rgb*vAnisotropyInfos.y;\n#endif\nanisotropicBlock(\nvAnisotropy,\nroughness,\n#ifdef ANISOTROPIC_TEXTURE\nanisotropyMapData,\n#endif\nTBN,\nnormalW,\nviewDirectionW,\nanisotropicOut\n);\n#endif\n#ifdef REFLECTION\nreflectionOutParams reflectionOut;\n#ifndef USE_CUSTOM_REFLECTION\nreflectionBlock(\nvPositionW,\nnormalW,\nalphaG,\nvReflectionMicrosurfaceInfos,\nvReflectionInfos,\nvReflectionColor,\n#ifdef ANISOTROPIC\nanisotropicOut,\n#endif\n#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)\nNdotVUnclamped,\n#endif\n#ifdef LINEARSPECULARREFLECTION\nroughness,\n#endif\nreflectionSampler,\n#if defined(NORMAL) && defined(USESPHERICALINVERTEX)\nvEnvironmentIrradiance,\n#endif\n#ifdef USESPHERICALFROMREFLECTIONMAP\n#if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)\nreflectionMatrix,\n#endif\n#endif\n#ifdef USEIRRADIANCEMAP\nirradianceSampler,\n#endif\n#ifndef LODBASEDMICROSFURACE\nreflectionSamplerLow,\nreflectionSamplerHigh,\n#endif\n#ifdef REALTIME_FILTERING\nvReflectionFilteringInfo,\n#endif\nreflectionOut\n);\n#else\n#define CUSTOM_REFLECTION\n#endif\n#endif\n#include\n#ifdef SHEEN\nsheenOutParams sheenOut;\n#ifdef SHEEN_TEXTURE\nvec4 sheenMapData=texture2D(sheenSampler,vSheenUV+uvOffset);\n#endif\n#if defined(SHEEN_ROUGHNESS) && defined(SHEEN_TEXTURE_ROUGHNESS) && !defined(SHEEN_TEXTURE_ROUGHNESS_IDENTICAL) && !defined(SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE)\nvec4 sheenMapRoughnessData=texture2D(sheenRoughnessSampler,vSheenRoughnessUV+uvOffset)*vSheenInfos.w;\n#endif\nsheenBlock(\nvSheenColor,\n#ifdef SHEEN_ROUGHNESS\nvSheenRoughness,\n#if defined(SHEEN_TEXTURE_ROUGHNESS) && !defined(SHEEN_TEXTURE_ROUGHNESS_IDENTICAL) && !defined(SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE)\nsheenMapRoughnessData,\n#endif\n#endif\nroughness,\n#ifdef SHEEN_TEXTURE\nsheenMapData,\nvSheenInfos.y,\n#endif\nreflectance,\n#ifdef SHEEN_LINKWITHALBEDO\nbaseColor,\nsurfaceAlbedo,\n#endif\n#ifdef ENVIRONMENTBRDF\nNdotV,\nenvironmentBrdf,\n#endif\n#if defined(REFLECTION) && defined(ENVIRONMENTBRDF)\nAARoughnessFactors,\nvReflectionMicrosurfaceInfos,\nvReflectionInfos,\nvReflectionColor,\nvLightingIntensity,\nreflectionSampler,\nreflectionOut.reflectionCoords,\nNdotVUnclamped,\n#ifndef LODBASEDMICROSFURACE\nreflectionSamplerLow,\nreflectionSamplerHigh,\n#endif\n#ifdef REALTIME_FILTERING\nvReflectionFilteringInfo,\n#endif\n#if !defined(REFLECTIONMAP_SKYBOX) && defined(RADIANCEOCCLUSION)\nseo,\n#endif\n#if !defined(REFLECTIONMAP_SKYBOX) && defined(HORIZONOCCLUSION) && defined(BUMP) && defined(REFLECTIONMAP_3D)\neho,\n#endif\n#endif\nsheenOut\n);\n#ifdef SHEEN_LINKWITHALBEDO\nsurfaceAlbedo=sheenOut.surfaceAlbedo;\n#endif\n#endif\n#ifdef CLEARCOAT\n#ifdef CLEARCOAT_TEXTURE\nvec2 clearCoatMapData=texture2D(clearCoatSampler,vClearCoatUV+uvOffset).rg*vClearCoatInfos.y;\n#endif\n#endif\n#ifdef IRIDESCENCE\niridescenceOutParams iridescenceOut;\n#ifdef IRIDESCENCE_TEXTURE\nvec2 iridescenceMapData=texture2D(iridescenceSampler,vIridescenceUV+uvOffset).rg*vIridescenceInfos.y;\n#endif\n#ifdef IRIDESCENCE_THICKNESS_TEXTURE\nvec2 iridescenceThicknessMapData=texture2D(iridescenceThicknessSampler,vIridescenceThicknessUV+uvOffset).rg*vIridescenceInfos.w;\n#endif\niridescenceBlock(\nvIridescenceParams,\nNdotV,\nspecularEnvironmentR0,\n#ifdef IRIDESCENCE_TEXTURE\niridescenceMapData,\n#endif\n#ifdef IRIDESCENCE_THICKNESS_TEXTURE\niridescenceThicknessMapData,\n#endif\n#ifdef CLEARCOAT\nNdotVUnclamped,\n#ifdef CLEARCOAT_TEXTURE\nclearCoatMapData,\n#endif\n#endif\niridescenceOut\n);float iridescenceIntensity=iridescenceOut.iridescenceIntensity;specularEnvironmentR0=iridescenceOut.specularEnvironmentR0;\n#endif\nclearcoatOutParams clearcoatOut;\n#ifdef CLEARCOAT\n#if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && !defined(CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL) && !defined(CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE)\nvec4 clearCoatMapRoughnessData=texture2D(clearCoatRoughnessSampler,vClearCoatRoughnessUV+uvOffset)*vClearCoatInfos.w;\n#endif\n#if defined(CLEARCOAT_TINT) && defined(CLEARCOAT_TINT_TEXTURE)\nvec4 clearCoatTintMapData=texture2D(clearCoatTintSampler,vClearCoatTintUV+uvOffset);\n#endif\n#ifdef CLEARCOAT_BUMP\nvec4 clearCoatBumpMapData=texture2D(clearCoatBumpSampler,vClearCoatBumpUV+uvOffset);\n#endif\nclearcoatBlock(\nvPositionW,\ngeometricNormalW,\nviewDirectionW,\nvClearCoatParams,\n#if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && !defined(CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL) && !defined(CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE)\nclearCoatMapRoughnessData,\n#endif\nspecularEnvironmentR0,\n#ifdef CLEARCOAT_TEXTURE\nclearCoatMapData,\n#endif\n#ifdef CLEARCOAT_TINT\nvClearCoatTintParams,\nclearCoatColorAtDistance,\nvClearCoatRefractionParams,\n#ifdef CLEARCOAT_TINT_TEXTURE\nclearCoatTintMapData,\n#endif\n#endif\n#ifdef CLEARCOAT_BUMP\nvClearCoatBumpInfos,\nclearCoatBumpMapData,\nvClearCoatBumpUV,\n#if defined(TANGENT) && defined(NORMAL)\nvTBN,\n#else\nvClearCoatTangentSpaceParams,\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\nnormalMatrix,\n#endif\n#endif\n#if defined(FORCENORMALFORWARD) && defined(NORMAL)\nfaceNormal,\n#endif\n#ifdef REFLECTION\nvReflectionMicrosurfaceInfos,\nvReflectionInfos,\nvReflectionColor,\nvLightingIntensity,\nreflectionSampler,\n#ifndef LODBASEDMICROSFURACE\nreflectionSamplerLow,\nreflectionSamplerHigh,\n#endif\n#ifdef REALTIME_FILTERING\nvReflectionFilteringInfo,\n#endif\n#endif\n#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\n#ifdef RADIANCEOCCLUSION\nambientMonochrome,\n#endif\n#endif\n#if defined(CLEARCOAT_BUMP) || defined(TWOSIDEDLIGHTING)\n(gl_FrontFacing ? 1. : -1.),\n#endif\nclearcoatOut\n);\n#else\nclearcoatOut.specularEnvironmentR0=specularEnvironmentR0;\n#endif\n#include\nsubSurfaceOutParams subSurfaceOut;\n#ifdef SUBSURFACE\n#ifdef SS_THICKNESSANDMASK_TEXTURE\nvec4 thicknessMap=texture2D(thicknessSampler,vThicknessUV+uvOffset);\n#endif\n#ifdef SS_REFRACTIONINTENSITY_TEXTURE\nvec4 refractionIntensityMap=texture2D(refractionIntensitySampler,vRefractionIntensityUV+uvOffset);\n#endif\n#ifdef SS_TRANSLUCENCYINTENSITY_TEXTURE\nvec4 translucencyIntensityMap=texture2D(translucencyIntensitySampler,vTranslucencyIntensityUV+uvOffset);\n#endif\nsubSurfaceBlock(\nvSubSurfaceIntensity,\nvThicknessParam,\nvTintColor,\nnormalW,\nspecularEnvironmentReflectance,\n#ifdef SS_THICKNESSANDMASK_TEXTURE\nthicknessMap,\n#endif\n#ifdef SS_REFRACTIONINTENSITY_TEXTURE\nrefractionIntensityMap,\n#endif\n#ifdef SS_TRANSLUCENCYINTENSITY_TEXTURE\ntranslucencyIntensityMap,\n#endif\n#ifdef REFLECTION\n#ifdef SS_TRANSLUCENCY\nreflectionMatrix,\n#ifdef USESPHERICALFROMREFLECTIONMAP\n#if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)\nreflectionOut.irradianceVector,\n#endif\n#if defined(REALTIME_FILTERING)\nreflectionSampler,\nvReflectionFilteringInfo,\n#endif\n#endif\n#ifdef USEIRRADIANCEMAP\nirradianceSampler,\n#endif\n#endif\n#endif\n#if defined(SS_REFRACTION) || defined(SS_TRANSLUCENCY)\nsurfaceAlbedo,\n#endif\n#ifdef SS_REFRACTION\nvPositionW,\nviewDirectionW,\nview,\nvRefractionInfos,\nrefractionMatrix,\nvRefractionMicrosurfaceInfos,\nvLightingIntensity,\n#ifdef SS_LINKREFRACTIONTOTRANSPARENCY\nalpha,\n#endif\n#ifdef SS_LODINREFRACTIONALPHA\nNdotVUnclamped,\n#endif\n#ifdef SS_LINEARSPECULARREFRACTION\nroughness,\n#endif\nalphaG,\nrefractionSampler,\n#ifndef LODBASEDMICROSFURACE\nrefractionSamplerLow,\nrefractionSamplerHigh,\n#endif\n#ifdef ANISOTROPIC\nanisotropicOut,\n#endif\n#ifdef REALTIME_FILTERING\nvRefractionFilteringInfo,\n#endif\n#ifdef SS_USE_LOCAL_REFRACTIONMAP_CUBIC\nvRefractionPosition,\nvRefractionSize,\n#endif\n#endif\n#ifdef SS_TRANSLUCENCY\nvDiffusionDistance,\n#endif\nsubSurfaceOut\n);\n#ifdef SS_REFRACTION\nsurfaceAlbedo=subSurfaceOut.surfaceAlbedo;\n#ifdef SS_LINKREFRACTIONTOTRANSPARENCY\nalpha=subSurfaceOut.alpha;\n#endif\n#endif\n#else\nsubSurfaceOut.specularEnvironmentReflectance=specularEnvironmentReflectance;\n#endif\n#include\n#include[0..maxSimultaneousLights]\n#include\n#endif \n#include\n#define CUSTOM_FRAGMENT_BEFORE_FINALCOLORCOMPOSITION\n#include\n#include\n#include(color,finalColor)\n#include\n#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR\n#ifdef PREPASS\nfloat writeGeometryInfo=finalColor.a>0.4 ? 1.0 : 0.0;\n#ifdef PREPASS_POSITION\ngl_FragData[PREPASS_POSITION_INDEX]=vec4(vPositionW,writeGeometryInfo);\n#endif\n#ifdef PREPASS_VELOCITY\nvec2 a=(vCurrentPosition.xy/vCurrentPosition.w)*0.5+0.5;vec2 b=(vPreviousPosition.xy/vPreviousPosition.w)*0.5+0.5;vec2 velocity=abs(a-b);velocity=vec2(pow(velocity.x,1.0/3.0),pow(velocity.y,1.0/3.0))*sign(a-b)*0.5+0.5;gl_FragData[PREPASS_VELOCITY_INDEX]=vec4(velocity,0.0,writeGeometryInfo);\n#endif\n#ifdef PREPASS_ALBEDO_SQRT\nvec3 sqAlbedo=sqrt(surfaceAlbedo); \n#endif\n#ifdef PREPASS_IRRADIANCE\nvec3 irradiance=finalDiffuse;\n#ifndef UNLIT\n#ifdef REFLECTION\nirradiance+=finalIrradiance;\n#endif\n#endif\n#ifdef SS_SCATTERING\ngl_FragData[0]=vec4(finalColor.rgb-irradiance,finalColor.a); \nirradiance/=sqAlbedo;\n#else\ngl_FragData[0]=finalColor; \nfloat scatteringDiffusionProfile=255.;\n#endif\ngl_FragData[PREPASS_IRRADIANCE_INDEX]=vec4(clamp(irradiance,vec3(0.),vec3(1.)),writeGeometryInfo*scatteringDiffusionProfile/255.); \n#else\ngl_FragData[0]=vec4(finalColor.rgb,finalColor.a);\n#endif\n#ifdef PREPASS_DEPTH\ngl_FragData[PREPASS_DEPTH_INDEX]=vec4(vViewPos.z,0.0,0.0,writeGeometryInfo); \n#endif\n#ifdef PREPASS_NORMAL\n#ifdef PREPASS_NORMAL_WORLDSPACE\ngl_FragData[PREPASS_NORMAL_INDEX]=vec4(normalW,writeGeometryInfo); \n#else\ngl_FragData[PREPASS_NORMAL_INDEX]=vec4(normalize((view*vec4(normalW,0.0)).rgb),writeGeometryInfo); \n#endif\n#endif\n#ifdef PREPASS_ALBEDO_SQRT\ngl_FragData[PREPASS_ALBEDO_SQRT_INDEX]=vec4(sqAlbedo,writeGeometryInfo); \n#endif\n#ifdef PREPASS_REFLECTIVITY\n#ifndef UNLIT\ngl_FragData[PREPASS_REFLECTIVITY_INDEX]=vec4(specularEnvironmentR0,microSurface)*writeGeometryInfo;\n#else\ngl_FragData[PREPASS_REFLECTIVITY_INDEX]=vec4( 0.0,0.0,0.0,1.0 )*writeGeometryInfo;\n#endif\n#endif\n#endif\n#if !defined(PREPASS) || defined(WEBGL2)\ngl_FragColor=finalColor;\n#endif\n#include\n#if ORDER_INDEPENDENT_TRANSPARENCY\nif (fragDepth==nearestDepth) {frontColor.rgb+=finalColor.rgb*finalColor.a*alphaMultiplier;frontColor.a=1.0-alphaMultiplier*(1.0-finalColor.a);} else {backColor+=finalColor;}\n#endif\n#include\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @internal */\nexport const pbrPixelShader = { name, shader };\n//# sourceMappingURL=pbr.fragment.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nimport \"./decalVertexDeclaration.js\";\nconst name = \"pbrVertexDeclaration\";\nconst shader = `uniform mat4 view;uniform mat4 viewProjection;\n#ifdef ALBEDO\nuniform mat4 albedoMatrix;uniform vec2 vAlbedoInfos;\n#endif\n#ifdef AMBIENT\nuniform mat4 ambientMatrix;uniform vec4 vAmbientInfos;\n#endif\n#ifdef OPACITY\nuniform mat4 opacityMatrix;uniform vec2 vOpacityInfos;\n#endif\n#ifdef EMISSIVE\nuniform vec2 vEmissiveInfos;uniform mat4 emissiveMatrix;\n#endif\n#ifdef LIGHTMAP\nuniform vec2 vLightmapInfos;uniform mat4 lightmapMatrix;\n#endif\n#ifdef REFLECTIVITY \nuniform vec3 vReflectivityInfos;uniform mat4 reflectivityMatrix;\n#endif\n#ifdef METALLIC_REFLECTANCE\nuniform vec2 vMetallicReflectanceInfos;uniform mat4 metallicReflectanceMatrix;\n#endif\n#ifdef REFLECTANCE\nuniform vec2 vReflectanceInfos;uniform mat4 reflectanceMatrix;\n#endif\n#ifdef MICROSURFACEMAP\nuniform vec2 vMicroSurfaceSamplerInfos;uniform mat4 microSurfaceSamplerMatrix;\n#endif\n#ifdef BUMP\nuniform vec3 vBumpInfos;uniform mat4 bumpMatrix;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n#ifdef REFLECTION\nuniform vec2 vReflectionInfos;uniform mat4 reflectionMatrix;\n#endif\n#ifdef CLEARCOAT\n#if defined(CLEARCOAT_TEXTURE) || defined(CLEARCOAT_TEXTURE_ROUGHNESS)\nuniform vec4 vClearCoatInfos;\n#endif\n#ifdef CLEARCOAT_TEXTURE\nuniform mat4 clearCoatMatrix;\n#endif\n#ifdef CLEARCOAT_TEXTURE_ROUGHNESS\nuniform mat4 clearCoatRoughnessMatrix;\n#endif\n#ifdef CLEARCOAT_BUMP\nuniform vec2 vClearCoatBumpInfos;uniform mat4 clearCoatBumpMatrix;\n#endif\n#ifdef CLEARCOAT_TINT_TEXTURE\nuniform vec2 vClearCoatTintInfos;uniform mat4 clearCoatTintMatrix;\n#endif\n#endif\n#ifdef IRIDESCENCE\n#if defined(IRIDESCENCE_TEXTURE) || defined(IRIDESCENCE_THICKNESS_TEXTURE)\nuniform vec4 vIridescenceInfos;\n#endif\n#ifdef IRIDESCENCE_TEXTURE\nuniform mat4 iridescenceMatrix;\n#endif\n#ifdef IRIDESCENCE_THICKNESS_TEXTURE\nuniform mat4 iridescenceThicknessMatrix;\n#endif\n#endif\n#ifdef ANISOTROPIC\n#ifdef ANISOTROPIC_TEXTURE\nuniform vec2 vAnisotropyInfos;uniform mat4 anisotropyMatrix;\n#endif\n#endif\n#ifdef SHEEN\n#if defined(SHEEN_TEXTURE) || defined(SHEEN_TEXTURE_ROUGHNESS)\nuniform vec4 vSheenInfos;\n#endif\n#ifdef SHEEN_TEXTURE\nuniform mat4 sheenMatrix;\n#endif\n#ifdef SHEEN_TEXTURE_ROUGHNESS\nuniform mat4 sheenRoughnessMatrix;\n#endif\n#endif\n#ifdef SUBSURFACE\n#ifdef SS_REFRACTION\nuniform vec4 vRefractionInfos;uniform mat4 refractionMatrix;\n#endif\n#ifdef SS_THICKNESSANDMASK_TEXTURE\nuniform vec2 vThicknessInfos;uniform mat4 thicknessMatrix;\n#endif\n#ifdef SS_REFRACTIONINTENSITY_TEXTURE\nuniform vec2 vRefractionIntensityInfos;uniform mat4 refractionIntensityMatrix;\n#endif\n#ifdef SS_TRANSLUCENCYINTENSITY_TEXTURE\nuniform vec2 vTranslucencyIntensityInfos;uniform mat4 translucencyIntensityMatrix;\n#endif\n#endif\n#ifdef NORMAL\n#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)\n#ifdef USESPHERICALFROMREFLECTIONMAP\n#ifdef SPHERICAL_HARMONICS\nuniform vec3 vSphericalL00;uniform vec3 vSphericalL1_1;uniform vec3 vSphericalL10;uniform vec3 vSphericalL11;uniform vec3 vSphericalL2_2;uniform vec3 vSphericalL2_1;uniform vec3 vSphericalL20;uniform vec3 vSphericalL21;uniform vec3 vSphericalL22;\n#else\nuniform vec3 vSphericalX;uniform vec3 vSphericalY;uniform vec3 vSphericalZ;uniform vec3 vSphericalXX_ZZ;uniform vec3 vSphericalYY_ZZ;uniform vec3 vSphericalZZ;uniform vec3 vSphericalXY;uniform vec3 vSphericalYZ;uniform vec3 vSphericalZX;\n#endif\n#endif\n#endif\n#endif\n#ifdef DETAIL\nuniform vec4 vDetailInfos;uniform mat4 detailMatrix;\n#endif\n#include\n#define ADDITIONAL_VERTEX_DECLARATION\n`;\n// Sideeffect\nShaderStore.IncludesShadersStore[name] = shader;\n/** @internal */\nexport const pbrVertexDeclaration = { name, shader };\n//# sourceMappingURL=pbrVertexDeclaration.js.map","// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore.js\";\nimport \"./ShadersInclude/pbrVertexDeclaration.js\";\nimport \"./ShadersInclude/pbrUboDeclaration.js\";\nimport \"./ShadersInclude/uvAttributeDeclaration.js\";\nimport \"./ShadersInclude/mainUVVaryingDeclaration.js\";\nimport \"./ShadersInclude/helperFunctions.js\";\nimport \"./ShadersInclude/bonesDeclaration.js\";\nimport \"./ShadersInclude/bakedVertexAnimationDeclaration.js\";\nimport \"./ShadersInclude/instancesDeclaration.js\";\nimport \"./ShadersInclude/prePassVertexDeclaration.js\";\nimport \"./ShadersInclude/samplerVertexDeclaration.js\";\nimport \"./ShadersInclude/harmonicsFunctions.js\";\nimport \"./ShadersInclude/bumpVertexDeclaration.js\";\nimport \"./ShadersInclude/clipPlaneVertexDeclaration.js\";\nimport \"./ShadersInclude/fogVertexDeclaration.js\";\nimport \"./ShadersInclude/lightVxFragmentDeclaration.js\";\nimport \"./ShadersInclude/lightVxUboDeclaration.js\";\nimport \"./ShadersInclude/morphTargetsVertexGlobalDeclaration.js\";\nimport \"./ShadersInclude/morphTargetsVertexDeclaration.js\";\nimport \"./ShadersInclude/logDepthDeclaration.js\";\nimport \"./ShadersInclude/morphTargetsVertexGlobal.js\";\nimport \"./ShadersInclude/morphTargetsVertex.js\";\nimport \"./ShadersInclude/instancesVertex.js\";\nimport \"./ShadersInclude/bonesVertex.js\";\nimport \"./ShadersInclude/bakedVertexAnimation.js\";\nimport \"./ShadersInclude/prePassVertex.js\";\nimport \"./ShadersInclude/uvVariableDeclaration.js\";\nimport \"./ShadersInclude/samplerVertexImplementation.js\";\nimport \"./ShadersInclude/bumpVertex.js\";\nimport \"./ShadersInclude/clipPlaneVertex.js\";\nimport \"./ShadersInclude/fogVertex.js\";\nimport \"./ShadersInclude/shadowsVertex.js\";\nimport \"./ShadersInclude/vertexColorMixing.js\";\nimport \"./ShadersInclude/logDepthVertex.js\";\nconst name = \"pbrVertexShader\";\nconst shader = `precision highp float;\n#include<__decl__pbrVertex>\n#define CUSTOM_VERTEX_BEGIN\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef TANGENT\nattribute vec4 tangent;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#include[2..7]\n#include[1..7]\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include\n#include\n#include\n#include\n#include\n#include(_DEFINENAME_,ALBEDO,_VARYINGNAME_,Albedo)\n#include(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail)\n#include(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient)\n#include(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity)\n#include(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive)\n#include(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap)\n#include(_DEFINENAME_,REFLECTIVITY,_VARYINGNAME_,Reflectivity)\n#include(_DEFINENAME_,MICROSURFACEMAP,_VARYINGNAME_,MicroSurfaceSampler)\n#include(_DEFINENAME_,METALLIC_REFLECTANCE,_VARYINGNAME_,MetallicReflectance)\n#include(_DEFINENAME_,REFLECTANCE,_VARYINGNAME_,Reflectance)\n#include(_DEFINENAME_,BUMP,_VARYINGNAME_,Bump)\n#include(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal)\n#ifdef CLEARCOAT\n#include(_DEFINENAME_,CLEARCOAT_TEXTURE,_VARYINGNAME_,ClearCoat)\n#include(_DEFINENAME_,CLEARCOAT_TEXTURE_ROUGHNESS,_VARYINGNAME_,ClearCoatRoughness)\n#include(_DEFINENAME_,CLEARCOAT_BUMP,_VARYINGNAME_,ClearCoatBump)\n#include(_DEFINENAME_,CLEARCOAT_TINT_TEXTURE,_VARYINGNAME_,ClearCoatTint)\n#endif\n#ifdef IRIDESCENCE\n#include(_DEFINENAME_,IRIDESCENCE_TEXTURE,_VARYINGNAME_,Iridescence)\n#include(_DEFINENAME_,IRIDESCENCE_THICKNESS_TEXTURE,_VARYINGNAME_,IridescenceThickness)\n#endif\n#ifdef SHEEN\n#include(_DEFINENAME_,SHEEN_TEXTURE,_VARYINGNAME_,Sheen)\n#include(_DEFINENAME_,SHEEN_TEXTURE_ROUGHNESS,_VARYINGNAME_,SheenRoughness)\n#endif\n#ifdef ANISOTROPIC\n#include(_DEFINENAME_,ANISOTROPIC_TEXTURE,_VARYINGNAME_,Anisotropy)\n#endif\n#ifdef SUBSURFACE\n#include(_DEFINENAME_,SS_THICKNESSANDMASK_TEXTURE,_VARYINGNAME_,Thickness)\n#include(_DEFINENAME_,SS_REFRACTIONINTENSITY_TEXTURE,_VARYINGNAME_,RefractionIntensity)\n#include(_DEFINENAME_,SS_TRANSLUCENCYINTENSITY_TEXTURE,_VARYINGNAME_,TranslucencyIntensity)\n#endif\nvarying vec3 vPositionW;\n#if DEBUGMODE>0\nvarying vec4 vClipSpacePosition;\n#endif\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)\nvarying vec3 vEnvironmentIrradiance;\n#include\n#endif\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vec4 vColor;\n#endif\n#include\n#include\n#include\n#include<__decl__lightVxFragment>[0..maxSimultaneousLights]\n#include\n#include[0..maxSimultaneousMorphTargets]\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#endif\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vec3 vDirectionW;\n#endif\n#include\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvec3 positionUpdated=position;\n#ifdef NORMAL\nvec3 normalUpdated=normal;\n#endif\n#ifdef TANGENT\nvec4 tangentUpdated=tangent;\n#endif\n#ifdef UV1\nvec2 uvUpdated=uv;\n#endif\n#include\n#include[0..maxSimultaneousMorphTargets]\n#ifdef REFLECTIONMAP_SKYBOX\nvPositionUVW=positionUpdated;\n#endif\n#define CUSTOM_VERTEX_UPDATE_POSITION\n#define CUSTOM_VERTEX_UPDATE_NORMAL\n#include\n#if defined(PREPASS) && defined(PREPASS_VELOCITY) && !defined(BONES_VELOCITY_ENABLED)\nvCurrentPosition=viewProjection*finalWorld*vec4(positionUpdated,1.0);vPreviousPosition=previousViewProjection*finalPreviousWorld*vec4(positionUpdated,1.0);\n#endif\n#include\n#include\nvec4 worldPos=finalWorld*vec4(positionUpdated,1.0);vPositionW=vec3(worldPos);\n#include\n#ifdef NORMAL\nmat3 normalWorld=mat3(finalWorld);\n#if defined(INSTANCES) && defined(THIN_INSTANCES)\nvNormalW=normalUpdated/vec3(dot(normalWorld[0],normalWorld[0]),dot(normalWorld[1],normalWorld[1]),dot(normalWorld[2],normalWorld[2]));vNormalW=normalize(normalWorld*vNormalW);\n#else\n#ifdef NONUNIFORMSCALING\nnormalWorld=transposeMat3(inverseMat3(normalWorld));\n#endif\nvNormalW=normalize(normalWorld*normalUpdated);\n#endif\n#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)\nvec3 reflectionVector=vec3(reflectionMatrix*vec4(vNormalW,0)).xyz;\n#ifdef REFLECTIONMAP_OPPOSITEZ\nreflectionVector.z*=-1.0;\n#endif\nvEnvironmentIrradiance=computeEnvironmentIrradiance(reflectionVector);\n#endif\n#endif\n#define CUSTOM_VERTEX_UPDATE_WORLDPOS\n#ifdef MULTIVIEW\nif (gl_ViewID_OVR==0u) {gl_Position=viewProjection*worldPos;} else {gl_Position=viewProjectionR*worldPos;}\n#else\ngl_Position=viewProjection*worldPos;\n#endif\n#if DEBUGMODE>0\nvClipSpacePosition=gl_Position;\n#endif\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvDirectionW=normalize(vec3(finalWorld*vec4(positionUpdated,0.0)));\n#endif\n#ifndef UV1\nvec2 uvUpdated=vec2(0.,0.);\n#endif\n#ifdef MAINUV1\nvMainUV1=uvUpdated;\n#endif\n#include[2..7]\n#include(_DEFINENAME_,ALBEDO,_VARYINGNAME_,Albedo,_MATRIXNAME_,albedo,_INFONAME_,AlbedoInfos.x)\n#include(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail,_MATRIXNAME_,detail,_INFONAME_,DetailInfos.x)\n#include(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient,_MATRIXNAME_,ambient,_INFONAME_,AmbientInfos.x)\n#include(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity,_MATRIXNAME_,opacity,_INFONAME_,OpacityInfos.x)\n#include(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive,_MATRIXNAME_,emissive,_INFONAME_,EmissiveInfos.x)\n#include(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap,_MATRIXNAME_,lightmap,_INFONAME_,LightmapInfos.x)\n#include(_DEFINENAME_,REFLECTIVITY,_VARYINGNAME_,Reflectivity,_MATRIXNAME_,reflectivity,_INFONAME_,ReflectivityInfos.x)\n#include(_DEFINENAME_,MICROSURFACEMAP,_VARYINGNAME_,MicroSurfaceSampler,_MATRIXNAME_,microSurfaceSampler,_INFONAME_,MicroSurfaceSamplerInfos.x)\n#include(_DEFINENAME_,METALLIC_REFLECTANCE,_VARYINGNAME_,MetallicReflectance,_MATRIXNAME_,metallicReflectance,_INFONAME_,MetallicReflectanceInfos.x)\n#include(_DEFINENAME_,REFLECTANCE,_VARYINGNAME_,Reflectance,_MATRIXNAME_,reflectance,_INFONAME_,ReflectanceInfos.x)\n#include(_DEFINENAME_,BUMP,_VARYINGNAME_,Bump,_MATRIXNAME_,bump,_INFONAME_,BumpInfos.x)\n#include(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal,_MATRIXNAME_,decal,_INFONAME_,DecalInfos.x)\n#ifdef CLEARCOAT\n#include(_DEFINENAME_,CLEARCOAT_TEXTURE,_VARYINGNAME_,ClearCoat,_MATRIXNAME_,clearCoat,_INFONAME_,ClearCoatInfos.x)\n#include(_DEFINENAME_,CLEARCOAT_TEXTURE_ROUGHNESS,_VARYINGNAME_,ClearCoatRoughness,_MATRIXNAME_,clearCoatRoughness,_INFONAME_,ClearCoatInfos.z)\n#include(_DEFINENAME_,CLEARCOAT_BUMP,_VARYINGNAME_,ClearCoatBump,_MATRIXNAME_,clearCoatBump,_INFONAME_,ClearCoatBumpInfos.x)\n#include(_DEFINENAME_,CLEARCOAT_TINT_TEXTURE,_VARYINGNAME_,ClearCoatTint,_MATRIXNAME_,clearCoatTint,_INFONAME_,ClearCoatTintInfos.x)\n#endif\n#ifdef IRIDESCENCE\n#include(_DEFINENAME_,IRIDESCENCE_TEXTURE,_VARYINGNAME_,Iridescence,_MATRIXNAME_,iridescence,_INFONAME_,IridescenceInfos.x)\n#include(_DEFINENAME_,IRIDESCENCE_THICKNESS_TEXTURE,_VARYINGNAME_,IridescenceThickness,_MATRIXNAME_,iridescenceThickness,_INFONAME_,IridescenceInfos.z)\n#endif\n#ifdef SHEEN\n#include(_DEFINENAME_,SHEEN_TEXTURE,_VARYINGNAME_,Sheen,_MATRIXNAME_,sheen,_INFONAME_,SheenInfos.x)\n#include(_DEFINENAME_,SHEEN_TEXTURE_ROUGHNESS,_VARYINGNAME_,SheenRoughness,_MATRIXNAME_,sheen,_INFONAME_,SheenInfos.z)\n#endif\n#ifdef ANISOTROPIC\n#include(_DEFINENAME_,ANISOTROPIC_TEXTURE,_VARYINGNAME_,Anisotropy,_MATRIXNAME_,anisotropy,_INFONAME_,AnisotropyInfos.x)\n#endif\n#ifdef SUBSURFACE\n#include(_DEFINENAME_,SS_THICKNESSANDMASK_TEXTURE,_VARYINGNAME_,Thickness,_MATRIXNAME_,thickness,_INFONAME_,ThicknessInfos.x)\n#include(_DEFINENAME_,SS_REFRACTIONINTENSITY_TEXTURE,_VARYINGNAME_,RefractionIntensity,_MATRIXNAME_,refractionIntensity,_INFONAME_,RefractionIntensityInfos.x)\n#include(_DEFINENAME_,SS_TRANSLUCENCYINTENSITY_TEXTURE,_VARYINGNAME_,TranslucencyIntensity,_MATRIXNAME_,translucencyIntensity,_INFONAME_,TranslucencyIntensityInfos.x)\n#endif\n#include\n#include\n#include\n#include[0..maxSimultaneousLights]\n#include\n#if defined(POINTSIZE) && !defined(WEBGPU)\ngl_PointSize=pointSize;\n#endif\n#include\n#define CUSTOM_VERTEX_MAIN_END\n}`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @internal */\nexport const pbrVertexShader = { name, shader };\n//# sourceMappingURL=pbr.vertex.js.map","import { __decorate } from \"../../tslib.es6.js\";\nimport { serialize, serializeAsTexture, expandToProperty, serializeAsColor3 } from \"../../Misc/decorators.js\";\nimport { Color3 } from \"../../Maths/math.color.js\";\nimport { MaterialFlags } from \"../materialFlags.js\";\nimport { MaterialHelper } from \"../../Materials/materialHelper.js\";\n\nimport { MaterialPluginBase } from \"../materialPluginBase.js\";\nimport { MaterialDefines } from \"../materialDefines.js\";\n/**\n * @internal\n */\nexport class MaterialClearCoatDefines extends MaterialDefines {\n constructor() {\n super(...arguments);\n this.CLEARCOAT = false;\n this.CLEARCOAT_DEFAULTIOR = false;\n this.CLEARCOAT_TEXTURE = false;\n this.CLEARCOAT_TEXTURE_ROUGHNESS = false;\n this.CLEARCOAT_TEXTUREDIRECTUV = 0;\n this.CLEARCOAT_TEXTURE_ROUGHNESSDIRECTUV = 0;\n this.CLEARCOAT_BUMP = false;\n this.CLEARCOAT_BUMPDIRECTUV = 0;\n this.CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE = false;\n this.CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL = false;\n this.CLEARCOAT_REMAP_F0 = false;\n this.CLEARCOAT_TINT = false;\n this.CLEARCOAT_TINT_TEXTURE = false;\n this.CLEARCOAT_TINT_TEXTUREDIRECTUV = 0;\n this.CLEARCOAT_TINT_GAMMATEXTURE = false;\n }\n}\n/**\n * Plugin that implements the clear coat component of the PBR material\n */\nexport class PBRClearCoatConfiguration extends MaterialPluginBase {\n /** @internal */\n _markAllSubMeshesAsTexturesDirty() {\n this._enable(this._isEnabled);\n this._internalMarkAllSubMeshesAsTexturesDirty();\n }\n constructor(material, addToPluginList = true) {\n super(material, \"PBRClearCoat\", 100, new MaterialClearCoatDefines(), addToPluginList);\n this._isEnabled = false;\n /**\n * Defines if the clear coat is enabled in the material.\n */\n this.isEnabled = false;\n /**\n * Defines the clear coat layer strength (between 0 and 1) it defaults to 1.\n */\n this.intensity = 1;\n /**\n * Defines the clear coat layer roughness.\n */\n this.roughness = 0;\n this._indexOfRefraction = PBRClearCoatConfiguration._DefaultIndexOfRefraction;\n /**\n * Defines the index of refraction of the clear coat.\n * This defaults to 1.5 corresponding to a 0.04 f0 or a 4% reflectance at normal incidence\n * The default fits with a polyurethane material.\n * Changing the default value is more performance intensive.\n */\n this.indexOfRefraction = PBRClearCoatConfiguration._DefaultIndexOfRefraction;\n this._texture = null;\n /**\n * Stores the clear coat values in a texture (red channel is intensity and green channel is roughness)\n * If useRoughnessFromMainTexture is false, the green channel of texture is not used and the green channel of textureRoughness is used instead\n * if textureRoughness is not empty, else no texture roughness is used\n */\n this.texture = null;\n this._useRoughnessFromMainTexture = true;\n /**\n * Indicates that the green channel of the texture property will be used for roughness (default: true)\n * If false, the green channel from textureRoughness is used for roughness\n */\n this.useRoughnessFromMainTexture = true;\n this._textureRoughness = null;\n /**\n * Stores the clear coat roughness in a texture (green channel)\n * Not used if useRoughnessFromMainTexture is true\n */\n this.textureRoughness = null;\n this._remapF0OnInterfaceChange = true;\n /**\n * Defines if the F0 value should be remapped to account for the interface change in the material.\n */\n this.remapF0OnInterfaceChange = true;\n this._bumpTexture = null;\n /**\n * Define the clear coat specific bump texture.\n */\n this.bumpTexture = null;\n this._isTintEnabled = false;\n /**\n * Defines if the clear coat tint is enabled in the material.\n */\n this.isTintEnabled = false;\n /**\n * Defines the clear coat tint of the material.\n * This is only use if tint is enabled\n */\n this.tintColor = Color3.White();\n /**\n * Defines the distance at which the tint color should be found in the\n * clear coat media.\n * This is only use if tint is enabled\n */\n this.tintColorAtDistance = 1;\n /**\n * Defines the clear coat layer thickness.\n * This is only use if tint is enabled\n */\n this.tintThickness = 1;\n this._tintTexture = null;\n /**\n * Stores the clear tint values in a texture.\n * rgb is tint\n * a is a thickness factor\n */\n this.tintTexture = null;\n this._internalMarkAllSubMeshesAsTexturesDirty = material._dirtyCallbacks[1];\n }\n isReadyForSubMesh(defines, scene, engine) {\n if (!this._isEnabled) {\n return true;\n }\n const disableBumpMap = this._material._disableBumpMap;\n if (defines._areTexturesDirty) {\n if (scene.texturesEnabled) {\n if (this._texture && MaterialFlags.ClearCoatTextureEnabled) {\n if (!this._texture.isReadyOrNotBlocking()) {\n return false;\n }\n }\n if (this._textureRoughness && MaterialFlags.ClearCoatTextureEnabled) {\n if (!this._textureRoughness.isReadyOrNotBlocking()) {\n return false;\n }\n }\n if (engine.getCaps().standardDerivatives && this._bumpTexture && MaterialFlags.ClearCoatBumpTextureEnabled && !disableBumpMap) {\n // Bump texture cannot be not blocking.\n if (!this._bumpTexture.isReady()) {\n return false;\n }\n }\n if (this._isTintEnabled && this._tintTexture && MaterialFlags.ClearCoatTintTextureEnabled) {\n if (!this._tintTexture.isReadyOrNotBlocking()) {\n return false;\n }\n }\n }\n }\n return true;\n }\n prepareDefinesBeforeAttributes(defines, scene) {\n var _a;\n if (this._isEnabled) {\n defines.CLEARCOAT = true;\n defines.CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE = this._useRoughnessFromMainTexture;\n defines.CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL =\n this._texture !== null && this._texture._texture === ((_a = this._textureRoughness) === null || _a === void 0 ? void 0 : _a._texture) && this._texture.checkTransformsAreIdentical(this._textureRoughness);\n defines.CLEARCOAT_REMAP_F0 = this._remapF0OnInterfaceChange;\n if (defines._areTexturesDirty) {\n if (scene.texturesEnabled) {\n if (this._texture && MaterialFlags.ClearCoatTextureEnabled) {\n MaterialHelper.PrepareDefinesForMergedUV(this._texture, defines, \"CLEARCOAT_TEXTURE\");\n }\n else {\n defines.CLEARCOAT_TEXTURE = false;\n }\n if (this._textureRoughness && MaterialFlags.ClearCoatTextureEnabled) {\n MaterialHelper.PrepareDefinesForMergedUV(this._textureRoughness, defines, \"CLEARCOAT_TEXTURE_ROUGHNESS\");\n }\n else {\n defines.CLEARCOAT_TEXTURE_ROUGHNESS = false;\n }\n if (this._bumpTexture && MaterialFlags.ClearCoatBumpTextureEnabled) {\n MaterialHelper.PrepareDefinesForMergedUV(this._bumpTexture, defines, \"CLEARCOAT_BUMP\");\n }\n else {\n defines.CLEARCOAT_BUMP = false;\n }\n defines.CLEARCOAT_DEFAULTIOR = this._indexOfRefraction === PBRClearCoatConfiguration._DefaultIndexOfRefraction;\n if (this._isTintEnabled) {\n defines.CLEARCOAT_TINT = true;\n if (this._tintTexture && MaterialFlags.ClearCoatTintTextureEnabled) {\n MaterialHelper.PrepareDefinesForMergedUV(this._tintTexture, defines, \"CLEARCOAT_TINT_TEXTURE\");\n defines.CLEARCOAT_TINT_GAMMATEXTURE = this._tintTexture.gammaSpace;\n }\n else {\n defines.CLEARCOAT_TINT_TEXTURE = false;\n }\n }\n else {\n defines.CLEARCOAT_TINT = false;\n defines.CLEARCOAT_TINT_TEXTURE = false;\n }\n }\n }\n }\n else {\n defines.CLEARCOAT = false;\n defines.CLEARCOAT_TEXTURE = false;\n defines.CLEARCOAT_TEXTURE_ROUGHNESS = false;\n defines.CLEARCOAT_BUMP = false;\n defines.CLEARCOAT_TINT = false;\n defines.CLEARCOAT_TINT_TEXTURE = false;\n defines.CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE = false;\n defines.CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL = false;\n defines.CLEARCOAT_DEFAULTIOR = false;\n defines.CLEARCOAT_TEXTUREDIRECTUV = 0;\n defines.CLEARCOAT_TEXTURE_ROUGHNESSDIRECTUV = 0;\n defines.CLEARCOAT_BUMPDIRECTUV = 0;\n defines.CLEARCOAT_REMAP_F0 = false;\n defines.CLEARCOAT_TINT_TEXTUREDIRECTUV = 0;\n defines.CLEARCOAT_TINT_GAMMATEXTURE = false;\n }\n }\n bindForSubMesh(uniformBuffer, scene, engine, subMesh) {\n var _a, _b, _c, _d, _e, _f, _g, _h;\n if (!this._isEnabled) {\n return;\n }\n const defines = subMesh.materialDefines;\n const isFrozen = this._material.isFrozen;\n const disableBumpMap = this._material._disableBumpMap;\n const invertNormalMapX = this._material._invertNormalMapX;\n const invertNormalMapY = this._material._invertNormalMapY;\n const identicalTextures = defines.CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL;\n if (!uniformBuffer.useUbo || !isFrozen || !uniformBuffer.isSync) {\n if (identicalTextures && MaterialFlags.ClearCoatTextureEnabled) {\n uniformBuffer.updateFloat4(\"vClearCoatInfos\", this._texture.coordinatesIndex, this._texture.level, -1, -1);\n MaterialHelper.BindTextureMatrix(this._texture, uniformBuffer, \"clearCoat\");\n }\n else if ((this._texture || this._textureRoughness) && MaterialFlags.ClearCoatTextureEnabled) {\n uniformBuffer.updateFloat4(\"vClearCoatInfos\", (_b = (_a = this._texture) === null || _a === void 0 ? void 0 : _a.coordinatesIndex) !== null && _b !== void 0 ? _b : 0, (_d = (_c = this._texture) === null || _c === void 0 ? void 0 : _c.level) !== null && _d !== void 0 ? _d : 0, (_f = (_e = this._textureRoughness) === null || _e === void 0 ? void 0 : _e.coordinatesIndex) !== null && _f !== void 0 ? _f : 0, (_h = (_g = this._textureRoughness) === null || _g === void 0 ? void 0 : _g.level) !== null && _h !== void 0 ? _h : 0);\n if (this._texture) {\n MaterialHelper.BindTextureMatrix(this._texture, uniformBuffer, \"clearCoat\");\n }\n if (this._textureRoughness && !identicalTextures && !defines.CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE) {\n MaterialHelper.BindTextureMatrix(this._textureRoughness, uniformBuffer, \"clearCoatRoughness\");\n }\n }\n if (this._bumpTexture && engine.getCaps().standardDerivatives && MaterialFlags.ClearCoatTextureEnabled && !disableBumpMap) {\n uniformBuffer.updateFloat2(\"vClearCoatBumpInfos\", this._bumpTexture.coordinatesIndex, this._bumpTexture.level);\n MaterialHelper.BindTextureMatrix(this._bumpTexture, uniformBuffer, \"clearCoatBump\");\n if (scene._mirroredCameraPosition) {\n uniformBuffer.updateFloat2(\"vClearCoatTangentSpaceParams\", invertNormalMapX ? 1.0 : -1.0, invertNormalMapY ? 1.0 : -1.0);\n }\n else {\n uniformBuffer.updateFloat2(\"vClearCoatTangentSpaceParams\", invertNormalMapX ? -1.0 : 1.0, invertNormalMapY ? -1.0 : 1.0);\n }\n }\n if (this._tintTexture && MaterialFlags.ClearCoatTintTextureEnabled) {\n uniformBuffer.updateFloat2(\"vClearCoatTintInfos\", this._tintTexture.coordinatesIndex, this._tintTexture.level);\n MaterialHelper.BindTextureMatrix(this._tintTexture, uniformBuffer, \"clearCoatTint\");\n }\n // Clear Coat General params\n uniformBuffer.updateFloat2(\"vClearCoatParams\", this.intensity, this.roughness);\n // Clear Coat Refraction params\n const a = 1 - this._indexOfRefraction;\n const b = 1 + this._indexOfRefraction;\n const f0 = Math.pow(-a / b, 2); // Schlicks approx: (ior1 - ior2) / (ior1 + ior2) where ior2 for air is close to vacuum = 1.\n const eta = 1 / this._indexOfRefraction;\n uniformBuffer.updateFloat4(\"vClearCoatRefractionParams\", f0, eta, a, b);\n if (this._isTintEnabled) {\n uniformBuffer.updateFloat4(\"vClearCoatTintParams\", this.tintColor.r, this.tintColor.g, this.tintColor.b, Math.max(0.00001, this.tintThickness));\n uniformBuffer.updateFloat(\"clearCoatColorAtDistance\", Math.max(0.00001, this.tintColorAtDistance));\n }\n }\n // Textures\n if (scene.texturesEnabled) {\n if (this._texture && MaterialFlags.ClearCoatTextureEnabled) {\n uniformBuffer.setTexture(\"clearCoatSampler\", this._texture);\n }\n if (this._textureRoughness && !identicalTextures && !defines.CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE && MaterialFlags.ClearCoatTextureEnabled) {\n uniformBuffer.setTexture(\"clearCoatRoughnessSampler\", this._textureRoughness);\n }\n if (this._bumpTexture && engine.getCaps().standardDerivatives && MaterialFlags.ClearCoatBumpTextureEnabled && !disableBumpMap) {\n uniformBuffer.setTexture(\"clearCoatBumpSampler\", this._bumpTexture);\n }\n if (this._isTintEnabled && this._tintTexture && MaterialFlags.ClearCoatTintTextureEnabled) {\n uniformBuffer.setTexture(\"clearCoatTintSampler\", this._tintTexture);\n }\n }\n }\n hasTexture(texture) {\n if (this._texture === texture) {\n return true;\n }\n if (this._textureRoughness === texture) {\n return true;\n }\n if (this._bumpTexture === texture) {\n return true;\n }\n if (this._tintTexture === texture) {\n return true;\n }\n return false;\n }\n getActiveTextures(activeTextures) {\n if (this._texture) {\n activeTextures.push(this._texture);\n }\n if (this._textureRoughness) {\n activeTextures.push(this._textureRoughness);\n }\n if (this._bumpTexture) {\n activeTextures.push(this._bumpTexture);\n }\n if (this._tintTexture) {\n activeTextures.push(this._tintTexture);\n }\n }\n getAnimatables(animatables) {\n if (this._texture && this._texture.animations && this._texture.animations.length > 0) {\n animatables.push(this._texture);\n }\n if (this._textureRoughness && this._textureRoughness.animations && this._textureRoughness.animations.length > 0) {\n animatables.push(this._textureRoughness);\n }\n if (this._bumpTexture && this._bumpTexture.animations && this._bumpTexture.animations.length > 0) {\n animatables.push(this._bumpTexture);\n }\n if (this._tintTexture && this._tintTexture.animations && this._tintTexture.animations.length > 0) {\n animatables.push(this._tintTexture);\n }\n }\n dispose(forceDisposeTextures) {\n var _a, _b, _c, _d;\n if (forceDisposeTextures) {\n (_a = this._texture) === null || _a === void 0 ? void 0 : _a.dispose();\n (_b = this._textureRoughness) === null || _b === void 0 ? void 0 : _b.dispose();\n (_c = this._bumpTexture) === null || _c === void 0 ? void 0 : _c.dispose();\n (_d = this._tintTexture) === null || _d === void 0 ? void 0 : _d.dispose();\n }\n }\n getClassName() {\n return \"PBRClearCoatConfiguration\";\n }\n addFallbacks(defines, fallbacks, currentRank) {\n if (defines.CLEARCOAT_BUMP) {\n fallbacks.addFallback(currentRank++, \"CLEARCOAT_BUMP\");\n }\n if (defines.CLEARCOAT_TINT) {\n fallbacks.addFallback(currentRank++, \"CLEARCOAT_TINT\");\n }\n if (defines.CLEARCOAT) {\n fallbacks.addFallback(currentRank++, \"CLEARCOAT\");\n }\n return currentRank;\n }\n getSamplers(samplers) {\n samplers.push(\"clearCoatSampler\", \"clearCoatRoughnessSampler\", \"clearCoatBumpSampler\", \"clearCoatTintSampler\");\n }\n getUniforms() {\n return {\n ubo: [\n { name: \"vClearCoatParams\", size: 2, type: \"vec2\" },\n { name: \"vClearCoatRefractionParams\", size: 4, type: \"vec4\" },\n { name: \"vClearCoatInfos\", size: 4, type: \"vec4\" },\n { name: \"clearCoatMatrix\", size: 16, type: \"mat4\" },\n { name: \"clearCoatRoughnessMatrix\", size: 16, type: \"mat4\" },\n { name: \"vClearCoatBumpInfos\", size: 2, type: \"vec2\" },\n { name: \"vClearCoatTangentSpaceParams\", size: 2, type: \"vec2\" },\n { name: \"clearCoatBumpMatrix\", size: 16, type: \"mat4\" },\n { name: \"vClearCoatTintParams\", size: 4, type: \"vec4\" },\n { name: \"clearCoatColorAtDistance\", size: 1, type: \"float\" },\n { name: \"vClearCoatTintInfos\", size: 2, type: \"vec2\" },\n { name: \"clearCoatTintMatrix\", size: 16, type: \"mat4\" },\n ],\n };\n }\n}\n/**\n * This defaults to 1.5 corresponding to a 0.04 f0 or a 4% reflectance at normal incidence\n * The default fits with a polyurethane material.\n * @internal\n */\nPBRClearCoatConfiguration._DefaultIndexOfRefraction = 1.5;\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRClearCoatConfiguration.prototype, \"isEnabled\", void 0);\n__decorate([\n serialize()\n], PBRClearCoatConfiguration.prototype, \"intensity\", void 0);\n__decorate([\n serialize()\n], PBRClearCoatConfiguration.prototype, \"roughness\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRClearCoatConfiguration.prototype, \"indexOfRefraction\", void 0);\n__decorate([\n serializeAsTexture(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRClearCoatConfiguration.prototype, \"texture\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRClearCoatConfiguration.prototype, \"useRoughnessFromMainTexture\", void 0);\n__decorate([\n serializeAsTexture(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRClearCoatConfiguration.prototype, \"textureRoughness\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRClearCoatConfiguration.prototype, \"remapF0OnInterfaceChange\", void 0);\n__decorate([\n serializeAsTexture(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRClearCoatConfiguration.prototype, \"bumpTexture\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRClearCoatConfiguration.prototype, \"isTintEnabled\", void 0);\n__decorate([\n serializeAsColor3()\n], PBRClearCoatConfiguration.prototype, \"tintColor\", void 0);\n__decorate([\n serialize()\n], PBRClearCoatConfiguration.prototype, \"tintColorAtDistance\", void 0);\n__decorate([\n serialize()\n], PBRClearCoatConfiguration.prototype, \"tintThickness\", void 0);\n__decorate([\n serializeAsTexture(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRClearCoatConfiguration.prototype, \"tintTexture\", void 0);\n//# sourceMappingURL=pbrClearCoatConfiguration.js.map","import { __decorate } from \"../../tslib.es6.js\";\nimport { serialize, serializeAsTexture, expandToProperty } from \"../../Misc/decorators.js\";\nimport { MaterialFlags } from \"../materialFlags.js\";\nimport { MaterialHelper } from \"../../Materials/materialHelper.js\";\n\nimport { MaterialPluginBase } from \"../materialPluginBase.js\";\nimport { MaterialDefines } from \"../materialDefines.js\";\n/**\n * @internal\n */\nexport class MaterialIridescenceDefines extends MaterialDefines {\n constructor() {\n super(...arguments);\n this.IRIDESCENCE = false;\n this.IRIDESCENCE_TEXTURE = false;\n this.IRIDESCENCE_TEXTUREDIRECTUV = 0;\n this.IRIDESCENCE_THICKNESS_TEXTURE = false;\n this.IRIDESCENCE_THICKNESS_TEXTUREDIRECTUV = 0;\n this.IRIDESCENCE_USE_THICKNESS_FROM_MAINTEXTURE = false;\n }\n}\n/**\n * Plugin that implements the iridescence (thin film) component of the PBR material\n */\nexport class PBRIridescenceConfiguration extends MaterialPluginBase {\n /** @internal */\n _markAllSubMeshesAsTexturesDirty() {\n this._enable(this._isEnabled);\n this._internalMarkAllSubMeshesAsTexturesDirty();\n }\n constructor(material, addToPluginList = true) {\n super(material, \"PBRIridescence\", 110, new MaterialIridescenceDefines(), addToPluginList);\n this._isEnabled = false;\n /**\n * Defines if the iridescence is enabled in the material.\n */\n this.isEnabled = false;\n /**\n * Defines the iridescence layer strength (between 0 and 1) it defaults to 1.\n */\n this.intensity = 1;\n /**\n * Defines the minimum thickness of the thin-film layer given in nanometers (nm).\n */\n this.minimumThickness = PBRIridescenceConfiguration._DefaultMinimumThickness;\n /**\n * Defines the maximum thickness of the thin-film layer given in nanometers (nm). This will be the thickness used if not thickness texture has been set.\n */\n this.maximumThickness = PBRIridescenceConfiguration._DefaultMaximumThickness;\n /**\n * Defines the maximum thickness of the thin-film layer given in nanometers (nm).\n */\n this.indexOfRefraction = PBRIridescenceConfiguration._DefaultIndexOfRefraction;\n this._texture = null;\n /**\n * Stores the iridescence intensity in a texture (red channel)\n */\n this.texture = null;\n this._thicknessTexture = null;\n /**\n * Stores the iridescence thickness in a texture (green channel)\n */\n this.thicknessTexture = null;\n this._internalMarkAllSubMeshesAsTexturesDirty = material._dirtyCallbacks[1];\n }\n isReadyForSubMesh(defines, scene) {\n if (!this._isEnabled) {\n return true;\n }\n if (defines._areTexturesDirty) {\n if (scene.texturesEnabled) {\n if (this._texture && MaterialFlags.IridescenceTextureEnabled) {\n if (!this._texture.isReadyOrNotBlocking()) {\n return false;\n }\n }\n if (this._thicknessTexture && MaterialFlags.IridescenceTextureEnabled) {\n if (!this._thicknessTexture.isReadyOrNotBlocking()) {\n return false;\n }\n }\n }\n }\n return true;\n }\n prepareDefinesBeforeAttributes(defines, scene) {\n var _a;\n if (this._isEnabled) {\n defines.IRIDESCENCE = true;\n defines.IRIDESCENCE_USE_THICKNESS_FROM_MAINTEXTURE =\n this._texture !== null && this._texture._texture === ((_a = this._thicknessTexture) === null || _a === void 0 ? void 0 : _a._texture) && this._texture.checkTransformsAreIdentical(this._thicknessTexture);\n if (defines._areTexturesDirty) {\n if (scene.texturesEnabled) {\n if (this._texture && MaterialFlags.IridescenceTextureEnabled) {\n MaterialHelper.PrepareDefinesForMergedUV(this._texture, defines, \"IRIDESCENCE_TEXTURE\");\n }\n else {\n defines.IRIDESCENCE_TEXTURE = false;\n }\n if (!defines.IRIDESCENCE_USE_THICKNESS_FROM_MAINTEXTURE && this._thicknessTexture && MaterialFlags.IridescenceTextureEnabled) {\n MaterialHelper.PrepareDefinesForMergedUV(this._thicknessTexture, defines, \"IRIDESCENCE_THICKNESS_TEXTURE\");\n }\n else {\n defines.IRIDESCENCE_THICKNESS_TEXTURE = false;\n }\n }\n }\n }\n else {\n defines.IRIDESCENCE = false;\n defines.IRIDESCENCE_TEXTURE = false;\n defines.IRIDESCENCE_THICKNESS_TEXTURE = false;\n defines.IRIDESCENCE_USE_THICKNESS_FROM_MAINTEXTURE = false;\n defines.IRIDESCENCE_TEXTUREDIRECTUV = 0;\n defines.IRIDESCENCE_THICKNESS_TEXTUREDIRECTUV = 0;\n }\n }\n bindForSubMesh(uniformBuffer, scene, engine, subMesh) {\n var _a, _b, _c, _d, _e, _f, _g, _h;\n if (!this._isEnabled) {\n return;\n }\n const defines = subMesh.materialDefines;\n const isFrozen = this._material.isFrozen;\n const identicalTextures = defines.IRIDESCENCE_USE_THICKNESS_FROM_MAINTEXTURE;\n if (!uniformBuffer.useUbo || !isFrozen || !uniformBuffer.isSync) {\n if (identicalTextures && MaterialFlags.IridescenceTextureEnabled) {\n uniformBuffer.updateFloat4(\"vIridescenceInfos\", this._texture.coordinatesIndex, this._texture.level, -1, -1);\n MaterialHelper.BindTextureMatrix(this._texture, uniformBuffer, \"iridescence\");\n }\n else if ((this._texture || this._thicknessTexture) && MaterialFlags.IridescenceTextureEnabled) {\n uniformBuffer.updateFloat4(\"vIridescenceInfos\", (_b = (_a = this._texture) === null || _a === void 0 ? void 0 : _a.coordinatesIndex) !== null && _b !== void 0 ? _b : 0, (_d = (_c = this._texture) === null || _c === void 0 ? void 0 : _c.level) !== null && _d !== void 0 ? _d : 0, (_f = (_e = this._thicknessTexture) === null || _e === void 0 ? void 0 : _e.coordinatesIndex) !== null && _f !== void 0 ? _f : 0, (_h = (_g = this._thicknessTexture) === null || _g === void 0 ? void 0 : _g.level) !== null && _h !== void 0 ? _h : 0);\n if (this._texture) {\n MaterialHelper.BindTextureMatrix(this._texture, uniformBuffer, \"iridescence\");\n }\n if (this._thicknessTexture && !identicalTextures && !defines.IRIDESCENCE_USE_THICKNESS_FROM_MAINTEXTURE) {\n MaterialHelper.BindTextureMatrix(this._thicknessTexture, uniformBuffer, \"iridescenceThickness\");\n }\n }\n // Clear Coat General params\n uniformBuffer.updateFloat4(\"vIridescenceParams\", this.intensity, this.indexOfRefraction, this.minimumThickness, this.maximumThickness);\n }\n // Textures\n if (scene.texturesEnabled) {\n if (this._texture && MaterialFlags.IridescenceTextureEnabled) {\n uniformBuffer.setTexture(\"iridescenceSampler\", this._texture);\n }\n if (this._thicknessTexture && !identicalTextures && !defines.IRIDESCENCE_USE_THICKNESS_FROM_MAINTEXTURE && MaterialFlags.IridescenceTextureEnabled) {\n uniformBuffer.setTexture(\"iridescenceThicknessSampler\", this._thicknessTexture);\n }\n }\n }\n hasTexture(texture) {\n if (this._texture === texture) {\n return true;\n }\n if (this._thicknessTexture === texture) {\n return true;\n }\n return false;\n }\n getActiveTextures(activeTextures) {\n if (this._texture) {\n activeTextures.push(this._texture);\n }\n if (this._thicknessTexture) {\n activeTextures.push(this._thicknessTexture);\n }\n }\n getAnimatables(animatables) {\n if (this._texture && this._texture.animations && this._texture.animations.length > 0) {\n animatables.push(this._texture);\n }\n if (this._thicknessTexture && this._thicknessTexture.animations && this._thicknessTexture.animations.length > 0) {\n animatables.push(this._thicknessTexture);\n }\n }\n dispose(forceDisposeTextures) {\n var _a, _b;\n if (forceDisposeTextures) {\n (_a = this._texture) === null || _a === void 0 ? void 0 : _a.dispose();\n (_b = this._thicknessTexture) === null || _b === void 0 ? void 0 : _b.dispose();\n }\n }\n getClassName() {\n return \"PBRIridescenceConfiguration\";\n }\n addFallbacks(defines, fallbacks, currentRank) {\n if (defines.IRIDESCENCE) {\n fallbacks.addFallback(currentRank++, \"IRIDESCENCE\");\n }\n return currentRank;\n }\n getSamplers(samplers) {\n samplers.push(\"iridescenceSampler\", \"iridescenceThicknessSampler\");\n }\n getUniforms() {\n return {\n ubo: [\n { name: \"vIridescenceParams\", size: 4, type: \"vec4\" },\n { name: \"vIridescenceInfos\", size: 4, type: \"vec4\" },\n { name: \"iridescenceMatrix\", size: 16, type: \"mat4\" },\n { name: \"iridescenceThicknessMatrix\", size: 16, type: \"mat4\" },\n ],\n };\n }\n}\n/**\n * The default minimum thickness of the thin-film layer given in nanometers (nm).\n * Defaults to 100 nm.\n * @internal\n */\nPBRIridescenceConfiguration._DefaultMinimumThickness = 100;\n/**\n * The default maximum thickness of the thin-film layer given in nanometers (nm).\n * Defaults to 400 nm.\n * @internal\n */\nPBRIridescenceConfiguration._DefaultMaximumThickness = 400;\n/**\n * The default index of refraction of the thin-film layer.\n * Defaults to 1.3\n * @internal\n */\nPBRIridescenceConfiguration._DefaultIndexOfRefraction = 1.3;\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRIridescenceConfiguration.prototype, \"isEnabled\", void 0);\n__decorate([\n serialize()\n], PBRIridescenceConfiguration.prototype, \"intensity\", void 0);\n__decorate([\n serialize()\n], PBRIridescenceConfiguration.prototype, \"minimumThickness\", void 0);\n__decorate([\n serialize()\n], PBRIridescenceConfiguration.prototype, \"maximumThickness\", void 0);\n__decorate([\n serialize()\n], PBRIridescenceConfiguration.prototype, \"indexOfRefraction\", void 0);\n__decorate([\n serializeAsTexture(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRIridescenceConfiguration.prototype, \"texture\", void 0);\n__decorate([\n serializeAsTexture(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRIridescenceConfiguration.prototype, \"thicknessTexture\", void 0);\n//# sourceMappingURL=pbrIridescenceConfiguration.js.map","import { __decorate } from \"../../tslib.es6.js\";\n/* eslint-disable @typescript-eslint/naming-convention */\nimport { serialize, expandToProperty, serializeAsVector2, serializeAsTexture } from \"../../Misc/decorators.js\";\nimport { VertexBuffer } from \"../../Buffers/buffer.js\";\nimport { Vector2 } from \"../../Maths/math.vector.js\";\nimport { MaterialFlags } from \"../../Materials/materialFlags.js\";\nimport { MaterialHelper } from \"../../Materials/materialHelper.js\";\nimport { MaterialPluginBase } from \"../materialPluginBase.js\";\n\nimport { MaterialDefines } from \"../materialDefines.js\";\n/**\n * @internal\n */\nexport class MaterialAnisotropicDefines extends MaterialDefines {\n constructor() {\n super(...arguments);\n this.ANISOTROPIC = false;\n this.ANISOTROPIC_TEXTURE = false;\n this.ANISOTROPIC_TEXTUREDIRECTUV = 0;\n this.ANISOTROPIC_LEGACY = false;\n this.MAINUV1 = false;\n }\n}\n/**\n * Plugin that implements the anisotropic component of the PBR material\n */\nexport class PBRAnisotropicConfiguration extends MaterialPluginBase {\n /**\n * Sets the anisotropy direction as an angle.\n */\n set angle(value) {\n this.direction.x = Math.cos(value);\n this.direction.y = Math.sin(value);\n }\n /**\n * Gets the anisotropy angle value in radians.\n * @returns the anisotropy angle value in radians.\n */\n get angle() {\n return Math.atan2(this.direction.y, this.direction.x);\n }\n /** @internal */\n _markAllSubMeshesAsTexturesDirty() {\n this._enable(this._isEnabled);\n this._internalMarkAllSubMeshesAsTexturesDirty();\n }\n /** @internal */\n _markAllSubMeshesAsMiscDirty() {\n this._enable(this._isEnabled);\n this._internalMarkAllSubMeshesAsMiscDirty();\n }\n constructor(material, addToPluginList = true) {\n super(material, \"PBRAnisotropic\", 110, new MaterialAnisotropicDefines(), addToPluginList);\n this._isEnabled = false;\n /**\n * Defines if the anisotropy is enabled in the material.\n */\n this.isEnabled = false;\n /**\n * Defines the anisotropy strength (between 0 and 1) it defaults to 1.\n */\n this.intensity = 1;\n /**\n * Defines if the effect is along the tangents, bitangents or in between.\n * By default, the effect is \"stretching\" the highlights along the tangents.\n */\n this.direction = new Vector2(1, 0);\n this._texture = null;\n /**\n * Stores the anisotropy values in a texture.\n * rg is direction (like normal from -1 to 1)\n * b is a intensity\n */\n this.texture = null;\n this._legacy = false;\n /**\n * Defines if the anisotropy is in legacy mode for backwards compatibility before 6.4.0.\n */\n this.legacy = false;\n this._internalMarkAllSubMeshesAsTexturesDirty = material._dirtyCallbacks[1];\n this._internalMarkAllSubMeshesAsMiscDirty = material._dirtyCallbacks[16];\n }\n isReadyForSubMesh(defines, scene) {\n if (!this._isEnabled) {\n return true;\n }\n if (defines._areTexturesDirty) {\n if (scene.texturesEnabled) {\n if (this._texture && MaterialFlags.AnisotropicTextureEnabled) {\n if (!this._texture.isReadyOrNotBlocking()) {\n return false;\n }\n }\n }\n }\n return true;\n }\n prepareDefinesBeforeAttributes(defines, scene, mesh) {\n if (this._isEnabled) {\n defines.ANISOTROPIC = this._isEnabled;\n if (this._isEnabled && !mesh.isVerticesDataPresent(VertexBuffer.TangentKind)) {\n defines._needUVs = true;\n defines.MAINUV1 = true;\n }\n if (defines._areTexturesDirty) {\n if (scene.texturesEnabled) {\n if (this._texture && MaterialFlags.AnisotropicTextureEnabled) {\n MaterialHelper.PrepareDefinesForMergedUV(this._texture, defines, \"ANISOTROPIC_TEXTURE\");\n }\n else {\n defines.ANISOTROPIC_TEXTURE = false;\n }\n }\n }\n if (defines._areMiscDirty) {\n defines.ANISOTROPIC_LEGACY = this._legacy;\n }\n }\n else {\n defines.ANISOTROPIC = false;\n defines.ANISOTROPIC_TEXTURE = false;\n defines.ANISOTROPIC_TEXTUREDIRECTUV = 0;\n defines.ANISOTROPIC_LEGACY = false;\n }\n }\n bindForSubMesh(uniformBuffer, scene) {\n if (!this._isEnabled) {\n return;\n }\n const isFrozen = this._material.isFrozen;\n if (!uniformBuffer.useUbo || !isFrozen || !uniformBuffer.isSync) {\n if (this._texture && MaterialFlags.AnisotropicTextureEnabled) {\n uniformBuffer.updateFloat2(\"vAnisotropyInfos\", this._texture.coordinatesIndex, this._texture.level);\n MaterialHelper.BindTextureMatrix(this._texture, uniformBuffer, \"anisotropy\");\n }\n // Anisotropy\n uniformBuffer.updateFloat3(\"vAnisotropy\", this.direction.x, this.direction.y, this.intensity);\n }\n // Textures\n if (scene.texturesEnabled) {\n if (this._texture && MaterialFlags.AnisotropicTextureEnabled) {\n uniformBuffer.setTexture(\"anisotropySampler\", this._texture);\n }\n }\n }\n hasTexture(texture) {\n if (this._texture === texture) {\n return true;\n }\n return false;\n }\n getActiveTextures(activeTextures) {\n if (this._texture) {\n activeTextures.push(this._texture);\n }\n }\n getAnimatables(animatables) {\n if (this._texture && this._texture.animations && this._texture.animations.length > 0) {\n animatables.push(this._texture);\n }\n }\n dispose(forceDisposeTextures) {\n if (forceDisposeTextures) {\n if (this._texture) {\n this._texture.dispose();\n }\n }\n }\n getClassName() {\n return \"PBRAnisotropicConfiguration\";\n }\n addFallbacks(defines, fallbacks, currentRank) {\n if (defines.ANISOTROPIC) {\n fallbacks.addFallback(currentRank++, \"ANISOTROPIC\");\n }\n return currentRank;\n }\n getSamplers(samplers) {\n samplers.push(\"anisotropySampler\");\n }\n getUniforms() {\n return {\n ubo: [\n { name: \"vAnisotropy\", size: 3, type: \"vec3\" },\n { name: \"vAnisotropyInfos\", size: 2, type: \"vec2\" },\n { name: \"anisotropyMatrix\", size: 16, type: \"mat4\" },\n ],\n };\n }\n /**\n * Parses a anisotropy Configuration from a serialized object.\n * @param source - Serialized object.\n * @param scene Defines the scene we are parsing for\n * @param rootUrl Defines the rootUrl to load from\n */\n parse(source, scene, rootUrl) {\n super.parse(source, scene, rootUrl);\n // Backward compatibility\n if (source.legacy === undefined) {\n this.legacy = true;\n }\n }\n}\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRAnisotropicConfiguration.prototype, \"isEnabled\", void 0);\n__decorate([\n serialize()\n], PBRAnisotropicConfiguration.prototype, \"intensity\", void 0);\n__decorate([\n serializeAsVector2()\n], PBRAnisotropicConfiguration.prototype, \"direction\", void 0);\n__decorate([\n serializeAsTexture(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRAnisotropicConfiguration.prototype, \"texture\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsMiscDirty\")\n], PBRAnisotropicConfiguration.prototype, \"legacy\", void 0);\n//# sourceMappingURL=pbrAnisotropicConfiguration.js.map","import { __decorate } from \"../../tslib.es6.js\";\n/* eslint-disable @typescript-eslint/naming-convention */\nimport { serialize, expandToProperty, serializeAsColor3, serializeAsTexture } from \"../../Misc/decorators.js\";\nimport { Color3 } from \"../../Maths/math.color.js\";\nimport { MaterialFlags } from \"../../Materials/materialFlags.js\";\nimport { MaterialHelper } from \"../../Materials/materialHelper.js\";\n\nimport { MaterialPluginBase } from \"../materialPluginBase.js\";\nimport { MaterialDefines } from \"../materialDefines.js\";\n/**\n * @internal\n */\nexport class MaterialSheenDefines extends MaterialDefines {\n constructor() {\n super(...arguments);\n this.SHEEN = false;\n this.SHEEN_TEXTURE = false;\n this.SHEEN_GAMMATEXTURE = false;\n this.SHEEN_TEXTURE_ROUGHNESS = false;\n this.SHEEN_TEXTUREDIRECTUV = 0;\n this.SHEEN_TEXTURE_ROUGHNESSDIRECTUV = 0;\n this.SHEEN_LINKWITHALBEDO = false;\n this.SHEEN_ROUGHNESS = false;\n this.SHEEN_ALBEDOSCALING = false;\n this.SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE = false;\n this.SHEEN_TEXTURE_ROUGHNESS_IDENTICAL = false;\n }\n}\n/**\n * Plugin that implements the sheen component of the PBR material.\n */\nexport class PBRSheenConfiguration extends MaterialPluginBase {\n /** @internal */\n _markAllSubMeshesAsTexturesDirty() {\n this._enable(this._isEnabled);\n this._internalMarkAllSubMeshesAsTexturesDirty();\n }\n constructor(material, addToPluginList = true) {\n super(material, \"Sheen\", 120, new MaterialSheenDefines(), addToPluginList);\n this._isEnabled = false;\n /**\n * Defines if the material uses sheen.\n */\n this.isEnabled = false;\n this._linkSheenWithAlbedo = false;\n /**\n * Defines if the sheen is linked to the sheen color.\n */\n this.linkSheenWithAlbedo = false;\n /**\n * Defines the sheen intensity.\n */\n this.intensity = 1;\n /**\n * Defines the sheen color.\n */\n this.color = Color3.White();\n this._texture = null;\n /**\n * Stores the sheen tint values in a texture.\n * rgb is tint\n * a is a intensity or roughness if the roughness property has been defined and useRoughnessFromTexture is true (in that case, textureRoughness won't be used)\n * If the roughness property has been defined and useRoughnessFromTexture is false then the alpha channel is not used to modulate roughness\n */\n this.texture = null;\n this._useRoughnessFromMainTexture = true;\n /**\n * Indicates that the alpha channel of the texture property will be used for roughness.\n * Has no effect if the roughness (and texture!) property is not defined\n */\n this.useRoughnessFromMainTexture = true;\n this._roughness = null;\n /**\n * Defines the sheen roughness.\n * It is not taken into account if linkSheenWithAlbedo is true.\n * To stay backward compatible, material roughness is used instead if sheen roughness = null\n */\n this.roughness = null;\n this._textureRoughness = null;\n /**\n * Stores the sheen roughness in a texture.\n * alpha channel is the roughness. This texture won't be used if the texture property is not empty and useRoughnessFromTexture is true\n */\n this.textureRoughness = null;\n this._albedoScaling = false;\n /**\n * If true, the sheen effect is layered above the base BRDF with the albedo-scaling technique.\n * It allows the strength of the sheen effect to not depend on the base color of the material,\n * making it easier to setup and tweak the effect\n */\n this.albedoScaling = false;\n this._internalMarkAllSubMeshesAsTexturesDirty = material._dirtyCallbacks[1];\n }\n isReadyForSubMesh(defines, scene) {\n if (!this._isEnabled) {\n return true;\n }\n if (defines._areTexturesDirty) {\n if (scene.texturesEnabled) {\n if (this._texture && MaterialFlags.SheenTextureEnabled) {\n if (!this._texture.isReadyOrNotBlocking()) {\n return false;\n }\n }\n if (this._textureRoughness && MaterialFlags.SheenTextureEnabled) {\n if (!this._textureRoughness.isReadyOrNotBlocking()) {\n return false;\n }\n }\n }\n }\n return true;\n }\n prepareDefinesBeforeAttributes(defines, scene) {\n var _a;\n if (this._isEnabled) {\n defines.SHEEN = true;\n defines.SHEEN_LINKWITHALBEDO = this._linkSheenWithAlbedo;\n defines.SHEEN_ROUGHNESS = this._roughness !== null;\n defines.SHEEN_ALBEDOSCALING = this._albedoScaling;\n defines.SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE = this._useRoughnessFromMainTexture;\n defines.SHEEN_TEXTURE_ROUGHNESS_IDENTICAL =\n this._texture !== null && this._texture._texture === ((_a = this._textureRoughness) === null || _a === void 0 ? void 0 : _a._texture) && this._texture.checkTransformsAreIdentical(this._textureRoughness);\n if (defines._areTexturesDirty) {\n if (scene.texturesEnabled) {\n if (this._texture && MaterialFlags.SheenTextureEnabled) {\n MaterialHelper.PrepareDefinesForMergedUV(this._texture, defines, \"SHEEN_TEXTURE\");\n defines.SHEEN_GAMMATEXTURE = this._texture.gammaSpace;\n }\n else {\n defines.SHEEN_TEXTURE = false;\n }\n if (this._textureRoughness && MaterialFlags.SheenTextureEnabled) {\n MaterialHelper.PrepareDefinesForMergedUV(this._textureRoughness, defines, \"SHEEN_TEXTURE_ROUGHNESS\");\n }\n else {\n defines.SHEEN_TEXTURE_ROUGHNESS = false;\n }\n }\n }\n }\n else {\n defines.SHEEN = false;\n defines.SHEEN_TEXTURE = false;\n defines.SHEEN_TEXTURE_ROUGHNESS = false;\n defines.SHEEN_LINKWITHALBEDO = false;\n defines.SHEEN_ROUGHNESS = false;\n defines.SHEEN_ALBEDOSCALING = false;\n defines.SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE = false;\n defines.SHEEN_TEXTURE_ROUGHNESS_IDENTICAL = false;\n defines.SHEEN_GAMMATEXTURE = false;\n defines.SHEEN_TEXTUREDIRECTUV = 0;\n defines.SHEEN_TEXTURE_ROUGHNESSDIRECTUV = 0;\n }\n }\n bindForSubMesh(uniformBuffer, scene, engine, subMesh) {\n var _a, _b, _c, _d, _e, _f, _g, _h;\n if (!this._isEnabled) {\n return;\n }\n const defines = subMesh.materialDefines;\n const isFrozen = this._material.isFrozen;\n const identicalTextures = defines.SHEEN_TEXTURE_ROUGHNESS_IDENTICAL;\n if (!uniformBuffer.useUbo || !isFrozen || !uniformBuffer.isSync) {\n if (identicalTextures && MaterialFlags.SheenTextureEnabled) {\n uniformBuffer.updateFloat4(\"vSheenInfos\", this._texture.coordinatesIndex, this._texture.level, -1, -1);\n MaterialHelper.BindTextureMatrix(this._texture, uniformBuffer, \"sheen\");\n }\n else if ((this._texture || this._textureRoughness) && MaterialFlags.SheenTextureEnabled) {\n uniformBuffer.updateFloat4(\"vSheenInfos\", (_b = (_a = this._texture) === null || _a === void 0 ? void 0 : _a.coordinatesIndex) !== null && _b !== void 0 ? _b : 0, (_d = (_c = this._texture) === null || _c === void 0 ? void 0 : _c.level) !== null && _d !== void 0 ? _d : 0, (_f = (_e = this._textureRoughness) === null || _e === void 0 ? void 0 : _e.coordinatesIndex) !== null && _f !== void 0 ? _f : 0, (_h = (_g = this._textureRoughness) === null || _g === void 0 ? void 0 : _g.level) !== null && _h !== void 0 ? _h : 0);\n if (this._texture) {\n MaterialHelper.BindTextureMatrix(this._texture, uniformBuffer, \"sheen\");\n }\n if (this._textureRoughness && !identicalTextures && !defines.SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE) {\n MaterialHelper.BindTextureMatrix(this._textureRoughness, uniformBuffer, \"sheenRoughness\");\n }\n }\n // Sheen\n uniformBuffer.updateFloat4(\"vSheenColor\", this.color.r, this.color.g, this.color.b, this.intensity);\n if (this._roughness !== null) {\n uniformBuffer.updateFloat(\"vSheenRoughness\", this._roughness);\n }\n }\n // Textures\n if (scene.texturesEnabled) {\n if (this._texture && MaterialFlags.SheenTextureEnabled) {\n uniformBuffer.setTexture(\"sheenSampler\", this._texture);\n }\n if (this._textureRoughness && !identicalTextures && !defines.SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE && MaterialFlags.SheenTextureEnabled) {\n uniformBuffer.setTexture(\"sheenRoughnessSampler\", this._textureRoughness);\n }\n }\n }\n hasTexture(texture) {\n if (this._texture === texture) {\n return true;\n }\n if (this._textureRoughness === texture) {\n return true;\n }\n return false;\n }\n getActiveTextures(activeTextures) {\n if (this._texture) {\n activeTextures.push(this._texture);\n }\n if (this._textureRoughness) {\n activeTextures.push(this._textureRoughness);\n }\n }\n getAnimatables(animatables) {\n if (this._texture && this._texture.animations && this._texture.animations.length > 0) {\n animatables.push(this._texture);\n }\n if (this._textureRoughness && this._textureRoughness.animations && this._textureRoughness.animations.length > 0) {\n animatables.push(this._textureRoughness);\n }\n }\n dispose(forceDisposeTextures) {\n var _a, _b;\n if (forceDisposeTextures) {\n (_a = this._texture) === null || _a === void 0 ? void 0 : _a.dispose();\n (_b = this._textureRoughness) === null || _b === void 0 ? void 0 : _b.dispose();\n }\n }\n getClassName() {\n return \"PBRSheenConfiguration\";\n }\n addFallbacks(defines, fallbacks, currentRank) {\n if (defines.SHEEN) {\n fallbacks.addFallback(currentRank++, \"SHEEN\");\n }\n return currentRank;\n }\n getSamplers(samplers) {\n samplers.push(\"sheenSampler\", \"sheenRoughnessSampler\");\n }\n getUniforms() {\n return {\n ubo: [\n { name: \"vSheenColor\", size: 4, type: \"vec4\" },\n { name: \"vSheenRoughness\", size: 1, type: \"float\" },\n { name: \"vSheenInfos\", size: 4, type: \"vec4\" },\n { name: \"sheenMatrix\", size: 16, type: \"mat4\" },\n { name: \"sheenRoughnessMatrix\", size: 16, type: \"mat4\" },\n ],\n };\n }\n}\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRSheenConfiguration.prototype, \"isEnabled\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRSheenConfiguration.prototype, \"linkSheenWithAlbedo\", void 0);\n__decorate([\n serialize()\n], PBRSheenConfiguration.prototype, \"intensity\", void 0);\n__decorate([\n serializeAsColor3()\n], PBRSheenConfiguration.prototype, \"color\", void 0);\n__decorate([\n serializeAsTexture(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRSheenConfiguration.prototype, \"texture\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRSheenConfiguration.prototype, \"useRoughnessFromMainTexture\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRSheenConfiguration.prototype, \"roughness\", void 0);\n__decorate([\n serializeAsTexture(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRSheenConfiguration.prototype, \"textureRoughness\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRSheenConfiguration.prototype, \"albedoScaling\", void 0);\n//# sourceMappingURL=pbrSheenConfiguration.js.map","import { __decorate } from \"../../tslib.es6.js\";\nimport { serialize, serializeAsTexture, expandToProperty, serializeAsColor3 } from \"../../Misc/decorators.js\";\nimport { Color3 } from \"../../Maths/math.color.js\";\nimport { MaterialFlags } from \"../materialFlags.js\";\nimport { MaterialHelper } from \"../../Materials/materialHelper.js\";\nimport { Scalar } from \"../../Maths/math.scalar.js\";\nimport { TmpVectors } from \"../../Maths/math.vector.js\";\nimport { MaterialPluginBase } from \"../materialPluginBase.js\";\n\nimport { MaterialDefines } from \"../materialDefines.js\";\n/**\n * @internal\n */\nexport class MaterialSubSurfaceDefines extends MaterialDefines {\n constructor() {\n super(...arguments);\n this.SUBSURFACE = false;\n this.SS_REFRACTION = false;\n this.SS_REFRACTION_USE_INTENSITY_FROM_TEXTURE = false;\n this.SS_TRANSLUCENCY = false;\n this.SS_TRANSLUCENCY_USE_INTENSITY_FROM_TEXTURE = false;\n this.SS_SCATTERING = false;\n this.SS_THICKNESSANDMASK_TEXTURE = false;\n this.SS_THICKNESSANDMASK_TEXTUREDIRECTUV = 0;\n this.SS_HAS_THICKNESS = false;\n this.SS_REFRACTIONINTENSITY_TEXTURE = false;\n this.SS_REFRACTIONINTENSITY_TEXTUREDIRECTUV = 0;\n this.SS_TRANSLUCENCYINTENSITY_TEXTURE = false;\n this.SS_TRANSLUCENCYINTENSITY_TEXTUREDIRECTUV = 0;\n this.SS_REFRACTIONMAP_3D = false;\n this.SS_REFRACTIONMAP_OPPOSITEZ = false;\n this.SS_LODINREFRACTIONALPHA = false;\n this.SS_GAMMAREFRACTION = false;\n this.SS_RGBDREFRACTION = false;\n this.SS_LINEARSPECULARREFRACTION = false;\n this.SS_LINKREFRACTIONTOTRANSPARENCY = false;\n this.SS_ALBEDOFORREFRACTIONTINT = false;\n this.SS_ALBEDOFORTRANSLUCENCYTINT = false;\n this.SS_USE_LOCAL_REFRACTIONMAP_CUBIC = false;\n this.SS_USE_THICKNESS_AS_DEPTH = false;\n this.SS_MASK_FROM_THICKNESS_TEXTURE = false;\n this.SS_USE_GLTF_TEXTURES = false;\n }\n}\n/**\n * Plugin that implements the sub surface component of the PBR material\n */\nexport class PBRSubSurfaceConfiguration extends MaterialPluginBase {\n /**\n * Diffusion profile for subsurface scattering.\n * Useful for better scattering in the skins or foliages.\n */\n get scatteringDiffusionProfile() {\n if (!this._scene.subSurfaceConfiguration) {\n return null;\n }\n return this._scene.subSurfaceConfiguration.ssDiffusionProfileColors[this._scatteringDiffusionProfileIndex];\n }\n set scatteringDiffusionProfile(c) {\n if (!this._scene.enableSubSurfaceForPrePass()) {\n // Not supported\n return;\n }\n // addDiffusionProfile automatically checks for doubles\n if (c) {\n this._scatteringDiffusionProfileIndex = this._scene.subSurfaceConfiguration.addDiffusionProfile(c);\n }\n }\n /**\n * Index of refraction of the material's volume.\n * https://en.wikipedia.org/wiki/List_of_refractive_indices\n *\n * This ONLY impacts refraction. If not provided or given a non-valid value,\n * the volume will use the same IOR as the surface.\n */\n get volumeIndexOfRefraction() {\n if (this._volumeIndexOfRefraction >= 1.0) {\n return this._volumeIndexOfRefraction;\n }\n return this._indexOfRefraction;\n }\n set volumeIndexOfRefraction(value) {\n if (value >= 1.0) {\n this._volumeIndexOfRefraction = value;\n }\n else {\n this._volumeIndexOfRefraction = -1.0;\n }\n }\n /** @internal */\n _markAllSubMeshesAsTexturesDirty() {\n this._enable(this._isRefractionEnabled || this._isTranslucencyEnabled || this._isScatteringEnabled);\n this._internalMarkAllSubMeshesAsTexturesDirty();\n }\n /** @internal */\n _markScenePrePassDirty() {\n this._internalMarkAllSubMeshesAsTexturesDirty();\n this._internalMarkScenePrePassDirty();\n }\n constructor(material, addToPluginList = true) {\n super(material, \"PBRSubSurface\", 130, new MaterialSubSurfaceDefines(), addToPluginList);\n this._isRefractionEnabled = false;\n /**\n * Defines if the refraction is enabled in the material.\n */\n this.isRefractionEnabled = false;\n this._isTranslucencyEnabled = false;\n /**\n * Defines if the translucency is enabled in the material.\n */\n this.isTranslucencyEnabled = false;\n this._isScatteringEnabled = false;\n /**\n * Defines if the sub surface scattering is enabled in the material.\n */\n this.isScatteringEnabled = false;\n this._scatteringDiffusionProfileIndex = 0;\n /**\n * Defines the refraction intensity of the material.\n * The refraction when enabled replaces the Diffuse part of the material.\n * The intensity helps transitioning between diffuse and refraction.\n */\n this.refractionIntensity = 1;\n /**\n * Defines the translucency intensity of the material.\n * When translucency has been enabled, this defines how much of the \"translucency\"\n * is added to the diffuse part of the material.\n */\n this.translucencyIntensity = 1;\n /**\n * When enabled, transparent surfaces will be tinted with the albedo colour (independent of thickness)\n */\n this.useAlbedoToTintRefraction = false;\n /**\n * When enabled, translucent surfaces will be tinted with the albedo colour (independent of thickness)\n */\n this.useAlbedoToTintTranslucency = false;\n this._thicknessTexture = null;\n /**\n * Stores the average thickness of a mesh in a texture (The texture is holding the values linearly).\n * The red (or green if useGltfStyleTextures=true) channel of the texture should contain the thickness remapped between 0 and 1.\n * 0 would mean minimumThickness\n * 1 would mean maximumThickness\n * The other channels might be use as a mask to vary the different effects intensity.\n */\n this.thicknessTexture = null;\n this._refractionTexture = null;\n /**\n * Defines the texture to use for refraction.\n */\n this.refractionTexture = null;\n /** @internal */\n this._indexOfRefraction = 1.5;\n /**\n * Index of refraction of the material base layer.\n * https://en.wikipedia.org/wiki/List_of_refractive_indices\n *\n * This does not only impact refraction but also the Base F0 of Dielectric Materials.\n *\n * From dielectric fresnel rules: F0 = square((iorT - iorI) / (iorT + iorI))\n */\n this.indexOfRefraction = 1.5;\n this._volumeIndexOfRefraction = -1.0;\n this._invertRefractionY = false;\n /**\n * Controls if refraction needs to be inverted on Y. This could be useful for procedural texture.\n */\n this.invertRefractionY = false;\n /** @internal */\n this._linkRefractionWithTransparency = false;\n /**\n * This parameters will make the material used its opacity to control how much it is refracting against not.\n * Materials half opaque for instance using refraction could benefit from this control.\n */\n this.linkRefractionWithTransparency = false;\n /**\n * Defines the minimum thickness stored in the thickness map.\n * If no thickness map is defined, this value will be used to simulate thickness.\n */\n this.minimumThickness = 0;\n /**\n * Defines the maximum thickness stored in the thickness map.\n */\n this.maximumThickness = 1;\n /**\n * Defines that the thickness should be used as a measure of the depth volume.\n */\n this.useThicknessAsDepth = false;\n /**\n * Defines the volume tint of the material.\n * This is used for both translucency and scattering.\n */\n this.tintColor = Color3.White();\n /**\n * Defines the distance at which the tint color should be found in the media.\n * This is used for refraction only.\n */\n this.tintColorAtDistance = 1;\n /**\n * Defines how far each channel transmit through the media.\n * It is defined as a color to simplify it selection.\n */\n this.diffusionDistance = Color3.White();\n this._useMaskFromThicknessTexture = false;\n /**\n * Stores the intensity of the different subsurface effects in the thickness texture.\n * Note that if refractionIntensityTexture and/or translucencyIntensityTexture is provided it takes precedence over thicknessTexture + useMaskFromThicknessTexture\n * * the green (red if useGltfStyleTextures = true) channel is the refraction intensity.\n * * the blue channel is the translucency intensity.\n */\n this.useMaskFromThicknessTexture = false;\n this._refractionIntensityTexture = null;\n /**\n * Stores the intensity of the refraction. If provided, it takes precedence over thicknessTexture + useMaskFromThicknessTexture\n * * the green (red if useGltfStyleTextures = true) channel is the refraction intensity.\n */\n this.refractionIntensityTexture = null;\n this._translucencyIntensityTexture = null;\n /**\n * Stores the intensity of the translucency. If provided, it takes precedence over thicknessTexture + useMaskFromThicknessTexture\n * * the blue channel is the translucency intensity.\n */\n this.translucencyIntensityTexture = null;\n this._useGltfStyleTextures = false;\n /**\n * Use channels layout used by glTF:\n * * thicknessTexture: the green (instead of red) channel is the thickness\n * * thicknessTexture/refractionIntensityTexture: the red (instead of green) channel is the refraction intensity\n * * thicknessTexture/translucencyIntensityTexture: no change, use the blue channel for the translucency intensity\n */\n this.useGltfStyleTextures = false;\n this._scene = material.getScene();\n this.registerForExtraEvents = true;\n this._internalMarkAllSubMeshesAsTexturesDirty = material._dirtyCallbacks[1];\n this._internalMarkScenePrePassDirty = material._dirtyCallbacks[32];\n }\n isReadyForSubMesh(defines, scene) {\n if (!this._isRefractionEnabled && !this._isTranslucencyEnabled && !this._isScatteringEnabled) {\n return true;\n }\n if (defines._areTexturesDirty) {\n if (scene.texturesEnabled) {\n if (this._thicknessTexture && MaterialFlags.ThicknessTextureEnabled) {\n if (!this._thicknessTexture.isReadyOrNotBlocking()) {\n return false;\n }\n }\n const refractionTexture = this._getRefractionTexture(scene);\n if (refractionTexture && MaterialFlags.RefractionTextureEnabled) {\n if (!refractionTexture.isReadyOrNotBlocking()) {\n return false;\n }\n }\n }\n }\n return true;\n }\n prepareDefinesBeforeAttributes(defines, scene) {\n if (!this._isRefractionEnabled && !this._isTranslucencyEnabled && !this._isScatteringEnabled) {\n defines.SUBSURFACE = false;\n defines.SS_TRANSLUCENCY = false;\n defines.SS_SCATTERING = false;\n defines.SS_REFRACTION = false;\n defines.SS_REFRACTION_USE_INTENSITY_FROM_TEXTURE = false;\n defines.SS_TRANSLUCENCY_USE_INTENSITY_FROM_TEXTURE = false;\n defines.SS_THICKNESSANDMASK_TEXTURE = false;\n defines.SS_THICKNESSANDMASK_TEXTUREDIRECTUV = 0;\n defines.SS_HAS_THICKNESS = false;\n defines.SS_REFRACTIONINTENSITY_TEXTURE = false;\n defines.SS_REFRACTIONINTENSITY_TEXTUREDIRECTUV = 0;\n defines.SS_TRANSLUCENCYINTENSITY_TEXTURE = false;\n defines.SS_TRANSLUCENCYINTENSITY_TEXTUREDIRECTUV = 0;\n defines.SS_REFRACTIONMAP_3D = false;\n defines.SS_REFRACTIONMAP_OPPOSITEZ = false;\n defines.SS_LODINREFRACTIONALPHA = false;\n defines.SS_GAMMAREFRACTION = false;\n defines.SS_RGBDREFRACTION = false;\n defines.SS_LINEARSPECULARREFRACTION = false;\n defines.SS_LINKREFRACTIONTOTRANSPARENCY = false;\n defines.SS_ALBEDOFORREFRACTIONTINT = false;\n defines.SS_ALBEDOFORTRANSLUCENCYTINT = false;\n defines.SS_USE_LOCAL_REFRACTIONMAP_CUBIC = false;\n defines.SS_USE_THICKNESS_AS_DEPTH = false;\n defines.SS_MASK_FROM_THICKNESS_TEXTURE = false;\n defines.SS_USE_GLTF_TEXTURES = false;\n return;\n }\n if (defines._areTexturesDirty) {\n defines.SUBSURFACE = true;\n defines.SS_TRANSLUCENCY = this._isTranslucencyEnabled;\n defines.SS_TRANSLUCENCY_USE_INTENSITY_FROM_TEXTURE = false;\n defines.SS_SCATTERING = this._isScatteringEnabled;\n defines.SS_THICKNESSANDMASK_TEXTURE = false;\n defines.SS_REFRACTIONINTENSITY_TEXTURE = false;\n defines.SS_TRANSLUCENCYINTENSITY_TEXTURE = false;\n defines.SS_HAS_THICKNESS = false;\n defines.SS_MASK_FROM_THICKNESS_TEXTURE = false;\n defines.SS_USE_GLTF_TEXTURES = false;\n defines.SS_REFRACTION = false;\n defines.SS_REFRACTION_USE_INTENSITY_FROM_TEXTURE = false;\n defines.SS_REFRACTIONMAP_3D = false;\n defines.SS_GAMMAREFRACTION = false;\n defines.SS_RGBDREFRACTION = false;\n defines.SS_LINEARSPECULARREFRACTION = false;\n defines.SS_REFRACTIONMAP_OPPOSITEZ = false;\n defines.SS_LODINREFRACTIONALPHA = false;\n defines.SS_LINKREFRACTIONTOTRANSPARENCY = false;\n defines.SS_ALBEDOFORREFRACTIONTINT = false;\n defines.SS_ALBEDOFORTRANSLUCENCYTINT = false;\n defines.SS_USE_LOCAL_REFRACTIONMAP_CUBIC = false;\n defines.SS_USE_THICKNESS_AS_DEPTH = false;\n const refractionIntensityTextureIsThicknessTexture = !!this._thicknessTexture &&\n !!this._refractionIntensityTexture &&\n this._refractionIntensityTexture.checkTransformsAreIdentical(this._thicknessTexture) &&\n this._refractionIntensityTexture._texture === this._thicknessTexture._texture;\n const translucencyIntensityTextureIsThicknessTexture = !!this._thicknessTexture &&\n !!this._translucencyIntensityTexture &&\n this._translucencyIntensityTexture.checkTransformsAreIdentical(this._thicknessTexture) &&\n this._translucencyIntensityTexture._texture === this._thicknessTexture._texture;\n // if true, it means the refraction/translucency textures are the same than the thickness texture so there's no need to pass them to the shader, only thicknessTexture\n const useOnlyThicknessTexture = (refractionIntensityTextureIsThicknessTexture || !this._refractionIntensityTexture) &&\n (translucencyIntensityTextureIsThicknessTexture || !this._translucencyIntensityTexture);\n if (defines._areTexturesDirty) {\n if (scene.texturesEnabled) {\n if (this._thicknessTexture && MaterialFlags.ThicknessTextureEnabled) {\n MaterialHelper.PrepareDefinesForMergedUV(this._thicknessTexture, defines, \"SS_THICKNESSANDMASK_TEXTURE\");\n }\n if (this._refractionIntensityTexture && MaterialFlags.RefractionIntensityTextureEnabled && !useOnlyThicknessTexture) {\n MaterialHelper.PrepareDefinesForMergedUV(this._refractionIntensityTexture, defines, \"SS_REFRACTIONINTENSITY_TEXTURE\");\n }\n if (this._translucencyIntensityTexture && MaterialFlags.TranslucencyIntensityTextureEnabled && !useOnlyThicknessTexture) {\n MaterialHelper.PrepareDefinesForMergedUV(this._translucencyIntensityTexture, defines, \"SS_TRANSLUCENCYINTENSITY_TEXTURE\");\n }\n }\n }\n defines.SS_HAS_THICKNESS = this.maximumThickness - this.minimumThickness !== 0.0;\n defines.SS_MASK_FROM_THICKNESS_TEXTURE =\n (this._useMaskFromThicknessTexture || !!this._refractionIntensityTexture || !!this._translucencyIntensityTexture) && useOnlyThicknessTexture;\n defines.SS_USE_GLTF_TEXTURES = this._useGltfStyleTextures;\n defines.SS_REFRACTION_USE_INTENSITY_FROM_TEXTURE = (this._useMaskFromThicknessTexture || !!this._refractionIntensityTexture) && useOnlyThicknessTexture;\n defines.SS_TRANSLUCENCY_USE_INTENSITY_FROM_TEXTURE = (this._useMaskFromThicknessTexture || !!this._translucencyIntensityTexture) && useOnlyThicknessTexture;\n if (this._isRefractionEnabled) {\n if (scene.texturesEnabled) {\n const refractionTexture = this._getRefractionTexture(scene);\n if (refractionTexture && MaterialFlags.RefractionTextureEnabled) {\n defines.SS_REFRACTION = true;\n defines.SS_REFRACTIONMAP_3D = refractionTexture.isCube;\n defines.SS_GAMMAREFRACTION = refractionTexture.gammaSpace;\n defines.SS_RGBDREFRACTION = refractionTexture.isRGBD;\n defines.SS_LINEARSPECULARREFRACTION = refractionTexture.linearSpecularLOD;\n defines.SS_REFRACTIONMAP_OPPOSITEZ = this._scene.useRightHandedSystem && refractionTexture.isCube ? !refractionTexture.invertZ : refractionTexture.invertZ;\n defines.SS_LODINREFRACTIONALPHA = refractionTexture.lodLevelInAlpha;\n defines.SS_LINKREFRACTIONTOTRANSPARENCY = this._linkRefractionWithTransparency;\n defines.SS_ALBEDOFORREFRACTIONTINT = this.useAlbedoToTintRefraction;\n defines.SS_USE_LOCAL_REFRACTIONMAP_CUBIC = refractionTexture.isCube && refractionTexture.boundingBoxSize;\n defines.SS_USE_THICKNESS_AS_DEPTH = this.useThicknessAsDepth;\n }\n }\n }\n if (this._isTranslucencyEnabled) {\n defines.SS_ALBEDOFORTRANSLUCENCYTINT = this.useAlbedoToTintTranslucency;\n }\n }\n }\n /**\n * Binds the material data (this function is called even if mustRebind() returns false)\n * @param uniformBuffer defines the Uniform buffer to fill in.\n * @param scene defines the scene the material belongs to.\n * @param engine defines the engine the material belongs to.\n * @param subMesh the submesh to bind data for\n */\n hardBindForSubMesh(uniformBuffer, scene, engine, subMesh) {\n if (!this._isRefractionEnabled && !this._isTranslucencyEnabled && !this._isScatteringEnabled) {\n return;\n }\n subMesh.getRenderingMesh().getWorldMatrix().decompose(TmpVectors.Vector3[0]);\n const thicknessScale = Math.max(Math.abs(TmpVectors.Vector3[0].x), Math.abs(TmpVectors.Vector3[0].y), Math.abs(TmpVectors.Vector3[0].z));\n uniformBuffer.updateFloat2(\"vThicknessParam\", this.minimumThickness * thicknessScale, (this.maximumThickness - this.minimumThickness) * thicknessScale);\n }\n bindForSubMesh(uniformBuffer, scene, engine, subMesh) {\n if (!this._isRefractionEnabled && !this._isTranslucencyEnabled && !this._isScatteringEnabled) {\n return;\n }\n const defines = subMesh.materialDefines;\n const isFrozen = this._material.isFrozen;\n const realTimeFiltering = this._material.realTimeFiltering;\n const lodBasedMicrosurface = defines.LODBASEDMICROSFURACE;\n const refractionTexture = this._getRefractionTexture(scene);\n if (!uniformBuffer.useUbo || !isFrozen || !uniformBuffer.isSync) {\n if (this._thicknessTexture && MaterialFlags.ThicknessTextureEnabled) {\n uniformBuffer.updateFloat2(\"vThicknessInfos\", this._thicknessTexture.coordinatesIndex, this._thicknessTexture.level);\n MaterialHelper.BindTextureMatrix(this._thicknessTexture, uniformBuffer, \"thickness\");\n }\n if (this._refractionIntensityTexture && MaterialFlags.RefractionIntensityTextureEnabled && defines.SS_REFRACTIONINTENSITY_TEXTURE) {\n uniformBuffer.updateFloat2(\"vRefractionIntensityInfos\", this._refractionIntensityTexture.coordinatesIndex, this._refractionIntensityTexture.level);\n MaterialHelper.BindTextureMatrix(this._refractionIntensityTexture, uniformBuffer, \"refractionIntensity\");\n }\n if (this._translucencyIntensityTexture && MaterialFlags.TranslucencyIntensityTextureEnabled && defines.SS_TRANSLUCENCYINTENSITY_TEXTURE) {\n uniformBuffer.updateFloat2(\"vTranslucencyIntensityInfos\", this._translucencyIntensityTexture.coordinatesIndex, this._translucencyIntensityTexture.level);\n MaterialHelper.BindTextureMatrix(this._translucencyIntensityTexture, uniformBuffer, \"translucencyIntensity\");\n }\n if (refractionTexture && MaterialFlags.RefractionTextureEnabled) {\n uniformBuffer.updateMatrix(\"refractionMatrix\", refractionTexture.getRefractionTextureMatrix());\n let depth = 1.0;\n if (!refractionTexture.isCube) {\n if (refractionTexture.depth) {\n depth = refractionTexture.depth;\n }\n }\n const width = refractionTexture.getSize().width;\n const refractionIor = this.volumeIndexOfRefraction;\n uniformBuffer.updateFloat4(\"vRefractionInfos\", refractionTexture.level, 1 / refractionIor, depth, this._invertRefractionY ? -1 : 1);\n uniformBuffer.updateFloat4(\"vRefractionMicrosurfaceInfos\", width, refractionTexture.lodGenerationScale, refractionTexture.lodGenerationOffset, 1.0 / this.indexOfRefraction);\n if (realTimeFiltering) {\n uniformBuffer.updateFloat2(\"vRefractionFilteringInfo\", width, Scalar.Log2(width));\n }\n if (refractionTexture.boundingBoxSize) {\n const cubeTexture = refractionTexture;\n uniformBuffer.updateVector3(\"vRefractionPosition\", cubeTexture.boundingBoxPosition);\n uniformBuffer.updateVector3(\"vRefractionSize\", cubeTexture.boundingBoxSize);\n }\n }\n if (this._isScatteringEnabled) {\n uniformBuffer.updateFloat(\"scatteringDiffusionProfile\", this._scatteringDiffusionProfileIndex);\n }\n uniformBuffer.updateColor3(\"vDiffusionDistance\", this.diffusionDistance);\n uniformBuffer.updateFloat4(\"vTintColor\", this.tintColor.r, this.tintColor.g, this.tintColor.b, Math.max(0.00001, this.tintColorAtDistance));\n uniformBuffer.updateFloat3(\"vSubSurfaceIntensity\", this.refractionIntensity, this.translucencyIntensity, 0);\n }\n // Textures\n if (scene.texturesEnabled) {\n if (this._thicknessTexture && MaterialFlags.ThicknessTextureEnabled) {\n uniformBuffer.setTexture(\"thicknessSampler\", this._thicknessTexture);\n }\n if (this._refractionIntensityTexture && MaterialFlags.RefractionIntensityTextureEnabled && defines.SS_REFRACTIONINTENSITY_TEXTURE) {\n uniformBuffer.setTexture(\"refractionIntensitySampler\", this._refractionIntensityTexture);\n }\n if (this._translucencyIntensityTexture && MaterialFlags.TranslucencyIntensityTextureEnabled && defines.SS_TRANSLUCENCYINTENSITY_TEXTURE) {\n uniformBuffer.setTexture(\"translucencyIntensitySampler\", this._translucencyIntensityTexture);\n }\n if (refractionTexture && MaterialFlags.RefractionTextureEnabled) {\n if (lodBasedMicrosurface) {\n uniformBuffer.setTexture(\"refractionSampler\", refractionTexture);\n }\n else {\n uniformBuffer.setTexture(\"refractionSampler\", refractionTexture._lodTextureMid || refractionTexture);\n uniformBuffer.setTexture(\"refractionSamplerLow\", refractionTexture._lodTextureLow || refractionTexture);\n uniformBuffer.setTexture(\"refractionSamplerHigh\", refractionTexture._lodTextureHigh || refractionTexture);\n }\n }\n }\n }\n /**\n * Returns the texture used for refraction or null if none is used.\n * @param scene defines the scene the material belongs to.\n * @returns - Refraction texture if present. If no refraction texture and refraction\n * is linked with transparency, returns environment texture. Otherwise, returns null.\n */\n _getRefractionTexture(scene) {\n if (this._refractionTexture) {\n return this._refractionTexture;\n }\n if (this._isRefractionEnabled) {\n return scene.environmentTexture;\n }\n return null;\n }\n /**\n * Returns true if alpha blending should be disabled.\n */\n get disableAlphaBlending() {\n return this._isRefractionEnabled && this._linkRefractionWithTransparency;\n }\n /**\n * Fills the list of render target textures.\n * @param renderTargets the list of render targets to update\n */\n fillRenderTargetTextures(renderTargets) {\n if (MaterialFlags.RefractionTextureEnabled && this._refractionTexture && this._refractionTexture.isRenderTarget) {\n renderTargets.push(this._refractionTexture);\n }\n }\n hasTexture(texture) {\n if (this._thicknessTexture === texture) {\n return true;\n }\n if (this._refractionTexture === texture) {\n return true;\n }\n return false;\n }\n hasRenderTargetTextures() {\n if (MaterialFlags.RefractionTextureEnabled && this._refractionTexture && this._refractionTexture.isRenderTarget) {\n return true;\n }\n return false;\n }\n getActiveTextures(activeTextures) {\n if (this._thicknessTexture) {\n activeTextures.push(this._thicknessTexture);\n }\n if (this._refractionTexture) {\n activeTextures.push(this._refractionTexture);\n }\n }\n getAnimatables(animatables) {\n if (this._thicknessTexture && this._thicknessTexture.animations && this._thicknessTexture.animations.length > 0) {\n animatables.push(this._thicknessTexture);\n }\n if (this._refractionTexture && this._refractionTexture.animations && this._refractionTexture.animations.length > 0) {\n animatables.push(this._refractionTexture);\n }\n }\n dispose(forceDisposeTextures) {\n if (forceDisposeTextures) {\n if (this._thicknessTexture) {\n this._thicknessTexture.dispose();\n }\n if (this._refractionTexture) {\n this._refractionTexture.dispose();\n }\n }\n }\n getClassName() {\n return \"PBRSubSurfaceConfiguration\";\n }\n addFallbacks(defines, fallbacks, currentRank) {\n if (defines.SS_SCATTERING) {\n fallbacks.addFallback(currentRank++, \"SS_SCATTERING\");\n }\n if (defines.SS_TRANSLUCENCY) {\n fallbacks.addFallback(currentRank++, \"SS_TRANSLUCENCY\");\n }\n return currentRank;\n }\n getSamplers(samplers) {\n samplers.push(\"thicknessSampler\", \"refractionIntensitySampler\", \"translucencyIntensitySampler\", \"refractionSampler\", \"refractionSamplerLow\", \"refractionSamplerHigh\");\n }\n getUniforms() {\n return {\n ubo: [\n { name: \"vRefractionMicrosurfaceInfos\", size: 4, type: \"vec4\" },\n { name: \"vRefractionFilteringInfo\", size: 2, type: \"vec2\" },\n { name: \"vTranslucencyIntensityInfos\", size: 2, type: \"vec2\" },\n { name: \"vRefractionInfos\", size: 4, type: \"vec4\" },\n { name: \"refractionMatrix\", size: 16, type: \"mat4\" },\n { name: \"vThicknessInfos\", size: 2, type: \"vec2\" },\n { name: \"vRefractionIntensityInfos\", size: 2, type: \"vec2\" },\n { name: \"thicknessMatrix\", size: 16, type: \"mat4\" },\n { name: \"refractionIntensityMatrix\", size: 16, type: \"mat4\" },\n { name: \"translucencyIntensityMatrix\", size: 16, type: \"mat4\" },\n { name: \"vThicknessParam\", size: 2, type: \"vec2\" },\n { name: \"vDiffusionDistance\", size: 3, type: \"vec3\" },\n { name: \"vTintColor\", size: 4, type: \"vec4\" },\n { name: \"vSubSurfaceIntensity\", size: 3, type: \"vec3\" },\n { name: \"vRefractionPosition\", size: 3, type: \"vec3\" },\n { name: \"vRefractionSize\", size: 3, type: \"vec3\" },\n { name: \"scatteringDiffusionProfile\", size: 1, type: \"float\" },\n ],\n };\n }\n}\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRSubSurfaceConfiguration.prototype, \"isRefractionEnabled\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRSubSurfaceConfiguration.prototype, \"isTranslucencyEnabled\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markScenePrePassDirty\")\n], PBRSubSurfaceConfiguration.prototype, \"isScatteringEnabled\", void 0);\n__decorate([\n serialize()\n], PBRSubSurfaceConfiguration.prototype, \"_scatteringDiffusionProfileIndex\", void 0);\n__decorate([\n serialize()\n], PBRSubSurfaceConfiguration.prototype, \"refractionIntensity\", void 0);\n__decorate([\n serialize()\n], PBRSubSurfaceConfiguration.prototype, \"translucencyIntensity\", void 0);\n__decorate([\n serialize()\n], PBRSubSurfaceConfiguration.prototype, \"useAlbedoToTintRefraction\", void 0);\n__decorate([\n serialize()\n], PBRSubSurfaceConfiguration.prototype, \"useAlbedoToTintTranslucency\", void 0);\n__decorate([\n serializeAsTexture(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRSubSurfaceConfiguration.prototype, \"thicknessTexture\", void 0);\n__decorate([\n serializeAsTexture(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRSubSurfaceConfiguration.prototype, \"refractionTexture\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRSubSurfaceConfiguration.prototype, \"indexOfRefraction\", void 0);\n__decorate([\n serialize()\n], PBRSubSurfaceConfiguration.prototype, \"_volumeIndexOfRefraction\", void 0);\n__decorate([\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRSubSurfaceConfiguration.prototype, \"volumeIndexOfRefraction\", null);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRSubSurfaceConfiguration.prototype, \"invertRefractionY\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRSubSurfaceConfiguration.prototype, \"linkRefractionWithTransparency\", void 0);\n__decorate([\n serialize()\n], PBRSubSurfaceConfiguration.prototype, \"minimumThickness\", void 0);\n__decorate([\n serialize()\n], PBRSubSurfaceConfiguration.prototype, \"maximumThickness\", void 0);\n__decorate([\n serialize()\n], PBRSubSurfaceConfiguration.prototype, \"useThicknessAsDepth\", void 0);\n__decorate([\n serializeAsColor3()\n], PBRSubSurfaceConfiguration.prototype, \"tintColor\", void 0);\n__decorate([\n serialize()\n], PBRSubSurfaceConfiguration.prototype, \"tintColorAtDistance\", void 0);\n__decorate([\n serializeAsColor3()\n], PBRSubSurfaceConfiguration.prototype, \"diffusionDistance\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRSubSurfaceConfiguration.prototype, \"useMaskFromThicknessTexture\", void 0);\n__decorate([\n serializeAsTexture(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRSubSurfaceConfiguration.prototype, \"refractionIntensityTexture\", void 0);\n__decorate([\n serializeAsTexture(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRSubSurfaceConfiguration.prototype, \"translucencyIntensityTexture\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRSubSurfaceConfiguration.prototype, \"useGltfStyleTextures\", void 0);\n//# sourceMappingURL=pbrSubSurfaceConfiguration.js.map","import { __decorate } from \"../../tslib.es6.js\";\n/* eslint-disable @typescript-eslint/naming-convention */\nimport { serialize, serializeAsImageProcessingConfiguration, expandToProperty } from \"../../Misc/decorators.js\";\nimport { Logger } from \"../../Misc/logger.js\";\nimport { SmartArray } from \"../../Misc/smartArray.js\";\nimport { GetEnvironmentBRDFTexture } from \"../../Misc/brdfTextureTools.js\";\nimport { Scene } from \"../../scene.js\";\nimport { Vector4 } from \"../../Maths/math.vector.js\";\nimport { VertexBuffer } from \"../../Buffers/buffer.js\";\nimport { PBRBRDFConfiguration } from \"./pbrBRDFConfiguration.js\";\nimport { PrePassConfiguration } from \"../prePassConfiguration.js\";\nimport { Color3, TmpColors } from \"../../Maths/math.color.js\";\nimport { Scalar } from \"../../Maths/math.scalar.js\";\nimport { ImageProcessingConfiguration } from \"../../Materials/imageProcessingConfiguration.js\";\nimport { Material } from \"../../Materials/material.js\";\nimport { MaterialPluginEvent } from \"../materialPluginEvent.js\";\nimport { MaterialDefines } from \"../../Materials/materialDefines.js\";\nimport { PushMaterial } from \"../../Materials/pushMaterial.js\";\nimport { MaterialHelper } from \"../../Materials/materialHelper.js\";\nimport { Texture } from \"../../Materials/Textures/texture.js\";\nimport { MaterialFlags } from \"../materialFlags.js\";\n\nimport \"../../Materials/Textures/baseTexture.polynomial.js\";\nimport \"../../Shaders/pbr.fragment.js\";\nimport \"../../Shaders/pbr.vertex.js\";\nimport { EffectFallbacks } from \"../effectFallbacks.js\";\nimport { PBRClearCoatConfiguration } from \"./pbrClearCoatConfiguration.js\";\nimport { PBRIridescenceConfiguration } from \"./pbrIridescenceConfiguration.js\";\nimport { PBRAnisotropicConfiguration } from \"./pbrAnisotropicConfiguration.js\";\nimport { PBRSheenConfiguration } from \"./pbrSheenConfiguration.js\";\nimport { PBRSubSurfaceConfiguration } from \"./pbrSubSurfaceConfiguration.js\";\nimport { DetailMapConfiguration } from \"../material.detailMapConfiguration.js\";\nimport { addClipPlaneUniforms, bindClipPlane } from \"../clipPlaneMaterialHelper.js\";\nconst onCreatedEffectParameters = { effect: null, subMesh: null };\n/**\n * Manages the defines for the PBR Material.\n * @internal\n */\nexport class PBRMaterialDefines extends MaterialDefines {\n /**\n * Initializes the PBR Material defines.\n * @param externalProperties The external properties\n */\n constructor(externalProperties) {\n super(externalProperties);\n this.PBR = true;\n this.NUM_SAMPLES = \"0\";\n this.REALTIME_FILTERING = false;\n this.MAINUV1 = false;\n this.MAINUV2 = false;\n this.MAINUV3 = false;\n this.MAINUV4 = false;\n this.MAINUV5 = false;\n this.MAINUV6 = false;\n this.UV1 = false;\n this.UV2 = false;\n this.UV3 = false;\n this.UV4 = false;\n this.UV5 = false;\n this.UV6 = false;\n this.ALBEDO = false;\n this.GAMMAALBEDO = false;\n this.ALBEDODIRECTUV = 0;\n this.VERTEXCOLOR = false;\n this.BAKED_VERTEX_ANIMATION_TEXTURE = false;\n this.AMBIENT = false;\n this.AMBIENTDIRECTUV = 0;\n this.AMBIENTINGRAYSCALE = false;\n this.OPACITY = false;\n this.VERTEXALPHA = false;\n this.OPACITYDIRECTUV = 0;\n this.OPACITYRGB = false;\n this.ALPHATEST = false;\n this.DEPTHPREPASS = false;\n this.ALPHABLEND = false;\n this.ALPHAFROMALBEDO = false;\n this.ALPHATESTVALUE = \"0.5\";\n this.SPECULAROVERALPHA = false;\n this.RADIANCEOVERALPHA = false;\n this.ALPHAFRESNEL = false;\n this.LINEARALPHAFRESNEL = false;\n this.PREMULTIPLYALPHA = false;\n this.EMISSIVE = false;\n this.EMISSIVEDIRECTUV = 0;\n this.GAMMAEMISSIVE = false;\n this.REFLECTIVITY = false;\n this.REFLECTIVITY_GAMMA = false;\n this.REFLECTIVITYDIRECTUV = 0;\n this.SPECULARTERM = false;\n this.MICROSURFACEFROMREFLECTIVITYMAP = false;\n this.MICROSURFACEAUTOMATIC = false;\n this.LODBASEDMICROSFURACE = false;\n this.MICROSURFACEMAP = false;\n this.MICROSURFACEMAPDIRECTUV = 0;\n this.METALLICWORKFLOW = false;\n this.ROUGHNESSSTOREINMETALMAPALPHA = false;\n this.ROUGHNESSSTOREINMETALMAPGREEN = false;\n this.METALLNESSSTOREINMETALMAPBLUE = false;\n this.AOSTOREINMETALMAPRED = false;\n this.METALLIC_REFLECTANCE = false;\n this.METALLIC_REFLECTANCE_GAMMA = false;\n this.METALLIC_REFLECTANCEDIRECTUV = 0;\n this.METALLIC_REFLECTANCE_USE_ALPHA_ONLY = false;\n this.REFLECTANCE = false;\n this.REFLECTANCE_GAMMA = false;\n this.REFLECTANCEDIRECTUV = 0;\n this.ENVIRONMENTBRDF = false;\n this.ENVIRONMENTBRDF_RGBD = false;\n this.NORMAL = false;\n this.TANGENT = false;\n this.BUMP = false;\n this.BUMPDIRECTUV = 0;\n this.OBJECTSPACE_NORMALMAP = false;\n this.PARALLAX = false;\n this.PARALLAX_RHS = false;\n this.PARALLAXOCCLUSION = false;\n this.NORMALXYSCALE = true;\n this.LIGHTMAP = false;\n this.LIGHTMAPDIRECTUV = 0;\n this.USELIGHTMAPASSHADOWMAP = false;\n this.GAMMALIGHTMAP = false;\n this.RGBDLIGHTMAP = false;\n this.REFLECTION = false;\n this.REFLECTIONMAP_3D = false;\n this.REFLECTIONMAP_SPHERICAL = false;\n this.REFLECTIONMAP_PLANAR = false;\n this.REFLECTIONMAP_CUBIC = false;\n this.USE_LOCAL_REFLECTIONMAP_CUBIC = false;\n this.REFLECTIONMAP_PROJECTION = false;\n this.REFLECTIONMAP_SKYBOX = false;\n this.REFLECTIONMAP_EXPLICIT = false;\n this.REFLECTIONMAP_EQUIRECTANGULAR = false;\n this.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = false;\n this.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = false;\n this.INVERTCUBICMAP = false;\n this.USESPHERICALFROMREFLECTIONMAP = false;\n this.USEIRRADIANCEMAP = false;\n this.USESPHERICALINVERTEX = false;\n this.REFLECTIONMAP_OPPOSITEZ = false;\n this.LODINREFLECTIONALPHA = false;\n this.GAMMAREFLECTION = false;\n this.RGBDREFLECTION = false;\n this.LINEARSPECULARREFLECTION = false;\n this.RADIANCEOCCLUSION = false;\n this.HORIZONOCCLUSION = false;\n this.INSTANCES = false;\n this.THIN_INSTANCES = false;\n this.INSTANCESCOLOR = false;\n this.PREPASS = false;\n this.PREPASS_IRRADIANCE = false;\n this.PREPASS_IRRADIANCE_INDEX = -1;\n this.PREPASS_ALBEDO_SQRT = false;\n this.PREPASS_ALBEDO_SQRT_INDEX = -1;\n this.PREPASS_DEPTH = false;\n this.PREPASS_DEPTH_INDEX = -1;\n this.PREPASS_NORMAL = false;\n this.PREPASS_NORMAL_INDEX = -1;\n this.PREPASS_NORMAL_WORLDSPACE = false;\n this.PREPASS_POSITION = false;\n this.PREPASS_POSITION_INDEX = -1;\n this.PREPASS_VELOCITY = false;\n this.PREPASS_VELOCITY_INDEX = -1;\n this.PREPASS_REFLECTIVITY = false;\n this.PREPASS_REFLECTIVITY_INDEX = -1;\n this.SCENE_MRT_COUNT = 0;\n this.NUM_BONE_INFLUENCERS = 0;\n this.BonesPerMesh = 0;\n this.BONETEXTURE = false;\n this.BONES_VELOCITY_ENABLED = false;\n this.NONUNIFORMSCALING = false;\n this.MORPHTARGETS = false;\n this.MORPHTARGETS_NORMAL = false;\n this.MORPHTARGETS_TANGENT = false;\n this.MORPHTARGETS_UV = false;\n this.NUM_MORPH_INFLUENCERS = 0;\n this.MORPHTARGETS_TEXTURE = false;\n this.IMAGEPROCESSING = false;\n this.VIGNETTE = false;\n this.VIGNETTEBLENDMODEMULTIPLY = false;\n this.VIGNETTEBLENDMODEOPAQUE = false;\n this.TONEMAPPING = false;\n this.TONEMAPPING_ACES = false;\n this.CONTRAST = false;\n this.COLORCURVES = false;\n this.COLORGRADING = false;\n this.COLORGRADING3D = false;\n this.SAMPLER3DGREENDEPTH = false;\n this.SAMPLER3DBGRMAP = false;\n this.DITHER = false;\n this.IMAGEPROCESSINGPOSTPROCESS = false;\n this.SKIPFINALCOLORCLAMP = false;\n this.EXPOSURE = false;\n this.MULTIVIEW = false;\n this.ORDER_INDEPENDENT_TRANSPARENCY = false;\n this.ORDER_INDEPENDENT_TRANSPARENCY_16BITS = false;\n this.USEPHYSICALLIGHTFALLOFF = false;\n this.USEGLTFLIGHTFALLOFF = false;\n this.TWOSIDEDLIGHTING = false;\n this.SHADOWFLOAT = false;\n this.CLIPPLANE = false;\n this.CLIPPLANE2 = false;\n this.CLIPPLANE3 = false;\n this.CLIPPLANE4 = false;\n this.CLIPPLANE5 = false;\n this.CLIPPLANE6 = false;\n this.POINTSIZE = false;\n this.FOG = false;\n this.LOGARITHMICDEPTH = false;\n this.CAMERA_ORTHOGRAPHIC = false;\n this.CAMERA_PERSPECTIVE = false;\n this.FORCENORMALFORWARD = false;\n this.SPECULARAA = false;\n this.UNLIT = false;\n this.DECAL_AFTER_DETAIL = false;\n this.DEBUGMODE = 0;\n this.rebuild();\n }\n /**\n * Resets the PBR Material defines.\n */\n reset() {\n super.reset();\n this.ALPHATESTVALUE = \"0.5\";\n this.PBR = true;\n this.NORMALXYSCALE = true;\n }\n}\n/**\n * The Physically based material base class of BJS.\n *\n * This offers the main features of a standard PBR material.\n * For more information, please refer to the documentation :\n * https://doc.babylonjs.com/features/featuresDeepDive/materials/using/introToPBR\n */\nexport class PBRBaseMaterial extends PushMaterial {\n /**\n * Enables realtime filtering on the texture.\n */\n get realTimeFiltering() {\n return this._realTimeFiltering;\n }\n set realTimeFiltering(b) {\n this._realTimeFiltering = b;\n this.markAsDirty(1);\n }\n /**\n * Quality switch for realtime filtering\n */\n get realTimeFilteringQuality() {\n return this._realTimeFilteringQuality;\n }\n set realTimeFilteringQuality(n) {\n this._realTimeFilteringQuality = n;\n this.markAsDirty(1);\n }\n /**\n * Can this material render to several textures at once\n */\n get canRenderToMRT() {\n return true;\n }\n /**\n * Attaches a new image processing configuration to the PBR Material.\n * @param configuration\n */\n _attachImageProcessingConfiguration(configuration) {\n if (configuration === this._imageProcessingConfiguration) {\n return;\n }\n // Detaches observer.\n if (this._imageProcessingConfiguration && this._imageProcessingObserver) {\n this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver);\n }\n // Pick the scene configuration if needed.\n if (!configuration) {\n this._imageProcessingConfiguration = this.getScene().imageProcessingConfiguration;\n }\n else {\n this._imageProcessingConfiguration = configuration;\n }\n // Attaches observer.\n if (this._imageProcessingConfiguration) {\n this._imageProcessingObserver = this._imageProcessingConfiguration.onUpdateParameters.add(() => {\n this._markAllSubMeshesAsImageProcessingDirty();\n });\n }\n }\n /**\n * Instantiates a new PBRMaterial instance.\n *\n * @param name The material name\n * @param scene The scene the material will be use in.\n */\n constructor(name, scene) {\n super(name, scene);\n /**\n * Intensity of the direct lights e.g. the four lights available in your scene.\n * This impacts both the direct diffuse and specular highlights.\n * @internal\n */\n this._directIntensity = 1.0;\n /**\n * Intensity of the emissive part of the material.\n * This helps controlling the emissive effect without modifying the emissive color.\n * @internal\n */\n this._emissiveIntensity = 1.0;\n /**\n * Intensity of the environment e.g. how much the environment will light the object\n * either through harmonics for rough material or through the reflection for shiny ones.\n * @internal\n */\n this._environmentIntensity = 1.0;\n /**\n * This is a special control allowing the reduction of the specular highlights coming from the\n * four lights of the scene. Those highlights may not be needed in full environment lighting.\n * @internal\n */\n this._specularIntensity = 1.0;\n /**\n * This stores the direct, emissive, environment, and specular light intensities into a Vector4.\n */\n this._lightingInfos = new Vector4(this._directIntensity, this._emissiveIntensity, this._environmentIntensity, this._specularIntensity);\n /**\n * Debug Control allowing disabling the bump map on this material.\n * @internal\n */\n this._disableBumpMap = false;\n /**\n * AKA Diffuse Texture in standard nomenclature.\n * @internal\n */\n this._albedoTexture = null;\n /**\n * AKA Occlusion Texture in other nomenclature.\n * @internal\n */\n this._ambientTexture = null;\n /**\n * AKA Occlusion Texture Intensity in other nomenclature.\n * @internal\n */\n this._ambientTextureStrength = 1.0;\n /**\n * Defines how much the AO map is occluding the analytical lights (point spot...).\n * 1 means it completely occludes it\n * 0 mean it has no impact\n * @internal\n */\n this._ambientTextureImpactOnAnalyticalLights = PBRBaseMaterial.DEFAULT_AO_ON_ANALYTICAL_LIGHTS;\n /**\n * Stores the alpha values in a texture.\n * @internal\n */\n this._opacityTexture = null;\n /**\n * Stores the reflection values in a texture.\n * @internal\n */\n this._reflectionTexture = null;\n /**\n * Stores the emissive values in a texture.\n * @internal\n */\n this._emissiveTexture = null;\n /**\n * AKA Specular texture in other nomenclature.\n * @internal\n */\n this._reflectivityTexture = null;\n /**\n * Used to switch from specular/glossiness to metallic/roughness workflow.\n * @internal\n */\n this._metallicTexture = null;\n /**\n * Specifies the metallic scalar of the metallic/roughness workflow.\n * Can also be used to scale the metalness values of the metallic texture.\n * @internal\n */\n this._metallic = null;\n /**\n * Specifies the roughness scalar of the metallic/roughness workflow.\n * Can also be used to scale the roughness values of the metallic texture.\n * @internal\n */\n this._roughness = null;\n /**\n * In metallic workflow, specifies an F0 factor to help configuring the material F0.\n * By default the indexOfrefraction is used to compute F0;\n *\n * This is used as a factor against the default reflectance at normal incidence to tweak it.\n *\n * F0 = defaultF0 * metallicF0Factor * metallicReflectanceColor;\n * F90 = metallicReflectanceColor;\n * @internal\n */\n this._metallicF0Factor = 1;\n /**\n * In metallic workflow, specifies an F0 color.\n * By default the F90 is always 1;\n *\n * Please note that this factor is also used as a factor against the default reflectance at normal incidence.\n *\n * F0 = defaultF0_from_IOR * metallicF0Factor * metallicReflectanceColor\n * F90 = metallicF0Factor;\n * @internal\n */\n this._metallicReflectanceColor = Color3.White();\n /**\n * Specifies that only the A channel from _metallicReflectanceTexture should be used.\n * If false, both RGB and A channels will be used\n * @internal\n */\n this._useOnlyMetallicFromMetallicReflectanceTexture = false;\n /**\n * Defines to store metallicReflectanceColor in RGB and metallicF0Factor in A\n * This is multiply against the scalar values defined in the material.\n * @internal\n */\n this._metallicReflectanceTexture = null;\n /**\n * Defines to store reflectanceColor in RGB\n * This is multiplied against the scalar values defined in the material.\n * If both _reflectanceTexture and _metallicReflectanceTexture textures are provided and _useOnlyMetallicFromMetallicReflectanceTexture\n * is false, _metallicReflectanceTexture takes precedence and _reflectanceTexture is not used\n * @internal\n */\n this._reflectanceTexture = null;\n /**\n * Used to enable roughness/glossiness fetch from a separate channel depending on the current mode.\n * Gray Scale represents roughness in metallic mode and glossiness in specular mode.\n * @internal\n */\n this._microSurfaceTexture = null;\n /**\n * Stores surface normal data used to displace a mesh in a texture.\n * @internal\n */\n this._bumpTexture = null;\n /**\n * Stores the pre-calculated light information of a mesh in a texture.\n * @internal\n */\n this._lightmapTexture = null;\n /**\n * The color of a material in ambient lighting.\n * @internal\n */\n this._ambientColor = new Color3(0, 0, 0);\n /**\n * AKA Diffuse Color in other nomenclature.\n * @internal\n */\n this._albedoColor = new Color3(1, 1, 1);\n /**\n * AKA Specular Color in other nomenclature.\n * @internal\n */\n this._reflectivityColor = new Color3(1, 1, 1);\n /**\n * The color applied when light is reflected from a material.\n * @internal\n */\n this._reflectionColor = new Color3(1, 1, 1);\n /**\n * The color applied when light is emitted from a material.\n * @internal\n */\n this._emissiveColor = new Color3(0, 0, 0);\n /**\n * AKA Glossiness in other nomenclature.\n * @internal\n */\n this._microSurface = 0.9;\n /**\n * Specifies that the material will use the light map as a show map.\n * @internal\n */\n this._useLightmapAsShadowmap = false;\n /**\n * This parameters will enable/disable Horizon occlusion to prevent normal maps to look shiny when the normal\n * makes the reflect vector face the model (under horizon).\n * @internal\n */\n this._useHorizonOcclusion = true;\n /**\n * This parameters will enable/disable radiance occlusion by preventing the radiance to lit\n * too much the area relying on ambient texture to define their ambient occlusion.\n * @internal\n */\n this._useRadianceOcclusion = true;\n /**\n * Specifies that the alpha is coming form the albedo channel alpha channel for alpha blending.\n * @internal\n */\n this._useAlphaFromAlbedoTexture = false;\n /**\n * Specifies that the material will keeps the specular highlights over a transparent surface (only the most luminous ones).\n * A car glass is a good example of that. When sun reflects on it you can not see what is behind.\n * @internal\n */\n this._useSpecularOverAlpha = true;\n /**\n * Specifies if the reflectivity texture contains the glossiness information in its alpha channel.\n * @internal\n */\n this._useMicroSurfaceFromReflectivityMapAlpha = false;\n /**\n * Specifies if the metallic texture contains the roughness information in its alpha channel.\n * @internal\n */\n this._useRoughnessFromMetallicTextureAlpha = true;\n /**\n * Specifies if the metallic texture contains the roughness information in its green channel.\n * @internal\n */\n this._useRoughnessFromMetallicTextureGreen = false;\n /**\n * Specifies if the metallic texture contains the metallness information in its blue channel.\n * @internal\n */\n this._useMetallnessFromMetallicTextureBlue = false;\n /**\n * Specifies if the metallic texture contains the ambient occlusion information in its red channel.\n * @internal\n */\n this._useAmbientOcclusionFromMetallicTextureRed = false;\n /**\n * Specifies if the ambient texture contains the ambient occlusion information in its red channel only.\n * @internal\n */\n this._useAmbientInGrayScale = false;\n /**\n * In case the reflectivity map does not contain the microsurface information in its alpha channel,\n * The material will try to infer what glossiness each pixel should be.\n * @internal\n */\n this._useAutoMicroSurfaceFromReflectivityMap = false;\n /**\n * Defines the falloff type used in this material.\n * It by default is Physical.\n * @internal\n */\n this._lightFalloff = PBRBaseMaterial.LIGHTFALLOFF_PHYSICAL;\n /**\n * Specifies that the material will keeps the reflection highlights over a transparent surface (only the most luminous ones).\n * A car glass is a good example of that. When the street lights reflects on it you can not see what is behind.\n * @internal\n */\n this._useRadianceOverAlpha = true;\n /**\n * Allows using an object space normal map (instead of tangent space).\n * @internal\n */\n this._useObjectSpaceNormalMap = false;\n /**\n * Allows using the bump map in parallax mode.\n * @internal\n */\n this._useParallax = false;\n /**\n * Allows using the bump map in parallax occlusion mode.\n * @internal\n */\n this._useParallaxOcclusion = false;\n /**\n * Controls the scale bias of the parallax mode.\n * @internal\n */\n this._parallaxScaleBias = 0.05;\n /**\n * If sets to true, disables all the lights affecting the material.\n * @internal\n */\n this._disableLighting = false;\n /**\n * Number of Simultaneous lights allowed on the material.\n * @internal\n */\n this._maxSimultaneousLights = 4;\n /**\n * If sets to true, x component of normal map value will be inverted (x = 1.0 - x).\n * @internal\n */\n this._invertNormalMapX = false;\n /**\n * If sets to true, y component of normal map value will be inverted (y = 1.0 - y).\n * @internal\n */\n this._invertNormalMapY = false;\n /**\n * If sets to true and backfaceCulling is false, normals will be flipped on the backside.\n * @internal\n */\n this._twoSidedLighting = false;\n /**\n * Defines the alpha limits in alpha test mode.\n * @internal\n */\n this._alphaCutOff = 0.4;\n /**\n * Enforces alpha test in opaque or blend mode in order to improve the performances of some situations.\n * @internal\n */\n this._forceAlphaTest = false;\n /**\n * A fresnel is applied to the alpha of the model to ensure grazing angles edges are not alpha tested.\n * And/Or occlude the blended part. (alpha is converted to gamma to compute the fresnel)\n * @internal\n */\n this._useAlphaFresnel = false;\n /**\n * A fresnel is applied to the alpha of the model to ensure grazing angles edges are not alpha tested.\n * And/Or occlude the blended part. (alpha stays linear to compute the fresnel)\n * @internal\n */\n this._useLinearAlphaFresnel = false;\n /**\n * Specifies the environment BRDF texture used to compute the scale and offset roughness values\n * from cos theta and roughness:\n * http://blog.selfshadow.com/publications/s2013-shading-course/karis/s2013_pbs_epic_notes_v2.pdf\n * @internal\n */\n this._environmentBRDFTexture = null;\n /**\n * Force the shader to compute irradiance in the fragment shader in order to take bump in account.\n * @internal\n */\n this._forceIrradianceInFragment = false;\n this._realTimeFiltering = false;\n this._realTimeFilteringQuality = 8;\n /**\n * Force normal to face away from face.\n * @internal\n */\n this._forceNormalForward = false;\n /**\n * Enables specular anti aliasing in the PBR shader.\n * It will both interacts on the Geometry for analytical and IBL lighting.\n * It also prefilter the roughness map based on the bump values.\n * @internal\n */\n this._enableSpecularAntiAliasing = false;\n /**\n * Keep track of the image processing observer to allow dispose and replace.\n */\n this._imageProcessingObserver = null;\n /**\n * Stores the available render targets.\n */\n this._renderTargets = new SmartArray(16);\n /**\n * Sets the global ambient color for the material used in lighting calculations.\n */\n this._globalAmbientColor = new Color3(0, 0, 0);\n /**\n * Enables the use of logarithmic depth buffers, which is good for wide depth buffers.\n */\n this._useLogarithmicDepth = false;\n /**\n * If set to true, no lighting calculations will be applied.\n */\n this._unlit = false;\n /**\n * If sets to true, the decal map will be applied after the detail map. Else, it is applied before (default: false)\n */\n this._applyDecalMapAfterDetailMap = false;\n this._debugMode = 0;\n /**\n * @internal\n * This is reserved for the inspector.\n * Defines the material debug mode.\n * It helps seeing only some components of the material while troubleshooting.\n */\n this.debugMode = 0;\n /**\n * @internal\n * This is reserved for the inspector.\n * Specify from where on screen the debug mode should start.\n * The value goes from -1 (full screen) to 1 (not visible)\n * It helps with side by side comparison against the final render\n * This defaults to -1\n */\n this.debugLimit = -1;\n /**\n * @internal\n * This is reserved for the inspector.\n * As the default viewing range might not be enough (if the ambient is really small for instance)\n * You can use the factor to better multiply the final value.\n */\n this.debugFactor = 1;\n this._cacheHasRenderTargetTextures = false;\n this.brdf = new PBRBRDFConfiguration(this);\n this.clearCoat = new PBRClearCoatConfiguration(this);\n this.iridescence = new PBRIridescenceConfiguration(this);\n this.anisotropy = new PBRAnisotropicConfiguration(this);\n this.sheen = new PBRSheenConfiguration(this);\n this.subSurface = new PBRSubSurfaceConfiguration(this);\n this.detailMap = new DetailMapConfiguration(this);\n // Setup the default processing configuration to the scene.\n this._attachImageProcessingConfiguration(null);\n this.getRenderTargetTextures = () => {\n this._renderTargets.reset();\n if (MaterialFlags.ReflectionTextureEnabled && this._reflectionTexture && this._reflectionTexture.isRenderTarget) {\n this._renderTargets.push(this._reflectionTexture);\n }\n this._eventInfo.renderTargets = this._renderTargets;\n this._callbackPluginEventFillRenderTargetTextures(this._eventInfo);\n return this._renderTargets;\n };\n this._environmentBRDFTexture = GetEnvironmentBRDFTexture(this.getScene());\n this.prePassConfiguration = new PrePassConfiguration();\n }\n /**\n * Gets a boolean indicating that current material needs to register RTT\n */\n get hasRenderTargetTextures() {\n if (MaterialFlags.ReflectionTextureEnabled && this._reflectionTexture && this._reflectionTexture.isRenderTarget) {\n return true;\n }\n return this._cacheHasRenderTargetTextures;\n }\n /**\n * Can this material render to prepass\n */\n get isPrePassCapable() {\n return !this.disableDepthWrite;\n }\n /**\n * Gets the name of the material class.\n */\n getClassName() {\n return \"PBRBaseMaterial\";\n }\n /**\n * Enabled the use of logarithmic depth buffers, which is good for wide depth buffers.\n */\n get useLogarithmicDepth() {\n return this._useLogarithmicDepth;\n }\n /**\n * Enabled the use of logarithmic depth buffers, which is good for wide depth buffers.\n */\n set useLogarithmicDepth(value) {\n this._useLogarithmicDepth = value && this.getScene().getEngine().getCaps().fragmentDepthSupported;\n }\n /**\n * Returns true if alpha blending should be disabled.\n */\n get _disableAlphaBlending() {\n var _a;\n return (this._transparencyMode === PBRBaseMaterial.PBRMATERIAL_OPAQUE ||\n this._transparencyMode === PBRBaseMaterial.PBRMATERIAL_ALPHATEST ||\n ((_a = this.subSurface) === null || _a === void 0 ? void 0 : _a.disableAlphaBlending));\n }\n /**\n * Specifies whether or not this material should be rendered in alpha blend mode.\n */\n needAlphaBlending() {\n if (this._disableAlphaBlending) {\n return false;\n }\n return this.alpha < 1.0 || this._opacityTexture != null || this._shouldUseAlphaFromAlbedoTexture();\n }\n /**\n * Specifies whether or not this material should be rendered in alpha test mode.\n */\n needAlphaTesting() {\n var _a;\n if (this._forceAlphaTest) {\n return true;\n }\n if ((_a = this.subSurface) === null || _a === void 0 ? void 0 : _a.disableAlphaBlending) {\n return false;\n }\n return this._hasAlphaChannel() && (this._transparencyMode == null || this._transparencyMode === PBRBaseMaterial.PBRMATERIAL_ALPHATEST);\n }\n /**\n * Specifies whether or not the alpha value of the albedo texture should be used for alpha blending.\n */\n _shouldUseAlphaFromAlbedoTexture() {\n return this._albedoTexture != null && this._albedoTexture.hasAlpha && this._useAlphaFromAlbedoTexture && this._transparencyMode !== PBRBaseMaterial.PBRMATERIAL_OPAQUE;\n }\n /**\n * Specifies whether or not there is a usable alpha channel for transparency.\n */\n _hasAlphaChannel() {\n return (this._albedoTexture != null && this._albedoTexture.hasAlpha) || this._opacityTexture != null;\n }\n /**\n * Gets the texture used for the alpha test.\n */\n getAlphaTestTexture() {\n return this._albedoTexture;\n }\n /**\n * Specifies that the submesh is ready to be used.\n * @param mesh - BJS mesh.\n * @param subMesh - A submesh of the BJS mesh. Used to check if it is ready.\n * @param useInstances - Specifies that instances should be used.\n * @returns - boolean indicating that the submesh is ready or not.\n */\n isReadyForSubMesh(mesh, subMesh, useInstances) {\n var _a;\n if (!this._uniformBufferLayoutBuilt) {\n this.buildUniformLayout();\n }\n if (subMesh.effect && this.isFrozen) {\n if (subMesh.effect._wasPreviouslyReady && subMesh.effect._wasPreviouslyUsingInstances === useInstances) {\n return true;\n }\n }\n if (!subMesh.materialDefines) {\n this._callbackPluginEventGeneric(MaterialPluginEvent.GetDefineNames, this._eventInfo);\n subMesh.materialDefines = new PBRMaterialDefines(this._eventInfo.defineNames);\n }\n const defines = subMesh.materialDefines;\n if (this._isReadyForSubMesh(subMesh)) {\n return true;\n }\n const scene = this.getScene();\n const engine = scene.getEngine();\n if (defines._areTexturesDirty) {\n this._eventInfo.hasRenderTargetTextures = false;\n this._callbackPluginEventHasRenderTargetTextures(this._eventInfo);\n this._cacheHasRenderTargetTextures = this._eventInfo.hasRenderTargetTextures;\n if (scene.texturesEnabled) {\n if (this._albedoTexture && MaterialFlags.DiffuseTextureEnabled) {\n if (!this._albedoTexture.isReadyOrNotBlocking()) {\n return false;\n }\n }\n if (this._ambientTexture && MaterialFlags.AmbientTextureEnabled) {\n if (!this._ambientTexture.isReadyOrNotBlocking()) {\n return false;\n }\n }\n if (this._opacityTexture && MaterialFlags.OpacityTextureEnabled) {\n if (!this._opacityTexture.isReadyOrNotBlocking()) {\n return false;\n }\n }\n const reflectionTexture = this._getReflectionTexture();\n if (reflectionTexture && MaterialFlags.ReflectionTextureEnabled) {\n if (!reflectionTexture.isReadyOrNotBlocking()) {\n return false;\n }\n if (reflectionTexture.irradianceTexture) {\n if (!reflectionTexture.irradianceTexture.isReadyOrNotBlocking()) {\n return false;\n }\n }\n else {\n // Not ready until spherical are ready too.\n if (!reflectionTexture.sphericalPolynomial && ((_a = reflectionTexture.getInternalTexture()) === null || _a === void 0 ? void 0 : _a._sphericalPolynomialPromise)) {\n return false;\n }\n }\n }\n if (this._lightmapTexture && MaterialFlags.LightmapTextureEnabled) {\n if (!this._lightmapTexture.isReadyOrNotBlocking()) {\n return false;\n }\n }\n if (this._emissiveTexture && MaterialFlags.EmissiveTextureEnabled) {\n if (!this._emissiveTexture.isReadyOrNotBlocking()) {\n return false;\n }\n }\n if (MaterialFlags.SpecularTextureEnabled) {\n if (this._metallicTexture) {\n if (!this._metallicTexture.isReadyOrNotBlocking()) {\n return false;\n }\n }\n else if (this._reflectivityTexture) {\n if (!this._reflectivityTexture.isReadyOrNotBlocking()) {\n return false;\n }\n }\n if (this._metallicReflectanceTexture) {\n if (!this._metallicReflectanceTexture.isReadyOrNotBlocking()) {\n return false;\n }\n }\n if (this._reflectanceTexture) {\n if (!this._reflectanceTexture.isReadyOrNotBlocking()) {\n return false;\n }\n }\n if (this._microSurfaceTexture) {\n if (!this._microSurfaceTexture.isReadyOrNotBlocking()) {\n return false;\n }\n }\n }\n if (engine.getCaps().standardDerivatives && this._bumpTexture && MaterialFlags.BumpTextureEnabled && !this._disableBumpMap) {\n // Bump texture cannot be not blocking.\n if (!this._bumpTexture.isReady()) {\n return false;\n }\n }\n if (this._environmentBRDFTexture && MaterialFlags.ReflectionTextureEnabled) {\n // This is blocking.\n if (!this._environmentBRDFTexture.isReady()) {\n return false;\n }\n }\n }\n }\n this._eventInfo.isReadyForSubMesh = true;\n this._eventInfo.defines = defines;\n this._eventInfo.subMesh = subMesh;\n this._callbackPluginEventIsReadyForSubMesh(this._eventInfo);\n if (!this._eventInfo.isReadyForSubMesh) {\n return false;\n }\n if (defines._areImageProcessingDirty && this._imageProcessingConfiguration) {\n if (!this._imageProcessingConfiguration.isReady()) {\n return false;\n }\n }\n if (!engine.getCaps().standardDerivatives && !mesh.isVerticesDataPresent(VertexBuffer.NormalKind)) {\n mesh.createNormals(true);\n Logger.Warn(\"PBRMaterial: Normals have been created for the mesh: \" + mesh.name);\n }\n const previousEffect = subMesh.effect;\n const lightDisposed = defines._areLightsDisposed;\n let effect = this._prepareEffect(mesh, defines, this.onCompiled, this.onError, useInstances, null, subMesh.getRenderingMesh().hasThinInstances);\n let forceWasNotReadyPreviously = false;\n if (effect) {\n if (this._onEffectCreatedObservable) {\n onCreatedEffectParameters.effect = effect;\n onCreatedEffectParameters.subMesh = subMesh;\n this._onEffectCreatedObservable.notifyObservers(onCreatedEffectParameters);\n }\n // Use previous effect while new one is compiling\n if (this.allowShaderHotSwapping && previousEffect && !effect.isReady()) {\n effect = previousEffect;\n defines.markAsUnprocessed();\n forceWasNotReadyPreviously = this.isFrozen;\n if (lightDisposed) {\n // re register in case it takes more than one frame.\n defines._areLightsDisposed = true;\n return false;\n }\n }\n else {\n scene.resetCachedMaterial();\n subMesh.setEffect(effect, defines, this._materialContext);\n }\n }\n if (!subMesh.effect || !subMesh.effect.isReady()) {\n return false;\n }\n defines._renderId = scene.getRenderId();\n subMesh.effect._wasPreviouslyReady = forceWasNotReadyPreviously ? false : true;\n subMesh.effect._wasPreviouslyUsingInstances = !!useInstances;\n this._checkScenePerformancePriority();\n return true;\n }\n /**\n * Specifies if the material uses metallic roughness workflow.\n * @returns boolean specifying if the material uses metallic roughness workflow.\n */\n isMetallicWorkflow() {\n if (this._metallic != null || this._roughness != null || this._metallicTexture) {\n return true;\n }\n return false;\n }\n _prepareEffect(mesh, defines, onCompiled = null, onError = null, useInstances = null, useClipPlane = null, useThinInstances) {\n this._prepareDefines(mesh, defines, useInstances, useClipPlane, useThinInstances);\n if (!defines.isDirty) {\n return null;\n }\n defines.markAsProcessed();\n const scene = this.getScene();\n const engine = scene.getEngine();\n // Fallbacks\n const fallbacks = new EffectFallbacks();\n let fallbackRank = 0;\n if (defines.USESPHERICALINVERTEX) {\n fallbacks.addFallback(fallbackRank++, \"USESPHERICALINVERTEX\");\n }\n if (defines.FOG) {\n fallbacks.addFallback(fallbackRank, \"FOG\");\n }\n if (defines.SPECULARAA) {\n fallbacks.addFallback(fallbackRank, \"SPECULARAA\");\n }\n if (defines.POINTSIZE) {\n fallbacks.addFallback(fallbackRank, \"POINTSIZE\");\n }\n if (defines.LOGARITHMICDEPTH) {\n fallbacks.addFallback(fallbackRank, \"LOGARITHMICDEPTH\");\n }\n if (defines.PARALLAX) {\n fallbacks.addFallback(fallbackRank, \"PARALLAX\");\n }\n if (defines.PARALLAX_RHS) {\n fallbacks.addFallback(fallbackRank, \"PARALLAX_RHS\");\n }\n if (defines.PARALLAXOCCLUSION) {\n fallbacks.addFallback(fallbackRank++, \"PARALLAXOCCLUSION\");\n }\n if (defines.ENVIRONMENTBRDF) {\n fallbacks.addFallback(fallbackRank++, \"ENVIRONMENTBRDF\");\n }\n if (defines.TANGENT) {\n fallbacks.addFallback(fallbackRank++, \"TANGENT\");\n }\n if (defines.BUMP) {\n fallbacks.addFallback(fallbackRank++, \"BUMP\");\n }\n fallbackRank = MaterialHelper.HandleFallbacksForShadows(defines, fallbacks, this._maxSimultaneousLights, fallbackRank++);\n if (defines.SPECULARTERM) {\n fallbacks.addFallback(fallbackRank++, \"SPECULARTERM\");\n }\n if (defines.USESPHERICALFROMREFLECTIONMAP) {\n fallbacks.addFallback(fallbackRank++, \"USESPHERICALFROMREFLECTIONMAP\");\n }\n if (defines.USEIRRADIANCEMAP) {\n fallbacks.addFallback(fallbackRank++, \"USEIRRADIANCEMAP\");\n }\n if (defines.LIGHTMAP) {\n fallbacks.addFallback(fallbackRank++, \"LIGHTMAP\");\n }\n if (defines.NORMAL) {\n fallbacks.addFallback(fallbackRank++, \"NORMAL\");\n }\n if (defines.AMBIENT) {\n fallbacks.addFallback(fallbackRank++, \"AMBIENT\");\n }\n if (defines.EMISSIVE) {\n fallbacks.addFallback(fallbackRank++, \"EMISSIVE\");\n }\n if (defines.VERTEXCOLOR) {\n fallbacks.addFallback(fallbackRank++, \"VERTEXCOLOR\");\n }\n if (defines.MORPHTARGETS) {\n fallbacks.addFallback(fallbackRank++, \"MORPHTARGETS\");\n }\n if (defines.MULTIVIEW) {\n fallbacks.addFallback(0, \"MULTIVIEW\");\n }\n //Attributes\n const attribs = [VertexBuffer.PositionKind];\n if (defines.NORMAL) {\n attribs.push(VertexBuffer.NormalKind);\n }\n if (defines.TANGENT) {\n attribs.push(VertexBuffer.TangentKind);\n }\n for (let i = 1; i <= 6; ++i) {\n if (defines[\"UV\" + i]) {\n attribs.push(`uv${i === 1 ? \"\" : i}`);\n }\n }\n if (defines.VERTEXCOLOR) {\n attribs.push(VertexBuffer.ColorKind);\n }\n if (defines.INSTANCESCOLOR) {\n attribs.push(VertexBuffer.ColorInstanceKind);\n }\n MaterialHelper.PrepareAttributesForBones(attribs, mesh, defines, fallbacks);\n MaterialHelper.PrepareAttributesForInstances(attribs, defines);\n MaterialHelper.PrepareAttributesForMorphTargets(attribs, mesh, defines);\n MaterialHelper.PrepareAttributesForBakedVertexAnimation(attribs, mesh, defines);\n let shaderName = \"pbr\";\n const uniforms = [\n \"world\",\n \"view\",\n \"viewProjection\",\n \"vEyePosition\",\n \"vLightsType\",\n \"vAmbientColor\",\n \"vAlbedoColor\",\n \"vReflectivityColor\",\n \"vMetallicReflectanceFactors\",\n \"vEmissiveColor\",\n \"visibility\",\n \"vReflectionColor\",\n \"vFogInfos\",\n \"vFogColor\",\n \"pointSize\",\n \"vAlbedoInfos\",\n \"vAmbientInfos\",\n \"vOpacityInfos\",\n \"vReflectionInfos\",\n \"vReflectionPosition\",\n \"vReflectionSize\",\n \"vEmissiveInfos\",\n \"vReflectivityInfos\",\n \"vReflectionFilteringInfo\",\n \"vMetallicReflectanceInfos\",\n \"vReflectanceInfos\",\n \"vMicroSurfaceSamplerInfos\",\n \"vBumpInfos\",\n \"vLightmapInfos\",\n \"mBones\",\n \"albedoMatrix\",\n \"ambientMatrix\",\n \"opacityMatrix\",\n \"reflectionMatrix\",\n \"emissiveMatrix\",\n \"reflectivityMatrix\",\n \"normalMatrix\",\n \"microSurfaceSamplerMatrix\",\n \"bumpMatrix\",\n \"lightmapMatrix\",\n \"metallicReflectanceMatrix\",\n \"reflectanceMatrix\",\n \"vLightingIntensity\",\n \"logarithmicDepthConstant\",\n \"vSphericalX\",\n \"vSphericalY\",\n \"vSphericalZ\",\n \"vSphericalXX_ZZ\",\n \"vSphericalYY_ZZ\",\n \"vSphericalZZ\",\n \"vSphericalXY\",\n \"vSphericalYZ\",\n \"vSphericalZX\",\n \"vSphericalL00\",\n \"vSphericalL1_1\",\n \"vSphericalL10\",\n \"vSphericalL11\",\n \"vSphericalL2_2\",\n \"vSphericalL2_1\",\n \"vSphericalL20\",\n \"vSphericalL21\",\n \"vSphericalL22\",\n \"vReflectionMicrosurfaceInfos\",\n \"vTangentSpaceParams\",\n \"boneTextureWidth\",\n \"vDebugMode\",\n \"morphTargetTextureInfo\",\n \"morphTargetTextureIndices\",\n ];\n const samplers = [\n \"albedoSampler\",\n \"reflectivitySampler\",\n \"ambientSampler\",\n \"emissiveSampler\",\n \"bumpSampler\",\n \"lightmapSampler\",\n \"opacitySampler\",\n \"reflectionSampler\",\n \"reflectionSamplerLow\",\n \"reflectionSamplerHigh\",\n \"irradianceSampler\",\n \"microSurfaceSampler\",\n \"environmentBrdfSampler\",\n \"boneSampler\",\n \"metallicReflectanceSampler\",\n \"reflectanceSampler\",\n \"morphTargets\",\n \"oitDepthSampler\",\n \"oitFrontColorSampler\",\n ];\n const uniformBuffers = [\"Material\", \"Scene\", \"Mesh\"];\n const indexParameters = { maxSimultaneousLights: this._maxSimultaneousLights, maxSimultaneousMorphTargets: defines.NUM_MORPH_INFLUENCERS };\n this._eventInfo.fallbacks = fallbacks;\n this._eventInfo.fallbackRank = fallbackRank;\n this._eventInfo.defines = defines;\n this._eventInfo.uniforms = uniforms;\n this._eventInfo.attributes = attribs;\n this._eventInfo.samplers = samplers;\n this._eventInfo.uniformBuffersNames = uniformBuffers;\n this._eventInfo.customCode = undefined;\n this._eventInfo.mesh = mesh;\n this._eventInfo.indexParameters = indexParameters;\n this._callbackPluginEventGeneric(MaterialPluginEvent.PrepareEffect, this._eventInfo);\n PrePassConfiguration.AddUniforms(uniforms);\n PrePassConfiguration.AddSamplers(samplers);\n addClipPlaneUniforms(uniforms);\n if (ImageProcessingConfiguration) {\n ImageProcessingConfiguration.PrepareUniforms(uniforms, defines);\n ImageProcessingConfiguration.PrepareSamplers(samplers, defines);\n }\n MaterialHelper.PrepareUniformsAndSamplersList({\n uniformsNames: uniforms,\n uniformBuffersNames: uniformBuffers,\n samplers: samplers,\n defines: defines,\n maxSimultaneousLights: this._maxSimultaneousLights,\n });\n const csnrOptions = {};\n if (this.customShaderNameResolve) {\n shaderName = this.customShaderNameResolve(shaderName, uniforms, uniformBuffers, samplers, defines, attribs, csnrOptions);\n }\n const join = defines.toString();\n const effect = engine.createEffect(shaderName, {\n attributes: attribs,\n uniformsNames: uniforms,\n uniformBuffersNames: uniformBuffers,\n samplers: samplers,\n defines: join,\n fallbacks: fallbacks,\n onCompiled: onCompiled,\n onError: onError,\n indexParameters,\n processFinalCode: csnrOptions.processFinalCode,\n processCodeAfterIncludes: this._eventInfo.customCode,\n multiTarget: defines.PREPASS,\n }, engine);\n this._eventInfo.customCode = undefined;\n return effect;\n }\n _prepareDefines(mesh, defines, useInstances = null, useClipPlane = null, useThinInstances = false) {\n var _a;\n const scene = this.getScene();\n const engine = scene.getEngine();\n // Lights\n MaterialHelper.PrepareDefinesForLights(scene, mesh, defines, true, this._maxSimultaneousLights, this._disableLighting);\n defines._needNormals = true;\n // Multiview\n MaterialHelper.PrepareDefinesForMultiview(scene, defines);\n // PrePass\n const oit = this.needAlphaBlendingForMesh(mesh) && this.getScene().useOrderIndependentTransparency;\n MaterialHelper.PrepareDefinesForPrePass(scene, defines, this.canRenderToMRT && !oit);\n // Order independant transparency\n MaterialHelper.PrepareDefinesForOIT(scene, defines, oit);\n // Textures\n defines.METALLICWORKFLOW = this.isMetallicWorkflow();\n if (defines._areTexturesDirty) {\n defines._needUVs = false;\n for (let i = 1; i <= 6; ++i) {\n defines[\"MAINUV\" + i] = false;\n }\n if (scene.texturesEnabled) {\n defines.ALBEDODIRECTUV = 0;\n defines.AMBIENTDIRECTUV = 0;\n defines.OPACITYDIRECTUV = 0;\n defines.EMISSIVEDIRECTUV = 0;\n defines.REFLECTIVITYDIRECTUV = 0;\n defines.MICROSURFACEMAPDIRECTUV = 0;\n defines.METALLIC_REFLECTANCEDIRECTUV = 0;\n defines.REFLECTANCEDIRECTUV = 0;\n defines.BUMPDIRECTUV = 0;\n defines.LIGHTMAPDIRECTUV = 0;\n if (engine.getCaps().textureLOD) {\n defines.LODBASEDMICROSFURACE = true;\n }\n if (this._albedoTexture && MaterialFlags.DiffuseTextureEnabled) {\n MaterialHelper.PrepareDefinesForMergedUV(this._albedoTexture, defines, \"ALBEDO\");\n defines.GAMMAALBEDO = this._albedoTexture.gammaSpace;\n }\n else {\n defines.ALBEDO = false;\n }\n if (this._ambientTexture && MaterialFlags.AmbientTextureEnabled) {\n MaterialHelper.PrepareDefinesForMergedUV(this._ambientTexture, defines, \"AMBIENT\");\n defines.AMBIENTINGRAYSCALE = this._useAmbientInGrayScale;\n }\n else {\n defines.AMBIENT = false;\n }\n if (this._opacityTexture && MaterialFlags.OpacityTextureEnabled) {\n MaterialHelper.PrepareDefinesForMergedUV(this._opacityTexture, defines, \"OPACITY\");\n defines.OPACITYRGB = this._opacityTexture.getAlphaFromRGB;\n }\n else {\n defines.OPACITY = false;\n }\n const reflectionTexture = this._getReflectionTexture();\n if (reflectionTexture && MaterialFlags.ReflectionTextureEnabled) {\n defines.REFLECTION = true;\n defines.GAMMAREFLECTION = reflectionTexture.gammaSpace;\n defines.RGBDREFLECTION = reflectionTexture.isRGBD;\n defines.LODINREFLECTIONALPHA = reflectionTexture.lodLevelInAlpha;\n defines.LINEARSPECULARREFLECTION = reflectionTexture.linearSpecularLOD;\n if (this.realTimeFiltering && this.realTimeFilteringQuality > 0) {\n defines.NUM_SAMPLES = \"\" + this.realTimeFilteringQuality;\n if (engine._features.needTypeSuffixInShaderConstants) {\n defines.NUM_SAMPLES = defines.NUM_SAMPLES + \"u\";\n }\n defines.REALTIME_FILTERING = true;\n }\n else {\n defines.REALTIME_FILTERING = false;\n }\n defines.INVERTCUBICMAP = reflectionTexture.coordinatesMode === Texture.INVCUBIC_MODE;\n defines.REFLECTIONMAP_3D = reflectionTexture.isCube;\n defines.REFLECTIONMAP_OPPOSITEZ = defines.REFLECTIONMAP_3D && this.getScene().useRightHandedSystem ? !reflectionTexture.invertZ : reflectionTexture.invertZ;\n defines.REFLECTIONMAP_CUBIC = false;\n defines.REFLECTIONMAP_EXPLICIT = false;\n defines.REFLECTIONMAP_PLANAR = false;\n defines.REFLECTIONMAP_PROJECTION = false;\n defines.REFLECTIONMAP_SKYBOX = false;\n defines.REFLECTIONMAP_SPHERICAL = false;\n defines.REFLECTIONMAP_EQUIRECTANGULAR = false;\n defines.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = false;\n defines.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = false;\n switch (reflectionTexture.coordinatesMode) {\n case Texture.EXPLICIT_MODE:\n defines.REFLECTIONMAP_EXPLICIT = true;\n break;\n case Texture.PLANAR_MODE:\n defines.REFLECTIONMAP_PLANAR = true;\n break;\n case Texture.PROJECTION_MODE:\n defines.REFLECTIONMAP_PROJECTION = true;\n break;\n case Texture.SKYBOX_MODE:\n defines.REFLECTIONMAP_SKYBOX = true;\n break;\n case Texture.SPHERICAL_MODE:\n defines.REFLECTIONMAP_SPHERICAL = true;\n break;\n case Texture.EQUIRECTANGULAR_MODE:\n defines.REFLECTIONMAP_EQUIRECTANGULAR = true;\n break;\n case Texture.FIXED_EQUIRECTANGULAR_MODE:\n defines.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = true;\n break;\n case Texture.FIXED_EQUIRECTANGULAR_MIRRORED_MODE:\n defines.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = true;\n break;\n case Texture.CUBIC_MODE:\n case Texture.INVCUBIC_MODE:\n default:\n defines.REFLECTIONMAP_CUBIC = true;\n defines.USE_LOCAL_REFLECTIONMAP_CUBIC = reflectionTexture.boundingBoxSize ? true : false;\n break;\n }\n if (reflectionTexture.coordinatesMode !== Texture.SKYBOX_MODE) {\n if (reflectionTexture.irradianceTexture) {\n defines.USEIRRADIANCEMAP = true;\n defines.USESPHERICALFROMREFLECTIONMAP = false;\n }\n // Assume using spherical polynomial if the reflection texture is a cube map\n else if (reflectionTexture.isCube) {\n defines.USESPHERICALFROMREFLECTIONMAP = true;\n defines.USEIRRADIANCEMAP = false;\n if (this._forceIrradianceInFragment || this.realTimeFiltering || this._twoSidedLighting || engine.getCaps().maxVaryingVectors <= 8) {\n defines.USESPHERICALINVERTEX = false;\n }\n else {\n defines.USESPHERICALINVERTEX = true;\n }\n }\n }\n }\n else {\n defines.REFLECTION = false;\n defines.REFLECTIONMAP_3D = false;\n defines.REFLECTIONMAP_SPHERICAL = false;\n defines.REFLECTIONMAP_PLANAR = false;\n defines.REFLECTIONMAP_CUBIC = false;\n defines.USE_LOCAL_REFLECTIONMAP_CUBIC = false;\n defines.REFLECTIONMAP_PROJECTION = false;\n defines.REFLECTIONMAP_SKYBOX = false;\n defines.REFLECTIONMAP_EXPLICIT = false;\n defines.REFLECTIONMAP_EQUIRECTANGULAR = false;\n defines.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = false;\n defines.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = false;\n defines.INVERTCUBICMAP = false;\n defines.USESPHERICALFROMREFLECTIONMAP = false;\n defines.USEIRRADIANCEMAP = false;\n defines.USESPHERICALINVERTEX = false;\n defines.REFLECTIONMAP_OPPOSITEZ = false;\n defines.LODINREFLECTIONALPHA = false;\n defines.GAMMAREFLECTION = false;\n defines.RGBDREFLECTION = false;\n defines.LINEARSPECULARREFLECTION = false;\n }\n if (this._lightmapTexture && MaterialFlags.LightmapTextureEnabled) {\n MaterialHelper.PrepareDefinesForMergedUV(this._lightmapTexture, defines, \"LIGHTMAP\");\n defines.USELIGHTMAPASSHADOWMAP = this._useLightmapAsShadowmap;\n defines.GAMMALIGHTMAP = this._lightmapTexture.gammaSpace;\n defines.RGBDLIGHTMAP = this._lightmapTexture.isRGBD;\n }\n else {\n defines.LIGHTMAP = false;\n }\n if (this._emissiveTexture && MaterialFlags.EmissiveTextureEnabled) {\n MaterialHelper.PrepareDefinesForMergedUV(this._emissiveTexture, defines, \"EMISSIVE\");\n defines.GAMMAEMISSIVE = this._emissiveTexture.gammaSpace;\n }\n else {\n defines.EMISSIVE = false;\n }\n if (MaterialFlags.SpecularTextureEnabled) {\n if (this._metallicTexture) {\n MaterialHelper.PrepareDefinesForMergedUV(this._metallicTexture, defines, \"REFLECTIVITY\");\n defines.ROUGHNESSSTOREINMETALMAPALPHA = this._useRoughnessFromMetallicTextureAlpha;\n defines.ROUGHNESSSTOREINMETALMAPGREEN = !this._useRoughnessFromMetallicTextureAlpha && this._useRoughnessFromMetallicTextureGreen;\n defines.METALLNESSSTOREINMETALMAPBLUE = this._useMetallnessFromMetallicTextureBlue;\n defines.AOSTOREINMETALMAPRED = this._useAmbientOcclusionFromMetallicTextureRed;\n defines.REFLECTIVITY_GAMMA = false;\n }\n else if (this._reflectivityTexture) {\n MaterialHelper.PrepareDefinesForMergedUV(this._reflectivityTexture, defines, \"REFLECTIVITY\");\n defines.MICROSURFACEFROMREFLECTIVITYMAP = this._useMicroSurfaceFromReflectivityMapAlpha;\n defines.MICROSURFACEAUTOMATIC = this._useAutoMicroSurfaceFromReflectivityMap;\n defines.REFLECTIVITY_GAMMA = this._reflectivityTexture.gammaSpace;\n }\n else {\n defines.REFLECTIVITY = false;\n }\n if (this._metallicReflectanceTexture || this._reflectanceTexture) {\n const identicalTextures = this._metallicReflectanceTexture !== null &&\n this._metallicReflectanceTexture._texture === ((_a = this._reflectanceTexture) === null || _a === void 0 ? void 0 : _a._texture) &&\n this._metallicReflectanceTexture.checkTransformsAreIdentical(this._reflectanceTexture);\n defines.METALLIC_REFLECTANCE_USE_ALPHA_ONLY = this._useOnlyMetallicFromMetallicReflectanceTexture && !identicalTextures;\n if (this._metallicReflectanceTexture) {\n MaterialHelper.PrepareDefinesForMergedUV(this._metallicReflectanceTexture, defines, \"METALLIC_REFLECTANCE\");\n defines.METALLIC_REFLECTANCE_GAMMA = this._metallicReflectanceTexture.gammaSpace;\n }\n else {\n defines.METALLIC_REFLECTANCE = false;\n }\n if (this._reflectanceTexture &&\n !identicalTextures &&\n (!this._metallicReflectanceTexture || (this._metallicReflectanceTexture && this._useOnlyMetallicFromMetallicReflectanceTexture))) {\n MaterialHelper.PrepareDefinesForMergedUV(this._reflectanceTexture, defines, \"REFLECTANCE\");\n defines.REFLECTANCE_GAMMA = this._reflectanceTexture.gammaSpace;\n }\n else {\n defines.REFLECTANCE = false;\n }\n }\n else {\n defines.METALLIC_REFLECTANCE = false;\n defines.REFLECTANCE = false;\n }\n if (this._microSurfaceTexture) {\n MaterialHelper.PrepareDefinesForMergedUV(this._microSurfaceTexture, defines, \"MICROSURFACEMAP\");\n }\n else {\n defines.MICROSURFACEMAP = false;\n }\n }\n else {\n defines.REFLECTIVITY = false;\n defines.MICROSURFACEMAP = false;\n }\n if (engine.getCaps().standardDerivatives && this._bumpTexture && MaterialFlags.BumpTextureEnabled && !this._disableBumpMap) {\n MaterialHelper.PrepareDefinesForMergedUV(this._bumpTexture, defines, \"BUMP\");\n if (this._useParallax && this._albedoTexture && MaterialFlags.DiffuseTextureEnabled) {\n defines.PARALLAX = true;\n defines.PARALLAX_RHS = scene.useRightHandedSystem;\n defines.PARALLAXOCCLUSION = !!this._useParallaxOcclusion;\n }\n else {\n defines.PARALLAX = false;\n }\n defines.OBJECTSPACE_NORMALMAP = this._useObjectSpaceNormalMap;\n }\n else {\n defines.BUMP = false;\n defines.PARALLAX = false;\n defines.PARALLAX_RHS = false;\n defines.PARALLAXOCCLUSION = false;\n defines.OBJECTSPACE_NORMALMAP = false;\n }\n if (this._environmentBRDFTexture && MaterialFlags.ReflectionTextureEnabled) {\n defines.ENVIRONMENTBRDF = true;\n defines.ENVIRONMENTBRDF_RGBD = this._environmentBRDFTexture.isRGBD;\n }\n else {\n defines.ENVIRONMENTBRDF = false;\n defines.ENVIRONMENTBRDF_RGBD = false;\n }\n if (this._shouldUseAlphaFromAlbedoTexture()) {\n defines.ALPHAFROMALBEDO = true;\n }\n else {\n defines.ALPHAFROMALBEDO = false;\n }\n }\n defines.SPECULAROVERALPHA = this._useSpecularOverAlpha;\n if (this._lightFalloff === PBRBaseMaterial.LIGHTFALLOFF_STANDARD) {\n defines.USEPHYSICALLIGHTFALLOFF = false;\n defines.USEGLTFLIGHTFALLOFF = false;\n }\n else if (this._lightFalloff === PBRBaseMaterial.LIGHTFALLOFF_GLTF) {\n defines.USEPHYSICALLIGHTFALLOFF = false;\n defines.USEGLTFLIGHTFALLOFF = true;\n }\n else {\n defines.USEPHYSICALLIGHTFALLOFF = true;\n defines.USEGLTFLIGHTFALLOFF = false;\n }\n defines.RADIANCEOVERALPHA = this._useRadianceOverAlpha;\n if (!this.backFaceCulling && this._twoSidedLighting) {\n defines.TWOSIDEDLIGHTING = true;\n }\n else {\n defines.TWOSIDEDLIGHTING = false;\n }\n defines.SPECULARAA = engine.getCaps().standardDerivatives && this._enableSpecularAntiAliasing;\n }\n if (defines._areTexturesDirty || defines._areMiscDirty) {\n defines.ALPHATESTVALUE = `${this._alphaCutOff}${this._alphaCutOff % 1 === 0 ? \".\" : \"\"}`;\n defines.PREMULTIPLYALPHA = this.alphaMode === 7 || this.alphaMode === 8;\n defines.ALPHABLEND = this.needAlphaBlendingForMesh(mesh);\n defines.ALPHAFRESNEL = this._useAlphaFresnel || this._useLinearAlphaFresnel;\n defines.LINEARALPHAFRESNEL = this._useLinearAlphaFresnel;\n }\n if (defines._areImageProcessingDirty && this._imageProcessingConfiguration) {\n this._imageProcessingConfiguration.prepareDefines(defines);\n }\n defines.FORCENORMALFORWARD = this._forceNormalForward;\n defines.RADIANCEOCCLUSION = this._useRadianceOcclusion;\n defines.HORIZONOCCLUSION = this._useHorizonOcclusion;\n // Misc.\n if (defines._areMiscDirty) {\n MaterialHelper.PrepareDefinesForMisc(mesh, scene, this._useLogarithmicDepth, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh) || this._forceAlphaTest, defines, this._applyDecalMapAfterDetailMap);\n defines.UNLIT = this._unlit || ((this.pointsCloud || this.wireframe) && !mesh.isVerticesDataPresent(VertexBuffer.NormalKind));\n defines.DEBUGMODE = this._debugMode;\n }\n // Values that need to be evaluated on every frame\n MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, this, defines, useInstances ? true : false, useClipPlane, useThinInstances);\n // External config\n this._eventInfo.defines = defines;\n this._eventInfo.mesh = mesh;\n this._callbackPluginEventPrepareDefinesBeforeAttributes(this._eventInfo);\n // Attribs\n MaterialHelper.PrepareDefinesForAttributes(mesh, defines, true, true, true, this._transparencyMode !== PBRBaseMaterial.PBRMATERIAL_OPAQUE);\n // External config\n this._callbackPluginEventPrepareDefines(this._eventInfo);\n }\n /**\n * Force shader compilation\n * @param mesh\n * @param onCompiled\n * @param options\n */\n forceCompilation(mesh, onCompiled, options) {\n const localOptions = Object.assign({ clipPlane: false, useInstances: false }, options);\n if (!this._uniformBufferLayoutBuilt) {\n this.buildUniformLayout();\n }\n this._callbackPluginEventGeneric(MaterialPluginEvent.GetDefineNames, this._eventInfo);\n const defines = new PBRMaterialDefines(this._eventInfo.defineNames);\n const effect = this._prepareEffect(mesh, defines, undefined, undefined, localOptions.useInstances, localOptions.clipPlane, mesh.hasThinInstances);\n if (this._onEffectCreatedObservable) {\n onCreatedEffectParameters.effect = effect;\n onCreatedEffectParameters.subMesh = null;\n this._onEffectCreatedObservable.notifyObservers(onCreatedEffectParameters);\n }\n if (effect.isReady()) {\n if (onCompiled) {\n onCompiled(this);\n }\n }\n else {\n effect.onCompileObservable.add(() => {\n if (onCompiled) {\n onCompiled(this);\n }\n });\n }\n }\n /**\n * Initializes the uniform buffer layout for the shader.\n */\n buildUniformLayout() {\n // Order is important !\n const ubo = this._uniformBuffer;\n ubo.addUniform(\"vAlbedoInfos\", 2);\n ubo.addUniform(\"vAmbientInfos\", 4);\n ubo.addUniform(\"vOpacityInfos\", 2);\n ubo.addUniform(\"vEmissiveInfos\", 2);\n ubo.addUniform(\"vLightmapInfos\", 2);\n ubo.addUniform(\"vReflectivityInfos\", 3);\n ubo.addUniform(\"vMicroSurfaceSamplerInfos\", 2);\n ubo.addUniform(\"vReflectionInfos\", 2);\n ubo.addUniform(\"vReflectionFilteringInfo\", 2);\n ubo.addUniform(\"vReflectionPosition\", 3);\n ubo.addUniform(\"vReflectionSize\", 3);\n ubo.addUniform(\"vBumpInfos\", 3);\n ubo.addUniform(\"albedoMatrix\", 16);\n ubo.addUniform(\"ambientMatrix\", 16);\n ubo.addUniform(\"opacityMatrix\", 16);\n ubo.addUniform(\"emissiveMatrix\", 16);\n ubo.addUniform(\"lightmapMatrix\", 16);\n ubo.addUniform(\"reflectivityMatrix\", 16);\n ubo.addUniform(\"microSurfaceSamplerMatrix\", 16);\n ubo.addUniform(\"bumpMatrix\", 16);\n ubo.addUniform(\"vTangentSpaceParams\", 2);\n ubo.addUniform(\"reflectionMatrix\", 16);\n ubo.addUniform(\"vReflectionColor\", 3);\n ubo.addUniform(\"vAlbedoColor\", 4);\n ubo.addUniform(\"vLightingIntensity\", 4);\n ubo.addUniform(\"vReflectionMicrosurfaceInfos\", 3);\n ubo.addUniform(\"pointSize\", 1);\n ubo.addUniform(\"vReflectivityColor\", 4);\n ubo.addUniform(\"vEmissiveColor\", 3);\n ubo.addUniform(\"vAmbientColor\", 3);\n ubo.addUniform(\"vDebugMode\", 2);\n ubo.addUniform(\"vMetallicReflectanceFactors\", 4);\n ubo.addUniform(\"vMetallicReflectanceInfos\", 2);\n ubo.addUniform(\"metallicReflectanceMatrix\", 16);\n ubo.addUniform(\"vReflectanceInfos\", 2);\n ubo.addUniform(\"reflectanceMatrix\", 16);\n ubo.addUniform(\"vSphericalL00\", 3);\n ubo.addUniform(\"vSphericalL1_1\", 3);\n ubo.addUniform(\"vSphericalL10\", 3);\n ubo.addUniform(\"vSphericalL11\", 3);\n ubo.addUniform(\"vSphericalL2_2\", 3);\n ubo.addUniform(\"vSphericalL2_1\", 3);\n ubo.addUniform(\"vSphericalL20\", 3);\n ubo.addUniform(\"vSphericalL21\", 3);\n ubo.addUniform(\"vSphericalL22\", 3);\n ubo.addUniform(\"vSphericalX\", 3);\n ubo.addUniform(\"vSphericalY\", 3);\n ubo.addUniform(\"vSphericalZ\", 3);\n ubo.addUniform(\"vSphericalXX_ZZ\", 3);\n ubo.addUniform(\"vSphericalYY_ZZ\", 3);\n ubo.addUniform(\"vSphericalZZ\", 3);\n ubo.addUniform(\"vSphericalXY\", 3);\n ubo.addUniform(\"vSphericalYZ\", 3);\n ubo.addUniform(\"vSphericalZX\", 3);\n super.buildUniformLayout();\n }\n /**\n * Binds the submesh data.\n * @param world - The world matrix.\n * @param mesh - The BJS mesh.\n * @param subMesh - A submesh of the BJS mesh.\n */\n bindForSubMesh(world, mesh, subMesh) {\n var _a, _b, _c, _d;\n const scene = this.getScene();\n const defines = subMesh.materialDefines;\n if (!defines) {\n return;\n }\n const effect = subMesh.effect;\n if (!effect) {\n return;\n }\n this._activeEffect = effect;\n // Matrices Mesh.\n mesh.getMeshUniformBuffer().bindToEffect(effect, \"Mesh\");\n mesh.transferToEffect(world);\n const engine = scene.getEngine();\n // Binding unconditionally\n this._uniformBuffer.bindToEffect(effect, \"Material\");\n this.prePassConfiguration.bindForSubMesh(this._activeEffect, scene, mesh, world, this.isFrozen);\n this._eventInfo.subMesh = subMesh;\n this._callbackPluginEventHardBindForSubMesh(this._eventInfo);\n // Normal Matrix\n if (defines.OBJECTSPACE_NORMALMAP) {\n world.toNormalMatrix(this._normalMatrix);\n this.bindOnlyNormalMatrix(this._normalMatrix);\n }\n const mustRebind = effect._forceRebindOnNextCall || this._mustRebind(scene, effect, mesh.visibility);\n // Bones\n MaterialHelper.BindBonesParameters(mesh, this._activeEffect, this.prePassConfiguration);\n let reflectionTexture = null;\n const ubo = this._uniformBuffer;\n if (mustRebind) {\n this.bindViewProjection(effect);\n reflectionTexture = this._getReflectionTexture();\n if (!ubo.useUbo || !this.isFrozen || !ubo.isSync || effect._forceRebindOnNextCall) {\n // Texture uniforms\n if (scene.texturesEnabled) {\n if (this._albedoTexture && MaterialFlags.DiffuseTextureEnabled) {\n ubo.updateFloat2(\"vAlbedoInfos\", this._albedoTexture.coordinatesIndex, this._albedoTexture.level);\n MaterialHelper.BindTextureMatrix(this._albedoTexture, ubo, \"albedo\");\n }\n if (this._ambientTexture && MaterialFlags.AmbientTextureEnabled) {\n ubo.updateFloat4(\"vAmbientInfos\", this._ambientTexture.coordinatesIndex, this._ambientTexture.level, this._ambientTextureStrength, this._ambientTextureImpactOnAnalyticalLights);\n MaterialHelper.BindTextureMatrix(this._ambientTexture, ubo, \"ambient\");\n }\n if (this._opacityTexture && MaterialFlags.OpacityTextureEnabled) {\n ubo.updateFloat2(\"vOpacityInfos\", this._opacityTexture.coordinatesIndex, this._opacityTexture.level);\n MaterialHelper.BindTextureMatrix(this._opacityTexture, ubo, \"opacity\");\n }\n if (reflectionTexture && MaterialFlags.ReflectionTextureEnabled) {\n ubo.updateMatrix(\"reflectionMatrix\", reflectionTexture.getReflectionTextureMatrix());\n ubo.updateFloat2(\"vReflectionInfos\", reflectionTexture.level, 0);\n if (reflectionTexture.boundingBoxSize) {\n const cubeTexture = reflectionTexture;\n ubo.updateVector3(\"vReflectionPosition\", cubeTexture.boundingBoxPosition);\n ubo.updateVector3(\"vReflectionSize\", cubeTexture.boundingBoxSize);\n }\n if (this.realTimeFiltering) {\n const width = reflectionTexture.getSize().width;\n ubo.updateFloat2(\"vReflectionFilteringInfo\", width, Scalar.Log2(width));\n }\n if (!defines.USEIRRADIANCEMAP) {\n const polynomials = reflectionTexture.sphericalPolynomial;\n if (defines.USESPHERICALFROMREFLECTIONMAP && polynomials) {\n if (defines.SPHERICAL_HARMONICS) {\n const preScaledHarmonics = polynomials.preScaledHarmonics;\n ubo.updateVector3(\"vSphericalL00\", preScaledHarmonics.l00);\n ubo.updateVector3(\"vSphericalL1_1\", preScaledHarmonics.l1_1);\n ubo.updateVector3(\"vSphericalL10\", preScaledHarmonics.l10);\n ubo.updateVector3(\"vSphericalL11\", preScaledHarmonics.l11);\n ubo.updateVector3(\"vSphericalL2_2\", preScaledHarmonics.l2_2);\n ubo.updateVector3(\"vSphericalL2_1\", preScaledHarmonics.l2_1);\n ubo.updateVector3(\"vSphericalL20\", preScaledHarmonics.l20);\n ubo.updateVector3(\"vSphericalL21\", preScaledHarmonics.l21);\n ubo.updateVector3(\"vSphericalL22\", preScaledHarmonics.l22);\n }\n else {\n ubo.updateFloat3(\"vSphericalX\", polynomials.x.x, polynomials.x.y, polynomials.x.z);\n ubo.updateFloat3(\"vSphericalY\", polynomials.y.x, polynomials.y.y, polynomials.y.z);\n ubo.updateFloat3(\"vSphericalZ\", polynomials.z.x, polynomials.z.y, polynomials.z.z);\n ubo.updateFloat3(\"vSphericalXX_ZZ\", polynomials.xx.x - polynomials.zz.x, polynomials.xx.y - polynomials.zz.y, polynomials.xx.z - polynomials.zz.z);\n ubo.updateFloat3(\"vSphericalYY_ZZ\", polynomials.yy.x - polynomials.zz.x, polynomials.yy.y - polynomials.zz.y, polynomials.yy.z - polynomials.zz.z);\n ubo.updateFloat3(\"vSphericalZZ\", polynomials.zz.x, polynomials.zz.y, polynomials.zz.z);\n ubo.updateFloat3(\"vSphericalXY\", polynomials.xy.x, polynomials.xy.y, polynomials.xy.z);\n ubo.updateFloat3(\"vSphericalYZ\", polynomials.yz.x, polynomials.yz.y, polynomials.yz.z);\n ubo.updateFloat3(\"vSphericalZX\", polynomials.zx.x, polynomials.zx.y, polynomials.zx.z);\n }\n }\n }\n ubo.updateFloat3(\"vReflectionMicrosurfaceInfos\", reflectionTexture.getSize().width, reflectionTexture.lodGenerationScale, reflectionTexture.lodGenerationOffset);\n }\n if (this._emissiveTexture && MaterialFlags.EmissiveTextureEnabled) {\n ubo.updateFloat2(\"vEmissiveInfos\", this._emissiveTexture.coordinatesIndex, this._emissiveTexture.level);\n MaterialHelper.BindTextureMatrix(this._emissiveTexture, ubo, \"emissive\");\n }\n if (this._lightmapTexture && MaterialFlags.LightmapTextureEnabled) {\n ubo.updateFloat2(\"vLightmapInfos\", this._lightmapTexture.coordinatesIndex, this._lightmapTexture.level);\n MaterialHelper.BindTextureMatrix(this._lightmapTexture, ubo, \"lightmap\");\n }\n if (MaterialFlags.SpecularTextureEnabled) {\n if (this._metallicTexture) {\n ubo.updateFloat3(\"vReflectivityInfos\", this._metallicTexture.coordinatesIndex, this._metallicTexture.level, this._ambientTextureStrength);\n MaterialHelper.BindTextureMatrix(this._metallicTexture, ubo, \"reflectivity\");\n }\n else if (this._reflectivityTexture) {\n ubo.updateFloat3(\"vReflectivityInfos\", this._reflectivityTexture.coordinatesIndex, this._reflectivityTexture.level, 1.0);\n MaterialHelper.BindTextureMatrix(this._reflectivityTexture, ubo, \"reflectivity\");\n }\n if (this._metallicReflectanceTexture) {\n ubo.updateFloat2(\"vMetallicReflectanceInfos\", this._metallicReflectanceTexture.coordinatesIndex, this._metallicReflectanceTexture.level);\n MaterialHelper.BindTextureMatrix(this._metallicReflectanceTexture, ubo, \"metallicReflectance\");\n }\n if (this._reflectanceTexture && defines.REFLECTANCE) {\n ubo.updateFloat2(\"vReflectanceInfos\", this._reflectanceTexture.coordinatesIndex, this._reflectanceTexture.level);\n MaterialHelper.BindTextureMatrix(this._reflectanceTexture, ubo, \"reflectance\");\n }\n if (this._microSurfaceTexture) {\n ubo.updateFloat2(\"vMicroSurfaceSamplerInfos\", this._microSurfaceTexture.coordinatesIndex, this._microSurfaceTexture.level);\n MaterialHelper.BindTextureMatrix(this._microSurfaceTexture, ubo, \"microSurfaceSampler\");\n }\n }\n if (this._bumpTexture && engine.getCaps().standardDerivatives && MaterialFlags.BumpTextureEnabled && !this._disableBumpMap) {\n ubo.updateFloat3(\"vBumpInfos\", this._bumpTexture.coordinatesIndex, this._bumpTexture.level, this._parallaxScaleBias);\n MaterialHelper.BindTextureMatrix(this._bumpTexture, ubo, \"bump\");\n if (scene._mirroredCameraPosition) {\n ubo.updateFloat2(\"vTangentSpaceParams\", this._invertNormalMapX ? 1.0 : -1.0, this._invertNormalMapY ? 1.0 : -1.0);\n }\n else {\n ubo.updateFloat2(\"vTangentSpaceParams\", this._invertNormalMapX ? -1.0 : 1.0, this._invertNormalMapY ? -1.0 : 1.0);\n }\n }\n }\n // Point size\n if (this.pointsCloud) {\n ubo.updateFloat(\"pointSize\", this.pointSize);\n }\n // Colors\n if (defines.METALLICWORKFLOW) {\n TmpColors.Color3[0].r = this._metallic === undefined || this._metallic === null ? 1 : this._metallic;\n TmpColors.Color3[0].g = this._roughness === undefined || this._roughness === null ? 1 : this._roughness;\n ubo.updateColor4(\"vReflectivityColor\", TmpColors.Color3[0], 1);\n const ior = (_b = (_a = this.subSurface) === null || _a === void 0 ? void 0 : _a._indexOfRefraction) !== null && _b !== void 0 ? _b : 1.5;\n const outsideIOR = 1; // consider air as clear coat and other layers would remap in the shader.\n // We are here deriving our default reflectance from a common value for none metallic surface.\n // Based of the schlick fresnel approximation model\n // for dielectrics.\n const f0 = Math.pow((ior - outsideIOR) / (ior + outsideIOR), 2);\n // Tweak the default F0 and F90 based on our given setup\n this._metallicReflectanceColor.scaleToRef(f0 * this._metallicF0Factor, TmpColors.Color3[0]);\n const metallicF90 = this._metallicF0Factor;\n ubo.updateColor4(\"vMetallicReflectanceFactors\", TmpColors.Color3[0], metallicF90);\n }\n else {\n ubo.updateColor4(\"vReflectivityColor\", this._reflectivityColor, this._microSurface);\n }\n ubo.updateColor3(\"vEmissiveColor\", MaterialFlags.EmissiveTextureEnabled ? this._emissiveColor : Color3.BlackReadOnly);\n ubo.updateColor3(\"vReflectionColor\", this._reflectionColor);\n if (!defines.SS_REFRACTION && ((_c = this.subSurface) === null || _c === void 0 ? void 0 : _c._linkRefractionWithTransparency)) {\n ubo.updateColor4(\"vAlbedoColor\", this._albedoColor, 1);\n }\n else {\n ubo.updateColor4(\"vAlbedoColor\", this._albedoColor, this.alpha);\n }\n // Misc\n this._lightingInfos.x = this._directIntensity;\n this._lightingInfos.y = this._emissiveIntensity;\n this._lightingInfos.z = this._environmentIntensity * scene.environmentIntensity;\n this._lightingInfos.w = this._specularIntensity;\n ubo.updateVector4(\"vLightingIntensity\", this._lightingInfos);\n // Colors\n scene.ambientColor.multiplyToRef(this._ambientColor, this._globalAmbientColor);\n ubo.updateColor3(\"vAmbientColor\", this._globalAmbientColor);\n ubo.updateFloat2(\"vDebugMode\", this.debugLimit, this.debugFactor);\n }\n // Textures\n if (scene.texturesEnabled) {\n if (this._albedoTexture && MaterialFlags.DiffuseTextureEnabled) {\n ubo.setTexture(\"albedoSampler\", this._albedoTexture);\n }\n if (this._ambientTexture && MaterialFlags.AmbientTextureEnabled) {\n ubo.setTexture(\"ambientSampler\", this._ambientTexture);\n }\n if (this._opacityTexture && MaterialFlags.OpacityTextureEnabled) {\n ubo.setTexture(\"opacitySampler\", this._opacityTexture);\n }\n if (reflectionTexture && MaterialFlags.ReflectionTextureEnabled) {\n if (defines.LODBASEDMICROSFURACE) {\n ubo.setTexture(\"reflectionSampler\", reflectionTexture);\n }\n else {\n ubo.setTexture(\"reflectionSampler\", reflectionTexture._lodTextureMid || reflectionTexture);\n ubo.setTexture(\"reflectionSamplerLow\", reflectionTexture._lodTextureLow || reflectionTexture);\n ubo.setTexture(\"reflectionSamplerHigh\", reflectionTexture._lodTextureHigh || reflectionTexture);\n }\n if (defines.USEIRRADIANCEMAP) {\n ubo.setTexture(\"irradianceSampler\", reflectionTexture.irradianceTexture);\n }\n }\n if (defines.ENVIRONMENTBRDF) {\n ubo.setTexture(\"environmentBrdfSampler\", this._environmentBRDFTexture);\n }\n if (this._emissiveTexture && MaterialFlags.EmissiveTextureEnabled) {\n ubo.setTexture(\"emissiveSampler\", this._emissiveTexture);\n }\n if (this._lightmapTexture && MaterialFlags.LightmapTextureEnabled) {\n ubo.setTexture(\"lightmapSampler\", this._lightmapTexture);\n }\n if (MaterialFlags.SpecularTextureEnabled) {\n if (this._metallicTexture) {\n ubo.setTexture(\"reflectivitySampler\", this._metallicTexture);\n }\n else if (this._reflectivityTexture) {\n ubo.setTexture(\"reflectivitySampler\", this._reflectivityTexture);\n }\n if (this._metallicReflectanceTexture) {\n ubo.setTexture(\"metallicReflectanceSampler\", this._metallicReflectanceTexture);\n }\n if (this._reflectanceTexture && defines.REFLECTANCE) {\n ubo.setTexture(\"reflectanceSampler\", this._reflectanceTexture);\n }\n if (this._microSurfaceTexture) {\n ubo.setTexture(\"microSurfaceSampler\", this._microSurfaceTexture);\n }\n }\n if (this._bumpTexture && engine.getCaps().standardDerivatives && MaterialFlags.BumpTextureEnabled && !this._disableBumpMap) {\n ubo.setTexture(\"bumpSampler\", this._bumpTexture);\n }\n }\n // OIT with depth peeling\n if (this.getScene().useOrderIndependentTransparency && this.needAlphaBlendingForMesh(mesh)) {\n this.getScene().depthPeelingRenderer.bind(effect);\n }\n this._eventInfo.subMesh = subMesh;\n this._callbackPluginEventBindForSubMesh(this._eventInfo);\n // Clip plane\n bindClipPlane(this._activeEffect, this, scene);\n this.bindEyePosition(effect);\n }\n else if (scene.getEngine()._features.needToAlwaysBindUniformBuffers) {\n this._needToBindSceneUbo = true;\n }\n if (mustRebind || !this.isFrozen) {\n // Lights\n if (scene.lightsEnabled && !this._disableLighting) {\n MaterialHelper.BindLights(scene, mesh, this._activeEffect, defines, this._maxSimultaneousLights);\n }\n // View\n if ((scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) || reflectionTexture || mesh.receiveShadows || defines.PREPASS) {\n this.bindView(effect);\n }\n // Fog\n MaterialHelper.BindFogParameters(scene, mesh, this._activeEffect, true);\n // Morph targets\n if (defines.NUM_MORPH_INFLUENCERS) {\n MaterialHelper.BindMorphTargetParameters(mesh, this._activeEffect);\n }\n if (defines.BAKED_VERTEX_ANIMATION_TEXTURE) {\n (_d = mesh.bakedVertexAnimationManager) === null || _d === void 0 ? void 0 : _d.bind(effect, defines.INSTANCES);\n }\n // image processing\n this._imageProcessingConfiguration.bind(this._activeEffect);\n // Log. depth\n MaterialHelper.BindLogDepth(defines, this._activeEffect, scene);\n }\n this._afterBind(mesh, this._activeEffect);\n ubo.update();\n }\n /**\n * Returns the animatable textures.\n * If material have animatable metallic texture, then reflectivity texture will not be returned, even if it has animations.\n * @returns - Array of animatable textures.\n */\n getAnimatables() {\n const results = super.getAnimatables();\n if (this._albedoTexture && this._albedoTexture.animations && this._albedoTexture.animations.length > 0) {\n results.push(this._albedoTexture);\n }\n if (this._ambientTexture && this._ambientTexture.animations && this._ambientTexture.animations.length > 0) {\n results.push(this._ambientTexture);\n }\n if (this._opacityTexture && this._opacityTexture.animations && this._opacityTexture.animations.length > 0) {\n results.push(this._opacityTexture);\n }\n if (this._reflectionTexture && this._reflectionTexture.animations && this._reflectionTexture.animations.length > 0) {\n results.push(this._reflectionTexture);\n }\n if (this._emissiveTexture && this._emissiveTexture.animations && this._emissiveTexture.animations.length > 0) {\n results.push(this._emissiveTexture);\n }\n if (this._metallicTexture && this._metallicTexture.animations && this._metallicTexture.animations.length > 0) {\n results.push(this._metallicTexture);\n }\n else if (this._reflectivityTexture && this._reflectivityTexture.animations && this._reflectivityTexture.animations.length > 0) {\n results.push(this._reflectivityTexture);\n }\n if (this._bumpTexture && this._bumpTexture.animations && this._bumpTexture.animations.length > 0) {\n results.push(this._bumpTexture);\n }\n if (this._lightmapTexture && this._lightmapTexture.animations && this._lightmapTexture.animations.length > 0) {\n results.push(this._lightmapTexture);\n }\n if (this._metallicReflectanceTexture && this._metallicReflectanceTexture.animations && this._metallicReflectanceTexture.animations.length > 0) {\n results.push(this._metallicReflectanceTexture);\n }\n if (this._reflectanceTexture && this._reflectanceTexture.animations && this._reflectanceTexture.animations.length > 0) {\n results.push(this._reflectanceTexture);\n }\n if (this._microSurfaceTexture && this._microSurfaceTexture.animations && this._microSurfaceTexture.animations.length > 0) {\n results.push(this._microSurfaceTexture);\n }\n return results;\n }\n /**\n * Returns the texture used for reflections.\n * @returns - Reflection texture if present. Otherwise, returns the environment texture.\n */\n _getReflectionTexture() {\n if (this._reflectionTexture) {\n return this._reflectionTexture;\n }\n return this.getScene().environmentTexture;\n }\n /**\n * Returns an array of the actively used textures.\n * @returns - Array of BaseTextures\n */\n getActiveTextures() {\n const activeTextures = super.getActiveTextures();\n if (this._albedoTexture) {\n activeTextures.push(this._albedoTexture);\n }\n if (this._ambientTexture) {\n activeTextures.push(this._ambientTexture);\n }\n if (this._opacityTexture) {\n activeTextures.push(this._opacityTexture);\n }\n if (this._reflectionTexture) {\n activeTextures.push(this._reflectionTexture);\n }\n if (this._emissiveTexture) {\n activeTextures.push(this._emissiveTexture);\n }\n if (this._reflectivityTexture) {\n activeTextures.push(this._reflectivityTexture);\n }\n if (this._metallicTexture) {\n activeTextures.push(this._metallicTexture);\n }\n if (this._metallicReflectanceTexture) {\n activeTextures.push(this._metallicReflectanceTexture);\n }\n if (this._reflectanceTexture) {\n activeTextures.push(this._reflectanceTexture);\n }\n if (this._microSurfaceTexture) {\n activeTextures.push(this._microSurfaceTexture);\n }\n if (this._bumpTexture) {\n activeTextures.push(this._bumpTexture);\n }\n if (this._lightmapTexture) {\n activeTextures.push(this._lightmapTexture);\n }\n return activeTextures;\n }\n /**\n * Checks to see if a texture is used in the material.\n * @param texture - Base texture to use.\n * @returns - Boolean specifying if a texture is used in the material.\n */\n hasTexture(texture) {\n if (super.hasTexture(texture)) {\n return true;\n }\n if (this._albedoTexture === texture) {\n return true;\n }\n if (this._ambientTexture === texture) {\n return true;\n }\n if (this._opacityTexture === texture) {\n return true;\n }\n if (this._reflectionTexture === texture) {\n return true;\n }\n if (this._emissiveTexture === texture) {\n return true;\n }\n if (this._reflectivityTexture === texture) {\n return true;\n }\n if (this._metallicTexture === texture) {\n return true;\n }\n if (this._metallicReflectanceTexture === texture) {\n return true;\n }\n if (this._reflectanceTexture === texture) {\n return true;\n }\n if (this._microSurfaceTexture === texture) {\n return true;\n }\n if (this._bumpTexture === texture) {\n return true;\n }\n if (this._lightmapTexture === texture) {\n return true;\n }\n return false;\n }\n /**\n * Sets the required values to the prepass renderer.\n * It can't be sets when subsurface scattering of this material is disabled.\n * When scene have ability to enable subsurface prepass effect, it will enable.\n */\n setPrePassRenderer() {\n var _a;\n if (!((_a = this.subSurface) === null || _a === void 0 ? void 0 : _a.isScatteringEnabled)) {\n return false;\n }\n const subSurfaceConfiguration = this.getScene().enableSubSurfaceForPrePass();\n if (subSurfaceConfiguration) {\n subSurfaceConfiguration.enabled = true;\n }\n return true;\n }\n /**\n * Disposes the resources of the material.\n * @param forceDisposeEffect - Forces the disposal of effects.\n * @param forceDisposeTextures - Forces the disposal of all textures.\n */\n dispose(forceDisposeEffect, forceDisposeTextures) {\n var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;\n if (forceDisposeTextures) {\n if (this._environmentBRDFTexture && this.getScene().environmentBRDFTexture !== this._environmentBRDFTexture) {\n this._environmentBRDFTexture.dispose();\n }\n (_a = this._albedoTexture) === null || _a === void 0 ? void 0 : _a.dispose();\n (_b = this._ambientTexture) === null || _b === void 0 ? void 0 : _b.dispose();\n (_c = this._opacityTexture) === null || _c === void 0 ? void 0 : _c.dispose();\n (_d = this._reflectionTexture) === null || _d === void 0 ? void 0 : _d.dispose();\n (_e = this._emissiveTexture) === null || _e === void 0 ? void 0 : _e.dispose();\n (_f = this._metallicTexture) === null || _f === void 0 ? void 0 : _f.dispose();\n (_g = this._reflectivityTexture) === null || _g === void 0 ? void 0 : _g.dispose();\n (_h = this._bumpTexture) === null || _h === void 0 ? void 0 : _h.dispose();\n (_j = this._lightmapTexture) === null || _j === void 0 ? void 0 : _j.dispose();\n (_k = this._metallicReflectanceTexture) === null || _k === void 0 ? void 0 : _k.dispose();\n (_l = this._reflectanceTexture) === null || _l === void 0 ? void 0 : _l.dispose();\n (_m = this._microSurfaceTexture) === null || _m === void 0 ? void 0 : _m.dispose();\n }\n this._renderTargets.dispose();\n if (this._imageProcessingConfiguration && this._imageProcessingObserver) {\n this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver);\n }\n super.dispose(forceDisposeEffect, forceDisposeTextures);\n }\n}\n/**\n * PBRMaterialTransparencyMode: No transparency mode, Alpha channel is not use.\n */\nPBRBaseMaterial.PBRMATERIAL_OPAQUE = Material.MATERIAL_OPAQUE;\n/**\n * PBRMaterialTransparencyMode: Alpha Test mode, pixel are discarded below a certain threshold defined by the alpha cutoff value.\n */\nPBRBaseMaterial.PBRMATERIAL_ALPHATEST = Material.MATERIAL_ALPHATEST;\n/**\n * PBRMaterialTransparencyMode: Pixels are blended (according to the alpha mode) with the already drawn pixels in the current frame buffer.\n */\nPBRBaseMaterial.PBRMATERIAL_ALPHABLEND = Material.MATERIAL_ALPHABLEND;\n/**\n * PBRMaterialTransparencyMode: Pixels are blended (according to the alpha mode) with the already drawn pixels in the current frame buffer.\n * They are also discarded below the alpha cutoff threshold to improve performances.\n */\nPBRBaseMaterial.PBRMATERIAL_ALPHATESTANDBLEND = Material.MATERIAL_ALPHATESTANDBLEND;\n/**\n * Defines the default value of how much AO map is occluding the analytical lights\n * (point spot...).\n */\nPBRBaseMaterial.DEFAULT_AO_ON_ANALYTICAL_LIGHTS = 0;\n/**\n * PBRMaterialLightFalloff Physical: light is falling off following the inverse squared distance law.\n */\nPBRBaseMaterial.LIGHTFALLOFF_PHYSICAL = 0;\n/**\n * PBRMaterialLightFalloff gltf: light is falling off as described in the gltf moving to PBR document\n * to enhance interoperability with other engines.\n */\nPBRBaseMaterial.LIGHTFALLOFF_GLTF = 1;\n/**\n * PBRMaterialLightFalloff Standard: light is falling off like in the standard material\n * to enhance interoperability with other materials.\n */\nPBRBaseMaterial.LIGHTFALLOFF_STANDARD = 2;\n__decorate([\n serializeAsImageProcessingConfiguration()\n], PBRBaseMaterial.prototype, \"_imageProcessingConfiguration\", void 0);\n__decorate([\n expandToProperty(\"_markAllSubMeshesAsMiscDirty\")\n], PBRBaseMaterial.prototype, \"debugMode\", void 0);\n__decorate([\n serialize()\n], PBRBaseMaterial.prototype, \"useLogarithmicDepth\", null);\n//# sourceMappingURL=pbrBaseMaterial.js.map","import { __decorate } from \"../../tslib.es6.js\";\nimport { serialize, SerializationHelper, serializeAsColor3, expandToProperty, serializeAsTexture } from \"../../Misc/decorators.js\";\nimport { GetEnvironmentBRDFTexture } from \"../../Misc/brdfTextureTools.js\";\nimport { Color3 } from \"../../Maths/math.color.js\";\nimport { PBRBaseMaterial } from \"./pbrBaseMaterial.js\";\nimport { RegisterClass } from \"../../Misc/typeStore.js\";\nimport { Material } from \"../material.js\";\n/**\n * The Physically based material of BJS.\n *\n * This offers the main features of a standard PBR material.\n * For more information, please refer to the documentation :\n * https://doc.babylonjs.com/features/featuresDeepDive/materials/using/introToPBR\n */\nexport class PBRMaterial extends PBRBaseMaterial {\n /**\n * Stores the refracted light information in a texture.\n */\n get refractionTexture() {\n return this.subSurface.refractionTexture;\n }\n set refractionTexture(value) {\n this.subSurface.refractionTexture = value;\n if (value) {\n this.subSurface.isRefractionEnabled = true;\n }\n else if (!this.subSurface.linkRefractionWithTransparency) {\n this.subSurface.isRefractionEnabled = false;\n }\n }\n /**\n * Index of refraction of the material base layer.\n * https://en.wikipedia.org/wiki/List_of_refractive_indices\n *\n * This does not only impact refraction but also the Base F0 of Dielectric Materials.\n *\n * From dielectric fresnel rules: F0 = square((iorT - iorI) / (iorT + iorI))\n */\n get indexOfRefraction() {\n return this.subSurface.indexOfRefraction;\n }\n set indexOfRefraction(value) {\n this.subSurface.indexOfRefraction = value;\n }\n /**\n * Controls if refraction needs to be inverted on Y. This could be useful for procedural texture.\n */\n get invertRefractionY() {\n return this.subSurface.invertRefractionY;\n }\n set invertRefractionY(value) {\n this.subSurface.invertRefractionY = value;\n }\n /**\n * This parameters will make the material used its opacity to control how much it is refracting against not.\n * Materials half opaque for instance using refraction could benefit from this control.\n */\n get linkRefractionWithTransparency() {\n return this.subSurface.linkRefractionWithTransparency;\n }\n set linkRefractionWithTransparency(value) {\n this.subSurface.linkRefractionWithTransparency = value;\n if (value) {\n this.subSurface.isRefractionEnabled = true;\n }\n }\n /**\n * BJS is using an hardcoded light falloff based on a manually sets up range.\n * In PBR, one way to represents the falloff is to use the inverse squared root algorithm.\n * This parameter can help you switch back to the BJS mode in order to create scenes using both materials.\n */\n get usePhysicalLightFalloff() {\n return this._lightFalloff === PBRBaseMaterial.LIGHTFALLOFF_PHYSICAL;\n }\n /**\n * BJS is using an hardcoded light falloff based on a manually sets up range.\n * In PBR, one way to represents the falloff is to use the inverse squared root algorithm.\n * This parameter can help you switch back to the BJS mode in order to create scenes using both materials.\n */\n set usePhysicalLightFalloff(value) {\n if (value !== this.usePhysicalLightFalloff) {\n // Ensure the effect will be rebuilt.\n this._markAllSubMeshesAsTexturesDirty();\n if (value) {\n this._lightFalloff = PBRBaseMaterial.LIGHTFALLOFF_PHYSICAL;\n }\n else {\n this._lightFalloff = PBRBaseMaterial.LIGHTFALLOFF_STANDARD;\n }\n }\n }\n /**\n * In order to support the falloff compatibility with gltf, a special mode has been added\n * to reproduce the gltf light falloff.\n */\n get useGLTFLightFalloff() {\n return this._lightFalloff === PBRBaseMaterial.LIGHTFALLOFF_GLTF;\n }\n /**\n * In order to support the falloff compatibility with gltf, a special mode has been added\n * to reproduce the gltf light falloff.\n */\n set useGLTFLightFalloff(value) {\n if (value !== this.useGLTFLightFalloff) {\n // Ensure the effect will be rebuilt.\n this._markAllSubMeshesAsTexturesDirty();\n if (value) {\n this._lightFalloff = PBRBaseMaterial.LIGHTFALLOFF_GLTF;\n }\n else {\n this._lightFalloff = PBRBaseMaterial.LIGHTFALLOFF_STANDARD;\n }\n }\n }\n /**\n * Gets the image processing configuration used either in this material.\n */\n get imageProcessingConfiguration() {\n return this._imageProcessingConfiguration;\n }\n /**\n * Sets the Default image processing configuration used either in the this material.\n *\n * If sets to null, the scene one is in use.\n */\n set imageProcessingConfiguration(value) {\n this._attachImageProcessingConfiguration(value);\n // Ensure the effect will be rebuilt.\n this._markAllSubMeshesAsTexturesDirty();\n }\n /**\n * Gets whether the color curves effect is enabled.\n */\n get cameraColorCurvesEnabled() {\n return this.imageProcessingConfiguration.colorCurvesEnabled;\n }\n /**\n * Sets whether the color curves effect is enabled.\n */\n set cameraColorCurvesEnabled(value) {\n this.imageProcessingConfiguration.colorCurvesEnabled = value;\n }\n /**\n * Gets whether the color grading effect is enabled.\n */\n get cameraColorGradingEnabled() {\n return this.imageProcessingConfiguration.colorGradingEnabled;\n }\n /**\n * Gets whether the color grading effect is enabled.\n */\n set cameraColorGradingEnabled(value) {\n this.imageProcessingConfiguration.colorGradingEnabled = value;\n }\n /**\n * Gets whether tonemapping is enabled or not.\n */\n get cameraToneMappingEnabled() {\n return this._imageProcessingConfiguration.toneMappingEnabled;\n }\n /**\n * Sets whether tonemapping is enabled or not\n */\n set cameraToneMappingEnabled(value) {\n this._imageProcessingConfiguration.toneMappingEnabled = value;\n }\n /**\n * The camera exposure used on this material.\n * This property is here and not in the camera to allow controlling exposure without full screen post process.\n * This corresponds to a photographic exposure.\n */\n get cameraExposure() {\n return this._imageProcessingConfiguration.exposure;\n }\n /**\n * The camera exposure used on this material.\n * This property is here and not in the camera to allow controlling exposure without full screen post process.\n * This corresponds to a photographic exposure.\n */\n set cameraExposure(value) {\n this._imageProcessingConfiguration.exposure = value;\n }\n /**\n * Gets The camera contrast used on this material.\n */\n get cameraContrast() {\n return this._imageProcessingConfiguration.contrast;\n }\n /**\n * Sets The camera contrast used on this material.\n */\n set cameraContrast(value) {\n this._imageProcessingConfiguration.contrast = value;\n }\n /**\n * Gets the Color Grading 2D Lookup Texture.\n */\n get cameraColorGradingTexture() {\n return this._imageProcessingConfiguration.colorGradingTexture;\n }\n /**\n * Sets the Color Grading 2D Lookup Texture.\n */\n set cameraColorGradingTexture(value) {\n this._imageProcessingConfiguration.colorGradingTexture = value;\n }\n /**\n * The color grading curves provide additional color adjustment that is applied after any color grading transform (3D LUT).\n * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.\n * These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image;\n * corresponding to low luminance, medium luminance, and high luminance areas respectively.\n */\n get cameraColorCurves() {\n return this._imageProcessingConfiguration.colorCurves;\n }\n /**\n * The color grading curves provide additional color adjustment that is applied after any color grading transform (3D LUT).\n * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.\n * These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image;\n * corresponding to low luminance, medium luminance, and high luminance areas respectively.\n */\n set cameraColorCurves(value) {\n this._imageProcessingConfiguration.colorCurves = value;\n }\n /**\n * Instantiates a new PBRMaterial instance.\n *\n * @param name The material name\n * @param scene The scene the material will be use in.\n */\n constructor(name, scene) {\n super(name, scene);\n /**\n * Intensity of the direct lights e.g. the four lights available in your scene.\n * This impacts both the direct diffuse and specular highlights.\n */\n this.directIntensity = 1.0;\n /**\n * Intensity of the emissive part of the material.\n * This helps controlling the emissive effect without modifying the emissive color.\n */\n this.emissiveIntensity = 1.0;\n /**\n * Intensity of the environment e.g. how much the environment will light the object\n * either through harmonics for rough material or through the reflection for shiny ones.\n */\n this.environmentIntensity = 1.0;\n /**\n * This is a special control allowing the reduction of the specular highlights coming from the\n * four lights of the scene. Those highlights may not be needed in full environment lighting.\n */\n this.specularIntensity = 1.0;\n /**\n * Debug Control allowing disabling the bump map on this material.\n */\n this.disableBumpMap = false;\n /**\n * AKA Occlusion Texture Intensity in other nomenclature.\n */\n this.ambientTextureStrength = 1.0;\n /**\n * Defines how much the AO map is occluding the analytical lights (point spot...).\n * 1 means it completely occludes it\n * 0 mean it has no impact\n */\n this.ambientTextureImpactOnAnalyticalLights = PBRMaterial.DEFAULT_AO_ON_ANALYTICAL_LIGHTS;\n /**\n * In metallic workflow, specifies an F0 factor to help configuring the material F0.\n * By default the indexOfrefraction is used to compute F0;\n *\n * This is used as a factor against the default reflectance at normal incidence to tweak it.\n *\n * F0 = defaultF0 * metallicF0Factor * metallicReflectanceColor;\n * F90 = metallicReflectanceColor;\n */\n this.metallicF0Factor = 1;\n /**\n * In metallic workflow, specifies an F0 color.\n * By default the F90 is always 1;\n *\n * Please note that this factor is also used as a factor against the default reflectance at normal incidence.\n *\n * F0 = defaultF0_from_IOR * metallicF0Factor * metallicReflectanceColor\n * F90 = metallicF0Factor;\n */\n this.metallicReflectanceColor = Color3.White();\n /**\n * Specifies that only the A channel from metallicReflectanceTexture should be used.\n * If false, both RGB and A channels will be used\n */\n this.useOnlyMetallicFromMetallicReflectanceTexture = false;\n /**\n * The color of a material in ambient lighting.\n */\n this.ambientColor = new Color3(0, 0, 0);\n /**\n * AKA Diffuse Color in other nomenclature.\n */\n this.albedoColor = new Color3(1, 1, 1);\n /**\n * AKA Specular Color in other nomenclature.\n */\n this.reflectivityColor = new Color3(1, 1, 1);\n /**\n * The color reflected from the material.\n */\n this.reflectionColor = new Color3(1.0, 1.0, 1.0);\n /**\n * The color emitted from the material.\n */\n this.emissiveColor = new Color3(0, 0, 0);\n /**\n * AKA Glossiness in other nomenclature.\n */\n this.microSurface = 1.0;\n /**\n * If true, the light map contains occlusion information instead of lighting info.\n */\n this.useLightmapAsShadowmap = false;\n /**\n * Specifies that the alpha is coming form the albedo channel alpha channel for alpha blending.\n */\n this.useAlphaFromAlbedoTexture = false;\n /**\n * Enforces alpha test in opaque or blend mode in order to improve the performances of some situations.\n */\n this.forceAlphaTest = false;\n /**\n * Defines the alpha limits in alpha test mode.\n */\n this.alphaCutOff = 0.4;\n /**\n * Specifies that the material will keep the specular highlights over a transparent surface (only the most luminous ones).\n * A car glass is a good example of that. When sun reflects on it you can not see what is behind.\n */\n this.useSpecularOverAlpha = true;\n /**\n * Specifies if the reflectivity texture contains the glossiness information in its alpha channel.\n */\n this.useMicroSurfaceFromReflectivityMapAlpha = false;\n /**\n * Specifies if the metallic texture contains the roughness information in its alpha channel.\n */\n this.useRoughnessFromMetallicTextureAlpha = true;\n /**\n * Specifies if the metallic texture contains the roughness information in its green channel.\n */\n this.useRoughnessFromMetallicTextureGreen = false;\n /**\n * Specifies if the metallic texture contains the metallness information in its blue channel.\n */\n this.useMetallnessFromMetallicTextureBlue = false;\n /**\n * Specifies if the metallic texture contains the ambient occlusion information in its red channel.\n */\n this.useAmbientOcclusionFromMetallicTextureRed = false;\n /**\n * Specifies if the ambient texture contains the ambient occlusion information in its red channel only.\n */\n this.useAmbientInGrayScale = false;\n /**\n * In case the reflectivity map does not contain the microsurface information in its alpha channel,\n * The material will try to infer what glossiness each pixel should be.\n */\n this.useAutoMicroSurfaceFromReflectivityMap = false;\n /**\n * Specifies that the material will keeps the reflection highlights over a transparent surface (only the most luminous ones).\n * A car glass is a good example of that. When the street lights reflects on it you can not see what is behind.\n */\n this.useRadianceOverAlpha = true;\n /**\n * Allows using an object space normal map (instead of tangent space).\n */\n this.useObjectSpaceNormalMap = false;\n /**\n * Allows using the bump map in parallax mode.\n */\n this.useParallax = false;\n /**\n * Allows using the bump map in parallax occlusion mode.\n */\n this.useParallaxOcclusion = false;\n /**\n * Controls the scale bias of the parallax mode.\n */\n this.parallaxScaleBias = 0.05;\n /**\n * If sets to true, disables all the lights affecting the material.\n */\n this.disableLighting = false;\n /**\n * Force the shader to compute irradiance in the fragment shader in order to take bump in account.\n */\n this.forceIrradianceInFragment = false;\n /**\n * Number of Simultaneous lights allowed on the material.\n */\n this.maxSimultaneousLights = 4;\n /**\n * If sets to true, x component of normal map value will invert (x = 1.0 - x).\n */\n this.invertNormalMapX = false;\n /**\n * If sets to true, y component of normal map value will invert (y = 1.0 - y).\n */\n this.invertNormalMapY = false;\n /**\n * If sets to true and backfaceCulling is false, normals will be flipped on the backside.\n */\n this.twoSidedLighting = false;\n /**\n * A fresnel is applied to the alpha of the model to ensure grazing angles edges are not alpha tested.\n * And/Or occlude the blended part. (alpha is converted to gamma to compute the fresnel)\n */\n this.useAlphaFresnel = false;\n /**\n * A fresnel is applied to the alpha of the model to ensure grazing angles edges are not alpha tested.\n * And/Or occlude the blended part. (alpha stays linear to compute the fresnel)\n */\n this.useLinearAlphaFresnel = false;\n /**\n * Let user defines the brdf lookup texture used for IBL.\n * A default 8bit version is embedded but you could point at :\n * * Default texture: https://assets.babylonjs.com/environments/correlatedMSBRDF_RGBD.png\n * * Default 16bit pixel depth texture: https://assets.babylonjs.com/environments/correlatedMSBRDF.dds\n * * LEGACY Default None correlated https://assets.babylonjs.com/environments/uncorrelatedBRDF_RGBD.png\n * * LEGACY Default None correlated 16bit pixel depth https://assets.babylonjs.com/environments/uncorrelatedBRDF.dds\n */\n this.environmentBRDFTexture = null;\n /**\n * Force normal to face away from face.\n */\n this.forceNormalForward = false;\n /**\n * Enables specular anti aliasing in the PBR shader.\n * It will both interacts on the Geometry for analytical and IBL lighting.\n * It also prefilter the roughness map based on the bump values.\n */\n this.enableSpecularAntiAliasing = false;\n /**\n * This parameters will enable/disable Horizon occlusion to prevent normal maps to look shiny when the normal\n * makes the reflect vector face the model (under horizon).\n */\n this.useHorizonOcclusion = true;\n /**\n * This parameters will enable/disable radiance occlusion by preventing the radiance to lit\n * too much the area relying on ambient texture to define their ambient occlusion.\n */\n this.useRadianceOcclusion = true;\n /**\n * If set to true, no lighting calculations will be applied.\n */\n this.unlit = false;\n /**\n * If sets to true, the decal map will be applied after the detail map. Else, it is applied before (default: false)\n */\n this.applyDecalMapAfterDetailMap = false;\n this._environmentBRDFTexture = GetEnvironmentBRDFTexture(this.getScene());\n }\n /**\n * Returns the name of this material class.\n */\n getClassName() {\n return \"PBRMaterial\";\n }\n /**\n * Makes a duplicate of the current material.\n * @param name - name to use for the new material.\n * @param cloneTexturesOnlyOnce - if a texture is used in more than one channel (e.g diffuse and opacity), only clone it once and reuse it on the other channels. Default false.\n * @param rootUrl defines the root URL to use to load textures\n */\n clone(name, cloneTexturesOnlyOnce = true, rootUrl = \"\") {\n const clone = SerializationHelper.Clone(() => new PBRMaterial(name, this.getScene()), this, { cloneTexturesOnlyOnce });\n clone.id = name;\n clone.name = name;\n this.stencil.copyTo(clone.stencil);\n this._clonePlugins(clone, rootUrl);\n return clone;\n }\n /**\n * Serializes this PBR Material.\n * @returns - An object with the serialized material.\n */\n serialize() {\n const serializationObject = super.serialize();\n serializationObject.customType = \"BABYLON.PBRMaterial\";\n return serializationObject;\n }\n // Statics\n /**\n * Parses a PBR Material from a serialized object.\n * @param source - Serialized object.\n * @param scene - BJS scene instance.\n * @param rootUrl - url for the scene object\n * @returns - PBRMaterial\n */\n static Parse(source, scene, rootUrl) {\n const material = SerializationHelper.Parse(() => new PBRMaterial(source.name, scene), source, scene, rootUrl);\n if (source.stencil) {\n material.stencil.parse(source.stencil, scene, rootUrl);\n }\n Material._parsePlugins(source, material, scene, rootUrl);\n // The code block below ensures backward compatibility with serialized materials before plugins are automatically serialized.\n if (source.clearCoat) {\n material.clearCoat.parse(source.clearCoat, scene, rootUrl);\n }\n if (source.anisotropy) {\n material.anisotropy.parse(source.anisotropy, scene, rootUrl);\n }\n if (source.brdf) {\n material.brdf.parse(source.brdf, scene, rootUrl);\n }\n if (source.sheen) {\n material.sheen.parse(source.sheen, scene, rootUrl);\n }\n if (source.subSurface) {\n material.subSurface.parse(source.subSurface, scene, rootUrl);\n }\n if (source.iridescence) {\n material.iridescence.parse(source.iridescence, scene, rootUrl);\n }\n return material;\n }\n}\n/**\n * PBRMaterialTransparencyMode: No transparency mode, Alpha channel is not use.\n */\nPBRMaterial.PBRMATERIAL_OPAQUE = PBRBaseMaterial.PBRMATERIAL_OPAQUE;\n/**\n * PBRMaterialTransparencyMode: Alpha Test mode, pixel are discarded below a certain threshold defined by the alpha cutoff value.\n */\nPBRMaterial.PBRMATERIAL_ALPHATEST = PBRBaseMaterial.PBRMATERIAL_ALPHATEST;\n/**\n * PBRMaterialTransparencyMode: Pixels are blended (according to the alpha mode) with the already drawn pixels in the current frame buffer.\n */\nPBRMaterial.PBRMATERIAL_ALPHABLEND = PBRBaseMaterial.PBRMATERIAL_ALPHABLEND;\n/**\n * PBRMaterialTransparencyMode: Pixels are blended (according to the alpha mode) with the already drawn pixels in the current frame buffer.\n * They are also discarded below the alpha cutoff threshold to improve performances.\n */\nPBRMaterial.PBRMATERIAL_ALPHATESTANDBLEND = PBRBaseMaterial.PBRMATERIAL_ALPHATESTANDBLEND;\n/**\n * Defines the default value of how much AO map is occluding the analytical lights\n * (point spot...).\n */\nPBRMaterial.DEFAULT_AO_ON_ANALYTICAL_LIGHTS = PBRBaseMaterial.DEFAULT_AO_ON_ANALYTICAL_LIGHTS;\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRMaterial.prototype, \"directIntensity\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRMaterial.prototype, \"emissiveIntensity\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRMaterial.prototype, \"environmentIntensity\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRMaterial.prototype, \"specularIntensity\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRMaterial.prototype, \"disableBumpMap\", void 0);\n__decorate([\n serializeAsTexture(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRMaterial.prototype, \"albedoTexture\", void 0);\n__decorate([\n serializeAsTexture(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRMaterial.prototype, \"ambientTexture\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRMaterial.prototype, \"ambientTextureStrength\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRMaterial.prototype, \"ambientTextureImpactOnAnalyticalLights\", void 0);\n__decorate([\n serializeAsTexture(),\n expandToProperty(\"_markAllSubMeshesAsTexturesAndMiscDirty\")\n], PBRMaterial.prototype, \"opacityTexture\", void 0);\n__decorate([\n serializeAsTexture(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRMaterial.prototype, \"reflectionTexture\", void 0);\n__decorate([\n serializeAsTexture(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRMaterial.prototype, \"emissiveTexture\", void 0);\n__decorate([\n serializeAsTexture(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRMaterial.prototype, \"reflectivityTexture\", void 0);\n__decorate([\n serializeAsTexture(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRMaterial.prototype, \"metallicTexture\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRMaterial.prototype, \"metallic\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRMaterial.prototype, \"roughness\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRMaterial.prototype, \"metallicF0Factor\", void 0);\n__decorate([\n serializeAsColor3(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRMaterial.prototype, \"metallicReflectanceColor\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRMaterial.prototype, \"useOnlyMetallicFromMetallicReflectanceTexture\", void 0);\n__decorate([\n serializeAsTexture(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRMaterial.prototype, \"metallicReflectanceTexture\", void 0);\n__decorate([\n serializeAsTexture(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRMaterial.prototype, \"reflectanceTexture\", void 0);\n__decorate([\n serializeAsTexture(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRMaterial.prototype, \"microSurfaceTexture\", void 0);\n__decorate([\n serializeAsTexture(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRMaterial.prototype, \"bumpTexture\", void 0);\n__decorate([\n serializeAsTexture(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\", null)\n], PBRMaterial.prototype, \"lightmapTexture\", void 0);\n__decorate([\n serializeAsColor3(\"ambient\"),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRMaterial.prototype, \"ambientColor\", void 0);\n__decorate([\n serializeAsColor3(\"albedo\"),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRMaterial.prototype, \"albedoColor\", void 0);\n__decorate([\n serializeAsColor3(\"reflectivity\"),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRMaterial.prototype, \"reflectivityColor\", void 0);\n__decorate([\n serializeAsColor3(\"reflection\"),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRMaterial.prototype, \"reflectionColor\", void 0);\n__decorate([\n serializeAsColor3(\"emissive\"),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRMaterial.prototype, \"emissiveColor\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRMaterial.prototype, \"microSurface\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRMaterial.prototype, \"useLightmapAsShadowmap\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsTexturesAndMiscDirty\")\n], PBRMaterial.prototype, \"useAlphaFromAlbedoTexture\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsTexturesAndMiscDirty\")\n], PBRMaterial.prototype, \"forceAlphaTest\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsTexturesAndMiscDirty\")\n], PBRMaterial.prototype, \"alphaCutOff\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRMaterial.prototype, \"useSpecularOverAlpha\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRMaterial.prototype, \"useMicroSurfaceFromReflectivityMapAlpha\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRMaterial.prototype, \"useRoughnessFromMetallicTextureAlpha\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRMaterial.prototype, \"useRoughnessFromMetallicTextureGreen\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRMaterial.prototype, \"useMetallnessFromMetallicTextureBlue\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRMaterial.prototype, \"useAmbientOcclusionFromMetallicTextureRed\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRMaterial.prototype, \"useAmbientInGrayScale\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRMaterial.prototype, \"useAutoMicroSurfaceFromReflectivityMap\", void 0);\n__decorate([\n serialize()\n], PBRMaterial.prototype, \"usePhysicalLightFalloff\", null);\n__decorate([\n serialize()\n], PBRMaterial.prototype, \"useGLTFLightFalloff\", null);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRMaterial.prototype, \"useRadianceOverAlpha\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRMaterial.prototype, \"useObjectSpaceNormalMap\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRMaterial.prototype, \"useParallax\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRMaterial.prototype, \"useParallaxOcclusion\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRMaterial.prototype, \"parallaxScaleBias\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\n], PBRMaterial.prototype, \"disableLighting\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRMaterial.prototype, \"forceIrradianceInFragment\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\n], PBRMaterial.prototype, \"maxSimultaneousLights\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRMaterial.prototype, \"invertNormalMapX\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRMaterial.prototype, \"invertNormalMapY\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRMaterial.prototype, \"twoSidedLighting\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRMaterial.prototype, \"useAlphaFresnel\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRMaterial.prototype, \"useLinearAlphaFresnel\", void 0);\n__decorate([\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRMaterial.prototype, \"environmentBRDFTexture\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRMaterial.prototype, \"forceNormalForward\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRMaterial.prototype, \"enableSpecularAntiAliasing\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRMaterial.prototype, \"useHorizonOcclusion\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\n], PBRMaterial.prototype, \"useRadianceOcclusion\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsMiscDirty\")\n], PBRMaterial.prototype, \"unlit\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsMiscDirty\")\n], PBRMaterial.prototype, \"applyDecalMapAfterDetailMap\", void 0);\nRegisterClass(\"BABYLON.PBRMaterial\", PBRMaterial);\n//# sourceMappingURL=pbrMaterial.js.map","import { __decorate } from \"../tslib.es6.js\";\nimport { Observable } from \"../Misc/observable.js\";\nimport { EngineStore } from \"../Engines/engineStore.js\";\nimport { VertexBuffer } from \"../Buffers/buffer.js\";\nimport { serialize, SerializationHelper } from \"../Misc/decorators.js\";\nimport { GetClass } from \"../Misc/typeStore.js\";\n/**\n * Defines a target to use with MorphTargetManager\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/morphTargets\n */\nexport class MorphTarget {\n /**\n * Gets or sets the influence of this target (ie. its weight in the overall morphing)\n */\n get influence() {\n return this._influence;\n }\n set influence(influence) {\n if (this._influence === influence) {\n return;\n }\n const previous = this._influence;\n this._influence = influence;\n if (this.onInfluenceChanged.hasObservers()) {\n this.onInfluenceChanged.notifyObservers(previous === 0 || influence === 0);\n }\n }\n /**\n * Gets or sets the animation properties override\n */\n get animationPropertiesOverride() {\n if (!this._animationPropertiesOverride && this._scene) {\n return this._scene.animationPropertiesOverride;\n }\n return this._animationPropertiesOverride;\n }\n set animationPropertiesOverride(value) {\n this._animationPropertiesOverride = value;\n }\n /**\n * Creates a new MorphTarget\n * @param name defines the name of the target\n * @param influence defines the influence to use\n * @param scene defines the scene the morphtarget belongs to\n */\n constructor(\n /** defines the name of the target */\n name, influence = 0, scene = null) {\n this.name = name;\n /**\n * Gets or sets the list of animations\n */\n this.animations = new Array();\n this._positions = null;\n this._normals = null;\n this._tangents = null;\n this._uvs = null;\n this._uniqueId = 0;\n /**\n * Observable raised when the influence changes\n */\n this.onInfluenceChanged = new Observable();\n /** @internal */\n this._onDataLayoutChanged = new Observable();\n this._animationPropertiesOverride = null;\n this._scene = scene || EngineStore.LastCreatedScene;\n this.influence = influence;\n if (this._scene) {\n this._uniqueId = this._scene.getUniqueId();\n }\n }\n /**\n * Gets the unique ID of this manager\n */\n get uniqueId() {\n return this._uniqueId;\n }\n /**\n * Gets a boolean defining if the target contains position data\n */\n get hasPositions() {\n return !!this._positions;\n }\n /**\n * Gets a boolean defining if the target contains normal data\n */\n get hasNormals() {\n return !!this._normals;\n }\n /**\n * Gets a boolean defining if the target contains tangent data\n */\n get hasTangents() {\n return !!this._tangents;\n }\n /**\n * Gets a boolean defining if the target contains texture coordinates data\n */\n get hasUVs() {\n return !!this._uvs;\n }\n /**\n * Affects position data to this target\n * @param data defines the position data to use\n */\n setPositions(data) {\n const hadPositions = this.hasPositions;\n this._positions = data;\n if (hadPositions !== this.hasPositions) {\n this._onDataLayoutChanged.notifyObservers(undefined);\n }\n }\n /**\n * Gets the position data stored in this target\n * @returns a FloatArray containing the position data (or null if not present)\n */\n getPositions() {\n return this._positions;\n }\n /**\n * Affects normal data to this target\n * @param data defines the normal data to use\n */\n setNormals(data) {\n const hadNormals = this.hasNormals;\n this._normals = data;\n if (hadNormals !== this.hasNormals) {\n this._onDataLayoutChanged.notifyObservers(undefined);\n }\n }\n /**\n * Gets the normal data stored in this target\n * @returns a FloatArray containing the normal data (or null if not present)\n */\n getNormals() {\n return this._normals;\n }\n /**\n * Affects tangent data to this target\n * @param data defines the tangent data to use\n */\n setTangents(data) {\n const hadTangents = this.hasTangents;\n this._tangents = data;\n if (hadTangents !== this.hasTangents) {\n this._onDataLayoutChanged.notifyObservers(undefined);\n }\n }\n /**\n * Gets the tangent data stored in this target\n * @returns a FloatArray containing the tangent data (or null if not present)\n */\n getTangents() {\n return this._tangents;\n }\n /**\n * Affects texture coordinates data to this target\n * @param data defines the texture coordinates data to use\n */\n setUVs(data) {\n const hadUVs = this.hasUVs;\n this._uvs = data;\n if (hadUVs !== this.hasUVs) {\n this._onDataLayoutChanged.notifyObservers(undefined);\n }\n }\n /**\n * Gets the texture coordinates data stored in this target\n * @returns a FloatArray containing the texture coordinates data (or null if not present)\n */\n getUVs() {\n return this._uvs;\n }\n /**\n * Clone the current target\n * @returns a new MorphTarget\n */\n clone() {\n const newOne = SerializationHelper.Clone(() => new MorphTarget(this.name, this.influence, this._scene), this);\n newOne._positions = this._positions;\n newOne._normals = this._normals;\n newOne._tangents = this._tangents;\n newOne._uvs = this._uvs;\n return newOne;\n }\n /**\n * Serializes the current target into a Serialization object\n * @returns the serialized object\n */\n serialize() {\n const serializationObject = {};\n serializationObject.name = this.name;\n serializationObject.influence = this.influence;\n serializationObject.positions = Array.prototype.slice.call(this.getPositions());\n if (this.id != null) {\n serializationObject.id = this.id;\n }\n if (this.hasNormals) {\n serializationObject.normals = Array.prototype.slice.call(this.getNormals());\n }\n if (this.hasTangents) {\n serializationObject.tangents = Array.prototype.slice.call(this.getTangents());\n }\n if (this.hasUVs) {\n serializationObject.uvs = Array.prototype.slice.call(this.getUVs());\n }\n // Animations\n SerializationHelper.AppendSerializedAnimations(this, serializationObject);\n return serializationObject;\n }\n /**\n * Returns the string \"MorphTarget\"\n * @returns \"MorphTarget\"\n */\n getClassName() {\n return \"MorphTarget\";\n }\n // Statics\n /**\n * Creates a new target from serialized data\n * @param serializationObject defines the serialized data to use\n * @param scene defines the hosting scene\n * @returns a new MorphTarget\n */\n static Parse(serializationObject, scene) {\n const result = new MorphTarget(serializationObject.name, serializationObject.influence);\n result.setPositions(serializationObject.positions);\n if (serializationObject.id != null) {\n result.id = serializationObject.id;\n }\n if (serializationObject.normals) {\n result.setNormals(serializationObject.normals);\n }\n if (serializationObject.tangents) {\n result.setTangents(serializationObject.tangents);\n }\n if (serializationObject.uvs) {\n result.setUVs(serializationObject.uvs);\n }\n // Animations\n if (serializationObject.animations) {\n for (let animationIndex = 0; animationIndex < serializationObject.animations.length; animationIndex++) {\n const parsedAnimation = serializationObject.animations[animationIndex];\n const internalClass = GetClass(\"BABYLON.Animation\");\n if (internalClass) {\n result.animations.push(internalClass.Parse(parsedAnimation));\n }\n }\n if (serializationObject.autoAnimate && scene) {\n scene.beginAnimation(result, serializationObject.autoAnimateFrom, serializationObject.autoAnimateTo, serializationObject.autoAnimateLoop, serializationObject.autoAnimateSpeed || 1.0);\n }\n }\n return result;\n }\n /**\n * Creates a MorphTarget from mesh data\n * @param mesh defines the source mesh\n * @param name defines the name to use for the new target\n * @param influence defines the influence to attach to the target\n * @returns a new MorphTarget\n */\n static FromMesh(mesh, name, influence) {\n if (!name) {\n name = mesh.name;\n }\n const result = new MorphTarget(name, influence, mesh.getScene());\n result.setPositions(mesh.getVerticesData(VertexBuffer.PositionKind));\n if (mesh.isVerticesDataPresent(VertexBuffer.NormalKind)) {\n result.setNormals(mesh.getVerticesData(VertexBuffer.NormalKind));\n }\n if (mesh.isVerticesDataPresent(VertexBuffer.TangentKind)) {\n result.setTangents(mesh.getVerticesData(VertexBuffer.TangentKind));\n }\n if (mesh.isVerticesDataPresent(VertexBuffer.UVKind)) {\n result.setUVs(mesh.getVerticesData(VertexBuffer.UVKind));\n }\n return result;\n }\n}\n__decorate([\n serialize()\n], MorphTarget.prototype, \"id\", void 0);\n//# sourceMappingURL=morphTarget.js.map","import { Texture } from \"./texture.js\";\n\nimport \"../../Engines/Extensions/engine.rawTexture.js\";\n/**\n * Class used to store 2D array textures containing user data\n */\nexport class RawTexture2DArray extends Texture {\n /**\n * Gets the number of layers of the texture\n */\n get depth() {\n return this._depth;\n }\n /**\n * Create a new RawTexture2DArray\n * @param data defines the data of the texture\n * @param width defines the width of the texture\n * @param height defines the height of the texture\n * @param depth defines the number of layers of the texture\n * @param format defines the texture format to use\n * @param scene defines the hosting scene\n * @param generateMipMaps defines a boolean indicating if mip levels should be generated (true by default)\n * @param invertY defines if texture must be stored with Y axis inverted\n * @param samplingMode defines the sampling mode to use (Texture.TRILINEAR_SAMPLINGMODE by default)\n * @param textureType defines the texture Type (Engine.TEXTURETYPE_UNSIGNED_INT, Engine.TEXTURETYPE_FLOAT...)\n * @param creationFlags specific flags to use when creating the texture (1 for storage textures, for eg)\n */\n constructor(data, width, height, depth, \n /** Gets or sets the texture format to use */\n format, scene, generateMipMaps = true, invertY = false, samplingMode = Texture.TRILINEAR_SAMPLINGMODE, textureType = 0, creationFlags) {\n super(null, scene, !generateMipMaps, invertY);\n this.format = format;\n this._texture = scene.getEngine().createRawTexture2DArray(data, width, height, depth, format, generateMipMaps, invertY, samplingMode, null, textureType, creationFlags);\n this._depth = depth;\n this.is2DArray = true;\n }\n /**\n * Update the texture with new data\n * @param data defines the data to store in the texture\n */\n update(data) {\n if (!this._texture) {\n return;\n }\n this._getEngine().updateRawTexture2DArray(this._texture, data, this._texture.format, this._texture.invertY, null, this._texture.type);\n }\n /**\n * Creates a RGBA texture from some data.\n * @param data Define the texture data\n * @param width Define the width of the texture\n * @param height Define the height of the texture\n * @param depth defines the number of layers of the texture\n * @param scene defines the scene the texture will belong to\n * @param generateMipMaps Define whether or not to create mip maps for the texture\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\n * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx)\n * @returns the RGBA texture\n */\n static CreateRGBATexture(data, width, height, depth, scene, generateMipMaps = true, invertY = false, samplingMode = 3, type = 0) {\n return new RawTexture2DArray(data, width, height, depth, 5, scene, generateMipMaps, invertY, samplingMode, type);\n }\n}\n//# sourceMappingURL=rawTexture2DArray.js.map","import { SmartArray } from \"../Misc/smartArray.js\";\nimport { Logger } from \"../Misc/logger.js\";\nimport { EngineStore } from \"../Engines/engineStore.js\";\nimport { MorphTarget } from \"./morphTarget.js\";\n\nimport { RawTexture2DArray } from \"../Materials/Textures/rawTexture2DArray.js\";\n/**\n * This class is used to deform meshes using morphing between different targets\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/morphTargets\n */\nexport class MorphTargetManager {\n /**\n * Sets a boolean indicating that adding new target or updating an existing target will not update the underlying data buffers\n */\n set areUpdatesFrozen(block) {\n if (block) {\n this._blockCounter++;\n }\n else {\n this._blockCounter--;\n if (this._blockCounter <= 0) {\n this._blockCounter = 0;\n this._syncActiveTargets(true);\n }\n }\n }\n get areUpdatesFrozen() {\n return this._blockCounter > 0;\n }\n /**\n * Creates a new MorphTargetManager\n * @param scene defines the current scene\n */\n constructor(scene = null) {\n this._targets = new Array();\n this._targetInfluenceChangedObservers = new Array();\n this._targetDataLayoutChangedObservers = new Array();\n this._activeTargets = new SmartArray(16);\n this._supportsNormals = false;\n this._supportsTangents = false;\n this._supportsUVs = false;\n this._vertexCount = 0;\n this._textureVertexStride = 0;\n this._textureWidth = 0;\n this._textureHeight = 1;\n this._uniqueId = 0;\n this._tempInfluences = new Array();\n this._canUseTextureForTargets = false;\n this._blockCounter = 0;\n /** @internal */\n this._parentContainer = null;\n /**\n * Gets or sets a boolean indicating if influencers must be optimized (eg. recompiling the shader if less influencers are used)\n */\n this.optimizeInfluencers = true;\n /**\n * Gets or sets a boolean indicating if normals must be morphed\n */\n this.enableNormalMorphing = true;\n /**\n * Gets or sets a boolean indicating if tangents must be morphed\n */\n this.enableTangentMorphing = true;\n /**\n * Gets or sets a boolean indicating if UV must be morphed\n */\n this.enableUVMorphing = true;\n this._useTextureToStoreTargets = true;\n if (!scene) {\n scene = EngineStore.LastCreatedScene;\n }\n this._scene = scene;\n if (this._scene) {\n this._scene.addMorphTargetManager(this);\n this._uniqueId = this._scene.getUniqueId();\n const engineCaps = this._scene.getEngine().getCaps();\n this._canUseTextureForTargets =\n engineCaps.canUseGLVertexID && engineCaps.textureFloat && engineCaps.maxVertexTextureImageUnits > 0 && engineCaps.texture2DArrayMaxLayerCount > 1;\n }\n }\n /**\n * Gets the unique ID of this manager\n */\n get uniqueId() {\n return this._uniqueId;\n }\n /**\n * Gets the number of vertices handled by this manager\n */\n get vertexCount() {\n return this._vertexCount;\n }\n /**\n * Gets a boolean indicating if this manager supports morphing of normals\n */\n get supportsNormals() {\n return this._supportsNormals && this.enableNormalMorphing;\n }\n /**\n * Gets a boolean indicating if this manager supports morphing of tangents\n */\n get supportsTangents() {\n return this._supportsTangents && this.enableTangentMorphing;\n }\n /**\n * Gets a boolean indicating if this manager supports morphing of texture coordinates\n */\n get supportsUVs() {\n return this._supportsUVs && this.enableUVMorphing;\n }\n /**\n * Gets the number of targets stored in this manager\n */\n get numTargets() {\n return this._targets.length;\n }\n /**\n * Gets the number of influencers (ie. the number of targets with influences > 0)\n */\n get numInfluencers() {\n return this._activeTargets.length;\n }\n /**\n * Gets the list of influences (one per target)\n */\n get influences() {\n return this._influences;\n }\n /**\n * Gets or sets a boolean indicating that targets should be stored as a texture instead of using vertex attributes (default is true).\n * Please note that this option is not available if the hardware does not support it\n */\n get useTextureToStoreTargets() {\n return this._useTextureToStoreTargets;\n }\n set useTextureToStoreTargets(value) {\n this._useTextureToStoreTargets = value;\n }\n /**\n * Gets a boolean indicating that the targets are stored into a texture (instead of as attributes)\n */\n get isUsingTextureForTargets() {\n var _a;\n return (MorphTargetManager.EnableTextureStorage &&\n this.useTextureToStoreTargets &&\n this._canUseTextureForTargets &&\n !((_a = this._scene) === null || _a === void 0 ? void 0 : _a.getEngine().getCaps().disableMorphTargetTexture));\n }\n /**\n * Gets the active target at specified index. An active target is a target with an influence > 0\n * @param index defines the index to check\n * @returns the requested target\n */\n getActiveTarget(index) {\n return this._activeTargets.data[index];\n }\n /**\n * Gets the target at specified index\n * @param index defines the index to check\n * @returns the requested target\n */\n getTarget(index) {\n return this._targets[index];\n }\n /**\n * Add a new target to this manager\n * @param target defines the target to add\n */\n addTarget(target) {\n this._targets.push(target);\n this._targetInfluenceChangedObservers.push(target.onInfluenceChanged.add((needUpdate) => {\n this._syncActiveTargets(needUpdate);\n }));\n this._targetDataLayoutChangedObservers.push(target._onDataLayoutChanged.add(() => {\n this._syncActiveTargets(true);\n }));\n this._syncActiveTargets(true);\n }\n /**\n * Removes a target from the manager\n * @param target defines the target to remove\n */\n removeTarget(target) {\n const index = this._targets.indexOf(target);\n if (index >= 0) {\n this._targets.splice(index, 1);\n target.onInfluenceChanged.remove(this._targetInfluenceChangedObservers.splice(index, 1)[0]);\n target._onDataLayoutChanged.remove(this._targetDataLayoutChangedObservers.splice(index, 1)[0]);\n this._syncActiveTargets(true);\n }\n if (this._scene) {\n this._scene.stopAnimation(target);\n }\n }\n /**\n * @internal\n */\n _bind(effect) {\n effect.setFloat3(\"morphTargetTextureInfo\", this._textureVertexStride, this._textureWidth, this._textureHeight);\n effect.setFloatArray(\"morphTargetTextureIndices\", this._morphTargetTextureIndices);\n effect.setTexture(\"morphTargets\", this._targetStoreTexture);\n }\n /**\n * Clone the current manager\n * @returns a new MorphTargetManager\n */\n clone() {\n const copy = new MorphTargetManager(this._scene);\n for (const target of this._targets) {\n copy.addTarget(target.clone());\n }\n copy.enableNormalMorphing = this.enableNormalMorphing;\n copy.enableTangentMorphing = this.enableTangentMorphing;\n copy.enableUVMorphing = this.enableUVMorphing;\n return copy;\n }\n /**\n * Serializes the current manager into a Serialization object\n * @returns the serialized object\n */\n serialize() {\n const serializationObject = {};\n serializationObject.id = this.uniqueId;\n serializationObject.targets = [];\n for (const target of this._targets) {\n serializationObject.targets.push(target.serialize());\n }\n return serializationObject;\n }\n _syncActiveTargets(needUpdate) {\n if (this.areUpdatesFrozen) {\n return;\n }\n let influenceCount = 0;\n this._activeTargets.reset();\n this._supportsNormals = true;\n this._supportsTangents = true;\n this._supportsUVs = true;\n this._vertexCount = 0;\n if (this._scene && this._targets.length > this._scene.getEngine().getCaps().texture2DArrayMaxLayerCount) {\n this.useTextureToStoreTargets = false;\n }\n if (!this._morphTargetTextureIndices || this._morphTargetTextureIndices.length !== this._targets.length) {\n this._morphTargetTextureIndices = new Float32Array(this._targets.length);\n }\n let targetIndex = -1;\n for (const target of this._targets) {\n targetIndex++;\n if (target.influence === 0 && this.optimizeInfluencers) {\n continue;\n }\n if (this._activeTargets.length >= MorphTargetManager.MaxActiveMorphTargetsInVertexAttributeMode && !this.isUsingTextureForTargets) {\n break;\n }\n this._activeTargets.push(target);\n this._morphTargetTextureIndices[influenceCount] = targetIndex;\n this._tempInfluences[influenceCount++] = target.influence;\n this._supportsNormals = this._supportsNormals && target.hasNormals;\n this._supportsTangents = this._supportsTangents && target.hasTangents;\n this._supportsUVs = this._supportsUVs && target.hasUVs;\n const positions = target.getPositions();\n if (positions) {\n const vertexCount = positions.length / 3;\n if (this._vertexCount === 0) {\n this._vertexCount = vertexCount;\n }\n else if (this._vertexCount !== vertexCount) {\n Logger.Error(\"Incompatible target. Targets must all have the same vertices count.\");\n return;\n }\n }\n }\n if (this._morphTargetTextureIndices.length !== influenceCount) {\n this._morphTargetTextureIndices = this._morphTargetTextureIndices.slice(0, influenceCount);\n }\n if (!this._influences || this._influences.length !== influenceCount) {\n this._influences = new Float32Array(influenceCount);\n }\n for (let index = 0; index < influenceCount; index++) {\n this._influences[index] = this._tempInfluences[index];\n }\n if (needUpdate) {\n this.synchronize();\n }\n }\n /**\n * Synchronize the targets with all the meshes using this morph target manager\n */\n synchronize() {\n if (!this._scene || this.areUpdatesFrozen) {\n return;\n }\n if (this.isUsingTextureForTargets && this._vertexCount) {\n this._textureVertexStride = 1;\n if (this._supportsNormals) {\n this._textureVertexStride++;\n }\n if (this._supportsTangents) {\n this._textureVertexStride++;\n }\n if (this._supportsUVs) {\n this._textureVertexStride++;\n }\n this._textureWidth = this._vertexCount * this._textureVertexStride;\n this._textureHeight = 1;\n const maxTextureSize = this._scene.getEngine().getCaps().maxTextureSize;\n if (this._textureWidth > maxTextureSize) {\n this._textureHeight = Math.ceil(this._textureWidth / maxTextureSize);\n this._textureWidth = maxTextureSize;\n }\n let mustUpdateTexture = true;\n if (this._targetStoreTexture) {\n const textureSize = this._targetStoreTexture.getSize();\n if (textureSize.width === this._textureWidth && textureSize.height === this._textureHeight && this._targetStoreTexture.depth === this._targets.length) {\n mustUpdateTexture = false;\n }\n }\n if (mustUpdateTexture) {\n if (this._targetStoreTexture) {\n this._targetStoreTexture.dispose();\n }\n const targetCount = this._targets.length;\n const data = new Float32Array(targetCount * this._textureWidth * this._textureHeight * 4);\n let offset = 0;\n for (let index = 0; index < targetCount; index++) {\n const target = this._targets[index];\n const positions = target.getPositions();\n const normals = target.getNormals();\n const uvs = target.getUVs();\n const tangents = target.getTangents();\n if (!positions) {\n if (index === 0) {\n Logger.Error(\"Invalid morph target. Target must have positions.\");\n }\n return;\n }\n offset = index * this._textureWidth * this._textureHeight * 4;\n for (let vertex = 0; vertex < this._vertexCount; vertex++) {\n data[offset] = positions[vertex * 3];\n data[offset + 1] = positions[vertex * 3 + 1];\n data[offset + 2] = positions[vertex * 3 + 2];\n offset += 4;\n if (this._supportsNormals && normals) {\n data[offset] = normals[vertex * 3];\n data[offset + 1] = normals[vertex * 3 + 1];\n data[offset + 2] = normals[vertex * 3 + 2];\n offset += 4;\n }\n if (this._supportsUVs && uvs) {\n data[offset] = uvs[vertex * 2];\n data[offset + 1] = uvs[vertex * 2 + 1];\n offset += 4;\n }\n if (this._supportsTangents && tangents) {\n data[offset] = tangents[vertex * 3];\n data[offset + 1] = tangents[vertex * 3 + 1];\n data[offset + 2] = tangents[vertex * 3 + 2];\n offset += 4;\n }\n }\n }\n this._targetStoreTexture = RawTexture2DArray.CreateRGBATexture(data, this._textureWidth, this._textureHeight, targetCount, this._scene, false, false, 1, 1);\n }\n }\n // Flag meshes as dirty to resync with the active targets\n for (const mesh of this._scene.meshes) {\n if (mesh.morphTargetManager === this) {\n mesh._syncGeometryWithMorphTargetManager();\n }\n }\n }\n /**\n * Release all resources\n */\n dispose() {\n if (this._targetStoreTexture) {\n this._targetStoreTexture.dispose();\n }\n this._targetStoreTexture = null;\n // Remove from scene\n if (this._scene) {\n this._scene.removeMorphTargetManager(this);\n if (this._parentContainer) {\n const index = this._parentContainer.morphTargetManagers.indexOf(this);\n if (index > -1) {\n this._parentContainer.morphTargetManagers.splice(index, 1);\n }\n this._parentContainer = null;\n }\n for (const morph of this._targets) {\n this._scene.stopAnimation(morph);\n }\n }\n }\n // Statics\n /**\n * Creates a new MorphTargetManager from serialized data\n * @param serializationObject defines the serialized data\n * @param scene defines the hosting scene\n * @returns the new MorphTargetManager\n */\n static Parse(serializationObject, scene) {\n const result = new MorphTargetManager(scene);\n result._uniqueId = serializationObject.id;\n for (const targetData of serializationObject.targets) {\n result.addTarget(MorphTarget.Parse(targetData, scene));\n }\n return result;\n }\n}\n/** Enable storing morph target data into textures when set to true (true by default) */\nMorphTargetManager.EnableTextureStorage = true;\n/** Maximum number of active morph targets supported in the \"vertex attribute\" mode (i.e., not the \"texture\" mode) */\nMorphTargetManager.MaxActiveMorphTargetsInVertexAttributeMode = 8;\n//# sourceMappingURL=morphTargetManager.js.map","import { Animation } from \"@babylonjs/core/Animations/animation.js\";\nimport { Quaternion, Vector3 } from \"@babylonjs/core/Maths/math.vector.js\";\n/** @internal */\nexport function getVector3(_target, source, offset, scale) {\n return Vector3.FromArray(source, offset).scaleInPlace(scale);\n}\n/** @internal */\nexport function getQuaternion(_target, source, offset, scale) {\n return Quaternion.FromArray(source, offset).scaleInPlace(scale);\n}\n/** @internal */\nexport function getWeights(target, source, offset, scale) {\n const value = new Array(target._numMorphTargets);\n for (let i = 0; i < value.length; i++) {\n value[i] = source[offset++] * scale;\n }\n return value;\n}\n/** @internal */\nexport class AnimationPropertyInfo {\n /** @internal */\n constructor(type, name, getValue, getStride) {\n this.type = type;\n this.name = name;\n this.getValue = getValue;\n this.getStride = getStride;\n }\n _buildAnimation(name, fps, keys) {\n const babylonAnimation = new Animation(name, this.name, fps, this.type);\n babylonAnimation.setKeys(keys);\n return babylonAnimation;\n }\n}\n/** @internal */\nexport class TransformNodeAnimationPropertyInfo extends AnimationPropertyInfo {\n /** @internal */\n buildAnimations(target, name, fps, keys, callback) {\n callback(target._babylonTransformNode, this._buildAnimation(name, fps, keys));\n }\n}\n/** @internal */\nexport class WeightAnimationPropertyInfo extends AnimationPropertyInfo {\n buildAnimations(target, name, fps, keys, callback) {\n if (target._numMorphTargets) {\n for (let targetIndex = 0; targetIndex < target._numMorphTargets; targetIndex++) {\n const babylonAnimation = new Animation(`${name}_${targetIndex}`, this.name, fps, this.type);\n babylonAnimation.setKeys(keys.map((key) => ({\n frame: key.frame,\n inTangent: key.inTangent ? key.inTangent[targetIndex] : undefined,\n value: key.value[targetIndex],\n outTangent: key.outTangent ? key.outTangent[targetIndex] : undefined,\n interpolation: key.interpolation,\n })));\n if (target._primitiveBabylonMeshes) {\n for (const babylonMesh of target._primitiveBabylonMeshes) {\n if (babylonMesh.morphTargetManager) {\n const morphTarget = babylonMesh.morphTargetManager.getTarget(targetIndex);\n const babylonAnimationClone = babylonAnimation.clone();\n morphTarget.animations.push(babylonAnimationClone);\n callback(morphTarget, babylonAnimationClone);\n }\n }\n }\n }\n }\n }\n}\n/** @internal */\nexport const nodeAnimationData = {\n translation: [new TransformNodeAnimationPropertyInfo(Animation.ANIMATIONTYPE_VECTOR3, \"position\", getVector3, () => 3)],\n rotation: [new TransformNodeAnimationPropertyInfo(Animation.ANIMATIONTYPE_QUATERNION, \"rotationQuaternion\", getQuaternion, () => 4)],\n scale: [new TransformNodeAnimationPropertyInfo(Animation.ANIMATIONTYPE_VECTOR3, \"scaling\", getVector3, () => 3)],\n weights: [new WeightAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"influence\", getWeights, (target) => target._numMorphTargets)],\n};\n//# sourceMappingURL=glTFLoaderAnimation.js.map","import { Deferred } from \"@babylonjs/core/Misc/deferred.js\";\nimport { Quaternion, Vector3, Matrix, TmpVectors } from \"@babylonjs/core/Maths/math.vector.js\";\nimport { Color3 } from \"@babylonjs/core/Maths/math.color.js\";\nimport { Tools } from \"@babylonjs/core/Misc/tools.js\";\nimport { Camera } from \"@babylonjs/core/Cameras/camera.js\";\nimport { FreeCamera } from \"@babylonjs/core/Cameras/freeCamera.js\";\nimport { AnimationKeyInterpolation } from \"@babylonjs/core/Animations/animationKey.js\";\nimport { AnimationGroup } from \"@babylonjs/core/Animations/animationGroup.js\";\nimport { Bone } from \"@babylonjs/core/Bones/bone.js\";\nimport { Skeleton } from \"@babylonjs/core/Bones/skeleton.js\";\nimport { Material } from \"@babylonjs/core/Materials/material.js\";\nimport { PBRMaterial } from \"@babylonjs/core/Materials/PBR/pbrMaterial.js\";\nimport { Texture } from \"@babylonjs/core/Materials/Textures/texture.js\";\nimport { TransformNode } from \"@babylonjs/core/Meshes/transformNode.js\";\nimport { Buffer, VertexBuffer } from \"@babylonjs/core/Buffers/buffer.js\";\nimport { Geometry } from \"@babylonjs/core/Meshes/geometry.js\";\nimport { Mesh } from \"@babylonjs/core/Meshes/mesh.js\";\nimport { MorphTarget } from \"@babylonjs/core/Morph/morphTarget.js\";\nimport { MorphTargetManager } from \"@babylonjs/core/Morph/morphTargetManager.js\";\nimport { GLTFFileLoader, GLTFLoaderState, GLTFLoaderCoordinateSystemMode, GLTFLoaderAnimationStartMode } from \"../glTFFileLoader.js\";\nimport { DecodeBase64UrlToBinary, IsBase64DataUrl, LoadFileError } from \"@babylonjs/core/Misc/fileTools.js\";\nimport { Logger } from \"@babylonjs/core/Misc/logger.js\";\nimport { BoundingInfo } from \"@babylonjs/core/Culling/boundingInfo.js\";\nimport { nodeAnimationData } from \"./glTFLoaderAnimation.js\";\n// https://stackoverflow.com/a/48218209\nfunction mergeDeep(...objects) {\n const isObject = (obj) => obj && typeof obj === \"object\";\n return objects.reduce((prev, obj) => {\n Object.keys(obj).forEach((key) => {\n const pVal = prev[key];\n const oVal = obj[key];\n if (Array.isArray(pVal) && Array.isArray(oVal)) {\n prev[key] = pVal.concat(...oVal);\n }\n else if (isObject(pVal) && isObject(oVal)) {\n prev[key] = mergeDeep(pVal, oVal);\n }\n else {\n prev[key] = oVal;\n }\n });\n return prev;\n }, {});\n}\n/**\n * Helper class for working with arrays when loading the glTF asset\n */\nexport class ArrayItem {\n /**\n * Gets an item from the given array.\n * @param context The context when loading the asset\n * @param array The array to get the item from\n * @param index The index to the array\n * @returns The array item\n */\n static Get(context, array, index) {\n if (!array || index == undefined || !array[index]) {\n throw new Error(`${context}: Failed to find index (${index})`);\n }\n return array[index];\n }\n /**\n * Assign an `index` field to each item of the given array.\n * @param array The array of items\n */\n static Assign(array) {\n if (array) {\n for (let index = 0; index < array.length; index++) {\n array[index].index = index;\n }\n }\n }\n}\n/**\n * The glTF 2.0 loader\n */\nexport class GLTFLoader {\n /**\n * Registers a loader extension.\n * @param name The name of the loader extension.\n * @param factory The factory function that creates the loader extension.\n */\n static RegisterExtension(name, factory) {\n if (GLTFLoader.UnregisterExtension(name)) {\n Logger.Warn(`Extension with the name '${name}' already exists`);\n }\n GLTFLoader._RegisteredExtensions[name] = {\n factory: factory,\n };\n }\n /**\n * Unregisters a loader extension.\n * @param name The name of the loader extension.\n * @returns A boolean indicating whether the extension has been unregistered\n */\n static UnregisterExtension(name) {\n if (!GLTFLoader._RegisteredExtensions[name]) {\n return false;\n }\n delete GLTFLoader._RegisteredExtensions[name];\n return true;\n }\n /**\n * The object that represents the glTF JSON.\n */\n get gltf() {\n if (!this._gltf) {\n throw new Error(\"glTF JSON is not available\");\n }\n return this._gltf;\n }\n /**\n * The BIN chunk of a binary glTF.\n */\n get bin() {\n return this._bin;\n }\n /**\n * The parent file loader.\n */\n get parent() {\n return this._parent;\n }\n /**\n * The Babylon scene when loading the asset.\n */\n get babylonScene() {\n if (!this._babylonScene) {\n throw new Error(\"Scene is not available\");\n }\n return this._babylonScene;\n }\n /**\n * The root Babylon mesh when loading the asset.\n */\n get rootBabylonMesh() {\n return this._rootBabylonMesh;\n }\n /**\n * @internal\n */\n constructor(parent) {\n /** @internal */\n this._completePromises = new Array();\n /** @internal */\n this._assetContainer = null;\n /** Storage */\n this._babylonLights = [];\n /** @internal */\n this._disableInstancedMesh = 0;\n this._extensions = new Array();\n this._disposed = false;\n this._rootUrl = null;\n this._fileName = null;\n this._uniqueRootUrl = null;\n this._bin = null;\n this._rootBabylonMesh = null;\n this._defaultBabylonMaterialData = {};\n this._postSceneLoadActions = new Array();\n this._parent = parent;\n }\n /** @internal */\n dispose() {\n if (this._disposed) {\n return;\n }\n this._disposed = true;\n this._completePromises.length = 0;\n this._extensions.forEach((extension) => extension.dispose && extension.dispose());\n this._extensions.length = 0;\n this._gltf = null; // TODO\n this._bin = null;\n this._babylonScene = null; // TODO\n this._rootBabylonMesh = null;\n this._defaultBabylonMaterialData = {};\n this._postSceneLoadActions.length = 0;\n this._parent.dispose();\n }\n /**\n * @internal\n */\n importMeshAsync(meshesNames, scene, container, data, rootUrl, onProgress, fileName = \"\") {\n return Promise.resolve().then(() => {\n this._babylonScene = scene;\n this._assetContainer = container;\n this._loadData(data);\n let nodes = null;\n if (meshesNames) {\n const nodeMap = {};\n if (this._gltf.nodes) {\n for (const node of this._gltf.nodes) {\n if (node.name) {\n nodeMap[node.name] = node.index;\n }\n }\n }\n const names = meshesNames instanceof Array ? meshesNames : [meshesNames];\n nodes = names.map((name) => {\n const node = nodeMap[name];\n if (node === undefined) {\n throw new Error(`Failed to find node '${name}'`);\n }\n return node;\n });\n }\n return this._loadAsync(rootUrl, fileName, nodes, () => {\n return {\n meshes: this._getMeshes(),\n particleSystems: [],\n skeletons: this._getSkeletons(),\n animationGroups: this._getAnimationGroups(),\n lights: this._babylonLights,\n transformNodes: this._getTransformNodes(),\n geometries: this._getGeometries(),\n };\n });\n });\n }\n /**\n * @internal\n */\n loadAsync(scene, data, rootUrl, onProgress, fileName = \"\") {\n return Promise.resolve().then(() => {\n this._babylonScene = scene;\n this._loadData(data);\n return this._loadAsync(rootUrl, fileName, null, () => undefined);\n });\n }\n _loadAsync(rootUrl, fileName, nodes, resultFunc) {\n return Promise.resolve()\n .then(() => {\n this._rootUrl = rootUrl;\n this._uniqueRootUrl = !rootUrl.startsWith(\"file:\") && fileName ? rootUrl : `${rootUrl}${Date.now()}/`;\n this._fileName = fileName;\n this._loadExtensions();\n this._checkExtensions();\n const loadingToReadyCounterName = `${GLTFLoaderState[GLTFLoaderState.LOADING]} => ${GLTFLoaderState[GLTFLoaderState.READY]}`;\n const loadingToCompleteCounterName = `${GLTFLoaderState[GLTFLoaderState.LOADING]} => ${GLTFLoaderState[GLTFLoaderState.COMPLETE]}`;\n this._parent._startPerformanceCounter(loadingToReadyCounterName);\n this._parent._startPerformanceCounter(loadingToCompleteCounterName);\n this._parent._setState(GLTFLoaderState.LOADING);\n this._extensionsOnLoading();\n const promises = new Array();\n // Block the marking of materials dirty until the scene is loaded.\n const oldBlockMaterialDirtyMechanism = this._babylonScene.blockMaterialDirtyMechanism;\n this._babylonScene.blockMaterialDirtyMechanism = true;\n if (!this.parent.loadOnlyMaterials) {\n if (nodes) {\n promises.push(this.loadSceneAsync(\"/nodes\", { nodes: nodes, index: -1 }));\n }\n else if (this._gltf.scene != undefined || (this._gltf.scenes && this._gltf.scenes[0])) {\n const scene = ArrayItem.Get(`/scene`, this._gltf.scenes, this._gltf.scene || 0);\n promises.push(this.loadSceneAsync(`/scenes/${scene.index}`, scene));\n }\n }\n if (!this.parent.skipMaterials && this.parent.loadAllMaterials && this._gltf.materials) {\n for (let m = 0; m < this._gltf.materials.length; ++m) {\n const material = this._gltf.materials[m];\n const context = \"/materials/\" + m;\n const babylonDrawMode = Material.TriangleFillMode;\n promises.push(this._loadMaterialAsync(context, material, null, babylonDrawMode, () => { }));\n }\n }\n // Restore the blocking of material dirty.\n this._babylonScene.blockMaterialDirtyMechanism = oldBlockMaterialDirtyMechanism;\n if (this._parent.compileMaterials) {\n promises.push(this._compileMaterialsAsync());\n }\n if (this._parent.compileShadowGenerators) {\n promises.push(this._compileShadowGeneratorsAsync());\n }\n const resultPromise = Promise.all(promises).then(() => {\n if (this._rootBabylonMesh) {\n this._rootBabylonMesh.setEnabled(true);\n }\n this._extensionsOnReady();\n this._parent._setState(GLTFLoaderState.READY);\n this._startAnimations();\n return resultFunc();\n });\n return resultPromise.then((result) => {\n this._parent._endPerformanceCounter(loadingToReadyCounterName);\n Tools.SetImmediate(() => {\n if (!this._disposed) {\n Promise.all(this._completePromises).then(() => {\n this._parent._endPerformanceCounter(loadingToCompleteCounterName);\n this._parent._setState(GLTFLoaderState.COMPLETE);\n this._parent.onCompleteObservable.notifyObservers(undefined);\n this._parent.onCompleteObservable.clear();\n this.dispose();\n }, (error) => {\n this._parent.onErrorObservable.notifyObservers(error);\n this._parent.onErrorObservable.clear();\n this.dispose();\n });\n }\n });\n return result;\n });\n })\n .catch((error) => {\n if (!this._disposed) {\n this._parent.onErrorObservable.notifyObservers(error);\n this._parent.onErrorObservable.clear();\n this.dispose();\n }\n throw error;\n });\n }\n _loadData(data) {\n this._gltf = data.json;\n this._setupData();\n if (data.bin) {\n const buffers = this._gltf.buffers;\n if (buffers && buffers[0] && !buffers[0].uri) {\n const binaryBuffer = buffers[0];\n if (binaryBuffer.byteLength < data.bin.byteLength - 3 || binaryBuffer.byteLength > data.bin.byteLength) {\n Logger.Warn(`Binary buffer length (${binaryBuffer.byteLength}) from JSON does not match chunk length (${data.bin.byteLength})`);\n }\n this._bin = data.bin;\n }\n else {\n Logger.Warn(\"Unexpected BIN chunk\");\n }\n }\n }\n _setupData() {\n ArrayItem.Assign(this._gltf.accessors);\n ArrayItem.Assign(this._gltf.animations);\n ArrayItem.Assign(this._gltf.buffers);\n ArrayItem.Assign(this._gltf.bufferViews);\n ArrayItem.Assign(this._gltf.cameras);\n ArrayItem.Assign(this._gltf.images);\n ArrayItem.Assign(this._gltf.materials);\n ArrayItem.Assign(this._gltf.meshes);\n ArrayItem.Assign(this._gltf.nodes);\n ArrayItem.Assign(this._gltf.samplers);\n ArrayItem.Assign(this._gltf.scenes);\n ArrayItem.Assign(this._gltf.skins);\n ArrayItem.Assign(this._gltf.textures);\n if (this._gltf.nodes) {\n const nodeParents = {};\n for (const node of this._gltf.nodes) {\n if (node.children) {\n for (const index of node.children) {\n nodeParents[index] = node.index;\n }\n }\n }\n const rootNode = this._createRootNode();\n for (const node of this._gltf.nodes) {\n const parentIndex = nodeParents[node.index];\n node.parent = parentIndex === undefined ? rootNode : this._gltf.nodes[parentIndex];\n }\n }\n }\n _loadExtensions() {\n for (const name in GLTFLoader._RegisteredExtensions) {\n const extension = GLTFLoader._RegisteredExtensions[name].factory(this);\n if (extension.name !== name) {\n Logger.Warn(`The name of the glTF loader extension instance does not match the registered name: ${extension.name} !== ${name}`);\n }\n this._extensions.push(extension);\n this._parent.onExtensionLoadedObservable.notifyObservers(extension);\n }\n this._extensions.sort((a, b) => (a.order || Number.MAX_VALUE) - (b.order || Number.MAX_VALUE));\n this._parent.onExtensionLoadedObservable.clear();\n }\n _checkExtensions() {\n if (this._gltf.extensionsRequired) {\n for (const name of this._gltf.extensionsRequired) {\n const available = this._extensions.some((extension) => extension.name === name && extension.enabled);\n if (!available) {\n throw new Error(`Require extension ${name} is not available`);\n }\n }\n }\n }\n _createRootNode() {\n this._babylonScene._blockEntityCollection = !!this._assetContainer;\n this._rootBabylonMesh = new Mesh(\"__root__\", this._babylonScene);\n this._rootBabylonMesh._parentContainer = this._assetContainer;\n this._babylonScene._blockEntityCollection = false;\n this._rootBabylonMesh.setEnabled(false);\n const rootNode = {\n _babylonTransformNode: this._rootBabylonMesh,\n index: -1,\n };\n switch (this._parent.coordinateSystemMode) {\n case GLTFLoaderCoordinateSystemMode.AUTO: {\n if (!this._babylonScene.useRightHandedSystem) {\n rootNode.rotation = [0, 1, 0, 0];\n rootNode.scale = [1, 1, -1];\n GLTFLoader._LoadTransform(rootNode, this._rootBabylonMesh);\n }\n break;\n }\n case GLTFLoaderCoordinateSystemMode.FORCE_RIGHT_HANDED: {\n this._babylonScene.useRightHandedSystem = true;\n break;\n }\n default: {\n throw new Error(`Invalid coordinate system mode (${this._parent.coordinateSystemMode})`);\n }\n }\n this._parent.onMeshLoadedObservable.notifyObservers(this._rootBabylonMesh);\n return rootNode;\n }\n /**\n * Loads a glTF scene.\n * @param context The context when loading the asset\n * @param scene The glTF scene property\n * @returns A promise that resolves when the load is complete\n */\n loadSceneAsync(context, scene) {\n const extensionPromise = this._extensionsLoadSceneAsync(context, scene);\n if (extensionPromise) {\n return extensionPromise;\n }\n const promises = new Array();\n this.logOpen(`${context} ${scene.name || \"\"}`);\n if (scene.nodes) {\n for (const index of scene.nodes) {\n const node = ArrayItem.Get(`${context}/nodes/${index}`, this._gltf.nodes, index);\n promises.push(this.loadNodeAsync(`/nodes/${node.index}`, node, (babylonMesh) => {\n babylonMesh.parent = this._rootBabylonMesh;\n }));\n }\n }\n for (const action of this._postSceneLoadActions) {\n action();\n }\n promises.push(this._loadAnimationsAsync());\n this.logClose();\n return Promise.all(promises).then(() => { });\n }\n _forEachPrimitive(node, callback) {\n if (node._primitiveBabylonMeshes) {\n for (const babylonMesh of node._primitiveBabylonMeshes) {\n callback(babylonMesh);\n }\n }\n }\n _getGeometries() {\n const geometries = new Array();\n const nodes = this._gltf.nodes;\n if (nodes) {\n for (const node of nodes) {\n this._forEachPrimitive(node, (babylonMesh) => {\n const geometry = babylonMesh.geometry;\n if (geometry && geometries.indexOf(geometry) === -1) {\n geometries.push(geometry);\n }\n });\n }\n }\n return geometries;\n }\n _getMeshes() {\n const meshes = new Array();\n // Root mesh is always first, if available.\n if (this._rootBabylonMesh) {\n meshes.push(this._rootBabylonMesh);\n }\n const nodes = this._gltf.nodes;\n if (nodes) {\n for (const node of nodes) {\n this._forEachPrimitive(node, (babylonMesh) => {\n meshes.push(babylonMesh);\n });\n }\n }\n return meshes;\n }\n _getTransformNodes() {\n const transformNodes = new Array();\n const nodes = this._gltf.nodes;\n if (nodes) {\n for (const node of nodes) {\n if (node._babylonTransformNode && node._babylonTransformNode.getClassName() === \"TransformNode\") {\n transformNodes.push(node._babylonTransformNode);\n }\n if (node._babylonTransformNodeForSkin) {\n transformNodes.push(node._babylonTransformNodeForSkin);\n }\n }\n }\n return transformNodes;\n }\n _getSkeletons() {\n const skeletons = new Array();\n const skins = this._gltf.skins;\n if (skins) {\n for (const skin of skins) {\n if (skin._data) {\n skeletons.push(skin._data.babylonSkeleton);\n }\n }\n }\n return skeletons;\n }\n _getAnimationGroups() {\n const animationGroups = new Array();\n const animations = this._gltf.animations;\n if (animations) {\n for (const animation of animations) {\n if (animation._babylonAnimationGroup) {\n animationGroups.push(animation._babylonAnimationGroup);\n }\n }\n }\n return animationGroups;\n }\n _startAnimations() {\n switch (this._parent.animationStartMode) {\n case GLTFLoaderAnimationStartMode.NONE: {\n // do nothing\n break;\n }\n case GLTFLoaderAnimationStartMode.FIRST: {\n const babylonAnimationGroups = this._getAnimationGroups();\n if (babylonAnimationGroups.length !== 0) {\n babylonAnimationGroups[0].start(true);\n }\n break;\n }\n case GLTFLoaderAnimationStartMode.ALL: {\n const babylonAnimationGroups = this._getAnimationGroups();\n for (const babylonAnimationGroup of babylonAnimationGroups) {\n babylonAnimationGroup.start(true);\n }\n break;\n }\n default: {\n Logger.Error(`Invalid animation start mode (${this._parent.animationStartMode})`);\n return;\n }\n }\n }\n /**\n * Loads a glTF node.\n * @param context The context when loading the asset\n * @param node The glTF node property\n * @param assign A function called synchronously after parsing the glTF properties\n * @returns A promise that resolves with the loaded Babylon mesh when the load is complete\n */\n loadNodeAsync(context, node, assign = () => { }) {\n const extensionPromise = this._extensionsLoadNodeAsync(context, node, assign);\n if (extensionPromise) {\n return extensionPromise;\n }\n if (node._babylonTransformNode) {\n throw new Error(`${context}: Invalid recursive node hierarchy`);\n }\n const promises = new Array();\n this.logOpen(`${context} ${node.name || \"\"}`);\n const loadNode = (babylonTransformNode) => {\n GLTFLoader.AddPointerMetadata(babylonTransformNode, context);\n GLTFLoader._LoadTransform(node, babylonTransformNode);\n if (node.camera != undefined) {\n const camera = ArrayItem.Get(`${context}/camera`, this._gltf.cameras, node.camera);\n promises.push(this.loadCameraAsync(`/cameras/${camera.index}`, camera, (babylonCamera) => {\n babylonCamera.parent = babylonTransformNode;\n }));\n }\n if (node.children) {\n for (const index of node.children) {\n const childNode = ArrayItem.Get(`${context}/children/${index}`, this._gltf.nodes, index);\n promises.push(this.loadNodeAsync(`/nodes/${childNode.index}`, childNode, (childBabylonMesh) => {\n childBabylonMesh.parent = babylonTransformNode;\n }));\n }\n }\n assign(babylonTransformNode);\n };\n if (node.mesh == undefined || node.skin != undefined) {\n const nodeName = node.name || `node${node.index}`;\n this._babylonScene._blockEntityCollection = !!this._assetContainer;\n const transformNode = new TransformNode(nodeName, this._babylonScene);\n transformNode._parentContainer = this._assetContainer;\n this._babylonScene._blockEntityCollection = false;\n if (node.mesh == undefined) {\n node._babylonTransformNode = transformNode;\n }\n else {\n node._babylonTransformNodeForSkin = transformNode;\n }\n loadNode(transformNode);\n }\n if (node.mesh != undefined) {\n if (node.skin == undefined) {\n const mesh = ArrayItem.Get(`${context}/mesh`, this._gltf.meshes, node.mesh);\n promises.push(this._loadMeshAsync(`/meshes/${mesh.index}`, node, mesh, loadNode));\n }\n else {\n // See https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins (second implementation note)\n // This code path will place the skinned mesh as a sibling of the skeleton root node without loading the\n // transform, which effectively ignores the transform of the skinned mesh, as per spec.\n const mesh = ArrayItem.Get(`${context}/mesh`, this._gltf.meshes, node.mesh);\n promises.push(this._loadMeshAsync(`/meshes/${mesh.index}`, node, mesh, (babylonTransformNode) => {\n const babylonTransformNodeForSkin = node._babylonTransformNodeForSkin;\n // Merge the metadata from the skin node to the skinned mesh in case a loader extension added metadata.\n babylonTransformNode.metadata = mergeDeep(babylonTransformNodeForSkin.metadata, babylonTransformNode.metadata || {});\n const skin = ArrayItem.Get(`${context}/skin`, this._gltf.skins, node.skin);\n promises.push(this._loadSkinAsync(`/skins/${skin.index}`, node, skin, (babylonSkeleton) => {\n this._forEachPrimitive(node, (babylonMesh) => {\n babylonMesh.skeleton = babylonSkeleton;\n });\n // Wait until all the nodes are parented before parenting the skinned mesh.\n this._postSceneLoadActions.push(() => {\n if (skin.skeleton != undefined) {\n // Place the skinned mesh node as a sibling of the skeleton root node.\n // Handle special case when the parent of the skeleton root is the skinned mesh.\n const parentNode = ArrayItem.Get(`/skins/${skin.index}/skeleton`, this._gltf.nodes, skin.skeleton).parent;\n if (node.index === parentNode.index) {\n babylonTransformNode.parent = babylonTransformNodeForSkin.parent;\n }\n else {\n babylonTransformNode.parent = parentNode._babylonTransformNode;\n }\n }\n else {\n babylonTransformNode.parent = this._rootBabylonMesh;\n }\n this._parent.onSkinLoadedObservable.notifyObservers({ node: babylonTransformNodeForSkin, skinnedNode: babylonTransformNode });\n });\n }));\n }));\n }\n }\n this.logClose();\n return Promise.all(promises).then(() => {\n this._forEachPrimitive(node, (babylonMesh) => {\n if (babylonMesh.geometry && babylonMesh.geometry.useBoundingInfoFromGeometry) {\n // simply apply the world matrices to the bounding info - the extends are already ok\n babylonMesh._updateBoundingInfo();\n }\n else {\n babylonMesh.refreshBoundingInfo(true);\n }\n });\n return node._babylonTransformNode;\n });\n }\n _loadMeshAsync(context, node, mesh, assign) {\n const primitives = mesh.primitives;\n if (!primitives || !primitives.length) {\n throw new Error(`${context}: Primitives are missing`);\n }\n if (primitives[0].index == undefined) {\n ArrayItem.Assign(primitives);\n }\n const promises = new Array();\n this.logOpen(`${context} ${mesh.name || \"\"}`);\n const name = node.name || `node${node.index}`;\n if (primitives.length === 1) {\n const primitive = mesh.primitives[0];\n promises.push(this._loadMeshPrimitiveAsync(`${context}/primitives/${primitive.index}`, name, node, mesh, primitive, (babylonMesh) => {\n node._babylonTransformNode = babylonMesh;\n node._primitiveBabylonMeshes = [babylonMesh];\n }));\n }\n else {\n this._babylonScene._blockEntityCollection = !!this._assetContainer;\n node._babylonTransformNode = new TransformNode(name, this._babylonScene);\n node._babylonTransformNode._parentContainer = this._assetContainer;\n this._babylonScene._blockEntityCollection = false;\n node._primitiveBabylonMeshes = [];\n for (const primitive of primitives) {\n promises.push(this._loadMeshPrimitiveAsync(`${context}/primitives/${primitive.index}`, `${name}_primitive${primitive.index}`, node, mesh, primitive, (babylonMesh) => {\n babylonMesh.parent = node._babylonTransformNode;\n node._primitiveBabylonMeshes.push(babylonMesh);\n }));\n }\n }\n assign(node._babylonTransformNode);\n this.logClose();\n return Promise.all(promises).then(() => {\n return node._babylonTransformNode;\n });\n }\n /**\n * @internal Define this method to modify the default behavior when loading data for mesh primitives.\n * @param context The context when loading the asset\n * @param name The mesh name when loading the asset\n * @param node The glTF node when loading the asset\n * @param mesh The glTF mesh when loading the asset\n * @param primitive The glTF mesh primitive property\n * @param assign A function called synchronously after parsing the glTF properties\n * @returns A promise that resolves with the loaded mesh when the load is complete or null if not handled\n */\n _loadMeshPrimitiveAsync(context, name, node, mesh, primitive, assign) {\n const extensionPromise = this._extensionsLoadMeshPrimitiveAsync(context, name, node, mesh, primitive, assign);\n if (extensionPromise) {\n return extensionPromise;\n }\n this.logOpen(`${context}`);\n const shouldInstance = this._disableInstancedMesh === 0 && this._parent.createInstances && node.skin == undefined && !mesh.primitives[0].targets;\n let babylonAbstractMesh;\n let promise;\n if (shouldInstance && primitive._instanceData) {\n this._babylonScene._blockEntityCollection = !!this._assetContainer;\n babylonAbstractMesh = primitive._instanceData.babylonSourceMesh.createInstance(name);\n babylonAbstractMesh._parentContainer = this._assetContainer;\n this._babylonScene._blockEntityCollection = false;\n promise = primitive._instanceData.promise;\n }\n else {\n const promises = new Array();\n this._babylonScene._blockEntityCollection = !!this._assetContainer;\n const babylonMesh = new Mesh(name, this._babylonScene);\n babylonMesh._parentContainer = this._assetContainer;\n this._babylonScene._blockEntityCollection = false;\n babylonMesh.overrideMaterialSideOrientation = this._babylonScene.useRightHandedSystem ? Material.CounterClockWiseSideOrientation : Material.ClockWiseSideOrientation;\n this._createMorphTargets(context, node, mesh, primitive, babylonMesh);\n promises.push(this._loadVertexDataAsync(context, primitive, babylonMesh).then((babylonGeometry) => {\n return this._loadMorphTargetsAsync(context, primitive, babylonMesh, babylonGeometry).then(() => {\n if (this._disposed) {\n return;\n }\n this._babylonScene._blockEntityCollection = !!this._assetContainer;\n babylonGeometry.applyToMesh(babylonMesh);\n babylonGeometry._parentContainer = this._assetContainer;\n this._babylonScene._blockEntityCollection = false;\n });\n }));\n const babylonDrawMode = GLTFLoader._GetDrawMode(context, primitive.mode);\n if (primitive.material == undefined) {\n let babylonMaterial = this._defaultBabylonMaterialData[babylonDrawMode];\n if (!babylonMaterial) {\n babylonMaterial = this._createDefaultMaterial(\"__GLTFLoader._default\", babylonDrawMode);\n this._parent.onMaterialLoadedObservable.notifyObservers(babylonMaterial);\n this._defaultBabylonMaterialData[babylonDrawMode] = babylonMaterial;\n }\n babylonMesh.material = babylonMaterial;\n }\n else if (!this.parent.skipMaterials) {\n const material = ArrayItem.Get(`${context}/material`, this._gltf.materials, primitive.material);\n promises.push(this._loadMaterialAsync(`/materials/${material.index}`, material, babylonMesh, babylonDrawMode, (babylonMaterial) => {\n babylonMesh.material = babylonMaterial;\n }));\n }\n promise = Promise.all(promises);\n if (shouldInstance) {\n primitive._instanceData = {\n babylonSourceMesh: babylonMesh,\n promise: promise,\n };\n }\n babylonAbstractMesh = babylonMesh;\n }\n GLTFLoader.AddPointerMetadata(babylonAbstractMesh, context);\n this._parent.onMeshLoadedObservable.notifyObservers(babylonAbstractMesh);\n assign(babylonAbstractMesh);\n this.logClose();\n return promise.then(() => {\n return babylonAbstractMesh;\n });\n }\n _loadVertexDataAsync(context, primitive, babylonMesh) {\n const extensionPromise = this._extensionsLoadVertexDataAsync(context, primitive, babylonMesh);\n if (extensionPromise) {\n return extensionPromise;\n }\n const attributes = primitive.attributes;\n if (!attributes) {\n throw new Error(`${context}: Attributes are missing`);\n }\n const promises = new Array();\n const babylonGeometry = new Geometry(babylonMesh.name, this._babylonScene);\n if (primitive.indices == undefined) {\n babylonMesh.isUnIndexed = true;\n }\n else {\n const accessor = ArrayItem.Get(`${context}/indices`, this._gltf.accessors, primitive.indices);\n promises.push(this._loadIndicesAccessorAsync(`/accessors/${accessor.index}`, accessor).then((data) => {\n babylonGeometry.setIndices(data);\n }));\n }\n const loadAttribute = (attribute, kind, callback) => {\n if (attributes[attribute] == undefined) {\n return;\n }\n babylonMesh._delayInfo = babylonMesh._delayInfo || [];\n if (babylonMesh._delayInfo.indexOf(kind) === -1) {\n babylonMesh._delayInfo.push(kind);\n }\n const accessor = ArrayItem.Get(`${context}/attributes/${attribute}`, this._gltf.accessors, attributes[attribute]);\n promises.push(this._loadVertexAccessorAsync(`/accessors/${accessor.index}`, accessor, kind).then((babylonVertexBuffer) => {\n if (babylonVertexBuffer.getKind() === VertexBuffer.PositionKind && !this.parent.alwaysComputeBoundingBox && !babylonMesh.skeleton) {\n if (accessor.min && accessor.max) {\n const min = TmpVectors.Vector3[0].copyFromFloats(...accessor.min);\n const max = TmpVectors.Vector3[1].copyFromFloats(...accessor.max);\n if (accessor.normalized && accessor.componentType !== 5126 /* AccessorComponentType.FLOAT */) {\n let divider = 1;\n switch (accessor.componentType) {\n case 5120 /* AccessorComponentType.BYTE */:\n divider = 127.0;\n break;\n case 5121 /* AccessorComponentType.UNSIGNED_BYTE */:\n divider = 255.0;\n break;\n case 5122 /* AccessorComponentType.SHORT */:\n divider = 32767.0;\n break;\n case 5123 /* AccessorComponentType.UNSIGNED_SHORT */:\n divider = 65535.0;\n break;\n }\n const oneOverDivider = 1 / divider;\n min.scaleInPlace(oneOverDivider);\n max.scaleInPlace(oneOverDivider);\n }\n babylonGeometry._boundingInfo = new BoundingInfo(min, max);\n babylonGeometry.useBoundingInfoFromGeometry = true;\n }\n }\n babylonGeometry.setVerticesBuffer(babylonVertexBuffer, accessor.count);\n }));\n if (kind == VertexBuffer.MatricesIndicesExtraKind) {\n babylonMesh.numBoneInfluencers = 8;\n }\n if (callback) {\n callback(accessor);\n }\n };\n loadAttribute(\"POSITION\", VertexBuffer.PositionKind);\n loadAttribute(\"NORMAL\", VertexBuffer.NormalKind);\n loadAttribute(\"TANGENT\", VertexBuffer.TangentKind);\n loadAttribute(\"TEXCOORD_0\", VertexBuffer.UVKind);\n loadAttribute(\"TEXCOORD_1\", VertexBuffer.UV2Kind);\n loadAttribute(\"TEXCOORD_2\", VertexBuffer.UV3Kind);\n loadAttribute(\"TEXCOORD_3\", VertexBuffer.UV4Kind);\n loadAttribute(\"TEXCOORD_4\", VertexBuffer.UV5Kind);\n loadAttribute(\"TEXCOORD_5\", VertexBuffer.UV6Kind);\n loadAttribute(\"JOINTS_0\", VertexBuffer.MatricesIndicesKind);\n loadAttribute(\"WEIGHTS_0\", VertexBuffer.MatricesWeightsKind);\n loadAttribute(\"JOINTS_1\", VertexBuffer.MatricesIndicesExtraKind);\n loadAttribute(\"WEIGHTS_1\", VertexBuffer.MatricesWeightsExtraKind);\n loadAttribute(\"COLOR_0\", VertexBuffer.ColorKind, (accessor) => {\n if (accessor.type === \"VEC4\" /* AccessorType.VEC4 */) {\n babylonMesh.hasVertexAlpha = true;\n }\n });\n return Promise.all(promises).then(() => {\n return babylonGeometry;\n });\n }\n _createMorphTargets(context, node, mesh, primitive, babylonMesh) {\n if (!primitive.targets) {\n return;\n }\n if (node._numMorphTargets == undefined) {\n node._numMorphTargets = primitive.targets.length;\n }\n else if (primitive.targets.length !== node._numMorphTargets) {\n throw new Error(`${context}: Primitives do not have the same number of targets`);\n }\n const targetNames = mesh.extras ? mesh.extras.targetNames : null;\n this._babylonScene._blockEntityCollection = !!this._assetContainer;\n babylonMesh.morphTargetManager = new MorphTargetManager(this._babylonScene);\n babylonMesh.morphTargetManager._parentContainer = this._assetContainer;\n this._babylonScene._blockEntityCollection = false;\n babylonMesh.morphTargetManager.areUpdatesFrozen = true;\n for (let index = 0; index < primitive.targets.length; index++) {\n const weight = node.weights ? node.weights[index] : mesh.weights ? mesh.weights[index] : 0;\n const name = targetNames ? targetNames[index] : `morphTarget${index}`;\n babylonMesh.morphTargetManager.addTarget(new MorphTarget(name, weight, babylonMesh.getScene()));\n // TODO: tell the target whether it has positions, normals, tangents\n }\n }\n _loadMorphTargetsAsync(context, primitive, babylonMesh, babylonGeometry) {\n if (!primitive.targets) {\n return Promise.resolve();\n }\n const promises = new Array();\n const morphTargetManager = babylonMesh.morphTargetManager;\n for (let index = 0; index < morphTargetManager.numTargets; index++) {\n const babylonMorphTarget = morphTargetManager.getTarget(index);\n promises.push(this._loadMorphTargetVertexDataAsync(`${context}/targets/${index}`, babylonGeometry, primitive.targets[index], babylonMorphTarget));\n }\n return Promise.all(promises).then(() => {\n morphTargetManager.areUpdatesFrozen = false;\n });\n }\n _loadMorphTargetVertexDataAsync(context, babylonGeometry, attributes, babylonMorphTarget) {\n const promises = new Array();\n const loadAttribute = (attribute, kind, setData) => {\n if (attributes[attribute] == undefined) {\n return;\n }\n const babylonVertexBuffer = babylonGeometry.getVertexBuffer(kind);\n if (!babylonVertexBuffer) {\n return;\n }\n const accessor = ArrayItem.Get(`${context}/${attribute}`, this._gltf.accessors, attributes[attribute]);\n promises.push(this._loadFloatAccessorAsync(`/accessors/${accessor.index}`, accessor).then((data) => {\n setData(babylonVertexBuffer, data);\n }));\n };\n loadAttribute(\"POSITION\", VertexBuffer.PositionKind, (babylonVertexBuffer, data) => {\n const positions = new Float32Array(data.length);\n babylonVertexBuffer.forEach(data.length, (value, index) => {\n positions[index] = data[index] + value;\n });\n babylonMorphTarget.setPositions(positions);\n });\n loadAttribute(\"NORMAL\", VertexBuffer.NormalKind, (babylonVertexBuffer, data) => {\n const normals = new Float32Array(data.length);\n babylonVertexBuffer.forEach(normals.length, (value, index) => {\n normals[index] = data[index] + value;\n });\n babylonMorphTarget.setNormals(normals);\n });\n loadAttribute(\"TANGENT\", VertexBuffer.TangentKind, (babylonVertexBuffer, data) => {\n const tangents = new Float32Array((data.length / 3) * 4);\n let dataIndex = 0;\n babylonVertexBuffer.forEach((data.length / 3) * 4, (value, index) => {\n // Tangent data for morph targets is stored as xyz delta.\n // The vertexData.tangent is stored as xyzw.\n // So we need to skip every fourth vertexData.tangent.\n if ((index + 1) % 4 !== 0) {\n tangents[dataIndex] = data[dataIndex] + value;\n dataIndex++;\n }\n });\n babylonMorphTarget.setTangents(tangents);\n });\n return Promise.all(promises).then(() => { });\n }\n static _LoadTransform(node, babylonNode) {\n // Ignore the TRS of skinned nodes.\n // See https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins (second implementation note)\n if (node.skin != undefined) {\n return;\n }\n let position = Vector3.Zero();\n let rotation = Quaternion.Identity();\n let scaling = Vector3.One();\n if (node.matrix) {\n const matrix = Matrix.FromArray(node.matrix);\n matrix.decompose(scaling, rotation, position);\n }\n else {\n if (node.translation) {\n position = Vector3.FromArray(node.translation);\n }\n if (node.rotation) {\n rotation = Quaternion.FromArray(node.rotation);\n }\n if (node.scale) {\n scaling = Vector3.FromArray(node.scale);\n }\n }\n babylonNode.position = position;\n babylonNode.rotationQuaternion = rotation;\n babylonNode.scaling = scaling;\n }\n _loadSkinAsync(context, node, skin, assign) {\n const extensionPromise = this._extensionsLoadSkinAsync(context, node, skin);\n if (extensionPromise) {\n return extensionPromise;\n }\n if (skin._data) {\n assign(skin._data.babylonSkeleton);\n return skin._data.promise;\n }\n const skeletonId = `skeleton${skin.index}`;\n this._babylonScene._blockEntityCollection = !!this._assetContainer;\n const babylonSkeleton = new Skeleton(skin.name || skeletonId, skeletonId, this._babylonScene);\n babylonSkeleton._parentContainer = this._assetContainer;\n this._babylonScene._blockEntityCollection = false;\n this._loadBones(context, skin, babylonSkeleton);\n const promise = this._loadSkinInverseBindMatricesDataAsync(context, skin).then((inverseBindMatricesData) => {\n this._updateBoneMatrices(babylonSkeleton, inverseBindMatricesData);\n });\n skin._data = {\n babylonSkeleton: babylonSkeleton,\n promise: promise,\n };\n assign(babylonSkeleton);\n return promise;\n }\n _loadBones(context, skin, babylonSkeleton) {\n if (skin.skeleton == undefined || this._parent.alwaysComputeSkeletonRootNode) {\n const rootNode = this._findSkeletonRootNode(`${context}/joints`, skin.joints);\n if (rootNode) {\n if (skin.skeleton === undefined) {\n skin.skeleton = rootNode.index;\n }\n else {\n const isParent = (a, b) => {\n for (; b.parent; b = b.parent) {\n if (b.parent === a) {\n return true;\n }\n }\n return false;\n };\n const skeletonNode = ArrayItem.Get(`${context}/skeleton`, this._gltf.nodes, skin.skeleton);\n if (skeletonNode !== rootNode && !isParent(skeletonNode, rootNode)) {\n Logger.Warn(`${context}/skeleton: Overriding with nearest common ancestor as skeleton node is not a common root`);\n skin.skeleton = rootNode.index;\n }\n }\n }\n else {\n Logger.Warn(`${context}: Failed to find common root`);\n }\n }\n const babylonBones = {};\n for (const index of skin.joints) {\n const node = ArrayItem.Get(`${context}/joints/${index}`, this._gltf.nodes, index);\n this._loadBone(node, skin, babylonSkeleton, babylonBones);\n }\n }\n _findSkeletonRootNode(context, joints) {\n if (joints.length === 0) {\n return null;\n }\n const paths = {};\n for (const index of joints) {\n const path = new Array();\n let node = ArrayItem.Get(`${context}/${index}`, this._gltf.nodes, index);\n while (node.index !== -1) {\n path.unshift(node);\n node = node.parent;\n }\n paths[index] = path;\n }\n let rootNode = null;\n for (let i = 0;; ++i) {\n let path = paths[joints[0]];\n if (i >= path.length) {\n return rootNode;\n }\n const node = path[i];\n for (let j = 1; j < joints.length; ++j) {\n path = paths[joints[j]];\n if (i >= path.length || node !== path[i]) {\n return rootNode;\n }\n }\n rootNode = node;\n }\n }\n _loadBone(node, skin, babylonSkeleton, babylonBones) {\n let babylonBone = babylonBones[node.index];\n if (babylonBone) {\n return babylonBone;\n }\n let parentBabylonBone = null;\n if (node.index !== skin.skeleton) {\n if (node.parent && node.parent.index !== -1) {\n parentBabylonBone = this._loadBone(node.parent, skin, babylonSkeleton, babylonBones);\n }\n else if (skin.skeleton !== undefined) {\n Logger.Warn(`/skins/${skin.index}/skeleton: Skeleton node is not a common root`);\n }\n }\n const boneIndex = skin.joints.indexOf(node.index);\n babylonBone = new Bone(node.name || `joint${node.index}`, babylonSkeleton, parentBabylonBone, this._getNodeMatrix(node), null, null, boneIndex);\n babylonBones[node.index] = babylonBone;\n // Wait until the scene is loaded to ensure the transform nodes are loaded.\n this._postSceneLoadActions.push(() => {\n // Link the Babylon bone with the corresponding Babylon transform node.\n // A glTF joint is a pointer to a glTF node in the glTF node hierarchy similar to Unity3D.\n babylonBone.linkTransformNode(node._babylonTransformNode);\n });\n return babylonBone;\n }\n _loadSkinInverseBindMatricesDataAsync(context, skin) {\n if (skin.inverseBindMatrices == undefined) {\n return Promise.resolve(null);\n }\n const accessor = ArrayItem.Get(`${context}/inverseBindMatrices`, this._gltf.accessors, skin.inverseBindMatrices);\n return this._loadFloatAccessorAsync(`/accessors/${accessor.index}`, accessor);\n }\n _updateBoneMatrices(babylonSkeleton, inverseBindMatricesData) {\n for (const babylonBone of babylonSkeleton.bones) {\n const baseMatrix = Matrix.Identity();\n const boneIndex = babylonBone._index;\n if (inverseBindMatricesData && boneIndex !== -1) {\n Matrix.FromArrayToRef(inverseBindMatricesData, boneIndex * 16, baseMatrix);\n baseMatrix.invertToRef(baseMatrix);\n }\n const babylonParentBone = babylonBone.getParent();\n if (babylonParentBone) {\n baseMatrix.multiplyToRef(babylonParentBone.getAbsoluteInverseBindMatrix(), baseMatrix);\n }\n babylonBone.updateMatrix(baseMatrix, false, false);\n babylonBone._updateAbsoluteBindMatrices(undefined, false);\n }\n }\n _getNodeMatrix(node) {\n return node.matrix\n ? Matrix.FromArray(node.matrix)\n : Matrix.Compose(node.scale ? Vector3.FromArray(node.scale) : Vector3.One(), node.rotation ? Quaternion.FromArray(node.rotation) : Quaternion.Identity(), node.translation ? Vector3.FromArray(node.translation) : Vector3.Zero());\n }\n /**\n * Loads a glTF camera.\n * @param context The context when loading the asset\n * @param camera The glTF camera property\n * @param assign A function called synchronously after parsing the glTF properties\n * @returns A promise that resolves with the loaded Babylon camera when the load is complete\n */\n loadCameraAsync(context, camera, assign = () => { }) {\n const extensionPromise = this._extensionsLoadCameraAsync(context, camera, assign);\n if (extensionPromise) {\n return extensionPromise;\n }\n const promises = new Array();\n this.logOpen(`${context} ${camera.name || \"\"}`);\n this._babylonScene._blockEntityCollection = !!this._assetContainer;\n const babylonCamera = new FreeCamera(camera.name || `camera${camera.index}`, Vector3.Zero(), this._babylonScene, false);\n babylonCamera._parentContainer = this._assetContainer;\n this._babylonScene._blockEntityCollection = false;\n babylonCamera.ignoreParentScaling = true;\n camera._babylonCamera = babylonCamera;\n babylonCamera.rotation = new Vector3(0, Math.PI, 0);\n switch (camera.type) {\n case \"perspective\" /* CameraType.PERSPECTIVE */: {\n const perspective = camera.perspective;\n if (!perspective) {\n throw new Error(`${context}: Camera perspective properties are missing`);\n }\n babylonCamera.fov = perspective.yfov;\n babylonCamera.minZ = perspective.znear;\n babylonCamera.maxZ = perspective.zfar || 0;\n break;\n }\n case \"orthographic\" /* CameraType.ORTHOGRAPHIC */: {\n if (!camera.orthographic) {\n throw new Error(`${context}: Camera orthographic properties are missing`);\n }\n babylonCamera.mode = Camera.ORTHOGRAPHIC_CAMERA;\n babylonCamera.orthoLeft = -camera.orthographic.xmag;\n babylonCamera.orthoRight = camera.orthographic.xmag;\n babylonCamera.orthoBottom = -camera.orthographic.ymag;\n babylonCamera.orthoTop = camera.orthographic.ymag;\n babylonCamera.minZ = camera.orthographic.znear;\n babylonCamera.maxZ = camera.orthographic.zfar;\n break;\n }\n default: {\n throw new Error(`${context}: Invalid camera type (${camera.type})`);\n }\n }\n GLTFLoader.AddPointerMetadata(babylonCamera, context);\n this._parent.onCameraLoadedObservable.notifyObservers(babylonCamera);\n assign(babylonCamera);\n this.logClose();\n return Promise.all(promises).then(() => {\n return babylonCamera;\n });\n }\n _loadAnimationsAsync() {\n const animations = this._gltf.animations;\n if (!animations) {\n return Promise.resolve();\n }\n const promises = new Array();\n for (let index = 0; index < animations.length; index++) {\n const animation = animations[index];\n promises.push(this.loadAnimationAsync(`/animations/${animation.index}`, animation).then((animationGroup) => {\n // Delete the animation group if it ended up not having any animations in it.\n if (animationGroup.targetedAnimations.length === 0) {\n animationGroup.dispose();\n }\n }));\n }\n return Promise.all(promises).then(() => { });\n }\n /**\n * Loads a glTF animation.\n * @param context The context when loading the asset\n * @param animation The glTF animation property\n * @returns A promise that resolves with the loaded Babylon animation group when the load is complete\n */\n loadAnimationAsync(context, animation) {\n const promise = this._extensionsLoadAnimationAsync(context, animation);\n if (promise) {\n return promise;\n }\n this._babylonScene._blockEntityCollection = !!this._assetContainer;\n const babylonAnimationGroup = new AnimationGroup(animation.name || `animation${animation.index}`, this._babylonScene);\n babylonAnimationGroup._parentContainer = this._assetContainer;\n this._babylonScene._blockEntityCollection = false;\n animation._babylonAnimationGroup = babylonAnimationGroup;\n const promises = new Array();\n ArrayItem.Assign(animation.channels);\n ArrayItem.Assign(animation.samplers);\n for (const channel of animation.channels) {\n promises.push(this._loadAnimationChannelAsync(`${context}/channels/${channel.index}`, context, animation, channel, (babylonTarget, babylonAnimation) => {\n babylonTarget.animations = babylonTarget.animations || [];\n babylonTarget.animations.push(babylonAnimation);\n babylonAnimationGroup.addTargetedAnimation(babylonAnimation, babylonTarget);\n }));\n }\n return Promise.all(promises).then(() => {\n babylonAnimationGroup.normalize(0);\n return babylonAnimationGroup;\n });\n }\n /**\n * @hidden\n * Loads a glTF animation channel.\n * @param context The context when loading the asset\n * @param animationContext The context of the animation when loading the asset\n * @param animation The glTF animation property\n * @param channel The glTF animation channel property\n * @param onLoad Called for each animation loaded\n * @returns A void promise that resolves when the load is complete\n */\n _loadAnimationChannelAsync(context, animationContext, animation, channel, onLoad) {\n const promise = this._extensionsLoadAnimationChannelAsync(context, animationContext, animation, channel, onLoad);\n if (promise) {\n return promise;\n }\n if (channel.target.node == undefined) {\n return Promise.resolve();\n }\n const targetNode = ArrayItem.Get(`${context}/target/node`, this._gltf.nodes, channel.target.node);\n // Ignore animations that have no animation targets.\n if ((channel.target.path === \"weights\" /* AnimationChannelTargetPath.WEIGHTS */ && !targetNode._numMorphTargets) ||\n (channel.target.path !== \"weights\" /* AnimationChannelTargetPath.WEIGHTS */ && !targetNode._babylonTransformNode)) {\n return Promise.resolve();\n }\n let properties;\n switch (channel.target.path) {\n case \"translation\" /* AnimationChannelTargetPath.TRANSLATION */: {\n properties = nodeAnimationData.translation;\n break;\n }\n case \"rotation\" /* AnimationChannelTargetPath.ROTATION */: {\n properties = nodeAnimationData.rotation;\n break;\n }\n case \"scale\" /* AnimationChannelTargetPath.SCALE */: {\n properties = nodeAnimationData.scale;\n break;\n }\n case \"weights\" /* AnimationChannelTargetPath.WEIGHTS */: {\n properties = nodeAnimationData.weights;\n break;\n }\n default: {\n throw new Error(`${context}/target/path: Invalid value (${channel.target.path})`);\n }\n }\n const targetInfo = {\n target: targetNode,\n properties: properties,\n };\n return this._loadAnimationChannelFromTargetInfoAsync(context, animationContext, animation, channel, targetInfo, onLoad);\n }\n /**\n * @hidden\n * Loads a glTF animation channel.\n * @param context The context when loading the asset\n * @param animationContext The context of the animation when loading the asset\n * @param animation The glTF animation property\n * @param channel The glTF animation channel property\n * @param targetInfo The glTF target and properties\n * @param onLoad Called for each animation loaded\n * @returns A void promise that resolves when the load is complete\n */\n _loadAnimationChannelFromTargetInfoAsync(context, animationContext, animation, channel, targetInfo, onLoad) {\n const fps = this.parent.targetFps;\n const invfps = 1 / fps;\n const sampler = ArrayItem.Get(`${context}/sampler`, animation.samplers, channel.sampler);\n return this._loadAnimationSamplerAsync(`${animationContext}/samplers/${channel.sampler}`, sampler).then((data) => {\n let numAnimations = 0;\n // Extract the corresponding values from the read value.\n // GLTF values may be dispatched to several Babylon properties.\n // For example, baseColorFactor [`r`, `g`, `b`, `a`] is dispatched to\n // - albedoColor as Color3(`r`, `g`, `b`)\n // - alpha as `a`\n for (const property of targetInfo.properties) {\n const stride = property.getStride(targetInfo.target);\n const input = data.input;\n const output = data.output;\n const keys = new Array(input.length);\n let outputOffset = 0;\n switch (data.interpolation) {\n case \"STEP\" /* AnimationSamplerInterpolation.STEP */: {\n for (let index = 0; index < input.length; index++) {\n const value = property.getValue(targetInfo.target, output, outputOffset, 1);\n outputOffset += stride;\n keys[index] = {\n frame: input[index] * fps,\n value: value,\n interpolation: AnimationKeyInterpolation.STEP,\n };\n }\n break;\n }\n case \"CUBICSPLINE\" /* AnimationSamplerInterpolation.CUBICSPLINE */: {\n for (let index = 0; index < input.length; index++) {\n const inTangent = property.getValue(targetInfo.target, output, outputOffset, invfps);\n outputOffset += stride;\n const value = property.getValue(targetInfo.target, output, outputOffset, 1);\n outputOffset += stride;\n const outTangent = property.getValue(targetInfo.target, output, outputOffset, invfps);\n outputOffset += stride;\n keys[index] = {\n frame: input[index] * fps,\n inTangent: inTangent,\n value: value,\n outTangent: outTangent,\n };\n }\n break;\n }\n case \"LINEAR\" /* AnimationSamplerInterpolation.LINEAR */: {\n for (let index = 0; index < input.length; index++) {\n const value = property.getValue(targetInfo.target, output, outputOffset, 1);\n outputOffset += stride;\n keys[index] = {\n frame: input[index] * fps,\n value: value,\n };\n }\n break;\n }\n }\n if (outputOffset > 0) {\n const name = `${animation.name || `animation${animation.index}`}_channel${channel.index}_${numAnimations}`;\n property.buildAnimations(targetInfo.target, name, fps, keys, (babylonAnimatable, babylonAnimation) => {\n ++numAnimations;\n onLoad(babylonAnimatable, babylonAnimation);\n });\n }\n }\n });\n }\n _loadAnimationSamplerAsync(context, sampler) {\n if (sampler._data) {\n return sampler._data;\n }\n const interpolation = sampler.interpolation || \"LINEAR\" /* AnimationSamplerInterpolation.LINEAR */;\n switch (interpolation) {\n case \"STEP\" /* AnimationSamplerInterpolation.STEP */:\n case \"LINEAR\" /* AnimationSamplerInterpolation.LINEAR */:\n case \"CUBICSPLINE\" /* AnimationSamplerInterpolation.CUBICSPLINE */: {\n break;\n }\n default: {\n throw new Error(`${context}/interpolation: Invalid value (${sampler.interpolation})`);\n }\n }\n const inputAccessor = ArrayItem.Get(`${context}/input`, this._gltf.accessors, sampler.input);\n const outputAccessor = ArrayItem.Get(`${context}/output`, this._gltf.accessors, sampler.output);\n sampler._data = Promise.all([\n this._loadFloatAccessorAsync(`/accessors/${inputAccessor.index}`, inputAccessor),\n this._loadFloatAccessorAsync(`/accessors/${outputAccessor.index}`, outputAccessor),\n ]).then(([inputData, outputData]) => {\n return {\n input: inputData,\n interpolation: interpolation,\n output: outputData,\n };\n });\n return sampler._data;\n }\n /**\n * Loads a glTF buffer.\n * @param context The context when loading the asset\n * @param buffer The glTF buffer property\n * @param byteOffset The byte offset to use\n * @param byteLength The byte length to use\n * @returns A promise that resolves with the loaded data when the load is complete\n */\n loadBufferAsync(context, buffer, byteOffset, byteLength) {\n const extensionPromise = this._extensionsLoadBufferAsync(context, buffer, byteOffset, byteLength);\n if (extensionPromise) {\n return extensionPromise;\n }\n if (!buffer._data) {\n if (buffer.uri) {\n buffer._data = this.loadUriAsync(`${context}/uri`, buffer, buffer.uri);\n }\n else {\n if (!this._bin) {\n throw new Error(`${context}: Uri is missing or the binary glTF is missing its binary chunk`);\n }\n buffer._data = this._bin.readAsync(0, buffer.byteLength);\n }\n }\n return buffer._data.then((data) => {\n try {\n return new Uint8Array(data.buffer, data.byteOffset + byteOffset, byteLength);\n }\n catch (e) {\n throw new Error(`${context}: ${e.message}`);\n }\n });\n }\n /**\n * Loads a glTF buffer view.\n * @param context The context when loading the asset\n * @param bufferView The glTF buffer view property\n * @returns A promise that resolves with the loaded data when the load is complete\n */\n loadBufferViewAsync(context, bufferView) {\n const extensionPromise = this._extensionsLoadBufferViewAsync(context, bufferView);\n if (extensionPromise) {\n return extensionPromise;\n }\n if (bufferView._data) {\n return bufferView._data;\n }\n const buffer = ArrayItem.Get(`${context}/buffer`, this._gltf.buffers, bufferView.buffer);\n bufferView._data = this.loadBufferAsync(`/buffers/${buffer.index}`, buffer, bufferView.byteOffset || 0, bufferView.byteLength);\n return bufferView._data;\n }\n _loadAccessorAsync(context, accessor, constructor) {\n if (accessor._data) {\n return accessor._data;\n }\n const numComponents = GLTFLoader._GetNumComponents(context, accessor.type);\n const byteStride = numComponents * VertexBuffer.GetTypeByteLength(accessor.componentType);\n const length = numComponents * accessor.count;\n if (accessor.bufferView == undefined) {\n accessor._data = Promise.resolve(new constructor(length));\n }\n else {\n const bufferView = ArrayItem.Get(`${context}/bufferView`, this._gltf.bufferViews, accessor.bufferView);\n accessor._data = this.loadBufferViewAsync(`/bufferViews/${bufferView.index}`, bufferView).then((data) => {\n if (accessor.componentType === 5126 /* AccessorComponentType.FLOAT */ && !accessor.normalized && (!bufferView.byteStride || bufferView.byteStride === byteStride)) {\n return GLTFLoader._GetTypedArray(context, accessor.componentType, data, accessor.byteOffset, length);\n }\n else {\n const typedArray = new constructor(length);\n VertexBuffer.ForEach(data, accessor.byteOffset || 0, bufferView.byteStride || byteStride, numComponents, accessor.componentType, typedArray.length, accessor.normalized || false, (value, index) => {\n typedArray[index] = value;\n });\n return typedArray;\n }\n });\n }\n if (accessor.sparse) {\n const sparse = accessor.sparse;\n accessor._data = accessor._data.then((data) => {\n const typedArray = data;\n const indicesBufferView = ArrayItem.Get(`${context}/sparse/indices/bufferView`, this._gltf.bufferViews, sparse.indices.bufferView);\n const valuesBufferView = ArrayItem.Get(`${context}/sparse/values/bufferView`, this._gltf.bufferViews, sparse.values.bufferView);\n return Promise.all([\n this.loadBufferViewAsync(`/bufferViews/${indicesBufferView.index}`, indicesBufferView),\n this.loadBufferViewAsync(`/bufferViews/${valuesBufferView.index}`, valuesBufferView),\n ]).then(([indicesData, valuesData]) => {\n const indices = GLTFLoader._GetTypedArray(`${context}/sparse/indices`, sparse.indices.componentType, indicesData, sparse.indices.byteOffset, sparse.count);\n const sparseLength = numComponents * sparse.count;\n let values;\n if (accessor.componentType === 5126 /* AccessorComponentType.FLOAT */ && !accessor.normalized) {\n values = GLTFLoader._GetTypedArray(`${context}/sparse/values`, accessor.componentType, valuesData, sparse.values.byteOffset, sparseLength);\n }\n else {\n const sparseData = GLTFLoader._GetTypedArray(`${context}/sparse/values`, accessor.componentType, valuesData, sparse.values.byteOffset, sparseLength);\n values = new constructor(sparseLength);\n VertexBuffer.ForEach(sparseData, 0, byteStride, numComponents, accessor.componentType, values.length, accessor.normalized || false, (value, index) => {\n values[index] = value;\n });\n }\n let valuesIndex = 0;\n for (let indicesIndex = 0; indicesIndex < indices.length; indicesIndex++) {\n let dataIndex = indices[indicesIndex] * numComponents;\n for (let componentIndex = 0; componentIndex < numComponents; componentIndex++) {\n typedArray[dataIndex++] = values[valuesIndex++];\n }\n }\n return typedArray;\n });\n });\n }\n return accessor._data;\n }\n /**\n * @internal\n */\n _loadFloatAccessorAsync(context, accessor) {\n return this._loadAccessorAsync(context, accessor, Float32Array);\n }\n /**\n * @internal\n */\n _loadIndicesAccessorAsync(context, accessor) {\n if (accessor.type !== \"SCALAR\" /* AccessorType.SCALAR */) {\n throw new Error(`${context}/type: Invalid value ${accessor.type}`);\n }\n if (accessor.componentType !== 5121 /* AccessorComponentType.UNSIGNED_BYTE */ &&\n accessor.componentType !== 5123 /* AccessorComponentType.UNSIGNED_SHORT */ &&\n accessor.componentType !== 5125 /* AccessorComponentType.UNSIGNED_INT */) {\n throw new Error(`${context}/componentType: Invalid value ${accessor.componentType}`);\n }\n if (accessor._data) {\n return accessor._data;\n }\n if (accessor.sparse) {\n const constructor = GLTFLoader._GetTypedArrayConstructor(`${context}/componentType`, accessor.componentType);\n accessor._data = this._loadAccessorAsync(context, accessor, constructor);\n }\n else {\n const bufferView = ArrayItem.Get(`${context}/bufferView`, this._gltf.bufferViews, accessor.bufferView);\n accessor._data = this.loadBufferViewAsync(`/bufferViews/${bufferView.index}`, bufferView).then((data) => {\n return GLTFLoader._GetTypedArray(context, accessor.componentType, data, accessor.byteOffset, accessor.count);\n });\n }\n return accessor._data;\n }\n /**\n * @internal\n */\n _loadVertexBufferViewAsync(bufferView) {\n if (bufferView._babylonBuffer) {\n return bufferView._babylonBuffer;\n }\n const engine = this._babylonScene.getEngine();\n bufferView._babylonBuffer = this.loadBufferViewAsync(`/bufferViews/${bufferView.index}`, bufferView).then((data) => {\n return new Buffer(engine, data, false);\n });\n return bufferView._babylonBuffer;\n }\n /**\n * @internal\n */\n _loadVertexAccessorAsync(context, accessor, kind) {\n var _a;\n if ((_a = accessor._babylonVertexBuffer) === null || _a === void 0 ? void 0 : _a[kind]) {\n return accessor._babylonVertexBuffer[kind];\n }\n if (!accessor._babylonVertexBuffer) {\n accessor._babylonVertexBuffer = {};\n }\n const engine = this._babylonScene.getEngine();\n if (accessor.sparse) {\n accessor._babylonVertexBuffer[kind] = this._loadFloatAccessorAsync(context, accessor).then((data) => {\n return new VertexBuffer(engine, data, kind, false);\n });\n }\n // Load joint indices as a float array since the shaders expect float data but glTF uses unsigned byte/short.\n // This prevents certain platforms (e.g. D3D) from having to convert the data to float on the fly.\n else if (kind === VertexBuffer.MatricesIndicesKind || kind === VertexBuffer.MatricesIndicesExtraKind) {\n accessor._babylonVertexBuffer[kind] = this._loadFloatAccessorAsync(context, accessor).then((data) => {\n return new VertexBuffer(engine, data, kind, false);\n });\n }\n else {\n const bufferView = ArrayItem.Get(`${context}/bufferView`, this._gltf.bufferViews, accessor.bufferView);\n accessor._babylonVertexBuffer[kind] = this._loadVertexBufferViewAsync(bufferView).then((babylonBuffer) => {\n const size = GLTFLoader._GetNumComponents(context, accessor.type);\n return new VertexBuffer(engine, babylonBuffer, kind, false, false, bufferView.byteStride, false, accessor.byteOffset, size, accessor.componentType, accessor.normalized, true, 1, true);\n });\n }\n return accessor._babylonVertexBuffer[kind];\n }\n _loadMaterialMetallicRoughnessPropertiesAsync(context, properties, babylonMaterial) {\n if (!(babylonMaterial instanceof PBRMaterial)) {\n throw new Error(`${context}: Material type not supported`);\n }\n const promises = new Array();\n if (properties) {\n if (properties.baseColorFactor) {\n babylonMaterial.albedoColor = Color3.FromArray(properties.baseColorFactor);\n babylonMaterial.alpha = properties.baseColorFactor[3];\n }\n else {\n babylonMaterial.albedoColor = Color3.White();\n }\n babylonMaterial.metallic = properties.metallicFactor == undefined ? 1 : properties.metallicFactor;\n babylonMaterial.roughness = properties.roughnessFactor == undefined ? 1 : properties.roughnessFactor;\n if (properties.baseColorTexture) {\n promises.push(this.loadTextureInfoAsync(`${context}/baseColorTexture`, properties.baseColorTexture, (texture) => {\n texture.name = `${babylonMaterial.name} (Base Color)`;\n babylonMaterial.albedoTexture = texture;\n }));\n }\n if (properties.metallicRoughnessTexture) {\n properties.metallicRoughnessTexture.nonColorData = true;\n promises.push(this.loadTextureInfoAsync(`${context}/metallicRoughnessTexture`, properties.metallicRoughnessTexture, (texture) => {\n texture.name = `${babylonMaterial.name} (Metallic Roughness)`;\n babylonMaterial.metallicTexture = texture;\n }));\n babylonMaterial.useMetallnessFromMetallicTextureBlue = true;\n babylonMaterial.useRoughnessFromMetallicTextureGreen = true;\n babylonMaterial.useRoughnessFromMetallicTextureAlpha = false;\n }\n }\n return Promise.all(promises).then(() => { });\n }\n /**\n * @internal\n */\n _loadMaterialAsync(context, material, babylonMesh, babylonDrawMode, assign = () => { }) {\n const extensionPromise = this._extensionsLoadMaterialAsync(context, material, babylonMesh, babylonDrawMode, assign);\n if (extensionPromise) {\n return extensionPromise;\n }\n material._data = material._data || {};\n let babylonData = material._data[babylonDrawMode];\n if (!babylonData) {\n this.logOpen(`${context} ${material.name || \"\"}`);\n const babylonMaterial = this.createMaterial(context, material, babylonDrawMode);\n babylonData = {\n babylonMaterial: babylonMaterial,\n babylonMeshes: [],\n promise: this.loadMaterialPropertiesAsync(context, material, babylonMaterial),\n };\n material._data[babylonDrawMode] = babylonData;\n GLTFLoader.AddPointerMetadata(babylonMaterial, context);\n this._parent.onMaterialLoadedObservable.notifyObservers(babylonMaterial);\n this.logClose();\n }\n if (babylonMesh) {\n babylonData.babylonMeshes.push(babylonMesh);\n babylonMesh.onDisposeObservable.addOnce(() => {\n const index = babylonData.babylonMeshes.indexOf(babylonMesh);\n if (index !== -1) {\n babylonData.babylonMeshes.splice(index, 1);\n }\n });\n }\n assign(babylonData.babylonMaterial);\n return babylonData.promise.then(() => {\n return babylonData.babylonMaterial;\n });\n }\n _createDefaultMaterial(name, babylonDrawMode) {\n this._babylonScene._blockEntityCollection = !!this._assetContainer;\n const babylonMaterial = new PBRMaterial(name, this._babylonScene);\n babylonMaterial._parentContainer = this._assetContainer;\n this._babylonScene._blockEntityCollection = false;\n // Moved to mesh so user can change materials on gltf meshes: babylonMaterial.sideOrientation = this._babylonScene.useRightHandedSystem ? Material.CounterClockWiseSideOrientation : Material.ClockWiseSideOrientation;\n babylonMaterial.fillMode = babylonDrawMode;\n babylonMaterial.enableSpecularAntiAliasing = true;\n babylonMaterial.useRadianceOverAlpha = !this._parent.transparencyAsCoverage;\n babylonMaterial.useSpecularOverAlpha = !this._parent.transparencyAsCoverage;\n babylonMaterial.transparencyMode = PBRMaterial.PBRMATERIAL_OPAQUE;\n babylonMaterial.metallic = 1;\n babylonMaterial.roughness = 1;\n return babylonMaterial;\n }\n /**\n * Creates a Babylon material from a glTF material.\n * @param context The context when loading the asset\n * @param material The glTF material property\n * @param babylonDrawMode The draw mode for the Babylon material\n * @returns The Babylon material\n */\n createMaterial(context, material, babylonDrawMode) {\n const extensionPromise = this._extensionsCreateMaterial(context, material, babylonDrawMode);\n if (extensionPromise) {\n return extensionPromise;\n }\n const name = material.name || `material${material.index}`;\n const babylonMaterial = this._createDefaultMaterial(name, babylonDrawMode);\n return babylonMaterial;\n }\n /**\n * Loads properties from a glTF material into a Babylon material.\n * @param context The context when loading the asset\n * @param material The glTF material property\n * @param babylonMaterial The Babylon material\n * @returns A promise that resolves when the load is complete\n */\n loadMaterialPropertiesAsync(context, material, babylonMaterial) {\n const extensionPromise = this._extensionsLoadMaterialPropertiesAsync(context, material, babylonMaterial);\n if (extensionPromise) {\n return extensionPromise;\n }\n const promises = new Array();\n promises.push(this.loadMaterialBasePropertiesAsync(context, material, babylonMaterial));\n if (material.pbrMetallicRoughness) {\n promises.push(this._loadMaterialMetallicRoughnessPropertiesAsync(`${context}/pbrMetallicRoughness`, material.pbrMetallicRoughness, babylonMaterial));\n }\n this.loadMaterialAlphaProperties(context, material, babylonMaterial);\n return Promise.all(promises).then(() => { });\n }\n /**\n * Loads the normal, occlusion, and emissive properties from a glTF material into a Babylon material.\n * @param context The context when loading the asset\n * @param material The glTF material property\n * @param babylonMaterial The Babylon material\n * @returns A promise that resolves when the load is complete\n */\n loadMaterialBasePropertiesAsync(context, material, babylonMaterial) {\n if (!(babylonMaterial instanceof PBRMaterial)) {\n throw new Error(`${context}: Material type not supported`);\n }\n const promises = new Array();\n babylonMaterial.emissiveColor = material.emissiveFactor ? Color3.FromArray(material.emissiveFactor) : new Color3(0, 0, 0);\n if (material.doubleSided) {\n babylonMaterial.backFaceCulling = false;\n babylonMaterial.twoSidedLighting = true;\n }\n if (material.normalTexture) {\n material.normalTexture.nonColorData = true;\n promises.push(this.loadTextureInfoAsync(`${context}/normalTexture`, material.normalTexture, (texture) => {\n texture.name = `${babylonMaterial.name} (Normal)`;\n babylonMaterial.bumpTexture = texture;\n }));\n babylonMaterial.invertNormalMapX = !this._babylonScene.useRightHandedSystem;\n babylonMaterial.invertNormalMapY = this._babylonScene.useRightHandedSystem;\n if (material.normalTexture.scale != undefined && babylonMaterial.bumpTexture) {\n babylonMaterial.bumpTexture.level = material.normalTexture.scale;\n }\n babylonMaterial.forceIrradianceInFragment = true;\n }\n if (material.occlusionTexture) {\n material.occlusionTexture.nonColorData = true;\n promises.push(this.loadTextureInfoAsync(`${context}/occlusionTexture`, material.occlusionTexture, (texture) => {\n texture.name = `${babylonMaterial.name} (Occlusion)`;\n babylonMaterial.ambientTexture = texture;\n }));\n babylonMaterial.useAmbientInGrayScale = true;\n if (material.occlusionTexture.strength != undefined) {\n babylonMaterial.ambientTextureStrength = material.occlusionTexture.strength;\n }\n }\n if (material.emissiveTexture) {\n promises.push(this.loadTextureInfoAsync(`${context}/emissiveTexture`, material.emissiveTexture, (texture) => {\n texture.name = `${babylonMaterial.name} (Emissive)`;\n babylonMaterial.emissiveTexture = texture;\n }));\n }\n return Promise.all(promises).then(() => { });\n }\n /**\n * Loads the alpha properties from a glTF material into a Babylon material.\n * Must be called after the setting the albedo texture of the Babylon material when the material has an albedo texture.\n * @param context The context when loading the asset\n * @param material The glTF material property\n * @param babylonMaterial The Babylon material\n */\n loadMaterialAlphaProperties(context, material, babylonMaterial) {\n if (!(babylonMaterial instanceof PBRMaterial)) {\n throw new Error(`${context}: Material type not supported`);\n }\n const alphaMode = material.alphaMode || \"OPAQUE\" /* MaterialAlphaMode.OPAQUE */;\n switch (alphaMode) {\n case \"OPAQUE\" /* MaterialAlphaMode.OPAQUE */: {\n babylonMaterial.transparencyMode = PBRMaterial.PBRMATERIAL_OPAQUE;\n break;\n }\n case \"MASK\" /* MaterialAlphaMode.MASK */: {\n babylonMaterial.transparencyMode = PBRMaterial.PBRMATERIAL_ALPHATEST;\n babylonMaterial.alphaCutOff = material.alphaCutoff == undefined ? 0.5 : material.alphaCutoff;\n if (babylonMaterial.albedoTexture) {\n babylonMaterial.albedoTexture.hasAlpha = true;\n }\n break;\n }\n case \"BLEND\" /* MaterialAlphaMode.BLEND */: {\n babylonMaterial.transparencyMode = PBRMaterial.PBRMATERIAL_ALPHABLEND;\n if (babylonMaterial.albedoTexture) {\n babylonMaterial.albedoTexture.hasAlpha = true;\n babylonMaterial.useAlphaFromAlbedoTexture = true;\n }\n break;\n }\n default: {\n throw new Error(`${context}/alphaMode: Invalid value (${material.alphaMode})`);\n }\n }\n }\n /**\n * Loads a glTF texture info.\n * @param context The context when loading the asset\n * @param textureInfo The glTF texture info property\n * @param assign A function called synchronously after parsing the glTF properties\n * @returns A promise that resolves with the loaded Babylon texture when the load is complete\n */\n loadTextureInfoAsync(context, textureInfo, assign = () => { }) {\n const extensionPromise = this._extensionsLoadTextureInfoAsync(context, textureInfo, assign);\n if (extensionPromise) {\n return extensionPromise;\n }\n this.logOpen(`${context}`);\n if (textureInfo.texCoord >= 6) {\n throw new Error(`${context}/texCoord: Invalid value (${textureInfo.texCoord})`);\n }\n const texture = ArrayItem.Get(`${context}/index`, this._gltf.textures, textureInfo.index);\n texture._textureInfo = textureInfo;\n const promise = this._loadTextureAsync(`/textures/${textureInfo.index}`, texture, (babylonTexture) => {\n babylonTexture.coordinatesIndex = textureInfo.texCoord || 0;\n GLTFLoader.AddPointerMetadata(babylonTexture, context);\n this._parent.onTextureLoadedObservable.notifyObservers(babylonTexture);\n assign(babylonTexture);\n });\n this.logClose();\n return promise;\n }\n /**\n * @internal\n */\n _loadTextureAsync(context, texture, assign = () => { }) {\n const extensionPromise = this._extensionsLoadTextureAsync(context, texture, assign);\n if (extensionPromise) {\n return extensionPromise;\n }\n this.logOpen(`${context} ${texture.name || \"\"}`);\n const sampler = texture.sampler == undefined ? GLTFLoader.DefaultSampler : ArrayItem.Get(`${context}/sampler`, this._gltf.samplers, texture.sampler);\n const image = ArrayItem.Get(`${context}/source`, this._gltf.images, texture.source);\n const promise = this._createTextureAsync(context, sampler, image, assign, undefined, !texture._textureInfo.nonColorData);\n this.logClose();\n return promise;\n }\n /**\n * @internal\n */\n _createTextureAsync(context, sampler, image, assign = () => { }, textureLoaderOptions, useSRGBBuffer) {\n const samplerData = this._loadSampler(`/samplers/${sampler.index}`, sampler);\n const promises = new Array();\n const deferred = new Deferred();\n this._babylonScene._blockEntityCollection = !!this._assetContainer;\n const textureCreationOptions = {\n noMipmap: samplerData.noMipMaps,\n invertY: false,\n samplingMode: samplerData.samplingMode,\n onLoad: () => {\n if (!this._disposed) {\n deferred.resolve();\n }\n },\n onError: (message, exception) => {\n if (!this._disposed) {\n deferred.reject(new Error(`${context}: ${exception && exception.message ? exception.message : message || \"Failed to load texture\"}`));\n }\n },\n mimeType: image.mimeType,\n loaderOptions: textureLoaderOptions,\n useSRGBBuffer: !!useSRGBBuffer && this._parent.useSRGBBuffers,\n };\n const babylonTexture = new Texture(null, this._babylonScene, textureCreationOptions);\n babylonTexture._parentContainer = this._assetContainer;\n this._babylonScene._blockEntityCollection = false;\n promises.push(deferred.promise);\n promises.push(this.loadImageAsync(`/images/${image.index}`, image).then((data) => {\n const name = image.uri || `${this._fileName}#image${image.index}`;\n const dataUrl = `data:${this._uniqueRootUrl}${name}`;\n babylonTexture.updateURL(dataUrl, data);\n }));\n babylonTexture.wrapU = samplerData.wrapU;\n babylonTexture.wrapV = samplerData.wrapV;\n assign(babylonTexture);\n return Promise.all(promises).then(() => {\n return babylonTexture;\n });\n }\n _loadSampler(context, sampler) {\n if (!sampler._data) {\n sampler._data = {\n noMipMaps: sampler.minFilter === 9728 /* TextureMinFilter.NEAREST */ || sampler.minFilter === 9729 /* TextureMinFilter.LINEAR */,\n samplingMode: GLTFLoader._GetTextureSamplingMode(context, sampler),\n wrapU: GLTFLoader._GetTextureWrapMode(`${context}/wrapS`, sampler.wrapS),\n wrapV: GLTFLoader._GetTextureWrapMode(`${context}/wrapT`, sampler.wrapT),\n };\n }\n return sampler._data;\n }\n /**\n * Loads a glTF image.\n * @param context The context when loading the asset\n * @param image The glTF image property\n * @returns A promise that resolves with the loaded data when the load is complete\n */\n loadImageAsync(context, image) {\n if (!image._data) {\n this.logOpen(`${context} ${image.name || \"\"}`);\n if (image.uri) {\n image._data = this.loadUriAsync(`${context}/uri`, image, image.uri);\n }\n else {\n const bufferView = ArrayItem.Get(`${context}/bufferView`, this._gltf.bufferViews, image.bufferView);\n image._data = this.loadBufferViewAsync(`/bufferViews/${bufferView.index}`, bufferView);\n }\n this.logClose();\n }\n return image._data;\n }\n /**\n * Loads a glTF uri.\n * @param context The context when loading the asset\n * @param property The glTF property associated with the uri\n * @param uri The base64 or relative uri\n * @returns A promise that resolves with the loaded data when the load is complete\n */\n loadUriAsync(context, property, uri) {\n const extensionPromise = this._extensionsLoadUriAsync(context, property, uri);\n if (extensionPromise) {\n return extensionPromise;\n }\n if (!GLTFLoader._ValidateUri(uri)) {\n throw new Error(`${context}: '${uri}' is invalid`);\n }\n if (IsBase64DataUrl(uri)) {\n const data = new Uint8Array(DecodeBase64UrlToBinary(uri));\n this.log(`${context}: Decoded ${uri.substr(0, 64)}... (${data.length} bytes)`);\n return Promise.resolve(data);\n }\n this.log(`${context}: Loading ${uri}`);\n return this._parent.preprocessUrlAsync(this._rootUrl + uri).then((url) => {\n return new Promise((resolve, reject) => {\n this._parent._loadFile(this._babylonScene, url, (data) => {\n if (!this._disposed) {\n this.log(`${context}: Loaded ${uri} (${data.byteLength} bytes)`);\n resolve(new Uint8Array(data));\n }\n }, true, (request) => {\n reject(new LoadFileError(`${context}: Failed to load '${uri}'${request ? \": \" + request.status + \" \" + request.statusText : \"\"}`, request));\n });\n });\n });\n }\n /**\n * Adds a JSON pointer to the _internalMetadata of the Babylon object at `._internalMetadata.gltf.pointers`.\n * @param babylonObject the Babylon object with _internalMetadata\n * @param pointer the JSON pointer\n */\n static AddPointerMetadata(babylonObject, pointer) {\n babylonObject.metadata = babylonObject.metadata || {};\n const metadata = (babylonObject._internalMetadata = babylonObject._internalMetadata || {});\n const gltf = (metadata.gltf = metadata.gltf || {});\n const pointers = (gltf.pointers = gltf.pointers || []);\n pointers.push(pointer);\n }\n static _GetTextureWrapMode(context, mode) {\n // Set defaults if undefined\n mode = mode == undefined ? 10497 /* TextureWrapMode.REPEAT */ : mode;\n switch (mode) {\n case 33071 /* TextureWrapMode.CLAMP_TO_EDGE */:\n return Texture.CLAMP_ADDRESSMODE;\n case 33648 /* TextureWrapMode.MIRRORED_REPEAT */:\n return Texture.MIRROR_ADDRESSMODE;\n case 10497 /* TextureWrapMode.REPEAT */:\n return Texture.WRAP_ADDRESSMODE;\n default:\n Logger.Warn(`${context}: Invalid value (${mode})`);\n return Texture.WRAP_ADDRESSMODE;\n }\n }\n static _GetTextureSamplingMode(context, sampler) {\n // Set defaults if undefined\n const magFilter = sampler.magFilter == undefined ? 9729 /* TextureMagFilter.LINEAR */ : sampler.magFilter;\n const minFilter = sampler.minFilter == undefined ? 9987 /* TextureMinFilter.LINEAR_MIPMAP_LINEAR */ : sampler.minFilter;\n if (magFilter === 9729 /* TextureMagFilter.LINEAR */) {\n switch (minFilter) {\n case 9728 /* TextureMinFilter.NEAREST */:\n return Texture.LINEAR_NEAREST;\n case 9729 /* TextureMinFilter.LINEAR */:\n return Texture.LINEAR_LINEAR;\n case 9984 /* TextureMinFilter.NEAREST_MIPMAP_NEAREST */:\n return Texture.LINEAR_NEAREST_MIPNEAREST;\n case 9985 /* TextureMinFilter.LINEAR_MIPMAP_NEAREST */:\n return Texture.LINEAR_LINEAR_MIPNEAREST;\n case 9986 /* TextureMinFilter.NEAREST_MIPMAP_LINEAR */:\n return Texture.LINEAR_NEAREST_MIPLINEAR;\n case 9987 /* TextureMinFilter.LINEAR_MIPMAP_LINEAR */:\n return Texture.LINEAR_LINEAR_MIPLINEAR;\n default:\n Logger.Warn(`${context}/minFilter: Invalid value (${minFilter})`);\n return Texture.LINEAR_LINEAR_MIPLINEAR;\n }\n }\n else {\n if (magFilter !== 9728 /* TextureMagFilter.NEAREST */) {\n Logger.Warn(`${context}/magFilter: Invalid value (${magFilter})`);\n }\n switch (minFilter) {\n case 9728 /* TextureMinFilter.NEAREST */:\n return Texture.NEAREST_NEAREST;\n case 9729 /* TextureMinFilter.LINEAR */:\n return Texture.NEAREST_LINEAR;\n case 9984 /* TextureMinFilter.NEAREST_MIPMAP_NEAREST */:\n return Texture.NEAREST_NEAREST_MIPNEAREST;\n case 9985 /* TextureMinFilter.LINEAR_MIPMAP_NEAREST */:\n return Texture.NEAREST_LINEAR_MIPNEAREST;\n case 9986 /* TextureMinFilter.NEAREST_MIPMAP_LINEAR */:\n return Texture.NEAREST_NEAREST_MIPLINEAR;\n case 9987 /* TextureMinFilter.LINEAR_MIPMAP_LINEAR */:\n return Texture.NEAREST_LINEAR_MIPLINEAR;\n default:\n Logger.Warn(`${context}/minFilter: Invalid value (${minFilter})`);\n return Texture.NEAREST_NEAREST_MIPNEAREST;\n }\n }\n }\n static _GetTypedArrayConstructor(context, componentType) {\n switch (componentType) {\n case 5120 /* AccessorComponentType.BYTE */:\n return Int8Array;\n case 5121 /* AccessorComponentType.UNSIGNED_BYTE */:\n return Uint8Array;\n case 5122 /* AccessorComponentType.SHORT */:\n return Int16Array;\n case 5123 /* AccessorComponentType.UNSIGNED_SHORT */:\n return Uint16Array;\n case 5125 /* AccessorComponentType.UNSIGNED_INT */:\n return Uint32Array;\n case 5126 /* AccessorComponentType.FLOAT */:\n return Float32Array;\n default:\n throw new Error(`${context}: Invalid component type ${componentType}`);\n }\n }\n static _GetTypedArray(context, componentType, bufferView, byteOffset, length) {\n const buffer = bufferView.buffer;\n byteOffset = bufferView.byteOffset + (byteOffset || 0);\n const constructor = GLTFLoader._GetTypedArrayConstructor(`${context}/componentType`, componentType);\n const componentTypeLength = VertexBuffer.GetTypeByteLength(componentType);\n if (byteOffset % componentTypeLength !== 0) {\n // HACK: Copy the buffer if byte offset is not a multiple of component type byte length.\n Logger.Warn(`${context}: Copying buffer as byte offset (${byteOffset}) is not a multiple of component type byte length (${componentTypeLength})`);\n return new constructor(buffer.slice(byteOffset, byteOffset + length * componentTypeLength), 0);\n }\n return new constructor(buffer, byteOffset, length);\n }\n static _GetNumComponents(context, type) {\n switch (type) {\n case \"SCALAR\":\n return 1;\n case \"VEC2\":\n return 2;\n case \"VEC3\":\n return 3;\n case \"VEC4\":\n return 4;\n case \"MAT2\":\n return 4;\n case \"MAT3\":\n return 9;\n case \"MAT4\":\n return 16;\n }\n throw new Error(`${context}: Invalid type (${type})`);\n }\n static _ValidateUri(uri) {\n return Tools.IsBase64(uri) || uri.indexOf(\"..\") === -1;\n }\n /**\n * @internal\n */\n static _GetDrawMode(context, mode) {\n if (mode == undefined) {\n mode = 4 /* MeshPrimitiveMode.TRIANGLES */;\n }\n switch (mode) {\n case 0 /* MeshPrimitiveMode.POINTS */:\n return Material.PointListDrawMode;\n case 1 /* MeshPrimitiveMode.LINES */:\n return Material.LineListDrawMode;\n case 2 /* MeshPrimitiveMode.LINE_LOOP */:\n return Material.LineLoopDrawMode;\n case 3 /* MeshPrimitiveMode.LINE_STRIP */:\n return Material.LineStripDrawMode;\n case 4 /* MeshPrimitiveMode.TRIANGLES */:\n return Material.TriangleFillMode;\n case 5 /* MeshPrimitiveMode.TRIANGLE_STRIP */:\n return Material.TriangleStripDrawMode;\n case 6 /* MeshPrimitiveMode.TRIANGLE_FAN */:\n return Material.TriangleFanDrawMode;\n }\n throw new Error(`${context}: Invalid mesh primitive mode (${mode})`);\n }\n _compileMaterialsAsync() {\n this._parent._startPerformanceCounter(\"Compile materials\");\n const promises = new Array();\n if (this._gltf.materials) {\n for (const material of this._gltf.materials) {\n if (material._data) {\n for (const babylonDrawMode in material._data) {\n const babylonData = material._data[babylonDrawMode];\n for (const babylonMesh of babylonData.babylonMeshes) {\n // Ensure nonUniformScaling is set if necessary.\n babylonMesh.computeWorldMatrix(true);\n const babylonMaterial = babylonData.babylonMaterial;\n promises.push(babylonMaterial.forceCompilationAsync(babylonMesh));\n promises.push(babylonMaterial.forceCompilationAsync(babylonMesh, { useInstances: true }));\n if (this._parent.useClipPlane) {\n promises.push(babylonMaterial.forceCompilationAsync(babylonMesh, { clipPlane: true }));\n promises.push(babylonMaterial.forceCompilationAsync(babylonMesh, { clipPlane: true, useInstances: true }));\n }\n }\n }\n }\n }\n }\n return Promise.all(promises).then(() => {\n this._parent._endPerformanceCounter(\"Compile materials\");\n });\n }\n _compileShadowGeneratorsAsync() {\n this._parent._startPerformanceCounter(\"Compile shadow generators\");\n const promises = new Array();\n const lights = this._babylonScene.lights;\n for (const light of lights) {\n const generator = light.getShadowGenerator();\n if (generator) {\n promises.push(generator.forceCompilationAsync());\n }\n }\n return Promise.all(promises).then(() => {\n this._parent._endPerformanceCounter(\"Compile shadow generators\");\n });\n }\n _forEachExtensions(action) {\n for (const extension of this._extensions) {\n if (extension.enabled) {\n action(extension);\n }\n }\n }\n _applyExtensions(property, functionName, actionAsync) {\n for (const extension of this._extensions) {\n if (extension.enabled) {\n const id = `${extension.name}.${functionName}`;\n const loaderProperty = property;\n loaderProperty._activeLoaderExtensionFunctions = loaderProperty._activeLoaderExtensionFunctions || {};\n const activeLoaderExtensionFunctions = loaderProperty._activeLoaderExtensionFunctions;\n if (!activeLoaderExtensionFunctions[id]) {\n activeLoaderExtensionFunctions[id] = true;\n try {\n const result = actionAsync(extension);\n if (result) {\n return result;\n }\n }\n finally {\n delete activeLoaderExtensionFunctions[id];\n }\n }\n }\n }\n return null;\n }\n _extensionsOnLoading() {\n this._forEachExtensions((extension) => extension.onLoading && extension.onLoading());\n }\n _extensionsOnReady() {\n this._forEachExtensions((extension) => extension.onReady && extension.onReady());\n }\n _extensionsLoadSceneAsync(context, scene) {\n return this._applyExtensions(scene, \"loadScene\", (extension) => extension.loadSceneAsync && extension.loadSceneAsync(context, scene));\n }\n _extensionsLoadNodeAsync(context, node, assign) {\n return this._applyExtensions(node, \"loadNode\", (extension) => extension.loadNodeAsync && extension.loadNodeAsync(context, node, assign));\n }\n _extensionsLoadCameraAsync(context, camera, assign) {\n return this._applyExtensions(camera, \"loadCamera\", (extension) => extension.loadCameraAsync && extension.loadCameraAsync(context, camera, assign));\n }\n _extensionsLoadVertexDataAsync(context, primitive, babylonMesh) {\n return this._applyExtensions(primitive, \"loadVertexData\", (extension) => extension._loadVertexDataAsync && extension._loadVertexDataAsync(context, primitive, babylonMesh));\n }\n _extensionsLoadMeshPrimitiveAsync(context, name, node, mesh, primitive, assign) {\n return this._applyExtensions(primitive, \"loadMeshPrimitive\", (extension) => extension._loadMeshPrimitiveAsync && extension._loadMeshPrimitiveAsync(context, name, node, mesh, primitive, assign));\n }\n _extensionsLoadMaterialAsync(context, material, babylonMesh, babylonDrawMode, assign) {\n return this._applyExtensions(material, \"loadMaterial\", (extension) => extension._loadMaterialAsync && extension._loadMaterialAsync(context, material, babylonMesh, babylonDrawMode, assign));\n }\n _extensionsCreateMaterial(context, material, babylonDrawMode) {\n return this._applyExtensions(material, \"createMaterial\", (extension) => extension.createMaterial && extension.createMaterial(context, material, babylonDrawMode));\n }\n _extensionsLoadMaterialPropertiesAsync(context, material, babylonMaterial) {\n return this._applyExtensions(material, \"loadMaterialProperties\", (extension) => extension.loadMaterialPropertiesAsync && extension.loadMaterialPropertiesAsync(context, material, babylonMaterial));\n }\n _extensionsLoadTextureInfoAsync(context, textureInfo, assign) {\n return this._applyExtensions(textureInfo, \"loadTextureInfo\", (extension) => extension.loadTextureInfoAsync && extension.loadTextureInfoAsync(context, textureInfo, assign));\n }\n _extensionsLoadTextureAsync(context, texture, assign) {\n return this._applyExtensions(texture, \"loadTexture\", (extension) => extension._loadTextureAsync && extension._loadTextureAsync(context, texture, assign));\n }\n _extensionsLoadAnimationAsync(context, animation) {\n return this._applyExtensions(animation, \"loadAnimation\", (extension) => extension.loadAnimationAsync && extension.loadAnimationAsync(context, animation));\n }\n _extensionsLoadAnimationChannelAsync(context, animationContext, animation, channel, onLoad) {\n return this._applyExtensions(animation, \"loadAnimationChannel\", (extension) => extension._loadAnimationChannelAsync && extension._loadAnimationChannelAsync(context, animationContext, animation, channel, onLoad));\n }\n _extensionsLoadSkinAsync(context, node, skin) {\n return this._applyExtensions(skin, \"loadSkin\", (extension) => extension._loadSkinAsync && extension._loadSkinAsync(context, node, skin));\n }\n _extensionsLoadUriAsync(context, property, uri) {\n return this._applyExtensions(property, \"loadUri\", (extension) => extension._loadUriAsync && extension._loadUriAsync(context, property, uri));\n }\n _extensionsLoadBufferViewAsync(context, bufferView) {\n return this._applyExtensions(bufferView, \"loadBufferView\", (extension) => extension.loadBufferViewAsync && extension.loadBufferViewAsync(context, bufferView));\n }\n _extensionsLoadBufferAsync(context, buffer, byteOffset, byteLength) {\n return this._applyExtensions(buffer, \"loadBuffer\", (extension) => extension.loadBufferAsync && extension.loadBufferAsync(context, buffer, byteOffset, byteLength));\n }\n /**\n * Helper method called by a loader extension to load an glTF extension.\n * @param context The context when loading the asset\n * @param property The glTF property to load the extension from\n * @param extensionName The name of the extension to load\n * @param actionAsync The action to run\n * @returns The promise returned by actionAsync or null if the extension does not exist\n */\n static LoadExtensionAsync(context, property, extensionName, actionAsync) {\n if (!property.extensions) {\n return null;\n }\n const extensions = property.extensions;\n const extension = extensions[extensionName];\n if (!extension) {\n return null;\n }\n return actionAsync(`${context}/extensions/${extensionName}`, extension);\n }\n /**\n * Helper method called by a loader extension to load a glTF extra.\n * @param context The context when loading the asset\n * @param property The glTF property to load the extra from\n * @param extensionName The name of the extension to load\n * @param actionAsync The action to run\n * @returns The promise returned by actionAsync or null if the extra does not exist\n */\n static LoadExtraAsync(context, property, extensionName, actionAsync) {\n if (!property.extras) {\n return null;\n }\n const extras = property.extras;\n const extra = extras[extensionName];\n if (!extra) {\n return null;\n }\n return actionAsync(`${context}/extras/${extensionName}`, extra);\n }\n /**\n * Checks for presence of an extension.\n * @param name The name of the extension to check\n * @returns A boolean indicating the presence of the given extension name in `extensionsUsed`\n */\n isExtensionUsed(name) {\n return !!this._gltf.extensionsUsed && this._gltf.extensionsUsed.indexOf(name) !== -1;\n }\n /**\n * Increments the indentation level and logs a message.\n * @param message The message to log\n */\n logOpen(message) {\n this._parent._logOpen(message);\n }\n /**\n * Decrements the indentation level.\n */\n logClose() {\n this._parent._logClose();\n }\n /**\n * Logs a message\n * @param message The message to log\n */\n log(message) {\n this._parent._log(message);\n }\n /**\n * Starts a performance counter.\n * @param counterName The name of the performance counter\n */\n startPerformanceCounter(counterName) {\n this._parent._startPerformanceCounter(counterName);\n }\n /**\n * Ends a performance counter.\n * @param counterName The name of the performance counter\n */\n endPerformanceCounter(counterName) {\n this._parent._endPerformanceCounter(counterName);\n }\n}\nGLTFLoader._RegisteredExtensions = {};\n/**\n * The default glTF sampler.\n */\nGLTFLoader.DefaultSampler = { index: -1 };\nGLTFFileLoader._CreateGLTF2Loader = (parent) => new GLTFLoader(parent);\n//# sourceMappingURL=glTFLoader.js.map","import { SerializationHelper } from \"../../Misc/decorators.js\";\nimport { _UpdateRGBDAsync as UpdateRGBDAsyncEnvTools } from \"../../Misc/environmentTextureTools.js\";\nimport { InternalTextureSource } from \"./internalTexture.js\";\nimport { CubeTexture } from \"./cubeTexture.js\";\n\nimport \"../../Engines/Extensions/engine.rawTexture.js\";\n/**\n * Raw cube texture where the raw buffers are passed in\n */\nexport class RawCubeTexture extends CubeTexture {\n /**\n * Creates a cube texture where the raw buffers are passed in.\n * @param scene defines the scene the texture is attached to\n * @param data defines the array of data to use to create each face\n * @param size defines the size of the textures\n * @param format defines the format of the data\n * @param type defines the type of the data (like Engine.TEXTURETYPE_UNSIGNED_INT)\n * @param generateMipMaps defines if the engine should generate the mip levels\n * @param invertY defines if data must be stored with Y axis inverted\n * @param samplingMode defines the required sampling mode (like Texture.NEAREST_SAMPLINGMODE)\n * @param compression defines the compression used (null by default)\n */\n constructor(scene, data, size, format = 5, type = 0, generateMipMaps = false, invertY = false, samplingMode = 3, compression = null) {\n super(\"\", scene);\n this._texture = scene.getEngine().createRawCubeTexture(data, size, format, type, generateMipMaps, invertY, samplingMode, compression);\n }\n /**\n * Updates the raw cube texture.\n * @param data defines the data to store\n * @param format defines the data format\n * @param type defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_INT by default)\n * @param invertY defines if data must be stored with Y axis inverted\n * @param compression defines the compression used (null by default)\n */\n update(data, format, type, invertY, compression = null) {\n this._texture.getEngine().updateRawCubeTexture(this._texture, data, format, type, invertY, compression);\n }\n /**\n * Updates a raw cube texture with RGBD encoded data.\n * @param data defines the array of data [mipmap][face] to use to create each face\n * @param sphericalPolynomial defines the spherical polynomial for irradiance\n * @param lodScale defines the scale applied to environment texture. This manages the range of LOD level used for IBL according to the roughness\n * @param lodOffset defines the offset applied to environment texture. This manages first LOD level used for IBL according to the roughness\n * @returns a promise that resolves when the operation is complete\n */\n updateRGBDAsync(data, sphericalPolynomial = null, lodScale = 0.8, lodOffset = 0) {\n return UpdateRGBDAsyncEnvTools(this._texture, data, sphericalPolynomial, lodScale, lodOffset).then(() => { });\n }\n /**\n * Clones the raw cube texture.\n * @returns a new cube texture\n */\n clone() {\n return SerializationHelper.Clone(() => {\n const scene = this.getScene();\n const internalTexture = this._texture;\n const texture = new RawCubeTexture(scene, internalTexture._bufferViewArray, internalTexture.width, internalTexture.format, internalTexture.type, internalTexture.generateMipMaps, internalTexture.invertY, internalTexture.samplingMode, internalTexture._compression);\n if (internalTexture.source === InternalTextureSource.CubeRawRGBD) {\n texture.updateRGBDAsync(internalTexture._bufferViewArrayArray, internalTexture._sphericalPolynomial, internalTexture._lodGenerationScale, internalTexture._lodGenerationOffset);\n }\n return texture;\n }, this);\n }\n}\n//# sourceMappingURL=rawCubeTexture.js.map","import { Scalar } from \"@babylonjs/core/Maths/math.scalar.js\";\nimport { SphericalHarmonics, SphericalPolynomial } from \"@babylonjs/core/Maths/sphericalPolynomial.js\";\nimport { Quaternion, Matrix } from \"@babylonjs/core/Maths/math.vector.js\";\nimport { RawCubeTexture } from \"@babylonjs/core/Materials/Textures/rawCubeTexture.js\";\nimport { GLTFLoader, ArrayItem } from \"../glTFLoader.js\";\nconst NAME = \"EXT_lights_image_based\";\n/**\n * [Specification](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Vendor/EXT_lights_image_based/README.md)\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport class EXT_lights_image_based {\n /**\n * @internal\n */\n constructor(loader) {\n /**\n * The name of this extension.\n */\n this.name = NAME;\n this._loader = loader;\n this.enabled = this._loader.isExtensionUsed(NAME);\n }\n /** @internal */\n dispose() {\n this._loader = null;\n delete this._lights;\n }\n /** @internal */\n onLoading() {\n const extensions = this._loader.gltf.extensions;\n if (extensions && extensions[this.name]) {\n const extension = extensions[this.name];\n this._lights = extension.lights;\n }\n }\n /**\n * @internal\n */\n loadSceneAsync(context, scene) {\n return GLTFLoader.LoadExtensionAsync(context, scene, this.name, (extensionContext, extension) => {\n const promises = new Array();\n promises.push(this._loader.loadSceneAsync(context, scene));\n this._loader.logOpen(`${extensionContext}`);\n const light = ArrayItem.Get(`${extensionContext}/light`, this._lights, extension.light);\n promises.push(this._loadLightAsync(`/extensions/${this.name}/lights/${extension.light}`, light).then((texture) => {\n this._loader.babylonScene.environmentTexture = texture;\n }));\n this._loader.logClose();\n return Promise.all(promises).then(() => { });\n });\n }\n _loadLightAsync(context, light) {\n if (!light._loaded) {\n const promises = new Array();\n this._loader.logOpen(`${context}`);\n const imageData = new Array(light.specularImages.length);\n for (let mipmap = 0; mipmap < light.specularImages.length; mipmap++) {\n const faces = light.specularImages[mipmap];\n imageData[mipmap] = new Array(faces.length);\n for (let face = 0; face < faces.length; face++) {\n const specularImageContext = `${context}/specularImages/${mipmap}/${face}`;\n this._loader.logOpen(`${specularImageContext}`);\n const index = faces[face];\n const image = ArrayItem.Get(specularImageContext, this._loader.gltf.images, index);\n promises.push(this._loader.loadImageAsync(`/images/${index}`, image).then((data) => {\n imageData[mipmap][face] = data;\n }));\n this._loader.logClose();\n }\n }\n this._loader.logClose();\n light._loaded = Promise.all(promises).then(() => {\n const babylonTexture = new RawCubeTexture(this._loader.babylonScene, null, light.specularImageSize);\n babylonTexture.name = light.name || \"environment\";\n light._babylonTexture = babylonTexture;\n if (light.intensity != undefined) {\n babylonTexture.level = light.intensity;\n }\n if (light.rotation) {\n let rotation = Quaternion.FromArray(light.rotation);\n // Invert the rotation so that positive rotation is counter-clockwise.\n if (!this._loader.babylonScene.useRightHandedSystem) {\n rotation = Quaternion.Inverse(rotation);\n }\n Matrix.FromQuaternionToRef(rotation, babylonTexture.getReflectionTextureMatrix());\n }\n if (!light.irradianceCoefficients) {\n throw new Error(`${context}: Irradiance coefficients are missing`);\n }\n const sphericalHarmonics = SphericalHarmonics.FromArray(light.irradianceCoefficients);\n sphericalHarmonics.scaleInPlace(light.intensity);\n sphericalHarmonics.convertIrradianceToLambertianRadiance();\n const sphericalPolynomial = SphericalPolynomial.FromHarmonics(sphericalHarmonics);\n // Compute the lod generation scale to fit exactly to the number of levels available.\n const lodGenerationScale = (imageData.length - 1) / Scalar.Log2(light.specularImageSize);\n return babylonTexture.updateRGBDAsync(imageData, sphericalPolynomial, lodGenerationScale);\n });\n }\n return light._loaded.then(() => {\n return light._babylonTexture;\n });\n }\n}\nGLTFLoader.RegisterExtension(NAME, (loader) => new EXT_lights_image_based(loader));\n//# sourceMappingURL=EXT_lights_image_based.js.map","import { Mesh } from \"../Meshes/mesh.js\";\nimport { VertexBuffer, Buffer } from \"../Buffers/buffer.js\";\nimport { Matrix, Vector3, TmpVectors } from \"../Maths/math.vector.js\";\nimport { Logger } from \"../Misc/logger.js\";\nimport { BoundingInfo } from \"../Culling/boundingInfo.js\";\nMesh.prototype.thinInstanceAdd = function (matrix, refresh = true) {\n if (!this.getScene().getEngine().getCaps().instancedArrays) {\n Logger.Error(\"Thin Instances are not supported on this device as Instanced Array extension not supported\");\n return -1;\n }\n this._thinInstanceUpdateBufferSize(\"matrix\", Array.isArray(matrix) ? matrix.length : 1);\n const index = this._thinInstanceDataStorage.instancesCount;\n if (Array.isArray(matrix)) {\n for (let i = 0; i < matrix.length; ++i) {\n this.thinInstanceSetMatrixAt(this._thinInstanceDataStorage.instancesCount++, matrix[i], i === matrix.length - 1 && refresh);\n }\n }\n else {\n this.thinInstanceSetMatrixAt(this._thinInstanceDataStorage.instancesCount++, matrix, refresh);\n }\n return index;\n};\nMesh.prototype.thinInstanceAddSelf = function (refresh = true) {\n return this.thinInstanceAdd(Matrix.IdentityReadOnly, refresh);\n};\nMesh.prototype.thinInstanceRegisterAttribute = function (kind, stride) {\n // preserve backward compatibility\n if (kind === VertexBuffer.ColorKind) {\n kind = VertexBuffer.ColorInstanceKind;\n }\n this.removeVerticesData(kind);\n this._thinInstanceInitializeUserStorage();\n this._userThinInstanceBuffersStorage.strides[kind] = stride;\n this._userThinInstanceBuffersStorage.sizes[kind] = stride * Math.max(32, this._thinInstanceDataStorage.instancesCount); // Initial size\n this._userThinInstanceBuffersStorage.data[kind] = new Float32Array(this._userThinInstanceBuffersStorage.sizes[kind]);\n this._userThinInstanceBuffersStorage.vertexBuffers[kind] = new VertexBuffer(this.getEngine(), this._userThinInstanceBuffersStorage.data[kind], kind, true, false, stride, true);\n this.setVerticesBuffer(this._userThinInstanceBuffersStorage.vertexBuffers[kind]);\n};\nMesh.prototype.thinInstanceSetMatrixAt = function (index, matrix, refresh = true) {\n if (!this._thinInstanceDataStorage.matrixData || index >= this._thinInstanceDataStorage.instancesCount) {\n return false;\n }\n const matrixData = this._thinInstanceDataStorage.matrixData;\n matrix.copyToArray(matrixData, index * 16);\n if (this._thinInstanceDataStorage.worldMatrices) {\n this._thinInstanceDataStorage.worldMatrices[index] = matrix;\n }\n if (refresh) {\n this.thinInstanceBufferUpdated(\"matrix\");\n if (!this.doNotSyncBoundingInfo) {\n this.thinInstanceRefreshBoundingInfo(false);\n }\n }\n return true;\n};\nMesh.prototype.thinInstanceSetAttributeAt = function (kind, index, value, refresh = true) {\n // preserve backward compatibility\n if (kind === VertexBuffer.ColorKind) {\n kind = VertexBuffer.ColorInstanceKind;\n }\n if (!this._userThinInstanceBuffersStorage || !this._userThinInstanceBuffersStorage.data[kind] || index >= this._thinInstanceDataStorage.instancesCount) {\n return false;\n }\n this._thinInstanceUpdateBufferSize(kind, 0); // make sur the buffer for the kind attribute is big enough\n this._userThinInstanceBuffersStorage.data[kind].set(value, index * this._userThinInstanceBuffersStorage.strides[kind]);\n if (refresh) {\n this.thinInstanceBufferUpdated(kind);\n }\n return true;\n};\nObject.defineProperty(Mesh.prototype, \"thinInstanceCount\", {\n get: function () {\n return this._thinInstanceDataStorage.instancesCount;\n },\n set: function (value) {\n var _a, _b;\n const matrixData = (_a = this._thinInstanceDataStorage.matrixData) !== null && _a !== void 0 ? _a : (_b = this.source) === null || _b === void 0 ? void 0 : _b._thinInstanceDataStorage.matrixData;\n const numMaxInstances = matrixData ? matrixData.length / 16 : 0;\n if (value <= numMaxInstances) {\n this._thinInstanceDataStorage.instancesCount = value;\n }\n },\n enumerable: true,\n configurable: true,\n});\nMesh.prototype._thinInstanceCreateMatrixBuffer = function (kind, buffer, staticBuffer = false) {\n // preserve backward compatibility\n if (kind === VertexBuffer.ColorKind) {\n kind = VertexBuffer.ColorInstanceKind;\n }\n const matrixBuffer = new Buffer(this.getEngine(), buffer, !staticBuffer, 16, false, true);\n for (let i = 0; i < 4; i++) {\n this.setVerticesBuffer(matrixBuffer.createVertexBuffer(kind + i, i * 4, 4));\n }\n return matrixBuffer;\n};\nMesh.prototype.thinInstanceSetBuffer = function (kind, buffer, stride = 0, staticBuffer = false) {\n var _a, _b, _c;\n stride = stride || 16;\n if (kind === \"matrix\") {\n (_a = this._thinInstanceDataStorage.matrixBuffer) === null || _a === void 0 ? void 0 : _a.dispose();\n this._thinInstanceDataStorage.matrixBuffer = null;\n this._thinInstanceDataStorage.matrixBufferSize = buffer ? buffer.length : 32 * stride;\n this._thinInstanceDataStorage.matrixData = buffer;\n this._thinInstanceDataStorage.worldMatrices = null;\n if (buffer !== null) {\n this._thinInstanceDataStorage.instancesCount = buffer.length / stride;\n this._thinInstanceDataStorage.matrixBuffer = this._thinInstanceCreateMatrixBuffer(\"world\", buffer, staticBuffer);\n if (!this.doNotSyncBoundingInfo) {\n this.thinInstanceRefreshBoundingInfo(false);\n }\n }\n else {\n this._thinInstanceDataStorage.instancesCount = 0;\n if (!this.doNotSyncBoundingInfo) {\n // mesh has no more thin instances, so need to recompute the bounding box because it's the regular mesh that will now be displayed\n this.refreshBoundingInfo();\n }\n }\n }\n else if (kind === \"previousMatrix\") {\n (_b = this._thinInstanceDataStorage.previousMatrixBuffer) === null || _b === void 0 ? void 0 : _b.dispose();\n this._thinInstanceDataStorage.previousMatrixBuffer = null;\n this._thinInstanceDataStorage.previousMatrixData = buffer;\n if (buffer !== null) {\n this._thinInstanceDataStorage.previousMatrixBuffer = this._thinInstanceCreateMatrixBuffer(\"previousWorld\", buffer, staticBuffer);\n }\n }\n else {\n // color for instanced mesh is ColorInstanceKind and not ColorKind because of native that needs to do the differenciation\n // hot switching kind here to preserve backward compatibility\n if (kind === VertexBuffer.ColorKind) {\n kind = VertexBuffer.ColorInstanceKind;\n }\n if (buffer === null) {\n if ((_c = this._userThinInstanceBuffersStorage) === null || _c === void 0 ? void 0 : _c.data[kind]) {\n this.removeVerticesData(kind);\n delete this._userThinInstanceBuffersStorage.data[kind];\n delete this._userThinInstanceBuffersStorage.strides[kind];\n delete this._userThinInstanceBuffersStorage.sizes[kind];\n delete this._userThinInstanceBuffersStorage.vertexBuffers[kind];\n }\n }\n else {\n this._thinInstanceInitializeUserStorage();\n this._userThinInstanceBuffersStorage.data[kind] = buffer;\n this._userThinInstanceBuffersStorage.strides[kind] = stride;\n this._userThinInstanceBuffersStorage.sizes[kind] = buffer.length;\n this._userThinInstanceBuffersStorage.vertexBuffers[kind] = new VertexBuffer(this.getEngine(), buffer, kind, !staticBuffer, false, stride, true);\n this.setVerticesBuffer(this._userThinInstanceBuffersStorage.vertexBuffers[kind]);\n }\n }\n};\nMesh.prototype.thinInstanceBufferUpdated = function (kind) {\n var _a, _b, _c;\n if (kind === \"matrix\") {\n (_a = this._thinInstanceDataStorage.matrixBuffer) === null || _a === void 0 ? void 0 : _a.updateDirectly(this._thinInstanceDataStorage.matrixData, 0, this._thinInstanceDataStorage.instancesCount);\n }\n else if (kind === \"previousMatrix\") {\n (_b = this._thinInstanceDataStorage.previousMatrixBuffer) === null || _b === void 0 ? void 0 : _b.updateDirectly(this._thinInstanceDataStorage.previousMatrixData, 0, this._thinInstanceDataStorage.instancesCount);\n }\n else {\n // preserve backward compatibility\n if (kind === VertexBuffer.ColorKind) {\n kind = VertexBuffer.ColorInstanceKind;\n }\n if ((_c = this._userThinInstanceBuffersStorage) === null || _c === void 0 ? void 0 : _c.vertexBuffers[kind]) {\n this._userThinInstanceBuffersStorage.vertexBuffers[kind].updateDirectly(this._userThinInstanceBuffersStorage.data[kind], 0);\n }\n }\n};\nMesh.prototype.thinInstancePartialBufferUpdate = function (kind, data, offset) {\n var _a;\n if (kind === \"matrix\") {\n if (this._thinInstanceDataStorage.matrixBuffer) {\n this._thinInstanceDataStorage.matrixBuffer.updateDirectly(data, offset);\n }\n }\n else {\n // preserve backward compatibility\n if (kind === VertexBuffer.ColorKind) {\n kind = VertexBuffer.ColorInstanceKind;\n }\n if ((_a = this._userThinInstanceBuffersStorage) === null || _a === void 0 ? void 0 : _a.vertexBuffers[kind]) {\n this._userThinInstanceBuffersStorage.vertexBuffers[kind].updateDirectly(data, offset);\n }\n }\n};\nMesh.prototype.thinInstanceGetWorldMatrices = function () {\n if (!this._thinInstanceDataStorage.matrixData || !this._thinInstanceDataStorage.matrixBuffer) {\n return [];\n }\n const matrixData = this._thinInstanceDataStorage.matrixData;\n if (!this._thinInstanceDataStorage.worldMatrices) {\n this._thinInstanceDataStorage.worldMatrices = new Array();\n for (let i = 0; i < this._thinInstanceDataStorage.instancesCount; ++i) {\n this._thinInstanceDataStorage.worldMatrices[i] = Matrix.FromArray(matrixData, i * 16);\n }\n }\n return this._thinInstanceDataStorage.worldMatrices;\n};\nMesh.prototype.thinInstanceRefreshBoundingInfo = function (forceRefreshParentInfo = false, applySkeleton = false, applyMorph = false) {\n if (!this._thinInstanceDataStorage.matrixData || !this._thinInstanceDataStorage.matrixBuffer) {\n return;\n }\n const vectors = this._thinInstanceDataStorage.boundingVectors;\n if (forceRefreshParentInfo || !this.rawBoundingInfo) {\n vectors.length = 0;\n this.refreshBoundingInfo(applySkeleton, applyMorph);\n const boundingInfo = this.getBoundingInfo();\n this.rawBoundingInfo = new BoundingInfo(boundingInfo.minimum, boundingInfo.maximum);\n }\n const boundingInfo = this.getBoundingInfo();\n const matrixData = this._thinInstanceDataStorage.matrixData;\n if (vectors.length === 0) {\n for (let v = 0; v < boundingInfo.boundingBox.vectors.length; ++v) {\n vectors.push(boundingInfo.boundingBox.vectors[v].clone());\n }\n }\n TmpVectors.Vector3[0].setAll(Number.POSITIVE_INFINITY); // min\n TmpVectors.Vector3[1].setAll(Number.NEGATIVE_INFINITY); // max\n for (let i = 0; i < this._thinInstanceDataStorage.instancesCount; ++i) {\n Matrix.FromArrayToRef(matrixData, i * 16, TmpVectors.Matrix[0]);\n for (let v = 0; v < vectors.length; ++v) {\n Vector3.TransformCoordinatesToRef(vectors[v], TmpVectors.Matrix[0], TmpVectors.Vector3[2]);\n TmpVectors.Vector3[0].minimizeInPlace(TmpVectors.Vector3[2]);\n TmpVectors.Vector3[1].maximizeInPlace(TmpVectors.Vector3[2]);\n }\n }\n boundingInfo.reConstruct(TmpVectors.Vector3[0], TmpVectors.Vector3[1]);\n this._updateBoundingInfo();\n};\nMesh.prototype._thinInstanceUpdateBufferSize = function (kind, numInstances = 1) {\n var _a, _b, _c;\n // preserve backward compatibility\n if (kind === VertexBuffer.ColorKind) {\n kind = VertexBuffer.ColorInstanceKind;\n }\n const kindIsMatrix = kind === \"matrix\";\n if (!kindIsMatrix && (!this._userThinInstanceBuffersStorage || !this._userThinInstanceBuffersStorage.strides[kind])) {\n return;\n }\n const stride = kindIsMatrix ? 16 : this._userThinInstanceBuffersStorage.strides[kind];\n const currentSize = kindIsMatrix ? this._thinInstanceDataStorage.matrixBufferSize : this._userThinInstanceBuffersStorage.sizes[kind];\n let data = kindIsMatrix ? this._thinInstanceDataStorage.matrixData : this._userThinInstanceBuffersStorage.data[kind];\n const bufferSize = (this._thinInstanceDataStorage.instancesCount + numInstances) * stride;\n let newSize = currentSize;\n while (newSize < bufferSize) {\n newSize *= 2;\n }\n if (!data || currentSize != newSize) {\n if (!data) {\n data = new Float32Array(newSize);\n }\n else {\n const newData = new Float32Array(newSize);\n newData.set(data, 0);\n data = newData;\n }\n if (kindIsMatrix) {\n (_a = this._thinInstanceDataStorage.matrixBuffer) === null || _a === void 0 ? void 0 : _a.dispose();\n this._thinInstanceDataStorage.matrixBuffer = this._thinInstanceCreateMatrixBuffer(\"world\", data, false);\n this._thinInstanceDataStorage.matrixData = data;\n this._thinInstanceDataStorage.matrixBufferSize = newSize;\n if (this._scene.needsPreviousWorldMatrices && !this._thinInstanceDataStorage.previousMatrixData) {\n (_b = this._thinInstanceDataStorage.previousMatrixBuffer) === null || _b === void 0 ? void 0 : _b.dispose();\n this._thinInstanceDataStorage.previousMatrixBuffer = this._thinInstanceCreateMatrixBuffer(\"previousWorld\", data, false);\n }\n }\n else {\n (_c = this._userThinInstanceBuffersStorage.vertexBuffers[kind]) === null || _c === void 0 ? void 0 : _c.dispose();\n this._userThinInstanceBuffersStorage.data[kind] = data;\n this._userThinInstanceBuffersStorage.sizes[kind] = newSize;\n this._userThinInstanceBuffersStorage.vertexBuffers[kind] = new VertexBuffer(this.getEngine(), data, kind, true, false, stride, true);\n this.setVerticesBuffer(this._userThinInstanceBuffersStorage.vertexBuffers[kind]);\n }\n }\n};\nMesh.prototype._thinInstanceInitializeUserStorage = function () {\n if (!this._userThinInstanceBuffersStorage) {\n this._userThinInstanceBuffersStorage = {\n data: {},\n sizes: {},\n vertexBuffers: {},\n strides: {},\n };\n }\n};\nMesh.prototype._disposeThinInstanceSpecificData = function () {\n var _a;\n if ((_a = this._thinInstanceDataStorage) === null || _a === void 0 ? void 0 : _a.matrixBuffer) {\n this._thinInstanceDataStorage.matrixBuffer.dispose();\n this._thinInstanceDataStorage.matrixBuffer = null;\n }\n};\n//# sourceMappingURL=thinInstanceMesh.js.map","import { Vector3, Quaternion, Matrix, TmpVectors } from \"@babylonjs/core/Maths/math.vector.js\";\nimport { GLTFLoader, ArrayItem } from \"../glTFLoader.js\";\nimport \"@babylonjs/core/Meshes/thinInstanceMesh.js\";\nconst NAME = \"EXT_mesh_gpu_instancing\";\n/**\n * [Specification](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Vendor/EXT_mesh_gpu_instancing/README.md)\n * [Playground Sample](https://playground.babylonjs.com/#QFIGLW#9)\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport class EXT_mesh_gpu_instancing {\n /**\n * @internal\n */\n constructor(loader) {\n /**\n * The name of this extension.\n */\n this.name = NAME;\n this._loader = loader;\n this.enabled = this._loader.isExtensionUsed(NAME);\n }\n /** @internal */\n dispose() {\n this._loader = null;\n }\n /**\n * @internal\n */\n loadNodeAsync(context, node, assign) {\n return GLTFLoader.LoadExtensionAsync(context, node, this.name, (extensionContext, extension) => {\n this._loader._disableInstancedMesh++;\n const promise = this._loader.loadNodeAsync(`/nodes/${node.index}`, node, assign);\n this._loader._disableInstancedMesh--;\n if (!node._primitiveBabylonMeshes) {\n return promise;\n }\n const promises = new Array();\n let instanceCount = 0;\n const loadAttribute = (attribute) => {\n if (extension.attributes[attribute] == undefined) {\n promises.push(Promise.resolve(null));\n return;\n }\n const accessor = ArrayItem.Get(`${extensionContext}/attributes/${attribute}`, this._loader.gltf.accessors, extension.attributes[attribute]);\n promises.push(this._loader._loadFloatAccessorAsync(`/accessors/${accessor.bufferView}`, accessor));\n if (instanceCount === 0) {\n instanceCount = accessor.count;\n }\n else if (instanceCount !== accessor.count) {\n throw new Error(`${extensionContext}/attributes: Instance buffer accessors do not have the same count.`);\n }\n };\n loadAttribute(\"TRANSLATION\");\n loadAttribute(\"ROTATION\");\n loadAttribute(\"SCALE\");\n return promise.then((babylonTransformNode) => {\n return Promise.all(promises).then(([translationBuffer, rotationBuffer, scaleBuffer]) => {\n const matrices = new Float32Array(instanceCount * 16);\n TmpVectors.Vector3[0].copyFromFloats(0, 0, 0); // translation\n TmpVectors.Quaternion[0].copyFromFloats(0, 0, 0, 1); // rotation\n TmpVectors.Vector3[1].copyFromFloats(1, 1, 1); // scale\n for (let i = 0; i < instanceCount; ++i) {\n translationBuffer && Vector3.FromArrayToRef(translationBuffer, i * 3, TmpVectors.Vector3[0]);\n rotationBuffer && Quaternion.FromArrayToRef(rotationBuffer, i * 4, TmpVectors.Quaternion[0]);\n scaleBuffer && Vector3.FromArrayToRef(scaleBuffer, i * 3, TmpVectors.Vector3[1]);\n Matrix.ComposeToRef(TmpVectors.Vector3[1], TmpVectors.Quaternion[0], TmpVectors.Vector3[0], TmpVectors.Matrix[0]);\n TmpVectors.Matrix[0].copyToArray(matrices, i * 16);\n }\n for (const babylonMesh of node._primitiveBabylonMeshes) {\n babylonMesh.thinInstanceSetBuffer(\"matrix\", matrices, 16, true);\n }\n return babylonTransformNode;\n });\n });\n });\n }\n}\nGLTFLoader.RegisterExtension(NAME, (loader) => new EXT_mesh_gpu_instancing(loader));\n//# sourceMappingURL=EXT_mesh_gpu_instancing.js.map","import { Tools } from \"../../Misc/tools.js\";\n/**\n * Meshopt compression (https://github.com/zeux/meshoptimizer)\n *\n * This class wraps the meshopt library from https://github.com/zeux/meshoptimizer/tree/master/js.\n *\n * **Encoder**\n *\n * The encoder is not currently implemented.\n *\n * **Decoder**\n *\n * By default, the configuration points to a copy of the meshopt files on the Babylon.js preview CDN (e.g. https://preview.babylonjs.com/meshopt_decoder.js).\n *\n * To update the configuration, use the following code:\n * ```javascript\n * MeshoptCompression.Configuration = {\n * decoder: {\n * url: \"\"\n * }\n * };\n * ```\n */\nexport class MeshoptCompression {\n /**\n * Default instance for the meshoptimizer object.\n */\n static get Default() {\n if (!MeshoptCompression._Default) {\n MeshoptCompression._Default = new MeshoptCompression();\n }\n return MeshoptCompression._Default;\n }\n /**\n * Constructor\n */\n constructor() {\n const decoder = MeshoptCompression.Configuration.decoder;\n this._decoderModulePromise = Tools.LoadScriptAsync(Tools.GetAbsoluteUrl(decoder.url)).then(() => {\n // Wait for WebAssembly compilation before resolving promise\n return MeshoptDecoder.ready;\n });\n }\n /**\n * Stop all async operations and release resources.\n */\n dispose() {\n delete this._decoderModulePromise;\n }\n /**\n * Decode meshopt data.\n * @see https://github.com/zeux/meshoptimizer/tree/master/js#decoder\n * @param source The input data.\n * @param count The number of elements.\n * @param stride The stride in bytes.\n * @param mode The compression mode.\n * @param filter The compression filter.\n * @returns a Promise that resolves to the decoded data\n */\n decodeGltfBufferAsync(source, count, stride, mode, filter) {\n return this._decoderModulePromise.then(() => {\n const result = new Uint8Array(count * stride);\n MeshoptDecoder.decodeGltfBuffer(result, count, stride, source, mode, filter);\n return result;\n });\n }\n}\n/**\n * The configuration. Defaults to the following:\n * ```javascript\n * decoder: {\n * url: \"https://preview.babylonjs.com/meshopt_decoder.js\"\n * }\n * ```\n */\nMeshoptCompression.Configuration = {\n decoder: {\n url: \"https://preview.babylonjs.com/meshopt_decoder.js\",\n },\n};\nMeshoptCompression._Default = null;\n//# sourceMappingURL=meshoptCompression.js.map","import { ArrayItem, GLTFLoader } from \"../glTFLoader.js\";\nimport { MeshoptCompression } from \"@babylonjs/core/Meshes/Compression/meshoptCompression.js\";\nconst NAME = \"EXT_meshopt_compression\";\n/**\n * [Specification](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Vendor/EXT_meshopt_compression/README.md)\n *\n * This extension uses a WebAssembly decoder module from https://github.com/zeux/meshoptimizer/tree/master/js\n * @since 5.0.0\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport class EXT_meshopt_compression {\n /**\n * @internal\n */\n constructor(loader) {\n /**\n * The name of this extension.\n */\n this.name = NAME;\n this.enabled = loader.isExtensionUsed(NAME);\n this._loader = loader;\n }\n /** @internal */\n dispose() {\n this._loader = null;\n }\n /**\n * @internal\n */\n loadBufferViewAsync(context, bufferView) {\n return GLTFLoader.LoadExtensionAsync(context, bufferView, this.name, (extensionContext, extension) => {\n const bufferViewMeshopt = bufferView;\n if (bufferViewMeshopt._meshOptData) {\n return bufferViewMeshopt._meshOptData;\n }\n const buffer = ArrayItem.Get(`${context}/buffer`, this._loader.gltf.buffers, extension.buffer);\n bufferViewMeshopt._meshOptData = this._loader.loadBufferAsync(`/buffers/${buffer.index}`, buffer, extension.byteOffset || 0, extension.byteLength).then((buffer) => {\n return MeshoptCompression.Default.decodeGltfBufferAsync(buffer, extension.count, extension.byteStride, extension.mode, extension.filter);\n });\n return bufferViewMeshopt._meshOptData;\n });\n }\n}\nGLTFLoader.RegisterExtension(NAME, (loader) => new EXT_meshopt_compression(loader));\n//# sourceMappingURL=EXT_meshopt_compression.js.map","import { GLTFLoader, ArrayItem } from \"../glTFLoader.js\";\nconst NAME = \"EXT_texture_webp\";\n/**\n * [Specification](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Vendor/EXT_texture_webp/README.md)\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport class EXT_texture_webp {\n /**\n * @internal\n */\n constructor(loader) {\n /** The name of this extension. */\n this.name = NAME;\n this._loader = loader;\n this.enabled = loader.isExtensionUsed(NAME);\n }\n /** @internal */\n dispose() {\n this._loader = null;\n }\n /**\n * @internal\n */\n _loadTextureAsync(context, texture, assign) {\n return GLTFLoader.LoadExtensionAsync(context, texture, this.name, (extensionContext, extension) => {\n const sampler = texture.sampler == undefined ? GLTFLoader.DefaultSampler : ArrayItem.Get(`${context}/sampler`, this._loader.gltf.samplers, texture.sampler);\n const image = ArrayItem.Get(`${extensionContext}/source`, this._loader.gltf.images, extension.source);\n return this._loader._createTextureAsync(context, sampler, image, (babylonTexture) => {\n assign(babylonTexture);\n }, undefined, !texture._textureInfo.nonColorData);\n });\n }\n}\nGLTFLoader.RegisterExtension(NAME, (loader) => new EXT_texture_webp(loader));\n//# sourceMappingURL=EXT_texture_webp.js.map","/**\n * Helper class to push actions to a pool of workers.\n */\nexport class WorkerPool {\n /**\n * Constructor\n * @param workers Array of workers to use for actions\n */\n constructor(workers) {\n this._pendingActions = new Array();\n this._workerInfos = workers.map((worker) => ({\n workerPromise: Promise.resolve(worker),\n idle: true,\n }));\n }\n /**\n * Terminates all workers and clears any pending actions.\n */\n dispose() {\n for (const workerInfo of this._workerInfos) {\n workerInfo.workerPromise.then((worker) => {\n worker.terminate();\n });\n }\n this._workerInfos.length = 0;\n this._pendingActions.length = 0;\n }\n /**\n * Pushes an action to the worker pool. If all the workers are active, the action will be\n * pended until a worker has completed its action.\n * @param action The action to perform. Call onComplete when the action is complete.\n */\n push(action) {\n if (!this._executeOnIdleWorker(action)) {\n this._pendingActions.push(action);\n }\n }\n _executeOnIdleWorker(action) {\n for (const workerInfo of this._workerInfos) {\n if (workerInfo.idle) {\n this._execute(workerInfo, action);\n return true;\n }\n }\n return false;\n }\n _execute(workerInfo, action) {\n workerInfo.idle = false;\n workerInfo.workerPromise.then((worker) => {\n action(worker, () => {\n const nextAction = this._pendingActions.shift();\n if (nextAction) {\n this._execute(workerInfo, nextAction);\n }\n else {\n workerInfo.idle = true;\n }\n });\n });\n }\n}\n/**\n * Similar to the WorkerPool class except it creates and destroys workers automatically with a maximum of `maxWorkers` workers.\n * Workers are terminated when it is idle for at least `idleTimeElapsedBeforeRelease` milliseconds.\n */\nexport class AutoReleaseWorkerPool extends WorkerPool {\n constructor(maxWorkers, createWorkerAsync, options = AutoReleaseWorkerPool.DefaultOptions) {\n super([]);\n this._maxWorkers = maxWorkers;\n this._createWorkerAsync = createWorkerAsync;\n this._options = options;\n }\n push(action) {\n if (!this._executeOnIdleWorker(action)) {\n if (this._workerInfos.length < this._maxWorkers) {\n const workerInfo = {\n workerPromise: this._createWorkerAsync(),\n idle: false,\n };\n this._workerInfos.push(workerInfo);\n this._execute(workerInfo, action);\n }\n else {\n this._pendingActions.push(action);\n }\n }\n }\n _execute(workerInfo, action) {\n // Reset the idle timeout.\n if (workerInfo.timeoutId) {\n clearTimeout(workerInfo.timeoutId);\n delete workerInfo.timeoutId;\n }\n super._execute(workerInfo, (worker, onComplete) => {\n action(worker, () => {\n onComplete();\n if (workerInfo.idle) {\n // Schedule the worker to be terminated after the elapsed time.\n workerInfo.timeoutId = setTimeout(() => {\n workerInfo.workerPromise.then((worker) => {\n worker.terminate();\n });\n const indexOf = this._workerInfos.indexOf(workerInfo);\n if (indexOf !== -1) {\n this._workerInfos.splice(indexOf, 1);\n }\n }, this._options.idleTimeElapsedBeforeRelease);\n }\n });\n });\n }\n}\n/**\n * Default options for the constructor.\n * Override to change the defaults.\n */\nAutoReleaseWorkerPool.DefaultOptions = {\n idleTimeElapsedBeforeRelease: 1000,\n};\n//# sourceMappingURL=workerPool.js.map","/* eslint-disable @typescript-eslint/naming-convention */\nimport { Tools } from \"../../Misc/tools.js\";\nimport { AutoReleaseWorkerPool } from \"../../Misc/workerPool.js\";\nimport { Geometry } from \"../geometry.js\";\nimport { VertexBuffer } from \"../buffer.js\";\nimport { VertexData } from \"../mesh.vertexData.js\";\nfunction createDecoderAsync(wasmBinary) {\n return new Promise((resolve) => {\n DracoDecoderModule({ wasmBinary: wasmBinary }).then((module) => {\n resolve({ module: module });\n });\n });\n}\nfunction decodeMesh(decoderModule, data, attributes, onIndicesData, onAttributeData) {\n let decoder = null;\n let buffer = null;\n let geometry = null;\n try {\n decoder = new decoderModule.Decoder();\n buffer = new decoderModule.DecoderBuffer();\n buffer.Init(data, data.byteLength);\n let status;\n const type = decoder.GetEncodedGeometryType(buffer);\n switch (type) {\n case decoderModule.TRIANGULAR_MESH: {\n const mesh = new decoderModule.Mesh();\n status = decoder.DecodeBufferToMesh(buffer, mesh);\n if (!status.ok() || mesh.ptr === 0) {\n throw new Error(status.error_msg());\n }\n const numFaces = mesh.num_faces();\n const numIndices = numFaces * 3;\n const byteLength = numIndices * 4;\n const ptr = decoderModule._malloc(byteLength);\n try {\n decoder.GetTrianglesUInt32Array(mesh, byteLength, ptr);\n const indices = new Uint32Array(numIndices);\n indices.set(new Uint32Array(decoderModule.HEAPF32.buffer, ptr, numIndices));\n onIndicesData(indices);\n }\n finally {\n decoderModule._free(ptr);\n }\n geometry = mesh;\n break;\n }\n case decoderModule.POINT_CLOUD: {\n const pointCloud = new decoderModule.PointCloud();\n status = decoder.DecodeBufferToPointCloud(buffer, pointCloud);\n if (!status.ok() || !pointCloud.ptr) {\n throw new Error(status.error_msg());\n }\n geometry = pointCloud;\n break;\n }\n default: {\n throw new Error(`Invalid geometry type ${type}`);\n }\n }\n const numPoints = geometry.num_points();\n const processAttribute = (decoder, geometry, kind, attribute) => {\n const dataType = attribute.data_type();\n const numComponents = attribute.num_components();\n const normalized = attribute.normalized();\n const byteStride = attribute.byte_stride();\n const byteOffset = attribute.byte_offset();\n const dataTypeInfo = {\n [decoderModule.DT_FLOAT32]: { typedArrayConstructor: Float32Array, heap: decoderModule.HEAPF32 },\n [decoderModule.DT_INT8]: { typedArrayConstructor: Int8Array, heap: decoderModule.HEAP8 },\n [decoderModule.DT_INT16]: { typedArrayConstructor: Int16Array, heap: decoderModule.HEAP16 },\n [decoderModule.DT_INT32]: { typedArrayConstructor: Int32Array, heap: decoderModule.HEAP32 },\n [decoderModule.DT_UINT8]: { typedArrayConstructor: Uint8Array, heap: decoderModule.HEAPU8 },\n [decoderModule.DT_UINT16]: { typedArrayConstructor: Uint16Array, heap: decoderModule.HEAPU16 },\n [decoderModule.DT_UINT32]: { typedArrayConstructor: Uint32Array, heap: decoderModule.HEAPU32 },\n };\n const info = dataTypeInfo[dataType];\n if (!info) {\n throw new Error(`Invalid data type ${dataType}`);\n }\n const numValues = numPoints * numComponents;\n const byteLength = numValues * info.typedArrayConstructor.BYTES_PER_ELEMENT;\n const ptr = decoderModule._malloc(byteLength);\n try {\n decoder.GetAttributeDataArrayForAllPoints(geometry, attribute, dataType, byteLength, ptr);\n const data = new info.typedArrayConstructor(info.heap.buffer, ptr, numValues);\n onAttributeData(kind, data.slice(), byteOffset, byteStride, normalized);\n }\n finally {\n decoderModule._free(ptr);\n }\n };\n if (attributes) {\n for (const kind in attributes) {\n const id = attributes[kind];\n const attribute = decoder.GetAttributeByUniqueId(geometry, id);\n processAttribute(decoder, geometry, kind, attribute);\n }\n }\n else {\n const dracoAttributeTypes = {\n position: decoderModule.POSITION,\n normal: decoderModule.NORMAL,\n color: decoderModule.COLOR,\n uv: decoderModule.TEX_COORD,\n };\n for (const kind in dracoAttributeTypes) {\n const id = decoder.GetAttributeId(geometry, dracoAttributeTypes[kind]);\n if (id !== -1) {\n const attribute = decoder.GetAttribute(geometry, id);\n processAttribute(decoder, geometry, kind, attribute);\n }\n }\n }\n return numPoints;\n }\n finally {\n if (geometry) {\n decoderModule.destroy(geometry);\n }\n if (buffer) {\n decoderModule.destroy(buffer);\n }\n if (decoder) {\n decoderModule.destroy(decoder);\n }\n }\n}\n/**\n * The worker function that gets converted to a blob url to pass into a worker.\n */\nfunction worker() {\n let decoderPromise;\n onmessage = (event) => {\n const message = event.data;\n switch (message.id) {\n case \"init\": {\n const decoder = message.decoder;\n if (decoder.url) {\n importScripts(decoder.url);\n decoderPromise = DracoDecoderModule({ wasmBinary: decoder.wasmBinary });\n }\n postMessage({ id: \"initDone\" });\n break;\n }\n case \"decodeMesh\": {\n if (!decoderPromise) {\n throw new Error(\"Draco decoder module is not available\");\n }\n decoderPromise.then((decoder) => {\n const numPoints = decodeMesh(decoder, message.dataView, message.attributes, (indices) => {\n postMessage({ id: \"indices\", data: indices }, [indices.buffer]);\n }, (kind, data, offset, stride, normalized) => {\n postMessage({ id: \"attribute\", kind, data, offset, stride, normalized }, [data.buffer]);\n });\n postMessage({ id: \"decodeMeshDone\", totalVertices: numPoints });\n });\n break;\n }\n }\n };\n}\n/**\n * Draco compression (https://google.github.io/draco/)\n *\n * This class wraps the Draco module.\n *\n * **Encoder**\n *\n * The encoder is not currently implemented.\n *\n * **Decoder**\n *\n * By default, the configuration points to a copy of the Draco decoder files for glTF from the babylon.js preview cdn https://preview.babylonjs.com/draco_wasm_wrapper_gltf.js.\n *\n * To update the configuration, use the following code:\n * ```javascript\n * DracoCompression.Configuration = {\n * decoder: {\n * wasmUrl: \"\",\n * wasmBinaryUrl: \"\",\n * fallbackUrl: \"\",\n * }\n * };\n * ```\n *\n * Draco has two versions, one for WebAssembly and one for JavaScript. The decoder configuration can be set to only support WebAssembly or only support the JavaScript version.\n * Decoding will automatically fallback to the JavaScript version if WebAssembly version is not configured or if WebAssembly is not supported by the browser.\n * Use `DracoCompression.DecoderAvailable` to determine if the decoder configuration is available for the current context.\n *\n * To decode Draco compressed data, get the default DracoCompression object and call decodeMeshToGeometryAsync:\n * ```javascript\n * var geometry = await DracoCompression.Default.decodeMeshToGeometryAsync(data);\n * ```\n *\n * @see https://playground.babylonjs.com/#DMZIBD#0\n */\nexport class DracoCompression {\n /**\n * Returns true if the decoder configuration is available.\n */\n static get DecoderAvailable() {\n const decoder = DracoCompression.Configuration.decoder;\n return !!((decoder.wasmUrl && decoder.wasmBinaryUrl && typeof WebAssembly === \"object\") || decoder.fallbackUrl);\n }\n static GetDefaultNumWorkers() {\n if (typeof navigator !== \"object\" || !navigator.hardwareConcurrency) {\n return 1;\n }\n // Use 50% of the available logical processors but capped at 4.\n return Math.min(Math.floor(navigator.hardwareConcurrency * 0.5), 4);\n }\n /**\n * Default instance for the draco compression object.\n */\n static get Default() {\n if (!DracoCompression._Default) {\n DracoCompression._Default = new DracoCompression();\n }\n return DracoCompression._Default;\n }\n /**\n * Constructor\n * @param numWorkers The number of workers for async operations. Specify `0` to disable web workers and run synchronously in the current context.\n */\n constructor(numWorkers = DracoCompression.DefaultNumWorkers) {\n const decoder = DracoCompression.Configuration.decoder;\n const decoderInfo = decoder.wasmUrl && decoder.wasmBinaryUrl && typeof WebAssembly === \"object\"\n ? {\n url: Tools.GetAbsoluteUrl(decoder.wasmUrl),\n wasmBinaryPromise: Tools.LoadFileAsync(Tools.GetAbsoluteUrl(decoder.wasmBinaryUrl)),\n }\n : {\n url: Tools.GetAbsoluteUrl(decoder.fallbackUrl),\n wasmBinaryPromise: Promise.resolve(undefined),\n };\n if (numWorkers && typeof Worker === \"function\" && typeof URL === \"function\") {\n this._workerPoolPromise = decoderInfo.wasmBinaryPromise.then((decoderWasmBinary) => {\n const workerContent = `${decodeMesh}(${worker})()`;\n const workerBlobUrl = URL.createObjectURL(new Blob([workerContent], { type: \"application/javascript\" }));\n return new AutoReleaseWorkerPool(numWorkers, () => {\n return new Promise((resolve, reject) => {\n const worker = new Worker(workerBlobUrl);\n const onError = (error) => {\n worker.removeEventListener(\"error\", onError);\n worker.removeEventListener(\"message\", onMessage);\n reject(error);\n };\n const onMessage = (event) => {\n if (event.data.id === \"initDone\") {\n worker.removeEventListener(\"error\", onError);\n worker.removeEventListener(\"message\", onMessage);\n resolve(worker);\n }\n };\n worker.addEventListener(\"error\", onError);\n worker.addEventListener(\"message\", onMessage);\n worker.postMessage({\n id: \"init\",\n decoder: {\n url: decoderInfo.url,\n wasmBinary: decoderWasmBinary,\n },\n });\n });\n });\n });\n }\n else {\n this._decoderModulePromise = decoderInfo.wasmBinaryPromise.then((decoderWasmBinary) => {\n if (!decoderInfo.url) {\n throw new Error(\"Draco decoder module is not available\");\n }\n return Tools.LoadScriptAsync(decoderInfo.url).then(() => {\n return createDecoderAsync(decoderWasmBinary);\n });\n });\n }\n }\n /**\n * Stop all async operations and release resources.\n */\n dispose() {\n if (this._workerPoolPromise) {\n this._workerPoolPromise.then((workerPool) => {\n workerPool.dispose();\n });\n }\n delete this._workerPoolPromise;\n delete this._decoderModulePromise;\n }\n /**\n * Returns a promise that resolves when ready. Call this manually to ensure draco compression is ready before use.\n * @returns a promise that resolves when ready\n */\n whenReadyAsync() {\n if (this._workerPoolPromise) {\n return this._workerPoolPromise.then(() => { });\n }\n if (this._decoderModulePromise) {\n return this._decoderModulePromise.then(() => { });\n }\n return Promise.resolve();\n }\n _decodeMeshAsync(engine, data, attributes) {\n const dataView = data instanceof ArrayBuffer ? new Int8Array(data) : new Int8Array(data.buffer, data.byteOffset, data.byteLength);\n if (this._workerPoolPromise) {\n return this._workerPoolPromise.then((workerPool) => {\n return new Promise((resolve, reject) => {\n workerPool.push((worker, onComplete) => {\n let resultIndices = null;\n const resultAttributes = [];\n const onError = (error) => {\n worker.removeEventListener(\"error\", onError);\n worker.removeEventListener(\"message\", onMessage);\n reject(error);\n onComplete();\n };\n const onMessage = (event) => {\n const message = event.data;\n switch (message.id) {\n case \"decodeMeshDone\": {\n worker.removeEventListener(\"error\", onError);\n worker.removeEventListener(\"message\", onMessage);\n resolve({ indices: resultIndices, attributes: resultAttributes, totalVertices: message.totalVertices });\n onComplete();\n break;\n }\n case \"indices\": {\n resultIndices = message.data;\n break;\n }\n case \"attribute\": {\n resultAttributes.push(new VertexBuffer(engine, message.data, message.kind, false, undefined, message.stride, undefined, message.offset, undefined, undefined, message.normalized, true));\n break;\n }\n }\n };\n worker.addEventListener(\"error\", onError);\n worker.addEventListener(\"message\", onMessage);\n const dataViewCopy = dataView.slice();\n worker.postMessage({ id: \"decodeMesh\", dataView: dataViewCopy, attributes: attributes }, [dataViewCopy.buffer]);\n });\n });\n });\n }\n if (this._decoderModulePromise) {\n return this._decoderModulePromise.then((decoder) => {\n let resultIndices = null;\n const resultAttributes = [];\n const numPoints = decodeMesh(decoder.module, dataView, attributes, (indices) => {\n resultIndices = indices;\n }, (kind, data, offset, stride, normalized) => {\n resultAttributes.push(new VertexBuffer(null, data, kind, false, undefined, stride, undefined, offset, undefined, undefined, normalized, true));\n });\n return { indices: resultIndices, attributes: resultAttributes, totalVertices: numPoints };\n });\n }\n throw new Error(\"Draco decoder module is not available\");\n }\n /**\n * Decode Draco compressed mesh data to Babylon geometry.\n * @param name The name to use when creating the geometry\n * @param scene The scene to use when creating the geometry\n * @param data The ArrayBuffer or ArrayBufferView for the Draco compression data\n * @param attributes A map of attributes from vertex buffer kinds to Draco unique ids\n * @returns A promise that resolves with the decoded geometry\n */\n decodeMeshToGeometryAsync(name, scene, data, attributes) {\n return this._decodeMeshAsync(scene.getEngine(), data, attributes).then((meshData) => {\n const geometry = new Geometry(name, scene);\n if (meshData.indices) {\n geometry.setIndices(meshData.indices);\n }\n for (const attribute of meshData.attributes) {\n geometry.setVerticesBuffer(attribute);\n }\n return geometry;\n });\n }\n /**\n * Decode Draco compressed mesh data to Babylon vertex data.\n * @param data The ArrayBuffer or ArrayBufferView for the Draco compression data\n * @param attributes A map of attributes from vertex buffer kinds to Draco unique ids\n * @returns A promise that resolves with the decoded vertex data\n * @deprecated Use {@link decodeMeshToGeometryAsync} for better performance in some cases\n */\n decodeMeshAsync(data, attributes) {\n return this._decodeMeshAsync(null, data, attributes).then((meshData) => {\n const vertexData = new VertexData();\n if (meshData.indices) {\n vertexData.indices = meshData.indices;\n }\n for (const attribute of meshData.attributes) {\n vertexData.set(attribute.getFloatData(meshData.totalVertices), attribute.getKind());\n }\n return vertexData;\n });\n }\n}\n/**\n * The configuration. Defaults to the following urls:\n * - wasmUrl: \"https://preview.babylonjs.com/draco_wasm_wrapper_gltf.js\"\n * - wasmBinaryUrl: \"https://preview.babylonjs.com/draco_decoder_gltf.wasm\"\n * - fallbackUrl: \"https://preview.babylonjs.com/draco_decoder_gltf.js\"\n */\nDracoCompression.Configuration = {\n decoder: {\n wasmUrl: \"https://preview.babylonjs.com/draco_wasm_wrapper_gltf.js\",\n wasmBinaryUrl: \"https://preview.babylonjs.com/draco_decoder_gltf.wasm\",\n fallbackUrl: \"https://preview.babylonjs.com/draco_decoder_gltf.js\",\n },\n};\n/**\n * Default number of workers to create when creating the draco compression object.\n */\nDracoCompression.DefaultNumWorkers = DracoCompression.GetDefaultNumWorkers();\nDracoCompression._Default = null;\n//# sourceMappingURL=dracoCompression.js.map","import { DracoCompression } from \"@babylonjs/core/Meshes/Compression/dracoCompression.js\";\nimport { VertexBuffer } from \"@babylonjs/core/Buffers/buffer.js\";\nimport { GLTFLoader, ArrayItem } from \"../glTFLoader.js\";\nconst NAME = \"KHR_draco_mesh_compression\";\n/**\n * [Specification](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_draco_mesh_compression/README.md)\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport class KHR_draco_mesh_compression {\n /**\n * @internal\n */\n constructor(loader) {\n /**\n * The name of this extension.\n */\n this.name = NAME;\n this._loader = loader;\n this.enabled = DracoCompression.DecoderAvailable && this._loader.isExtensionUsed(NAME);\n }\n /** @internal */\n dispose() {\n delete this.dracoCompression;\n this._loader = null;\n }\n /**\n * @internal\n */\n _loadVertexDataAsync(context, primitive, babylonMesh) {\n return GLTFLoader.LoadExtensionAsync(context, primitive, this.name, (extensionContext, extension) => {\n if (primitive.mode != undefined) {\n if (primitive.mode !== 5 /* MeshPrimitiveMode.TRIANGLE_STRIP */ && primitive.mode !== 4 /* MeshPrimitiveMode.TRIANGLES */) {\n throw new Error(`${context}: Unsupported mode ${primitive.mode}`);\n }\n // TODO: handle triangle strips\n if (primitive.mode === 5 /* MeshPrimitiveMode.TRIANGLE_STRIP */) {\n throw new Error(`${context}: Mode ${primitive.mode} is not currently supported`);\n }\n }\n const attributes = {};\n const loadAttribute = (name, kind) => {\n const uniqueId = extension.attributes[name];\n if (uniqueId == undefined) {\n return;\n }\n babylonMesh._delayInfo = babylonMesh._delayInfo || [];\n if (babylonMesh._delayInfo.indexOf(kind) === -1) {\n babylonMesh._delayInfo.push(kind);\n }\n attributes[kind] = uniqueId;\n };\n loadAttribute(\"POSITION\", VertexBuffer.PositionKind);\n loadAttribute(\"NORMAL\", VertexBuffer.NormalKind);\n loadAttribute(\"TANGENT\", VertexBuffer.TangentKind);\n loadAttribute(\"TEXCOORD_0\", VertexBuffer.UVKind);\n loadAttribute(\"TEXCOORD_1\", VertexBuffer.UV2Kind);\n loadAttribute(\"TEXCOORD_2\", VertexBuffer.UV3Kind);\n loadAttribute(\"TEXCOORD_3\", VertexBuffer.UV4Kind);\n loadAttribute(\"TEXCOORD_4\", VertexBuffer.UV5Kind);\n loadAttribute(\"TEXCOORD_5\", VertexBuffer.UV6Kind);\n loadAttribute(\"JOINTS_0\", VertexBuffer.MatricesIndicesKind);\n loadAttribute(\"WEIGHTS_0\", VertexBuffer.MatricesWeightsKind);\n loadAttribute(\"COLOR_0\", VertexBuffer.ColorKind);\n const bufferView = ArrayItem.Get(extensionContext, this._loader.gltf.bufferViews, extension.bufferView);\n if (!bufferView._dracoBabylonGeometry) {\n bufferView._dracoBabylonGeometry = this._loader.loadBufferViewAsync(`/bufferViews/${bufferView.index}`, bufferView).then((data) => {\n const dracoCompression = this.dracoCompression || DracoCompression.Default;\n return dracoCompression.decodeMeshToGeometryAsync(babylonMesh.name, this._loader.babylonScene, data, attributes).catch((error) => {\n throw new Error(`${context}: ${error.message}`);\n });\n });\n }\n return bufferView._dracoBabylonGeometry;\n });\n }\n}\nGLTFLoader.RegisterExtension(NAME, (loader) => new KHR_draco_mesh_compression(loader));\n//# sourceMappingURL=KHR_draco_mesh_compression.js.map","import { Vector3 } from \"@babylonjs/core/Maths/math.vector.js\";\nimport { Color3 } from \"@babylonjs/core/Maths/math.color.js\";\nimport { DirectionalLight } from \"@babylonjs/core/Lights/directionalLight.js\";\nimport { PointLight } from \"@babylonjs/core/Lights/pointLight.js\";\nimport { SpotLight } from \"@babylonjs/core/Lights/spotLight.js\";\nimport { Light } from \"@babylonjs/core/Lights/light.js\";\nimport { GLTFLoader, ArrayItem } from \"../glTFLoader.js\";\nconst NAME = \"KHR_lights_punctual\";\n/**\n * [Specification](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_lights_punctual/README.md)\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport class KHR_lights {\n /**\n * @internal\n */\n constructor(loader) {\n /**\n * The name of this extension.\n */\n this.name = NAME;\n this._loader = loader;\n this.enabled = this._loader.isExtensionUsed(NAME);\n }\n /** @internal */\n dispose() {\n this._loader = null;\n delete this._lights;\n }\n /** @internal */\n onLoading() {\n const extensions = this._loader.gltf.extensions;\n if (extensions && extensions[this.name]) {\n const extension = extensions[this.name];\n this._lights = extension.lights;\n ArrayItem.Assign(this._lights);\n }\n }\n /**\n * @internal\n */\n loadNodeAsync(context, node, assign) {\n return GLTFLoader.LoadExtensionAsync(context, node, this.name, (extensionContext, extension) => {\n return this._loader.loadNodeAsync(context, node, (babylonMesh) => {\n let babylonLight;\n const light = ArrayItem.Get(extensionContext, this._lights, extension.light);\n const name = light.name || babylonMesh.name;\n this._loader.babylonScene._blockEntityCollection = !!this._loader._assetContainer;\n switch (light.type) {\n case \"directional\" /* KHRLightsPunctual_LightType.DIRECTIONAL */: {\n const babylonDirectionalLight = new DirectionalLight(name, Vector3.Backward(), this._loader.babylonScene);\n babylonDirectionalLight.position.setAll(0);\n babylonLight = babylonDirectionalLight;\n break;\n }\n case \"point\" /* KHRLightsPunctual_LightType.POINT */: {\n babylonLight = new PointLight(name, Vector3.Zero(), this._loader.babylonScene);\n break;\n }\n case \"spot\" /* KHRLightsPunctual_LightType.SPOT */: {\n const babylonSpotLight = new SpotLight(name, Vector3.Zero(), Vector3.Backward(), 0, 1, this._loader.babylonScene);\n babylonSpotLight.angle = ((light.spot && light.spot.outerConeAngle) || Math.PI / 4) * 2;\n babylonSpotLight.innerAngle = ((light.spot && light.spot.innerConeAngle) || 0) * 2;\n babylonLight = babylonSpotLight;\n break;\n }\n default: {\n this._loader.babylonScene._blockEntityCollection = false;\n throw new Error(`${extensionContext}: Invalid light type (${light.type})`);\n }\n }\n babylonLight._parentContainer = this._loader._assetContainer;\n this._loader.babylonScene._blockEntityCollection = false;\n light._babylonLight = babylonLight;\n babylonLight.falloffType = Light.FALLOFF_GLTF;\n babylonLight.diffuse = light.color ? Color3.FromArray(light.color) : Color3.White();\n babylonLight.intensity = light.intensity == undefined ? 1 : light.intensity;\n babylonLight.range = light.range == undefined ? Number.MAX_VALUE : light.range;\n babylonLight.parent = babylonMesh;\n this._loader._babylonLights.push(babylonLight);\n GLTFLoader.AddPointerMetadata(babylonLight, extensionContext);\n assign(babylonMesh);\n });\n });\n }\n}\nGLTFLoader.RegisterExtension(NAME, (loader) => new KHR_lights(loader));\n//# sourceMappingURL=KHR_lights_punctual.js.map","import { Color3 } from \"@babylonjs/core/Maths/math.color.js\";\nimport { PBRMaterial } from \"@babylonjs/core/Materials/PBR/pbrMaterial.js\";\nimport { GLTFLoader } from \"../glTFLoader.js\";\nconst NAME = \"KHR_materials_pbrSpecularGlossiness\";\n/**\n * [Specification](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Archived/KHR_materials_pbrSpecularGlossiness/README.md)\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport class KHR_materials_pbrSpecularGlossiness {\n /**\n * @internal\n */\n constructor(loader) {\n /**\n * The name of this extension.\n */\n this.name = NAME;\n /**\n * Defines a number that determines the order the extensions are applied.\n */\n this.order = 200;\n this._loader = loader;\n this.enabled = this._loader.isExtensionUsed(NAME);\n }\n /** @internal */\n dispose() {\n this._loader = null;\n }\n /**\n * @internal\n */\n loadMaterialPropertiesAsync(context, material, babylonMaterial) {\n return GLTFLoader.LoadExtensionAsync(context, material, this.name, (extensionContext, extension) => {\n const promises = new Array();\n promises.push(this._loader.loadMaterialBasePropertiesAsync(context, material, babylonMaterial));\n promises.push(this._loadSpecularGlossinessPropertiesAsync(extensionContext, material, extension, babylonMaterial));\n this._loader.loadMaterialAlphaProperties(context, material, babylonMaterial);\n return Promise.all(promises).then(() => { });\n });\n }\n _loadSpecularGlossinessPropertiesAsync(context, material, properties, babylonMaterial) {\n if (!(babylonMaterial instanceof PBRMaterial)) {\n throw new Error(`${context}: Material type not supported`);\n }\n const promises = new Array();\n babylonMaterial.metallic = null;\n babylonMaterial.roughness = null;\n if (properties.diffuseFactor) {\n babylonMaterial.albedoColor = Color3.FromArray(properties.diffuseFactor);\n babylonMaterial.alpha = properties.diffuseFactor[3];\n }\n else {\n babylonMaterial.albedoColor = Color3.White();\n }\n babylonMaterial.reflectivityColor = properties.specularFactor ? Color3.FromArray(properties.specularFactor) : Color3.White();\n babylonMaterial.microSurface = properties.glossinessFactor == undefined ? 1 : properties.glossinessFactor;\n if (properties.diffuseTexture) {\n promises.push(this._loader.loadTextureInfoAsync(`${context}/diffuseTexture`, properties.diffuseTexture, (texture) => {\n texture.name = `${babylonMaterial.name} (Diffuse)`;\n babylonMaterial.albedoTexture = texture;\n }));\n }\n if (properties.specularGlossinessTexture) {\n promises.push(this._loader.loadTextureInfoAsync(`${context}/specularGlossinessTexture`, properties.specularGlossinessTexture, (texture) => {\n texture.name = `${babylonMaterial.name} (Specular Glossiness)`;\n babylonMaterial.reflectivityTexture = texture;\n babylonMaterial.reflectivityTexture.hasAlpha = true;\n }));\n babylonMaterial.useMicroSurfaceFromReflectivityMapAlpha = true;\n }\n return Promise.all(promises).then(() => { });\n }\n}\nGLTFLoader.RegisterExtension(NAME, (loader) => new KHR_materials_pbrSpecularGlossiness(loader));\n//# sourceMappingURL=KHR_materials_pbrSpecularGlossiness.js.map","import { Color3 } from \"@babylonjs/core/Maths/math.color.js\";\nimport { PBRMaterial } from \"@babylonjs/core/Materials/PBR/pbrMaterial.js\";\nimport { GLTFLoader } from \"../glTFLoader.js\";\nconst NAME = \"KHR_materials_unlit\";\n/**\n * [Specification](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_materials_unlit/README.md)\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport class KHR_materials_unlit {\n /**\n * @internal\n */\n constructor(loader) {\n /**\n * The name of this extension.\n */\n this.name = NAME;\n /**\n * Defines a number that determines the order the extensions are applied.\n */\n this.order = 210;\n this._loader = loader;\n this.enabled = this._loader.isExtensionUsed(NAME);\n }\n /** @internal */\n dispose() {\n this._loader = null;\n }\n /**\n * @internal\n */\n loadMaterialPropertiesAsync(context, material, babylonMaterial) {\n return GLTFLoader.LoadExtensionAsync(context, material, this.name, () => {\n return this._loadUnlitPropertiesAsync(context, material, babylonMaterial);\n });\n }\n _loadUnlitPropertiesAsync(context, material, babylonMaterial) {\n if (!(babylonMaterial instanceof PBRMaterial)) {\n throw new Error(`${context}: Material type not supported`);\n }\n const promises = new Array();\n babylonMaterial.unlit = true;\n const properties = material.pbrMetallicRoughness;\n if (properties) {\n if (properties.baseColorFactor) {\n babylonMaterial.albedoColor = Color3.FromArray(properties.baseColorFactor);\n babylonMaterial.alpha = properties.baseColorFactor[3];\n }\n else {\n babylonMaterial.albedoColor = Color3.White();\n }\n if (properties.baseColorTexture) {\n promises.push(this._loader.loadTextureInfoAsync(`${context}/baseColorTexture`, properties.baseColorTexture, (texture) => {\n texture.name = `${babylonMaterial.name} (Base Color)`;\n babylonMaterial.albedoTexture = texture;\n }));\n }\n }\n if (material.doubleSided) {\n babylonMaterial.backFaceCulling = false;\n babylonMaterial.twoSidedLighting = true;\n }\n this._loader.loadMaterialAlphaProperties(context, material, babylonMaterial);\n return Promise.all(promises).then(() => { });\n }\n}\nGLTFLoader.RegisterExtension(NAME, (loader) => new KHR_materials_unlit(loader));\n//# sourceMappingURL=KHR_materials_unlit.js.map","import { PBRMaterial } from \"@babylonjs/core/Materials/PBR/pbrMaterial.js\";\nimport { GLTFLoader } from \"../glTFLoader.js\";\nconst NAME = \"KHR_materials_clearcoat\";\n/**\n * [Specification](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_materials_clearcoat/README.md)\n * [Playground Sample](https://www.babylonjs-playground.com/frame.html#7F7PN6#8)\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport class KHR_materials_clearcoat {\n /**\n * @internal\n */\n constructor(loader) {\n /**\n * The name of this extension.\n */\n this.name = NAME;\n /**\n * Defines a number that determines the order the extensions are applied.\n */\n this.order = 190;\n this._loader = loader;\n this.enabled = this._loader.isExtensionUsed(NAME);\n }\n /** @internal */\n dispose() {\n this._loader = null;\n }\n /**\n * @internal\n */\n loadMaterialPropertiesAsync(context, material, babylonMaterial) {\n return GLTFLoader.LoadExtensionAsync(context, material, this.name, (extensionContext, extension) => {\n const promises = new Array();\n promises.push(this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial));\n promises.push(this._loadClearCoatPropertiesAsync(extensionContext, extension, babylonMaterial));\n return Promise.all(promises).then(() => { });\n });\n }\n _loadClearCoatPropertiesAsync(context, properties, babylonMaterial) {\n if (!(babylonMaterial instanceof PBRMaterial)) {\n throw new Error(`${context}: Material type not supported`);\n }\n const promises = new Array();\n babylonMaterial.clearCoat.isEnabled = true;\n babylonMaterial.clearCoat.useRoughnessFromMainTexture = false;\n babylonMaterial.clearCoat.remapF0OnInterfaceChange = false;\n if (properties.clearcoatFactor != undefined) {\n babylonMaterial.clearCoat.intensity = properties.clearcoatFactor;\n }\n else {\n babylonMaterial.clearCoat.intensity = 0;\n }\n if (properties.clearcoatTexture) {\n promises.push(this._loader.loadTextureInfoAsync(`${context}/clearcoatTexture`, properties.clearcoatTexture, (texture) => {\n texture.name = `${babylonMaterial.name} (ClearCoat Intensity)`;\n babylonMaterial.clearCoat.texture = texture;\n }));\n }\n if (properties.clearcoatRoughnessFactor != undefined) {\n babylonMaterial.clearCoat.roughness = properties.clearcoatRoughnessFactor;\n }\n else {\n babylonMaterial.clearCoat.roughness = 0;\n }\n if (properties.clearcoatRoughnessTexture) {\n properties.clearcoatRoughnessTexture.nonColorData = true;\n promises.push(this._loader.loadTextureInfoAsync(`${context}/clearcoatRoughnessTexture`, properties.clearcoatRoughnessTexture, (texture) => {\n texture.name = `${babylonMaterial.name} (ClearCoat Roughness)`;\n babylonMaterial.clearCoat.textureRoughness = texture;\n }));\n }\n if (properties.clearcoatNormalTexture) {\n properties.clearcoatNormalTexture.nonColorData = true;\n promises.push(this._loader.loadTextureInfoAsync(`${context}/clearcoatNormalTexture`, properties.clearcoatNormalTexture, (texture) => {\n texture.name = `${babylonMaterial.name} (ClearCoat Normal)`;\n babylonMaterial.clearCoat.bumpTexture = texture;\n }));\n babylonMaterial.invertNormalMapX = !babylonMaterial.getScene().useRightHandedSystem;\n babylonMaterial.invertNormalMapY = babylonMaterial.getScene().useRightHandedSystem;\n if (properties.clearcoatNormalTexture.scale != undefined) {\n babylonMaterial.clearCoat.bumpTexture.level = properties.clearcoatNormalTexture.scale;\n }\n }\n return Promise.all(promises).then(() => { });\n }\n}\nGLTFLoader.RegisterExtension(NAME, (loader) => new KHR_materials_clearcoat(loader));\n//# sourceMappingURL=KHR_materials_clearcoat.js.map","import { PBRMaterial } from \"@babylonjs/core/Materials/PBR/pbrMaterial.js\";\nimport { GLTFLoader } from \"../glTFLoader.js\";\nconst NAME = \"KHR_materials_iridescence\";\n/**\n * [Specification](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_materials_iridescence/README.md)\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport class KHR_materials_iridescence {\n /**\n * @internal\n */\n constructor(loader) {\n /**\n * The name of this extension.\n */\n this.name = NAME;\n /**\n * Defines a number that determines the order the extensions are applied.\n */\n this.order = 195;\n this._loader = loader;\n this.enabled = this._loader.isExtensionUsed(NAME);\n }\n /** @internal */\n dispose() {\n this._loader = null;\n }\n /**\n * @internal\n */\n loadMaterialPropertiesAsync(context, material, babylonMaterial) {\n return GLTFLoader.LoadExtensionAsync(context, material, this.name, (extensionContext, extension) => {\n const promises = new Array();\n promises.push(this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial));\n promises.push(this._loadIridescencePropertiesAsync(extensionContext, extension, babylonMaterial));\n return Promise.all(promises).then(() => { });\n });\n }\n _loadIridescencePropertiesAsync(context, properties, babylonMaterial) {\n var _a, _b, _c, _d, _e;\n if (!(babylonMaterial instanceof PBRMaterial)) {\n throw new Error(`${context}: Material type not supported`);\n }\n const promises = new Array();\n babylonMaterial.iridescence.isEnabled = true;\n babylonMaterial.iridescence.intensity = (_a = properties.iridescenceFactor) !== null && _a !== void 0 ? _a : 0;\n babylonMaterial.iridescence.indexOfRefraction = (_c = (_b = properties.iridescenceIor) !== null && _b !== void 0 ? _b : properties.iridescenceIOR) !== null && _c !== void 0 ? _c : 1.3;\n babylonMaterial.iridescence.minimumThickness = (_d = properties.iridescenceThicknessMinimum) !== null && _d !== void 0 ? _d : 100;\n babylonMaterial.iridescence.maximumThickness = (_e = properties.iridescenceThicknessMaximum) !== null && _e !== void 0 ? _e : 400;\n if (properties.iridescenceTexture) {\n promises.push(this._loader.loadTextureInfoAsync(`${context}/iridescenceTexture`, properties.iridescenceTexture, (texture) => {\n texture.name = `${babylonMaterial.name} (Iridescence Intensity)`;\n babylonMaterial.iridescence.texture = texture;\n }));\n }\n if (properties.iridescenceThicknessTexture) {\n promises.push(this._loader.loadTextureInfoAsync(`${context}/iridescenceThicknessTexture`, properties.iridescenceThicknessTexture, (texture) => {\n texture.name = `${babylonMaterial.name} (Iridescence Thickness)`;\n babylonMaterial.iridescence.thicknessTexture = texture;\n }));\n }\n return Promise.all(promises).then(() => { });\n }\n}\nGLTFLoader.RegisterExtension(NAME, (loader) => new KHR_materials_iridescence(loader));\n//# sourceMappingURL=KHR_materials_iridescence.js.map","import { PBRMaterial } from \"@babylonjs/core/Materials/PBR/pbrMaterial.js\";\nimport { GLTFLoader } from \"../glTFLoader.js\";\nconst NAME = \"KHR_materials_anisotropy\";\n/**\n * [Specification](https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_materials_anisotropy)\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport class KHR_materials_anisotropy {\n /**\n * @internal\n */\n constructor(loader) {\n /**\n * The name of this extension.\n */\n this.name = NAME;\n /**\n * Defines a number that determines the order the extensions are applied.\n */\n this.order = 195;\n this._loader = loader;\n this.enabled = this._loader.isExtensionUsed(NAME);\n }\n /** @internal */\n dispose() {\n this._loader = null;\n }\n /**\n * @internal\n */\n loadMaterialPropertiesAsync(context, material, babylonMaterial) {\n return GLTFLoader.LoadExtensionAsync(context, material, this.name, (extensionContext, extension) => {\n const promises = new Array();\n promises.push(this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial));\n promises.push(this._loadIridescencePropertiesAsync(extensionContext, extension, babylonMaterial));\n return Promise.all(promises).then(() => { });\n });\n }\n _loadIridescencePropertiesAsync(context, properties, babylonMaterial) {\n var _a, _b;\n if (!(babylonMaterial instanceof PBRMaterial)) {\n throw new Error(`${context}: Material type not supported`);\n }\n const promises = new Array();\n babylonMaterial.anisotropy.isEnabled = true;\n babylonMaterial.anisotropy.intensity = (_a = properties.anisotropyStrength) !== null && _a !== void 0 ? _a : 0;\n babylonMaterial.anisotropy.angle = (_b = properties.anisotropyRotation) !== null && _b !== void 0 ? _b : 0;\n if (properties.anisotropyTexture) {\n promises.push(this._loader.loadTextureInfoAsync(`${context}/anisotropyTexture`, properties.anisotropyTexture, (texture) => {\n texture.name = `${babylonMaterial.name} (Anisotropy Intensity)`;\n babylonMaterial.anisotropy.texture = texture;\n }));\n }\n return Promise.all(promises).then(() => { });\n }\n}\nGLTFLoader.RegisterExtension(NAME, (loader) => new KHR_materials_anisotropy(loader));\n//# sourceMappingURL=KHR_materials_anisotropy.js.map","import { PBRMaterial } from \"@babylonjs/core/Materials/PBR/pbrMaterial.js\";\nimport { GLTFLoader } from \"../glTFLoader.js\";\nconst NAME = \"KHR_materials_emissive_strength\";\n/**\n * [Specification](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_materials_emissive_strength/README.md)\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport class KHR_materials_emissive_strength {\n /**\n * @internal\n */\n constructor(loader) {\n /**\n * The name of this extension.\n */\n this.name = NAME;\n /**\n * Defines a number that determines the order the extensions are applied.\n */\n this.order = 170;\n this._loader = loader;\n this.enabled = this._loader.isExtensionUsed(NAME);\n }\n /** @internal */\n dispose() {\n this._loader = null;\n }\n /**\n * @internal\n */\n loadMaterialPropertiesAsync(context, material, babylonMaterial) {\n return GLTFLoader.LoadExtensionAsync(context, material, this.name, (extensionContext, extension) => {\n return this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial).then(() => {\n this._loadEmissiveProperties(extensionContext, extension, babylonMaterial);\n });\n });\n }\n _loadEmissiveProperties(context, properties, babylonMaterial) {\n if (!(babylonMaterial instanceof PBRMaterial)) {\n throw new Error(`${context}: Material type not supported`);\n }\n if (properties.emissiveStrength !== undefined) {\n babylonMaterial.emissiveColor.scaleToRef(properties.emissiveStrength, babylonMaterial.emissiveColor);\n }\n }\n}\nGLTFLoader.RegisterExtension(NAME, (loader) => new KHR_materials_emissive_strength(loader));\n//# sourceMappingURL=KHR_materials_emissive_strength.js.map","import { PBRMaterial } from \"@babylonjs/core/Materials/PBR/pbrMaterial.js\";\nimport { GLTFLoader } from \"../glTFLoader.js\";\nimport { Color3 } from \"@babylonjs/core/Maths/math.color.js\";\nconst NAME = \"KHR_materials_sheen\";\n/**\n * [Specification](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_materials_sheen/README.md)\n * [Playground Sample](https://www.babylonjs-playground.com/frame.html#BNIZX6#4)\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport class KHR_materials_sheen {\n /**\n * @internal\n */\n constructor(loader) {\n /**\n * The name of this extension.\n */\n this.name = NAME;\n /**\n * Defines a number that determines the order the extensions are applied.\n */\n this.order = 190;\n this._loader = loader;\n this.enabled = this._loader.isExtensionUsed(NAME);\n }\n /** @internal */\n dispose() {\n this._loader = null;\n }\n /**\n * @internal\n */\n loadMaterialPropertiesAsync(context, material, babylonMaterial) {\n return GLTFLoader.LoadExtensionAsync(context, material, this.name, (extensionContext, extension) => {\n const promises = new Array();\n promises.push(this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial));\n promises.push(this._loadSheenPropertiesAsync(extensionContext, extension, babylonMaterial));\n return Promise.all(promises).then(() => { });\n });\n }\n _loadSheenPropertiesAsync(context, properties, babylonMaterial) {\n if (!(babylonMaterial instanceof PBRMaterial)) {\n throw new Error(`${context}: Material type not supported`);\n }\n const promises = new Array();\n babylonMaterial.sheen.isEnabled = true;\n babylonMaterial.sheen.intensity = 1;\n if (properties.sheenColorFactor != undefined) {\n babylonMaterial.sheen.color = Color3.FromArray(properties.sheenColorFactor);\n }\n else {\n babylonMaterial.sheen.color = Color3.Black();\n }\n if (properties.sheenColorTexture) {\n promises.push(this._loader.loadTextureInfoAsync(`${context}/sheenColorTexture`, properties.sheenColorTexture, (texture) => {\n texture.name = `${babylonMaterial.name} (Sheen Color)`;\n babylonMaterial.sheen.texture = texture;\n }));\n }\n if (properties.sheenRoughnessFactor !== undefined) {\n babylonMaterial.sheen.roughness = properties.sheenRoughnessFactor;\n }\n else {\n babylonMaterial.sheen.roughness = 0;\n }\n if (properties.sheenRoughnessTexture) {\n properties.sheenRoughnessTexture.nonColorData = true;\n promises.push(this._loader.loadTextureInfoAsync(`${context}/sheenRoughnessTexture`, properties.sheenRoughnessTexture, (texture) => {\n texture.name = `${babylonMaterial.name} (Sheen Roughness)`;\n babylonMaterial.sheen.textureRoughness = texture;\n }));\n }\n babylonMaterial.sheen.albedoScaling = true;\n babylonMaterial.sheen.useRoughnessFromMainTexture = false;\n return Promise.all(promises).then(() => { });\n }\n}\nGLTFLoader.RegisterExtension(NAME, (loader) => new KHR_materials_sheen(loader));\n//# sourceMappingURL=KHR_materials_sheen.js.map","import { PBRMaterial } from \"@babylonjs/core/Materials/PBR/pbrMaterial.js\";\nimport { GLTFLoader } from \"../glTFLoader.js\";\nimport { Color3 } from \"@babylonjs/core/Maths/math.color.js\";\nconst NAME = \"KHR_materials_specular\";\n/**\n * [Specification](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_materials_specular/README.md)\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport class KHR_materials_specular {\n /**\n * @internal\n */\n constructor(loader) {\n /**\n * The name of this extension.\n */\n this.name = NAME;\n /**\n * Defines a number that determines the order the extensions are applied.\n */\n this.order = 190;\n this._loader = loader;\n this.enabled = this._loader.isExtensionUsed(NAME);\n }\n /** @internal */\n dispose() {\n this._loader = null;\n }\n /**\n * @internal\n */\n loadMaterialPropertiesAsync(context, material, babylonMaterial) {\n return GLTFLoader.LoadExtensionAsync(context, material, this.name, (extensionContext, extension) => {\n const promises = new Array();\n promises.push(this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial));\n promises.push(this._loadSpecularPropertiesAsync(extensionContext, extension, babylonMaterial));\n return Promise.all(promises).then(() => { });\n });\n }\n _loadSpecularPropertiesAsync(context, properties, babylonMaterial) {\n if (!(babylonMaterial instanceof PBRMaterial)) {\n throw new Error(`${context}: Material type not supported`);\n }\n const promises = new Array();\n if (properties.specularFactor !== undefined) {\n babylonMaterial.metallicF0Factor = properties.specularFactor;\n }\n if (properties.specularColorFactor !== undefined) {\n babylonMaterial.metallicReflectanceColor = Color3.FromArray(properties.specularColorFactor);\n }\n if (properties.specularTexture) {\n properties.specularTexture.nonColorData = true;\n promises.push(this._loader.loadTextureInfoAsync(`${context}/specularTexture`, properties.specularTexture, (texture) => {\n texture.name = `${babylonMaterial.name} (Specular F0 Strength)`;\n babylonMaterial.metallicReflectanceTexture = texture;\n babylonMaterial.useOnlyMetallicFromMetallicReflectanceTexture = true;\n }));\n }\n if (properties.specularColorTexture) {\n promises.push(this._loader.loadTextureInfoAsync(`${context}/specularColorTexture`, properties.specularColorTexture, (texture) => {\n texture.name = `${babylonMaterial.name} (Specular F0 Color)`;\n babylonMaterial.reflectanceTexture = texture;\n }));\n }\n return Promise.all(promises).then(() => { });\n }\n}\nGLTFLoader.RegisterExtension(NAME, (loader) => new KHR_materials_specular(loader));\n//# sourceMappingURL=KHR_materials_specular.js.map","import { PBRMaterial } from \"@babylonjs/core/Materials/PBR/pbrMaterial.js\";\nimport { GLTFLoader } from \"../glTFLoader.js\";\nconst NAME = \"KHR_materials_ior\";\n/**\n * [Specification](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_materials_ior/README.md)\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport class KHR_materials_ior {\n /**\n * @internal\n */\n constructor(loader) {\n /**\n * The name of this extension.\n */\n this.name = NAME;\n /**\n * Defines a number that determines the order the extensions are applied.\n */\n this.order = 180;\n this._loader = loader;\n this.enabled = this._loader.isExtensionUsed(NAME);\n }\n /** @internal */\n dispose() {\n this._loader = null;\n }\n /**\n * @internal\n */\n loadMaterialPropertiesAsync(context, material, babylonMaterial) {\n return GLTFLoader.LoadExtensionAsync(context, material, this.name, (extensionContext, extension) => {\n const promises = new Array();\n promises.push(this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial));\n promises.push(this._loadIorPropertiesAsync(extensionContext, extension, babylonMaterial));\n return Promise.all(promises).then(() => { });\n });\n }\n _loadIorPropertiesAsync(context, properties, babylonMaterial) {\n if (!(babylonMaterial instanceof PBRMaterial)) {\n throw new Error(`${context}: Material type not supported`);\n }\n if (properties.ior !== undefined) {\n babylonMaterial.indexOfRefraction = properties.ior;\n }\n else {\n babylonMaterial.indexOfRefraction = KHR_materials_ior._DEFAULT_IOR;\n }\n return Promise.resolve();\n }\n}\n/**\n * Default ior Value from the spec.\n */\nKHR_materials_ior._DEFAULT_IOR = 1.5;\nGLTFLoader.RegisterExtension(NAME, (loader) => new KHR_materials_ior(loader));\n//# sourceMappingURL=KHR_materials_ior.js.map","import { GLTFLoader, ArrayItem } from \"../glTFLoader.js\";\nimport { Mesh } from \"@babylonjs/core/Meshes/mesh.js\";\nconst NAME = \"KHR_materials_variants\";\n/**\n * [Specification](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_materials_variants/README.md)\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport class KHR_materials_variants {\n /**\n * @internal\n */\n constructor(loader) {\n /**\n * The name of this extension.\n */\n this.name = NAME;\n this._loader = loader;\n this.enabled = this._loader.isExtensionUsed(NAME);\n }\n /** @internal */\n dispose() {\n this._loader = null;\n }\n /**\n * Gets the list of available variant names for this asset.\n * @param rootMesh The glTF root mesh\n * @returns the list of all the variant names for this model\n */\n static GetAvailableVariants(rootMesh) {\n const extensionMetadata = this._GetExtensionMetadata(rootMesh);\n if (!extensionMetadata) {\n return [];\n }\n return Object.keys(extensionMetadata.variants);\n }\n /**\n * Gets the list of available variant names for this asset.\n * @param rootMesh The glTF root mesh\n * @returns the list of all the variant names for this model\n */\n getAvailableVariants(rootMesh) {\n return KHR_materials_variants.GetAvailableVariants(rootMesh);\n }\n /**\n * Select a variant given a variant name or a list of variant names.\n * @param rootMesh The glTF root mesh\n * @param variantName The variant name(s) to select.\n */\n static SelectVariant(rootMesh, variantName) {\n const extensionMetadata = this._GetExtensionMetadata(rootMesh);\n if (!extensionMetadata) {\n throw new Error(`Cannot select variant on a glTF mesh that does not have the ${NAME} extension`);\n }\n const select = (variantName) => {\n const entries = extensionMetadata.variants[variantName];\n if (entries) {\n for (const entry of entries) {\n entry.mesh.material = entry.material;\n }\n }\n };\n if (variantName instanceof Array) {\n for (const name of variantName) {\n select(name);\n }\n }\n else {\n select(variantName);\n }\n extensionMetadata.lastSelected = variantName;\n }\n /**\n * Select a variant given a variant name or a list of variant names.\n * @param rootMesh The glTF root mesh\n * @param variantName The variant name(s) to select.\n */\n selectVariant(rootMesh, variantName) {\n return KHR_materials_variants.SelectVariant(rootMesh, variantName);\n }\n /**\n * Reset back to the original before selecting a variant.\n * @param rootMesh The glTF root mesh\n */\n static Reset(rootMesh) {\n const extensionMetadata = this._GetExtensionMetadata(rootMesh);\n if (!extensionMetadata) {\n throw new Error(`Cannot reset on a glTF mesh that does not have the ${NAME} extension`);\n }\n for (const entry of extensionMetadata.original) {\n entry.mesh.material = entry.material;\n }\n extensionMetadata.lastSelected = null;\n }\n /**\n * Reset back to the original before selecting a variant.\n * @param rootMesh The glTF root mesh\n */\n reset(rootMesh) {\n return KHR_materials_variants.Reset(rootMesh);\n }\n /**\n * Gets the last selected variant name(s) or null if original.\n * @param rootMesh The glTF root mesh\n * @returns The selected variant name(s).\n */\n static GetLastSelectedVariant(rootMesh) {\n const extensionMetadata = this._GetExtensionMetadata(rootMesh);\n if (!extensionMetadata) {\n throw new Error(`Cannot get the last selected variant on a glTF mesh that does not have the ${NAME} extension`);\n }\n return extensionMetadata.lastSelected;\n }\n /**\n * Gets the last selected variant name(s) or null if original.\n * @param rootMesh The glTF root mesh\n * @returns The selected variant name(s).\n */\n getLastSelectedVariant(rootMesh) {\n return KHR_materials_variants.GetLastSelectedVariant(rootMesh);\n }\n static _GetExtensionMetadata(rootMesh) {\n var _a, _b;\n return ((_b = (_a = rootMesh === null || rootMesh === void 0 ? void 0 : rootMesh._internalMetadata) === null || _a === void 0 ? void 0 : _a.gltf) === null || _b === void 0 ? void 0 : _b[NAME]) || null;\n }\n /** @internal */\n onLoading() {\n const extensions = this._loader.gltf.extensions;\n if (extensions && extensions[this.name]) {\n const extension = extensions[this.name];\n this._variants = extension.variants;\n }\n }\n /**\n * @internal\n */\n _loadMeshPrimitiveAsync(context, name, node, mesh, primitive, assign) {\n return GLTFLoader.LoadExtensionAsync(context, primitive, this.name, (extensionContext, extension) => {\n const promises = new Array();\n promises.push(this._loader._loadMeshPrimitiveAsync(context, name, node, mesh, primitive, (babylonMesh) => {\n assign(babylonMesh);\n if (babylonMesh instanceof Mesh) {\n const babylonDrawMode = GLTFLoader._GetDrawMode(context, primitive.mode);\n const root = this._loader.rootBabylonMesh;\n const metadata = root ? (root._internalMetadata = root._internalMetadata || {}) : {};\n const gltf = (metadata.gltf = metadata.gltf || {});\n const extensionMetadata = (gltf[NAME] = gltf[NAME] || { lastSelected: null, original: [], variants: {} });\n // Store the original material.\n extensionMetadata.original.push({ mesh: babylonMesh, material: babylonMesh.material });\n // For each mapping, look at the variants and make a new entry for them.\n for (let mappingIndex = 0; mappingIndex < extension.mappings.length; ++mappingIndex) {\n const mapping = extension.mappings[mappingIndex];\n const material = ArrayItem.Get(`${extensionContext}/mappings/${mappingIndex}/material`, this._loader.gltf.materials, mapping.material);\n promises.push(this._loader._loadMaterialAsync(`#/materials/${mapping.material}`, material, babylonMesh, babylonDrawMode, (babylonMaterial) => {\n for (let mappingVariantIndex = 0; mappingVariantIndex < mapping.variants.length; ++mappingVariantIndex) {\n const variantIndex = mapping.variants[mappingVariantIndex];\n const variant = ArrayItem.Get(`/extensions/${NAME}/variants/${variantIndex}`, this._variants, variantIndex);\n extensionMetadata.variants[variant.name] = extensionMetadata.variants[variant.name] || [];\n extensionMetadata.variants[variant.name].push({\n mesh: babylonMesh,\n material: babylonMaterial,\n });\n // Replace the target when original mesh is cloned\n babylonMesh.onClonedObservable.add((newOne) => {\n const newMesh = newOne;\n let metadata = null;\n let newRoot = newMesh;\n // Find root to get medata\n do {\n newRoot = newRoot.parent;\n if (!newRoot) {\n return;\n }\n metadata = KHR_materials_variants._GetExtensionMetadata(newRoot);\n } while (metadata === null);\n // Need to clone the metadata on the root (first time only)\n if (root && metadata === KHR_materials_variants._GetExtensionMetadata(root)) {\n // Copy main metadata\n newRoot._internalMetadata = {};\n for (const key in root._internalMetadata) {\n newRoot._internalMetadata[key] = root._internalMetadata[key];\n }\n // Copy the gltf metadata\n newRoot._internalMetadata.gltf = [];\n for (const key in root._internalMetadata.gltf) {\n newRoot._internalMetadata.gltf[key] = root._internalMetadata.gltf[key];\n }\n // Duplicate the extension specific metadata\n newRoot._internalMetadata.gltf[NAME] = { lastSelected: null, original: [], variants: {} };\n for (const original of metadata.original) {\n newRoot._internalMetadata.gltf[NAME].original.push({\n mesh: original.mesh,\n material: original.material,\n });\n }\n for (const key in metadata.variants) {\n if (Object.prototype.hasOwnProperty.call(metadata.variants, key)) {\n newRoot._internalMetadata.gltf[NAME].variants[key] = [];\n for (const variantEntry of metadata.variants[key]) {\n newRoot._internalMetadata.gltf[NAME].variants[key].push({\n mesh: variantEntry.mesh,\n material: variantEntry.material,\n });\n }\n }\n }\n metadata = newRoot._internalMetadata.gltf[NAME];\n }\n // Relocate\n for (const target of metadata.original) {\n if (target.mesh === babylonMesh) {\n target.mesh = newMesh;\n }\n }\n for (const target of metadata.variants[variant.name]) {\n if (target.mesh === babylonMesh) {\n target.mesh = newMesh;\n }\n }\n });\n }\n }));\n }\n }\n }));\n return Promise.all(promises).then(([babylonMesh]) => {\n return babylonMesh;\n });\n });\n }\n}\nGLTFLoader.RegisterExtension(NAME, (loader) => new KHR_materials_variants(loader));\n//# sourceMappingURL=KHR_materials_variants.js.map","import { PBRMaterial } from \"@babylonjs/core/Materials/PBR/pbrMaterial.js\";\nimport { GLTFLoader } from \"../glTFLoader.js\";\nimport { RenderTargetTexture } from \"@babylonjs/core/Materials/Textures/renderTargetTexture.js\";\nimport { Observable } from \"@babylonjs/core/Misc/observable.js\";\nimport { Constants } from \"@babylonjs/core/Engines/constants.js\";\nimport { Tools } from \"@babylonjs/core/Misc/tools.js\";\n/**\n * A class to handle setting up the rendering of opaque objects to be shown through transmissive objects.\n */\nclass TransmissionHelper {\n /**\n * Creates the default options for the helper.\n */\n static _GetDefaultOptions() {\n return {\n renderSize: 1024,\n samples: 4,\n lodGenerationScale: 1,\n lodGenerationOffset: -4,\n renderTargetTextureType: Constants.TEXTURETYPE_HALF_FLOAT,\n generateMipmaps: true,\n };\n }\n /**\n * constructor\n * @param options Defines the options we want to customize the helper\n * @param scene The scene to add the material to\n */\n constructor(options, scene) {\n this._opaqueRenderTarget = null;\n this._opaqueMeshesCache = [];\n this._transparentMeshesCache = [];\n this._materialObservers = {};\n this._options = {\n ...TransmissionHelper._GetDefaultOptions(),\n ...options,\n };\n this._scene = scene;\n this._scene._transmissionHelper = this;\n this.onErrorObservable = new Observable();\n this._scene.onDisposeObservable.addOnce(() => {\n this.dispose();\n });\n this._parseScene();\n this._setupRenderTargets();\n }\n /**\n * Updates the background according to the new options\n * @param options\n */\n updateOptions(options) {\n // First check if any options are actually being changed. If not, exit.\n const newValues = Object.keys(options).filter((key) => this._options[key] !== options[key]);\n if (!newValues.length) {\n return;\n }\n const newOptions = {\n ...this._options,\n ...options,\n };\n const oldOptions = this._options;\n this._options = newOptions;\n // If size changes, recreate everything\n if (newOptions.renderSize !== oldOptions.renderSize ||\n newOptions.renderTargetTextureType !== oldOptions.renderTargetTextureType ||\n newOptions.generateMipmaps !== oldOptions.generateMipmaps ||\n !this._opaqueRenderTarget) {\n this._setupRenderTargets();\n }\n else {\n this._opaqueRenderTarget.samples = newOptions.samples;\n this._opaqueRenderTarget.lodGenerationScale = newOptions.lodGenerationScale;\n this._opaqueRenderTarget.lodGenerationOffset = newOptions.lodGenerationOffset;\n }\n }\n /**\n * Gets the opaque render target texture or null if not available.\n */\n getOpaqueTarget() {\n return this._opaqueRenderTarget;\n }\n _shouldRenderAsTransmission(material) {\n if (!material) {\n return false;\n }\n if (material instanceof PBRMaterial && material.subSurface.isRefractionEnabled) {\n return true;\n }\n return false;\n }\n _addMesh(mesh) {\n this._materialObservers[mesh.uniqueId] = mesh.onMaterialChangedObservable.add(this._onMeshMaterialChanged.bind(this));\n // we need to defer the processing because _addMesh may be called as part as an instance mesh creation, in which case some\n // internal properties are not setup yet, like _sourceMesh (needed when doing mesh.material below)\n Tools.SetImmediate(() => {\n if (this._shouldRenderAsTransmission(mesh.material)) {\n mesh.material.refractionTexture = this._opaqueRenderTarget;\n if (this._transparentMeshesCache.indexOf(mesh) === -1) {\n this._transparentMeshesCache.push(mesh);\n }\n }\n else {\n if (this._opaqueMeshesCache.indexOf(mesh) === -1) {\n this._opaqueMeshesCache.push(mesh);\n }\n }\n });\n }\n _removeMesh(mesh) {\n mesh.onMaterialChangedObservable.remove(this._materialObservers[mesh.uniqueId]);\n delete this._materialObservers[mesh.uniqueId];\n let idx = this._transparentMeshesCache.indexOf(mesh);\n if (idx !== -1) {\n this._transparentMeshesCache.splice(idx, 1);\n }\n idx = this._opaqueMeshesCache.indexOf(mesh);\n if (idx !== -1) {\n this._opaqueMeshesCache.splice(idx, 1);\n }\n }\n _parseScene() {\n this._scene.meshes.forEach(this._addMesh.bind(this));\n // Listen for when a mesh is added to the scene and add it to our cache lists.\n this._scene.onNewMeshAddedObservable.add(this._addMesh.bind(this));\n // Listen for when a mesh is removed from to the scene and remove it from our cache lists.\n this._scene.onMeshRemovedObservable.add(this._removeMesh.bind(this));\n }\n // When one of the meshes in the scene has its material changed, make sure that it's in the correct cache list.\n _onMeshMaterialChanged(mesh) {\n const transparentIdx = this._transparentMeshesCache.indexOf(mesh);\n const opaqueIdx = this._opaqueMeshesCache.indexOf(mesh);\n // If the material is transparent, make sure that it's added to the transparent list and removed from the opaque list\n const useTransmission = this._shouldRenderAsTransmission(mesh.material);\n if (useTransmission) {\n if (mesh.material instanceof PBRMaterial) {\n mesh.material.subSurface.refractionTexture = this._opaqueRenderTarget;\n }\n if (opaqueIdx !== -1) {\n this._opaqueMeshesCache.splice(opaqueIdx, 1);\n this._transparentMeshesCache.push(mesh);\n }\n else if (transparentIdx === -1) {\n this._transparentMeshesCache.push(mesh);\n }\n // If the material is opaque, make sure that it's added to the opaque list and removed from the transparent list\n }\n else {\n if (transparentIdx !== -1) {\n this._transparentMeshesCache.splice(transparentIdx, 1);\n this._opaqueMeshesCache.push(mesh);\n }\n else if (opaqueIdx === -1) {\n this._opaqueMeshesCache.push(mesh);\n }\n }\n }\n /**\n * Setup the render targets according to the specified options.\n */\n _setupRenderTargets() {\n var _a, _b;\n if (this._opaqueRenderTarget) {\n this._opaqueRenderTarget.dispose();\n }\n this._opaqueRenderTarget = new RenderTargetTexture(\"opaqueSceneTexture\", this._options.renderSize, this._scene, this._options.generateMipmaps, undefined, this._options.renderTargetTextureType);\n this._opaqueRenderTarget.ignoreCameraViewport = true;\n this._opaqueRenderTarget.renderList = this._opaqueMeshesCache;\n this._opaqueRenderTarget.clearColor = (_b = (_a = this._options.clearColor) === null || _a === void 0 ? void 0 : _a.clone()) !== null && _b !== void 0 ? _b : this._scene.clearColor.clone();\n this._opaqueRenderTarget.gammaSpace = false;\n this._opaqueRenderTarget.lodGenerationScale = this._options.lodGenerationScale;\n this._opaqueRenderTarget.lodGenerationOffset = this._options.lodGenerationOffset;\n this._opaqueRenderTarget.samples = this._options.samples;\n let sceneImageProcessingapplyByPostProcess;\n let saveSceneEnvIntensity;\n this._opaqueRenderTarget.onBeforeBindObservable.add((opaqueRenderTarget) => {\n saveSceneEnvIntensity = this._scene.environmentIntensity;\n this._scene.environmentIntensity = 1.0;\n sceneImageProcessingapplyByPostProcess = this._scene.imageProcessingConfiguration.applyByPostProcess;\n if (!this._options.clearColor) {\n this._scene.clearColor.toLinearSpaceToRef(opaqueRenderTarget.clearColor, this._scene.getEngine().useExactSrgbConversions);\n }\n else {\n opaqueRenderTarget.clearColor.copyFrom(this._options.clearColor);\n }\n // we do not use the applyByPostProcess setter to avoid flagging all the materials as \"image processing dirty\"!\n this._scene.imageProcessingConfiguration._applyByPostProcess = true;\n });\n this._opaqueRenderTarget.onAfterUnbindObservable.add(() => {\n this._scene.environmentIntensity = saveSceneEnvIntensity;\n this._scene.imageProcessingConfiguration._applyByPostProcess = sceneImageProcessingapplyByPostProcess;\n });\n this._transparentMeshesCache.forEach((mesh) => {\n if (this._shouldRenderAsTransmission(mesh.material)) {\n mesh.material.refractionTexture = this._opaqueRenderTarget;\n }\n });\n }\n /**\n * Dispose all the elements created by the Helper.\n */\n dispose() {\n this._scene._transmissionHelper = undefined;\n if (this._opaqueRenderTarget) {\n this._opaqueRenderTarget.dispose();\n this._opaqueRenderTarget = null;\n }\n this._transparentMeshesCache = [];\n this._opaqueMeshesCache = [];\n }\n}\nconst NAME = \"KHR_materials_transmission\";\n/**\n * [Specification](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_materials_transmission/README.md)\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport class KHR_materials_transmission {\n /**\n * @internal\n */\n constructor(loader) {\n /**\n * The name of this extension.\n */\n this.name = NAME;\n /**\n * Defines a number that determines the order the extensions are applied.\n */\n this.order = 175;\n this._loader = loader;\n this.enabled = this._loader.isExtensionUsed(NAME);\n if (this.enabled) {\n loader.parent.transparencyAsCoverage = true;\n }\n }\n /** @internal */\n dispose() {\n this._loader = null;\n }\n /**\n * @internal\n */\n loadMaterialPropertiesAsync(context, material, babylonMaterial) {\n return GLTFLoader.LoadExtensionAsync(context, material, this.name, (extensionContext, extension) => {\n const promises = new Array();\n promises.push(this._loader.loadMaterialBasePropertiesAsync(context, material, babylonMaterial));\n promises.push(this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial));\n promises.push(this._loadTransparentPropertiesAsync(extensionContext, material, babylonMaterial, extension));\n return Promise.all(promises).then(() => { });\n });\n }\n _loadTransparentPropertiesAsync(context, material, babylonMaterial, extension) {\n if (!(babylonMaterial instanceof PBRMaterial)) {\n throw new Error(`${context}: Material type not supported`);\n }\n const pbrMaterial = babylonMaterial;\n // Enables \"refraction\" texture which represents transmitted light.\n pbrMaterial.subSurface.isRefractionEnabled = true;\n // Since this extension models thin-surface transmission only, we must make IOR = 1.0\n pbrMaterial.subSurface.volumeIndexOfRefraction = 1.0;\n // Albedo colour will tint transmission.\n pbrMaterial.subSurface.useAlbedoToTintRefraction = true;\n if (extension.transmissionFactor !== undefined) {\n pbrMaterial.subSurface.refractionIntensity = extension.transmissionFactor;\n const scene = pbrMaterial.getScene();\n if (pbrMaterial.subSurface.refractionIntensity && !scene._transmissionHelper) {\n new TransmissionHelper({}, pbrMaterial.getScene());\n }\n }\n else {\n pbrMaterial.subSurface.refractionIntensity = 0.0;\n pbrMaterial.subSurface.isRefractionEnabled = false;\n return Promise.resolve();\n }\n pbrMaterial.subSurface.minimumThickness = 0.0;\n pbrMaterial.subSurface.maximumThickness = 0.0;\n if (extension.transmissionTexture) {\n extension.transmissionTexture.nonColorData = true;\n return this._loader.loadTextureInfoAsync(`${context}/transmissionTexture`, extension.transmissionTexture, undefined).then((texture) => {\n pbrMaterial.subSurface.refractionIntensityTexture = texture;\n pbrMaterial.subSurface.useGltfStyleTextures = true;\n });\n }\n else {\n return Promise.resolve();\n }\n }\n}\nGLTFLoader.RegisterExtension(NAME, (loader) => new KHR_materials_transmission(loader));\n//# sourceMappingURL=KHR_materials_transmission.js.map","import { PBRMaterial } from \"@babylonjs/core/Materials/PBR/pbrMaterial.js\";\nimport { GLTFLoader } from \"../glTFLoader.js\";\nconst NAME = \"KHR_materials_translucency\";\n/**\n * [Proposed Specification](https://github.com/KhronosGroup/glTF/pull/1825)\n * !!! Experimental Extension Subject to Changes !!!\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport class KHR_materials_translucency {\n /**\n * @internal\n */\n constructor(loader) {\n /**\n * The name of this extension.\n */\n this.name = NAME;\n /**\n * Defines a number that determines the order the extensions are applied.\n */\n this.order = 174;\n this._loader = loader;\n this.enabled = this._loader.isExtensionUsed(NAME);\n if (this.enabled) {\n loader.parent.transparencyAsCoverage = true;\n }\n }\n /** @internal */\n dispose() {\n this._loader = null;\n }\n /**\n * @internal\n */\n loadMaterialPropertiesAsync(context, material, babylonMaterial) {\n return GLTFLoader.LoadExtensionAsync(context, material, this.name, (extensionContext, extension) => {\n const promises = new Array();\n promises.push(this._loader.loadMaterialBasePropertiesAsync(context, material, babylonMaterial));\n promises.push(this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial));\n promises.push(this._loadTranslucentPropertiesAsync(extensionContext, material, babylonMaterial, extension));\n return Promise.all(promises).then(() => { });\n });\n }\n _loadTranslucentPropertiesAsync(context, material, babylonMaterial, extension) {\n if (!(babylonMaterial instanceof PBRMaterial)) {\n throw new Error(`${context}: Material type not supported`);\n }\n const pbrMaterial = babylonMaterial;\n // Enables \"translucency\" texture which represents diffusely-transmitted light.\n pbrMaterial.subSurface.isTranslucencyEnabled = true;\n // Since this extension models thin-surface transmission only, we must make the\n // internal IOR == 1.0 and set the thickness to 0.\n pbrMaterial.subSurface.volumeIndexOfRefraction = 1.0;\n pbrMaterial.subSurface.minimumThickness = 0.0;\n pbrMaterial.subSurface.maximumThickness = 0.0;\n // Albedo colour will tint transmission.\n pbrMaterial.subSurface.useAlbedoToTintTranslucency = true;\n if (extension.translucencyFactor !== undefined) {\n pbrMaterial.subSurface.translucencyIntensity = extension.translucencyFactor;\n }\n else {\n pbrMaterial.subSurface.translucencyIntensity = 0.0;\n pbrMaterial.subSurface.isTranslucencyEnabled = false;\n return Promise.resolve();\n }\n if (extension.translucencyTexture) {\n extension.translucencyTexture.nonColorData = true;\n return this._loader.loadTextureInfoAsync(`${context}/translucencyTexture`, extension.translucencyTexture).then((texture) => {\n pbrMaterial.subSurface.translucencyIntensityTexture = texture;\n });\n }\n else {\n return Promise.resolve();\n }\n }\n}\nGLTFLoader.RegisterExtension(NAME, (loader) => new KHR_materials_translucency(loader));\n//# sourceMappingURL=KHR_materials_translucency.js.map","import { PBRMaterial } from \"@babylonjs/core/Materials/PBR/pbrMaterial.js\";\nimport { GLTFLoader } from \"../glTFLoader.js\";\nconst NAME = \"KHR_materials_volume\";\n/**\n * [Specification](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_materials_volume/README.md)\n * @since 5.0.0\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport class KHR_materials_volume {\n /**\n * @internal\n */\n constructor(loader) {\n /**\n * The name of this extension.\n */\n this.name = NAME;\n /**\n * Defines a number that determines the order the extensions are applied.\n */\n this.order = 173;\n this._loader = loader;\n this.enabled = this._loader.isExtensionUsed(NAME);\n if (this.enabled) {\n // We need to disable instance usage because the attenuation factor depends on the node scale of each individual mesh\n this._loader._disableInstancedMesh++;\n }\n }\n /** @internal */\n dispose() {\n if (this.enabled) {\n this._loader._disableInstancedMesh--;\n }\n this._loader = null;\n }\n /**\n * @internal\n */\n loadMaterialPropertiesAsync(context, material, babylonMaterial) {\n return GLTFLoader.LoadExtensionAsync(context, material, this.name, (extensionContext, extension) => {\n const promises = new Array();\n promises.push(this._loader.loadMaterialBasePropertiesAsync(context, material, babylonMaterial));\n promises.push(this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial));\n promises.push(this._loadVolumePropertiesAsync(extensionContext, material, babylonMaterial, extension));\n return Promise.all(promises).then(() => { });\n });\n }\n _loadVolumePropertiesAsync(context, material, babylonMaterial, extension) {\n if (!(babylonMaterial instanceof PBRMaterial)) {\n throw new Error(`${context}: Material type not supported`);\n }\n // If transparency isn't enabled already, this extension shouldn't do anything.\n // i.e. it requires either the KHR_materials_transmission or KHR_materials_translucency extensions.\n if ((!babylonMaterial.subSurface.isRefractionEnabled && !babylonMaterial.subSurface.isTranslucencyEnabled) || !extension.thicknessFactor) {\n return Promise.resolve();\n }\n // IOR in this extension only affects interior.\n babylonMaterial.subSurface.volumeIndexOfRefraction = babylonMaterial.indexOfRefraction;\n const attenuationDistance = extension.attenuationDistance !== undefined ? extension.attenuationDistance : Number.MAX_VALUE;\n babylonMaterial.subSurface.tintColorAtDistance = attenuationDistance;\n if (extension.attenuationColor !== undefined && extension.attenuationColor.length == 3) {\n babylonMaterial.subSurface.tintColor.copyFromFloats(extension.attenuationColor[0], extension.attenuationColor[1], extension.attenuationColor[2]);\n }\n babylonMaterial.subSurface.minimumThickness = 0.0;\n babylonMaterial.subSurface.maximumThickness = extension.thicknessFactor;\n babylonMaterial.subSurface.useThicknessAsDepth = true;\n if (extension.thicknessTexture) {\n extension.thicknessTexture.nonColorData = true;\n return this._loader.loadTextureInfoAsync(`${context}/thicknessTexture`, extension.thicknessTexture).then((texture) => {\n babylonMaterial.subSurface.thicknessTexture = texture;\n babylonMaterial.subSurface.useGltfStyleTextures = true;\n });\n }\n else {\n return Promise.resolve();\n }\n }\n}\nGLTFLoader.RegisterExtension(NAME, (loader) => new KHR_materials_volume(loader));\n//# sourceMappingURL=KHR_materials_volume.js.map","import { GLTFLoader } from \"../glTFLoader.js\";\nconst NAME = \"KHR_mesh_quantization\";\n/**\n * [Specification](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_mesh_quantization/README.md)\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport class KHR_mesh_quantization {\n /**\n * @internal\n */\n constructor(loader) {\n /**\n * The name of this extension.\n */\n this.name = NAME;\n this.enabled = loader.isExtensionUsed(NAME);\n }\n /** @internal */\n dispose() { }\n}\nGLTFLoader.RegisterExtension(NAME, (loader) => new KHR_mesh_quantization(loader));\n//# sourceMappingURL=KHR_mesh_quantization.js.map","import { GLTFLoader, ArrayItem } from \"../glTFLoader.js\";\nconst NAME = \"KHR_texture_basisu\";\n/**\n * [Specification](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_texture_basisu/README.md)\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport class KHR_texture_basisu {\n /**\n * @internal\n */\n constructor(loader) {\n /** The name of this extension. */\n this.name = NAME;\n this._loader = loader;\n this.enabled = loader.isExtensionUsed(NAME);\n }\n /** @internal */\n dispose() {\n this._loader = null;\n }\n /**\n * @internal\n */\n _loadTextureAsync(context, texture, assign) {\n return GLTFLoader.LoadExtensionAsync(context, texture, this.name, (extensionContext, extension) => {\n const sampler = texture.sampler == undefined ? GLTFLoader.DefaultSampler : ArrayItem.Get(`${context}/sampler`, this._loader.gltf.samplers, texture.sampler);\n const image = ArrayItem.Get(`${extensionContext}/source`, this._loader.gltf.images, extension.source);\n return this._loader._createTextureAsync(context, sampler, image, (babylonTexture) => {\n assign(babylonTexture);\n }, texture._textureInfo.nonColorData ? { useRGBAIfASTCBC7NotAvailableWhenUASTC: true } : undefined, !texture._textureInfo.nonColorData);\n });\n }\n}\nGLTFLoader.RegisterExtension(NAME, (loader) => new KHR_texture_basisu(loader));\n//# sourceMappingURL=KHR_texture_basisu.js.map","import { Texture } from \"@babylonjs/core/Materials/Textures/texture.js\";\nimport { GLTFLoader } from \"../glTFLoader.js\";\nconst NAME = \"KHR_texture_transform\";\n/**\n * [Specification](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_texture_transform/README.md)\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport class KHR_texture_transform {\n /**\n * @internal\n */\n constructor(loader) {\n /**\n * The name of this extension.\n */\n this.name = NAME;\n this._loader = loader;\n this.enabled = this._loader.isExtensionUsed(NAME);\n }\n /** @internal */\n dispose() {\n this._loader = null;\n }\n /**\n * @internal\n */\n loadTextureInfoAsync(context, textureInfo, assign) {\n return GLTFLoader.LoadExtensionAsync(context, textureInfo, this.name, (extensionContext, extension) => {\n return this._loader.loadTextureInfoAsync(context, textureInfo, (babylonTexture) => {\n if (!(babylonTexture instanceof Texture)) {\n throw new Error(`${extensionContext}: Texture type not supported`);\n }\n if (extension.offset) {\n babylonTexture.uOffset = extension.offset[0];\n babylonTexture.vOffset = extension.offset[1];\n }\n // Always rotate around the origin.\n babylonTexture.uRotationCenter = 0;\n babylonTexture.vRotationCenter = 0;\n if (extension.rotation) {\n babylonTexture.wAng = -extension.rotation;\n }\n if (extension.scale) {\n babylonTexture.uScale = extension.scale[0];\n babylonTexture.vScale = extension.scale[1];\n }\n if (extension.texCoord != undefined) {\n babylonTexture.coordinatesIndex = extension.texCoord;\n }\n assign(babylonTexture);\n });\n });\n }\n}\nGLTFLoader.RegisterExtension(NAME, (loader) => new KHR_texture_transform(loader));\n//# sourceMappingURL=KHR_texture_transform.js.map","import { GLTFLoader } from \"../glTFLoader.js\";\nconst NAME = \"KHR_xmp_json_ld\";\n/**\n * [Specification](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_xmp_json_ld/README.md)\n * @since 5.0.0\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport class KHR_xmp_json_ld {\n /**\n * @internal\n */\n constructor(loader) {\n /**\n * The name of this extension.\n */\n this.name = NAME;\n /**\n * Defines a number that determines the order the extensions are applied.\n */\n this.order = 100;\n this._loader = loader;\n this.enabled = this._loader.isExtensionUsed(NAME);\n }\n /** @internal */\n dispose() {\n this._loader = null;\n }\n /**\n * Called after the loader state changes to LOADING.\n */\n onLoading() {\n var _a, _b, _c;\n if (this._loader.rootBabylonMesh === null) {\n return;\n }\n const xmp_gltf = (_a = this._loader.gltf.extensions) === null || _a === void 0 ? void 0 : _a.KHR_xmp_json_ld;\n const xmp_node = (_c = (_b = this._loader.gltf.asset) === null || _b === void 0 ? void 0 : _b.extensions) === null || _c === void 0 ? void 0 : _c.KHR_xmp_json_ld;\n if (xmp_gltf && xmp_node) {\n const packet = +xmp_node.packet;\n if (xmp_gltf.packets && packet < xmp_gltf.packets.length) {\n this._loader.rootBabylonMesh.metadata = this._loader.rootBabylonMesh.metadata || {};\n this._loader.rootBabylonMesh.metadata.xmp = xmp_gltf.packets[packet];\n }\n }\n }\n}\nGLTFLoader.RegisterExtension(NAME, (loader) => new KHR_xmp_json_ld(loader));\n//# sourceMappingURL=KHR_xmp_json_ld.js.map","/* eslint-disable @typescript-eslint/naming-convention */\nimport { Animation } from \"@babylonjs/core/Animations/animation.js\";\nimport { AnimationPropertyInfo, nodeAnimationData } from \"../glTFLoaderAnimation.js\";\nimport { Color3 } from \"@babylonjs/core/Maths/math.color.js\";\nfunction getColor3(_target, source, offset, scale) {\n return Color3.FromArray(source, offset).scale(scale);\n}\nfunction getAlpha(_target, source, offset, scale) {\n return source[offset + 3] * scale;\n}\nfunction getFloat(_target, source, offset, scale) {\n return source[offset] * scale;\n}\nfunction getMinusFloat(_target, source, offset, scale) {\n return -source[offset] * scale;\n}\nfunction getNextFloat(_target, source, offset, scale) {\n return source[offset + 1] * scale;\n}\nfunction getFloatBy2(_target, source, offset, scale) {\n return source[offset] * scale * 2;\n}\nfunction getTextureTransformTree(textureName) {\n return {\n scale: [\n new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, `${textureName}.uScale`, getFloat, () => 2),\n new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, `${textureName}.vScale`, getNextFloat, () => 2),\n ],\n offset: [\n new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, `${textureName}.uOffset`, getFloat, () => 2),\n new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, `${textureName}.vOffset`, getNextFloat, () => 2),\n ],\n rotation: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, `${textureName}.wAng`, getMinusFloat, () => 1)],\n };\n}\nclass CameraAnimationPropertyInfo extends AnimationPropertyInfo {\n /** @internal */\n buildAnimations(target, name, fps, keys, callback) {\n callback(target._babylonCamera, this._buildAnimation(name, fps, keys));\n }\n}\nclass MaterialAnimationPropertyInfo extends AnimationPropertyInfo {\n /** @internal */\n buildAnimations(target, name, fps, keys, callback) {\n for (const fillMode in target._data) {\n callback(target._data[fillMode].babylonMaterial, this._buildAnimation(name, fps, keys));\n }\n }\n}\nclass LightAnimationPropertyInfo extends AnimationPropertyInfo {\n /** @internal */\n buildAnimations(target, name, fps, keys, callback) {\n callback(target._babylonLight, this._buildAnimation(name, fps, keys));\n }\n}\nconst nodesTree = {\n __array__: {\n __target__: true,\n ...nodeAnimationData,\n },\n};\nconst camerasTree = {\n __array__: {\n __target__: true,\n orthographic: {\n xmag: [\n new CameraAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"orthoLeft\", getMinusFloat, () => 1),\n new CameraAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"orthoRight\", getNextFloat, () => 1),\n ],\n ymag: [\n new CameraAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"orthoBottom\", getMinusFloat, () => 1),\n new CameraAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"orthoTop\", getNextFloat, () => 1),\n ],\n zfar: [new CameraAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"maxZ\", getFloat, () => 1)],\n znear: [new CameraAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"minZ\", getFloat, () => 1)],\n },\n perspective: {\n yfov: [new CameraAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"fov\", getFloat, () => 1)],\n zfar: [new CameraAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"maxZ\", getFloat, () => 1)],\n znear: [new CameraAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"minZ\", getFloat, () => 1)],\n },\n },\n};\nconst materialsTree = {\n __array__: {\n __target__: true,\n pbrMetallicRoughness: {\n baseColorFactor: [\n new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_COLOR3, \"albedoColor\", getColor3, () => 4),\n new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"alpha\", getAlpha, () => 4),\n ],\n metallicFactor: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"metallic\", getFloat, () => 1)],\n roughnessFactor: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"roughness\", getFloat, () => 1)],\n baseColorTexture: {\n extensions: {\n KHR_texture_transform: getTextureTransformTree(\"albedoTexture\"),\n },\n },\n },\n emissiveFactor: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_COLOR3, \"emissiveColor\", getColor3, () => 3)],\n normalTexture: {\n scale: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"bumpTexture.level\", getFloat, () => 1)],\n },\n occlusionTexture: {\n strength: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"ambientTextureStrength\", getFloat, () => 1)],\n extensions: {\n KHR_texture_transform: getTextureTransformTree(\"ambientTexture\"),\n },\n },\n emissiveTexture: {\n extensions: {\n KHR_texture_transform: getTextureTransformTree(\"emissiveTexture\"),\n },\n },\n extensions: {\n KHR_materials_ior: {\n ior: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"indexOfRefraction\", getFloat, () => 1)],\n },\n KHR_materials_clearcoat: {\n clearcoatFactor: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"clearCoat.intensity\", getFloat, () => 1)],\n clearcoatRoughnessFactor: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"clearCoat.roughness\", getFloat, () => 1)],\n },\n KHR_materials_sheen: {\n sheenColorFactor: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_COLOR3, \"sheen.color\", getColor3, () => 3)],\n sheenRoughnessFactor: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"sheen.roughness\", getFloat, () => 1)],\n },\n KHR_materials_specular: {\n specularFactor: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"metallicF0Factor\", getFloat, () => 1)],\n specularColorFactor: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_COLOR3, \"metallicReflectanceColor\", getColor3, () => 3)],\n },\n KHR_materials_emissive_strength: {\n emissiveStrength: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"emissiveIntensity\", getFloat, () => 1)],\n },\n KHR_materials_transmission: {\n transmissionFactor: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"subSurface.refractionIntensity\", getFloat, () => 1)],\n },\n KHR_materials_volume: {\n attenuationColor: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_COLOR3, \"subSurface.tintColor\", getColor3, () => 3)],\n attenuationDistance: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"subSurface.tintColorAtDistance\", getFloat, () => 1)],\n thicknessFactor: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"subSurface.maximumThickness\", getFloat, () => 1)],\n },\n KHR_materials_iridescence: {\n iridescenceFactor: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"iridescence.intensity\", getFloat, () => 1)],\n iridescenceIor: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"iridescence.indexOfRefraction\", getFloat, () => 1)],\n iridescenceThicknessMinimum: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"iridescence.minimumThickness\", getFloat, () => 1)],\n iridescenceThicknessMaximum: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"iridescence.maximumThickness\", getFloat, () => 1)],\n },\n KHR_materials_anisotropy: {\n anisotropyStrength: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"anisotropy.intensity\", getFloat, () => 1)],\n anisotropyRotation: [new MaterialAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"anisotropy.angle\", getFloat, () => 1)],\n },\n },\n },\n};\nconst extensionsTree = {\n KHR_lights_punctual: {\n lights: {\n __array__: {\n __target__: true,\n color: [new LightAnimationPropertyInfo(Animation.ANIMATIONTYPE_COLOR3, \"diffuse\", getColor3, () => 3)],\n intensity: [new LightAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"intensity\", getFloat, () => 1)],\n range: [new LightAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"range\", getFloat, () => 1)],\n spot: {\n innerConeAngle: [new LightAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"innerAngle\", getFloatBy2, () => 1)],\n outerConeAngle: [new LightAnimationPropertyInfo(Animation.ANIMATIONTYPE_FLOAT, \"angle\", getFloatBy2, () => 1)],\n },\n },\n },\n },\n};\n/** @internal */\nexport const animationPointerTree = {\n nodes: nodesTree,\n materials: materialsTree,\n cameras: camerasTree,\n extensions: extensionsTree,\n};\n//# sourceMappingURL=KHR_animation_pointer.data.js.map","import { GLTFLoader } from \"../glTFLoader.js\";\nimport { Logger } from \"@babylonjs/core/Misc/logger.js\";\nimport { animationPointerTree } from \"./KHR_animation_pointer.data.js\";\nconst NAME = \"KHR_animation_pointer\";\n/**\n * [Specification PR](https://github.com/KhronosGroup/glTF/pull/2147)\n * !!! Experimental Extension Subject to Changes !!!\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport class KHR_animation_pointer {\n /**\n * @internal\n */\n constructor(loader) {\n /**\n * The name of this extension.\n */\n this.name = NAME;\n this._loader = loader;\n }\n /**\n * Defines whether this extension is enabled.\n */\n get enabled() {\n return this._loader.isExtensionUsed(NAME);\n }\n /** @internal */\n dispose() {\n this._loader = null;\n }\n /**\n * Loads a glTF animation channel.\n * @param context The context when loading the asset\n * @param animationContext The context of the animation when loading the asset\n * @param animation The glTF animation property\n * @param channel The glTF animation channel property\n * @param onLoad Called for each animation loaded\n * @returns A void promise that resolves when the load is complete or null if not handled\n */\n _loadAnimationChannelAsync(context, animationContext, animation, channel, onLoad) {\n var _a;\n const extension = (_a = channel.target.extensions) === null || _a === void 0 ? void 0 : _a.KHR_animation_pointer;\n if (!extension) {\n return null;\n }\n if (channel.target.path !== \"pointer\" /* AnimationChannelTargetPath.POINTER */) {\n Logger.Warn(`${context}/target/path: Value (${channel.target.path}) must be (${\"pointer\" /* AnimationChannelTargetPath.POINTER */}) when using the ${this.name} extension`);\n }\n if (channel.target.node != undefined) {\n Logger.Warn(`${context}/target/node: Value (${channel.target.node}) must not be present when using the ${this.name} extension`);\n }\n const extensionContext = `${context}/extensions/${this.name}`;\n const pointer = extension.pointer;\n if (!pointer) {\n throw new Error(`${extensionContext}: Pointer is missing`);\n }\n const targetInfo = this._parseAnimationPointer(`${extensionContext}/pointer`, pointer);\n if (!targetInfo) {\n Logger.Warn(`${extensionContext}/pointer: Invalid pointer (${pointer}) skipped`);\n return null;\n }\n return this._loader._loadAnimationChannelFromTargetInfoAsync(context, animationContext, animation, channel, targetInfo, onLoad);\n }\n /**\n * The pointer string is represented by a [JSON pointer](https://datatracker.ietf.org/doc/html/rfc6901).\n * := ///\n * := \"nodes\" | \"materials\" | \"meshes\" | \"cameras\" | \"extensions\"\n * := | \n * := | \n * := \"extensions\"//\n * := | /\n * := W+\n * := D+\n *\n * Examples:\n * - \"/nodes/0/rotation\"\n * - \"/materials/2/emissiveFactor\"\n * - \"/materials/2/pbrMetallicRoughness/baseColorFactor\"\n * - \"/materials/2/extensions/KHR_materials_emissive_strength/emissiveStrength\"\n */\n _parseAnimationPointer(context, pointer) {\n if (!pointer.startsWith(\"/\")) {\n Logger.Warn(`${context}: Value (${pointer}) must start with a slash`);\n return null;\n }\n const parts = pointer.split(\"/\");\n // Remove the first part since it will be empty string as pointers must start with a slash.\n parts.shift();\n let node = animationPointerTree;\n let gltfCurrentNode = this._loader.gltf;\n let gltfTargetNode = undefined;\n for (const part of parts) {\n if (node.__array__) {\n node = node.__array__;\n }\n else {\n node = node[part];\n if (!node) {\n return null;\n }\n }\n gltfCurrentNode = gltfCurrentNode && gltfCurrentNode[part];\n if (node.__target__) {\n gltfTargetNode = gltfCurrentNode;\n }\n }\n if (!gltfTargetNode || !Array.isArray(node)) {\n return null;\n }\n return {\n target: gltfTargetNode,\n properties: node,\n };\n }\n}\nGLTFLoader.RegisterExtension(NAME, (loader) => new KHR_animation_pointer(loader));\n//# sourceMappingURL=KHR_animation_pointer.js.map","/**\n * Composed of a frame, and an action function\n */\nexport class AnimationEvent {\n /**\n * Initializes the animation event\n * @param frame The frame for which the event is triggered\n * @param action The event to perform when triggered\n * @param onlyOnce Specifies if the event should be triggered only once\n */\n constructor(\n /** The frame for which the event is triggered **/\n frame, \n /** The event to perform when triggered **/\n action, \n /** Specifies if the event should be triggered only once**/\n onlyOnce) {\n this.frame = frame;\n this.action = action;\n this.onlyOnce = onlyOnce;\n /**\n * Specifies if the animation event is done\n */\n this.isDone = false;\n }\n /** @internal */\n _clone() {\n return new AnimationEvent(this.frame, this.action, this.onlyOnce);\n }\n}\n//# sourceMappingURL=animationEvent.js.map","import { Tools } from \"../Misc/tools.js\";\nimport { Observable } from \"../Misc/observable.js\";\nimport { Vector3 } from \"../Maths/math.vector.js\";\nimport { Engine } from \"../Engines/engine.js\";\nimport { Logger } from \"../Misc/logger.js\";\nimport { _WarnImport } from \"../Misc/devTools.js\";\nimport { EngineStore } from \"../Engines/engineStore.js\";\n/**\n * Defines a sound that can be played in the application.\n * The sound can either be an ambient track or a simple sound played in reaction to a user action.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/audio/playingSoundsMusic\n */\nexport class Sound {\n /**\n * Does the sound loop after it finishes playing once.\n */\n get loop() {\n return this._loop;\n }\n set loop(value) {\n if (value === this._loop) {\n return;\n }\n this._loop = value;\n this.updateOptions({ loop: value });\n }\n /**\n * Gets the current time for the sound.\n */\n get currentTime() {\n var _a;\n if (this._htmlAudioElement) {\n return this._htmlAudioElement.currentTime;\n }\n if (((_a = Engine.audioEngine) === null || _a === void 0 ? void 0 : _a.audioContext) && (this.isPlaying || this.isPaused)) {\n // The `_currentTime` member is only updated when the sound is paused. Add the time since the last start\n // to get the actual current time.\n const timeSinceLastStart = this.isPaused ? 0 : Engine.audioEngine.audioContext.currentTime - this._startTime;\n return this._currentTime + timeSinceLastStart;\n }\n return 0;\n }\n /**\n * Does this sound enables spatial sound.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/audio/playingSoundsMusic#creating-a-spatial-3d-sound\n */\n get spatialSound() {\n return this._spatialSound;\n }\n /**\n * Does this sound enables spatial sound.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/audio/playingSoundsMusic#creating-a-spatial-3d-sound\n */\n set spatialSound(newValue) {\n if (newValue == this._spatialSound) {\n return;\n }\n const wasPlaying = this.isPlaying;\n this.pause();\n if (newValue) {\n this._spatialSound = newValue;\n this._updateSpatialParameters();\n }\n else {\n this._disableSpatialSound();\n }\n if (wasPlaying) {\n this.play();\n }\n }\n /**\n * Create a sound and attach it to a scene\n * @param name Name of your sound\n * @param urlOrArrayBuffer Url to the sound to load async or ArrayBuffer, it also works with MediaStreams and AudioBuffers\n * @param scene defines the scene the sound belongs to\n * @param readyToPlayCallback Provide a callback function if you'd like to load your code once the sound is ready to be played\n * @param options Objects to provide with the current available options: autoplay, loop, volume, spatialSound, maxDistance, rolloffFactor, refDistance, distanceModel, panningModel, streaming\n */\n constructor(name, urlOrArrayBuffer, scene, readyToPlayCallback = null, options) {\n var _a, _b, _c, _d, _e;\n /**\n * Does the sound autoplay once loaded.\n */\n this.autoplay = false;\n this._loop = false;\n /**\n * Does the sound use a custom attenuation curve to simulate the falloff\n * happening when the source gets further away from the camera.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/audio/playingSoundsMusic#creating-your-own-custom-attenuation-function\n */\n this.useCustomAttenuation = false;\n /**\n * Is this sound currently played.\n */\n this.isPlaying = false;\n /**\n * Is this sound currently paused.\n */\n this.isPaused = false;\n /**\n * Define the reference distance the sound should be heard perfectly.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/audio/playingSoundsMusic#creating-a-spatial-3d-sound\n */\n this.refDistance = 1;\n /**\n * Define the roll off factor of spatial sounds.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/audio/playingSoundsMusic#creating-a-spatial-3d-sound\n */\n this.rolloffFactor = 1;\n /**\n * Define the max distance the sound should be heard (intensity just became 0 at this point).\n * @see https://doc.babylonjs.com/features/featuresDeepDive/audio/playingSoundsMusic#creating-a-spatial-3d-sound\n */\n this.maxDistance = 100;\n /**\n * Define the distance attenuation model the sound will follow.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/audio/playingSoundsMusic#creating-a-spatial-3d-sound\n */\n this.distanceModel = \"linear\";\n /**\n * Gets or sets an object used to store user defined information for the sound.\n */\n this.metadata = null;\n /**\n * Observable event when the current playing sound finishes.\n */\n this.onEndedObservable = new Observable();\n this._spatialSound = false;\n this._panningModel = \"equalpower\";\n this._playbackRate = 1;\n this._streaming = false;\n this._startTime = 0;\n this._currentTime = 0;\n this._position = Vector3.Zero();\n this._localDirection = new Vector3(1, 0, 0);\n this._volume = 1;\n this._isReadyToPlay = false;\n this._isDirectional = false;\n // Used if you'd like to create a directional sound.\n // If not set, the sound will be omnidirectional\n this._coneInnerAngle = 360;\n this._coneOuterAngle = 360;\n this._coneOuterGain = 0;\n this._isOutputConnected = false;\n this._urlType = \"Unknown\";\n this.name = name;\n scene = scene || EngineStore.LastCreatedScene;\n if (!scene) {\n return;\n }\n this._scene = scene;\n Sound._SceneComponentInitialization(scene);\n this._readyToPlayCallback = readyToPlayCallback;\n // Default custom attenuation function is a linear attenuation\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n this._customAttenuationFunction = (currentVolume, currentDistance, maxDistance, refDistance, rolloffFactor) => {\n if (currentDistance < maxDistance) {\n return currentVolume * (1 - currentDistance / maxDistance);\n }\n else {\n return 0;\n }\n };\n if (options) {\n this.autoplay = options.autoplay || false;\n this._loop = options.loop || false;\n // if volume === 0, we need another way to check this option\n if (options.volume !== undefined) {\n this._volume = options.volume;\n }\n this._spatialSound = (_a = options.spatialSound) !== null && _a !== void 0 ? _a : false;\n this.maxDistance = (_b = options.maxDistance) !== null && _b !== void 0 ? _b : 100;\n this.useCustomAttenuation = (_c = options.useCustomAttenuation) !== null && _c !== void 0 ? _c : false;\n this.rolloffFactor = options.rolloffFactor || 1;\n this.refDistance = options.refDistance || 1;\n this.distanceModel = options.distanceModel || \"linear\";\n this._playbackRate = options.playbackRate || 1;\n this._streaming = (_d = options.streaming) !== null && _d !== void 0 ? _d : false;\n this._length = options.length;\n this._offset = options.offset;\n }\n if (((_e = Engine.audioEngine) === null || _e === void 0 ? void 0 : _e.canUseWebAudio) && Engine.audioEngine.audioContext) {\n this._soundGain = Engine.audioEngine.audioContext.createGain();\n this._soundGain.gain.value = this._volume;\n this._inputAudioNode = this._soundGain;\n this._outputAudioNode = this._soundGain;\n if (this._spatialSound) {\n this._createSpatialParameters();\n }\n this._scene.mainSoundTrack.addSound(this);\n let validParameter = true;\n // if no parameter is passed, you need to call setAudioBuffer yourself to prepare the sound\n if (urlOrArrayBuffer) {\n try {\n if (typeof urlOrArrayBuffer === \"string\") {\n this._urlType = \"String\";\n this._url = urlOrArrayBuffer;\n }\n else if (urlOrArrayBuffer instanceof ArrayBuffer) {\n this._urlType = \"ArrayBuffer\";\n }\n else if (urlOrArrayBuffer instanceof HTMLMediaElement) {\n this._urlType = \"MediaElement\";\n }\n else if (urlOrArrayBuffer instanceof MediaStream) {\n this._urlType = \"MediaStream\";\n }\n else if (urlOrArrayBuffer instanceof AudioBuffer) {\n this._urlType = \"AudioBuffer\";\n }\n else if (Array.isArray(urlOrArrayBuffer)) {\n this._urlType = \"Array\";\n }\n let urls = [];\n let codecSupportedFound = false;\n switch (this._urlType) {\n case \"MediaElement\":\n this._streaming = true;\n this._isReadyToPlay = true;\n this._streamingSource = Engine.audioEngine.audioContext.createMediaElementSource(urlOrArrayBuffer);\n if (this.autoplay) {\n this.play(0, this._offset, this._length);\n }\n if (this._readyToPlayCallback) {\n this._readyToPlayCallback();\n }\n break;\n case \"MediaStream\":\n this._streaming = true;\n this._isReadyToPlay = true;\n this._streamingSource = Engine.audioEngine.audioContext.createMediaStreamSource(urlOrArrayBuffer);\n if (this.autoplay) {\n this.play(0, this._offset, this._length);\n }\n if (this._readyToPlayCallback) {\n this._readyToPlayCallback();\n }\n break;\n case \"ArrayBuffer\":\n if (urlOrArrayBuffer.byteLength > 0) {\n codecSupportedFound = true;\n this._soundLoaded(urlOrArrayBuffer);\n }\n break;\n case \"AudioBuffer\":\n this._audioBufferLoaded(urlOrArrayBuffer);\n break;\n case \"String\":\n urls.push(urlOrArrayBuffer);\n // eslint-disable-next-line no-fallthrough\n case \"Array\":\n if (urls.length === 0) {\n urls = urlOrArrayBuffer;\n }\n // If we found a supported format, we load it immediately and stop the loop\n for (let i = 0; i < urls.length; i++) {\n const url = urls[i];\n codecSupportedFound =\n (options && options.skipCodecCheck) ||\n (url.indexOf(\".mp3\", url.length - 4) !== -1 && Engine.audioEngine.isMP3supported) ||\n (url.indexOf(\".ogg\", url.length - 4) !== -1 && Engine.audioEngine.isOGGsupported) ||\n url.indexOf(\".wav\", url.length - 4) !== -1 ||\n url.indexOf(\".m4a\", url.length - 4) !== -1 ||\n url.indexOf(\".mp4\", url.length - 4) !== -1 ||\n url.indexOf(\"blob:\") !== -1;\n if (codecSupportedFound) {\n // Loading sound\n if (!this._streaming) {\n this._scene._loadFile(url, (data) => {\n this._soundLoaded(data);\n }, undefined, true, true, (exception) => {\n if (exception) {\n Logger.Error(\"XHR \" + exception.status + \" error on: \" + url + \".\");\n }\n Logger.Error(\"Sound creation aborted.\");\n this._scene.mainSoundTrack.removeSound(this);\n });\n }\n // Streaming sound using HTML5 Audio tag\n else {\n this._htmlAudioElement = new Audio(url);\n this._htmlAudioElement.controls = false;\n this._htmlAudioElement.loop = this.loop;\n Tools.SetCorsBehavior(url, this._htmlAudioElement);\n this._htmlAudioElement.preload = \"auto\";\n this._htmlAudioElement.addEventListener(\"canplaythrough\", () => {\n this._isReadyToPlay = true;\n if (this.autoplay) {\n this.play(0, this._offset, this._length);\n }\n if (this._readyToPlayCallback) {\n this._readyToPlayCallback();\n }\n });\n document.body.appendChild(this._htmlAudioElement);\n this._htmlAudioElement.load();\n }\n break;\n }\n }\n break;\n default:\n validParameter = false;\n break;\n }\n if (!validParameter) {\n Logger.Error(\"Parameter must be a URL to the sound, an Array of URLs (.mp3 & .ogg) or an ArrayBuffer of the sound.\");\n }\n else {\n if (!codecSupportedFound) {\n this._isReadyToPlay = true;\n // Simulating a ready to play event to avoid breaking code path\n if (this._readyToPlayCallback) {\n setTimeout(() => {\n if (this._readyToPlayCallback) {\n this._readyToPlayCallback();\n }\n }, 1000);\n }\n }\n }\n }\n catch (ex) {\n Logger.Error(\"Unexpected error. Sound creation aborted.\");\n this._scene.mainSoundTrack.removeSound(this);\n }\n }\n }\n else {\n // Adding an empty sound to avoid breaking audio calls for non Web Audio browsers\n this._scene.mainSoundTrack.addSound(this);\n if (Engine.audioEngine && !Engine.audioEngine.WarnedWebAudioUnsupported) {\n Logger.Error(\"Web Audio is not supported by your browser.\");\n Engine.audioEngine.WarnedWebAudioUnsupported = true;\n }\n // Simulating a ready to play event to avoid breaking code for non web audio browsers\n if (this._readyToPlayCallback) {\n setTimeout(() => {\n if (this._readyToPlayCallback) {\n this._readyToPlayCallback();\n }\n }, 1000);\n }\n }\n }\n /**\n * Release the sound and its associated resources\n */\n dispose() {\n var _a;\n if ((_a = Engine.audioEngine) === null || _a === void 0 ? void 0 : _a.canUseWebAudio) {\n if (this.isPlaying) {\n this.stop();\n }\n this._isReadyToPlay = false;\n if (this.soundTrackId === -1) {\n this._scene.mainSoundTrack.removeSound(this);\n }\n else if (this._scene.soundTracks) {\n this._scene.soundTracks[this.soundTrackId].removeSound(this);\n }\n if (this._soundGain) {\n this._soundGain.disconnect();\n this._soundGain = null;\n }\n if (this._soundPanner) {\n this._soundPanner.disconnect();\n this._soundPanner = null;\n }\n if (this._soundSource) {\n this._soundSource.disconnect();\n this._soundSource = null;\n }\n this._audioBuffer = null;\n if (this._htmlAudioElement) {\n this._htmlAudioElement.pause();\n this._htmlAudioElement.src = \"\";\n document.body.removeChild(this._htmlAudioElement);\n }\n if (this._streamingSource) {\n this._streamingSource.disconnect();\n }\n if (this._connectedTransformNode && this._registerFunc) {\n this._connectedTransformNode.unregisterAfterWorldMatrixUpdate(this._registerFunc);\n this._connectedTransformNode = null;\n }\n this._clearTimeoutsAndObservers();\n }\n }\n /**\n * Gets if the sounds is ready to be played or not.\n * @returns true if ready, otherwise false\n */\n isReady() {\n return this._isReadyToPlay;\n }\n /**\n * Get the current class name.\n * @returns current class name\n */\n getClassName() {\n return \"Sound\";\n }\n _audioBufferLoaded(buffer) {\n var _a;\n if (!((_a = Engine.audioEngine) === null || _a === void 0 ? void 0 : _a.audioContext)) {\n return;\n }\n this._audioBuffer = buffer;\n this._isReadyToPlay = true;\n if (this.autoplay) {\n this.play(0, this._offset, this._length);\n }\n if (this._readyToPlayCallback) {\n this._readyToPlayCallback();\n }\n }\n _soundLoaded(audioData) {\n var _a;\n if (!((_a = Engine.audioEngine) === null || _a === void 0 ? void 0 : _a.audioContext)) {\n return;\n }\n Engine.audioEngine.audioContext.decodeAudioData(audioData, (buffer) => {\n this._audioBufferLoaded(buffer);\n }, (err) => {\n Logger.Error(\"Error while decoding audio data for: \" + this.name + \" / Error: \" + err);\n });\n }\n /**\n * Sets the data of the sound from an audiobuffer\n * @param audioBuffer The audioBuffer containing the data\n */\n setAudioBuffer(audioBuffer) {\n var _a;\n if ((_a = Engine.audioEngine) === null || _a === void 0 ? void 0 : _a.canUseWebAudio) {\n this._audioBuffer = audioBuffer;\n this._isReadyToPlay = true;\n }\n }\n /**\n * Updates the current sounds options such as maxdistance, loop...\n * @param options A JSON object containing values named as the object properties\n */\n updateOptions(options) {\n var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;\n if (options) {\n this.loop = (_a = options.loop) !== null && _a !== void 0 ? _a : this.loop;\n this.maxDistance = (_b = options.maxDistance) !== null && _b !== void 0 ? _b : this.maxDistance;\n this.useCustomAttenuation = (_c = options.useCustomAttenuation) !== null && _c !== void 0 ? _c : this.useCustomAttenuation;\n this.rolloffFactor = (_d = options.rolloffFactor) !== null && _d !== void 0 ? _d : this.rolloffFactor;\n this.refDistance = (_e = options.refDistance) !== null && _e !== void 0 ? _e : this.refDistance;\n this.distanceModel = (_f = options.distanceModel) !== null && _f !== void 0 ? _f : this.distanceModel;\n this._playbackRate = (_g = options.playbackRate) !== null && _g !== void 0 ? _g : this._playbackRate;\n this._length = (_h = options.length) !== null && _h !== void 0 ? _h : undefined;\n this.spatialSound = (_j = options.spatialSound) !== null && _j !== void 0 ? _j : this._spatialSound;\n this._setOffset((_k = options.offset) !== null && _k !== void 0 ? _k : undefined);\n this.setVolume((_l = options.volume) !== null && _l !== void 0 ? _l : this._volume);\n this._updateSpatialParameters();\n if (this.isPlaying) {\n if (this._streaming && this._htmlAudioElement) {\n this._htmlAudioElement.playbackRate = this._playbackRate;\n if (this._htmlAudioElement.loop !== this.loop) {\n this._htmlAudioElement.loop = this.loop;\n }\n }\n else {\n if (this._soundSource) {\n this._soundSource.playbackRate.value = this._playbackRate;\n if (this._soundSource.loop !== this.loop) {\n this._soundSource.loop = this.loop;\n }\n if (this._offset !== undefined && this._soundSource.loopStart !== this._offset) {\n this._soundSource.loopStart = this._offset;\n }\n if (this._length !== undefined && this._length !== this._soundSource.loopEnd) {\n this._soundSource.loopEnd = (this._offset | 0) + this._length;\n }\n }\n }\n }\n }\n }\n _createSpatialParameters() {\n var _a, _b;\n if (((_a = Engine.audioEngine) === null || _a === void 0 ? void 0 : _a.canUseWebAudio) && Engine.audioEngine.audioContext) {\n if (this._scene.headphone) {\n this._panningModel = \"HRTF\";\n }\n this._soundPanner = (_b = this._soundPanner) !== null && _b !== void 0 ? _b : Engine.audioEngine.audioContext.createPanner();\n if (this._soundPanner && this._outputAudioNode) {\n this._updateSpatialParameters();\n this._soundPanner.connect(this._outputAudioNode);\n this._inputAudioNode = this._soundPanner;\n }\n }\n }\n _disableSpatialSound() {\n var _a;\n if (!this._spatialSound) {\n return;\n }\n this._inputAudioNode = this._soundGain;\n (_a = this._soundPanner) === null || _a === void 0 ? void 0 : _a.disconnect();\n this._soundPanner = null;\n this._spatialSound = false;\n }\n _updateSpatialParameters() {\n if (!this._spatialSound) {\n return;\n }\n if (this._soundPanner) {\n if (this.useCustomAttenuation) {\n // Tricks to disable in a way embedded Web Audio attenuation\n this._soundPanner.distanceModel = \"linear\";\n this._soundPanner.maxDistance = Number.MAX_VALUE;\n this._soundPanner.refDistance = 1;\n this._soundPanner.rolloffFactor = 1;\n this._soundPanner.panningModel = this._panningModel;\n }\n else {\n this._soundPanner.distanceModel = this.distanceModel;\n this._soundPanner.maxDistance = this.maxDistance;\n this._soundPanner.refDistance = this.refDistance;\n this._soundPanner.rolloffFactor = this.rolloffFactor;\n this._soundPanner.panningModel = this._panningModel;\n }\n }\n else {\n this._createSpatialParameters();\n }\n }\n /**\n * Switch the panning model to HRTF:\n * Renders a stereo output of higher quality than equalpower — it uses a convolution with measured impulse responses from human subjects.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/audio/playingSoundsMusic#creating-a-spatial-3d-sound\n */\n switchPanningModelToHRTF() {\n this._panningModel = \"HRTF\";\n this._switchPanningModel();\n }\n /**\n * Switch the panning model to Equal Power:\n * Represents the equal-power panning algorithm, generally regarded as simple and efficient. equalpower is the default value.\n * @see https://doc.babylonjs.com/features/featuresDeepDive/audio/playingSoundsMusic#creating-a-spatial-3d-sound\n */\n switchPanningModelToEqualPower() {\n this._panningModel = \"equalpower\";\n this._switchPanningModel();\n }\n _switchPanningModel() {\n var _a;\n if (((_a = Engine.audioEngine) === null || _a === void 0 ? void 0 : _a.canUseWebAudio) && this._spatialSound && this._soundPanner) {\n this._soundPanner.panningModel = this._panningModel;\n }\n }\n /**\n * Connect this sound to a sound track audio node like gain...\n * @param soundTrackAudioNode the sound track audio node to connect to\n */\n connectToSoundTrackAudioNode(soundTrackAudioNode) {\n var _a;\n if (((_a = Engine.audioEngine) === null || _a === void 0 ? void 0 : _a.canUseWebAudio) && this._outputAudioNode) {\n if (this._isOutputConnected) {\n this._outputAudioNode.disconnect();\n }\n this._outputAudioNode.connect(soundTrackAudioNode);\n this._isOutputConnected = true;\n }\n }\n /**\n * Transform this sound into a directional source\n * @param coneInnerAngle Size of the inner cone in degree\n * @param coneOuterAngle Size of the outer cone in degree\n * @param coneOuterGain Volume of the sound outside the outer cone (between 0.0 and 1.0)\n */\n setDirectionalCone(coneInnerAngle, coneOuterAngle, coneOuterGain) {\n if (coneOuterAngle < coneInnerAngle) {\n Logger.Error(\"setDirectionalCone(): outer angle of the cone must be superior or equal to the inner angle.\");\n return;\n }\n this._coneInnerAngle = coneInnerAngle;\n this._coneOuterAngle = coneOuterAngle;\n this._coneOuterGain = coneOuterGain;\n this._isDirectional = true;\n if (this.isPlaying && this.loop) {\n this.stop();\n this.play(0, this._offset, this._length);\n }\n }\n /**\n * Gets or sets the inner angle for the directional cone.\n */\n get directionalConeInnerAngle() {\n return this._coneInnerAngle;\n }\n /**\n * Gets or sets the inner angle for the directional cone.\n */\n set directionalConeInnerAngle(value) {\n var _a;\n if (value != this._coneInnerAngle) {\n if (this._coneOuterAngle < value) {\n Logger.Error(\"directionalConeInnerAngle: outer angle of the cone must be superior or equal to the inner angle.\");\n return;\n }\n this._coneInnerAngle = value;\n if (((_a = Engine.audioEngine) === null || _a === void 0 ? void 0 : _a.canUseWebAudio) && this._spatialSound && this._soundPanner) {\n this._soundPanner.coneInnerAngle = this._coneInnerAngle;\n }\n }\n }\n /**\n * Gets or sets the outer angle for the directional cone.\n */\n get directionalConeOuterAngle() {\n return this._coneOuterAngle;\n }\n /**\n * Gets or sets the outer angle for the directional cone.\n */\n set directionalConeOuterAngle(value) {\n var _a;\n if (value != this._coneOuterAngle) {\n if (value < this._coneInnerAngle) {\n Logger.Error(\"directionalConeOuterAngle: outer angle of the cone must be superior or equal to the inner angle.\");\n return;\n }\n this._coneOuterAngle = value;\n if (((_a = Engine.audioEngine) === null || _a === void 0 ? void 0 : _a.canUseWebAudio) && this._spatialSound && this._soundPanner) {\n this._soundPanner.coneOuterAngle = this._coneOuterAngle;\n }\n }\n }\n /**\n * Sets the position of the emitter if spatial sound is enabled\n * @param newPosition Defines the new position\n */\n setPosition(newPosition) {\n var _a;\n if (newPosition.equals(this._position)) {\n return;\n }\n this._position.copyFrom(newPosition);\n if (((_a = Engine.audioEngine) === null || _a === void 0 ? void 0 : _a.canUseWebAudio) && this._spatialSound && this._soundPanner && !isNaN(this._position.x) && !isNaN(this._position.y) && !isNaN(this._position.z)) {\n this._soundPanner.positionX.value = this._position.x;\n this._soundPanner.positionY.value = this._position.y;\n this._soundPanner.positionZ.value = this._position.z;\n }\n }\n /**\n * Sets the local direction of the emitter if spatial sound is enabled\n * @param newLocalDirection Defines the new local direction\n */\n setLocalDirectionToMesh(newLocalDirection) {\n var _a;\n this._localDirection = newLocalDirection;\n if (((_a = Engine.audioEngine) === null || _a === void 0 ? void 0 : _a.canUseWebAudio) && this._connectedTransformNode && this.isPlaying) {\n this._updateDirection();\n }\n }\n _updateDirection() {\n if (!this._connectedTransformNode || !this._soundPanner) {\n return;\n }\n const mat = this._connectedTransformNode.getWorldMatrix();\n const direction = Vector3.TransformNormal(this._localDirection, mat);\n direction.normalize();\n this._soundPanner.orientationX.value = direction.x;\n this._soundPanner.orientationY.value = direction.y;\n this._soundPanner.orientationZ.value = direction.z;\n }\n /** @internal */\n updateDistanceFromListener() {\n var _a;\n if (((_a = Engine.audioEngine) === null || _a === void 0 ? void 0 : _a.canUseWebAudio) && this._connectedTransformNode && this.useCustomAttenuation && this._soundGain && this._scene.activeCamera) {\n const distance = this._scene.audioListenerPositionProvider\n ? this._connectedTransformNode.position.subtract(this._scene.audioListenerPositionProvider()).length()\n : this._connectedTransformNode.getDistanceToCamera(this._scene.activeCamera);\n this._soundGain.gain.value = this._customAttenuationFunction(this._volume, distance, this.maxDistance, this.refDistance, this.rolloffFactor);\n }\n }\n /**\n * Sets a new custom attenuation function for the sound.\n * @param callback Defines the function used for the attenuation\n * @see https://doc.babylonjs.com/features/featuresDeepDive/audio/playingSoundsMusic#creating-your-own-custom-attenuation-function\n */\n setAttenuationFunction(callback) {\n this._customAttenuationFunction = callback;\n }\n /**\n * Play the sound\n * @param time (optional) Start the sound after X seconds. Start immediately (0) by default.\n * @param offset (optional) Start the sound at a specific time in seconds\n * @param length (optional) Sound duration (in seconds)\n */\n play(time, offset, length) {\n var _a, _b, _c, _d;\n if (this._isReadyToPlay && this._scene.audioEnabled && ((_a = Engine.audioEngine) === null || _a === void 0 ? void 0 : _a.audioContext)) {\n try {\n this._clearTimeoutsAndObservers();\n let startTime = time ? ((_b = Engine.audioEngine) === null || _b === void 0 ? void 0 : _b.audioContext.currentTime) + time : (_c = Engine.audioEngine) === null || _c === void 0 ? void 0 : _c.audioContext.currentTime;\n if (!this._soundSource || !this._streamingSource) {\n if (this._spatialSound && this._soundPanner) {\n if (!isNaN(this._position.x) && !isNaN(this._position.y) && !isNaN(this._position.z)) {\n this._soundPanner.positionX.value = this._position.x;\n this._soundPanner.positionY.value = this._position.y;\n this._soundPanner.positionZ.value = this._position.z;\n }\n if (this._isDirectional) {\n this._soundPanner.coneInnerAngle = this._coneInnerAngle;\n this._soundPanner.coneOuterAngle = this._coneOuterAngle;\n this._soundPanner.coneOuterGain = this._coneOuterGain;\n if (this._connectedTransformNode) {\n this._updateDirection();\n }\n else {\n this._soundPanner.setOrientation(this._localDirection.x, this._localDirection.y, this._localDirection.z);\n }\n }\n }\n }\n if (this._streaming) {\n if (!this._streamingSource) {\n this._streamingSource = Engine.audioEngine.audioContext.createMediaElementSource(this._htmlAudioElement);\n this._htmlAudioElement.onended = () => {\n this._onended();\n };\n this._htmlAudioElement.playbackRate = this._playbackRate;\n }\n this._streamingSource.disconnect();\n if (this._inputAudioNode) {\n this._streamingSource.connect(this._inputAudioNode);\n }\n if (this._htmlAudioElement) {\n // required to manage properly the new suspended default state of Chrome\n // When the option 'streaming: true' is used, we need first to wait for\n // the audio engine to be unlocked by a user gesture before trying to play\n // an HTML Audio element\n const tryToPlay = () => {\n var _a, _b;\n if ((_a = Engine.audioEngine) === null || _a === void 0 ? void 0 : _a.unlocked) {\n const playPromise = this._htmlAudioElement.play();\n // In browsers that don’t yet support this functionality,\n // playPromise won’t be defined.\n if (playPromise !== undefined) {\n playPromise.catch(() => {\n var _a, _b;\n // Automatic playback failed.\n // Waiting for the audio engine to be unlocked by user click on unmute\n (_a = Engine.audioEngine) === null || _a === void 0 ? void 0 : _a.lock();\n if (this.loop || this.autoplay) {\n this._audioUnlockedObserver = (_b = Engine.audioEngine) === null || _b === void 0 ? void 0 : _b.onAudioUnlockedObservable.addOnce(() => {\n tryToPlay();\n });\n }\n });\n }\n }\n else {\n if (this.loop || this.autoplay) {\n this._audioUnlockedObserver = (_b = Engine.audioEngine) === null || _b === void 0 ? void 0 : _b.onAudioUnlockedObservable.addOnce(() => {\n tryToPlay();\n });\n }\n }\n };\n tryToPlay();\n }\n }\n else {\n const tryToPlay = () => {\n var _a, _b, _c, _d;\n if ((_a = Engine.audioEngine) === null || _a === void 0 ? void 0 : _a.audioContext) {\n length = length || this._length;\n if (offset !== undefined) {\n this._setOffset(offset);\n }\n if (this._soundSource) {\n const oldSource = this._soundSource;\n oldSource.onended = () => {\n oldSource.disconnect();\n };\n }\n this._soundSource = (_b = Engine.audioEngine) === null || _b === void 0 ? void 0 : _b.audioContext.createBufferSource();\n if (this._soundSource && this._inputAudioNode) {\n this._soundSource.buffer = this._audioBuffer;\n this._soundSource.connect(this._inputAudioNode);\n this._soundSource.loop = this.loop;\n if (offset !== undefined) {\n this._soundSource.loopStart = offset;\n }\n if (length !== undefined) {\n this._soundSource.loopEnd = (offset | 0) + length;\n }\n this._soundSource.playbackRate.value = this._playbackRate;\n this._soundSource.onended = () => {\n this._onended();\n };\n startTime = time ? ((_c = Engine.audioEngine) === null || _c === void 0 ? void 0 : _c.audioContext.currentTime) + time : Engine.audioEngine.audioContext.currentTime;\n const actualOffset = ((this.isPaused ? this.currentTime : 0) + ((_d = this._offset) !== null && _d !== void 0 ? _d : 0)) % this._soundSource.buffer.duration;\n this._soundSource.start(startTime, actualOffset, this.loop ? undefined : length);\n }\n }\n };\n if (((_d = Engine.audioEngine) === null || _d === void 0 ? void 0 : _d.audioContext.state) === \"suspended\") {\n // Wait a bit for FF as context seems late to be ready.\n this._tryToPlayTimeout = setTimeout(() => {\n var _a;\n if (((_a = Engine.audioEngine) === null || _a === void 0 ? void 0 : _a.audioContext.state) === \"suspended\") {\n // Automatic playback failed.\n // Waiting for the audio engine to be unlocked by user click on unmute\n Engine.audioEngine.lock();\n if (this.loop || this.autoplay) {\n this._audioUnlockedObserver = Engine.audioEngine.onAudioUnlockedObservable.addOnce(() => {\n tryToPlay();\n });\n }\n }\n else {\n tryToPlay();\n }\n }, 500);\n }\n else {\n tryToPlay();\n }\n }\n this._startTime = startTime;\n this.isPlaying = true;\n this.isPaused = false;\n }\n catch (ex) {\n Logger.Error(\"Error while trying to play audio: \" + this.name + \", \" + ex.message);\n }\n }\n }\n _onended() {\n this.isPlaying = false;\n this._startTime = 0;\n this._currentTime = 0;\n if (this.onended) {\n this.onended();\n }\n this.onEndedObservable.notifyObservers(this);\n }\n /**\n * Stop the sound\n * @param time (optional) Stop the sound after X seconds. Stop immediately (0) by default.\n */\n stop(time) {\n var _a;\n if (this.isPlaying) {\n this._clearTimeoutsAndObservers();\n if (this._streaming) {\n if (this._htmlAudioElement) {\n this._htmlAudioElement.pause();\n // Test needed for Firefox or it will generate an Invalid State Error\n if (this._htmlAudioElement.currentTime > 0) {\n this._htmlAudioElement.currentTime = 0;\n }\n }\n else {\n this._streamingSource.disconnect();\n }\n this.isPlaying = false;\n }\n else if (((_a = Engine.audioEngine) === null || _a === void 0 ? void 0 : _a.audioContext) && this._soundSource) {\n const stopTime = time ? Engine.audioEngine.audioContext.currentTime + time : undefined;\n this._soundSource.onended = () => {\n this.isPlaying = false;\n this.isPaused = false;\n this._startTime = 0;\n this._currentTime = 0;\n if (this._soundSource) {\n this._soundSource.onended = () => void 0;\n }\n this._onended();\n };\n this._soundSource.stop(stopTime);\n }\n else {\n this.isPlaying = false;\n }\n }\n else if (this.isPaused) {\n this.isPaused = false;\n this._startTime = 0;\n this._currentTime = 0;\n }\n }\n /**\n * Put the sound in pause\n */\n pause() {\n var _a;\n if (this.isPlaying) {\n this._clearTimeoutsAndObservers();\n if (this._streaming) {\n if (this._htmlAudioElement) {\n this._htmlAudioElement.pause();\n }\n else {\n this._streamingSource.disconnect();\n }\n this.isPlaying = false;\n this.isPaused = true;\n }\n else if (((_a = Engine.audioEngine) === null || _a === void 0 ? void 0 : _a.audioContext) && this._soundSource) {\n this._soundSource.onended = () => void 0;\n this._soundSource.stop();\n this.isPlaying = false;\n this.isPaused = true;\n this._currentTime += Engine.audioEngine.audioContext.currentTime - this._startTime;\n }\n }\n }\n /**\n * Sets a dedicated volume for this sounds\n * @param newVolume Define the new volume of the sound\n * @param time Define time for gradual change to new volume\n */\n setVolume(newVolume, time) {\n var _a;\n if (((_a = Engine.audioEngine) === null || _a === void 0 ? void 0 : _a.canUseWebAudio) && this._soundGain) {\n if (time && Engine.audioEngine.audioContext) {\n this._soundGain.gain.cancelScheduledValues(Engine.audioEngine.audioContext.currentTime);\n this._soundGain.gain.setValueAtTime(this._soundGain.gain.value, Engine.audioEngine.audioContext.currentTime);\n this._soundGain.gain.linearRampToValueAtTime(newVolume, Engine.audioEngine.audioContext.currentTime + time);\n }\n else {\n this._soundGain.gain.value = newVolume;\n }\n }\n this._volume = newVolume;\n }\n /**\n * Set the sound play back rate\n * @param newPlaybackRate Define the playback rate the sound should be played at\n */\n setPlaybackRate(newPlaybackRate) {\n this._playbackRate = newPlaybackRate;\n if (this.isPlaying) {\n if (this._streaming && this._htmlAudioElement) {\n this._htmlAudioElement.playbackRate = this._playbackRate;\n }\n else if (this._soundSource) {\n this._soundSource.playbackRate.value = this._playbackRate;\n }\n }\n }\n /**\n * Gets the sound play back rate.\n * @returns the play back rate of the sound\n */\n getPlaybackRate() {\n return this._playbackRate;\n }\n /**\n * Gets the volume of the sound.\n * @returns the volume of the sound\n */\n getVolume() {\n return this._volume;\n }\n /**\n * Attach the sound to a dedicated mesh\n * @param transformNode The transform node to connect the sound with\n * @see https://doc.babylonjs.com/features/featuresDeepDive/audio/playingSoundsMusic#attaching-a-sound-to-a-mesh\n */\n attachToMesh(transformNode) {\n if (this._connectedTransformNode && this._registerFunc) {\n this._connectedTransformNode.unregisterAfterWorldMatrixUpdate(this._registerFunc);\n this._registerFunc = null;\n }\n this._connectedTransformNode = transformNode;\n if (!this._spatialSound) {\n this._spatialSound = true;\n this._createSpatialParameters();\n if (this.isPlaying && this.loop) {\n this.stop();\n this.play(0, this._offset, this._length);\n }\n }\n this._onRegisterAfterWorldMatrixUpdate(this._connectedTransformNode);\n this._registerFunc = (transformNode) => this._onRegisterAfterWorldMatrixUpdate(transformNode);\n this._connectedTransformNode.registerAfterWorldMatrixUpdate(this._registerFunc);\n }\n /**\n * Detach the sound from the previously attached mesh\n * @see https://doc.babylonjs.com/features/featuresDeepDive/audio/playingSoundsMusic#attaching-a-sound-to-a-mesh\n */\n detachFromMesh() {\n if (this._connectedTransformNode && this._registerFunc) {\n this._connectedTransformNode.unregisterAfterWorldMatrixUpdate(this._registerFunc);\n this._registerFunc = null;\n this._connectedTransformNode = null;\n }\n }\n _onRegisterAfterWorldMatrixUpdate(node) {\n var _a;\n if (!node.getBoundingInfo) {\n this.setPosition(node.absolutePosition);\n }\n else {\n const mesh = node;\n const boundingInfo = mesh.getBoundingInfo();\n this.setPosition(boundingInfo.boundingSphere.centerWorld);\n }\n if (((_a = Engine.audioEngine) === null || _a === void 0 ? void 0 : _a.canUseWebAudio) && this._isDirectional && this.isPlaying) {\n this._updateDirection();\n }\n }\n /**\n * Clone the current sound in the scene.\n * @returns the new sound clone\n */\n clone() {\n if (!this._streaming) {\n const setBufferAndRun = () => {\n if (this._isReadyToPlay) {\n clonedSound._audioBuffer = this.getAudioBuffer();\n clonedSound._isReadyToPlay = true;\n if (clonedSound.autoplay) {\n clonedSound.play(0, this._offset, this._length);\n }\n }\n else {\n setTimeout(setBufferAndRun, 300);\n }\n };\n const currentOptions = {\n autoplay: this.autoplay,\n loop: this.loop,\n volume: this._volume,\n spatialSound: this._spatialSound,\n maxDistance: this.maxDistance,\n useCustomAttenuation: this.useCustomAttenuation,\n rolloffFactor: this.rolloffFactor,\n refDistance: this.refDistance,\n distanceModel: this.distanceModel,\n };\n const clonedSound = new Sound(this.name + \"_cloned\", new ArrayBuffer(0), this._scene, null, currentOptions);\n if (this.useCustomAttenuation) {\n clonedSound.setAttenuationFunction(this._customAttenuationFunction);\n }\n clonedSound.setPosition(this._position);\n clonedSound.setPlaybackRate(this._playbackRate);\n setBufferAndRun();\n return clonedSound;\n }\n // Can't clone a streaming sound\n else {\n return null;\n }\n }\n /**\n * Gets the current underlying audio buffer containing the data\n * @returns the audio buffer\n */\n getAudioBuffer() {\n return this._audioBuffer;\n }\n /**\n * Gets the WebAudio AudioBufferSourceNode, lets you keep track of and stop instances of this Sound.\n * @returns the source node\n */\n getSoundSource() {\n return this._soundSource;\n }\n /**\n * Gets the WebAudio GainNode, gives you precise control over the gain of instances of this Sound.\n * @returns the gain node\n */\n getSoundGain() {\n return this._soundGain;\n }\n /**\n * Serializes the Sound in a JSON representation\n * @returns the JSON representation of the sound\n */\n serialize() {\n const serializationObject = {\n name: this.name,\n url: this._url,\n autoplay: this.autoplay,\n loop: this.loop,\n volume: this._volume,\n spatialSound: this._spatialSound,\n maxDistance: this.maxDistance,\n rolloffFactor: this.rolloffFactor,\n refDistance: this.refDistance,\n distanceModel: this.distanceModel,\n playbackRate: this._playbackRate,\n panningModel: this._panningModel,\n soundTrackId: this.soundTrackId,\n metadata: this.metadata,\n };\n if (this._spatialSound) {\n if (this._connectedTransformNode) {\n serializationObject.connectedMeshId = this._connectedTransformNode.id;\n }\n serializationObject.position = this._position.asArray();\n serializationObject.refDistance = this.refDistance;\n serializationObject.distanceModel = this.distanceModel;\n serializationObject.isDirectional = this._isDirectional;\n serializationObject.localDirectionToMesh = this._localDirection.asArray();\n serializationObject.coneInnerAngle = this._coneInnerAngle;\n serializationObject.coneOuterAngle = this._coneOuterAngle;\n serializationObject.coneOuterGain = this._coneOuterGain;\n }\n return serializationObject;\n }\n /**\n * Parse a JSON representation of a sound to instantiate in a given scene\n * @param parsedSound Define the JSON representation of the sound (usually coming from the serialize method)\n * @param scene Define the scene the new parsed sound should be created in\n * @param rootUrl Define the rooturl of the load in case we need to fetch relative dependencies\n * @param sourceSound Define a sound place holder if do not need to instantiate a new one\n * @returns the newly parsed sound\n */\n static Parse(parsedSound, scene, rootUrl, sourceSound) {\n const soundName = parsedSound.name;\n let soundUrl;\n if (parsedSound.url) {\n soundUrl = rootUrl + parsedSound.url;\n }\n else {\n soundUrl = rootUrl + soundName;\n }\n const options = {\n autoplay: parsedSound.autoplay,\n loop: parsedSound.loop,\n volume: parsedSound.volume,\n spatialSound: parsedSound.spatialSound,\n maxDistance: parsedSound.maxDistance,\n rolloffFactor: parsedSound.rolloffFactor,\n refDistance: parsedSound.refDistance,\n distanceModel: parsedSound.distanceModel,\n playbackRate: parsedSound.playbackRate,\n };\n let newSound;\n if (!sourceSound) {\n newSound = new Sound(soundName, soundUrl, scene, () => {\n scene.removePendingData(newSound);\n }, options);\n scene.addPendingData(newSound);\n }\n else {\n const setBufferAndRun = () => {\n if (sourceSound._isReadyToPlay) {\n newSound._audioBuffer = sourceSound.getAudioBuffer();\n newSound._isReadyToPlay = true;\n if (newSound.autoplay) {\n newSound.play(0, newSound._offset, newSound._length);\n }\n }\n else {\n setTimeout(setBufferAndRun, 300);\n }\n };\n newSound = new Sound(soundName, new ArrayBuffer(0), scene, null, options);\n setBufferAndRun();\n }\n if (parsedSound.position) {\n const soundPosition = Vector3.FromArray(parsedSound.position);\n newSound.setPosition(soundPosition);\n }\n if (parsedSound.isDirectional) {\n newSound.setDirectionalCone(parsedSound.coneInnerAngle || 360, parsedSound.coneOuterAngle || 360, parsedSound.coneOuterGain || 0);\n if (parsedSound.localDirectionToMesh) {\n const localDirectionToMesh = Vector3.FromArray(parsedSound.localDirectionToMesh);\n newSound.setLocalDirectionToMesh(localDirectionToMesh);\n }\n }\n if (parsedSound.connectedMeshId) {\n const connectedMesh = scene.getMeshById(parsedSound.connectedMeshId);\n if (connectedMesh) {\n newSound.attachToMesh(connectedMesh);\n }\n }\n if (parsedSound.metadata) {\n newSound.metadata = parsedSound.metadata;\n }\n return newSound;\n }\n _setOffset(value) {\n if (this._offset === value) {\n return;\n }\n if (this.isPaused) {\n this.stop();\n this.isPaused = false;\n }\n this._offset = value;\n }\n _clearTimeoutsAndObservers() {\n var _a;\n if (this._tryToPlayTimeout) {\n clearTimeout(this._tryToPlayTimeout);\n this._tryToPlayTimeout = null;\n }\n if (this._audioUnlockedObserver) {\n (_a = Engine.audioEngine) === null || _a === void 0 ? void 0 : _a.onAudioUnlockedObservable.remove(this._audioUnlockedObserver);\n this._audioUnlockedObserver = null;\n }\n }\n}\n/**\n * @internal\n */\nSound._SceneComponentInitialization = (_) => {\n throw _WarnImport(\"AudioSceneComponent\");\n};\n//# sourceMappingURL=sound.js.map","import { Logger } from \"../Misc/logger.js\";\n/**\n * Wraps one or more Sound objects and selects one with random weight for playback.\n */\nexport class WeightedSound {\n /**\n * Creates a new WeightedSound from the list of sounds given.\n * @param loop When true a Sound will be selected and played when the current playing Sound completes.\n * @param sounds Array of Sounds that will be selected from.\n * @param weights Array of number values for selection weights; length must equal sounds, values will be normalized to 1\n */\n constructor(loop, sounds, weights) {\n /** When true a Sound will be selected and played when the current playing Sound completes. */\n this.loop = false;\n this._coneInnerAngle = 360;\n this._coneOuterAngle = 360;\n this._volume = 1;\n /** A Sound is currently playing. */\n this.isPlaying = false;\n /** A Sound is currently paused. */\n this.isPaused = false;\n this._sounds = [];\n this._weights = [];\n if (sounds.length !== weights.length) {\n throw new Error(\"Sounds length does not equal weights length\");\n }\n this.loop = loop;\n this._weights = weights;\n // Normalize the weights\n let weightSum = 0;\n for (const weight of weights) {\n weightSum += weight;\n }\n const invWeightSum = weightSum > 0 ? 1 / weightSum : 0;\n for (let i = 0; i < this._weights.length; i++) {\n this._weights[i] *= invWeightSum;\n }\n this._sounds = sounds;\n for (const sound of this._sounds) {\n sound.onEndedObservable.add(() => {\n this._onended();\n });\n }\n }\n /**\n * The size of cone in degrees for a directional sound in which there will be no attenuation.\n */\n get directionalConeInnerAngle() {\n return this._coneInnerAngle;\n }\n /**\n * The size of cone in degrees for a directional sound in which there will be no attenuation.\n */\n set directionalConeInnerAngle(value) {\n if (value !== this._coneInnerAngle) {\n if (this._coneOuterAngle < value) {\n Logger.Error(\"directionalConeInnerAngle: outer angle of the cone must be superior or equal to the inner angle.\");\n return;\n }\n this._coneInnerAngle = value;\n for (const sound of this._sounds) {\n sound.directionalConeInnerAngle = value;\n }\n }\n }\n /**\n * Size of cone in degrees for a directional sound outside of which there will be no sound.\n * Listener angles between innerAngle and outerAngle will falloff linearly.\n */\n get directionalConeOuterAngle() {\n return this._coneOuterAngle;\n }\n /**\n * Size of cone in degrees for a directional sound outside of which there will be no sound.\n * Listener angles between innerAngle and outerAngle will falloff linearly.\n */\n set directionalConeOuterAngle(value) {\n if (value !== this._coneOuterAngle) {\n if (value < this._coneInnerAngle) {\n Logger.Error(\"directionalConeOuterAngle: outer angle of the cone must be superior or equal to the inner angle.\");\n return;\n }\n this._coneOuterAngle = value;\n for (const sound of this._sounds) {\n sound.directionalConeOuterAngle = value;\n }\n }\n }\n /**\n * Playback volume.\n */\n get volume() {\n return this._volume;\n }\n /**\n * Playback volume.\n */\n set volume(value) {\n if (value !== this._volume) {\n for (const sound of this._sounds) {\n sound.setVolume(value);\n }\n }\n }\n _onended() {\n if (this._currentIndex !== undefined) {\n this._sounds[this._currentIndex].autoplay = false;\n }\n if (this.loop && this.isPlaying) {\n this.play();\n }\n else {\n this.isPlaying = false;\n }\n }\n /**\n * Suspend playback\n */\n pause() {\n this.isPaused = true;\n if (this._currentIndex !== undefined) {\n this._sounds[this._currentIndex].pause();\n }\n }\n /**\n * Stop playback\n */\n stop() {\n this.isPlaying = false;\n if (this._currentIndex !== undefined) {\n this._sounds[this._currentIndex].stop();\n }\n }\n /**\n * Start playback.\n * @param startOffset Position the clip head at a specific time in seconds.\n */\n play(startOffset) {\n if (!this.isPaused) {\n this.stop();\n const randomValue = Math.random();\n let total = 0;\n for (let i = 0; i < this._weights.length; i++) {\n total += this._weights[i];\n if (randomValue <= total) {\n this._currentIndex = i;\n break;\n }\n }\n }\n const sound = this._sounds[this._currentIndex];\n if (sound.isReady()) {\n sound.play(0, this.isPaused ? undefined : startOffset);\n }\n else {\n sound.autoplay = true;\n }\n this.isPlaying = true;\n this.isPaused = false;\n }\n}\n//# sourceMappingURL=weightedsound.js.map","import { Vector3 } from \"@babylonjs/core/Maths/math.vector.js\";\nimport { Tools } from \"@babylonjs/core/Misc/tools.js\";\nimport { AnimationEvent } from \"@babylonjs/core/Animations/animationEvent.js\";\nimport { Sound } from \"@babylonjs/core/Audio/sound.js\";\nimport { WeightedSound } from \"@babylonjs/core/Audio/weightedsound.js\";\nimport { GLTFLoader, ArrayItem } from \"../glTFLoader.js\";\nconst NAME = \"MSFT_audio_emitter\";\n/**\n * [Specification](https://github.com/najadojo/glTF/blob/MSFT_audio_emitter/extensions/2.0/Vendor/MSFT_audio_emitter/README.md)\n * !!! Experimental Extension Subject to Changes !!!\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport class MSFT_audio_emitter {\n /**\n * @internal\n */\n constructor(loader) {\n /**\n * The name of this extension.\n */\n this.name = NAME;\n this._loader = loader;\n this.enabled = this._loader.isExtensionUsed(NAME);\n }\n /** @internal */\n dispose() {\n this._loader = null;\n this._clips = null;\n this._emitters = null;\n }\n /** @internal */\n onLoading() {\n const extensions = this._loader.gltf.extensions;\n if (extensions && extensions[this.name]) {\n const extension = extensions[this.name];\n this._clips = extension.clips;\n this._emitters = extension.emitters;\n ArrayItem.Assign(this._clips);\n ArrayItem.Assign(this._emitters);\n }\n }\n /**\n * @internal\n */\n loadSceneAsync(context, scene) {\n return GLTFLoader.LoadExtensionAsync(context, scene, this.name, (extensionContext, extension) => {\n const promises = new Array();\n promises.push(this._loader.loadSceneAsync(context, scene));\n for (const emitterIndex of extension.emitters) {\n const emitter = ArrayItem.Get(`${extensionContext}/emitters`, this._emitters, emitterIndex);\n if (emitter.refDistance != undefined ||\n emitter.maxDistance != undefined ||\n emitter.rolloffFactor != undefined ||\n emitter.distanceModel != undefined ||\n emitter.innerAngle != undefined ||\n emitter.outerAngle != undefined) {\n throw new Error(`${extensionContext}: Direction or Distance properties are not allowed on emitters attached to a scene`);\n }\n promises.push(this._loadEmitterAsync(`${extensionContext}/emitters/${emitter.index}`, emitter));\n }\n return Promise.all(promises).then(() => { });\n });\n }\n /**\n * @internal\n */\n loadNodeAsync(context, node, assign) {\n return GLTFLoader.LoadExtensionAsync(context, node, this.name, (extensionContext, extension) => {\n const promises = new Array();\n return this._loader\n .loadNodeAsync(extensionContext, node, (babylonMesh) => {\n for (const emitterIndex of extension.emitters) {\n const emitter = ArrayItem.Get(`${extensionContext}/emitters`, this._emitters, emitterIndex);\n promises.push(this._loadEmitterAsync(`${extensionContext}/emitters/${emitter.index}`, emitter).then(() => {\n for (const sound of emitter._babylonSounds) {\n sound.attachToMesh(babylonMesh);\n if (emitter.innerAngle != undefined || emitter.outerAngle != undefined) {\n sound.setLocalDirectionToMesh(Vector3.Forward());\n sound.setDirectionalCone(2 * Tools.ToDegrees(emitter.innerAngle == undefined ? Math.PI : emitter.innerAngle), 2 * Tools.ToDegrees(emitter.outerAngle == undefined ? Math.PI : emitter.outerAngle), 0);\n }\n }\n }));\n }\n assign(babylonMesh);\n })\n .then((babylonMesh) => {\n return Promise.all(promises).then(() => {\n return babylonMesh;\n });\n });\n });\n }\n /**\n * @internal\n */\n loadAnimationAsync(context, animation) {\n return GLTFLoader.LoadExtensionAsync(context, animation, this.name, (extensionContext, extension) => {\n return this._loader.loadAnimationAsync(context, animation).then((babylonAnimationGroup) => {\n const promises = new Array();\n ArrayItem.Assign(extension.events);\n for (const event of extension.events) {\n promises.push(this._loadAnimationEventAsync(`${extensionContext}/events/${event.index}`, context, animation, event, babylonAnimationGroup));\n }\n return Promise.all(promises).then(() => {\n return babylonAnimationGroup;\n });\n });\n });\n }\n _loadClipAsync(context, clip) {\n if (clip._objectURL) {\n return clip._objectURL;\n }\n let promise;\n if (clip.uri) {\n promise = this._loader.loadUriAsync(context, clip, clip.uri);\n }\n else {\n const bufferView = ArrayItem.Get(`${context}/bufferView`, this._loader.gltf.bufferViews, clip.bufferView);\n promise = this._loader.loadBufferViewAsync(`/bufferViews/${bufferView.index}`, bufferView);\n }\n clip._objectURL = promise.then((data) => {\n return URL.createObjectURL(new Blob([data], { type: clip.mimeType }));\n });\n return clip._objectURL;\n }\n _loadEmitterAsync(context, emitter) {\n emitter._babylonSounds = emitter._babylonSounds || [];\n if (!emitter._babylonData) {\n const clipPromises = new Array();\n const name = emitter.name || `emitter${emitter.index}`;\n const options = {\n loop: false,\n autoplay: false,\n volume: emitter.volume == undefined ? 1 : emitter.volume,\n };\n for (let i = 0; i < emitter.clips.length; i++) {\n const clipContext = `/extensions/${this.name}/clips`;\n const clip = ArrayItem.Get(clipContext, this._clips, emitter.clips[i].clip);\n clipPromises.push(this._loadClipAsync(`${clipContext}/${emitter.clips[i].clip}`, clip).then((objectURL) => {\n const sound = (emitter._babylonSounds[i] = new Sound(name, objectURL, this._loader.babylonScene, null, options));\n sound.refDistance = emitter.refDistance || 1;\n sound.maxDistance = emitter.maxDistance || 256;\n sound.rolloffFactor = emitter.rolloffFactor || 1;\n sound.distanceModel = emitter.distanceModel || \"exponential\";\n }));\n }\n const promise = Promise.all(clipPromises).then(() => {\n const weights = emitter.clips.map((clip) => {\n return clip.weight || 1;\n });\n const weightedSound = new WeightedSound(emitter.loop || false, emitter._babylonSounds, weights);\n if (emitter.innerAngle) {\n weightedSound.directionalConeInnerAngle = 2 * Tools.ToDegrees(emitter.innerAngle);\n }\n if (emitter.outerAngle) {\n weightedSound.directionalConeOuterAngle = 2 * Tools.ToDegrees(emitter.outerAngle);\n }\n if (emitter.volume) {\n weightedSound.volume = emitter.volume;\n }\n emitter._babylonData.sound = weightedSound;\n });\n emitter._babylonData = {\n loaded: promise,\n };\n }\n return emitter._babylonData.loaded;\n }\n _getEventAction(context, sound, action, time, startOffset) {\n switch (action) {\n case \"play\" /* IMSFTAudioEmitter_AnimationEventAction.play */: {\n return (currentFrame) => {\n const frameOffset = (startOffset || 0) + (currentFrame - time);\n sound.play(frameOffset);\n };\n }\n case \"stop\" /* IMSFTAudioEmitter_AnimationEventAction.stop */: {\n return () => {\n sound.stop();\n };\n }\n case \"pause\" /* IMSFTAudioEmitter_AnimationEventAction.pause */: {\n return () => {\n sound.pause();\n };\n }\n default: {\n throw new Error(`${context}: Unsupported action ${action}`);\n }\n }\n }\n _loadAnimationEventAsync(context, animationContext, animation, event, babylonAnimationGroup) {\n if (babylonAnimationGroup.targetedAnimations.length == 0) {\n return Promise.resolve();\n }\n const babylonAnimation = babylonAnimationGroup.targetedAnimations[0];\n const emitterIndex = event.emitter;\n const emitter = ArrayItem.Get(`/extensions/${this.name}/emitters`, this._emitters, emitterIndex);\n return this._loadEmitterAsync(context, emitter).then(() => {\n const sound = emitter._babylonData.sound;\n if (sound) {\n const babylonAnimationEvent = new AnimationEvent(event.time, this._getEventAction(context, sound, event.action, event.time, event.startOffset));\n babylonAnimation.animation.addEvent(babylonAnimationEvent);\n // Make sure all started audio stops when this animation is terminated.\n babylonAnimationGroup.onAnimationGroupEndObservable.add(() => {\n sound.stop();\n });\n babylonAnimationGroup.onAnimationGroupPauseObservable.add(() => {\n sound.pause();\n });\n }\n });\n }\n}\nGLTFLoader.RegisterExtension(NAME, (loader) => new MSFT_audio_emitter(loader));\n//# sourceMappingURL=MSFT_audio_emitter.js.map","import { Observable } from \"@babylonjs/core/Misc/observable.js\";\nimport { Deferred } from \"@babylonjs/core/Misc/deferred.js\";\nimport { GLTFLoader, ArrayItem } from \"../glTFLoader.js\";\nconst NAME = \"MSFT_lod\";\n/**\n * [Specification](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Vendor/MSFT_lod/README.md)\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport class MSFT_lod {\n /**\n * @internal\n */\n constructor(loader) {\n /**\n * The name of this extension.\n */\n this.name = NAME;\n /**\n * Defines a number that determines the order the extensions are applied.\n */\n this.order = 100;\n /**\n * Maximum number of LODs to load, starting from the lowest LOD.\n */\n this.maxLODsToLoad = 10;\n /**\n * Observable raised when all node LODs of one level are loaded.\n * The event data is the index of the loaded LOD starting from zero.\n * Dispose the loader to cancel the loading of the next level of LODs.\n */\n this.onNodeLODsLoadedObservable = new Observable();\n /**\n * Observable raised when all material LODs of one level are loaded.\n * The event data is the index of the loaded LOD starting from zero.\n * Dispose the loader to cancel the loading of the next level of LODs.\n */\n this.onMaterialLODsLoadedObservable = new Observable();\n this._bufferLODs = new Array();\n this._nodeIndexLOD = null;\n this._nodeSignalLODs = new Array();\n this._nodePromiseLODs = new Array();\n this._nodeBufferLODs = new Array();\n this._materialIndexLOD = null;\n this._materialSignalLODs = new Array();\n this._materialPromiseLODs = new Array();\n this._materialBufferLODs = new Array();\n this._loader = loader;\n this.enabled = this._loader.isExtensionUsed(NAME);\n }\n /** @internal */\n dispose() {\n this._loader = null;\n this._nodeIndexLOD = null;\n this._nodeSignalLODs.length = 0;\n this._nodePromiseLODs.length = 0;\n this._nodeBufferLODs.length = 0;\n this._materialIndexLOD = null;\n this._materialSignalLODs.length = 0;\n this._materialPromiseLODs.length = 0;\n this._materialBufferLODs.length = 0;\n this.onMaterialLODsLoadedObservable.clear();\n this.onNodeLODsLoadedObservable.clear();\n }\n /** @internal */\n onReady() {\n for (let indexLOD = 0; indexLOD < this._nodePromiseLODs.length; indexLOD++) {\n const promise = Promise.all(this._nodePromiseLODs[indexLOD]).then(() => {\n if (indexLOD !== 0) {\n this._loader.endPerformanceCounter(`Node LOD ${indexLOD}`);\n this._loader.log(`Loaded node LOD ${indexLOD}`);\n }\n this.onNodeLODsLoadedObservable.notifyObservers(indexLOD);\n if (indexLOD !== this._nodePromiseLODs.length - 1) {\n this._loader.startPerformanceCounter(`Node LOD ${indexLOD + 1}`);\n this._loadBufferLOD(this._nodeBufferLODs, indexLOD + 1);\n if (this._nodeSignalLODs[indexLOD]) {\n this._nodeSignalLODs[indexLOD].resolve();\n }\n }\n });\n this._loader._completePromises.push(promise);\n }\n for (let indexLOD = 0; indexLOD < this._materialPromiseLODs.length; indexLOD++) {\n const promise = Promise.all(this._materialPromiseLODs[indexLOD]).then(() => {\n if (indexLOD !== 0) {\n this._loader.endPerformanceCounter(`Material LOD ${indexLOD}`);\n this._loader.log(`Loaded material LOD ${indexLOD}`);\n }\n this.onMaterialLODsLoadedObservable.notifyObservers(indexLOD);\n if (indexLOD !== this._materialPromiseLODs.length - 1) {\n this._loader.startPerformanceCounter(`Material LOD ${indexLOD + 1}`);\n this._loadBufferLOD(this._materialBufferLODs, indexLOD + 1);\n if (this._materialSignalLODs[indexLOD]) {\n this._materialSignalLODs[indexLOD].resolve();\n }\n }\n });\n this._loader._completePromises.push(promise);\n }\n }\n /**\n * @internal\n */\n loadSceneAsync(context, scene) {\n const promise = this._loader.loadSceneAsync(context, scene);\n this._loadBufferLOD(this._bufferLODs, 0);\n return promise;\n }\n /**\n * @internal\n */\n loadNodeAsync(context, node, assign) {\n return GLTFLoader.LoadExtensionAsync(context, node, this.name, (extensionContext, extension) => {\n let firstPromise;\n const nodeLODs = this._getLODs(extensionContext, node, this._loader.gltf.nodes, extension.ids);\n this._loader.logOpen(`${extensionContext}`);\n for (let indexLOD = 0; indexLOD < nodeLODs.length; indexLOD++) {\n const nodeLOD = nodeLODs[indexLOD];\n if (indexLOD !== 0) {\n this._nodeIndexLOD = indexLOD;\n this._nodeSignalLODs[indexLOD] = this._nodeSignalLODs[indexLOD] || new Deferred();\n }\n const assignWrap = (babylonTransformNode) => {\n assign(babylonTransformNode);\n babylonTransformNode.setEnabled(false);\n };\n const promise = this._loader.loadNodeAsync(`/nodes/${nodeLOD.index}`, nodeLOD, assignWrap).then((babylonMesh) => {\n if (indexLOD !== 0) {\n // TODO: should not rely on _babylonTransformNode\n const previousNodeLOD = nodeLODs[indexLOD - 1];\n if (previousNodeLOD._babylonTransformNode) {\n this._disposeTransformNode(previousNodeLOD._babylonTransformNode);\n delete previousNodeLOD._babylonTransformNode;\n }\n }\n babylonMesh.setEnabled(true);\n return babylonMesh;\n });\n this._nodePromiseLODs[indexLOD] = this._nodePromiseLODs[indexLOD] || [];\n if (indexLOD === 0) {\n firstPromise = promise;\n }\n else {\n this._nodeIndexLOD = null;\n this._nodePromiseLODs[indexLOD].push(promise);\n }\n }\n this._loader.logClose();\n return firstPromise;\n });\n }\n /**\n * @internal\n */\n _loadMaterialAsync(context, material, babylonMesh, babylonDrawMode, assign) {\n // Don't load material LODs if already loading a node LOD.\n if (this._nodeIndexLOD) {\n return null;\n }\n return GLTFLoader.LoadExtensionAsync(context, material, this.name, (extensionContext, extension) => {\n let firstPromise;\n const materialLODs = this._getLODs(extensionContext, material, this._loader.gltf.materials, extension.ids);\n this._loader.logOpen(`${extensionContext}`);\n for (let indexLOD = 0; indexLOD < materialLODs.length; indexLOD++) {\n const materialLOD = materialLODs[indexLOD];\n if (indexLOD !== 0) {\n this._materialIndexLOD = indexLOD;\n }\n const promise = this._loader\n ._loadMaterialAsync(`/materials/${materialLOD.index}`, materialLOD, babylonMesh, babylonDrawMode, (babylonMaterial) => {\n if (indexLOD === 0) {\n assign(babylonMaterial);\n }\n })\n .then((babylonMaterial) => {\n if (indexLOD !== 0) {\n assign(babylonMaterial);\n // TODO: should not rely on _data\n const previousDataLOD = materialLODs[indexLOD - 1]._data;\n if (previousDataLOD[babylonDrawMode]) {\n this._disposeMaterials([previousDataLOD[babylonDrawMode].babylonMaterial]);\n delete previousDataLOD[babylonDrawMode];\n }\n }\n return babylonMaterial;\n });\n this._materialPromiseLODs[indexLOD] = this._materialPromiseLODs[indexLOD] || [];\n if (indexLOD === 0) {\n firstPromise = promise;\n }\n else {\n this._materialIndexLOD = null;\n this._materialPromiseLODs[indexLOD].push(promise);\n }\n }\n this._loader.logClose();\n return firstPromise;\n });\n }\n /**\n * @internal\n */\n _loadUriAsync(context, property, uri) {\n // Defer the loading of uris if loading a node or material LOD.\n if (this._nodeIndexLOD !== null) {\n this._loader.log(`deferred`);\n const previousIndexLOD = this._nodeIndexLOD - 1;\n this._nodeSignalLODs[previousIndexLOD] = this._nodeSignalLODs[previousIndexLOD] || new Deferred();\n return this._nodeSignalLODs[this._nodeIndexLOD - 1].promise.then(() => {\n return this._loader.loadUriAsync(context, property, uri);\n });\n }\n else if (this._materialIndexLOD !== null) {\n this._loader.log(`deferred`);\n const previousIndexLOD = this._materialIndexLOD - 1;\n this._materialSignalLODs[previousIndexLOD] = this._materialSignalLODs[previousIndexLOD] || new Deferred();\n return this._materialSignalLODs[previousIndexLOD].promise.then(() => {\n return this._loader.loadUriAsync(context, property, uri);\n });\n }\n return null;\n }\n /**\n * @internal\n */\n loadBufferAsync(context, buffer, byteOffset, byteLength) {\n if (this._loader.parent.useRangeRequests && !buffer.uri) {\n if (!this._loader.bin) {\n throw new Error(`${context}: Uri is missing or the binary glTF is missing its binary chunk`);\n }\n const loadAsync = (bufferLODs, indexLOD) => {\n const start = byteOffset;\n const end = start + byteLength - 1;\n let bufferLOD = bufferLODs[indexLOD];\n if (bufferLOD) {\n bufferLOD.start = Math.min(bufferLOD.start, start);\n bufferLOD.end = Math.max(bufferLOD.end, end);\n }\n else {\n bufferLOD = { start: start, end: end, loaded: new Deferred() };\n bufferLODs[indexLOD] = bufferLOD;\n }\n return bufferLOD.loaded.promise.then((data) => {\n return new Uint8Array(data.buffer, data.byteOffset + byteOffset - bufferLOD.start, byteLength);\n });\n };\n this._loader.log(`deferred`);\n if (this._nodeIndexLOD !== null) {\n return loadAsync(this._nodeBufferLODs, this._nodeIndexLOD);\n }\n else if (this._materialIndexLOD !== null) {\n return loadAsync(this._materialBufferLODs, this._materialIndexLOD);\n }\n else {\n return loadAsync(this._bufferLODs, 0);\n }\n }\n return null;\n }\n _loadBufferLOD(bufferLODs, indexLOD) {\n const bufferLOD = bufferLODs[indexLOD];\n if (bufferLOD) {\n this._loader.log(`Loading buffer range [${bufferLOD.start}-${bufferLOD.end}]`);\n this._loader.bin.readAsync(bufferLOD.start, bufferLOD.end - bufferLOD.start + 1).then((data) => {\n bufferLOD.loaded.resolve(data);\n }, (error) => {\n bufferLOD.loaded.reject(error);\n });\n }\n }\n /**\n * Gets an array of LOD properties from lowest to highest.\n * @param context\n * @param property\n * @param array\n * @param ids\n */\n _getLODs(context, property, array, ids) {\n if (this.maxLODsToLoad <= 0) {\n throw new Error(\"maxLODsToLoad must be greater than zero\");\n }\n const properties = new Array();\n for (let i = ids.length - 1; i >= 0; i--) {\n properties.push(ArrayItem.Get(`${context}/ids/${ids[i]}`, array, ids[i]));\n if (properties.length === this.maxLODsToLoad) {\n return properties;\n }\n }\n properties.push(property);\n return properties;\n }\n _disposeTransformNode(babylonTransformNode) {\n const babylonMaterials = new Array();\n const babylonMaterial = babylonTransformNode.material;\n if (babylonMaterial) {\n babylonMaterials.push(babylonMaterial);\n }\n for (const babylonMesh of babylonTransformNode.getChildMeshes()) {\n if (babylonMesh.material) {\n babylonMaterials.push(babylonMesh.material);\n }\n }\n babylonTransformNode.dispose();\n const babylonMaterialsToDispose = babylonMaterials.filter((babylonMaterial) => this._loader.babylonScene.meshes.every((mesh) => mesh.material != babylonMaterial));\n this._disposeMaterials(babylonMaterialsToDispose);\n }\n _disposeMaterials(babylonMaterials) {\n const babylonTextures = {};\n for (const babylonMaterial of babylonMaterials) {\n for (const babylonTexture of babylonMaterial.getActiveTextures()) {\n babylonTextures[babylonTexture.uniqueId] = babylonTexture;\n }\n babylonMaterial.dispose();\n }\n for (const uniqueId in babylonTextures) {\n for (const babylonMaterial of this._loader.babylonScene.materials) {\n if (babylonMaterial.hasTexture(babylonTextures[uniqueId])) {\n delete babylonTextures[uniqueId];\n }\n }\n }\n for (const uniqueId in babylonTextures) {\n babylonTextures[uniqueId].dispose();\n }\n }\n}\nGLTFLoader.RegisterExtension(NAME, (loader) => new MSFT_lod(loader));\n//# sourceMappingURL=MSFT_lod.js.map","import { PBRMaterial } from \"@babylonjs/core/Materials/PBR/pbrMaterial.js\";\nimport { GLTFLoader } from \"../glTFLoader.js\";\nconst NAME = \"MSFT_minecraftMesh\";\n/** @internal */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport class MSFT_minecraftMesh {\n /** @internal */\n constructor(loader) {\n /** @internal */\n this.name = NAME;\n this._loader = loader;\n this.enabled = this._loader.isExtensionUsed(NAME);\n }\n /** @internal */\n dispose() {\n this._loader = null;\n }\n /** @internal */\n loadMaterialPropertiesAsync(context, material, babylonMaterial) {\n return GLTFLoader.LoadExtraAsync(context, material, this.name, (extraContext, extra) => {\n if (extra) {\n if (!(babylonMaterial instanceof PBRMaterial)) {\n throw new Error(`${extraContext}: Material type not supported`);\n }\n const promise = this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial);\n if (babylonMaterial.needAlphaBlending()) {\n babylonMaterial.forceDepthWrite = true;\n babylonMaterial.separateCullingPass = true;\n }\n babylonMaterial.backFaceCulling = babylonMaterial.forceDepthWrite;\n babylonMaterial.twoSidedLighting = true;\n return promise;\n }\n return null;\n });\n }\n}\nGLTFLoader.RegisterExtension(NAME, (loader) => new MSFT_minecraftMesh(loader));\n//# sourceMappingURL=MSFT_minecraftMesh.js.map","import { PBRMaterial } from \"@babylonjs/core/Materials/PBR/pbrMaterial.js\";\nimport { GLTFLoader } from \"../glTFLoader.js\";\nconst NAME = \"MSFT_sRGBFactors\";\n/** @internal */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport class MSFT_sRGBFactors {\n /** @internal */\n constructor(loader) {\n /** @internal */\n this.name = NAME;\n this._loader = loader;\n this.enabled = this._loader.isExtensionUsed(NAME);\n }\n /** @internal */\n dispose() {\n this._loader = null;\n }\n /** @internal */\n loadMaterialPropertiesAsync(context, material, babylonMaterial) {\n return GLTFLoader.LoadExtraAsync(context, material, this.name, (extraContext, extra) => {\n if (extra) {\n if (!(babylonMaterial instanceof PBRMaterial)) {\n throw new Error(`${extraContext}: Material type not supported`);\n }\n const promise = this._loader.loadMaterialPropertiesAsync(context, material, babylonMaterial);\n const useExactSrgbConversions = babylonMaterial.getScene().getEngine().useExactSrgbConversions;\n if (!babylonMaterial.albedoTexture) {\n babylonMaterial.albedoColor.toLinearSpaceToRef(babylonMaterial.albedoColor, useExactSrgbConversions);\n }\n if (!babylonMaterial.reflectivityTexture) {\n babylonMaterial.reflectivityColor.toLinearSpaceToRef(babylonMaterial.reflectivityColor, useExactSrgbConversions);\n }\n return promise;\n }\n return null;\n });\n }\n}\nGLTFLoader.RegisterExtension(NAME, (loader) => new MSFT_sRGBFactors(loader));\n//# sourceMappingURL=MSFT_sRGBFactors.js.map","import { GLTFLoader } from \"../glTFLoader.js\";\nconst NAME = \"ExtrasAsMetadata\";\n/**\n * Store glTF extras (if present) in BJS objects' metadata\n */\nexport class ExtrasAsMetadata {\n _assignExtras(babylonObject, gltfProp) {\n if (gltfProp.extras && Object.keys(gltfProp.extras).length > 0) {\n const metadata = (babylonObject.metadata = babylonObject.metadata || {});\n const gltf = (metadata.gltf = metadata.gltf || {});\n gltf.extras = gltfProp.extras;\n }\n }\n /**\n * @internal\n */\n constructor(loader) {\n /**\n * The name of this extension.\n */\n this.name = NAME;\n /**\n * Defines whether this extension is enabled.\n */\n this.enabled = true;\n this._loader = loader;\n }\n /** @internal */\n dispose() {\n this._loader = null;\n }\n /**\n * @internal\n */\n loadNodeAsync(context, node, assign) {\n return this._loader.loadNodeAsync(context, node, (babylonTransformNode) => {\n this._assignExtras(babylonTransformNode, node);\n assign(babylonTransformNode);\n });\n }\n /**\n * @internal\n */\n loadCameraAsync(context, camera, assign) {\n return this._loader.loadCameraAsync(context, camera, (babylonCamera) => {\n this._assignExtras(babylonCamera, camera);\n assign(babylonCamera);\n });\n }\n /**\n * @internal\n */\n createMaterial(context, material, babylonDrawMode) {\n const babylonMaterial = this._loader.createMaterial(context, material, babylonDrawMode);\n this._assignExtras(babylonMaterial, material);\n return babylonMaterial;\n }\n}\nGLTFLoader.RegisterExtension(NAME, (loader) => new ExtrasAsMetadata(loader));\n//# sourceMappingURL=ExtrasAsMetadata.js.map","\n\n","\n\n\n\n","import { createStore } from \"vuex\";\n\nexport default createStore({\n\tstate: {\n\t\t// Language\n\t\tactiveLanguage: 'de',\n\t\tlanguages: ['de'],\n\n\t\t// Tutorial\n\t\ttutorialVisible: false,\n\t\tfirstTimeTutorial: true,\n\t\tactiveTutorialPage: 0,\n\n\t\t// Categories\n\t\tavailableSegments: null,\n\t\twaterEnabled: true,\n\t\tsewageEnabled: true,\n\t\tgasEnabled: true,\n\n\t\t// InfoPanel\n\t\tisInfoPanelOpen: false,\n\t\tinfoPanelData: null,\n\n\t\t// Tooltip\n\t\tisTooltipOpen: false,\n\t\ttooltipData: null,\n\t\ttoolTipsDisabled: true,\n\n\t\t// Products data\n\t\tproducts: [],\n\n\t\tisGroundOpen: false,\n\t\tloadingscreenVisible: true,\n\t\tdefaultCamStats: {\n\t\t\tradius: {\n\t\t\t\tupperLimit: null,\n\t\t\t\tlowerLimit: null,\n\t\t\t\tvalue: null,\n\t\t\t},\n\t\t\talpha: {\n\t\t\t\tupperLimit: null,\n\t\t\t\tlowerLimit: null,\n\t\t\t\tvalue: null,\n\t\t\t},\n\t\t\tbeta: {\n\t\t\t\tupperLimit: null,\n\t\t\t\tlowerLimit: null,\n\t\t\t\tvalue: null,\n\t\t\t},\n\t\t\ttarget: null,\n\t\t}\n\t},\n\tgetters: {\n\t\ttoolTipsDisabled: (state) => { return state.toolTipsDisabled; },\n\t\ttooltipData: (state) => { return state.tooltipData; },\n\t\tloadingscreenVisible: (state) => { return state.loadingscreenVisible; },\n\t\tactiveLanguage: (state) => {return state.activeLanguage},\n\t\tlanguages: (state) => {return state.languages},\n\t\tproducts: (state) => {return state.products},\n\t\tavailableSegments: (state) => {return state.availableSegments},\n\t\tisWaterEnabled: (state) => {return state.waterEnabled},\n\t\tisSewageEnabled: (state) => {return state.sewageEnabled},\n\t\tisGasEnabled: (state) => {return state.gasEnabled},\n\t\tisGroundOpen: (state) => {return state.isGroundOpen},\n\t\tisInfoPanelOpen: (state) => {return state.isInfoPanelOpen},\n\t\tisTooltipOpen: (state) => {return state.isTooltipOpen},\n\t\tdefaultCamStats: (state) => {return state.defaultCamStats},\n\t\tinfoPanelData: (state) => {return state.infoPanelData},\n\t\tisTutorialVisible: (state) => {return state.tutorialVisible},\n\t\tisFirstTimeTutorial: (state) => {return state.firstTimeTutorial},\n\t},\n\tmutations: {\n\t\tsetToolTipsDisabled(state, boolean){\n\t\t\tstate.toolTipsDisabled = boolean;\n\t\t},\n\t\tsetLoadingscreenVisible(state, boolean){\n\t\t\tstate.loadingscreenVisible = boolean;\n\t\t},\n\t\tsetActiveLanguage(state, code){\n\t\t\tstate.activeLanguage = code;\n\t\t},\n\t\tsetProducts(state, array){\n\t\t\tstate.products = array;\n\t\t},\n\t\tsetLanguages(state,array){\n\t\t\tstate.languages = array;\n\t\t},\n\t\tsetAvailableSegments(state,object){\n\t\t\tstate.availableSegments = object;\n\t\t},\n\t\tsetWaterBool(state, boolean){\n\t\t\tstate.waterEnabled = boolean;\n\t\t},\n\t\tsetSewageBool(state, boolean){\n\t\t\tstate.sewageEnabled = boolean;\n\t\t},\n\t\tsetGasBool(state, boolean){\n\t\t\tstate.gasEnabled = boolean;\n\t\t},\n\t\tsetGroundBool(state, boolean){\n\t\t\tstate.isGroundOpen = boolean;\n\t\t},\n\t\ttoggleWaterBool(state){\n\t\t\tstate.waterEnabled = !state.waterEnabled;\n\t\t},\n\t\ttoggleSewageBool(state){\n\t\t\tstate.sewageEnabled = !state.sewageEnabled;\n\t\t},\n\t\ttoggleGasBool(state){\n\t\t\tstate.gasEnabled = !state.gasEnabled;\n\t\t},\n\t\ttoggleGroundBool(state){\n\t\t\tstate.isGroundOpen = !state.isGroundOpen;\n\t\t},\n\t\tsetDefaultCamTarget(state,target){\n\t\t\tstate.defaultCamStats.target = target;\n\t\t},\n\t\tsetDefaultCamStats(state,camStats){\n\t\t\tstate.defaultCamStats = camStats;\n\t\t},\n\t\tsetInfoPanelOpen(state,boolean){\n\t\t\tstate.isInfoPanelOpen = boolean;\n\t\t},\n\t\tsetTooltipOpen(state,boolean){\n\t\t\tstate.isTooltipOpen = boolean;\n\t\t},\n\t\tsetTooltipData(state,data){\n\t\t\tstate.tooltipData = data;\n\t\t},\n\t\tsetInfoPanelData(state, data){\n\t\t\tstate.infoPanelData = data;\n\t\t},\n\t\tsetTutorialVisible(state, boolean){\n\t\t\tstate.tutorialVisible = boolean;\n\t\t},\n\t\tsetFirstTimeTutorialBoolean(state, boolean){\n\t\t\tstate.firstTimeTutorial = boolean;\n\t\t}\n\t}\n})","/*!\n * shared v9.4.1\n * (c) 2023 kazuya kawaguchi\n * Released under the MIT License.\n */\n/**\n * Original Utilities\n * written by kazuya kawaguchi\n */\nconst inBrowser = typeof window !== 'undefined';\nlet mark;\nlet measure;\nif ((process.env.NODE_ENV !== 'production')) {\n const perf = inBrowser && window.performance;\n if (perf &&\n perf.mark &&\n perf.measure &&\n perf.clearMarks &&\n // @ts-ignore browser compat\n perf.clearMeasures) {\n mark = (tag) => {\n perf.mark(tag);\n };\n measure = (name, startTag, endTag) => {\n perf.measure(name, startTag, endTag);\n perf.clearMarks(startTag);\n perf.clearMarks(endTag);\n };\n }\n}\nconst RE_ARGS = /\\{([0-9a-zA-Z]+)\\}/g;\n/* eslint-disable */\nfunction format(message, ...args) {\n if (args.length === 1 && isObject(args[0])) {\n args = args[0];\n }\n if (!args || !args.hasOwnProperty) {\n args = {};\n }\n return message.replace(RE_ARGS, (match, identifier) => {\n return args.hasOwnProperty(identifier) ? args[identifier] : '';\n });\n}\nconst makeSymbol = (name, shareable = false) => !shareable ? Symbol(name) : Symbol.for(name);\nconst generateFormatCacheKey = (locale, key, source) => friendlyJSONstringify({ l: locale, k: key, s: source });\nconst friendlyJSONstringify = (json) => JSON.stringify(json)\n .replace(/\\u2028/g, '\\\\u2028')\n .replace(/\\u2029/g, '\\\\u2029')\n .replace(/\\u0027/g, '\\\\u0027');\nconst isNumber = (val) => typeof val === 'number' && isFinite(val);\nconst isDate = (val) => toTypeString(val) === '[object Date]';\nconst isRegExp = (val) => toTypeString(val) === '[object RegExp]';\nconst isEmptyObject = (val) => isPlainObject(val) && Object.keys(val).length === 0;\nconst assign = Object.assign;\nlet _globalThis;\nconst getGlobalThis = () => {\n // prettier-ignore\n return (_globalThis ||\n (_globalThis =\n typeof globalThis !== 'undefined'\n ? globalThis\n : typeof self !== 'undefined'\n ? self\n : typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : {}));\n};\nfunction escapeHtml(rawText) {\n return rawText\n .replace(//g, '>')\n .replace(/\"/g, '"')\n .replace(/'/g, ''');\n}\nconst hasOwnProperty = Object.prototype.hasOwnProperty;\nfunction hasOwn(obj, key) {\n return hasOwnProperty.call(obj, key);\n}\n/* eslint-enable */\n/**\n * Useful Utilities By Evan you\n * Modified by kazuya kawaguchi\n * MIT License\n * https://github.com/vuejs/vue-next/blob/master/packages/shared/src/index.ts\n * https://github.com/vuejs/vue-next/blob/master/packages/shared/src/codeframe.ts\n */\nconst isArray = Array.isArray;\nconst isFunction = (val) => typeof val === 'function';\nconst isString = (val) => typeof val === 'string';\nconst isBoolean = (val) => typeof val === 'boolean';\nconst isSymbol = (val) => typeof val === 'symbol';\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst isObject = (val) => val !== null && typeof val === 'object';\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst isPromise = (val) => {\n return isObject(val) && isFunction(val.then) && isFunction(val.catch);\n};\nconst objectToString = Object.prototype.toString;\nconst toTypeString = (value) => objectToString.call(value);\nconst isPlainObject = (val) => {\n if (!isObject(val))\n return false;\n const proto = Object.getPrototypeOf(val);\n return proto === null || proto.constructor === Object;\n};\n// for converting list and named values to displayed strings.\nconst toDisplayString = (val) => {\n return val == null\n ? ''\n : isArray(val) || (isPlainObject(val) && val.toString === objectToString)\n ? JSON.stringify(val, null, 2)\n : String(val);\n};\nfunction join(items, separator = '') {\n return items.reduce((str, item, index) => (index === 0 ? str + item : str + separator + item), '');\n}\nconst RANGE = 2;\nfunction generateCodeFrame(source, start = 0, end = source.length) {\n const lines = source.split(/\\r?\\n/);\n let count = 0;\n const res = [];\n for (let i = 0; i < lines.length; i++) {\n count += lines[i].length + 1;\n if (count >= start) {\n for (let j = i - RANGE; j <= i + RANGE || end > count; j++) {\n if (j < 0 || j >= lines.length)\n continue;\n const line = j + 1;\n res.push(`${line}${' '.repeat(3 - String(line).length)}| ${lines[j]}`);\n const lineLength = lines[j].length;\n if (j === i) {\n // push underline\n const pad = start - (count - lineLength) + 1;\n const length = Math.max(1, end > count ? lineLength - pad : end - start);\n res.push(` | ` + ' '.repeat(pad) + '^'.repeat(length));\n }\n else if (j > i) {\n if (end > count) {\n const length = Math.max(Math.min(end - count, lineLength), 1);\n res.push(` | ` + '^'.repeat(length));\n }\n count += lineLength + 1;\n }\n }\n break;\n }\n }\n return res.join('\\n');\n}\nfunction incrementer(code) {\n let current = code;\n return () => ++current;\n}\n\nfunction warn(msg, err) {\n if (typeof console !== 'undefined') {\n console.warn(`[intlify] ` + msg);\n /* istanbul ignore if */\n if (err) {\n console.warn(err.stack);\n }\n }\n}\nconst hasWarned = {};\nfunction warnOnce(msg) {\n if (!hasWarned[msg]) {\n hasWarned[msg] = true;\n warn(msg);\n }\n}\n\n/**\n * Event emitter, forked from the below:\n * - original repository url: https://github.com/developit/mitt\n * - code url: https://github.com/developit/mitt/blob/master/src/index.ts\n * - author: Jason Miller (https://github.com/developit)\n * - license: MIT\n */\n/**\n * Create a event emitter\n *\n * @returns An event emitter\n */\nfunction createEmitter() {\n const events = new Map();\n const emitter = {\n events,\n on(event, handler) {\n const handlers = events.get(event);\n const added = handlers && handlers.push(handler);\n if (!added) {\n events.set(event, [handler]);\n }\n },\n off(event, handler) {\n const handlers = events.get(event);\n if (handlers) {\n handlers.splice(handlers.indexOf(handler) >>> 0, 1);\n }\n },\n emit(event, payload) {\n (events.get(event) || [])\n .slice()\n .map(handler => handler(payload));\n (events.get('*') || [])\n .slice()\n .map(handler => handler(event, payload));\n }\n };\n return emitter;\n}\n\nexport { assign, createEmitter, escapeHtml, format, friendlyJSONstringify, generateCodeFrame, generateFormatCacheKey, getGlobalThis, hasOwn, inBrowser, incrementer, isArray, isBoolean, isDate, isEmptyObject, isFunction, isNumber, isObject, isPlainObject, isPromise, isRegExp, isString, isSymbol, join, makeSymbol, mark, measure, objectToString, toDisplayString, toTypeString, warn, warnOnce };\n","/*!\n * message-compiler v9.4.1\n * (c) 2023 kazuya kawaguchi\n * Released under the MIT License.\n */\nconst LOCATION_STUB = {\n start: { line: 1, column: 1, offset: 0 },\n end: { line: 1, column: 1, offset: 0 }\n};\nfunction createPosition(line, column, offset) {\n return { line, column, offset };\n}\nfunction createLocation(start, end, source) {\n const loc = { start, end };\n if (source != null) {\n loc.source = source;\n }\n return loc;\n}\n\n/**\n * Original Utilities\n * written by kazuya kawaguchi\n */\nconst RE_ARGS = /\\{([0-9a-zA-Z]+)\\}/g;\n/* eslint-disable */\nfunction format(message, ...args) {\n if (args.length === 1 && isObject(args[0])) {\n args = args[0];\n }\n if (!args || !args.hasOwnProperty) {\n args = {};\n }\n return message.replace(RE_ARGS, (match, identifier) => {\n return args.hasOwnProperty(identifier) ? args[identifier] : '';\n });\n}\nconst assign = Object.assign;\nconst isString = (val) => typeof val === 'string';\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst isObject = (val) => val !== null && typeof val === 'object';\nfunction join(items, separator = '') {\n return items.reduce((str, item, index) => (index === 0 ? str + item : str + separator + item), '');\n}\n\nconst CompileErrorCodes = {\n // tokenizer error codes\n EXPECTED_TOKEN: 1,\n INVALID_TOKEN_IN_PLACEHOLDER: 2,\n UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER: 3,\n UNKNOWN_ESCAPE_SEQUENCE: 4,\n INVALID_UNICODE_ESCAPE_SEQUENCE: 5,\n UNBALANCED_CLOSING_BRACE: 6,\n UNTERMINATED_CLOSING_BRACE: 7,\n EMPTY_PLACEHOLDER: 8,\n NOT_ALLOW_NEST_PLACEHOLDER: 9,\n INVALID_LINKED_FORMAT: 10,\n // parser error codes\n MUST_HAVE_MESSAGES_IN_PLURAL: 11,\n UNEXPECTED_EMPTY_LINKED_MODIFIER: 12,\n UNEXPECTED_EMPTY_LINKED_KEY: 13,\n UNEXPECTED_LEXICAL_ANALYSIS: 14,\n // generator error codes\n UNHANDLED_CODEGEN_NODE_TYPE: 15,\n // minifier error codes\n UNHANDLED_MINIFIER_NODE_TYPE: 16,\n // Special value for higher-order compilers to pick up the last code\n // to avoid collision of error codes. This should always be kept as the last\n // item.\n __EXTEND_POINT__: 17\n};\n/** @internal */\nconst errorMessages = {\n // tokenizer error messages\n [CompileErrorCodes.EXPECTED_TOKEN]: `Expected token: '{0}'`,\n [CompileErrorCodes.INVALID_TOKEN_IN_PLACEHOLDER]: `Invalid token in placeholder: '{0}'`,\n [CompileErrorCodes.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER]: `Unterminated single quote in placeholder`,\n [CompileErrorCodes.UNKNOWN_ESCAPE_SEQUENCE]: `Unknown escape sequence: \\\\{0}`,\n [CompileErrorCodes.INVALID_UNICODE_ESCAPE_SEQUENCE]: `Invalid unicode escape sequence: {0}`,\n [CompileErrorCodes.UNBALANCED_CLOSING_BRACE]: `Unbalanced closing brace`,\n [CompileErrorCodes.UNTERMINATED_CLOSING_BRACE]: `Unterminated closing brace`,\n [CompileErrorCodes.EMPTY_PLACEHOLDER]: `Empty placeholder`,\n [CompileErrorCodes.NOT_ALLOW_NEST_PLACEHOLDER]: `Not allowed nest placeholder`,\n [CompileErrorCodes.INVALID_LINKED_FORMAT]: `Invalid linked format`,\n // parser error messages\n [CompileErrorCodes.MUST_HAVE_MESSAGES_IN_PLURAL]: `Plural must have messages`,\n [CompileErrorCodes.UNEXPECTED_EMPTY_LINKED_MODIFIER]: `Unexpected empty linked modifier`,\n [CompileErrorCodes.UNEXPECTED_EMPTY_LINKED_KEY]: `Unexpected empty linked key`,\n [CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS]: `Unexpected lexical analysis in token: '{0}'`,\n // generator error messages\n [CompileErrorCodes.UNHANDLED_CODEGEN_NODE_TYPE]: `unhandled codegen node type: '{0}'`,\n // minimizer error messages\n [CompileErrorCodes.UNHANDLED_MINIFIER_NODE_TYPE]: `unhandled mimifier node type: '{0}'`\n};\nfunction createCompileError(code, loc, options = {}) {\n const { domain, messages, args } = options;\n const msg = format((messages || errorMessages)[code] || '', ...(args || []))\n ;\n const error = new SyntaxError(String(msg));\n error.code = code;\n if (loc) {\n error.location = loc;\n }\n error.domain = domain;\n return error;\n}\n/** @internal */\nfunction defaultOnError(error) {\n throw error;\n}\n\nconst RE_HTML_TAG = /<\\/?[\\w\\s=\"/.':;#-\\/]+>/;\nconst detectHtmlTag = (source) => RE_HTML_TAG.test(source);\n\nconst CHAR_SP = ' ';\nconst CHAR_CR = '\\r';\nconst CHAR_LF = '\\n';\nconst CHAR_LS = String.fromCharCode(0x2028);\nconst CHAR_PS = String.fromCharCode(0x2029);\nfunction createScanner(str) {\n const _buf = str;\n let _index = 0;\n let _line = 1;\n let _column = 1;\n let _peekOffset = 0;\n const isCRLF = (index) => _buf[index] === CHAR_CR && _buf[index + 1] === CHAR_LF;\n const isLF = (index) => _buf[index] === CHAR_LF;\n const isPS = (index) => _buf[index] === CHAR_PS;\n const isLS = (index) => _buf[index] === CHAR_LS;\n const isLineEnd = (index) => isCRLF(index) || isLF(index) || isPS(index) || isLS(index);\n const index = () => _index;\n const line = () => _line;\n const column = () => _column;\n const peekOffset = () => _peekOffset;\n const charAt = (offset) => isCRLF(offset) || isPS(offset) || isLS(offset) ? CHAR_LF : _buf[offset];\n const currentChar = () => charAt(_index);\n const currentPeek = () => charAt(_index + _peekOffset);\n function next() {\n _peekOffset = 0;\n if (isLineEnd(_index)) {\n _line++;\n _column = 0;\n }\n if (isCRLF(_index)) {\n _index++;\n }\n _index++;\n _column++;\n return _buf[_index];\n }\n function peek() {\n if (isCRLF(_index + _peekOffset)) {\n _peekOffset++;\n }\n _peekOffset++;\n return _buf[_index + _peekOffset];\n }\n function reset() {\n _index = 0;\n _line = 1;\n _column = 1;\n _peekOffset = 0;\n }\n function resetPeek(offset = 0) {\n _peekOffset = offset;\n }\n function skipToPeek() {\n const target = _index + _peekOffset;\n // eslint-disable-next-line no-unmodified-loop-condition\n while (target !== _index) {\n next();\n }\n _peekOffset = 0;\n }\n return {\n index,\n line,\n column,\n peekOffset,\n charAt,\n currentChar,\n currentPeek,\n next,\n peek,\n reset,\n resetPeek,\n skipToPeek\n };\n}\n\nconst EOF = undefined;\nconst DOT = '.';\nconst LITERAL_DELIMITER = \"'\";\nconst ERROR_DOMAIN$3 = 'tokenizer';\nfunction createTokenizer(source, options = {}) {\n const location = options.location !== false;\n const _scnr = createScanner(source);\n const currentOffset = () => _scnr.index();\n const currentPosition = () => createPosition(_scnr.line(), _scnr.column(), _scnr.index());\n const _initLoc = currentPosition();\n const _initOffset = currentOffset();\n const _context = {\n currentType: 14 /* TokenTypes.EOF */,\n offset: _initOffset,\n startLoc: _initLoc,\n endLoc: _initLoc,\n lastType: 14 /* TokenTypes.EOF */,\n lastOffset: _initOffset,\n lastStartLoc: _initLoc,\n lastEndLoc: _initLoc,\n braceNest: 0,\n inLinked: false,\n text: ''\n };\n const context = () => _context;\n const { onError } = options;\n function emitError(code, pos, offset, ...args) {\n const ctx = context();\n pos.column += offset;\n pos.offset += offset;\n if (onError) {\n const loc = location ? createLocation(ctx.startLoc, pos) : null;\n const err = createCompileError(code, loc, {\n domain: ERROR_DOMAIN$3,\n args\n });\n onError(err);\n }\n }\n function getToken(context, type, value) {\n context.endLoc = currentPosition();\n context.currentType = type;\n const token = { type };\n if (location) {\n token.loc = createLocation(context.startLoc, context.endLoc);\n }\n if (value != null) {\n token.value = value;\n }\n return token;\n }\n const getEndToken = (context) => getToken(context, 14 /* TokenTypes.EOF */);\n function eat(scnr, ch) {\n if (scnr.currentChar() === ch) {\n scnr.next();\n return ch;\n }\n else {\n emitError(CompileErrorCodes.EXPECTED_TOKEN, currentPosition(), 0, ch);\n return '';\n }\n }\n function peekSpaces(scnr) {\n let buf = '';\n while (scnr.currentPeek() === CHAR_SP || scnr.currentPeek() === CHAR_LF) {\n buf += scnr.currentPeek();\n scnr.peek();\n }\n return buf;\n }\n function skipSpaces(scnr) {\n const buf = peekSpaces(scnr);\n scnr.skipToPeek();\n return buf;\n }\n function isIdentifierStart(ch) {\n if (ch === EOF) {\n return false;\n }\n const cc = ch.charCodeAt(0);\n return ((cc >= 97 && cc <= 122) || // a-z\n (cc >= 65 && cc <= 90) || // A-Z\n cc === 95 // _\n );\n }\n function isNumberStart(ch) {\n if (ch === EOF) {\n return false;\n }\n const cc = ch.charCodeAt(0);\n return cc >= 48 && cc <= 57; // 0-9\n }\n function isNamedIdentifierStart(scnr, context) {\n const { currentType } = context;\n if (currentType !== 2 /* TokenTypes.BraceLeft */) {\n return false;\n }\n peekSpaces(scnr);\n const ret = isIdentifierStart(scnr.currentPeek());\n scnr.resetPeek();\n return ret;\n }\n function isListIdentifierStart(scnr, context) {\n const { currentType } = context;\n if (currentType !== 2 /* TokenTypes.BraceLeft */) {\n return false;\n }\n peekSpaces(scnr);\n const ch = scnr.currentPeek() === '-' ? scnr.peek() : scnr.currentPeek();\n const ret = isNumberStart(ch);\n scnr.resetPeek();\n return ret;\n }\n function isLiteralStart(scnr, context) {\n const { currentType } = context;\n if (currentType !== 2 /* TokenTypes.BraceLeft */) {\n return false;\n }\n peekSpaces(scnr);\n const ret = scnr.currentPeek() === LITERAL_DELIMITER;\n scnr.resetPeek();\n return ret;\n }\n function isLinkedDotStart(scnr, context) {\n const { currentType } = context;\n if (currentType !== 8 /* TokenTypes.LinkedAlias */) {\n return false;\n }\n peekSpaces(scnr);\n const ret = scnr.currentPeek() === \".\" /* TokenChars.LinkedDot */;\n scnr.resetPeek();\n return ret;\n }\n function isLinkedModifierStart(scnr, context) {\n const { currentType } = context;\n if (currentType !== 9 /* TokenTypes.LinkedDot */) {\n return false;\n }\n peekSpaces(scnr);\n const ret = isIdentifierStart(scnr.currentPeek());\n scnr.resetPeek();\n return ret;\n }\n function isLinkedDelimiterStart(scnr, context) {\n const { currentType } = context;\n if (!(currentType === 8 /* TokenTypes.LinkedAlias */ ||\n currentType === 12 /* TokenTypes.LinkedModifier */)) {\n return false;\n }\n peekSpaces(scnr);\n const ret = scnr.currentPeek() === \":\" /* TokenChars.LinkedDelimiter */;\n scnr.resetPeek();\n return ret;\n }\n function isLinkedReferStart(scnr, context) {\n const { currentType } = context;\n if (currentType !== 10 /* TokenTypes.LinkedDelimiter */) {\n return false;\n }\n const fn = () => {\n const ch = scnr.currentPeek();\n if (ch === \"{\" /* TokenChars.BraceLeft */) {\n return isIdentifierStart(scnr.peek());\n }\n else if (ch === \"@\" /* TokenChars.LinkedAlias */ ||\n ch === \"%\" /* TokenChars.Modulo */ ||\n ch === \"|\" /* TokenChars.Pipe */ ||\n ch === \":\" /* TokenChars.LinkedDelimiter */ ||\n ch === \".\" /* TokenChars.LinkedDot */ ||\n ch === CHAR_SP ||\n !ch) {\n return false;\n }\n else if (ch === CHAR_LF) {\n scnr.peek();\n return fn();\n }\n else {\n // other characters\n return isIdentifierStart(ch);\n }\n };\n const ret = fn();\n scnr.resetPeek();\n return ret;\n }\n function isPluralStart(scnr) {\n peekSpaces(scnr);\n const ret = scnr.currentPeek() === \"|\" /* TokenChars.Pipe */;\n scnr.resetPeek();\n return ret;\n }\n function detectModuloStart(scnr) {\n const spaces = peekSpaces(scnr);\n const ret = scnr.currentPeek() === \"%\" /* TokenChars.Modulo */ &&\n scnr.peek() === \"{\" /* TokenChars.BraceLeft */;\n scnr.resetPeek();\n return {\n isModulo: ret,\n hasSpace: spaces.length > 0\n };\n }\n function isTextStart(scnr, reset = true) {\n const fn = (hasSpace = false, prev = '', detectModulo = false) => {\n const ch = scnr.currentPeek();\n if (ch === \"{\" /* TokenChars.BraceLeft */) {\n return prev === \"%\" /* TokenChars.Modulo */ ? false : hasSpace;\n }\n else if (ch === \"@\" /* TokenChars.LinkedAlias */ || !ch) {\n return prev === \"%\" /* TokenChars.Modulo */ ? true : hasSpace;\n }\n else if (ch === \"%\" /* TokenChars.Modulo */) {\n scnr.peek();\n return fn(hasSpace, \"%\" /* TokenChars.Modulo */, true);\n }\n else if (ch === \"|\" /* TokenChars.Pipe */) {\n return prev === \"%\" /* TokenChars.Modulo */ || detectModulo\n ? true\n : !(prev === CHAR_SP || prev === CHAR_LF);\n }\n else if (ch === CHAR_SP) {\n scnr.peek();\n return fn(true, CHAR_SP, detectModulo);\n }\n else if (ch === CHAR_LF) {\n scnr.peek();\n return fn(true, CHAR_LF, detectModulo);\n }\n else {\n return true;\n }\n };\n const ret = fn();\n reset && scnr.resetPeek();\n return ret;\n }\n function takeChar(scnr, fn) {\n const ch = scnr.currentChar();\n if (ch === EOF) {\n return EOF;\n }\n if (fn(ch)) {\n scnr.next();\n return ch;\n }\n return null;\n }\n function takeIdentifierChar(scnr) {\n const closure = (ch) => {\n const cc = ch.charCodeAt(0);\n return ((cc >= 97 && cc <= 122) || // a-z\n (cc >= 65 && cc <= 90) || // A-Z\n (cc >= 48 && cc <= 57) || // 0-9\n cc === 95 || // _\n cc === 36 // $\n );\n };\n return takeChar(scnr, closure);\n }\n function takeDigit(scnr) {\n const closure = (ch) => {\n const cc = ch.charCodeAt(0);\n return cc >= 48 && cc <= 57; // 0-9\n };\n return takeChar(scnr, closure);\n }\n function takeHexDigit(scnr) {\n const closure = (ch) => {\n const cc = ch.charCodeAt(0);\n return ((cc >= 48 && cc <= 57) || // 0-9\n (cc >= 65 && cc <= 70) || // A-F\n (cc >= 97 && cc <= 102)); // a-f\n };\n return takeChar(scnr, closure);\n }\n function getDigits(scnr) {\n let ch = '';\n let num = '';\n while ((ch = takeDigit(scnr))) {\n num += ch;\n }\n return num;\n }\n function readModulo(scnr) {\n skipSpaces(scnr);\n const ch = scnr.currentChar();\n if (ch !== \"%\" /* TokenChars.Modulo */) {\n emitError(CompileErrorCodes.EXPECTED_TOKEN, currentPosition(), 0, ch);\n }\n scnr.next();\n return \"%\" /* TokenChars.Modulo */;\n }\n function readText(scnr) {\n let buf = '';\n while (true) {\n const ch = scnr.currentChar();\n if (ch === \"{\" /* TokenChars.BraceLeft */ ||\n ch === \"}\" /* TokenChars.BraceRight */ ||\n ch === \"@\" /* TokenChars.LinkedAlias */ ||\n ch === \"|\" /* TokenChars.Pipe */ ||\n !ch) {\n break;\n }\n else if (ch === \"%\" /* TokenChars.Modulo */) {\n if (isTextStart(scnr)) {\n buf += ch;\n scnr.next();\n }\n else {\n break;\n }\n }\n else if (ch === CHAR_SP || ch === CHAR_LF) {\n if (isTextStart(scnr)) {\n buf += ch;\n scnr.next();\n }\n else if (isPluralStart(scnr)) {\n break;\n }\n else {\n buf += ch;\n scnr.next();\n }\n }\n else {\n buf += ch;\n scnr.next();\n }\n }\n return buf;\n }\n function readNamedIdentifier(scnr) {\n skipSpaces(scnr);\n let ch = '';\n let name = '';\n while ((ch = takeIdentifierChar(scnr))) {\n name += ch;\n }\n if (scnr.currentChar() === EOF) {\n emitError(CompileErrorCodes.UNTERMINATED_CLOSING_BRACE, currentPosition(), 0);\n }\n return name;\n }\n function readListIdentifier(scnr) {\n skipSpaces(scnr);\n let value = '';\n if (scnr.currentChar() === '-') {\n scnr.next();\n value += `-${getDigits(scnr)}`;\n }\n else {\n value += getDigits(scnr);\n }\n if (scnr.currentChar() === EOF) {\n emitError(CompileErrorCodes.UNTERMINATED_CLOSING_BRACE, currentPosition(), 0);\n }\n return value;\n }\n function readLiteral(scnr) {\n skipSpaces(scnr);\n eat(scnr, `\\'`);\n let ch = '';\n let literal = '';\n const fn = (x) => x !== LITERAL_DELIMITER && x !== CHAR_LF;\n while ((ch = takeChar(scnr, fn))) {\n if (ch === '\\\\') {\n literal += readEscapeSequence(scnr);\n }\n else {\n literal += ch;\n }\n }\n const current = scnr.currentChar();\n if (current === CHAR_LF || current === EOF) {\n emitError(CompileErrorCodes.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER, currentPosition(), 0);\n // TODO: Is it correct really?\n if (current === CHAR_LF) {\n scnr.next();\n eat(scnr, `\\'`);\n }\n return literal;\n }\n eat(scnr, `\\'`);\n return literal;\n }\n function readEscapeSequence(scnr) {\n const ch = scnr.currentChar();\n switch (ch) {\n case '\\\\':\n case `\\'`:\n scnr.next();\n return `\\\\${ch}`;\n case 'u':\n return readUnicodeEscapeSequence(scnr, ch, 4);\n case 'U':\n return readUnicodeEscapeSequence(scnr, ch, 6);\n default:\n emitError(CompileErrorCodes.UNKNOWN_ESCAPE_SEQUENCE, currentPosition(), 0, ch);\n return '';\n }\n }\n function readUnicodeEscapeSequence(scnr, unicode, digits) {\n eat(scnr, unicode);\n let sequence = '';\n for (let i = 0; i < digits; i++) {\n const ch = takeHexDigit(scnr);\n if (!ch) {\n emitError(CompileErrorCodes.INVALID_UNICODE_ESCAPE_SEQUENCE, currentPosition(), 0, `\\\\${unicode}${sequence}${scnr.currentChar()}`);\n break;\n }\n sequence += ch;\n }\n return `\\\\${unicode}${sequence}`;\n }\n function readInvalidIdentifier(scnr) {\n skipSpaces(scnr);\n let ch = '';\n let identifiers = '';\n const closure = (ch) => ch !== \"{\" /* TokenChars.BraceLeft */ &&\n ch !== \"}\" /* TokenChars.BraceRight */ &&\n ch !== CHAR_SP &&\n ch !== CHAR_LF;\n while ((ch = takeChar(scnr, closure))) {\n identifiers += ch;\n }\n return identifiers;\n }\n function readLinkedModifier(scnr) {\n let ch = '';\n let name = '';\n while ((ch = takeIdentifierChar(scnr))) {\n name += ch;\n }\n return name;\n }\n function readLinkedRefer(scnr) {\n const fn = (detect = false, buf) => {\n const ch = scnr.currentChar();\n if (ch === \"{\" /* TokenChars.BraceLeft */ ||\n ch === \"%\" /* TokenChars.Modulo */ ||\n ch === \"@\" /* TokenChars.LinkedAlias */ ||\n ch === \"|\" /* TokenChars.Pipe */ ||\n ch === \"(\" /* TokenChars.ParenLeft */ ||\n ch === \")\" /* TokenChars.ParenRight */ ||\n !ch) {\n return buf;\n }\n else if (ch === CHAR_SP) {\n return buf;\n }\n else if (ch === CHAR_LF || ch === DOT) {\n buf += ch;\n scnr.next();\n return fn(detect, buf);\n }\n else {\n buf += ch;\n scnr.next();\n return fn(true, buf);\n }\n };\n return fn(false, '');\n }\n function readPlural(scnr) {\n skipSpaces(scnr);\n const plural = eat(scnr, \"|\" /* TokenChars.Pipe */);\n skipSpaces(scnr);\n return plural;\n }\n // TODO: We need refactoring of token parsing ...\n function readTokenInPlaceholder(scnr, context) {\n let token = null;\n const ch = scnr.currentChar();\n switch (ch) {\n case \"{\" /* TokenChars.BraceLeft */:\n if (context.braceNest >= 1) {\n emitError(CompileErrorCodes.NOT_ALLOW_NEST_PLACEHOLDER, currentPosition(), 0);\n }\n scnr.next();\n token = getToken(context, 2 /* TokenTypes.BraceLeft */, \"{\" /* TokenChars.BraceLeft */);\n skipSpaces(scnr);\n context.braceNest++;\n return token;\n case \"}\" /* TokenChars.BraceRight */:\n if (context.braceNest > 0 &&\n context.currentType === 2 /* TokenTypes.BraceLeft */) {\n emitError(CompileErrorCodes.EMPTY_PLACEHOLDER, currentPosition(), 0);\n }\n scnr.next();\n token = getToken(context, 3 /* TokenTypes.BraceRight */, \"}\" /* TokenChars.BraceRight */);\n context.braceNest--;\n context.braceNest > 0 && skipSpaces(scnr);\n if (context.inLinked && context.braceNest === 0) {\n context.inLinked = false;\n }\n return token;\n case \"@\" /* TokenChars.LinkedAlias */:\n if (context.braceNest > 0) {\n emitError(CompileErrorCodes.UNTERMINATED_CLOSING_BRACE, currentPosition(), 0);\n }\n token = readTokenInLinked(scnr, context) || getEndToken(context);\n context.braceNest = 0;\n return token;\n default:\n let validNamedIdentifier = true;\n let validListIdentifier = true;\n let validLiteral = true;\n if (isPluralStart(scnr)) {\n if (context.braceNest > 0) {\n emitError(CompileErrorCodes.UNTERMINATED_CLOSING_BRACE, currentPosition(), 0);\n }\n token = getToken(context, 1 /* TokenTypes.Pipe */, readPlural(scnr));\n // reset\n context.braceNest = 0;\n context.inLinked = false;\n return token;\n }\n if (context.braceNest > 0 &&\n (context.currentType === 5 /* TokenTypes.Named */ ||\n context.currentType === 6 /* TokenTypes.List */ ||\n context.currentType === 7 /* TokenTypes.Literal */)) {\n emitError(CompileErrorCodes.UNTERMINATED_CLOSING_BRACE, currentPosition(), 0);\n context.braceNest = 0;\n return readToken(scnr, context);\n }\n if ((validNamedIdentifier = isNamedIdentifierStart(scnr, context))) {\n token = getToken(context, 5 /* TokenTypes.Named */, readNamedIdentifier(scnr));\n skipSpaces(scnr);\n return token;\n }\n if ((validListIdentifier = isListIdentifierStart(scnr, context))) {\n token = getToken(context, 6 /* TokenTypes.List */, readListIdentifier(scnr));\n skipSpaces(scnr);\n return token;\n }\n if ((validLiteral = isLiteralStart(scnr, context))) {\n token = getToken(context, 7 /* TokenTypes.Literal */, readLiteral(scnr));\n skipSpaces(scnr);\n return token;\n }\n if (!validNamedIdentifier && !validListIdentifier && !validLiteral) {\n // TODO: we should be re-designed invalid cases, when we will extend message syntax near the future ...\n token = getToken(context, 13 /* TokenTypes.InvalidPlace */, readInvalidIdentifier(scnr));\n emitError(CompileErrorCodes.INVALID_TOKEN_IN_PLACEHOLDER, currentPosition(), 0, token.value);\n skipSpaces(scnr);\n return token;\n }\n break;\n }\n return token;\n }\n // TODO: We need refactoring of token parsing ...\n function readTokenInLinked(scnr, context) {\n const { currentType } = context;\n let token = null;\n const ch = scnr.currentChar();\n if ((currentType === 8 /* TokenTypes.LinkedAlias */ ||\n currentType === 9 /* TokenTypes.LinkedDot */ ||\n currentType === 12 /* TokenTypes.LinkedModifier */ ||\n currentType === 10 /* TokenTypes.LinkedDelimiter */) &&\n (ch === CHAR_LF || ch === CHAR_SP)) {\n emitError(CompileErrorCodes.INVALID_LINKED_FORMAT, currentPosition(), 0);\n }\n switch (ch) {\n case \"@\" /* TokenChars.LinkedAlias */:\n scnr.next();\n token = getToken(context, 8 /* TokenTypes.LinkedAlias */, \"@\" /* TokenChars.LinkedAlias */);\n context.inLinked = true;\n return token;\n case \".\" /* TokenChars.LinkedDot */:\n skipSpaces(scnr);\n scnr.next();\n return getToken(context, 9 /* TokenTypes.LinkedDot */, \".\" /* TokenChars.LinkedDot */);\n case \":\" /* TokenChars.LinkedDelimiter */:\n skipSpaces(scnr);\n scnr.next();\n return getToken(context, 10 /* TokenTypes.LinkedDelimiter */, \":\" /* TokenChars.LinkedDelimiter */);\n default:\n if (isPluralStart(scnr)) {\n token = getToken(context, 1 /* TokenTypes.Pipe */, readPlural(scnr));\n // reset\n context.braceNest = 0;\n context.inLinked = false;\n return token;\n }\n if (isLinkedDotStart(scnr, context) ||\n isLinkedDelimiterStart(scnr, context)) {\n skipSpaces(scnr);\n return readTokenInLinked(scnr, context);\n }\n if (isLinkedModifierStart(scnr, context)) {\n skipSpaces(scnr);\n return getToken(context, 12 /* TokenTypes.LinkedModifier */, readLinkedModifier(scnr));\n }\n if (isLinkedReferStart(scnr, context)) {\n skipSpaces(scnr);\n if (ch === \"{\" /* TokenChars.BraceLeft */) {\n // scan the placeholder\n return readTokenInPlaceholder(scnr, context) || token;\n }\n else {\n return getToken(context, 11 /* TokenTypes.LinkedKey */, readLinkedRefer(scnr));\n }\n }\n if (currentType === 8 /* TokenTypes.LinkedAlias */) {\n emitError(CompileErrorCodes.INVALID_LINKED_FORMAT, currentPosition(), 0);\n }\n context.braceNest = 0;\n context.inLinked = false;\n return readToken(scnr, context);\n }\n }\n // TODO: We need refactoring of token parsing ...\n function readToken(scnr, context) {\n let token = { type: 14 /* TokenTypes.EOF */ };\n if (context.braceNest > 0) {\n return readTokenInPlaceholder(scnr, context) || getEndToken(context);\n }\n if (context.inLinked) {\n return readTokenInLinked(scnr, context) || getEndToken(context);\n }\n const ch = scnr.currentChar();\n switch (ch) {\n case \"{\" /* TokenChars.BraceLeft */:\n return readTokenInPlaceholder(scnr, context) || getEndToken(context);\n case \"}\" /* TokenChars.BraceRight */:\n emitError(CompileErrorCodes.UNBALANCED_CLOSING_BRACE, currentPosition(), 0);\n scnr.next();\n return getToken(context, 3 /* TokenTypes.BraceRight */, \"}\" /* TokenChars.BraceRight */);\n case \"@\" /* TokenChars.LinkedAlias */:\n return readTokenInLinked(scnr, context) || getEndToken(context);\n default:\n if (isPluralStart(scnr)) {\n token = getToken(context, 1 /* TokenTypes.Pipe */, readPlural(scnr));\n // reset\n context.braceNest = 0;\n context.inLinked = false;\n return token;\n }\n const { isModulo, hasSpace } = detectModuloStart(scnr);\n if (isModulo) {\n return hasSpace\n ? getToken(context, 0 /* TokenTypes.Text */, readText(scnr))\n : getToken(context, 4 /* TokenTypes.Modulo */, readModulo(scnr));\n }\n if (isTextStart(scnr)) {\n return getToken(context, 0 /* TokenTypes.Text */, readText(scnr));\n }\n break;\n }\n return token;\n }\n function nextToken() {\n const { currentType, offset, startLoc, endLoc } = _context;\n _context.lastType = currentType;\n _context.lastOffset = offset;\n _context.lastStartLoc = startLoc;\n _context.lastEndLoc = endLoc;\n _context.offset = currentOffset();\n _context.startLoc = currentPosition();\n if (_scnr.currentChar() === EOF) {\n return getToken(_context, 14 /* TokenTypes.EOF */);\n }\n return readToken(_scnr, _context);\n }\n return {\n nextToken,\n currentOffset,\n currentPosition,\n context\n };\n}\n\nconst ERROR_DOMAIN$2 = 'parser';\n// Backslash backslash, backslash quote, uHHHH, UHHHHHH.\nconst KNOWN_ESCAPES = /(?:\\\\\\\\|\\\\'|\\\\u([0-9a-fA-F]{4})|\\\\U([0-9a-fA-F]{6}))/g;\nfunction fromEscapeSequence(match, codePoint4, codePoint6) {\n switch (match) {\n case `\\\\\\\\`:\n return `\\\\`;\n case `\\\\\\'`:\n return `\\'`;\n default: {\n const codePoint = parseInt(codePoint4 || codePoint6, 16);\n if (codePoint <= 0xd7ff || codePoint >= 0xe000) {\n return String.fromCodePoint(codePoint);\n }\n // invalid ...\n // Replace them with U+FFFD REPLACEMENT CHARACTER.\n return '�';\n }\n }\n}\nfunction createParser(options = {}) {\n const location = options.location !== false;\n const { onError } = options;\n function emitError(tokenzer, code, start, offset, ...args) {\n const end = tokenzer.currentPosition();\n end.offset += offset;\n end.column += offset;\n if (onError) {\n const loc = location ? createLocation(start, end) : null;\n const err = createCompileError(code, loc, {\n domain: ERROR_DOMAIN$2,\n args\n });\n onError(err);\n }\n }\n function startNode(type, offset, loc) {\n const node = { type };\n if (location) {\n node.start = offset;\n node.end = offset;\n node.loc = { start: loc, end: loc };\n }\n return node;\n }\n function endNode(node, offset, pos, type) {\n if (type) {\n node.type = type;\n }\n if (location) {\n node.end = offset;\n if (node.loc) {\n node.loc.end = pos;\n }\n }\n }\n function parseText(tokenizer, value) {\n const context = tokenizer.context();\n const node = startNode(3 /* NodeTypes.Text */, context.offset, context.startLoc);\n node.value = value;\n endNode(node, tokenizer.currentOffset(), tokenizer.currentPosition());\n return node;\n }\n function parseList(tokenizer, index) {\n const context = tokenizer.context();\n const { lastOffset: offset, lastStartLoc: loc } = context; // get brace left loc\n const node = startNode(5 /* NodeTypes.List */, offset, loc);\n node.index = parseInt(index, 10);\n tokenizer.nextToken(); // skip brach right\n endNode(node, tokenizer.currentOffset(), tokenizer.currentPosition());\n return node;\n }\n function parseNamed(tokenizer, key) {\n const context = tokenizer.context();\n const { lastOffset: offset, lastStartLoc: loc } = context; // get brace left loc\n const node = startNode(4 /* NodeTypes.Named */, offset, loc);\n node.key = key;\n tokenizer.nextToken(); // skip brach right\n endNode(node, tokenizer.currentOffset(), tokenizer.currentPosition());\n return node;\n }\n function parseLiteral(tokenizer, value) {\n const context = tokenizer.context();\n const { lastOffset: offset, lastStartLoc: loc } = context; // get brace left loc\n const node = startNode(9 /* NodeTypes.Literal */, offset, loc);\n node.value = value.replace(KNOWN_ESCAPES, fromEscapeSequence);\n tokenizer.nextToken(); // skip brach right\n endNode(node, tokenizer.currentOffset(), tokenizer.currentPosition());\n return node;\n }\n function parseLinkedModifier(tokenizer) {\n const token = tokenizer.nextToken();\n const context = tokenizer.context();\n const { lastOffset: offset, lastStartLoc: loc } = context; // get linked dot loc\n const node = startNode(8 /* NodeTypes.LinkedModifier */, offset, loc);\n if (token.type !== 12 /* TokenTypes.LinkedModifier */) {\n // empty modifier\n emitError(tokenizer, CompileErrorCodes.UNEXPECTED_EMPTY_LINKED_MODIFIER, context.lastStartLoc, 0);\n node.value = '';\n endNode(node, offset, loc);\n return {\n nextConsumeToken: token,\n node\n };\n }\n // check token\n if (token.value == null) {\n emitError(tokenizer, CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS, context.lastStartLoc, 0, getTokenCaption(token));\n }\n node.value = token.value || '';\n endNode(node, tokenizer.currentOffset(), tokenizer.currentPosition());\n return {\n node\n };\n }\n function parseLinkedKey(tokenizer, value) {\n const context = tokenizer.context();\n const node = startNode(7 /* NodeTypes.LinkedKey */, context.offset, context.startLoc);\n node.value = value;\n endNode(node, tokenizer.currentOffset(), tokenizer.currentPosition());\n return node;\n }\n function parseLinked(tokenizer) {\n const context = tokenizer.context();\n const linkedNode = startNode(6 /* NodeTypes.Linked */, context.offset, context.startLoc);\n let token = tokenizer.nextToken();\n if (token.type === 9 /* TokenTypes.LinkedDot */) {\n const parsed = parseLinkedModifier(tokenizer);\n linkedNode.modifier = parsed.node;\n token = parsed.nextConsumeToken || tokenizer.nextToken();\n }\n // asset check token\n if (token.type !== 10 /* TokenTypes.LinkedDelimiter */) {\n emitError(tokenizer, CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS, context.lastStartLoc, 0, getTokenCaption(token));\n }\n token = tokenizer.nextToken();\n // skip brace left\n if (token.type === 2 /* TokenTypes.BraceLeft */) {\n token = tokenizer.nextToken();\n }\n switch (token.type) {\n case 11 /* TokenTypes.LinkedKey */:\n if (token.value == null) {\n emitError(tokenizer, CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS, context.lastStartLoc, 0, getTokenCaption(token));\n }\n linkedNode.key = parseLinkedKey(tokenizer, token.value || '');\n break;\n case 5 /* TokenTypes.Named */:\n if (token.value == null) {\n emitError(tokenizer, CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS, context.lastStartLoc, 0, getTokenCaption(token));\n }\n linkedNode.key = parseNamed(tokenizer, token.value || '');\n break;\n case 6 /* TokenTypes.List */:\n if (token.value == null) {\n emitError(tokenizer, CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS, context.lastStartLoc, 0, getTokenCaption(token));\n }\n linkedNode.key = parseList(tokenizer, token.value || '');\n break;\n case 7 /* TokenTypes.Literal */:\n if (token.value == null) {\n emitError(tokenizer, CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS, context.lastStartLoc, 0, getTokenCaption(token));\n }\n linkedNode.key = parseLiteral(tokenizer, token.value || '');\n break;\n default:\n // empty key\n emitError(tokenizer, CompileErrorCodes.UNEXPECTED_EMPTY_LINKED_KEY, context.lastStartLoc, 0);\n const nextContext = tokenizer.context();\n const emptyLinkedKeyNode = startNode(7 /* NodeTypes.LinkedKey */, nextContext.offset, nextContext.startLoc);\n emptyLinkedKeyNode.value = '';\n endNode(emptyLinkedKeyNode, nextContext.offset, nextContext.startLoc);\n linkedNode.key = emptyLinkedKeyNode;\n endNode(linkedNode, nextContext.offset, nextContext.startLoc);\n return {\n nextConsumeToken: token,\n node: linkedNode\n };\n }\n endNode(linkedNode, tokenizer.currentOffset(), tokenizer.currentPosition());\n return {\n node: linkedNode\n };\n }\n function parseMessage(tokenizer) {\n const context = tokenizer.context();\n const startOffset = context.currentType === 1 /* TokenTypes.Pipe */\n ? tokenizer.currentOffset()\n : context.offset;\n const startLoc = context.currentType === 1 /* TokenTypes.Pipe */\n ? context.endLoc\n : context.startLoc;\n const node = startNode(2 /* NodeTypes.Message */, startOffset, startLoc);\n node.items = [];\n let nextToken = null;\n do {\n const token = nextToken || tokenizer.nextToken();\n nextToken = null;\n switch (token.type) {\n case 0 /* TokenTypes.Text */:\n if (token.value == null) {\n emitError(tokenizer, CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS, context.lastStartLoc, 0, getTokenCaption(token));\n }\n node.items.push(parseText(tokenizer, token.value || ''));\n break;\n case 6 /* TokenTypes.List */:\n if (token.value == null) {\n emitError(tokenizer, CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS, context.lastStartLoc, 0, getTokenCaption(token));\n }\n node.items.push(parseList(tokenizer, token.value || ''));\n break;\n case 5 /* TokenTypes.Named */:\n if (token.value == null) {\n emitError(tokenizer, CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS, context.lastStartLoc, 0, getTokenCaption(token));\n }\n node.items.push(parseNamed(tokenizer, token.value || ''));\n break;\n case 7 /* TokenTypes.Literal */:\n if (token.value == null) {\n emitError(tokenizer, CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS, context.lastStartLoc, 0, getTokenCaption(token));\n }\n node.items.push(parseLiteral(tokenizer, token.value || ''));\n break;\n case 8 /* TokenTypes.LinkedAlias */:\n const parsed = parseLinked(tokenizer);\n node.items.push(parsed.node);\n nextToken = parsed.nextConsumeToken || null;\n break;\n }\n } while (context.currentType !== 14 /* TokenTypes.EOF */ &&\n context.currentType !== 1 /* TokenTypes.Pipe */);\n // adjust message node loc\n const endOffset = context.currentType === 1 /* TokenTypes.Pipe */\n ? context.lastOffset\n : tokenizer.currentOffset();\n const endLoc = context.currentType === 1 /* TokenTypes.Pipe */\n ? context.lastEndLoc\n : tokenizer.currentPosition();\n endNode(node, endOffset, endLoc);\n return node;\n }\n function parsePlural(tokenizer, offset, loc, msgNode) {\n const context = tokenizer.context();\n let hasEmptyMessage = msgNode.items.length === 0;\n const node = startNode(1 /* NodeTypes.Plural */, offset, loc);\n node.cases = [];\n node.cases.push(msgNode);\n do {\n const msg = parseMessage(tokenizer);\n if (!hasEmptyMessage) {\n hasEmptyMessage = msg.items.length === 0;\n }\n node.cases.push(msg);\n } while (context.currentType !== 14 /* TokenTypes.EOF */);\n if (hasEmptyMessage) {\n emitError(tokenizer, CompileErrorCodes.MUST_HAVE_MESSAGES_IN_PLURAL, loc, 0);\n }\n endNode(node, tokenizer.currentOffset(), tokenizer.currentPosition());\n return node;\n }\n function parseResource(tokenizer) {\n const context = tokenizer.context();\n const { offset, startLoc } = context;\n const msgNode = parseMessage(tokenizer);\n if (context.currentType === 14 /* TokenTypes.EOF */) {\n return msgNode;\n }\n else {\n return parsePlural(tokenizer, offset, startLoc, msgNode);\n }\n }\n function parse(source) {\n const tokenizer = createTokenizer(source, assign({}, options));\n const context = tokenizer.context();\n const node = startNode(0 /* NodeTypes.Resource */, context.offset, context.startLoc);\n if (location && node.loc) {\n node.loc.source = source;\n }\n node.body = parseResource(tokenizer);\n if (options.onCacheKey) {\n node.cacheKey = options.onCacheKey(source);\n }\n // assert whether achieved to EOF\n if (context.currentType !== 14 /* TokenTypes.EOF */) {\n emitError(tokenizer, CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS, context.lastStartLoc, 0, source[context.offset] || '');\n }\n endNode(node, tokenizer.currentOffset(), tokenizer.currentPosition());\n return node;\n }\n return { parse };\n}\nfunction getTokenCaption(token) {\n if (token.type === 14 /* TokenTypes.EOF */) {\n return 'EOF';\n }\n const name = (token.value || '').replace(/\\r?\\n/gu, '\\\\n');\n return name.length > 10 ? name.slice(0, 9) + '…' : name;\n}\n\nfunction createTransformer(ast, options = {} // eslint-disable-line\n) {\n const _context = {\n ast,\n helpers: new Set()\n };\n const context = () => _context;\n const helper = (name) => {\n _context.helpers.add(name);\n return name;\n };\n return { context, helper };\n}\nfunction traverseNodes(nodes, transformer) {\n for (let i = 0; i < nodes.length; i++) {\n traverseNode(nodes[i], transformer);\n }\n}\nfunction traverseNode(node, transformer) {\n // TODO: if we need pre-hook of transform, should be implemented to here\n switch (node.type) {\n case 1 /* NodeTypes.Plural */:\n traverseNodes(node.cases, transformer);\n transformer.helper(\"plural\" /* HelperNameMap.PLURAL */);\n break;\n case 2 /* NodeTypes.Message */:\n traverseNodes(node.items, transformer);\n break;\n case 6 /* NodeTypes.Linked */:\n const linked = node;\n traverseNode(linked.key, transformer);\n transformer.helper(\"linked\" /* HelperNameMap.LINKED */);\n transformer.helper(\"type\" /* HelperNameMap.TYPE */);\n break;\n case 5 /* NodeTypes.List */:\n transformer.helper(\"interpolate\" /* HelperNameMap.INTERPOLATE */);\n transformer.helper(\"list\" /* HelperNameMap.LIST */);\n break;\n case 4 /* NodeTypes.Named */:\n transformer.helper(\"interpolate\" /* HelperNameMap.INTERPOLATE */);\n transformer.helper(\"named\" /* HelperNameMap.NAMED */);\n break;\n }\n // TODO: if we need post-hook of transform, should be implemented to here\n}\n// transform AST\nfunction transform(ast, options = {} // eslint-disable-line\n) {\n const transformer = createTransformer(ast);\n transformer.helper(\"normalize\" /* HelperNameMap.NORMALIZE */);\n // traverse\n ast.body && traverseNode(ast.body, transformer);\n // set meta information\n const context = transformer.context();\n ast.helpers = Array.from(context.helpers);\n}\n\nfunction optimize(ast) {\n const body = ast.body;\n if (body.type === 2 /* NodeTypes.Message */) {\n optimizeMessageNode(body);\n }\n else {\n body.cases.forEach(c => optimizeMessageNode(c));\n }\n return ast;\n}\nfunction optimizeMessageNode(message) {\n if (message.items.length === 1) {\n const item = message.items[0];\n if (item.type === 3 /* NodeTypes.Text */ || item.type === 9 /* NodeTypes.Literal */) {\n message.static = item.value;\n delete item.value; // optimization for size\n }\n }\n else {\n const values = [];\n for (let i = 0; i < message.items.length; i++) {\n const item = message.items[i];\n if (!(item.type === 3 /* NodeTypes.Text */ || item.type === 9 /* NodeTypes.Literal */)) {\n break;\n }\n if (item.value == null) {\n break;\n }\n values.push(item.value);\n }\n if (values.length === message.items.length) {\n message.static = join(values);\n for (let i = 0; i < message.items.length; i++) {\n const item = message.items[i];\n if (item.type === 3 /* NodeTypes.Text */ || item.type === 9 /* NodeTypes.Literal */) {\n delete item.value; // optimization for size\n }\n }\n }\n }\n}\n\nconst ERROR_DOMAIN$1 = 'minifier';\n/* eslint-disable @typescript-eslint/no-explicit-any */\nfunction minify(node) {\n node.t = node.type;\n switch (node.type) {\n case 0 /* NodeTypes.Resource */:\n const resource = node;\n minify(resource.body);\n resource.b = resource.body;\n delete resource.body;\n break;\n case 1 /* NodeTypes.Plural */:\n const plural = node;\n const cases = plural.cases;\n for (let i = 0; i < cases.length; i++) {\n minify(cases[i]);\n }\n plural.c = cases;\n delete plural.cases;\n break;\n case 2 /* NodeTypes.Message */:\n const message = node;\n const items = message.items;\n for (let i = 0; i < items.length; i++) {\n minify(items[i]);\n }\n message.i = items;\n delete message.items;\n if (message.static) {\n message.s = message.static;\n delete message.static;\n }\n break;\n case 3 /* NodeTypes.Text */:\n case 9 /* NodeTypes.Literal */:\n case 8 /* NodeTypes.LinkedModifier */:\n case 7 /* NodeTypes.LinkedKey */:\n const valueNode = node;\n if (valueNode.value) {\n valueNode.v = valueNode.value;\n delete valueNode.value;\n }\n break;\n case 6 /* NodeTypes.Linked */:\n const linked = node;\n minify(linked.key);\n linked.k = linked.key;\n delete linked.key;\n if (linked.modifier) {\n minify(linked.modifier);\n linked.m = linked.modifier;\n delete linked.modifier;\n }\n break;\n case 5 /* NodeTypes.List */:\n const list = node;\n list.i = list.index;\n delete list.index;\n break;\n case 4 /* NodeTypes.Named */:\n const named = node;\n named.k = named.key;\n delete named.key;\n break;\n default:\n {\n throw createCompileError(CompileErrorCodes.UNHANDLED_MINIFIER_NODE_TYPE, null, {\n domain: ERROR_DOMAIN$1,\n args: [node.type]\n });\n }\n }\n delete node.type;\n}\n/* eslint-enable @typescript-eslint/no-explicit-any */\n\nconst ERROR_DOMAIN = 'parser';\nfunction createCodeGenerator(ast, options) {\n const { sourceMap, filename, breakLineCode, needIndent: _needIndent } = options;\n const location = options.location !== false;\n const _context = {\n filename,\n code: '',\n column: 1,\n line: 1,\n offset: 0,\n map: undefined,\n breakLineCode,\n needIndent: _needIndent,\n indentLevel: 0\n };\n if (location && ast.loc) {\n _context.source = ast.loc.source;\n }\n const context = () => _context;\n function push(code, node) {\n _context.code += code;\n }\n function _newline(n, withBreakLine = true) {\n const _breakLineCode = withBreakLine ? breakLineCode : '';\n push(_needIndent ? _breakLineCode + ` `.repeat(n) : _breakLineCode);\n }\n function indent(withNewLine = true) {\n const level = ++_context.indentLevel;\n withNewLine && _newline(level);\n }\n function deindent(withNewLine = true) {\n const level = --_context.indentLevel;\n withNewLine && _newline(level);\n }\n function newline() {\n _newline(_context.indentLevel);\n }\n const helper = (key) => `_${key}`;\n const needIndent = () => _context.needIndent;\n return {\n context,\n push,\n indent,\n deindent,\n newline,\n helper,\n needIndent\n };\n}\nfunction generateLinkedNode(generator, node) {\n const { helper } = generator;\n generator.push(`${helper(\"linked\" /* HelperNameMap.LINKED */)}(`);\n generateNode(generator, node.key);\n if (node.modifier) {\n generator.push(`, `);\n generateNode(generator, node.modifier);\n generator.push(`, _type`);\n }\n else {\n generator.push(`, undefined, _type`);\n }\n generator.push(`)`);\n}\nfunction generateMessageNode(generator, node) {\n const { helper, needIndent } = generator;\n generator.push(`${helper(\"normalize\" /* HelperNameMap.NORMALIZE */)}([`);\n generator.indent(needIndent());\n const length = node.items.length;\n for (let i = 0; i < length; i++) {\n generateNode(generator, node.items[i]);\n if (i === length - 1) {\n break;\n }\n generator.push(', ');\n }\n generator.deindent(needIndent());\n generator.push('])');\n}\nfunction generatePluralNode(generator, node) {\n const { helper, needIndent } = generator;\n if (node.cases.length > 1) {\n generator.push(`${helper(\"plural\" /* HelperNameMap.PLURAL */)}([`);\n generator.indent(needIndent());\n const length = node.cases.length;\n for (let i = 0; i < length; i++) {\n generateNode(generator, node.cases[i]);\n if (i === length - 1) {\n break;\n }\n generator.push(', ');\n }\n generator.deindent(needIndent());\n generator.push(`])`);\n }\n}\nfunction generateResource(generator, node) {\n if (node.body) {\n generateNode(generator, node.body);\n }\n else {\n generator.push('null');\n }\n}\nfunction generateNode(generator, node) {\n const { helper } = generator;\n switch (node.type) {\n case 0 /* NodeTypes.Resource */:\n generateResource(generator, node);\n break;\n case 1 /* NodeTypes.Plural */:\n generatePluralNode(generator, node);\n break;\n case 2 /* NodeTypes.Message */:\n generateMessageNode(generator, node);\n break;\n case 6 /* NodeTypes.Linked */:\n generateLinkedNode(generator, node);\n break;\n case 8 /* NodeTypes.LinkedModifier */:\n generator.push(JSON.stringify(node.value), node);\n break;\n case 7 /* NodeTypes.LinkedKey */:\n generator.push(JSON.stringify(node.value), node);\n break;\n case 5 /* NodeTypes.List */:\n generator.push(`${helper(\"interpolate\" /* HelperNameMap.INTERPOLATE */)}(${helper(\"list\" /* HelperNameMap.LIST */)}(${node.index}))`, node);\n break;\n case 4 /* NodeTypes.Named */:\n generator.push(`${helper(\"interpolate\" /* HelperNameMap.INTERPOLATE */)}(${helper(\"named\" /* HelperNameMap.NAMED */)}(${JSON.stringify(node.key)}))`, node);\n break;\n case 9 /* NodeTypes.Literal */:\n generator.push(JSON.stringify(node.value), node);\n break;\n case 3 /* NodeTypes.Text */:\n generator.push(JSON.stringify(node.value), node);\n break;\n default:\n {\n throw createCompileError(CompileErrorCodes.UNHANDLED_CODEGEN_NODE_TYPE, null, {\n domain: ERROR_DOMAIN,\n args: [node.type]\n });\n }\n }\n}\n// generate code from AST\nconst generate = (ast, options = {} // eslint-disable-line\n) => {\n const mode = isString(options.mode) ? options.mode : 'normal';\n const filename = isString(options.filename)\n ? options.filename\n : 'message.intl';\n const sourceMap = !!options.sourceMap;\n // prettier-ignore\n const breakLineCode = options.breakLineCode != null\n ? options.breakLineCode\n : mode === 'arrow'\n ? ';'\n : '\\n';\n const needIndent = options.needIndent ? options.needIndent : mode !== 'arrow';\n const helpers = ast.helpers || [];\n const generator = createCodeGenerator(ast, {\n mode,\n filename,\n sourceMap,\n breakLineCode,\n needIndent\n });\n generator.push(mode === 'normal' ? `function __msg__ (ctx) {` : `(ctx) => {`);\n generator.indent(needIndent);\n if (helpers.length > 0) {\n generator.push(`const { ${join(helpers.map(s => `${s}: _${s}`), ', ')} } = ctx`);\n generator.newline();\n }\n generator.push(`return `);\n generateNode(generator, ast);\n generator.deindent(needIndent);\n generator.push(`}`);\n delete ast.helpers;\n const { code, map } = generator.context();\n return {\n ast,\n code,\n map: map ? map.toJSON() : undefined // eslint-disable-line @typescript-eslint/no-explicit-any\n };\n};\n\nfunction baseCompile(source, options = {}) {\n const assignedOptions = assign({}, options);\n const jit = !!assignedOptions.jit;\n const enalbeMinify = !!assignedOptions.minify;\n const enambeOptimize = assignedOptions.optimize == null ? true : assignedOptions.optimize;\n // parse source codes\n const parser = createParser(assignedOptions);\n const ast = parser.parse(source);\n if (!jit) {\n // transform ASTs\n transform(ast, assignedOptions);\n // generate javascript codes\n return generate(ast, assignedOptions);\n }\n else {\n // optimize ASTs\n enambeOptimize && optimize(ast);\n // minimize ASTs\n enalbeMinify && minify(ast);\n // In JIT mode, no ast transform, no code generation.\n return { ast, code: '' };\n }\n}\n\nexport { CompileErrorCodes, ERROR_DOMAIN$2 as ERROR_DOMAIN, LOCATION_STUB, baseCompile, createCompileError, createLocation, createParser, createPosition, defaultOnError, detectHtmlTag, errorMessages };\n","/*!\n * core-base v9.4.1\n * (c) 2023 kazuya kawaguchi\n * Released under the MIT License.\n */\nimport { getGlobalThis, isObject, isString, isFunction, isNumber, isPlainObject, assign, join, toDisplayString, isArray, format as format$1, isBoolean, warn, isRegExp, warnOnce, incrementer, escapeHtml, inBrowser, mark, measure, isEmptyObject, generateCodeFrame, generateFormatCacheKey, isDate } from '@intlify/shared';\nimport { CompileErrorCodes, createCompileError, detectHtmlTag, defaultOnError, baseCompile as baseCompile$1 } from '@intlify/message-compiler';\nexport { CompileErrorCodes, createCompileError } from '@intlify/message-compiler';\n\n/**\n * This is only called in esm-bundler builds.\n * istanbul-ignore-next\n */\nfunction initFeatureFlags() {\n if (typeof __INTLIFY_PROD_DEVTOOLS__ !== 'boolean') {\n getGlobalThis().__INTLIFY_PROD_DEVTOOLS__ = false;\n }\n if (typeof __INTLIFY_JIT_COMPILATION__ !== 'boolean') {\n getGlobalThis().__INTLIFY_JIT_COMPILATION__ = false;\n }\n if (typeof __INTLIFY_DROP_MESSAGE_COMPILER__ !== 'boolean') {\n getGlobalThis().__INTLIFY_DROP_MESSAGE_COMPILER__ = false;\n }\n}\n\nconst pathStateMachine = [];\npathStateMachine[0 /* States.BEFORE_PATH */] = {\n [\"w\" /* PathCharTypes.WORKSPACE */]: [0 /* States.BEFORE_PATH */],\n [\"i\" /* PathCharTypes.IDENT */]: [3 /* States.IN_IDENT */, 0 /* Actions.APPEND */],\n [\"[\" /* PathCharTypes.LEFT_BRACKET */]: [4 /* States.IN_SUB_PATH */],\n [\"o\" /* PathCharTypes.END_OF_FAIL */]: [7 /* States.AFTER_PATH */]\n};\npathStateMachine[1 /* States.IN_PATH */] = {\n [\"w\" /* PathCharTypes.WORKSPACE */]: [1 /* States.IN_PATH */],\n [\".\" /* PathCharTypes.DOT */]: [2 /* States.BEFORE_IDENT */],\n [\"[\" /* PathCharTypes.LEFT_BRACKET */]: [4 /* States.IN_SUB_PATH */],\n [\"o\" /* PathCharTypes.END_OF_FAIL */]: [7 /* States.AFTER_PATH */]\n};\npathStateMachine[2 /* States.BEFORE_IDENT */] = {\n [\"w\" /* PathCharTypes.WORKSPACE */]: [2 /* States.BEFORE_IDENT */],\n [\"i\" /* PathCharTypes.IDENT */]: [3 /* States.IN_IDENT */, 0 /* Actions.APPEND */],\n [\"0\" /* PathCharTypes.ZERO */]: [3 /* States.IN_IDENT */, 0 /* Actions.APPEND */]\n};\npathStateMachine[3 /* States.IN_IDENT */] = {\n [\"i\" /* PathCharTypes.IDENT */]: [3 /* States.IN_IDENT */, 0 /* Actions.APPEND */],\n [\"0\" /* PathCharTypes.ZERO */]: [3 /* States.IN_IDENT */, 0 /* Actions.APPEND */],\n [\"w\" /* PathCharTypes.WORKSPACE */]: [1 /* States.IN_PATH */, 1 /* Actions.PUSH */],\n [\".\" /* PathCharTypes.DOT */]: [2 /* States.BEFORE_IDENT */, 1 /* Actions.PUSH */],\n [\"[\" /* PathCharTypes.LEFT_BRACKET */]: [4 /* States.IN_SUB_PATH */, 1 /* Actions.PUSH */],\n [\"o\" /* PathCharTypes.END_OF_FAIL */]: [7 /* States.AFTER_PATH */, 1 /* Actions.PUSH */]\n};\npathStateMachine[4 /* States.IN_SUB_PATH */] = {\n [\"'\" /* PathCharTypes.SINGLE_QUOTE */]: [5 /* States.IN_SINGLE_QUOTE */, 0 /* Actions.APPEND */],\n [\"\\\"\" /* PathCharTypes.DOUBLE_QUOTE */]: [6 /* States.IN_DOUBLE_QUOTE */, 0 /* Actions.APPEND */],\n [\"[\" /* PathCharTypes.LEFT_BRACKET */]: [\n 4 /* States.IN_SUB_PATH */,\n 2 /* Actions.INC_SUB_PATH_DEPTH */\n ],\n [\"]\" /* PathCharTypes.RIGHT_BRACKET */]: [1 /* States.IN_PATH */, 3 /* Actions.PUSH_SUB_PATH */],\n [\"o\" /* PathCharTypes.END_OF_FAIL */]: 8 /* States.ERROR */,\n [\"l\" /* PathCharTypes.ELSE */]: [4 /* States.IN_SUB_PATH */, 0 /* Actions.APPEND */]\n};\npathStateMachine[5 /* States.IN_SINGLE_QUOTE */] = {\n [\"'\" /* PathCharTypes.SINGLE_QUOTE */]: [4 /* States.IN_SUB_PATH */, 0 /* Actions.APPEND */],\n [\"o\" /* PathCharTypes.END_OF_FAIL */]: 8 /* States.ERROR */,\n [\"l\" /* PathCharTypes.ELSE */]: [5 /* States.IN_SINGLE_QUOTE */, 0 /* Actions.APPEND */]\n};\npathStateMachine[6 /* States.IN_DOUBLE_QUOTE */] = {\n [\"\\\"\" /* PathCharTypes.DOUBLE_QUOTE */]: [4 /* States.IN_SUB_PATH */, 0 /* Actions.APPEND */],\n [\"o\" /* PathCharTypes.END_OF_FAIL */]: 8 /* States.ERROR */,\n [\"l\" /* PathCharTypes.ELSE */]: [6 /* States.IN_DOUBLE_QUOTE */, 0 /* Actions.APPEND */]\n};\n/**\n * Check if an expression is a literal value.\n */\nconst literalValueRE = /^\\s?(?:true|false|-?[\\d.]+|'[^']*'|\"[^\"]*\")\\s?$/;\nfunction isLiteral(exp) {\n return literalValueRE.test(exp);\n}\n/**\n * Strip quotes from a string\n */\nfunction stripQuotes(str) {\n const a = str.charCodeAt(0);\n const b = str.charCodeAt(str.length - 1);\n return a === b && (a === 0x22 || a === 0x27) ? str.slice(1, -1) : str;\n}\n/**\n * Determine the type of a character in a keypath.\n */\nfunction getPathCharType(ch) {\n if (ch === undefined || ch === null) {\n return \"o\" /* PathCharTypes.END_OF_FAIL */;\n }\n const code = ch.charCodeAt(0);\n switch (code) {\n case 0x5b: // [\n case 0x5d: // ]\n case 0x2e: // .\n case 0x22: // \"\n case 0x27: // '\n return ch;\n case 0x5f: // _\n case 0x24: // $\n case 0x2d: // -\n return \"i\" /* PathCharTypes.IDENT */;\n case 0x09: // Tab (HT)\n case 0x0a: // Newline (LF)\n case 0x0d: // Return (CR)\n case 0xa0: // No-break space (NBSP)\n case 0xfeff: // Byte Order Mark (BOM)\n case 0x2028: // Line Separator (LS)\n case 0x2029: // Paragraph Separator (PS)\n return \"w\" /* PathCharTypes.WORKSPACE */;\n }\n return \"i\" /* PathCharTypes.IDENT */;\n}\n/**\n * Format a subPath, return its plain form if it is\n * a literal string or number. Otherwise prepend the\n * dynamic indicator (*).\n */\nfunction formatSubPath(path) {\n const trimmed = path.trim();\n // invalid leading 0\n if (path.charAt(0) === '0' && isNaN(parseInt(path))) {\n return false;\n }\n return isLiteral(trimmed)\n ? stripQuotes(trimmed)\n : \"*\" /* PathCharTypes.ASTARISK */ + trimmed;\n}\n/**\n * Parse a string path into an array of segments\n */\nfunction parse(path) {\n const keys = [];\n let index = -1;\n let mode = 0 /* States.BEFORE_PATH */;\n let subPathDepth = 0;\n let c;\n let key; // eslint-disable-line\n let newChar;\n let type;\n let transition;\n let action;\n let typeMap;\n const actions = [];\n actions[0 /* Actions.APPEND */] = () => {\n if (key === undefined) {\n key = newChar;\n }\n else {\n key += newChar;\n }\n };\n actions[1 /* Actions.PUSH */] = () => {\n if (key !== undefined) {\n keys.push(key);\n key = undefined;\n }\n };\n actions[2 /* Actions.INC_SUB_PATH_DEPTH */] = () => {\n actions[0 /* Actions.APPEND */]();\n subPathDepth++;\n };\n actions[3 /* Actions.PUSH_SUB_PATH */] = () => {\n if (subPathDepth > 0) {\n subPathDepth--;\n mode = 4 /* States.IN_SUB_PATH */;\n actions[0 /* Actions.APPEND */]();\n }\n else {\n subPathDepth = 0;\n if (key === undefined) {\n return false;\n }\n key = formatSubPath(key);\n if (key === false) {\n return false;\n }\n else {\n actions[1 /* Actions.PUSH */]();\n }\n }\n };\n function maybeUnescapeQuote() {\n const nextChar = path[index + 1];\n if ((mode === 5 /* States.IN_SINGLE_QUOTE */ &&\n nextChar === \"'\" /* PathCharTypes.SINGLE_QUOTE */) ||\n (mode === 6 /* States.IN_DOUBLE_QUOTE */ &&\n nextChar === \"\\\"\" /* PathCharTypes.DOUBLE_QUOTE */)) {\n index++;\n newChar = '\\\\' + nextChar;\n actions[0 /* Actions.APPEND */]();\n return true;\n }\n }\n while (mode !== null) {\n index++;\n c = path[index];\n if (c === '\\\\' && maybeUnescapeQuote()) {\n continue;\n }\n type = getPathCharType(c);\n typeMap = pathStateMachine[mode];\n transition = typeMap[type] || typeMap[\"l\" /* PathCharTypes.ELSE */] || 8 /* States.ERROR */;\n // check parse error\n if (transition === 8 /* States.ERROR */) {\n return;\n }\n mode = transition[0];\n if (transition[1] !== undefined) {\n action = actions[transition[1]];\n if (action) {\n newChar = c;\n if (action() === false) {\n return;\n }\n }\n }\n // check parse finish\n if (mode === 7 /* States.AFTER_PATH */) {\n return keys;\n }\n }\n}\n// path token cache\nconst cache = new Map();\n/**\n * key-value message resolver\n *\n * @remarks\n * Resolves messages with the key-value structure. Note that messages with a hierarchical structure such as objects cannot be resolved\n *\n * @param obj - A target object to be resolved with path\n * @param path - A {@link Path | path} to resolve the value of message\n *\n * @returns A resolved {@link PathValue | path value}\n *\n * @VueI18nGeneral\n */\nfunction resolveWithKeyValue(obj, path) {\n return isObject(obj) ? obj[path] : null;\n}\n/**\n * message resolver\n *\n * @remarks\n * Resolves messages. messages with a hierarchical structure such as objects can be resolved. This resolver is used in VueI18n as default.\n *\n * @param obj - A target object to be resolved with path\n * @param path - A {@link Path | path} to resolve the value of message\n *\n * @returns A resolved {@link PathValue | path value}\n *\n * @VueI18nGeneral\n */\nfunction resolveValue(obj, path) {\n // check object\n if (!isObject(obj)) {\n return null;\n }\n // parse path\n let hit = cache.get(path);\n if (!hit) {\n hit = parse(path);\n if (hit) {\n cache.set(path, hit);\n }\n }\n // check hit\n if (!hit) {\n return null;\n }\n // resolve path value\n const len = hit.length;\n let last = obj;\n let i = 0;\n while (i < len) {\n const val = last[hit[i]];\n if (val === undefined) {\n return null;\n }\n last = val;\n i++;\n }\n return last;\n}\n\nconst DEFAULT_MODIFIER = (str) => str;\nconst DEFAULT_MESSAGE = (ctx) => ''; // eslint-disable-line\nconst DEFAULT_MESSAGE_DATA_TYPE = 'text';\nconst DEFAULT_NORMALIZE = (values) => values.length === 0 ? '' : join(values);\nconst DEFAULT_INTERPOLATE = toDisplayString;\nfunction pluralDefault(choice, choicesLength) {\n choice = Math.abs(choice);\n if (choicesLength === 2) {\n // prettier-ignore\n return choice\n ? choice > 1\n ? 1\n : 0\n : 1;\n }\n return choice ? Math.min(choice, 2) : 0;\n}\nfunction getPluralIndex(options) {\n // prettier-ignore\n const index = isNumber(options.pluralIndex)\n ? options.pluralIndex\n : -1;\n // prettier-ignore\n return options.named && (isNumber(options.named.count) || isNumber(options.named.n))\n ? isNumber(options.named.count)\n ? options.named.count\n : isNumber(options.named.n)\n ? options.named.n\n : index\n : index;\n}\nfunction normalizeNamed(pluralIndex, props) {\n if (!props.count) {\n props.count = pluralIndex;\n }\n if (!props.n) {\n props.n = pluralIndex;\n }\n}\nfunction createMessageContext(options = {}) {\n const locale = options.locale;\n const pluralIndex = getPluralIndex(options);\n const pluralRule = isObject(options.pluralRules) &&\n isString(locale) &&\n isFunction(options.pluralRules[locale])\n ? options.pluralRules[locale]\n : pluralDefault;\n const orgPluralRule = isObject(options.pluralRules) &&\n isString(locale) &&\n isFunction(options.pluralRules[locale])\n ? pluralDefault\n : undefined;\n const plural = (messages) => {\n return messages[pluralRule(pluralIndex, messages.length, orgPluralRule)];\n };\n const _list = options.list || [];\n const list = (index) => _list[index];\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const _named = options.named || {};\n isNumber(options.pluralIndex) && normalizeNamed(pluralIndex, _named);\n const named = (key) => _named[key];\n function message(key) {\n // prettier-ignore\n const msg = isFunction(options.messages)\n ? options.messages(key)\n : isObject(options.messages)\n ? options.messages[key]\n : false;\n return !msg\n ? options.parent\n ? options.parent.message(key) // resolve from parent messages\n : DEFAULT_MESSAGE\n : msg;\n }\n const _modifier = (name) => options.modifiers\n ? options.modifiers[name]\n : DEFAULT_MODIFIER;\n const normalize = isPlainObject(options.processor) && isFunction(options.processor.normalize)\n ? options.processor.normalize\n : DEFAULT_NORMALIZE;\n const interpolate = isPlainObject(options.processor) &&\n isFunction(options.processor.interpolate)\n ? options.processor.interpolate\n : DEFAULT_INTERPOLATE;\n const type = isPlainObject(options.processor) && isString(options.processor.type)\n ? options.processor.type\n : DEFAULT_MESSAGE_DATA_TYPE;\n const linked = (key, ...args) => {\n const [arg1, arg2] = args;\n let type = 'text';\n let modifier = '';\n if (args.length === 1) {\n if (isObject(arg1)) {\n modifier = arg1.modifier || modifier;\n type = arg1.type || type;\n }\n else if (isString(arg1)) {\n modifier = arg1 || modifier;\n }\n }\n else if (args.length === 2) {\n if (isString(arg1)) {\n modifier = arg1 || modifier;\n }\n if (isString(arg2)) {\n type = arg2 || type;\n }\n }\n const ret = message(key)(ctx);\n const msg = \n // The message in vnode resolved with linked are returned as an array by processor.nomalize\n type === 'vnode' && isArray(ret) && modifier\n ? ret[0]\n : ret;\n return modifier ? _modifier(modifier)(msg, type) : msg;\n };\n const ctx = {\n [\"list\" /* HelperNameMap.LIST */]: list,\n [\"named\" /* HelperNameMap.NAMED */]: named,\n [\"plural\" /* HelperNameMap.PLURAL */]: plural,\n [\"linked\" /* HelperNameMap.LINKED */]: linked,\n [\"message\" /* HelperNameMap.MESSAGE */]: message,\n [\"type\" /* HelperNameMap.TYPE */]: type,\n [\"interpolate\" /* HelperNameMap.INTERPOLATE */]: interpolate,\n [\"normalize\" /* HelperNameMap.NORMALIZE */]: normalize,\n [\"values\" /* HelperNameMap.VALUES */]: assign({}, _list, _named)\n };\n return ctx;\n}\n\nlet devtools = null;\nfunction setDevToolsHook(hook) {\n devtools = hook;\n}\nfunction getDevToolsHook() {\n return devtools;\n}\nfunction initI18nDevTools(i18n, version, meta) {\n // TODO: queue if devtools is undefined\n devtools &&\n devtools.emit(\"i18n:init\" /* IntlifyDevToolsHooks.I18nInit */, {\n timestamp: Date.now(),\n i18n,\n version,\n meta\n });\n}\nconst translateDevTools = /* #__PURE__*/ createDevToolsHook(\"function:translate\" /* IntlifyDevToolsHooks.FunctionTranslate */);\nfunction createDevToolsHook(hook) {\n return (payloads) => devtools && devtools.emit(hook, payloads);\n}\n\nconst CoreWarnCodes = {\n NOT_FOUND_KEY: 1,\n FALLBACK_TO_TRANSLATE: 2,\n CANNOT_FORMAT_NUMBER: 3,\n FALLBACK_TO_NUMBER_FORMAT: 4,\n CANNOT_FORMAT_DATE: 5,\n FALLBACK_TO_DATE_FORMAT: 6,\n EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER: 7,\n __EXTEND_POINT__: 8\n};\n/** @internal */\nconst warnMessages = {\n [CoreWarnCodes.NOT_FOUND_KEY]: `Not found '{key}' key in '{locale}' locale messages.`,\n [CoreWarnCodes.FALLBACK_TO_TRANSLATE]: `Fall back to translate '{key}' key with '{target}' locale.`,\n [CoreWarnCodes.CANNOT_FORMAT_NUMBER]: `Cannot format a number value due to not supported Intl.NumberFormat.`,\n [CoreWarnCodes.FALLBACK_TO_NUMBER_FORMAT]: `Fall back to number format '{key}' key with '{target}' locale.`,\n [CoreWarnCodes.CANNOT_FORMAT_DATE]: `Cannot format a date value due to not supported Intl.DateTimeFormat.`,\n [CoreWarnCodes.FALLBACK_TO_DATE_FORMAT]: `Fall back to datetime format '{key}' key with '{target}' locale.`,\n [CoreWarnCodes.EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER]: `This project is using Custom Message Compiler, which is an experimental feature. It may receive breaking changes or be removed in the future.`\n};\nfunction getWarnMessage(code, ...args) {\n return format$1(warnMessages[code], ...args);\n}\n\n/**\n * Fallback with simple implemenation\n *\n * @remarks\n * A fallback locale function implemented with a simple fallback algorithm.\n *\n * Basically, it returns the value as specified in the `fallbackLocale` props, and is processed with the fallback inside intlify.\n *\n * @param ctx - A {@link CoreContext | context}\n * @param fallback - A {@link FallbackLocale | fallback locale}\n * @param start - A starting {@link Locale | locale}\n *\n * @returns Fallback locales\n *\n * @VueI18nGeneral\n */\nfunction fallbackWithSimple(ctx, fallback, start // eslint-disable-line @typescript-eslint/no-unused-vars\n) {\n // prettier-ignore\n return [...new Set([\n start,\n ...(isArray(fallback)\n ? fallback\n : isObject(fallback)\n ? Object.keys(fallback)\n : isString(fallback)\n ? [fallback]\n : [start])\n ])];\n}\n/**\n * Fallback with locale chain\n *\n * @remarks\n * A fallback locale function implemented with a fallback chain algorithm. It's used in VueI18n as default.\n *\n * @param ctx - A {@link CoreContext | context}\n * @param fallback - A {@link FallbackLocale | fallback locale}\n * @param start - A starting {@link Locale | locale}\n *\n * @returns Fallback locales\n *\n * @VueI18nSee [Fallbacking](../guide/essentials/fallback)\n *\n * @VueI18nGeneral\n */\nfunction fallbackWithLocaleChain(ctx, fallback, start) {\n const startLocale = isString(start) ? start : DEFAULT_LOCALE;\n const context = ctx;\n if (!context.__localeChainCache) {\n context.__localeChainCache = new Map();\n }\n let chain = context.__localeChainCache.get(startLocale);\n if (!chain) {\n chain = [];\n // first block defined by start\n let block = [start];\n // while any intervening block found\n while (isArray(block)) {\n block = appendBlockToChain(chain, block, fallback);\n }\n // prettier-ignore\n // last block defined by default\n const defaults = isArray(fallback) || !isPlainObject(fallback)\n ? fallback\n : fallback['default']\n ? fallback['default']\n : null;\n // convert defaults to array\n block = isString(defaults) ? [defaults] : defaults;\n if (isArray(block)) {\n appendBlockToChain(chain, block, false);\n }\n context.__localeChainCache.set(startLocale, chain);\n }\n return chain;\n}\nfunction appendBlockToChain(chain, block, blocks) {\n let follow = true;\n for (let i = 0; i < block.length && isBoolean(follow); i++) {\n const locale = block[i];\n if (isString(locale)) {\n follow = appendLocaleToChain(chain, block[i], blocks);\n }\n }\n return follow;\n}\nfunction appendLocaleToChain(chain, locale, blocks) {\n let follow;\n const tokens = locale.split('-');\n do {\n const target = tokens.join('-');\n follow = appendItemToChain(chain, target, blocks);\n tokens.splice(-1, 1);\n } while (tokens.length && follow === true);\n return follow;\n}\nfunction appendItemToChain(chain, target, blocks) {\n let follow = false;\n if (!chain.includes(target)) {\n follow = true;\n if (target) {\n follow = target[target.length - 1] !== '!';\n const locale = target.replace(/!/g, '');\n chain.push(locale);\n if ((isArray(blocks) || isPlainObject(blocks)) &&\n blocks[locale] // eslint-disable-line @typescript-eslint/no-explicit-any\n ) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n follow = blocks[locale];\n }\n }\n }\n return follow;\n}\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n/**\n * Intlify core-base version\n * @internal\n */\nconst VERSION = '9.4.1';\nconst NOT_REOSLVED = -1;\nconst DEFAULT_LOCALE = 'en-US';\nconst MISSING_RESOLVE_VALUE = '';\nconst capitalize = (str) => `${str.charAt(0).toLocaleUpperCase()}${str.substr(1)}`;\nfunction getDefaultLinkedModifiers() {\n return {\n upper: (val, type) => {\n // prettier-ignore\n return type === 'text' && isString(val)\n ? val.toUpperCase()\n : type === 'vnode' && isObject(val) && '__v_isVNode' in val\n ? val.children.toUpperCase()\n : val;\n },\n lower: (val, type) => {\n // prettier-ignore\n return type === 'text' && isString(val)\n ? val.toLowerCase()\n : type === 'vnode' && isObject(val) && '__v_isVNode' in val\n ? val.children.toLowerCase()\n : val;\n },\n capitalize: (val, type) => {\n // prettier-ignore\n return (type === 'text' && isString(val)\n ? capitalize(val)\n : type === 'vnode' && isObject(val) && '__v_isVNode' in val\n ? capitalize(val.children)\n : val);\n }\n };\n}\nlet _compiler;\nfunction registerMessageCompiler(compiler) {\n _compiler = compiler;\n}\nlet _resolver;\n/**\n * Register the message resolver\n *\n * @param resolver - A {@link MessageResolver} function\n *\n * @VueI18nGeneral\n */\nfunction registerMessageResolver(resolver) {\n _resolver = resolver;\n}\nlet _fallbacker;\n/**\n * Register the locale fallbacker\n *\n * @param fallbacker - A {@link LocaleFallbacker} function\n *\n * @VueI18nGeneral\n */\nfunction registerLocaleFallbacker(fallbacker) {\n _fallbacker = fallbacker;\n}\n// Additional Meta for Intlify DevTools\nlet _additionalMeta = null;\nconst setAdditionalMeta = /* #__PURE__*/ (meta) => {\n _additionalMeta = meta;\n};\nconst getAdditionalMeta = /* #__PURE__*/ () => _additionalMeta;\nlet _fallbackContext = null;\nconst setFallbackContext = (context) => {\n _fallbackContext = context;\n};\nconst getFallbackContext = () => _fallbackContext;\n// ID for CoreContext\nlet _cid = 0;\nfunction createCoreContext(options = {}) {\n // setup options\n const onWarn = isFunction(options.onWarn) ? options.onWarn : warn;\n const version = isString(options.version) ? options.version : VERSION;\n const locale = isString(options.locale) ? options.locale : DEFAULT_LOCALE;\n const fallbackLocale = isArray(options.fallbackLocale) ||\n isPlainObject(options.fallbackLocale) ||\n isString(options.fallbackLocale) ||\n options.fallbackLocale === false\n ? options.fallbackLocale\n : locale;\n const messages = isPlainObject(options.messages)\n ? options.messages\n : { [locale]: {} };\n const datetimeFormats = isPlainObject(options.datetimeFormats)\n ? options.datetimeFormats\n : { [locale]: {} }\n ;\n const numberFormats = isPlainObject(options.numberFormats)\n ? options.numberFormats\n : { [locale]: {} }\n ;\n const modifiers = assign({}, options.modifiers || {}, getDefaultLinkedModifiers());\n const pluralRules = options.pluralRules || {};\n const missing = isFunction(options.missing) ? options.missing : null;\n const missingWarn = isBoolean(options.missingWarn) || isRegExp(options.missingWarn)\n ? options.missingWarn\n : true;\n const fallbackWarn = isBoolean(options.fallbackWarn) || isRegExp(options.fallbackWarn)\n ? options.fallbackWarn\n : true;\n const fallbackFormat = !!options.fallbackFormat;\n const unresolving = !!options.unresolving;\n const postTranslation = isFunction(options.postTranslation)\n ? options.postTranslation\n : null;\n const processor = isPlainObject(options.processor) ? options.processor : null;\n const warnHtmlMessage = isBoolean(options.warnHtmlMessage)\n ? options.warnHtmlMessage\n : true;\n const escapeParameter = !!options.escapeParameter;\n const messageCompiler = isFunction(options.messageCompiler)\n ? options.messageCompiler\n : _compiler;\n if ((process.env.NODE_ENV !== 'production') &&\n !false &&\n !false &&\n isFunction(options.messageCompiler)) {\n warnOnce(getWarnMessage(CoreWarnCodes.EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER));\n }\n const messageResolver = isFunction(options.messageResolver)\n ? options.messageResolver\n : _resolver || resolveWithKeyValue;\n const localeFallbacker = isFunction(options.localeFallbacker)\n ? options.localeFallbacker\n : _fallbacker || fallbackWithSimple;\n const fallbackContext = isObject(options.fallbackContext)\n ? options.fallbackContext\n : undefined;\n // setup internal options\n const internalOptions = options;\n const __datetimeFormatters = isObject(internalOptions.__datetimeFormatters)\n ? internalOptions.__datetimeFormatters\n : new Map()\n ;\n const __numberFormatters = isObject(internalOptions.__numberFormatters)\n ? internalOptions.__numberFormatters\n : new Map()\n ;\n const __meta = isObject(internalOptions.__meta) ? internalOptions.__meta : {};\n _cid++;\n const context = {\n version,\n cid: _cid,\n locale,\n fallbackLocale,\n messages,\n modifiers,\n pluralRules,\n missing,\n missingWarn,\n fallbackWarn,\n fallbackFormat,\n unresolving,\n postTranslation,\n processor,\n warnHtmlMessage,\n escapeParameter,\n messageCompiler,\n messageResolver,\n localeFallbacker,\n fallbackContext,\n onWarn,\n __meta\n };\n {\n context.datetimeFormats = datetimeFormats;\n context.numberFormats = numberFormats;\n context.__datetimeFormatters = __datetimeFormatters;\n context.__numberFormatters = __numberFormatters;\n }\n // for vue-devtools timeline event\n if ((process.env.NODE_ENV !== 'production')) {\n context.__v_emitter =\n internalOptions.__v_emitter != null\n ? internalOptions.__v_emitter\n : undefined;\n }\n // NOTE: experimental !!\n if ((process.env.NODE_ENV !== 'production') || __INTLIFY_PROD_DEVTOOLS__) {\n initI18nDevTools(context, version, __meta);\n }\n return context;\n}\n/** @internal */\nfunction isTranslateFallbackWarn(fallback, key) {\n return fallback instanceof RegExp ? fallback.test(key) : fallback;\n}\n/** @internal */\nfunction isTranslateMissingWarn(missing, key) {\n return missing instanceof RegExp ? missing.test(key) : missing;\n}\n/** @internal */\nfunction handleMissing(context, key, locale, missingWarn, type) {\n const { missing, onWarn } = context;\n // for vue-devtools timeline event\n if ((process.env.NODE_ENV !== 'production')) {\n const emitter = context.__v_emitter;\n if (emitter) {\n emitter.emit(\"missing\" /* VueDevToolsTimelineEvents.MISSING */, {\n locale,\n key,\n type,\n groupId: `${type}:${key}`\n });\n }\n }\n if (missing !== null) {\n const ret = missing(context, locale, key, type);\n return isString(ret) ? ret : key;\n }\n else {\n if ((process.env.NODE_ENV !== 'production') && isTranslateMissingWarn(missingWarn, key)) {\n onWarn(getWarnMessage(CoreWarnCodes.NOT_FOUND_KEY, { key, locale }));\n }\n return key;\n }\n}\n/** @internal */\nfunction updateFallbackLocale(ctx, locale, fallback) {\n const context = ctx;\n context.__localeChainCache = new Map();\n ctx.localeFallbacker(ctx, fallback, locale);\n}\n/* eslint-enable @typescript-eslint/no-explicit-any */\n\nfunction format(ast) {\n const msg = (ctx) => formatParts(ctx, ast);\n return msg;\n}\nfunction formatParts(ctx, ast) {\n const body = ast.b || ast.body;\n if ((body.t || body.type) === 1 /* NodeTypes.Plural */) {\n const plural = body;\n const cases = plural.c || plural.cases;\n return ctx.plural(cases.reduce((messages, c) => [\n ...messages,\n formatMessageParts(ctx, c)\n ], []));\n }\n else {\n return formatMessageParts(ctx, body);\n }\n}\nfunction formatMessageParts(ctx, node) {\n const _static = node.s || node.static;\n if (_static) {\n return ctx.type === 'text'\n ? _static\n : ctx.normalize([_static]);\n }\n else {\n const messages = (node.i || node.items).reduce((acm, c) => [...acm, formatMessagePart(ctx, c)], []);\n return ctx.normalize(messages);\n }\n}\nfunction formatMessagePart(ctx, node) {\n const type = node.t || node.type;\n switch (type) {\n case 3 /* NodeTypes.Text */:\n const text = node;\n return (text.v || text.value);\n case 9 /* NodeTypes.Literal */:\n const literal = node;\n return (literal.v || literal.value);\n case 4 /* NodeTypes.Named */:\n const named = node;\n return ctx.interpolate(ctx.named(named.k || named.key));\n case 5 /* NodeTypes.List */:\n const list = node;\n return ctx.interpolate(ctx.list(list.i || list.index));\n case 6 /* NodeTypes.Linked */:\n const linked = node;\n const modifier = linked.m || linked.modifier;\n return ctx.linked(formatMessagePart(ctx, linked.k || linked.key), modifier ? formatMessagePart(ctx, modifier) : undefined, ctx.type);\n case 7 /* NodeTypes.LinkedKey */:\n const linkedKey = node;\n return (linkedKey.v || linkedKey.value);\n case 8 /* NodeTypes.LinkedModifier */:\n const linkedModifier = node;\n return (linkedModifier.v || linkedModifier.value);\n default:\n throw new Error(`unhandled node type on format message part: ${type}`);\n }\n}\n\nconst code = CompileErrorCodes.__EXTEND_POINT__;\nconst inc = incrementer(code);\nconst CoreErrorCodes = {\n INVALID_ARGUMENT: code,\n INVALID_DATE_ARGUMENT: inc(),\n INVALID_ISO_DATE_ARGUMENT: inc(),\n NOT_SUPPORT_NON_STRING_MESSAGE: inc(),\n __EXTEND_POINT__: inc() // 22\n};\nfunction createCoreError(code) {\n return createCompileError(code, null, (process.env.NODE_ENV !== 'production') ? { messages: errorMessages } : undefined);\n}\n/** @internal */\nconst errorMessages = {\n [CoreErrorCodes.INVALID_ARGUMENT]: 'Invalid arguments',\n [CoreErrorCodes.INVALID_DATE_ARGUMENT]: 'The date provided is an invalid Date object.' +\n 'Make sure your Date represents a valid date.',\n [CoreErrorCodes.INVALID_ISO_DATE_ARGUMENT]: 'The argument provided is not a valid ISO date string',\n [CoreErrorCodes.NOT_SUPPORT_NON_STRING_MESSAGE]: 'Not support non-string message'\n};\n\nconst WARN_MESSAGE = `Detected HTML in '{source}' message. Recommend not using HTML messages to avoid XSS.`;\nfunction checkHtmlMessage(source, warnHtmlMessage) {\n if (warnHtmlMessage && detectHtmlTag(source)) {\n warn(format$1(WARN_MESSAGE, { source }));\n }\n}\nconst defaultOnCacheKey = (message) => message;\nlet compileCache = Object.create(null);\nfunction clearCompileCache() {\n compileCache = Object.create(null);\n}\nconst isMessageAST = (val) => isObject(val) &&\n (val.t === 0 || val.type === 0) &&\n ('b' in val || 'body' in val);\nfunction baseCompile(message, options = {}) {\n // error detecting on compile\n let detectError = false;\n const onError = options.onError || defaultOnError;\n options.onError = (err) => {\n detectError = true;\n onError(err);\n };\n // compile with mesasge-compiler\n return { ...baseCompile$1(message, options), detectError };\n}\nconst compileToFunction = /* #__PURE__*/ (message, context) => {\n if (!isString(message)) {\n throw createCoreError(CoreErrorCodes.NOT_SUPPORT_NON_STRING_MESSAGE);\n }\n {\n // check HTML message\n const warnHtmlMessage = isBoolean(context.warnHtmlMessage)\n ? context.warnHtmlMessage\n : true;\n (process.env.NODE_ENV !== 'production') && checkHtmlMessage(message, warnHtmlMessage);\n // check caches\n const onCacheKey = context.onCacheKey || defaultOnCacheKey;\n const cacheKey = onCacheKey(message);\n const cached = compileCache[cacheKey];\n if (cached) {\n return cached;\n }\n // compile\n const { code, detectError } = baseCompile(message, context);\n // evaluate function\n const msg = new Function(`return ${code}`)();\n // if occurred compile error, don't cache\n return !detectError\n ? (compileCache[cacheKey] = msg)\n : msg;\n }\n};\nfunction compile(message, context) {\n if (((__INTLIFY_JIT_COMPILATION__ && !__INTLIFY_DROP_MESSAGE_COMPILER__)) &&\n isString(message)) {\n // check HTML message\n const warnHtmlMessage = isBoolean(context.warnHtmlMessage)\n ? context.warnHtmlMessage\n : true;\n (process.env.NODE_ENV !== 'production') && checkHtmlMessage(message, warnHtmlMessage);\n // check caches\n const onCacheKey = context.onCacheKey || defaultOnCacheKey;\n const cacheKey = onCacheKey(message);\n const cached = compileCache[cacheKey];\n if (cached) {\n return cached;\n }\n // compile with JIT mode\n const { ast, detectError } = baseCompile(message, {\n ...context,\n location: (process.env.NODE_ENV !== 'production'),\n jit: true\n });\n // compose message function from AST\n const msg = format(ast);\n // if occurred compile error, don't cache\n return !detectError\n ? (compileCache[cacheKey] = msg)\n : msg;\n }\n else {\n if ((process.env.NODE_ENV !== 'production') && !isMessageAST(message)) {\n warn(`the message that is resolve with key '${context.key}' is not supported for jit compilation`);\n return (() => message);\n }\n // AST case (passed from bundler)\n const cacheKey = message.cacheKey;\n if (cacheKey) {\n const cached = compileCache[cacheKey];\n if (cached) {\n return cached;\n }\n // compose message function from message (AST)\n return (compileCache[cacheKey] =\n format(message));\n }\n else {\n return format(message);\n }\n }\n}\n\nconst NOOP_MESSAGE_FUNCTION = () => '';\nconst isMessageFunction = (val) => isFunction(val);\n// implementation of `translate` function\nfunction translate(context, ...args) {\n const { fallbackFormat, postTranslation, unresolving, messageCompiler, fallbackLocale, messages } = context;\n const [key, options] = parseTranslateArgs(...args);\n const missingWarn = isBoolean(options.missingWarn)\n ? options.missingWarn\n : context.missingWarn;\n const fallbackWarn = isBoolean(options.fallbackWarn)\n ? options.fallbackWarn\n : context.fallbackWarn;\n const escapeParameter = isBoolean(options.escapeParameter)\n ? options.escapeParameter\n : context.escapeParameter;\n const resolvedMessage = !!options.resolvedMessage;\n // prettier-ignore\n const defaultMsgOrKey = isString(options.default) || isBoolean(options.default) // default by function option\n ? !isBoolean(options.default)\n ? options.default\n : (!messageCompiler ? () => key : key)\n : fallbackFormat // default by `fallbackFormat` option\n ? (!messageCompiler ? () => key : key)\n : '';\n const enableDefaultMsg = fallbackFormat || defaultMsgOrKey !== '';\n const locale = isString(options.locale) ? options.locale : context.locale;\n // escape params\n escapeParameter && escapeParams(options);\n // resolve message format\n // eslint-disable-next-line prefer-const\n let [formatScope, targetLocale, message] = !resolvedMessage\n ? resolveMessageFormat(context, key, locale, fallbackLocale, fallbackWarn, missingWarn)\n : [\n key,\n locale,\n messages[locale] || {}\n ];\n // NOTE:\n // Fix to work around `ssrTransfrom` bug in Vite.\n // https://github.com/vitejs/vite/issues/4306\n // To get around this, use temporary variables.\n // https://github.com/nuxt/framework/issues/1461#issuecomment-954606243\n let format = formatScope;\n // if you use default message, set it as message format!\n let cacheBaseKey = key;\n if (!resolvedMessage &&\n !(isString(format) ||\n isMessageAST(format) ||\n isMessageFunction(format))) {\n if (enableDefaultMsg) {\n format = defaultMsgOrKey;\n cacheBaseKey = format;\n }\n }\n // checking message format and target locale\n if (!resolvedMessage &&\n (!(isString(format) ||\n isMessageAST(format) ||\n isMessageFunction(format)) ||\n !isString(targetLocale))) {\n return unresolving ? NOT_REOSLVED : key;\n }\n // TODO: refactor\n if ((process.env.NODE_ENV !== 'production') && isString(format) && context.messageCompiler == null) {\n warn(`The message format compilation is not supported in this build. ` +\n `Because message compiler isn't included. ` +\n `You need to pre-compilation all message format. ` +\n `So translate function return '${key}'.`);\n return key;\n }\n // setup compile error detecting\n let occurred = false;\n const onError = () => {\n occurred = true;\n };\n // compile message format\n const msg = !isMessageFunction(format)\n ? compileMessageFormat(context, key, targetLocale, format, cacheBaseKey, onError)\n : format;\n // if occurred compile error, return the message format\n if (occurred) {\n return format;\n }\n // evaluate message with context\n const ctxOptions = getMessageContextOptions(context, targetLocale, message, options);\n const msgContext = createMessageContext(ctxOptions);\n const messaged = evaluateMessage(context, msg, msgContext);\n // if use post translation option, proceed it with handler\n const ret = postTranslation\n ? postTranslation(messaged, key)\n : messaged;\n // NOTE: experimental !!\n if ((process.env.NODE_ENV !== 'production') || __INTLIFY_PROD_DEVTOOLS__) {\n // prettier-ignore\n const payloads = {\n timestamp: Date.now(),\n key: isString(key)\n ? key\n : isMessageFunction(format)\n ? format.key\n : '',\n locale: targetLocale || (isMessageFunction(format)\n ? format.locale\n : ''),\n format: isString(format)\n ? format\n : isMessageFunction(format)\n ? format.source\n : '',\n message: ret\n };\n payloads.meta = assign({}, context.__meta, getAdditionalMeta() || {});\n translateDevTools(payloads);\n }\n return ret;\n}\nfunction escapeParams(options) {\n if (isArray(options.list)) {\n options.list = options.list.map(item => isString(item) ? escapeHtml(item) : item);\n }\n else if (isObject(options.named)) {\n Object.keys(options.named).forEach(key => {\n if (isString(options.named[key])) {\n options.named[key] = escapeHtml(options.named[key]);\n }\n });\n }\n}\nfunction resolveMessageFormat(context, key, locale, fallbackLocale, fallbackWarn, missingWarn) {\n const { messages, onWarn, messageResolver: resolveValue, localeFallbacker } = context;\n const locales = localeFallbacker(context, fallbackLocale, locale); // eslint-disable-line @typescript-eslint/no-explicit-any\n let message = {};\n let targetLocale;\n let format = null;\n let from = locale;\n let to = null;\n const type = 'translate';\n for (let i = 0; i < locales.length; i++) {\n targetLocale = to = locales[i];\n if ((process.env.NODE_ENV !== 'production') &&\n locale !== targetLocale &&\n isTranslateFallbackWarn(fallbackWarn, key)) {\n onWarn(getWarnMessage(CoreWarnCodes.FALLBACK_TO_TRANSLATE, {\n key,\n target: targetLocale\n }));\n }\n // for vue-devtools timeline event\n if ((process.env.NODE_ENV !== 'production') && locale !== targetLocale) {\n const emitter = context.__v_emitter;\n if (emitter) {\n emitter.emit(\"fallback\" /* VueDevToolsTimelineEvents.FALBACK */, {\n type,\n key,\n from,\n to,\n groupId: `${type}:${key}`\n });\n }\n }\n message =\n messages[targetLocale] || {};\n // for vue-devtools timeline event\n let start = null;\n let startTag;\n let endTag;\n if ((process.env.NODE_ENV !== 'production') && inBrowser) {\n start = window.performance.now();\n startTag = 'intlify-message-resolve-start';\n endTag = 'intlify-message-resolve-end';\n mark && mark(startTag);\n }\n if ((format = resolveValue(message, key)) === null) {\n // if null, resolve with object key path\n format = message[key]; // eslint-disable-line @typescript-eslint/no-explicit-any\n }\n // for vue-devtools timeline event\n if ((process.env.NODE_ENV !== 'production') && inBrowser) {\n const end = window.performance.now();\n const emitter = context.__v_emitter;\n if (emitter && start && format) {\n emitter.emit(\"message-resolve\" /* VueDevToolsTimelineEvents.MESSAGE_RESOLVE */, {\n type: \"message-resolve\" /* VueDevToolsTimelineEvents.MESSAGE_RESOLVE */,\n key,\n message: format,\n time: end - start,\n groupId: `${type}:${key}`\n });\n }\n if (startTag && endTag && mark && measure) {\n mark(endTag);\n measure('intlify message resolve', startTag, endTag);\n }\n }\n if (isString(format) || isMessageAST(format) || isMessageFunction(format)) {\n break;\n }\n const missingRet = handleMissing(context, // eslint-disable-line @typescript-eslint/no-explicit-any\n key, targetLocale, missingWarn, type);\n if (missingRet !== key) {\n format = missingRet;\n }\n from = to;\n }\n return [format, targetLocale, message];\n}\nfunction compileMessageFormat(context, key, targetLocale, format, cacheBaseKey, onError) {\n const { messageCompiler, warnHtmlMessage } = context;\n if (isMessageFunction(format)) {\n const msg = format;\n msg.locale = msg.locale || targetLocale;\n msg.key = msg.key || key;\n return msg;\n }\n if (messageCompiler == null) {\n const msg = (() => format);\n msg.locale = targetLocale;\n msg.key = key;\n return msg;\n }\n // for vue-devtools timeline event\n let start = null;\n let startTag;\n let endTag;\n if ((process.env.NODE_ENV !== 'production') && inBrowser) {\n start = window.performance.now();\n startTag = 'intlify-message-compilation-start';\n endTag = 'intlify-message-compilation-end';\n mark && mark(startTag);\n }\n const msg = messageCompiler(format, getCompileContext(context, targetLocale, cacheBaseKey, format, warnHtmlMessage, onError));\n // for vue-devtools timeline event\n if ((process.env.NODE_ENV !== 'production') && inBrowser) {\n const end = window.performance.now();\n const emitter = context.__v_emitter;\n if (emitter && start) {\n emitter.emit(\"message-compilation\" /* VueDevToolsTimelineEvents.MESSAGE_COMPILATION */, {\n type: \"message-compilation\" /* VueDevToolsTimelineEvents.MESSAGE_COMPILATION */,\n message: format,\n time: end - start,\n groupId: `${'translate'}:${key}`\n });\n }\n if (startTag && endTag && mark && measure) {\n mark(endTag);\n measure('intlify message compilation', startTag, endTag);\n }\n }\n msg.locale = targetLocale;\n msg.key = key;\n msg.source = format;\n return msg;\n}\nfunction evaluateMessage(context, msg, msgCtx) {\n // for vue-devtools timeline event\n let start = null;\n let startTag;\n let endTag;\n if ((process.env.NODE_ENV !== 'production') && inBrowser) {\n start = window.performance.now();\n startTag = 'intlify-message-evaluation-start';\n endTag = 'intlify-message-evaluation-end';\n mark && mark(startTag);\n }\n const messaged = msg(msgCtx);\n // for vue-devtools timeline event\n if ((process.env.NODE_ENV !== 'production') && inBrowser) {\n const end = window.performance.now();\n const emitter = context.__v_emitter;\n if (emitter && start) {\n emitter.emit(\"message-evaluation\" /* VueDevToolsTimelineEvents.MESSAGE_EVALUATION */, {\n type: \"message-evaluation\" /* VueDevToolsTimelineEvents.MESSAGE_EVALUATION */,\n value: messaged,\n time: end - start,\n groupId: `${'translate'}:${msg.key}`\n });\n }\n if (startTag && endTag && mark && measure) {\n mark(endTag);\n measure('intlify message evaluation', startTag, endTag);\n }\n }\n return messaged;\n}\n/** @internal */\nfunction parseTranslateArgs(...args) {\n const [arg1, arg2, arg3] = args;\n const options = {};\n if (!isString(arg1) &&\n !isNumber(arg1) &&\n !isMessageFunction(arg1) &&\n !isMessageAST(arg1)) {\n throw createCoreError(CoreErrorCodes.INVALID_ARGUMENT);\n }\n // prettier-ignore\n const key = isNumber(arg1)\n ? String(arg1)\n : isMessageFunction(arg1)\n ? arg1\n : arg1;\n if (isNumber(arg2)) {\n options.plural = arg2;\n }\n else if (isString(arg2)) {\n options.default = arg2;\n }\n else if (isPlainObject(arg2) && !isEmptyObject(arg2)) {\n options.named = arg2;\n }\n else if (isArray(arg2)) {\n options.list = arg2;\n }\n if (isNumber(arg3)) {\n options.plural = arg3;\n }\n else if (isString(arg3)) {\n options.default = arg3;\n }\n else if (isPlainObject(arg3)) {\n assign(options, arg3);\n }\n return [key, options];\n}\nfunction getCompileContext(context, locale, key, source, warnHtmlMessage, onError) {\n return {\n locale,\n key,\n warnHtmlMessage,\n onError: (err) => {\n onError && onError(err);\n if ((process.env.NODE_ENV !== 'production')) {\n const _source = getSourceForCodeFrame(source);\n const message = `Message compilation error: ${err.message}`;\n const codeFrame = err.location &&\n _source &&\n generateCodeFrame(_source, err.location.start.offset, err.location.end.offset);\n const emitter = context.__v_emitter;\n if (emitter && _source) {\n emitter.emit(\"compile-error\" /* VueDevToolsTimelineEvents.COMPILE_ERROR */, {\n message: _source,\n error: err.message,\n start: err.location && err.location.start.offset,\n end: err.location && err.location.end.offset,\n groupId: `${'translate'}:${key}`\n });\n }\n console.error(codeFrame ? `${message}\\n${codeFrame}` : message);\n }\n else {\n throw err;\n }\n },\n onCacheKey: (source) => generateFormatCacheKey(locale, key, source)\n };\n}\nfunction getSourceForCodeFrame(source) {\n if (isString(source)) ;\n else {\n if (source.loc?.source) {\n return source.loc.source;\n }\n }\n}\nfunction getMessageContextOptions(context, locale, message, options) {\n const { modifiers, pluralRules, messageResolver: resolveValue, fallbackLocale, fallbackWarn, missingWarn, fallbackContext } = context;\n const resolveMessage = (key) => {\n let val = resolveValue(message, key);\n // fallback to root context\n if (val == null && fallbackContext) {\n const [, , message] = resolveMessageFormat(fallbackContext, key, locale, fallbackLocale, fallbackWarn, missingWarn);\n val = resolveValue(message, key);\n }\n if (isString(val) || isMessageAST(val)) {\n let occurred = false;\n const onError = () => {\n occurred = true;\n };\n const msg = compileMessageFormat(context, key, locale, val, key, onError);\n return !occurred\n ? msg\n : NOOP_MESSAGE_FUNCTION;\n }\n else if (isMessageFunction(val)) {\n return val;\n }\n else {\n // TODO: should be implemented warning message\n return NOOP_MESSAGE_FUNCTION;\n }\n };\n const ctxOptions = {\n locale,\n modifiers,\n pluralRules,\n messages: resolveMessage\n };\n if (context.processor) {\n ctxOptions.processor = context.processor;\n }\n if (options.list) {\n ctxOptions.list = options.list;\n }\n if (options.named) {\n ctxOptions.named = options.named;\n }\n if (isNumber(options.plural)) {\n ctxOptions.pluralIndex = options.plural;\n }\n return ctxOptions;\n}\n\nconst intlDefined = typeof Intl !== 'undefined';\nconst Availabilities = {\n dateTimeFormat: intlDefined && typeof Intl.DateTimeFormat !== 'undefined',\n numberFormat: intlDefined && typeof Intl.NumberFormat !== 'undefined'\n};\n\n// implementation of `datetime` function\nfunction datetime(context, ...args) {\n const { datetimeFormats, unresolving, fallbackLocale, onWarn, localeFallbacker } = context;\n const { __datetimeFormatters } = context;\n if ((process.env.NODE_ENV !== 'production') && !Availabilities.dateTimeFormat) {\n onWarn(getWarnMessage(CoreWarnCodes.CANNOT_FORMAT_DATE));\n return MISSING_RESOLVE_VALUE;\n }\n const [key, value, options, overrides] = parseDateTimeArgs(...args);\n const missingWarn = isBoolean(options.missingWarn)\n ? options.missingWarn\n : context.missingWarn;\n const fallbackWarn = isBoolean(options.fallbackWarn)\n ? options.fallbackWarn\n : context.fallbackWarn;\n const part = !!options.part;\n const locale = isString(options.locale) ? options.locale : context.locale;\n const locales = localeFallbacker(context, // eslint-disable-line @typescript-eslint/no-explicit-any\n fallbackLocale, locale);\n if (!isString(key) || key === '') {\n return new Intl.DateTimeFormat(locale, overrides).format(value);\n }\n // resolve format\n let datetimeFormat = {};\n let targetLocale;\n let format = null;\n let from = locale;\n let to = null;\n const type = 'datetime format';\n for (let i = 0; i < locales.length; i++) {\n targetLocale = to = locales[i];\n if ((process.env.NODE_ENV !== 'production') &&\n locale !== targetLocale &&\n isTranslateFallbackWarn(fallbackWarn, key)) {\n onWarn(getWarnMessage(CoreWarnCodes.FALLBACK_TO_DATE_FORMAT, {\n key,\n target: targetLocale\n }));\n }\n // for vue-devtools timeline event\n if ((process.env.NODE_ENV !== 'production') && locale !== targetLocale) {\n const emitter = context.__v_emitter;\n if (emitter) {\n emitter.emit(\"fallback\" /* VueDevToolsTimelineEvents.FALBACK */, {\n type,\n key,\n from,\n to,\n groupId: `${type}:${key}`\n });\n }\n }\n datetimeFormat =\n datetimeFormats[targetLocale] || {};\n format = datetimeFormat[key];\n if (isPlainObject(format))\n break;\n handleMissing(context, key, targetLocale, missingWarn, type); // eslint-disable-line @typescript-eslint/no-explicit-any\n from = to;\n }\n // checking format and target locale\n if (!isPlainObject(format) || !isString(targetLocale)) {\n return unresolving ? NOT_REOSLVED : key;\n }\n let id = `${targetLocale}__${key}`;\n if (!isEmptyObject(overrides)) {\n id = `${id}__${JSON.stringify(overrides)}`;\n }\n let formatter = __datetimeFormatters.get(id);\n if (!formatter) {\n formatter = new Intl.DateTimeFormat(targetLocale, assign({}, format, overrides));\n __datetimeFormatters.set(id, formatter);\n }\n return !part ? formatter.format(value) : formatter.formatToParts(value);\n}\n/** @internal */\nconst DATETIME_FORMAT_OPTIONS_KEYS = [\n 'localeMatcher',\n 'weekday',\n 'era',\n 'year',\n 'month',\n 'day',\n 'hour',\n 'minute',\n 'second',\n 'timeZoneName',\n 'formatMatcher',\n 'hour12',\n 'timeZone',\n 'dateStyle',\n 'timeStyle',\n 'calendar',\n 'dayPeriod',\n 'numberingSystem',\n 'hourCycle',\n 'fractionalSecondDigits'\n];\n/** @internal */\nfunction parseDateTimeArgs(...args) {\n const [arg1, arg2, arg3, arg4] = args;\n const options = {};\n let overrides = {};\n let value;\n if (isString(arg1)) {\n // Only allow ISO strings - other date formats are often supported,\n // but may cause different results in different browsers.\n const matches = arg1.match(/(\\d{4}-\\d{2}-\\d{2})(T|\\s)?(.*)/);\n if (!matches) {\n throw createCoreError(CoreErrorCodes.INVALID_ISO_DATE_ARGUMENT);\n }\n // Some browsers can not parse the iso datetime separated by space,\n // this is a compromise solution by replace the 'T'/' ' with 'T'\n const dateTime = matches[3]\n ? matches[3].trim().startsWith('T')\n ? `${matches[1].trim()}${matches[3].trim()}`\n : `${matches[1].trim()}T${matches[3].trim()}`\n : matches[1].trim();\n value = new Date(dateTime);\n try {\n // This will fail if the date is not valid\n value.toISOString();\n }\n catch (e) {\n throw createCoreError(CoreErrorCodes.INVALID_ISO_DATE_ARGUMENT);\n }\n }\n else if (isDate(arg1)) {\n if (isNaN(arg1.getTime())) {\n throw createCoreError(CoreErrorCodes.INVALID_DATE_ARGUMENT);\n }\n value = arg1;\n }\n else if (isNumber(arg1)) {\n value = arg1;\n }\n else {\n throw createCoreError(CoreErrorCodes.INVALID_ARGUMENT);\n }\n if (isString(arg2)) {\n options.key = arg2;\n }\n else if (isPlainObject(arg2)) {\n Object.keys(arg2).forEach(key => {\n if (DATETIME_FORMAT_OPTIONS_KEYS.includes(key)) {\n overrides[key] = arg2[key];\n }\n else {\n options[key] = arg2[key];\n }\n });\n }\n if (isString(arg3)) {\n options.locale = arg3;\n }\n else if (isPlainObject(arg3)) {\n overrides = arg3;\n }\n if (isPlainObject(arg4)) {\n overrides = arg4;\n }\n return [options.key || '', value, options, overrides];\n}\n/** @internal */\nfunction clearDateTimeFormat(ctx, locale, format) {\n const context = ctx;\n for (const key in format) {\n const id = `${locale}__${key}`;\n if (!context.__datetimeFormatters.has(id)) {\n continue;\n }\n context.__datetimeFormatters.delete(id);\n }\n}\n\n// implementation of `number` function\nfunction number(context, ...args) {\n const { numberFormats, unresolving, fallbackLocale, onWarn, localeFallbacker } = context;\n const { __numberFormatters } = context;\n if ((process.env.NODE_ENV !== 'production') && !Availabilities.numberFormat) {\n onWarn(getWarnMessage(CoreWarnCodes.CANNOT_FORMAT_NUMBER));\n return MISSING_RESOLVE_VALUE;\n }\n const [key, value, options, overrides] = parseNumberArgs(...args);\n const missingWarn = isBoolean(options.missingWarn)\n ? options.missingWarn\n : context.missingWarn;\n const fallbackWarn = isBoolean(options.fallbackWarn)\n ? options.fallbackWarn\n : context.fallbackWarn;\n const part = !!options.part;\n const locale = isString(options.locale) ? options.locale : context.locale;\n const locales = localeFallbacker(context, // eslint-disable-line @typescript-eslint/no-explicit-any\n fallbackLocale, locale);\n if (!isString(key) || key === '') {\n return new Intl.NumberFormat(locale, overrides).format(value);\n }\n // resolve format\n let numberFormat = {};\n let targetLocale;\n let format = null;\n let from = locale;\n let to = null;\n const type = 'number format';\n for (let i = 0; i < locales.length; i++) {\n targetLocale = to = locales[i];\n if ((process.env.NODE_ENV !== 'production') &&\n locale !== targetLocale &&\n isTranslateFallbackWarn(fallbackWarn, key)) {\n onWarn(getWarnMessage(CoreWarnCodes.FALLBACK_TO_NUMBER_FORMAT, {\n key,\n target: targetLocale\n }));\n }\n // for vue-devtools timeline event\n if ((process.env.NODE_ENV !== 'production') && locale !== targetLocale) {\n const emitter = context.__v_emitter;\n if (emitter) {\n emitter.emit(\"fallback\" /* VueDevToolsTimelineEvents.FALBACK */, {\n type,\n key,\n from,\n to,\n groupId: `${type}:${key}`\n });\n }\n }\n numberFormat =\n numberFormats[targetLocale] || {};\n format = numberFormat[key];\n if (isPlainObject(format))\n break;\n handleMissing(context, key, targetLocale, missingWarn, type); // eslint-disable-line @typescript-eslint/no-explicit-any\n from = to;\n }\n // checking format and target locale\n if (!isPlainObject(format) || !isString(targetLocale)) {\n return unresolving ? NOT_REOSLVED : key;\n }\n let id = `${targetLocale}__${key}`;\n if (!isEmptyObject(overrides)) {\n id = `${id}__${JSON.stringify(overrides)}`;\n }\n let formatter = __numberFormatters.get(id);\n if (!formatter) {\n formatter = new Intl.NumberFormat(targetLocale, assign({}, format, overrides));\n __numberFormatters.set(id, formatter);\n }\n return !part ? formatter.format(value) : formatter.formatToParts(value);\n}\n/** @internal */\nconst NUMBER_FORMAT_OPTIONS_KEYS = [\n 'localeMatcher',\n 'style',\n 'currency',\n 'currencyDisplay',\n 'currencySign',\n 'useGrouping',\n 'minimumIntegerDigits',\n 'minimumFractionDigits',\n 'maximumFractionDigits',\n 'minimumSignificantDigits',\n 'maximumSignificantDigits',\n 'compactDisplay',\n 'notation',\n 'signDisplay',\n 'unit',\n 'unitDisplay',\n 'roundingMode',\n 'roundingPriority',\n 'roundingIncrement',\n 'trailingZeroDisplay'\n];\n/** @internal */\nfunction parseNumberArgs(...args) {\n const [arg1, arg2, arg3, arg4] = args;\n const options = {};\n let overrides = {};\n if (!isNumber(arg1)) {\n throw createCoreError(CoreErrorCodes.INVALID_ARGUMENT);\n }\n const value = arg1;\n if (isString(arg2)) {\n options.key = arg2;\n }\n else if (isPlainObject(arg2)) {\n Object.keys(arg2).forEach(key => {\n if (NUMBER_FORMAT_OPTIONS_KEYS.includes(key)) {\n overrides[key] = arg2[key];\n }\n else {\n options[key] = arg2[key];\n }\n });\n }\n if (isString(arg3)) {\n options.locale = arg3;\n }\n else if (isPlainObject(arg3)) {\n overrides = arg3;\n }\n if (isPlainObject(arg4)) {\n overrides = arg4;\n }\n return [options.key || '', value, options, overrides];\n}\n/** @internal */\nfunction clearNumberFormat(ctx, locale, format) {\n const context = ctx;\n for (const key in format) {\n const id = `${locale}__${key}`;\n if (!context.__numberFormatters.has(id)) {\n continue;\n }\n context.__numberFormatters.delete(id);\n }\n}\n\n{\n initFeatureFlags();\n}\n\nexport { CoreErrorCodes, CoreWarnCodes, DATETIME_FORMAT_OPTIONS_KEYS, DEFAULT_LOCALE, DEFAULT_MESSAGE_DATA_TYPE, MISSING_RESOLVE_VALUE, NOT_REOSLVED, NUMBER_FORMAT_OPTIONS_KEYS, VERSION, clearCompileCache, clearDateTimeFormat, clearNumberFormat, compile, compileToFunction, createCoreContext, createCoreError, createMessageContext, datetime, fallbackWithLocaleChain, fallbackWithSimple, getAdditionalMeta, getDevToolsHook, getFallbackContext, getWarnMessage, handleMissing, initI18nDevTools, isMessageAST, isMessageFunction, isTranslateFallbackWarn, isTranslateMissingWarn, number, parse, parseDateTimeArgs, parseNumberArgs, parseTranslateArgs, registerLocaleFallbacker, registerMessageCompiler, registerMessageResolver, resolveValue, resolveWithKeyValue, setAdditionalMeta, setDevToolsHook, setFallbackContext, translate, translateDevTools, updateFallbackLocale };\n","/*!\n * vue-i18n v9.4.1\n * (c) 2023 kazuya kawaguchi\n * Released under the MIT License.\n */\nimport { getGlobalThis, incrementer, format, makeSymbol, isPlainObject, isArray, isString, hasOwn, isObject, warn, isBoolean, isRegExp, isFunction, inBrowser, assign, isNumber, createEmitter, isEmptyObject } from '@intlify/shared';\nimport { CoreWarnCodes, CoreErrorCodes, createCompileError, DEFAULT_LOCALE, updateFallbackLocale, setFallbackContext, createCoreContext, clearDateTimeFormat, clearNumberFormat, setAdditionalMeta, getFallbackContext, NOT_REOSLVED, isTranslateFallbackWarn, isTranslateMissingWarn, parseTranslateArgs, translate, MISSING_RESOLVE_VALUE, parseDateTimeArgs, datetime, parseNumberArgs, number, fallbackWithLocaleChain, NUMBER_FORMAT_OPTIONS_KEYS, DATETIME_FORMAT_OPTIONS_KEYS, isMessageAST, registerMessageCompiler, compile, compileToFunction, registerMessageResolver, resolveValue, registerLocaleFallbacker, setDevToolsHook } from '@intlify/core-base';\nimport { createVNode, Text, ref, computed, watch, getCurrentInstance, Fragment, defineComponent, h, effectScope, inject, onMounted, onUnmounted, shallowRef, onBeforeMount, isRef } from 'vue';\nimport { setupDevtoolsPlugin } from '@vue/devtools-api';\n\n/**\n * Vue I18n Version\n *\n * @remarks\n * Semver format. Same format as the package.json `version` field.\n *\n * @VueI18nGeneral\n */\nconst VERSION = '9.4.1';\n/**\n * This is only called in esm-bundler builds.\n * istanbul-ignore-next\n */\nfunction initFeatureFlags() {\n if (typeof __VUE_I18N_FULL_INSTALL__ !== 'boolean') {\n getGlobalThis().__VUE_I18N_FULL_INSTALL__ = true;\n }\n if (typeof __VUE_I18N_LEGACY_API__ !== 'boolean') {\n getGlobalThis().__VUE_I18N_LEGACY_API__ = true;\n }\n if (typeof __INTLIFY_JIT_COMPILATION__ !== 'boolean') {\n getGlobalThis().__INTLIFY_JIT_COMPILATION__ = false;\n }\n if (typeof __INTLIFY_DROP_MESSAGE_COMPILER__ !== 'boolean') {\n getGlobalThis().__INTLIFY_DROP_MESSAGE_COMPILER__ = false;\n }\n if (typeof __INTLIFY_PROD_DEVTOOLS__ !== 'boolean') {\n getGlobalThis().__INTLIFY_PROD_DEVTOOLS__ = false;\n }\n}\n\nconst code$1 = CoreWarnCodes.__EXTEND_POINT__;\nconst inc$1 = incrementer(code$1);\nconst I18nWarnCodes = {\n FALLBACK_TO_ROOT: code$1,\n NOT_SUPPORTED_PRESERVE: inc$1(),\n NOT_SUPPORTED_FORMATTER: inc$1(),\n NOT_SUPPORTED_PRESERVE_DIRECTIVE: inc$1(),\n NOT_SUPPORTED_GET_CHOICE_INDEX: inc$1(),\n COMPONENT_NAME_LEGACY_COMPATIBLE: inc$1(),\n NOT_FOUND_PARENT_SCOPE: inc$1(),\n IGNORE_OBJ_FLATTEN: inc$1(),\n NOTICE_DROP_ALLOW_COMPOSITION: inc$1() // 17\n};\nconst warnMessages = {\n [I18nWarnCodes.FALLBACK_TO_ROOT]: `Fall back to {type} '{key}' with root locale.`,\n [I18nWarnCodes.NOT_SUPPORTED_PRESERVE]: `Not supported 'preserve'.`,\n [I18nWarnCodes.NOT_SUPPORTED_FORMATTER]: `Not supported 'formatter'.`,\n [I18nWarnCodes.NOT_SUPPORTED_PRESERVE_DIRECTIVE]: `Not supported 'preserveDirectiveContent'.`,\n [I18nWarnCodes.NOT_SUPPORTED_GET_CHOICE_INDEX]: `Not supported 'getChoiceIndex'.`,\n [I18nWarnCodes.COMPONENT_NAME_LEGACY_COMPATIBLE]: `Component name legacy compatible: '{name}' -> 'i18n'`,\n [I18nWarnCodes.NOT_FOUND_PARENT_SCOPE]: `Not found parent scope. use the global scope.`,\n [I18nWarnCodes.IGNORE_OBJ_FLATTEN]: `Ignore object flatten: '{key}' key has an string value`,\n [I18nWarnCodes.NOTICE_DROP_ALLOW_COMPOSITION]: `'allowComposition' option will be dropped in the next major version. For more information, please see 👉 https://tinyurl.com/2p97mcze`\n};\nfunction getWarnMessage(code, ...args) {\n return format(warnMessages[code], ...args);\n}\n\nconst code = CoreErrorCodes.__EXTEND_POINT__;\nconst inc = incrementer(code);\nconst I18nErrorCodes = {\n // composer module errors\n UNEXPECTED_RETURN_TYPE: code,\n // legacy module errors\n INVALID_ARGUMENT: inc(),\n // i18n module errors\n MUST_BE_CALL_SETUP_TOP: inc(),\n NOT_INSTALLED: inc(),\n NOT_AVAILABLE_IN_LEGACY_MODE: inc(),\n // directive module errors\n REQUIRED_VALUE: inc(),\n INVALID_VALUE: inc(),\n // vue-devtools errors\n CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN: inc(),\n NOT_INSTALLED_WITH_PROVIDE: inc(),\n // unexpected error\n UNEXPECTED_ERROR: inc(),\n // not compatible legacy vue-i18n constructor\n NOT_COMPATIBLE_LEGACY_VUE_I18N: inc(),\n // bridge support vue 2.x only\n BRIDGE_SUPPORT_VUE_2_ONLY: inc(),\n // need to define `i18n` option in `allowComposition: true` and `useScope: 'local' at `useI18n``\n MUST_DEFINE_I18N_OPTION_IN_ALLOW_COMPOSITION: inc(),\n // Not available Compostion API in Legacy API mode. Please make sure that the legacy API mode is working properly\n NOT_AVAILABLE_COMPOSITION_IN_LEGACY: inc(),\n // for enhancement\n __EXTEND_POINT__: inc() // 37\n};\nfunction createI18nError(code, ...args) {\n return createCompileError(code, null, (process.env.NODE_ENV !== 'production') ? { messages: errorMessages, args } : undefined);\n}\nconst errorMessages = {\n [I18nErrorCodes.UNEXPECTED_RETURN_TYPE]: 'Unexpected return type in composer',\n [I18nErrorCodes.INVALID_ARGUMENT]: 'Invalid argument',\n [I18nErrorCodes.MUST_BE_CALL_SETUP_TOP]: 'Must be called at the top of a `setup` function',\n [I18nErrorCodes.NOT_INSTALLED]: 'Need to install with `app.use` function',\n [I18nErrorCodes.UNEXPECTED_ERROR]: 'Unexpected error',\n [I18nErrorCodes.NOT_AVAILABLE_IN_LEGACY_MODE]: 'Not available in legacy mode',\n [I18nErrorCodes.REQUIRED_VALUE]: `Required in value: {0}`,\n [I18nErrorCodes.INVALID_VALUE]: `Invalid value`,\n [I18nErrorCodes.CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN]: `Cannot setup vue-devtools plugin`,\n [I18nErrorCodes.NOT_INSTALLED_WITH_PROVIDE]: 'Need to install with `provide` function',\n [I18nErrorCodes.NOT_COMPATIBLE_LEGACY_VUE_I18N]: 'Not compatible legacy VueI18n.',\n [I18nErrorCodes.BRIDGE_SUPPORT_VUE_2_ONLY]: 'vue-i18n-bridge support Vue 2.x only',\n [I18nErrorCodes.MUST_DEFINE_I18N_OPTION_IN_ALLOW_COMPOSITION]: 'Must define ‘i18n’ option or custom block in Composition API with using local scope in Legacy API mode',\n [I18nErrorCodes.NOT_AVAILABLE_COMPOSITION_IN_LEGACY]: 'Not available Compostion API in Legacy API mode. Please make sure that the legacy API mode is working properly'\n};\n\nconst TranslateVNodeSymbol = \n/* #__PURE__*/ makeSymbol('__translateVNode');\nconst DatetimePartsSymbol = /* #__PURE__*/ makeSymbol('__datetimeParts');\nconst NumberPartsSymbol = /* #__PURE__*/ makeSymbol('__numberParts');\nconst EnableEmitter = /* #__PURE__*/ makeSymbol('__enableEmitter');\nconst DisableEmitter = /* #__PURE__*/ makeSymbol('__disableEmitter');\nconst SetPluralRulesSymbol = makeSymbol('__setPluralRules');\nmakeSymbol('__intlifyMeta');\nconst InejctWithOptionSymbol = \n/* #__PURE__*/ makeSymbol('__injectWithOption');\nconst DisposeSymbol = /* #__PURE__*/ makeSymbol('__dispose');\nconst __VUE_I18N_BRIDGE__ = '__VUE_I18N_BRIDGE__';\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n/**\n * Transform flat json in obj to normal json in obj\n */\nfunction handleFlatJson(obj) {\n // check obj\n if (!isObject(obj)) {\n return obj;\n }\n for (const key in obj) {\n // check key\n if (!hasOwn(obj, key)) {\n continue;\n }\n // handle for normal json\n if (!key.includes('.')) {\n // recursive process value if value is also a object\n if (isObject(obj[key])) {\n handleFlatJson(obj[key]);\n }\n }\n // handle for flat json, transform to normal json\n else {\n // go to the last object\n const subKeys = key.split('.');\n const lastIndex = subKeys.length - 1;\n let currentObj = obj;\n let hasStringValue = false;\n for (let i = 0; i < lastIndex; i++) {\n if (!(subKeys[i] in currentObj)) {\n currentObj[subKeys[i]] = {};\n }\n if (!isObject(currentObj[subKeys[i]])) {\n (process.env.NODE_ENV !== 'production') &&\n warn(getWarnMessage(I18nWarnCodes.IGNORE_OBJ_FLATTEN, {\n key: subKeys[i]\n }));\n hasStringValue = true;\n break;\n }\n currentObj = currentObj[subKeys[i]];\n }\n // update last object value, delete old property\n if (!hasStringValue) {\n currentObj[subKeys[lastIndex]] = obj[key];\n delete obj[key];\n }\n // recursive process value if value is also a object\n if (isObject(currentObj[subKeys[lastIndex]])) {\n handleFlatJson(currentObj[subKeys[lastIndex]]);\n }\n }\n }\n return obj;\n}\nfunction getLocaleMessages(locale, options) {\n const { messages, __i18n, messageResolver, flatJson } = options;\n // prettier-ignore\n const ret = (isPlainObject(messages)\n ? messages\n : isArray(__i18n)\n ? {}\n : { [locale]: {} });\n // merge locale messages of i18n custom block\n if (isArray(__i18n)) {\n __i18n.forEach(custom => {\n if ('locale' in custom && 'resource' in custom) {\n const { locale, resource } = custom;\n if (locale) {\n ret[locale] = ret[locale] || {};\n deepCopy(resource, ret[locale]);\n }\n else {\n deepCopy(resource, ret);\n }\n }\n else {\n isString(custom) && deepCopy(JSON.parse(custom), ret);\n }\n });\n }\n // handle messages for flat json\n if (messageResolver == null && flatJson) {\n for (const key in ret) {\n if (hasOwn(ret, key)) {\n handleFlatJson(ret[key]);\n }\n }\n }\n return ret;\n}\nconst isNotObjectOrIsArray = (val) => !isObject(val) || isArray(val);\n// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types\nfunction deepCopy(src, des) {\n // src and des should both be objects, and non of then can be a array\n if (isNotObjectOrIsArray(src) || isNotObjectOrIsArray(des)) {\n throw createI18nError(I18nErrorCodes.INVALID_VALUE);\n }\n for (const key in src) {\n if (hasOwn(src, key)) {\n if (isNotObjectOrIsArray(src[key]) || isNotObjectOrIsArray(des[key])) {\n // replace with src[key] when:\n // src[key] or des[key] is not a object, or\n // src[key] or des[key] is a array\n des[key] = src[key];\n }\n else {\n // src[key] and des[key] are both object, merge them\n deepCopy(src[key], des[key]);\n }\n }\n }\n}\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction getComponentOptions(instance) {\n return instance.type ;\n}\nfunction adjustI18nResources(gl, options, componentOptions // eslint-disable-line @typescript-eslint/no-explicit-any\n) {\n let messages = isObject(options.messages) ? options.messages : {};\n if ('__i18nGlobal' in componentOptions) {\n messages = getLocaleMessages(gl.locale.value, {\n messages,\n __i18n: componentOptions.__i18nGlobal\n });\n }\n // merge locale messages\n const locales = Object.keys(messages);\n if (locales.length) {\n locales.forEach(locale => {\n gl.mergeLocaleMessage(locale, messages[locale]);\n });\n }\n {\n // merge datetime formats\n if (isObject(options.datetimeFormats)) {\n const locales = Object.keys(options.datetimeFormats);\n if (locales.length) {\n locales.forEach(locale => {\n gl.mergeDateTimeFormat(locale, options.datetimeFormats[locale]);\n });\n }\n }\n // merge number formats\n if (isObject(options.numberFormats)) {\n const locales = Object.keys(options.numberFormats);\n if (locales.length) {\n locales.forEach(locale => {\n gl.mergeNumberFormat(locale, options.numberFormats[locale]);\n });\n }\n }\n }\n}\nfunction createTextNode(key) {\n return createVNode(Text, null, key, 0)\n ;\n}\n/* eslint-enable @typescript-eslint/no-explicit-any */\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n// extend VNode interface\nconst DEVTOOLS_META = '__INTLIFY_META__';\nlet composerID = 0;\nfunction defineCoreMissingHandler(missing) {\n return ((ctx, locale, key, type) => {\n return missing(locale, key, getCurrentInstance() || undefined, type);\n });\n}\n// for Intlify DevTools\nconst getMetaInfo = /* #__PURE__*/ () => {\n const instance = getCurrentInstance();\n let meta = null; // eslint-disable-line @typescript-eslint/no-explicit-any\n return instance && (meta = getComponentOptions(instance)[DEVTOOLS_META])\n ? { [DEVTOOLS_META]: meta } // eslint-disable-line @typescript-eslint/no-explicit-any\n : null;\n};\n/**\n * Create composer interface factory\n *\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nfunction createComposer(options = {}, VueI18nLegacy) {\n const { __root, __injectWithOption } = options;\n const _isGlobal = __root === undefined;\n let _inheritLocale = isBoolean(options.inheritLocale)\n ? options.inheritLocale\n : true;\n const _locale = ref(\n // prettier-ignore\n __root && _inheritLocale\n ? __root.locale.value\n : isString(options.locale)\n ? options.locale\n : DEFAULT_LOCALE);\n const _fallbackLocale = ref(\n // prettier-ignore\n __root && _inheritLocale\n ? __root.fallbackLocale.value\n : isString(options.fallbackLocale) ||\n isArray(options.fallbackLocale) ||\n isPlainObject(options.fallbackLocale) ||\n options.fallbackLocale === false\n ? options.fallbackLocale\n : _locale.value);\n const _messages = ref(getLocaleMessages(_locale.value, options));\n // prettier-ignore\n const _datetimeFormats = ref(isPlainObject(options.datetimeFormats)\n ? options.datetimeFormats\n : { [_locale.value]: {} })\n ;\n // prettier-ignore\n const _numberFormats = ref(isPlainObject(options.numberFormats)\n ? options.numberFormats\n : { [_locale.value]: {} })\n ;\n // warning suppress options\n // prettier-ignore\n let _missingWarn = __root\n ? __root.missingWarn\n : isBoolean(options.missingWarn) || isRegExp(options.missingWarn)\n ? options.missingWarn\n : true;\n // prettier-ignore\n let _fallbackWarn = __root\n ? __root.fallbackWarn\n : isBoolean(options.fallbackWarn) || isRegExp(options.fallbackWarn)\n ? options.fallbackWarn\n : true;\n // prettier-ignore\n let _fallbackRoot = __root\n ? __root.fallbackRoot\n : isBoolean(options.fallbackRoot)\n ? options.fallbackRoot\n : true;\n // configure fall back to root\n let _fallbackFormat = !!options.fallbackFormat;\n // runtime missing\n let _missing = isFunction(options.missing) ? options.missing : null;\n let _runtimeMissing = isFunction(options.missing)\n ? defineCoreMissingHandler(options.missing)\n : null;\n // postTranslation handler\n let _postTranslation = isFunction(options.postTranslation)\n ? options.postTranslation\n : null;\n // prettier-ignore\n let _warnHtmlMessage = __root\n ? __root.warnHtmlMessage\n : isBoolean(options.warnHtmlMessage)\n ? options.warnHtmlMessage\n : true;\n let _escapeParameter = !!options.escapeParameter;\n // custom linked modifiers\n // prettier-ignore\n const _modifiers = __root\n ? __root.modifiers\n : isPlainObject(options.modifiers)\n ? options.modifiers\n : {};\n // pluralRules\n let _pluralRules = options.pluralRules || (__root && __root.pluralRules);\n // runtime context\n // eslint-disable-next-line prefer-const\n let _context;\n const getCoreContext = () => {\n _isGlobal && setFallbackContext(null);\n const ctxOptions = {\n version: VERSION,\n locale: _locale.value,\n fallbackLocale: _fallbackLocale.value,\n messages: _messages.value,\n modifiers: _modifiers,\n pluralRules: _pluralRules,\n missing: _runtimeMissing === null ? undefined : _runtimeMissing,\n missingWarn: _missingWarn,\n fallbackWarn: _fallbackWarn,\n fallbackFormat: _fallbackFormat,\n unresolving: true,\n postTranslation: _postTranslation === null ? undefined : _postTranslation,\n warnHtmlMessage: _warnHtmlMessage,\n escapeParameter: _escapeParameter,\n messageResolver: options.messageResolver,\n messageCompiler: options.messageCompiler,\n __meta: { framework: 'vue' }\n };\n {\n ctxOptions.datetimeFormats = _datetimeFormats.value;\n ctxOptions.numberFormats = _numberFormats.value;\n ctxOptions.__datetimeFormatters = isPlainObject(_context)\n ? _context.__datetimeFormatters\n : undefined;\n ctxOptions.__numberFormatters = isPlainObject(_context)\n ? _context.__numberFormatters\n : undefined;\n }\n if ((process.env.NODE_ENV !== 'production')) {\n ctxOptions.__v_emitter = isPlainObject(_context)\n ? _context.__v_emitter\n : undefined;\n }\n const ctx = createCoreContext(ctxOptions);\n _isGlobal && setFallbackContext(ctx);\n return ctx;\n };\n _context = getCoreContext();\n updateFallbackLocale(_context, _locale.value, _fallbackLocale.value);\n // track reactivity\n function trackReactivityValues() {\n return [\n _locale.value,\n _fallbackLocale.value,\n _messages.value,\n _datetimeFormats.value,\n _numberFormats.value\n ]\n ;\n }\n // locale\n const locale = computed({\n get: () => _locale.value,\n set: val => {\n _locale.value = val;\n _context.locale = _locale.value;\n }\n });\n // fallbackLocale\n const fallbackLocale = computed({\n get: () => _fallbackLocale.value,\n set: val => {\n _fallbackLocale.value = val;\n _context.fallbackLocale = _fallbackLocale.value;\n updateFallbackLocale(_context, _locale.value, val);\n }\n });\n // messages\n const messages = computed(() => _messages.value);\n // datetimeFormats\n const datetimeFormats = /* #__PURE__*/ computed(() => _datetimeFormats.value);\n // numberFormats\n const numberFormats = /* #__PURE__*/ computed(() => _numberFormats.value);\n // getPostTranslationHandler\n function getPostTranslationHandler() {\n return isFunction(_postTranslation) ? _postTranslation : null;\n }\n // setPostTranslationHandler\n function setPostTranslationHandler(handler) {\n _postTranslation = handler;\n _context.postTranslation = handler;\n }\n // getMissingHandler\n function getMissingHandler() {\n return _missing;\n }\n // setMissingHandler\n function setMissingHandler(handler) {\n if (handler !== null) {\n _runtimeMissing = defineCoreMissingHandler(handler);\n }\n _missing = handler;\n _context.missing = _runtimeMissing;\n }\n function isResolvedTranslateMessage(type, arg // eslint-disable-line @typescript-eslint/no-explicit-any\n ) {\n return type !== 'translate' || !arg.resolvedMessage;\n }\n const wrapWithDeps = (fn, argumentParser, warnType, fallbackSuccess, fallbackFail, successCondition) => {\n trackReactivityValues(); // track reactive dependency\n // NOTE: experimental !!\n let ret;\n try {\n if ((process.env.NODE_ENV !== 'production') || __INTLIFY_PROD_DEVTOOLS__) {\n setAdditionalMeta(getMetaInfo());\n }\n if (!_isGlobal) {\n _context.fallbackContext = __root\n ? getFallbackContext()\n : undefined;\n }\n ret = fn(_context);\n }\n finally {\n if ((process.env.NODE_ENV !== 'production') || __INTLIFY_PROD_DEVTOOLS__) {\n setAdditionalMeta(null);\n }\n if (!_isGlobal) {\n _context.fallbackContext = undefined;\n }\n }\n if (isNumber(ret) && ret === NOT_REOSLVED) {\n const [key, arg2] = argumentParser();\n if ((process.env.NODE_ENV !== 'production') &&\n __root &&\n isString(key) &&\n isResolvedTranslateMessage(warnType, arg2)) {\n if (_fallbackRoot &&\n (isTranslateFallbackWarn(_fallbackWarn, key) ||\n isTranslateMissingWarn(_missingWarn, key))) {\n warn(getWarnMessage(I18nWarnCodes.FALLBACK_TO_ROOT, {\n key,\n type: warnType\n }));\n }\n // for vue-devtools timeline event\n if ((process.env.NODE_ENV !== 'production')) {\n const { __v_emitter: emitter } = _context;\n if (emitter && _fallbackRoot) {\n emitter.emit(\"fallback\" /* VueDevToolsTimelineEvents.FALBACK */, {\n type: warnType,\n key,\n to: 'global',\n groupId: `${warnType}:${key}`\n });\n }\n }\n }\n return __root && _fallbackRoot\n ? fallbackSuccess(__root)\n : fallbackFail(key);\n }\n else if (successCondition(ret)) {\n return ret;\n }\n else {\n /* istanbul ignore next */\n throw createI18nError(I18nErrorCodes.UNEXPECTED_RETURN_TYPE);\n }\n };\n // t\n function t(...args) {\n return wrapWithDeps(context => Reflect.apply(translate, null, [context, ...args]), () => parseTranslateArgs(...args), 'translate', root => Reflect.apply(root.t, root, [...args]), key => key, val => isString(val));\n }\n // rt\n function rt(...args) {\n const [arg1, arg2, arg3] = args;\n if (arg3 && !isObject(arg3)) {\n throw createI18nError(I18nErrorCodes.INVALID_ARGUMENT);\n }\n return t(...[arg1, arg2, assign({ resolvedMessage: true }, arg3 || {})]);\n }\n // d\n function d(...args) {\n return wrapWithDeps(context => Reflect.apply(datetime, null, [context, ...args]), () => parseDateTimeArgs(...args), 'datetime format', root => Reflect.apply(root.d, root, [...args]), () => MISSING_RESOLVE_VALUE, val => isString(val));\n }\n // n\n function n(...args) {\n return wrapWithDeps(context => Reflect.apply(number, null, [context, ...args]), () => parseNumberArgs(...args), 'number format', root => Reflect.apply(root.n, root, [...args]), () => MISSING_RESOLVE_VALUE, val => isString(val));\n }\n // for custom processor\n function normalize(values) {\n return values.map(val => isString(val) || isNumber(val) || isBoolean(val)\n ? createTextNode(String(val))\n : val);\n }\n const interpolate = (val) => val;\n const processor = {\n normalize,\n interpolate,\n type: 'vnode'\n };\n // translateVNode, using for `i18n-t` component\n function translateVNode(...args) {\n return wrapWithDeps(context => {\n let ret;\n const _context = context;\n try {\n _context.processor = processor;\n ret = Reflect.apply(translate, null, [_context, ...args]);\n }\n finally {\n _context.processor = null;\n }\n return ret;\n }, () => parseTranslateArgs(...args), 'translate', \n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n root => root[TranslateVNodeSymbol](...args), key => [createTextNode(key)], val => isArray(val));\n }\n // numberParts, using for `i18n-n` component\n function numberParts(...args) {\n return wrapWithDeps(context => Reflect.apply(number, null, [context, ...args]), () => parseNumberArgs(...args), 'number format', \n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n root => root[NumberPartsSymbol](...args), () => [], val => isString(val) || isArray(val));\n }\n // datetimeParts, using for `i18n-d` component\n function datetimeParts(...args) {\n return wrapWithDeps(context => Reflect.apply(datetime, null, [context, ...args]), () => parseDateTimeArgs(...args), 'datetime format', \n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n root => root[DatetimePartsSymbol](...args), () => [], val => isString(val) || isArray(val));\n }\n function setPluralRules(rules) {\n _pluralRules = rules;\n _context.pluralRules = _pluralRules;\n }\n // te\n function te(key, locale) {\n const targetLocale = isString(locale) ? locale : _locale.value;\n const message = getLocaleMessage(targetLocale);\n return _context.messageResolver(message, key) !== null;\n }\n function resolveMessages(key) {\n let messages = null;\n const locales = fallbackWithLocaleChain(_context, _fallbackLocale.value, _locale.value);\n for (let i = 0; i < locales.length; i++) {\n const targetLocaleMessages = _messages.value[locales[i]] || {};\n const messageValue = _context.messageResolver(targetLocaleMessages, key);\n if (messageValue != null) {\n messages = messageValue;\n break;\n }\n }\n return messages;\n }\n // tm\n function tm(key) {\n const messages = resolveMessages(key);\n // prettier-ignore\n return messages != null\n ? messages\n : __root\n ? __root.tm(key) || {}\n : {};\n }\n // getLocaleMessage\n function getLocaleMessage(locale) {\n return (_messages.value[locale] || {});\n }\n // setLocaleMessage\n function setLocaleMessage(locale, message) {\n _messages.value[locale] = message;\n _context.messages = _messages.value;\n }\n // mergeLocaleMessage\n function mergeLocaleMessage(locale, message) {\n _messages.value[locale] = _messages.value[locale] || {};\n deepCopy(message, _messages.value[locale]);\n _context.messages = _messages.value;\n }\n // getDateTimeFormat\n function getDateTimeFormat(locale) {\n return _datetimeFormats.value[locale] || {};\n }\n // setDateTimeFormat\n function setDateTimeFormat(locale, format) {\n _datetimeFormats.value[locale] = format;\n _context.datetimeFormats = _datetimeFormats.value;\n clearDateTimeFormat(_context, locale, format);\n }\n // mergeDateTimeFormat\n function mergeDateTimeFormat(locale, format) {\n _datetimeFormats.value[locale] = assign(_datetimeFormats.value[locale] || {}, format);\n _context.datetimeFormats = _datetimeFormats.value;\n clearDateTimeFormat(_context, locale, format);\n }\n // getNumberFormat\n function getNumberFormat(locale) {\n return _numberFormats.value[locale] || {};\n }\n // setNumberFormat\n function setNumberFormat(locale, format) {\n _numberFormats.value[locale] = format;\n _context.numberFormats = _numberFormats.value;\n clearNumberFormat(_context, locale, format);\n }\n // mergeNumberFormat\n function mergeNumberFormat(locale, format) {\n _numberFormats.value[locale] = assign(_numberFormats.value[locale] || {}, format);\n _context.numberFormats = _numberFormats.value;\n clearNumberFormat(_context, locale, format);\n }\n // for debug\n composerID++;\n // watch root locale & fallbackLocale\n if (__root && inBrowser) {\n watch(__root.locale, (val) => {\n if (_inheritLocale) {\n _locale.value = val;\n _context.locale = val;\n updateFallbackLocale(_context, _locale.value, _fallbackLocale.value);\n }\n });\n watch(__root.fallbackLocale, (val) => {\n if (_inheritLocale) {\n _fallbackLocale.value = val;\n _context.fallbackLocale = val;\n updateFallbackLocale(_context, _locale.value, _fallbackLocale.value);\n }\n });\n }\n // define basic composition API!\n const composer = {\n id: composerID,\n locale,\n fallbackLocale,\n get inheritLocale() {\n return _inheritLocale;\n },\n set inheritLocale(val) {\n _inheritLocale = val;\n if (val && __root) {\n _locale.value = __root.locale.value;\n _fallbackLocale.value = __root.fallbackLocale.value;\n updateFallbackLocale(_context, _locale.value, _fallbackLocale.value);\n }\n },\n get availableLocales() {\n return Object.keys(_messages.value).sort();\n },\n messages,\n get modifiers() {\n return _modifiers;\n },\n get pluralRules() {\n return _pluralRules || {};\n },\n get isGlobal() {\n return _isGlobal;\n },\n get missingWarn() {\n return _missingWarn;\n },\n set missingWarn(val) {\n _missingWarn = val;\n _context.missingWarn = _missingWarn;\n },\n get fallbackWarn() {\n return _fallbackWarn;\n },\n set fallbackWarn(val) {\n _fallbackWarn = val;\n _context.fallbackWarn = _fallbackWarn;\n },\n get fallbackRoot() {\n return _fallbackRoot;\n },\n set fallbackRoot(val) {\n _fallbackRoot = val;\n },\n get fallbackFormat() {\n return _fallbackFormat;\n },\n set fallbackFormat(val) {\n _fallbackFormat = val;\n _context.fallbackFormat = _fallbackFormat;\n },\n get warnHtmlMessage() {\n return _warnHtmlMessage;\n },\n set warnHtmlMessage(val) {\n _warnHtmlMessage = val;\n _context.warnHtmlMessage = val;\n },\n get escapeParameter() {\n return _escapeParameter;\n },\n set escapeParameter(val) {\n _escapeParameter = val;\n _context.escapeParameter = val;\n },\n t,\n getLocaleMessage,\n setLocaleMessage,\n mergeLocaleMessage,\n getPostTranslationHandler,\n setPostTranslationHandler,\n getMissingHandler,\n setMissingHandler,\n [SetPluralRulesSymbol]: setPluralRules\n };\n {\n composer.datetimeFormats = datetimeFormats;\n composer.numberFormats = numberFormats;\n composer.rt = rt;\n composer.te = te;\n composer.tm = tm;\n composer.d = d;\n composer.n = n;\n composer.getDateTimeFormat = getDateTimeFormat;\n composer.setDateTimeFormat = setDateTimeFormat;\n composer.mergeDateTimeFormat = mergeDateTimeFormat;\n composer.getNumberFormat = getNumberFormat;\n composer.setNumberFormat = setNumberFormat;\n composer.mergeNumberFormat = mergeNumberFormat;\n composer[InejctWithOptionSymbol] = __injectWithOption;\n composer[TranslateVNodeSymbol] = translateVNode;\n composer[DatetimePartsSymbol] = datetimeParts;\n composer[NumberPartsSymbol] = numberParts;\n }\n // for vue-devtools timeline event\n if ((process.env.NODE_ENV !== 'production')) {\n composer[EnableEmitter] = (emitter) => {\n _context.__v_emitter = emitter;\n };\n composer[DisableEmitter] = () => {\n _context.__v_emitter = undefined;\n };\n }\n return composer;\n}\n/* eslint-enable @typescript-eslint/no-explicit-any */\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n/**\n * Convert to I18n Composer Options from VueI18n Options\n *\n * @internal\n */\nfunction convertComposerOptions(options) {\n const locale = isString(options.locale) ? options.locale : DEFAULT_LOCALE;\n const fallbackLocale = isString(options.fallbackLocale) ||\n isArray(options.fallbackLocale) ||\n isPlainObject(options.fallbackLocale) ||\n options.fallbackLocale === false\n ? options.fallbackLocale\n : locale;\n const missing = isFunction(options.missing) ? options.missing : undefined;\n const missingWarn = isBoolean(options.silentTranslationWarn) ||\n isRegExp(options.silentTranslationWarn)\n ? !options.silentTranslationWarn\n : true;\n const fallbackWarn = isBoolean(options.silentFallbackWarn) ||\n isRegExp(options.silentFallbackWarn)\n ? !options.silentFallbackWarn\n : true;\n const fallbackRoot = isBoolean(options.fallbackRoot)\n ? options.fallbackRoot\n : true;\n const fallbackFormat = !!options.formatFallbackMessages;\n const modifiers = isPlainObject(options.modifiers) ? options.modifiers : {};\n const pluralizationRules = options.pluralizationRules;\n const postTranslation = isFunction(options.postTranslation)\n ? options.postTranslation\n : undefined;\n const warnHtmlMessage = isString(options.warnHtmlInMessage)\n ? options.warnHtmlInMessage !== 'off'\n : true;\n const escapeParameter = !!options.escapeParameterHtml;\n const inheritLocale = isBoolean(options.sync) ? options.sync : true;\n if ((process.env.NODE_ENV !== 'production') && options.formatter) {\n warn(getWarnMessage(I18nWarnCodes.NOT_SUPPORTED_FORMATTER));\n }\n if ((process.env.NODE_ENV !== 'production') && options.preserveDirectiveContent) {\n warn(getWarnMessage(I18nWarnCodes.NOT_SUPPORTED_PRESERVE_DIRECTIVE));\n }\n let messages = options.messages;\n if (isPlainObject(options.sharedMessages)) {\n const sharedMessages = options.sharedMessages;\n const locales = Object.keys(sharedMessages);\n messages = locales.reduce((messages, locale) => {\n const message = messages[locale] || (messages[locale] = {});\n assign(message, sharedMessages[locale]);\n return messages;\n }, (messages || {}));\n }\n const { __i18n, __root, __injectWithOption } = options;\n const datetimeFormats = options.datetimeFormats;\n const numberFormats = options.numberFormats;\n const flatJson = options.flatJson;\n return {\n locale,\n fallbackLocale,\n messages,\n flatJson,\n datetimeFormats,\n numberFormats,\n missing,\n missingWarn,\n fallbackWarn,\n fallbackRoot,\n fallbackFormat,\n modifiers,\n pluralRules: pluralizationRules,\n postTranslation,\n warnHtmlMessage,\n escapeParameter,\n messageResolver: options.messageResolver,\n inheritLocale,\n __i18n,\n __root,\n __injectWithOption\n };\n}\n/**\n * create VueI18n interface factory\n *\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nfunction createVueI18n(options = {}, VueI18nLegacy) {\n {\n const composer = createComposer(convertComposerOptions(options));\n const { __extender } = options;\n // defines VueI18n\n const vueI18n = {\n // id\n id: composer.id,\n // locale\n get locale() {\n return composer.locale.value;\n },\n set locale(val) {\n composer.locale.value = val;\n },\n // fallbackLocale\n get fallbackLocale() {\n return composer.fallbackLocale.value;\n },\n set fallbackLocale(val) {\n composer.fallbackLocale.value = val;\n },\n // messages\n get messages() {\n return composer.messages.value;\n },\n // datetimeFormats\n get datetimeFormats() {\n return composer.datetimeFormats.value;\n },\n // numberFormats\n get numberFormats() {\n return composer.numberFormats.value;\n },\n // availableLocales\n get availableLocales() {\n return composer.availableLocales;\n },\n // formatter\n get formatter() {\n (process.env.NODE_ENV !== 'production') && warn(getWarnMessage(I18nWarnCodes.NOT_SUPPORTED_FORMATTER));\n // dummy\n return {\n interpolate() {\n return [];\n }\n };\n },\n set formatter(val) {\n (process.env.NODE_ENV !== 'production') && warn(getWarnMessage(I18nWarnCodes.NOT_SUPPORTED_FORMATTER));\n },\n // missing\n get missing() {\n return composer.getMissingHandler();\n },\n set missing(handler) {\n composer.setMissingHandler(handler);\n },\n // silentTranslationWarn\n get silentTranslationWarn() {\n return isBoolean(composer.missingWarn)\n ? !composer.missingWarn\n : composer.missingWarn;\n },\n set silentTranslationWarn(val) {\n composer.missingWarn = isBoolean(val) ? !val : val;\n },\n // silentFallbackWarn\n get silentFallbackWarn() {\n return isBoolean(composer.fallbackWarn)\n ? !composer.fallbackWarn\n : composer.fallbackWarn;\n },\n set silentFallbackWarn(val) {\n composer.fallbackWarn = isBoolean(val) ? !val : val;\n },\n // modifiers\n get modifiers() {\n return composer.modifiers;\n },\n // formatFallbackMessages\n get formatFallbackMessages() {\n return composer.fallbackFormat;\n },\n set formatFallbackMessages(val) {\n composer.fallbackFormat = val;\n },\n // postTranslation\n get postTranslation() {\n return composer.getPostTranslationHandler();\n },\n set postTranslation(handler) {\n composer.setPostTranslationHandler(handler);\n },\n // sync\n get sync() {\n return composer.inheritLocale;\n },\n set sync(val) {\n composer.inheritLocale = val;\n },\n // warnInHtmlMessage\n get warnHtmlInMessage() {\n return composer.warnHtmlMessage ? 'warn' : 'off';\n },\n set warnHtmlInMessage(val) {\n composer.warnHtmlMessage = val !== 'off';\n },\n // escapeParameterHtml\n get escapeParameterHtml() {\n return composer.escapeParameter;\n },\n set escapeParameterHtml(val) {\n composer.escapeParameter = val;\n },\n // preserveDirectiveContent\n get preserveDirectiveContent() {\n (process.env.NODE_ENV !== 'production') &&\n warn(getWarnMessage(I18nWarnCodes.NOT_SUPPORTED_PRESERVE_DIRECTIVE));\n return true;\n },\n set preserveDirectiveContent(val) {\n (process.env.NODE_ENV !== 'production') &&\n warn(getWarnMessage(I18nWarnCodes.NOT_SUPPORTED_PRESERVE_DIRECTIVE));\n },\n // pluralizationRules\n get pluralizationRules() {\n return composer.pluralRules || {};\n },\n // for internal\n __composer: composer,\n // t\n t(...args) {\n const [arg1, arg2, arg3] = args;\n const options = {};\n let list = null;\n let named = null;\n if (!isString(arg1)) {\n throw createI18nError(I18nErrorCodes.INVALID_ARGUMENT);\n }\n const key = arg1;\n if (isString(arg2)) {\n options.locale = arg2;\n }\n else if (isArray(arg2)) {\n list = arg2;\n }\n else if (isPlainObject(arg2)) {\n named = arg2;\n }\n if (isArray(arg3)) {\n list = arg3;\n }\n else if (isPlainObject(arg3)) {\n named = arg3;\n }\n // return composer.t(key, (list || named || {}) as any, options)\n return Reflect.apply(composer.t, composer, [\n key,\n (list || named || {}),\n options\n ]);\n },\n rt(...args) {\n return Reflect.apply(composer.rt, composer, [...args]);\n },\n // tc\n tc(...args) {\n const [arg1, arg2, arg3] = args;\n const options = { plural: 1 };\n let list = null;\n let named = null;\n if (!isString(arg1)) {\n throw createI18nError(I18nErrorCodes.INVALID_ARGUMENT);\n }\n const key = arg1;\n if (isString(arg2)) {\n options.locale = arg2;\n }\n else if (isNumber(arg2)) {\n options.plural = arg2;\n }\n else if (isArray(arg2)) {\n list = arg2;\n }\n else if (isPlainObject(arg2)) {\n named = arg2;\n }\n if (isString(arg3)) {\n options.locale = arg3;\n }\n else if (isArray(arg3)) {\n list = arg3;\n }\n else if (isPlainObject(arg3)) {\n named = arg3;\n }\n // return composer.t(key, (list || named || {}) as any, options)\n return Reflect.apply(composer.t, composer, [\n key,\n (list || named || {}),\n options\n ]);\n },\n // te\n te(key, locale) {\n return composer.te(key, locale);\n },\n // tm\n tm(key) {\n return composer.tm(key);\n },\n // getLocaleMessage\n getLocaleMessage(locale) {\n return composer.getLocaleMessage(locale);\n },\n // setLocaleMessage\n setLocaleMessage(locale, message) {\n composer.setLocaleMessage(locale, message);\n },\n // mergeLocaleMessage\n mergeLocaleMessage(locale, message) {\n composer.mergeLocaleMessage(locale, message);\n },\n // d\n d(...args) {\n return Reflect.apply(composer.d, composer, [...args]);\n },\n // getDateTimeFormat\n getDateTimeFormat(locale) {\n return composer.getDateTimeFormat(locale);\n },\n // setDateTimeFormat\n setDateTimeFormat(locale, format) {\n composer.setDateTimeFormat(locale, format);\n },\n // mergeDateTimeFormat\n mergeDateTimeFormat(locale, format) {\n composer.mergeDateTimeFormat(locale, format);\n },\n // n\n n(...args) {\n return Reflect.apply(composer.n, composer, [...args]);\n },\n // getNumberFormat\n getNumberFormat(locale) {\n return composer.getNumberFormat(locale);\n },\n // setNumberFormat\n setNumberFormat(locale, format) {\n composer.setNumberFormat(locale, format);\n },\n // mergeNumberFormat\n mergeNumberFormat(locale, format) {\n composer.mergeNumberFormat(locale, format);\n },\n // getChoiceIndex\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n getChoiceIndex(choice, choicesLength) {\n (process.env.NODE_ENV !== 'production') &&\n warn(getWarnMessage(I18nWarnCodes.NOT_SUPPORTED_GET_CHOICE_INDEX));\n return -1;\n }\n };\n vueI18n.__extender = __extender;\n // for vue-devtools timeline event\n if ((process.env.NODE_ENV !== 'production')) {\n vueI18n.__enableEmitter = (emitter) => {\n const __composer = composer;\n __composer[EnableEmitter] && __composer[EnableEmitter](emitter);\n };\n vueI18n.__disableEmitter = () => {\n const __composer = composer;\n __composer[DisableEmitter] && __composer[DisableEmitter]();\n };\n }\n return vueI18n;\n }\n}\n/* eslint-enable @typescript-eslint/no-explicit-any */\n\nconst baseFormatProps = {\n tag: {\n type: [String, Object]\n },\n locale: {\n type: String\n },\n scope: {\n type: String,\n // NOTE: avoid https://github.com/microsoft/rushstack/issues/1050\n validator: (val /* ComponentI18nScope */) => val === 'parent' || val === 'global',\n default: 'parent' /* ComponentI18nScope */\n },\n i18n: {\n type: Object\n }\n};\n\nfunction getInterpolateArg(\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\n{ slots }, // SetupContext,\nkeys) {\n if (keys.length === 1 && keys[0] === 'default') {\n // default slot with list\n const ret = slots.default ? slots.default() : [];\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return ret.reduce((slot, current) => {\n return [\n ...slot,\n // prettier-ignore\n ...(current.type === Fragment ? current.children : [current]\n )\n ];\n }, []);\n }\n else {\n // named slots\n return keys.reduce((arg, key) => {\n const slot = slots[key];\n if (slot) {\n arg[key] = slot();\n }\n return arg;\n }, {});\n }\n}\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction getFragmentableTag(tag) {\n return Fragment ;\n}\n\nconst TranslationImpl = /*#__PURE__*/ defineComponent({\n /* eslint-disable */\n name: 'i18n-t',\n props: assign({\n keypath: {\n type: String,\n required: true\n },\n plural: {\n type: [Number, String],\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n validator: (val) => isNumber(val) || !isNaN(val)\n }\n }, baseFormatProps),\n /* eslint-enable */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n setup(props, context) {\n const { slots, attrs } = context;\n // NOTE: avoid https://github.com/microsoft/rushstack/issues/1050\n const i18n = props.i18n ||\n useI18n({\n useScope: props.scope,\n __useComponent: true\n });\n return () => {\n const keys = Object.keys(slots).filter(key => key !== '_');\n const options = {};\n if (props.locale) {\n options.locale = props.locale;\n }\n if (props.plural !== undefined) {\n options.plural = isString(props.plural) ? +props.plural : props.plural;\n }\n const arg = getInterpolateArg(context, keys);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const children = i18n[TranslateVNodeSymbol](props.keypath, arg, options);\n const assignedAttrs = assign({}, attrs);\n const tag = isString(props.tag) || isObject(props.tag)\n ? props.tag\n : getFragmentableTag();\n return h(tag, assignedAttrs, children);\n };\n }\n});\n/**\n * export the public type for h/tsx inference\n * also to avoid inline import() in generated d.ts files\n */\n/**\n * Translation Component\n *\n * @remarks\n * See the following items for property about details\n *\n * @VueI18nSee [TranslationProps](component#translationprops)\n * @VueI18nSee [BaseFormatProps](component#baseformatprops)\n * @VueI18nSee [Component Interpolation](../guide/advanced/component)\n *\n * @example\n * ```html\n *
\n * \n * \n * {{ $t('tos') }}\n * \n * \n *
\n * ```\n * ```js\n * import { createApp } from 'vue'\n * import { createI18n } from 'vue-i18n'\n *\n * const messages = {\n * en: {\n * tos: 'Term of Service',\n * term: 'I accept xxx {0}.'\n * },\n * ja: {\n * tos: '利用規約',\n * term: '私は xxx の{0}に同意します。'\n * }\n * }\n *\n * const i18n = createI18n({\n * locale: 'en',\n * messages\n * })\n *\n * const app = createApp({\n * data: {\n * url: '/term'\n * }\n * }).use(i18n).mount('#app')\n * ```\n *\n * @VueI18nComponent\n */\nconst Translation = TranslationImpl;\nconst I18nT = Translation;\n\nfunction isVNode(target) {\n return isArray(target) && !isString(target[0]);\n}\nfunction renderFormatter(props, context, slotKeys, partFormatter) {\n const { slots, attrs } = context;\n return () => {\n const options = { part: true };\n let overrides = {};\n if (props.locale) {\n options.locale = props.locale;\n }\n if (isString(props.format)) {\n options.key = props.format;\n }\n else if (isObject(props.format)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n if (isString(props.format.key)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n options.key = props.format.key;\n }\n // Filter out number format options only\n overrides = Object.keys(props.format).reduce((options, prop) => {\n return slotKeys.includes(prop)\n ? assign({}, options, { [prop]: props.format[prop] }) // eslint-disable-line @typescript-eslint/no-explicit-any\n : options;\n }, {});\n }\n const parts = partFormatter(...[props.value, options, overrides]);\n let children = [options.key];\n if (isArray(parts)) {\n children = parts.map((part, index) => {\n const slot = slots[part.type];\n const node = slot\n ? slot({ [part.type]: part.value, index, parts })\n : [part.value];\n if (isVNode(node)) {\n node[0].key = `${part.type}-${index}`;\n }\n return node;\n });\n }\n else if (isString(parts)) {\n children = [parts];\n }\n const assignedAttrs = assign({}, attrs);\n const tag = isString(props.tag) || isObject(props.tag)\n ? props.tag\n : getFragmentableTag();\n return h(tag, assignedAttrs, children);\n };\n}\n\nconst NumberFormatImpl = /*#__PURE__*/ defineComponent({\n /* eslint-disable */\n name: 'i18n-n',\n props: assign({\n value: {\n type: Number,\n required: true\n },\n format: {\n type: [String, Object]\n }\n }, baseFormatProps),\n /* eslint-enable */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n setup(props, context) {\n const i18n = props.i18n ||\n useI18n({\n useScope: 'parent',\n __useComponent: true\n });\n return renderFormatter(props, context, NUMBER_FORMAT_OPTIONS_KEYS, (...args) => \n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n i18n[NumberPartsSymbol](...args));\n }\n});\n/**\n * export the public type for h/tsx inference\n * also to avoid inline import() in generated d.ts files\n */\n/**\n * Number Format Component\n *\n * @remarks\n * See the following items for property about details\n *\n * @VueI18nSee [FormattableProps](component#formattableprops)\n * @VueI18nSee [BaseFormatProps](component#baseformatprops)\n * @VueI18nSee [Custom Formatting](../guide/essentials/number#custom-formatting)\n *\n * @VueI18nDanger\n * Not supported IE, due to no support `Intl.NumberFormat#formatToParts` in [IE](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/formatToParts)\n *\n * If you want to use it, you need to use [polyfill](https://github.com/formatjs/formatjs/tree/main/packages/intl-numberformat)\n *\n * @VueI18nComponent\n */\nconst NumberFormat = NumberFormatImpl;\nconst I18nN = NumberFormat;\n\nconst DatetimeFormatImpl = /* #__PURE__*/ defineComponent({\n /* eslint-disable */\n name: 'i18n-d',\n props: assign({\n value: {\n type: [Number, Date],\n required: true\n },\n format: {\n type: [String, Object]\n }\n }, baseFormatProps),\n /* eslint-enable */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n setup(props, context) {\n const i18n = props.i18n ||\n useI18n({\n useScope: 'parent',\n __useComponent: true\n });\n return renderFormatter(props, context, DATETIME_FORMAT_OPTIONS_KEYS, (...args) => \n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n i18n[DatetimePartsSymbol](...args));\n }\n});\n/**\n * Datetime Format Component\n *\n * @remarks\n * See the following items for property about details\n *\n * @VueI18nSee [FormattableProps](component#formattableprops)\n * @VueI18nSee [BaseFormatProps](component#baseformatprops)\n * @VueI18nSee [Custom Formatting](../guide/essentials/datetime#custom-formatting)\n *\n * @VueI18nDanger\n * Not supported IE, due to no support `Intl.DateTimeFormat#formatToParts` in [IE](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/formatToParts)\n *\n * If you want to use it, you need to use [polyfill](https://github.com/formatjs/formatjs/tree/main/packages/intl-datetimeformat)\n *\n * @VueI18nComponent\n */\nconst DatetimeFormat = DatetimeFormatImpl;\nconst I18nD = DatetimeFormat;\n\nfunction getComposer$2(i18n, instance) {\n const i18nInternal = i18n;\n if (i18n.mode === 'composition') {\n return (i18nInternal.__getInstance(instance) || i18n.global);\n }\n else {\n const vueI18n = i18nInternal.__getInstance(instance);\n return vueI18n != null\n ? vueI18n.__composer\n : i18n.global.__composer;\n }\n}\nfunction vTDirective(i18n) {\n const _process = (binding) => {\n const { instance, modifiers, value } = binding;\n /* istanbul ignore if */\n if (!instance || !instance.$) {\n throw createI18nError(I18nErrorCodes.UNEXPECTED_ERROR);\n }\n const composer = getComposer$2(i18n, instance.$);\n if ((process.env.NODE_ENV !== 'production') && modifiers.preserve) {\n warn(getWarnMessage(I18nWarnCodes.NOT_SUPPORTED_PRESERVE));\n }\n const parsedValue = parseValue(value);\n return [\n Reflect.apply(composer.t, composer, [...makeParams(parsedValue)]),\n composer\n ];\n };\n const register = (el, binding) => {\n const [textContent, composer] = _process(binding);\n if (inBrowser && i18n.global === composer) {\n // global scope only\n el.__i18nWatcher = watch(composer.locale, () => {\n binding.instance && binding.instance.$forceUpdate();\n });\n }\n el.__composer = composer;\n el.textContent = textContent;\n };\n const unregister = (el) => {\n if (inBrowser && el.__i18nWatcher) {\n el.__i18nWatcher();\n el.__i18nWatcher = undefined;\n delete el.__i18nWatcher;\n }\n if (el.__composer) {\n el.__composer = undefined;\n delete el.__composer;\n }\n };\n const update = (el, { value }) => {\n if (el.__composer) {\n const composer = el.__composer;\n const parsedValue = parseValue(value);\n el.textContent = Reflect.apply(composer.t, composer, [\n ...makeParams(parsedValue)\n ]);\n }\n };\n const getSSRProps = (binding) => {\n const [textContent] = _process(binding);\n return { textContent };\n };\n return {\n created: register,\n unmounted: unregister,\n beforeUpdate: update,\n getSSRProps\n };\n}\nfunction parseValue(value) {\n if (isString(value)) {\n return { path: value };\n }\n else if (isPlainObject(value)) {\n if (!('path' in value)) {\n throw createI18nError(I18nErrorCodes.REQUIRED_VALUE, 'path');\n }\n return value;\n }\n else {\n throw createI18nError(I18nErrorCodes.INVALID_VALUE);\n }\n}\nfunction makeParams(value) {\n const { path, locale, args, choice, plural } = value;\n const options = {};\n const named = args || {};\n if (isString(locale)) {\n options.locale = locale;\n }\n if (isNumber(choice)) {\n options.plural = choice;\n }\n if (isNumber(plural)) {\n options.plural = plural;\n }\n return [path, named, options];\n}\n\nfunction apply(app, i18n, ...options) {\n const pluginOptions = isPlainObject(options[0])\n ? options[0]\n : {};\n const useI18nComponentName = !!pluginOptions.useI18nComponentName;\n const globalInstall = isBoolean(pluginOptions.globalInstall)\n ? pluginOptions.globalInstall\n : true;\n if ((process.env.NODE_ENV !== 'production') && globalInstall && useI18nComponentName) {\n warn(getWarnMessage(I18nWarnCodes.COMPONENT_NAME_LEGACY_COMPATIBLE, {\n name: Translation.name\n }));\n }\n if (globalInstall) {\n [!useI18nComponentName ? Translation.name : 'i18n', 'I18nT'].forEach(name => app.component(name, Translation));\n [NumberFormat.name, 'I18nN'].forEach(name => app.component(name, NumberFormat));\n [DatetimeFormat.name, 'I18nD'].forEach(name => app.component(name, DatetimeFormat));\n }\n // install directive\n {\n app.directive('t', vTDirective(i18n));\n }\n}\n\nconst VueDevToolsLabels = {\n [\"vue-devtools-plugin-vue-i18n\" /* VueDevToolsIDs.PLUGIN */]: 'Vue I18n devtools',\n [\"vue-i18n-resource-inspector\" /* VueDevToolsIDs.CUSTOM_INSPECTOR */]: 'I18n Resources',\n [\"vue-i18n-timeline\" /* VueDevToolsIDs.TIMELINE */]: 'Vue I18n'\n};\nconst VueDevToolsPlaceholders = {\n [\"vue-i18n-resource-inspector\" /* VueDevToolsIDs.CUSTOM_INSPECTOR */]: 'Search for scopes ...'\n};\nconst VueDevToolsTimelineColors = {\n [\"vue-i18n-timeline\" /* VueDevToolsIDs.TIMELINE */]: 0xffcd19\n};\n\nconst VUE_I18N_COMPONENT_TYPES = 'vue-i18n: composer properties';\nlet devtoolsApi;\nasync function enableDevTools(app, i18n) {\n return new Promise((resolve, reject) => {\n try {\n setupDevtoolsPlugin({\n id: \"vue-devtools-plugin-vue-i18n\" /* VueDevToolsIDs.PLUGIN */,\n label: VueDevToolsLabels[\"vue-devtools-plugin-vue-i18n\" /* VueDevToolsIDs.PLUGIN */],\n packageName: 'vue-i18n',\n homepage: 'https://vue-i18n.intlify.dev',\n logo: 'https://vue-i18n.intlify.dev/vue-i18n-devtools-logo.png',\n componentStateTypes: [VUE_I18N_COMPONENT_TYPES],\n app: app // eslint-disable-line @typescript-eslint/no-explicit-any\n }, api => {\n devtoolsApi = api;\n api.on.visitComponentTree(({ componentInstance, treeNode }) => {\n updateComponentTreeTags(componentInstance, treeNode, i18n);\n });\n api.on.inspectComponent(({ componentInstance, instanceData }) => {\n if (componentInstance.vnode.el &&\n componentInstance.vnode.el.__VUE_I18N__ &&\n instanceData) {\n if (i18n.mode === 'legacy') {\n // ignore global scope on legacy mode\n if (componentInstance.vnode.el.__VUE_I18N__ !==\n i18n.global.__composer) {\n inspectComposer(instanceData, componentInstance.vnode.el.__VUE_I18N__);\n }\n }\n else {\n inspectComposer(instanceData, componentInstance.vnode.el.__VUE_I18N__);\n }\n }\n });\n api.addInspector({\n id: \"vue-i18n-resource-inspector\" /* VueDevToolsIDs.CUSTOM_INSPECTOR */,\n label: VueDevToolsLabels[\"vue-i18n-resource-inspector\" /* VueDevToolsIDs.CUSTOM_INSPECTOR */],\n icon: 'language',\n treeFilterPlaceholder: VueDevToolsPlaceholders[\"vue-i18n-resource-inspector\" /* VueDevToolsIDs.CUSTOM_INSPECTOR */]\n });\n api.on.getInspectorTree(payload => {\n if (payload.app === app &&\n payload.inspectorId === \"vue-i18n-resource-inspector\" /* VueDevToolsIDs.CUSTOM_INSPECTOR */) {\n registerScope(payload, i18n);\n }\n });\n const roots = new Map();\n api.on.getInspectorState(async (payload) => {\n if (payload.app === app &&\n payload.inspectorId === \"vue-i18n-resource-inspector\" /* VueDevToolsIDs.CUSTOM_INSPECTOR */) {\n api.unhighlightElement();\n inspectScope(payload, i18n);\n if (payload.nodeId === 'global') {\n if (!roots.has(payload.app)) {\n const [root] = await api.getComponentInstances(payload.app);\n roots.set(payload.app, root);\n }\n api.highlightElement(roots.get(payload.app));\n }\n else {\n const instance = getComponentInstance(payload.nodeId, i18n);\n instance && api.highlightElement(instance);\n }\n }\n });\n api.on.editInspectorState(payload => {\n if (payload.app === app &&\n payload.inspectorId === \"vue-i18n-resource-inspector\" /* VueDevToolsIDs.CUSTOM_INSPECTOR */) {\n editScope(payload, i18n);\n }\n });\n api.addTimelineLayer({\n id: \"vue-i18n-timeline\" /* VueDevToolsIDs.TIMELINE */,\n label: VueDevToolsLabels[\"vue-i18n-timeline\" /* VueDevToolsIDs.TIMELINE */],\n color: VueDevToolsTimelineColors[\"vue-i18n-timeline\" /* VueDevToolsIDs.TIMELINE */]\n });\n resolve(true);\n });\n }\n catch (e) {\n console.error(e);\n reject(false);\n }\n });\n}\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction getI18nScopeLable(instance) {\n return (instance.type.name ||\n instance.type.displayName ||\n instance.type.__file ||\n 'Anonymous');\n}\nfunction updateComponentTreeTags(instance, // eslint-disable-line @typescript-eslint/no-explicit-any\ntreeNode, i18n) {\n // prettier-ignore\n const global = i18n.mode === 'composition'\n ? i18n.global\n : i18n.global.__composer;\n if (instance && instance.vnode.el && instance.vnode.el.__VUE_I18N__) {\n // add custom tags local scope only\n if (instance.vnode.el.__VUE_I18N__ !== global) {\n const tag = {\n label: `i18n (${getI18nScopeLable(instance)} Scope)`,\n textColor: 0x000000,\n backgroundColor: 0xffcd19\n };\n treeNode.tags.push(tag);\n }\n }\n}\nfunction inspectComposer(instanceData, composer) {\n const type = VUE_I18N_COMPONENT_TYPES;\n instanceData.state.push({\n type,\n key: 'locale',\n editable: true,\n value: composer.locale.value\n });\n instanceData.state.push({\n type,\n key: 'availableLocales',\n editable: false,\n value: composer.availableLocales\n });\n instanceData.state.push({\n type,\n key: 'fallbackLocale',\n editable: true,\n value: composer.fallbackLocale.value\n });\n instanceData.state.push({\n type,\n key: 'inheritLocale',\n editable: true,\n value: composer.inheritLocale\n });\n instanceData.state.push({\n type,\n key: 'messages',\n editable: false,\n value: getLocaleMessageValue(composer.messages.value)\n });\n {\n instanceData.state.push({\n type,\n key: 'datetimeFormats',\n editable: false,\n value: composer.datetimeFormats.value\n });\n instanceData.state.push({\n type,\n key: 'numberFormats',\n editable: false,\n value: composer.numberFormats.value\n });\n }\n}\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction getLocaleMessageValue(messages) {\n const value = {};\n Object.keys(messages).forEach((key) => {\n const v = messages[key];\n if (isFunction(v) && 'source' in v) {\n value[key] = getMessageFunctionDetails(v);\n }\n else if (isMessageAST(v) && v.loc && v.loc.source) {\n value[key] = v.loc.source;\n }\n else if (isObject(v)) {\n value[key] = getLocaleMessageValue(v);\n }\n else {\n value[key] = v;\n }\n });\n return value;\n}\nconst ESC = {\n '<': '<',\n '>': '>',\n '\"': '"',\n '&': '&'\n};\nfunction escape(s) {\n return s.replace(/[<>\"&]/g, escapeChar);\n}\nfunction escapeChar(a) {\n return ESC[a] || a;\n}\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction getMessageFunctionDetails(func) {\n const argString = func.source ? `(\"${escape(func.source)}\")` : `(?)`;\n return {\n _custom: {\n type: 'function',\n display: `ƒ ${argString}`\n }\n };\n}\nfunction registerScope(payload, i18n) {\n payload.rootNodes.push({\n id: 'global',\n label: 'Global Scope'\n });\n // prettier-ignore\n const global = i18n.mode === 'composition'\n ? i18n.global\n : i18n.global.__composer;\n for (const [keyInstance, instance] of i18n.__instances) {\n // prettier-ignore\n const composer = i18n.mode === 'composition'\n ? instance\n : instance.__composer;\n if (global === composer) {\n continue;\n }\n payload.rootNodes.push({\n id: composer.id.toString(),\n label: `${getI18nScopeLable(keyInstance)} Scope`\n });\n }\n}\nfunction getComponentInstance(nodeId, i18n) {\n let instance = null;\n if (nodeId !== 'global') {\n for (const [component, composer] of i18n.__instances.entries()) {\n if (composer.id.toString() === nodeId) {\n instance = component;\n break;\n }\n }\n }\n return instance;\n}\nfunction getComposer$1(nodeId, i18n) {\n if (nodeId === 'global') {\n return i18n.mode === 'composition'\n ? i18n.global\n : i18n.global.__composer;\n }\n else {\n const instance = Array.from(i18n.__instances.values()).find(item => item.id.toString() === nodeId);\n if (instance) {\n return i18n.mode === 'composition'\n ? instance\n : instance.__composer;\n }\n else {\n return null;\n }\n }\n}\nfunction inspectScope(payload, i18n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\n) {\n const composer = getComposer$1(payload.nodeId, i18n);\n if (composer) {\n // TODO:\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n payload.state = makeScopeInspectState(composer);\n }\n return null;\n}\nfunction makeScopeInspectState(composer) {\n const state = {};\n const localeType = 'Locale related info';\n const localeStates = [\n {\n type: localeType,\n key: 'locale',\n editable: true,\n value: composer.locale.value\n },\n {\n type: localeType,\n key: 'fallbackLocale',\n editable: true,\n value: composer.fallbackLocale.value\n },\n {\n type: localeType,\n key: 'availableLocales',\n editable: false,\n value: composer.availableLocales\n },\n {\n type: localeType,\n key: 'inheritLocale',\n editable: true,\n value: composer.inheritLocale\n }\n ];\n state[localeType] = localeStates;\n const localeMessagesType = 'Locale messages info';\n const localeMessagesStates = [\n {\n type: localeMessagesType,\n key: 'messages',\n editable: false,\n value: getLocaleMessageValue(composer.messages.value)\n }\n ];\n state[localeMessagesType] = localeMessagesStates;\n {\n const datetimeFormatsType = 'Datetime formats info';\n const datetimeFormatsStates = [\n {\n type: datetimeFormatsType,\n key: 'datetimeFormats',\n editable: false,\n value: composer.datetimeFormats.value\n }\n ];\n state[datetimeFormatsType] = datetimeFormatsStates;\n const numberFormatsType = 'Datetime formats info';\n const numberFormatsStates = [\n {\n type: numberFormatsType,\n key: 'numberFormats',\n editable: false,\n value: composer.numberFormats.value\n }\n ];\n state[numberFormatsType] = numberFormatsStates;\n }\n return state;\n}\nfunction addTimelineEvent(event, payload) {\n if (devtoolsApi) {\n let groupId;\n if (payload && 'groupId' in payload) {\n groupId = payload.groupId;\n delete payload.groupId;\n }\n devtoolsApi.addTimelineEvent({\n layerId: \"vue-i18n-timeline\" /* VueDevToolsIDs.TIMELINE */,\n event: {\n title: event,\n groupId,\n time: Date.now(),\n meta: {},\n data: payload || {},\n logType: event === \"compile-error\" /* VueDevToolsTimelineEvents.COMPILE_ERROR */\n ? 'error'\n : event === \"fallback\" /* VueDevToolsTimelineEvents.FALBACK */ ||\n event === \"missing\" /* VueDevToolsTimelineEvents.MISSING */\n ? 'warning'\n : 'default'\n }\n });\n }\n}\nfunction editScope(payload, i18n) {\n const composer = getComposer$1(payload.nodeId, i18n);\n if (composer) {\n const [field] = payload.path;\n if (field === 'locale' && isString(payload.state.value)) {\n composer.locale.value = payload.state.value;\n }\n else if (field === 'fallbackLocale' &&\n (isString(payload.state.value) ||\n isArray(payload.state.value) ||\n isObject(payload.state.value))) {\n composer.fallbackLocale.value = payload.state.value;\n }\n else if (field === 'inheritLocale' && isBoolean(payload.state.value)) {\n composer.inheritLocale = payload.state.value;\n }\n }\n}\n\n/**\n * Supports compatibility for legacy vue-i18n APIs\n * This mixin is used when we use vue-i18n@v9.x or later\n */\nfunction defineMixin(vuei18n, composer, i18n) {\n return {\n beforeCreate() {\n const instance = getCurrentInstance();\n /* istanbul ignore if */\n if (!instance) {\n throw createI18nError(I18nErrorCodes.UNEXPECTED_ERROR);\n }\n const options = this.$options;\n if (options.i18n) {\n const optionsI18n = options.i18n;\n if (options.__i18n) {\n optionsI18n.__i18n = options.__i18n;\n }\n optionsI18n.__root = composer;\n if (this === this.$root) {\n // merge option and gttach global\n this.$i18n = mergeToGlobal(vuei18n, optionsI18n);\n }\n else {\n optionsI18n.__injectWithOption = true;\n optionsI18n.__extender = i18n.__vueI18nExtend;\n // atttach local VueI18n instance\n this.$i18n = createVueI18n(optionsI18n);\n // extend VueI18n instance\n const _vueI18n = this.$i18n;\n if (_vueI18n.__extender) {\n _vueI18n.__disposer = _vueI18n.__extender(this.$i18n);\n }\n }\n }\n else if (options.__i18n) {\n if (this === this.$root) {\n // merge option and gttach global\n this.$i18n = mergeToGlobal(vuei18n, options);\n }\n else {\n // atttach local VueI18n instance\n this.$i18n = createVueI18n({\n __i18n: options.__i18n,\n __injectWithOption: true,\n __extender: i18n.__vueI18nExtend,\n __root: composer\n });\n // extend VueI18n instance\n const _vueI18n = this.$i18n;\n if (_vueI18n.__extender) {\n _vueI18n.__disposer = _vueI18n.__extender(this.$i18n);\n }\n }\n }\n else {\n // attach global VueI18n instance\n this.$i18n = vuei18n;\n }\n if (options.__i18nGlobal) {\n adjustI18nResources(composer, options, options);\n }\n // defines vue-i18n legacy APIs\n this.$t = (...args) => this.$i18n.t(...args);\n this.$rt = (...args) => this.$i18n.rt(...args);\n this.$tc = (...args) => this.$i18n.tc(...args);\n this.$te = (key, locale) => this.$i18n.te(key, locale);\n this.$d = (...args) => this.$i18n.d(...args);\n this.$n = (...args) => this.$i18n.n(...args);\n this.$tm = (key) => this.$i18n.tm(key);\n i18n.__setInstance(instance, this.$i18n);\n },\n mounted() {\n /* istanbul ignore if */\n if (((process.env.NODE_ENV !== 'production') || __VUE_PROD_DEVTOOLS__) &&\n !false &&\n this.$el &&\n this.$i18n) {\n const _vueI18n = this.$i18n;\n this.$el.__VUE_I18N__ = _vueI18n.__composer;\n const emitter = (this.__v_emitter =\n createEmitter());\n _vueI18n.__enableEmitter && _vueI18n.__enableEmitter(emitter);\n emitter.on('*', addTimelineEvent);\n }\n },\n unmounted() {\n const instance = getCurrentInstance();\n /* istanbul ignore if */\n if (!instance) {\n throw createI18nError(I18nErrorCodes.UNEXPECTED_ERROR);\n }\n const _vueI18n = this.$i18n;\n /* istanbul ignore if */\n if (((process.env.NODE_ENV !== 'production') || __VUE_PROD_DEVTOOLS__) &&\n !false &&\n this.$el &&\n this.$el.__VUE_I18N__) {\n if (this.__v_emitter) {\n this.__v_emitter.off('*', addTimelineEvent);\n delete this.__v_emitter;\n }\n if (this.$i18n) {\n _vueI18n.__disableEmitter && _vueI18n.__disableEmitter();\n delete this.$el.__VUE_I18N__;\n }\n }\n delete this.$t;\n delete this.$rt;\n delete this.$tc;\n delete this.$te;\n delete this.$d;\n delete this.$n;\n delete this.$tm;\n if (_vueI18n.__disposer) {\n _vueI18n.__disposer();\n delete _vueI18n.__disposer;\n delete _vueI18n.__extender;\n }\n i18n.__deleteInstance(instance);\n delete this.$i18n;\n }\n };\n}\nfunction mergeToGlobal(g, options) {\n g.locale = options.locale || g.locale;\n g.fallbackLocale = options.fallbackLocale || g.fallbackLocale;\n g.missing = options.missing || g.missing;\n g.silentTranslationWarn =\n options.silentTranslationWarn || g.silentFallbackWarn;\n g.silentFallbackWarn = options.silentFallbackWarn || g.silentFallbackWarn;\n g.formatFallbackMessages =\n options.formatFallbackMessages || g.formatFallbackMessages;\n g.postTranslation = options.postTranslation || g.postTranslation;\n g.warnHtmlInMessage = options.warnHtmlInMessage || g.warnHtmlInMessage;\n g.escapeParameterHtml = options.escapeParameterHtml || g.escapeParameterHtml;\n g.sync = options.sync || g.sync;\n g.__composer[SetPluralRulesSymbol](options.pluralizationRules || g.pluralizationRules);\n const messages = getLocaleMessages(g.locale, {\n messages: options.messages,\n __i18n: options.__i18n\n });\n Object.keys(messages).forEach(locale => g.mergeLocaleMessage(locale, messages[locale]));\n if (options.datetimeFormats) {\n Object.keys(options.datetimeFormats).forEach(locale => g.mergeDateTimeFormat(locale, options.datetimeFormats[locale]));\n }\n if (options.numberFormats) {\n Object.keys(options.numberFormats).forEach(locale => g.mergeNumberFormat(locale, options.numberFormats[locale]));\n }\n return g;\n}\n\n/**\n * Injection key for {@link useI18n}\n *\n * @remarks\n * The global injection key for I18n instances with `useI18n`. this injection key is used in Web Components.\n * Specify the i18n instance created by {@link createI18n} together with `provide` function.\n *\n * @VueI18nGeneral\n */\nconst I18nInjectionKey = \n/* #__PURE__*/ makeSymbol('global-vue-i18n');\n// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types\nfunction createI18n(options = {}, VueI18nLegacy) {\n // prettier-ignore\n const __legacyMode = __VUE_I18N_LEGACY_API__ && isBoolean(options.legacy)\n ? options.legacy\n : __VUE_I18N_LEGACY_API__;\n // prettier-ignore\n const __globalInjection = isBoolean(options.globalInjection)\n ? options.globalInjection\n : true;\n // prettier-ignore\n const __allowComposition = __VUE_I18N_LEGACY_API__ && __legacyMode\n ? !!options.allowComposition\n : true;\n const __instances = new Map();\n const [globalScope, __global] = createGlobal(options, __legacyMode);\n const symbol = /* #__PURE__*/ makeSymbol((process.env.NODE_ENV !== 'production') ? 'vue-i18n' : '');\n if ((process.env.NODE_ENV !== 'production')) {\n if (__legacyMode && __allowComposition && !false) {\n warn(getWarnMessage(I18nWarnCodes.NOTICE_DROP_ALLOW_COMPOSITION));\n }\n }\n function __getInstance(component) {\n return __instances.get(component) || null;\n }\n function __setInstance(component, instance) {\n __instances.set(component, instance);\n }\n function __deleteInstance(component) {\n __instances.delete(component);\n }\n {\n const i18n = {\n // mode\n get mode() {\n return __VUE_I18N_LEGACY_API__ && __legacyMode\n ? 'legacy'\n : 'composition';\n },\n // allowComposition\n get allowComposition() {\n return __allowComposition;\n },\n // install plugin\n async install(app, ...options) {\n if (((process.env.NODE_ENV !== 'production') || __VUE_PROD_DEVTOOLS__) &&\n !false) {\n app.__VUE_I18N__ = i18n;\n }\n // setup global provider\n app.__VUE_I18N_SYMBOL__ = symbol;\n app.provide(app.__VUE_I18N_SYMBOL__, i18n);\n // set composer & vuei18n extend hook options from plugin options\n if (isPlainObject(options[0])) {\n const opts = options[0];\n i18n.__composerExtend =\n opts.__composerExtend;\n i18n.__vueI18nExtend =\n opts.__vueI18nExtend;\n }\n // global method and properties injection for Composition API\n let globalReleaseHandler = null;\n if (!__legacyMode && __globalInjection) {\n globalReleaseHandler = injectGlobalFields(app, i18n.global);\n }\n // install built-in components and directive\n if (__VUE_I18N_FULL_INSTALL__) {\n apply(app, i18n, ...options);\n }\n // setup mixin for Legacy API\n if (__VUE_I18N_LEGACY_API__ && __legacyMode) {\n app.mixin(defineMixin(__global, __global.__composer, i18n));\n }\n // release global scope\n const unmountApp = app.unmount;\n app.unmount = () => {\n globalReleaseHandler && globalReleaseHandler();\n i18n.dispose();\n unmountApp();\n };\n // setup vue-devtools plugin\n if (((process.env.NODE_ENV !== 'production') || __VUE_PROD_DEVTOOLS__) && !false) {\n const ret = await enableDevTools(app, i18n);\n if (!ret) {\n throw createI18nError(I18nErrorCodes.CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN);\n }\n const emitter = createEmitter();\n if (__legacyMode) {\n const _vueI18n = __global;\n _vueI18n.__enableEmitter && _vueI18n.__enableEmitter(emitter);\n }\n else {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const _composer = __global;\n _composer[EnableEmitter] && _composer[EnableEmitter](emitter);\n }\n emitter.on('*', addTimelineEvent);\n }\n },\n // global accessor\n get global() {\n return __global;\n },\n dispose() {\n globalScope.stop();\n },\n // @internal\n __instances,\n // @internal\n __getInstance,\n // @internal\n __setInstance,\n // @internal\n __deleteInstance\n };\n return i18n;\n }\n}\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nfunction useI18n(options = {}) {\n const instance = getCurrentInstance();\n if (instance == null) {\n throw createI18nError(I18nErrorCodes.MUST_BE_CALL_SETUP_TOP);\n }\n if (!instance.isCE &&\n instance.appContext.app != null &&\n !instance.appContext.app.__VUE_I18N_SYMBOL__) {\n throw createI18nError(I18nErrorCodes.NOT_INSTALLED);\n }\n const i18n = getI18nInstance(instance);\n const gl = getGlobalComposer(i18n);\n const componentOptions = getComponentOptions(instance);\n const scope = getScope(options, componentOptions);\n if (__VUE_I18N_LEGACY_API__) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n if (i18n.mode === 'legacy' && !options.__useComponent) {\n if (!i18n.allowComposition) {\n throw createI18nError(I18nErrorCodes.NOT_AVAILABLE_IN_LEGACY_MODE);\n }\n return useI18nForLegacy(instance, scope, gl, options);\n }\n }\n if (scope === 'global') {\n adjustI18nResources(gl, options, componentOptions);\n return gl;\n }\n if (scope === 'parent') {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let composer = getComposer(i18n, instance, options.__useComponent);\n if (composer == null) {\n if ((process.env.NODE_ENV !== 'production')) {\n warn(getWarnMessage(I18nWarnCodes.NOT_FOUND_PARENT_SCOPE));\n }\n composer = gl;\n }\n return composer;\n }\n const i18nInternal = i18n;\n let composer = i18nInternal.__getInstance(instance);\n if (composer == null) {\n const composerOptions = assign({}, options);\n if ('__i18n' in componentOptions) {\n composerOptions.__i18n = componentOptions.__i18n;\n }\n if (gl) {\n composerOptions.__root = gl;\n }\n composer = createComposer(composerOptions);\n if (i18nInternal.__composerExtend) {\n composer[DisposeSymbol] =\n i18nInternal.__composerExtend(composer);\n }\n setupLifeCycle(i18nInternal, instance, composer);\n i18nInternal.__setInstance(instance, composer);\n }\n return composer;\n}\n/**\n * Cast to VueI18n legacy compatible type\n *\n * @remarks\n * This API is provided only with [vue-i18n-bridge](https://vue-i18n.intlify.dev/guide/migration/ways.html#what-is-vue-i18n-bridge).\n *\n * The purpose of this function is to convert an {@link I18n} instance created with {@link createI18n | createI18n(legacy: true)} into a `vue-i18n@v8.x` compatible instance of `new VueI18n` in a TypeScript environment.\n *\n * @param i18n - An instance of {@link I18n}\n * @returns A i18n instance which is casted to {@link VueI18n} type\n *\n * @VueI18nTip\n * :new: provided by **vue-i18n-bridge only**\n *\n * @VueI18nGeneral\n */\nconst castToVueI18n = /* #__PURE__*/ (i18n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\n) => {\n if (!(__VUE_I18N_BRIDGE__ in i18n)) {\n throw createI18nError(I18nErrorCodes.NOT_COMPATIBLE_LEGACY_VUE_I18N);\n }\n return i18n;\n};\nfunction createGlobal(options, legacyMode, VueI18nLegacy // eslint-disable-line @typescript-eslint/no-explicit-any\n) {\n const scope = effectScope();\n {\n const obj = __VUE_I18N_LEGACY_API__ && legacyMode\n ? scope.run(() => createVueI18n(options))\n : scope.run(() => createComposer(options));\n if (obj == null) {\n throw createI18nError(I18nErrorCodes.UNEXPECTED_ERROR);\n }\n return [scope, obj];\n }\n}\nfunction getI18nInstance(instance) {\n {\n const i18n = inject(!instance.isCE\n ? instance.appContext.app.__VUE_I18N_SYMBOL__\n : I18nInjectionKey);\n /* istanbul ignore if */\n if (!i18n) {\n throw createI18nError(!instance.isCE\n ? I18nErrorCodes.UNEXPECTED_ERROR\n : I18nErrorCodes.NOT_INSTALLED_WITH_PROVIDE);\n }\n return i18n;\n }\n}\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction getScope(options, componentOptions) {\n // prettier-ignore\n return isEmptyObject(options)\n ? ('__i18n' in componentOptions)\n ? 'local'\n : 'global'\n : !options.useScope\n ? 'local'\n : options.useScope;\n}\nfunction getGlobalComposer(i18n) {\n // prettier-ignore\n return i18n.mode === 'composition'\n ? i18n.global\n : i18n.global.__composer\n ;\n}\nfunction getComposer(i18n, target, useComponent = false) {\n let composer = null;\n const root = target.root;\n let current = getParentComponentInstance(target, useComponent);\n while (current != null) {\n const i18nInternal = i18n;\n if (i18n.mode === 'composition') {\n composer = i18nInternal.__getInstance(current);\n }\n else {\n if (__VUE_I18N_LEGACY_API__) {\n const vueI18n = i18nInternal.__getInstance(current);\n if (vueI18n != null) {\n composer = vueI18n\n .__composer;\n if (useComponent &&\n composer &&\n !composer[InejctWithOptionSymbol] // eslint-disable-line @typescript-eslint/no-explicit-any\n ) {\n composer = null;\n }\n }\n }\n }\n if (composer != null) {\n break;\n }\n if (root === current) {\n break;\n }\n current = current.parent;\n }\n return composer;\n}\nfunction getParentComponentInstance(target, useComponent = false) {\n if (target == null) {\n return null;\n }\n {\n // if `useComponent: true` will be specified, we get lexical scope owner instance for use-case slots\n return !useComponent\n ? target.parent\n : target.vnode.ctx || target.parent; // eslint-disable-line @typescript-eslint/no-explicit-any\n }\n}\nfunction setupLifeCycle(i18n, target, composer) {\n let emitter = null;\n {\n onMounted(() => {\n // inject composer instance to DOM for intlify-devtools\n if (((process.env.NODE_ENV !== 'production') || __VUE_PROD_DEVTOOLS__) &&\n !false &&\n target.vnode.el) {\n target.vnode.el.__VUE_I18N__ = composer;\n emitter = createEmitter();\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const _composer = composer;\n _composer[EnableEmitter] && _composer[EnableEmitter](emitter);\n emitter.on('*', addTimelineEvent);\n }\n }, target);\n onUnmounted(() => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const _composer = composer;\n // remove composer instance from DOM for intlify-devtools\n if (((process.env.NODE_ENV !== 'production') || __VUE_PROD_DEVTOOLS__) &&\n !false &&\n target.vnode.el &&\n target.vnode.el.__VUE_I18N__) {\n emitter && emitter.off('*', addTimelineEvent);\n _composer[DisableEmitter] && _composer[DisableEmitter]();\n delete target.vnode.el.__VUE_I18N__;\n }\n i18n.__deleteInstance(target);\n // dispose extended resources\n const dispose = _composer[DisposeSymbol];\n if (dispose) {\n dispose();\n delete _composer[DisposeSymbol];\n }\n }, target);\n }\n}\nfunction useI18nForLegacy(instance, scope, root, options = {} // eslint-disable-line @typescript-eslint/no-explicit-any\n) {\n const isLocalScope = scope === 'local';\n const _composer = shallowRef(null);\n if (isLocalScope &&\n instance.proxy &&\n !(instance.proxy.$options.i18n || instance.proxy.$options.__i18n)) {\n throw createI18nError(I18nErrorCodes.MUST_DEFINE_I18N_OPTION_IN_ALLOW_COMPOSITION);\n }\n const _inheritLocale = isBoolean(options.inheritLocale)\n ? options.inheritLocale\n : !isString(options.locale);\n const _locale = ref(\n // prettier-ignore\n !isLocalScope || _inheritLocale\n ? root.locale.value\n : isString(options.locale)\n ? options.locale\n : DEFAULT_LOCALE);\n const _fallbackLocale = ref(\n // prettier-ignore\n !isLocalScope || _inheritLocale\n ? root.fallbackLocale.value\n : isString(options.fallbackLocale) ||\n isArray(options.fallbackLocale) ||\n isPlainObject(options.fallbackLocale) ||\n options.fallbackLocale === false\n ? options.fallbackLocale\n : _locale.value);\n const _messages = ref(getLocaleMessages(_locale.value, options));\n // prettier-ignore\n const _datetimeFormats = ref(isPlainObject(options.datetimeFormats)\n ? options.datetimeFormats\n : { [_locale.value]: {} });\n // prettier-ignore\n const _numberFormats = ref(isPlainObject(options.numberFormats)\n ? options.numberFormats\n : { [_locale.value]: {} });\n // prettier-ignore\n const _missingWarn = isLocalScope\n ? root.missingWarn\n : isBoolean(options.missingWarn) || isRegExp(options.missingWarn)\n ? options.missingWarn\n : true;\n // prettier-ignore\n const _fallbackWarn = isLocalScope\n ? root.fallbackWarn\n : isBoolean(options.fallbackWarn) || isRegExp(options.fallbackWarn)\n ? options.fallbackWarn\n : true;\n // prettier-ignore\n const _fallbackRoot = isLocalScope\n ? root.fallbackRoot\n : isBoolean(options.fallbackRoot)\n ? options.fallbackRoot\n : true;\n // configure fall back to root\n const _fallbackFormat = !!options.fallbackFormat;\n // runtime missing\n const _missing = isFunction(options.missing) ? options.missing : null;\n // postTranslation handler\n const _postTranslation = isFunction(options.postTranslation)\n ? options.postTranslation\n : null;\n // prettier-ignore\n const _warnHtmlMessage = isLocalScope\n ? root.warnHtmlMessage\n : isBoolean(options.warnHtmlMessage)\n ? options.warnHtmlMessage\n : true;\n const _escapeParameter = !!options.escapeParameter;\n // prettier-ignore\n const _modifiers = isLocalScope\n ? root.modifiers\n : isPlainObject(options.modifiers)\n ? options.modifiers\n : {};\n // pluralRules\n const _pluralRules = options.pluralRules || (isLocalScope && root.pluralRules);\n // track reactivity\n function trackReactivityValues() {\n return [\n _locale.value,\n _fallbackLocale.value,\n _messages.value,\n _datetimeFormats.value,\n _numberFormats.value\n ];\n }\n // locale\n const locale = computed({\n get: () => {\n return _composer.value ? _composer.value.locale.value : _locale.value;\n },\n set: val => {\n if (_composer.value) {\n _composer.value.locale.value = val;\n }\n _locale.value = val;\n }\n });\n // fallbackLocale\n const fallbackLocale = computed({\n get: () => {\n return _composer.value\n ? _composer.value.fallbackLocale.value\n : _fallbackLocale.value;\n },\n set: val => {\n if (_composer.value) {\n _composer.value.fallbackLocale.value = val;\n }\n _fallbackLocale.value = val;\n }\n });\n // messages\n const messages = computed(() => {\n if (_composer.value) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return _composer.value.messages.value;\n }\n else {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return _messages.value;\n }\n });\n const datetimeFormats = computed(() => _datetimeFormats.value);\n const numberFormats = computed(() => _numberFormats.value);\n function getPostTranslationHandler() {\n return _composer.value\n ? _composer.value.getPostTranslationHandler()\n : _postTranslation;\n }\n function setPostTranslationHandler(handler) {\n if (_composer.value) {\n _composer.value.setPostTranslationHandler(handler);\n }\n }\n function getMissingHandler() {\n return _composer.value ? _composer.value.getMissingHandler() : _missing;\n }\n function setMissingHandler(handler) {\n if (_composer.value) {\n _composer.value.setMissingHandler(handler);\n }\n }\n function warpWithDeps(fn) {\n trackReactivityValues();\n return fn();\n }\n function t(...args) {\n return _composer.value\n ? warpWithDeps(() => Reflect.apply(_composer.value.t, null, [...args]))\n : warpWithDeps(() => '');\n }\n function rt(...args) {\n return _composer.value\n ? Reflect.apply(_composer.value.rt, null, [...args])\n : '';\n }\n function d(...args) {\n return _composer.value\n ? warpWithDeps(() => Reflect.apply(_composer.value.d, null, [...args]))\n : warpWithDeps(() => '');\n }\n function n(...args) {\n return _composer.value\n ? warpWithDeps(() => Reflect.apply(_composer.value.n, null, [...args]))\n : warpWithDeps(() => '');\n }\n function tm(key) {\n return _composer.value ? _composer.value.tm(key) : {};\n }\n function te(key, locale) {\n return _composer.value ? _composer.value.te(key, locale) : false;\n }\n function getLocaleMessage(locale) {\n return _composer.value ? _composer.value.getLocaleMessage(locale) : {};\n }\n function setLocaleMessage(locale, message) {\n if (_composer.value) {\n _composer.value.setLocaleMessage(locale, message);\n _messages.value[locale] = message;\n }\n }\n function mergeLocaleMessage(locale, message) {\n if (_composer.value) {\n _composer.value.mergeLocaleMessage(locale, message);\n }\n }\n function getDateTimeFormat(locale) {\n return _composer.value ? _composer.value.getDateTimeFormat(locale) : {};\n }\n function setDateTimeFormat(locale, format) {\n if (_composer.value) {\n _composer.value.setDateTimeFormat(locale, format);\n _datetimeFormats.value[locale] = format;\n }\n }\n function mergeDateTimeFormat(locale, format) {\n if (_composer.value) {\n _composer.value.mergeDateTimeFormat(locale, format);\n }\n }\n function getNumberFormat(locale) {\n return _composer.value ? _composer.value.getNumberFormat(locale) : {};\n }\n function setNumberFormat(locale, format) {\n if (_composer.value) {\n _composer.value.setNumberFormat(locale, format);\n _numberFormats.value[locale] = format;\n }\n }\n function mergeNumberFormat(locale, format) {\n if (_composer.value) {\n _composer.value.mergeNumberFormat(locale, format);\n }\n }\n const wrapper = {\n get id() {\n return _composer.value ? _composer.value.id : -1;\n },\n locale,\n fallbackLocale,\n messages,\n datetimeFormats,\n numberFormats,\n get inheritLocale() {\n return _composer.value ? _composer.value.inheritLocale : _inheritLocale;\n },\n set inheritLocale(val) {\n if (_composer.value) {\n _composer.value.inheritLocale = val;\n }\n },\n get availableLocales() {\n return _composer.value\n ? _composer.value.availableLocales\n : Object.keys(_messages.value);\n },\n get modifiers() {\n return (_composer.value ? _composer.value.modifiers : _modifiers);\n },\n get pluralRules() {\n return (_composer.value ? _composer.value.pluralRules : _pluralRules);\n },\n get isGlobal() {\n return _composer.value ? _composer.value.isGlobal : false;\n },\n get missingWarn() {\n return _composer.value ? _composer.value.missingWarn : _missingWarn;\n },\n set missingWarn(val) {\n if (_composer.value) {\n _composer.value.missingWarn = val;\n }\n },\n get fallbackWarn() {\n return _composer.value ? _composer.value.fallbackWarn : _fallbackWarn;\n },\n set fallbackWarn(val) {\n if (_composer.value) {\n _composer.value.missingWarn = val;\n }\n },\n get fallbackRoot() {\n return _composer.value ? _composer.value.fallbackRoot : _fallbackRoot;\n },\n set fallbackRoot(val) {\n if (_composer.value) {\n _composer.value.fallbackRoot = val;\n }\n },\n get fallbackFormat() {\n return _composer.value ? _composer.value.fallbackFormat : _fallbackFormat;\n },\n set fallbackFormat(val) {\n if (_composer.value) {\n _composer.value.fallbackFormat = val;\n }\n },\n get warnHtmlMessage() {\n return _composer.value\n ? _composer.value.warnHtmlMessage\n : _warnHtmlMessage;\n },\n set warnHtmlMessage(val) {\n if (_composer.value) {\n _composer.value.warnHtmlMessage = val;\n }\n },\n get escapeParameter() {\n return _composer.value\n ? _composer.value.escapeParameter\n : _escapeParameter;\n },\n set escapeParameter(val) {\n if (_composer.value) {\n _composer.value.escapeParameter = val;\n }\n },\n t,\n getPostTranslationHandler,\n setPostTranslationHandler,\n getMissingHandler,\n setMissingHandler,\n rt,\n d,\n n,\n tm,\n te,\n getLocaleMessage,\n setLocaleMessage,\n mergeLocaleMessage,\n getDateTimeFormat,\n setDateTimeFormat,\n mergeDateTimeFormat,\n getNumberFormat,\n setNumberFormat,\n mergeNumberFormat\n };\n function sync(composer) {\n composer.locale.value = _locale.value;\n composer.fallbackLocale.value = _fallbackLocale.value;\n Object.keys(_messages.value).forEach(locale => {\n composer.mergeLocaleMessage(locale, _messages.value[locale]);\n });\n Object.keys(_datetimeFormats.value).forEach(locale => {\n composer.mergeDateTimeFormat(locale, _datetimeFormats.value[locale]);\n });\n Object.keys(_numberFormats.value).forEach(locale => {\n composer.mergeNumberFormat(locale, _numberFormats.value[locale]);\n });\n composer.escapeParameter = _escapeParameter;\n composer.fallbackFormat = _fallbackFormat;\n composer.fallbackRoot = _fallbackRoot;\n composer.fallbackWarn = _fallbackWarn;\n composer.missingWarn = _missingWarn;\n composer.warnHtmlMessage = _warnHtmlMessage;\n }\n onBeforeMount(() => {\n if (instance.proxy == null || instance.proxy.$i18n == null) {\n throw createI18nError(I18nErrorCodes.NOT_AVAILABLE_COMPOSITION_IN_LEGACY);\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const composer = (_composer.value = instance.proxy.$i18n\n .__composer);\n if (scope === 'global') {\n _locale.value = composer.locale.value;\n _fallbackLocale.value = composer.fallbackLocale.value;\n _messages.value = composer.messages.value;\n _datetimeFormats.value = composer.datetimeFormats.value;\n _numberFormats.value = composer.numberFormats.value;\n }\n else if (isLocalScope) {\n sync(composer);\n }\n });\n return wrapper;\n}\nconst globalExportProps = [\n 'locale',\n 'fallbackLocale',\n 'availableLocales'\n];\nconst globalExportMethods = ['t', 'rt', 'd', 'n', 'tm', 'te']\n ;\nfunction injectGlobalFields(app, composer) {\n const i18n = Object.create(null);\n globalExportProps.forEach(prop => {\n const desc = Object.getOwnPropertyDescriptor(composer, prop);\n if (!desc) {\n throw createI18nError(I18nErrorCodes.UNEXPECTED_ERROR);\n }\n const wrap = isRef(desc.value) // check computed props\n ? {\n get() {\n return desc.value.value;\n },\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n set(val) {\n desc.value.value = val;\n }\n }\n : {\n get() {\n return desc.get && desc.get();\n }\n };\n Object.defineProperty(i18n, prop, wrap);\n });\n app.config.globalProperties.$i18n = i18n;\n globalExportMethods.forEach(method => {\n const desc = Object.getOwnPropertyDescriptor(composer, method);\n if (!desc || !desc.value) {\n throw createI18nError(I18nErrorCodes.UNEXPECTED_ERROR);\n }\n Object.defineProperty(app.config.globalProperties, `$${method}`, desc);\n });\n const dispose = () => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n delete app.config.globalProperties.$i18n;\n globalExportMethods.forEach(method => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n delete app.config.globalProperties[`$${method}`];\n });\n };\n return dispose;\n}\n\n{\n initFeatureFlags();\n}\n// register message compiler at vue-i18n\nif (__INTLIFY_JIT_COMPILATION__) {\n registerMessageCompiler(compile);\n}\nelse {\n registerMessageCompiler(compileToFunction);\n}\n// register message resolver at vue-i18n\nregisterMessageResolver(resolveValue);\n// register fallback locale at vue-i18n\nregisterLocaleFallbacker(fallbackWithLocaleChain);\n// NOTE: experimental !!\nif ((process.env.NODE_ENV !== 'production') || __INTLIFY_PROD_DEVTOOLS__) {\n const target = getGlobalThis();\n target.__INTLIFY__ = true;\n setDevToolsHook(target.__INTLIFY_DEVTOOLS_GLOBAL_HOOK__);\n}\nif ((process.env.NODE_ENV !== 'production')) ;\n\nexport { DatetimeFormat, I18nD, I18nInjectionKey, I18nN, I18nT, NumberFormat, Translation, VERSION, castToVueI18n, createI18n, useI18n, vTDirective };\n","import { createI18n } from 'vue-i18n'\n\nlet i18n = createI18n({\n\tlocale: 'en', // default locale will be overwritten by the products.json\n\tfallbackLocale: 'en',\n\tmessages: {},\n\tsilentFallbackWarn: true,\n\tsilentTranslationWarn: true\n});\n\nexport default i18n;","import { createApp } from 'vue'\nimport App from './App.vue'\nimport Store from \"./Store\"\nimport I18n from './I18n';\n\nimport {version} from '../package.json';\nconsole.log(`Aliaxis Showroom - Version ${version} Starting...`);\nconsole.log(\"\");\n\n// global method to get media files\nconst getMedia = ((url) => {\n return new URL(`/src/assets/${url}`, import.meta.url).href;\n});\n\n// Create App\nlet app = createApp(App);\napp.config.globalProperties.$getMedia = getMedia;\napp.use(Store);\napp.use(I18n);\napp.mount('#app');"],"file":"assets/index-6175b78e.js"}