@babylonjs/core 5.30.0 → 5.31.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.
Files changed (91) hide show
  1. package/Animations/animatable.d.ts +1 -0
  2. package/Animations/animatable.js +7 -0
  3. package/Animations/animatable.js.map +1 -1
  4. package/Cameras/cameraInputsManager.d.ts +2 -2
  5. package/Cameras/cameraInputsManager.js +5 -4
  6. package/Cameras/cameraInputsManager.js.map +1 -1
  7. package/Engines/Extensions/engine.rawTexture.js +17 -0
  8. package/Engines/Extensions/engine.rawTexture.js.map +1 -1
  9. package/Engines/Extensions/engine.views.js +2 -2
  10. package/Engines/Extensions/engine.views.js.map +1 -1
  11. package/Engines/Processors/iShaderProcessor.d.ts +4 -0
  12. package/Engines/Processors/iShaderProcessor.js.map +1 -1
  13. package/Engines/Processors/shaderCodeNode.js +11 -2
  14. package/Engines/Processors/shaderCodeNode.js.map +1 -1
  15. package/Engines/Processors/shaderProcessor.js +4 -1
  16. package/Engines/Processors/shaderProcessor.js.map +1 -1
  17. package/Engines/WebGPU/Extensions/engine.rawTexture.js +3 -0
  18. package/Engines/WebGPU/Extensions/engine.rawTexture.js.map +1 -1
  19. package/Engines/WebGPU/webgpuShaderProcessorsGLSL.d.ts +6 -0
  20. package/Engines/WebGPU/webgpuShaderProcessorsGLSL.js +36 -8
  21. package/Engines/WebGPU/webgpuShaderProcessorsGLSL.js.map +1 -1
  22. package/Engines/nativeEngine.js +1 -0
  23. package/Engines/nativeEngine.js.map +1 -1
  24. package/Engines/thinEngine.js +6 -4
  25. package/Engines/thinEngine.js.map +1 -1
  26. package/Layers/effectLayer.js +1 -1
  27. package/Layers/effectLayer.js.map +1 -1
  28. package/Lights/Shadows/cascadedShadowGenerator.d.ts +3 -1
  29. package/Lights/Shadows/cascadedShadowGenerator.js +19 -16
  30. package/Lights/Shadows/cascadedShadowGenerator.js.map +1 -1
  31. package/Lights/Shadows/shadowGenerator.d.ts +6 -2
  32. package/Lights/Shadows/shadowGenerator.js +40 -11
  33. package/Lights/Shadows/shadowGenerator.js.map +1 -1
  34. package/Lights/Shadows/shadowGeneratorSceneComponent.js +16 -8
  35. package/Lights/Shadows/shadowGeneratorSceneComponent.js.map +1 -1
  36. package/Lights/light.d.ts +10 -3
  37. package/Lights/light.js +28 -6
  38. package/Lights/light.js.map +1 -1
  39. package/Lights/pointLight.js +6 -2
  40. package/Lights/pointLight.js.map +1 -1
  41. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.d.ts +3 -1
  42. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js +8 -2
  43. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js.map +1 -1
  44. package/Materials/Node/Blocks/PBR/anisotropyBlock.d.ts +4 -0
  45. package/Materials/Node/Blocks/PBR/anisotropyBlock.js +11 -1
  46. package/Materials/Node/Blocks/PBR/anisotropyBlock.js.map +1 -1
  47. package/Materials/Node/Blocks/PBR/clearCoatBlock.d.ts +1 -0
  48. package/Materials/Node/Blocks/PBR/clearCoatBlock.js +7 -1
  49. package/Materials/Node/Blocks/PBR/clearCoatBlock.js.map +1 -1
  50. package/Materials/materialHelper.js +2 -1
  51. package/Materials/materialHelper.js.map +1 -1
  52. package/Materials/uniformBuffer.js +1 -1
  53. package/Materials/uniformBuffer.js.map +1 -1
  54. package/Maths/math.vector.d.ts +16 -0
  55. package/Maths/math.vector.js +16 -0
  56. package/Maths/math.vector.js.map +1 -1
  57. package/Meshes/abstractMesh.js +11 -7
  58. package/Meshes/abstractMesh.js.map +1 -1
  59. package/Meshes/mesh.d.ts +5 -3
  60. package/Meshes/mesh.js +30 -19
  61. package/Meshes/mesh.js.map +1 -1
  62. package/Meshes/transformNode.d.ts +1 -1
  63. package/Meshes/transformNode.js +1 -1
  64. package/Meshes/transformNode.js.map +1 -1
  65. package/Misc/sceneRecorder.js +10 -4
  66. package/Misc/sceneRecorder.js.map +1 -1
  67. package/PostProcesses/motionBlurPostProcess.js +7 -5
  68. package/PostProcesses/motionBlurPostProcess.js.map +1 -1
  69. package/Shaders/ShadersInclude/hdrFilteringFunctions.js +3 -3
  70. package/Shaders/ShadersInclude/hdrFilteringFunctions.js.map +1 -1
  71. package/Shaders/ShadersInclude/helperFunctions.js +2 -2
  72. package/Shaders/ShadersInclude/helperFunctions.js.map +1 -1
  73. package/Shaders/ShadersInclude/mrtFragmentDeclaration.js +1 -1
  74. package/Shaders/ShadersInclude/mrtFragmentDeclaration.js.map +1 -1
  75. package/Shaders/ShadersInclude/shadowsFragmentFunctions.js +3 -3
  76. package/Shaders/ShadersInclude/shadowsFragmentFunctions.js.map +1 -1
  77. package/Shaders/fxaa.fragment.js +1 -1
  78. package/Shaders/fxaa.fragment.js.map +1 -1
  79. package/Shaders/motionBlur.fragment.js +2 -2
  80. package/Shaders/motionBlur.fragment.js.map +1 -1
  81. package/Shaders/shadowMap.fragment.js +6 -4
  82. package/Shaders/shadowMap.fragment.js.map +1 -1
  83. package/Shaders/shadowMap.vertex.js +2 -2
  84. package/Shaders/shadowMap.vertex.js.map +1 -1
  85. package/Shaders/spriteMap.fragment.js +1 -1
  86. package/Shaders/spriteMap.fragment.js.map +1 -1
  87. package/XR/webXRCamera.js +2 -0
  88. package/XR/webXRCamera.js.map +1 -1
  89. package/assetContainer.js +2 -2
  90. package/assetContainer.js.map +1 -1
  91. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"engine.rawTexture.js","sourceRoot":"","sources":["../../../../../../lts/core/generated/Engines/Extensions/engine.rawTexture.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AAClG,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AA4R3C,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AAC,EAAE;YACzB,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC;SACtD;QAED,IAAI,WAAW,IAAI,IAAI,EAAE;YACrB,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;SAC5I;aAAM;YACH,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;SAC3I;QAED,IAAI,OAAO,CAAC,eAAe,EAAE;YACzB,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;SACnC;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 { Tools } from \"../../Misc/tools\";\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\n\r\ndeclare module \"../../Engines/thinEngine\" {\r\n export interface ThinEngine {\r\n /**\r\n * Creates a raw texture\r\n * @param data defines the data to store in the texture\r\n * @param width defines the width of the texture\r\n * @param height defines the height of the texture\r\n * @param format defines the format of the data\r\n * @param generateMipMaps defines if the engine should generate the mip levels\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param samplingMode defines the required sampling mode (Texture.NEAREST_SAMPLINGMODE by default)\r\n * @param compression defines the compression used (null by default)\r\n * @param type defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_INT by default)\r\n * @param creationFlags specific flags to use when creating the texture (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg)\r\n * @param useSRGBBuffer defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU).\r\n * @returns the raw texture inside an InternalTexture\r\n */\r\n createRawTexture(\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>,\r\n type: number,\r\n creationFlags?: number,\r\n useSRGBBuffer?: boolean\r\n ): InternalTexture;\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 */\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_INT 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 /**\r\n * Creates a new raw cube texture\r\n * @param data defines the array of data to use to create each face\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 of the data (like Engine.TEXTURETYPE_UNSIGNED_INT)\r\n * @param generateMipMaps defines if the engine should generate the mip levels\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param samplingMode defines the required sampling mode (like Texture.NEAREST_SAMPLINGMODE)\r\n * @param compression defines the compression used (null by default)\r\n * @returns the cube texture as an InternalTexture\r\n */\r\n createRawCubeTexture(\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>\r\n ): InternalTexture;\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_INT 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_INT 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_INT 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_INT)\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_INT)\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 * Creates a new raw 3D texture\r\n * @param data defines the data used to create the texture\r\n * @param width defines the width of the texture\r\n * @param height defines the height of the texture\r\n * @param depth defines the depth of the texture\r\n * @param format defines the format of the texture\r\n * @param generateMipMaps defines if the engine must generate mip levels\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param samplingMode defines the required sampling mode (like Texture.NEAREST_SAMPLINGMODE)\r\n * @param compression defines the compressed used (can be null)\r\n * @param textureType defines the compressed used (can be null)\r\n * @param creationFlags specific flags to use when creating the texture (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg)\r\n * @returns a new raw 3D texture (stored in an InternalTexture)\r\n */\r\n createRawTexture3D(\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>,\r\n textureType: number,\r\n creationFlags?: number\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_INT, 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 * Creates a new raw 2D array texture\r\n * @param data defines the data used to create the texture\r\n * @param width defines the width of the texture\r\n * @param height defines the height of the texture\r\n * @param depth defines the number of layers of the texture\r\n * @param format defines the format of the texture\r\n * @param generateMipMaps defines if the engine must generate mip levels\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param samplingMode defines the required sampling mode (like Texture.NEAREST_SAMPLINGMODE)\r\n * @param compression defines the compressed used (can be null)\r\n * @param textureType defines the compressed used (can be null)\r\n * @param creationFlags specific flags to use when creating the texture (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg)\r\n * @returns a new raw 2D array texture (stored in an InternalTexture)\r\n */\r\n createRawTexture2DArray(\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>,\r\n textureType: number,\r\n creationFlags?: number\r\n ): InternalTexture;\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_INT, 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_INT,\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_INT,\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\r\n // Double check on POT to generate Mips.\r\n const isPot = !this.needPOTTextures || (Tools.IsExponentOfTwo(texture.width) && Tools.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 }\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\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 || (Tools.IsExponentOfTwo(texture.width) && Tools.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 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_INT\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_INT\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":["../../../../../../lts/core/generated/Engines/Extensions/engine.rawTexture.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AAClG,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AA4R3C,UAAU,CAAC,SAAS,CAAC,gBAAgB,GAAG,UACpC,OAAkC,EAClC,IAA+B,EAC/B,MAAc,EACd,OAAgB,EAChB,c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CAAC,EAAE,IAAI,CAAC,CAAC;SAC5I;aAAM;YACH,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;SAC3I;QAED,IAAI,OAAO,CAAC,eAAe,EAAE;YACzB,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;SACnC;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 { Tools } from \"../../Misc/tools\";\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\n\r\ndeclare module \"../../Engines/thinEngine\" {\r\n export interface ThinEngine {\r\n /**\r\n * Creates a raw texture\r\n * @param data defines the data to store in the texture\r\n * @param width defines the width of the texture\r\n * @param height defines the height of the texture\r\n * @param format defines the format of the data\r\n * @param generateMipMaps defines if the engine should generate the mip levels\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param samplingMode defines the required sampling mode (Texture.NEAREST_SAMPLINGMODE by default)\r\n * @param compression defines the compression used (null by default)\r\n * @param type defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_INT by default)\r\n * @param creationFlags specific flags to use when creating the texture (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg)\r\n * @param useSRGBBuffer defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU).\r\n * @returns the raw texture inside an InternalTexture\r\n */\r\n createRawTexture(\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>,\r\n type: number,\r\n creationFlags?: number,\r\n useSRGBBuffer?: boolean\r\n ): InternalTexture;\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 */\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_INT 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 /**\r\n * Creates a new raw cube texture\r\n * @param data defines the array of data to use to create each face\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 of the data (like Engine.TEXTURETYPE_UNSIGNED_INT)\r\n * @param generateMipMaps defines if the engine should generate the mip levels\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param samplingMode defines the required sampling mode (like Texture.NEAREST_SAMPLINGMODE)\r\n * @param compression defines the compression used (null by default)\r\n * @returns the cube texture as an InternalTexture\r\n */\r\n createRawCubeTexture(\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>\r\n ): InternalTexture;\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_INT 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_INT 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_INT 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_INT)\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_INT)\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 * Creates a new raw 3D texture\r\n * @param data defines the data used to create the texture\r\n * @param width defines the width of the texture\r\n * @param height defines the height of the texture\r\n * @param depth defines the depth of the texture\r\n * @param format defines the format of the texture\r\n * @param generateMipMaps defines if the engine must generate mip levels\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param samplingMode defines the required sampling mode (like Texture.NEAREST_SAMPLINGMODE)\r\n * @param compression defines the compressed used (can be null)\r\n * @param textureType defines the compressed used (can be null)\r\n * @param creationFlags specific flags to use when creating the texture (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg)\r\n * @returns a new raw 3D texture (stored in an InternalTexture)\r\n */\r\n createRawTexture3D(\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>,\r\n textureType: number,\r\n creationFlags?: number\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_INT, 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 * Creates a new raw 2D array texture\r\n * @param data defines the data used to create the texture\r\n * @param width defines the width of the texture\r\n * @param height defines the height of the texture\r\n * @param depth defines the number of layers of the texture\r\n * @param format defines the format of the texture\r\n * @param generateMipMaps defines if the engine must generate mip levels\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param samplingMode defines the required sampling mode (like Texture.NEAREST_SAMPLINGMODE)\r\n * @param compression defines the compressed used (can be null)\r\n * @param textureType defines the compressed used (can be null)\r\n * @param creationFlags specific flags to use when creating the texture (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg)\r\n * @returns a new raw 2D array texture (stored in an InternalTexture)\r\n */\r\n createRawTexture2DArray(\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>,\r\n textureType: number,\r\n creationFlags?: number\r\n ): InternalTexture;\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_INT, 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_INT,\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_INT,\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 || (Tools.IsExponentOfTwo(texture.width) && Tools.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 || (Tools.IsExponentOfTwo(texture.width) && Tools.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 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_INT\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_INT\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"]}
