@babylonjs/core 7.47.3 → 7.48.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Buffers/bufferUtils.d.ts +6 -0
- package/Buffers/bufferUtils.js.map +1 -1
- package/Cameras/camera.d.ts +1 -1
- package/Cameras/camera.js +1 -1
- package/Cameras/camera.js.map +1 -1
- package/DeviceInput/webDeviceInputSystem.d.ts +2 -0
- package/DeviceInput/webDeviceInputSystem.js +29 -13
- package/DeviceInput/webDeviceInputSystem.js.map +1 -1
- package/Engines/Extensions/engine.rawTexture.js +4 -0
- package/Engines/Extensions/engine.rawTexture.js.map +1 -1
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/nativeEngine.js +2 -2
- package/Engines/nativeEngine.js.map +1 -1
- package/Loading/sceneLoader.d.ts +61 -5
- package/Loading/sceneLoader.js +156 -63
- package/Loading/sceneLoader.js.map +1 -1
- package/Meshes/Compression/dracoCompressionWorker.js +14 -1
- package/Meshes/Compression/dracoCompressionWorker.js.map +1 -1
- package/Meshes/Compression/dracoEncoder.js +8 -11
- package/Meshes/Compression/dracoEncoder.js.map +1 -1
- package/Meshes/Compression/dracoEncoder.types.d.ts +2 -1
- package/Meshes/Compression/dracoEncoder.types.js.map +1 -1
- package/Misc/dumpTools.js +5 -0
- package/Misc/dumpTools.js.map +1 -1
- package/Misc/environmentTextureTools.d.ts +77 -13
- package/Misc/environmentTextureTools.js +205 -68
- package/Misc/environmentTextureTools.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webDeviceInputSystem.js","sourceRoot":"","sources":["../../../../dev/core/src/DeviceInput/webDeviceInputSystem.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAE7D,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEtC,OAAO,EAAE,kBAAk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C,OAAO,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC;YACtD,CAAC;QACL,CAAC;IACL,CAAC;IAED;;;;OAIG;IACK,qBAAqB,CAAC,UAAkB;QAC5C,IAAI,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;YACpC,sBAAsB;YACtB,OAAO,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,SAAS,CAAC;QAC3F,CAAC;aAAM,IAAI,UAAU,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;YAC7H,eAAe;YACf,OAAO,UAAU,CAAC,IAAI,CAAC;QAC3B,CAAC;aAAM,IAAI,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;YAC3C,iBAAiB;YACjB,OAAO,UAAU,CAAC,MAAM,CAAC;QAC7B,CAAC;QAED,OAAO,UAAU,CAAC,OAAO,CAAC;IAC9B,CAAC;IAED;;;;OAIG;IACK,eAAe,CAAC,GAAQ;QAC5B,IAAI,UAAU,GAAG,UAAU,CAAC,KAAK,CAAC;QAElC,IAAI,GAAG,CAAC,WAAW,KAAK,OAAO,IAAI,GAAG,CAAC,WAAW,KAAK,KAAK,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC;YAC1E,UAAU,GAAG,UAAU,CAAC,KAAK,CAAC;QAClC,CAAC;QAED,OAAO,UAAU,CAAC;IACtB,CAAC;CACJ","sourcesContent":["import type { AbstractEngine } from \"../Engines/abstractEngine\";\r\nimport type { IPointerEvent, IUIEvent } from \"../Events/deviceInputEvents\";\r\nimport { IsNavigatorAvailable } from \"../Misc/domManagement\";\r\nimport type { Observer } from \"../Misc/observable\";\r\nimport { Tools } from \"../Misc/tools\";\r\nimport type { Nullable } from \"../types\";\r\nimport { DeviceEventFactory } from \"./eventFactory\";\r\nimport { DeviceType, PointerInput } from \"./InputDevices/deviceEnums\";\r\nimport type { IDeviceInputSystem } from \"./inputInterfaces\";\r\n\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nconst MAX_KEYCODES = 255;\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nconst MAX_POINTER_INPUTS = Object.keys(PointerInput).length / 2;\r\n\r\n/** @internal */\r\nexport class WebDeviceInputSystem implements IDeviceInputSystem {\r\n // Private Members\r\n private _inputs: Array<{ [deviceSlot: number]: Array<number> }> = [];\r\n private _gamepads: Array<DeviceType>;\r\n private _keyboardActive: boolean = false;\r\n private _pointerActive: boolean = false;\r\n private _elementToAttachTo: HTMLElement;\r\n private _metaKeys: Array<number>;\r\n private readonly _engine: AbstractEngine;\r\n private readonly _usingSafari: boolean = Tools.IsSafari();\r\n // Found solution for determining if MacOS is being used here:\r\n // https://stackoverflow.com/questions/10527983/best-way-to-detect-mac-os-x-or-windows-computers-with-javascript-or-jquery\r\n private readonly _usingMacOS: boolean = IsNavigatorAvailable() && /(Mac|iPhone|iPod|iPad)/i.test(navigator.platform);\r\n\r\n private _onDeviceConnected: (deviceType: DeviceType, deviceSlot: number) => void;\r\n private _onDeviceDisconnected: (deviceType: DeviceType, deviceSlot: number) => void;\r\n private _onInputChanged: (deviceType: DeviceType, deviceSlot: number, eventData: IUIEvent) => void;\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n private _keyboardDownEvent = (evt: any) => {};\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n private _keyboardUpEvent = (evt: any) => {};\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n private _keyboardBlurEvent = (evt: any) => {};\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n private _pointerMoveEvent = (evt: any) => {};\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n private _pointerDownEvent = (evt: any) => {};\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n private _pointerUpEvent = (evt: any) => {};\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n private _pointerCancelEvent = (evt: any) => {};\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n private _pointerWheelEvent = (evt: any) => {};\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n private _pointerBlurEvent = (evt: any) => {};\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n private _pointerMacOSChromeOutEvent = (evt: any) => {};\r\n private _wheelEventName: string;\r\n private _eventsAttached: boolean = false;\r\n\r\n private _mouseId = -1;\r\n private readonly _isUsingFirefox = IsNavigatorAvailable() && navigator.userAgent && navigator.userAgent.indexOf(\"Firefox\") !== -1;\r\n private readonly _isUsingChromium = IsNavigatorAvailable() && navigator.userAgent && navigator.userAgent.indexOf(\"Chrome\") !== -1;\r\n\r\n // Array to store active Pointer ID values; prevents issues with negative pointerIds\r\n private _activeTouchIds: Array<number>;\r\n private _maxTouchPoints: number = 0;\r\n\r\n private _pointerInputClearObserver: Nullable<Observer<AbstractEngine>> = null;\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n private _gamepadConnectedEvent = (evt: any) => {};\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n private _gamepadDisconnectedEvent = (evt: any) => {};\r\n\r\n private _eventPrefix: string;\r\n\r\n /**\r\n * Constructor for the WebDeviceInputSystem\r\n * @param engine Engine to reference\r\n * @param onDeviceConnected Callback to execute when device is connected\r\n * @param onDeviceDisconnected Callback to execute when device is disconnected\r\n * @param onInputChanged Callback to execute when input changes on device\r\n */\r\n constructor(\r\n engine: AbstractEngine,\r\n onDeviceConnected: (deviceType: DeviceType, deviceSlot: number) => void,\r\n onDeviceDisconnected: (deviceType: DeviceType, deviceSlot: number) => void,\r\n onInputChanged: (deviceType: DeviceType, deviceSlot: number, eventData: IUIEvent) => void\r\n ) {\r\n this._eventPrefix = Tools.GetPointerPrefix(engine);\r\n this._engine = engine;\r\n\r\n this._onDeviceConnected = onDeviceConnected;\r\n this._onDeviceDisconnected = onDeviceDisconnected;\r\n this._onInputChanged = onInputChanged;\r\n\r\n // If we need a pointerId, set one for future use\r\n this._mouseId = this._isUsingFirefox ? 0 : 1;\r\n\r\n this._enableEvents();\r\n\r\n if (this._usingMacOS) {\r\n this._metaKeys = [];\r\n }\r\n\r\n // Set callback to enable event handler switching when inputElement changes\r\n if (!this._engine._onEngineViewChanged) {\r\n this._engine._onEngineViewChanged = () => {\r\n this._enableEvents();\r\n };\r\n }\r\n }\r\n\r\n // Public functions\r\n /**\r\n * Checks for current device input value, given an id and input index. Throws exception if requested device not initialized.\r\n * @param deviceType Enum specifying device type\r\n * @param deviceSlot \"Slot\" or index that device is referenced in\r\n * @param inputIndex Id of input to be checked\r\n * @returns Current value of input\r\n */\r\n public pollInput(deviceType: DeviceType, deviceSlot: number, inputIndex: number): number {\r\n const device = this._inputs[deviceType][deviceSlot];\r\n\r\n if (!device) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw `Unable to find device ${DeviceType[deviceType]}`;\r\n }\r\n\r\n if (deviceType >= DeviceType.DualShock && deviceType <= DeviceType.DualSense) {\r\n this._updateDevice(deviceType, deviceSlot, inputIndex);\r\n }\r\n\r\n const currentValue = device[inputIndex];\r\n if (currentValue === undefined) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw `Unable to find input ${inputIndex} for device ${DeviceType[deviceType]} in slot ${deviceSlot}`;\r\n }\r\n\r\n if (inputIndex === PointerInput.Move) {\r\n Tools.Warn(`Unable to provide information for PointerInput.Move. Try using PointerInput.Horizontal or PointerInput.Vertical for move data.`);\r\n }\r\n\r\n return currentValue;\r\n }\r\n\r\n /**\r\n * Check for a specific device in the DeviceInputSystem\r\n * @param deviceType Type of device to check for\r\n * @returns bool with status of device's existence\r\n */\r\n public isDeviceAvailable(deviceType: DeviceType): boolean {\r\n return this._inputs[deviceType] !== undefined;\r\n }\r\n\r\n /**\r\n * Dispose of all the eventlisteners\r\n */\r\n public dispose(): void {\r\n // Callbacks\r\n this._onDeviceConnected = () => {};\r\n this._onDeviceDisconnected = () => {};\r\n this._onInputChanged = () => {};\r\n delete this._engine._onEngineViewChanged;\r\n\r\n if (this._elementToAttachTo) {\r\n this._disableEvents();\r\n }\r\n }\r\n\r\n /**\r\n * Enable listening for user input events\r\n */\r\n private _enableEvents(): void {\r\n const inputElement = this?._engine.getInputElement();\r\n if (inputElement && (!this._eventsAttached || this._elementToAttachTo !== inputElement)) {\r\n // Remove events before adding to avoid double events or simultaneous events on multiple canvases\r\n this._disableEvents();\r\n\r\n // If the inputs array has already been created, zero it out to before setting up events\r\n if (this._inputs) {\r\n for (const inputs of this._inputs) {\r\n if (inputs) {\r\n for (const deviceSlotKey in inputs) {\r\n const deviceSlot = +deviceSlotKey;\r\n const device = inputs[deviceSlot];\r\n if (device) {\r\n for (let inputIndex = 0; inputIndex < device.length; inputIndex++) {\r\n device[inputIndex] = 0;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n this._elementToAttachTo = inputElement;\r\n // Set tab index for the inputElement to the engine's canvasTabIndex, if and only if the element's tab index is -1\r\n this._elementToAttachTo.tabIndex = this._elementToAttachTo.tabIndex !== -1 ? this._elementToAttachTo.tabIndex : this._engine.canvasTabIndex;\r\n this._handleKeyActions();\r\n this._handlePointerActions();\r\n this._handleGamepadActions();\r\n this._eventsAttached = true;\r\n\r\n // Check for devices that are already connected but aren't registered. Currently, only checks for gamepads and mouse\r\n this._checkForConnectedDevices();\r\n }\r\n }\r\n\r\n /**\r\n * Disable listening for user input events\r\n */\r\n private _disableEvents(): void {\r\n if (this._elementToAttachTo) {\r\n // Blur Events\r\n this._elementToAttachTo.removeEventListener(\"blur\", this._keyboardBlurEvent);\r\n this._elementToAttachTo.removeEventListener(\"blur\", this._pointerBlurEvent);\r\n\r\n // Keyboard Events\r\n this._elementToAttachTo.removeEventListener(\"keydown\", this._keyboardDownEvent);\r\n this._elementToAttachTo.removeEventListener(\"keyup\", this._keyboardUpEvent);\r\n\r\n // Pointer Events\r\n this._elementToAttachTo.removeEventListener(this._eventPrefix + \"move\", this._pointerMoveEvent);\r\n this._elementToAttachTo.removeEventListener(this._eventPrefix + \"down\", this._pointerDownEvent);\r\n this._elementToAttachTo.removeEventListener(this._eventPrefix + \"up\", this._pointerUpEvent);\r\n this._elementToAttachTo.removeEventListener(this._eventPrefix + \"cancel\", this._pointerCancelEvent);\r\n this._elementToAttachTo.removeEventListener(this._wheelEventName, this._pointerWheelEvent);\r\n if (this._usingMacOS && this._isUsingChromium) {\r\n this._elementToAttachTo.removeEventListener(\"lostpointercapture\", this._pointerMacOSChromeOutEvent);\r\n }\r\n\r\n // Gamepad Events\r\n window.removeEventListener(\"gamepadconnected\", this._gamepadConnectedEvent);\r\n window.removeEventListener(\"gamepaddisconnected\", this._gamepadDisconnectedEvent);\r\n }\r\n\r\n if (this._pointerInputClearObserver) {\r\n this._engine.onEndFrameObservable.remove(this._pointerInputClearObserver);\r\n }\r\n\r\n this._eventsAttached = false;\r\n }\r\n\r\n /**\r\n * Checks for existing connections to devices and register them, if necessary\r\n * Currently handles gamepads and mouse\r\n */\r\n private _checkForConnectedDevices(): void {\r\n if (navigator.getGamepads) {\r\n const gamepads = navigator.getGamepads();\r\n\r\n for (const gamepad of gamepads) {\r\n if (gamepad) {\r\n this._addGamePad(gamepad);\r\n }\r\n }\r\n }\r\n\r\n // If the device in use has mouse capabilities, pre-register mouse\r\n if (typeof matchMedia === \"function\" && matchMedia(\"(pointer:fine)\").matches) {\r\n // This will provide a dummy value for the cursor position and is expected to be overridden when the first mouse event happens.\r\n // There isn't any good way to get the current position outside of a pointer event so that's why this was done.\r\n this._addPointerDevice(DeviceType.Mouse, 0, 0, 0);\r\n }\r\n }\r\n\r\n // Private functions\r\n /**\r\n * Add a gamepad to the DeviceInputSystem\r\n * @param gamepad A single DOM Gamepad object\r\n */\r\n private _addGamePad(gamepad: any): void {\r\n const deviceType = this._getGamepadDeviceType(gamepad.id);\r\n const deviceSlot = gamepad.index;\r\n\r\n this._gamepads = this._gamepads || new Array<DeviceType>(gamepad.index + 1);\r\n this._registerDevice(deviceType, deviceSlot, gamepad.buttons.length + gamepad.axes.length);\r\n\r\n this._gamepads[deviceSlot] = deviceType;\r\n }\r\n\r\n /**\r\n * Add pointer device to DeviceInputSystem\r\n * @param deviceType Type of Pointer to add\r\n * @param deviceSlot Pointer ID (0 for mouse, pointerId for Touch)\r\n * @param currentX Current X at point of adding\r\n * @param currentY Current Y at point of adding\r\n */\r\n private _addPointerDevice(deviceType: DeviceType, deviceSlot: number, currentX: number, currentY: number): void {\r\n if (!this._pointerActive) {\r\n this._pointerActive = true;\r\n }\r\n this._registerDevice(deviceType, deviceSlot, MAX_POINTER_INPUTS);\r\n const pointer = this._inputs[deviceType][deviceSlot]; /* initialize our pointer position immediately after registration */\r\n pointer[0] = currentX;\r\n pointer[1] = currentY;\r\n }\r\n\r\n /**\r\n * Add device and inputs to device array\r\n * @param deviceType Enum specifying device type\r\n * @param deviceSlot \"Slot\" or index that device is referenced in\r\n * @param numberOfInputs Number of input entries to create for given device\r\n */\r\n private _registerDevice(deviceType: DeviceType, deviceSlot: number, numberOfInputs: number): void {\r\n if (deviceSlot === undefined) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw `Unable to register device ${DeviceType[deviceType]} to undefined slot.`;\r\n }\r\n\r\n if (!this._inputs[deviceType]) {\r\n this._inputs[deviceType] = {};\r\n }\r\n\r\n if (!this._inputs[deviceType][deviceSlot]) {\r\n const device = new Array<number>(numberOfInputs);\r\n\r\n device.fill(0);\r\n\r\n this._inputs[deviceType][deviceSlot] = device;\r\n this._onDeviceConnected(deviceType, deviceSlot);\r\n }\r\n }\r\n\r\n /**\r\n * Given a specific device name, remove that device from the device map\r\n * @param deviceType Enum specifying device type\r\n * @param deviceSlot \"Slot\" or index that device is referenced in\r\n */\r\n private _unregisterDevice(deviceType: DeviceType, deviceSlot: number): void {\r\n if (this._inputs[deviceType][deviceSlot]) {\r\n delete this._inputs[deviceType][deviceSlot];\r\n this._onDeviceDisconnected(deviceType, deviceSlot);\r\n }\r\n }\r\n\r\n /**\r\n * Handle all actions that come from keyboard interaction\r\n */\r\n private _handleKeyActions(): void {\r\n this._keyboardDownEvent = (evt) => {\r\n if (!this._keyboardActive) {\r\n this._keyboardActive = true;\r\n this._registerDevice(DeviceType.Keyboard, 0, MAX_KEYCODES);\r\n }\r\n\r\n const kbKey = this._inputs[DeviceType.Keyboard][0];\r\n if (kbKey) {\r\n kbKey[evt.keyCode] = 1;\r\n\r\n const deviceEvent = evt as IUIEvent;\r\n deviceEvent.inputIndex = evt.keyCode;\r\n\r\n if (this._usingMacOS && evt.metaKey && evt.key !== \"Meta\") {\r\n if (!this._metaKeys.includes(evt.keyCode)) {\r\n this._metaKeys.push(evt.keyCode);\r\n }\r\n }\r\n\r\n this._onInputChanged(DeviceType.Keyboard, 0, deviceEvent);\r\n }\r\n };\r\n\r\n this._keyboardUpEvent = (evt) => {\r\n if (!this._keyboardActive) {\r\n this._keyboardActive = true;\r\n this._registerDevice(DeviceType.Keyboard, 0, MAX_KEYCODES);\r\n }\r\n\r\n const kbKey = this._inputs[DeviceType.Keyboard][0];\r\n if (kbKey) {\r\n kbKey[evt.keyCode] = 0;\r\n\r\n const deviceEvent = evt as IUIEvent;\r\n deviceEvent.inputIndex = evt.keyCode;\r\n\r\n if (this._usingMacOS && evt.key === \"Meta\" && this._metaKeys.length > 0) {\r\n for (const keyCode of this._metaKeys) {\r\n const deviceEvent: IUIEvent = DeviceEventFactory.CreateDeviceEvent(DeviceType.Keyboard, 0, keyCode, 0, this, this._elementToAttachTo);\r\n kbKey[keyCode] = 0;\r\n this._onInputChanged(DeviceType.Keyboard, 0, deviceEvent);\r\n }\r\n this._metaKeys.splice(0, this._metaKeys.length);\r\n }\r\n\r\n this._onInputChanged(DeviceType.Keyboard, 0, deviceEvent);\r\n }\r\n };\r\n\r\n this._keyboardBlurEvent = () => {\r\n if (this._keyboardActive) {\r\n const kbKey = this._inputs[DeviceType.Keyboard][0];\r\n\r\n for (let i = 0; i < kbKey.length; i++) {\r\n if (kbKey[i] !== 0) {\r\n kbKey[i] = 0;\r\n\r\n const deviceEvent: IUIEvent = DeviceEventFactory.CreateDeviceEvent(DeviceType.Keyboard, 0, i, 0, this, this._elementToAttachTo);\r\n\r\n this._onInputChanged(DeviceType.Keyboard, 0, deviceEvent);\r\n }\r\n }\r\n if (this._usingMacOS) {\r\n this._metaKeys.splice(0, this._metaKeys.length);\r\n }\r\n }\r\n };\r\n\r\n this._elementToAttachTo.addEventListener(\"keydown\", this._keyboardDownEvent);\r\n this._elementToAttachTo.addEventListener(\"keyup\", this._keyboardUpEvent);\r\n this._elementToAttachTo.addEventListener(\"blur\", this._keyboardBlurEvent);\r\n }\r\n\r\n /**\r\n * Handle all actions that come from pointer interaction\r\n */\r\n private _handlePointerActions(): void {\r\n // If maxTouchPoints is defined, use that value. Otherwise, allow for a minimum for supported gestures like pinch\r\n this._maxTouchPoints = (IsNavigatorAvailable() && navigator.maxTouchPoints) || 2;\r\n if (!this._activeTouchIds) {\r\n this._activeTouchIds = new Array<number>(this._maxTouchPoints);\r\n }\r\n\r\n for (let i = 0; i < this._maxTouchPoints; i++) {\r\n this._activeTouchIds[i] = -1;\r\n }\r\n\r\n this._pointerMoveEvent = (evt) => {\r\n const deviceType = this._getPointerType(evt);\r\n let deviceSlot = deviceType === DeviceType.Mouse ? 0 : this._activeTouchIds.indexOf(evt.pointerId);\r\n\r\n // In the event that we're getting pointermove events from touch inputs that we aren't tracking,\r\n // look for an available slot and retroactively connect it.\r\n if (deviceType === DeviceType.Touch && deviceSlot === -1) {\r\n const idx = this._activeTouchIds.indexOf(-1);\r\n\r\n if (idx >= 0) {\r\n deviceSlot = idx;\r\n this._activeTouchIds[idx] = evt.pointerId;\r\n // Because this is a \"new\" input, inform the connected callback\r\n this._onDeviceConnected(deviceType, deviceSlot);\r\n } else {\r\n // We can't find an open slot to store new pointer so just return (can only support max number of touches)\r\n Tools.Warn(`Max number of touches exceeded. Ignoring touches in excess of ${this._maxTouchPoints}`);\r\n return;\r\n }\r\n }\r\n\r\n if (!this._inputs[deviceType]) {\r\n this._inputs[deviceType] = {};\r\n }\r\n\r\n if (!this._inputs[deviceType][deviceSlot]) {\r\n this._addPointerDevice(deviceType, deviceSlot, evt.clientX, evt.clientY);\r\n }\r\n\r\n const pointer = this._inputs[deviceType][deviceSlot];\r\n if (pointer) {\r\n const deviceEvent = evt as IPointerEvent;\r\n deviceEvent.inputIndex = PointerInput.Move;\r\n\r\n pointer[PointerInput.Horizontal] = evt.clientX;\r\n pointer[PointerInput.Vertical] = evt.clientY;\r\n\r\n // For touches that aren't started with a down, we need to set the button state to 1\r\n if (deviceType === DeviceType.Touch && pointer[PointerInput.LeftClick] === 0) {\r\n pointer[PointerInput.LeftClick] = 1;\r\n }\r\n\r\n if (evt.pointerId === undefined) {\r\n evt.pointerId = this._mouseId;\r\n }\r\n\r\n this._onInputChanged(deviceType, deviceSlot, deviceEvent);\r\n\r\n // Lets Propagate the event for move with same position.\r\n if (!this._usingSafari && evt.button !== -1) {\r\n deviceEvent.inputIndex = evt.button + 2;\r\n pointer[evt.button + 2] = pointer[evt.button + 2] ? 0 : 1; // Reverse state of button if evt.button has value\r\n this._onInputChanged(deviceType, deviceSlot, deviceEvent);\r\n }\r\n }\r\n };\r\n\r\n this._pointerDownEvent = (evt) => {\r\n const deviceType = this._getPointerType(evt);\r\n let deviceSlot = deviceType === DeviceType.Mouse ? 0 : evt.pointerId;\r\n\r\n if (deviceType === DeviceType.Touch) {\r\n // See if this pointerId is already using an existing slot\r\n // (possible on some devices which raise the pointerMove event before the pointerDown event, e.g. when using a pen)\r\n let idx = this._activeTouchIds.indexOf(evt.pointerId);\r\n if (idx === -1) {\r\n // If the pointerId wasn't already using a slot, find an open one\r\n idx = this._activeTouchIds.indexOf(-1);\r\n }\r\n\r\n if (idx >= 0) {\r\n deviceSlot = idx;\r\n this._activeTouchIds[idx] = evt.pointerId;\r\n } else {\r\n // We can't find an open slot to store new pointer so just return (can only support max number of touches)\r\n Tools.Warn(`Max number of touches exceeded. Ignoring touches in excess of ${this._maxTouchPoints}`);\r\n return;\r\n }\r\n }\r\n\r\n if (!this._inputs[deviceType]) {\r\n this._inputs[deviceType] = {};\r\n }\r\n\r\n if (!this._inputs[deviceType][deviceSlot]) {\r\n this._addPointerDevice(deviceType, deviceSlot, evt.clientX, evt.clientY);\r\n } else if (deviceType === DeviceType.Touch) {\r\n this._onDeviceConnected(deviceType, deviceSlot);\r\n }\r\n\r\n const pointer = this._inputs[deviceType][deviceSlot];\r\n if (pointer) {\r\n const previousHorizontal = pointer[PointerInput.Horizontal];\r\n const previousVertical = pointer[PointerInput.Vertical];\r\n\r\n if (deviceType === DeviceType.Mouse) {\r\n // Mouse; Set pointerId if undefined\r\n if (evt.pointerId === undefined) {\r\n evt.pointerId = this._mouseId;\r\n }\r\n\r\n if (!document.pointerLockElement) {\r\n try {\r\n this._elementToAttachTo.setPointerCapture(this._mouseId);\r\n } catch (e) {\r\n // DO NOTHING\r\n }\r\n }\r\n } else {\r\n // Touch; Since touches are dynamically assigned, only set capture if we have an id\r\n if (evt.pointerId && !document.pointerLockElement) {\r\n try {\r\n this._elementToAttachTo.setPointerCapture(evt.pointerId);\r\n } catch (e) {\r\n // DO NOTHING\r\n }\r\n }\r\n }\r\n\r\n pointer[PointerInput.Horizontal] = evt.clientX;\r\n pointer[PointerInput.Vertical] = evt.clientY;\r\n pointer[evt.button + 2] = 1;\r\n\r\n const deviceEvent = evt as IUIEvent;\r\n\r\n // NOTE: The +2 used here to is because PointerInput has the same value progression for its mouse buttons as PointerEvent.button\r\n // However, we have our X and Y values front-loaded to group together the touch inputs but not break this progression\r\n // EG. ([X, Y, Left-click], Middle-click, etc...)\r\n deviceEvent.inputIndex = evt.button + 2;\r\n\r\n this._onInputChanged(deviceType, deviceSlot, deviceEvent);\r\n\r\n if (previousHorizontal !== evt.clientX || previousVertical !== evt.clientY) {\r\n deviceEvent.inputIndex = PointerInput.Move;\r\n this._onInputChanged(deviceType, deviceSlot, deviceEvent);\r\n }\r\n }\r\n };\r\n\r\n this._pointerUpEvent = (evt) => {\r\n const deviceType = this._getPointerType(evt);\r\n const deviceSlot = deviceType === DeviceType.Mouse ? 0 : this._activeTouchIds.indexOf(evt.pointerId);\r\n\r\n if (deviceType === DeviceType.Touch) {\r\n // If we're getting a pointerup event for a touch that isn't active, just return.\r\n if (deviceSlot === -1) {\r\n return;\r\n } else {\r\n this._activeTouchIds[deviceSlot] = -1;\r\n }\r\n }\r\n\r\n const pointer = this._inputs[deviceType]?.[deviceSlot];\r\n if (pointer && pointer[evt.button + 2] !== 0) {\r\n const previousHorizontal = pointer[PointerInput.Horizontal];\r\n const previousVertical = pointer[PointerInput.Vertical];\r\n\r\n pointer[PointerInput.Horizontal] = evt.clientX;\r\n pointer[PointerInput.Vertical] = evt.clientY;\r\n pointer[evt.button + 2] = 0;\r\n\r\n const deviceEvent = evt as IUIEvent;\r\n\r\n if (evt.pointerId === undefined) {\r\n evt.pointerId = this._mouseId;\r\n }\r\n\r\n if (previousHorizontal !== evt.clientX || previousVertical !== evt.clientY) {\r\n deviceEvent.inputIndex = PointerInput.Move;\r\n this._onInputChanged(deviceType, deviceSlot, deviceEvent);\r\n }\r\n\r\n // NOTE: The +2 used here to is because PointerInput has the same value progression for its mouse buttons as PointerEvent.button\r\n // However, we have our X and Y values front-loaded to group together the touch inputs but not break this progression\r\n // EG. ([X, Y, Left-click], Middle-click, etc...)\r\n deviceEvent.inputIndex = evt.button + 2;\r\n\r\n if (deviceType === DeviceType.Mouse && this._mouseId >= 0 && this._elementToAttachTo.hasPointerCapture?.(this._mouseId)) {\r\n this._elementToAttachTo.releasePointerCapture(this._mouseId);\r\n } else if (evt.pointerId && this._elementToAttachTo.hasPointerCapture?.(evt.pointerId)) {\r\n this._elementToAttachTo.releasePointerCapture(evt.pointerId);\r\n }\r\n\r\n this._onInputChanged(deviceType, deviceSlot, deviceEvent);\r\n\r\n if (deviceType === DeviceType.Touch) {\r\n this._onDeviceDisconnected(deviceType, deviceSlot);\r\n }\r\n }\r\n };\r\n\r\n this._pointerCancelEvent = (evt) => {\r\n if (evt.pointerType === \"mouse\") {\r\n const pointer = this._inputs[DeviceType.Mouse][0];\r\n\r\n if (this._mouseId >= 0 && this._elementToAttachTo.hasPointerCapture?.(this._mouseId)) {\r\n this._elementToAttachTo.releasePointerCapture(this._mouseId);\r\n }\r\n\r\n for (let inputIndex = PointerInput.LeftClick; inputIndex <= PointerInput.BrowserForward; inputIndex++) {\r\n if (pointer[inputIndex] === 1) {\r\n pointer[inputIndex] = 0;\r\n\r\n const deviceEvent: IUIEvent = DeviceEventFactory.CreateDeviceEvent(DeviceType.Mouse, 0, inputIndex, 0, this, this._elementToAttachTo);\r\n\r\n this._onInputChanged(DeviceType.Mouse, 0, deviceEvent);\r\n }\r\n }\r\n } else {\r\n const deviceSlot = this._activeTouchIds.indexOf(evt.pointerId);\r\n\r\n // If we're getting a pointercancel event for a touch that isn't active, just return\r\n if (deviceSlot === -1) {\r\n return;\r\n }\r\n\r\n if (this._elementToAttachTo.hasPointerCapture?.(evt.pointerId)) {\r\n this._elementToAttachTo.releasePointerCapture(evt.pointerId);\r\n }\r\n\r\n this._inputs[DeviceType.Touch][deviceSlot][PointerInput.LeftClick] = 0;\r\n\r\n const deviceEvent: IUIEvent = DeviceEventFactory.CreateDeviceEvent(\r\n DeviceType.Touch,\r\n deviceSlot,\r\n PointerInput.LeftClick,\r\n 0,\r\n this,\r\n this._elementToAttachTo,\r\n evt.pointerId\r\n );\r\n\r\n this._onInputChanged(DeviceType.Touch, deviceSlot, deviceEvent);\r\n\r\n this._activeTouchIds[deviceSlot] = -1;\r\n this._onDeviceDisconnected(DeviceType.Touch, deviceSlot);\r\n }\r\n };\r\n\r\n // Set Wheel Event Name, code originally from scene.inputManager\r\n this._wheelEventName =\r\n \"onwheel\" in document.createElement(\"div\")\r\n ? \"wheel\" // Modern browsers support \"wheel\"\r\n : (<any>document).onmousewheel !== undefined\r\n ? \"mousewheel\" // Webkit and IE support at least \"mousewheel\"\r\n : \"DOMMouseScroll\"; // let's assume that remaining browsers are older Firefox\r\n\r\n // Code originally in scene.inputManager.ts\r\n // Chrome reports warning in console if wheel listener doesn't set an explicit passive option.\r\n // IE11 only supports captureEvent:boolean, not options:object, and it defaults to false.\r\n // Feature detection technique copied from: https://github.com/github/eventlistener-polyfill (MIT license)\r\n let passiveSupported = false;\r\n const noop = function () {};\r\n\r\n try {\r\n const options = Object.defineProperty({}, \"passive\", {\r\n get: function () {\r\n passiveSupported = true;\r\n },\r\n });\r\n\r\n this._elementToAttachTo.addEventListener(\"test\", noop, options);\r\n this._elementToAttachTo.removeEventListener(\"test\", noop, options);\r\n } catch (e) {\r\n /* */\r\n }\r\n\r\n this._pointerBlurEvent = () => {\r\n // Handle mouse buttons\r\n if (this.isDeviceAvailable(DeviceType.Mouse)) {\r\n const pointer = this._inputs[DeviceType.Mouse][0];\r\n\r\n if (this._mouseId >= 0 && this._elementToAttachTo.hasPointerCapture?.(this._mouseId)) {\r\n this._elementToAttachTo.releasePointerCapture(this._mouseId);\r\n }\r\n\r\n for (let inputIndex = PointerInput.LeftClick; inputIndex <= PointerInput.BrowserForward; inputIndex++) {\r\n if (pointer[inputIndex] === 1) {\r\n pointer[inputIndex] = 0;\r\n\r\n const deviceEvent: IUIEvent = DeviceEventFactory.CreateDeviceEvent(DeviceType.Mouse, 0, inputIndex, 0, this, this._elementToAttachTo);\r\n\r\n this._onInputChanged(DeviceType.Mouse, 0, deviceEvent);\r\n }\r\n }\r\n }\r\n\r\n // Handle Active Touches\r\n if (this.isDeviceAvailable(DeviceType.Touch)) {\r\n const pointer = this._inputs[DeviceType.Touch];\r\n\r\n for (let deviceSlot = 0; deviceSlot < this._activeTouchIds.length; deviceSlot++) {\r\n const pointerId = this._activeTouchIds[deviceSlot];\r\n\r\n if (this._elementToAttachTo.hasPointerCapture?.(pointerId)) {\r\n this._elementToAttachTo.releasePointerCapture(pointerId);\r\n }\r\n\r\n if (pointerId !== -1 && pointer[deviceSlot]?.[PointerInput.LeftClick] === 1) {\r\n pointer[deviceSlot][PointerInput.LeftClick] = 0;\r\n\r\n const deviceEvent: IUIEvent = DeviceEventFactory.CreateDeviceEvent(\r\n DeviceType.Touch,\r\n deviceSlot,\r\n PointerInput.LeftClick,\r\n 0,\r\n this,\r\n this._elementToAttachTo,\r\n pointerId\r\n );\r\n\r\n this._onInputChanged(DeviceType.Touch, deviceSlot, deviceEvent);\r\n\r\n this._activeTouchIds[deviceSlot] = -1;\r\n this._onDeviceDisconnected(DeviceType.Touch, deviceSlot);\r\n }\r\n }\r\n }\r\n };\r\n\r\n this._pointerWheelEvent = (evt) => {\r\n const deviceType = DeviceType.Mouse;\r\n const deviceSlot = 0;\r\n\r\n if (!this._inputs[deviceType]) {\r\n this._inputs[deviceType] = [];\r\n }\r\n\r\n if (!this._inputs[deviceType][deviceSlot]) {\r\n this._pointerActive = true;\r\n this._registerDevice(deviceType, deviceSlot, MAX_POINTER_INPUTS);\r\n }\r\n\r\n const pointer = this._inputs[deviceType][deviceSlot];\r\n if (pointer) {\r\n pointer[PointerInput.MouseWheelX] = evt.deltaX || 0;\r\n pointer[PointerInput.MouseWheelY] = evt.deltaY || evt.wheelDelta || 0;\r\n pointer[PointerInput.MouseWheelZ] = evt.deltaZ || 0;\r\n\r\n const deviceEvent = evt as IUIEvent;\r\n // By default, there is no pointerId for mouse wheel events so we'll add one here\r\n // This logic was originally in the InputManager but was added here to make the\r\n // InputManager more platform-agnostic\r\n if (evt.pointerId === undefined) {\r\n evt.pointerId = this._mouseId;\r\n }\r\n\r\n if (pointer[PointerInput.MouseWheelX] !== 0) {\r\n deviceEvent.inputIndex = PointerInput.MouseWheelX;\r\n this._onInputChanged(deviceType, deviceSlot, deviceEvent);\r\n }\r\n if (pointer[PointerInput.MouseWheelY] !== 0) {\r\n deviceEvent.inputIndex = PointerInput.MouseWheelY;\r\n this._onInputChanged(deviceType, deviceSlot, deviceEvent);\r\n }\r\n if (pointer[PointerInput.MouseWheelZ] !== 0) {\r\n deviceEvent.inputIndex = PointerInput.MouseWheelZ;\r\n this._onInputChanged(deviceType, deviceSlot, deviceEvent);\r\n }\r\n }\r\n };\r\n\r\n // Workaround for MacOS Chromium Browsers for lost pointer capture bug\r\n if (this._usingMacOS && this._isUsingChromium) {\r\n this._pointerMacOSChromeOutEvent = (evt) => {\r\n if (evt.buttons > 1) {\r\n this._pointerCancelEvent(evt);\r\n }\r\n };\r\n this._elementToAttachTo.addEventListener(\"lostpointercapture\", this._pointerMacOSChromeOutEvent);\r\n }\r\n\r\n this._elementToAttachTo.addEventListener(this._eventPrefix + \"move\", this._pointerMoveEvent);\r\n this._elementToAttachTo.addEventListener(this._eventPrefix + \"down\", this._pointerDownEvent);\r\n this._elementToAttachTo.addEventListener(this._eventPrefix + \"up\", this._pointerUpEvent);\r\n this._elementToAttachTo.addEventListener(this._eventPrefix + \"cancel\", this._pointerCancelEvent);\r\n this._elementToAttachTo.addEventListener(\"blur\", this._pointerBlurEvent);\r\n this._elementToAttachTo.addEventListener(this._wheelEventName, this._pointerWheelEvent, passiveSupported ? { passive: false } : false);\r\n\r\n // Since there's no up or down event for mouse wheel or delta x/y, clear mouse values at end of frame\r\n this._pointerInputClearObserver = this._engine.onEndFrameObservable.add(() => {\r\n if (this.isDeviceAvailable(DeviceType.Mouse)) {\r\n const pointer = this._inputs[DeviceType.Mouse][0];\r\n pointer[PointerInput.MouseWheelX] = 0;\r\n pointer[PointerInput.MouseWheelY] = 0;\r\n pointer[PointerInput.MouseWheelZ] = 0;\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Handle all actions that come from gamepad interaction\r\n */\r\n private _handleGamepadActions(): void {\r\n this._gamepadConnectedEvent = (evt: any) => {\r\n this._addGamePad(evt.gamepad);\r\n };\r\n\r\n this._gamepadDisconnectedEvent = (evt: any) => {\r\n if (this._gamepads) {\r\n const deviceType = this._getGamepadDeviceType(evt.gamepad.id);\r\n const deviceSlot = evt.gamepad.index;\r\n\r\n this._unregisterDevice(deviceType, deviceSlot);\r\n delete this._gamepads[deviceSlot];\r\n }\r\n };\r\n\r\n window.addEventListener(\"gamepadconnected\", this._gamepadConnectedEvent);\r\n window.addEventListener(\"gamepaddisconnected\", this._gamepadDisconnectedEvent);\r\n }\r\n\r\n /**\r\n * Update all non-event based devices with each frame\r\n * @param deviceType Enum specifying device type\r\n * @param deviceSlot \"Slot\" or index that device is referenced in\r\n * @param inputIndex Id of input to be checked\r\n */\r\n private _updateDevice(deviceType: DeviceType, deviceSlot: number, inputIndex: number): void {\r\n // Gamepads\r\n const gp = navigator.getGamepads()[deviceSlot];\r\n\r\n if (gp && deviceType === this._gamepads[deviceSlot]) {\r\n const device = this._inputs[deviceType][deviceSlot];\r\n\r\n if (inputIndex >= gp.buttons.length) {\r\n device[inputIndex] = gp.axes[inputIndex - gp.buttons.length].valueOf();\r\n } else {\r\n device[inputIndex] = gp.buttons[inputIndex].value;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Gets DeviceType from the device name\r\n * @param deviceName Name of Device from DeviceInputSystem\r\n * @returns DeviceType enum value\r\n */\r\n private _getGamepadDeviceType(deviceName: string): DeviceType {\r\n if (deviceName.indexOf(\"054c\") !== -1) {\r\n // DualShock 4 Gamepad\r\n return deviceName.indexOf(\"0ce6\") !== -1 ? DeviceType.DualSense : DeviceType.DualShock;\r\n } else if (deviceName.indexOf(\"Xbox One\") !== -1 || deviceName.search(\"Xbox 360\") !== -1 || deviceName.search(\"xinput\") !== -1) {\r\n // Xbox Gamepad\r\n return DeviceType.Xbox;\r\n } else if (deviceName.indexOf(\"057e\") !== -1) {\r\n // Switch Gamepad\r\n return DeviceType.Switch;\r\n }\r\n\r\n return DeviceType.Generic;\r\n }\r\n\r\n /**\r\n * Get DeviceType from a given pointer/mouse/touch event.\r\n * @param evt PointerEvent to evaluate\r\n * @returns DeviceType interpreted from event\r\n */\r\n private _getPointerType(evt: any): DeviceType {\r\n let deviceType = DeviceType.Mouse;\r\n\r\n if (evt.pointerType === \"touch\" || evt.pointerType === \"pen\" || evt.touches) {\r\n deviceType = DeviceType.Touch;\r\n }\r\n\r\n return deviceType;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"webDeviceInputSystem.js","sourceRoot":"","sources":["../../../../dev/core/src/DeviceInput/webDeviceInputSystem.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAE7D,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAGtE,gEAAgE;AAChE,MAAM,YAAY,GAAG,GAAG,CAAC;AACzB,gEAAgE;AAChE,MAAM,kBAAkB,GAAG,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;AAEhE,gBAAgB;AAChB,MAAM,OAAO,oBAAoB;IA+D7B;;;;;;OAMG;IACH,YACI,MAAsB,EACtB,iBAAuE,EACvE,oBAA0E,EAC1E,cAAyF;QAzE7F,kBAAkB;QACV,YAAO,GAAmD,EAAE,CAAC;QAE7D,oBAAe,GAAY,KAAK,CAAC;QACjC,mBAAc,GAAY,KAAK,CAAC;QAIvB,iBAAY,GAAY,KAAK,CAAC,QAAQ,EAAE,CAAC;QAC1D,8DAA8D;QAC9D,0HAA0H;QACzG,gBAAW,GAAY,oBAAoB,EAAE,IAAI,yBAAyB,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QAMrH,6DAA6D;QACrD,uBAAkB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AAC,GAAG,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC;YACtD,CAAC;QACL,CAAC;IACL,CAAC;IAED;;;;OAIG;IACK,qBAAqB,CAAC,UAAkB;QAC5C,IAAI,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;YACpC,sBAAsB;YACtB,OAAO,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,SAAS,CAAC;QAC3F,CAAC;aAAM,IAAI,UAAU,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;YAC7H,eAAe;YACf,OAAO,UAAU,CAAC,IAAI,CAAC;QAC3B,CAAC;aAAM,IAAI,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;YAC3C,iBAAiB;YACjB,OAAO,UAAU,CAAC,MAAM,CAAC;QAC7B,CAAC;QAED,OAAO,UAAU,CAAC,OAAO,CAAC;IAC9B,CAAC;IAED;;;;OAIG;IACK,eAAe,CAAC,GAAQ;QAC5B,IAAI,UAAU,GAAG,UAAU,CAAC,KAAK,CAAC;QAElC,IAAI,GAAG,CAAC,WAAW,KAAK,OAAO,IAAI,GAAG,CAAC,WAAW,KAAK,KAAK,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC;YAC1E,UAAU,GAAG,UAAU,CAAC,KAAK,CAAC;QAClC,CAAC;QAED,OAAO,UAAU,CAAC;IACtB,CAAC;CACJ","sourcesContent":["import type { AbstractEngine } from \"../Engines/abstractEngine\";\r\nimport type { IPointerEvent, IUIEvent } from \"../Events/deviceInputEvents\";\r\nimport { IsNavigatorAvailable } from \"../Misc/domManagement\";\r\nimport type { Observer } from \"../Misc/observable\";\r\nimport { Tools } from \"../Misc/tools\";\r\nimport type { Nullable } from \"../types\";\r\nimport { DeviceEventFactory } from \"./eventFactory\";\r\nimport { DeviceType, PointerInput } from \"./InputDevices/deviceEnums\";\r\nimport type { IDeviceInputSystem } from \"./inputInterfaces\";\r\n\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nconst MAX_KEYCODES = 255;\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nconst MAX_POINTER_INPUTS = Object.keys(PointerInput).length / 2;\r\n\r\n/** @internal */\r\nexport class WebDeviceInputSystem implements IDeviceInputSystem {\r\n // Private Members\r\n private _inputs: Array<{ [deviceSlot: number]: Array<number> }> = [];\r\n private _gamepads: Array<DeviceType>;\r\n private _keyboardActive: boolean = false;\r\n private _pointerActive: boolean = false;\r\n private _elementToAttachTo: HTMLElement;\r\n private _metaKeys: Array<number>;\r\n private readonly _engine: AbstractEngine;\r\n private readonly _usingSafari: boolean = Tools.IsSafari();\r\n // Found solution for determining if MacOS is being used here:\r\n // https://stackoverflow.com/questions/10527983/best-way-to-detect-mac-os-x-or-windows-computers-with-javascript-or-jquery\r\n private readonly _usingMacOS: boolean = IsNavigatorAvailable() && /(Mac|iPhone|iPod|iPad)/i.test(navigator.platform);\r\n\r\n private _onDeviceConnected: (deviceType: DeviceType, deviceSlot: number) => void;\r\n private _onDeviceDisconnected: (deviceType: DeviceType, deviceSlot: number) => void;\r\n private _onInputChanged: (deviceType: DeviceType, deviceSlot: number, eventData: IUIEvent) => void;\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n private _keyboardDownEvent = (evt: any) => {};\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n private _keyboardUpEvent = (evt: any) => {};\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n private _keyboardBlurEvent = (evt: any) => {};\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n private _pointerMoveEvent = (evt: any) => {};\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n private _pointerDownEvent = (evt: any) => {};\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n private _pointerUpEvent = (evt: any) => {};\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n private _pointerCancelEvent = (evt: any) => {};\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n private _pointerCancelTouch = (pointerId: number) => {};\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n private _pointerLeaveEvent = (evt: any) => {};\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n private _pointerWheelEvent = (evt: any) => {};\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n private _pointerBlurEvent = (evt: any) => {};\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n private _pointerMacOSChromeOutEvent = (evt: any) => {};\r\n private _wheelEventName: string;\r\n private _eventsAttached: boolean = false;\r\n\r\n private _mouseId = -1;\r\n private readonly _isUsingFirefox = IsNavigatorAvailable() && navigator.userAgent && navigator.userAgent.indexOf(\"Firefox\") !== -1;\r\n private readonly _isUsingChromium = IsNavigatorAvailable() && navigator.userAgent && navigator.userAgent.indexOf(\"Chrome\") !== -1;\r\n\r\n // Array to store active Pointer ID values; prevents issues with negative pointerIds\r\n private _activeTouchIds: Array<number>;\r\n private _maxTouchPoints: number = 0;\r\n\r\n private _pointerInputClearObserver: Nullable<Observer<AbstractEngine>> = null;\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n private _gamepadConnectedEvent = (evt: any) => {};\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n private _gamepadDisconnectedEvent = (evt: any) => {};\r\n\r\n private _eventPrefix: string;\r\n\r\n /**\r\n * Constructor for the WebDeviceInputSystem\r\n * @param engine Engine to reference\r\n * @param onDeviceConnected Callback to execute when device is connected\r\n * @param onDeviceDisconnected Callback to execute when device is disconnected\r\n * @param onInputChanged Callback to execute when input changes on device\r\n */\r\n constructor(\r\n engine: AbstractEngine,\r\n onDeviceConnected: (deviceType: DeviceType, deviceSlot: number) => void,\r\n onDeviceDisconnected: (deviceType: DeviceType, deviceSlot: number) => void,\r\n onInputChanged: (deviceType: DeviceType, deviceSlot: number, eventData: IUIEvent) => void\r\n ) {\r\n this._eventPrefix = Tools.GetPointerPrefix(engine);\r\n this._engine = engine;\r\n\r\n this._onDeviceConnected = onDeviceConnected;\r\n this._onDeviceDisconnected = onDeviceDisconnected;\r\n this._onInputChanged = onInputChanged;\r\n\r\n // If we need a pointerId, set one for future use\r\n this._mouseId = this._isUsingFirefox ? 0 : 1;\r\n\r\n this._enableEvents();\r\n\r\n if (this._usingMacOS) {\r\n this._metaKeys = [];\r\n }\r\n\r\n // Set callback to enable event handler switching when inputElement changes\r\n if (!this._engine._onEngineViewChanged) {\r\n this._engine._onEngineViewChanged = () => {\r\n this._enableEvents();\r\n };\r\n }\r\n }\r\n\r\n // Public functions\r\n /**\r\n * Checks for current device input value, given an id and input index. Throws exception if requested device not initialized.\r\n * @param deviceType Enum specifying device type\r\n * @param deviceSlot \"Slot\" or index that device is referenced in\r\n * @param inputIndex Id of input to be checked\r\n * @returns Current value of input\r\n */\r\n public pollInput(deviceType: DeviceType, deviceSlot: number, inputIndex: number): number {\r\n const device = this._inputs[deviceType][deviceSlot];\r\n\r\n if (!device) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw `Unable to find device ${DeviceType[deviceType]}`;\r\n }\r\n\r\n if (deviceType >= DeviceType.DualShock && deviceType <= DeviceType.DualSense) {\r\n this._updateDevice(deviceType, deviceSlot, inputIndex);\r\n }\r\n\r\n const currentValue = device[inputIndex];\r\n if (currentValue === undefined) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw `Unable to find input ${inputIndex} for device ${DeviceType[deviceType]} in slot ${deviceSlot}`;\r\n }\r\n\r\n if (inputIndex === PointerInput.Move) {\r\n Tools.Warn(`Unable to provide information for PointerInput.Move. Try using PointerInput.Horizontal or PointerInput.Vertical for move data.`);\r\n }\r\n\r\n return currentValue;\r\n }\r\n\r\n /**\r\n * Check for a specific device in the DeviceInputSystem\r\n * @param deviceType Type of device to check for\r\n * @returns bool with status of device's existence\r\n */\r\n public isDeviceAvailable(deviceType: DeviceType): boolean {\r\n return this._inputs[deviceType] !== undefined;\r\n }\r\n\r\n /**\r\n * Dispose of all the eventlisteners\r\n */\r\n public dispose(): void {\r\n // Callbacks\r\n this._onDeviceConnected = () => {};\r\n this._onDeviceDisconnected = () => {};\r\n this._onInputChanged = () => {};\r\n delete this._engine._onEngineViewChanged;\r\n\r\n if (this._elementToAttachTo) {\r\n this._disableEvents();\r\n }\r\n }\r\n\r\n /**\r\n * Enable listening for user input events\r\n */\r\n private _enableEvents(): void {\r\n const inputElement = this?._engine.getInputElement();\r\n if (inputElement && (!this._eventsAttached || this._elementToAttachTo !== inputElement)) {\r\n // Remove events before adding to avoid double events or simultaneous events on multiple canvases\r\n this._disableEvents();\r\n\r\n // If the inputs array has already been created, zero it out to before setting up events\r\n if (this._inputs) {\r\n for (const inputs of this._inputs) {\r\n if (inputs) {\r\n for (const deviceSlotKey in inputs) {\r\n const deviceSlot = +deviceSlotKey;\r\n const device = inputs[deviceSlot];\r\n if (device) {\r\n for (let inputIndex = 0; inputIndex < device.length; inputIndex++) {\r\n device[inputIndex] = 0;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n this._elementToAttachTo = inputElement;\r\n // Set tab index for the inputElement to the engine's canvasTabIndex, if and only if the element's tab index is -1\r\n this._elementToAttachTo.tabIndex = this._elementToAttachTo.tabIndex !== -1 ? this._elementToAttachTo.tabIndex : this._engine.canvasTabIndex;\r\n this._handleKeyActions();\r\n this._handlePointerActions();\r\n this._handleGamepadActions();\r\n this._eventsAttached = true;\r\n\r\n // Check for devices that are already connected but aren't registered. Currently, only checks for gamepads and mouse\r\n this._checkForConnectedDevices();\r\n }\r\n }\r\n\r\n /**\r\n * Disable listening for user input events\r\n */\r\n private _disableEvents(): void {\r\n if (this._elementToAttachTo) {\r\n // Blur Events\r\n this._elementToAttachTo.removeEventListener(\"blur\", this._keyboardBlurEvent);\r\n this._elementToAttachTo.removeEventListener(\"blur\", this._pointerBlurEvent);\r\n\r\n // Keyboard Events\r\n this._elementToAttachTo.removeEventListener(\"keydown\", this._keyboardDownEvent);\r\n this._elementToAttachTo.removeEventListener(\"keyup\", this._keyboardUpEvent);\r\n\r\n // Pointer Events\r\n this._elementToAttachTo.removeEventListener(this._eventPrefix + \"move\", this._pointerMoveEvent);\r\n this._elementToAttachTo.removeEventListener(this._eventPrefix + \"down\", this._pointerDownEvent);\r\n this._elementToAttachTo.removeEventListener(this._eventPrefix + \"up\", this._pointerUpEvent);\r\n this._elementToAttachTo.removeEventListener(this._eventPrefix + \"cancel\", this._pointerCancelEvent);\r\n this._elementToAttachTo.removeEventListener(this._eventPrefix + \"leave\", this._pointerLeaveEvent);\r\n this._elementToAttachTo.removeEventListener(this._wheelEventName, this._pointerWheelEvent);\r\n if (this._usingMacOS && this._isUsingChromium) {\r\n this._elementToAttachTo.removeEventListener(\"lostpointercapture\", this._pointerMacOSChromeOutEvent);\r\n }\r\n\r\n // Gamepad Events\r\n window.removeEventListener(\"gamepadconnected\", this._gamepadConnectedEvent);\r\n window.removeEventListener(\"gamepaddisconnected\", this._gamepadDisconnectedEvent);\r\n }\r\n\r\n if (this._pointerInputClearObserver) {\r\n this._engine.onEndFrameObservable.remove(this._pointerInputClearObserver);\r\n }\r\n\r\n this._eventsAttached = false;\r\n }\r\n\r\n /**\r\n * Checks for existing connections to devices and register them, if necessary\r\n * Currently handles gamepads and mouse\r\n */\r\n private _checkForConnectedDevices(): void {\r\n if (navigator.getGamepads) {\r\n const gamepads = navigator.getGamepads();\r\n\r\n for (const gamepad of gamepads) {\r\n if (gamepad) {\r\n this._addGamePad(gamepad);\r\n }\r\n }\r\n }\r\n\r\n // If the device in use has mouse capabilities, pre-register mouse\r\n if (typeof matchMedia === \"function\" && matchMedia(\"(pointer:fine)\").matches) {\r\n // This will provide a dummy value for the cursor position and is expected to be overridden when the first mouse event happens.\r\n // There isn't any good way to get the current position outside of a pointer event so that's why this was done.\r\n this._addPointerDevice(DeviceType.Mouse, 0, 0, 0);\r\n }\r\n }\r\n\r\n // Private functions\r\n /**\r\n * Add a gamepad to the DeviceInputSystem\r\n * @param gamepad A single DOM Gamepad object\r\n */\r\n private _addGamePad(gamepad: any): void {\r\n const deviceType = this._getGamepadDeviceType(gamepad.id);\r\n const deviceSlot = gamepad.index;\r\n\r\n this._gamepads = this._gamepads || new Array<DeviceType>(gamepad.index + 1);\r\n this._registerDevice(deviceType, deviceSlot, gamepad.buttons.length + gamepad.axes.length);\r\n\r\n this._gamepads[deviceSlot] = deviceType;\r\n }\r\n\r\n /**\r\n * Add pointer device to DeviceInputSystem\r\n * @param deviceType Type of Pointer to add\r\n * @param deviceSlot Pointer ID (0 for mouse, pointerId for Touch)\r\n * @param currentX Current X at point of adding\r\n * @param currentY Current Y at point of adding\r\n */\r\n private _addPointerDevice(deviceType: DeviceType, deviceSlot: number, currentX: number, currentY: number): void {\r\n if (!this._pointerActive) {\r\n this._pointerActive = true;\r\n }\r\n this._registerDevice(deviceType, deviceSlot, MAX_POINTER_INPUTS);\r\n const pointer = this._inputs[deviceType][deviceSlot]; /* initialize our pointer position immediately after registration */\r\n pointer[0] = currentX;\r\n pointer[1] = currentY;\r\n }\r\n\r\n /**\r\n * Add device and inputs to device array\r\n * @param deviceType Enum specifying device type\r\n * @param deviceSlot \"Slot\" or index that device is referenced in\r\n * @param numberOfInputs Number of input entries to create for given device\r\n */\r\n private _registerDevice(deviceType: DeviceType, deviceSlot: number, numberOfInputs: number): void {\r\n if (deviceSlot === undefined) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw `Unable to register device ${DeviceType[deviceType]} to undefined slot.`;\r\n }\r\n\r\n if (!this._inputs[deviceType]) {\r\n this._inputs[deviceType] = {};\r\n }\r\n\r\n if (!this._inputs[deviceType][deviceSlot]) {\r\n const device = new Array<number>(numberOfInputs);\r\n\r\n device.fill(0);\r\n\r\n this._inputs[deviceType][deviceSlot] = device;\r\n this._onDeviceConnected(deviceType, deviceSlot);\r\n }\r\n }\r\n\r\n /**\r\n * Given a specific device name, remove that device from the device map\r\n * @param deviceType Enum specifying device type\r\n * @param deviceSlot \"Slot\" or index that device is referenced in\r\n */\r\n private _unregisterDevice(deviceType: DeviceType, deviceSlot: number): void {\r\n if (this._inputs[deviceType][deviceSlot]) {\r\n delete this._inputs[deviceType][deviceSlot];\r\n this._onDeviceDisconnected(deviceType, deviceSlot);\r\n }\r\n }\r\n\r\n /**\r\n * Handle all actions that come from keyboard interaction\r\n */\r\n private _handleKeyActions(): void {\r\n this._keyboardDownEvent = (evt) => {\r\n if (!this._keyboardActive) {\r\n this._keyboardActive = true;\r\n this._registerDevice(DeviceType.Keyboard, 0, MAX_KEYCODES);\r\n }\r\n\r\n const kbKey = this._inputs[DeviceType.Keyboard][0];\r\n if (kbKey) {\r\n kbKey[evt.keyCode] = 1;\r\n\r\n const deviceEvent = evt as IUIEvent;\r\n deviceEvent.inputIndex = evt.keyCode;\r\n\r\n if (this._usingMacOS && evt.metaKey && evt.key !== \"Meta\") {\r\n if (!this._metaKeys.includes(evt.keyCode)) {\r\n this._metaKeys.push(evt.keyCode);\r\n }\r\n }\r\n\r\n this._onInputChanged(DeviceType.Keyboard, 0, deviceEvent);\r\n }\r\n };\r\n\r\n this._keyboardUpEvent = (evt) => {\r\n if (!this._keyboardActive) {\r\n this._keyboardActive = true;\r\n this._registerDevice(DeviceType.Keyboard, 0, MAX_KEYCODES);\r\n }\r\n\r\n const kbKey = this._inputs[DeviceType.Keyboard][0];\r\n if (kbKey) {\r\n kbKey[evt.keyCode] = 0;\r\n\r\n const deviceEvent = evt as IUIEvent;\r\n deviceEvent.inputIndex = evt.keyCode;\r\n\r\n if (this._usingMacOS && evt.key === \"Meta\" && this._metaKeys.length > 0) {\r\n for (const keyCode of this._metaKeys) {\r\n const deviceEvent: IUIEvent = DeviceEventFactory.CreateDeviceEvent(DeviceType.Keyboard, 0, keyCode, 0, this, this._elementToAttachTo);\r\n kbKey[keyCode] = 0;\r\n this._onInputChanged(DeviceType.Keyboard, 0, deviceEvent);\r\n }\r\n this._metaKeys.splice(0, this._metaKeys.length);\r\n }\r\n\r\n this._onInputChanged(DeviceType.Keyboard, 0, deviceEvent);\r\n }\r\n };\r\n\r\n this._keyboardBlurEvent = () => {\r\n if (this._keyboardActive) {\r\n const kbKey = this._inputs[DeviceType.Keyboard][0];\r\n\r\n for (let i = 0; i < kbKey.length; i++) {\r\n if (kbKey[i] !== 0) {\r\n kbKey[i] = 0;\r\n\r\n const deviceEvent: IUIEvent = DeviceEventFactory.CreateDeviceEvent(DeviceType.Keyboard, 0, i, 0, this, this._elementToAttachTo);\r\n\r\n this._onInputChanged(DeviceType.Keyboard, 0, deviceEvent);\r\n }\r\n }\r\n if (this._usingMacOS) {\r\n this._metaKeys.splice(0, this._metaKeys.length);\r\n }\r\n }\r\n };\r\n\r\n this._elementToAttachTo.addEventListener(\"keydown\", this._keyboardDownEvent);\r\n this._elementToAttachTo.addEventListener(\"keyup\", this._keyboardUpEvent);\r\n this._elementToAttachTo.addEventListener(\"blur\", this._keyboardBlurEvent);\r\n }\r\n\r\n /**\r\n * Handle all actions that come from pointer interaction\r\n */\r\n private _handlePointerActions(): void {\r\n // If maxTouchPoints is defined, use that value. Otherwise, allow for a minimum for supported gestures like pinch\r\n this._maxTouchPoints = (IsNavigatorAvailable() && navigator.maxTouchPoints) || 2;\r\n if (!this._activeTouchIds) {\r\n this._activeTouchIds = new Array<number>(this._maxTouchPoints);\r\n }\r\n\r\n for (let i = 0; i < this._maxTouchPoints; i++) {\r\n this._activeTouchIds[i] = -1;\r\n }\r\n\r\n this._pointerMoveEvent = (evt) => {\r\n const deviceType = this._getPointerType(evt);\r\n let deviceSlot = deviceType === DeviceType.Mouse ? 0 : this._activeTouchIds.indexOf(evt.pointerId);\r\n\r\n // In the event that we're getting pointermove events from touch inputs that we aren't tracking,\r\n // look for an available slot and retroactively connect it.\r\n if (deviceType === DeviceType.Touch && deviceSlot === -1) {\r\n const idx = this._activeTouchIds.indexOf(-1);\r\n\r\n if (idx >= 0) {\r\n deviceSlot = idx;\r\n this._activeTouchIds[idx] = evt.pointerId;\r\n // Because this is a \"new\" input, inform the connected callback\r\n this._onDeviceConnected(deviceType, deviceSlot);\r\n } else {\r\n // We can't find an open slot to store new pointer so just return (can only support max number of touches)\r\n Tools.Warn(`Max number of touches exceeded. Ignoring touches in excess of ${this._maxTouchPoints}`);\r\n return;\r\n }\r\n }\r\n\r\n if (!this._inputs[deviceType]) {\r\n this._inputs[deviceType] = {};\r\n }\r\n\r\n if (!this._inputs[deviceType][deviceSlot]) {\r\n this._addPointerDevice(deviceType, deviceSlot, evt.clientX, evt.clientY);\r\n }\r\n\r\n const pointer = this._inputs[deviceType][deviceSlot];\r\n if (pointer) {\r\n const deviceEvent = evt as IPointerEvent;\r\n deviceEvent.inputIndex = PointerInput.Move;\r\n\r\n pointer[PointerInput.Horizontal] = evt.clientX;\r\n pointer[PointerInput.Vertical] = evt.clientY;\r\n\r\n // For touches that aren't started with a down, we need to set the button state to 1\r\n if (deviceType === DeviceType.Touch && pointer[PointerInput.LeftClick] === 0) {\r\n pointer[PointerInput.LeftClick] = 1;\r\n }\r\n\r\n if (evt.pointerId === undefined) {\r\n evt.pointerId = this._mouseId;\r\n }\r\n\r\n this._onInputChanged(deviceType, deviceSlot, deviceEvent);\r\n\r\n // Lets Propagate the event for move with same position.\r\n if (!this._usingSafari && evt.button !== -1) {\r\n deviceEvent.inputIndex = evt.button + 2;\r\n pointer[evt.button + 2] = pointer[evt.button + 2] ? 0 : 1; // Reverse state of button if evt.button has value\r\n this._onInputChanged(deviceType, deviceSlot, deviceEvent);\r\n }\r\n }\r\n };\r\n\r\n this._pointerDownEvent = (evt) => {\r\n const deviceType = this._getPointerType(evt);\r\n let deviceSlot = deviceType === DeviceType.Mouse ? 0 : evt.pointerId;\r\n\r\n if (deviceType === DeviceType.Touch) {\r\n // See if this pointerId is already using an existing slot\r\n // (possible on some devices which raise the pointerMove event before the pointerDown event, e.g. when using a pen)\r\n let idx = this._activeTouchIds.indexOf(evt.pointerId);\r\n if (idx === -1) {\r\n // If the pointerId wasn't already using a slot, find an open one\r\n idx = this._activeTouchIds.indexOf(-1);\r\n }\r\n\r\n if (idx >= 0) {\r\n deviceSlot = idx;\r\n this._activeTouchIds[idx] = evt.pointerId;\r\n } else {\r\n // We can't find an open slot to store new pointer so just return (can only support max number of touches)\r\n Tools.Warn(`Max number of touches exceeded. Ignoring touches in excess of ${this._maxTouchPoints}`);\r\n return;\r\n }\r\n }\r\n\r\n if (!this._inputs[deviceType]) {\r\n this._inputs[deviceType] = {};\r\n }\r\n\r\n if (!this._inputs[deviceType][deviceSlot]) {\r\n this._addPointerDevice(deviceType, deviceSlot, evt.clientX, evt.clientY);\r\n } else if (deviceType === DeviceType.Touch) {\r\n this._onDeviceConnected(deviceType, deviceSlot);\r\n }\r\n\r\n const pointer = this._inputs[deviceType][deviceSlot];\r\n if (pointer) {\r\n const previousHorizontal = pointer[PointerInput.Horizontal];\r\n const previousVertical = pointer[PointerInput.Vertical];\r\n\r\n if (deviceType === DeviceType.Mouse) {\r\n // Mouse; Set pointerId if undefined\r\n if (evt.pointerId === undefined) {\r\n evt.pointerId = this._mouseId;\r\n }\r\n\r\n if (!document.pointerLockElement) {\r\n try {\r\n this._elementToAttachTo.setPointerCapture(this._mouseId);\r\n } catch (e) {\r\n // DO NOTHING\r\n }\r\n }\r\n } else {\r\n // Touch; Since touches are dynamically assigned, only set capture if we have an id\r\n if (evt.pointerId && !document.pointerLockElement) {\r\n try {\r\n this._elementToAttachTo.setPointerCapture(evt.pointerId);\r\n } catch (e) {\r\n // DO NOTHING\r\n }\r\n }\r\n }\r\n\r\n pointer[PointerInput.Horizontal] = evt.clientX;\r\n pointer[PointerInput.Vertical] = evt.clientY;\r\n pointer[evt.button + 2] = 1;\r\n\r\n const deviceEvent = evt as IUIEvent;\r\n\r\n // NOTE: The +2 used here to is because PointerInput has the same value progression for its mouse buttons as PointerEvent.button\r\n // However, we have our X and Y values front-loaded to group together the touch inputs but not break this progression\r\n // EG. ([X, Y, Left-click], Middle-click, etc...)\r\n deviceEvent.inputIndex = evt.button + 2;\r\n\r\n this._onInputChanged(deviceType, deviceSlot, deviceEvent);\r\n\r\n if (previousHorizontal !== evt.clientX || previousVertical !== evt.clientY) {\r\n deviceEvent.inputIndex = PointerInput.Move;\r\n this._onInputChanged(deviceType, deviceSlot, deviceEvent);\r\n }\r\n }\r\n };\r\n\r\n this._pointerUpEvent = (evt) => {\r\n const deviceType = this._getPointerType(evt);\r\n const deviceSlot = deviceType === DeviceType.Mouse ? 0 : this._activeTouchIds.indexOf(evt.pointerId);\r\n\r\n if (deviceType === DeviceType.Touch) {\r\n // If we're getting a pointerup event for a touch that isn't active, just return.\r\n if (deviceSlot === -1) {\r\n return;\r\n } else {\r\n this._activeTouchIds[deviceSlot] = -1;\r\n }\r\n }\r\n\r\n const pointer = this._inputs[deviceType]?.[deviceSlot];\r\n if (pointer && pointer[evt.button + 2] !== 0) {\r\n const previousHorizontal = pointer[PointerInput.Horizontal];\r\n const previousVertical = pointer[PointerInput.Vertical];\r\n\r\n pointer[PointerInput.Horizontal] = evt.clientX;\r\n pointer[PointerInput.Vertical] = evt.clientY;\r\n pointer[evt.button + 2] = 0;\r\n\r\n const deviceEvent = evt as IUIEvent;\r\n\r\n if (evt.pointerId === undefined) {\r\n evt.pointerId = this._mouseId;\r\n }\r\n\r\n if (previousHorizontal !== evt.clientX || previousVertical !== evt.clientY) {\r\n deviceEvent.inputIndex = PointerInput.Move;\r\n this._onInputChanged(deviceType, deviceSlot, deviceEvent);\r\n }\r\n\r\n // NOTE: The +2 used here to is because PointerInput has the same value progression for its mouse buttons as PointerEvent.button\r\n // However, we have our X and Y values front-loaded to group together the touch inputs but not break this progression\r\n // EG. ([X, Y, Left-click], Middle-click, etc...)\r\n deviceEvent.inputIndex = evt.button + 2;\r\n\r\n if (deviceType === DeviceType.Mouse && this._mouseId >= 0 && this._elementToAttachTo.hasPointerCapture?.(this._mouseId)) {\r\n this._elementToAttachTo.releasePointerCapture(this._mouseId);\r\n } else if (evt.pointerId && this._elementToAttachTo.hasPointerCapture?.(evt.pointerId)) {\r\n this._elementToAttachTo.releasePointerCapture(evt.pointerId);\r\n }\r\n\r\n this._onInputChanged(deviceType, deviceSlot, deviceEvent);\r\n\r\n if (deviceType === DeviceType.Touch) {\r\n this._onDeviceDisconnected(deviceType, deviceSlot);\r\n }\r\n }\r\n };\r\n\r\n this._pointerCancelTouch = (pointerId: number) => {\r\n const deviceSlot = this._activeTouchIds.indexOf(pointerId);\r\n\r\n // If we're getting a pointercancel event for a touch that isn't active, just return\r\n if (deviceSlot === -1) {\r\n return;\r\n }\r\n\r\n if (this._elementToAttachTo.hasPointerCapture?.(pointerId)) {\r\n this._elementToAttachTo.releasePointerCapture(pointerId);\r\n }\r\n\r\n this._inputs[DeviceType.Touch][deviceSlot][PointerInput.LeftClick] = 0;\r\n\r\n const deviceEvent: IUIEvent = DeviceEventFactory.CreateDeviceEvent(DeviceType.Touch, deviceSlot, PointerInput.LeftClick, 0, this, this._elementToAttachTo, pointerId);\r\n\r\n this._onInputChanged(DeviceType.Touch, deviceSlot, deviceEvent);\r\n\r\n this._activeTouchIds[deviceSlot] = -1;\r\n this._onDeviceDisconnected(DeviceType.Touch, deviceSlot);\r\n };\r\n\r\n this._pointerCancelEvent = (evt) => {\r\n if (evt.pointerType === \"mouse\") {\r\n const pointer = this._inputs[DeviceType.Mouse][0];\r\n\r\n if (this._mouseId >= 0 && this._elementToAttachTo.hasPointerCapture?.(this._mouseId)) {\r\n this._elementToAttachTo.releasePointerCapture(this._mouseId);\r\n }\r\n\r\n for (let inputIndex = PointerInput.LeftClick; inputIndex <= PointerInput.BrowserForward; inputIndex++) {\r\n if (pointer[inputIndex] === 1) {\r\n pointer[inputIndex] = 0;\r\n\r\n const deviceEvent: IUIEvent = DeviceEventFactory.CreateDeviceEvent(DeviceType.Mouse, 0, inputIndex, 0, this, this._elementToAttachTo);\r\n\r\n this._onInputChanged(DeviceType.Mouse, 0, deviceEvent);\r\n }\r\n }\r\n } else {\r\n this._pointerCancelTouch(evt.pointerId);\r\n }\r\n };\r\n\r\n this._pointerLeaveEvent = (evt) => {\r\n if (evt.pointerType === \"pen\") {\r\n // If a pen leaves the hover range detectible by the hardware this event is raised and we need to cancel the operation\r\n // Note that pen operations are treated as touch operations\r\n this._pointerCancelTouch(evt.pointerId);\r\n }\r\n };\r\n\r\n // Set Wheel Event Name, code originally from scene.inputManager\r\n this._wheelEventName =\r\n \"onwheel\" in document.createElement(\"div\")\r\n ? \"wheel\" // Modern browsers support \"wheel\"\r\n : (<any>document).onmousewheel !== undefined\r\n ? \"mousewheel\" // Webkit and IE support at least \"mousewheel\"\r\n : \"DOMMouseScroll\"; // let's assume that remaining browsers are older Firefox\r\n\r\n // Code originally in scene.inputManager.ts\r\n // Chrome reports warning in console if wheel listener doesn't set an explicit passive option.\r\n // IE11 only supports captureEvent:boolean, not options:object, and it defaults to false.\r\n // Feature detection technique copied from: https://github.com/github/eventlistener-polyfill (MIT license)\r\n let passiveSupported = false;\r\n const noop = function () {};\r\n\r\n try {\r\n const options = Object.defineProperty({}, \"passive\", {\r\n get: function () {\r\n passiveSupported = true;\r\n },\r\n });\r\n\r\n this._elementToAttachTo.addEventListener(\"test\", noop, options);\r\n this._elementToAttachTo.removeEventListener(\"test\", noop, options);\r\n } catch (e) {\r\n /* */\r\n }\r\n\r\n this._pointerBlurEvent = () => {\r\n // Handle mouse buttons\r\n if (this.isDeviceAvailable(DeviceType.Mouse)) {\r\n const pointer = this._inputs[DeviceType.Mouse][0];\r\n\r\n if (this._mouseId >= 0 && this._elementToAttachTo.hasPointerCapture?.(this._mouseId)) {\r\n this._elementToAttachTo.releasePointerCapture(this._mouseId);\r\n }\r\n\r\n for (let inputIndex = PointerInput.LeftClick; inputIndex <= PointerInput.BrowserForward; inputIndex++) {\r\n if (pointer[inputIndex] === 1) {\r\n pointer[inputIndex] = 0;\r\n\r\n const deviceEvent: IUIEvent = DeviceEventFactory.CreateDeviceEvent(DeviceType.Mouse, 0, inputIndex, 0, this, this._elementToAttachTo);\r\n\r\n this._onInputChanged(DeviceType.Mouse, 0, deviceEvent);\r\n }\r\n }\r\n }\r\n\r\n // Handle Active Touches\r\n if (this.isDeviceAvailable(DeviceType.Touch)) {\r\n const pointer = this._inputs[DeviceType.Touch];\r\n\r\n for (let deviceSlot = 0; deviceSlot < this._activeTouchIds.length; deviceSlot++) {\r\n const pointerId = this._activeTouchIds[deviceSlot];\r\n\r\n if (this._elementToAttachTo.hasPointerCapture?.(pointerId)) {\r\n this._elementToAttachTo.releasePointerCapture(pointerId);\r\n }\r\n\r\n if (pointerId !== -1 && pointer[deviceSlot]?.[PointerInput.LeftClick] === 1) {\r\n pointer[deviceSlot][PointerInput.LeftClick] = 0;\r\n\r\n const deviceEvent: IUIEvent = DeviceEventFactory.CreateDeviceEvent(\r\n DeviceType.Touch,\r\n deviceSlot,\r\n PointerInput.LeftClick,\r\n 0,\r\n this,\r\n this._elementToAttachTo,\r\n pointerId\r\n );\r\n\r\n this._onInputChanged(DeviceType.Touch, deviceSlot, deviceEvent);\r\n\r\n this._activeTouchIds[deviceSlot] = -1;\r\n this._onDeviceDisconnected(DeviceType.Touch, deviceSlot);\r\n }\r\n }\r\n }\r\n };\r\n\r\n this._pointerWheelEvent = (evt) => {\r\n const deviceType = DeviceType.Mouse;\r\n const deviceSlot = 0;\r\n\r\n if (!this._inputs[deviceType]) {\r\n this._inputs[deviceType] = [];\r\n }\r\n\r\n if (!this._inputs[deviceType][deviceSlot]) {\r\n this._pointerActive = true;\r\n this._registerDevice(deviceType, deviceSlot, MAX_POINTER_INPUTS);\r\n }\r\n\r\n const pointer = this._inputs[deviceType][deviceSlot];\r\n if (pointer) {\r\n pointer[PointerInput.MouseWheelX] = evt.deltaX || 0;\r\n pointer[PointerInput.MouseWheelY] = evt.deltaY || evt.wheelDelta || 0;\r\n pointer[PointerInput.MouseWheelZ] = evt.deltaZ || 0;\r\n\r\n const deviceEvent = evt as IUIEvent;\r\n // By default, there is no pointerId for mouse wheel events so we'll add one here\r\n // This logic was originally in the InputManager but was added here to make the\r\n // InputManager more platform-agnostic\r\n if (evt.pointerId === undefined) {\r\n evt.pointerId = this._mouseId;\r\n }\r\n\r\n if (pointer[PointerInput.MouseWheelX] !== 0) {\r\n deviceEvent.inputIndex = PointerInput.MouseWheelX;\r\n this._onInputChanged(deviceType, deviceSlot, deviceEvent);\r\n }\r\n if (pointer[PointerInput.MouseWheelY] !== 0) {\r\n deviceEvent.inputIndex = PointerInput.MouseWheelY;\r\n this._onInputChanged(deviceType, deviceSlot, deviceEvent);\r\n }\r\n if (pointer[PointerInput.MouseWheelZ] !== 0) {\r\n deviceEvent.inputIndex = PointerInput.MouseWheelZ;\r\n this._onInputChanged(deviceType, deviceSlot, deviceEvent);\r\n }\r\n }\r\n };\r\n\r\n // Workaround for MacOS Chromium Browsers for lost pointer capture bug\r\n if (this._usingMacOS && this._isUsingChromium) {\r\n this._pointerMacOSChromeOutEvent = (evt) => {\r\n if (evt.buttons > 1) {\r\n this._pointerCancelEvent(evt);\r\n }\r\n };\r\n this._elementToAttachTo.addEventListener(\"lostpointercapture\", this._pointerMacOSChromeOutEvent);\r\n }\r\n\r\n this._elementToAttachTo.addEventListener(this._eventPrefix + \"move\", this._pointerMoveEvent);\r\n this._elementToAttachTo.addEventListener(this._eventPrefix + \"down\", this._pointerDownEvent);\r\n this._elementToAttachTo.addEventListener(this._eventPrefix + \"up\", this._pointerUpEvent);\r\n this._elementToAttachTo.addEventListener(this._eventPrefix + \"cancel\", this._pointerCancelEvent);\r\n this._elementToAttachTo.addEventListener(this._eventPrefix + \"leave\", this._pointerLeaveEvent);\r\n this._elementToAttachTo.addEventListener(\"blur\", this._pointerBlurEvent);\r\n this._elementToAttachTo.addEventListener(this._wheelEventName, this._pointerWheelEvent, passiveSupported ? { passive: false } : false);\r\n\r\n // Since there's no up or down event for mouse wheel or delta x/y, clear mouse values at end of frame\r\n this._pointerInputClearObserver = this._engine.onEndFrameObservable.add(() => {\r\n if (this.isDeviceAvailable(DeviceType.Mouse)) {\r\n const pointer = this._inputs[DeviceType.Mouse][0];\r\n pointer[PointerInput.MouseWheelX] = 0;\r\n pointer[PointerInput.MouseWheelY] = 0;\r\n pointer[PointerInput.MouseWheelZ] = 0;\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Handle all actions that come from gamepad interaction\r\n */\r\n private _handleGamepadActions(): void {\r\n this._gamepadConnectedEvent = (evt: any) => {\r\n this._addGamePad(evt.gamepad);\r\n };\r\n\r\n this._gamepadDisconnectedEvent = (evt: any) => {\r\n if (this._gamepads) {\r\n const deviceType = this._getGamepadDeviceType(evt.gamepad.id);\r\n const deviceSlot = evt.gamepad.index;\r\n\r\n this._unregisterDevice(deviceType, deviceSlot);\r\n delete this._gamepads[deviceSlot];\r\n }\r\n };\r\n\r\n window.addEventListener(\"gamepadconnected\", this._gamepadConnectedEvent);\r\n window.addEventListener(\"gamepaddisconnected\", this._gamepadDisconnectedEvent);\r\n }\r\n\r\n /**\r\n * Update all non-event based devices with each frame\r\n * @param deviceType Enum specifying device type\r\n * @param deviceSlot \"Slot\" or index that device is referenced in\r\n * @param inputIndex Id of input to be checked\r\n */\r\n private _updateDevice(deviceType: DeviceType, deviceSlot: number, inputIndex: number): void {\r\n // Gamepads\r\n const gp = navigator.getGamepads()[deviceSlot];\r\n\r\n if (gp && deviceType === this._gamepads[deviceSlot]) {\r\n const device = this._inputs[deviceType][deviceSlot];\r\n\r\n if (inputIndex >= gp.buttons.length) {\r\n device[inputIndex] = gp.axes[inputIndex - gp.buttons.length].valueOf();\r\n } else {\r\n device[inputIndex] = gp.buttons[inputIndex].value;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Gets DeviceType from the device name\r\n * @param deviceName Name of Device from DeviceInputSystem\r\n * @returns DeviceType enum value\r\n */\r\n private _getGamepadDeviceType(deviceName: string): DeviceType {\r\n if (deviceName.indexOf(\"054c\") !== -1) {\r\n // DualShock 4 Gamepad\r\n return deviceName.indexOf(\"0ce6\") !== -1 ? DeviceType.DualSense : DeviceType.DualShock;\r\n } else if (deviceName.indexOf(\"Xbox One\") !== -1 || deviceName.search(\"Xbox 360\") !== -1 || deviceName.search(\"xinput\") !== -1) {\r\n // Xbox Gamepad\r\n return DeviceType.Xbox;\r\n } else if (deviceName.indexOf(\"057e\") !== -1) {\r\n // Switch Gamepad\r\n return DeviceType.Switch;\r\n }\r\n\r\n return DeviceType.Generic;\r\n }\r\n\r\n /**\r\n * Get DeviceType from a given pointer/mouse/touch event.\r\n * @param evt PointerEvent to evaluate\r\n * @returns DeviceType interpreted from event\r\n */\r\n private _getPointerType(evt: any): DeviceType {\r\n let deviceType = DeviceType.Mouse;\r\n\r\n if (evt.pointerType === \"touch\" || evt.pointerType === \"pen\" || evt.touches) {\r\n deviceType = DeviceType.Touch;\r\n }\r\n\r\n return deviceType;\r\n }\r\n}\r\n"]}
|
|
@@ -201,6 +201,10 @@ ThinEngine.prototype.createRawCubeTextureFromUrl = function (url, scene, size, f
|
|
|
201
201
|
}
|
|
202
202
|
};
|
|
203
203
|
const internalCallback = (data) => {
|
|
204
|
+
// If the texture has been disposed
|
|
205
|
+
if (!texture._hardwareTexture) {
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
204
208
|
const width = texture.width;
|
|
205
209
|
const faceDataArrays = callback(data);
|
|
206
210
|
if (!faceDataArrays) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine.rawTexture.js","sourceRoot":"","sources":["../../../../../dev/core/src/Engines/Extensions/engine.rawTexture.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAyB,MAAM,0CA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C,OAAO,GAAG,IAAI,CAAC;IAC3B,CAAC,CAAC;AACN,CAAC;AAED,UAAU,CAAC,SAAS,CAAC,uBAAuB,GAAG,6BAA6B,CAAC,KAAK,CAAC,CAAC;AACpF,UAAU,CAAC,SAAS,CAAC,kBAAkB,GAAG,6BAA6B,CAAC,IAAI,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"../../types\";\r\nimport { InternalTexture, InternalTextureSource } from \"../../Materials/Textures/internalTexture\";\r\nimport { Logger } from \"../../Misc/logger\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { Constants } from \"../constants\";\r\nimport { ThinEngine } from \"../thinEngine\";\r\nimport type { IWebRequest } from \"../../Misc/interfaces/iWebRequest\";\r\nimport { IsExponentOfTwo } from \"../../Misc/tools.functions\";\r\n\r\ndeclare module \"../abstractEngine\" {\r\n export interface AbstractEngine {\r\n /**\r\n * Update a raw texture\r\n * @param texture defines the texture to update\r\n * @param data defines the data to store in the texture\r\n * @param format defines the format of the data\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n */\r\n updateRawTexture(texture: Nullable<InternalTexture>, data: Nullable<ArrayBufferView>, format: number, invertY: boolean): void;\r\n\r\n /**\r\n * Update a raw texture\r\n * @param texture defines the texture to update\r\n * @param data defines the data to store in the texture\r\n * @param format defines the format of the data\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param compression defines the compression used (null by default)\r\n * @param type defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_BYTE by default)\r\n * @param useSRGBBuffer defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU).\r\n */\r\n updateRawTexture(\r\n texture: Nullable<InternalTexture>,\r\n data: Nullable<ArrayBufferView>,\r\n format: number,\r\n invertY: boolean,\r\n compression: Nullable<string>,\r\n type: number,\r\n useSRGBBuffer: boolean\r\n ): void;\r\n /**\r\n * Update a raw cube texture\r\n * @param texture defines the texture to update\r\n * @param data defines the data to store\r\n * @param format defines the data format\r\n * @param type defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_BYTE by default)\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n */\r\n updateRawCubeTexture(texture: InternalTexture, data: ArrayBufferView[], format: number, type: number, invertY: boolean): void;\r\n\r\n /**\r\n * Update a raw cube texture\r\n * @param texture defines the texture to update\r\n * @param data defines the data to store\r\n * @param format defines the data format\r\n * @param type defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_BYTE by default)\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param compression defines the compression used (null by default)\r\n */\r\n updateRawCubeTexture(texture: InternalTexture, data: ArrayBufferView[], format: number, type: number, invertY: boolean, compression: Nullable<string>): void;\r\n\r\n /**\r\n * Update a raw cube texture\r\n * @param texture defines the texture to update\r\n * @param data defines the data to store\r\n * @param format defines the data format\r\n * @param type defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_BYTE by default)\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param compression defines the compression used (null by default)\r\n * @param level defines which level of the texture to update\r\n */\r\n updateRawCubeTexture(texture: InternalTexture, data: ArrayBufferView[], format: number, type: number, invertY: boolean, compression: Nullable<string>, level: number): void;\r\n\r\n /**\r\n * Creates a new raw cube texture from a specified url\r\n * @param url defines the url where the data is located\r\n * @param scene defines the current scene\r\n * @param size defines the size of the textures\r\n * @param format defines the format of the data\r\n * @param type defines the type fo the data (like Engine.TEXTURETYPE_UNSIGNED_BYTE)\r\n * @param noMipmap defines if the engine should avoid generating the mip levels\r\n * @param callback defines a callback used to extract texture data from loaded data\r\n * @param mipmapGenerator defines to provide an optional tool to generate mip levels\r\n * @param onLoad defines a callback called when texture is loaded\r\n * @param onError defines a callback called if there is an error\r\n * @returns the cube texture as an InternalTexture\r\n */\r\n createRawCubeTextureFromUrl(\r\n url: string,\r\n scene: Nullable<Scene>,\r\n size: number,\r\n format: number,\r\n type: number,\r\n noMipmap: boolean,\r\n callback: (ArrayBuffer: ArrayBuffer) => Nullable<ArrayBufferView[]>,\r\n mipmapGenerator: Nullable<(faces: ArrayBufferView[]) => ArrayBufferView[][]>,\r\n onLoad: Nullable<() => void>,\r\n onError: Nullable<(message?: string, exception?: any) => void>\r\n ): InternalTexture;\r\n\r\n /**\r\n * Creates a new raw cube texture from a specified url\r\n * @param url defines the url where the data is located\r\n * @param scene defines the current scene\r\n * @param size defines the size of the textures\r\n * @param format defines the format of the data\r\n * @param type defines the type fo the data (like Engine.TEXTURETYPE_UNSIGNED_BYTE)\r\n * @param noMipmap defines if the engine should avoid generating the mip levels\r\n * @param callback defines a callback used to extract texture data from loaded data\r\n * @param mipmapGenerator defines to provide an optional tool to generate mip levels\r\n * @param onLoad defines a callback called when texture is loaded\r\n * @param onError defines a callback called if there is an error\r\n * @param samplingMode defines the required sampling mode (like Texture.NEAREST_SAMPLINGMODE)\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @returns the cube texture as an InternalTexture\r\n */\r\n createRawCubeTextureFromUrl(\r\n url: string,\r\n scene: Nullable<Scene>,\r\n size: number,\r\n format: number,\r\n type: number,\r\n noMipmap: boolean,\r\n callback: (ArrayBuffer: ArrayBuffer) => Nullable<ArrayBufferView[]>,\r\n mipmapGenerator: Nullable<(faces: ArrayBufferView[]) => ArrayBufferView[][]>,\r\n onLoad: Nullable<() => void>,\r\n onError: Nullable<(message?: string, exception?: any) => void>,\r\n samplingMode: number,\r\n invertY: boolean\r\n ): InternalTexture;\r\n\r\n /**\r\n * Update a raw 3D texture\r\n * @param texture defines the texture to update\r\n * @param data defines the data to store\r\n * @param format defines the data format\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n */\r\n updateRawTexture3D(texture: InternalTexture, data: Nullable<ArrayBufferView>, format: number, invertY: boolean): void;\r\n\r\n /**\r\n * Update a raw 3D texture\r\n * @param texture defines the texture to update\r\n * @param data defines the data to store\r\n * @param format defines the data format\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param compression defines the used compression (can be null)\r\n * @param textureType defines the texture Type (Engine.TEXTURETYPE_UNSIGNED_BYTE, Engine.TEXTURETYPE_FLOAT...)\r\n */\r\n updateRawTexture3D(texture: InternalTexture, data: Nullable<ArrayBufferView>, format: number, invertY: boolean, compression: Nullable<string>, textureType: number): void;\r\n\r\n /**\r\n * Update a raw 2D array texture\r\n * @param texture defines the texture to update\r\n * @param data defines the data to store\r\n * @param format defines the data format\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n */\r\n updateRawTexture2DArray(texture: InternalTexture, data: Nullable<ArrayBufferView>, format: number, invertY: boolean): void;\r\n\r\n /**\r\n * Update a raw 2D array texture\r\n * @param texture defines the texture to update\r\n * @param data defines the data to store\r\n * @param format defines the data format\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param compression defines the used compression (can be null)\r\n * @param textureType defines the texture Type (Engine.TEXTURETYPE_UNSIGNED_BYTE, Engine.TEXTURETYPE_FLOAT...)\r\n */\r\n updateRawTexture2DArray(\r\n texture: InternalTexture,\r\n data: Nullable<ArrayBufferView>,\r\n format: number,\r\n invertY: boolean,\r\n compression: Nullable<string>,\r\n textureType: number\r\n ): void;\r\n }\r\n}\r\n\r\nThinEngine.prototype.updateRawTexture = function (\r\n texture: Nullable<InternalTexture>,\r\n data: Nullable<ArrayBufferView>,\r\n format: number,\r\n invertY: boolean,\r\n compression: Nullable<string> = null,\r\n type: number = Constants.TEXTURETYPE_UNSIGNED_BYTE,\r\n useSRGBBuffer: boolean = false\r\n): void {\r\n if (!texture) {\r\n return;\r\n }\r\n // Babylon's internalSizedFomat but gl's texImage2D internalFormat\r\n const internalSizedFomat = this._getRGBABufferInternalSizedFormat(type, format, useSRGBBuffer);\r\n\r\n // Babylon's internalFormat but gl's texImage2D format\r\n const internalFormat = this._getInternalFormat(format);\r\n const textureType = this._getWebGLTextureType(type);\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, texture, true);\r\n this._unpackFlipY(invertY === undefined ? true : invertY ? true : false);\r\n\r\n if (!this._doNotHandleContextLost) {\r\n texture._bufferView = data;\r\n texture.format = format;\r\n texture.type = type;\r\n texture.invertY = invertY;\r\n texture._compression = compression;\r\n }\r\n\r\n if (texture.width % 4 !== 0) {\r\n this._gl.pixelStorei(this._gl.UNPACK_ALIGNMENT, 1);\r\n }\r\n\r\n if (compression && data) {\r\n this._gl.compressedTexImage2D(this._gl.TEXTURE_2D, 0, (<any>this.getCaps().s3tc)[compression], texture.width, texture.height, 0, <DataView>data);\r\n } else {\r\n this._gl.texImage2D(this._gl.TEXTURE_2D, 0, internalSizedFomat, texture.width, texture.height, 0, internalFormat, textureType, data);\r\n }\r\n\r\n if (texture.generateMipMaps) {\r\n this._gl.generateMipmap(this._gl.TEXTURE_2D);\r\n }\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, null);\r\n // this.resetTextureCache();\r\n texture.isReady = true;\r\n};\r\n\r\nThinEngine.prototype.createRawTexture = function (\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n format: number,\r\n generateMipMaps: boolean,\r\n invertY: boolean,\r\n samplingMode: number,\r\n compression: Nullable<string> = null,\r\n type: number = Constants.TEXTURETYPE_UNSIGNED_BYTE,\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n creationFlags = 0,\r\n useSRGBBuffer = false\r\n): InternalTexture {\r\n const texture = new InternalTexture(this, InternalTextureSource.Raw);\r\n texture.baseWidth = width;\r\n texture.baseHeight = height;\r\n texture.width = width;\r\n texture.height = height;\r\n texture.format = format;\r\n texture.generateMipMaps = generateMipMaps;\r\n texture.samplingMode = samplingMode;\r\n texture.invertY = invertY;\r\n texture._compression = compression;\r\n texture.type = type;\r\n texture._useSRGBBuffer = this._getUseSRGBBuffer(useSRGBBuffer, !generateMipMaps);\r\n\r\n if (!this._doNotHandleContextLost) {\r\n texture._bufferView = data;\r\n }\r\n\r\n this.updateRawTexture(texture, data, format, invertY, compression, type, texture._useSRGBBuffer);\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, texture, true);\r\n\r\n // Filters\r\n const filters = this._getSamplingParameters(samplingMode, generateMipMaps);\r\n\r\n this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MAG_FILTER, filters.mag);\r\n this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MIN_FILTER, filters.min);\r\n\r\n if (generateMipMaps) {\r\n this._gl.generateMipmap(this._gl.TEXTURE_2D);\r\n }\r\n\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, null);\r\n\r\n this._internalTexturesCache.push(texture);\r\n\r\n return texture;\r\n};\r\n\r\nThinEngine.prototype.createRawCubeTexture = function (\r\n data: Nullable<ArrayBufferView[]>,\r\n size: number,\r\n format: number,\r\n type: number,\r\n generateMipMaps: boolean,\r\n invertY: boolean,\r\n samplingMode: number,\r\n compression: Nullable<string> = null\r\n): InternalTexture {\r\n const gl = this._gl;\r\n const texture = new InternalTexture(this, InternalTextureSource.CubeRaw);\r\n texture.isCube = true;\r\n texture.format = format;\r\n texture.type = type;\r\n if (!this._doNotHandleContextLost) {\r\n texture._bufferViewArray = data;\r\n }\r\n\r\n const textureType = this._getWebGLTextureType(type);\r\n let internalFormat = this._getInternalFormat(format);\r\n\r\n if (internalFormat === gl.RGB) {\r\n internalFormat = gl.RGBA;\r\n }\r\n\r\n // Mipmap generation needs a sized internal format that is both color-renderable and texture-filterable\r\n if (textureType === gl.FLOAT && !this._caps.textureFloatLinearFiltering) {\r\n generateMipMaps = false;\r\n samplingMode = Constants.TEXTURE_NEAREST_SAMPLINGMODE;\r\n Logger.Warn(\"Float texture filtering is not supported. Mipmap generation and sampling mode are forced to false and TEXTURE_NEAREST_SAMPLINGMODE, respectively.\");\r\n } else if (textureType === this._gl.HALF_FLOAT_OES && !this._caps.textureHalfFloatLinearFiltering) {\r\n generateMipMaps = false;\r\n samplingMode = Constants.TEXTURE_NEAREST_SAMPLINGMODE;\r\n Logger.Warn(\"Half float texture filtering is not supported. Mipmap generation and sampling mode are forced to false and TEXTURE_NEAREST_SAMPLINGMODE, respectively.\");\r\n } else if (textureType === gl.FLOAT && !this._caps.textureFloatRender) {\r\n generateMipMaps = false;\r\n Logger.Warn(\"Render to float textures is not supported. Mipmap generation forced to false.\");\r\n } else if (textureType === gl.HALF_FLOAT && !this._caps.colorBufferFloat) {\r\n generateMipMaps = false;\r\n Logger.Warn(\"Render to half float textures is not supported. Mipmap generation forced to false.\");\r\n }\r\n\r\n const width = size;\r\n const height = width;\r\n\r\n texture.width = width;\r\n texture.height = height;\r\n texture.invertY = invertY;\r\n texture._compression = compression;\r\n\r\n // Double check on POT to generate Mips.\r\n const isPot = !this.needPOTTextures || (IsExponentOfTwo(texture.width) && IsExponentOfTwo(texture.height));\r\n if (!isPot) {\r\n generateMipMaps = false;\r\n }\r\n\r\n // Upload data if needed. The texture won't be ready until then.\r\n if (data) {\r\n this.updateRawCubeTexture(texture, data, format, type, invertY, compression);\r\n } else {\r\n const internalSizedFomat = this._getRGBABufferInternalSizedFormat(type);\r\n const level = 0;\r\n\r\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true);\r\n\r\n for (let faceIndex = 0; faceIndex < 6; faceIndex++) {\r\n if (compression) {\r\n gl.compressedTexImage2D(\r\n gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex,\r\n level,\r\n (<any>this.getCaps().s3tc)[compression],\r\n texture.width,\r\n texture.height,\r\n 0,\r\n undefined as any\r\n );\r\n } else {\r\n gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, level, internalSizedFomat, texture.width, texture.height, 0, internalFormat, textureType, null);\r\n }\r\n }\r\n\r\n this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null);\r\n }\r\n\r\n this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, texture, true);\r\n\r\n // Filters\r\n if (data && generateMipMaps) {\r\n this._gl.generateMipmap(this._gl.TEXTURE_CUBE_MAP);\r\n }\r\n\r\n const filters = this._getSamplingParameters(samplingMode, generateMipMaps);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, filters.mag);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, filters.min);\r\n\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\r\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, null);\r\n\r\n texture.generateMipMaps = generateMipMaps;\r\n texture.samplingMode = samplingMode;\r\n texture.isReady = true;\r\n\r\n return texture;\r\n};\r\n\r\nThinEngine.prototype.updateRawCubeTexture = function (\r\n texture: InternalTexture,\r\n data: ArrayBufferView[],\r\n format: number,\r\n type: number,\r\n invertY: boolean,\r\n compression: Nullable<string> = null,\r\n level: number = 0\r\n): void {\r\n texture._bufferViewArray = data;\r\n texture.format = format;\r\n texture.type = type;\r\n texture.invertY = invertY;\r\n texture._compression = compression;\r\n\r\n const gl = this._gl;\r\n const textureType = this._getWebGLTextureType(type);\r\n let internalFormat = this._getInternalFormat(format);\r\n const internalSizedFomat = this._getRGBABufferInternalSizedFormat(type);\r\n\r\n let needConversion = false;\r\n if (internalFormat === gl.RGB) {\r\n internalFormat = gl.RGBA;\r\n needConversion = true;\r\n }\r\n\r\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true);\r\n this._unpackFlipY(invertY === undefined ? true : invertY ? true : false);\r\n\r\n if (texture.width % 4 !== 0) {\r\n gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1);\r\n }\r\n\r\n // Data are known to be in +X +Y +Z -X -Y -Z\r\n for (let faceIndex = 0; faceIndex < 6; faceIndex++) {\r\n let faceData = data[faceIndex];\r\n\r\n if (compression) {\r\n gl.compressedTexImage2D(\r\n gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex,\r\n level,\r\n (<any>this.getCaps().s3tc)[compression],\r\n texture.width,\r\n texture.height,\r\n 0,\r\n <DataView>faceData\r\n );\r\n } else {\r\n if (needConversion) {\r\n faceData = _convertRGBtoRGBATextureData(faceData, texture.width, texture.height, type);\r\n }\r\n gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, level, internalSizedFomat, texture.width, texture.height, 0, internalFormat, textureType, faceData);\r\n }\r\n }\r\n\r\n const isPot = !this.needPOTTextures || (IsExponentOfTwo(texture.width) && IsExponentOfTwo(texture.height));\r\n if (isPot && texture.generateMipMaps && level === 0) {\r\n this._gl.generateMipmap(this._gl.TEXTURE_CUBE_MAP);\r\n }\r\n this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null);\r\n\r\n // this.resetTextureCache();\r\n texture.isReady = true;\r\n};\r\n\r\nThinEngine.prototype.createRawCubeTextureFromUrl = function (\r\n url: string,\r\n scene: Nullable<Scene>,\r\n size: number,\r\n format: number,\r\n type: number,\r\n noMipmap: boolean,\r\n callback: (ArrayBuffer: ArrayBuffer) => Nullable<ArrayBufferView[]>,\r\n mipmapGenerator: Nullable<(faces: ArrayBufferView[]) => ArrayBufferView[][]>,\r\n onLoad: Nullable<() => void> = null,\r\n onError: Nullable<(message?: string, exception?: any) => void> = null,\r\n samplingMode: number = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE,\r\n invertY: boolean = false\r\n): InternalTexture {\r\n const gl = this._gl;\r\n const texture = this.createRawCubeTexture(null, size, format, type, !noMipmap, invertY, samplingMode, null);\r\n scene?.addPendingData(texture);\r\n texture.url = url;\r\n texture.isReady = false;\r\n this._internalTexturesCache.push(texture);\r\n\r\n const onerror = (request?: IWebRequest, exception?: any) => {\r\n scene?.removePendingData(texture);\r\n if (onError && request) {\r\n onError(request.status + \" \" + request.statusText, exception);\r\n }\r\n };\r\n\r\n const internalCallback = (data: any) => {\r\n const width = texture.width;\r\n const faceDataArrays = callback(data);\r\n\r\n if (!faceDataArrays) {\r\n return;\r\n }\r\n\r\n if (mipmapGenerator) {\r\n const textureType = this._getWebGLTextureType(type);\r\n let internalFormat = this._getInternalFormat(format);\r\n const internalSizedFomat = this._getRGBABufferInternalSizedFormat(type);\r\n\r\n let needConversion = false;\r\n if (internalFormat === gl.RGB) {\r\n internalFormat = gl.RGBA;\r\n needConversion = true;\r\n }\r\n\r\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true);\r\n this._unpackFlipY(false);\r\n\r\n const mipData = mipmapGenerator(faceDataArrays);\r\n for (let level = 0; level < mipData.length; level++) {\r\n const mipSize = width >> level;\r\n\r\n for (let faceIndex = 0; faceIndex < 6; faceIndex++) {\r\n let mipFaceData = mipData[level][faceIndex];\r\n if (needConversion) {\r\n mipFaceData = _convertRGBtoRGBATextureData(mipFaceData, mipSize, mipSize, type);\r\n }\r\n gl.texImage2D(faceIndex, level, internalSizedFomat, mipSize, mipSize, 0, internalFormat, textureType, mipFaceData);\r\n }\r\n }\r\n\r\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, null);\r\n } else {\r\n this.updateRawCubeTexture(texture, faceDataArrays, format, type, invertY);\r\n }\r\n\r\n texture.isReady = true;\r\n // this.resetTextureCache();\r\n scene?.removePendingData(texture);\r\n\r\n texture.onLoadedObservable.notifyObservers(texture);\r\n texture.onLoadedObservable.clear();\r\n\r\n if (onLoad) {\r\n onLoad();\r\n }\r\n };\r\n\r\n this._loadFile(\r\n url,\r\n (data) => {\r\n internalCallback(data);\r\n },\r\n undefined,\r\n scene?.offlineProvider,\r\n true,\r\n onerror\r\n );\r\n\r\n return texture;\r\n};\r\n\r\n/**\r\n * @internal\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nfunction _convertRGBtoRGBATextureData(rgbData: any, width: number, height: number, textureType: number): ArrayBufferView {\r\n // Create new RGBA data container.\r\n let rgbaData: any;\r\n let val1 = 1;\r\n if (textureType === Constants.TEXTURETYPE_FLOAT) {\r\n rgbaData = new Float32Array(width * height * 4);\r\n } else if (textureType === Constants.TEXTURETYPE_HALF_FLOAT) {\r\n rgbaData = new Uint16Array(width * height * 4);\r\n val1 = 15360; // 15360 is the encoding of 1 in half float\r\n } else if (textureType === Constants.TEXTURETYPE_UNSIGNED_INTEGER) {\r\n rgbaData = new Uint32Array(width * height * 4);\r\n } else {\r\n rgbaData = new Uint8Array(width * height * 4);\r\n }\r\n\r\n // Convert each pixel.\r\n for (let x = 0; x < width; x++) {\r\n for (let y = 0; y < height; y++) {\r\n const index = (y * width + x) * 3;\r\n const newIndex = (y * width + x) * 4;\r\n\r\n // Map Old Value to new value.\r\n rgbaData[newIndex + 0] = rgbData[index + 0];\r\n rgbaData[newIndex + 1] = rgbData[index + 1];\r\n rgbaData[newIndex + 2] = rgbData[index + 2];\r\n\r\n // Add fully opaque alpha channel.\r\n rgbaData[newIndex + 3] = val1;\r\n }\r\n }\r\n\r\n return rgbaData;\r\n}\r\n\r\n/**\r\n * Create a function for createRawTexture3D/createRawTexture2DArray\r\n * @param is3D true for TEXTURE_3D and false for TEXTURE_2D_ARRAY\r\n * @internal\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nfunction _makeCreateRawTextureFunction(is3D: boolean) {\r\n return function (\r\n this: ThinEngine,\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n depth: number,\r\n format: number,\r\n generateMipMaps: boolean,\r\n invertY: boolean,\r\n samplingMode: number,\r\n compression: Nullable<string> = null,\r\n textureType: number = Constants.TEXTURETYPE_UNSIGNED_BYTE\r\n ): InternalTexture {\r\n const target = is3D ? this._gl.TEXTURE_3D : this._gl.TEXTURE_2D_ARRAY;\r\n const source = is3D ? InternalTextureSource.Raw3D : InternalTextureSource.Raw2DArray;\r\n const texture = new InternalTexture(this, source);\r\n texture.baseWidth = width;\r\n texture.baseHeight = height;\r\n texture.baseDepth = depth;\r\n texture.width = width;\r\n texture.height = height;\r\n texture.depth = depth;\r\n texture.format = format;\r\n texture.type = textureType;\r\n texture.generateMipMaps = generateMipMaps;\r\n texture.samplingMode = samplingMode;\r\n if (is3D) {\r\n texture.is3D = true;\r\n } else {\r\n texture.is2DArray = true;\r\n }\r\n\r\n if (!this._doNotHandleContextLost) {\r\n texture._bufferView = data;\r\n }\r\n\r\n if (is3D) {\r\n this.updateRawTexture3D(texture, data, format, invertY, compression, textureType);\r\n } else {\r\n this.updateRawTexture2DArray(texture, data, format, invertY, compression, textureType);\r\n }\r\n this._bindTextureDirectly(target, texture, true);\r\n\r\n // Filters\r\n const filters = this._getSamplingParameters(samplingMode, generateMipMaps);\r\n\r\n this._gl.texParameteri(target, this._gl.TEXTURE_MAG_FILTER, filters.mag);\r\n this._gl.texParameteri(target, this._gl.TEXTURE_MIN_FILTER, filters.min);\r\n\r\n if (generateMipMaps) {\r\n this._gl.generateMipmap(target);\r\n }\r\n\r\n this._bindTextureDirectly(target, null);\r\n\r\n this._internalTexturesCache.push(texture);\r\n\r\n return texture;\r\n };\r\n}\r\n\r\nThinEngine.prototype.createRawTexture2DArray = _makeCreateRawTextureFunction(false);\r\nThinEngine.prototype.createRawTexture3D = _makeCreateRawTextureFunction(true);\r\n\r\n/**\r\n * Create a function for updateRawTexture3D/updateRawTexture2DArray\r\n * @param is3D true for TEXTURE_3D and false for TEXTURE_2D_ARRAY\r\n * @internal\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nfunction _makeUpdateRawTextureFunction(is3D: boolean) {\r\n return function (\r\n this: ThinEngine,\r\n texture: InternalTexture,\r\n data: Nullable<ArrayBufferView>,\r\n format: number,\r\n invertY: boolean,\r\n compression: Nullable<string> = null,\r\n textureType: number = Constants.TEXTURETYPE_UNSIGNED_BYTE\r\n ): void {\r\n const target = is3D ? this._gl.TEXTURE_3D : this._gl.TEXTURE_2D_ARRAY;\r\n const internalType = this._getWebGLTextureType(textureType);\r\n const internalFormat = this._getInternalFormat(format);\r\n const internalSizedFomat = this._getRGBABufferInternalSizedFormat(textureType, format);\r\n\r\n this._bindTextureDirectly(target, texture, true);\r\n this._unpackFlipY(invertY === undefined ? true : invertY ? true : false);\r\n\r\n if (!this._doNotHandleContextLost) {\r\n texture._bufferView = data;\r\n texture.format = format;\r\n texture.invertY = invertY;\r\n texture._compression = compression;\r\n }\r\n\r\n if (texture.width % 4 !== 0) {\r\n this._gl.pixelStorei(this._gl.UNPACK_ALIGNMENT, 1);\r\n }\r\n\r\n if (compression && data) {\r\n this._gl.compressedTexImage3D(target, 0, (<any>this.getCaps().s3tc)[compression], texture.width, texture.height, texture.depth, 0, data);\r\n } else {\r\n this._gl.texImage3D(target, 0, internalSizedFomat, texture.width, texture.height, texture.depth, 0, internalFormat, internalType, data);\r\n }\r\n\r\n if (texture.generateMipMaps) {\r\n this._gl.generateMipmap(target);\r\n }\r\n this._bindTextureDirectly(target, null);\r\n // this.resetTextureCache();\r\n texture.isReady = true;\r\n };\r\n}\r\n\r\nThinEngine.prototype.updateRawTexture2DArray = _makeUpdateRawTextureFunction(false);\r\nThinEngine.prototype.updateRawTexture3D = _makeUpdateRawTextureFunction(true);\r\n"]}
|
|
1
|
+
{"version":3,"file":"engine.rawTexture.js","sourceRoot":"","sources":["../../../../../dev/core/src/Engines/Extensions/engine.rawTexture.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAyB,MAAM,0CAA0C,CAAC;AAClG,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AA4K7D,UAAU,CAAC,SAAS,CAAC,gBAAgB,GAAG,UACpC,OAAkC,EAClC,IAA+B,EAC/B,MAAc,EACd,OAAgB,EAChB,cAAgC,IAAI,EACpC,OAAe,SAAS,CAAC,yBAAyB,EAClD,gBAAyB,KAAK;IAE9B,IAAI,CAAC,OAAO,EAAE,CAAC;QACX,OAAO;IACX,CAAC;IAC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AK,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;YAC1B,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC;QACvD,CAAC;QAED,IAAI,WAAW,IAAI,IAAI,EAAE,CAAC;YACtB,IAAI,CAAC,GAAG,CAAC,oBAAoB,CAAC,MAAM,EAAE,CAAC,EAAQ,IAAI,CAAC,OAAO,EAAE,CAAC,IAAK,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;QAC7I,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,kBAAkB,EAAE,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,EAAE,cAAc,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC;QAC5I,CAAC;QAED,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC;YAC1B,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;QACpC,CAAC;QACD,IAAI,CAAC,oBAAoB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QACxC,4BAA4B;QAC5B,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;IAC3B,CAAC,CAAC;AACN,CAAC;AAED,UAAU,CAAC,SAAS,CAAC,uBAAuB,GAAG,6BAA6B,CAAC,KAAK,CAAC,CAAC;AACpF,UAAU,CAAC,SAAS,CAAC,kBAAkB,GAAG,6BAA6B,CAAC,IAAI,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"../../types\";\r\nimport { InternalTexture, InternalTextureSource } from \"../../Materials/Textures/internalTexture\";\r\nimport { Logger } from \"../../Misc/logger\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { Constants } from \"../constants\";\r\nimport { ThinEngine } from \"../thinEngine\";\r\nimport type { IWebRequest } from \"../../Misc/interfaces/iWebRequest\";\r\nimport { IsExponentOfTwo } from \"../../Misc/tools.functions\";\r\n\r\ndeclare module \"../abstractEngine\" {\r\n export interface AbstractEngine {\r\n /**\r\n * Update a raw texture\r\n * @param texture defines the texture to update\r\n * @param data defines the data to store in the texture\r\n * @param format defines the format of the data\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n */\r\n updateRawTexture(texture: Nullable<InternalTexture>, data: Nullable<ArrayBufferView>, format: number, invertY: boolean): void;\r\n\r\n /**\r\n * Update a raw texture\r\n * @param texture defines the texture to update\r\n * @param data defines the data to store in the texture\r\n * @param format defines the format of the data\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param compression defines the compression used (null by default)\r\n * @param type defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_BYTE by default)\r\n * @param useSRGBBuffer defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU).\r\n */\r\n updateRawTexture(\r\n texture: Nullable<InternalTexture>,\r\n data: Nullable<ArrayBufferView>,\r\n format: number,\r\n invertY: boolean,\r\n compression: Nullable<string>,\r\n type: number,\r\n useSRGBBuffer: boolean\r\n ): void;\r\n /**\r\n * Update a raw cube texture\r\n * @param texture defines the texture to update\r\n * @param data defines the data to store\r\n * @param format defines the data format\r\n * @param type defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_BYTE by default)\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n */\r\n updateRawCubeTexture(texture: InternalTexture, data: ArrayBufferView[], format: number, type: number, invertY: boolean): void;\r\n\r\n /**\r\n * Update a raw cube texture\r\n * @param texture defines the texture to update\r\n * @param data defines the data to store\r\n * @param format defines the data format\r\n * @param type defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_BYTE by default)\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param compression defines the compression used (null by default)\r\n */\r\n updateRawCubeTexture(texture: InternalTexture, data: ArrayBufferView[], format: number, type: number, invertY: boolean, compression: Nullable<string>): void;\r\n\r\n /**\r\n * Update a raw cube texture\r\n * @param texture defines the texture to update\r\n * @param data defines the data to store\r\n * @param format defines the data format\r\n * @param type defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_BYTE by default)\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param compression defines the compression used (null by default)\r\n * @param level defines which level of the texture to update\r\n */\r\n updateRawCubeTexture(texture: InternalTexture, data: ArrayBufferView[], format: number, type: number, invertY: boolean, compression: Nullable<string>, level: number): void;\r\n\r\n /**\r\n * Creates a new raw cube texture from a specified url\r\n * @param url defines the url where the data is located\r\n * @param scene defines the current scene\r\n * @param size defines the size of the textures\r\n * @param format defines the format of the data\r\n * @param type defines the type fo the data (like Engine.TEXTURETYPE_UNSIGNED_BYTE)\r\n * @param noMipmap defines if the engine should avoid generating the mip levels\r\n * @param callback defines a callback used to extract texture data from loaded data\r\n * @param mipmapGenerator defines to provide an optional tool to generate mip levels\r\n * @param onLoad defines a callback called when texture is loaded\r\n * @param onError defines a callback called if there is an error\r\n * @returns the cube texture as an InternalTexture\r\n */\r\n createRawCubeTextureFromUrl(\r\n url: string,\r\n scene: Nullable<Scene>,\r\n size: number,\r\n format: number,\r\n type: number,\r\n noMipmap: boolean,\r\n callback: (ArrayBuffer: ArrayBuffer) => Nullable<ArrayBufferView[]>,\r\n mipmapGenerator: Nullable<(faces: ArrayBufferView[]) => ArrayBufferView[][]>,\r\n onLoad: Nullable<() => void>,\r\n onError: Nullable<(message?: string, exception?: any) => void>\r\n ): InternalTexture;\r\n\r\n /**\r\n * Creates a new raw cube texture from a specified url\r\n * @param url defines the url where the data is located\r\n * @param scene defines the current scene\r\n * @param size defines the size of the textures\r\n * @param format defines the format of the data\r\n * @param type defines the type fo the data (like Engine.TEXTURETYPE_UNSIGNED_BYTE)\r\n * @param noMipmap defines if the engine should avoid generating the mip levels\r\n * @param callback defines a callback used to extract texture data from loaded data\r\n * @param mipmapGenerator defines to provide an optional tool to generate mip levels\r\n * @param onLoad defines a callback called when texture is loaded\r\n * @param onError defines a callback called if there is an error\r\n * @param samplingMode defines the required sampling mode (like Texture.NEAREST_SAMPLINGMODE)\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @returns the cube texture as an InternalTexture\r\n */\r\n createRawCubeTextureFromUrl(\r\n url: string,\r\n scene: Nullable<Scene>,\r\n size: number,\r\n format: number,\r\n type: number,\r\n noMipmap: boolean,\r\n callback: (ArrayBuffer: ArrayBuffer) => Nullable<ArrayBufferView[]>,\r\n mipmapGenerator: Nullable<(faces: ArrayBufferView[]) => ArrayBufferView[][]>,\r\n onLoad: Nullable<() => void>,\r\n onError: Nullable<(message?: string, exception?: any) => void>,\r\n samplingMode: number,\r\n invertY: boolean\r\n ): InternalTexture;\r\n\r\n /**\r\n * Update a raw 3D texture\r\n * @param texture defines the texture to update\r\n * @param data defines the data to store\r\n * @param format defines the data format\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n */\r\n updateRawTexture3D(texture: InternalTexture, data: Nullable<ArrayBufferView>, format: number, invertY: boolean): void;\r\n\r\n /**\r\n * Update a raw 3D texture\r\n * @param texture defines the texture to update\r\n * @param data defines the data to store\r\n * @param format defines the data format\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param compression defines the used compression (can be null)\r\n * @param textureType defines the texture Type (Engine.TEXTURETYPE_UNSIGNED_BYTE, Engine.TEXTURETYPE_FLOAT...)\r\n */\r\n updateRawTexture3D(texture: InternalTexture, data: Nullable<ArrayBufferView>, format: number, invertY: boolean, compression: Nullable<string>, textureType: number): void;\r\n\r\n /**\r\n * Update a raw 2D array texture\r\n * @param texture defines the texture to update\r\n * @param data defines the data to store\r\n * @param format defines the data format\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n */\r\n updateRawTexture2DArray(texture: InternalTexture, data: Nullable<ArrayBufferView>, format: number, invertY: boolean): void;\r\n\r\n /**\r\n * Update a raw 2D array texture\r\n * @param texture defines the texture to update\r\n * @param data defines the data to store\r\n * @param format defines the data format\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param compression defines the used compression (can be null)\r\n * @param textureType defines the texture Type (Engine.TEXTURETYPE_UNSIGNED_BYTE, Engine.TEXTURETYPE_FLOAT...)\r\n */\r\n updateRawTexture2DArray(\r\n texture: InternalTexture,\r\n data: Nullable<ArrayBufferView>,\r\n format: number,\r\n invertY: boolean,\r\n compression: Nullable<string>,\r\n textureType: number\r\n ): void;\r\n }\r\n}\r\n\r\nThinEngine.prototype.updateRawTexture = function (\r\n texture: Nullable<InternalTexture>,\r\n data: Nullable<ArrayBufferView>,\r\n format: number,\r\n invertY: boolean,\r\n compression: Nullable<string> = null,\r\n type: number = Constants.TEXTURETYPE_UNSIGNED_BYTE,\r\n useSRGBBuffer: boolean = false\r\n): void {\r\n if (!texture) {\r\n return;\r\n }\r\n // Babylon's internalSizedFomat but gl's texImage2D internalFormat\r\n const internalSizedFomat = this._getRGBABufferInternalSizedFormat(type, format, useSRGBBuffer);\r\n\r\n // Babylon's internalFormat but gl's texImage2D format\r\n const internalFormat = this._getInternalFormat(format);\r\n const textureType = this._getWebGLTextureType(type);\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, texture, true);\r\n this._unpackFlipY(invertY === undefined ? true : invertY ? true : false);\r\n\r\n if (!this._doNotHandleContextLost) {\r\n texture._bufferView = data;\r\n texture.format = format;\r\n texture.type = type;\r\n texture.invertY = invertY;\r\n texture._compression = compression;\r\n }\r\n\r\n if (texture.width % 4 !== 0) {\r\n this._gl.pixelStorei(this._gl.UNPACK_ALIGNMENT, 1);\r\n }\r\n\r\n if (compression && data) {\r\n this._gl.compressedTexImage2D(this._gl.TEXTURE_2D, 0, (<any>this.getCaps().s3tc)[compression], texture.width, texture.height, 0, <DataView>data);\r\n } else {\r\n this._gl.texImage2D(this._gl.TEXTURE_2D, 0, internalSizedFomat, texture.width, texture.height, 0, internalFormat, textureType, data);\r\n }\r\n\r\n if (texture.generateMipMaps) {\r\n this._gl.generateMipmap(this._gl.TEXTURE_2D);\r\n }\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, null);\r\n // this.resetTextureCache();\r\n texture.isReady = true;\r\n};\r\n\r\nThinEngine.prototype.createRawTexture = function (\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n format: number,\r\n generateMipMaps: boolean,\r\n invertY: boolean,\r\n samplingMode: number,\r\n compression: Nullable<string> = null,\r\n type: number = Constants.TEXTURETYPE_UNSIGNED_BYTE,\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n creationFlags = 0,\r\n useSRGBBuffer = false\r\n): InternalTexture {\r\n const texture = new InternalTexture(this, InternalTextureSource.Raw);\r\n texture.baseWidth = width;\r\n texture.baseHeight = height;\r\n texture.width = width;\r\n texture.height = height;\r\n texture.format = format;\r\n texture.generateMipMaps = generateMipMaps;\r\n texture.samplingMode = samplingMode;\r\n texture.invertY = invertY;\r\n texture._compression = compression;\r\n texture.type = type;\r\n texture._useSRGBBuffer = this._getUseSRGBBuffer(useSRGBBuffer, !generateMipMaps);\r\n\r\n if (!this._doNotHandleContextLost) {\r\n texture._bufferView = data;\r\n }\r\n\r\n this.updateRawTexture(texture, data, format, invertY, compression, type, texture._useSRGBBuffer);\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, texture, true);\r\n\r\n // Filters\r\n const filters = this._getSamplingParameters(samplingMode, generateMipMaps);\r\n\r\n this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MAG_FILTER, filters.mag);\r\n this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MIN_FILTER, filters.min);\r\n\r\n if (generateMipMaps) {\r\n this._gl.generateMipmap(this._gl.TEXTURE_2D);\r\n }\r\n\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, null);\r\n\r\n this._internalTexturesCache.push(texture);\r\n\r\n return texture;\r\n};\r\n\r\nThinEngine.prototype.createRawCubeTexture = function (\r\n data: Nullable<ArrayBufferView[]>,\r\n size: number,\r\n format: number,\r\n type: number,\r\n generateMipMaps: boolean,\r\n invertY: boolean,\r\n samplingMode: number,\r\n compression: Nullable<string> = null\r\n): InternalTexture {\r\n const gl = this._gl;\r\n const texture = new InternalTexture(this, InternalTextureSource.CubeRaw);\r\n texture.isCube = true;\r\n texture.format = format;\r\n texture.type = type;\r\n if (!this._doNotHandleContextLost) {\r\n texture._bufferViewArray = data;\r\n }\r\n\r\n const textureType = this._getWebGLTextureType(type);\r\n let internalFormat = this._getInternalFormat(format);\r\n\r\n if (internalFormat === gl.RGB) {\r\n internalFormat = gl.RGBA;\r\n }\r\n\r\n // Mipmap generation needs a sized internal format that is both color-renderable and texture-filterable\r\n if (textureType === gl.FLOAT && !this._caps.textureFloatLinearFiltering) {\r\n generateMipMaps = false;\r\n samplingMode = Constants.TEXTURE_NEAREST_SAMPLINGMODE;\r\n Logger.Warn(\"Float texture filtering is not supported. Mipmap generation and sampling mode are forced to false and TEXTURE_NEAREST_SAMPLINGMODE, respectively.\");\r\n } else if (textureType === this._gl.HALF_FLOAT_OES && !this._caps.textureHalfFloatLinearFiltering) {\r\n generateMipMaps = false;\r\n samplingMode = Constants.TEXTURE_NEAREST_SAMPLINGMODE;\r\n Logger.Warn(\"Half float texture filtering is not supported. Mipmap generation and sampling mode are forced to false and TEXTURE_NEAREST_SAMPLINGMODE, respectively.\");\r\n } else if (textureType === gl.FLOAT && !this._caps.textureFloatRender) {\r\n generateMipMaps = false;\r\n Logger.Warn(\"Render to float textures is not supported. Mipmap generation forced to false.\");\r\n } else if (textureType === gl.HALF_FLOAT && !this._caps.colorBufferFloat) {\r\n generateMipMaps = false;\r\n Logger.Warn(\"Render to half float textures is not supported. Mipmap generation forced to false.\");\r\n }\r\n\r\n const width = size;\r\n const height = width;\r\n\r\n texture.width = width;\r\n texture.height = height;\r\n texture.invertY = invertY;\r\n texture._compression = compression;\r\n\r\n // Double check on POT to generate Mips.\r\n const isPot = !this.needPOTTextures || (IsExponentOfTwo(texture.width) && IsExponentOfTwo(texture.height));\r\n if (!isPot) {\r\n generateMipMaps = false;\r\n }\r\n\r\n // Upload data if needed. The texture won't be ready until then.\r\n if (data) {\r\n this.updateRawCubeTexture(texture, data, format, type, invertY, compression);\r\n } else {\r\n const internalSizedFomat = this._getRGBABufferInternalSizedFormat(type);\r\n const level = 0;\r\n\r\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true);\r\n\r\n for (let faceIndex = 0; faceIndex < 6; faceIndex++) {\r\n if (compression) {\r\n gl.compressedTexImage2D(\r\n gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex,\r\n level,\r\n (<any>this.getCaps().s3tc)[compression],\r\n texture.width,\r\n texture.height,\r\n 0,\r\n undefined as any\r\n );\r\n } else {\r\n gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, level, internalSizedFomat, texture.width, texture.height, 0, internalFormat, textureType, null);\r\n }\r\n }\r\n\r\n this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null);\r\n }\r\n\r\n this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, texture, true);\r\n\r\n // Filters\r\n if (data && generateMipMaps) {\r\n this._gl.generateMipmap(this._gl.TEXTURE_CUBE_MAP);\r\n }\r\n\r\n const filters = this._getSamplingParameters(samplingMode, generateMipMaps);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, filters.mag);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, filters.min);\r\n\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\r\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\r\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, null);\r\n\r\n texture.generateMipMaps = generateMipMaps;\r\n texture.samplingMode = samplingMode;\r\n texture.isReady = true;\r\n\r\n return texture;\r\n};\r\n\r\nThinEngine.prototype.updateRawCubeTexture = function (\r\n texture: InternalTexture,\r\n data: ArrayBufferView[],\r\n format: number,\r\n type: number,\r\n invertY: boolean,\r\n compression: Nullable<string> = null,\r\n level: number = 0\r\n): void {\r\n texture._bufferViewArray = data;\r\n texture.format = format;\r\n texture.type = type;\r\n texture.invertY = invertY;\r\n texture._compression = compression;\r\n\r\n const gl = this._gl;\r\n const textureType = this._getWebGLTextureType(type);\r\n let internalFormat = this._getInternalFormat(format);\r\n const internalSizedFomat = this._getRGBABufferInternalSizedFormat(type);\r\n\r\n let needConversion = false;\r\n if (internalFormat === gl.RGB) {\r\n internalFormat = gl.RGBA;\r\n needConversion = true;\r\n }\r\n\r\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true);\r\n this._unpackFlipY(invertY === undefined ? true : invertY ? true : false);\r\n\r\n if (texture.width % 4 !== 0) {\r\n gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1);\r\n }\r\n\r\n // Data are known to be in +X +Y +Z -X -Y -Z\r\n for (let faceIndex = 0; faceIndex < 6; faceIndex++) {\r\n let faceData = data[faceIndex];\r\n\r\n if (compression) {\r\n gl.compressedTexImage2D(\r\n gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex,\r\n level,\r\n (<any>this.getCaps().s3tc)[compression],\r\n texture.width,\r\n texture.height,\r\n 0,\r\n <DataView>faceData\r\n );\r\n } else {\r\n if (needConversion) {\r\n faceData = _convertRGBtoRGBATextureData(faceData, texture.width, texture.height, type);\r\n }\r\n gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, level, internalSizedFomat, texture.width, texture.height, 0, internalFormat, textureType, faceData);\r\n }\r\n }\r\n\r\n const isPot = !this.needPOTTextures || (IsExponentOfTwo(texture.width) && IsExponentOfTwo(texture.height));\r\n if (isPot && texture.generateMipMaps && level === 0) {\r\n this._gl.generateMipmap(this._gl.TEXTURE_CUBE_MAP);\r\n }\r\n this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null);\r\n\r\n // this.resetTextureCache();\r\n texture.isReady = true;\r\n};\r\n\r\nThinEngine.prototype.createRawCubeTextureFromUrl = function (\r\n url: string,\r\n scene: Nullable<Scene>,\r\n size: number,\r\n format: number,\r\n type: number,\r\n noMipmap: boolean,\r\n callback: (ArrayBuffer: ArrayBuffer) => Nullable<ArrayBufferView[]>,\r\n mipmapGenerator: Nullable<(faces: ArrayBufferView[]) => ArrayBufferView[][]>,\r\n onLoad: Nullable<() => void> = null,\r\n onError: Nullable<(message?: string, exception?: any) => void> = null,\r\n samplingMode: number = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE,\r\n invertY: boolean = false\r\n): InternalTexture {\r\n const gl = this._gl;\r\n const texture = this.createRawCubeTexture(null, size, format, type, !noMipmap, invertY, samplingMode, null);\r\n scene?.addPendingData(texture);\r\n texture.url = url;\r\n texture.isReady = false;\r\n this._internalTexturesCache.push(texture);\r\n\r\n const onerror = (request?: IWebRequest, exception?: any) => {\r\n scene?.removePendingData(texture);\r\n if (onError && request) {\r\n onError(request.status + \" \" + request.statusText, exception);\r\n }\r\n };\r\n\r\n const internalCallback = (data: any) => {\r\n // If the texture has been disposed\r\n if (!texture._hardwareTexture) {\r\n return;\r\n }\r\n\r\n const width = texture.width;\r\n const faceDataArrays = callback(data);\r\n\r\n if (!faceDataArrays) {\r\n return;\r\n }\r\n\r\n if (mipmapGenerator) {\r\n const textureType = this._getWebGLTextureType(type);\r\n let internalFormat = this._getInternalFormat(format);\r\n const internalSizedFomat = this._getRGBABufferInternalSizedFormat(type);\r\n\r\n let needConversion = false;\r\n if (internalFormat === gl.RGB) {\r\n internalFormat = gl.RGBA;\r\n needConversion = true;\r\n }\r\n\r\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true);\r\n this._unpackFlipY(false);\r\n\r\n const mipData = mipmapGenerator(faceDataArrays);\r\n for (let level = 0; level < mipData.length; level++) {\r\n const mipSize = width >> level;\r\n\r\n for (let faceIndex = 0; faceIndex < 6; faceIndex++) {\r\n let mipFaceData = mipData[level][faceIndex];\r\n if (needConversion) {\r\n mipFaceData = _convertRGBtoRGBATextureData(mipFaceData, mipSize, mipSize, type);\r\n }\r\n gl.texImage2D(faceIndex, level, internalSizedFomat, mipSize, mipSize, 0, internalFormat, textureType, mipFaceData);\r\n }\r\n }\r\n\r\n this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, null);\r\n } else {\r\n this.updateRawCubeTexture(texture, faceDataArrays, format, type, invertY);\r\n }\r\n\r\n texture.isReady = true;\r\n // this.resetTextureCache();\r\n scene?.removePendingData(texture);\r\n\r\n texture.onLoadedObservable.notifyObservers(texture);\r\n texture.onLoadedObservable.clear();\r\n\r\n if (onLoad) {\r\n onLoad();\r\n }\r\n };\r\n\r\n this._loadFile(\r\n url,\r\n (data) => {\r\n internalCallback(data);\r\n },\r\n undefined,\r\n scene?.offlineProvider,\r\n true,\r\n onerror\r\n );\r\n\r\n return texture;\r\n};\r\n\r\n/**\r\n * @internal\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nfunction _convertRGBtoRGBATextureData(rgbData: any, width: number, height: number, textureType: number): ArrayBufferView {\r\n // Create new RGBA data container.\r\n let rgbaData: any;\r\n let val1 = 1;\r\n if (textureType === Constants.TEXTURETYPE_FLOAT) {\r\n rgbaData = new Float32Array(width * height * 4);\r\n } else if (textureType === Constants.TEXTURETYPE_HALF_FLOAT) {\r\n rgbaData = new Uint16Array(width * height * 4);\r\n val1 = 15360; // 15360 is the encoding of 1 in half float\r\n } else if (textureType === Constants.TEXTURETYPE_UNSIGNED_INTEGER) {\r\n rgbaData = new Uint32Array(width * height * 4);\r\n } else {\r\n rgbaData = new Uint8Array(width * height * 4);\r\n }\r\n\r\n // Convert each pixel.\r\n for (let x = 0; x < width; x++) {\r\n for (let y = 0; y < height; y++) {\r\n const index = (y * width + x) * 3;\r\n const newIndex = (y * width + x) * 4;\r\n\r\n // Map Old Value to new value.\r\n rgbaData[newIndex + 0] = rgbData[index + 0];\r\n rgbaData[newIndex + 1] = rgbData[index + 1];\r\n rgbaData[newIndex + 2] = rgbData[index + 2];\r\n\r\n // Add fully opaque alpha channel.\r\n rgbaData[newIndex + 3] = val1;\r\n }\r\n }\r\n\r\n return rgbaData;\r\n}\r\n\r\n/**\r\n * Create a function for createRawTexture3D/createRawTexture2DArray\r\n * @param is3D true for TEXTURE_3D and false for TEXTURE_2D_ARRAY\r\n * @internal\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nfunction _makeCreateRawTextureFunction(is3D: boolean) {\r\n return function (\r\n this: ThinEngine,\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n depth: number,\r\n format: number,\r\n generateMipMaps: boolean,\r\n invertY: boolean,\r\n samplingMode: number,\r\n compression: Nullable<string> = null,\r\n textureType: number = Constants.TEXTURETYPE_UNSIGNED_BYTE\r\n ): InternalTexture {\r\n const target = is3D ? this._gl.TEXTURE_3D : this._gl.TEXTURE_2D_ARRAY;\r\n const source = is3D ? InternalTextureSource.Raw3D : InternalTextureSource.Raw2DArray;\r\n const texture = new InternalTexture(this, source);\r\n texture.baseWidth = width;\r\n texture.baseHeight = height;\r\n texture.baseDepth = depth;\r\n texture.width = width;\r\n texture.height = height;\r\n texture.depth = depth;\r\n texture.format = format;\r\n texture.type = textureType;\r\n texture.generateMipMaps = generateMipMaps;\r\n texture.samplingMode = samplingMode;\r\n if (is3D) {\r\n texture.is3D = true;\r\n } else {\r\n texture.is2DArray = true;\r\n }\r\n\r\n if (!this._doNotHandleContextLost) {\r\n texture._bufferView = data;\r\n }\r\n\r\n if (is3D) {\r\n this.updateRawTexture3D(texture, data, format, invertY, compression, textureType);\r\n } else {\r\n this.updateRawTexture2DArray(texture, data, format, invertY, compression, textureType);\r\n }\r\n this._bindTextureDirectly(target, texture, true);\r\n\r\n // Filters\r\n const filters = this._getSamplingParameters(samplingMode, generateMipMaps);\r\n\r\n this._gl.texParameteri(target, this._gl.TEXTURE_MAG_FILTER, filters.mag);\r\n this._gl.texParameteri(target, this._gl.TEXTURE_MIN_FILTER, filters.min);\r\n\r\n if (generateMipMaps) {\r\n this._gl.generateMipmap(target);\r\n }\r\n\r\n this._bindTextureDirectly(target, null);\r\n\r\n this._internalTexturesCache.push(texture);\r\n\r\n return texture;\r\n };\r\n}\r\n\r\nThinEngine.prototype.createRawTexture2DArray = _makeCreateRawTextureFunction(false);\r\nThinEngine.prototype.createRawTexture3D = _makeCreateRawTextureFunction(true);\r\n\r\n/**\r\n * Create a function for updateRawTexture3D/updateRawTexture2DArray\r\n * @param is3D true for TEXTURE_3D and false for TEXTURE_2D_ARRAY\r\n * @internal\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nfunction _makeUpdateRawTextureFunction(is3D: boolean) {\r\n return function (\r\n this: ThinEngine,\r\n texture: InternalTexture,\r\n data: Nullable<ArrayBufferView>,\r\n format: number,\r\n invertY: boolean,\r\n compression: Nullable<string> = null,\r\n textureType: number = Constants.TEXTURETYPE_UNSIGNED_BYTE\r\n ): void {\r\n const target = is3D ? this._gl.TEXTURE_3D : this._gl.TEXTURE_2D_ARRAY;\r\n const internalType = this._getWebGLTextureType(textureType);\r\n const internalFormat = this._getInternalFormat(format);\r\n const internalSizedFomat = this._getRGBABufferInternalSizedFormat(textureType, format);\r\n\r\n this._bindTextureDirectly(target, texture, true);\r\n this._unpackFlipY(invertY === undefined ? true : invertY ? true : false);\r\n\r\n if (!this._doNotHandleContextLost) {\r\n texture._bufferView = data;\r\n texture.format = format;\r\n texture.invertY = invertY;\r\n texture._compression = compression;\r\n }\r\n\r\n if (texture.width % 4 !== 0) {\r\n this._gl.pixelStorei(this._gl.UNPACK_ALIGNMENT, 1);\r\n }\r\n\r\n if (compression && data) {\r\n this._gl.compressedTexImage3D(target, 0, (<any>this.getCaps().s3tc)[compression], texture.width, texture.height, texture.depth, 0, data);\r\n } else {\r\n this._gl.texImage3D(target, 0, internalSizedFomat, texture.width, texture.height, texture.depth, 0, internalFormat, internalType, data);\r\n }\r\n\r\n if (texture.generateMipMaps) {\r\n this._gl.generateMipmap(target);\r\n }\r\n this._bindTextureDirectly(target, null);\r\n // this.resetTextureCache();\r\n texture.isReady = true;\r\n };\r\n}\r\n\r\nThinEngine.prototype.updateRawTexture2DArray = _makeUpdateRawTextureFunction(false);\r\nThinEngine.prototype.updateRawTexture3D = _makeUpdateRawTextureFunction(true);\r\n"]}
|
|
@@ -769,13 +769,13 @@ export class AbstractEngine {
|
|
|
769
769
|
*/
|
|
770
770
|
// Not mixed with Version for tooling purpose.
|
|
771
771
|
static get NpmPackage() {
|
|
772
|
-
return "babylonjs@7.
|
|
772
|
+
return "babylonjs@7.48.1";
|
|
773
773
|
}
|
|
774
774
|
/**
|
|
775
775
|
* Returns the current version of the framework
|
|
776
776
|
*/
|
|
777
777
|
static get Version() {
|
|
778
|
-
return "7.
|
|
778
|
+
return "7.48.1";
|
|
779
779
|
}
|
|
780
780
|
/**
|
|
781
781
|
* Gets the HTML canvas attached with the current webGL context
|