@onerjs/core 8.44.6 → 8.44.8

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.
Files changed (121) hide show
  1. package/Bones/skeleton.d.ts +5 -0
  2. package/Bones/skeleton.js +35 -8
  3. package/Bones/skeleton.js.map +1 -1
  4. package/Collisions/collider.js +2 -2
  5. package/Collisions/collider.js.map +1 -1
  6. package/Culling/Helper/computeShaderBoundingHelper.js +8 -1
  7. package/Culling/Helper/computeShaderBoundingHelper.js.map +1 -1
  8. package/Culling/Helper/transformFeedbackBoundingHelper.js +1 -1
  9. package/Culling/Helper/transformFeedbackBoundingHelper.js.map +1 -1
  10. package/Engines/abstractEngine.js +2 -2
  11. package/Engines/abstractEngine.js.map +1 -1
  12. package/Engines/engine.d.ts +2 -1
  13. package/FlowGraph/Blocks/Data/flowGraphDebugBlock.d.ts +45 -0
  14. package/FlowGraph/Blocks/Data/flowGraphDebugBlock.js +98 -0
  15. package/FlowGraph/Blocks/Data/flowGraphDebugBlock.js.map +1 -0
  16. package/FlowGraph/Blocks/Data/flowGraphGetPropertyBlock.d.ts +16 -0
  17. package/FlowGraph/Blocks/Data/flowGraphGetPropertyBlock.js +15 -2
  18. package/FlowGraph/Blocks/Data/flowGraphGetPropertyBlock.js.map +1 -1
  19. package/FlowGraph/Blocks/Event/flowGraphPointerDownEventBlock.d.ts +64 -0
  20. package/FlowGraph/Blocks/Event/flowGraphPointerDownEventBlock.js +54 -0
  21. package/FlowGraph/Blocks/Event/flowGraphPointerDownEventBlock.js.map +1 -0
  22. package/FlowGraph/Blocks/Event/flowGraphPointerMoveEventBlock.d.ts +64 -0
  23. package/FlowGraph/Blocks/Event/flowGraphPointerMoveEventBlock.js +54 -0
  24. package/FlowGraph/Blocks/Event/flowGraphPointerMoveEventBlock.js.map +1 -0
  25. package/FlowGraph/Blocks/Event/flowGraphPointerUpEventBlock.d.ts +64 -0
  26. package/FlowGraph/Blocks/Event/flowGraphPointerUpEventBlock.js +54 -0
  27. package/FlowGraph/Blocks/Event/flowGraphPointerUpEventBlock.js.map +1 -0
  28. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.d.ts +1 -0
  29. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.js +17 -1
  30. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.js.map +1 -1
  31. package/FlowGraph/Blocks/Event/flowGraphSendCustomEventBlock.d.ts +1 -0
  32. package/FlowGraph/Blocks/Event/flowGraphSendCustomEventBlock.js +23 -3
  33. package/FlowGraph/Blocks/Event/flowGraphSendCustomEventBlock.js.map +1 -1
  34. package/FlowGraph/Blocks/Execution/Animation/flowGraphInterpolationBlock.js +2 -2
  35. package/FlowGraph/Blocks/Execution/Animation/flowGraphInterpolationBlock.js.map +1 -1
  36. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js +7 -1
  37. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js.map +1 -1
  38. package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.d.ts +4 -0
  39. package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.js +6 -2
  40. package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.js.map +1 -1
  41. package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.js +2 -2
  42. package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.js.map +1 -1
  43. package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.js +0 -4
  44. package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.js.map +1 -1
  45. package/FlowGraph/Blocks/flowGraphBlockFactory.js +16 -0
  46. package/FlowGraph/Blocks/flowGraphBlockFactory.js.map +1 -1
  47. package/FlowGraph/Blocks/flowGraphBlockNames.d.ts +2 -1
  48. package/FlowGraph/Blocks/flowGraphBlockNames.js +1 -0
  49. package/FlowGraph/Blocks/flowGraphBlockNames.js.map +1 -1
  50. package/FlowGraph/flowGraph.d.ts +63 -2
  51. package/FlowGraph/flowGraph.js +210 -19
  52. package/FlowGraph/flowGraph.js.map +1 -1
  53. package/FlowGraph/flowGraphContext.d.ts +73 -0
  54. package/FlowGraph/flowGraphContext.js +115 -0
  55. package/FlowGraph/flowGraphContext.js.map +1 -1
  56. package/FlowGraph/flowGraphExecutionBlock.d.ts +7 -0
  57. package/FlowGraph/flowGraphExecutionBlock.js +7 -0
  58. package/FlowGraph/flowGraphExecutionBlock.js.map +1 -1
  59. package/FlowGraph/flowGraphParser.js +1 -0
  60. package/FlowGraph/flowGraphParser.js.map +1 -1
  61. package/FlowGraph/flowGraphSceneEventCoordinator.d.ts +3 -0
  62. package/FlowGraph/flowGraphSceneEventCoordinator.js +13 -1
  63. package/FlowGraph/flowGraphSceneEventCoordinator.js.map +1 -1
  64. package/FlowGraph/flowGraphSignalConnection.d.ts +5 -0
  65. package/FlowGraph/flowGraphSignalConnection.js +12 -0
  66. package/FlowGraph/flowGraphSignalConnection.js.map +1 -1
  67. package/FlowGraph/flowGraphValidator.d.ts +66 -0
  68. package/FlowGraph/flowGraphValidator.js +324 -0
  69. package/FlowGraph/flowGraphValidator.js.map +1 -0
  70. package/FlowGraph/index.d.ts +1 -0
  71. package/FlowGraph/index.js +1 -0
  72. package/FlowGraph/index.js.map +1 -1
  73. package/FlowGraph/serialization.js +10 -3
  74. package/FlowGraph/serialization.js.map +1 -1
  75. package/Layers/thinEffectLayer.js +1 -1
  76. package/Layers/thinEffectLayer.js.map +1 -1
  77. package/Layers/thinSelectionOutlineLayer.js +1 -1
  78. package/Layers/thinSelectionOutlineLayer.js.map +1 -1
  79. package/Lights/Shadows/shadowGenerator.js +1 -1
  80. package/Lights/Shadows/shadowGenerator.js.map +1 -1
  81. package/Loading/Plugins/babylonFileLoader.js +7 -1
  82. package/Loading/Plugins/babylonFileLoader.js.map +1 -1
  83. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +2 -0
  84. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
  85. package/Materials/Node/Blocks/Vertex/bonesBlock.js +2 -2
  86. package/Materials/Node/Blocks/Vertex/bonesBlock.js.map +1 -1
  87. package/Materials/PBR/openpbrMaterial.js +1 -1
  88. package/Materials/PBR/openpbrMaterial.js.map +1 -1
  89. package/Materials/PBR/pbrBaseMaterial.js +1 -1
  90. package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
  91. package/Materials/Textures/equiRectangularCubeTexture.js +1 -4
  92. package/Materials/Textures/equiRectangularCubeTexture.js.map +1 -1
  93. package/Materials/materialHelper.functions.js +2 -2
  94. package/Materials/materialHelper.functions.js.map +1 -1
  95. package/Materials/materialHelper.geometryrendering.js +1 -1
  96. package/Materials/materialHelper.geometryrendering.js.map +1 -1
  97. package/Materials/standardMaterial.js +1 -1
  98. package/Materials/standardMaterial.js.map +1 -1
  99. package/Meshes/mesh.js +2 -2
  100. package/Meshes/mesh.js.map +1 -1
  101. package/Misc/bitArray.js +1 -1
  102. package/Misc/bitArray.js.map +1 -1
  103. package/Misc/tools.js +3 -3
  104. package/Misc/tools.js.map +1 -1
  105. package/Particles/thinParticleSystem.js +2 -2
  106. package/Particles/thinParticleSystem.js.map +1 -1
  107. package/PostProcesses/volumetricLightScatteringPostProcess.js +1 -1
  108. package/PostProcesses/volumetricLightScatteringPostProcess.js.map +1 -1
  109. package/Rendering/depthRenderer.js +1 -1
  110. package/Rendering/depthRenderer.js.map +1 -1
  111. package/Rendering/geometryBufferRenderer.js +3 -3
  112. package/Rendering/geometryBufferRenderer.js.map +1 -1
  113. package/Rendering/outlineRenderer.js +1 -1
  114. package/Rendering/outlineRenderer.js.map +1 -1
  115. package/Shaders/ShadersInclude/bonesDeclaration.js +5 -7
  116. package/Shaders/ShadersInclude/bonesDeclaration.js.map +1 -1
  117. package/ShadersWGSL/ShadersInclude/bonesDeclaration.js +3 -3
  118. package/ShadersWGSL/ShadersInclude/bonesDeclaration.js.map +1 -1
  119. package/ShadersWGSL/boundingInfo.compute.js +4 -3
  120. package/ShadersWGSL/boundingInfo.compute.js.map +1 -1
  121. package/package.json +1 -1
