1 |
- {"ast":null,"code":"import _asyncToGenerator from \"F:/workspace/202226701027/huinongbao-app/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js\";\nimport { EngineStore } from \"./engineStore.js\";\nimport { Logger } from \"../Misc/logger.js\";\nimport { Effect } from \"../Materials/effect.js\";\nimport { PerformanceConfigurator } from \"./performanceConfigurator.js\";\nimport { PrecisionDate } from \"../Misc/precisionDate.js\";\nimport { DepthCullingState } from \"../States/depthCullingState.js\";\nimport { StencilStateComposer } from \"../States/stencilStateComposer.js\";\nimport { StencilState } from \"../States/stencilState.js\";\nimport { AlphaState } from \"../States/alphaCullingState.js\";\nimport { _WarnImport } from \"../Misc/devTools.js\";\nimport { InternalTexture } from \"../Materials/Textures/internalTexture.js\";\nimport { IsDocumentAvailable, IsNavigatorAvailable, IsWindowObjectExist } from \"../Misc/domManagement.js\";\nimport { Observable } from \"../Misc/observable.js\";\nimport { EngineFunctionContext, _loadFile } from \"./abstractEngine.functions.js\";\nimport { _GetCompatibleTextureLoader } from \"../Materials/Textures/Loaders/textureLoaderManager.js\";\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 */\nexport function 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 } else {\n const {\n requestAnimationFrame\n } = 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 * The parent class for specialized engines (WebGL, WebGPU)\n */\nexport class AbstractEngine {\n /**\n * Gets the current frame id\n */\n get frameId() {\n return this._frameId;\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 * @internal\n */\n _getShaderProcessor(shaderLanguage) {\n return this._shaderProcessor;\n }\n /**\n * Gets the shader platform name used by the effects.\n */\n get shaderPlatformName() {\n return this._shaderPlatformName;\n }\n _clearEmptyResources() {\n this._emptyTexture = null;\n this._emptyCubeTexture = null;\n this._emptyTexture3D = null;\n this._emptyTexture2DArray = null;\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 } else {\n this._depthCullingState.depthFunc = 515;\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 /** @internal */\n _getGlobalDefines(defines) {\n if (defines) {\n if (this.isNDCHalfZRange) {\n defines[\"IS_NDC_HALF_ZRANGE\"] = \"\";\n } else {\n delete defines[\"IS_NDC_HALF_ZRANGE\"];\n }\n if (this.useReverseDepthBuffer) {\n defines[\"USE_REVERSE_DEPTHBUFFER\"] = \"\";\n } else {\n delete defines[\"USE_REVERSE_DEPTHBUFFER\"];\n }\n if (this.useExactSrgbConversions) {\n defines[\"USE_EXACT_SRGB_CONVERSIONS\"] = \"\";\n } else {\n delete defines[\"USE_EXACT_SRGB_CONVERSIONS\"];\n }\n return;\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 _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._prepareEffect();\n }\n Effect.ResetCache();\n }\n _rebuildGraphicsResources() {\n var _this$_rebuildCompute;\n // Ensure webgl and engine states are matching\n this.wipeCaches(true);\n // Rebuild effects\n this._rebuildEffects();\n (_this$_rebuildCompute = this._rebuildComputeEffects) === null || _this$_rebuildCompute === void 0 || _this$_rebuildCompute.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._rebuildTextures();\n // Rebuild textures\n this._rebuildRenderTargetWrappers();\n // Reset engine states after all the buffer/textures/... have been rebuilt\n this.wipeCaches(true);\n }\n _flagContextRestored() {\n Logger.Warn(this.name + \" context successfully restored.\");\n this.onContextRestoredObservable.notifyObservers(this);\n this._contextWasLost = false;\n }\n _restoreEngineAfterContextLost(initEngine) {\n var _this = this;\n // Adding a timeout to avoid race condition at browser level\n setTimeout( /*#__PURE__*/_asyncToGenerator(function* () {\n _this._clearEmptyResources();\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 yield initEngine();\n _this._rebuildGraphicsResources();\n _this._depthCullingState.depthTest = depthTest;\n _this._depthCullingState.depthFunc = depthFunc;\n _this._depthCullingState.depthMask = depthMask;\n _this._stencilState.stencilTest = stencilTest;\n _this._flagContextRestored();\n }), 0);\n }\n /** Gets a boolean indicating if the engine was disposed */\n get isDisposed() {\n return this._isDisposed;\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 // Do nothing\n }\n /**\n * Gets or sets the snapshot rendering mode\n */\n get snapshotRenderingMode() {\n return 0;\n }\n set snapshotRenderingMode(mode) {}\n /**\n * Returns the string \"AbstractEngine\"\n * @returns \"AbstractEngine\"\n */\n getClassName() {\n return \"AbstractEngine\";\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 the list of current active render loop functions\n * @returns a read only array with the current render loop functions\n */\n get activeRenderLoops() {\n return this._activeRenderLoops;\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._frameHandler !== 0) {\n const handlerToCancel = this._frameHandler;\n this._frameHandler = 0;\n if (!IsWindowObjectExist()) {\n if (typeof cancelAnimationFrame === \"function\") {\n return cancelAnimationFrame(handlerToCancel);\n }\n } else {\n const {\n cancelAnimationFrame\n } = this.getHostWindow() || window;\n if (typeof cancelAnimationFrame === \"function\") {\n return cancelAnimationFrame(handlerToCancel);\n }\n }\n return clearTimeout(handlerToCancel);\n }\n }\n /**\n * Begin a new frame\n */\n beginFrame() {\n this.onBeginFrameObservable.notifyObservers(this);\n }\n /**\n * End the current frame\n */\n endFrame() {\n this._frameId++;\n this.onEndFrameObservable.notifyObservers(this);\n }\n /** @internal */\n _renderLoop() {\n // Reset the frame handler before rendering a frame to determine if a new frame has been queued.\n this._frameHandler = 0;\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 // The first condition prevents queuing another frame if we no longer have active render loops (e.g., if\n // `stopRenderLoop` is called mid frame). The second condition prevents queuing another frame if one has\n // already been queued (e.g., if `stopRenderLoop` and `runRenderLoop` is called mid frame).\n if (this._activeRenderLoops.length > 0 && this._frameHandler === 0) {\n this._frameHandler = this._queueNewFrame(this._boundRenderFunction, this.getHostWindow());\n }\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 /** @internal */\n _renderViews() {\n return false;\n }\n /**\n * Can be used to override the current requestAnimationFrame requester.\n * @internal\n */\n _queueNewFrame(bindedRenderFunction, requester) {\n return 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 // On the first added function, start the render loop.\n if (this._activeRenderLoops.length === 1 && this._frameHandler === 0) {\n this._frameHandler = this._queueNewFrame(this._boundRenderFunction, this.getHostWindow());\n }\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 * 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 * (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 _rebuildTextures() {\n for (const scene of this.scenes) {\n scene._rebuildTextures();\n }\n for (const scene of this._virtualScenes) {\n scene._rebuildTextures();\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 /**\n * Gets the current viewport\n */\n get currentViewport() {\n return this._cachedViewport;\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 * Create an image to use with canvas\n * @returns IImage interface\n */\n createCanvasImage() {\n return document.createElement(\"img\");\n }\n /**\n * Returns a string describing the current engine\n */\n get description() {\n let description = this.name + this.version;\n if (this._caps.parallelShaderCompile) {\n description += \" - Parallel shader compilation\";\n }\n return description;\n }\n _createTextureBase(url, noMipmap, invertY, scene, samplingMode = 3, onLoad = null, onError = null, prepareTexture, prepareTextureProcess, 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, 1 /* 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 // Remove query string\n const queryStringIndex = extension.indexOf(\"?\");\n if (queryStringIndex > -1) {\n extension = extension.split(\"?\")[0];\n }\n const loaderPromise = _GetCompatibleTextureLoader(extension, mimeType);\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 && url !== EngineStore.FallbackTexture) {\n this._createTextureBase(EngineStore.FallbackTexture, noMipmap, texture.invertY, scene, samplingMode, null, onError, prepareTexture, prepareTextureProcess, buffer, texture);\n }\n message = (message || \"Unknown error\") + (EngineStore.UseFallbackTexture ? \" - Fallback texture was used\" : \"\");\n texture.onErrorObservable.notifyObservers({\n message,\n exception\n });\n if (onError) {\n onError(message, exception);\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, prepareTextureProcess, buffer, texture, format, forcedExtension, mimeType, loaderOptions, useSRGBBuffer);\n }\n };\n // processing for non-image formats\n if (loaderPromise) {\n const callback = /*#__PURE__*/function () {\n var _ref2 = _asyncToGenerator(function* (data) {\n const loader = yield loaderPromise;\n loader.loadData(data, texture, (width, height, loadMipmap, isCompressed, done, loadFailed) => {\n if (loadFailed) {\n onInternalError(\"TextureLoader failed to load data\");\n } else {\n prepareTexture(texture, extension, scene, {\n width,\n height\n }, texture.invertY, !loadMipmap, isCompressed, () => {\n done();\n return false;\n }, samplingMode);\n }\n }, loaderOptions);\n });\n return function callback(_x) {\n return _ref2.apply(this, arguments);\n };\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 } else {\n if (buffer instanceof ArrayBuffer) {\n callback(new Uint8Array(buffer));\n } else if (ArrayBuffer.isView(buffer)) {\n callback(buffer);\n } else {\n if (onError) {\n onError(\"Unable to load: only ArrayBuffer or ArrayBufferView is supported\", null);\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, prepareTextureProcess, 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 } else {\n AbstractEngine._FileToolsLoadImage(url || \"\", onload, onInternalError, scene ? scene.offlineProvider : null, mimeType, texture.invertY && this._features.needsInvertingBitmap ? {\n imageOrientation: \"flipY\"\n } : undefined);\n }\n } else if (typeof buffer === \"string\" || buffer instanceof ArrayBuffer || ArrayBuffer.isView(buffer) || buffer instanceof Blob) {\n AbstractEngine._FileToolsLoadImage(buffer, onload, onInternalError, scene ? scene.offlineProvider : null, mimeType, texture.invertY && this._features.needsInvertingBitmap ? {\n imageOrientation: \"flipY\"\n } : undefined);\n } else if (buffer) {\n onload(buffer);\n }\n }\n return texture;\n }\n _rebuildBuffers() {\n // Uniforms\n for (const uniformBuffer of this._uniformBuffers) {\n uniformBuffer._rebuildAfterContextLost();\n }\n }\n /** @internal */\n get _shouldUseHighPrecisionShader() {\n return !!(this._caps.highPrecisionShaderSupported && this._highPrecisionShadersAllowed);\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 /**\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 * 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 * Gets the object containing all engine capabilities\n * @returns the EngineCapabilities object\n */\n getCaps() {\n return this._caps;\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 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 current npm package of the sdk\n */\n // Not mixed with Version for tooling purpose.\n static get NpmPackage() {\n return \"babylonjs@7.37.0\";\n }\n /**\n * Returns the current version of the framework\n */\n static get Version() {\n return \"7.37.0\";\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 * 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 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 /**\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 /**\n * Gets the options used for engine creation\n * @returns EngineOptions object\n */\n getCreationOptions() {\n return this._creationOptions;\n }\n /**\n * Creates a new engine\n * @param antialias defines whether anti-aliasing should be enabled. If undefined, it means that the underlying engine is free to enable it or not\n * @param options defines further options to be sent to the creation context\n * @param adaptToDeviceRatio defines whether to adapt to the device's viewport characteristics (default: false)\n */\n constructor(antialias, options, adaptToDeviceRatio) {\n var _adaptToDeviceRatio, _options$deterministi, _options$lockstepMaxS, _options$timeStep, _options$audioEngine, _options$stencil, _options$audioEngineO, _options$audioEngineO2, _options$audioEngineO3, _options$audioEngineO4, _options$premultiplie, _options$useExactSrgb;\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 this._activeRequests = [];\n /** @internal */\n this._badOS = false;\n /** @internal */\n this._badDesktopOS = false;\n this._compatibilityMode = true;\n /** @internal */\n this._internalTexturesCache = new Array();\n /** @internal */\n this._currentRenderTarget = null;\n /** @internal */\n this._boundTexturesCache = {};\n /** @internal */\n this._activeChannel = 0;\n /** @internal */\n this._currentTextureChannel = -1;\n /** @internal */\n this._viewportCached = {\n x: 0,\n y: 0,\n z: 0,\n w: 0\n };\n /** @internal */\n this._isWebGPU = false;\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 * Event raised when a new scene is created\n */\n this.onNewSceneAddedObservable = new Observable();\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 receives pointerout event\n */\n this.onCanvasPointerOutObservable = new Observable();\n /**\n * Turn this value on if you want to pause FPS computation when in background\n */\n this.disablePerformanceMonitorInBackground = 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 /** @internal */\n this._frameId = 0;\n /**\n * Gets information about the current host\n */\n this.hostInformation = {\n isMobile: false\n };\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 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 or sets the current render pass id\n */\n this.currentRenderPassId = 0;\n /**\n * Gets a boolean indicating if the pointer is currently locked\n */\n this.isPointerLock = false;\n /**\n * Gets the list of created postprocesses\n */\n this.postProcesses = [];\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 /** @internal */\n this._contextWasLost = 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 /** @internal */\n this._renderTargetWrapperCache = new Array();\n /** @internal */\n this._compiledEffects = {};\n /** @internal */\n this._isDisposed = false;\n /**\n * Gets the list of created scenes\n */\n this.scenes = [];\n /** @internal */\n this._virtualScenes = new Array();\n /**\n * Observable event triggered before each texture is initialized\n */\n this.onBeforeTextureInitObservable = new Observable();\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 /** @internal */\n this._frameHandler = 0;\n /** @internal */\n this._activeRenderLoops = new Array();\n /** @internal */\n this._windowIsBackground = false;\n /** @internal */\n this._boundRenderFunction = () => this._renderLoop();\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 /**\n * Observable raised when the engine begins a new frame\n */\n this.onBeginFrameObservable = new Observable();\n /**\n * Observable raised when the engine ends the current frame\n */\n this.onEndFrameObservable = new Observable();\n /** @internal */\n this._transformTextureUrl = null;\n /** @internal */\n this._uniformBuffers = new Array();\n /** @internal */\n this._storageBuffers = new Array();\n this._highPrecisionShadersAllowed = true;\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 /** @internal */\n this._name = \"\";\n /**\n * Defines whether the engine has been created with the premultipliedAlpha option on or not.\n */\n this.premultipliedAlpha = true;\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._doNotHandleContextLost = 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 /** @internal */\n this._renderPassNames = [\"main\"];\n // FPS\n this._fps = 60;\n this._deltaTime = 0;\n // Deterministic lockstepMaxSteps\n /** @internal */\n this._deterministicLockstep = false;\n /** @internal */\n this._lockstepMaxSteps = 4;\n /** @internal */\n this._timeStep = 1 / 60;\n /**\n * An event triggered when the engine is disposed.\n */\n this.onDisposeObservable = new Observable();\n EngineStore.Instances.push(this);\n this.startTime = PrecisionDate.Now;\n this._stencilStateComposer.stencilGlobal = this._stencilState;\n PerformanceConfigurator.SetMatrixPrecision(!!options.useHighPrecisionMatrix);\n if (IsNavigatorAvailable() && navigator.userAgent) {\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 // Detect if we are running on a faulty buggy desktop OS.\n this._badDesktopOS = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\n }\n // Save this off for use in resize().\n this.adaptToDeviceRatio = (_adaptToDeviceRatio = adaptToDeviceRatio) !== null && _adaptToDeviceRatio !== void 0 ? _adaptToDeviceRatio : false;\n options.antialias = antialias !== null && antialias !== void 0 ? antialias : options.antialias;\n options.deterministicLockstep = (_options$deterministi = options.deterministicLockstep) !== null && _options$deterministi !== void 0 ? _options$deterministi : false;\n options.lockstepMaxSteps = (_options$lockstepMaxS = options.lockstepMaxSteps) !== null && _options$lockstepMaxS !== void 0 ? _options$lockstepMaxS : 4;\n options.timeStep = (_options$timeStep = options.timeStep) !== null && _options$timeStep !== void 0 ? _options$timeStep : 1 / 60;\n options.audioEngine = (_options$audioEngine = options.audioEngine) !== null && _options$audioEngine !== void 0 ? _options$audioEngine : true;\n options.stencil = (_options$stencil = options.stencil) !== null && _options$stencil !== void 0 ? _options$stencil : true;\n this._audioContext = (_options$audioEngineO = (_options$audioEngineO2 = options.audioEngineOptions) === null || _options$audioEngineO2 === void 0 ? void 0 : _options$audioEngineO2.audioContext) !== null && _options$audioEngineO !== void 0 ? _options$audioEngineO : null;\n this._audioDestination = (_options$audioEngineO3 = (_options$audioEngineO4 = options.audioEngineOptions) === null || _options$audioEngineO4 === void 0 ? void 0 : _options$audioEngineO4.audioDestination) !== null && _options$audioEngineO3 !== void 0 ? _options$audioEngineO3 : null;\n this.premultipliedAlpha = (_options$premultiplie = options.premultipliedAlpha) !== null && _options$premultiplie !== void 0 ? _options$premultiplie : true;\n this._doNotHandleContextLost = !!options.doNotHandleContextLost;\n this._isStencilEnable = options.stencil ? true : false;\n this.useExactSrgbConversions = (_options$useExactSrgb = options.useExactSrgbConversions) !== null && _options$useExactSrgb !== void 0 ? _options$useExactSrgb : false;\n const devicePixelRatio = IsWindowObjectExist() ? window.devicePixelRatio || 1.0 : 1.0;\n const limitDeviceRatio = options.limitDeviceRatio || devicePixelRatio;\n // Viewport\n adaptToDeviceRatio = adaptToDeviceRatio || options.adaptToDeviceRatio || false;\n this._hardwareScalingLevel = adaptToDeviceRatio ? 1.0 / Math.min(limitDeviceRatio, devicePixelRatio) : 1.0;\n this._lastDevicePixelRatio = devicePixelRatio;\n this._creationOptions = options;\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 ? this._renderingCanvas.getBoundingClientRect() : {\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 } else {\n width = window.innerWidth;\n height = window.innerHeight;\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 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 // eslint-disable-next-line jsdoc/require-returns-check\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_BYTE 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, type, creationFlags, useSRGBBuffer) {\n throw _WarnImport(\"engine.rawTexture\");\n }\n // eslint-disable-next-line jsdoc/require-returns-check\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_BYTE)\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) {\n throw _WarnImport(\"engine.rawTexture\");\n }\n // eslint-disable-next-line jsdoc/require-returns-check\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 * @param creationFlags specific flags to use when creating the texture (1 for storage textures, for eg)\n * @returns a new raw 3D texture (stored in an InternalTexture)\n */\n createRawTexture3D(data, width, height, depth, format, generateMipMaps, invertY, samplingMode, compression, textureType, creationFlags) {\n throw _WarnImport(\"engine.rawTexture\");\n }\n // eslint-disable-next-line jsdoc/require-returns-check\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 * @param creationFlags specific flags to use when creating the texture (1 for storage textures, for eg)\n * @returns a new raw 2D array texture (stored in an InternalTexture)\n */\n createRawTexture2DArray(data, width, height, depth, format, generateMipMaps, invertY, samplingMode, compression, textureType, creationFlags) {\n throw _WarnImport(\"engine.rawTexture\");\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 _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 = 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 /**\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 /**\n * @internal\n */\n _reportDrawCall(numDrawCalls = 1) {\n var _this$_drawCalls;\n (_this$_drawCalls = this._drawCalls) === null || _this$_drawCalls === void 0 || _this$_drawCalls.addCount(numDrawCalls, false);\n }\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 /**\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 * 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 */\n _createImageBitmapFromSource(imageSource, options) {\n throw new Error(\"createImageBitmapFromSource is not implemented\");\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 */\n resizeImageBitmap(image, bufferWidth, bufferHeight) {\n throw new Error(\"resizeImageBitmap is not implemented\");\n }\n /**\n * Get Font size information\n * @param font font name\n */\n getFontOffset(font) {\n throw new Error(\"getFontOffset is not implemented\");\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 AbstractEngine._CreateCanvas(width, height);\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 _loadFile(url, onSuccess, onProgress, offlineProvider, useArrayBuffer, onError) {\n const request = _loadFile(url, onSuccess, onProgress, offlineProvider, useArrayBuffer, onError);\n this._activeRequests.push(request);\n request.onCompleteObservable.add(() => {\n const index = this._activeRequests.indexOf(request);\n if (index !== -1) {\n this._activeRequests.splice(index, 1);\n }\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 if (EngineFunctionContext.loadFile) {\n return EngineFunctionContext.loadFile(url, onSuccess, onProgress, offlineProvider, useArrayBuffer, onError);\n }\n throw _WarnImport(\"FileTools\");\n }\n /**\n * Dispose and release all associated resources\n */\n dispose() {\n var _this$releaseComputeE;\n this.releaseEffects();\n this._isDisposed = true;\n this.stopRenderLoop();\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 this._renderingCanvas = null;\n // Clear observables\n if (this.onBeforeTextureInitObservable) {\n this.onBeforeTextureInitObservable.clear();\n }\n // Release postProcesses\n while (this.postProcesses.length) {\n this.postProcesses[0].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 effects\n (_this$releaseComputeE = this.releaseComputeEffects) === null || _this$releaseComputeE === void 0 || _this$releaseComputeE.call(this);\n Effect.ResetCache();\n // Abort active requests\n for (const request of this._activeRequests) {\n request.abort();\n }\n this._boundRenderFunction = null;\n this.onDisposeObservable.notifyObservers(this);\n this.onDisposeObservable.clear();\n this.onResizeObservable.clear();\n this.onCanvasBlurObservable.clear();\n this.onCanvasFocusObservable.clear();\n this.onCanvasPointerOutObservable.clear();\n this.onNewSceneAddedObservable.clear();\n if (IsWindowObjectExist()) {\n window.removeEventListener(\"resize\", this._checkForMobile);\n }\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 (!EngineStore.Instances.length) {\n EngineStore.OnEnginesDisposedObservable.notifyObservers(this);\n EngineStore.OnEnginesDisposedObservable.clear();\n }\n // Observables\n this.onBeginFrameObservable.clear();\n this.onEndFrameObservable.clear();\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 */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static DefaultLoadingScreenFactory(canvas) {\n throw _WarnImport(\"LoadingScreen\");\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 < EngineStore.Instances.length; engineIndex++) {\n const engine = EngineStore.Instances[engineIndex];\n for (let sceneIndex = 0; sceneIndex < engine.scenes.length; sceneIndex++) {\n engine.scenes[sceneIndex].markAllMaterialsAsDirty(flag, predicate);\n }\n }\n }\n}\n// eslint-disable-next-line @typescript-eslint/naming-convention\n/** @internal */\nAbstractEngine._RenderPassIdCounter = 0;\n/**\n * Method called to create the default rescale post process on each engine.\n */\nAbstractEngine._RescalePostProcessFactory = null;\n// Updatable statics so stick with vars here\n/**\n * Gets or sets the epsilon value used by collision engine\n */\nAbstractEngine.CollisionsEpsilon = 0.001;\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 */\nAbstractEngine.QueueNewFrame = QueueNewFrame;","map":{"version":3,"names":["EngineStore","Logger","Effect","PerformanceConfigurator","PrecisionDate","DepthCullingState","StencilStateComposer","StencilState","AlphaState","_WarnImport","InternalTexture","IsDocumentAvailable","IsNavigatorAvailable","IsWindowObjectExist","Observable","EngineFunctionContext","_loadFile","_GetCompatibleTextureLoader","QueueNewFrame","func","requester","requestAnimationFrame","window","setTimeout","AbstractEngine","frameId","_frameId","isWebGPU","_isWebGPU","_getShaderProcessor","shaderLanguage","_shaderProcessor","shaderPlatformName","_shaderPlatformName","_clearEmptyResources","_emptyTexture","_emptyCubeTexture","_emptyTexture3D","_emptyTexture2DArray","useReverseDepthBuffer","_useReverseDepthBuffer","useReverse","_depthCullingState","depthFunc","setColorWrite","enable","_colorWrite","_colorWriteChanged","getColorWrite","depthCullingState","alphaState","_alphaState","stencilState","_stencilState","stencilStateComposer","_stencilStateComposer","_getGlobalDefines","defines","isNDCHalfZRange","useExactSrgbConversions","s","_rebuildInternalTextures","currentState","_internalTexturesCache","slice","internalTexture","_rebuild","_rebuildRenderTargetWrappers","_renderTargetWrapperCache","renderTargetWrapper","_rebuildEffects","key","_compiledEffects","effect","_pipelineContext","_prepareEffect","ResetCache","_rebuildGraphicsResources","_this$_rebuildCompute","wipeCaches","_rebuildComputeEffects","call","_rebuildBuffers","_rebuildTextures","_flagContextRestored","Warn","name","onContextRestoredObservable","notifyObservers","_contextWasLost","_restoreEngineAfterContextLost","initEngine","_this","_asyncToGenerator","depthTest","depthMask","stencilTest","isDisposed","_isDisposed","snapshotRendering","activate","snapshotRenderingMode","mode","getClassName","emptyTexture","createRawTexture","Uint8Array","emptyTexture3D","createRawTexture3D","emptyTexture2DArray","createRawTexture2DArray","emptyCubeTexture","faceData","cubeData","createRawCubeTexture","activeRenderLoops","_activeRenderLoops","stopRenderLoop","renderFunction","length","_cancelFrame","index","indexOf","splice","_frameHandler","handlerToCancel","cancelAnimationFrame","getHostWindow","clearTimeout","beginFrame","onBeginFrameObservable","endFrame","onEndFrameObservable","_renderLoop","shouldRender","renderEvenInBackground","_windowIsBackground","_renderViews","_renderFrame","_queueNewFrame","_boundRenderFunction","bindedRenderFunction","runRenderLoop","push","getDepthBuffer","setDepthBuffer","setZOffset","value","zOffset","getZOffset","setZOffsetUnits","zOffsetUnits","getZOffsetUnits","_renderingCanvas","ownerDocument","defaultView","compatibilityMode","_compatibilityMode","scene","scenes","_virtualScenes","_releaseRenderTargetWrapper","rtWrapper","currentViewport","_cachedViewport","setViewport","viewport","requiredWidth","requiredHeight","width","getRenderWidth","height","getRenderHeight","x","y","_viewport","createCanvasImage","document","createElement","description","version","_caps","parallelShaderCompile","_createTextureBase","url","noMipmap","invertY","samplingMode","onLoad","onError","prepareTexture","prepareTextureProcess","buffer","fallback","format","forcedExtension","mimeType","loaderOptions","useSRGBBuffer","fromData","substr","fromBlob","isBase64","texture","label","substring","originalUrl","_transformTextureUrl","_originalUrl","lastDot","lastIndexOf","extension","toLowerCase","queryStringIndex","split","loaderPromise","addPendingData","generateMipMaps","_useSRGBBuffer","_getUseSRGBBuffer","_doNotHandleContextLost","_buffer","onLoadObserver","onLoadedObservable","add","onInternalError","message","exception","removePendingData","remove","UseFallbackTexture","FallbackTexture","onErrorObservable","callback","_ref2","data","loader","loadData","loadMipmap","isCompressed","done","loadFailed","_x","apply","arguments","undefined","offlineProvider","request","responseURL","ArrayBuffer","isView","onload","img","decoding","close","_FileToolsLoadImage","_features","needsInvertingBitmap","imageOrientation","Blob","uniformBuffer","_uniformBuffers","_rebuildAfterContextLost","_shouldUseHighPrecisionShader","highPrecisionShaderSupported","_highPrecisionShadersAllowed","getHostDocument","getLoadedTexturesCache","clearInternalTexturesCache","getCaps","resetTextureCache","_boundTexturesCache","Object","prototype","hasOwnProperty","_currentTextureChannel","_name","NpmPackage","Version","getRenderingCanvas","getAudioContext","_audioContext","getAudioDestination","_audioDestination","setHardwareScalingLevel","level","_hardwareScalingLevel","resize","getHardwareScalingLevel","doNotHandleContextLost","isStencilEnable","_isStencilEnable","getCreationOptions","_creationOptions","constructor","antialias","options","adaptToDeviceRatio","_adaptToDeviceRatio","_options$deterministi","_options$lockstepMaxS","_options$timeStep","_options$audioEngine","_options$stencil","_options$audioEngineO","_options$audioEngineO2","_options$audioEngineO3","_options$audioEngineO4","_options$premultiplie","_options$useExactSrgb","_alphaMode","_alphaEquation","_activeRequests","_badOS","_badDesktopOS","Array","_currentRenderTarget","_activeChannel","_viewportCached","z","w","onCanvasBlurObservable","onCanvasFocusObservable","onNewSceneAddedObservable","onResizeObservable","onCanvasPointerOutObservable","disablePerformanceMonitorInBackground","disableVertexArrayObjects","hostInformation","isMobile","isFullscreen","enableOfflineSupport","disableManifestCheck","disableContextMenu","currentRenderPassId","isPointerLock","postProcesses","canvasTabIndex","hasOriginBottomLeft","onBeforeTextureInitObservable","preventCacheWipeBetweenFrames","onBeforeShaderCompilationObservable","onAfterShaderCompilationObservable","_storageBuffers","onContextLostObservable","premultipliedAlpha","_lastDevicePixelRatio","cullBackFaces","_renderPassNames","_fps","_deltaTime","_deterministicLockstep","_lockstepMaxSteps","_timeStep","onDisposeObservable","Instances","startTime","Now","stencilGlobal","SetMatrixPrecision","useHighPrecisionMatrix","navigator","userAgent","test","deterministicLockstep","lockstepMaxSteps","timeStep","audioEngine","stencil","audioEngineOptions","audioContext","audioDestination","devicePixelRatio","limitDeviceRatio","Math","min","forceSetSize","changeRatio","boundingRect","getBoundingClientRect","clientWidth","clientHeight","innerWidth","innerHeight","setSize","camIndex","cameras","cam","_currentRenderId","hasObservers","compression","type","creationFlags","size","depth","textureType","_sharedInit","canvas","_setupMobileChecks","_checkForMobile","currentUA","addEventListener","createVideoElement","constraints","_reportDrawCall","numDrawCalls","_this$_drawCalls","_drawCalls","addCount","getFps","getDeltaTime","isDeterministicLockStep","getLockstepMaxSteps","getTimeStep","_createImageBitmapFromSource","imageSource","Error","createImageBitmap","image","resizeImageBitmap","bufferWidth","bufferHeight","getFontOffset","font","_CreateCanvas","OffscreenCanvas","createCanvas","input","imageBitmapOptions","onSuccess","onProgress","useArrayBuffer","onCompleteObservable","_FileToolsLoadFile","loadFile","dispose","_this$releaseComputeE","releaseEffects","_releaseTexture","clear","releaseComputeEffects","abort","removeEventListener","OnEnginesDisposedObservable","DefaultLoadingScreenFactory","MarkAllMaterialsAsDirty","flag","predicate","engineIndex","engine","sceneIndex","markAllMaterialsAsDirty","_RenderPassIdCounter","_RescalePostProcessFactory","CollisionsEpsilon"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Engines/abstractEngine.js"],"sourcesContent":["import { EngineStore } from \"./engineStore.js\";\nimport { Logger } from \"../Misc/logger.js\";\nimport { Effect } from \"../Materials/effect.js\";\nimport { PerformanceConfigurator } from \"./performanceConfigurator.js\";\nimport { PrecisionDate } from \"../Misc/precisionDate.js\";\nimport { DepthCullingState } from \"../States/depthCullingState.js\";\nimport { StencilStateComposer } from \"../States/stencilStateComposer.js\";\nimport { StencilState } from \"../States/stencilState.js\";\nimport { AlphaState } from \"../States/alphaCullingState.js\";\nimport { _WarnImport } from \"../Misc/devTools.js\";\nimport { InternalTexture } from \"../Materials/Textures/internalTexture.js\";\nimport { IsDocumentAvailable, IsNavigatorAvailable, IsWindowObjectExist } from \"../Misc/domManagement.js\";\n\nimport { Observable } from \"../Misc/observable.js\";\nimport { EngineFunctionContext, _loadFile } from \"./abstractEngine.functions.js\";\nimport { _GetCompatibleTextureLoader } from \"../Materials/Textures/Loaders/textureLoaderManager.js\";\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 */\nexport function 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 * The parent class for specialized engines (WebGL, WebGPU)\n */\nexport class AbstractEngine {\n /**\n * Gets the current frame id\n */\n get frameId() {\n return this._frameId;\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 * @internal\n */\n _getShaderProcessor(shaderLanguage) {\n return this._shaderProcessor;\n }\n /**\n * Gets the shader platform name used by the effects.\n */\n get shaderPlatformName() {\n return this._shaderPlatformName;\n }\n _clearEmptyResources() {\n this._emptyTexture = null;\n this._emptyCubeTexture = null;\n this._emptyTexture3D = null;\n this._emptyTexture2DArray = null;\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 * 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 /** @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 _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._prepareEffect();\n }\n Effect.ResetCache();\n }\n _rebuildGraphicsResources() {\n // Ensure webgl and engine states are matching\n this.wipeCaches(true);\n // Rebuild effects\n this._rebuildEffects();\n this._rebuildComputeEffects?.();\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._rebuildTextures();\n // Rebuild textures\n this._rebuildRenderTargetWrappers();\n // Reset engine states after all the buffer/textures/... have been rebuilt\n this.wipeCaches(true);\n }\n _flagContextRestored() {\n Logger.Warn(this.name + \" context successfully restored.\");\n this.onContextRestoredObservable.notifyObservers(this);\n this._contextWasLost = false;\n }\n _restoreEngineAfterContextLost(initEngine) {\n // Adding a timeout to avoid race condition at browser level\n setTimeout(async () => {\n this._clearEmptyResources();\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 this._rebuildGraphicsResources();\n this._depthCullingState.depthTest = depthTest;\n this._depthCullingState.depthFunc = depthFunc;\n this._depthCullingState.depthMask = depthMask;\n this._stencilState.stencilTest = stencilTest;\n this._flagContextRestored();\n }, 0);\n }\n /** Gets a boolean indicating if the engine was disposed */\n get isDisposed() {\n return this._isDisposed;\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 // Do nothing\n }\n /**\n * Gets or sets the snapshot rendering mode\n */\n get snapshotRenderingMode() {\n return 0;\n }\n set snapshotRenderingMode(mode) { }\n /**\n * Returns the string \"AbstractEngine\"\n * @returns \"AbstractEngine\"\n */\n getClassName() {\n return \"AbstractEngine\";\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 the list of current active render loop functions\n * @returns a read only array with the current render loop functions\n */\n get activeRenderLoops() {\n return this._activeRenderLoops;\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._frameHandler !== 0) {\n const handlerToCancel = this._frameHandler;\n this._frameHandler = 0;\n if (!IsWindowObjectExist()) {\n if (typeof cancelAnimationFrame === \"function\") {\n return cancelAnimationFrame(handlerToCancel);\n }\n }\n else {\n const { cancelAnimationFrame } = this.getHostWindow() || window;\n if (typeof cancelAnimationFrame === \"function\") {\n return cancelAnimationFrame(handlerToCancel);\n }\n }\n return clearTimeout(handlerToCancel);\n }\n }\n /**\n * Begin a new frame\n */\n beginFrame() {\n this.onBeginFrameObservable.notifyObservers(this);\n }\n /**\n * End the current frame\n */\n endFrame() {\n this._frameId++;\n this.onEndFrameObservable.notifyObservers(this);\n }\n /** @internal */\n _renderLoop() {\n // Reset the frame handler before rendering a frame to determine if a new frame has been queued.\n this._frameHandler = 0;\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 // The first condition prevents queuing another frame if we no longer have active render loops (e.g., if\n // `stopRenderLoop` is called mid frame). The second condition prevents queuing another frame if one has\n // already been queued (e.g., if `stopRenderLoop` and `runRenderLoop` is called mid frame).\n if (this._activeRenderLoops.length > 0 && this._frameHandler === 0) {\n this._frameHandler = this._queueNewFrame(this._boundRenderFunction, this.getHostWindow());\n }\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 /** @internal */\n _renderViews() {\n return false;\n }\n /**\n * Can be used to override the current requestAnimationFrame requester.\n * @internal\n */\n _queueNewFrame(bindedRenderFunction, requester) {\n return 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 // On the first added function, start the render loop.\n if (this._activeRenderLoops.length === 1 && this._frameHandler === 0) {\n this._frameHandler = this._queueNewFrame(this._boundRenderFunction, this.getHostWindow());\n }\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 * 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 * (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 _rebuildTextures() {\n for (const scene of this.scenes) {\n scene._rebuildTextures();\n }\n for (const scene of this._virtualScenes) {\n scene._rebuildTextures();\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 /**\n * Gets the current viewport\n */\n get currentViewport() {\n return this._cachedViewport;\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 * Create an image to use with canvas\n * @returns IImage interface\n */\n createCanvasImage() {\n return document.createElement(\"img\");\n }\n /**\n * Returns a string describing the current engine\n */\n get description() {\n let description = this.name + this.version;\n if (this._caps.parallelShaderCompile) {\n description += \" - Parallel shader compilation\";\n }\n return description;\n }\n _createTextureBase(url, noMipmap, invertY, scene, samplingMode = 3, onLoad = null, onError = null, prepareTexture, prepareTextureProcess, 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, 1 /* 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 // Remove query string\n const queryStringIndex = extension.indexOf(\"?\");\n if (queryStringIndex > -1) {\n extension = extension.split(\"?\")[0];\n }\n const loaderPromise = _GetCompatibleTextureLoader(extension, mimeType);\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 && url !== EngineStore.FallbackTexture) {\n this._createTextureBase(EngineStore.FallbackTexture, noMipmap, texture.invertY, scene, samplingMode, null, onError, prepareTexture, prepareTextureProcess, 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, prepareTextureProcess, buffer, texture, format, forcedExtension, mimeType, loaderOptions, useSRGBBuffer);\n }\n };\n // processing for non-image formats\n if (loaderPromise) {\n const callback = async (data) => {\n const loader = await loaderPromise;\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, prepareTextureProcess, 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 AbstractEngine._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 AbstractEngine._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 _rebuildBuffers() {\n // Uniforms\n for (const uniformBuffer of this._uniformBuffers) {\n uniformBuffer._rebuildAfterContextLost();\n }\n }\n /** @internal */\n get _shouldUseHighPrecisionShader() {\n return !!(this._caps.highPrecisionShaderSupported && this._highPrecisionShadersAllowed);\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 /**\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 * 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 * Gets the object containing all engine capabilities\n * @returns the EngineCapabilities object\n */\n getCaps() {\n return this._caps;\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 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 current npm package of the sdk\n */\n // Not mixed with Version for tooling purpose.\n static get NpmPackage() {\n return \"babylonjs@7.37.0\";\n }\n /**\n * Returns the current version of the framework\n */\n static get Version() {\n return \"7.37.0\";\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 * 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 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 /**\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 /**\n * Gets the options used for engine creation\n * @returns EngineOptions object\n */\n getCreationOptions() {\n return this._creationOptions;\n }\n /**\n * Creates a new engine\n * @param antialias defines whether anti-aliasing should be enabled. If undefined, it means that the underlying engine is free to enable it or not\n * @param options defines further options to be sent to the creation context\n * @param adaptToDeviceRatio defines whether to adapt to the device's viewport characteristics (default: false)\n */\n constructor(antialias, options, adaptToDeviceRatio) {\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 this._activeRequests = [];\n /** @internal */\n this._badOS = false;\n /** @internal */\n this._badDesktopOS = false;\n this._compatibilityMode = true;\n /** @internal */\n this._internalTexturesCache = new Array();\n /** @internal */\n this._currentRenderTarget = null;\n /** @internal */\n this._boundTexturesCache = {};\n /** @internal */\n this._activeChannel = 0;\n /** @internal */\n this._currentTextureChannel = -1;\n /** @internal */\n this._viewportCached = { x: 0, y: 0, z: 0, w: 0 };\n /** @internal */\n this._isWebGPU = false;\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 * Event raised when a new scene is created\n */\n this.onNewSceneAddedObservable = new Observable();\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 receives pointerout event\n */\n this.onCanvasPointerOutObservable = new Observable();\n /**\n * Turn this value on if you want to pause FPS computation when in background\n */\n this.disablePerformanceMonitorInBackground = 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 /** @internal */\n this._frameId = 0;\n /**\n * Gets information about the current host\n */\n this.hostInformation = {\n isMobile: false,\n };\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 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 or sets the current render pass id\n */\n this.currentRenderPassId = 0;\n /**\n * Gets a boolean indicating if the pointer is currently locked\n */\n this.isPointerLock = false;\n /**\n * Gets the list of created postprocesses\n */\n this.postProcesses = [];\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 /** @internal */\n this._contextWasLost = 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 /** @internal */\n this._renderTargetWrapperCache = new Array();\n /** @internal */\n this._compiledEffects = {};\n /** @internal */\n this._isDisposed = false;\n /**\n * Gets the list of created scenes\n */\n this.scenes = [];\n /** @internal */\n this._virtualScenes = new Array();\n /**\n * Observable event triggered before each texture is initialized\n */\n this.onBeforeTextureInitObservable = new Observable();\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 /** @internal */\n this._frameHandler = 0;\n /** @internal */\n this._activeRenderLoops = new Array();\n /** @internal */\n this._windowIsBackground = false;\n /** @internal */\n this._boundRenderFunction = () => this._renderLoop();\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 /**\n * Observable raised when the engine begins a new frame\n */\n this.onBeginFrameObservable = new Observable();\n /**\n * Observable raised when the engine ends the current frame\n */\n this.onEndFrameObservable = new Observable();\n /** @internal */\n this._transformTextureUrl = null;\n /** @internal */\n this._uniformBuffers = new Array();\n /** @internal */\n this._storageBuffers = new Array();\n this._highPrecisionShadersAllowed = true;\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 /** @internal */\n this._name = \"\";\n /**\n * Defines whether the engine has been created with the premultipliedAlpha option on or not.\n */\n this.premultipliedAlpha = true;\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._doNotHandleContextLost = 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 /** @internal */\n this._renderPassNames = [\"main\"];\n // FPS\n this._fps = 60;\n this._deltaTime = 0;\n // Deterministic lockstepMaxSteps\n /** @internal */\n this._deterministicLockstep = false;\n /** @internal */\n this._lockstepMaxSteps = 4;\n /** @internal */\n this._timeStep = 1 / 60;\n /**\n * An event triggered when the engine is disposed.\n */\n this.onDisposeObservable = new Observable();\n EngineStore.Instances.push(this);\n this.startTime = PrecisionDate.Now;\n this._stencilStateComposer.stencilGlobal = this._stencilState;\n PerformanceConfigurator.SetMatrixPrecision(!!options.useHighPrecisionMatrix);\n if (IsNavigatorAvailable() && navigator.userAgent) {\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 // Detect if we are running on a faulty buggy desktop OS.\n this._badDesktopOS = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\n }\n // Save this off for use in resize().\n this.adaptToDeviceRatio = adaptToDeviceRatio ?? false;\n options.antialias = antialias ?? options.antialias;\n options.deterministicLockstep = options.deterministicLockstep ?? false;\n options.lockstepMaxSteps = options.lockstepMaxSteps ?? 4;\n options.timeStep = options.timeStep ?? 1 / 60;\n options.audioEngine = options.audioEngine ?? true;\n options.stencil = options.stencil ?? true;\n this._audioContext = options.audioEngineOptions?.audioContext ?? null;\n this._audioDestination = options.audioEngineOptions?.audioDestination ?? null;\n this.premultipliedAlpha = options.premultipliedAlpha ?? true;\n this._doNotHandleContextLost = !!options.doNotHandleContextLost;\n this._isStencilEnable = options.stencil ? true : false;\n this.useExactSrgbConversions = options.useExactSrgbConversions ?? false;\n const devicePixelRatio = IsWindowObjectExist() ? window.devicePixelRatio || 1.0 : 1.0;\n const limitDeviceRatio = options.limitDeviceRatio || devicePixelRatio;\n // Viewport\n adaptToDeviceRatio = adaptToDeviceRatio || options.adaptToDeviceRatio || false;\n this._hardwareScalingLevel = adaptToDeviceRatio ? 1.0 / Math.min(limitDeviceRatio, devicePixelRatio) : 1.0;\n this._lastDevicePixelRatio = devicePixelRatio;\n this._creationOptions = options;\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 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 // eslint-disable-next-line jsdoc/require-returns-check\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_BYTE 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, type, creationFlags, useSRGBBuffer) {\n throw _WarnImport(\"engine.rawTexture\");\n }\n // eslint-disable-next-line jsdoc/require-returns-check\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_BYTE)\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) {\n throw _WarnImport(\"engine.rawTexture\");\n }\n // eslint-disable-next-line jsdoc/require-returns-check\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 * @param creationFlags specific flags to use when creating the texture (1 for storage textures, for eg)\n * @returns a new raw 3D texture (stored in an InternalTexture)\n */\n createRawTexture3D(data, width, height, depth, format, generateMipMaps, invertY, samplingMode, compression, textureType, creationFlags) {\n throw _WarnImport(\"engine.rawTexture\");\n }\n // eslint-disable-next-line jsdoc/require-returns-check\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 * @param creationFlags specific flags to use when creating the texture (1 for storage textures, for eg)\n * @returns a new raw 2D array texture (stored in an InternalTexture)\n */\n createRawTexture2DArray(data, width, height, depth, format, generateMipMaps, invertY, samplingMode, compression, textureType, creationFlags) {\n throw _WarnImport(\"engine.rawTexture\");\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 _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 /**\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 /**\n * @internal\n */\n _reportDrawCall(numDrawCalls = 1) {\n this._drawCalls?.addCount(numDrawCalls, false);\n }\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 /**\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 * 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 */\n _createImageBitmapFromSource(imageSource, options) {\n throw new Error(\"createImageBitmapFromSource is not implemented\");\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 */\n resizeImageBitmap(image, bufferWidth, bufferHeight) {\n throw new Error(\"resizeImageBitmap is not implemented\");\n }\n /**\n * Get Font size information\n * @param font font name\n */\n getFontOffset(font) {\n throw new Error(\"getFontOffset is not implemented\");\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 AbstractEngine._CreateCanvas(width, height);\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 _loadFile(url, onSuccess, onProgress, offlineProvider, useArrayBuffer, onError) {\n const request = _loadFile(url, onSuccess, onProgress, offlineProvider, useArrayBuffer, onError);\n this._activeRequests.push(request);\n request.onCompleteObservable.add(() => {\n const index = this._activeRequests.indexOf(request);\n if (index !== -1) {\n this._activeRequests.splice(index, 1);\n }\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 if (EngineFunctionContext.loadFile) {\n return EngineFunctionContext.loadFile(url, onSuccess, onProgress, offlineProvider, useArrayBuffer, onError);\n }\n throw _WarnImport(\"FileTools\");\n }\n /**\n * Dispose and release all associated resources\n */\n dispose() {\n this.releaseEffects();\n this._isDisposed = true;\n this.stopRenderLoop();\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 this._renderingCanvas = null;\n // Clear observables\n if (this.onBeforeTextureInitObservable) {\n this.onBeforeTextureInitObservable.clear();\n }\n // Release postProcesses\n while (this.postProcesses.length) {\n this.postProcesses[0].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 effects\n this.releaseComputeEffects?.();\n Effect.ResetCache();\n // Abort active requests\n for (const request of this._activeRequests) {\n request.abort();\n }\n this._boundRenderFunction = null;\n this.onDisposeObservable.notifyObservers(this);\n this.onDisposeObservable.clear();\n this.onResizeObservable.clear();\n this.onCanvasBlurObservable.clear();\n this.onCanvasFocusObservable.clear();\n this.onCanvasPointerOutObservable.clear();\n this.onNewSceneAddedObservable.clear();\n if (IsWindowObjectExist()) {\n window.removeEventListener(\"resize\", this._checkForMobile);\n }\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 (!EngineStore.Instances.length) {\n EngineStore.OnEnginesDisposedObservable.notifyObservers(this);\n EngineStore.OnEnginesDisposedObservable.clear();\n }\n // Observables\n this.onBeginFrameObservable.clear();\n this.onEndFrameObservable.clear();\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 */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static DefaultLoadingScreenFactory(canvas) {\n throw _WarnImport(\"LoadingScreen\");\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 < EngineStore.Instances.length; engineIndex++) {\n const engine = EngineStore.Instances[engineIndex];\n for (let sceneIndex = 0; sceneIndex < engine.scenes.length; sceneIndex++) {\n engine.scenes[sceneIndex].markAllMaterialsAsDirty(flag, predicate);\n }\n }\n }\n}\n// eslint-disable-next-line @typescript-eslint/naming-convention\n/** @internal */\nAbstractEngine._RenderPassIdCounter = 0;\n/**\n * Method called to create the default rescale post process on each engine.\n */\nAbstractEngine._RescalePostProcessFactory = null;\n// Updatable statics so stick with vars here\n/**\n * Gets or sets the epsilon value used by collision engine\n */\nAbstractEngine.CollisionsEpsilon = 0.001;\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 */\nAbstractEngine.QueueNewFrame = QueueNewFrame;\n"],"mappings":";AAAA,SAASA,WAAW,QAAQ,kBAAkB;AAC9C,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,MAAM,QAAQ,wBAAwB;AAC/C,SAASC,uBAAuB,QAAQ,8BAA8B;AACtE,SAASC,aAAa,QAAQ,0BAA0B;AACxD,SAASC,iBAAiB,QAAQ,gCAAgC;AAClE,SAASC,oBAAoB,QAAQ,mCAAmC;AACxE,SAASC,YAAY,QAAQ,2BAA2B;AACxD,SAASC,UAAU,QAAQ,gCAAgC;AAC3D,SAASC,WAAW,QAAQ,qBAAqB;AACjD,SAASC,eAAe,QAAQ,0CAA0C;AAC1E,SAASC,mBAAmB,EAAEC,oBAAoB,EAAEC,mBAAmB,QAAQ,0BAA0B;AAEzG,SAASC,UAAU,QAAQ,uBAAuB;AAClD,SAASC,qBAAqB,EAAEC,SAAS,QAAQ,+BAA+B;AAChF,SAASC,2BAA2B,QAAQ,uDAAuD;AACnG;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,aAAaA,CAACC,IAAI,EAAEC,SAAS,EAAE;EAC3C;EACA;EACA;EACA,IAAI,CAACP,mBAAmB,CAAC,CAAC,EAAE;IACxB,IAAI,OAAOQ,qBAAqB,KAAK,UAAU,EAAE;MAC7C,OAAOA,qBAAqB,CAACF,IAAI,CAAC;IACtC;EACJ,CAAC,MACI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A;IACA,IAAI,CAACrT,sBAAsB,CAACqT,KAAK,CAAC,CAAC;IACnC,IAAI,CAACnT,oBAAoB,CAACmT,KAAK,CAAC,CAAC;EACrC;EACA;AACJ;AACA;AACA;AACA;EACI;EACA,OAAOK,2BAA2BA,CAAC/C,MAAM,EAAE;IACvC,MAAMpY,WAAW,CAAC,eAAe,CAAC;EACtC;EACA;AACJ;AACA;AACA;AACA;EACI,OAAOob,uBAAuBA,CAACC,IAAI,EAAEC,SAAS,EAAE;IAC5C,KAAK,IAAIC,WAAW,GAAG,CAAC,EAAEA,WAAW,GAAGhc,WAAW,CAACmW,SAAS,CAAC5O,MAAM,EAAEyU,WAAW,EAAE,EAAE;MACjF,MAAMC,MAAM,GAAGjc,WAAW,CAACmW,SAAS,CAAC6F,WAAW,CAAC;MACjD,KAAK,IAAIE,UAAU,GAAG,CAAC,EAAEA,UAAU,GAAGD,MAAM,CAAClS,MAAM,CAACxC,MAAM,EAAE2U,UAAU,EAAE,EAAE;QACtED,MAAM,CAAClS,MAAM,CAACmS,UAAU,CAAC,CAACC,uBAAuB,CAACL,IAAI,EAAEC,SAAS,CAAC;MACtE;IACJ;EACJ;AACJ;AACA;AACA;AACAva,cAAc,CAAC4a,oBAAoB,GAAG,CAAC;AACvC;AACA;AACA;AACA5a,cAAc,CAAC6a,0BAA0B,GAAG,IAAI;AAChD;AACA;AACA;AACA;AACA7a,cAAc,CAAC8a,iBAAiB,GAAG,KAAK;AACxC;AACA;AACA;AACA;AACA;AACA;AACA9a,cAAc,CAACN,aAAa,GAAGA,aAAa","ignoreList":[]},"metadata":{},"sourceType":"module","externalDependencies":[]}
|