@@ -57,7 +57,7 @@ Engine.prototype.registerView = function (canvas, camera, clearBeforeCopy) {
57
57
  return newView;
58
58
  };
59
59
  Engine.prototype.unRegisterView = function (canvas) {
60
- if (!this.views) {
60
+ if (!this.views || this.views.length === 0) {
61
61
  return this;
62
62
  }
63
63
  for (const view of this.views) {
@@ -72,7 +72,7 @@ Engine.prototype.unRegisterView = function (canvas) {
72
72
  return this;
73
73
  };
74
74
  Engine.prototype._renderViews = function () {
75
- if (!this.views) {
75
+ if (!this.views || this.views.length === 0) {
76
76
  return false;
77
77
  }
78
78
  const parent = this.getRenderingCanvas();
@@ -1 +1 @@
1
- {"version":3,"file":"engine.views.js","sourceRoot":"","sources":["../../../../../../lts/core/generated/Engines/Extensions/engine.views.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAInC,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD;;;GAGG;AACH,MAAM,OAAO,UAAU;CAetB;AAsDD,MAAM,6BAA6B,GAAG,IAAI,UAAU,EAAc,CAAC;AACnE,MAAM,4BAA4B,GAAG,IAAI,UAAU,EAAc,CAAC;AAElE,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,SAAS,EAAE,8BAA8B,EAAE;IACpE,GAAG,EAAE;QACD,OAAO,6BAA6B,CAAC;IACzC,CAAC;CACJ,CAAC,CAAC;AAEH,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,SAAS,EAAE,6BAA6B,EAAE;IACnE,GAAG,EAAE;QACD,OAAO,4BAA4B,CAAC;IACxC,CAAC;CACJ,CAAC,CAAC;AAEH,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,SAAS,EAAE,cAAc,EAAE;IACpD,GAAG,EAAE;QACD,OAAO,IAAI,CAAC,aAAa,CAAC;IAC9B,CAAC;IACD,GAAG,EAAE,UAAwB,KAAkB;;QAC3C,IAAI,IAAI,CAAC,aAAa,KAAK,KAAK,EAAE;YAC9B,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;YAC3B,MAAA,IAAI,CAAC,oBAAoB,oDAAI,CAAC;SACjC;IACL,CAAC;CACJ,CAAC,CAAC;AAEH,MAAM,CAAC,SAAS,CAAC,eAAe,GAAG;IAC/B,OAAO,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,kBAAkB,EAAE,CAAC;AAC1D,CAAC,CAAC;AAEF,MAAM,CAAC,SAAS,CAAC,YAAY,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CAAC;KACtD;IAED,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;IAEvB,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC","sourcesContent":["import { Engine } from \"../engine\";\r\nimport type { Camera } from \"../../Cameras/camera\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { Observable } from \"../../Misc/observable\";\r\n\r\n/**\r\n * Class used to define an additional view for the engine\r\n * @see https://doc.babylonjs.com/divingDeeper/scene/multiCanvas\r\n */\r\nexport class EngineView {\r\n /**\r\n * A randomly generated unique id\r\n */\r\n readonly id: string;\r\n /** Defines the canvas where to render the view */\r\n target: HTMLCanvasElement;\r\n /** Defines an optional camera used to render the view (will use active camera else) */\r\n camera?: Camera;\r\n /** Indicates if the destination view canvas should be cleared before copying the parent canvas. Can help if the scene clear color has alpha < 1 */\r\n clearBeforeCopy?: boolean;\r\n /** Indicates if the view is enabled (true by default) */\r\n enabled: boolean;\r\n /** Defines a custom function to handle canvas size changes. (the canvas to render into is provided to the callback) */\r\n customResize?: (canvas: HTMLCanvasElement) => void;\r\n}\r\n\r\ndeclare module \"../../Engines/engine\" {\r\n export interface Engine {\r\n /** @internal */\r\n _inputElement: Nullable<HTMLElement>;\r\n\r\n /**\r\n * Gets or sets the HTML element to use for attaching events\r\n */\r\n inputElement: Nullable<HTMLElement>;\r\n\r\n /**\r\n * Observable to handle when a change to inputElement occurs\r\n * @internal\r\n */\r\n _onEngineViewChanged?: () => void;\r\n\r\n /**\r\n * Will be triggered before the view renders\r\n */\r\n readonly onBeforeViewRenderObservable: Observable<EngineView>;\r\n /**\r\n * Will be triggered after the view rendered\r\n */\r\n readonly onAfterViewRenderObservable: Observable<EngineView>;\r\n\r\n /**\r\n * Gets the current engine view\r\n * @see https://doc.babylonjs.com/how_to/multi_canvases\r\n */\r\n activeView: Nullable<EngineView>;\r\n\r\n /** Gets or sets the list of views */\r\n views: EngineView[];\r\n\r\n /**\r\n * Register a new child canvas\r\n * @param canvas defines the canvas to register\r\n * @param camera defines an optional camera to use with this canvas (it will overwrite the scene.camera for this view)\r\n * @param clearBeforeCopy Indicates if the destination view canvas should be cleared before copying the parent canvas. Can help if the scene clear color has alpha < 1\r\n * @returns the associated view\r\n */\r\n registerView(canvas: HTMLCanvasElement, camera?: Camera, clearBeforeCopy?: boolean): EngineView;\r\n\r\n /**\r\n * Remove a registered child canvas\r\n * @param canvas defines the canvas to remove\r\n * @returns the current engine\r\n */\r\n unRegisterView(canvas: HTMLCanvasElement): Engine;\r\n }\r\n}\r\n\r\nconst _onBeforeViewRenderObservable = new Observable<EngineView>();\r\nconst _onAfterViewRenderObservable = new Observable<EngineView>();\r\n\r\nObject.defineProperty(Engine.prototype, \"onBeforeViewRenderObservable\", {\r\n get: function (this: Engine) {\r\n return _onBeforeViewRenderObservable;\r\n },\r\n});\r\n\r\nObject.defineProperty(Engine.prototype, \"onAfterViewRenderObservable\", {\r\n get: function (this: Engine) {\r\n return _onAfterViewRenderObservable;\r\n },\r\n});\r\n\r\nObject.defineProperty(Engine.prototype, \"inputElement\", {\r\n get: function (this: Engine) {\r\n return this._inputElement;\r\n },\r\n set: function (this: Engine, value: HTMLElement) {\r\n if (this._inputElement !== value) {\r\n this._inputElement = value;\r\n this._onEngineViewChanged?.();\r\n }\r\n },\r\n});\r\n\r\nEngine.prototype.getInputElement = function (): Nullable<HTMLElement> {\r\n return this.inputElement || this.getRenderingCanvas();\r\n};\r\n\r\nEngine.prototype.registerView = function (canvas: HTMLCanvasElement, camera?: Camera, clearBeforeCopy?: boolean): EngineView {\r\n if (!this.views) {\r\n this.views = [];\r\n }\r\n\r\n for (const view of this.views) {\r\n if (view.target === canvas) {\r\n return view;\r\n }\r\n }\r\n\r\n const masterCanvas = this.getRenderingCanvas();\r\n if (masterCanvas) {\r\n canvas.width = masterCanvas.width;\r\n canvas.height = masterCanvas.height;\r\n }\r\n\r\n const newView = { target: canvas, camera, clearBeforeCopy, enabled: true, id: (Math.random() * 100000).toFixed() };\r\n this.views.push(newView);\r\n\r\n if (camera) {\r\n camera.onDisposeObservable.add(() => {\r\n this.unRegisterView(canvas);\r\n });\r\n }\r\n\r\n return newView;\r\n};\r\n\r\nEngine.prototype.unRegisterView = function (canvas: HTMLCanvasElement): Engine {\r\n if (!this.views) {\r\n return this;\r\n }\r\n\r\n for (const view of this.views) {\r\n if (view.target === canvas) {\r\n const index = this.views.indexOf(view);\r\n\r\n if (index !== -1) {\r\n this.views.splice(index, 1);\r\n }\r\n break;\r\n }\r\n }\r\n\r\n return this;\r\n};\r\n\r\nEngine.prototype._renderViews = function () {\r\n if (!this.views) {\r\n return false;\r\n }\r\n\r\n const parent = this.getRenderingCanvas();\r\n\r\n if (!parent) {\r\n return false;\r\n }\r\n\r\n for (const view of this.views) {\r\n if (!view.enabled) {\r\n continue;\r\n }\r\n const canvas = view.target;\r\n const context = canvas.getContext(\"2d\");\r\n if (!context) {\r\n continue;\r\n }\r\n _onBeforeViewRenderObservable.notifyObservers(view);\r\n const camera = view.camera;\r\n let previewCamera: Nullable<Camera> = null;\r\n let scene: Nullable<Scene> = null;\r\n if (camera) {\r\n scene = camera.getScene();\r\n\r\n if (scene.activeCameras && scene.activeCameras.length) {\r\n continue;\r\n }\r\n\r\n this.activeView = view;\r\n\r\n previewCamera = scene.activeCamera;\r\n scene.activeCamera = camera;\r\n }\r\n\r\n if (view.customResize) {\r\n view.customResize(canvas);\r\n } else {\r\n // Set sizes\r\n const width = Math.floor(canvas.clientWidth / this._hardwareScalingLevel);\r\n const height = Math.floor(canvas.clientHeight / this._hardwareScalingLevel);\r\n\r\n const dimsChanged = width !== canvas.width || parent.width !== canvas.width || height !== canvas.height || parent.height !== canvas.height;\r\n if (canvas.clientWidth && canvas.clientHeight && dimsChanged) {\r\n canvas.width = width;\r\n canvas.height = height;\r\n this.setSize(width, height);\r\n }\r\n }\r\n\r\n if (!parent.width || !parent.height) {\r\n return false;\r\n }\r\n\r\n // Render the frame\r\n this._renderFrame();\r\n\r\n this.flushFramebuffer();\r\n\r\n // Copy to target\r\n if (view.clearBeforeCopy) {\r\n context.clearRect(0, 0, parent.width, parent.height);\r\n }\r\n context.drawImage(parent, 0, 0);\r\n\r\n // Restore\r\n if (previewCamera && scene) {\r\n scene.activeCamera = previewCamera;\r\n }\r\n _onAfterViewRenderObservable.notifyObservers(view);\r\n }\r\n\r\n this.activeView = null;\r\n\r\n return true;\r\n};\r\n"]}
1
+ {"version":3,"file":"engine.views.js","sourceRoot":"","sources":["../../../../../../lts/core/generated/Engines/Extensions/engine.views.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAInC,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD;;;GAGG;AACH,MAAM,OAAO,UAAU;CAetB;AAsDD,MAAM,6BAA6B,GAAG,IAAI,UAAU,EAAc,CAAC;AACnE,MAAM,4BAA4B,GAAG,IAAI,UAAU,EAAc,CAAC;AAElE,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,SAAS,EAAE,8BAA8B,EAAE;IACpE,GAAG,EAAE;QACD,OAAO,6BAA6B,CAAC;IACzC,CAAC;CACJ,CAAC,CAAC;AAEH,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,SAAS,EAAE,6BAA6B,EAAE;IACnE,GAAG,EAAE;QACD,OAAO,4BAA4B,CAAC;IACxC,CAAC;CACJ,CAAC,CAAC;AAEH,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,SAAS,EAAE,cAAc,EAAE;IACpD,GAAG,EAAE;QACD,OAAO,IAAI,CAAC,aAAa,CAAC;IAC9B,CAAC;IACD,GAAG,EAAE,UAAwB,KAAkB;;QAC3C,IAAI,IAAI,CAAC,aAAa,KAAK,KAAK,EAAE;YAC9B,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;YAC3B,MAAA,IAAI,CAAC,oBAAoB,oDAAI,CAAC;SACjC;IACL,CAAC;CACJ,CAAC,CAAC;AAEH,MAAM,CA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AAE,MAAM,CAAC,MAAM,CAAC,CAAC;SACxD;QACD,OAAO,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAEhC,UAAU;QACV,IAAI,aAAa,IAAI,KAAK,EAAE;YACxB,KAAK,CAAC,YAAY,GAAG,aAAa,CAAC;SACtC;QACD,4BAA4B,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;KACtD;IAED,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;IAEvB,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC","sourcesContent":["import { Engine } from \"../engine\";\r\nimport type { Camera } from \"../../Cameras/camera\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { Observable } from \"../../Misc/observable\";\r\n\r\n/**\r\n * Class used to define an additional view for the engine\r\n * @see https://doc.babylonjs.com/divingDeeper/scene/multiCanvas\r\n */\r\nexport class EngineView {\r\n /**\r\n * A randomly generated unique id\r\n */\r\n readonly id: string;\r\n /** Defines the canvas where to render the view */\r\n target: HTMLCanvasElement;\r\n /** Defines an optional camera used to render the view (will use active camera else) */\r\n camera?: Camera;\r\n /** Indicates if the destination view canvas should be cleared before copying the parent canvas. Can help if the scene clear color has alpha < 1 */\r\n clearBeforeCopy?: boolean;\r\n /** Indicates if the view is enabled (true by default) */\r\n enabled: boolean;\r\n /** Defines a custom function to handle canvas size changes. (the canvas to render into is provided to the callback) */\r\n customResize?: (canvas: HTMLCanvasElement) => void;\r\n}\r\n\r\ndeclare module \"../../Engines/engine\" {\r\n export interface Engine {\r\n /** @internal */\r\n _inputElement: Nullable<HTMLElement>;\r\n\r\n /**\r\n * Gets or sets the HTML element to use for attaching events\r\n */\r\n inputElement: Nullable<HTMLElement>;\r\n\r\n /**\r\n * Observable to handle when a change to inputElement occurs\r\n * @internal\r\n */\r\n _onEngineViewChanged?: () => void;\r\n\r\n /**\r\n * Will be triggered before the view renders\r\n */\r\n readonly onBeforeViewRenderObservable: Observable<EngineView>;\r\n /**\r\n * Will be triggered after the view rendered\r\n */\r\n readonly onAfterViewRenderObservable: Observable<EngineView>;\r\n\r\n /**\r\n * Gets the current engine view\r\n * @see https://doc.babylonjs.com/how_to/multi_canvases\r\n */\r\n activeView: Nullable<EngineView>;\r\n\r\n /** Gets or sets the list of views */\r\n views: EngineView[];\r\n\r\n /**\r\n * Register a new child canvas\r\n * @param canvas defines the canvas to register\r\n * @param camera defines an optional camera to use with this canvas (it will overwrite the scene.camera for this view)\r\n * @param clearBeforeCopy Indicates if the destination view canvas should be cleared before copying the parent canvas. Can help if the scene clear color has alpha < 1\r\n * @returns the associated view\r\n */\r\n registerView(canvas: HTMLCanvasElement, camera?: Camera, clearBeforeCopy?: boolean): EngineView;\r\n\r\n /**\r\n * Remove a registered child canvas\r\n * @param canvas defines the canvas to remove\r\n * @returns the current engine\r\n */\r\n unRegisterView(canvas: HTMLCanvasElement): Engine;\r\n }\r\n}\r\n\r\nconst _onBeforeViewRenderObservable = new Observable<EngineView>();\r\nconst _onAfterViewRenderObservable = new Observable<EngineView>();\r\n\r\nObject.defineProperty(Engine.prototype, \"onBeforeViewRenderObservable\", {\r\n get: function (this: Engine) {\r\n return _onBeforeViewRenderObservable;\r\n },\r\n});\r\n\r\nObject.defineProperty(Engine.prototype, \"onAfterViewRenderObservable\", {\r\n get: function (this: Engine) {\r\n return _onAfterViewRenderObservable;\r\n },\r\n});\r\n\r\nObject.defineProperty(Engine.prototype, \"inputElement\", {\r\n get: function (this: Engine) {\r\n return this._inputElement;\r\n },\r\n set: function (this: Engine, value: HTMLElement) {\r\n if (this._inputElement !== value) {\r\n this._inputElement = value;\r\n this._onEngineViewChanged?.();\r\n }\r\n },\r\n});\r\n\r\nEngine.prototype.getInputElement = function (): Nullable<HTMLElement> {\r\n return this.inputElement || this.getRenderingCanvas();\r\n};\r\n\r\nEngine.prototype.registerView = function (canvas: HTMLCanvasElement, camera?: Camera, clearBeforeCopy?: boolean): EngineView {\r\n if (!this.views) {\r\n this.views = [];\r\n }\r\n\r\n for (const view of this.views) {\r\n if (view.target === canvas) {\r\n return view;\r\n }\r\n }\r\n\r\n const masterCanvas = this.getRenderingCanvas();\r\n if (masterCanvas) {\r\n canvas.width = masterCanvas.width;\r\n canvas.height = masterCanvas.height;\r\n }\r\n\r\n const newView = { target: canvas, camera, clearBeforeCopy, enabled: true, id: (Math.random() * 100000).toFixed() };\r\n this.views.push(newView);\r\n\r\n if (camera) {\r\n camera.onDisposeObservable.add(() => {\r\n this.unRegisterView(canvas);\r\n });\r\n }\r\n\r\n return newView;\r\n};\r\n\r\nEngine.prototype.unRegisterView = function (canvas: HTMLCanvasElement): Engine {\r\n if (!this.views || this.views.length === 0) {\r\n return this;\r\n }\r\n\r\n for (const view of this.views) {\r\n if (view.target === canvas) {\r\n const index = this.views.indexOf(view);\r\n\r\n if (index !== -1) {\r\n this.views.splice(index, 1);\r\n }\r\n break;\r\n }\r\n }\r\n\r\n return this;\r\n};\r\n\r\nEngine.prototype._renderViews = function () {\r\n if (!this.views || this.views.length === 0) {\r\n return false;\r\n }\r\n\r\n const parent = this.getRenderingCanvas();\r\n\r\n if (!parent) {\r\n return false;\r\n }\r\n\r\n for (const view of this.views) {\r\n if (!view.enabled) {\r\n continue;\r\n }\r\n const canvas = view.target;\r\n const context = canvas.getContext(\"2d\");\r\n if (!context) {\r\n continue;\r\n }\r\n _onBeforeViewRenderObservable.notifyObservers(view);\r\n const camera = view.camera;\r\n let previewCamera: Nullable<Camera> = null;\r\n let scene: Nullable<Scene> = null;\r\n if (camera) {\r\n scene = camera.getScene();\r\n\r\n if (scene.activeCameras && scene.activeCameras.length) {\r\n continue;\r\n }\r\n\r\n this.activeView = view;\r\n\r\n previewCamera = scene.activeCamera;\r\n scene.activeCamera = camera;\r\n }\r\n\r\n if (view.customResize) {\r\n view.customResize(canvas);\r\n } else {\r\n // Set sizes\r\n const width = Math.floor(canvas.clientWidth / this._hardwareScalingLevel);\r\n const height = Math.floor(canvas.clientHeight / this._hardwareScalingLevel);\r\n\r\n const dimsChanged = width !== canvas.width || parent.width !== canvas.width || height !== canvas.height || parent.height !== canvas.height;\r\n if (canvas.clientWidth && canvas.clientHeight && dimsChanged) {\r\n canvas.width = width;\r\n canvas.height = height;\r\n this.setSize(width, height);\r\n }\r\n }\r\n\r\n if (!parent.width || !parent.height) {\r\n return false;\r\n }\r\n\r\n // Render the frame\r\n this._renderFrame();\r\n\r\n this.flushFramebuffer();\r\n\r\n // Copy to target\r\n if (view.clearBeforeCopy) {\r\n context.clearRect(0, 0, parent.width, parent.height);\r\n }\r\n context.drawImage(parent, 0, 0);\r\n\r\n // Restore\r\n if (previewCamera && scene) {\r\n scene.activeCamera = previewCamera;\r\n }\r\n _onAfterViewRenderObservable.notifyObservers(view);\r\n }\r\n\r\n this.activeView = null;\r\n\r\n return true;\r\n};\r\n"]}
@@ -9,6 +9,10 @@ export interface IShaderProcessor {
9
9
  uniformBufferRegexp?: RegExp;
10
10
  textureRegexp?: RegExp;
11
11
  noPrecision?: boolean;
12
+ parseGLES3?: boolean;
13
+ attributeKeywordName?: string;
14
+ varyingVertexKeywordName?: string;
15
+ varyingFragmentKeywordName?: string;
12
16
  preProcessShaderCode?: (code: string, isFragment: boolean) => string;
13
17
  attributeProcessor?: (attribute: string, preProcessors: {
14
18
  [key: string]: string;
@@ -1 +1 @@
1
- {"version":3,"file":"iShaderProcessor.js","sourceRoot":"","sources":["../../../../../../lts/core/generated/Engines/Processors/iShaderProcessor.ts"],"names":[],"mappings":"","sourcesContent":["import type { ShaderLanguage } from \"../../Materials/shaderLanguage\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { ShaderProcessingContext } from \"./shaderProcessingOptions\";\r\n\r\ndeclare type ThinEngine = import(\"../thinEngine\").ThinEngine;\r\n\r\n/** @internal */\r\nexport interface IShaderProcessor {\r\n shaderLanguage: ShaderLanguage;\r\n\r\n uniformRegexp?: RegExp;\r\n uniformBufferRegexp?: RegExp;\r\n textureRegexp?: RegExp;\r\n noPrecision?: boolean;\r\n\r\n preProcessShaderCode?: (code: string, isFragment: boolean) => string;\r\n attributeProcessor?: (attribute: string, preProcessors: { [key: string]: string }, processingContext: Nullable<ShaderProcessingContext>) => string;\r\n varyingProcessor?: (varying: string, isFragment: boolean, preProcessors: { [key: string]: string }, processingContext: Nullable<ShaderProcessingContext>) => string;\r\n uniformProcessor?: (uniform: string, isFragment: boolean, preProcessors: { [key: string]: string }, processingContext: Nullable<ShaderProcessingContext>) => string;\r\n uniformBufferProcessor?: (uniformBuffer: string, isFragment: boolean, processingContext: Nullable<ShaderProcessingContext>) => string;\r\n textureProcessor?: (texture: string, isFragment: boolean, preProcessors: { [key: string]: string }, processingContext: Nullable<ShaderProcessingContext>) => string;\r\n endOfUniformBufferProcessor?: (closingBracketLine: string, isFragment: boolean, processingContext: Nullable<ShaderProcessingContext>) => string;\r\n lineProcessor?: (line: string, isFragment: boolean, processingContext: Nullable<ShaderProcessingContext>) => string;\r\n preProcessor?: (code: string, defines: string[], isFragment: boolean, processingContext: Nullable<ShaderProcessingContext>) => string;\r\n postProcessor?: (code: string, defines: string[], isFragment: boolean, processingContext: Nullable<ShaderProcessingContext>, engine: ThinEngine) => string;\r\n initializeShaders?: (processingContext: Nullable<ShaderProcessingContext>) => void;\r\n finalizeShaders?: (vertexCode: string, fragmentCode: string, processingContext: Nullable<ShaderProcessingContext>) => { vertexCode: string; fragmentCode: string };\r\n}\r\n"]}
1
+ {"version":3,"file":"iShaderProcessor.js","sourceRoot":"","sources":["../../../../../../lts/core/generated/Engines/Processors/iShaderProcessor.ts"],"names":[],"mappings":"","sourcesContent":["import type { ShaderLanguage } from \"../../Materials/shaderLanguage\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { ShaderProcessingContext } from \"./shaderProcessingOptions\";\r\n\r\ndeclare type ThinEngine = import(\"../thinEngine\").ThinEngine;\r\n\r\n/** @internal */\r\nexport interface IShaderProcessor {\r\n shaderLanguage: ShaderLanguage;\r\n\r\n uniformRegexp?: RegExp;\r\n uniformBufferRegexp?: RegExp;\r\n textureRegexp?: RegExp;\r\n noPrecision?: boolean;\r\n parseGLES3?: boolean;\r\n\r\n attributeKeywordName?: string;\r\n varyingVertexKeywordName?: string;\r\n varyingFragmentKeywordName?: string;\r\n\r\n preProcessShaderCode?: (code: string, isFragment: boolean) => string;\r\n attributeProcessor?: (attribute: string, preProcessors: { [key: string]: string }, processingContext: Nullable<ShaderProcessingContext>) => string;\r\n varyingProcessor?: (varying: string, isFragment: boolean, preProcessors: { [key: string]: string }, processingContext: Nullable<ShaderProcessingContext>) => string;\r\n uniformProcessor?: (uniform: string, isFragment: boolean, preProcessors: { [key: string]: string }, processingContext: Nullable<ShaderProcessingContext>) => string;\r\n uniformBufferProcessor?: (uniformBuffer: string, isFragment: boolean, processingContext: Nullable<ShaderProcessingContext>) => string;\r\n textureProcessor?: (texture: string, isFragment: boolean, preProcessors: { [key: string]: string }, processingContext: Nullable<ShaderProcessingContext>) => string;\r\n endOfUniformBufferProcessor?: (closingBracketLine: string, isFragment: boolean, processingContext: Nullable<ShaderProcessingContext>) => string;\r\n lineProcessor?: (line: string, isFragment: boolean, processingContext: Nullable<ShaderProcessingContext>) => string;\r\n preProcessor?: (code: string, defines: string[], isFragment: boolean, processingContext: Nullable<ShaderProcessingContext>) => string;\r\n postProcessor?: (code: string, defines: string[], isFragment: boolean, processingContext: Nullable<ShaderProcessingContext>, engine: ThinEngine) => string;\r\n initializeShaders?: (processingContext: Nullable<ShaderProcessingContext>) => void;\r\n finalizeShaders?: (vertexCode: string, fragmentCode: string, processingContext: Nullable<ShaderProcessingContext>) => { vertexCode: string; fragmentCode: string };\r\n}\r\n"]}
@@ -1,3 +1,5 @@
1
+ const defaultAttributeKeywordName = "attribute";
2
+ const defaultVaryingKeywordName = "varying";
1
3
  /** @internal */
2
4
  export class ShaderCodeNode {
3
5
  constructor() {
@@ -8,6 +10,7 @@ export class ShaderCodeNode {
8
10
  return true;
9
11
  }
10
12
  process(preprocessors, options) {
13
+ var _a, _b, _c, _d, _e, _f;
11
14
  let result = "";
12
15
  if (this.line) {
13
16
  let value = this.line;
@@ -17,10 +20,16 @@ export class ShaderCodeNode {
17
20
  if (processor.lineProcessor) {
18
21
  value = processor.lineProcessor(value, options.isFragment, options.processingContext);
19
22
  }
20
- if (processor.attributeProcessor && this.line.startsWith("attribute")) {
23
+ const attributeKeyword = (_b = (_a = options.processor) === null || _a === void 0 ? void 0 : _a.attributeKeywordName) !== null && _b !== void 0 ? _b : defaultAttributeKeywordName;
24
+ const varyingKeyword = options.isFragment && ((_c = options.processor) === null || _c === void 0 ? void 0 : _c.varyingFragmentKeywordName)
25
+ ? (_d = options.processor) === null || _d === void 0 ? void 0 : _d.varyingFragmentKeywordName
26
+ : !options.isFragment && ((_e = options.processor) === null || _e === void 0 ? void 0 : _e.varyingVertexKeywordName)
27
+ ? (_f = options.processor) === null || _f === void 0 ? void 0 : _f.varyingVertexKeywordName
28
+ : defaultVaryingKeywordName;
29
+ if (!options.isFragment && processor.attributeProcessor && this.line.startsWith(attributeKeyword)) {
21
30
  value = processor.attributeProcessor(this.line, preprocessors, options.processingContext);
22
31
  }
23
- else if (processor.varyingProcessor && this.line.startsWith("varying")) {
32
+ else if (processor.varyingProcessor && this.line.startsWith(varyingKeyword)) {
24
33
  value = processor.varyingProcessor(this.line, options.isFragment, preprocessors, options.processingContext);
25
34
  }
26
35
  else if (processor.uniformProcessor && processor.uniformRegexp && processor.uniformRegexp.test(this.line)) {
@@ -1 +1 @@
1
- {"version":3,"file":"shaderCodeNode.js","sourceRoot":"","sources":["../../../../../../lts/core/generated/Engines/Processors/shaderCodeNode.ts"],"names":[],"mappings":"AAEA,gBAAgB;AAChB,MAAM,OAAO,cAAc;IAA3B;QAEI,aAAQ,GAAqB,EAAE,CAAC;IAyEpC,CAAC;IArEG,6DAA6D;IAC7D,OAAO,CAAC,aAAwC;QAC5C,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,OAAO,CAAC,aAAwC,EAAE,OA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AAC;4BACnG,OAAO,CAAC,qCAAqC,GAAG,IAAI,CAAC;yBACxD;qBACJ;iBACJ;gBAED,IAAI,OAAO,CAAC,qCAAqC,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE;oBAChF,OAAO,CAAC,qCAAqC,GAAG,KAAK,CAAC;oBACtD,IAAI,SAAS,CAAC,2BAA2B,EAAE;wBACvC,KAAK,GAAG,SAAS,CAAC,2BAA2B,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;qBAC3G;iBACJ;aACJ;YAED,MAAM,IAAI,KAAK,GAAG,MAAM,CAAC;SAC5B;QAED,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;YAC5B,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;QACpD,CAAC,CAAC,CAAC;QAEH,IAAI,IAAI,CAAC,mBAAmB,EAAE;YAC1B,aAAa,CAAC,IAAI,CAAC,mBAAmB,CAAC,GAAG,IAAI,CAAC,qBAAqB,IAAI,MAAM,CAAC;SAClF;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ","sourcesContent":["import type { ProcessingOptions } from \"./shaderProcessingOptions\";\r\n\r\n/** @internal */\r\nexport class ShaderCodeNode {\r\n line: string;\r\n children: ShaderCodeNode[] = [];\r\n additionalDefineKey?: string;\r\n additionalDefineValue?: string;\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n isValid(preprocessors: { [key: string]: string }): boolean {\r\n return true;\r\n }\r\n\r\n process(preprocessors: { [key: string]: string }, options: ProcessingOptions): string {\r\n let result = \"\";\r\n if (this.line) {\r\n let value: string = this.line;\r\n const processor = options.processor;\r\n if (processor) {\r\n // This must be done before other replacements to avoid mistakenly changing something that was already changed.\r\n if (processor.lineProcessor) {\r\n value = processor.lineProcessor(value, options.isFragment, options.processingContext);\r\n }\r\n\r\n if (processor.attributeProcessor && this.line.startsWith(\"attribute\")) {\r\n value = processor.attributeProcessor(this.line, preprocessors, options.processingContext);\r\n } else if (processor.varyingProcessor && this.line.startsWith(\"varying\")) {\r\n value = processor.varyingProcessor(this.line, options.isFragment, preprocessors, options.processingContext);\r\n } else if (processor.uniformProcessor && processor.uniformRegexp && processor.uniformRegexp.test(this.line)) {\r\n if (!options.lookForClosingBracketForUniformBuffer) {\r\n value = processor.uniformProcessor(this.line, options.isFragment, preprocessors, options.processingContext);\r\n }\r\n } else if (processor.uniformBufferProcessor && processor.uniformBufferRegexp && processor.uniformBufferRegexp.test(this.line)) {\r\n if (!options.lookForClosingBracketForUniformBuffer) {\r\n value = processor.uniformBufferProcessor(this.line, options.isFragment, options.processingContext);\r\n options.lookForClosingBracketForUniformBuffer = true;\r\n }\r\n } else if (processor.textureProcessor && processor.textureRegexp && processor.textureRegexp.test(this.line)) {\r\n value = processor.textureProcessor(this.line, options.isFragment, preprocessors, options.processingContext);\r\n } else if ((processor.uniformProcessor || processor.uniformBufferProcessor) && this.line.startsWith(\"uniform\") && !options.lookForClosingBracketForUniformBuffer) {\r\n const regex = /uniform\\s+(?:(?:highp)?|(?:lowp)?)\\s*(\\S+)\\s+(\\S+)\\s*;/;\r\n\r\n if (regex.test(this.line)) {\r\n // uniform\r\n if (processor.uniformProcessor) {\r\n value = processor.uniformProcessor(this.line, options.isFragment, preprocessors, options.processingContext);\r\n }\r\n } else {\r\n // Uniform buffer\r\n if (processor.uniformBufferProcessor) {\r\n value = processor.uniformBufferProcessor(this.line, options.isFragment, options.processingContext);\r\n options.lookForClosingBracketForUniformBuffer = true;\r\n }\r\n }\r\n }\r\n\r\n if (options.lookForClosingBracketForUniformBuffer && this.line.indexOf(\"}\") !== -1) {\r\n options.lookForClosingBracketForUniformBuffer = false;\r\n if (processor.endOfUniformBufferProcessor) {\r\n value = processor.endOfUniformBufferProcessor(this.line, options.isFragment, options.processingContext);\r\n }\r\n }\r\n }\r\n\r\n result += value + \"\\r\\n\";\r\n }\r\n\r\n this.children.forEach((child) => {\r\n result += child.process(preprocessors, options);\r\n });\r\n\r\n if (this.additionalDefineKey) {\r\n preprocessors[this.additionalDefineKey] = this.additionalDefineValue || \"true\";\r\n }\r\n\r\n return result;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"shaderCodeNode.js","sourceRoot":"","sources":["../../../../../../lts/core/generated/Engines/Processors/shaderCodeNode.ts"],"names":[],"mappings":"AAEA,MAAM,2BAA2B,GAAG,WAAW,CAAC;AAChD,MAAM,yBAAyB,GAAG,SAAS,CAAC;AAE5C,gBAAgB;AAChB,MAAM,OAAO,cAAc;IAA3B;QAEI,aAAQ,GAAqB,EAAE,CAAC;IAiFpC,CAAC;IA7EG,6DAA6D;IAC7D,OAAO,CAAC,aAAwC;QAC5C,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,OAAO,CAAC,aAAwC,EAAE,OAA0B;;QACxE,IAAI,MAAM,GAAG,EAAE,CAAC;QAChB,IAAI,IAAI,CAAC,IAAI,EAAE;YACX,IAAI,KAAK,GAAW,IAAI,CAAC,IAAI,CAAC;YAC9B,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;YACpC,IAAI,SAAS,EAAE;gBACX,+GAA+G;gBAC/G,IAAI,SAAS,CAAC,aAAa,EAAE;oBACzB,KAAK,GAAG,SAAS,CAAC,aAAa,CAAC,KAAK,EAAE,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;iBACzF;gBAED,MAAM,gBAAgB,GAAG,MAAA,MAAA,OAAO,CAAC,SAAS,0CAAE,oBAAoB,mCAAI,2BAA2B,CAAC;gBAChG,MAAM,cAAc,GAChB,OAAO,CAAC,UAAU,KAAI,MAAA,OAAO,CAAC,SAAS,0CAAE,0BAA0B,CAAA;oBAC/D,CAAC,CAAC,MAAA,OAAO,CAAC,SAAS,0CAAE,0BAA0B;oB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C,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE;oBAChF,OAAO,CAAC,qCAAqC,GAAG,KAAK,CAAC;oBACtD,IAAI,SAAS,CAAC,2BAA2B,EAAE;wBACvC,KAAK,GAAG,SAAS,CAAC,2BAA2B,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;qBAC3G;iBACJ;aACJ;YAED,MAAM,IAAI,KAAK,GAAG,MAAM,CAAC;SAC5B;QAED,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;YAC5B,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;QACpD,CAAC,CAAC,CAAC;QAEH,IAAI,IAAI,CAAC,mBAAmB,EAAE;YAC1B,aAAa,CAAC,IAAI,CAAC,mBAAmB,CAAC,GAAG,IAAI,CAAC,qBAAqB,IAAI,MAAM,CAAC;SAClF;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ","sourcesContent":["import type { ProcessingOptions } from \"./shaderProcessingOptions\";\r\n\r\nconst defaultAttributeKeywordName = \"attribute\";\r\nconst defaultVaryingKeywordName = \"varying\";\r\n\r\n/** @internal */\r\nexport class ShaderCodeNode {\r\n line: string;\r\n children: ShaderCodeNode[] = [];\r\n additionalDefineKey?: string;\r\n additionalDefineValue?: string;\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n isValid(preprocessors: { [key: string]: string }): boolean {\r\n return true;\r\n }\r\n\r\n process(preprocessors: { [key: string]: string }, options: ProcessingOptions): string {\r\n let result = \"\";\r\n if (this.line) {\r\n let value: string = this.line;\r\n const processor = options.processor;\r\n if (processor) {\r\n // This must be done before other replacements to avoid mistakenly changing something that was already changed.\r\n if (processor.lineProcessor) {\r\n value = processor.lineProcessor(value, options.isFragment, options.processingContext);\r\n }\r\n\r\n const attributeKeyword = options.processor?.attributeKeywordName ?? defaultAttributeKeywordName;\r\n const varyingKeyword =\r\n options.isFragment && options.processor?.varyingFragmentKeywordName\r\n ? options.processor?.varyingFragmentKeywordName\r\n : !options.isFragment && options.processor?.varyingVertexKeywordName\r\n ? options.processor?.varyingVertexKeywordName\r\n : defaultVaryingKeywordName;\r\n\r\n if (!options.isFragment && processor.attributeProcessor && this.line.startsWith(attributeKeyword)) {\r\n value = processor.attributeProcessor(this.line, preprocessors, options.processingContext);\r\n } else if (processor.varyingProcessor && this.line.startsWith(varyingKeyword)) {\r\n value = processor.varyingProcessor(this.line, options.isFragment, preprocessors, options.processingContext);\r\n } else if (processor.uniformProcessor && processor.uniformRegexp && processor.uniformRegexp.test(this.line)) {\r\n if (!options.lookForClosingBracketForUniformBuffer) {\r\n value = processor.uniformProcessor(this.line, options.isFragment, preprocessors, options.processingContext);\r\n }\r\n } else if (processor.uniformBufferProcessor && processor.uniformBufferRegexp && processor.uniformBufferRegexp.test(this.line)) {\r\n if (!options.lookForClosingBracketForUniformBuffer) {\r\n value = processor.uniformBufferProcessor(this.line, options.isFragment, options.processingContext);\r\n options.lookForClosingBracketForUniformBuffer = true;\r\n }\r\n } else if (processor.textureProcessor && processor.textureRegexp && processor.textureRegexp.test(this.line)) {\r\n value = processor.textureProcessor(this.line, options.isFragment, preprocessors, options.processingContext);\r\n } else if ((processor.uniformProcessor || processor.uniformBufferProcessor) && this.line.startsWith(\"uniform\") && !options.lookForClosingBracketForUniformBuffer) {\r\n const regex = /uniform\\s+(?:(?:highp)?|(?:lowp)?)\\s*(\\S+)\\s+(\\S+)\\s*;/;\r\n\r\n if (regex.test(this.line)) {\r\n // uniform\r\n if (processor.uniformProcessor) {\r\n value = processor.uniformProcessor(this.line, options.isFragment, preprocessors, options.processingContext);\r\n }\r\n } else {\r\n // Uniform buffer\r\n if (processor.uniformBufferProcessor) {\r\n value = processor.uniformBufferProcessor(this.line, options.isFragment, options.processingContext);\r\n options.lookForClosingBracketForUniformBuffer = true;\r\n }\r\n }\r\n }\r\n\r\n if (options.lookForClosingBracketForUniformBuffer && this.line.indexOf(\"}\") !== -1) {\r\n options.lookForClosingBracketForUniformBuffer = false;\r\n if (processor.endOfUniformBufferProcessor) {\r\n value = processor.endOfUniformBufferProcessor(this.line, options.isFragment, options.processingContext);\r\n }\r\n }\r\n }\r\n\r\n result += value + \"\\r\\n\";\r\n }\r\n\r\n this.children.forEach((child) => {\r\n result += child.process(preprocessors, options);\r\n });\r\n\r\n if (this.additionalDefineKey) {\r\n preprocessors[this.additionalDefineKey] = this.additionalDefineValue || \"true\";\r\n }\r\n\r\n return result;\r\n }\r\n}\r\n"]}
@@ -250,7 +250,10 @@ export class ShaderProcessor {
250
250
  }
251
251
  // Already converted
252
252
  if (options.processor.shaderLanguage === ShaderLanguage.GLSL && preparedSourceCode.indexOf("#version 3") !== -1) {
253
- return preparedSourceCode.replace("#version 300 es", "");
253
+ preparedSourceCode = preparedSourceCode.replace("#version 300 es", "");
254
+ if (!options.processor.parseGLES3) {
255
+ return preparedSourceCode;
256
+ }
254
257
  }
255
258
  const defines = options.defines;
256
259
  const preprocessors = this._PreparePreProcessors(options, engine);