@onerjs/core 8.33.5 → 8.33.6

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 (73) hide show
  1. package/Engines/WebGPU/Extensions/engine.multiRender.js +5 -10
  2. package/Engines/WebGPU/Extensions/engine.multiRender.js.map +1 -1
  3. package/Engines/WebGPU/Extensions/engine.renderTarget.js +4 -2
  4. package/Engines/WebGPU/Extensions/engine.renderTarget.js.map +1 -1
  5. package/Engines/WebGPU/webgpuHardwareTexture.d.ts +4 -3
  6. package/Engines/WebGPU/webgpuHardwareTexture.js +27 -21
  7. package/Engines/WebGPU/webgpuHardwareTexture.js.map +1 -1
  8. package/Engines/WebGPU/webgpuTextureManager.d.ts +5 -4
  9. package/Engines/WebGPU/webgpuTextureManager.js +20 -30
  10. package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
  11. package/Engines/engine.d.ts +1 -0
  12. package/Engines/thinEngine.js +9 -1
  13. package/Engines/thinEngine.js.map +1 -1
  14. package/Engines/thinWebGPUEngine.js +2 -3
  15. package/Engines/thinWebGPUEngine.js.map +1 -1
  16. package/Engines/webgpuEngine.js +28 -13
  17. package/Engines/webgpuEngine.js.map +1 -1
  18. package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js +2 -2
  19. package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js.map +1 -1
  20. package/FrameGraph/Node/Blocks/Textures/clearBlock.d.ts +1 -1
  21. package/FrameGraph/Node/Blocks/Textures/clearBlock.js +2 -2
  22. package/FrameGraph/Node/Blocks/Textures/clearBlock.js.map +1 -1
  23. package/FrameGraph/Node/Blocks/inputBlock.js +4 -0
  24. package/FrameGraph/Node/Blocks/inputBlock.js.map +1 -1
  25. package/FrameGraph/Node/nodeRenderGraphBlock.d.ts +1 -0
  26. package/FrameGraph/Node/nodeRenderGraphBlock.js +19 -0
  27. package/FrameGraph/Node/nodeRenderGraphBlock.js.map +1 -1
  28. package/FrameGraph/Passes/renderPass.d.ts +16 -0
  29. package/FrameGraph/Passes/renderPass.js +12 -0
  30. package/FrameGraph/Passes/renderPass.js.map +1 -1
  31. package/FrameGraph/Tasks/Rendering/objectRendererTask.d.ts +3 -3
  32. package/FrameGraph/Tasks/Rendering/objectRendererTask.js +3 -2
  33. package/FrameGraph/Tasks/Rendering/objectRendererTask.js.map +1 -1
  34. package/FrameGraph/Tasks/Texture/clearTextureTask.d.ts +2 -2
  35. package/FrameGraph/Tasks/Texture/clearTextureTask.js +3 -2
  36. package/FrameGraph/Tasks/Texture/clearTextureTask.js.map +1 -1
  37. package/FrameGraph/frameGraphRenderContext.js +4 -15
  38. package/FrameGraph/frameGraphRenderContext.js.map +1 -1
  39. package/FrameGraph/frameGraphTask.d.ts +2 -2
  40. package/FrameGraph/frameGraphTask.js +6 -6
  41. package/FrameGraph/frameGraphTask.js.map +1 -1
  42. package/FrameGraph/frameGraphTaskMultiRenderTarget.d.ts +15 -0
  43. package/FrameGraph/frameGraphTaskMultiRenderTarget.js +25 -0
  44. package/FrameGraph/frameGraphTaskMultiRenderTarget.js.map +1 -0
  45. package/FrameGraph/frameGraphTextureManager.js +13 -2
  46. package/FrameGraph/frameGraphTextureManager.js.map +1 -1
  47. package/FrameGraph/frameGraphTypes.d.ts +9 -1
  48. package/FrameGraph/frameGraphTypes.js.map +1 -1
  49. package/Loading/Plugins/babylonFileLoader.js +13 -0
  50. package/Loading/Plugins/babylonFileLoader.js.map +1 -1
  51. package/Materials/Textures/baseTexture.d.ts +4 -0
  52. package/Materials/Textures/baseTexture.js +4 -0
  53. package/Materials/Textures/baseTexture.js.map +1 -1
  54. package/Materials/Textures/textureCreationOptions.d.ts +2 -0
  55. package/Materials/Textures/textureCreationOptions.js +0 -1
  56. package/Materials/Textures/textureCreationOptions.js.map +1 -1
  57. package/Meshes/abstractMesh.js +1 -1
  58. package/Meshes/abstractMesh.js.map +1 -1
  59. package/Meshes/geometry.js +1 -0
  60. package/Meshes/geometry.js.map +1 -1
  61. package/Misc/decorators.serialization.js +1 -1
  62. package/Misc/decorators.serialization.js.map +1 -1
  63. package/Particles/solidParticleSystem.d.ts +2 -1
  64. package/Particles/solidParticleSystem.js.map +1 -1
  65. package/Shaders/ShadersInclude/shadowsFragmentFunctions.js +4 -12
  66. package/Shaders/ShadersInclude/shadowsFragmentFunctions.js.map +1 -1
  67. package/Shaders/picking.vertex.js +2 -2
  68. package/Shaders/picking.vertex.js.map +1 -1
  69. package/ShadersWGSL/ShadersInclude/shadowsFragmentFunctions.js +8 -14
  70. package/ShadersWGSL/ShadersInclude/shadowsFragmentFunctions.js.map +1 -1
  71. package/ShadersWGSL/picking.vertex.js +2 -2
  72. package/ShadersWGSL/picking.vertex.js.map +1 -1
  73. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"baseTexture.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/Textures/baseTexture.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAGnD,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEjD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,OAAO,sBAAsB,CAAC;AAE9B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAG1E;;;;GAIG;AACH,MAAM,OAAO,WAAY,SAAQ,WAAW;IAyCxC;;OAEG;IACH,IAAW,QAAQ,CAAC,KAAc;QAC9B,IAAI,IAAI,CAAC,SAAS,KAAK,KAAK,EAAE,CAAC;YAC3B,OAAO;QACX,CAAC;QACD,IAAI,CAAC,SAAS,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AAC,kBAAkB,CAAC;sDACE;AAOzB;IADN,SAAS,EAAE;yDACuB;AAsBzB;IADT,SAAS,CAAC,iBAAiB,CAAC;qDACgC;AAyC7D;IADC,SAAS,EAAE;wCAGX;AAaD;IADC,SAAS,EAAE;wCAGX;AAae;IADf,SAAS,EAAE;0CAC+C;AAQ3C;IADf,SAAS,EAAE;8DACgF;AAQ5F;IADC,SAAS,EAAE;yCAOX;AAeD;IADC,SAAS,EAAE;uCAOX;AAeD;IADC,SAAS,EAAE;4CAOX;AAqDD;IADC,SAAS,EAAE;oDAWX;AA8BM;IADN,SAAS,EAAE;4CACW;AAahB;IADN,SAAS,EAAE;oDACmB;AAM/B;IADC,SAAS,EAAE;sDAOX;AAWD;IADC,SAAS,EAAE;qDAOX;AAaD;IADC,SAAS,EAAE;oDAOX;AAaD;IADC,kBAAkB,EAAE;oDAOpB;AAmBM;IADN,SAAS,EAAE;mDACkB","sourcesContent":["import { serialize, serializeAsTexture } from \"../../Misc/decorators\";\r\nimport type { Observer } from \"../../Misc/observable\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { Matrix } from \"../../Maths/math.vector\";\r\nimport type { Vector3 } from \"../../Maths/math.vector\";\r\nimport { EngineStore } from \"../../Engines/engineStore\";\r\nimport type { InternalTexture } from \"../../Materials/Textures/internalTexture\";\r\nimport { Constants } from \"../../Engines/constants\";\r\nimport type { IAnimatable } from \"../../Animations/animatable.interface\";\r\nimport { RandomGUID } from \"../../Misc/guid\";\r\n\r\nimport \"../../Misc/fileTools\";\r\nimport type { AbstractEngine } from \"../../Engines/abstractEngine\";\r\nimport { ThinTexture } from \"./thinTexture\";\r\n\r\nimport type { Animation } from \"../../Animations/animation\";\r\nimport { SerializationHelper } from \"../../Misc/decorators.serialization\";\r\nimport type { IAssetContainer } from \"core/IAssetContainer\";\r\n\r\n/**\r\n * Base class of all the textures in babylon.\r\n * It groups all the common properties the materials, post process, lights... might need\r\n * in order to make a correct use of the texture.\r\n */\r\nexport class BaseTexture extends ThinTexture implements IAnimatable {\r\n /**\r\n * Default anisotropic filtering level for the application.\r\n * It is set to 4 as a good tradeoff between perf and quality.\r\n */\r\n public static DEFAULT_ANISOTROPIC_FILTERING_LEVEL = 4;\r\n\r\n /**\r\n * Gets or sets the unique id of the texture\r\n */\r\n @serialize()\r\n public uniqueId: number;\r\n\r\n /**\r\n * Define the name of the texture.\r\n */\r\n @serialize()\r\n public name: string;\r\n\r\n /**\r\n * Define the display name of the texture, which is used as tree item name of the dedicated node in the inspector\r\n */\r\n @serialize()\r\n public displayName: string;\r\n\r\n /**\r\n * Gets or sets an object used to store user defined information.\r\n */\r\n @serialize()\r\n public metadata: any = null;\r\n\r\n /** @internal */\r\n public _internalMetadata: any;\r\n\r\n /**\r\n * For internal use only. Please do not use.\r\n */\r\n public reservedDataStore: any = null;\r\n\r\n @serialize(\"hasAlpha\")\r\n private _hasAlpha = false;\r\n /**\r\n * Define if the texture is having a usable alpha value (can be use for transparency or glossiness for instance).\r\n */\r\n public set hasAlpha(value: boolean) {\r\n if (this._hasAlpha === value) {\r\n return;\r\n }\r\n this._hasAlpha = value;\r\n if (this._scene) {\r\n this._scene.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag, (mat) => {\r\n return mat.hasTexture(this);\r\n });\r\n }\r\n }\r\n public get hasAlpha(): boolean {\r\n return this._hasAlpha;\r\n }\r\n\r\n @serialize(\"getAlphaFromRGB\")\r\n private _getAlphaFromRGB = false;\r\n /**\r\n * Defines if the alpha value should be determined via the rgb values.\r\n * If true the luminance of the pixel might be used to find the corresponding alpha value.\r\n */\r\n public set getAlphaFromRGB(value: boolean) {\r\n if (this._getAlphaFromRGB === value) {\r\n return;\r\n }\r\n this._getAlphaFromRGB = value;\r\n if (this._scene) {\r\n this._scene.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag, (mat) => {\r\n return mat.hasTexture(this);\r\n });\r\n }\r\n }\r\n public get getAlphaFromRGB(): boolean {\r\n return this._getAlphaFromRGB;\r\n }\r\n\r\n /**\r\n * Intensity or strength of the texture.\r\n * It is commonly used by materials to fine tune the intensity of the texture\r\n */\r\n @serialize()\r\n public level = 1;\r\n\r\n @serialize(\"coordinatesIndex\")\r\n protected _coordinatesIndex = 0;\r\n\r\n /**\r\n * Gets or sets a boolean indicating that the texture should try to reduce shader code if there is no UV manipulation.\r\n * (ie. when texture.getTextureMatrix().isIdentityAs3x2() returns true)\r\n */\r\n @serialize()\r\n public optimizeUVAllocation = true;\r\n\r\n /**\r\n * Define the UV channel to use starting from 0 and defaulting to 0.\r\n * This is part of the texture as textures usually maps to one uv set.\r\n */\r\n public set coordinatesIndex(value: number) {\r\n if (this._coordinatesIndex === value) {\r\n return;\r\n }\r\n this._coordinatesIndex = value;\r\n if (this._scene) {\r\n this._scene.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag, (mat) => {\r\n return mat.hasTexture(this);\r\n });\r\n }\r\n }\r\n public get coordinatesIndex(): number {\r\n return this._coordinatesIndex;\r\n }\r\n\r\n @serialize(\"coordinatesMode\")\r\n protected _coordinatesMode = Constants.TEXTURE_EXPLICIT_MODE;\r\n\r\n /**\r\n * How a texture is mapped.\r\n *\r\n * | Value | Type | Description |\r\n * | ----- | ----------------------------------- | ----------- |\r\n * | 0 | EXPLICIT_MODE | |\r\n * | 1 | SPHERICAL_MODE | |\r\n * | 2 | PLANAR_MODE | |\r\n * | 3 | CUBIC_MODE | |\r\n * | 4 | PROJECTION_MODE | |\r\n * | 5 | SKYBOX_MODE | |\r\n * | 6 | INVCUBIC_MODE | |\r\n * | 7 | EQUIRECTANGULAR_MODE | |\r\n * | 8 | FIXED_EQUIRECTANGULAR_MODE | |\r\n * | 9 | FIXED_EQUIRECTANGULAR_MIRRORED_MODE | |\r\n */\r\n public override set coordinatesMode(value: number) {\r\n if (this._coordinatesMode === value) {\r\n return;\r\n }\r\n this._coordinatesMode = value;\r\n if (this._scene) {\r\n this._scene.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag, (mat) => {\r\n return mat.hasTexture(this);\r\n });\r\n }\r\n }\r\n public override get coordinatesMode(): number {\r\n return this._coordinatesMode;\r\n }\r\n\r\n /**\r\n * | Value | Type | Description |\r\n * | ----- | ------------------ | ----------- |\r\n * | 0 | CLAMP_ADDRESSMODE | |\r\n * | 1 | WRAP_ADDRESSMODE | |\r\n * | 2 | MIRROR_ADDRESSMODE | |\r\n */\r\n @serialize()\r\n public override get wrapU() {\r\n return this._wrapU;\r\n }\r\n public override set wrapU(value: number) {\r\n this._wrapU = value;\r\n }\r\n\r\n /**\r\n * | Value | Type | Description |\r\n * | ----- | ------------------ | ----------- |\r\n * | 0 | CLAMP_ADDRESSMODE | |\r\n * | 1 | WRAP_ADDRESSMODE | |\r\n * | 2 | MIRROR_ADDRESSMODE | |\r\n */\r\n @serialize()\r\n public override get wrapV() {\r\n return this._wrapV;\r\n }\r\n public override set wrapV(value: number) {\r\n this._wrapV = value;\r\n }\r\n\r\n /**\r\n * | Value | Type | Description |\r\n * | ----- | ------------------ | ----------- |\r\n * | 0 | CLAMP_ADDRESSMODE | |\r\n * | 1 | WRAP_ADDRESSMODE | |\r\n * | 2 | MIRROR_ADDRESSMODE | |\r\n */\r\n @serialize()\r\n public override wrapR = Constants.TEXTURE_WRAP_ADDRESSMODE;\r\n\r\n /**\r\n * With compliant hardware and browser (supporting anisotropic filtering)\r\n * this defines the level of anisotropic filtering in the texture.\r\n * The higher the better but the slower. This defaults to 4 as it seems to be the best tradeoff.\r\n */\r\n @serialize()\r\n public override anisotropicFilteringLevel = BaseTexture.DEFAULT_ANISOTROPIC_FILTERING_LEVEL;\r\n\r\n /** @internal */\r\n public _isCube = false;\r\n /**\r\n * Define if the texture is a cube texture or if false a 2d texture.\r\n */\r\n @serialize()\r\n public override get isCube(): boolean {\r\n if (!this._texture) {\r\n return this._isCube;\r\n }\r\n\r\n return this._texture.isCube;\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n protected override set isCube(value: boolean) {\r\n if (!this._texture) {\r\n this._isCube = value;\r\n } else {\r\n this._texture.isCube = value;\r\n }\r\n }\r\n\r\n /**\r\n * Define if the texture is a 3d texture (webgl 2) or if false a 2d texture.\r\n */\r\n @serialize()\r\n public override get is3D(): boolean {\r\n if (!this._texture) {\r\n return false;\r\n }\r\n\r\n return this._texture.is3D;\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n protected override set is3D(value: boolean) {\r\n if (!this._texture) {\r\n return;\r\n }\r\n\r\n this._texture.is3D = value;\r\n }\r\n\r\n /**\r\n * Define if the texture is a 2d array texture (webgl 2) or if false a 2d texture.\r\n */\r\n @serialize()\r\n public override get is2DArray(): boolean {\r\n if (!this._texture) {\r\n return false;\r\n }\r\n\r\n return this._texture.is2DArray;\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n protected override set is2DArray(value: boolean) {\r\n if (!this._texture) {\r\n return;\r\n }\r\n\r\n this._texture.is2DArray = value;\r\n }\r\n\r\n /** @internal */\r\n protected _gammaSpace = true;\r\n /**\r\n * Define if the texture contains data in gamma space (most of the png/jpg aside bump).\r\n * HDR texture are usually stored in linear space.\r\n * This only impacts the PBR and Background materials\r\n */\r\n public get gammaSpace(): boolean {\r\n if (!this._texture) {\r\n return this._gammaSpace;\r\n } else {\r\n if (this._texture._gammaSpace === null) {\r\n this._texture._gammaSpace = this._gammaSpace;\r\n }\r\n }\r\n\r\n return this._texture._gammaSpace && !this._texture._useSRGBBuffer;\r\n }\r\n\r\n public set gammaSpace(gamma: boolean) {\r\n if (!this._texture) {\r\n if (this._gammaSpace === gamma) {\r\n return;\r\n }\r\n\r\n this._gammaSpace = gamma;\r\n } else {\r\n if (this._texture._gammaSpace === gamma) {\r\n return;\r\n }\r\n this._texture._gammaSpace = gamma;\r\n }\r\n\r\n this.getScene()?.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag, (mat) => {\r\n return mat.hasTexture(this);\r\n });\r\n }\r\n\r\n /**\r\n * Define gamma space which not affected by useSRGBBuffer\r\n */\r\n @serialize()\r\n public get currentGammaSpace(): boolean {\r\n if (!this._texture) {\r\n return this._gammaSpace;\r\n } else {\r\n if (this._texture._gammaSpace === null) {\r\n this._texture._gammaSpace = this._gammaSpace;\r\n }\r\n }\r\n\r\n return this._texture._gammaSpace;\r\n }\r\n\r\n public set currentGammaSpace(gamma) {\r\n this.gammaSpace = gamma;\r\n }\r\n\r\n /**\r\n * Gets or sets whether or not the texture contains RGBD data.\r\n */\r\n public get isRGBD(): boolean {\r\n return this._texture != null && this._texture._isRGBD;\r\n }\r\n public set isRGBD(value: boolean) {\r\n if (value === this.isRGBD) {\r\n return;\r\n }\r\n\r\n if (this._texture) {\r\n this._texture._isRGBD = value;\r\n }\r\n\r\n this.getScene()?.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag, (mat) => {\r\n return mat.hasTexture(this);\r\n });\r\n }\r\n\r\n /**\r\n * Is Z inverted in the texture (useful in a cube texture).\r\n */\r\n @serialize()\r\n public invertZ = false;\r\n\r\n /**\r\n * Are mip maps generated for this texture or not.\r\n */\r\n public get noMipmap(): boolean {\r\n return false;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n @serialize()\r\n public lodLevelInAlpha = false;\r\n\r\n /**\r\n * With prefiltered texture, defined the offset used during the prefiltering steps.\r\n */\r\n @serialize()\r\n public get lodGenerationOffset(): number {\r\n if (this._texture) {\r\n return this._texture._lodGenerationOffset;\r\n }\r\n\r\n return 0.0;\r\n }\r\n public set lodGenerationOffset(value: number) {\r\n if (this._texture) {\r\n this._texture._lodGenerationOffset = value;\r\n }\r\n }\r\n\r\n /**\r\n * With prefiltered texture, defined the scale used during the prefiltering steps.\r\n */\r\n @serialize()\r\n public get lodGenerationScale(): number {\r\n if (this._texture) {\r\n return this._texture._lodGenerationScale;\r\n }\r\n\r\n return 0.0;\r\n }\r\n public set lodGenerationScale(value: number) {\r\n if (this._texture) {\r\n this._texture._lodGenerationScale = value;\r\n }\r\n }\r\n\r\n /**\r\n * With prefiltered texture, defined if the specular generation is based on a linear ramp.\r\n * By default we are using a log2 of the linear roughness helping to keep a better resolution for\r\n * average roughness values.\r\n */\r\n @serialize()\r\n public get linearSpecularLOD(): boolean {\r\n if (this._texture) {\r\n return this._texture._linearSpecularLOD;\r\n }\r\n\r\n return false;\r\n }\r\n public set linearSpecularLOD(value: boolean) {\r\n if (this._texture) {\r\n this._texture._linearSpecularLOD = value;\r\n }\r\n }\r\n\r\n /**\r\n * In case a better definition than spherical harmonics is required for the diffuse part of the environment.\r\n * You can set the irradiance texture to rely on a texture instead of the spherical approach.\r\n * This texture need to have the same characteristics than its parent (Cube vs 2d, coordinates mode, Gamma/Linear, RGBD).\r\n */\r\n @serializeAsTexture()\r\n public get irradianceTexture(): Nullable<BaseTexture> {\r\n if (this._texture) {\r\n return this._texture._irradianceTexture;\r\n }\r\n\r\n return null;\r\n }\r\n public set irradianceTexture(value: Nullable<BaseTexture>) {\r\n if (this._texture) {\r\n this._texture._irradianceTexture = value;\r\n }\r\n }\r\n\r\n /**\r\n * Indicates the average direction of light in an environment map. This\r\n * can be treated as the most dominant direction but it's magnitude also\r\n * tells you something about how dominant that direction is.\r\n */\r\n /** @internal */\r\n public _dominantDirection: Nullable<Vector3> = null;\r\n\r\n /**\r\n * Define if the texture is a render target.\r\n */\r\n @serialize()\r\n public isRenderTarget = false;\r\n\r\n /**\r\n * Define the unique id of the texture in the scene.\r\n */\r\n public get uid(): string {\r\n if (!this._uid) {\r\n this._uid = RandomGUID();\r\n }\r\n return this._uid;\r\n }\r\n\r\n /** @internal */\r\n public _prefiltered: boolean = false;\r\n /** @internal */\r\n public _forceSerialize: boolean = false;\r\n\r\n /**\r\n * Return a string representation of the texture.\r\n * @returns the texture as a string\r\n */\r\n public override toString(): string {\r\n return this.name;\r\n }\r\n\r\n /**\r\n * Get the class name of the texture.\r\n * @returns \"BaseTexture\"\r\n */\r\n public override getClassName(): string {\r\n return \"BaseTexture\";\r\n }\r\n\r\n /**\r\n * Define the list of animation attached to the texture.\r\n */\r\n public animations: Animation[] = [];\r\n\r\n /**\r\n * An event triggered when the texture is disposed.\r\n */\r\n public onDisposeObservable = new Observable<BaseTexture>();\r\n\r\n private _onDisposeObserver: Nullable<Observer<BaseTexture>> = null;\r\n /**\r\n * Callback triggered when the texture has been disposed.\r\n * Kept for back compatibility, you can use the onDisposeObservable instead.\r\n */\r\n public set onDispose(callback: () => void) {\r\n if (this._onDisposeObserver) {\r\n this.onDisposeObservable.remove(this._onDisposeObserver);\r\n }\r\n this._onDisposeObserver = this.onDisposeObservable.add(callback);\r\n }\r\n\r\n protected _scene: Nullable<Scene> = null;\r\n\r\n /** @internal */\r\n private _uid: Nullable<string> = null;\r\n\r\n /**\r\n * Define if the texture is preventing a material to render or not.\r\n * If not and the texture is not ready, the engine will use a default black texture instead.\r\n */\r\n public get isBlocking(): boolean {\r\n return true;\r\n }\r\n\r\n /** @internal */\r\n public _parentContainer: Nullable<IAssetContainer> = null;\r\n\r\n protected _loadingError: boolean = false;\r\n protected _errorObject?: {\r\n message?: string;\r\n exception?: any;\r\n };\r\n\r\n /**\r\n * Was there any loading error?\r\n */\r\n public get loadingError(): boolean {\r\n return this._loadingError;\r\n }\r\n\r\n /**\r\n * If a loading error occurred this object will be populated with information about the error.\r\n */\r\n public get errorObject():\r\n | {\r\n message?: string;\r\n exception?: any;\r\n }\r\n | undefined {\r\n return this._errorObject;\r\n }\r\n\r\n /**\r\n * Instantiates a new BaseTexture.\r\n * Base class of all the textures in babylon.\r\n * It groups all the common properties the materials, post process, lights... might need\r\n * in order to make a correct use of the texture.\r\n * @param sceneOrEngine Define the scene or engine the texture belongs to\r\n * @param internalTexture Define the internal texture associated with the texture\r\n */\r\n constructor(sceneOrEngine?: Nullable<Scene | AbstractEngine>, internalTexture: Nullable<InternalTexture> = null) {\r\n super(null);\r\n\r\n if (sceneOrEngine) {\r\n if (BaseTexture._IsScene(sceneOrEngine)) {\r\n this._scene = sceneOrEngine;\r\n } else {\r\n this._engine = sceneOrEngine;\r\n }\r\n } else {\r\n this._scene = EngineStore.LastCreatedScene;\r\n }\r\n\r\n if (this._scene) {\r\n this.uniqueId = this._scene.getUniqueId();\r\n this._scene.addTexture(this);\r\n this._engine = this._scene.getEngine();\r\n }\r\n\r\n this._texture = internalTexture;\r\n\r\n this._uid = null;\r\n }\r\n\r\n /**\r\n * Get the scene the texture belongs to.\r\n * @returns the scene or null if undefined\r\n */\r\n public getScene(): Nullable<Scene> {\r\n return this._scene;\r\n }\r\n\r\n /** @internal */\r\n protected _getEngine(): Nullable<AbstractEngine> {\r\n return this._engine;\r\n }\r\n\r\n /**\r\n * Get the texture transform matrix used to offset tile the texture for instance.\r\n * @returns the transformation matrix\r\n */\r\n public getTextureMatrix(): Matrix {\r\n return <Matrix>Matrix.IdentityReadOnly;\r\n }\r\n\r\n /**\r\n * Get the texture reflection matrix used to rotate/transform the reflection.\r\n * @returns the reflection matrix\r\n */\r\n public getReflectionTextureMatrix(): Matrix {\r\n return <Matrix>Matrix.IdentityReadOnly;\r\n }\r\n\r\n /**\r\n * Gets a suitable rotate/transform matrix when the texture is used for refraction.\r\n * There's a separate function from getReflectionTextureMatrix because refraction requires a special configuration of the matrix in right-handed mode.\r\n * @returns The refraction matrix\r\n */\r\n public getRefractionTextureMatrix(): Matrix {\r\n return this.getReflectionTextureMatrix();\r\n }\r\n\r\n /**\r\n * Get if the texture is ready to be consumed (either it is ready or it is not blocking)\r\n * @returns true if ready, not blocking or if there was an error loading the texture\r\n */\r\n public isReadyOrNotBlocking(): boolean {\r\n return !this.isBlocking || this.isReady() || this.loadingError;\r\n }\r\n\r\n /**\r\n * Scales the texture if is `canRescale()`\r\n * @param ratio the resize factor we want to use to rescale\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n public scale(ratio: number): void {}\r\n\r\n /**\r\n * Get if the texture can rescale.\r\n */\r\n public get canRescale(): boolean {\r\n return false;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _getFromCache(url: Nullable<string>, noMipmap: boolean, sampling?: number, invertY?: boolean, useSRGBBuffer?: boolean, isCube?: boolean): Nullable<InternalTexture> {\r\n const engine = this._getEngine();\r\n if (!engine) {\r\n return null;\r\n }\r\n\r\n const correctedUseSRGBBuffer = engine._getUseSRGBBuffer(!!useSRGBBuffer, noMipmap);\r\n\r\n const texturesCache = engine.getLoadedTexturesCache();\r\n for (let index = 0; index < texturesCache.length; index++) {\r\n const texturesCacheEntry = texturesCache[index];\r\n\r\n if (useSRGBBuffer === undefined || correctedUseSRGBBuffer === texturesCacheEntry._useSRGBBuffer) {\r\n if (invertY === undefined || invertY === texturesCacheEntry.invertY) {\r\n if (texturesCacheEntry.url === url && texturesCacheEntry.generateMipMaps === !noMipmap) {\r\n if (!sampling || sampling === texturesCacheEntry.samplingMode) {\r\n if (isCube === undefined || isCube === texturesCacheEntry.isCube) {\r\n texturesCacheEntry.incrementReferences();\r\n return texturesCacheEntry;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /** @internal */\r\n public _rebuild(_fromContextLost = false): void {}\r\n\r\n /**\r\n * Clones the texture.\r\n * @returns the cloned texture\r\n */\r\n public clone(): Nullable<BaseTexture> {\r\n return null;\r\n }\r\n\r\n /**\r\n * Get the texture underlying type (INT, FLOAT...)\r\n */\r\n public get textureType(): number {\r\n if (!this._texture) {\r\n return Constants.TEXTURETYPE_UNSIGNED_BYTE;\r\n }\r\n\r\n return this._texture.type !== undefined ? this._texture.type : Constants.TEXTURETYPE_UNSIGNED_BYTE;\r\n }\r\n\r\n /**\r\n * Get the texture underlying format (RGB, RGBA...)\r\n */\r\n public get textureFormat(): number {\r\n if (!this._texture) {\r\n return Constants.TEXTUREFORMAT_RGBA;\r\n }\r\n\r\n return this._texture.format !== undefined ? this._texture.format : Constants.TEXTUREFORMAT_RGBA;\r\n }\r\n\r\n /**\r\n * Indicates that textures need to be re-calculated for all materials\r\n */\r\n protected _markAllSubMeshesAsTexturesDirty() {\r\n const scene = this.getScene();\r\n\r\n if (!scene) {\r\n return;\r\n }\r\n\r\n scene.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag);\r\n }\r\n\r\n /**\r\n * Reads the pixels stored in the webgl texture and returns them as an ArrayBuffer.\r\n * This will returns an RGBA array buffer containing either in values (0-255) or\r\n * float values (0-1) depending of the underlying buffer type.\r\n * @param faceIndex defines the face of the texture to read (in case of cube texture)\r\n * @param level defines the LOD level of the texture to read (in case of Mip Maps)\r\n * @param buffer defines a user defined buffer to fill with data (can be null)\r\n * @param flushRenderer true to flush the renderer from the pending commands before reading the pixels\r\n * @param noDataConversion false to convert the data to Uint8Array (if texture type is UNSIGNED_BYTE) or to Float32Array (if texture type is anything but UNSIGNED_BYTE). If true, the type of the generated buffer (if buffer==null) will depend on the type of the texture\r\n * @param x defines the region x coordinates to start reading from (default to 0)\r\n * @param y defines the region y coordinates to start reading from (default to 0)\r\n * @param width defines the region width to read from (default to the texture size at level)\r\n * @param height defines the region width to read from (default to the texture size at level)\r\n * @returns The Array buffer promise containing the pixels data.\r\n */\r\n public readPixels(\r\n faceIndex = 0,\r\n level = 0,\r\n buffer: Nullable<ArrayBufferView> = null,\r\n flushRenderer = true,\r\n noDataConversion = false,\r\n x = 0,\r\n y = 0,\r\n width = Number.MAX_VALUE,\r\n height = Number.MAX_VALUE\r\n ): Nullable<Promise<ArrayBufferView>> {\r\n if (!this._texture) {\r\n return null;\r\n }\r\n\r\n const engine = this._getEngine();\r\n if (!engine) {\r\n return null;\r\n }\r\n\r\n const size = this.getSize();\r\n let maxWidth = size.width;\r\n let maxHeight = size.height;\r\n if (level !== 0) {\r\n maxWidth = maxWidth / Math.pow(2, level);\r\n maxHeight = maxHeight / Math.pow(2, level);\r\n maxWidth = Math.round(maxWidth);\r\n maxHeight = Math.round(maxHeight);\r\n }\r\n\r\n width = Math.min(maxWidth, width);\r\n height = Math.min(maxHeight, height);\r\n\r\n try {\r\n if (this._texture.isCube) {\r\n return engine._readTexturePixels(this._texture, width, height, faceIndex, level, buffer, flushRenderer, noDataConversion, x, y);\r\n }\r\n\r\n return engine._readTexturePixels(this._texture, width, height, -1, level, buffer, flushRenderer, noDataConversion, x, y);\r\n } catch (e) {\r\n return null;\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _readPixelsSync(faceIndex = 0, level = 0, buffer: Nullable<ArrayBufferView> = null, flushRenderer = true, noDataConversion = false): Nullable<ArrayBufferView> {\r\n if (!this._texture) {\r\n return null;\r\n }\r\n\r\n const size = this.getSize();\r\n let width = size.width;\r\n let height = size.height;\r\n\r\n const engine = this._getEngine();\r\n if (!engine) {\r\n return null;\r\n }\r\n\r\n if (level != 0) {\r\n width = width / Math.pow(2, level);\r\n height = height / Math.pow(2, level);\r\n\r\n width = Math.round(width);\r\n height = Math.round(height);\r\n }\r\n\r\n try {\r\n if (this._texture.isCube) {\r\n return engine._readTexturePixelsSync(this._texture, width, height, faceIndex, level, buffer, flushRenderer, noDataConversion);\r\n }\r\n\r\n return engine._readTexturePixelsSync(this._texture, width, height, -1, level, buffer, flushRenderer, noDataConversion);\r\n } catch (e) {\r\n return null;\r\n }\r\n }\r\n\r\n /** @internal */\r\n public get _lodTextureHigh(): Nullable<BaseTexture> {\r\n if (this._texture) {\r\n return this._texture._lodTextureHigh;\r\n }\r\n return null;\r\n }\r\n\r\n /** @internal */\r\n public get _lodTextureMid(): Nullable<BaseTexture> {\r\n if (this._texture) {\r\n return this._texture._lodTextureMid;\r\n }\r\n return null;\r\n }\r\n\r\n /** @internal */\r\n public get _lodTextureLow(): Nullable<BaseTexture> {\r\n if (this._texture) {\r\n return this._texture._lodTextureLow;\r\n }\r\n return null;\r\n }\r\n\r\n /**\r\n * Dispose the texture and release its associated resources.\r\n */\r\n public override dispose(): void {\r\n if (this._scene) {\r\n // Animations\r\n if (this._scene.stopAnimation) {\r\n this._scene.stopAnimation(this);\r\n }\r\n\r\n // Remove from scene\r\n this._scene.removePendingData(this);\r\n const index = this._scene.textures.indexOf(this);\r\n\r\n if (index >= 0) {\r\n this._scene.textures.splice(index, 1);\r\n }\r\n this._scene.onTextureRemovedObservable.notifyObservers(this);\r\n this._scene = null;\r\n\r\n if (this._parentContainer) {\r\n const index = this._parentContainer.textures.indexOf(this);\r\n if (index > -1) {\r\n this._parentContainer.textures.splice(index, 1);\r\n }\r\n this._parentContainer = null;\r\n }\r\n }\r\n\r\n // Callback\r\n this.onDisposeObservable.notifyObservers(this);\r\n this.onDisposeObservable.clear();\r\n\r\n this.metadata = null;\r\n\r\n super.dispose();\r\n }\r\n\r\n /**\r\n * Serialize the texture into a JSON representation that can be parsed later on.\r\n * @param allowEmptyName True to force serialization even if name is empty. Default: false\r\n * @returns the JSON representation of the texture\r\n */\r\n public serialize(allowEmptyName = false): any {\r\n if (!this.name && !allowEmptyName) {\r\n return null;\r\n }\r\n\r\n const serializationObject = SerializationHelper.Serialize(this);\r\n\r\n // Animations\r\n SerializationHelper.AppendSerializedAnimations(this, serializationObject);\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Helper function to be called back once a list of texture contains only ready textures.\r\n * @param textures Define the list of textures to wait for\r\n * @param callback Define the callback triggered once the entire list will be ready\r\n */\r\n public static WhenAllReady(textures: BaseTexture[], callback: () => void): void {\r\n let numRemaining = textures.length;\r\n if (numRemaining === 0) {\r\n callback();\r\n return;\r\n }\r\n\r\n for (let i = 0; i < textures.length; i++) {\r\n const texture = textures[i];\r\n\r\n if (texture.isReady()) {\r\n if (--numRemaining === 0) {\r\n callback();\r\n }\r\n } else {\r\n const onLoadObservable = (texture as any).onLoadObservable as Observable<BaseTexture>;\r\n\r\n if (onLoadObservable) {\r\n onLoadObservable.addOnce(() => {\r\n if (--numRemaining === 0) {\r\n callback();\r\n }\r\n });\r\n } else {\r\n if (--numRemaining === 0) {\r\n callback();\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n private static _IsScene(sceneOrEngine: Scene | AbstractEngine): sceneOrEngine is Scene {\r\n return sceneOrEngine.getClassName() === \"Scene\";\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"baseTexture.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/Textures/baseTexture.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAGnD,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEjD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,OAAO,sBAAsB,CAAC;AAE9B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAG1E;;;;GAIG;AACH,MAAM,OAAO,WAAY,SAAQ,WAAW;IA6CxC;;OAEG;IACH,IAAW,QAAQ,CAAC,KAAc;QAC9B,IAAI,IAAI,CAAC,SAAS,KAAK,KAAK,EAAE,CAAC;YAC3B,OAAO;QACX,CAAC;QACD,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;QACvB,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YACd,IAAI,CAAC,MAAM,CAAC,uBAAuB,CAAC,SAAS,CAAC,yBAAyB,EAAE,CAAC,GAAG,EAAE,EAAE;gBAC7E,OAAO,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;YAChC,CAAC,CAAC,CAAC;QACP,CAAC;IACL,CAAC;IACD,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,SAAS,CAAC;IAC1B,CAAC;IAID;;;OAGG;IACH,IAAW,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AAS,EAAE;4CAOX;AAqDD;IADC,SAAS,EAAE;oDAWX;AA8BM;IADN,SAAS,EAAE;4CACW;AAahB;IADN,SAAS,EAAE;oDACmB;AAM/B;IADC,SAAS,EAAE;sDAOX;AAWD;IADC,SAAS,EAAE;qDAOX;AAaD;IADC,SAAS,EAAE;oDAOX;AAaD;IADC,kBAAkB,EAAE;oDAOpB;AAmBM;IADN,SAAS,EAAE;mDACkB","sourcesContent":["import { serialize, serializeAsTexture } from \"../../Misc/decorators\";\r\nimport type { Observer } from \"../../Misc/observable\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { Matrix } from \"../../Maths/math.vector\";\r\nimport type { Vector3 } from \"../../Maths/math.vector\";\r\nimport { EngineStore } from \"../../Engines/engineStore\";\r\nimport type { InternalTexture } from \"../../Materials/Textures/internalTexture\";\r\nimport { Constants } from \"../../Engines/constants\";\r\nimport type { IAnimatable } from \"../../Animations/animatable.interface\";\r\nimport { RandomGUID } from \"../../Misc/guid\";\r\n\r\nimport \"../../Misc/fileTools\";\r\nimport type { AbstractEngine } from \"../../Engines/abstractEngine\";\r\nimport { ThinTexture } from \"./thinTexture\";\r\n\r\nimport type { Animation } from \"../../Animations/animation\";\r\nimport { SerializationHelper } from \"../../Misc/decorators.serialization\";\r\nimport type { IAssetContainer } from \"core/IAssetContainer\";\r\n\r\n/**\r\n * Base class of all the textures in babylon.\r\n * It groups all the common properties the materials, post process, lights... might need\r\n * in order to make a correct use of the texture.\r\n */\r\nexport class BaseTexture extends ThinTexture implements IAnimatable {\r\n /**\r\n * Default anisotropic filtering level for the application.\r\n * It is set to 4 as a good tradeoff between perf and quality.\r\n */\r\n public static DEFAULT_ANISOTROPIC_FILTERING_LEVEL = 4;\r\n\r\n /**\r\n * Gets or sets the unique id of the texture\r\n */\r\n @serialize()\r\n public uniqueId: number;\r\n\r\n /**\r\n * Define the name of the texture.\r\n */\r\n @serialize()\r\n public name: string;\r\n\r\n /**\r\n * Define the display name of the texture, which is used as tree item name of the dedicated node in the inspector\r\n */\r\n @serialize()\r\n public displayName: string;\r\n\r\n /**\r\n * Gets or sets an object used to store user defined information.\r\n */\r\n @serialize()\r\n public metadata: any = null;\r\n\r\n /** @internal */\r\n public _internalMetadata: any;\r\n\r\n /**\r\n * For internal use only. Please do not use.\r\n */\r\n public reservedDataStore: any = null;\r\n /**\r\n * For control if the texture should be serialized with material\r\n */\r\n public doNotSerialize = false;\r\n\r\n @serialize(\"hasAlpha\")\r\n private _hasAlpha = false;\r\n /**\r\n * Define if the texture is having a usable alpha value (can be use for transparency or glossiness for instance).\r\n */\r\n public set hasAlpha(value: boolean) {\r\n if (this._hasAlpha === value) {\r\n return;\r\n }\r\n this._hasAlpha = value;\r\n if (this._scene) {\r\n this._scene.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag, (mat) => {\r\n return mat.hasTexture(this);\r\n });\r\n }\r\n }\r\n public get hasAlpha(): boolean {\r\n return this._hasAlpha;\r\n }\r\n\r\n @serialize(\"getAlphaFromRGB\")\r\n private _getAlphaFromRGB = false;\r\n /**\r\n * Defines if the alpha value should be determined via the rgb values.\r\n * If true the luminance of the pixel might be used to find the corresponding alpha value.\r\n */\r\n public set getAlphaFromRGB(value: boolean) {\r\n if (this._getAlphaFromRGB === value) {\r\n return;\r\n }\r\n this._getAlphaFromRGB = value;\r\n if (this._scene) {\r\n this._scene.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag, (mat) => {\r\n return mat.hasTexture(this);\r\n });\r\n }\r\n }\r\n public get getAlphaFromRGB(): boolean {\r\n return this._getAlphaFromRGB;\r\n }\r\n\r\n /**\r\n * Intensity or strength of the texture.\r\n * It is commonly used by materials to fine tune the intensity of the texture\r\n */\r\n @serialize()\r\n public level = 1;\r\n\r\n @serialize(\"coordinatesIndex\")\r\n protected _coordinatesIndex = 0;\r\n\r\n /**\r\n * Gets or sets a boolean indicating that the texture should try to reduce shader code if there is no UV manipulation.\r\n * (ie. when texture.getTextureMatrix().isIdentityAs3x2() returns true)\r\n */\r\n @serialize()\r\n public optimizeUVAllocation = true;\r\n\r\n /**\r\n * Define the UV channel to use starting from 0 and defaulting to 0.\r\n * This is part of the texture as textures usually maps to one uv set.\r\n */\r\n public set coordinatesIndex(value: number) {\r\n if (this._coordinatesIndex === value) {\r\n return;\r\n }\r\n this._coordinatesIndex = value;\r\n if (this._scene) {\r\n this._scene.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag, (mat) => {\r\n return mat.hasTexture(this);\r\n });\r\n }\r\n }\r\n public get coordinatesIndex(): number {\r\n return this._coordinatesIndex;\r\n }\r\n\r\n @serialize(\"coordinatesMode\")\r\n protected _coordinatesMode = Constants.TEXTURE_EXPLICIT_MODE;\r\n\r\n /**\r\n * How a texture is mapped.\r\n *\r\n * | Value | Type | Description |\r\n * | ----- | ----------------------------------- | ----------- |\r\n * | 0 | EXPLICIT_MODE | |\r\n * | 1 | SPHERICAL_MODE | |\r\n * | 2 | PLANAR_MODE | |\r\n * | 3 | CUBIC_MODE | |\r\n * | 4 | PROJECTION_MODE | |\r\n * | 5 | SKYBOX_MODE | |\r\n * | 6 | INVCUBIC_MODE | |\r\n * | 7 | EQUIRECTANGULAR_MODE | |\r\n * | 8 | FIXED_EQUIRECTANGULAR_MODE | |\r\n * | 9 | FIXED_EQUIRECTANGULAR_MIRRORED_MODE | |\r\n */\r\n public override set coordinatesMode(value: number) {\r\n if (this._coordinatesMode === value) {\r\n return;\r\n }\r\n this._coordinatesMode = value;\r\n if (this._scene) {\r\n this._scene.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag, (mat) => {\r\n return mat.hasTexture(this);\r\n });\r\n }\r\n }\r\n public override get coordinatesMode(): number {\r\n return this._coordinatesMode;\r\n }\r\n\r\n /**\r\n * | Value | Type | Description |\r\n * | ----- | ------------------ | ----------- |\r\n * | 0 | CLAMP_ADDRESSMODE | |\r\n * | 1 | WRAP_ADDRESSMODE | |\r\n * | 2 | MIRROR_ADDRESSMODE | |\r\n */\r\n @serialize()\r\n public override get wrapU() {\r\n return this._wrapU;\r\n }\r\n public override set wrapU(value: number) {\r\n this._wrapU = value;\r\n }\r\n\r\n /**\r\n * | Value | Type | Description |\r\n * | ----- | ------------------ | ----------- |\r\n * | 0 | CLAMP_ADDRESSMODE | |\r\n * | 1 | WRAP_ADDRESSMODE | |\r\n * | 2 | MIRROR_ADDRESSMODE | |\r\n */\r\n @serialize()\r\n public override get wrapV() {\r\n return this._wrapV;\r\n }\r\n public override set wrapV(value: number) {\r\n this._wrapV = value;\r\n }\r\n\r\n /**\r\n * | Value | Type | Description |\r\n * | ----- | ------------------ | ----------- |\r\n * | 0 | CLAMP_ADDRESSMODE | |\r\n * | 1 | WRAP_ADDRESSMODE | |\r\n * | 2 | MIRROR_ADDRESSMODE | |\r\n */\r\n @serialize()\r\n public override wrapR = Constants.TEXTURE_WRAP_ADDRESSMODE;\r\n\r\n /**\r\n * With compliant hardware and browser (supporting anisotropic filtering)\r\n * this defines the level of anisotropic filtering in the texture.\r\n * The higher the better but the slower. This defaults to 4 as it seems to be the best tradeoff.\r\n */\r\n @serialize()\r\n public override anisotropicFilteringLevel = BaseTexture.DEFAULT_ANISOTROPIC_FILTERING_LEVEL;\r\n\r\n /** @internal */\r\n public _isCube = false;\r\n /**\r\n * Define if the texture is a cube texture or if false a 2d texture.\r\n */\r\n @serialize()\r\n public override get isCube(): boolean {\r\n if (!this._texture) {\r\n return this._isCube;\r\n }\r\n\r\n return this._texture.isCube;\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n protected override set isCube(value: boolean) {\r\n if (!this._texture) {\r\n this._isCube = value;\r\n } else {\r\n this._texture.isCube = value;\r\n }\r\n }\r\n\r\n /**\r\n * Define if the texture is a 3d texture (webgl 2) or if false a 2d texture.\r\n */\r\n @serialize()\r\n public override get is3D(): boolean {\r\n if (!this._texture) {\r\n return false;\r\n }\r\n\r\n return this._texture.is3D;\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n protected override set is3D(value: boolean) {\r\n if (!this._texture) {\r\n return;\r\n }\r\n\r\n this._texture.is3D = value;\r\n }\r\n\r\n /**\r\n * Define if the texture is a 2d array texture (webgl 2) or if false a 2d texture.\r\n */\r\n @serialize()\r\n public override get is2DArray(): boolean {\r\n if (!this._texture) {\r\n return false;\r\n }\r\n\r\n return this._texture.is2DArray;\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n protected override set is2DArray(value: boolean) {\r\n if (!this._texture) {\r\n return;\r\n }\r\n\r\n this._texture.is2DArray = value;\r\n }\r\n\r\n /** @internal */\r\n protected _gammaSpace = true;\r\n /**\r\n * Define if the texture contains data in gamma space (most of the png/jpg aside bump).\r\n * HDR texture are usually stored in linear space.\r\n * This only impacts the PBR and Background materials\r\n */\r\n public get gammaSpace(): boolean {\r\n if (!this._texture) {\r\n return this._gammaSpace;\r\n } else {\r\n if (this._texture._gammaSpace === null) {\r\n this._texture._gammaSpace = this._gammaSpace;\r\n }\r\n }\r\n\r\n return this._texture._gammaSpace && !this._texture._useSRGBBuffer;\r\n }\r\n\r\n public set gammaSpace(gamma: boolean) {\r\n if (!this._texture) {\r\n if (this._gammaSpace === gamma) {\r\n return;\r\n }\r\n\r\n this._gammaSpace = gamma;\r\n } else {\r\n if (this._texture._gammaSpace === gamma) {\r\n return;\r\n }\r\n this._texture._gammaSpace = gamma;\r\n }\r\n\r\n this.getScene()?.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag, (mat) => {\r\n return mat.hasTexture(this);\r\n });\r\n }\r\n\r\n /**\r\n * Define gamma space which not affected by useSRGBBuffer\r\n */\r\n @serialize()\r\n public get currentGammaSpace(): boolean {\r\n if (!this._texture) {\r\n return this._gammaSpace;\r\n } else {\r\n if (this._texture._gammaSpace === null) {\r\n this._texture._gammaSpace = this._gammaSpace;\r\n }\r\n }\r\n\r\n return this._texture._gammaSpace;\r\n }\r\n\r\n public set currentGammaSpace(gamma) {\r\n this.gammaSpace = gamma;\r\n }\r\n\r\n /**\r\n * Gets or sets whether or not the texture contains RGBD data.\r\n */\r\n public get isRGBD(): boolean {\r\n return this._texture != null && this._texture._isRGBD;\r\n }\r\n public set isRGBD(value: boolean) {\r\n if (value === this.isRGBD) {\r\n return;\r\n }\r\n\r\n if (this._texture) {\r\n this._texture._isRGBD = value;\r\n }\r\n\r\n this.getScene()?.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag, (mat) => {\r\n return mat.hasTexture(this);\r\n });\r\n }\r\n\r\n /**\r\n * Is Z inverted in the texture (useful in a cube texture).\r\n */\r\n @serialize()\r\n public invertZ = false;\r\n\r\n /**\r\n * Are mip maps generated for this texture or not.\r\n */\r\n public get noMipmap(): boolean {\r\n return false;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n @serialize()\r\n public lodLevelInAlpha = false;\r\n\r\n /**\r\n * With prefiltered texture, defined the offset used during the prefiltering steps.\r\n */\r\n @serialize()\r\n public get lodGenerationOffset(): number {\r\n if (this._texture) {\r\n return this._texture._lodGenerationOffset;\r\n }\r\n\r\n return 0.0;\r\n }\r\n public set lodGenerationOffset(value: number) {\r\n if (this._texture) {\r\n this._texture._lodGenerationOffset = value;\r\n }\r\n }\r\n\r\n /**\r\n * With prefiltered texture, defined the scale used during the prefiltering steps.\r\n */\r\n @serialize()\r\n public get lodGenerationScale(): number {\r\n if (this._texture) {\r\n return this._texture._lodGenerationScale;\r\n }\r\n\r\n return 0.0;\r\n }\r\n public set lodGenerationScale(value: number) {\r\n if (this._texture) {\r\n this._texture._lodGenerationScale = value;\r\n }\r\n }\r\n\r\n /**\r\n * With prefiltered texture, defined if the specular generation is based on a linear ramp.\r\n * By default we are using a log2 of the linear roughness helping to keep a better resolution for\r\n * average roughness values.\r\n */\r\n @serialize()\r\n public get linearSpecularLOD(): boolean {\r\n if (this._texture) {\r\n return this._texture._linearSpecularLOD;\r\n }\r\n\r\n return false;\r\n }\r\n public set linearSpecularLOD(value: boolean) {\r\n if (this._texture) {\r\n this._texture._linearSpecularLOD = value;\r\n }\r\n }\r\n\r\n /**\r\n * In case a better definition than spherical harmonics is required for the diffuse part of the environment.\r\n * You can set the irradiance texture to rely on a texture instead of the spherical approach.\r\n * This texture need to have the same characteristics than its parent (Cube vs 2d, coordinates mode, Gamma/Linear, RGBD).\r\n */\r\n @serializeAsTexture()\r\n public get irradianceTexture(): Nullable<BaseTexture> {\r\n if (this._texture) {\r\n return this._texture._irradianceTexture;\r\n }\r\n\r\n return null;\r\n }\r\n public set irradianceTexture(value: Nullable<BaseTexture>) {\r\n if (this._texture) {\r\n this._texture._irradianceTexture = value;\r\n }\r\n }\r\n\r\n /**\r\n * Indicates the average direction of light in an environment map. This\r\n * can be treated as the most dominant direction but it's magnitude also\r\n * tells you something about how dominant that direction is.\r\n */\r\n /** @internal */\r\n public _dominantDirection: Nullable<Vector3> = null;\r\n\r\n /**\r\n * Define if the texture is a render target.\r\n */\r\n @serialize()\r\n public isRenderTarget = false;\r\n\r\n /**\r\n * Define the unique id of the texture in the scene.\r\n */\r\n public get uid(): string {\r\n if (!this._uid) {\r\n this._uid = RandomGUID();\r\n }\r\n return this._uid;\r\n }\r\n\r\n /** @internal */\r\n public _prefiltered: boolean = false;\r\n /** @internal */\r\n public _forceSerialize: boolean = false;\r\n\r\n /**\r\n * Return a string representation of the texture.\r\n * @returns the texture as a string\r\n */\r\n public override toString(): string {\r\n return this.name;\r\n }\r\n\r\n /**\r\n * Get the class name of the texture.\r\n * @returns \"BaseTexture\"\r\n */\r\n public override getClassName(): string {\r\n return \"BaseTexture\";\r\n }\r\n\r\n /**\r\n * Define the list of animation attached to the texture.\r\n */\r\n public animations: Animation[] = [];\r\n\r\n /**\r\n * An event triggered when the texture is disposed.\r\n */\r\n public onDisposeObservable = new Observable<BaseTexture>();\r\n\r\n private _onDisposeObserver: Nullable<Observer<BaseTexture>> = null;\r\n /**\r\n * Callback triggered when the texture has been disposed.\r\n * Kept for back compatibility, you can use the onDisposeObservable instead.\r\n */\r\n public set onDispose(callback: () => void) {\r\n if (this._onDisposeObserver) {\r\n this.onDisposeObservable.remove(this._onDisposeObserver);\r\n }\r\n this._onDisposeObserver = this.onDisposeObservable.add(callback);\r\n }\r\n\r\n protected _scene: Nullable<Scene> = null;\r\n\r\n /** @internal */\r\n private _uid: Nullable<string> = null;\r\n\r\n /**\r\n * Define if the texture is preventing a material to render or not.\r\n * If not and the texture is not ready, the engine will use a default black texture instead.\r\n */\r\n public get isBlocking(): boolean {\r\n return true;\r\n }\r\n\r\n /** @internal */\r\n public _parentContainer: Nullable<IAssetContainer> = null;\r\n\r\n protected _loadingError: boolean = false;\r\n protected _errorObject?: {\r\n message?: string;\r\n exception?: any;\r\n };\r\n\r\n /**\r\n * Was there any loading error?\r\n */\r\n public get loadingError(): boolean {\r\n return this._loadingError;\r\n }\r\n\r\n /**\r\n * If a loading error occurred this object will be populated with information about the error.\r\n */\r\n public get errorObject():\r\n | {\r\n message?: string;\r\n exception?: any;\r\n }\r\n | undefined {\r\n return this._errorObject;\r\n }\r\n\r\n /**\r\n * Instantiates a new BaseTexture.\r\n * Base class of all the textures in babylon.\r\n * It groups all the common properties the materials, post process, lights... might need\r\n * in order to make a correct use of the texture.\r\n * @param sceneOrEngine Define the scene or engine the texture belongs to\r\n * @param internalTexture Define the internal texture associated with the texture\r\n */\r\n constructor(sceneOrEngine?: Nullable<Scene | AbstractEngine>, internalTexture: Nullable<InternalTexture> = null) {\r\n super(null);\r\n\r\n if (sceneOrEngine) {\r\n if (BaseTexture._IsScene(sceneOrEngine)) {\r\n this._scene = sceneOrEngine;\r\n } else {\r\n this._engine = sceneOrEngine;\r\n }\r\n } else {\r\n this._scene = EngineStore.LastCreatedScene;\r\n }\r\n\r\n if (this._scene) {\r\n this.uniqueId = this._scene.getUniqueId();\r\n this._scene.addTexture(this);\r\n this._engine = this._scene.getEngine();\r\n }\r\n\r\n this._texture = internalTexture;\r\n\r\n this._uid = null;\r\n }\r\n\r\n /**\r\n * Get the scene the texture belongs to.\r\n * @returns the scene or null if undefined\r\n */\r\n public getScene(): Nullable<Scene> {\r\n return this._scene;\r\n }\r\n\r\n /** @internal */\r\n protected _getEngine(): Nullable<AbstractEngine> {\r\n return this._engine;\r\n }\r\n\r\n /**\r\n * Get the texture transform matrix used to offset tile the texture for instance.\r\n * @returns the transformation matrix\r\n */\r\n public getTextureMatrix(): Matrix {\r\n return <Matrix>Matrix.IdentityReadOnly;\r\n }\r\n\r\n /**\r\n * Get the texture reflection matrix used to rotate/transform the reflection.\r\n * @returns the reflection matrix\r\n */\r\n public getReflectionTextureMatrix(): Matrix {\r\n return <Matrix>Matrix.IdentityReadOnly;\r\n }\r\n\r\n /**\r\n * Gets a suitable rotate/transform matrix when the texture is used for refraction.\r\n * There's a separate function from getReflectionTextureMatrix because refraction requires a special configuration of the matrix in right-handed mode.\r\n * @returns The refraction matrix\r\n */\r\n public getRefractionTextureMatrix(): Matrix {\r\n return this.getReflectionTextureMatrix();\r\n }\r\n\r\n /**\r\n * Get if the texture is ready to be consumed (either it is ready or it is not blocking)\r\n * @returns true if ready, not blocking or if there was an error loading the texture\r\n */\r\n public isReadyOrNotBlocking(): boolean {\r\n return !this.isBlocking || this.isReady() || this.loadingError;\r\n }\r\n\r\n /**\r\n * Scales the texture if is `canRescale()`\r\n * @param ratio the resize factor we want to use to rescale\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n public scale(ratio: number): void {}\r\n\r\n /**\r\n * Get if the texture can rescale.\r\n */\r\n public get canRescale(): boolean {\r\n return false;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _getFromCache(url: Nullable<string>, noMipmap: boolean, sampling?: number, invertY?: boolean, useSRGBBuffer?: boolean, isCube?: boolean): Nullable<InternalTexture> {\r\n const engine = this._getEngine();\r\n if (!engine) {\r\n return null;\r\n }\r\n\r\n const correctedUseSRGBBuffer = engine._getUseSRGBBuffer(!!useSRGBBuffer, noMipmap);\r\n\r\n const texturesCache = engine.getLoadedTexturesCache();\r\n for (let index = 0; index < texturesCache.length; index++) {\r\n const texturesCacheEntry = texturesCache[index];\r\n\r\n if (useSRGBBuffer === undefined || correctedUseSRGBBuffer === texturesCacheEntry._useSRGBBuffer) {\r\n if (invertY === undefined || invertY === texturesCacheEntry.invertY) {\r\n if (texturesCacheEntry.url === url && texturesCacheEntry.generateMipMaps === !noMipmap) {\r\n if (!sampling || sampling === texturesCacheEntry.samplingMode) {\r\n if (isCube === undefined || isCube === texturesCacheEntry.isCube) {\r\n texturesCacheEntry.incrementReferences();\r\n return texturesCacheEntry;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /** @internal */\r\n public _rebuild(_fromContextLost = false): void {}\r\n\r\n /**\r\n * Clones the texture.\r\n * @returns the cloned texture\r\n */\r\n public clone(): Nullable<BaseTexture> {\r\n return null;\r\n }\r\n\r\n /**\r\n * Get the texture underlying type (INT, FLOAT...)\r\n */\r\n public get textureType(): number {\r\n if (!this._texture) {\r\n return Constants.TEXTURETYPE_UNSIGNED_BYTE;\r\n }\r\n\r\n return this._texture.type !== undefined ? this._texture.type : Constants.TEXTURETYPE_UNSIGNED_BYTE;\r\n }\r\n\r\n /**\r\n * Get the texture underlying format (RGB, RGBA...)\r\n */\r\n public get textureFormat(): number {\r\n if (!this._texture) {\r\n return Constants.TEXTUREFORMAT_RGBA;\r\n }\r\n\r\n return this._texture.format !== undefined ? this._texture.format : Constants.TEXTUREFORMAT_RGBA;\r\n }\r\n\r\n /**\r\n * Indicates that textures need to be re-calculated for all materials\r\n */\r\n protected _markAllSubMeshesAsTexturesDirty() {\r\n const scene = this.getScene();\r\n\r\n if (!scene) {\r\n return;\r\n }\r\n\r\n scene.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag);\r\n }\r\n\r\n /**\r\n * Reads the pixels stored in the webgl texture and returns them as an ArrayBuffer.\r\n * This will returns an RGBA array buffer containing either in values (0-255) or\r\n * float values (0-1) depending of the underlying buffer type.\r\n * @param faceIndex defines the face of the texture to read (in case of cube texture)\r\n * @param level defines the LOD level of the texture to read (in case of Mip Maps)\r\n * @param buffer defines a user defined buffer to fill with data (can be null)\r\n * @param flushRenderer true to flush the renderer from the pending commands before reading the pixels\r\n * @param noDataConversion false to convert the data to Uint8Array (if texture type is UNSIGNED_BYTE) or to Float32Array (if texture type is anything but UNSIGNED_BYTE). If true, the type of the generated buffer (if buffer==null) will depend on the type of the texture\r\n * @param x defines the region x coordinates to start reading from (default to 0)\r\n * @param y defines the region y coordinates to start reading from (default to 0)\r\n * @param width defines the region width to read from (default to the texture size at level)\r\n * @param height defines the region width to read from (default to the texture size at level)\r\n * @returns The Array buffer promise containing the pixels data.\r\n */\r\n public readPixels(\r\n faceIndex = 0,\r\n level = 0,\r\n buffer: Nullable<ArrayBufferView> = null,\r\n flushRenderer = true,\r\n noDataConversion = false,\r\n x = 0,\r\n y = 0,\r\n width = Number.MAX_VALUE,\r\n height = Number.MAX_VALUE\r\n ): Nullable<Promise<ArrayBufferView>> {\r\n if (!this._texture) {\r\n return null;\r\n }\r\n\r\n const engine = this._getEngine();\r\n if (!engine) {\r\n return null;\r\n }\r\n\r\n const size = this.getSize();\r\n let maxWidth = size.width;\r\n let maxHeight = size.height;\r\n if (level !== 0) {\r\n maxWidth = maxWidth / Math.pow(2, level);\r\n maxHeight = maxHeight / Math.pow(2, level);\r\n maxWidth = Math.round(maxWidth);\r\n maxHeight = Math.round(maxHeight);\r\n }\r\n\r\n width = Math.min(maxWidth, width);\r\n height = Math.min(maxHeight, height);\r\n\r\n try {\r\n if (this._texture.isCube) {\r\n return engine._readTexturePixels(this._texture, width, height, faceIndex, level, buffer, flushRenderer, noDataConversion, x, y);\r\n }\r\n\r\n return engine._readTexturePixels(this._texture, width, height, -1, level, buffer, flushRenderer, noDataConversion, x, y);\r\n } catch (e) {\r\n return null;\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _readPixelsSync(faceIndex = 0, level = 0, buffer: Nullable<ArrayBufferView> = null, flushRenderer = true, noDataConversion = false): Nullable<ArrayBufferView> {\r\n if (!this._texture) {\r\n return null;\r\n }\r\n\r\n const size = this.getSize();\r\n let width = size.width;\r\n let height = size.height;\r\n\r\n const engine = this._getEngine();\r\n if (!engine) {\r\n return null;\r\n }\r\n\r\n if (level != 0) {\r\n width = width / Math.pow(2, level);\r\n height = height / Math.pow(2, level);\r\n\r\n width = Math.round(width);\r\n height = Math.round(height);\r\n }\r\n\r\n try {\r\n if (this._texture.isCube) {\r\n return engine._readTexturePixelsSync(this._texture, width, height, faceIndex, level, buffer, flushRenderer, noDataConversion);\r\n }\r\n\r\n return engine._readTexturePixelsSync(this._texture, width, height, -1, level, buffer, flushRenderer, noDataConversion);\r\n } catch (e) {\r\n return null;\r\n }\r\n }\r\n\r\n /** @internal */\r\n public get _lodTextureHigh(): Nullable<BaseTexture> {\r\n if (this._texture) {\r\n return this._texture._lodTextureHigh;\r\n }\r\n return null;\r\n }\r\n\r\n /** @internal */\r\n public get _lodTextureMid(): Nullable<BaseTexture> {\r\n if (this._texture) {\r\n return this._texture._lodTextureMid;\r\n }\r\n return null;\r\n }\r\n\r\n /** @internal */\r\n public get _lodTextureLow(): Nullable<BaseTexture> {\r\n if (this._texture) {\r\n return this._texture._lodTextureLow;\r\n }\r\n return null;\r\n }\r\n\r\n /**\r\n * Dispose the texture and release its associated resources.\r\n */\r\n public override dispose(): void {\r\n if (this._scene) {\r\n // Animations\r\n if (this._scene.stopAnimation) {\r\n this._scene.stopAnimation(this);\r\n }\r\n\r\n // Remove from scene\r\n this._scene.removePendingData(this);\r\n const index = this._scene.textures.indexOf(this);\r\n\r\n if (index >= 0) {\r\n this._scene.textures.splice(index, 1);\r\n }\r\n this._scene.onTextureRemovedObservable.notifyObservers(this);\r\n this._scene = null;\r\n\r\n if (this._parentContainer) {\r\n const index = this._parentContainer.textures.indexOf(this);\r\n if (index > -1) {\r\n this._parentContainer.textures.splice(index, 1);\r\n }\r\n this._parentContainer = null;\r\n }\r\n }\r\n\r\n // Callback\r\n this.onDisposeObservable.notifyObservers(this);\r\n this.onDisposeObservable.clear();\r\n\r\n this.metadata = null;\r\n\r\n super.dispose();\r\n }\r\n\r\n /**\r\n * Serialize the texture into a JSON representation that can be parsed later on.\r\n * @param allowEmptyName True to force serialization even if name is empty. Default: false\r\n * @returns the JSON representation of the texture\r\n */\r\n public serialize(allowEmptyName = false): any {\r\n if (!this.name && !allowEmptyName) {\r\n return null;\r\n }\r\n\r\n const serializationObject = SerializationHelper.Serialize(this);\r\n\r\n // Animations\r\n SerializationHelper.AppendSerializedAnimations(this, serializationObject);\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Helper function to be called back once a list of texture contains only ready textures.\r\n * @param textures Define the list of textures to wait for\r\n * @param callback Define the callback triggered once the entire list will be ready\r\n */\r\n public static WhenAllReady(textures: BaseTexture[], callback: () => void): void {\r\n let numRemaining = textures.length;\r\n if (numRemaining === 0) {\r\n callback();\r\n return;\r\n }\r\n\r\n for (let i = 0; i < textures.length; i++) {\r\n const texture = textures[i];\r\n\r\n if (texture.isReady()) {\r\n if (--numRemaining === 0) {\r\n callback();\r\n }\r\n } else {\r\n const onLoadObservable = (texture as any).onLoadObservable as Observable<BaseTexture>;\r\n\r\n if (onLoadObservable) {\r\n onLoadObservable.addOnce(() => {\r\n if (--numRemaining === 0) {\r\n callback();\r\n }\r\n });\r\n } else {\r\n if (--numRemaining === 0) {\r\n callback();\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n private static _IsScene(sceneOrEngine: Scene | AbstractEngine): sceneOrEngine is Scene {\r\n return sceneOrEngine.getClassName() === \"Scene\";\r\n }\r\n}\r\n"]}
