-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path256b551e-1832dd584c826cd29ac8.js.map
1 lines (1 loc) · 294 KB
/
256b551e-1832dd584c826cd29ac8.js.map
1
{"version":3,"file":"256b551e-1832dd584c826cd29ac8.js","mappings":"qVAyBA,MAAMA,GAKC,MAAMC,EAKEC,wBACP,MAAO,kBACX,CAIWC,qBACP,MAAO,QACX,CAIIC,kBACA,IAAIA,EAAcC,KAAKC,KAAOD,KAAKE,aAInC,OAHIF,KAAKG,MAAMC,wBACXL,GAAe,kCAEZA,CACX,CAIIE,WACA,OAAOD,KAAKK,KAChB,CACIJ,SAAKK,GACLN,KAAKK,MAAQC,CACjB,CAIIC,cACA,OAAOP,KAAKQ,aAChB,CACIC,iBACA,OAAOT,KAAKU,WAChB,CAIWC,+BACP,OAAO,IAAOA,iBAClB,CACWA,6BAAkBL,GACzB,IAAOK,kBAAoBL,CAC/B,CAIAM,oBAAoBC,GAChB,OAAOb,KAAKc,gBAChB,CAKIC,4BACA,OAAOf,KAAKgB,sBAChB,CACID,0BAAsBE,GAClBA,IAAejB,KAAKgB,yBAGxBhB,KAAKgB,uBAAyBC,EAE1BjB,KAAKkB,mBAAmBC,UADxBF,EACoC,IAGA,IAE5C,CAIIG,cACA,OAAOpB,KAAKqB,QAChB,CAKIC,6BACA,OAAOtB,KAAKE,aAAe,IAAMF,KAAKuB,qBAC1C,CAKAC,qBACI,OAAOxB,KAAKyB,gBAChB,CAEIC,oCACA,SAAU1B,KAAKG,MAAMwB,+BAAgC3B,KAAK4B,6BAC9D,CAKIC,sBACA,OAAO7B,KAAKQ,cAAgB,GAAKR,KAAK8B,gBAC1C,CAKIC,wBACA,OAAO/B,KAAKgC,kBAChB,CAKIC,6BACA,OAAOjC,KAAKkC,uBAChB,CACID,2BAAuB3B,GACvBN,KAAKkC,wBAA0B5B,CACnC,CACI6B,wCACA,OAAO,CACX,CAMIC,gCAA4BC,GAC5BrC,KAAKsC,6BAA+BD,CACxC,CAIIE,sBACA,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AAKgL,iBAAiBwR,eAE1B,UAAwBnY,SAAW,IAC9C,EAGJzE,EAAW6L,cAAgB,CACvB,CAAEC,IAAK,cAAeI,QAAS,yBAA0BC,kBAAmB,IAAKJ,QAAS,CAAC,kBAC3F,CAAED,IAAK,aAAcI,QAAS,KAAMC,kBAAmB,KAAMJ,QAAS,CAAC,kBACvE,CAAED,IAAK,aAAcI,QAAS,KAAMC,kBAAmB,KAAMJ,QAAS,CAAC,kBACvE,CAAED,IAAK,qBAAsBI,QAAS,KAAMC,kBAAmB,KAAMJ,QAAS,CAAC,QAC/E,CAAED,IAAK,qBAAsBI,QAAS,KAAMC,kBAAmB,KAAMJ,QAAS,CAAC,QAC/E,CAAED,IAAK,qBAAsBI,QAAS,KAAMC,kBAAmB,KAAMJ,QAAS,CAAC,QAC/E,CAAED,IAAK,oBAAqBI,QAAS,KAAMC,kBAAmB,KAAMJ,QAAS,CAAC,QAC9E,CAAED,IAAK,oBAAqBI,QAAS,KAAMC,kBAAmB,KAAMJ,QAAS,CAAC,QAC9E,CAAED,IAAK,iBAAkBI,QAAS,KAAMC,kBAAmB,KAAMJ,QAAS,CAAC,kBAE3E,CAAED,IAAK,gCAAiCI,QAAS,KAAMC,kBAAmB,KAAMJ,QAAS,CAAC,YAAa,mBAEvG,CAAED,IAAK,gCAAiCI,QAAS,KAAMC,kBAAmB,KAAMJ,QAAS,CAAC,YAAa,oBAG3G/L,EAAW27B,gBAAkB,GAK7B37B,EAAW2tC,kBAAoB,KAE/B3tC,EAAW4sC,aAAe,KAC1B5sC,EAAW2sC,2BAA6B,I","sources":["webpack://code-cave/./node_modules/@babylonjs/core/Engines/thinEngine.js"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\nimport { EngineStore } from \"./engineStore.js\";\nimport { Effect } from \"../Materials/effect.js\";\nimport { _WarnImport } from \"../Misc/devTools.js\";\nimport { Observable } from \"../Misc/observable.js\";\nimport { DepthCullingState } from \"../States/depthCullingState.js\";\nimport { StencilState } from \"../States/stencilState.js\";\nimport { AlphaState } from \"../States/alphaCullingState.js\";\n\nimport { InternalTexture, InternalTextureSource } from \"../Materials/Textures/internalTexture.js\";\nimport { Logger } from \"../Misc/logger.js\";\nimport { IsDocumentAvailable, IsWindowObjectExist } from \"../Misc/domManagement.js\";\nimport { WebGLShaderProcessor } from \"./WebGL/webGLShaderProcessors.js\";\nimport { WebGL2ShaderProcessor } from \"./WebGL/webGL2ShaderProcessors.js\";\nimport { WebGLDataBuffer } from \"../Meshes/WebGL/webGLDataBuffer.js\";\nimport { WebGLPipelineContext } from \"./WebGL/webGLPipelineContext.js\";\nimport { PerformanceConfigurator } from \"./performanceConfigurator.js\";\nimport { WebGLHardwareTexture } from \"./WebGL/webGLHardwareTexture.js\";\nimport { DrawWrapper } from \"../Materials/drawWrapper.js\";\nimport { StencilStateComposer } from \"../States/stencilStateComposer.js\";\nimport { ShaderLanguage } from \"../Materials/shaderLanguage.js\";\nimport { PrecisionDate } from \"../Misc/precisionDate.js\";\n/**\n * Keeps track of all the buffer info used in engine.\n */\nclass BufferPointer {\n}\n/**\n * The base engine class (root of all engines)\n */\nexport class ThinEngine {\n /**\n * Returns the current npm package of the sdk\n */\n // Not mixed with Version for tooling purpose.\n static get NpmPackage() {\n return \"[email protected]\";\n }\n /**\n * Returns the current version of the framework\n */\n static get Version() {\n return \"6.10.0\";\n }\n /**\n * Returns a string describing the current engine\n */\n get description() {\n let description = this.name + this.webGLVersion;\n if (this._caps.parallelShaderCompile) {\n description += \" - Parallel shader compilation\";\n }\n return description;\n }\n /**\n * Gets or sets the name of the engine\n */\n get name() {\n return this._name;\n }\n set name(value) {\n this._name = value;\n }\n /**\n * Returns the version of the engine\n */\n get version() {\n return this._webGLVersion;\n }\n get isDisposed() {\n return this._isDisposed;\n }\n /**\n * Gets or sets the relative url used to load shaders if using the engine in non-minified mode\n */\n static get ShadersRepository() {\n return Effect.ShadersRepository;\n }\n static set ShadersRepository(value) {\n Effect.ShadersRepository = value;\n }\n /**\n * @internal\n */\n _getShaderProcessor(shaderLanguage) {\n return this._shaderProcessor;\n }\n /**\n * Gets or sets a boolean indicating if depth buffer should be reverse, going from far to near.\n * This can provide greater z depth for distant objects.\n */\n get useReverseDepthBuffer() {\n return this._useReverseDepthBuffer;\n }\n set useReverseDepthBuffer(useReverse) {\n if (useReverse === this._useReverseDepthBuffer) {\n return;\n }\n this._useReverseDepthBuffer = useReverse;\n if (useReverse) {\n this._depthCullingState.depthFunc = 518;\n }\n else {\n this._depthCullingState.depthFunc = 515;\n }\n }\n /**\n * Gets the current frame id\n */\n get frameId() {\n return this._frameId;\n }\n /**\n * Gets a boolean indicating that the engine supports uniform buffers\n * @see https://doc.babylonjs.com/setup/support/webGL2#uniform-buffer-objets\n */\n get supportsUniformBuffers() {\n return this.webGLVersion > 1 && !this.disableUniformBuffers;\n }\n /**\n * Gets the options used for engine creation\n * @returns EngineOptions object\n */\n getCreationOptions() {\n return this._creationOptions;\n }\n /** @internal */\n get _shouldUseHighPrecisionShader() {\n return !!(this._caps.highPrecisionShaderSupported && this._highPrecisionShadersAllowed);\n }\n /**\n * Gets a boolean indicating that only power of 2 textures are supported\n * Please note that you can still use non power of 2 textures but in this case the engine will forcefully convert them\n */\n get needPOTTextures() {\n return this._webGLVersion < 2 || this.forcePOTTextures;\n }\n /**\n * Gets the list of current active render loop functions\n * @returns an array with the current render loop functions\n */\n get activeRenderLoops() {\n return this._activeRenderLoops;\n }\n /**\n * Gets or sets a boolean indicating if resources should be retained to be able to handle context lost events\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/optimize_your_scene#handling-webgl-context-lost\n */\n get doNotHandleContextLost() {\n return this._doNotHandleContextLost;\n }\n set doNotHandleContextLost(value) {\n this._doNotHandleContextLost = value;\n }\n get _supportsHardwareTextureRescaling() {\n return false;\n }\n /**\n * sets the object from which width and height will be taken from when getting render width and height\n * Will fallback to the gl object\n * @param dimensions the framebuffer width and height that will be used.\n */\n set framebufferDimensionsObject(dimensions) {\n this._framebufferDimensionsObject = dimensions;\n }\n /**\n * Gets the current viewport\n */\n get currentViewport() {\n return this._cachedViewport;\n }\n /**\n * Gets the default empty texture\n */\n get emptyTexture() {\n if (!this._emptyTexture) {\n this._emptyTexture = this.createRawTexture(new Uint8Array(4), 1, 1, 5, false, false, 1);\n }\n return this._emptyTexture;\n }\n /**\n * Gets the default empty 3D texture\n */\n get emptyTexture3D() {\n if (!this._emptyTexture3D) {\n this._emptyTexture3D = this.createRawTexture3D(new Uint8Array(4), 1, 1, 1, 5, false, false, 1);\n }\n return this._emptyTexture3D;\n }\n /**\n * Gets the default empty 2D array texture\n */\n get emptyTexture2DArray() {\n if (!this._emptyTexture2DArray) {\n this._emptyTexture2DArray = this.createRawTexture2DArray(new Uint8Array(4), 1, 1, 1, 5, false, false, 1);\n }\n return this._emptyTexture2DArray;\n }\n /**\n * Gets the default empty cube texture\n */\n get emptyCubeTexture() {\n if (!this._emptyCubeTexture) {\n const faceData = new Uint8Array(4);\n const cubeData = [faceData, faceData, faceData, faceData, faceData, faceData];\n this._emptyCubeTexture = this.createRawCubeTexture(cubeData, 1, 5, 0, false, false, 1);\n }\n return this._emptyCubeTexture;\n }\n /**\n * Gets a boolean indicating if the engine runs in WebGPU or not.\n */\n get isWebGPU() {\n return this._isWebGPU;\n }\n /**\n * Gets the shader platform name used by the effects.\n */\n get shaderPlatformName() {\n return this._shaderPlatformName;\n }\n /**\n * Enables or disables the snapshot rendering mode\n * Note that the WebGL engine does not support snapshot rendering so setting the value won't have any effect for this engine\n */\n get snapshotRendering() {\n return false;\n }\n set snapshotRendering(activate) {\n // WebGL engine does not support snapshot rendering\n }\n /**\n * Gets or sets the snapshot rendering mode\n */\n get snapshotRenderingMode() {\n return this._snapshotRenderingMode;\n }\n set snapshotRenderingMode(mode) {\n this._snapshotRenderingMode = mode;\n }\n /**\n * Creates a new snapshot at the next frame using the current snapshotRenderingMode\n */\n snapshotRenderingReset() {\n this.snapshotRendering = false;\n }\n static _CreateCanvas(width, height) {\n if (typeof document === \"undefined\") {\n return new OffscreenCanvas(width, height);\n }\n const canvas = document.createElement(\"canvas\");\n canvas.width = width;\n canvas.height = height;\n return canvas;\n }\n /**\n * Create a canvas. This method is overridden by other engines\n * @param width width\n * @param height height\n * @returns ICanvas interface\n */\n createCanvas(width, height) {\n return ThinEngine._CreateCanvas(width, height);\n }\n /**\n * Create an image to use with canvas\n * @returns IImage interface\n */\n createCanvasImage() {\n return document.createElement(\"img\");\n }\n /**\n * Creates a new engine\n * @param canvasOrContext defines the canvas or WebGL context to use for rendering. If you provide a WebGL context, Babylon.js will not hook events on the canvas (like pointers, keyboards, etc...) so no event observables will be available. This is mostly used when Babylon.js is used as a plugin on a system which already used the WebGL context\n * @param antialias defines enable antialiasing (default: false)\n * @param options defines further options to be sent to the getContext() function\n * @param adaptToDeviceRatio defines whether to adapt to the device's viewport characteristics (default: false)\n */\n constructor(canvasOrContext, antialias, options, adaptToDeviceRatio) {\n var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;\n /** @internal */\n this._name = \"WebGL\";\n this._isDisposed = false;\n /**\n * Gets or sets a boolean that indicates if textures must be forced to power of 2 size even if not required\n */\n this.forcePOTTextures = false;\n /**\n * Gets a boolean indicating if the engine is currently rendering in fullscreen mode\n */\n this.isFullscreen = false;\n /**\n * Gets or sets a boolean indicating if back faces must be culled. If false, front faces are culled instead (true by default)\n * If non null, this takes precedence over the value from the material\n */\n this.cullBackFaces = null;\n /**\n * Gets or sets a boolean indicating if the engine must keep rendering even if the window is not in foreground\n */\n this.renderEvenInBackground = true;\n /**\n * Gets or sets a boolean indicating that cache can be kept between frames\n */\n this.preventCacheWipeBetweenFrames = false;\n /** Gets or sets a boolean indicating if the engine should validate programs after compilation */\n this.validateShaderPrograms = false;\n this._useReverseDepthBuffer = false;\n /**\n * Indicates if the z range in NDC space is 0..1 (value: true) or -1..1 (value: false)\n */\n this.isNDCHalfZRange = false;\n /**\n * Indicates that the origin of the texture/framebuffer space is the bottom left corner. If false, the origin is top left\n */\n this.hasOriginBottomLeft = true;\n /**\n * Gets or sets a boolean indicating that uniform buffers must be disabled even if they are supported\n */\n this.disableUniformBuffers = false;\n /**\n * An event triggered when the engine is disposed.\n */\n this.onDisposeObservable = new Observable();\n this._frameId = 0;\n /** @internal */\n this._uniformBuffers = new Array();\n /** @internal */\n this._storageBuffers = new Array();\n /** @internal */\n this._webGLVersion = 1.0;\n this._windowIsBackground = false;\n this._highPrecisionShadersAllowed = true;\n /** @internal */\n this._badOS = false;\n /** @internal */\n this._badDesktopOS = false;\n this._renderingQueueLaunched = false;\n this._activeRenderLoops = new Array();\n // Lost context\n /**\n * Observable signaled when a context lost event is raised\n */\n this.onContextLostObservable = new Observable();\n /**\n * Observable signaled when a context restored event is raised\n */\n this.onContextRestoredObservable = new Observable();\n this._contextWasLost = false;\n /** @internal */\n this._doNotHandleContextLost = false;\n /**\n * Gets or sets a boolean indicating that vertex array object must be disabled even if they are supported\n */\n this.disableVertexArrayObjects = false;\n // States\n /** @internal */\n this._colorWrite = true;\n /** @internal */\n this._colorWriteChanged = true;\n /** @internal */\n this._depthCullingState = new DepthCullingState();\n /** @internal */\n this._stencilStateComposer = new StencilStateComposer();\n /** @internal */\n this._stencilState = new StencilState();\n /** @internal */\n this._alphaState = new AlphaState();\n /** @internal */\n this._alphaMode = 1;\n /** @internal */\n this._alphaEquation = 0;\n // Cache\n /** @internal */\n this._internalTexturesCache = new Array();\n /** @internal */\n this._renderTargetWrapperCache = new Array();\n /** @internal */\n this._activeChannel = 0;\n this._currentTextureChannel = -1;\n /** @internal */\n this._boundTexturesCache = {};\n this._compiledEffects = {};\n this._vertexAttribArraysEnabled = [];\n this._uintIndicesCurrentlySet = false;\n this._currentBoundBuffer = new Array();\n /** @internal */\n this._currentFramebuffer = null;\n /** @internal */\n this._dummyFramebuffer = null;\n this._currentBufferPointers = new Array();\n this._currentInstanceLocations = new Array();\n this._currentInstanceBuffers = new Array();\n this._vaoRecordInProgress = false;\n this._mustWipeVertexAttributes = false;\n this._nextFreeTextureSlots = new Array();\n this._maxSimultaneousTextures = 0;\n this._maxMSAASamplesOverride = null;\n this._activeRequests = new Array();\n /**\n * If set to true zooming in and out in the browser will rescale the hardware-scaling correctly.\n */\n this.adaptToDeviceRatio = false;\n /** @internal */\n this._lastDevicePixelRatio = 1.0;\n /** @internal */\n this._transformTextureUrl = null;\n /**\n * Gets information about the current host\n */\n this.hostInformation = {\n isMobile: false,\n };\n /**\n * Defines whether the engine has been created with the premultipliedAlpha option on or not.\n */\n this.premultipliedAlpha = true;\n /**\n * Observable event triggered before each texture is initialized\n */\n this.onBeforeTextureInitObservable = new Observable();\n /** @internal */\n this._isWebGPU = false;\n this._snapshotRenderingMode = 0;\n this._viewportCached = { x: 0, y: 0, z: 0, w: 0 };\n this._unpackFlipYCached = null;\n /**\n * In case you are sharing the context with other applications, it might\n * be interested to not cache the unpack flip y state to ensure a consistent\n * value would be set.\n */\n this.enableUnpackFlipYCached = true;\n this._boundUniforms = {};\n this.startTime = PrecisionDate.Now;\n let canvas = null;\n options = options || {};\n this._creationOptions = options;\n // Save this off for use in resize().\n this.adaptToDeviceRatio = adaptToDeviceRatio !== null && adaptToDeviceRatio !== void 0 ? adaptToDeviceRatio : false;\n this._stencilStateComposer.stencilGlobal = this._stencilState;\n PerformanceConfigurator.SetMatrixPrecision(!!options.useHighPrecisionMatrix);\n options.antialias = antialias !== null && antialias !== void 0 ? antialias : options.antialias;\n options.deterministicLockstep = (_a = options.deterministicLockstep) !== null && _a !== void 0 ? _a : false;\n options.lockstepMaxSteps = (_b = options.lockstepMaxSteps) !== null && _b !== void 0 ? _b : 4;\n options.timeStep = (_c = options.timeStep) !== null && _c !== void 0 ? _c : 1 / 60;\n options.audioEngine = (_d = options.audioEngine) !== null && _d !== void 0 ? _d : true;\n options.stencil = (_e = options.stencil) !== null && _e !== void 0 ? _e : true;\n this._audioContext = (_g = (_f = options.audioEngineOptions) === null || _f === void 0 ? void 0 : _f.audioContext) !== null && _g !== void 0 ? _g : null;\n this._audioDestination = (_j = (_h = options.audioEngineOptions) === null || _h === void 0 ? void 0 : _h.audioDestination) !== null && _j !== void 0 ? _j : null;\n this.premultipliedAlpha = (_k = options.premultipliedAlpha) !== null && _k !== void 0 ? _k : true;\n this.useExactSrgbConversions = (_l = options.useExactSrgbConversions) !== null && _l !== void 0 ? _l : false;\n this._doNotHandleContextLost = !!options.doNotHandleContextLost;\n this._isStencilEnable = options.stencil ? true : false;\n // Viewport\n adaptToDeviceRatio = adaptToDeviceRatio || options.adaptToDeviceRatio || false;\n const devicePixelRatio = IsWindowObjectExist() ? window.devicePixelRatio || 1.0 : 1.0;\n const limitDeviceRatio = options.limitDeviceRatio || devicePixelRatio;\n this._hardwareScalingLevel = adaptToDeviceRatio ? 1.0 / Math.min(limitDeviceRatio, devicePixelRatio) : 1.0;\n this._lastDevicePixelRatio = devicePixelRatio;\n if (!canvasOrContext) {\n return;\n }\n if (canvasOrContext.getContext) {\n canvas = canvasOrContext;\n this._renderingCanvas = canvas;\n if (options.preserveDrawingBuffer === undefined) {\n options.preserveDrawingBuffer = false;\n }\n if (options.xrCompatible === undefined) {\n options.xrCompatible = true;\n }\n // Exceptions\n if (navigator && navigator.userAgent) {\n this._setupMobileChecks();\n const ua = navigator.userAgent;\n for (const exception of ThinEngine.ExceptionList) {\n const key = exception.key;\n const targets = exception.targets;\n const check = new RegExp(key);\n if (check.test(ua)) {\n if (exception.capture && exception.captureConstraint) {\n const capture = exception.capture;\n const constraint = exception.captureConstraint;\n const regex = new RegExp(capture);\n const matches = regex.exec(ua);\n if (matches && matches.length > 0) {\n const capturedValue = parseInt(matches[matches.length - 1]);\n if (capturedValue >= constraint) {\n continue;\n }\n }\n }\n for (const target of targets) {\n switch (target) {\n case \"uniformBuffer\":\n this.disableUniformBuffers = true;\n break;\n case \"vao\":\n this.disableVertexArrayObjects = true;\n break;\n case \"antialias\":\n options.antialias = false;\n break;\n case \"maxMSAASamples\":\n this._maxMSAASamplesOverride = 1;\n break;\n }\n }\n }\n }\n }\n // Context lost\n if (!this._doNotHandleContextLost) {\n this._onContextLost = (evt) => {\n evt.preventDefault();\n this._contextWasLost = true;\n Logger.Warn(\"WebGL context lost.\");\n this.onContextLostObservable.notifyObservers(this);\n };\n this._onContextRestored = () => {\n this._restoreEngineAfterContextLost(this._initGLContext.bind(this));\n };\n canvas.addEventListener(\"webglcontextlost\", this._onContextLost, false);\n canvas.addEventListener(\"webglcontextrestored\", this._onContextRestored, false);\n options.powerPreference = options.powerPreference || \"high-performance\";\n }\n // Detect if we are running on a faulty buggy desktop OS.\n this._badDesktopOS = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\n if (this._badDesktopOS) {\n options.xrCompatible = false;\n }\n // GL\n if (!options.disableWebGL2Support) {\n try {\n this._gl = (canvas.getContext(\"webgl2\", options) || canvas.getContext(\"experimental-webgl2\", options));\n if (this._gl) {\n this._webGLVersion = 2.0;\n this._shaderPlatformName = \"WEBGL2\";\n // Prevent weird browsers to lie (yeah that happens!)\n if (!this._gl.deleteQuery) {\n this._webGLVersion = 1.0;\n this._shaderPlatformName = \"WEBGL1\";\n }\n }\n }\n catch (e) {\n // Do nothing\n }\n }\n if (!this._gl) {\n if (!canvas) {\n throw new Error(\"The provided canvas is null or undefined.\");\n }\n try {\n this._gl = (canvas.getContext(\"webgl\", options) || canvas.getContext(\"experimental-webgl\", options));\n }\n catch (e) {\n throw new Error(\"WebGL not supported\");\n }\n }\n if (!this._gl) {\n throw new Error(\"WebGL not supported\");\n }\n }\n else {\n this._gl = canvasOrContext;\n this._renderingCanvas = this._gl.canvas;\n if (this._gl.renderbufferStorageMultisample) {\n this._webGLVersion = 2.0;\n this._shaderPlatformName = \"WEBGL2\";\n }\n else {\n this._shaderPlatformName = \"WEBGL1\";\n }\n const attributes = this._gl.getContextAttributes();\n if (attributes) {\n options.stencil = attributes.stencil;\n }\n }\n // Ensures a consistent color space unpacking of textures cross browser.\n this._gl.pixelStorei(this._gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, this._gl.NONE);\n if (options.useHighPrecisionFloats !== undefined) {\n this._highPrecisionShadersAllowed = options.useHighPrecisionFloats;\n }\n this.resize();\n this._initGLContext();\n this._initFeatures();\n // Prepare buffer pointers\n for (let i = 0; i < this._caps.maxVertexAttribs; i++) {\n this._currentBufferPointers[i] = new BufferPointer();\n }\n // Shader processor\n this._shaderProcessor = this.webGLVersion > 1 ? new WebGL2ShaderProcessor() : new WebGLShaderProcessor();\n // Detect if we are running on a faulty buggy OS.\n this._badOS = /iPad/i.test(navigator.userAgent) || /iPhone/i.test(navigator.userAgent);\n // Starting with iOS 14, we can trust the browser\n // let matches = navigator.userAgent.match(/Version\\/(\\d+)/);\n // if (matches && matches.length === 2) {\n // if (parseInt(matches[1]) >= 14) {\n // this._badOS = false;\n // }\n // }\n const versionToLog = `Babylon.js v${ThinEngine.Version}`;\n console.log(versionToLog + ` - ${this.description}`);\n // Check setAttribute in case of workers\n if (this._renderingCanvas && this._renderingCanvas.setAttribute) {\n this._renderingCanvas.setAttribute(\"data-engine\", versionToLog);\n }\n }\n _setupMobileChecks() {\n if (!(navigator && navigator.userAgent)) {\n return;\n }\n // Function to check if running on mobile device\n this._checkForMobile = () => {\n const currentUA = navigator.userAgent;\n this.hostInformation.isMobile =\n currentUA.indexOf(\"Mobile\") !== -1 ||\n // Needed for iOS 13+ detection on iPad (inspired by solution from https://stackoverflow.com/questions/9038625/detect-if-device-is-ios)\n (currentUA.indexOf(\"Mac\") !== -1 && IsDocumentAvailable() && \"ontouchend\" in document);\n };\n // Set initial isMobile value\n this._checkForMobile();\n // Set up event listener to check when window is resized (used to get emulator activation to work properly)\n if (IsWindowObjectExist()) {\n window.addEventListener(\"resize\", this._checkForMobile);\n }\n }\n _restoreEngineAfterContextLost(initEngine) {\n // Adding a timeout to avoid race condition at browser level\n setTimeout(async () => {\n var _a;\n this._dummyFramebuffer = null;\n const depthTest = this._depthCullingState.depthTest; // backup those values because the call to initEngine / wipeCaches will reset them\n const depthFunc = this._depthCullingState.depthFunc;\n const depthMask = this._depthCullingState.depthMask;\n const stencilTest = this._stencilState.stencilTest;\n // Rebuild context\n await initEngine();\n // Ensure webgl and engine states are matching\n this.wipeCaches(true);\n // Rebuild effects\n this._rebuildEffects();\n (_a = this._rebuildComputeEffects) === null || _a === void 0 ? void 0 : _a.call(this);\n // Note:\n // The call to _rebuildBuffers must be made before the call to _rebuildInternalTextures because in the process of _rebuildBuffers the buffers used by the post process managers will be rebuilt\n // and we may need to use the post process manager of the scene during _rebuildInternalTextures (in WebGL1, non-POT textures are rescaled using a post process + post process manager of the scene)\n // Rebuild buffers\n this._rebuildBuffers();\n // Rebuild textures\n this._rebuildInternalTextures();\n // Rebuild textures\n this._rebuildRenderTargetWrappers();\n // Reset engine states after all the buffer/textures/... have been rebuilt\n this.wipeCaches(true);\n this._depthCullingState.depthTest = depthTest;\n this._depthCullingState.depthFunc = depthFunc;\n this._depthCullingState.depthMask = depthMask;\n this._stencilState.stencilTest = stencilTest;\n Logger.Warn(this.name + \" context successfully restored.\");\n this.onContextRestoredObservable.notifyObservers(this);\n this._contextWasLost = false;\n }, 0);\n }\n /**\n * Shared initialization across engines types.\n * @param canvas The canvas associated with this instance of the engine.\n */\n _sharedInit(canvas) {\n this._renderingCanvas = canvas;\n }\n /**\n * @internal\n */\n _getShaderProcessingContext(shaderLanguage) {\n return null;\n }\n _rebuildInternalTextures() {\n const currentState = this._internalTexturesCache.slice(); // Do a copy because the rebuild will add proxies\n for (const internalTexture of currentState) {\n internalTexture._rebuild();\n }\n }\n _rebuildRenderTargetWrappers() {\n const currentState = this._renderTargetWrapperCache.slice(); // Do a copy because the rebuild will add proxies\n for (const renderTargetWrapper of currentState) {\n renderTargetWrapper._rebuild();\n }\n }\n _rebuildEffects() {\n for (const key in this._compiledEffects) {\n const effect = this._compiledEffects[key];\n effect._pipelineContext = null; // because _prepareEffect will try to dispose this pipeline before recreating it and that would lead to webgl errors\n effect._wasPreviouslyReady = false;\n effect._prepareEffect();\n }\n Effect.ResetCache();\n }\n /**\n * Gets a boolean indicating if all created effects are ready\n * @returns true if all effects are ready\n */\n areAllEffectsReady() {\n for (const key in this._compiledEffects) {\n const effect = this._compiledEffects[key];\n if (!effect.isReady()) {\n return false;\n }\n }\n return true;\n }\n _rebuildBuffers() {\n // Uniforms\n for (const uniformBuffer of this._uniformBuffers) {\n uniformBuffer._rebuild();\n }\n // Storage buffers\n for (const storageBuffer of this._storageBuffers) {\n storageBuffer._rebuild();\n }\n }\n _initGLContext() {\n var _a;\n // Caps\n this._caps = {\n maxTexturesImageUnits: this._gl.getParameter(this._gl.MAX_TEXTURE_IMAGE_UNITS),\n maxCombinedTexturesImageUnits: this._gl.getParameter(this._gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS),\n maxVertexTextureImageUnits: this._gl.getParameter(this._gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS),\n maxTextureSize: this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),\n maxSamples: this._webGLVersion > 1 ? this._gl.getParameter(this._gl.MAX_SAMPLES) : 1,\n maxCubemapTextureSize: this._gl.getParameter(this._gl.MAX_CUBE_MAP_TEXTURE_SIZE),\n maxRenderTextureSize: this._gl.getParameter(this._gl.MAX_RENDERBUFFER_SIZE),\n maxVertexAttribs: this._gl.getParameter(this._gl.MAX_VERTEX_ATTRIBS),\n maxVaryingVectors: this._gl.getParameter(this._gl.MAX_VARYING_VECTORS),\n maxFragmentUniformVectors: this._gl.getParameter(this._gl.MAX_FRAGMENT_UNIFORM_VECTORS),\n maxVertexUniformVectors: this._gl.getParameter(this._gl.MAX_VERTEX_UNIFORM_VECTORS),\n parallelShaderCompile: this._gl.getExtension(\"KHR_parallel_shader_compile\") || undefined,\n standardDerivatives: this._webGLVersion > 1 || this._gl.getExtension(\"OES_standard_derivatives\") !== null,\n maxAnisotropy: 1,\n astc: this._gl.getExtension(\"WEBGL_compressed_texture_astc\") || this._gl.getExtension(\"WEBKIT_WEBGL_compressed_texture_astc\"),\n bptc: this._gl.getExtension(\"EXT_texture_compression_bptc\") || this._gl.getExtension(\"WEBKIT_EXT_texture_compression_bptc\"),\n s3tc: this._gl.getExtension(\"WEBGL_compressed_texture_s3tc\") || this._gl.getExtension(\"WEBKIT_WEBGL_compressed_texture_s3tc\"),\n // eslint-disable-next-line @typescript-eslint/naming-convention\n s3tc_srgb: this._gl.getExtension(\"WEBGL_compressed_texture_s3tc_srgb\") || this._gl.getExtension(\"WEBKIT_WEBGL_compressed_texture_s3tc_srgb\"),\n pvrtc: this._gl.getExtension(\"WEBGL_compressed_texture_pvrtc\") || this._gl.getExtension(\"WEBKIT_WEBGL_compressed_texture_pvrtc\"),\n etc1: this._gl.getExtension(\"WEBGL_compressed_texture_etc1\") || this._gl.getExtension(\"WEBKIT_WEBGL_compressed_texture_etc1\"),\n etc2: this._gl.getExtension(\"WEBGL_compressed_texture_etc\") ||\n this._gl.getExtension(\"WEBKIT_WEBGL_compressed_texture_etc\") ||\n this._gl.getExtension(\"WEBGL_compressed_texture_es3_0\"),\n textureAnisotropicFilterExtension: this._gl.getExtension(\"EXT_texture_filter_anisotropic\") ||\n this._gl.getExtension(\"WEBKIT_EXT_texture_filter_anisotropic\") ||\n this._gl.getExtension(\"MOZ_EXT_texture_filter_anisotropic\"),\n uintIndices: this._webGLVersion > 1 || this._gl.getExtension(\"OES_element_index_uint\") !== null,\n fragmentDepthSupported: this._webGLVersion > 1 || this._gl.getExtension(\"EXT_frag_depth\") !== null,\n highPrecisionShaderSupported: false,\n timerQuery: this._gl.getExtension(\"EXT_disjoint_timer_query_webgl2\") || this._gl.getExtension(\"EXT_disjoint_timer_query\"),\n supportOcclusionQuery: this._webGLVersion > 1,\n canUseTimestampForTimerQuery: false,\n drawBuffersExtension: false,\n maxMSAASamples: 1,\n colorBufferFloat: !!(this._webGLVersion > 1 && this._gl.getExtension(\"EXT_color_buffer_float\")),\n colorBufferHalfFloat: !!(this._webGLVersion > 1 && this._gl.getExtension(\"EXT_color_buffer_half_float\")),\n textureFloat: this._webGLVersion > 1 || this._gl.getExtension(\"OES_texture_float\") ? true : false,\n textureHalfFloat: this._webGLVersion > 1 || this._gl.getExtension(\"OES_texture_half_float\") ? true : false,\n textureHalfFloatRender: false,\n textureFloatLinearFiltering: false,\n textureFloatRender: false,\n textureHalfFloatLinearFiltering: false,\n vertexArrayObject: false,\n instancedArrays: false,\n textureLOD: this._webGLVersion > 1 || this._gl.getExtension(\"EXT_shader_texture_lod\") ? true : false,\n texelFetch: this._webGLVersion !== 1,\n blendMinMax: false,\n multiview: this._gl.getExtension(\"OVR_multiview2\"),\n oculusMultiview: this._gl.getExtension(\"OCULUS_multiview\"),\n depthTextureExtension: false,\n canUseGLInstanceID: this._webGLVersion > 1,\n canUseGLVertexID: this._webGLVersion > 1,\n supportComputeShaders: false,\n supportSRGBBuffers: false,\n supportTransformFeedbacks: this._webGLVersion > 1,\n textureMaxLevel: this._webGLVersion > 1,\n texture2DArrayMaxLayerCount: this._webGLVersion > 1 ? this._gl.getParameter(this._gl.MAX_ARRAY_TEXTURE_LAYERS) : 128,\n disableMorphTargetTexture: false,\n };\n // Infos\n this._glVersion = this._gl.getParameter(this._gl.VERSION);\n const rendererInfo = this._gl.getExtension(\"WEBGL_debug_renderer_info\");\n if (rendererInfo != null) {\n this._glRenderer = this._gl.getParameter(rendererInfo.UNMASKED_RENDERER_WEBGL);\n this._glVendor = this._gl.getParameter(rendererInfo.UNMASKED_VENDOR_WEBGL);\n }\n if (!this._glVendor) {\n this._glVendor = this._gl.getParameter(this._gl.VENDOR) || \"Unknown vendor\";\n }\n if (!this._glRenderer) {\n this._glRenderer = this._gl.getParameter(this._gl.RENDERER) || \"Unknown renderer\";\n }\n // Constants\n if (this._gl.HALF_FLOAT_OES !== 0x8d61) {\n this._gl.HALF_FLOAT_OES = 0x8d61; // Half floating-point type (16-bit).\n }\n if (this._gl.RGBA16F !== 0x881a) {\n this._gl.RGBA16F = 0x881a; // RGBA 16-bit floating-point color-renderable internal sized format.\n }\n if (this._gl.RGBA32F !== 0x8814) {\n this._gl.RGBA32F = 0x8814; // RGBA 32-bit floating-point color-renderable internal sized format.\n }\n if (this._gl.DEPTH24_STENCIL8 !== 35056) {\n this._gl.DEPTH24_STENCIL8 = 35056;\n }\n // Extensions\n if (this._caps.timerQuery) {\n if (this._webGLVersion === 1) {\n this._gl.getQuery = this._caps.timerQuery.getQueryEXT.bind(this._caps.timerQuery);\n }\n // WebGLQuery casted to number to avoid TS error\n this._caps.canUseTimestampForTimerQuery = ((_a = this._gl.getQuery(this._caps.timerQuery.TIMESTAMP_EXT, this._caps.timerQuery.QUERY_COUNTER_BITS_EXT)) !== null && _a !== void 0 ? _a : 0) > 0;\n }\n this._caps.maxAnisotropy = this._caps.textureAnisotropicFilterExtension\n ? this._gl.getParameter(this._caps.textureAnisotropicFilterExtension.MAX_TEXTURE_MAX_ANISOTROPY_EXT)\n : 0;\n this._caps.textureFloatLinearFiltering = this._caps.textureFloat && this._gl.getExtension(\"OES_texture_float_linear\") ? true : false;\n this._caps.textureFloatRender = this._caps.textureFloat && this._canRenderToFloatFramebuffer() ? true : false;\n this._caps.textureHalfFloatLinearFiltering =\n this._webGLVersion > 1 || (this._caps.textureHalfFloat && this._gl.getExtension(\"OES_texture_half_float_linear\")) ? true : false;\n // Compressed formats\n if (this._caps.astc) {\n this._gl.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR = this._caps.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR;\n }\n if (this._caps.bptc) {\n this._gl.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT = this._caps.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT;\n }\n if (this._caps.s3tc_srgb) {\n this._gl.COMPRESSED_SRGB_S3TC_DXT1_EXT = this._caps.s3tc_srgb.COMPRESSED_SRGB_S3TC_DXT1_EXT;\n this._gl.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT = this._caps.s3tc_srgb.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;\n this._gl.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT = this._caps.s3tc_srgb.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT;\n }\n if (this._caps.etc2) {\n this._gl.COMPRESSED_SRGB8_ETC2 = this._caps.etc2.COMPRESSED_SRGB8_ETC2;\n this._gl.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC = this._caps.etc2.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC;\n }\n // Checks if some of the format renders first to allow the use of webgl inspector.\n if (this._webGLVersion > 1) {\n if (this._gl.HALF_FLOAT_OES !== 0x140b) {\n this._gl.HALF_FLOAT_OES = 0x140b;\n }\n }\n this._caps.textureHalfFloatRender = this._caps.textureHalfFloat && this._canRenderToHalfFloatFramebuffer();\n // Draw buffers\n if (this._webGLVersion > 1) {\n this._caps.drawBuffersExtension = true;\n this._caps.maxMSAASamples = this._maxMSAASamplesOverride !== null ? this._maxMSAASamplesOverride : this._gl.getParameter(this._gl.MAX_SAMPLES);\n }\n else {\n const drawBuffersExtension = this._gl.getExtension(\"WEBGL_draw_buffers\");\n if (drawBuffersExtension !== null) {\n this._caps.drawBuffersExtension = true;\n this._gl.drawBuffers = drawBuffersExtension.drawBuffersWEBGL.bind(drawBuffersExtension);\n this._gl.DRAW_FRAMEBUFFER = this._gl.FRAMEBUFFER;\n for (let i = 0; i < 16; i++) {\n this._gl[\"COLOR_ATTACHMENT\" + i + \"_WEBGL\"] = drawBuffersExtension[\"COLOR_ATTACHMENT\" + i + \"_WEBGL\"];\n }\n }\n }\n // Depth Texture\n if (this._webGLVersion > 1) {\n this._caps.depthTextureExtension = true;\n }\n else {\n const depthTextureExtension = this._gl.getExtension(\"WEBGL_depth_texture\");\n if (depthTextureExtension != null) {\n this._caps.depthTextureExtension = true;\n this._gl.UNSIGNED_INT_24_8 = depthTextureExtension.UNSIGNED_INT_24_8_WEBGL;\n }\n }\n // Vertex array object\n if (this.disableVertexArrayObjects) {\n this._caps.vertexArrayObject = false;\n }\n else if (this._webGLVersion > 1) {\n this._caps.vertexArrayObject = true;\n }\n else {\n const vertexArrayObjectExtension = this._gl.getExtension(\"OES_vertex_array_object\");\n if (vertexArrayObjectExtension != null) {\n this._caps.vertexArrayObject = true;\n this._gl.createVertexArray = vertexArrayObjectExtension.createVertexArrayOES.bind(vertexArrayObjectExtension);\n this._gl.bindVertexArray = vertexArrayObjectExtension.bindVertexArrayOES.bind(vertexArrayObjectExtension);\n this._gl.deleteVertexArray = vertexArrayObjectExtension.deleteVertexArrayOES.bind(vertexArrayObjectExtension);\n }\n }\n // Instances count\n if (this._webGLVersion > 1) {\n this._caps.instancedArrays = true;\n }\n else {\n const instanceExtension = this._gl.getExtension(\"ANGLE_instanced_arrays\");\n if (instanceExtension != null) {\n this._caps.instancedArrays = true;\n this._gl.drawArraysInstanced = instanceExtension.drawArraysInstancedANGLE.bind(instanceExtension);\n this._gl.drawElementsInstanced = instanceExtension.drawElementsInstancedANGLE.bind(instanceExtension);\n this._gl.vertexAttribDivisor = instanceExtension.vertexAttribDivisorANGLE.bind(instanceExtension);\n }\n else {\n this._caps.instancedArrays = false;\n }\n }\n if (this._gl.getShaderPrecisionFormat) {\n const vertexhighp = this._gl.getShaderPrecisionFormat(this._gl.VERTEX_SHADER, this._gl.HIGH_FLOAT);\n const fragmenthighp = this._gl.getShaderPrecisionFormat(this._gl.FRAGMENT_SHADER, this._gl.HIGH_FLOAT);\n if (vertexhighp && fragmenthighp) {\n this._caps.highPrecisionShaderSupported = vertexhighp.precision !== 0 && fragmenthighp.precision !== 0;\n }\n }\n if (this._webGLVersion > 1) {\n this._caps.blendMinMax = true;\n }\n else {\n const blendMinMaxExtension = this._gl.getExtension(\"EXT_blend_minmax\");\n if (blendMinMaxExtension != null) {\n this._caps.blendMinMax = true;\n this._gl.MAX = blendMinMaxExtension.MAX_EXT;\n this._gl.MIN = blendMinMaxExtension.MIN_EXT;\n }\n }\n // sRGB buffers\n // only run this if not already set to true (in the constructor, for example)\n if (!this._caps.supportSRGBBuffers) {\n if (this._webGLVersion > 1) {\n this._caps.supportSRGBBuffers = true;\n this._glSRGBExtensionValues = {\n SRGB: WebGL2RenderingContext.SRGB,\n SRGB8: WebGL2RenderingContext.SRGB8,\n SRGB8_ALPHA8: WebGL2RenderingContext.SRGB8_ALPHA8,\n };\n }\n else {\n const sRGBExtension = this._gl.getExtension(\"EXT_sRGB\");\n if (sRGBExtension != null) {\n this._caps.supportSRGBBuffers = true;\n this._glSRGBExtensionValues = {\n SRGB: sRGBExtension.SRGB_EXT,\n SRGB8: sRGBExtension.SRGB_ALPHA_EXT,\n SRGB8_ALPHA8: sRGBExtension.SRGB_ALPHA_EXT,\n };\n }\n }\n // take into account the forced state that was provided in options\n // When the issue in angle/chrome is fixed the flag should be taken into account only when it is explicitly defined\n this._caps.supportSRGBBuffers = this._caps.supportSRGBBuffers && !!(this._creationOptions && this._creationOptions.forceSRGBBufferSupportState);\n }\n // Depth buffer\n this._depthCullingState.depthTest = true;\n this._depthCullingState.depthFunc = this._gl.LEQUAL;\n this._depthCullingState.depthMask = true;\n // Texture maps\n this._maxSimultaneousTextures = this._caps.maxCombinedTexturesImageUnits;\n for (let slot = 0; slot < this._maxSimultaneousTextures; slot++) {\n this._nextFreeTextureSlots.push(slot);\n }\n if (this._glRenderer === \"Mali-G72\") {\n // Overcome a bug when using a texture to store morph targets on Mali-G72\n this._caps.disableMorphTargetTexture = true;\n }\n }\n _initFeatures() {\n this._features = {\n forceBitmapOverHTMLImageElement: false,\n supportRenderAndCopyToLodForFloatTextures: this._webGLVersion !== 1,\n supportDepthStencilTexture: this._webGLVersion !== 1,\n supportShadowSamplers: this._webGLVersion !== 1,\n uniformBufferHardCheckMatrix: false,\n allowTexturePrefiltering: this._webGLVersion !== 1,\n trackUbosInFrame: false,\n checkUbosContentBeforeUpload: false,\n supportCSM: this._webGLVersion !== 1,\n basisNeedsPOT: this._webGLVersion === 1,\n support3DTextures: this._webGLVersion !== 1,\n needTypeSuffixInShaderConstants: this._webGLVersion !== 1,\n supportMSAA: this._webGLVersion !== 1,\n supportSSAO2: this._webGLVersion !== 1,\n supportExtendedTextureFormats: this._webGLVersion !== 1,\n supportSwitchCaseInShader: this._webGLVersion !== 1,\n supportSyncTextureRead: true,\n needsInvertingBitmap: true,\n useUBOBindingCache: true,\n needShaderCodeInlining: false,\n needToAlwaysBindUniformBuffers: false,\n supportRenderPasses: false,\n supportSpriteInstancing: true,\n _collectUbosUpdatedInFrame: false,\n };\n }\n /**\n * Gets version of the current webGL context\n * Keep it for back compat - use version instead\n */\n get webGLVersion() {\n return this._webGLVersion;\n }\n /**\n * Gets a string identifying the name of the class\n * @returns \"Engine\" string\n */\n getClassName() {\n return \"ThinEngine\";\n }\n /**\n * Returns true if the stencil buffer has been enabled through the creation option of the context.\n */\n get isStencilEnable() {\n return this._isStencilEnable;\n }\n /** @internal */\n _prepareWorkingCanvas() {\n if (this._workingCanvas) {\n return;\n }\n this._workingCanvas = this.createCanvas(1, 1);\n const context = this._workingCanvas.getContext(\"2d\");\n if (context) {\n this._workingContext = context;\n }\n }\n /**\n * Reset the texture cache to empty state\n */\n resetTextureCache() {\n for (const key in this._boundTexturesCache) {\n if (!Object.prototype.hasOwnProperty.call(this._boundTexturesCache, key)) {\n continue;\n }\n this._boundTexturesCache[key] = null;\n }\n this._currentTextureChannel = -1;\n }\n /**\n * Gets an object containing information about the current engine context\n * @returns an object containing the vendor, the renderer and the version of the current engine context\n */\n getInfo() {\n return this.getGlInfo();\n }\n /**\n * Gets an object containing information about the current webGL context\n * @returns an object containing the vendor, the renderer and the version of the current webGL context\n */\n getGlInfo() {\n return {\n vendor: this._glVendor,\n renderer: this._glRenderer,\n version: this._glVersion,\n };\n }\n /**\n * Defines the hardware scaling level.\n * By default the hardware scaling level is computed from the window device ratio.\n * if level = 1 then the engine will render at the exact resolution of the canvas. If level = 0.5 then the engine will render at twice the size of the canvas.\n * @param level defines the level to use\n */\n setHardwareScalingLevel(level) {\n this._hardwareScalingLevel = level;\n this.resize();\n }\n /**\n * Gets the current hardware scaling level.\n * By default the hardware scaling level is computed from the window device ratio.\n * if level = 1 then the engine will render at the exact resolution of the canvas. If level = 0.5 then the engine will render at twice the size of the canvas.\n * @returns a number indicating the current hardware scaling level\n */\n getHardwareScalingLevel() {\n return this._hardwareScalingLevel;\n }\n /**\n * Gets the list of loaded textures\n * @returns an array containing all loaded textures\n */\n getLoadedTexturesCache() {\n return this._internalTexturesCache;\n }\n /**\n * Gets the object containing all engine capabilities\n * @returns the EngineCapabilities object\n */\n getCaps() {\n return this._caps;\n }\n /**\n * stop executing a render loop function and remove it from the execution array\n * @param renderFunction defines the function to be removed. If not provided all functions will be removed.\n */\n stopRenderLoop(renderFunction) {\n if (!renderFunction) {\n this._activeRenderLoops.length = 0;\n return;\n }\n const index = this._activeRenderLoops.indexOf(renderFunction);\n if (index >= 0) {\n this._activeRenderLoops.splice(index, 1);\n }\n }\n /** @internal */\n _renderLoop() {\n if (!this._contextWasLost) {\n let shouldRender = true;\n if (this._isDisposed || (!this.renderEvenInBackground && this._windowIsBackground)) {\n shouldRender = false;\n }\n if (shouldRender) {\n // Start new frame\n this.beginFrame();\n for (let index = 0; index < this._activeRenderLoops.length; index++) {\n const renderFunction = this._activeRenderLoops[index];\n renderFunction();\n }\n // Present\n this.endFrame();\n }\n }\n if (this._activeRenderLoops.length > 0) {\n this._frameHandler = this._queueNewFrame(this._boundRenderFunction, this.getHostWindow());\n }\n else {\n this._renderingQueueLaunched = false;\n }\n }\n /**\n * Gets the HTML canvas attached with the current webGL context\n * @returns a HTML canvas\n */\n getRenderingCanvas() {\n return this._renderingCanvas;\n }\n /**\n * Gets the audio context specified in engine initialization options\n * @returns an Audio Context\n */\n getAudioContext() {\n return this._audioContext;\n }\n /**\n * Gets the audio destination specified in engine initialization options\n * @returns an audio destination node\n */\n getAudioDestination() {\n return this._audioDestination;\n }\n /**\n * Gets host window\n * @returns the host window object\n */\n getHostWindow() {\n if (!IsWindowObjectExist()) {\n return null;\n }\n if (this._renderingCanvas && this._renderingCanvas.ownerDocument && this._renderingCanvas.ownerDocument.defaultView) {\n return this._renderingCanvas.ownerDocument.defaultView;\n }\n return window;\n }\n /**\n * Gets the current render width\n * @param useScreen defines if screen size must be used (or the current render target if any)\n * @returns a number defining the current render width\n */\n getRenderWidth(useScreen = false) {\n if (!useScreen && this._currentRenderTarget) {\n return this._currentRenderTarget.width;\n }\n return this._framebufferDimensionsObject ? this._framebufferDimensionsObject.framebufferWidth : this._gl.drawingBufferWidth;\n }\n /**\n * Gets the current render height\n * @param useScreen defines if screen size must be used (or the current render target if any)\n * @returns a number defining the current render height\n */\n getRenderHeight(useScreen = false) {\n if (!useScreen && this._currentRenderTarget) {\n return this._currentRenderTarget.height;\n }\n return this._framebufferDimensionsObject ? this._framebufferDimensionsObject.framebufferHeight : this._gl.drawingBufferHeight;\n }\n /**\n * Can be used to override the current requestAnimationFrame requester.\n * @internal\n */\n _queueNewFrame(bindedRenderFunction, requester) {\n return ThinEngine.QueueNewFrame(bindedRenderFunction, requester);\n }\n /**\n * Register and execute a render loop. The engine can have more than one render function\n * @param renderFunction defines the function to continuously execute\n */\n runRenderLoop(renderFunction) {\n if (this._activeRenderLoops.indexOf(renderFunction) !== -1) {\n return;\n }\n this._activeRenderLoops.push(renderFunction);\n if (!this._renderingQueueLaunched) {\n this._renderingQueueLaunched = true;\n this._boundRenderFunction = this._renderLoop.bind(this);\n this._frameHandler = this._queueNewFrame(this._boundRenderFunction, this.getHostWindow());\n }\n }\n /**\n * Clear the current render buffer or the current render target (if any is set up)\n * @param color defines the color to use\n * @param backBuffer defines if the back buffer must be cleared\n * @param depth defines if the depth buffer must be cleared\n * @param stencil defines if the stencil buffer must be cleared\n */\n clear(color, backBuffer, depth, stencil = false) {\n const useStencilGlobalOnly = this.stencilStateComposer.useStencilGlobalOnly;\n this.stencilStateComposer.useStencilGlobalOnly = true; // make sure the stencil mask is coming from the global stencil and not from a material (effect) which would currently be in effect\n this.applyStates();\n this.stencilStateComposer.useStencilGlobalOnly = useStencilGlobalOnly;\n let mode = 0;\n if (backBuffer && color) {\n this._gl.clearColor(color.r, color.g, color.b, color.a !== undefined ? color.a : 1.0);\n mode |= this._gl.COLOR_BUFFER_BIT;\n }\n if (depth) {\n if (this.useReverseDepthBuffer) {\n this._depthCullingState.depthFunc = this._gl.GEQUAL;\n this._gl.clearDepth(0.0);\n }\n else {\n this._gl.clearDepth(1.0);\n }\n mode |= this._gl.DEPTH_BUFFER_BIT;\n }\n if (stencil) {\n this._gl.clearStencil(0);\n mode |= this._gl.STENCIL_BUFFER_BIT;\n }\n this._gl.clear(mode);\n }\n /**\n * @internal\n */\n _viewport(x, y, width, height) {\n if (x !== this._viewportCached.x || y !== this._viewportCached.y || width !== this._viewportCached.z || height !== this._viewportCached.w) {\n this._viewportCached.x = x;\n this._viewportCached.y = y;\n this._viewportCached.z = width;\n this._viewportCached.w = height;\n this._gl.viewport(x, y, width, height);\n }\n }\n /**\n * Set the WebGL's viewport\n * @param viewport defines the viewport element to be used\n * @param requiredWidth defines the width required for rendering. If not provided the rendering canvas' width is used\n * @param requiredHeight defines the height required for rendering. If not provided the rendering canvas' height is used\n */\n setViewport(viewport, requiredWidth, requiredHeight) {\n const width = requiredWidth || this.getRenderWidth();\n const height = requiredHeight || this.getRenderHeight();\n const x = viewport.x || 0;\n const y = viewport.y || 0;\n this._cachedViewport = viewport;\n this._viewport(x * width, y * height, width * viewport.width, height * viewport.height);\n }\n /**\n * Begin a new frame\n */\n beginFrame() { }\n /**\n * Enf the current frame\n */\n endFrame() {\n // Force a flush in case we are using a bad OS.\n if (this._badOS) {\n this.flushFramebuffer();\n }\n this._frameId++;\n }\n /**\n * Resize the view according to the canvas' size\n * @param forceSetSize true to force setting the sizes of the underlying canvas\n */\n resize(forceSetSize = false) {\n let width;\n let height;\n // Re-query hardware scaling level to handle zoomed-in resizing.\n if (this.adaptToDeviceRatio) {\n const devicePixelRatio = IsWindowObjectExist() ? window.devicePixelRatio || 1.0 : 1.0;\n const changeRatio = this._lastDevicePixelRatio / devicePixelRatio;\n this._lastDevicePixelRatio = devicePixelRatio;\n this._hardwareScalingLevel *= changeRatio;\n }\n if (IsWindowObjectExist() && IsDocumentAvailable()) {\n // make sure it is a Node object, and is a part of the document.\n if (this._renderingCanvas) {\n const boundingRect = this._renderingCanvas.getBoundingClientRect\n ? this._renderingCanvas.getBoundingClientRect()\n : {\n // fallback to last solution in case the function doesn't exist\n width: this._renderingCanvas.width * this._hardwareScalingLevel,\n height: this._renderingCanvas.height * this._hardwareScalingLevel,\n };\n width = this._renderingCanvas.clientWidth || boundingRect.width || this._renderingCanvas.width || 100;\n height = this._renderingCanvas.clientHeight || boundingRect.height || this._renderingCanvas.height || 100;\n }\n else {\n width = window.innerWidth;\n height = window.innerHeight;\n }\n }\n else {\n width = this._renderingCanvas ? this._renderingCanvas.width : 100;\n height = this._renderingCanvas ? this._renderingCanvas.height : 100;\n }\n this.setSize(width / this._hardwareScalingLevel, height / this._hardwareScalingLevel, forceSetSize);\n }\n /**\n * Force a specific size of the canvas\n * @param width defines the new canvas' width\n * @param height defines the new canvas' height\n * @param forceSetSize true to force setting the sizes of the underlying canvas\n * @returns true if the size was changed\n */\n setSize(width, height, forceSetSize = false) {\n if (!this._renderingCanvas) {\n return false;\n }\n width = width | 0;\n height = height | 0;\n if (!forceSetSize && this._renderingCanvas.width === width && this._renderingCanvas.height === height) {\n return false;\n }\n this._renderingCanvas.width = width;\n this._renderingCanvas.height = height;\n return true;\n }\n /**\n * Binds the frame buffer to the specified texture.\n * @param rtWrapper The render target wrapper to render to\n * @param faceIndex The face of the texture to render to in case of cube texture and if the render target wrapper is not a multi render target\n * @param requiredWidth The width of the target to render to\n * @param requiredHeight The height of the target to render to\n * @param forceFullscreenViewport Forces the viewport to be the entire texture/screen if true\n * @param lodLevel Defines the lod level to bind to the frame buffer\n * @param layer Defines the 2d array index to bind to the frame buffer if the render target wrapper is not a multi render target\n */\n bindFramebuffer(rtWrapper, faceIndex = 0, requiredWidth, requiredHeight, forceFullscreenViewport, lodLevel = 0, layer = 0) {\n var _a, _b, _c, _d, _e;\n const webglRTWrapper = rtWrapper;\n if (this._currentRenderTarget) {\n this.unBindFramebuffer(this._currentRenderTarget);\n }\n this._currentRenderTarget = rtWrapper;\n this._bindUnboundFramebuffer(webglRTWrapper._MSAAFramebuffer ? webglRTWrapper._MSAAFramebuffer : webglRTWrapper._framebuffer);\n const gl = this._gl;\n if (!rtWrapper.isMulti) {\n if (rtWrapper.is2DArray) {\n gl.framebufferTextureLayer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, (_a = rtWrapper.texture._hardwareTexture) === null || _a === void 0 ? void 0 : _a.underlyingResource, lodLevel, layer);\n }\n else if (rtWrapper.isCube) {\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, (_b = rtWrapper.texture._hardwareTexture) === null || _b === void 0 ? void 0 : _b.underlyingResource, lodLevel);\n }\n }\n const depthStencilTexture = rtWrapper._depthStencilTexture;\n if (depthStencilTexture) {\n const attachment = rtWrapper._depthStencilTextureWithStencil ? gl.DEPTH_STENCIL_ATTACHMENT : gl.DEPTH_ATTACHMENT;\n if (rtWrapper.is2DArray) {\n gl.framebufferTextureLayer(gl.FRAMEBUFFER, attachment, (_c = depthStencilTexture._hardwareTexture) === null || _c === void 0 ? void 0 : _c.underlyingResource, lodLevel, layer);\n }\n else if (rtWrapper.isCube) {\n gl.framebufferTexture2D(gl.FRAMEBUFFER, attachment, gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, (_d = depthStencilTexture._hardwareTexture) === null || _d === void 0 ? void 0 : _d.underlyingResource, lodLevel);\n }\n else {\n gl.framebufferTexture2D(gl.FRAMEBUFFER, attachment, gl.TEXTURE_2D, (_e = depthStencilTexture._hardwareTexture) === null || _e === void 0 ? void 0 : _e.underlyingResource, lodLevel);\n }\n }\n if (this._cachedViewport && !forceFullscreenViewport) {\n this.setViewport(this._cachedViewport, requiredWidth, requiredHeight);\n }\n else {\n if (!requiredWidth) {\n requiredWidth = rtWrapper.width;\n if (lodLevel) {\n requiredWidth = requiredWidth / Math.pow(2, lodLevel);\n }\n }\n if (!requiredHeight) {\n requiredHeight = rtWrapper.height;\n if (lodLevel) {\n requiredHeight = requiredHeight / Math.pow(2, lodLevel);\n }\n }\n this._viewport(0, 0, requiredWidth, requiredHeight);\n }\n this.wipeCaches();\n }\n /**\n * Set various states to the webGL context\n * @param culling defines culling state: true to enable culling, false to disable it\n * @param zOffset defines the value to apply to zOffset (0 by default)\n * @param force defines if states must be applied even if cache is up to date\n * @param reverseSide defines if culling must be reversed (CCW if false, CW if true)\n * @param cullBackFaces true to cull back faces, false to cull front faces (if culling is enabled)\n * @param stencil stencil states to set\n * @param zOffsetUnits defines the value to apply to zOffsetUnits (0 by default)\n */\n setState(culling, zOffset = 0, force, reverseSide = false, cullBackFaces, stencil, zOffsetUnits = 0) {\n var _a, _b;\n // Culling\n if (this._depthCullingState.cull !== culling || force) {\n this._depthCullingState.cull = culling;\n }\n // Cull face\n const cullFace = ((_b = (_a = this.cullBackFaces) !== null && _a !== void 0 ? _a : cullBackFaces) !== null && _b !== void 0 ? _b : true) ? this._gl.BACK : this._gl.FRONT;\n if (this._depthCullingState.cullFace !== cullFace || force) {\n this._depthCullingState.cullFace = cullFace;\n }\n // Z offset\n this.setZOffset(zOffset);\n this.setZOffsetUnits(zOffsetUnits);\n // Front face\n const frontFace = reverseSide ? this._gl.CW : this._gl.CCW;\n if (this._depthCullingState.frontFace !== frontFace || force) {\n this._depthCullingState.frontFace = frontFace;\n }\n this._stencilStateComposer.stencilMaterial = stencil;\n }\n /**\n * Gets a boolean indicating if depth testing is enabled\n * @returns the current state\n */\n getDepthBuffer() {\n return this._depthCullingState.depthTest;\n }\n /**\n * Enable or disable depth buffering\n * @param enable defines the state to set\n */\n setDepthBuffer(enable) {\n this._depthCullingState.depthTest = enable;\n }\n /**\n * Set the z offset Factor to apply to current rendering\n * @param value defines the offset to apply\n */\n setZOffset(value) {\n this._depthCullingState.zOffset = this.useReverseDepthBuffer ? -value : value;\n }\n /**\n * Gets the current value of the zOffset Factor\n * @returns the current zOffset Factor state\n */\n getZOffset() {\n const zOffset = this._depthCullingState.zOffset;\n return this.useReverseDepthBuffer ? -zOffset : zOffset;\n }\n /**\n * Set the z offset Units to apply to current rendering\n * @param value defines the offset to apply\n */\n setZOffsetUnits(value) {\n this._depthCullingState.zOffsetUnits = this.useReverseDepthBuffer ? -value : value;\n }\n /**\n * Gets the current value of the zOffset Units\n * @returns the current zOffset Units state\n */\n getZOffsetUnits() {\n const zOffsetUnits = this._depthCullingState.zOffsetUnits;\n return this.useReverseDepthBuffer ? -zOffsetUnits : zOffsetUnits;\n }\n /**\n * @internal\n */\n _bindUnboundFramebuffer(framebuffer) {\n if (this._currentFramebuffer !== framebuffer) {\n this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, framebuffer);\n this._currentFramebuffer = framebuffer;\n }\n }\n /** @internal */\n _currentFrameBufferIsDefaultFrameBuffer() {\n return this._currentFramebuffer === null;\n }\n /**\n * Generates the mipmaps for a texture\n * @param texture texture to generate the mipmaps for\n */\n generateMipmaps(texture) {\n this._bindTextureDirectly(this._gl.TEXTURE_2D, texture, true);\n this._gl.generateMipmap(this._gl.TEXTURE_2D);\n this._bindTextureDirectly(this._gl.TEXTURE_2D, null);\n }\n /**\n * Unbind the current render target texture from the webGL context\n * @param texture defines the render target wrapper to unbind\n * @param disableGenerateMipMaps defines a boolean indicating that mipmaps must not be generated\n * @param onBeforeUnbind defines a function which will be called before the effective unbind\n */\n unBindFramebuffer(texture, disableGenerateMipMaps = false, onBeforeUnbind) {\n var _a;\n const webglRTWrapper = texture;\n this._currentRenderTarget = null;\n // If MSAA, we need to bitblt back to main texture\n const gl = this._gl;\n if (webglRTWrapper._MSAAFramebuffer) {\n if (texture.isMulti) {\n // This texture is part of a MRT texture, we need to treat all attachments\n this.unBindMultiColorAttachmentFramebuffer(texture, disableGenerateMipMaps, onBeforeUnbind);\n return;\n }\n gl.bindFramebuffer(gl.READ_FRAMEBUFFER, webglRTWrapper._MSAAFramebuffer);\n gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, webglRTWrapper._framebuffer);\n gl.blitFramebuffer(0, 0, texture.width, texture.height, 0, 0, texture.width, texture.height, gl.COLOR_BUFFER_BIT, gl.NEAREST);\n }\n if (((_a = texture.texture) === null || _a === void 0 ? void 0 : _a.generateMipMaps) && !disableGenerateMipMaps && !texture.isCube) {\n this.generateMipmaps(texture.texture);\n }\n if (onBeforeUnbind) {\n if (webglRTWrapper._MSAAFramebuffer) {\n // Bind the correct framebuffer\n this._bindUnboundFramebuffer(webglRTWrapper._framebuffer);\n }\n onBeforeUnbind();\n }\n this._bindUnboundFramebuffer(null);\n }\n /**\n * Force a webGL flush (ie. a flush of all waiting webGL commands)\n */\n flushFramebuffer() {\n this._gl.flush();\n }\n /**\n * Unbind the current render target and bind the default framebuffer\n */\n restoreDefaultFramebuffer() {\n if (this._currentRenderTarget) {\n this.unBindFramebuffer(this._currentRenderTarget);\n }\n else {\n this._bindUnboundFramebuffer(null);\n }\n if (this._cachedViewport) {\n this.setViewport(this._cachedViewport);\n }\n this.wipeCaches();\n }\n // VBOs\n /** @internal */\n _resetVertexBufferBinding() {\n this.bindArrayBuffer(null);\n this._cachedVertexBuffers = null;\n }\n /**\n * Creates a vertex buffer\n * @param data the data for the vertex buffer\n * @returns the new WebGL static buffer\n */\n createVertexBuffer(data) {\n return this._createVertexBuffer(data, this._gl.STATIC_DRAW);\n }\n _createVertexBuffer(data, usage) {\n const vbo = this._gl.createBuffer();\n if (!vbo) {\n throw new Error(\"Unable to create vertex buffer\");\n }\n const dataBuffer = new WebGLDataBuffer(vbo);\n this.bindArrayBuffer(dataBuffer);\n if (data instanceof Array) {\n this._gl.bufferData(this._gl.ARRAY_BUFFER, new Float32Array(data), usage);\n }\n else {\n this._gl.bufferData(this._gl.ARRAY_BUFFER, data, usage);\n }\n this._resetVertexBufferBinding();\n dataBuffer.references = 1;\n return dataBuffer;\n }\n /**\n * Creates a dynamic vertex buffer\n * @param data the data for the dynamic vertex buffer\n * @returns the new WebGL dynamic buffer\n */\n createDynamicVertexBuffer(data) {\n return this._createVertexBuffer(data, this._gl.DYNAMIC_DRAW);\n }\n _resetIndexBufferBinding() {\n this.bindIndexBuffer(null);\n this._cachedIndexBuffer = null;\n }\n /**\n * Creates a new index buffer\n * @param indices defines the content of the index buffer\n * @param updatable defines if the index buffer must be updatable\n * @returns a new webGL buffer\n */\n createIndexBuffer(indices, updatable) {\n const vbo = this._gl.createBuffer();\n const dataBuffer = new WebGLDataBuffer(vbo);\n if (!vbo) {\n throw new Error(\"Unable to create index buffer\");\n }\n this.bindIndexBuffer(dataBuffer);\n const data = this._normalizeIndexData(indices);\n this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, data, updatable ? this._gl.DYNAMIC_DRAW : this._gl.STATIC_DRAW);\n this._resetIndexBufferBinding();\n dataBuffer.references = 1;\n dataBuffer.is32Bits = data.BYTES_PER_ELEMENT === 4;\n return dataBuffer;\n }\n _normalizeIndexData(indices) {\n const bytesPerElement = indices.BYTES_PER_ELEMENT;\n if (bytesPerElement === 2) {\n return indices;\n }\n // Check 32 bit support\n if (this._caps.uintIndices) {\n if (indices instanceof Uint32Array) {\n return indices;\n }\n else {\n // number[] or Int32Array, check if 32 bit is necessary\n for (let index = 0; index < indices.length; index++) {\n if (indices[index] >= 65535) {\n return new Uint32Array(indices);\n }\n }\n return new Uint16Array(indices);\n }\n }\n // No 32 bit support, force conversion to 16 bit (values greater 16 bit are lost)\n return new Uint16Array(indices);\n }\n /**\n * Bind a webGL buffer to the webGL context\n * @param buffer defines the buffer to bind\n */\n bindArrayBuffer(buffer) {\n if (!this._vaoRecordInProgress) {\n this._unbindVertexArrayObject();\n }\n this._bindBuffer(buffer, this._gl.ARRAY_BUFFER);\n }\n /**\n * Bind a specific block at a given index in a specific shader program\n * @param pipelineContext defines the pipeline context to use\n * @param blockName defines the block name\n * @param index defines the index where to bind the block\n */\n bindUniformBlock(pipelineContext, blockName, index) {\n const program = pipelineContext.program;\n const uniformLocation = this._gl.getUniformBlockIndex(program, blockName);\n this._gl.uniformBlockBinding(program, uniformLocation, index);\n }\n // eslint-disable-next-line @typescript-eslint/naming-convention\n bindIndexBuffer(buffer) {\n if (!this._vaoRecordInProgress) {\n this._unbindVertexArrayObject();\n }\n this._bindBuffer(buffer, this._gl.ELEMENT_ARRAY_BUFFER);\n }\n _bindBuffer(buffer, target) {\n if (this._vaoRecordInProgress || this._currentBoundBuffer[target] !== buffer) {\n this._gl.bindBuffer(target, buffer ? buffer.underlyingResource : null);\n this._currentBoundBuffer[target] = buffer;\n }\n }\n /**\n * update the bound buffer with the given data\n * @param data defines the data to update\n */\n updateArrayBuffer(data) {\n this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, data);\n }\n _vertexAttribPointer(buffer, indx, size, type, normalized, stride, offset) {\n const pointer = this._currentBufferPointers[indx];\n if (!pointer) {\n return;\n }\n let changed = false;\n if (!pointer.active) {\n changed = true;\n pointer.active = true;\n pointer.index = indx;\n pointer.size = size;\n pointer.type = type;\n pointer.normalized = normalized;\n pointer.stride = stride;\n pointer.offset = offset;\n pointer.buffer = buffer;\n }\n else {\n if (pointer.buffer !== buffer) {\n pointer.buffer = buffer;\n changed = true;\n }\n if (pointer.size !== size) {\n pointer.size = size;\n changed = true;\n }\n if (pointer.type !== type) {\n pointer.type = type;\n changed = true;\n }\n if (pointer.normalized !== normalized) {\n pointer.normalized = normalized;\n changed = true;\n }\n if (pointer.stride !== stride) {\n pointer.stride = stride;\n changed = true;\n }\n if (pointer.offset !== offset) {\n pointer.offset = offset;\n changed = true;\n }\n }\n if (changed || this._vaoRecordInProgress) {\n this.bindArrayBuffer(buffer);\n if (type === this._gl.UNSIGNED_INT || type === this._gl.INT) {\n this._gl.vertexAttribIPointer(indx, size, type, stride, offset);\n }\n else {\n this._gl.vertexAttribPointer(indx, size, type, normalized, stride, offset);\n }\n }\n }\n /**\n * @internal\n */\n _bindIndexBufferWithCache(indexBuffer) {\n if (indexBuffer == null) {\n return;\n }\n if (this._cachedIndexBuffer !== indexBuffer) {\n this._cachedIndexBuffer = indexBuffer;\n this.bindIndexBuffer(indexBuffer);\n this._uintIndicesCurrentlySet = indexBuffer.is32Bits;\n }\n }\n _bindVertexBuffersAttributes(vertexBuffers, effect, overrideVertexBuffers) {\n const attributes = effect.getAttributesNames();\n if (!this._vaoRecordInProgress) {\n this._unbindVertexArrayObject();\n }\n this.unbindAllAttributes();\n for (let index = 0; index < attributes.length; index++) {\n const order = effect.getAttributeLocation(index);\n if (order >= 0) {\n const ai = attributes[index];\n let vertexBuffer = null;\n if (overrideVertexBuffers) {\n vertexBuffer = overrideVertexBuffers[ai];\n }\n if (!vertexBuffer) {\n vertexBuffer = vertexBuffers[ai];\n }\n if (!vertexBuffer) {\n continue;\n }\n this._gl.enableVertexAttribArray(order);\n if (!this._vaoRecordInProgress) {\n this._vertexAttribArraysEnabled[order] = true;\n }\n const buffer = vertexBuffer.getBuffer();\n if (buffer) {\n this._vertexAttribPointer(buffer, order, vertexBuffer.getSize(), vertexBuffer.type, vertexBuffer.normalized, vertexBuffer.byteStride, vertexBuffer.byteOffset);\n if (vertexBuffer.getIsInstanced()) {\n this._gl.vertexAttribDivisor(order, vertexBuffer.getInstanceDivisor());\n if (!this._vaoRecordInProgress) {\n this._currentInstanceLocations.push(order);\n this._currentInstanceBuffers.push(buffer);\n }\n }\n }\n }\n }\n }\n /**\n * Records a vertex array object\n * @see https://doc.babylonjs.com/setup/support/webGL2#vertex-array-objects\n * @param vertexBuffers defines the list of vertex buffers to store\n * @param indexBuffer defines the index buffer to store\n * @param effect defines the effect to store\n * @param overrideVertexBuffers defines optional list of avertex buffers that overrides the entries in vertexBuffers\n * @returns the new vertex array object\n */\n recordVertexArrayObject(vertexBuffers, indexBuffer, effect, overrideVertexBuffers) {\n const vao = this._gl.createVertexArray();\n if (!vao) {\n throw new Error(\"Unable to create VAO\");\n }\n this._vaoRecordInProgress = true;\n this._gl.bindVertexArray(vao);\n this._mustWipeVertexAttributes = true;\n this._bindVertexBuffersAttributes(vertexBuffers, effect, overrideVertexBuffers);\n this.bindIndexBuffer(indexBuffer);\n this._vaoRecordInProgress = false;\n this._gl.bindVertexArray(null);\n return vao;\n }\n /**\n * Bind a specific vertex array object\n * @see https://doc.babylonjs.com/setup/support/webGL2#vertex-array-objects\n * @param vertexArrayObject defines the vertex array object to bind\n * @param indexBuffer defines the index buffer to bind\n */\n bindVertexArrayObject(vertexArrayObject, indexBuffer) {\n if (this._cachedVertexArrayObject !== vertexArrayObject) {\n this._cachedVertexArrayObject = vertexArrayObject;\n this._gl.bindVertexArray(vertexArrayObject);\n this._cachedVertexBuffers = null;\n this._cachedIndexBuffer = null;\n this._uintIndicesCurrentlySet = indexBuffer != null && indexBuffer.is32Bits;\n this._mustWipeVertexAttributes = true;\n }\n }\n /**\n * Bind webGl buffers directly to the webGL context\n * @param vertexBuffer defines the vertex buffer to bind\n * @param indexBuffer defines the index buffer to bind\n * @param vertexDeclaration defines the vertex declaration to use with the vertex buffer\n * @param vertexStrideSize defines the vertex stride of the vertex buffer\n * @param effect defines the effect associated with the vertex buffer\n */\n bindBuffersDirectly(vertexBuffer, indexBuffer, vertexDeclaration, vertexStrideSize, effect) {\n if (this._cachedVertexBuffers !== vertexBuffer || this._cachedEffectForVertexBuffers !== effect) {\n this._cachedVertexBuffers = vertexBuffer;\n this._cachedEffectForVertexBuffers = effect;\n const attributesCount = effect.getAttributesCount();\n this._unbindVertexArrayObject();\n this.unbindAllAttributes();\n let offset = 0;\n for (let index = 0; index < attributesCount; index++) {\n if (index < vertexDeclaration.length) {\n const order = effect.getAttributeLocation(index);\n if (order >= 0) {\n this._gl.enableVertexAttribArray(order);\n this._vertexAttribArraysEnabled[order] = true;\n this._vertexAttribPointer(vertexBuffer, order, vertexDeclaration[index], this._gl.FLOAT, false, vertexStrideSize, offset);\n }\n offset += vertexDeclaration[index] * 4;\n }\n }\n }\n this._bindIndexBufferWithCache(indexBuffer);\n }\n _unbindVertexArrayObject() {\n if (!this._cachedVertexArrayObject) {\n return;\n }\n this._cachedVertexArrayObject = null;\n this._gl.bindVertexArray(null);\n }\n /**\n * Bind a list of vertex buffers to the webGL context\n * @param vertexBuffers defines the list of vertex buffers to bind\n * @param indexBuffer defines the index buffer to bind\n * @param effect defines the effect associated with the vertex buffers\n * @param overrideVertexBuffers defines optional list of avertex buffers that overrides the entries in vertexBuffers\n */\n bindBuffers(vertexBuffers, indexBuffer, effect, overrideVertexBuffers) {\n if (this._cachedVertexBuffers !== vertexBuffers || this._cachedEffectForVertexBuffers !== effect) {\n this._cachedVertexBuffers = vertexBuffers;\n this._cachedEffectForVertexBuffers = effect;\n this._bindVertexBuffersAttributes(vertexBuffers, effect, overrideVertexBuffers);\n }\n this._bindIndexBufferWithCache(indexBuffer);\n }\n /**\n * Unbind all instance attributes\n */\n unbindInstanceAttributes() {\n let boundBuffer;\n for (let i = 0, ul = this._currentInstanceLocations.length; i < ul; i++) {\n const instancesBuffer = this._currentInstanceBuffers[i];\n if (boundBuffer != instancesBuffer && instancesBuffer.references) {\n boundBuffer = instancesBuffer;\n this.bindArrayBuffer(instancesBuffer);\n }\n const offsetLocation = this._currentInstanceLocations[i];\n this._gl.vertexAttribDivisor(offsetLocation, 0);\n }\n this._currentInstanceBuffers.length = 0;\n this._currentInstanceLocations.length = 0;\n }\n /**\n * Release and free the memory of a vertex array object\n * @param vao defines the vertex array object to delete\n */\n releaseVertexArrayObject(vao) {\n this._gl.deleteVertexArray(vao);\n }\n /**\n * @internal\n */\n _releaseBuffer(buffer) {\n buffer.references--;\n if (buffer.references === 0) {\n this._deleteBuffer(buffer);\n return true;\n }\n return false;\n }\n _deleteBuffer(buffer) {\n this._gl.deleteBuffer(buffer.underlyingResource);\n }\n /**\n * Update the content of a webGL buffer used with instantiation and bind it to the webGL context\n * @param instancesBuffer defines the webGL buffer to update and bind\n * @param data defines the data to store in the buffer\n * @param offsetLocations defines the offsets or attributes information used to determine where data must be stored in the buffer\n */\n updateAndBindInstancesBuffer(instancesBuffer, data, offsetLocations) {\n this.bindArrayBuffer(instancesBuffer);\n if (data) {\n this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, data);\n }\n if (offsetLocations[0].index !== undefined) {\n this.bindInstancesBuffer(instancesBuffer, offsetLocations, true);\n }\n else {\n for (let index = 0; index < 4; index++) {\n const offsetLocation = offsetLocations[index];\n if (!this._vertexAttribArraysEnabled[offsetLocation]) {\n this._gl.enableVertexAttribArray(offsetLocation);\n this._vertexAttribArraysEnabled[offsetLocation] = true;\n }\n this._vertexAttribPointer(instancesBuffer, offsetLocation, 4, this._gl.FLOAT, false, 64, index * 16);\n this._gl.vertexAttribDivisor(offsetLocation, 1);\n this._currentInstanceLocations.push(offsetLocation);\n this._currentInstanceBuffers.push(instancesBuffer);\n }\n }\n }\n /**\n * Bind the content of a webGL buffer used with instantiation\n * @param instancesBuffer defines the webGL buffer to bind\n * @param attributesInfo defines the offsets or attributes information used to determine where data must be stored in the buffer\n * @param computeStride defines Whether to compute the strides from the info or use the default 0\n */\n bindInstancesBuffer(instancesBuffer, attributesInfo, computeStride = true) {\n this.bindArrayBuffer(instancesBuffer);\n let stride = 0;\n if (computeStride) {\n for (let i = 0; i < attributesInfo.length; i++) {\n const ai = attributesInfo[i];\n stride += ai.attributeSize * 4;\n }\n }\n for (let i = 0; i < attributesInfo.length; i++) {\n const ai = attributesInfo[i];\n if (ai.index === undefined) {\n ai.index = this._currentEffect.getAttributeLocationByName(ai.attributeName);\n }\n if (ai.index < 0) {\n continue;\n }\n if (!this._vertexAttribArraysEnabled[ai.index]) {\n this._gl.enableVertexAttribArray(ai.index);\n this._vertexAttribArraysEnabled[ai.index] = true;\n }\n this._vertexAttribPointer(instancesBuffer, ai.index, ai.attributeSize, ai.attributeType || this._gl.FLOAT, ai.normalized || false, stride, ai.offset);\n this._gl.vertexAttribDivisor(ai.index, ai.divisor === undefined ? 1 : ai.divisor);\n this._currentInstanceLocations.push(ai.index);\n this._currentInstanceBuffers.push(instancesBuffer);\n }\n }\n /**\n * Disable the instance attribute corresponding to the name in parameter\n * @param name defines the name of the attribute to disable\n */\n disableInstanceAttributeByName(name) {\n if (!this._currentEffect) {\n return;\n }\n const attributeLocation = this._currentEffect.getAttributeLocationByName(name);\n this.disableInstanceAttribute(attributeLocation);\n }\n /**\n * Disable the instance attribute corresponding to the location in parameter\n * @param attributeLocation defines the attribute location of the attribute to disable\n */\n disableInstanceAttribute(attributeLocation) {\n let shouldClean = false;\n let index;\n while ((index = this._currentInstanceLocations.indexOf(attributeLocation)) !== -1) {\n this._currentInstanceLocations.splice(index, 1);\n this._currentInstanceBuffers.splice(index, 1);\n shouldClean = true;\n index = this._currentInstanceLocations.indexOf(attributeLocation);\n }\n if (shouldClean) {\n this._gl.vertexAttribDivisor(attributeLocation, 0);\n this.disableAttributeByIndex(attributeLocation);\n }\n }\n /**\n * Disable the attribute corresponding to the location in parameter\n * @param attributeLocation defines the attribute location of the attribute to disable\n */\n disableAttributeByIndex(attributeLocation) {\n this._gl.disableVertexAttribArray(attributeLocation);\n this._vertexAttribArraysEnabled[attributeLocation] = false;\n this._currentBufferPointers[attributeLocation].active = false;\n }\n /**\n * Send a draw order\n * @param useTriangles defines if triangles must be used to draw (else wireframe will be used)\n * @param indexStart defines the starting index\n * @param indexCount defines the number of index to draw\n * @param instancesCount defines the number of instances to draw (if instantiation is enabled)\n */\n draw(useTriangles, indexStart, indexCount, instancesCount) {\n this.drawElementsType(useTriangles ? 0 : 1, indexStart, indexCount, instancesCount);\n }\n /**\n * Draw a list of points\n * @param verticesStart defines the index of first vertex to draw\n * @param verticesCount defines the count of vertices to draw\n * @param instancesCount defines the number of instances to draw (if instantiation is enabled)\n */\n drawPointClouds(verticesStart, verticesCount, instancesCount) {\n this.drawArraysType(2, verticesStart, verticesCount, instancesCount);\n }\n /**\n * Draw a list of unindexed primitives\n * @param useTriangles defines if triangles must be used to draw (else wireframe will be used)\n * @param verticesStart defines the index of first vertex to draw\n * @param verticesCount defines the count of vertices to draw\n * @param instancesCount defines the number of instances to draw (if instantiation is enabled)\n */\n drawUnIndexed(useTriangles, verticesStart, verticesCount, instancesCount) {\n this.drawArraysType(useTriangles ? 0 : 1, verticesStart, verticesCount, instancesCount);\n }\n /**\n * Draw a list of indexed primitives\n * @param fillMode defines the primitive to use\n * @param indexStart defines the starting index\n * @param indexCount defines the number of index to draw\n * @param instancesCount defines the number of instances to draw (if instantiation is enabled)\n */\n drawElementsType(fillMode, indexStart, indexCount, instancesCount) {\n // Apply states\n this.applyStates();\n this._reportDrawCall();\n // Render\n const drawMode = this._drawMode(fillMode);\n const indexFormat = this._uintIndicesCurrentlySet ? this._gl.UNSIGNED_INT : this._gl.UNSIGNED_SHORT;\n const mult = this._uintIndicesCurrentlySet ? 4 : 2;\n if (instancesCount) {\n this._gl.drawElementsInstanced(drawMode, indexCount, indexFormat, indexStart * mult, instancesCount);\n }\n else {\n this._gl.drawElements(drawMode, indexCount, indexFormat, indexStart * mult);\n }\n }\n /**\n * Draw a list of unindexed primitives\n * @param fillMode defines the primitive to use\n * @param verticesStart defines the index of first vertex to draw\n * @param verticesCount defines the count of vertices to draw\n * @param instancesCount defines the number of instances to draw (if instantiation is enabled)\n */\n drawArraysType(fillMode, verticesStart, verticesCount, instancesCount) {\n // Apply states\n this.applyStates();\n this._reportDrawCall();\n const drawMode = this._drawMode(fillMode);\n if (instancesCount) {\n this._gl.drawArraysInstanced(drawMode, verticesStart, verticesCount, instancesCount);\n }\n else {\n this._gl.drawArrays(drawMode, verticesStart, verticesCount);\n }\n }\n _drawMode(fillMode) {\n switch (fillMode) {\n // Triangle views\n case 0:\n return this._gl.TRIANGLES;\n case 2:\n return this._gl.POINTS;\n case 1:\n return this._gl.LINES;\n // Draw modes\n case 3:\n return this._gl.POINTS;\n case 4:\n return this._gl.LINES;\n case 5:\n return this._gl.LINE_LOOP;\n case 6:\n return this._gl.LINE_STRIP;\n case 7:\n return this._gl.TRIANGLE_STRIP;\n case 8:\n return this._gl.TRIANGLE_FAN;\n default:\n return this._gl.TRIANGLES;\n }\n }\n /** @internal */\n _reportDrawCall() {\n // Will be implemented by children\n }\n // Shaders\n /**\n * @internal\n */\n _releaseEffect(effect) {\n if (this._compiledEffects[effect._key]) {\n delete this._compiledEffects[effect._key];\n }\n const pipelineContext = effect.getPipelineContext();\n if (pipelineContext) {\n this._deletePipelineContext(pipelineContext);\n }\n }\n /**\n * @internal\n */\n _deletePipelineContext(pipelineContext) {\n const webGLPipelineContext = pipelineContext;\n if (webGLPipelineContext && webGLPipelineContext.program) {\n webGLPipelineContext.program.__SPECTOR_rebuildProgram = null;\n this._gl.deleteProgram(webGLPipelineContext.program);\n }\n }\n /** @internal */\n _getGlobalDefines(defines) {\n if (defines) {\n if (this.isNDCHalfZRange) {\n defines[\"IS_NDC_HALF_ZRANGE\"] = \"\";\n }\n else {\n delete defines[\"IS_NDC_HALF_ZRANGE\"];\n }\n if (this.useReverseDepthBuffer) {\n defines[\"USE_REVERSE_DEPTHBUFFER\"] = \"\";\n }\n else {\n delete defines[\"USE_REVERSE_DEPTHBUFFER\"];\n }\n if (this.useExactSrgbConversions) {\n defines[\"USE_EXACT_SRGB_CONVERSIONS\"] = \"\";\n }\n else {\n delete defines[\"USE_EXACT_SRGB_CONVERSIONS\"];\n }\n return;\n }\n else {\n let s = \"\";\n if (this.isNDCHalfZRange) {\n s += \"#define IS_NDC_HALF_ZRANGE\";\n }\n if (this.useReverseDepthBuffer) {\n if (s) {\n s += \"\\n\";\n }\n s += \"#define USE_REVERSE_DEPTHBUFFER\";\n }\n if (this.useExactSrgbConversions) {\n if (s) {\n s += \"\\n\";\n }\n s += \"#define USE_EXACT_SRGB_CONVERSIONS\";\n }\n return s;\n }\n }\n /**\n * Create a new effect (used to store vertex/fragment shaders)\n * @param baseName defines the base name of the effect (The name of file without .fragment.fx or .vertex.fx)\n * @param attributesNamesOrOptions defines either a list of attribute names or an IEffectCreationOptions object\n * @param uniformsNamesOrEngine defines either a list of uniform names or the engine to use\n * @param samplers defines an array of string used to represent textures\n * @param defines defines the string containing the defines to use to compile the shaders\n * @param fallbacks defines the list of potential fallbacks to use if shader compilation fails\n * @param onCompiled defines a function to call when the effect creation is successful\n * @param onError defines a function to call when the effect creation has failed\n * @param indexParameters defines an object containing the index values to use to compile shaders (like the maximum number of simultaneous lights)\n * @param shaderLanguage the language the shader is written in (default: GLSL)\n * @returns the new Effect\n */\n createEffect(baseName, attributesNamesOrOptions, uniformsNamesOrEngine, samplers, defines, fallbacks, onCompiled, onError, indexParameters, shaderLanguage = ShaderLanguage.GLSL) {\n var _a;\n const vertex = baseName.vertexElement || baseName.vertex || baseName.vertexToken || baseName.vertexSource || baseName;\n const fragment = baseName.fragmentElement || baseName.fragment || baseName.fragmentToken || baseName.fragmentSource || baseName;\n const globalDefines = this._getGlobalDefines();\n let fullDefines = (_a = defines !== null && defines !== void 0 ? defines : attributesNamesOrOptions.defines) !== null && _a !== void 0 ? _a : \"\";\n if (globalDefines) {\n fullDefines += globalDefines;\n }\n const name = vertex + \"+\" + fragment + \"@\" + fullDefines;\n if (this._compiledEffects[name]) {\n const compiledEffect = this._compiledEffects[name];\n if (onCompiled && compiledEffect.isReady()) {\n onCompiled(compiledEffect);\n }\n return compiledEffect;\n }\n const effect = new Effect(baseName, attributesNamesOrOptions, uniformsNamesOrEngine, samplers, this, defines, fallbacks, onCompiled, onError, indexParameters, name, shaderLanguage);\n this._compiledEffects[name] = effect;\n return effect;\n }\n // eslint-disable-next-line @typescript-eslint/naming-convention\n static _ConcatenateShader(source, defines, shaderVersion = \"\") {\n return shaderVersion + (defines ? defines + \"\\n\" : \"\") + source;\n }\n _compileShader(source, type, defines, shaderVersion) {\n return this._compileRawShader(ThinEngine._ConcatenateShader(source, defines, shaderVersion), type);\n }\n _compileRawShader(source, type) {\n const gl = this._gl;\n const shader = gl.createShader(type === \"vertex\" ? gl.VERTEX_SHADER : gl.FRAGMENT_SHADER);\n if (!shader) {\n let error = gl.NO_ERROR;\n let tempError = gl.NO_ERROR;\n while ((tempError = gl.getError()) !== gl.NO_ERROR) {\n error = tempError;\n }\n throw new Error(`Something went wrong while creating a gl ${type} shader object. gl error=${error}, gl isContextLost=${gl.isContextLost()}, _contextWasLost=${this._contextWasLost}`);\n }\n gl.shaderSource(shader, source);\n gl.compileShader(shader);\n return shader;\n }\n /**\n * @internal\n */\n _getShaderSource(shader) {\n return this._gl.getShaderSource(shader);\n }\n /**\n * Directly creates a webGL program\n * @param pipelineContext defines the pipeline context to attach to\n * @param vertexCode defines the vertex shader code to use\n * @param fragmentCode defines the fragment shader code to use\n * @param context defines the webGL context to use (if not set, the current one will be used)\n * @param transformFeedbackVaryings defines the list of transform feedback varyings to use\n * @returns the new webGL program\n */\n createRawShaderProgram(pipelineContext, vertexCode, fragmentCode, context, transformFeedbackVaryings = null) {\n context = context || this._gl;\n const vertexShader = this._compileRawShader(vertexCode, \"vertex\");\n const fragmentShader = this._compileRawShader(fragmentCode, \"fragment\");\n return this._createShaderProgram(pipelineContext, vertexShader, fragmentShader, context, transformFeedbackVaryings);\n }\n /**\n * Creates a webGL program\n * @param pipelineContext defines the pipeline context to attach to\n * @param vertexCode defines the vertex shader code to use\n * @param fragmentCode defines the fragment shader code to use\n * @param defines defines the string containing the defines to use to compile the shaders\n * @param context defines the webGL context to use (if not set, the current one will be used)\n * @param transformFeedbackVaryings defines the list of transform feedback varyings to use\n * @returns the new webGL program\n */\n createShaderProgram(pipelineContext, vertexCode, fragmentCode, defines, context, transformFeedbackVaryings = null) {\n context = context || this._gl;\n const shaderVersion = this._webGLVersion > 1 ? \"#version 300 es\\n#define WEBGL2 \\n\" : \"\";\n const vertexShader = this._compileShader(vertexCode, \"vertex\", defines, shaderVersion);\n const fragmentShader = this._compileShader(fragmentCode, \"fragment\", defines, shaderVersion);\n return this._createShaderProgram(pipelineContext, vertexShader, fragmentShader, context, transformFeedbackVaryings);\n }\n /**\n * Inline functions in shader code that are marked to be inlined\n * @param code code to inline\n * @returns inlined code\n */\n inlineShaderCode(code) {\n // no inlining needed in the WebGL engine\n return code;\n }\n /**\n * Creates a new pipeline context\n * @param shaderProcessingContext defines the shader processing context used during the processing if available\n * @returns the new pipeline\n */\n createPipelineContext(shaderProcessingContext) {\n const pipelineContext = new WebGLPipelineContext();\n pipelineContext.engine = this;\n if (this._caps.parallelShaderCompile) {\n pipelineContext.isParallelCompiled = true;\n }\n return pipelineContext;\n }\n /**\n * Creates a new material context\n * @returns the new context\n */\n createMaterialContext() {\n return undefined;\n }\n /**\n * Creates a new draw context\n * @returns the new context\n */\n createDrawContext() {\n return undefined;\n }\n _createShaderProgram(pipelineContext, vertexShader, fragmentShader, context, transformFeedbackVaryings = null) {\n const shaderProgram = context.createProgram();\n pipelineContext.program = shaderProgram;\n if (!shaderProgram) {\n throw new Error(\"Unable to create program\");\n }\n context.attachShader(shaderProgram, vertexShader);\n context.attachShader(shaderProgram, fragmentShader);\n context.linkProgram(shaderProgram);\n pipelineContext.context = context;\n pipelineContext.vertexShader = vertexShader;\n pipelineContext.fragmentShader = fragmentShader;\n if (!pipelineContext.isParallelCompiled) {\n this._finalizePipelineContext(pipelineContext);\n }\n return shaderProgram;\n }\n _finalizePipelineContext(pipelineContext) {\n const context = pipelineContext.context;\n const vertexShader = pipelineContext.vertexShader;\n const fragmentShader = pipelineContext.fragmentShader;\n const program = pipelineContext.program;\n const linked = context.getProgramParameter(program, context.LINK_STATUS);\n if (!linked) {\n // Get more info\n // Vertex\n if (!this._gl.getShaderParameter(vertexShader, this._gl.COMPILE_STATUS)) {\n const log = this._gl.getShaderInfoLog(vertexShader);\n if (log) {\n pipelineContext.vertexCompilationError = log;\n throw new Error(\"VERTEX SHADER \" + log);\n }\n }\n // Fragment\n if (!this._gl.getShaderParameter(fragmentShader, this._gl.COMPILE_STATUS)) {\n const log = this._gl.getShaderInfoLog(fragmentShader);\n if (log) {\n pipelineContext.fragmentCompilationError = log;\n throw new Error(\"FRAGMENT SHADER \" + log);\n }\n }\n const error = context.getProgramInfoLog(program);\n if (error) {\n pipelineContext.programLinkError = error;\n throw new Error(error);\n }\n }\n if (this.validateShaderPrograms) {\n context.validateProgram(program);\n const validated = context.getProgramParameter(program, context.VALIDATE_STATUS);\n if (!validated) {\n const error = context.getProgramInfoLog(program);\n if (error) {\n pipelineContext.programValidationError = error;\n throw new Error(error);\n }\n }\n }\n context.deleteShader(vertexShader);\n context.deleteShader(fragmentShader);\n pipelineContext.vertexShader = undefined;\n pipelineContext.fragmentShader = undefined;\n if (pipelineContext.onCompiled) {\n pipelineContext.onCompiled();\n pipelineContext.onCompiled = undefined;\n }\n }\n /**\n * @internal\n */\n _preparePipelineContext(pipelineContext, vertexSourceCode, fragmentSourceCode, createAsRaw, rawVertexSourceCode, rawFragmentSourceCode, rebuildRebind, defines, transformFeedbackVaryings, key) {\n const webGLRenderingState = pipelineContext;\n if (createAsRaw) {\n webGLRenderingState.program = this.createRawShaderProgram(webGLRenderingState, vertexSourceCode, fragmentSourceCode, undefined, transformFeedbackVaryings);\n }\n else {\n webGLRenderingState.program = this.createShaderProgram(webGLRenderingState, vertexSourceCode, fragmentSourceCode, defines, undefined, transformFeedbackVaryings);\n }\n webGLRenderingState.program.__SPECTOR_rebuildProgram = rebuildRebind;\n }\n /**\n * @internal\n */\n _isRenderingStateCompiled(pipelineContext) {\n const webGLPipelineContext = pipelineContext;\n if (this._gl.getProgramParameter(webGLPipelineContext.program, this._caps.parallelShaderCompile.COMPLETION_STATUS_KHR)) {\n this._finalizePipelineContext(webGLPipelineContext);\n return true;\n }\n return false;\n }\n /**\n * @internal\n */\n _executeWhenRenderingStateIsCompiled(pipelineContext, action) {\n const webGLPipelineContext = pipelineContext;\n if (!webGLPipelineContext.isParallelCompiled) {\n action();\n return;\n }\n const oldHandler = webGLPipelineContext.onCompiled;\n if (oldHandler) {\n webGLPipelineContext.onCompiled = () => {\n oldHandler();\n action();\n };\n }\n else {\n webGLPipelineContext.onCompiled = action;\n }\n }\n /**\n * Gets the list of webGL uniform locations associated with a specific program based on a list of uniform names\n * @param pipelineContext defines the pipeline context to use\n * @param uniformsNames defines the list of uniform names\n * @returns an array of webGL uniform locations\n */\n getUniforms(pipelineContext, uniformsNames) {\n const results = new Array();\n const webGLPipelineContext = pipelineContext;\n for (let index = 0; index < uniformsNames.length; index++) {\n results.push(this._gl.getUniformLocation(webGLPipelineContext.program, uniformsNames[index]));\n }\n return results;\n }\n /**\n * Gets the list of active attributes for a given webGL program\n * @param pipelineContext defines the pipeline context to use\n * @param attributesNames defines the list of attribute names to get\n * @returns an array of indices indicating the offset of each attribute\n */\n getAttributes(pipelineContext, attributesNames) {\n const results = [];\n const webGLPipelineContext = pipelineContext;\n for (let index = 0; index < attributesNames.length; index++) {\n try {\n results.push(this._gl.getAttribLocation(webGLPipelineContext.program, attributesNames[index]));\n }\n catch (e) {\n results.push(-1);\n }\n }\n return results;\n }\n /**\n * Activates an effect, making it the current one (ie. the one used for rendering)\n * @param effect defines the effect to activate\n */\n enableEffect(effect) {\n effect = effect !== null && DrawWrapper.IsWrapper(effect) ? effect.effect : effect; // get only the effect, we don't need a Wrapper in the WebGL engine\n if (!effect || effect === this._currentEffect) {\n return;\n }\n this._stencilStateComposer.stencilMaterial = undefined;\n effect = effect;\n // Use program\n this.bindSamplers(effect);\n this._currentEffect = effect;\n if (effect.onBind) {\n effect.onBind(effect);\n }\n if (effect._onBindObservable) {\n effect._onBindObservable.notifyObservers(effect);\n }\n }\n /**\n * Set the value of an uniform to a number (int)\n * @param uniform defines the webGL uniform location where to store the value\n * @param value defines the int number to store\n * @returns true if the value was set\n */\n setInt(uniform, value) {\n if (!uniform) {\n return false;\n }\n this._gl.uniform1i(uniform, value);\n return true;\n }\n /**\n * Set the value of an uniform to a int2\n * @param uniform defines the webGL uniform location where to store the value\n * @param x defines the 1st component of the value\n * @param y defines the 2nd component of the value\n * @returns true if the value was set\n */\n setInt2(uniform, x, y) {\n if (!uniform) {\n return false;\n }\n this._gl.uniform2i(uniform, x, y);\n return true;\n }\n /**\n * Set the value of an uniform to a int3\n * @param uniform defines the webGL uniform location where to store the value\n * @param x defines the 1st component of the value\n * @param y defines the 2nd component of the value\n * @param z defines the 3rd component of the value\n * @returns true if the value was set\n */\n setInt3(uniform, x, y, z) {\n if (!uniform) {\n return false;\n }\n this._gl.uniform3i(uniform, x, y, z);\n return true;\n }\n /**\n * Set the value of an uniform to a int4\n * @param uniform defines the webGL uniform location where to store the value\n * @param x defines the 1st component of the value\n * @param y defines the 2nd component of the value\n * @param z defines the 3rd component of the value\n * @param w defines the 4th component of the value\n * @returns true if the value was set\n */\n setInt4(uniform, x, y, z, w) {\n if (!uniform) {\n return false;\n }\n this._gl.uniform4i(uniform, x, y, z, w);\n return true;\n }\n /**\n * Set the value of an uniform to an array of int32\n * @param uniform defines the webGL uniform location where to store the value\n * @param array defines the array of int32 to store\n * @returns true if the value was set\n */\n setIntArray(uniform, array) {\n if (!uniform) {\n return false;\n }\n this._gl.uniform1iv(uniform, array);\n return true;\n }\n /**\n * Set the value of an uniform to an array of int32 (stored as vec2)\n * @param uniform defines the webGL uniform location where to store the value\n * @param array defines the array of int32 to store\n * @returns true if the value was set\n */\n setIntArray2(uniform, array) {\n if (!uniform || array.length % 2 !== 0) {\n return false;\n }\n this._gl.uniform2iv(uniform, array);\n return true;\n }\n /**\n * Set the value of an uniform to an array of int32 (stored as vec3)\n * @param uniform defines the webGL uniform location where to store the value\n * @param array defines the array of int32 to store\n * @returns true if the value was set\n */\n setIntArray3(uniform, array) {\n if (!uniform || array.length % 3 !== 0) {\n return false;\n }\n this._gl.uniform3iv(uniform, array);\n return true;\n }\n /**\n * Set the value of an uniform to an array of int32 (stored as vec4)\n * @param uniform defines the webGL uniform location where to store the value\n * @param array defines the array of int32 to store\n * @returns true if the value was set\n */\n setIntArray4(uniform, array) {\n if (!uniform || array.length % 4 !== 0) {\n return false;\n }\n this._gl.uniform4iv(uniform, array);\n return true;\n }\n /**\n * Set the value of an uniform to a number (unsigned int)\n * @param uniform defines the webGL uniform location where to store the value\n * @param value defines the unsigned int number to store\n * @returns true if the value was set\n */\n setUInt(uniform, value) {\n if (!uniform) {\n return false;\n }\n this._gl.uniform1ui(uniform, value);\n return true;\n }\n /**\n * Set the value of an uniform to a unsigned int2\n * @param uniform defines the webGL uniform location where to store the value\n * @param x defines the 1st component of the value\n * @param y defines the 2nd component of the value\n * @returns true if the value was set\n */\n setUInt2(uniform, x, y) {\n if (!uniform) {\n return false;\n }\n this._gl.uniform2ui(uniform, x, y);\n return true;\n }\n /**\n * Set the value of an uniform to a unsigned int3\n * @param uniform defines the webGL uniform location where to store the value\n * @param x defines the 1st component of the value\n * @param y defines the 2nd component of the value\n * @param z defines the 3rd component of the value\n * @returns true if the value was set\n */\n setUInt3(uniform, x, y, z) {\n if (!uniform) {\n return false;\n }\n this._gl.uniform3ui(uniform, x, y, z);\n return true;\n }\n /**\n * Set the value of an uniform to a unsigned int4\n * @param uniform defines the webGL uniform location where to store the value\n * @param x defines the 1st component of the value\n * @param y defines the 2nd component of the value\n * @param z defines the 3rd component of the value\n * @param w defines the 4th component of the value\n * @returns true if the value was set\n */\n setUInt4(uniform, x, y, z, w) {\n if (!uniform) {\n return false;\n }\n this._gl.uniform4ui(uniform, x, y, z, w);\n return true;\n }\n /**\n * Set the value of an uniform to an array of unsigned int32\n * @param uniform defines the webGL uniform location where to store the value\n * @param array defines the array of unsigned int32 to store\n * @returns true if the value was set\n */\n setUIntArray(uniform, array) {\n if (!uniform) {\n return false;\n }\n this._gl.uniform1uiv(uniform, array);\n return true;\n }\n /**\n * Set the value of an uniform to an array of unsigned int32 (stored as vec2)\n * @param uniform defines the webGL uniform location where to store the value\n * @param array defines the array of unsigned int32 to store\n * @returns true if the value was set\n */\n setUIntArray2(uniform, array) {\n if (!uniform || array.length % 2 !== 0) {\n return false;\n }\n this._gl.uniform2uiv(uniform, array);\n return true;\n }\n /**\n * Set the value of an uniform to an array of unsigned int32 (stored as vec3)\n * @param uniform defines the webGL uniform location where to store the value\n * @param array defines the array of unsigned int32 to store\n * @returns true if the value was set\n */\n setUIntArray3(uniform, array) {\n if (!uniform || array.length % 3 !== 0) {\n return false;\n }\n this._gl.uniform3uiv(uniform, array);\n return true;\n }\n /**\n * Set the value of an uniform to an array of unsigned int32 (stored as vec4)\n * @param uniform defines the webGL uniform location where to store the value\n * @param array defines the array of unsigned int32 to store\n * @returns true if the value was set\n */\n setUIntArray4(uniform, array) {\n if (!uniform || array.length % 4 !== 0) {\n return false;\n }\n this._gl.uniform4uiv(uniform, array);\n return true;\n }\n /**\n * Set the value of an uniform to an array of number\n * @param uniform defines the webGL uniform location where to store the value\n * @param array defines the array of number to store\n * @returns true if the value was set\n */\n setArray(uniform, array) {\n if (!uniform) {\n return false;\n }\n if (array.length < 1) {\n return false;\n }\n this._gl.uniform1fv(uniform, array);\n return true;\n }\n /**\n * Set the value of an uniform to an array of number (stored as vec2)\n * @param uniform defines the webGL uniform location where to store the value\n * @param array defines the array of number to store\n * @returns true if the value was set\n */\n setArray2(uniform, array) {\n if (!uniform || array.length % 2 !== 0) {\n return false;\n }\n this._gl.uniform2fv(uniform, array);\n return true;\n }\n /**\n * Set the value of an uniform to an array of number (stored as vec3)\n * @param uniform defines the webGL uniform location where to store the value\n * @param array defines the array of number to store\n * @returns true if the value was set\n */\n setArray3(uniform, array) {\n if (!uniform || array.length % 3 !== 0) {\n return false;\n }\n this._gl.uniform3fv(uniform, array);\n return true;\n }\n /**\n * Set the value of an uniform to an array of number (stored as vec4)\n * @param uniform defines the webGL uniform location where to store the value\n * @param array defines the array of number to store\n * @returns true if the value was set\n */\n setArray4(uniform, array) {\n if (!uniform || array.length % 4 !== 0) {\n return false;\n }\n this._gl.uniform4fv(uniform, array);\n return true;\n }\n /**\n * Set the value of an uniform to an array of float32 (stored as matrices)\n * @param uniform defines the webGL uniform location where to store the value\n * @param matrices defines the array of float32 to store\n * @returns true if the value was set\n */\n setMatrices(uniform, matrices) {\n if (!uniform) {\n return false;\n }\n this._gl.uniformMatrix4fv(uniform, false, matrices);\n return true;\n }\n /**\n * Set the value of an uniform to a matrix (3x3)\n * @param uniform defines the webGL uniform location where to store the value\n * @param matrix defines the Float32Array representing the 3x3 matrix to store\n * @returns true if the value was set\n */\n setMatrix3x3(uniform, matrix) {\n if (!uniform) {\n return false;\n }\n this._gl.uniformMatrix3fv(uniform, false, matrix);\n return true;\n }\n /**\n * Set the value of an uniform to a matrix (2x2)\n * @param uniform defines the webGL uniform location where to store the value\n * @param matrix defines the Float32Array representing the 2x2 matrix to store\n * @returns true if the value was set\n */\n setMatrix2x2(uniform, matrix) {\n if (!uniform) {\n return false;\n }\n this._gl.uniformMatrix2fv(uniform, false, matrix);\n return true;\n }\n /**\n * Set the value of an uniform to a number (float)\n * @param uniform defines the webGL uniform location where to store the value\n * @param value defines the float number to store\n * @returns true if the value was transferred\n */\n setFloat(uniform, value) {\n if (!uniform) {\n return false;\n }\n this._gl.uniform1f(uniform, value);\n return true;\n }\n /**\n * Set the value of an uniform to a vec2\n * @param uniform defines the webGL uniform location where to store the value\n * @param x defines the 1st component of the value\n * @param y defines the 2nd component of the value\n * @returns true if the value was set\n */\n setFloat2(uniform, x, y) {\n if (!uniform) {\n return false;\n }\n this._gl.uniform2f(uniform, x, y);\n return true;\n }\n /**\n * Set the value of an uniform to a vec3\n * @param uniform defines the webGL uniform location where to store the value\n * @param x defines the 1st component of the value\n * @param y defines the 2nd component of the value\n * @param z defines the 3rd component of the value\n * @returns true if the value was set\n */\n setFloat3(uniform, x, y, z) {\n if (!uniform) {\n return false;\n }\n this._gl.uniform3f(uniform, x, y, z);\n return true;\n }\n /**\n * Set the value of an uniform to a vec4\n * @param uniform defines the webGL uniform location where to store the value\n * @param x defines the 1st component of the value\n * @param y defines the 2nd component of the value\n * @param z defines the 3rd component of the value\n * @param w defines the 4th component of the value\n * @returns true if the value was set\n */\n setFloat4(uniform, x, y, z, w) {\n if (!uniform) {\n return false;\n }\n this._gl.uniform4f(uniform, x, y, z, w);\n return true;\n }\n // States\n /**\n * Apply all cached states (depth, culling, stencil and alpha)\n */\n applyStates() {\n this._depthCullingState.apply(this._gl);\n this._stencilStateComposer.apply(this._gl);\n this._alphaState.apply(this._gl);\n if (this._colorWriteChanged) {\n this._colorWriteChanged = false;\n const enable = this._colorWrite;\n this._gl.colorMask(enable, enable, enable, enable);\n }\n }\n /**\n * Enable or disable color writing\n * @param enable defines the state to set\n */\n setColorWrite(enable) {\n if (enable !== this._colorWrite) {\n this._colorWriteChanged = true;\n this._colorWrite = enable;\n }\n }\n /**\n * Gets a boolean indicating if color writing is enabled\n * @returns the current color writing state\n */\n getColorWrite() {\n return this._colorWrite;\n }\n /**\n * Gets the depth culling state manager\n */\n get depthCullingState() {\n return this._depthCullingState;\n }\n /**\n * Gets the alpha state manager\n */\n get alphaState() {\n return this._alphaState;\n }\n /**\n * Gets the stencil state manager\n */\n get stencilState() {\n return this._stencilState;\n }\n /**\n * Gets the stencil state composer\n */\n get stencilStateComposer() {\n return this._stencilStateComposer;\n }\n // Textures\n /**\n * Clears the list of texture accessible through engine.\n * This can help preventing texture load conflict due to name collision.\n */\n clearInternalTexturesCache() {\n this._internalTexturesCache.length = 0;\n }\n /**\n * Force the entire cache to be cleared\n * You should not have to use this function unless your engine needs to share the webGL context with another engine\n * @param bruteForce defines a boolean to force clearing ALL caches (including stencil, detoh and alpha states)\n */\n wipeCaches(bruteForce) {\n if (this.preventCacheWipeBetweenFrames && !bruteForce) {\n return;\n }\n this._currentEffect = null;\n this._viewportCached.x = 0;\n this._viewportCached.y = 0;\n this._viewportCached.z = 0;\n this._viewportCached.w = 0;\n // Done before in case we clean the attributes\n this._unbindVertexArrayObject();\n if (bruteForce) {\n this._currentProgram = null;\n this.resetTextureCache();\n this._stencilStateComposer.reset();\n this._depthCullingState.reset();\n this._depthCullingState.depthFunc = this._gl.LEQUAL;\n this._alphaState.reset();\n this._alphaMode = 1;\n this._alphaEquation = 0;\n this._colorWrite = true;\n this._colorWriteChanged = true;\n this._unpackFlipYCached = null;\n this._gl.pixelStorei(this._gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, this._gl.NONE);\n this._gl.pixelStorei(this._gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 0);\n this._mustWipeVertexAttributes = true;\n this.unbindAllAttributes();\n }\n this._resetVertexBufferBinding();\n this._cachedIndexBuffer = null;\n this._cachedEffectForVertexBuffers = null;\n this.bindIndexBuffer(null);\n }\n /**\n * @internal\n */\n _getSamplingParameters(samplingMode, generateMipMaps) {\n const gl = this._gl;\n let magFilter = gl.NEAREST;\n let minFilter = gl.NEAREST;\n switch (samplingMode) {\n case 11:\n magFilter = gl.LINEAR;\n if (generateMipMaps) {\n minFilter = gl.LINEAR_MIPMAP_NEAREST;\n }\n else {\n minFilter = gl.LINEAR;\n }\n break;\n case 3:\n magFilter = gl.LINEAR;\n if (generateMipMaps) {\n minFilter = gl.LINEAR_MIPMAP_LINEAR;\n }\n else {\n minFilter = gl.LINEAR;\n }\n break;\n case 8:\n magFilter = gl.NEAREST;\n if (generateMipMaps) {\n minFilter = gl.NEAREST_MIPMAP_LINEAR;\n }\n else {\n minFilter = gl.NEAREST;\n }\n break;\n case 4:\n magFilter = gl.NEAREST;\n if (generateMipMaps) {\n minFilter = gl.NEAREST_MIPMAP_NEAREST;\n }\n else {\n minFilter = gl.NEAREST;\n }\n break;\n case 5:\n magFilter = gl.NEAREST;\n if (generateMipMaps) {\n minFilter = gl.LINEAR_MIPMAP_NEAREST;\n }\n else {\n minFilter = gl.LINEAR;\n }\n break;\n case 6:\n magFilter = gl.NEAREST;\n if (generateMipMaps) {\n minFilter = gl.LINEAR_MIPMAP_LINEAR;\n }\n else {\n minFilter = gl.LINEAR;\n }\n break;\n case 7:\n magFilter = gl.NEAREST;\n minFilter = gl.LINEAR;\n break;\n case 1:\n magFilter = gl.NEAREST;\n minFilter = gl.NEAREST;\n break;\n case 9:\n magFilter = gl.LINEAR;\n if (generateMipMaps) {\n minFilter = gl.NEAREST_MIPMAP_NEAREST;\n }\n else {\n minFilter = gl.NEAREST;\n }\n break;\n case 10:\n magFilter = gl.LINEAR;\n if (generateMipMaps) {\n minFilter = gl.NEAREST_MIPMAP_LINEAR;\n }\n else {\n minFilter = gl.NEAREST;\n }\n break;\n case 2:\n magFilter = gl.LINEAR;\n minFilter = gl.LINEAR;\n break;\n case 12:\n magFilter = gl.LINEAR;\n minFilter = gl.NEAREST;\n break;\n }\n return {\n min: minFilter,\n mag: magFilter,\n };\n }\n /** @internal */\n _createTexture() {\n const texture = this._gl.createTexture();\n if (!texture) {\n throw new Error(\"Unable to create texture\");\n }\n return texture;\n }\n /** @internal */\n _createHardwareTexture() {\n return new WebGLHardwareTexture(this._createTexture(), this._gl);\n }\n /**\n * Creates an internal texture without binding it to a framebuffer\n * @internal\n * @param size defines the size of the texture\n * @param options defines the options used to create the texture\n * @param delayGPUTextureCreation true to delay the texture creation the first time it is really needed. false to create it right away\n * @param source source type of the texture\n * @returns a new internal texture\n */\n _createInternalTexture(size, options, delayGPUTextureCreation = true, source = InternalTextureSource.Unknown) {\n var _a;\n let generateMipMaps = false;\n let type = 0;\n let samplingMode = 3;\n let format = 5;\n let useSRGBBuffer = false;\n let samples = 1;\n let label;\n if (options !== undefined && typeof options === \"object\") {\n generateMipMaps = !!options.generateMipMaps;\n type = options.type === undefined ? 0 : options.type;\n samplingMode = options.samplingMode === undefined ? 3 : options.samplingMode;\n format = options.format === undefined ? 5 : options.format;\n useSRGBBuffer = options.useSRGBBuffer === undefined ? false : options.useSRGBBuffer;\n samples = (_a = options.samples) !== null && _a !== void 0 ? _a : 1;\n label = options.label;\n }\n else {\n generateMipMaps = !!options;\n }\n useSRGBBuffer && (useSRGBBuffer = this._caps.supportSRGBBuffers && (this.webGLVersion > 1 || this.isWebGPU));\n if (type === 1 && !this._caps.textureFloatLinearFiltering) {\n // if floating point linear (gl.FLOAT) then force to NEAREST_SAMPLINGMODE\n samplingMode = 1;\n }\n else if (type === 2 && !this._caps.textureHalfFloatLinearFiltering) {\n // if floating point linear (HALF_FLOAT) then force to NEAREST_SAMPLINGMODE\n samplingMode = 1;\n }\n if (type === 1 && !this._caps.textureFloat) {\n type = 0;\n Logger.Warn(\"Float textures are not supported. Type forced to TEXTURETYPE_UNSIGNED_BYTE\");\n }\n const gl = this._gl;\n const texture = new InternalTexture(this, source);\n const width = size.width || size;\n const height = size.height || size;\n const layers = size.layers || 0;\n const filters = this._getSamplingParameters(samplingMode, generateMipMaps);\n const target = layers !== 0 ? gl.TEXTURE_2D_ARRAY : gl.TEXTURE_2D;\n const sizedFormat = this._getRGBABufferInternalSizedFormat(type, format, useSRGBBuffer);\n const internalFormat = this._getInternalFormat(format);\n const textureType = this._getWebGLTextureType(type);\n // Bind\n this._bindTextureDirectly(target, texture);\n if (layers !== 0) {\n texture.is2DArray = true;\n gl.texImage3D(target, 0, sizedFormat, width, height, layers, 0, internalFormat, textureType, null);\n }\n else {\n gl.texImage2D(target, 0, sizedFormat, width, height, 0, internalFormat, textureType, null);\n }\n gl.texParameteri(target, gl.TEXTURE_MAG_FILTER, filters.mag);\n gl.texParameteri(target, gl.TEXTURE_MIN_FILTER, filters.min);\n gl.texParameteri(target, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(target, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n // MipMaps\n if (generateMipMaps) {\n this._gl.generateMipmap(target);\n }\n this._bindTextureDirectly(target, null);\n texture._useSRGBBuffer = useSRGBBuffer;\n texture.baseWidth = width;\n texture.baseHeight = height;\n texture.width = width;\n texture.height = height;\n texture.depth = layers;\n texture.isReady = true;\n texture.samples = samples;\n texture.generateMipMaps = generateMipMaps;\n texture.samplingMode = samplingMode;\n texture.type = type;\n texture.format = format;\n texture.label = label;\n this._internalTexturesCache.push(texture);\n return texture;\n }\n /**\n * @internal\n */\n _getUseSRGBBuffer(useSRGBBuffer, noMipmap) {\n // Generating mipmaps for sRGB textures is not supported in WebGL1 so we must disable the support if mipmaps is enabled\n return useSRGBBuffer && this._caps.supportSRGBBuffers && (this.webGLVersion > 1 || this.isWebGPU || noMipmap);\n }\n _createTextureBase(url, noMipmap, invertY, scene, samplingMode = 3, onLoad = null, onError = null, prepareTexture, prepareTextureProcessFunction, buffer = null, fallback = null, format = null, forcedExtension = null, mimeType, loaderOptions, useSRGBBuffer) {\n url = url || \"\";\n const fromData = url.substr(0, 5) === \"data:\";\n const fromBlob = url.substr(0, 5) === \"blob:\";\n const isBase64 = fromData && url.indexOf(\";base64,\") !== -1;\n const texture = fallback ? fallback : new InternalTexture(this, InternalTextureSource.Url);\n if (texture !== fallback) {\n texture.label = url.substring(0, 60); // default label, can be overriden by the caller\n }\n const originalUrl = url;\n if (this._transformTextureUrl && !isBase64 && !fallback && !buffer) {\n url = this._transformTextureUrl(url);\n }\n if (originalUrl !== url) {\n texture._originalUrl = originalUrl;\n }\n // establish the file extension, if possible\n const lastDot = url.lastIndexOf(\".\");\n let extension = forcedExtension ? forcedExtension : lastDot > -1 ? url.substring(lastDot).toLowerCase() : \"\";\n let loader = null;\n // Remove query string\n const queryStringIndex = extension.indexOf(\"?\");\n if (queryStringIndex > -1) {\n extension = extension.split(\"?\")[0];\n }\n for (const availableLoader of ThinEngine._TextureLoaders) {\n if (availableLoader.canLoad(extension, mimeType)) {\n loader = availableLoader;\n break;\n }\n }\n if (scene) {\n scene.addPendingData(texture);\n }\n texture.url = url;\n texture.generateMipMaps = !noMipmap;\n texture.samplingMode = samplingMode;\n texture.invertY = invertY;\n texture._useSRGBBuffer = this._getUseSRGBBuffer(!!useSRGBBuffer, noMipmap);\n if (!this._doNotHandleContextLost) {\n // Keep a link to the buffer only if we plan to handle context lost\n texture._buffer = buffer;\n }\n let onLoadObserver = null;\n if (onLoad && !fallback) {\n onLoadObserver = texture.onLoadedObservable.add(onLoad);\n }\n if (!fallback) {\n this._internalTexturesCache.push(texture);\n }\n const onInternalError = (message, exception) => {\n if (scene) {\n scene.removePendingData(texture);\n }\n if (url === originalUrl) {\n if (onLoadObserver) {\n texture.onLoadedObservable.remove(onLoadObserver);\n }\n if (EngineStore.UseFallbackTexture) {\n this._createTextureBase(EngineStore.FallbackTexture, noMipmap, texture.invertY, scene, samplingMode, null, onError, prepareTexture, prepareTextureProcessFunction, buffer, texture);\n }\n message = (message || \"Unknown error\") + (EngineStore.UseFallbackTexture ? \" - Fallback texture was used\" : \"\");\n texture.onErrorObservable.notifyObservers({ message, exception });\n if (onError) {\n onError(message, exception);\n }\n }\n else {\n // fall back to the original url if the transformed url fails to load\n Logger.Warn(`Failed to load ${url}, falling back to ${originalUrl}`);\n this._createTextureBase(originalUrl, noMipmap, texture.invertY, scene, samplingMode, onLoad, onError, prepareTexture, prepareTextureProcessFunction, buffer, texture, format, forcedExtension, mimeType, loaderOptions, useSRGBBuffer);\n }\n };\n // processing for non-image formats\n if (loader) {\n const callback = (data) => {\n loader.loadData(data, texture, (width, height, loadMipmap, isCompressed, done, loadFailed) => {\n if (loadFailed) {\n onInternalError(\"TextureLoader failed to load data\");\n }\n else {\n prepareTexture(texture, extension, scene, { width, height }, texture.invertY, !loadMipmap, isCompressed, () => {\n done();\n return false;\n }, samplingMode);\n }\n }, loaderOptions);\n };\n if (!buffer) {\n this._loadFile(url, (data) => callback(new Uint8Array(data)), undefined, scene ? scene.offlineProvider : undefined, true, (request, exception) => {\n onInternalError(\"Unable to load \" + (request ? request.responseURL : url, exception));\n });\n }\n else {\n if (buffer instanceof ArrayBuffer) {\n callback(new Uint8Array(buffer));\n }\n else if (ArrayBuffer.isView(buffer)) {\n callback(buffer);\n }\n else {\n if (onError) {\n onError(\"Unable to load: only ArrayBuffer or ArrayBufferView is supported\", null);\n }\n }\n }\n }\n else {\n const onload = (img) => {\n if (fromBlob && !this._doNotHandleContextLost) {\n // We need to store the image if we need to rebuild the texture\n // in case of a webgl context lost\n texture._buffer = img;\n }\n prepareTexture(texture, extension, scene, img, texture.invertY, noMipmap, false, prepareTextureProcessFunction, samplingMode);\n };\n // According to the WebGL spec section 6.10, ImageBitmaps must be inverted on creation.\n // So, we pass imageOrientation to _FileToolsLoadImage() as it may create an ImageBitmap.\n if (!fromData || isBase64) {\n if (buffer && (typeof buffer.decoding === \"string\" || buffer.close)) {\n onload(buffer);\n }\n else {\n ThinEngine._FileToolsLoadImage(url, onload, onInternalError, scene ? scene.offlineProvider : null, mimeType, texture.invertY && this._features.needsInvertingBitmap ? { imageOrientation: \"flipY\" } : undefined);\n }\n }\n else if (typeof buffer === \"string\" || buffer instanceof ArrayBuffer || ArrayBuffer.isView(buffer) || buffer instanceof Blob) {\n ThinEngine._FileToolsLoadImage(buffer, onload, onInternalError, scene ? scene.offlineProvider : null, mimeType, texture.invertY && this._features.needsInvertingBitmap ? { imageOrientation: \"flipY\" } : undefined);\n }\n else if (buffer) {\n onload(buffer);\n }\n }\n return texture;\n }\n /**\n * Usually called from Texture.ts.\n * Passed information to create a WebGLTexture\n * @param url defines a value which contains one of the following:\n * * A conventional http URL, e.g. 'http://...' or 'file://...'\n * * A base64 string of in-line texture data, e.g. 'data:image/jpg;base64,/...'\n * * An indicator that data being passed using the buffer parameter, e.g. 'data:mytexture.jpg'\n * @param noMipmap defines a boolean indicating that no mipmaps shall be generated. Ignored for compressed textures. They must be in the file\n * @param invertY when true, image is flipped when loaded. You probably want true. Certain compressed textures may invert this if their default is inverted (eg. ktx)\n * @param scene needed for loading to the correct scene\n * @param samplingMode mode with should be used sample / access the texture (Default: Texture.TRILINEAR_SAMPLINGMODE)\n * @param onLoad optional callback to be called upon successful completion\n * @param onError optional callback to be called upon failure\n * @param buffer a source of a file previously fetched as either a base64 string, an ArrayBuffer (compressed or image format), HTMLImageElement (image format), or a Blob\n * @param fallback an internal argument in case the function must be called again, due to etc1 not having alpha capabilities\n * @param format internal format. Default: RGB when extension is '.jpg' else RGBA. Ignored for compressed textures\n * @param forcedExtension defines the extension to use to pick the right loader\n * @param mimeType defines an optional mime type\n * @param loaderOptions options to be passed to the loader\n * @param creationFlags specific flags to use when creating the texture (1 for storage textures, for eg)\n * @param useSRGBBuffer defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU).\n * @returns a InternalTexture for assignment back into BABYLON.Texture\n */\n createTexture(url, noMipmap, invertY, scene, samplingMode = 3, onLoad = null, onError = null, buffer = null, fallback = null, format = null, forcedExtension = null, mimeType, loaderOptions, creationFlags, useSRGBBuffer) {\n return this._createTextureBase(url, noMipmap, invertY, scene, samplingMode, onLoad, onError, this._prepareWebGLTexture.bind(this), (potWidth, potHeight, img, extension, texture, continuationCallback) => {\n const gl = this._gl;\n const isPot = img.width === potWidth && img.height === potHeight;\n const internalFormat = format\n ? this._getInternalFormat(format, texture._useSRGBBuffer)\n : extension === \".jpg\" && !texture._useSRGBBuffer\n ? gl.RGB\n : texture._useSRGBBuffer\n ? this._glSRGBExtensionValues.SRGB8_ALPHA8\n : gl.RGBA;\n let texelFormat = format ? this._getInternalFormat(format) : extension === \".jpg\" && !texture._useSRGBBuffer ? gl.RGB : gl.RGBA;\n if (texture._useSRGBBuffer && this.webGLVersion === 1) {\n texelFormat = internalFormat;\n }\n if (isPot) {\n gl.texImage2D(gl.TEXTURE_2D, 0, internalFormat, texelFormat, gl.UNSIGNED_BYTE, img);\n return false;\n }\n const maxTextureSize = this._caps.maxTextureSize;\n if (img.width > maxTextureSize || img.height > maxTextureSize || !this._supportsHardwareTextureRescaling) {\n this._prepareWorkingCanvas();\n if (!this._workingCanvas || !this._workingContext) {\n return false;\n }\n this._workingCanvas.width = potWidth;\n this._workingCanvas.height = potHeight;\n this._workingContext.drawImage(img, 0, 0, img.width, img.height, 0, 0, potWidth, potHeight);\n gl.texImage2D(gl.TEXTURE_2D, 0, internalFormat, texelFormat, gl.UNSIGNED_BYTE, this._workingCanvas);\n texture.width = potWidth;\n texture.height = potHeight;\n return false;\n }\n else {\n // Using shaders when possible to rescale because canvas.drawImage is lossy\n const source = new InternalTexture(this, InternalTextureSource.Temp);\n this._bindTextureDirectly(gl.TEXTURE_2D, source, true);\n gl.texImage2D(gl.TEXTURE_2D, 0, internalFormat, texelFormat, gl.UNSIGNED_BYTE, img);\n this._rescaleTexture(source, texture, scene, internalFormat, () => {\n this._releaseTexture(source);\n this._bindTextureDirectly(gl.TEXTURE_2D, texture, true);\n continuationCallback();\n });\n }\n return true;\n }, buffer, fallback, format, forcedExtension, mimeType, loaderOptions, useSRGBBuffer);\n }\n /**\n * Loads an image as an HTMLImageElement.\n * @param input url string, ArrayBuffer, or Blob to load\n * @param onLoad callback called when the image successfully loads\n * @param onError callback called when the image fails to load\n * @param offlineProvider offline provider for caching\n * @param mimeType optional mime type\n * @param imageBitmapOptions optional the options to use when creating an ImageBitmap\n * @returns the HTMLImageElement of the loaded image\n * @internal\n */\n static _FileToolsLoadImage(input, onLoad, onError, offlineProvider, mimeType, imageBitmapOptions) {\n throw _WarnImport(\"FileTools\");\n }\n /**\n * @internal\n */\n _rescaleTexture(source, destination, scene, internalFormat, onComplete) { }\n /**\n * Creates a raw texture\n * @param data defines the data to store in the texture\n * @param width defines the width of the texture\n * @param height defines the height of the texture\n * @param format defines the format of the data\n * @param generateMipMaps defines if the engine should generate the mip levels\n * @param invertY defines if data must be stored with Y axis inverted\n * @param samplingMode defines the required sampling mode (Texture.NEAREST_SAMPLINGMODE by default)\n * @param compression defines the compression used (null by default)\n * @param type defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_INT by default)\n * @param creationFlags specific flags to use when creating the texture (1 for storage textures, for eg)\n * @param useSRGBBuffer defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU).\n * @returns the raw texture inside an InternalTexture\n */\n createRawTexture(data, width, height, format, generateMipMaps, invertY, samplingMode, compression = null, type = 0, creationFlags = 0, useSRGBBuffer = false) {\n throw _WarnImport(\"Engine.RawTexture\");\n }\n /**\n * Creates a new raw cube texture\n * @param data defines the array of data to use to create each face\n * @param size defines the size of the textures\n * @param format defines the format of the data\n * @param type defines the type of the data (like Engine.TEXTURETYPE_UNSIGNED_INT)\n * @param generateMipMaps defines if the engine should generate the mip levels\n * @param invertY defines if data must be stored with Y axis inverted\n * @param samplingMode defines the required sampling mode (like Texture.NEAREST_SAMPLINGMODE)\n * @param compression defines the compression used (null by default)\n * @returns the cube texture as an InternalTexture\n */\n createRawCubeTexture(data, size, format, type, generateMipMaps, invertY, samplingMode, compression = null) {\n throw _WarnImport(\"Engine.RawTexture\");\n }\n /**\n * Creates a new raw 3D texture\n * @param data defines the data used to create the texture\n * @param width defines the width of the texture\n * @param height defines the height of the texture\n * @param depth defines the depth of the texture\n * @param format defines the format of the texture\n * @param generateMipMaps defines if the engine must generate mip levels\n * @param invertY defines if data must be stored with Y axis inverted\n * @param samplingMode defines the required sampling mode (like Texture.NEAREST_SAMPLINGMODE)\n * @param compression defines the compressed used (can be null)\n * @param textureType defines the compressed used (can be null)\n * @returns a new raw 3D texture (stored in an InternalTexture)\n */\n createRawTexture3D(data, width, height, depth, format, generateMipMaps, invertY, samplingMode, compression = null, textureType = 0) {\n throw _WarnImport(\"Engine.RawTexture\");\n }\n /**\n * Creates a new raw 2D array texture\n * @param data defines the data used to create the texture\n * @param width defines the width of the texture\n * @param height defines the height of the texture\n * @param depth defines the number of layers of the texture\n * @param format defines the format of the texture\n * @param generateMipMaps defines if the engine must generate mip levels\n * @param invertY defines if data must be stored with Y axis inverted\n * @param samplingMode defines the required sampling mode (like Texture.NEAREST_SAMPLINGMODE)\n * @param compression defines the compressed used (can be null)\n * @param textureType defines the compressed used (can be null)\n * @returns a new raw 2D array texture (stored in an InternalTexture)\n */\n createRawTexture2DArray(data, width, height, depth, format, generateMipMaps, invertY, samplingMode, compression = null, textureType = 0) {\n throw _WarnImport(\"Engine.RawTexture\");\n }\n /**\n * @internal\n */\n _unpackFlipY(value) {\n if (this._unpackFlipYCached !== value) {\n this._gl.pixelStorei(this._gl.UNPACK_FLIP_Y_WEBGL, value ? 1 : 0);\n if (this.enableUnpackFlipYCached) {\n this._unpackFlipYCached = value;\n }\n }\n }\n /** @internal */\n _getUnpackAlignement() {\n return this._gl.getParameter(this._gl.UNPACK_ALIGNMENT);\n }\n _getTextureTarget(texture) {\n if (texture.isCube) {\n return this._gl.TEXTURE_CUBE_MAP;\n }\n else if (texture.is3D) {\n return this._gl.TEXTURE_3D;\n }\n else if (texture.is2DArray || texture.isMultiview) {\n return this._gl.TEXTURE_2D_ARRAY;\n }\n return this._gl.TEXTURE_2D;\n }\n /**\n * Update the sampling mode of a given texture\n * @param samplingMode defines the required sampling mode\n * @param texture defines the texture to update\n * @param generateMipMaps defines whether to generate mipmaps for the texture\n */\n updateTextureSamplingMode(samplingMode, texture, generateMipMaps = false) {\n const target = this._getTextureTarget(texture);\n const filters = this._getSamplingParameters(samplingMode, texture.useMipMaps || generateMipMaps);\n this._setTextureParameterInteger(target, this._gl.TEXTURE_MAG_FILTER, filters.mag, texture);\n this._setTextureParameterInteger(target, this._gl.TEXTURE_MIN_FILTER, filters.min);\n if (generateMipMaps) {\n texture.generateMipMaps = true;\n this._gl.generateMipmap(target);\n }\n this._bindTextureDirectly(target, null);\n texture.samplingMode = samplingMode;\n }\n /**\n * Update the dimensions of a texture\n * @param texture texture to update\n * @param width new width of the texture\n * @param height new height of the texture\n * @param depth new depth of the texture\n */\n updateTextureDimensions(texture, width, height, depth = 1) { }\n /**\n * Update the sampling mode of a given texture\n * @param texture defines the texture to update\n * @param wrapU defines the texture wrap mode of the u coordinates\n * @param wrapV defines the texture wrap mode of the v coordinates\n * @param wrapR defines the texture wrap mode of the r coordinates\n */\n updateTextureWrappingMode(texture, wrapU, wrapV = null, wrapR = null) {\n const target = this._getTextureTarget(texture);\n if (wrapU !== null) {\n this._setTextureParameterInteger(target, this._gl.TEXTURE_WRAP_S, this._getTextureWrapMode(wrapU), texture);\n texture._cachedWrapU = wrapU;\n }\n if (wrapV !== null) {\n this._setTextureParameterInteger(target, this._gl.TEXTURE_WRAP_T, this._getTextureWrapMode(wrapV), texture);\n texture._cachedWrapV = wrapV;\n }\n if ((texture.is2DArray || texture.is3D) && wrapR !== null) {\n this._setTextureParameterInteger(target, this._gl.TEXTURE_WRAP_R, this._getTextureWrapMode(wrapR), texture);\n texture._cachedWrapR = wrapR;\n }\n this._bindTextureDirectly(target, null);\n }\n /**\n * @internal\n */\n _setupDepthStencilTexture(internalTexture, size, generateStencil, bilinearFiltering, comparisonFunction, samples = 1) {\n const width = size.width || size;\n const height = size.height || size;\n const layers = size.layers || 0;\n internalTexture.baseWidth = width;\n internalTexture.baseHeight = height;\n internalTexture.width = width;\n internalTexture.height = height;\n internalTexture.is2DArray = layers > 0;\n internalTexture.depth = layers;\n internalTexture.isReady = true;\n internalTexture.samples = samples;\n internalTexture.generateMipMaps = false;\n internalTexture.samplingMode = bilinearFiltering ? 2 : 1;\n internalTexture.type = 0;\n internalTexture._comparisonFunction = comparisonFunction;\n const gl = this._gl;\n const target = this._getTextureTarget(internalTexture);\n const samplingParameters = this._getSamplingParameters(internalTexture.samplingMode, false);\n gl.texParameteri(target, gl.TEXTURE_MAG_FILTER, samplingParameters.mag);\n gl.texParameteri(target, gl.TEXTURE_MIN_FILTER, samplingParameters.min);\n gl.texParameteri(target, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(target, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n // TEXTURE_COMPARE_FUNC/MODE are only availble in WebGL2.\n if (this.webGLVersion > 1) {\n if (comparisonFunction === 0) {\n gl.texParameteri(target, gl.TEXTURE_COMPARE_FUNC, 515);\n gl.texParameteri(target, gl.TEXTURE_COMPARE_MODE, gl.NONE);\n }\n else {\n gl.texParameteri(target, gl.TEXTURE_COMPARE_FUNC, comparisonFunction);\n gl.texParameteri(target, gl.TEXTURE_COMPARE_MODE, gl.COMPARE_REF_TO_TEXTURE);\n }\n }\n }\n /**\n * @internal\n */\n _uploadCompressedDataToTextureDirectly(texture, internalFormat, width, height, data, faceIndex = 0, lod = 0) {\n const gl = this._gl;\n let target = gl.TEXTURE_2D;\n if (texture.isCube) {\n target = gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex;\n }\n if (texture._useSRGBBuffer) {\n switch (internalFormat) {\n case 37492:\n case 36196:\n // Note, if using ETC1 and sRGB is requested, this will use ETC2 if available.\n if (this._caps.etc2) {\n internalFormat = gl.COMPRESSED_SRGB8_ETC2;\n }\n else {\n texture._useSRGBBuffer = false;\n }\n break;\n case 37496:\n if (this._caps.etc2) {\n internalFormat = gl.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC;\n }\n else {\n texture._useSRGBBuffer = false;\n }\n break;\n case 36492:\n internalFormat = gl.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT;\n break;\n case 37808:\n internalFormat = gl.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR;\n break;\n case 33776:\n if (this._caps.s3tc_srgb) {\n internalFormat = gl.COMPRESSED_SRGB_S3TC_DXT1_EXT;\n }\n else {\n // S3TC sRGB extension not supported\n texture._useSRGBBuffer = false;\n }\n break;\n case 33777:\n if (this._caps.s3tc_srgb) {\n internalFormat = gl.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;\n }\n else {\n // S3TC sRGB extension not supported\n texture._useSRGBBuffer = false;\n }\n break;\n case 33779:\n if (this._caps.s3tc_srgb) {\n internalFormat = gl.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT;\n }\n else {\n // S3TC sRGB extension not supported\n texture._useSRGBBuffer = false;\n }\n break;\n default:\n // We don't support a sRGB format corresponding to internalFormat, so revert to non sRGB format\n texture._useSRGBBuffer = false;\n break;\n }\n }\n this._gl.compressedTexImage2D(target, lod, internalFormat, width, height, 0, data);\n }\n /**\n * @internal\n */\n _uploadDataToTextureDirectly(texture, imageData, faceIndex = 0, lod = 0, babylonInternalFormat, useTextureWidthAndHeight = false) {\n const gl = this._gl;\n const textureType = this._getWebGLTextureType(texture.type);\n const format = this._getInternalFormat(texture.format);\n const internalFormat = babylonInternalFormat === undefined\n ? this._getRGBABufferInternalSizedFormat(texture.type, texture.format, texture._useSRGBBuffer)\n : this._getInternalFormat(babylonInternalFormat, texture._useSRGBBuffer);\n this._unpackFlipY(texture.invertY);\n let target = gl.TEXTURE_2D;\n if (texture.isCube) {\n target = gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex;\n }\n const lodMaxWidth = Math.round(Math.log(texture.width) * Math.LOG2E);\n const lodMaxHeight = Math.round(Math.log(texture.height) * Math.LOG2E);\n const width = useTextureWidthAndHeight ? texture.width : Math.pow(2, Math.max(lodMaxWidth - lod, 0));\n const height = useTextureWidthAndHeight ? texture.height : Math.pow(2, Math.max(lodMaxHeight - lod, 0));\n gl.texImage2D(target, lod, internalFormat, width, height, 0, format, textureType, imageData);\n }\n /**\n * Update a portion of an internal texture\n * @param texture defines the texture to update\n * @param imageData defines the data to store into the texture\n * @param xOffset defines the x coordinates of the update rectangle\n * @param yOffset defines the y coordinates of the update rectangle\n * @param width defines the width of the update rectangle\n * @param height defines the height of the update rectangle\n * @param faceIndex defines the face index if texture is a cube (0 by default)\n * @param lod defines the lod level to update (0 by default)\n * @param generateMipMaps defines whether to generate mipmaps or not\n */\n updateTextureData(texture, imageData, xOffset, yOffset, width, height, faceIndex = 0, lod = 0, generateMipMaps = false) {\n const gl = this._gl;\n const textureType = this._getWebGLTextureType(texture.type);\n const format = this._getInternalFormat(texture.format);\n this._unpackFlipY(texture.invertY);\n let targetForBinding = gl.TEXTURE_2D;\n let target = gl.TEXTURE_2D;\n if (texture.isCube) {\n target = gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex;\n targetForBinding = gl.TEXTURE_CUBE_MAP;\n }\n this._bindTextureDirectly(targetForBinding, texture, true);\n gl.texSubImage2D(target, lod, xOffset, yOffset, width, height, format, textureType, imageData);\n if (generateMipMaps) {\n this._gl.generateMipmap(target);\n }\n this._bindTextureDirectly(targetForBinding, null);\n }\n /**\n * @internal\n */\n _uploadArrayBufferViewToTexture(texture, imageData, faceIndex = 0, lod = 0) {\n const gl = this._gl;\n const bindTarget = texture.isCube ? gl.TEXTURE_CUBE_MAP : gl.TEXTURE_2D;\n this._bindTextureDirectly(bindTarget, texture, true);\n this._uploadDataToTextureDirectly(texture, imageData, faceIndex, lod);\n this._bindTextureDirectly(bindTarget, null, true);\n }\n _prepareWebGLTextureContinuation(texture, scene, noMipmap, isCompressed, samplingMode) {\n const gl = this._gl;\n if (!gl) {\n return;\n }\n const filters = this._getSamplingParameters(samplingMode, !noMipmap);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, filters.mag);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, filters.min);\n if (!noMipmap && !isCompressed) {\n gl.generateMipmap(gl.TEXTURE_2D);\n }\n this._bindTextureDirectly(gl.TEXTURE_2D, null);\n // this.resetTextureCache();\n if (scene) {\n scene.removePendingData(texture);\n }\n texture.onLoadedObservable.notifyObservers(texture);\n texture.onLoadedObservable.clear();\n }\n _prepareWebGLTexture(texture, extension, scene, img, invertY, noMipmap, isCompressed, processFunction, samplingMode = 3) {\n const maxTextureSize = this.getCaps().maxTextureSize;\n const potWidth = Math.min(maxTextureSize, this.needPOTTextures ? ThinEngine.GetExponentOfTwo(img.width, maxTextureSize) : img.width);\n const potHeight = Math.min(maxTextureSize, this.needPOTTextures ? ThinEngine.GetExponentOfTwo(img.height, maxTextureSize) : img.height);\n const gl = this._gl;\n if (!gl) {\n return;\n }\n if (!texture._hardwareTexture) {\n // this.resetTextureCache();\n if (scene) {\n scene.removePendingData(texture);\n }\n return;\n }\n this._bindTextureDirectly(gl.TEXTURE_2D, texture, true);\n this._unpackFlipY(invertY === undefined ? true : invertY ? true : false);\n texture.baseWidth = img.width;\n texture.baseHeight = img.height;\n texture.width = potWidth;\n texture.height = potHeight;\n texture.isReady = true;\n if (processFunction(potWidth, potHeight, img, extension, texture, () => {\n this._prepareWebGLTextureContinuation(texture, scene, noMipmap, isCompressed, samplingMode);\n })) {\n // Returning as texture needs extra async steps\n return;\n }\n this._prepareWebGLTextureContinuation(texture, scene, noMipmap, isCompressed, samplingMode);\n }\n /**\n * @internal\n */\n _setupFramebufferDepthAttachments(generateStencilBuffer, generateDepthBuffer, width, height, samples = 1) {\n const gl = this._gl;\n // Create the depth/stencil buffer\n if (generateStencilBuffer && generateDepthBuffer) {\n return this._createRenderBuffer(width, height, samples, gl.DEPTH_STENCIL, gl.DEPTH24_STENCIL8, gl.DEPTH_STENCIL_ATTACHMENT);\n }\n if (generateDepthBuffer) {\n let depthFormat = gl.DEPTH_COMPONENT16;\n if (this._webGLVersion > 1) {\n depthFormat = gl.DEPTH_COMPONENT32F;\n }\n return this._createRenderBuffer(width, height, samples, depthFormat, depthFormat, gl.DEPTH_ATTACHMENT);\n }\n if (generateStencilBuffer) {\n return this._createRenderBuffer(width, height, samples, gl.STENCIL_INDEX8, gl.STENCIL_INDEX8, gl.STENCIL_ATTACHMENT);\n }\n return null;\n }\n /**\n * @internal\n */\n _createRenderBuffer(width, height, samples, internalFormat, msInternalFormat, attachment, unbindBuffer = true) {\n const gl = this._gl;\n const renderBuffer = gl.createRenderbuffer();\n return this._updateRenderBuffer(renderBuffer, width, height, samples, internalFormat, msInternalFormat, attachment, unbindBuffer);\n }\n _updateRenderBuffer(renderBuffer, width, height, samples, internalFormat, msInternalFormat, attachment, unbindBuffer = true) {\n const gl = this._gl;\n gl.bindRenderbuffer(gl.RENDERBUFFER, renderBuffer);\n if (samples > 1 && gl.renderbufferStorageMultisample) {\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, samples, msInternalFormat, width, height);\n }\n else {\n gl.renderbufferStorage(gl.RENDERBUFFER, internalFormat, width, height);\n }\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, attachment, gl.RENDERBUFFER, renderBuffer);\n if (unbindBuffer) {\n gl.bindRenderbuffer(gl.RENDERBUFFER, null);\n }\n return renderBuffer;\n }\n /**\n * @internal\n */\n _releaseTexture(texture) {\n var _a;\n this._deleteTexture((_a = texture._hardwareTexture) === null || _a === void 0 ? void 0 : _a.underlyingResource);\n // Unbind channels\n this.unbindAllTextures();\n const index = this._internalTexturesCache.indexOf(texture);\n if (index !== -1) {\n this._internalTexturesCache.splice(index, 1);\n }\n // Integrated fixed lod samplers.\n if (texture._lodTextureHigh) {\n texture._lodTextureHigh.dispose();\n }\n if (texture._lodTextureMid) {\n texture._lodTextureMid.dispose();\n }\n if (texture._lodTextureLow) {\n texture._lodTextureLow.dispose();\n }\n // Integrated irradiance map.\n if (texture._irradianceTexture) {\n texture._irradianceTexture.dispose();\n }\n }\n /**\n * @internal\n */\n _releaseRenderTargetWrapper(rtWrapper) {\n const index = this._renderTargetWrapperCache.indexOf(rtWrapper);\n if (index !== -1) {\n this._renderTargetWrapperCache.splice(index, 1);\n }\n }\n _deleteTexture(texture) {\n if (texture) {\n this._gl.deleteTexture(texture);\n }\n }\n _setProgram(program) {\n if (this._currentProgram !== program) {\n this._gl.useProgram(program);\n this._currentProgram = program;\n }\n }\n /**\n * Binds an effect to the webGL context\n * @param effect defines the effect to bind\n */\n bindSamplers(effect) {\n const webGLPipelineContext = effect.getPipelineContext();\n this._setProgram(webGLPipelineContext.program);\n const samplers = effect.getSamplers();\n for (let index = 0; index < samplers.length; index++) {\n const uniform = effect.getUniform(samplers[index]);\n if (uniform) {\n this._boundUniforms[index] = uniform;\n }\n }\n this._currentEffect = null;\n }\n _activateCurrentTexture() {\n if (this._currentTextureChannel !== this._activeChannel) {\n this._gl.activeTexture(this._gl.TEXTURE0 + this._activeChannel);\n this._currentTextureChannel = this._activeChannel;\n }\n }\n /**\n * @internal\n */\n _bindTextureDirectly(target, texture, forTextureDataUpdate = false, force = false) {\n var _a, _b;\n let wasPreviouslyBound = false;\n const isTextureForRendering = texture && texture._associatedChannel > -1;\n if (forTextureDataUpdate && isTextureForRendering) {\n this._activeChannel = texture._associatedChannel;\n }\n const currentTextureBound = this._boundTexturesCache[this._activeChannel];\n if (currentTextureBound !== texture || force) {\n this._activateCurrentTexture();\n if (texture && texture.isMultiview) {\n //this._gl.bindTexture(target, texture ? texture._colorTextureArray : null);\n console.error(target, texture);\n throw \"_bindTextureDirectly called with a multiview texture!\";\n }\n else {\n this._gl.bindTexture(target, (_b = (_a = texture === null || texture === void 0 ? void 0 : texture._hardwareTexture) === null || _a === void 0 ? void 0 : _a.underlyingResource) !== null && _b !== void 0 ? _b : null);\n }\n this._boundTexturesCache[this._activeChannel] = texture;\n if (texture) {\n texture._associatedChannel = this._activeChannel;\n }\n }\n else if (forTextureDataUpdate) {\n wasPreviouslyBound = true;\n this._activateCurrentTexture();\n }\n if (isTextureForRendering && !forTextureDataUpdate) {\n this._bindSamplerUniformToChannel(texture._associatedChannel, this._activeChannel);\n }\n return wasPreviouslyBound;\n }\n /**\n * @internal\n */\n _bindTexture(channel, texture, name) {\n if (channel === undefined) {\n return;\n }\n if (texture) {\n texture._associatedChannel = channel;\n }\n this._activeChannel = channel;\n const target = texture ? this._getTextureTarget(texture) : this._gl.TEXTURE_2D;\n this._bindTextureDirectly(target, texture);\n }\n /**\n * Unbind all textures from the webGL context\n */\n unbindAllTextures() {\n for (let channel = 0; channel < this._maxSimultaneousTextures; channel++) {\n this._activeChannel = channel;\n this._bindTextureDirectly(this._gl.TEXTURE_2D, null);\n this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null);\n if (this.webGLVersion > 1) {\n this._bindTextureDirectly(this._gl.TEXTURE_3D, null);\n this._bindTextureDirectly(this._gl.TEXTURE_2D_ARRAY, null);\n }\n }\n }\n /**\n * Sets a texture to the according uniform.\n * @param channel The texture channel\n * @param uniform The uniform to set\n * @param texture The texture to apply\n * @param name The name of the uniform in the effect\n */\n setTexture(channel, uniform, texture, name) {\n if (channel === undefined) {\n return;\n }\n if (uniform) {\n this._boundUniforms[channel] = uniform;\n }\n this._setTexture(channel, texture);\n }\n _bindSamplerUniformToChannel(sourceSlot, destination) {\n const uniform = this._boundUniforms[sourceSlot];\n if (!uniform || uniform._currentState === destination) {\n return;\n }\n this._gl.uniform1i(uniform, destination);\n uniform._currentState = destination;\n }\n _getTextureWrapMode(mode) {\n switch (mode) {\n case 1:\n return this._gl.REPEAT;\n case 0:\n return this._gl.CLAMP_TO_EDGE;\n case 2:\n return this._gl.MIRRORED_REPEAT;\n }\n return this._gl.REPEAT;\n }\n _setTexture(channel, texture, isPartOfTextureArray = false, depthStencilTexture = false, name = \"\") {\n // Not ready?\n if (!texture) {\n if (this._boundTexturesCache[channel] != null) {\n this._activeChannel = channel;\n this._bindTextureDirectly(this._gl.TEXTURE_2D, null);\n this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null);\n if (this.webGLVersion > 1) {\n this._bindTextureDirectly(this._gl.TEXTURE_3D, null);\n this._bindTextureDirectly(this._gl.TEXTURE_2D_ARRAY, null);\n }\n }\n return false;\n }\n // Video\n if (texture.video) {\n this._activeChannel = channel;\n const videoInternalTexture = texture.getInternalTexture();\n if (videoInternalTexture) {\n videoInternalTexture._associatedChannel = channel;\n }\n texture.update();\n }\n else if (texture.delayLoadState === 4) {\n // Delay loading\n texture.delayLoad();\n return false;\n }\n let internalTexture;\n if (depthStencilTexture) {\n internalTexture = texture.depthStencilTexture;\n }\n else if (texture.isReady()) {\n internalTexture = texture.getInternalTexture();\n }\n else if (texture.isCube) {\n internalTexture = this.emptyCubeTexture;\n }\n else if (texture.is3D) {\n internalTexture = this.emptyTexture3D;\n }\n else if (texture.is2DArray) {\n internalTexture = this.emptyTexture2DArray;\n }\n else {\n internalTexture = this.emptyTexture;\n }\n if (!isPartOfTextureArray && internalTexture) {\n internalTexture._associatedChannel = channel;\n }\n let needToBind = true;\n if (this._boundTexturesCache[channel] === internalTexture) {\n if (!isPartOfTextureArray) {\n this._bindSamplerUniformToChannel(internalTexture._associatedChannel, channel);\n }\n needToBind = false;\n }\n this._activeChannel = channel;\n const target = this._getTextureTarget(internalTexture);\n if (needToBind) {\n this._bindTextureDirectly(target, internalTexture, isPartOfTextureArray);\n }\n if (internalTexture && !internalTexture.isMultiview) {\n // CUBIC_MODE and SKYBOX_MODE both require CLAMP_TO_EDGE. All other modes use REPEAT.\n if (internalTexture.isCube && internalTexture._cachedCoordinatesMode !== texture.coordinatesMode) {\n internalTexture._cachedCoordinatesMode = texture.coordinatesMode;\n const textureWrapMode = texture.coordinatesMode !== 3 && texture.coordinatesMode !== 5\n ? 1\n : 0;\n texture.wrapU = textureWrapMode;\n texture.wrapV = textureWrapMode;\n }\n if (internalTexture._cachedWrapU !== texture.wrapU) {\n internalTexture._cachedWrapU = texture.wrapU;\n this._setTextureParameterInteger(target, this._gl.TEXTURE_WRAP_S, this._getTextureWrapMode(texture.wrapU), internalTexture);\n }\n if (internalTexture._cachedWrapV !== texture.wrapV) {\n internalTexture._cachedWrapV = texture.wrapV;\n this._setTextureParameterInteger(target, this._gl.TEXTURE_WRAP_T, this._getTextureWrapMode(texture.wrapV), internalTexture);\n }\n if (internalTexture.is3D && internalTexture._cachedWrapR !== texture.wrapR) {\n internalTexture._cachedWrapR = texture.wrapR;\n this._setTextureParameterInteger(target, this._gl.TEXTURE_WRAP_R, this._getTextureWrapMode(texture.wrapR), internalTexture);\n }\n this._setAnisotropicLevel(target, internalTexture, texture.anisotropicFilteringLevel);\n }\n return true;\n }\n /**\n * Sets an array of texture to the webGL context\n * @param channel defines the channel where the texture array must be set\n * @param uniform defines the associated uniform location\n * @param textures defines the array of textures to bind\n * @param name name of the channel\n */\n setTextureArray(channel, uniform, textures, name) {\n if (channel === undefined || !uniform) {\n return;\n }\n if (!this._textureUnits || this._textureUnits.length !== textures.length) {\n this._textureUnits = new Int32Array(textures.length);\n }\n for (let i = 0; i < textures.length; i++) {\n const texture = textures[i].getInternalTexture();\n if (texture) {\n this._textureUnits[i] = channel + i;\n texture._associatedChannel = channel + i;\n }\n else {\n this._textureUnits[i] = -1;\n }\n }\n this._gl.uniform1iv(uniform, this._textureUnits);\n for (let index = 0; index < textures.length; index++) {\n this._setTexture(this._textureUnits[index], textures[index], true);\n }\n }\n /**\n * @internal\n */\n _setAnisotropicLevel(target, internalTexture, anisotropicFilteringLevel) {\n const anisotropicFilterExtension = this._caps.textureAnisotropicFilterExtension;\n if (internalTexture.samplingMode !== 11 &&\n internalTexture.samplingMode !== 3 &&\n internalTexture.samplingMode !== 2) {\n anisotropicFilteringLevel = 1; // Forcing the anisotropic to 1 because else webgl will force filters to linear\n }\n if (anisotropicFilterExtension && internalTexture._cachedAnisotropicFilteringLevel !== anisotropicFilteringLevel) {\n this._setTextureParameterFloat(target, anisotropicFilterExtension.TEXTURE_MAX_ANISOTROPY_EXT, Math.min(anisotropicFilteringLevel, this._caps.maxAnisotropy), internalTexture);\n internalTexture._cachedAnisotropicFilteringLevel = anisotropicFilteringLevel;\n }\n }\n _setTextureParameterFloat(target, parameter, value, texture) {\n this._bindTextureDirectly(target, texture, true, true);\n this._gl.texParameterf(target, parameter, value);\n }\n _setTextureParameterInteger(target, parameter, value, texture) {\n if (texture) {\n this._bindTextureDirectly(target, texture, true, true);\n }\n this._gl.texParameteri(target, parameter, value);\n }\n /**\n * Unbind all vertex attributes from the webGL context\n */\n unbindAllAttributes() {\n if (this._mustWipeVertexAttributes) {\n this._mustWipeVertexAttributes = false;\n for (let i = 0; i < this._caps.maxVertexAttribs; i++) {\n this.disableAttributeByIndex(i);\n }\n return;\n }\n for (let i = 0, ul = this._vertexAttribArraysEnabled.length; i < ul; i++) {\n if (i >= this._caps.maxVertexAttribs || !this._vertexAttribArraysEnabled[i]) {\n continue;\n }\n this.disableAttributeByIndex(i);\n }\n }\n /**\n * Force the engine to release all cached effects. This means that next effect compilation will have to be done completely even if a similar effect was already compiled\n */\n releaseEffects() {\n for (const name in this._compiledEffects) {\n const webGLPipelineContext = this._compiledEffects[name].getPipelineContext();\n this._deletePipelineContext(webGLPipelineContext);\n }\n this._compiledEffects = {};\n }\n /**\n * Dispose and release all associated resources\n */\n dispose() {\n var _a;\n this._isDisposed = true;\n this.stopRenderLoop();\n // Clear observables\n if (this.onBeforeTextureInitObservable) {\n this.onBeforeTextureInitObservable.clear();\n }\n // Empty texture\n if (this._emptyTexture) {\n this._releaseTexture(this._emptyTexture);\n this._emptyTexture = null;\n }\n if (this._emptyCubeTexture) {\n this._releaseTexture(this._emptyCubeTexture);\n this._emptyCubeTexture = null;\n }\n if (this._dummyFramebuffer) {\n this._gl.deleteFramebuffer(this._dummyFramebuffer);\n }\n // Release effects\n this.releaseEffects();\n (_a = this.releaseComputeEffects) === null || _a === void 0 ? void 0 : _a.call(this);\n // Unbind\n this.unbindAllAttributes();\n this._boundUniforms = {};\n // Events\n if (IsWindowObjectExist()) {\n if (this._renderingCanvas) {\n if (!this._doNotHandleContextLost) {\n this._renderingCanvas.removeEventListener(\"webglcontextlost\", this._onContextLost);\n this._renderingCanvas.removeEventListener(\"webglcontextrestored\", this._onContextRestored);\n }\n window.removeEventListener(\"resize\", this._checkForMobile);\n }\n }\n this._workingCanvas = null;\n this._workingContext = null;\n this._currentBufferPointers.length = 0;\n this._renderingCanvas = null;\n this._currentProgram = null;\n this._boundRenderFunction = null;\n Effect.ResetCache();\n // Abort active requests\n for (const request of this._activeRequests) {\n request.abort();\n }\n this.onDisposeObservable.notifyObservers(this);\n this.onDisposeObservable.clear();\n }\n /**\n * Attach a new callback raised when context lost event is fired\n * @param callback defines the callback to call\n */\n attachContextLostEvent(callback) {\n if (this._renderingCanvas) {\n this._renderingCanvas.addEventListener(\"webglcontextlost\", callback, false);\n }\n }\n /**\n * Attach a new callback raised when context restored event is fired\n * @param callback defines the callback to call\n */\n attachContextRestoredEvent(callback) {\n if (this._renderingCanvas) {\n this._renderingCanvas.addEventListener(\"webglcontextrestored\", callback, false);\n }\n }\n /**\n * Get the current error code of the webGL context\n * @returns the error code\n * @see https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/getError\n */\n getError() {\n return this._gl.getError();\n }\n _canRenderToFloatFramebuffer() {\n if (this._webGLVersion > 1) {\n return this._caps.colorBufferFloat;\n }\n return this._canRenderToFramebuffer(1);\n }\n _canRenderToHalfFloatFramebuffer() {\n if (this._webGLVersion > 1) {\n return this._caps.colorBufferFloat;\n }\n return this._canRenderToFramebuffer(2);\n }\n // Thank you : http://stackoverflow.com/questions/28827511/webgl-ios-render-to-floating-point-texture\n _canRenderToFramebuffer(type) {\n const gl = this._gl;\n //clear existing errors\n // eslint-disable-next-line no-empty\n while (gl.getError() !== gl.NO_ERROR) { }\n let successful = true;\n const texture = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, texture);\n gl.texImage2D(gl.TEXTURE_2D, 0, this._getRGBABufferInternalSizedFormat(type), 1, 1, 0, gl.RGBA, this._getWebGLTextureType(type), null);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);\n const fb = gl.createFramebuffer();\n gl.bindFramebuffer(gl.FRAMEBUFFER, fb);\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0);\n const status = gl.checkFramebufferStatus(gl.FRAMEBUFFER);\n successful = successful && status === gl.FRAMEBUFFER_COMPLETE;\n successful = successful && gl.getError() === gl.NO_ERROR;\n //try render by clearing frame buffer's color buffer\n if (successful) {\n gl.clear(gl.COLOR_BUFFER_BIT);\n successful = successful && gl.getError() === gl.NO_ERROR;\n }\n //try reading from frame to ensure render occurs (just creating the FBO is not sufficient to determine if rendering is supported)\n if (successful) {\n //in practice it's sufficient to just read from the backbuffer rather than handle potentially issues reading from the texture\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n const readFormat = gl.RGBA;\n const readType = gl.UNSIGNED_BYTE;\n const buffer = new Uint8Array(4);\n gl.readPixels(0, 0, 1, 1, readFormat, readType, buffer);\n successful = successful && gl.getError() === gl.NO_ERROR;\n }\n //clean up\n gl.deleteTexture(texture);\n gl.deleteFramebuffer(fb);\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n //clear accumulated errors\n // eslint-disable-next-line no-empty\n while (!successful && gl.getError() !== gl.NO_ERROR) { }\n return successful;\n }\n /**\n * @internal\n */\n _getWebGLTextureType(type) {\n if (this._webGLVersion === 1) {\n switch (type) {\n case 1:\n return this._gl.FLOAT;\n case 2:\n return this._gl.HALF_FLOAT_OES;\n case 0:\n return this._gl.UNSIGNED_BYTE;\n case 8:\n return this._gl.UNSIGNED_SHORT_4_4_4_4;\n case 9:\n return this._gl.UNSIGNED_SHORT_5_5_5_1;\n case 10:\n return this._gl.UNSIGNED_SHORT_5_6_5;\n }\n return this._gl.UNSIGNED_BYTE;\n }\n switch (type) {\n case 3:\n return this._gl.BYTE;\n case 0:\n return this._gl.UNSIGNED_BYTE;\n case 4:\n return this._gl.SHORT;\n case 5:\n return this._gl.UNSIGNED_SHORT;\n case 6:\n return this._gl.INT;\n case 7: // Refers to UNSIGNED_INT\n return this._gl.UNSIGNED_INT;\n case 1:\n return this._gl.FLOAT;\n case 2:\n return this._gl.HALF_FLOAT;\n case 8:\n return this._gl.UNSIGNED_SHORT_4_4_4_4;\n case 9:\n return this._gl.UNSIGNED_SHORT_5_5_5_1;\n case 10:\n return this._gl.UNSIGNED_SHORT_5_6_5;\n case 11:\n return this._gl.UNSIGNED_INT_2_10_10_10_REV;\n case 12:\n return this._gl.UNSIGNED_INT_24_8;\n case 13:\n return this._gl.UNSIGNED_INT_10F_11F_11F_REV;\n case 14:\n return this._gl.UNSIGNED_INT_5_9_9_9_REV;\n case 15:\n return this._gl.FLOAT_32_UNSIGNED_INT_24_8_REV;\n }\n return this._gl.UNSIGNED_BYTE;\n }\n /**\n * @internal\n */\n _getInternalFormat(format, useSRGBBuffer = false) {\n let internalFormat = useSRGBBuffer ? this._glSRGBExtensionValues.SRGB8_ALPHA8 : this._gl.RGBA;\n switch (format) {\n case 0:\n internalFormat = this._gl.ALPHA;\n break;\n case 1:\n internalFormat = this._gl.LUMINANCE;\n break;\n case 2:\n internalFormat = this._gl.LUMINANCE_ALPHA;\n break;\n case 6:\n internalFormat = this._gl.RED;\n break;\n case 7:\n internalFormat = this._gl.RG;\n break;\n case 4:\n internalFormat = useSRGBBuffer ? this._glSRGBExtensionValues.SRGB : this._gl.RGB;\n break;\n case 5:\n internalFormat = useSRGBBuffer ? this._glSRGBExtensionValues.SRGB8_ALPHA8 : this._gl.RGBA;\n break;\n }\n if (this._webGLVersion > 1) {\n switch (format) {\n case 8:\n internalFormat = this._gl.RED_INTEGER;\n break;\n case 9:\n internalFormat = this._gl.RG_INTEGER;\n break;\n case 10:\n internalFormat = this._gl.RGB_INTEGER;\n break;\n case 11:\n internalFormat = this._gl.RGBA_INTEGER;\n break;\n }\n }\n return internalFormat;\n }\n /**\n * @internal\n */\n _getRGBABufferInternalSizedFormat(type, format, useSRGBBuffer = false) {\n if (this._webGLVersion === 1) {\n if (format !== undefined) {\n switch (format) {\n case 0:\n return this._gl.ALPHA;\n case 1:\n return this._gl.LUMINANCE;\n case 2:\n return this._gl.LUMINANCE_ALPHA;\n case 4:\n return useSRGBBuffer ? this._glSRGBExtensionValues.SRGB : this._gl.RGB;\n }\n }\n return this._gl.RGBA;\n }\n switch (type) {\n case 3:\n switch (format) {\n case 6:\n return this._gl.R8_SNORM;\n case 7:\n return this._gl.RG8_SNORM;\n case 4:\n return this._gl.RGB8_SNORM;\n case 8:\n return this._gl.R8I;\n case 9:\n return this._gl.RG8I;\n case 10:\n return this._gl.RGB8I;\n case 11:\n return this._gl.RGBA8I;\n default:\n return this._gl.RGBA8_SNORM;\n }\n case 0:\n switch (format) {\n case 6:\n return this._gl.R8;\n case 7:\n return this._gl.RG8;\n case 4:\n return useSRGBBuffer ? this._glSRGBExtensionValues.SRGB8 : this._gl.RGB8; // By default. Other possibilities are RGB565, SRGB8.\n case 5:\n return useSRGBBuffer ? this._glSRGBExtensionValues.SRGB8_ALPHA8 : this._gl.RGBA8; // By default. Other possibilities are RGB5_A1, RGBA4, SRGB8_ALPHA8.\n case 8:\n return this._gl.R8UI;\n case 9:\n return this._gl.RG8UI;\n case 10:\n return this._gl.RGB8UI;\n case 11:\n return this._gl.RGBA8UI;\n case 0:\n return this._gl.ALPHA;\n case 1:\n return this._gl.LUMINANCE;\n case 2:\n return this._gl.LUMINANCE_ALPHA;\n default:\n return this._gl.RGBA8;\n }\n case 4:\n switch (format) {\n case 8:\n return this._gl.R16I;\n case 9:\n return this._gl.RG16I;\n case 10:\n return this._gl.RGB16I;\n case 11:\n return this._gl.RGBA16I;\n default:\n return this._gl.RGBA16I;\n }\n case 5:\n switch (format) {\n case 8:\n return this._gl.R16UI;\n case 9:\n return this._gl.RG16UI;\n case 10:\n return this._gl.RGB16UI;\n case 11:\n return this._gl.RGBA16UI;\n default:\n return this._gl.RGBA16UI;\n }\n case 6:\n switch (format) {\n case 8:\n return this._gl.R32I;\n case 9:\n return this._gl.RG32I;\n case 10:\n return this._gl.RGB32I;\n case 11:\n return this._gl.RGBA32I;\n default:\n return this._gl.RGBA32I;\n }\n case 7: // Refers to UNSIGNED_INT\n switch (format) {\n case 8:\n return this._gl.R32UI;\n case 9:\n return this._gl.RG32UI;\n case 10:\n return this._gl.RGB32UI;\n case 11:\n return this._gl.RGBA32UI;\n default:\n return this._gl.RGBA32UI;\n }\n case 1:\n switch (format) {\n case 6:\n return this._gl.R32F; // By default. Other possibility is R16F.\n case 7:\n return this._gl.RG32F; // By default. Other possibility is RG16F.\n case 4:\n return this._gl.RGB32F; // By default. Other possibilities are RGB16F, R11F_G11F_B10F, RGB9_E5.\n case 5:\n return this._gl.RGBA32F; // By default. Other possibility is RGBA16F.\n default:\n return this._gl.RGBA32F;\n }\n case 2:\n switch (format) {\n case 6:\n return this._gl.R16F;\n case 7:\n return this._gl.RG16F;\n case 4:\n return this._gl.RGB16F; // By default. Other possibilities are R11F_G11F_B10F, RGB9_E5.\n case 5:\n return this._gl.RGBA16F;\n default:\n return this._gl.RGBA16F;\n }\n case 10:\n return this._gl.RGB565;\n case 13:\n return this._gl.R11F_G11F_B10F;\n case 14:\n return this._gl.RGB9_E5;\n case 8:\n return this._gl.RGBA4;\n case 9:\n return this._gl.RGB5_A1;\n case 11:\n switch (format) {\n case 5:\n return this._gl.RGB10_A2; // By default. Other possibility is RGB5_A1.\n case 11:\n return this._gl.RGB10_A2UI;\n default:\n return this._gl.RGB10_A2;\n }\n }\n return useSRGBBuffer ? this._glSRGBExtensionValues.SRGB8_ALPHA8 : this._gl.RGBA8;\n }\n /**\n * @internal\n */\n _getRGBAMultiSampleBufferFormat(type, format = 5) {\n switch (type) {\n case 1:\n switch (format) {\n case 6:\n return this._gl.R32F;\n default:\n return this._gl.RGBA32F;\n }\n case 2:\n switch (format) {\n case 6:\n return this._gl.R16F;\n default:\n return this._gl.RGBA16F;\n }\n }\n return this._gl.RGBA8;\n }\n /**\n * @internal\n */\n _loadFile(url, onSuccess, onProgress, offlineProvider, useArrayBuffer, onError) {\n const request = ThinEngine._FileToolsLoadFile(url, onSuccess, onProgress, offlineProvider, useArrayBuffer, onError);\n this._activeRequests.push(request);\n request.onCompleteObservable.add((request) => {\n this._activeRequests.splice(this._activeRequests.indexOf(request), 1);\n });\n return request;\n }\n /**\n * Loads a file from a url\n * @param url url to load\n * @param onSuccess callback called when the file successfully loads\n * @param onProgress callback called while file is loading (if the server supports this mode)\n * @param offlineProvider defines the offline provider for caching\n * @param useArrayBuffer defines a boolean indicating that date must be returned as ArrayBuffer\n * @param onError callback called when the file fails to load\n * @returns a file request object\n * @internal\n */\n static _FileToolsLoadFile(url, onSuccess, onProgress, offlineProvider, useArrayBuffer, onError) {\n throw _WarnImport(\"FileTools\");\n }\n /**\n * Reads pixels from the current frame buffer. Please note that this function can be slow\n * @param x defines the x coordinate of the rectangle where pixels must be read\n * @param y defines the y coordinate of the rectangle where pixels must be read\n * @param width defines the width of the rectangle where pixels must be read\n * @param height defines the height of the rectangle where pixels must be read\n * @param hasAlpha defines whether the output should have alpha or not (defaults to true)\n * @param flushRenderer true to flush the renderer from the pending commands before reading the pixels\n * @returns a ArrayBufferView promise (Uint8Array) containing RGBA colors\n */\n readPixels(x, y, width, height, hasAlpha = true, flushRenderer = true) {\n const numChannels = hasAlpha ? 4 : 3;\n const format = hasAlpha ? this._gl.RGBA : this._gl.RGB;\n const data = new Uint8Array(height * width * numChannels);\n if (flushRenderer) {\n this.flushFramebuffer();\n }\n this._gl.readPixels(x, y, width, height, format, this._gl.UNSIGNED_BYTE, data);\n return Promise.resolve(data);\n }\n /**\n * Gets a Promise<boolean> indicating if the engine can be instantiated (ie. if a webGL context can be found)\n */\n static get IsSupportedAsync() {\n return Promise.resolve(this.isSupported());\n }\n /**\n * Gets a boolean indicating if the engine can be instantiated (ie. if a webGL context can be found)\n */\n static get IsSupported() {\n return this.isSupported(); // Backward compat\n }\n /**\n * Gets a boolean indicating if the engine can be instantiated (ie. if a webGL context can be found)\n * @returns true if the engine can be created\n * @ignorenaming\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n static isSupported() {\n if (this._HasMajorPerformanceCaveat !== null) {\n return !this._HasMajorPerformanceCaveat; // We know it is performant so WebGL is supported\n }\n if (this._IsSupported === null) {\n try {\n const tempcanvas = this._CreateCanvas(1, 1);\n const gl = tempcanvas.getContext(\"webgl\") || tempcanvas.getContext(\"experimental-webgl\");\n this._IsSupported = gl != null && !!window.WebGLRenderingContext;\n }\n catch (e) {\n this._IsSupported = false;\n }\n }\n return this._IsSupported;\n }\n /**\n * Gets a boolean indicating if the engine can be instantiated on a performant device (ie. if a webGL context can be found and it does not use a slow implementation)\n */\n static get HasMajorPerformanceCaveat() {\n if (this._HasMajorPerformanceCaveat === null) {\n try {\n const tempcanvas = this._CreateCanvas(1, 1);\n const gl = tempcanvas.getContext(\"webgl\", { failIfMajorPerformanceCaveat: true }) ||\n tempcanvas.getContext(\"experimental-webgl\", { failIfMajorPerformanceCaveat: true });\n this._HasMajorPerformanceCaveat = !gl;\n }\n catch (e) {\n this._HasMajorPerformanceCaveat = false;\n }\n }\n return this._HasMajorPerformanceCaveat;\n }\n /**\n * Find the next highest power of two.\n * @param x Number to start search from.\n * @returns Next highest power of two.\n */\n static CeilingPOT(x) {\n x--;\n x |= x >> 1;\n x |= x >> 2;\n x |= x >> 4;\n x |= x >> 8;\n x |= x >> 16;\n x++;\n return x;\n }\n /**\n * Find the next lowest power of two.\n * @param x Number to start search from.\n * @returns Next lowest power of two.\n */\n static FloorPOT(x) {\n x = x | (x >> 1);\n x = x | (x >> 2);\n x = x | (x >> 4);\n x = x | (x >> 8);\n x = x | (x >> 16);\n return x - (x >> 1);\n }\n /**\n * Find the nearest power of two.\n * @param x Number to start search from.\n * @returns Next nearest power of two.\n */\n static NearestPOT(x) {\n const c = ThinEngine.CeilingPOT(x);\n const f = ThinEngine.FloorPOT(x);\n return c - x > x - f ? f : c;\n }\n /**\n * Get the closest exponent of two\n * @param value defines the value to approximate\n * @param max defines the maximum value to return\n * @param mode defines how to define the closest value\n * @returns closest exponent of two of the given value\n */\n static GetExponentOfTwo(value, max, mode = 2) {\n let pot;\n switch (mode) {\n case 1:\n pot = ThinEngine.FloorPOT(value);\n break;\n case 2:\n pot = ThinEngine.NearestPOT(value);\n break;\n case 3:\n default:\n pot = ThinEngine.CeilingPOT(value);\n break;\n }\n return Math.min(pot, max);\n }\n /**\n * Queue a new function into the requested animation frame pool (ie. this function will be executed by the browser (or the javascript engine) for the next frame)\n * @param func - the function to be called\n * @param requester - the object that will request the next frame. Falls back to window.\n * @returns frame number\n */\n static QueueNewFrame(func, requester) {\n // Note that there is kind of a typing issue here, as `setTimeout` might return something else than a number (NodeJs returns a NodeJS.Timeout object).\n // Also if the global `requestAnimationFrame`'s returnType is number, `requester.requestPostAnimationFrame` and `requester.requestAnimationFrame` types\n // are `any`.\n if (!IsWindowObjectExist()) {\n if (typeof requestAnimationFrame === \"function\") {\n return requestAnimationFrame(func);\n }\n }\n else {\n const { requestPostAnimationFrame, requestAnimationFrame } = requester || window;\n if (typeof requestPostAnimationFrame === \"function\") {\n return requestPostAnimationFrame(func);\n }\n if (typeof requestAnimationFrame === \"function\") {\n return requestAnimationFrame(func);\n }\n }\n // fallback to the global `setTimeout`.\n // In most cases (aka in the browser), `window` is the global object, so instead of calling `window.setTimeout` we could call the global `setTimeout`.\n return setTimeout(func, 16);\n }\n /**\n * Gets host document\n * @returns the host document object\n */\n getHostDocument() {\n if (this._renderingCanvas && this._renderingCanvas.ownerDocument) {\n return this._renderingCanvas.ownerDocument;\n }\n return IsDocumentAvailable() ? document : null;\n }\n}\n/** Use this array to turn off some WebGL2 features on known buggy browsers version */\nThinEngine.ExceptionList = [\n { key: \"Chrome/63.0\", capture: \"63\\\\.0\\\\.3239\\\\.(\\\\d+)\", captureConstraint: 108, targets: [\"uniformBuffer\"] },\n { key: \"Firefox/58\", capture: null, captureConstraint: null, targets: [\"uniformBuffer\"] },\n { key: \"Firefox/59\", capture: null, captureConstraint: null, targets: [\"uniformBuffer\"] },\n { key: \"Chrome/72.+?Mobile\", capture: null, captureConstraint: null, targets: [\"vao\"] },\n { key: \"Chrome/73.+?Mobile\", capture: null, captureConstraint: null, targets: [\"vao\"] },\n { key: \"Chrome/74.+?Mobile\", capture: null, captureConstraint: null, targets: [\"vao\"] },\n { key: \"Mac OS.+Chrome/71\", capture: null, captureConstraint: null, targets: [\"vao\"] },\n { key: \"Mac OS.+Chrome/72\", capture: null, captureConstraint: null, targets: [\"vao\"] },\n { key: \"Mac OS.+Chrome\", capture: null, captureConstraint: null, targets: [\"uniformBuffer\"] },\n // desktop osx safari 15.4\n { key: \".*AppleWebKit.*(15.4).*Safari\", capture: null, captureConstraint: null, targets: [\"antialias\", \"maxMSAASamples\"] },\n // mobile browsers using safari 15.4 on ios\n { key: \".*(15.4).*AppleWebKit.*Safari\", capture: null, captureConstraint: null, targets: [\"antialias\", \"maxMSAASamples\"] },\n];\n/** @internal */\nThinEngine._TextureLoaders = [];\n// Updatable statics so stick with vars here\n/**\n * Gets or sets the epsilon value used by collision engine\n */\nThinEngine.CollisionsEpsilon = 0.001;\n// Statics\nThinEngine._IsSupported = null;\nThinEngine._HasMajorPerformanceCaveat = null;\n//# sourceMappingURL=thinEngine.js.map"],"names":["BufferPointer","ThinEngine","NpmPackage","Version","description","this","name","webGLVersion","_caps","parallelShaderCompile","_name","value","version","_webGLVersion","isDisposed","_isDisposed","ShadersRepository","_getShaderProcessor","shaderLanguage","_shaderProcessor","useReverseDepthBuffer","_useReverseDepthBuffer","useReverse","_depthCullingState","depthFunc","frameId","_frameId","supportsUniformBuffers","disableUniformBuffers","getCreationOptions","_creationOptions","_shouldUseHighPrecisionShader","highPrecisionShaderSupported","_highPrecisionShadersAllowed","needPOTTextures","forcePOTTextures","activeRenderLoops","_activeRenderLoops","doNotHandleContextLost","_doNotHandleContextLost","_supportsHardwareTextureRescaling","framebufferDimensionsObject","dimensions","_framebufferDimensionsObject","currentViewport","_cachedViewport","emptyTexture","_emptyTexture","createRawTexture","Uint8Array","emptyTexture3D","_emptyTexture3D","createRawTexture3D","emptyTexture2DArray","_emptyTexture2DArray","createRawTexture2DArray","emptyCubeTexture","_emptyCubeTexture","faceData","cubeData","createRawCubeTexture","isWebGPU","_isWebGPU","shaderPlatformName","_shaderPlatformName","snapshotRendering","activate","snapshotRenderingMode","_snapshotRenderingMode","mode","snapshotRenderingReset","static","width","height","document","OffscreenCanvas","canvas","createElement","createCanvas","_CreateCanvas","createCanvasImage","constructor","canvasOrContext","antialias","options","adaptToDeviceRatio","_a","_b","_c","_d","_e","_f","_g","_h","_j","_k","_l","isFullscreen","cullBackFaces","renderEvenInBackground","preventCacheWipeBetweenFrames","validateShaderPrograms","isNDCHalfZRange","hasOriginBottomLeft","onDisposeObservable","_uniformBuffers","Array","_storageBuffers","_windowIsBackground","_badOS","_badDesktopOS","_renderingQueueLaunched","onContextLostObservable","onContextRestoredObservable","_contextWasLost","disableVertexArrayObjects","_colorWrite","_colorWriteChanged","_stencilStateComposer","_stencilState","_alphaState","_alphaMode","_alphaEquation","_internalTexturesCache","_renderTargetWrapperCache","_activeChannel","_currentTextureChannel","_boundTexturesCache","_compiledEffects","_vertexAttribArraysEnabled","_uintIndicesCurrentlySet","_currentBoundBuffer","_currentFramebuffer","_dummyFramebuffer","_currentBufferPointers","_currentInstanceLocations","_currentInstanceBuffers","_vaoRecordInProgress","_mustWipeVertexAttributes","_nextFreeTextureSlots","_maxSimultaneousTextures","_maxMSAASamplesOverride","_activeRequests","_lastDevicePixelRatio","_transformTextureUrl","hostInformation","isMobile","premultipliedAlpha","onBeforeTextureInitObservable","_viewportCached","x","y","z","w","_unpackFlipYCached","enableUnpackFlipYCached","_boundUniforms","startTime","Now","stencilGlobal","SetMatrixPrecision","useHighPrecisionMatrix","deterministicLockstep","lockstepMaxSteps","timeStep","audioEngine","stencil","_audioContext","audioEngineOptions","audioContext","_audioDestination","audioDestination","useExactSrgbConversions","_isStencilEnable","devicePixelRatio","window","limitDeviceRatio","_hardwareScalingLevel","Math","min","getContext","_renderingCanvas","undefined","preserveDrawingBuffer","xrCompatible","navigator","userAgent","_setupMobileChecks","ua","exception","ExceptionList","key","targets","RegExp","test","capture","captureConstraint","constraint","matches","exec","length","parseInt","target","_onContextLost","evt","preventDefault","Warn","notifyObservers","_onContextRestored","_restoreEngineAfterContextLost","_initGLContext","bind","addEventListener","powerPreference","disableWebGL2Support","_gl","deleteQuery","e","Error","renderbufferStorageMultisample","attributes","getContextAttributes","pixelStorei","UNPACK_COLORSPACE_CONVERSION_WEBGL","NONE","useHighPrecisionFloats","resize","_initFeatures","i","maxVertexAttribs","versionToLog","console","log","setAttribute","_checkForMobile","currentUA","indexOf","initEngine","setTimeout","async","depthTest","depthMask","stencilTest","wipeCaches","_rebuildEffects","_rebuildComputeEffects","call","_rebuildBuffers","_rebuildInternalTextures","_rebuildRenderTargetWrappers","_sharedInit","_getShaderProcessingContext","currentState","slice","internalTexture","_rebuild","renderTargetWrapper","effect","_pipelineContext","_wasPreviouslyReady","_prepareEffect","ResetCache","areAllEffectsReady","isReady","uniformBuffer","storageBuffer","maxTexturesImageUnits","getParameter","MAX_TEXTURE_IMAGE_UNITS","maxCombinedTexturesImageUnits","MAX_COMBINED_TEXTURE_IMAGE_UNITS","maxVertexTextureImageUnits","MAX_VERTEX_TEXTURE_IMAGE_UNITS","maxTextureSize","MAX_TEXTURE_SIZE","maxSamples","MAX_SAMPLES","maxCubemapTextureSize","MAX_CUBE_MAP_TEXTURE_SIZE","maxRenderTextureSize","MAX_RENDERBUFFER_SIZE","MAX_VERTEX_ATTRIBS","maxVaryingVectors","MAX_VARYING_VECTORS","maxFragmentUniformVectors","MAX_FRAGMENT_UNIFORM_VECTORS","maxVertexUniformVectors","MAX_VERTEX_UNIFORM_VECTORS","getExtension","standardDerivatives","maxAnisotropy","astc","bptc","s3tc","s3tc_srgb","pvrtc","etc1","etc2","textureAnisotropicFilterExtension","uintIndices","fragmentDepthSupported","timerQuery","supportOcclusionQuery","canUseTimestampForTimerQuery","drawBuffersExtension","maxMSAASamples","colorBufferFloat","colorBufferHalfFloat","textureFloat","textureHalfFloat","textureHalfFloatRender","textureFloatLinearFiltering","textureFloatRender","textureHalfFloatLinearFiltering","vertexArrayObject","instancedArrays","textureLOD","texelFetch","blendMinMax","multiview","oculusMultiview","depthTextureExtension","canUseGLInstanceID","canUseGLVertexID","supportComputeShaders","supportSRGBBuffers","supportTransformFeedbacks","textureMaxLevel","texture2DArrayMaxLayerCount","MAX_ARRAY_TEXTURE_LAYERS","disableMorphTargetTexture","_glVersion","VERSION","rendererInfo","_glRenderer","UNMASKED_RENDERER_WEBGL","_glVendor","UNMASKED_VENDOR_WEBGL","VENDOR","RENDERER","HALF_FLOAT_OES","RGBA16F","RGBA32F","DEPTH24_STENCIL8","getQuery","getQueryEXT","TIMESTAMP_EXT","QUERY_COUNTER_BITS_EXT","MAX_TEXTURE_MAX_ANISOTROPY_EXT","_canRenderToFloatFramebuffer","COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR","COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT","COMPRESSED_SRGB_S3TC_DXT1_EXT","COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT","COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT","COMPRESSED_SRGB8_ETC2","COMPRESSED_SRGB8_ALPHA8_ETC2_EAC","_canRenderToHalfFloatFramebuffer","drawBuffers","drawBuffersWEBGL","DRAW_FRAMEBUFFER","FRAMEBUFFER","UNSIGNED_INT_24_8","UNSIGNED_INT_24_8_WEBGL","vertexArrayObjectExtension","createVertexArray","createVertexArrayOES","bindVertexArray","bindVertexArrayOES","deleteVertexArray","deleteVertexArrayOES","instanceExtension","drawArraysInstanced","drawArraysInstancedANGLE","drawElementsInstanced","drawElementsInstancedANGLE","vertexAttribDivisor","vertexAttribDivisorANGLE","getShaderPrecisionFormat","vertexhighp","VERTEX_SHADER","HIGH_FLOAT","fragmenthighp","FRAGMENT_SHADER","precision","blendMinMaxExtension","MAX","MAX_EXT","MIN","MIN_EXT","_glSRGBExtensionValues","SRGB","WebGL2RenderingContext","SRGB8","SRGB8_ALPHA8","sRGBExtension","SRGB_EXT","SRGB_ALPHA_EXT","forceSRGBBufferSupportState","LEQUAL","slot","push","_features","forceBitmapOverHTMLImageElement","supportRenderAndCopyToLodForFloatTextures","supportDepthStencilTexture","supportShadowSamplers","uniformBufferHardCheckMatrix","allowTexturePrefiltering","trackUbosInFrame","checkUbosContentBeforeUpload","supportCSM","basisNeedsPOT","support3DTextures","needTypeSuffixInShaderConstants","supportMSAA","supportSSAO2","supportExtendedTextureFormats","supportSwitchCaseInShader","supportSyncTextureRead","needsInvertingBitmap","useUBOBindingCache","needShaderCodeInlining","needToAlwaysBindUniformBuffers","supportRenderPasses","supportSpriteInstancing","_collectUbosUpdatedInFrame","getClassName","isStencilEnable","_prepareWorkingCanvas","_workingCanvas","context","_workingContext","resetTextureCache","Object","prototype","hasOwnProperty","getInfo","getGlInfo","vendor","renderer","setHardwareScalingLevel","level","getHardwareScalingLevel","getLoadedTexturesCache","getCaps","stopRenderLoop","renderFunction","index","splice","_renderLoop","shouldRender","beginFrame","endFrame","_frameHandler","_queueNewFrame","_boundRenderFunction","getHostWindow","getRenderingCanvas","getAudioContext","getAudioDestination","ownerDocument","defaultView","getRenderWidth","useScreen","_currentRenderTarget","framebufferWidth","drawingBufferWidth","getRenderHeight","framebufferHeight","drawingBufferHeight","bindedRenderFunction","requester","QueueNewFrame","runRenderLoop","clear","color","backBuffer","depth","useStencilGlobalOnly","stencilStateComposer","applyStates","clearColor","r","g","b","a","COLOR_BUFFER_BIT","GEQUAL","clearDepth","DEPTH_BUFFER_BIT","clearStencil","STENCIL_BUFFER_BIT","_viewport","viewport","setViewport","requiredWidth","requiredHeight","flushFramebuffer","forceSetSize","changeRatio","boundingRect","getBoundingClientRect","clientWidth","clientHeight","innerWidth","innerHeight","setSize","bindFramebuffer","rtWrapper","faceIndex","forceFullscreenViewport","lodLevel","layer","webglRTWrapper","unBindFramebuffer","_bindUnboundFramebuffer","_MSAAFramebuffer","_framebuffer","gl","isMulti","is2DArray","framebufferTextureLayer","COLOR_ATTACHMENT0","texture","_hardwareTexture","underlyingResource","isCube","framebufferTexture2D","TEXTURE_CUBE_MAP_POSITIVE_X","depthStencilTexture","_depthStencilTexture","attachment","_depthStencilTextureWithStencil","DEPTH_STENCIL_ATTACHMENT","DEPTH_ATTACHMENT","TEXTURE_2D","pow","setState","culling","zOffset","force","reverseSide","zOffsetUnits","cull","cullFace","BACK","FRONT","setZOffset","setZOffsetUnits","frontFace","CW","CCW","stencilMaterial","getDepthBuffer","setDepthBuffer","enable","getZOffset","getZOffsetUnits","framebuffer","_currentFrameBufferIsDefaultFrameBuffer","generateMipmaps","_bindTextureDirectly","generateMipmap","disableGenerateMipMaps","onBeforeUnbind","unBindMultiColorAttachmentFramebuffer","READ_FRAMEBUFFER","blitFramebuffer","NEAREST","generateMipMaps","flush","restoreDefaultFramebuffer","_resetVertexBufferBinding","bindArrayBuffer","_cachedVertexBuffers","createVertexBuffer","data","_createVertexBuffer","STATIC_DRAW","usage","vbo","createBuffer","dataBuffer","bufferData","ARRAY_BUFFER","Float32Array","references","createDynamicVertexBuffer","DYNAMIC_DRAW","_resetIndexBufferBinding","bindIndexBuffer","_cachedIndexBuffer","createIndexBuffer","indices","updatable","_normalizeIndexData","ELEMENT_ARRAY_BUFFER","is32Bits","BYTES_PER_ELEMENT","Uint32Array","Uint16Array","buffer","_unbindVertexArrayObject","_bindBuffer","bindUniformBlock","pipelineContext","blockName","program","uniformLocation","getUniformBlockIndex","uniformBlockBinding","bindBuffer","updateArrayBuffer","bufferSubData","_vertexAttribPointer","indx","size","type","normalized","stride","offset","pointer","changed","active","UNSIGNED_INT","INT","vertexAttribIPointer","vertexAttribPointer","_bindIndexBufferWithCache","indexBuffer","_bindVertexBuffersAttributes","vertexBuffers","overrideVertexBuffers","getAttributesNames","unbindAllAttributes","order","getAttributeLocation","ai","vertexBuffer","enableVertexAttribArray","getBuffer","getSize","byteStride","byteOffset","getIsInstanced","getInstanceDivisor","recordVertexArrayObject","vao","bindVertexArrayObject","_cachedVertexArrayObject","bindBuffersDirectly","vertexDeclaration","vertexStrideSize","_cachedEffectForVertexBuffers","attributesCount","getAttributesCount","FLOAT","bindBuffers","unbindInstanceAttributes","boundBuffer","ul","instancesBuffer","offsetLocation","releaseVertexArrayObject","_releaseBuffer","_deleteBuffer","deleteBuffer","updateAndBindInstancesBuffer","offsetLocations","bindInstancesBuffer","attributesInfo","computeStride","attributeSize","_currentEffect","getAttributeLocationByName","attributeName","attributeType","divisor","disableInstanceAttributeByName","attributeLocation","disableInstanceAttribute","shouldClean","disableAttributeByIndex","disableVertexAttribArray","draw","useTriangles","indexStart","indexCount","instancesCount","drawElementsType","drawPointClouds","verticesStart","verticesCount","drawArraysType","drawUnIndexed","fillMode","_reportDrawCall","drawMode","_drawMode","indexFormat","UNSIGNED_SHORT","mult","drawElements","drawArrays","TRIANGLES","POINTS","LINES","LINE_LOOP","LINE_STRIP","TRIANGLE_STRIP","TRIANGLE_FAN","_releaseEffect","_key","getPipelineContext","_deletePipelineContext","webGLPipelineContext","__SPECTOR_rebuildProgram","deleteProgram","_getGlobalDefines","defines","s","createEffect","baseName","attributesNamesOrOptions","uniformsNamesOrEngine","samplers","fallbacks","onCompiled","onError","indexParameters","GLSL","vertex","vertexElement","vertexToken","vertexSource","fragment","fragmentElement","fragmentToken","fragmentSource","globalDefines","fullDefines","compiledEffect","source","shaderVersion","_compileShader","_compileRawShader","_ConcatenateShader","shader","createShader","error","NO_ERROR","tempError","getError","isContextLost","shaderSource","compileShader","_getShaderSource","getShaderSource","createRawShaderProgram","vertexCode","fragmentCode","transformFeedbackVaryings","vertexShader","fragmentShader","_createShaderProgram","createShaderProgram","inlineShaderCode","code","createPipelineContext","shaderProcessingContext","engine","isParallelCompiled","createMaterialContext","createDrawContext","shaderProgram","createProgram","attachShader","linkProgram","_finalizePipelineContext","getProgramParameter","LINK_STATUS","getShaderParameter","COMPILE_STATUS","getShaderInfoLog","vertexCompilationError","fragmentCompilationError","getProgramInfoLog","programLinkError","validateProgram","VALIDATE_STATUS","programValidationError","deleteShader","_preparePipelineContext","vertexSourceCode","fragmentSourceCode","createAsRaw","rawVertexSourceCode","rawFragmentSourceCode","rebuildRebind","webGLRenderingState","_isRenderingStateCompiled","COMPLETION_STATUS_KHR","_executeWhenRenderingStateIsCompiled","action","oldHandler","getUniforms","uniformsNames","results","getUniformLocation","getAttributes","attributesNames","getAttribLocation","enableEffect","IsWrapper","bindSamplers","onBind","_onBindObservable","setInt","uniform","uniform1i","setInt2","uniform2i","setInt3","uniform3i","setInt4","uniform4i","setIntArray","array","uniform1iv","setIntArray2","uniform2iv","setIntArray3","uniform3iv","setIntArray4","uniform4iv","setUInt","uniform1ui","setUInt2","uniform2ui","setUInt3","uniform3ui","setUInt4","uniform4ui","setUIntArray","uniform1uiv","setUIntArray2","uniform2uiv","setUIntArray3","uniform3uiv","setUIntArray4","uniform4uiv","setArray","uniform1fv","setArray2","uniform2fv","setArray3","uniform3fv","setArray4","uniform4fv","setMatrices","matrices","uniformMatrix4fv","setMatrix3x3","matrix","uniformMatrix3fv","setMatrix2x2","uniformMatrix2fv","setFloat","uniform1f","setFloat2","uniform2f","setFloat3","uniform3f","setFloat4","uniform4f","apply","colorMask","setColorWrite","getColorWrite","depthCullingState","alphaState","stencilState","clearInternalTexturesCache","bruteForce","_currentProgram","reset","UNPACK_PREMULTIPLY_ALPHA_WEBGL","_getSamplingParameters","samplingMode","magFilter","minFilter","LINEAR","LINEAR_MIPMAP_NEAREST","LINEAR_MIPMAP_LINEAR","NEAREST_MIPMAP_LINEAR","NEAREST_MIPMAP_NEAREST","mag","_createTexture","createTexture","_createHardwareTexture","_createInternalTexture","delayGPUTextureCreation","Unknown","label","format","useSRGBBuffer","samples","layers","filters","TEXTURE_2D_ARRAY","sizedFormat","_getRGBABufferInternalSizedFormat","internalFormat","_getInternalFormat","textureType","_getWebGLTextureType","texImage3D","texImage2D","texParameteri","TEXTURE_MAG_FILTER","TEXTURE_MIN_FILTER","TEXTURE_WRAP_S","CLAMP_TO_EDGE","TEXTURE_WRAP_T","_useSRGBBuffer","baseWidth","baseHeight","_getUseSRGBBuffer","noMipmap","_createTextureBase","url","invertY","scene","onLoad","prepareTexture","prepareTextureProcessFunction","fallback","forcedExtension","mimeType","loaderOptions","fromData","substr","fromBlob","isBase64","Url","substring","originalUrl","_originalUrl","lastDot","lastIndexOf","extension","toLowerCase","loader","split","availableLoader","_TextureLoaders","canLoad","addPendingData","_buffer","onLoadObserver","onLoadedObservable","add","onInternalError","message","removePendingData","remove","UseFallbackTexture","FallbackTexture","onErrorObservable","callback","loadData","loadMipmap","isCompressed","done","loadFailed","ArrayBuffer","isView","_loadFile","offlineProvider","request","responseURL","onload","img","decoding","close","_FileToolsLoadImage","imageOrientation","Blob","creationFlags","_prepareWebGLTexture","potWidth","potHeight","continuationCallback","isPot","RGBA","RGB","texelFormat","UNSIGNED_BYTE","drawImage","Temp","_rescaleTexture","_releaseTexture","input","imageBitmapOptions","destination","onComplete","compression","_unpackFlipY","UNPACK_FLIP_Y_WEBGL","_getUnpackAlignement","UNPACK_ALIGNMENT","_getTextureTarget","TEXTURE_CUBE_MAP","is3D","TEXTURE_3D","isMultiview","updateTextureSamplingMode","useMipMaps","_setTextureParameterInteger","updateTextureDimensions","updateTextureWrappingMode","wrapU","wrapV","wrapR","_getTextureWrapMode","_cachedWrapU","_cachedWrapV","TEXTURE_WRAP_R","_cachedWrapR","_setupDepthStencilTexture","generateStencil","bilinearFiltering","comparisonFunction","_comparisonFunction","samplingParameters","TEXTURE_COMPARE_FUNC","TEXTURE_COMPARE_MODE","COMPARE_REF_TO_TEXTURE","_uploadCompressedDataToTextureDirectly","lod","compressedTexImage2D","_uploadDataToTextureDirectly","imageData","babylonInternalFormat","useTextureWidthAndHeight","lodMaxWidth","round","LOG2E","lodMaxHeight","max","updateTextureData","xOffset","yOffset","targetForBinding","texSubImage2D","_uploadArrayBufferViewToTexture","bindTarget","_prepareWebGLTextureContinuation","processFunction","GetExponentOfTwo","_setupFramebufferDepthAttachments","generateStencilBuffer","generateDepthBuffer","_createRenderBuffer","DEPTH_STENCIL","depthFormat","DEPTH_COMPONENT16","DEPTH_COMPONENT32F","STENCIL_INDEX8","STENCIL_ATTACHMENT","msInternalFormat","unbindBuffer","renderBuffer","createRenderbuffer","_updateRenderBuffer","bindRenderbuffer","RENDERBUFFER","renderbufferStorage","framebufferRenderbuffer","_deleteTexture","unbindAllTextures","_lodTextureHigh","dispose","_lodTextureMid","_lodTextureLow","_irradianceTexture","_releaseRenderTargetWrapper","deleteTexture","_setProgram","useProgram","getSamplers","getUniform","_activateCurrentTexture","activeTexture","TEXTURE0","forTextureDataUpdate","wasPreviouslyBound","isTextureForRendering","_associatedChannel","bindTexture","_bindSamplerUniformToChannel","_bindTexture","channel","setTexture","_setTexture","sourceSlot","_currentState","REPEAT","MIRRORED_REPEAT","isPartOfTextureArray","video","videoInternalTexture","getInternalTexture","update","delayLoadState","delayLoad","needToBind","_cachedCoordinatesMode","coordinatesMode","textureWrapMode","_setAnisotropicLevel","anisotropicFilteringLevel","setTextureArray","textures","_textureUnits","Int32Array","anisotropicFilterExtension","_cachedAnisotropicFilteringLevel","_setTextureParameterFloat","TEXTURE_MAX_ANISOTROPY_EXT","parameter","texParameterf","releaseEffects","deleteFramebuffer","releaseComputeEffects","removeEventListener","abort","attachContextLostEvent","attachContextRestoredEvent","_canRenderToFramebuffer","successful","fb","createFramebuffer","status","checkFramebufferStatus","FRAMEBUFFER_COMPLETE","readFormat","readType","readPixels","UNSIGNED_SHORT_4_4_4_4","UNSIGNED_SHORT_5_5_5_1","UNSIGNED_SHORT_5_6_5","BYTE","SHORT","HALF_FLOAT","UNSIGNED_INT_2_10_10_10_REV","UNSIGNED_INT_10F_11F_11F_REV","UNSIGNED_INT_5_9_9_9_REV","FLOAT_32_UNSIGNED_INT_24_8_REV","ALPHA","LUMINANCE","LUMINANCE_ALPHA","RED","RG","RED_INTEGER","RG_INTEGER","RGB_INTEGER","RGBA_INTEGER","R8_SNORM","RG8_SNORM","RGB8_SNORM","R8I","RG8I","RGB8I","RGBA8I","RGBA8_SNORM","R8","RG8","RGB8","RGBA8","R8UI","RG8UI","RGB8UI","RGBA8UI","R16I","RG16I","RGB16I","RGBA16I","R16UI","RG16UI","RGB16UI","RGBA16UI","R32I","RG32I","RGB32I","RGBA32I","R32UI","RG32UI","RGB32UI","RGBA32UI","R32F","RG32F","RGB32F","R16F","RG16F","RGB16F","RGB565","R11F_G11F_B10F","RGB9_E5","RGBA4","RGB5_A1","RGB10_A2","RGB10_A2UI","_getRGBAMultiSampleBufferFormat","onSuccess","onProgress","useArrayBuffer","_FileToolsLoadFile","onCompleteObservable","hasAlpha","flushRenderer","numChannels","Promise","resolve","IsSupportedAsync","isSupported","IsSupported","_HasMajorPerformanceCaveat","_IsSupported","tempcanvas","WebGLRenderingContext","HasMajorPerformanceCaveat","failIfMajorPerformanceCaveat","c","CeilingPOT","f","FloorPOT","pot","NearestPOT","func","requestPostAnimationFrame","requestAnimationFrame","getHostDocument","CollisionsEpsilon"],"sourceRoot":""}