@@ -187,15 +187,12 @@ export class EquiRectangularCubeTexture extends BaseTexture {
187
187
  return;
188
188
  }
189
189
  this._texture = this._getFromCache(this.url, this._noMipmap, undefined, undefined, undefined, this.isCube);
190
+ this.delayLoadState = 1;
190
191
  if (!this._texture) {
191
- this.delayLoadState = 1;
192
192
  this._loadImage(() => {
193
193
  this._loadTexture();
194
194
  }, this._onError);
195
195
  }
196
- else {
197
- this.delayLoadState = 1;
198
- }
199
196
  }
200
197
  }
201
198
  /** The six faces of the cube. */
@@ -1 +1 @@
1
- {"version":3,"file":"equiRectangularCubeTexture.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/Textures/equiRectangularCubeTexture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,+CAA+C,CAAC;AACvF,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,oCAAgC;AAE9D;;GAEG;AACH,MAAM,OAAO,0BAA2B,SAAQ,WAAW;IA0BvD;;;;;;;;;;;OAWG;IACH,YACI,GAAW,EACX,KAAY,EACZ,IAAY,EACZ,WAAoB,KAAK,EACzB,aAAsB,IAAI,EAC1B,SAA+B,IAAI,EACnC,UAAiE,IAAI,EACrE,WAAW,GAAG,KAAK;QAEnB,KAAK,CAAC,KAAK,CAAC,CAAC;QA3CT,YAAO,GAAyB,IAAI,CAAC;QACrC,aAAQ,GAAyB,IAAI,CAAC;QA4C1C,IAAI,CAAC,GAAG,EAAE,CAAC;YACP,MAAM,IAAI,KAAK,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,IAAI,CAAC,cAAc,KAAK,SAAS,CAAC,wBAAwB,EAAE,CAAC;YAC7D,OAAO;QACX,CAAC;QAED,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAE3G,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACjB,IAAI,CAAC,cAAc,GAAG,SAAS,CAAC,qBAAqB,CAAC;YACtD,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE;gBACjB,IAAI,CAAC,YAAY,EAAE,CAAC;YACxB,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;QACtB,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,cAAc,GAAG,SAAS,CAAC,qBAAqB,CAAC;QAC1D,CAAC;IACL,CAAC;;AAnQD,iCAAiC;AAClB,wCAAa,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,AAAnD,CAAoD","sourcesContent":["import { PanoramaToCubeMapTools } from \"../../Misc/HighDynamicRange/panoramaToCubemap\";\r\nimport { BaseTexture } from \"./baseTexture\";\r\nimport { Texture } from \"./texture\";\r\nimport type { Scene } from \"../../scene\";\r\nimport type { Nullable } from \"../../types\";\r\nimport { Tools } from \"../../Misc/tools\";\r\nimport { Constants } from \"../../Engines/constants\";\r\nimport { LoadImage } from \"../../Misc/fileTools\";\r\nimport { IsDocumentAvailable } from \"core/Misc/domManagement\";\r\n\r\n/**\r\n * This represents a texture coming from an equirectangular image supported by the web browser canvas.\r\n */\r\nexport class EquiRectangularCubeTexture extends BaseTexture {\r\n /** The six faces of the cube. */\r\n private static _FacesMapping = [\"right\", \"left\", \"up\", \"down\", \"front\", \"back\"];\r\n\r\n private _noMipmap: boolean;\r\n private _onLoad: Nullable<() => void> = null;\r\n private _onError: Nullable<() => void> = null;\r\n\r\n /** The size of the cubemap. */\r\n private _size: number;\r\n\r\n /** Whether to supersample the input image */\r\n private _supersample: boolean;\r\n\r\n /** The buffer of the image. */\r\n private _buffer: ArrayBuffer;\r\n\r\n /** The width of the input image. */\r\n private _width: number;\r\n\r\n /** The height of the input image. */\r\n private _height: number;\r\n\r\n /** The URL to the image. */\r\n public url: string;\r\n\r\n /**\r\n * Instantiates an EquiRectangularCubeTexture from the following parameters.\r\n * @param url The location of the image\r\n * @param scene The scene the texture will be used in\r\n * @param size The cubemap desired size (the more it increases the longer the generation will be)\r\n * @param noMipmap Forces to not generate the mipmap if true\r\n * @param gammaSpace Specifies if the texture will be used in gamma or linear space\r\n * (the PBR material requires those textures in linear space, but the standard material would require them in Gamma space)\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 supersample — defines if texture must be supersampled (default: false)\r\n */\r\n constructor(\r\n url: string,\r\n scene: Scene,\r\n size: number,\r\n noMipmap: boolean = false,\r\n gammaSpace: boolean = true,\r\n onLoad: Nullable<() => void> = null,\r\n onError: Nullable<(message?: string, exception?: any) => void> = null,\r\n supersample = false\r\n ) {\r\n super(scene);\r\n\r\n if (!url) {\r\n throw new Error(\"Image url is not set\");\r\n }\r\n\r\n this._coordinatesMode = Texture.CUBIC_MODE;\r\n this.name = url;\r\n this.url = url;\r\n this._size = size;\r\n this._supersample = supersample;\r\n this._noMipmap = noMipmap;\r\n this.gammaSpace = gammaSpace;\r\n this._onLoad = onLoad;\r\n this._onError = onError;\r\n\r\n this.hasAlpha = false;\r\n this.isCube = true;\r\n\r\n this._texture = this._getFromCache(url, this._noMipmap, undefined, undefined, undefined, this.isCube);\r\n\r\n if (!this._texture) {\r\n if (!scene.useDelayedTextureLoading) {\r\n this._loadImage(() => this._loadTexture(), this._onError);\r\n } else {\r\n this.delayLoadState = Constants.DELAYLOADSTATE_NOTLOADED;\r\n }\r\n } else if (onLoad) {\r\n if (this._texture.isReady) {\r\n Tools.SetImmediate(() => onLoad());\r\n } else {\r\n this._texture.onLoadedObservable.add(onLoad);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Load the image data, by putting the image on a canvas and extracting its buffer.\r\n * @param loadTextureCallback\r\n * @param onError\r\n */\r\n private _loadImage(loadTextureCallback: () => void, onError: Nullable<(message?: string, exception?: any) => void>): void {\r\n const scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n\r\n // Create texture before loading\r\n const texture = scene\r\n .getEngine()\r\n .createRawCubeTexture(\r\n null,\r\n this._size,\r\n Constants.TEXTUREFORMAT_RGB,\r\n scene.getEngine().getCaps().textureFloat ? Constants.TEXTURETYPE_FLOAT : Constants.TEXTURETYPE_UNSIGNED_INTEGER,\r\n !this._noMipmap,\r\n false,\r\n Constants.TEXTURE_TRILINEAR_SAMPLINGMODE\r\n );\r\n texture.generateMipMaps = !this._noMipmap;\r\n scene.addPendingData(texture);\r\n texture.url = this.url;\r\n texture.isReady = false;\r\n scene.getEngine()._internalTexturesCache.push(texture);\r\n this._texture = texture;\r\n\r\n LoadImage(\r\n this.url,\r\n (image) => {\r\n this._width = image.width;\r\n this._height = image.height;\r\n let canvas: HTMLCanvasElement | OffscreenCanvas;\r\n\r\n if (IsDocumentAvailable()) {\r\n canvas = document.createElement(\"canvas\");\r\n canvas.width = this._width;\r\n canvas.height = this._height;\r\n } else {\r\n // Canvas is not available in the current environment\r\n canvas = new OffscreenCanvas(this._width, this._height);\r\n }\r\n\r\n const ctx = canvas.getContext(\"2d\") as CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D;\r\n ctx.drawImage(image, 0, 0);\r\n\r\n const imageData = ctx.getImageData(0, 0, image.width, image.height);\r\n this._buffer = imageData.data.buffer as ArrayBuffer;\r\n\r\n if ((canvas as HTMLCanvasElement).remove) {\r\n (canvas as HTMLCanvasElement).remove();\r\n }\r\n loadTextureCallback();\r\n },\r\n (_, e) => {\r\n scene.removePendingData(texture);\r\n if (onError) {\r\n onError(`${this.getClassName()} could not be loaded`, e);\r\n }\r\n },\r\n scene ? scene.offlineProvider : null\r\n );\r\n }\r\n\r\n /**\r\n * Convert the image buffer into a cubemap and create a CubeTexture.\r\n */\r\n private _loadTexture(): void {\r\n const scene = this.getScene();\r\n const callback = (): ArrayBufferView[] => {\r\n const imageData = this._getFloat32ArrayFromArrayBuffer(this._buffer);\r\n\r\n // Extract the raw linear data.\r\n const data = PanoramaToCubeMapTools.ConvertPanoramaToCubemap(imageData, this._width, this._height, this._size, this._supersample);\r\n\r\n const results = [];\r\n\r\n // Push each faces.\r\n for (let i = 0; i < 6; i++) {\r\n const dataFace = (data as any)[EquiRectangularCubeTexture._FacesMapping[i]];\r\n results.push(dataFace);\r\n }\r\n\r\n return results;\r\n };\r\n\r\n if (!scene) {\r\n return;\r\n }\r\n const faceDataArrays = callback();\r\n\r\n const texture = this._texture!;\r\n scene.getEngine().updateRawCubeTexture(texture, faceDataArrays, texture.format, texture.type, texture.invertY);\r\n texture.isReady = true;\r\n scene.removePendingData(texture);\r\n\r\n texture.onLoadedObservable.notifyObservers(texture);\r\n texture.onLoadedObservable.clear();\r\n\r\n if (this._onLoad) {\r\n this._onLoad();\r\n }\r\n }\r\n\r\n /**\r\n * Convert the ArrayBuffer into a Float32Array and drop the transparency channel.\r\n * @param buffer The ArrayBuffer that should be converted.\r\n * @returns The buffer as Float32Array.\r\n */\r\n private _getFloat32ArrayFromArrayBuffer(buffer: ArrayBuffer): Float32Array {\r\n const dataView = new DataView(buffer);\r\n const floatImageData = new Float32Array((buffer.byteLength * 3) / 4);\r\n\r\n let k = 0;\r\n for (let i = 0; i < buffer.byteLength; i++) {\r\n // We drop the transparency channel, because we do not need/want it\r\n if ((i + 1) % 4 !== 0) {\r\n floatImageData[k++] = dataView.getUint8(i) / 255;\r\n }\r\n }\r\n\r\n return floatImageData;\r\n }\r\n\r\n /**\r\n * Get the current class name of the texture useful for serialization or dynamic coding.\r\n * @returns \"EquiRectangularCubeTexture\"\r\n */\r\n public override getClassName(): string {\r\n return \"EquiRectangularCubeTexture\";\r\n }\r\n\r\n /**\r\n * Create a clone of the current EquiRectangularCubeTexture and return it.\r\n * @returns A clone of the current EquiRectangularCubeTexture.\r\n */\r\n public override clone(): EquiRectangularCubeTexture {\r\n const scene = this.getScene();\r\n if (!scene) {\r\n return this;\r\n }\r\n\r\n const newTexture = new EquiRectangularCubeTexture(this.url, scene, this._size, this._noMipmap, this.gammaSpace);\r\n\r\n // Base texture\r\n newTexture.level = this.level;\r\n newTexture.wrapU = this.wrapU;\r\n newTexture.wrapV = this.wrapV;\r\n newTexture.coordinatesIndex = this.coordinatesIndex;\r\n newTexture.coordinatesMode = this.coordinatesMode;\r\n\r\n return newTexture;\r\n }\r\n\r\n /**\r\n * Finish the loading sequence of a texture flagged as delayed load.\r\n * @internal\r\n */\r\n public override delayLoad(): void {\r\n if (this.delayLoadState !== Constants.DELAYLOADSTATE_NOTLOADED) {\r\n return;\r\n }\r\n\r\n this._texture = this._getFromCache(this.url, this._noMipmap, undefined, undefined, undefined, this.isCube);\r\n\r\n if (!this._texture) {\r\n this.delayLoadState = Constants.DELAYLOADSTATE_LOADED;\r\n this._loadImage(() => {\r\n this._loadTexture();\r\n }, this._onError);\r\n } else {\r\n this.delayLoadState = Constants.DELAYLOADSTATE_LOADED;\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"equiRectangularCubeTexture.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/Textures/equiRectangularCubeTexture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,+CAA+C,CAAC;AACvF,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,SA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E,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QAEhH,eAAe;QACf,UAAU,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QAC9B,UAAU,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QAC9B,UAAU,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QAC9B,UAAU,CAAC,gBAAgB,GAAG,IAAI,CAAC,gBAAgB,CAAC;QACpD,UAAU,CAAC,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC;QAElD,OAAO,UAAU,CAAC;IACtB,CAAC;IAED;;;OAGG;IACa,SAAS;QACrB,IAAI,IAAI,CAAC,cAAc,KAAK,SAAS,CAAC,wBAAwB,EAAE,CAAC;YAC7D,OAAO;QACX,CAAC;QAED,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAC3G,IAAI,CAAC,cAAc,GAAG,SAAS,CAAC,qBAAqB,CAAC;QAEtD,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACjB,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE;gBACjB,IAAI,CAAC,YAAY,EAAE,CAAC;YACxB,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;QACtB,CAAC;IACL,CAAC;;AAjQD,iCAAiC;AAClB,wCAAa,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,AAAnD,CAAoD","sourcesContent":["import { PanoramaToCubeMapTools } from \"../../Misc/HighDynamicRange/panoramaToCubemap\";\r\nimport { BaseTexture } from \"./baseTexture\";\r\nimport { Texture } from \"./texture\";\r\nimport type { Scene } from \"../../scene\";\r\nimport type { Nullable } from \"../../types\";\r\nimport { Tools } from \"../../Misc/tools\";\r\nimport { Constants } from \"../../Engines/constants\";\r\nimport { LoadImage } from \"../../Misc/fileTools\";\r\nimport { IsDocumentAvailable } from \"core/Misc/domManagement\";\r\n\r\n/**\r\n * This represents a texture coming from an equirectangular image supported by the web browser canvas.\r\n */\r\nexport class EquiRectangularCubeTexture extends BaseTexture {\r\n /** The six faces of the cube. */\r\n private static _FacesMapping = [\"right\", \"left\", \"up\", \"down\", \"front\", \"back\"];\r\n\r\n private _noMipmap: boolean;\r\n private _onLoad: Nullable<() => void> = null;\r\n private _onError: Nullable<() => void> = null;\r\n\r\n /** The size of the cubemap. */\r\n private _size: number;\r\n\r\n /** Whether to supersample the input image */\r\n private _supersample: boolean;\r\n\r\n /** The buffer of the image. */\r\n private _buffer: ArrayBuffer;\r\n\r\n /** The width of the input image. */\r\n private _width: number;\r\n\r\n /** The height of the input image. */\r\n private _height: number;\r\n\r\n /** The URL to the image. */\r\n public url: string;\r\n\r\n /**\r\n * Instantiates an EquiRectangularCubeTexture from the following parameters.\r\n * @param url The location of the image\r\n * @param scene The scene the texture will be used in\r\n * @param size The cubemap desired size (the more it increases the longer the generation will be)\r\n * @param noMipmap Forces to not generate the mipmap if true\r\n * @param gammaSpace Specifies if the texture will be used in gamma or linear space\r\n * (the PBR material requires those textures in linear space, but the standard material would require them in Gamma space)\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 supersample — defines if texture must be supersampled (default: false)\r\n */\r\n constructor(\r\n url: string,\r\n scene: Scene,\r\n size: number,\r\n noMipmap: boolean = false,\r\n gammaSpace: boolean = true,\r\n onLoad: Nullable<() => void> = null,\r\n onError: Nullable<(message?: string, exception?: any) => void> = null,\r\n supersample = false\r\n ) {\r\n super(scene);\r\n\r\n if (!url) {\r\n throw new Error(\"Image url is not set\");\r\n }\r\n\r\n this._coordinatesMode = Texture.CUBIC_MODE;\r\n this.name = url;\r\n this.url = url;\r\n this._size = size;\r\n this._supersample = supersample;\r\n this._noMipmap = noMipmap;\r\n this.gammaSpace = gammaSpace;\r\n this._onLoad = onLoad;\r\n this._onError = onError;\r\n\r\n this.hasAlpha = false;\r\n this.isCube = true;\r\n\r\n this._texture = this._getFromCache(url, this._noMipmap, undefined, undefined, undefined, this.isCube);\r\n\r\n if (!this._texture) {\r\n if (!scene.useDelayedTextureLoading) {\r\n this._loadImage(() => this._loadTexture(), this._onError);\r\n } else {\r\n this.delayLoadState = Constants.DELAYLOADSTATE_NOTLOADED;\r\n }\r\n } else if (onLoad) {\r\n if (this._texture.isReady) {\r\n Tools.SetImmediate(() => onLoad());\r\n } else {\r\n this._texture.onLoadedObservable.add(onLoad);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Load the image data, by putting the image on a canvas and extracting its buffer.\r\n * @param loadTextureCallback\r\n * @param onError\r\n */\r\n private _loadImage(loadTextureCallback: () => void, onError: Nullable<(message?: string, exception?: any) => void>): void {\r\n const scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n\r\n // Create texture before loading\r\n const texture = scene\r\n .getEngine()\r\n .createRawCubeTexture(\r\n null,\r\n this._size,\r\n Constants.TEXTUREFORMAT_RGB,\r\n scene.getEngine().getCaps().textureFloat ? Constants.TEXTURETYPE_FLOAT : Constants.TEXTURETYPE_UNSIGNED_INTEGER,\r\n !this._noMipmap,\r\n false,\r\n Constants.TEXTURE_TRILINEAR_SAMPLINGMODE\r\n );\r\n texture.generateMipMaps = !this._noMipmap;\r\n scene.addPendingData(texture);\r\n texture.url = this.url;\r\n texture.isReady = false;\r\n scene.getEngine()._internalTexturesCache.push(texture);\r\n this._texture = texture;\r\n\r\n LoadImage(\r\n this.url,\r\n (image) => {\r\n this._width = image.width;\r\n this._height = image.height;\r\n let canvas: HTMLCanvasElement | OffscreenCanvas;\r\n\r\n if (IsDocumentAvailable()) {\r\n canvas = document.createElement(\"canvas\");\r\n canvas.width = this._width;\r\n canvas.height = this._height;\r\n } else {\r\n // Canvas is not available in the current environment\r\n canvas = new OffscreenCanvas(this._width, this._height);\r\n }\r\n\r\n const ctx = canvas.getContext(\"2d\") as CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D;\r\n ctx.drawImage(image, 0, 0);\r\n\r\n const imageData = ctx.getImageData(0, 0, image.width, image.height);\r\n this._buffer = imageData.data.buffer as ArrayBuffer;\r\n\r\n if ((canvas as HTMLCanvasElement).remove) {\r\n (canvas as HTMLCanvasElement).remove();\r\n }\r\n loadTextureCallback();\r\n },\r\n (_, e) => {\r\n scene.removePendingData(texture);\r\n if (onError) {\r\n onError(`${this.getClassName()} could not be loaded`, e);\r\n }\r\n },\r\n scene ? scene.offlineProvider : null\r\n );\r\n }\r\n\r\n /**\r\n * Convert the image buffer into a cubemap and create a CubeTexture.\r\n */\r\n private _loadTexture(): void {\r\n const scene = this.getScene();\r\n const callback = (): ArrayBufferView[] => {\r\n const imageData = this._getFloat32ArrayFromArrayBuffer(this._buffer);\r\n\r\n // Extract the raw linear data.\r\n const data = PanoramaToCubeMapTools.ConvertPanoramaToCubemap(imageData, this._width, this._height, this._size, this._supersample);\r\n\r\n const results = [];\r\n\r\n // Push each faces.\r\n for (let i = 0; i < 6; i++) {\r\n const dataFace = (data as any)[EquiRectangularCubeTexture._FacesMapping[i]];\r\n results.push(dataFace);\r\n }\r\n\r\n return results;\r\n };\r\n\r\n if (!scene) {\r\n return;\r\n }\r\n const faceDataArrays = callback();\r\n\r\n const texture = this._texture!;\r\n scene.getEngine().updateRawCubeTexture(texture, faceDataArrays, texture.format, texture.type, texture.invertY);\r\n texture.isReady = true;\r\n scene.removePendingData(texture);\r\n\r\n texture.onLoadedObservable.notifyObservers(texture);\r\n texture.onLoadedObservable.clear();\r\n\r\n if (this._onLoad) {\r\n this._onLoad();\r\n }\r\n }\r\n\r\n /**\r\n * Convert the ArrayBuffer into a Float32Array and drop the transparency channel.\r\n * @param buffer The ArrayBuffer that should be converted.\r\n * @returns The buffer as Float32Array.\r\n */\r\n private _getFloat32ArrayFromArrayBuffer(buffer: ArrayBuffer): Float32Array {\r\n const dataView = new DataView(buffer);\r\n const floatImageData = new Float32Array((buffer.byteLength * 3) / 4);\r\n\r\n let k = 0;\r\n for (let i = 0; i < buffer.byteLength; i++) {\r\n // We drop the transparency channel, because we do not need/want it\r\n if ((i + 1) % 4 !== 0) {\r\n floatImageData[k++] = dataView.getUint8(i) / 255;\r\n }\r\n }\r\n\r\n return floatImageData;\r\n }\r\n\r\n /**\r\n * Get the current class name of the texture useful for serialization or dynamic coding.\r\n * @returns \"EquiRectangularCubeTexture\"\r\n */\r\n public override getClassName(): string {\r\n return \"EquiRectangularCubeTexture\";\r\n }\r\n\r\n /**\r\n * Create a clone of the current EquiRectangularCubeTexture and return it.\r\n * @returns A clone of the current EquiRectangularCubeTexture.\r\n */\r\n public override clone(): EquiRectangularCubeTexture {\r\n const scene = this.getScene();\r\n if (!scene) {\r\n return this;\r\n }\r\n\r\n const newTexture = new EquiRectangularCubeTexture(this.url, scene, this._size, this._noMipmap, this.gammaSpace);\r\n\r\n // Base texture\r\n newTexture.level = this.level;\r\n newTexture.wrapU = this.wrapU;\r\n newTexture.wrapV = this.wrapV;\r\n newTexture.coordinatesIndex = this.coordinatesIndex;\r\n newTexture.coordinatesMode = this.coordinatesMode;\r\n\r\n return newTexture;\r\n }\r\n\r\n /**\r\n * Finish the loading sequence of a texture flagged as delayed load.\r\n * @internal\r\n */\r\n public override delayLoad(): void {\r\n if (this.delayLoadState !== Constants.DELAYLOADSTATE_NOTLOADED) {\r\n return;\r\n }\r\n\r\n this._texture = this._getFromCache(this.url, this._noMipmap, undefined, undefined, undefined, this.isCube);\r\n this.delayLoadState = Constants.DELAYLOADSTATE_LOADED;\r\n\r\n if (!this._texture) {\r\n this._loadImage(() => {\r\n this._loadTexture();\r\n }, this._onError);\r\n }\r\n }\r\n}\r\n"]}
@@ -364,10 +364,10 @@ export function BindBonesParameters(mesh, effect, prePassConfiguration) {
364
364
  }
365
365
  if (mesh.useBones && mesh.computeBonesUsingShaders && mesh.skeleton) {
366
366
  const skeleton = mesh.skeleton;
367
- if (skeleton.isUsingTextureForMatrices && effect.getUniformIndex("boneTextureWidth") > -1) {
367
+ if (skeleton.isUsingTextureForMatrices && effect.getUniformIndex("boneTextureInfo") > -1) {
368
368
  const boneTexture = skeleton.getTransformMatrixTexture(mesh);
369
369
  effect.setTexture("boneSampler", boneTexture);
370
- effect.setFloat("boneTextureWidth", 4.0 * (skeleton.bones.length + 1));
370
+ effect.setFloat2("boneTextureInfo", skeleton._textureWidth, skeleton._textureHeight);
371
371
  }
372
372
  else {
373
373
  const matrices = skeleton.getTransformMatrices(mesh);