@@ -25,6 +25,8 @@ export interface InternalTextureCreationOptions {
25
25
  createMSAATexture?: boolean;
26
26
  /** Comparison function. Used only for depth textures (default: 0) */
27
27
  comparisonFunction?: number;
28
+ /** If the created texture is a cube texture */
29
+ isCube?: boolean;
28
30
  }
29
31
  /**
30
32
  * Define options used to create a render target texture
@@ -4,7 +4,6 @@
4
4
  * @returns True if the TextureSize is an object
5
5
  */
6
6
  export function textureSizeIsObject(size) {
7
- // eslint-disable-next-line jsdoc/require-jsdoc
8
7
  return size.width !== undefined;
9
8
  }
10
9
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"textureCreationOptions.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/Textures/textureCreationOptions.ts"],"names":[],"mappings":"AAsEA;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAiB;IACjD,+CAA+C;IAC/C,OAAQ,IAA0B,CAAC,KAAK,KAAK,SAAS,CAAC;AAC3D,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,4BAA4B,CAAC,IAAiB;IAC1D,IAAI,mBAAmB,CAAC,IAAI,CAAC,EAAE,CAAC;QAC5B,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;IACtD,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;AACzC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { InternalTexture } from \"./internalTexture\";\r\n\r\n/**\r\n * Define options used to create an internal texture\r\n */\r\nexport interface InternalTextureCreationOptions {\r\n /** Specifies if mipmaps must be created. If undefined, the value from generateMipMaps is taken instead */\r\n createMipMaps?: boolean;\r\n /** Specifies if mipmaps must be generated */\r\n generateMipMaps?: boolean;\r\n /** Defines texture type (unsigned byte by default) */\r\n type?: number;\r\n /** Defines sampling mode (trilinear by default) */\r\n samplingMode?: number;\r\n /** Defines format (RGBA by default) */\r\n format?: number;\r\n /** Defines sample count (1 by default) */\r\n samples?: number;\r\n /** Texture creation flags */\r\n creationFlags?: number;\r\n /** Creates the RTT in sRGB space */\r\n useSRGBBuffer?: boolean;\r\n /** Label of the texture (used for debugging only) */\r\n label?: string;\r\n /** If the MSAA texture must be created right away (default: false) */\r\n createMSAATexture?: boolean;\r\n /** Comparison function. Used only for depth textures (default: 0) */\r\n comparisonFunction?: number;\r\n}\r\n\r\n/**\r\n * Define options used to create a render target texture\r\n */\r\nexport interface RenderTargetCreationOptions extends InternalTextureCreationOptions {\r\n /** Specifies whether or not a depth should be allocated in the texture (true by default) */\r\n generateDepthBuffer?: boolean;\r\n /** Specifies whether or not a stencil should be allocated in the texture (false by default)*/\r\n generateStencilBuffer?: boolean;\r\n /** Specifies that no color target should be bound to the render target (useful if you only want to write to the depth buffer, for eg) */\r\n noColorAttachment?: boolean;\r\n /** Specifies the internal texture to use directly instead of creating one (ignores `noColorAttachment` flag when set) **/\r\n colorAttachment?: InternalTexture;\r\n}\r\n\r\n/**\r\n * Define options used to create a depth texture\r\n */\r\nexport interface DepthTextureCreationOptions {\r\n /** Specifies whether or not a stencil should be allocated in the texture. Not used if depthTextureFormat is supplied, in which case stencil creation will depend on this value. */\r\n generateStencil?: boolean;\r\n /** Specifies whether or not bilinear filtering is enable on the texture */\r\n bilinearFiltering?: boolean;\r\n /** Specifies the comparison function to set on the texture. If 0 or undefined, the texture is not in comparison mode */\r\n comparisonFunction?: number;\r\n /** Specifies if the created texture is a cube texture */\r\n isCube?: boolean;\r\n /** Specifies the sample count of the depth/stencil texture texture */\r\n samples?: number;\r\n /** Specifies the depth texture format to use */\r\n depthTextureFormat?: number;\r\n /** Label of the texture (used for debugging only) */\r\n label?: string;\r\n}\r\n\r\n/**\r\n * Type used to define a texture size (either with a number or with a rect width and height)\r\n */\r\nexport type TextureSize = number | { width: number; height: number; depth?: number; layers?: number };\r\n\r\n/**\r\n * Check if a TextureSize is an object\r\n * @param size The TextureSize to check\r\n * @returns True if the TextureSize is an object\r\n */\r\nexport function textureSizeIsObject(size: TextureSize): size is { width: number; height: number } {\r\n // eslint-disable-next-line jsdoc/require-jsdoc\r\n return (size as { width: number }).width !== undefined;\r\n}\r\n\r\n/**\r\n * Get the width/height dimensions from a TextureSize\r\n * @param size The TextureSize to get the dimensions from\r\n * @returns The width and height as an object\r\n */\r\nexport function getDimensionsFromTextureSize(size: TextureSize): { width: number; height: number } {\r\n if (textureSizeIsObject(size)) {\r\n return { width: size.width, height: size.height };\r\n }\r\n return { width: size, height: size };\r\n}\r\n"]}
1
+ {"version":3,"file":"textureCreationOptions.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/Textures/textureCreationOptions.ts"],"names":[],"mappings":"AAwEA;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAiB;IACjD,OAAQ,IAA0B,CAAC,KAAK,KAAK,SAAS,CAAC;AAC3D,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,4BAA4B,CAAC,IAAiB;IAC1D,IAAI,mBAAmB,CAAC,IAAI,CAAC,EAAE,CAAC;QAC5B,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;IACtD,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;AACzC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { InternalTexture } from \"./internalTexture\";\r\n\r\n/**\r\n * Define options used to create an internal texture\r\n */\r\nexport interface InternalTextureCreationOptions {\r\n /** Specifies if mipmaps must be created. If undefined, the value from generateMipMaps is taken instead */\r\n createMipMaps?: boolean;\r\n /** Specifies if mipmaps must be generated */\r\n generateMipMaps?: boolean;\r\n /** Defines texture type (unsigned byte by default) */\r\n type?: number;\r\n /** Defines sampling mode (trilinear by default) */\r\n samplingMode?: number;\r\n /** Defines format (RGBA by default) */\r\n format?: number;\r\n /** Defines sample count (1 by default) */\r\n samples?: number;\r\n /** Texture creation flags */\r\n creationFlags?: number;\r\n /** Creates the RTT in sRGB space */\r\n useSRGBBuffer?: boolean;\r\n /** Label of the texture (used for debugging only) */\r\n label?: string;\r\n /** If the MSAA texture must be created right away (default: false) */\r\n createMSAATexture?: boolean;\r\n /** Comparison function. Used only for depth textures (default: 0) */\r\n comparisonFunction?: number;\r\n /** If the created texture is a cube texture */\r\n isCube?: boolean;\r\n}\r\n\r\n/**\r\n * Define options used to create a render target texture\r\n */\r\nexport interface RenderTargetCreationOptions extends InternalTextureCreationOptions {\r\n /** Specifies whether or not a depth should be allocated in the texture (true by default) */\r\n generateDepthBuffer?: boolean;\r\n /** Specifies whether or not a stencil should be allocated in the texture (false by default)*/\r\n generateStencilBuffer?: boolean;\r\n /** Specifies that no color target should be bound to the render target (useful if you only want to write to the depth buffer, for eg) */\r\n noColorAttachment?: boolean;\r\n /** Specifies the internal texture to use directly instead of creating one (ignores `noColorAttachment` flag when set) **/\r\n colorAttachment?: InternalTexture;\r\n}\r\n\r\n/**\r\n * Define options used to create a depth texture\r\n */\r\nexport interface DepthTextureCreationOptions {\r\n /** Specifies whether or not a stencil should be allocated in the texture. Not used if depthTextureFormat is supplied, in which case stencil creation will depend on this value. */\r\n generateStencil?: boolean;\r\n /** Specifies whether or not bilinear filtering is enable on the texture */\r\n bilinearFiltering?: boolean;\r\n /** Specifies the comparison function to set on the texture. If 0 or undefined, the texture is not in comparison mode */\r\n comparisonFunction?: number;\r\n /** Specifies if the created texture is a cube texture */\r\n isCube?: boolean;\r\n /** Specifies the sample count of the depth/stencil texture texture */\r\n samples?: number;\r\n /** Specifies the depth texture format to use */\r\n depthTextureFormat?: number;\r\n /** Label of the texture (used for debugging only) */\r\n label?: string;\r\n}\r\n\r\n/**\r\n * Type used to define a texture size (either with a number or with a rect width and height)\r\n */\r\nexport type TextureSize = number | { width: number; height: number; depth?: number; layers?: number };\r\n\r\n/**\r\n * Check if a TextureSize is an object\r\n * @param size The TextureSize to check\r\n * @returns True if the TextureSize is an object\r\n */\r\nexport function textureSizeIsObject(size: TextureSize): size is { width: number; height: number } {\r\n return (size as { width: number }).width !== undefined;\r\n}\r\n\r\n/**\r\n * Get the width/height dimensions from a TextureSize\r\n * @param size The TextureSize to get the dimensions from\r\n * @returns The width and height as an object\r\n */\r\nexport function getDimensionsFromTextureSize(size: TextureSize): { width: number; height: number } {\r\n if (textureSizeIsObject(size)) {\r\n return { width: size.width, height: size.height };\r\n }\r\n return { width: size, height: size };\r\n}\r\n"]}
@@ -1860,7 +1860,7 @@ export class AbstractMesh extends TransformNode {
1860
1860
  }
1861
1861
  const positions = this.getVerticesData(VertexBuffer.PositionKind);
1862
1862
  const indices = this.getIndices();
1863
- const normals = this.getVerticesData(VertexBuffer.NormalKind);
1863
+ const normals = this.getVerticesData(VertexBuffer.NormalKind)?.slice();
1864
1864
  const bInfo = this.getBoundingInfo();
1865
1865
  if (data.facetDepthSort && !data.facetDepthSortEnabled) {
1866
1866
  // init arrays, matrix and sort function on first call