@babylonjs/core 7.1.0 → 7.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Animations/animationGroup.d.ts +1 -1
- package/Animations/animationGroup.js +1 -1
- package/Animations/animationGroup.js.map +1 -1
- package/Compute/computeEffect.d.ts +0 -1
- package/Compute/computeEffect.js +40 -33
- package/Compute/computeEffect.js.map +1 -1
- package/Engines/Extensions/engine.computeShader.d.ts +25 -1
- package/Engines/Extensions/engine.computeShader.js +1 -1
- package/Engines/Extensions/engine.computeShader.js.map +1 -1
- package/Engines/WebGL/webGLRenderTargetWrapper.d.ts +1 -2
- package/Engines/WebGL/webGLRenderTargetWrapper.js +2 -3
- package/Engines/WebGL/webGLRenderTargetWrapper.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.computeShader.js +22 -0
- package/Engines/WebGPU/Extensions/engine.computeShader.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.renderTarget.js +2 -3
- package/Engines/WebGPU/Extensions/engine.renderTarget.js.map +1 -1
- package/Engines/WebGPU/webgpuComputePipelineContext.js +4 -2
- package/Engines/WebGPU/webgpuComputePipelineContext.js.map +1 -1
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.d.ts +1 -0
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js +6 -1
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureManager.js +2 -2
- package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
- package/Engines/renderTargetWrapper.d.ts +6 -2
- package/Engines/renderTargetWrapper.js +9 -2
- package/Engines/renderTargetWrapper.js.map +1 -1
- package/Engines/thinEngine.js +2 -2
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/webgpuEngine.js +4 -5
- package/Engines/webgpuEngine.js.map +1 -1
- package/Gizmos/axisScaleGizmo.js +6 -1
- package/Gizmos/axisScaleGizmo.js.map +1 -1
- package/Gizmos/boundingBoxGizmo.d.ts +2 -2
- package/Gizmos/boundingBoxGizmo.js +27 -17
- package/Gizmos/boundingBoxGizmo.js.map +1 -1
- package/Gizmos/scaleGizmo.d.ts +6 -0
- package/Gizmos/scaleGizmo.js +10 -2
- package/Gizmos/scaleGizmo.js.map +1 -1
- package/Lights/Shadows/cascadedShadowGenerator.js +1 -1
- package/Lights/Shadows/cascadedShadowGenerator.js.map +1 -1
- package/Lights/Shadows/shadowGenerator.js +17 -2
- package/Lights/Shadows/shadowGenerator.js.map +1 -1
- package/Materials/PBR/pbrBaseMaterial.js +1 -5
- package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
- package/Materials/PBR/pbrClearCoatConfiguration.d.ts +0 -1
- package/Materials/PBR/pbrClearCoatConfiguration.js +3 -12
- package/Materials/PBR/pbrClearCoatConfiguration.js.map +1 -1
- package/Materials/PBR/pbrIridescenceConfiguration.d.ts +1 -4
- package/Materials/PBR/pbrIridescenceConfiguration.js +5 -15
- package/Materials/PBR/pbrIridescenceConfiguration.js.map +1 -1
- package/Materials/PBR/pbrSheenConfiguration.d.ts +0 -1
- package/Materials/PBR/pbrSheenConfiguration.js +3 -12
- package/Materials/PBR/pbrSheenConfiguration.js.map +1 -1
- package/Materials/PBR/pbrSubSurfaceConfiguration.js +5 -17
- package/Materials/PBR/pbrSubSurfaceConfiguration.js.map +1 -1
- package/Materials/Textures/baseTexture.d.ts +0 -6
- package/Materials/Textures/baseTexture.js +0 -8
- package/Materials/Textures/baseTexture.js.map +1 -1
- package/Materials/Textures/renderTargetTexture.d.ts +2 -1
- package/Materials/Textures/renderTargetTexture.js +3 -2
- package/Materials/Textures/renderTargetTexture.js.map +1 -1
- package/Materials/Textures/texture.d.ts +0 -6
- package/Materials/Textures/texture.js +0 -15
- package/Materials/Textures/texture.js.map +1 -1
- package/Materials/Textures/thinTexture.js +1 -1
- package/Materials/Textures/thinTexture.js.map +1 -1
- package/Maths/math.vector.d.ts +12 -0
- package/Maths/math.vector.js +17 -2
- package/Maths/math.vector.js.map +1 -1
- package/Maths/tensor.d.ts +13 -11
- package/Maths/tensor.js.map +1 -1
- package/Meshes/Builders/greasedLineBuilder.js +14 -0
- package/Meshes/Builders/greasedLineBuilder.js.map +1 -1
- package/Meshes/GreasedLine/greasedLineBaseMesh.d.ts +14 -3
- package/Meshes/GreasedLine/greasedLineBaseMesh.js +18 -2
- package/Meshes/GreasedLine/greasedLineBaseMesh.js.map +1 -1
- package/Meshes/GreasedLine/greasedLineMesh.js +3 -4
- package/Meshes/GreasedLine/greasedLineMesh.js.map +1 -1
- package/Meshes/GreasedLine/greasedLineRibbonMesh.js +10 -1
- package/Meshes/GreasedLine/greasedLineRibbonMesh.js.map +1 -1
- package/Physics/v2/IPhysicsEnginePlugin.d.ts +1 -0
- package/Physics/v2/IPhysicsEnginePlugin.js.map +1 -1
- package/Physics/v2/Plugins/havokPlugin.d.ts +7 -0
- package/Physics/v2/Plugins/havokPlugin.js +16 -0
- package/Physics/v2/Plugins/havokPlugin.js.map +1 -1
- package/Physics/v2/physicsBody.d.ts +7 -1
- package/Physics/v2/physicsBody.js +10 -1
- package/Physics/v2/physicsBody.js.map +1 -1
- package/Physics/v2/physicsEngineComponent.d.ts +5 -0
- package/Physics/v2/physicsEngineComponent.js +13 -0
- package/Physics/v2/physicsEngineComponent.js.map +1 -1
- package/Rendering/depthPeelingRenderer.js +1 -1
- package/Rendering/depthPeelingRenderer.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderer.js +1 -1
- package/Rendering/fluidRenderer/fluidRenderer.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBlockClearcoat.js +0 -4
- package/Shaders/ShadersInclude/pbrBlockClearcoat.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBlockIridescence.js +0 -3
- package/Shaders/ShadersInclude/pbrBlockIridescence.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBlockSheen.js +1 -5
- package/Shaders/ShadersInclude/pbrBlockSheen.js.map +1 -1
- package/Shaders/ShadersInclude/pbrFragmentSamplersDeclaration.js +2 -2
- package/Shaders/ShadersInclude/pbrFragmentSamplersDeclaration.js.map +1 -1
- package/Shaders/greasedLine.vertex.js +3 -3
- package/Shaders/greasedLine.vertex.js.map +1 -1
- package/Shaders/pbr.fragment.js +4 -4
- package/Shaders/pbr.fragment.js.map +1 -1
- package/XR/features/WebXRHandTracking.d.ts +5 -0
- package/XR/features/WebXRHandTracking.js +6 -0
- package/XR/features/WebXRHandTracking.js.map +1 -1
- package/XR/webXRCamera.js +4 -0
- package/XR/webXRCamera.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"texture.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/Textures/texture.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGlD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,+BAA+B,EAAE,oCAAoC,EAAE,MAAM,sBAAsB,CAAC;AAC7G,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AASzE,OAAO,EAAE,mBAAmB,EAAE,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AG,SAAS,CAAC,mBAAmB,AAAhC,CAAiC;AACnE,qCAAqC;AACd,qBAAa,GAAG,SAAS,CAAC,qBAAqB,AAAlC,CAAmC;AACvE,uCAAuC;AAChB,4BAAoB,GAAG,SAAS,CAAC,4BAA4B,AAAzC,CAA0C;AACrF,6CAA6C;AACtB,kCAA0B,GAAG,SAAS,CAAC,kCAAkC,AAA/C,CAAgD;AACjG,sDAAsD;AAC/B,2CAAmC,GAAG,SAAS,CAAC,2CAA2C,AAAxD,CAAyD;AAEnH,mDAAmD;AAC5B,yBAAiB,GAAG,SAAS,CAAC,yBAAyB,AAAtC,CAAuC;AAC/E,+CAA+C;AACxB,wBAAgB,GAAG,SAAS,CAAC,wBAAwB,AAArC,CAAsC;AAC7E,wCAAwC;AACjB,0BAAkB,GAAG,SAAS,CAAC,0BAA0B,AAAvC,CAAwC;AAEjF;;GAEG;AACW,6BAAqB,GAAG,KAAK,AAAR,CAAS;AAMrC;IADN,SAAS,EAAE;oCACwB;AAO7B;IADN,SAAS,EAAE;wCACO;AAOZ;IADN,SAAS,EAAE;wCACO;AAOZ;IADN,SAAS,EAAE;uCACQ;AAOb;IADN,SAAS,EAAE;uCACQ;AAQb;IADN,SAAS,EAAE;qCACI;AAQT;IADN,SAAS,EAAE;qCACI;AAQT;IADN,SAAS,EAAE;qCACI;AAMT;IADN,SAAS,EAAE;gDACiB;AAMtB;IADN,SAAS,EAAE;gDACiB;AAMtB;IADN,SAAS,EAAE;gDACiB;AAMtB;IADN,SAAS,EAAE;iEACoC;AA+EhD;IADC,SAAS,EAAE;yCAGX;AAm2BL,+BAA+B;AAC/B,aAAa,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC;AAC1C,mBAAmB,CAAC,cAAc,GAAG,OAAO,CAAC,KAAK,CAAC","sourcesContent":["import { serialize } from \"../../Misc/decorators\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport type { Nullable } from \"../../types\";\r\nimport { Matrix, TmpVectors, Vector3 } from \"../../Maths/math.vector\";\r\nimport { BaseTexture } from \"../../Materials/Textures/baseTexture\";\r\nimport { Constants } from \"../../Engines/constants\";\r\nimport { GetClass, RegisterClass } from \"../../Misc/typeStore\";\r\nimport { _WarnImport } from \"../../Misc/devTools\";\r\nimport type { IInspectable } from \"../../Misc/iInspectable\";\r\nimport type { ThinEngine } from \"../../Engines/thinEngine\";\r\nimport { TimingTools } from \"../../Misc/timingTools\";\r\nimport { InstantiationTools } from \"../../Misc/instantiationTools\";\r\nimport { Plane } from \"../../Maths/math.plane\";\r\nimport { EncodeArrayBufferToBase64 } from \"../../Misc/stringTools\";\r\nimport { GenerateBase64StringFromTexture, GenerateBase64StringFromTextureAsync } from \"../../Misc/copyTools\";\r\nimport { CompatibilityOptions } from \"../../Compat/compatibilityOptions\";\r\nimport type { InternalTexture } from \"./internalTexture\";\r\n\r\nimport type { CubeTexture } from \"../../Materials/Textures/cubeTexture\";\r\nimport type { MirrorTexture } from \"../../Materials/Textures/mirrorTexture\";\r\nimport type { RenderTargetTexture } from \"../../Materials/Textures/renderTargetTexture\";\r\nimport type { Scene } from \"../../scene\";\r\nimport type { VideoTexture, VideoTextureSettings } from \"./videoTexture\";\r\n\r\nimport { SerializationHelper } from \"../../Misc/decorators.serialization\";\r\n\r\n/**\r\n * Defines the available options when creating a texture\r\n */\r\nexport interface ITextureCreationOptions {\r\n /** Defines if the texture will require mip maps or not (default: false) */\r\n noMipmap?: boolean;\r\n\r\n /** Defines if the texture needs to be inverted on the y axis during loading (default: true) */\r\n invertY?: boolean;\r\n\r\n /** Defines the sampling mode we want for the texture while fetching from it (Texture.NEAREST_SAMPLINGMODE...) (default: Texture.TRILINEAR_SAMPLINGMODE) */\r\n samplingMode?: number;\r\n\r\n /** Defines a callback triggered when the texture has been loaded (default: null) */\r\n onLoad?: Nullable<() => void>;\r\n\r\n /** Defines a callback triggered when an error occurred during the loading session (default: null) */\r\n onError?: Nullable<(message?: string, exception?: any) => void>;\r\n\r\n /** Defines the buffer to load the texture from in case the texture is loaded from a buffer representation (default: null) */\r\n buffer?: Nullable<string | ArrayBuffer | ArrayBufferView | HTMLImageElement | Blob | ImageBitmap>;\r\n\r\n /** Defines if the buffer we are loading the texture from should be deleted after load (default: false) */\r\n deleteBuffer?: boolean;\r\n\r\n /** Defines the format of the texture we are trying to load (Engine.TEXTUREFORMAT_RGBA...) (default: ) */\r\n format?: number;\r\n\r\n /** Defines an optional mime type information (default: undefined) */\r\n mimeType?: string;\r\n\r\n /** Options to be passed to the loader (default: undefined) */\r\n loaderOptions?: any;\r\n\r\n /** Specific flags to use when creating the texture (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg) (default: undefined) */\r\n creationFlags?: number;\r\n\r\n /** Defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU) (default: false) */\r\n useSRGBBuffer?: boolean;\r\n\r\n /** Defines the underlying texture from an already existing one */\r\n internalTexture?: InternalTexture;\r\n\r\n /** Defines the underlying texture texture space */\r\n gammaSpace?: boolean;\r\n}\r\n\r\n/**\r\n * This represents a texture in babylon. It can be easily loaded from a network, base64 or html input.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/materials_introduction#texture\r\n */\r\nexport class Texture extends BaseTexture {\r\n /**\r\n * Gets or sets a general boolean used to indicate that textures containing direct data (buffers) must be saved as part of the serialization process\r\n */\r\n public static SerializeBuffers = true;\r\n\r\n /**\r\n * Gets or sets a general boolean used to indicate that texture buffers must be saved as part of the serialization process.\r\n * If no buffer exists, one will be created as base64 string from the internal webgl data.\r\n */\r\n public static ForceSerializeBuffers = false;\r\n\r\n /**\r\n * This observable will notify when any texture had a loading error\r\n */\r\n public static OnTextureLoadErrorObservable = new Observable<BaseTexture>();\r\n\r\n /** @internal */\r\n public static _SerializeInternalTextureUniqueId = false;\r\n\r\n /**\r\n * @internal\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n public static _CubeTextureParser = (jsonTexture: any, scene: Scene, rootUrl: string): CubeTexture => {\r\n throw _WarnImport(\"CubeTexture\");\r\n };\r\n /**\r\n * @internal\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n public static _CreateMirror = (name: string, renderTargetSize: number, scene: Scene, generateMipMaps: boolean): MirrorTexture => {\r\n throw _WarnImport(\"MirrorTexture\");\r\n };\r\n /**\r\n * @internal\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n public static _CreateRenderTargetTexture = (name: string, renderTargetSize: number, scene: Scene, generateMipMaps: boolean, creationFlags?: number): RenderTargetTexture => {\r\n throw _WarnImport(\"RenderTargetTexture\");\r\n };\r\n\r\n /**\r\n * @internal\r\n */\r\n public static _CreateVideoTexture(\r\n name: Nullable<string>,\r\n src: string | string[] | HTMLVideoElement,\r\n scene: Nullable<Scene>,\r\n generateMipMaps = false,\r\n invertY = false,\r\n samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE,\r\n settings: Partial<VideoTextureSettings> = {},\r\n onError?: Nullable<(message?: string, exception?: any) => void>,\r\n format: number = Constants.TEXTUREFORMAT_RGBA\r\n ): VideoTexture {\r\n throw _WarnImport(\"VideoTexture\");\r\n }\r\n\r\n /** nearest is mag = nearest and min = nearest and no mip */\r\n public static readonly NEAREST_SAMPLINGMODE = Constants.TEXTURE_NEAREST_SAMPLINGMODE;\r\n /** nearest is mag = nearest and min = nearest and mip = linear */\r\n public static readonly NEAREST_NEAREST_MIPLINEAR = Constants.TEXTURE_NEAREST_NEAREST_MIPLINEAR; // nearest is mag = nearest and min = nearest and mip = linear\r\n\r\n /** Bilinear is mag = linear and min = linear and no mip */\r\n public static readonly BILINEAR_SAMPLINGMODE = Constants.TEXTURE_BILINEAR_SAMPLINGMODE;\r\n /** Bilinear is mag = linear and min = linear and mip = nearest */\r\n public static readonly LINEAR_LINEAR_MIPNEAREST = Constants.TEXTURE_LINEAR_LINEAR_MIPNEAREST; // Bilinear is mag = linear and min = linear and mip = nearest\r\n\r\n /** Trilinear is mag = linear and min = linear and mip = linear */\r\n public static readonly TRILINEAR_SAMPLINGMODE = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE;\r\n /** Trilinear is mag = linear and min = linear and mip = linear */\r\n public static readonly LINEAR_LINEAR_MIPLINEAR = Constants.TEXTURE_LINEAR_LINEAR_MIPLINEAR; // Trilinear is mag = linear and min = linear and mip = linear\r\n\r\n /** mag = nearest and min = nearest and mip = nearest */\r\n public static readonly NEAREST_NEAREST_MIPNEAREST = Constants.TEXTURE_NEAREST_NEAREST_MIPNEAREST;\r\n /** mag = nearest and min = linear and mip = nearest */\r\n public static readonly NEAREST_LINEAR_MIPNEAREST = Constants.TEXTURE_NEAREST_LINEAR_MIPNEAREST;\r\n /** mag = nearest and min = linear and mip = linear */\r\n public static readonly NEAREST_LINEAR_MIPLINEAR = Constants.TEXTURE_NEAREST_LINEAR_MIPLINEAR;\r\n /** mag = nearest and min = linear and mip = none */\r\n public static readonly NEAREST_LINEAR = Constants.TEXTURE_NEAREST_LINEAR;\r\n /** mag = nearest and min = nearest and mip = none */\r\n public static readonly NEAREST_NEAREST = Constants.TEXTURE_NEAREST_NEAREST;\r\n /** mag = linear and min = nearest and mip = nearest */\r\n public static readonly LINEAR_NEAREST_MIPNEAREST = Constants.TEXTURE_LINEAR_NEAREST_MIPNEAREST;\r\n /** mag = linear and min = nearest and mip = linear */\r\n public static readonly LINEAR_NEAREST_MIPLINEAR = Constants.TEXTURE_LINEAR_NEAREST_MIPLINEAR;\r\n /** mag = linear and min = linear and mip = none */\r\n public static readonly LINEAR_LINEAR = Constants.TEXTURE_LINEAR_LINEAR;\r\n /** mag = linear and min = nearest and mip = none */\r\n public static readonly LINEAR_NEAREST = Constants.TEXTURE_LINEAR_NEAREST;\r\n\r\n /** Explicit coordinates mode */\r\n public static readonly EXPLICIT_MODE = Constants.TEXTURE_EXPLICIT_MODE;\r\n /** Spherical coordinates mode */\r\n public static readonly SPHERICAL_MODE = Constants.TEXTURE_SPHERICAL_MODE;\r\n /** Planar coordinates mode */\r\n public static readonly PLANAR_MODE = Constants.TEXTURE_PLANAR_MODE;\r\n /** Cubic coordinates mode */\r\n public static readonly CUBIC_MODE = Constants.TEXTURE_CUBIC_MODE;\r\n /** Projection coordinates mode */\r\n public static readonly PROJECTION_MODE = Constants.TEXTURE_PROJECTION_MODE;\r\n /** Inverse Cubic coordinates mode */\r\n public static readonly SKYBOX_MODE = Constants.TEXTURE_SKYBOX_MODE;\r\n /** Inverse Cubic coordinates mode */\r\n public static readonly INVCUBIC_MODE = Constants.TEXTURE_INVCUBIC_MODE;\r\n /** Equirectangular coordinates mode */\r\n public static readonly EQUIRECTANGULAR_MODE = Constants.TEXTURE_EQUIRECTANGULAR_MODE;\r\n /** Equirectangular Fixed coordinates mode */\r\n public static readonly FIXED_EQUIRECTANGULAR_MODE = Constants.TEXTURE_FIXED_EQUIRECTANGULAR_MODE;\r\n /** Equirectangular Fixed Mirrored coordinates mode */\r\n public static readonly FIXED_EQUIRECTANGULAR_MIRRORED_MODE = Constants.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE;\r\n\r\n /** Texture is not repeating outside of 0..1 UVs */\r\n public static readonly CLAMP_ADDRESSMODE = Constants.TEXTURE_CLAMP_ADDRESSMODE;\r\n /** Texture is repeating outside of 0..1 UVs */\r\n public static readonly WRAP_ADDRESSMODE = Constants.TEXTURE_WRAP_ADDRESSMODE;\r\n /** Texture is repeating and mirrored */\r\n public static readonly MIRROR_ADDRESSMODE = Constants.TEXTURE_MIRROR_ADDRESSMODE;\r\n\r\n /**\r\n * Gets or sets a boolean which defines if the texture url must be build from the serialized URL instead of just using the name and loading them side by side with the scene file\r\n */\r\n public static UseSerializedUrlIfAny = false;\r\n\r\n /**\r\n * Define the url of the texture.\r\n */\r\n @serialize()\r\n public url: Nullable<string> = null;\r\n\r\n /**\r\n * Define an offset on the texture to offset the u coordinates of the UVs\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/moreMaterials#offsetting\r\n */\r\n @serialize()\r\n public uOffset = 0;\r\n\r\n /**\r\n * Define an offset on the texture to offset the v coordinates of the UVs\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/moreMaterials#offsetting\r\n */\r\n @serialize()\r\n public vOffset = 0;\r\n\r\n /**\r\n * Define an offset on the texture to scale the u coordinates of the UVs\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/moreMaterials#tiling\r\n */\r\n @serialize()\r\n public uScale = 1.0;\r\n\r\n /**\r\n * Define an offset on the texture to scale the v coordinates of the UVs\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/moreMaterials#tiling\r\n */\r\n @serialize()\r\n public vScale = 1.0;\r\n\r\n /**\r\n * Define an offset on the texture to rotate around the u coordinates of the UVs\r\n * The angle is defined in radians.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/moreMaterials\r\n */\r\n @serialize()\r\n public uAng = 0;\r\n\r\n /**\r\n * Define an offset on the texture to rotate around the v coordinates of the UVs\r\n * The angle is defined in radians.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/moreMaterials\r\n */\r\n @serialize()\r\n public vAng = 0;\r\n\r\n /**\r\n * Define an offset on the texture to rotate around the w coordinates of the UVs (in case of 3d texture)\r\n * The angle is defined in radians.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/moreMaterials\r\n */\r\n @serialize()\r\n public wAng = 0;\r\n\r\n /**\r\n * Defines the center of rotation (U)\r\n */\r\n @serialize()\r\n public uRotationCenter = 0.5;\r\n\r\n /**\r\n * Defines the center of rotation (V)\r\n */\r\n @serialize()\r\n public vRotationCenter = 0.5;\r\n\r\n /**\r\n * Defines the center of rotation (W)\r\n */\r\n @serialize()\r\n public wRotationCenter = 0.5;\r\n\r\n /**\r\n * Sets this property to true to avoid deformations when rotating the texture with non-uniform scaling\r\n */\r\n @serialize()\r\n public homogeneousRotationInUVTransform = false;\r\n\r\n /**\r\n * Are mip maps generated for this texture or not.\r\n */\r\n get noMipmap(): boolean {\r\n return this._noMipmap;\r\n }\r\n\r\n /**\r\n * List of inspectable custom properties (used by the Inspector)\r\n * @see https://doc.babylonjs.com/toolsAndResources/inspector#extensibility\r\n */\r\n public inspectableCustomProperties: Nullable<IInspectable[]> = null;\r\n\r\n /** @internal */\r\n public _noMipmap: boolean = false;\r\n /** @internal */\r\n public _invertY: boolean = false;\r\n private _rowGenerationMatrix: Nullable<Matrix> = null;\r\n private _cachedTextureMatrix: Nullable<Matrix> = null;\r\n private _projectionModeMatrix: Nullable<Matrix> = null;\r\n private _t0: Nullable<Vector3> = null;\r\n private _t1: Nullable<Vector3> = null;\r\n private _t2: Nullable<Vector3> = null;\r\n\r\n private _cachedUOffset: number = -1;\r\n private _cachedVOffset: number = -1;\r\n private _cachedUScale: number = 0;\r\n private _cachedVScale: number = 0;\r\n private _cachedUAng: number = -1;\r\n private _cachedVAng: number = -1;\r\n private _cachedWAng: number = -1;\r\n private _cachedReflectionProjectionMatrixId: number = -1;\r\n private _cachedURotationCenter: number = -1;\r\n private _cachedVRotationCenter: number = -1;\r\n private _cachedWRotationCenter: number = -1;\r\n private _cachedHomogeneousRotationInUVTransform: boolean = false;\r\n private _cachedIdentity3x2: boolean = true;\r\n\r\n private _cachedReflectionTextureMatrix: Nullable<Matrix> = null;\r\n private _cachedReflectionUOffset = -1;\r\n private _cachedReflectionVOffset = -1;\r\n private _cachedReflectionUScale = 0;\r\n private _cachedReflectionVScale = 0;\r\n private _cachedReflectionCoordinatesMode = -1;\r\n\r\n /** @internal */\r\n public _buffer: Nullable<string | ArrayBuffer | ArrayBufferView | HTMLImageElement | Blob | ImageBitmap> = null;\r\n private _deleteBuffer: boolean = false;\r\n protected _format: Nullable<number> = null;\r\n private _delayedOnLoad: Nullable<() => void> = null;\r\n private _delayedOnError: Nullable<() => void> = null;\r\n private _mimeType?: string;\r\n private _loaderOptions?: any;\r\n private _creationFlags?: number;\r\n /** @internal */\r\n public _useSRGBBuffer?: boolean;\r\n private _forcedExtension?: string;\r\n\r\n /** Returns the texture mime type if it was defined by a loader (undefined else) */\r\n public get mimeType() {\r\n return this._mimeType;\r\n }\r\n\r\n /**\r\n * Observable triggered once the texture has been loaded.\r\n */\r\n public onLoadObservable: Observable<Texture> = new Observable<Texture>();\r\n\r\n protected _isBlocking: boolean = true;\r\n /**\r\n * Is the texture preventing material to render while loading.\r\n * If false, a default texture will be used instead of the loading one during the preparation step.\r\n */\r\n public set isBlocking(value: boolean) {\r\n this._isBlocking = value;\r\n }\r\n @serialize()\r\n public get isBlocking(): boolean {\r\n return this._isBlocking;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if the texture needs to be inverted on the y axis during loading\r\n */\r\n public get invertY(): boolean {\r\n return this._invertY;\r\n }\r\n\r\n /**\r\n * Instantiates a new texture.\r\n * This represents a texture in babylon. It can be easily loaded from a network, base64 or html input.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/materials_introduction#texture\r\n * @param url defines the url of the picture to load as a texture\r\n * @param sceneOrEngine defines the scene or engine the texture will belong to\r\n * @param noMipmapOrOptions defines if the texture will require mip maps or not or set of all options to create the texture\r\n * @param invertY defines if the texture needs to be inverted on the y axis during loading\r\n * @param samplingMode defines the sampling mode we want for the texture while fetching from it (Texture.NEAREST_SAMPLINGMODE...)\r\n * @param onLoad defines a callback triggered when the texture has been loaded\r\n * @param onError defines a callback triggered when an error occurred during the loading session\r\n * @param buffer defines the buffer to load the texture from in case the texture is loaded from a buffer representation\r\n * @param deleteBuffer defines if the buffer we are loading the texture from should be deleted after load\r\n * @param format defines the format of the texture we are trying to load (Engine.TEXTUREFORMAT_RGBA...)\r\n * @param mimeType defines an optional mime type information\r\n * @param loaderOptions options to be passed to the loader\r\n * @param creationFlags specific flags to use when creating the texture (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg)\r\n * @param forcedExtension defines the extension to use to pick the right loader\r\n */\r\n constructor(\r\n url: Nullable<string>,\r\n sceneOrEngine?: Nullable<Scene | ThinEngine>,\r\n noMipmapOrOptions?: boolean | ITextureCreationOptions,\r\n invertY?: boolean,\r\n samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE,\r\n onLoad: Nullable<() => void> = null,\r\n onError: Nullable<(message?: string, exception?: any) => void> = null,\r\n buffer: Nullable<string | ArrayBuffer | ArrayBufferView | HTMLImageElement | Blob | ImageBitmap> = null,\r\n deleteBuffer: boolean = false,\r\n format?: number,\r\n mimeType?: string,\r\n loaderOptions?: any,\r\n creationFlags?: number,\r\n forcedExtension?: string\r\n ) {\r\n super(sceneOrEngine);\r\n\r\n this.name = url || \"\";\r\n this.url = url;\r\n\r\n let noMipmap: boolean;\r\n let useSRGBBuffer: boolean = false;\r\n let internalTexture: Nullable<InternalTexture> = null;\r\n let gammaSpace = true;\r\n\r\n if (typeof noMipmapOrOptions === \"object\" && noMipmapOrOptions !== null) {\r\n noMipmap = noMipmapOrOptions.noMipmap ?? false;\r\n invertY = noMipmapOrOptions.invertY ?? (CompatibilityOptions.UseOpenGLOrientationForUV ? false : true);\r\n samplingMode = noMipmapOrOptions.samplingMode ?? Texture.TRILINEAR_SAMPLINGMODE;\r\n onLoad = noMipmapOrOptions.onLoad ?? null;\r\n onError = noMipmapOrOptions.onError ?? null;\r\n buffer = noMipmapOrOptions.buffer ?? null;\r\n deleteBuffer = noMipmapOrOptions.deleteBuffer ?? false;\r\n format = noMipmapOrOptions.format;\r\n mimeType = noMipmapOrOptions.mimeType;\r\n loaderOptions = noMipmapOrOptions.loaderOptions;\r\n creationFlags = noMipmapOrOptions.creationFlags;\r\n useSRGBBuffer = noMipmapOrOptions.useSRGBBuffer ?? false;\r\n internalTexture = noMipmapOrOptions.internalTexture ?? null;\r\n gammaSpace = noMipmapOrOptions.gammaSpace ?? gammaSpace;\r\n } else {\r\n noMipmap = !!noMipmapOrOptions;\r\n }\r\n\r\n this._gammaSpace = gammaSpace;\r\n this._noMipmap = noMipmap;\r\n this._invertY = invertY === undefined ? (CompatibilityOptions.UseOpenGLOrientationForUV ? false : true) : invertY;\r\n this._initialSamplingMode = samplingMode;\r\n this._buffer = buffer;\r\n this._deleteBuffer = deleteBuffer;\r\n this._mimeType = mimeType;\r\n this._loaderOptions = loaderOptions;\r\n this._creationFlags = creationFlags;\r\n this._useSRGBBuffer = useSRGBBuffer;\r\n this._forcedExtension = forcedExtension;\r\n if (format) {\r\n this._format = format;\r\n }\r\n\r\n const scene = this.getScene();\r\n const engine = this._getEngine();\r\n if (!engine) {\r\n return;\r\n }\r\n\r\n engine.onBeforeTextureInitObservable.notifyObservers(this);\r\n\r\n const load = () => {\r\n if (this._texture) {\r\n if (this._texture._invertVScale) {\r\n this.vScale *= -1;\r\n this.vOffset += 1;\r\n }\r\n\r\n // Update texture to match internal texture's wrapping\r\n if (this._texture._cachedWrapU !== null) {\r\n this.wrapU = this._texture._cachedWrapU;\r\n this._texture._cachedWrapU = null;\r\n }\r\n if (this._texture._cachedWrapV !== null) {\r\n this.wrapV = this._texture._cachedWrapV;\r\n this._texture._cachedWrapV = null;\r\n }\r\n if (this._texture._cachedWrapR !== null) {\r\n this.wrapR = this._texture._cachedWrapR;\r\n this._texture._cachedWrapR = null;\r\n }\r\n }\r\n\r\n if (this.onLoadObservable.hasObservers()) {\r\n this.onLoadObservable.notifyObservers(this);\r\n }\r\n if (onLoad) {\r\n onLoad();\r\n }\r\n\r\n if (!this.isBlocking && scene) {\r\n scene.resetCachedMaterial();\r\n }\r\n };\r\n\r\n const errorHandler = (message?: string, exception?: any) => {\r\n this._loadingError = true;\r\n this._errorObject = { message, exception };\r\n if (onError) {\r\n onError(message, exception);\r\n }\r\n Texture.OnTextureLoadErrorObservable.notifyObservers(this);\r\n };\r\n\r\n if (!this.url && !internalTexture) {\r\n this._delayedOnLoad = load;\r\n this._delayedOnError = errorHandler;\r\n return;\r\n }\r\n\r\n this._texture = internalTexture ?? this._getFromCache(this.url, noMipmap, samplingMode, this._invertY, useSRGBBuffer, this.isCube);\r\n\r\n if (!this._texture) {\r\n if (!scene || !scene.useDelayedTextureLoading) {\r\n try {\r\n this._texture = engine.createTexture(\r\n this.url,\r\n noMipmap,\r\n this._invertY,\r\n scene,\r\n samplingMode,\r\n load,\r\n errorHandler,\r\n this._buffer,\r\n undefined,\r\n this._format,\r\n this._forcedExtension,\r\n mimeType,\r\n loaderOptions,\r\n creationFlags,\r\n useSRGBBuffer\r\n );\r\n } catch (e) {\r\n errorHandler(\"error loading\", e);\r\n throw e;\r\n }\r\n if (deleteBuffer) {\r\n this._buffer = null;\r\n }\r\n } else {\r\n this.delayLoadState = Constants.DELAYLOADSTATE_NOTLOADED;\r\n\r\n this._delayedOnLoad = load;\r\n this._delayedOnError = errorHandler;\r\n }\r\n } else {\r\n if (this._texture.isReady) {\r\n TimingTools.SetImmediate(() => load());\r\n } else {\r\n const loadObserver = this._texture.onLoadedObservable.add(load);\r\n this._texture.onErrorObservable.add((e) => {\r\n errorHandler(e.message, e.exception);\r\n this._texture?.onLoadedObservable.remove(loadObserver);\r\n });\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Update the url (and optional buffer) of this texture if url was null during construction.\r\n * @param url the url of the texture\r\n * @param buffer the buffer of the texture (defaults to null)\r\n * @param onLoad callback called when the texture is loaded (defaults to null)\r\n * @param forcedExtension defines the extension to use to pick the right loader\r\n */\r\n public updateURL(\r\n url: string,\r\n buffer: Nullable<string | ArrayBuffer | ArrayBufferView | HTMLImageElement | Blob | ImageBitmap> = null,\r\n onLoad?: () => void,\r\n forcedExtension?: string\r\n ): void {\r\n if (this.url) {\r\n this.releaseInternalTexture();\r\n this.getScene()!.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag, (mat) => {\r\n return mat.hasTexture(this);\r\n });\r\n }\r\n\r\n if (!this.name || this.name.startsWith(\"data:\")) {\r\n this.name = url;\r\n }\r\n this.url = url;\r\n this._buffer = buffer;\r\n this._forcedExtension = forcedExtension;\r\n this.delayLoadState = Constants.DELAYLOADSTATE_NOTLOADED;\r\n\r\n if (onLoad) {\r\n this._delayedOnLoad = onLoad;\r\n }\r\n this.delayLoad();\r\n }\r\n\r\n /**\r\n * Finish the loading sequence of a texture flagged as delayed load.\r\n * @internal\r\n */\r\n public delayLoad(): void {\r\n if (this.delayLoadState !== Constants.DELAYLOADSTATE_NOTLOADED) {\r\n return;\r\n }\r\n\r\n const scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n\r\n this.delayLoadState = Constants.DELAYLOADSTATE_LOADED;\r\n this._texture = this._getFromCache(this.url, this._noMipmap, this.samplingMode, this._invertY, this._useSRGBBuffer, this.isCube);\r\n\r\n if (!this._texture) {\r\n this._texture = scene\r\n .getEngine()\r\n .createTexture(\r\n this.url,\r\n this._noMipmap,\r\n this._invertY,\r\n scene,\r\n this.samplingMode,\r\n this._delayedOnLoad,\r\n this._delayedOnError,\r\n this._buffer,\r\n null,\r\n this._format,\r\n this._forcedExtension,\r\n this._mimeType,\r\n this._loaderOptions,\r\n this._creationFlags,\r\n this._useSRGBBuffer\r\n );\r\n if (this._deleteBuffer) {\r\n this._buffer = null;\r\n }\r\n } else {\r\n if (this._delayedOnLoad) {\r\n if (this._texture.isReady) {\r\n TimingTools.SetImmediate(this._delayedOnLoad);\r\n } else {\r\n this._texture.onLoadedObservable.add(this._delayedOnLoad);\r\n }\r\n }\r\n }\r\n\r\n this._delayedOnLoad = null;\r\n this._delayedOnError = null;\r\n }\r\n\r\n private _prepareRowForTextureGeneration(x: number, y: number, z: number, t: Vector3): void {\r\n x *= this._cachedUScale;\r\n y *= this._cachedVScale;\r\n\r\n x -= this.uRotationCenter * this._cachedUScale;\r\n y -= this.vRotationCenter * this._cachedVScale;\r\n z -= this.wRotationCenter;\r\n\r\n Vector3.TransformCoordinatesFromFloatsToRef(x, y, z, this._rowGenerationMatrix!, t);\r\n\r\n t.x += this.uRotationCenter * this._cachedUScale + this._cachedUOffset;\r\n t.y += this.vRotationCenter * this._cachedVScale + this._cachedVOffset;\r\n t.z += this.wRotationCenter;\r\n }\r\n\r\n /**\r\n * Checks if the texture has the same transform matrix than another texture\r\n * @param texture texture to check against\r\n * @returns true if the transforms are the same, else false\r\n */\r\n public checkTransformsAreIdentical(texture: Nullable<Texture>): boolean {\r\n return (\r\n texture !== null &&\r\n this.uOffset === texture.uOffset &&\r\n this.vOffset === texture.vOffset &&\r\n this.uScale === texture.uScale &&\r\n this.vScale === texture.vScale &&\r\n this.uAng === texture.uAng &&\r\n this.vAng === texture.vAng &&\r\n this.wAng === texture.wAng\r\n );\r\n }\r\n\r\n /**\r\n * Get the current texture matrix which includes the requested offsetting, tiling and rotation components.\r\n * @param uBase The horizontal base offset multiplier (1 by default)\r\n * @returns the transform matrix of the texture.\r\n */\r\n public getTextureMatrix(uBase = 1): Matrix {\r\n if (\r\n this.uOffset === this._cachedUOffset &&\r\n this.vOffset === this._cachedVOffset &&\r\n this.uScale * uBase === this._cachedUScale &&\r\n this.vScale === this._cachedVScale &&\r\n this.uAng === this._cachedUAng &&\r\n this.vAng === this._cachedVAng &&\r\n this.wAng === this._cachedWAng &&\r\n this.uRotationCenter === this._cachedURotationCenter &&\r\n this.vRotationCenter === this._cachedVRotationCenter &&\r\n this.wRotationCenter === this._cachedWRotationCenter &&\r\n this.homogeneousRotationInUVTransform === this._cachedHomogeneousRotationInUVTransform\r\n ) {\r\n return this._cachedTextureMatrix!;\r\n }\r\n\r\n this._cachedUOffset = this.uOffset;\r\n this._cachedVOffset = this.vOffset;\r\n this._cachedUScale = this.uScale * uBase;\r\n this._cachedVScale = this.vScale;\r\n this._cachedUAng = this.uAng;\r\n this._cachedVAng = this.vAng;\r\n this._cachedWAng = this.wAng;\r\n this._cachedURotationCenter = this.uRotationCenter;\r\n this._cachedVRotationCenter = this.vRotationCenter;\r\n this._cachedWRotationCenter = this.wRotationCenter;\r\n this._cachedHomogeneousRotationInUVTransform = this.homogeneousRotationInUVTransform;\r\n\r\n if (!this._cachedTextureMatrix || !this._rowGenerationMatrix) {\r\n this._cachedTextureMatrix = Matrix.Zero();\r\n this._rowGenerationMatrix = new Matrix();\r\n this._t0 = Vector3.Zero();\r\n this._t1 = Vector3.Zero();\r\n this._t2 = Vector3.Zero();\r\n }\r\n\r\n Matrix.RotationYawPitchRollToRef(this.vAng, this.uAng, this.wAng, this._rowGenerationMatrix!);\r\n\r\n if (this.homogeneousRotationInUVTransform) {\r\n Matrix.TranslationToRef(-this._cachedURotationCenter, -this._cachedVRotationCenter, -this._cachedWRotationCenter, TmpVectors.Matrix[0]);\r\n Matrix.TranslationToRef(this._cachedURotationCenter, this._cachedVRotationCenter, this._cachedWRotationCenter, TmpVectors.Matrix[1]);\r\n Matrix.ScalingToRef(this._cachedUScale, this._cachedVScale, 0, TmpVectors.Matrix[2]);\r\n Matrix.TranslationToRef(this._cachedUOffset, this._cachedVOffset, 0, TmpVectors.Matrix[3]);\r\n\r\n TmpVectors.Matrix[0].multiplyToRef(this._rowGenerationMatrix!, this._cachedTextureMatrix);\r\n this._cachedTextureMatrix.multiplyToRef(TmpVectors.Matrix[1], this._cachedTextureMatrix);\r\n this._cachedTextureMatrix.multiplyToRef(TmpVectors.Matrix[2], this._cachedTextureMatrix);\r\n this._cachedTextureMatrix.multiplyToRef(TmpVectors.Matrix[3], this._cachedTextureMatrix);\r\n\r\n // copy the translation row to the 3rd row of the matrix so that we don't need to update the shaders (which expects the translation to be on the 3rd row)\r\n this._cachedTextureMatrix.setRowFromFloats(2, this._cachedTextureMatrix.m[12], this._cachedTextureMatrix.m[13], this._cachedTextureMatrix.m[14], 1);\r\n } else {\r\n this._prepareRowForTextureGeneration(0, 0, 0, this._t0!);\r\n this._prepareRowForTextureGeneration(1.0, 0, 0, this._t1!);\r\n this._prepareRowForTextureGeneration(0, 1.0, 0, this._t2!);\r\n\r\n this._t1!.subtractInPlace(this._t0!);\r\n this._t2!.subtractInPlace(this._t0!);\r\n\r\n Matrix.FromValuesToRef(\r\n this._t1!.x,\r\n this._t1!.y,\r\n this._t1!.z,\r\n 0.0,\r\n this._t2!.x,\r\n this._t2!.y,\r\n this._t2!.z,\r\n 0.0,\r\n this._t0!.x,\r\n this._t0!.y,\r\n this._t0!.z,\r\n 0.0,\r\n 0.0,\r\n 0.0,\r\n 0.0,\r\n 1.0,\r\n this._cachedTextureMatrix\r\n );\r\n }\r\n\r\n const scene = this.getScene();\r\n\r\n if (!scene) {\r\n return this._cachedTextureMatrix;\r\n }\r\n\r\n const previousIdentity3x2 = this._cachedIdentity3x2;\r\n this._cachedIdentity3x2 = this._cachedTextureMatrix.isIdentityAs3x2();\r\n\r\n if (this.optimizeUVAllocation && previousIdentity3x2 !== this._cachedIdentity3x2) {\r\n // We flag the materials that are using this texture as \"texture dirty\" because depending on the fact that the matrix is the identity or not, some defines\r\n // will get different values (see PrepareDefinesForMergedUV), meaning we should regenerate the effect accordingly\r\n scene.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag, (mat) => {\r\n return mat.hasTexture(this);\r\n });\r\n }\r\n\r\n return this._cachedTextureMatrix;\r\n }\r\n\r\n /**\r\n * Get the current matrix used to apply reflection. This is useful to rotate an environment texture for instance.\r\n * @returns The reflection texture transform\r\n */\r\n public getReflectionTextureMatrix(): Matrix {\r\n const scene = this.getScene();\r\n\r\n if (!scene) {\r\n return this._cachedReflectionTextureMatrix!;\r\n }\r\n\r\n if (\r\n this.uOffset === this._cachedReflectionUOffset &&\r\n this.vOffset === this._cachedReflectionVOffset &&\r\n this.uScale === this._cachedReflectionUScale &&\r\n this.vScale === this._cachedReflectionVScale &&\r\n this.coordinatesMode === this._cachedReflectionCoordinatesMode\r\n ) {\r\n if (this.coordinatesMode === Texture.PROJECTION_MODE) {\r\n if (this._cachedReflectionProjectionMatrixId === scene.getProjectionMatrix().updateFlag) {\r\n return this._cachedReflectionTextureMatrix!;\r\n }\r\n } else {\r\n return this._cachedReflectionTextureMatrix!;\r\n }\r\n }\r\n\r\n if (!this._cachedReflectionTextureMatrix) {\r\n this._cachedReflectionTextureMatrix = Matrix.Zero();\r\n }\r\n\r\n if (!this._projectionModeMatrix) {\r\n this._projectionModeMatrix = Matrix.Zero();\r\n }\r\n\r\n const flagMaterialsAsTextureDirty = this._cachedReflectionCoordinatesMode !== this.coordinatesMode;\r\n\r\n this._cachedReflectionUOffset = this.uOffset;\r\n this._cachedReflectionVOffset = this.vOffset;\r\n this._cachedReflectionUScale = this.uScale;\r\n this._cachedReflectionVScale = this.vScale;\r\n this._cachedReflectionCoordinatesMode = this.coordinatesMode;\r\n\r\n switch (this.coordinatesMode) {\r\n case Texture.PLANAR_MODE: {\r\n Matrix.IdentityToRef(this._cachedReflectionTextureMatrix);\r\n (<any>this._cachedReflectionTextureMatrix)[0] = this.uScale;\r\n (<any>this._cachedReflectionTextureMatrix)[5] = this.vScale;\r\n (<any>this._cachedReflectionTextureMatrix)[12] = this.uOffset;\r\n (<any>this._cachedReflectionTextureMatrix)[13] = this.vOffset;\r\n break;\r\n }\r\n case Texture.PROJECTION_MODE: {\r\n Matrix.FromValuesToRef(0.5, 0.0, 0.0, 0.0, 0.0, -0.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.5, 0.5, 1.0, 1.0, this._projectionModeMatrix);\r\n\r\n const projectionMatrix = scene.getProjectionMatrix();\r\n this._cachedReflectionProjectionMatrixId = projectionMatrix.updateFlag;\r\n projectionMatrix.multiplyToRef(this._projectionModeMatrix, this._cachedReflectionTextureMatrix);\r\n break;\r\n }\r\n default:\r\n Matrix.IdentityToRef(this._cachedReflectionTextureMatrix);\r\n break;\r\n }\r\n\r\n if (flagMaterialsAsTextureDirty) {\r\n // We flag the materials that are using this texture as \"texture dirty\" if the coordinatesMode has changed.\r\n // Indeed, this property is used to set the value of some defines used to generate the effect (in material.isReadyForSubMesh), so we must make sure this code will be re-executed and the effect recreated if necessary\r\n scene.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag, (mat) => {\r\n return mat.hasTexture(this);\r\n });\r\n }\r\n\r\n return this._cachedReflectionTextureMatrix;\r\n }\r\n\r\n /**\r\n * Clones the texture.\r\n * @returns the cloned texture\r\n */\r\n public clone(): Texture {\r\n const options: ITextureCreationOptions = {\r\n noMipmap: this._noMipmap,\r\n invertY: this._invertY,\r\n samplingMode: this.samplingMode,\r\n onLoad: undefined,\r\n onError: undefined,\r\n buffer: this._texture ? this._texture._buffer : undefined,\r\n deleteBuffer: this._deleteBuffer,\r\n format: this.textureFormat,\r\n mimeType: this.mimeType,\r\n loaderOptions: this._loaderOptions,\r\n creationFlags: this._creationFlags,\r\n useSRGBBuffer: this._useSRGBBuffer,\r\n };\r\n\r\n return SerializationHelper.Clone(() => {\r\n return new Texture(this._texture ? this._texture.url : null, this.getScene(), options);\r\n }, this);\r\n }\r\n\r\n /**\r\n * Serialize the texture to a JSON representation we can easily use in the respective Parse function.\r\n * @returns The JSON representation of the texture\r\n */\r\n public serialize(): any {\r\n const savedName = this.name;\r\n\r\n if (!Texture.SerializeBuffers) {\r\n if (this.name.startsWith(\"data:\")) {\r\n this.name = \"\";\r\n }\r\n }\r\n\r\n if (this.name.startsWith(\"data:\") && this.url === this.name) {\r\n this.url = \"\";\r\n }\r\n\r\n const serializationObject = super.serialize(Texture._SerializeInternalTextureUniqueId);\r\n\r\n if (!serializationObject) {\r\n return null;\r\n }\r\n\r\n if (Texture.SerializeBuffers || Texture.ForceSerializeBuffers) {\r\n if (typeof this._buffer === \"string\" && (this._buffer as string).substr(0, 5) === \"data:\") {\r\n serializationObject.base64String = this._buffer;\r\n serializationObject.name = serializationObject.name.replace(\"data:\", \"\");\r\n } else if (this.url && this.url.startsWith(\"data:\") && this._buffer instanceof Uint8Array) {\r\n serializationObject.base64String = \"data:image/png;base64,\" + EncodeArrayBufferToBase64(this._buffer);\r\n } else if (Texture.ForceSerializeBuffers || (this.url && this.url.startsWith(\"blob:\")) || this._forceSerialize) {\r\n serializationObject.base64String =\r\n !this._engine || this._engine._features.supportSyncTextureRead ? GenerateBase64StringFromTexture(this) : GenerateBase64StringFromTextureAsync(this);\r\n }\r\n }\r\n\r\n serializationObject.invertY = this._invertY;\r\n serializationObject.samplingMode = this.samplingMode;\r\n serializationObject._creationFlags = this._creationFlags;\r\n serializationObject._useSRGBBuffer = this._useSRGBBuffer;\r\n if (Texture._SerializeInternalTextureUniqueId) {\r\n serializationObject.internalTextureUniqueId = this._texture?.uniqueId ?? undefined;\r\n }\r\n serializationObject.noMipmap = this._noMipmap;\r\n\r\n this.name = savedName;\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Get the current class name of the texture useful for serialization or dynamic coding.\r\n * @returns \"Texture\"\r\n */\r\n public getClassName(): string {\r\n return \"Texture\";\r\n }\r\n\r\n /**\r\n * Dispose the texture and release its associated resources.\r\n */\r\n public dispose(): void {\r\n super.dispose();\r\n\r\n this.onLoadObservable.clear();\r\n\r\n this._delayedOnLoad = null;\r\n this._delayedOnError = null;\r\n this._buffer = null;\r\n }\r\n\r\n /**\r\n * Parse the JSON representation of a texture in order to recreate the texture in the given scene.\r\n * @param parsedTexture Define the JSON representation of the texture\r\n * @param scene Define the scene the parsed texture should be instantiated in\r\n * @param rootUrl Define the root url of the parsing sequence in the case of relative dependencies\r\n * @returns The parsed texture if successful\r\n */\r\n public static Parse(parsedTexture: any, scene: Scene, rootUrl: string): Nullable<BaseTexture> {\r\n if (parsedTexture.customType) {\r\n const customTexture = InstantiationTools.Instantiate(parsedTexture.customType);\r\n // Update Sampling Mode\r\n const parsedCustomTexture: any = customTexture.Parse(parsedTexture, scene, rootUrl);\r\n if (parsedTexture.samplingMode && parsedCustomTexture.updateSamplingMode && parsedCustomTexture._samplingMode) {\r\n if (parsedCustomTexture._samplingMode !== parsedTexture.samplingMode) {\r\n parsedCustomTexture.updateSamplingMode(parsedTexture.samplingMode);\r\n }\r\n }\r\n return parsedCustomTexture;\r\n }\r\n\r\n if (parsedTexture.isCube && !parsedTexture.isRenderTarget) {\r\n return Texture._CubeTextureParser(parsedTexture, scene, rootUrl);\r\n }\r\n\r\n const hasInternalTextureUniqueId = parsedTexture.internalTextureUniqueId !== undefined;\r\n\r\n if (!parsedTexture.name && !parsedTexture.isRenderTarget && !hasInternalTextureUniqueId) {\r\n return null;\r\n }\r\n\r\n let internalTexture: InternalTexture | undefined;\r\n\r\n if (hasInternalTextureUniqueId) {\r\n const cache = scene.getEngine().getLoadedTexturesCache();\r\n for (const texture of cache) {\r\n if (texture.uniqueId === parsedTexture.internalTextureUniqueId) {\r\n internalTexture = texture;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n const onLoaded = (texture: Texture | null) => {\r\n // Clear cache\r\n if (texture && texture._texture) {\r\n texture._texture._cachedWrapU = null;\r\n texture._texture._cachedWrapV = null;\r\n texture._texture._cachedWrapR = null;\r\n }\r\n\r\n // Update Sampling Mode\r\n if (parsedTexture.samplingMode) {\r\n const sampling: number = parsedTexture.samplingMode;\r\n if (texture && texture.samplingMode !== sampling) {\r\n texture.updateSamplingMode(sampling);\r\n }\r\n }\r\n // Animations\r\n if (texture && parsedTexture.animations) {\r\n for (let animationIndex = 0; animationIndex < parsedTexture.animations.length; animationIndex++) {\r\n const parsedAnimation = parsedTexture.animations[animationIndex];\r\n const internalClass = GetClass(\"BABYLON.Animation\");\r\n if (internalClass) {\r\n texture.animations.push(internalClass.Parse(parsedAnimation));\r\n }\r\n }\r\n }\r\n\r\n if (hasInternalTextureUniqueId && !internalTexture) {\r\n texture?._texture?._setUniqueId(parsedTexture.internalTextureUniqueId);\r\n }\r\n };\r\n\r\n const texture = SerializationHelper.Parse(\r\n () => {\r\n let generateMipMaps: boolean = true;\r\n if (parsedTexture.noMipmap) {\r\n generateMipMaps = false;\r\n }\r\n if (parsedTexture.mirrorPlane) {\r\n const mirrorTexture = Texture._CreateMirror(parsedTexture.name, parsedTexture.renderTargetSize, scene, generateMipMaps);\r\n mirrorTexture._waitingRenderList = parsedTexture.renderList;\r\n mirrorTexture.mirrorPlane = Plane.FromArray(parsedTexture.mirrorPlane);\r\n onLoaded(mirrorTexture);\r\n return mirrorTexture;\r\n } else if (parsedTexture.isRenderTarget) {\r\n let renderTargetTexture: Nullable<RenderTargetTexture> = null;\r\n if (parsedTexture.isCube) {\r\n // Search for an existing reflection probe (which contains a cube render target texture)\r\n if (scene.reflectionProbes) {\r\n for (let index = 0; index < scene.reflectionProbes.length; index++) {\r\n const probe = scene.reflectionProbes[index];\r\n if (probe.name === parsedTexture.name) {\r\n return probe.cubeTexture;\r\n }\r\n }\r\n }\r\n } else {\r\n renderTargetTexture = Texture._CreateRenderTargetTexture(\r\n parsedTexture.name,\r\n parsedTexture.renderTargetSize,\r\n scene,\r\n generateMipMaps,\r\n parsedTexture._creationFlags ?? 0\r\n );\r\n renderTargetTexture._waitingRenderList = parsedTexture.renderList;\r\n }\r\n onLoaded(renderTargetTexture);\r\n return renderTargetTexture;\r\n } else if (parsedTexture.isVideo) {\r\n const texture = Texture._CreateVideoTexture(\r\n rootUrl + (parsedTexture.url || parsedTexture.name),\r\n rootUrl + (parsedTexture.src || parsedTexture.url),\r\n scene,\r\n generateMipMaps,\r\n parsedTexture.invertY,\r\n parsedTexture.samplingMode,\r\n parsedTexture.settings || {}\r\n );\r\n onLoaded(texture);\r\n return texture;\r\n } else {\r\n let texture: Texture;\r\n\r\n if (parsedTexture.base64String && !internalTexture) {\r\n // name and url are the same to ensure caching happens from the actual base64 string\r\n texture = Texture.CreateFromBase64String(\r\n parsedTexture.base64String,\r\n parsedTexture.base64String,\r\n scene,\r\n !generateMipMaps,\r\n parsedTexture.invertY,\r\n parsedTexture.samplingMode,\r\n () => {\r\n onLoaded(texture);\r\n },\r\n parsedTexture._creationFlags ?? 0,\r\n parsedTexture._useSRGBBuffer ?? false\r\n );\r\n\r\n // prettier name to fit with the loaded data\r\n texture.name = parsedTexture.name;\r\n } else {\r\n let url: string;\r\n if (parsedTexture.name && (parsedTexture.name.indexOf(\"://\") > 0 || parsedTexture.name.startsWith(\"data:\"))) {\r\n url = parsedTexture.name;\r\n } else {\r\n url = rootUrl + parsedTexture.name;\r\n }\r\n\r\n if (parsedTexture.url && (parsedTexture.url.startsWith(\"data:\") || Texture.UseSerializedUrlIfAny)) {\r\n url = parsedTexture.url;\r\n }\r\n\r\n const options: ITextureCreationOptions = {\r\n noMipmap: !generateMipMaps,\r\n invertY: parsedTexture.invertY,\r\n samplingMode: parsedTexture.samplingMode,\r\n onLoad: () => {\r\n onLoaded(texture);\r\n },\r\n internalTexture,\r\n };\r\n\r\n texture = new Texture(url, scene, options);\r\n }\r\n\r\n return texture;\r\n }\r\n },\r\n parsedTexture,\r\n scene\r\n );\r\n\r\n return texture;\r\n }\r\n\r\n /**\r\n * Creates a texture from its base 64 representation.\r\n * @param data Define the base64 payload without the data: prefix\r\n * @param name Define the name of the texture in the scene useful fo caching purpose for instance\r\n * @param scene Define the scene the texture should belong to\r\n * @param noMipmapOrOptions defines if the texture will require mip maps or not or set of all options to create the texture\r\n * @param invertY define if the texture needs to be inverted on the y axis during loading\r\n * @param samplingMode define the sampling mode we want for the texture while fetching from it (Texture.NEAREST_SAMPLINGMODE...)\r\n * @param onLoad define a callback triggered when the texture has been loaded\r\n * @param onError define a callback triggered when an error occurred during the loading session\r\n * @param format define the format of the texture we are trying to load (Engine.TEXTUREFORMAT_RGBA...)\r\n * @param creationFlags specific flags to use when creating the texture (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg)\r\n * @param forcedExtension defines the extension to use to pick the right loader\r\n * @returns the created texture\r\n */\r\n public static CreateFromBase64String(\r\n data: string,\r\n name: string,\r\n scene: Scene,\r\n noMipmapOrOptions?: boolean | ITextureCreationOptions,\r\n invertY?: boolean,\r\n samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE,\r\n onLoad: Nullable<() => void> = null,\r\n onError: Nullable<() => void> = null,\r\n format: number = Constants.TEXTUREFORMAT_RGBA,\r\n creationFlags?: number,\r\n forcedExtension?: string\r\n ): Texture {\r\n return new Texture(\r\n \"data:\" + name,\r\n scene,\r\n noMipmapOrOptions,\r\n invertY,\r\n samplingMode,\r\n onLoad,\r\n onError,\r\n data,\r\n false,\r\n format,\r\n undefined,\r\n undefined,\r\n creationFlags,\r\n forcedExtension\r\n );\r\n }\r\n\r\n /**\r\n * Creates a texture from its data: representation. (data: will be added in case only the payload has been passed in)\r\n * @param name Define the name of the texture in the scene useful fo caching purpose for instance\r\n * @param buffer define the buffer to load the texture from in case the texture is loaded from a buffer representation\r\n * @param scene Define the scene the texture should belong to\r\n * @param deleteBuffer define if the buffer we are loading the texture from should be deleted after load\r\n * @param noMipmapOrOptions defines if the texture will require mip maps or not or set of all options to create the texture\r\n * @param invertY define if the texture needs to be inverted on the y axis during loading\r\n * @param samplingMode define the sampling mode we want for the texture while fetching from it (Texture.NEAREST_SAMPLINGMODE...)\r\n * @param onLoad define a callback triggered when the texture has been loaded\r\n * @param onError define a callback triggered when an error occurred during the loading session\r\n * @param format define the format of the texture we are trying to load (Engine.TEXTUREFORMAT_RGBA...)\r\n * @param creationFlags specific flags to use when creating the texture (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg)\r\n * @param forcedExtension defines the extension to use to pick the right loader\r\n * @returns the created texture\r\n */\r\n public static LoadFromDataString(\r\n name: string,\r\n buffer: any,\r\n scene: Scene,\r\n deleteBuffer: boolean = false,\r\n noMipmapOrOptions?: boolean | ITextureCreationOptions,\r\n invertY: boolean = true,\r\n samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE,\r\n onLoad: Nullable<() => void> = null,\r\n onError: Nullable<(message?: string, exception?: any) => void> = null,\r\n format: number = Constants.TEXTUREFORMAT_RGBA,\r\n creationFlags?: number,\r\n forcedExtension?: string\r\n ): Texture {\r\n if (name.substr(0, 5) !== \"data:\") {\r\n name = \"data:\" + name;\r\n }\r\n\r\n return new Texture(\r\n name,\r\n scene,\r\n noMipmapOrOptions,\r\n invertY,\r\n samplingMode,\r\n onLoad,\r\n onError,\r\n buffer,\r\n deleteBuffer,\r\n format,\r\n undefined,\r\n undefined,\r\n creationFlags,\r\n forcedExtension\r\n );\r\n }\r\n}\r\n\r\n// References the dependencies.\r\nRegisterClass(\"BABYLON.Texture\", Texture);\r\nSerializationHelper._TextureParser = Texture.Parse;\r\n"]}
|
|
1
|
+
{"version":3,"file":"texture.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/Textures/texture.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGlD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,+BAA+B,EAAE,oCAAoC,EAAE,MAAM,sBAAsB,CAAC;AAC7G,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AASzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAiD1E;;;GAGG;AACH,MAAM,OAAO,OAAQ,SAAQ,WAAW;IA0CpC;;OAEG;IACI,MAAM,CAAC,mBAAmB,CAC7B,IAAsB,EACtB,GAAyC,EACzC,KAAsB,EACtB,eAAe,GAAG,KAAK,EACvB,OAAO,GAAG,KAAK,EACf,eAAuB,OAAO,CAAC,sBAAsB,EACrD,WAA0C,EAAE,EAC5C,OAA+D,EAC/D,SAAiB,SAAS,CAAC,kBAAkB;QAE7C,MAAM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ACI;AAQT;IADN,SAAS,EAAE;qCACI;AAQT;IADN,SAAS,EAAE;qCACI;AAMT;IADN,SAAS,EAAE;gDACiB;AAMtB;IADN,SAAS,EAAE;gDACiB;AAMtB;IADN,SAAS,EAAE;gDACiB;AAMtB;IADN,SAAS,EAAE;iEACoC;AA+EhD;IADC,SAAS,EAAE;yCAGX;AAi1BL,+BAA+B;AAC/B,aAAa,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC;AAC1C,mBAAmB,CAAC,cAAc,GAAG,OAAO,CAAC,KAAK,CAAC","sourcesContent":["import { serialize } from \"../../Misc/decorators\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport type { Nullable } from \"../../types\";\r\nimport { Matrix, TmpVectors, Vector3 } from \"../../Maths/math.vector\";\r\nimport { BaseTexture } from \"../../Materials/Textures/baseTexture\";\r\nimport { Constants } from \"../../Engines/constants\";\r\nimport { GetClass, RegisterClass } from \"../../Misc/typeStore\";\r\nimport { _WarnImport } from \"../../Misc/devTools\";\r\nimport type { IInspectable } from \"../../Misc/iInspectable\";\r\nimport type { ThinEngine } from \"../../Engines/thinEngine\";\r\nimport { TimingTools } from \"../../Misc/timingTools\";\r\nimport { InstantiationTools } from \"../../Misc/instantiationTools\";\r\nimport { Plane } from \"../../Maths/math.plane\";\r\nimport { EncodeArrayBufferToBase64 } from \"../../Misc/stringTools\";\r\nimport { GenerateBase64StringFromTexture, GenerateBase64StringFromTextureAsync } from \"../../Misc/copyTools\";\r\nimport { CompatibilityOptions } from \"../../Compat/compatibilityOptions\";\r\nimport type { InternalTexture } from \"./internalTexture\";\r\n\r\nimport type { CubeTexture } from \"../../Materials/Textures/cubeTexture\";\r\nimport type { MirrorTexture } from \"../../Materials/Textures/mirrorTexture\";\r\nimport type { RenderTargetTexture } from \"../../Materials/Textures/renderTargetTexture\";\r\nimport type { Scene } from \"../../scene\";\r\nimport type { VideoTexture, VideoTextureSettings } from \"./videoTexture\";\r\n\r\nimport { SerializationHelper } from \"../../Misc/decorators.serialization\";\r\n\r\n/**\r\n * Defines the available options when creating a texture\r\n */\r\nexport interface ITextureCreationOptions {\r\n /** Defines if the texture will require mip maps or not (default: false) */\r\n noMipmap?: boolean;\r\n\r\n /** Defines if the texture needs to be inverted on the y axis during loading (default: true) */\r\n invertY?: boolean;\r\n\r\n /** Defines the sampling mode we want for the texture while fetching from it (Texture.NEAREST_SAMPLINGMODE...) (default: Texture.TRILINEAR_SAMPLINGMODE) */\r\n samplingMode?: number;\r\n\r\n /** Defines a callback triggered when the texture has been loaded (default: null) */\r\n onLoad?: Nullable<() => void>;\r\n\r\n /** Defines a callback triggered when an error occurred during the loading session (default: null) */\r\n onError?: Nullable<(message?: string, exception?: any) => void>;\r\n\r\n /** Defines the buffer to load the texture from in case the texture is loaded from a buffer representation (default: null) */\r\n buffer?: Nullable<string | ArrayBuffer | ArrayBufferView | HTMLImageElement | Blob | ImageBitmap>;\r\n\r\n /** Defines if the buffer we are loading the texture from should be deleted after load (default: false) */\r\n deleteBuffer?: boolean;\r\n\r\n /** Defines the format of the texture we are trying to load (Engine.TEXTUREFORMAT_RGBA...) (default: ) */\r\n format?: number;\r\n\r\n /** Defines an optional mime type information (default: undefined) */\r\n mimeType?: string;\r\n\r\n /** Options to be passed to the loader (default: undefined) */\r\n loaderOptions?: any;\r\n\r\n /** Specific flags to use when creating the texture (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg) (default: undefined) */\r\n creationFlags?: number;\r\n\r\n /** Defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU) (default: false) */\r\n useSRGBBuffer?: boolean;\r\n\r\n /** Defines the underlying texture from an already existing one */\r\n internalTexture?: InternalTexture;\r\n\r\n /** Defines the underlying texture texture space */\r\n gammaSpace?: boolean;\r\n}\r\n\r\n/**\r\n * This represents a texture in babylon. It can be easily loaded from a network, base64 or html input.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/materials_introduction#texture\r\n */\r\nexport class Texture extends BaseTexture {\r\n /**\r\n * Gets or sets a general boolean used to indicate that textures containing direct data (buffers) must be saved as part of the serialization process\r\n */\r\n public static SerializeBuffers = true;\r\n\r\n /**\r\n * Gets or sets a general boolean used to indicate that texture buffers must be saved as part of the serialization process.\r\n * If no buffer exists, one will be created as base64 string from the internal webgl data.\r\n */\r\n public static ForceSerializeBuffers = false;\r\n\r\n /**\r\n * This observable will notify when any texture had a loading error\r\n */\r\n public static OnTextureLoadErrorObservable = new Observable<BaseTexture>();\r\n\r\n /** @internal */\r\n public static _SerializeInternalTextureUniqueId = false;\r\n\r\n /**\r\n * @internal\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n public static _CubeTextureParser = (jsonTexture: any, scene: Scene, rootUrl: string): CubeTexture => {\r\n throw _WarnImport(\"CubeTexture\");\r\n };\r\n /**\r\n * @internal\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n public static _CreateMirror = (name: string, renderTargetSize: number, scene: Scene, generateMipMaps: boolean): MirrorTexture => {\r\n throw _WarnImport(\"MirrorTexture\");\r\n };\r\n /**\r\n * @internal\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n public static _CreateRenderTargetTexture = (name: string, renderTargetSize: number, scene: Scene, generateMipMaps: boolean, creationFlags?: number): RenderTargetTexture => {\r\n throw _WarnImport(\"RenderTargetTexture\");\r\n };\r\n\r\n /**\r\n * @internal\r\n */\r\n public static _CreateVideoTexture(\r\n name: Nullable<string>,\r\n src: string | string[] | HTMLVideoElement,\r\n scene: Nullable<Scene>,\r\n generateMipMaps = false,\r\n invertY = false,\r\n samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE,\r\n settings: Partial<VideoTextureSettings> = {},\r\n onError?: Nullable<(message?: string, exception?: any) => void>,\r\n format: number = Constants.TEXTUREFORMAT_RGBA\r\n ): VideoTexture {\r\n throw _WarnImport(\"VideoTexture\");\r\n }\r\n\r\n /** nearest is mag = nearest and min = nearest and no mip */\r\n public static readonly NEAREST_SAMPLINGMODE = Constants.TEXTURE_NEAREST_SAMPLINGMODE;\r\n /** nearest is mag = nearest and min = nearest and mip = linear */\r\n public static readonly NEAREST_NEAREST_MIPLINEAR = Constants.TEXTURE_NEAREST_NEAREST_MIPLINEAR; // nearest is mag = nearest and min = nearest and mip = linear\r\n\r\n /** Bilinear is mag = linear and min = linear and no mip */\r\n public static readonly BILINEAR_SAMPLINGMODE = Constants.TEXTURE_BILINEAR_SAMPLINGMODE;\r\n /** Bilinear is mag = linear and min = linear and mip = nearest */\r\n public static readonly LINEAR_LINEAR_MIPNEAREST = Constants.TEXTURE_LINEAR_LINEAR_MIPNEAREST; // Bilinear is mag = linear and min = linear and mip = nearest\r\n\r\n /** Trilinear is mag = linear and min = linear and mip = linear */\r\n public static readonly TRILINEAR_SAMPLINGMODE = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE;\r\n /** Trilinear is mag = linear and min = linear and mip = linear */\r\n public static readonly LINEAR_LINEAR_MIPLINEAR = Constants.TEXTURE_LINEAR_LINEAR_MIPLINEAR; // Trilinear is mag = linear and min = linear and mip = linear\r\n\r\n /** mag = nearest and min = nearest and mip = nearest */\r\n public static readonly NEAREST_NEAREST_MIPNEAREST = Constants.TEXTURE_NEAREST_NEAREST_MIPNEAREST;\r\n /** mag = nearest and min = linear and mip = nearest */\r\n public static readonly NEAREST_LINEAR_MIPNEAREST = Constants.TEXTURE_NEAREST_LINEAR_MIPNEAREST;\r\n /** mag = nearest and min = linear and mip = linear */\r\n public static readonly NEAREST_LINEAR_MIPLINEAR = Constants.TEXTURE_NEAREST_LINEAR_MIPLINEAR;\r\n /** mag = nearest and min = linear and mip = none */\r\n public static readonly NEAREST_LINEAR = Constants.TEXTURE_NEAREST_LINEAR;\r\n /** mag = nearest and min = nearest and mip = none */\r\n public static readonly NEAREST_NEAREST = Constants.TEXTURE_NEAREST_NEAREST;\r\n /** mag = linear and min = nearest and mip = nearest */\r\n public static readonly LINEAR_NEAREST_MIPNEAREST = Constants.TEXTURE_LINEAR_NEAREST_MIPNEAREST;\r\n /** mag = linear and min = nearest and mip = linear */\r\n public static readonly LINEAR_NEAREST_MIPLINEAR = Constants.TEXTURE_LINEAR_NEAREST_MIPLINEAR;\r\n /** mag = linear and min = linear and mip = none */\r\n public static readonly LINEAR_LINEAR = Constants.TEXTURE_LINEAR_LINEAR;\r\n /** mag = linear and min = nearest and mip = none */\r\n public static readonly LINEAR_NEAREST = Constants.TEXTURE_LINEAR_NEAREST;\r\n\r\n /** Explicit coordinates mode */\r\n public static readonly EXPLICIT_MODE = Constants.TEXTURE_EXPLICIT_MODE;\r\n /** Spherical coordinates mode */\r\n public static readonly SPHERICAL_MODE = Constants.TEXTURE_SPHERICAL_MODE;\r\n /** Planar coordinates mode */\r\n public static readonly PLANAR_MODE = Constants.TEXTURE_PLANAR_MODE;\r\n /** Cubic coordinates mode */\r\n public static readonly CUBIC_MODE = Constants.TEXTURE_CUBIC_MODE;\r\n /** Projection coordinates mode */\r\n public static readonly PROJECTION_MODE = Constants.TEXTURE_PROJECTION_MODE;\r\n /** Inverse Cubic coordinates mode */\r\n public static readonly SKYBOX_MODE = Constants.TEXTURE_SKYBOX_MODE;\r\n /** Inverse Cubic coordinates mode */\r\n public static readonly INVCUBIC_MODE = Constants.TEXTURE_INVCUBIC_MODE;\r\n /** Equirectangular coordinates mode */\r\n public static readonly EQUIRECTANGULAR_MODE = Constants.TEXTURE_EQUIRECTANGULAR_MODE;\r\n /** Equirectangular Fixed coordinates mode */\r\n public static readonly FIXED_EQUIRECTANGULAR_MODE = Constants.TEXTURE_FIXED_EQUIRECTANGULAR_MODE;\r\n /** Equirectangular Fixed Mirrored coordinates mode */\r\n public static readonly FIXED_EQUIRECTANGULAR_MIRRORED_MODE = Constants.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE;\r\n\r\n /** Texture is not repeating outside of 0..1 UVs */\r\n public static readonly CLAMP_ADDRESSMODE = Constants.TEXTURE_CLAMP_ADDRESSMODE;\r\n /** Texture is repeating outside of 0..1 UVs */\r\n public static readonly WRAP_ADDRESSMODE = Constants.TEXTURE_WRAP_ADDRESSMODE;\r\n /** Texture is repeating and mirrored */\r\n public static readonly MIRROR_ADDRESSMODE = Constants.TEXTURE_MIRROR_ADDRESSMODE;\r\n\r\n /**\r\n * Gets or sets a boolean which defines if the texture url must be build from the serialized URL instead of just using the name and loading them side by side with the scene file\r\n */\r\n public static UseSerializedUrlIfAny = false;\r\n\r\n /**\r\n * Define the url of the texture.\r\n */\r\n @serialize()\r\n public url: Nullable<string> = null;\r\n\r\n /**\r\n * Define an offset on the texture to offset the u coordinates of the UVs\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/moreMaterials#offsetting\r\n */\r\n @serialize()\r\n public uOffset = 0;\r\n\r\n /**\r\n * Define an offset on the texture to offset the v coordinates of the UVs\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/moreMaterials#offsetting\r\n */\r\n @serialize()\r\n public vOffset = 0;\r\n\r\n /**\r\n * Define an offset on the texture to scale the u coordinates of the UVs\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/moreMaterials#tiling\r\n */\r\n @serialize()\r\n public uScale = 1.0;\r\n\r\n /**\r\n * Define an offset on the texture to scale the v coordinates of the UVs\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/moreMaterials#tiling\r\n */\r\n @serialize()\r\n public vScale = 1.0;\r\n\r\n /**\r\n * Define an offset on the texture to rotate around the u coordinates of the UVs\r\n * The angle is defined in radians.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/moreMaterials\r\n */\r\n @serialize()\r\n public uAng = 0;\r\n\r\n /**\r\n * Define an offset on the texture to rotate around the v coordinates of the UVs\r\n * The angle is defined in radians.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/moreMaterials\r\n */\r\n @serialize()\r\n public vAng = 0;\r\n\r\n /**\r\n * Define an offset on the texture to rotate around the w coordinates of the UVs (in case of 3d texture)\r\n * The angle is defined in radians.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/moreMaterials\r\n */\r\n @serialize()\r\n public wAng = 0;\r\n\r\n /**\r\n * Defines the center of rotation (U)\r\n */\r\n @serialize()\r\n public uRotationCenter = 0.5;\r\n\r\n /**\r\n * Defines the center of rotation (V)\r\n */\r\n @serialize()\r\n public vRotationCenter = 0.5;\r\n\r\n /**\r\n * Defines the center of rotation (W)\r\n */\r\n @serialize()\r\n public wRotationCenter = 0.5;\r\n\r\n /**\r\n * Sets this property to true to avoid deformations when rotating the texture with non-uniform scaling\r\n */\r\n @serialize()\r\n public homogeneousRotationInUVTransform = false;\r\n\r\n /**\r\n * Are mip maps generated for this texture or not.\r\n */\r\n get noMipmap(): boolean {\r\n return this._noMipmap;\r\n }\r\n\r\n /**\r\n * List of inspectable custom properties (used by the Inspector)\r\n * @see https://doc.babylonjs.com/toolsAndResources/inspector#extensibility\r\n */\r\n public inspectableCustomProperties: Nullable<IInspectable[]> = null;\r\n\r\n /** @internal */\r\n public _noMipmap: boolean = false;\r\n /** @internal */\r\n public _invertY: boolean = false;\r\n private _rowGenerationMatrix: Nullable<Matrix> = null;\r\n private _cachedTextureMatrix: Nullable<Matrix> = null;\r\n private _projectionModeMatrix: Nullable<Matrix> = null;\r\n private _t0: Nullable<Vector3> = null;\r\n private _t1: Nullable<Vector3> = null;\r\n private _t2: Nullable<Vector3> = null;\r\n\r\n private _cachedUOffset: number = -1;\r\n private _cachedVOffset: number = -1;\r\n private _cachedUScale: number = 0;\r\n private _cachedVScale: number = 0;\r\n private _cachedUAng: number = -1;\r\n private _cachedVAng: number = -1;\r\n private _cachedWAng: number = -1;\r\n private _cachedReflectionProjectionMatrixId: number = -1;\r\n private _cachedURotationCenter: number = -1;\r\n private _cachedVRotationCenter: number = -1;\r\n private _cachedWRotationCenter: number = -1;\r\n private _cachedHomogeneousRotationInUVTransform: boolean = false;\r\n private _cachedIdentity3x2: boolean = true;\r\n\r\n private _cachedReflectionTextureMatrix: Nullable<Matrix> = null;\r\n private _cachedReflectionUOffset = -1;\r\n private _cachedReflectionVOffset = -1;\r\n private _cachedReflectionUScale = 0;\r\n private _cachedReflectionVScale = 0;\r\n private _cachedReflectionCoordinatesMode = -1;\r\n\r\n /** @internal */\r\n public _buffer: Nullable<string | ArrayBuffer | ArrayBufferView | HTMLImageElement | Blob | ImageBitmap> = null;\r\n private _deleteBuffer: boolean = false;\r\n protected _format: Nullable<number> = null;\r\n private _delayedOnLoad: Nullable<() => void> = null;\r\n private _delayedOnError: Nullable<() => void> = null;\r\n private _mimeType?: string;\r\n private _loaderOptions?: any;\r\n private _creationFlags?: number;\r\n /** @internal */\r\n public _useSRGBBuffer?: boolean;\r\n private _forcedExtension?: string;\r\n\r\n /** Returns the texture mime type if it was defined by a loader (undefined else) */\r\n public get mimeType() {\r\n return this._mimeType;\r\n }\r\n\r\n /**\r\n * Observable triggered once the texture has been loaded.\r\n */\r\n public onLoadObservable: Observable<Texture> = new Observable<Texture>();\r\n\r\n protected _isBlocking: boolean = true;\r\n /**\r\n * Is the texture preventing material to render while loading.\r\n * If false, a default texture will be used instead of the loading one during the preparation step.\r\n */\r\n public set isBlocking(value: boolean) {\r\n this._isBlocking = value;\r\n }\r\n @serialize()\r\n public get isBlocking(): boolean {\r\n return this._isBlocking;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if the texture needs to be inverted on the y axis during loading\r\n */\r\n public get invertY(): boolean {\r\n return this._invertY;\r\n }\r\n\r\n /**\r\n * Instantiates a new texture.\r\n * This represents a texture in babylon. It can be easily loaded from a network, base64 or html input.\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/materials_introduction#texture\r\n * @param url defines the url of the picture to load as a texture\r\n * @param sceneOrEngine defines the scene or engine the texture will belong to\r\n * @param noMipmapOrOptions defines if the texture will require mip maps or not or set of all options to create the texture\r\n * @param invertY defines if the texture needs to be inverted on the y axis during loading\r\n * @param samplingMode defines the sampling mode we want for the texture while fetching from it (Texture.NEAREST_SAMPLINGMODE...)\r\n * @param onLoad defines a callback triggered when the texture has been loaded\r\n * @param onError defines a callback triggered when an error occurred during the loading session\r\n * @param buffer defines the buffer to load the texture from in case the texture is loaded from a buffer representation\r\n * @param deleteBuffer defines if the buffer we are loading the texture from should be deleted after load\r\n * @param format defines the format of the texture we are trying to load (Engine.TEXTUREFORMAT_RGBA...)\r\n * @param mimeType defines an optional mime type information\r\n * @param loaderOptions options to be passed to the loader\r\n * @param creationFlags specific flags to use when creating the texture (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg)\r\n * @param forcedExtension defines the extension to use to pick the right loader\r\n */\r\n constructor(\r\n url: Nullable<string>,\r\n sceneOrEngine?: Nullable<Scene | ThinEngine>,\r\n noMipmapOrOptions?: boolean | ITextureCreationOptions,\r\n invertY?: boolean,\r\n samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE,\r\n onLoad: Nullable<() => void> = null,\r\n onError: Nullable<(message?: string, exception?: any) => void> = null,\r\n buffer: Nullable<string | ArrayBuffer | ArrayBufferView | HTMLImageElement | Blob | ImageBitmap> = null,\r\n deleteBuffer: boolean = false,\r\n format?: number,\r\n mimeType?: string,\r\n loaderOptions?: any,\r\n creationFlags?: number,\r\n forcedExtension?: string\r\n ) {\r\n super(sceneOrEngine);\r\n\r\n this.name = url || \"\";\r\n this.url = url;\r\n\r\n let noMipmap: boolean;\r\n let useSRGBBuffer: boolean = false;\r\n let internalTexture: Nullable<InternalTexture> = null;\r\n let gammaSpace = true;\r\n\r\n if (typeof noMipmapOrOptions === \"object\" && noMipmapOrOptions !== null) {\r\n noMipmap = noMipmapOrOptions.noMipmap ?? false;\r\n invertY = noMipmapOrOptions.invertY ?? (CompatibilityOptions.UseOpenGLOrientationForUV ? false : true);\r\n samplingMode = noMipmapOrOptions.samplingMode ?? Texture.TRILINEAR_SAMPLINGMODE;\r\n onLoad = noMipmapOrOptions.onLoad ?? null;\r\n onError = noMipmapOrOptions.onError ?? null;\r\n buffer = noMipmapOrOptions.buffer ?? null;\r\n deleteBuffer = noMipmapOrOptions.deleteBuffer ?? false;\r\n format = noMipmapOrOptions.format;\r\n mimeType = noMipmapOrOptions.mimeType;\r\n loaderOptions = noMipmapOrOptions.loaderOptions;\r\n creationFlags = noMipmapOrOptions.creationFlags;\r\n useSRGBBuffer = noMipmapOrOptions.useSRGBBuffer ?? false;\r\n internalTexture = noMipmapOrOptions.internalTexture ?? null;\r\n gammaSpace = noMipmapOrOptions.gammaSpace ?? gammaSpace;\r\n } else {\r\n noMipmap = !!noMipmapOrOptions;\r\n }\r\n\r\n this._gammaSpace = gammaSpace;\r\n this._noMipmap = noMipmap;\r\n this._invertY = invertY === undefined ? (CompatibilityOptions.UseOpenGLOrientationForUV ? false : true) : invertY;\r\n this._initialSamplingMode = samplingMode;\r\n this._buffer = buffer;\r\n this._deleteBuffer = deleteBuffer;\r\n this._mimeType = mimeType;\r\n this._loaderOptions = loaderOptions;\r\n this._creationFlags = creationFlags;\r\n this._useSRGBBuffer = useSRGBBuffer;\r\n this._forcedExtension = forcedExtension;\r\n if (format) {\r\n this._format = format;\r\n }\r\n\r\n const scene = this.getScene();\r\n const engine = this._getEngine();\r\n if (!engine) {\r\n return;\r\n }\r\n\r\n engine.onBeforeTextureInitObservable.notifyObservers(this);\r\n\r\n const load = () => {\r\n if (this._texture) {\r\n if (this._texture._invertVScale) {\r\n this.vScale *= -1;\r\n this.vOffset += 1;\r\n }\r\n\r\n // Update texture to match internal texture's wrapping\r\n if (this._texture._cachedWrapU !== null) {\r\n this.wrapU = this._texture._cachedWrapU;\r\n this._texture._cachedWrapU = null;\r\n }\r\n if (this._texture._cachedWrapV !== null) {\r\n this.wrapV = this._texture._cachedWrapV;\r\n this._texture._cachedWrapV = null;\r\n }\r\n if (this._texture._cachedWrapR !== null) {\r\n this.wrapR = this._texture._cachedWrapR;\r\n this._texture._cachedWrapR = null;\r\n }\r\n }\r\n\r\n if (this.onLoadObservable.hasObservers()) {\r\n this.onLoadObservable.notifyObservers(this);\r\n }\r\n if (onLoad) {\r\n onLoad();\r\n }\r\n\r\n if (!this.isBlocking && scene) {\r\n scene.resetCachedMaterial();\r\n }\r\n };\r\n\r\n const errorHandler = (message?: string, exception?: any) => {\r\n this._loadingError = true;\r\n this._errorObject = { message, exception };\r\n if (onError) {\r\n onError(message, exception);\r\n }\r\n Texture.OnTextureLoadErrorObservable.notifyObservers(this);\r\n };\r\n\r\n if (!this.url && !internalTexture) {\r\n this._delayedOnLoad = load;\r\n this._delayedOnError = errorHandler;\r\n return;\r\n }\r\n\r\n this._texture = internalTexture ?? this._getFromCache(this.url, noMipmap, samplingMode, this._invertY, useSRGBBuffer, this.isCube);\r\n\r\n if (!this._texture) {\r\n if (!scene || !scene.useDelayedTextureLoading) {\r\n try {\r\n this._texture = engine.createTexture(\r\n this.url,\r\n noMipmap,\r\n this._invertY,\r\n scene,\r\n samplingMode,\r\n load,\r\n errorHandler,\r\n this._buffer,\r\n undefined,\r\n this._format,\r\n this._forcedExtension,\r\n mimeType,\r\n loaderOptions,\r\n creationFlags,\r\n useSRGBBuffer\r\n );\r\n } catch (e) {\r\n errorHandler(\"error loading\", e);\r\n throw e;\r\n }\r\n if (deleteBuffer) {\r\n this._buffer = null;\r\n }\r\n } else {\r\n this.delayLoadState = Constants.DELAYLOADSTATE_NOTLOADED;\r\n\r\n this._delayedOnLoad = load;\r\n this._delayedOnError = errorHandler;\r\n }\r\n } else {\r\n if (this._texture.isReady) {\r\n TimingTools.SetImmediate(() => load());\r\n } else {\r\n const loadObserver = this._texture.onLoadedObservable.add(load);\r\n this._texture.onErrorObservable.add((e) => {\r\n errorHandler(e.message, e.exception);\r\n this._texture?.onLoadedObservable.remove(loadObserver);\r\n });\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Update the url (and optional buffer) of this texture if url was null during construction.\r\n * @param url the url of the texture\r\n * @param buffer the buffer of the texture (defaults to null)\r\n * @param onLoad callback called when the texture is loaded (defaults to null)\r\n * @param forcedExtension defines the extension to use to pick the right loader\r\n */\r\n public updateURL(\r\n url: string,\r\n buffer: Nullable<string | ArrayBuffer | ArrayBufferView | HTMLImageElement | Blob | ImageBitmap> = null,\r\n onLoad?: () => void,\r\n forcedExtension?: string\r\n ): void {\r\n if (this.url) {\r\n this.releaseInternalTexture();\r\n this.getScene()!.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag, (mat) => {\r\n return mat.hasTexture(this);\r\n });\r\n }\r\n\r\n if (!this.name || this.name.startsWith(\"data:\")) {\r\n this.name = url;\r\n }\r\n this.url = url;\r\n this._buffer = buffer;\r\n this._forcedExtension = forcedExtension;\r\n this.delayLoadState = Constants.DELAYLOADSTATE_NOTLOADED;\r\n\r\n if (onLoad) {\r\n this._delayedOnLoad = onLoad;\r\n }\r\n this.delayLoad();\r\n }\r\n\r\n /**\r\n * Finish the loading sequence of a texture flagged as delayed load.\r\n * @internal\r\n */\r\n public delayLoad(): void {\r\n if (this.delayLoadState !== Constants.DELAYLOADSTATE_NOTLOADED) {\r\n return;\r\n }\r\n\r\n const scene = this.getScene();\r\n if (!scene) {\r\n return;\r\n }\r\n\r\n this.delayLoadState = Constants.DELAYLOADSTATE_LOADED;\r\n this._texture = this._getFromCache(this.url, this._noMipmap, this.samplingMode, this._invertY, this._useSRGBBuffer, this.isCube);\r\n\r\n if (!this._texture) {\r\n this._texture = scene\r\n .getEngine()\r\n .createTexture(\r\n this.url,\r\n this._noMipmap,\r\n this._invertY,\r\n scene,\r\n this.samplingMode,\r\n this._delayedOnLoad,\r\n this._delayedOnError,\r\n this._buffer,\r\n null,\r\n this._format,\r\n this._forcedExtension,\r\n this._mimeType,\r\n this._loaderOptions,\r\n this._creationFlags,\r\n this._useSRGBBuffer\r\n );\r\n if (this._deleteBuffer) {\r\n this._buffer = null;\r\n }\r\n } else {\r\n if (this._delayedOnLoad) {\r\n if (this._texture.isReady) {\r\n TimingTools.SetImmediate(this._delayedOnLoad);\r\n } else {\r\n this._texture.onLoadedObservable.add(this._delayedOnLoad);\r\n }\r\n }\r\n }\r\n\r\n this._delayedOnLoad = null;\r\n this._delayedOnError = null;\r\n }\r\n\r\n private _prepareRowForTextureGeneration(x: number, y: number, z: number, t: Vector3): void {\r\n x *= this._cachedUScale;\r\n y *= this._cachedVScale;\r\n\r\n x -= this.uRotationCenter * this._cachedUScale;\r\n y -= this.vRotationCenter * this._cachedVScale;\r\n z -= this.wRotationCenter;\r\n\r\n Vector3.TransformCoordinatesFromFloatsToRef(x, y, z, this._rowGenerationMatrix!, t);\r\n\r\n t.x += this.uRotationCenter * this._cachedUScale + this._cachedUOffset;\r\n t.y += this.vRotationCenter * this._cachedVScale + this._cachedVOffset;\r\n t.z += this.wRotationCenter;\r\n }\r\n\r\n /**\r\n * Get the current texture matrix which includes the requested offsetting, tiling and rotation components.\r\n * @param uBase The horizontal base offset multiplier (1 by default)\r\n * @returns the transform matrix of the texture.\r\n */\r\n public getTextureMatrix(uBase = 1): Matrix {\r\n if (\r\n this.uOffset === this._cachedUOffset &&\r\n this.vOffset === this._cachedVOffset &&\r\n this.uScale * uBase === this._cachedUScale &&\r\n this.vScale === this._cachedVScale &&\r\n this.uAng === this._cachedUAng &&\r\n this.vAng === this._cachedVAng &&\r\n this.wAng === this._cachedWAng &&\r\n this.uRotationCenter === this._cachedURotationCenter &&\r\n this.vRotationCenter === this._cachedVRotationCenter &&\r\n this.wRotationCenter === this._cachedWRotationCenter &&\r\n this.homogeneousRotationInUVTransform === this._cachedHomogeneousRotationInUVTransform\r\n ) {\r\n return this._cachedTextureMatrix!;\r\n }\r\n\r\n this._cachedUOffset = this.uOffset;\r\n this._cachedVOffset = this.vOffset;\r\n this._cachedUScale = this.uScale * uBase;\r\n this._cachedVScale = this.vScale;\r\n this._cachedUAng = this.uAng;\r\n this._cachedVAng = this.vAng;\r\n this._cachedWAng = this.wAng;\r\n this._cachedURotationCenter = this.uRotationCenter;\r\n this._cachedVRotationCenter = this.vRotationCenter;\r\n this._cachedWRotationCenter = this.wRotationCenter;\r\n this._cachedHomogeneousRotationInUVTransform = this.homogeneousRotationInUVTransform;\r\n\r\n if (!this._cachedTextureMatrix || !this._rowGenerationMatrix) {\r\n this._cachedTextureMatrix = Matrix.Zero();\r\n this._rowGenerationMatrix = new Matrix();\r\n this._t0 = Vector3.Zero();\r\n this._t1 = Vector3.Zero();\r\n this._t2 = Vector3.Zero();\r\n }\r\n\r\n Matrix.RotationYawPitchRollToRef(this.vAng, this.uAng, this.wAng, this._rowGenerationMatrix!);\r\n\r\n if (this.homogeneousRotationInUVTransform) {\r\n Matrix.TranslationToRef(-this._cachedURotationCenter, -this._cachedVRotationCenter, -this._cachedWRotationCenter, TmpVectors.Matrix[0]);\r\n Matrix.TranslationToRef(this._cachedURotationCenter, this._cachedVRotationCenter, this._cachedWRotationCenter, TmpVectors.Matrix[1]);\r\n Matrix.ScalingToRef(this._cachedUScale, this._cachedVScale, 0, TmpVectors.Matrix[2]);\r\n Matrix.TranslationToRef(this._cachedUOffset, this._cachedVOffset, 0, TmpVectors.Matrix[3]);\r\n\r\n TmpVectors.Matrix[0].multiplyToRef(this._rowGenerationMatrix!, this._cachedTextureMatrix);\r\n this._cachedTextureMatrix.multiplyToRef(TmpVectors.Matrix[1], this._cachedTextureMatrix);\r\n this._cachedTextureMatrix.multiplyToRef(TmpVectors.Matrix[2], this._cachedTextureMatrix);\r\n this._cachedTextureMatrix.multiplyToRef(TmpVectors.Matrix[3], this._cachedTextureMatrix);\r\n\r\n // copy the translation row to the 3rd row of the matrix so that we don't need to update the shaders (which expects the translation to be on the 3rd row)\r\n this._cachedTextureMatrix.setRowFromFloats(2, this._cachedTextureMatrix.m[12], this._cachedTextureMatrix.m[13], this._cachedTextureMatrix.m[14], 1);\r\n } else {\r\n this._prepareRowForTextureGeneration(0, 0, 0, this._t0!);\r\n this._prepareRowForTextureGeneration(1.0, 0, 0, this._t1!);\r\n this._prepareRowForTextureGeneration(0, 1.0, 0, this._t2!);\r\n\r\n this._t1!.subtractInPlace(this._t0!);\r\n this._t2!.subtractInPlace(this._t0!);\r\n\r\n Matrix.FromValuesToRef(\r\n this._t1!.x,\r\n this._t1!.y,\r\n this._t1!.z,\r\n 0.0,\r\n this._t2!.x,\r\n this._t2!.y,\r\n this._t2!.z,\r\n 0.0,\r\n this._t0!.x,\r\n this._t0!.y,\r\n this._t0!.z,\r\n 0.0,\r\n 0.0,\r\n 0.0,\r\n 0.0,\r\n 1.0,\r\n this._cachedTextureMatrix\r\n );\r\n }\r\n\r\n const scene = this.getScene();\r\n\r\n if (!scene) {\r\n return this._cachedTextureMatrix;\r\n }\r\n\r\n const previousIdentity3x2 = this._cachedIdentity3x2;\r\n this._cachedIdentity3x2 = this._cachedTextureMatrix.isIdentityAs3x2();\r\n\r\n if (this.optimizeUVAllocation && previousIdentity3x2 !== this._cachedIdentity3x2) {\r\n // We flag the materials that are using this texture as \"texture dirty\" because depending on the fact that the matrix is the identity or not, some defines\r\n // will get different values (see PrepareDefinesForMergedUV), meaning we should regenerate the effect accordingly\r\n scene.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag, (mat) => {\r\n return mat.hasTexture(this);\r\n });\r\n }\r\n\r\n return this._cachedTextureMatrix;\r\n }\r\n\r\n /**\r\n * Get the current matrix used to apply reflection. This is useful to rotate an environment texture for instance.\r\n * @returns The reflection texture transform\r\n */\r\n public getReflectionTextureMatrix(): Matrix {\r\n const scene = this.getScene();\r\n\r\n if (!scene) {\r\n return this._cachedReflectionTextureMatrix!;\r\n }\r\n\r\n if (\r\n this.uOffset === this._cachedReflectionUOffset &&\r\n this.vOffset === this._cachedReflectionVOffset &&\r\n this.uScale === this._cachedReflectionUScale &&\r\n this.vScale === this._cachedReflectionVScale &&\r\n this.coordinatesMode === this._cachedReflectionCoordinatesMode\r\n ) {\r\n if (this.coordinatesMode === Texture.PROJECTION_MODE) {\r\n if (this._cachedReflectionProjectionMatrixId === scene.getProjectionMatrix().updateFlag) {\r\n return this._cachedReflectionTextureMatrix!;\r\n }\r\n } else {\r\n return this._cachedReflectionTextureMatrix!;\r\n }\r\n }\r\n\r\n if (!this._cachedReflectionTextureMatrix) {\r\n this._cachedReflectionTextureMatrix = Matrix.Zero();\r\n }\r\n\r\n if (!this._projectionModeMatrix) {\r\n this._projectionModeMatrix = Matrix.Zero();\r\n }\r\n\r\n const flagMaterialsAsTextureDirty = this._cachedReflectionCoordinatesMode !== this.coordinatesMode;\r\n\r\n this._cachedReflectionUOffset = this.uOffset;\r\n this._cachedReflectionVOffset = this.vOffset;\r\n this._cachedReflectionUScale = this.uScale;\r\n this._cachedReflectionVScale = this.vScale;\r\n this._cachedReflectionCoordinatesMode = this.coordinatesMode;\r\n\r\n switch (this.coordinatesMode) {\r\n case Texture.PLANAR_MODE: {\r\n Matrix.IdentityToRef(this._cachedReflectionTextureMatrix);\r\n (<any>this._cachedReflectionTextureMatrix)[0] = this.uScale;\r\n (<any>this._cachedReflectionTextureMatrix)[5] = this.vScale;\r\n (<any>this._cachedReflectionTextureMatrix)[12] = this.uOffset;\r\n (<any>this._cachedReflectionTextureMatrix)[13] = this.vOffset;\r\n break;\r\n }\r\n case Texture.PROJECTION_MODE: {\r\n Matrix.FromValuesToRef(0.5, 0.0, 0.0, 0.0, 0.0, -0.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.5, 0.5, 1.0, 1.0, this._projectionModeMatrix);\r\n\r\n const projectionMatrix = scene.getProjectionMatrix();\r\n this._cachedReflectionProjectionMatrixId = projectionMatrix.updateFlag;\r\n projectionMatrix.multiplyToRef(this._projectionModeMatrix, this._cachedReflectionTextureMatrix);\r\n break;\r\n }\r\n default:\r\n Matrix.IdentityToRef(this._cachedReflectionTextureMatrix);\r\n break;\r\n }\r\n\r\n if (flagMaterialsAsTextureDirty) {\r\n // We flag the materials that are using this texture as \"texture dirty\" if the coordinatesMode has changed.\r\n // Indeed, this property is used to set the value of some defines used to generate the effect (in material.isReadyForSubMesh), so we must make sure this code will be re-executed and the effect recreated if necessary\r\n scene.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag, (mat) => {\r\n return mat.hasTexture(this);\r\n });\r\n }\r\n\r\n return this._cachedReflectionTextureMatrix;\r\n }\r\n\r\n /**\r\n * Clones the texture.\r\n * @returns the cloned texture\r\n */\r\n public clone(): Texture {\r\n const options: ITextureCreationOptions = {\r\n noMipmap: this._noMipmap,\r\n invertY: this._invertY,\r\n samplingMode: this.samplingMode,\r\n onLoad: undefined,\r\n onError: undefined,\r\n buffer: this._texture ? this._texture._buffer : undefined,\r\n deleteBuffer: this._deleteBuffer,\r\n format: this.textureFormat,\r\n mimeType: this.mimeType,\r\n loaderOptions: this._loaderOptions,\r\n creationFlags: this._creationFlags,\r\n useSRGBBuffer: this._useSRGBBuffer,\r\n };\r\n\r\n return SerializationHelper.Clone(() => {\r\n return new Texture(this._texture ? this._texture.url : null, this.getScene(), options);\r\n }, this);\r\n }\r\n\r\n /**\r\n * Serialize the texture to a JSON representation we can easily use in the respective Parse function.\r\n * @returns The JSON representation of the texture\r\n */\r\n public serialize(): any {\r\n const savedName = this.name;\r\n\r\n if (!Texture.SerializeBuffers) {\r\n if (this.name.startsWith(\"data:\")) {\r\n this.name = \"\";\r\n }\r\n }\r\n\r\n if (this.name.startsWith(\"data:\") && this.url === this.name) {\r\n this.url = \"\";\r\n }\r\n\r\n const serializationObject = super.serialize(Texture._SerializeInternalTextureUniqueId);\r\n\r\n if (!serializationObject) {\r\n return null;\r\n }\r\n\r\n if (Texture.SerializeBuffers || Texture.ForceSerializeBuffers) {\r\n if (typeof this._buffer === \"string\" && (this._buffer as string).substr(0, 5) === \"data:\") {\r\n serializationObject.base64String = this._buffer;\r\n serializationObject.name = serializationObject.name.replace(\"data:\", \"\");\r\n } else if (this.url && this.url.startsWith(\"data:\") && this._buffer instanceof Uint8Array) {\r\n serializationObject.base64String = \"data:image/png;base64,\" + EncodeArrayBufferToBase64(this._buffer);\r\n } else if (Texture.ForceSerializeBuffers || (this.url && this.url.startsWith(\"blob:\")) || this._forceSerialize) {\r\n serializationObject.base64String =\r\n !this._engine || this._engine._features.supportSyncTextureRead ? GenerateBase64StringFromTexture(this) : GenerateBase64StringFromTextureAsync(this);\r\n }\r\n }\r\n\r\n serializationObject.invertY = this._invertY;\r\n serializationObject.samplingMode = this.samplingMode;\r\n serializationObject._creationFlags = this._creationFlags;\r\n serializationObject._useSRGBBuffer = this._useSRGBBuffer;\r\n if (Texture._SerializeInternalTextureUniqueId) {\r\n serializationObject.internalTextureUniqueId = this._texture?.uniqueId ?? undefined;\r\n }\r\n serializationObject.noMipmap = this._noMipmap;\r\n\r\n this.name = savedName;\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Get the current class name of the texture useful for serialization or dynamic coding.\r\n * @returns \"Texture\"\r\n */\r\n public getClassName(): string {\r\n return \"Texture\";\r\n }\r\n\r\n /**\r\n * Dispose the texture and release its associated resources.\r\n */\r\n public dispose(): void {\r\n super.dispose();\r\n\r\n this.onLoadObservable.clear();\r\n\r\n this._delayedOnLoad = null;\r\n this._delayedOnError = null;\r\n this._buffer = null;\r\n }\r\n\r\n /**\r\n * Parse the JSON representation of a texture in order to recreate the texture in the given scene.\r\n * @param parsedTexture Define the JSON representation of the texture\r\n * @param scene Define the scene the parsed texture should be instantiated in\r\n * @param rootUrl Define the root url of the parsing sequence in the case of relative dependencies\r\n * @returns The parsed texture if successful\r\n */\r\n public static Parse(parsedTexture: any, scene: Scene, rootUrl: string): Nullable<BaseTexture> {\r\n if (parsedTexture.customType) {\r\n const customTexture = InstantiationTools.Instantiate(parsedTexture.customType);\r\n // Update Sampling Mode\r\n const parsedCustomTexture: any = customTexture.Parse(parsedTexture, scene, rootUrl);\r\n if (parsedTexture.samplingMode && parsedCustomTexture.updateSamplingMode && parsedCustomTexture._samplingMode) {\r\n if (parsedCustomTexture._samplingMode !== parsedTexture.samplingMode) {\r\n parsedCustomTexture.updateSamplingMode(parsedTexture.samplingMode);\r\n }\r\n }\r\n return parsedCustomTexture;\r\n }\r\n\r\n if (parsedTexture.isCube && !parsedTexture.isRenderTarget) {\r\n return Texture._CubeTextureParser(parsedTexture, scene, rootUrl);\r\n }\r\n\r\n const hasInternalTextureUniqueId = parsedTexture.internalTextureUniqueId !== undefined;\r\n\r\n if (!parsedTexture.name && !parsedTexture.isRenderTarget && !hasInternalTextureUniqueId) {\r\n return null;\r\n }\r\n\r\n let internalTexture: InternalTexture | undefined;\r\n\r\n if (hasInternalTextureUniqueId) {\r\n const cache = scene.getEngine().getLoadedTexturesCache();\r\n for (const texture of cache) {\r\n if (texture.uniqueId === parsedTexture.internalTextureUniqueId) {\r\n internalTexture = texture;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n const onLoaded = (texture: Texture | null) => {\r\n // Clear cache\r\n if (texture && texture._texture) {\r\n texture._texture._cachedWrapU = null;\r\n texture._texture._cachedWrapV = null;\r\n texture._texture._cachedWrapR = null;\r\n }\r\n\r\n // Update Sampling Mode\r\n if (parsedTexture.samplingMode) {\r\n const sampling: number = parsedTexture.samplingMode;\r\n if (texture && texture.samplingMode !== sampling) {\r\n texture.updateSamplingMode(sampling);\r\n }\r\n }\r\n // Animations\r\n if (texture && parsedTexture.animations) {\r\n for (let animationIndex = 0; animationIndex < parsedTexture.animations.length; animationIndex++) {\r\n const parsedAnimation = parsedTexture.animations[animationIndex];\r\n const internalClass = GetClass(\"BABYLON.Animation\");\r\n if (internalClass) {\r\n texture.animations.push(internalClass.Parse(parsedAnimation));\r\n }\r\n }\r\n }\r\n\r\n if (hasInternalTextureUniqueId && !internalTexture) {\r\n texture?._texture?._setUniqueId(parsedTexture.internalTextureUniqueId);\r\n }\r\n };\r\n\r\n const texture = SerializationHelper.Parse(\r\n () => {\r\n let generateMipMaps: boolean = true;\r\n if (parsedTexture.noMipmap) {\r\n generateMipMaps = false;\r\n }\r\n if (parsedTexture.mirrorPlane) {\r\n const mirrorTexture = Texture._CreateMirror(parsedTexture.name, parsedTexture.renderTargetSize, scene, generateMipMaps);\r\n mirrorTexture._waitingRenderList = parsedTexture.renderList;\r\n mirrorTexture.mirrorPlane = Plane.FromArray(parsedTexture.mirrorPlane);\r\n onLoaded(mirrorTexture);\r\n return mirrorTexture;\r\n } else if (parsedTexture.isRenderTarget) {\r\n let renderTargetTexture: Nullable<RenderTargetTexture> = null;\r\n if (parsedTexture.isCube) {\r\n // Search for an existing reflection probe (which contains a cube render target texture)\r\n if (scene.reflectionProbes) {\r\n for (let index = 0; index < scene.reflectionProbes.length; index++) {\r\n const probe = scene.reflectionProbes[index];\r\n if (probe.name === parsedTexture.name) {\r\n return probe.cubeTexture;\r\n }\r\n }\r\n }\r\n } else {\r\n renderTargetTexture = Texture._CreateRenderTargetTexture(\r\n parsedTexture.name,\r\n parsedTexture.renderTargetSize,\r\n scene,\r\n generateMipMaps,\r\n parsedTexture._creationFlags ?? 0\r\n );\r\n renderTargetTexture._waitingRenderList = parsedTexture.renderList;\r\n }\r\n onLoaded(renderTargetTexture);\r\n return renderTargetTexture;\r\n } else if (parsedTexture.isVideo) {\r\n const texture = Texture._CreateVideoTexture(\r\n rootUrl + (parsedTexture.url || parsedTexture.name),\r\n rootUrl + (parsedTexture.src || parsedTexture.url),\r\n scene,\r\n generateMipMaps,\r\n parsedTexture.invertY,\r\n parsedTexture.samplingMode,\r\n parsedTexture.settings || {}\r\n );\r\n onLoaded(texture);\r\n return texture;\r\n } else {\r\n let texture: Texture;\r\n\r\n if (parsedTexture.base64String && !internalTexture) {\r\n // name and url are the same to ensure caching happens from the actual base64 string\r\n texture = Texture.CreateFromBase64String(\r\n parsedTexture.base64String,\r\n parsedTexture.base64String,\r\n scene,\r\n !generateMipMaps,\r\n parsedTexture.invertY,\r\n parsedTexture.samplingMode,\r\n () => {\r\n onLoaded(texture);\r\n },\r\n parsedTexture._creationFlags ?? 0,\r\n parsedTexture._useSRGBBuffer ?? false\r\n );\r\n\r\n // prettier name to fit with the loaded data\r\n texture.name = parsedTexture.name;\r\n } else {\r\n let url: string;\r\n if (parsedTexture.name && (parsedTexture.name.indexOf(\"://\") > 0 || parsedTexture.name.startsWith(\"data:\"))) {\r\n url = parsedTexture.name;\r\n } else {\r\n url = rootUrl + parsedTexture.name;\r\n }\r\n\r\n if (parsedTexture.url && (parsedTexture.url.startsWith(\"data:\") || Texture.UseSerializedUrlIfAny)) {\r\n url = parsedTexture.url;\r\n }\r\n\r\n const options: ITextureCreationOptions = {\r\n noMipmap: !generateMipMaps,\r\n invertY: parsedTexture.invertY,\r\n samplingMode: parsedTexture.samplingMode,\r\n onLoad: () => {\r\n onLoaded(texture);\r\n },\r\n internalTexture,\r\n };\r\n\r\n texture = new Texture(url, scene, options);\r\n }\r\n\r\n return texture;\r\n }\r\n },\r\n parsedTexture,\r\n scene\r\n );\r\n\r\n return texture;\r\n }\r\n\r\n /**\r\n * Creates a texture from its base 64 representation.\r\n * @param data Define the base64 payload without the data: prefix\r\n * @param name Define the name of the texture in the scene useful fo caching purpose for instance\r\n * @param scene Define the scene the texture should belong to\r\n * @param noMipmapOrOptions defines if the texture will require mip maps or not or set of all options to create the texture\r\n * @param invertY define if the texture needs to be inverted on the y axis during loading\r\n * @param samplingMode define the sampling mode we want for the texture while fetching from it (Texture.NEAREST_SAMPLINGMODE...)\r\n * @param onLoad define a callback triggered when the texture has been loaded\r\n * @param onError define a callback triggered when an error occurred during the loading session\r\n * @param format define the format of the texture we are trying to load (Engine.TEXTUREFORMAT_RGBA...)\r\n * @param creationFlags specific flags to use when creating the texture (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg)\r\n * @param forcedExtension defines the extension to use to pick the right loader\r\n * @returns the created texture\r\n */\r\n public static CreateFromBase64String(\r\n data: string,\r\n name: string,\r\n scene: Scene,\r\n noMipmapOrOptions?: boolean | ITextureCreationOptions,\r\n invertY?: boolean,\r\n samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE,\r\n onLoad: Nullable<() => void> = null,\r\n onError: Nullable<() => void> = null,\r\n format: number = Constants.TEXTUREFORMAT_RGBA,\r\n creationFlags?: number,\r\n forcedExtension?: string\r\n ): Texture {\r\n return new Texture(\r\n \"data:\" + name,\r\n scene,\r\n noMipmapOrOptions,\r\n invertY,\r\n samplingMode,\r\n onLoad,\r\n onError,\r\n data,\r\n false,\r\n format,\r\n undefined,\r\n undefined,\r\n creationFlags,\r\n forcedExtension\r\n );\r\n }\r\n\r\n /**\r\n * Creates a texture from its data: representation. (data: will be added in case only the payload has been passed in)\r\n * @param name Define the name of the texture in the scene useful fo caching purpose for instance\r\n * @param buffer define the buffer to load the texture from in case the texture is loaded from a buffer representation\r\n * @param scene Define the scene the texture should belong to\r\n * @param deleteBuffer define if the buffer we are loading the texture from should be deleted after load\r\n * @param noMipmapOrOptions defines if the texture will require mip maps or not or set of all options to create the texture\r\n * @param invertY define if the texture needs to be inverted on the y axis during loading\r\n * @param samplingMode define the sampling mode we want for the texture while fetching from it (Texture.NEAREST_SAMPLINGMODE...)\r\n * @param onLoad define a callback triggered when the texture has been loaded\r\n * @param onError define a callback triggered when an error occurred during the loading session\r\n * @param format define the format of the texture we are trying to load (Engine.TEXTUREFORMAT_RGBA...)\r\n * @param creationFlags specific flags to use when creating the texture (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg)\r\n * @param forcedExtension defines the extension to use to pick the right loader\r\n * @returns the created texture\r\n */\r\n public static LoadFromDataString(\r\n name: string,\r\n buffer: any,\r\n scene: Scene,\r\n deleteBuffer: boolean = false,\r\n noMipmapOrOptions?: boolean | ITextureCreationOptions,\r\n invertY: boolean = true,\r\n samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE,\r\n onLoad: Nullable<() => void> = null,\r\n onError: Nullable<(message?: string, exception?: any) => void> = null,\r\n format: number = Constants.TEXTUREFORMAT_RGBA,\r\n creationFlags?: number,\r\n forcedExtension?: string\r\n ): Texture {\r\n if (name.substr(0, 5) !== \"data:\") {\r\n name = \"data:\" + name;\r\n }\r\n\r\n return new Texture(\r\n name,\r\n scene,\r\n noMipmapOrOptions,\r\n invertY,\r\n samplingMode,\r\n onLoad,\r\n onError,\r\n buffer,\r\n deleteBuffer,\r\n format,\r\n undefined,\r\n undefined,\r\n creationFlags,\r\n forcedExtension\r\n );\r\n }\r\n}\r\n\r\n// References the dependencies.\r\nRegisterClass(\"BABYLON.Texture\", Texture);\r\nSerializationHelper._TextureParser = Texture.Parse;\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"thinTexture.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/Textures/thinTexture.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAGpD,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAK7C;;;GAGG;AACH,MAAM,OAAO,WAAW;IAEpB;;;;;;OAMG;IACH,IAAW,KAAK;QACZ,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAED,IAAW,KAAK,CAAC,KAAa;QAC1B,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACxB,CAAC;IAGD;;;;;;OAMG;IACH,IAAW,KAAK;QACZ,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAED,IAAW,KAAK,CAAC,KAAa;QAC1B,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACxB,CAAC;IAuBD;;;OAGG;IACH,IAAW,eAAe;QACtB,OAAO,CAAC,CAAC;IACb,CAAC;IAED;;OAEG;IACH,IAAW,MAAM;QACb,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YAChB,OAAO,KAAK,CAAC;SAChB;QAED,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;IAChC,CAAC;IAED,gEAAgE;IAChE,IAAc,MAAM,CAAC,KAAc;QAC/B,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YAChB,OAAO;SACV;QAED,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,KAAK,CAAC;IACjC,CAAC;IAED;;OAEG;I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AC,YAAY,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;SACvE;IACL,CAAC;IAED;;OAEG;IACI,sBAAsB;QACzB,IAAI,IAAI,CAAC,QAAQ,EAAE;YACf,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;YACxB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;SACxB;IACL,CAAC;IAED;;OAEG;IACI,OAAO;QACV,IAAI,IAAI,CAAC,QAAQ,EAAE;YACf,IAAI,CAAC,sBAAsB,EAAE,CAAC;YAC9B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;SACvB;IACL,CAAC;CACJ","sourcesContent":["import type { Nullable } from \"../../types\";\r\nimport type { InternalTexture } from \"../../Materials/Textures/internalTexture\";\r\nimport { Constants } from \"../../Engines/constants\";\r\n\r\nimport type { ISize } from \"../../Maths/math.size\";\r\nimport { Size } from \"../../Maths/math.size\";\r\n\r\nimport type { ThinEngine } from \"../../Engines/thinEngine\";\r\nimport type { RenderTargetWrapper } from \"core/Engines/renderTargetWrapper\";\r\n\r\n/**\r\n * Base class of all the textures in babylon.\r\n * It groups all the common properties required to work with Thin Engine.\r\n */\r\nexport class ThinTexture {\r\n protected _wrapU = Constants.TEXTURE_WRAP_ADDRESSMODE;\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 public get wrapU() {\r\n return this._wrapU;\r\n }\r\n\r\n public set wrapU(value: number) {\r\n this._wrapU = value;\r\n }\r\n\r\n protected _wrapV = Constants.TEXTURE_WRAP_ADDRESSMODE;\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 public get wrapV() {\r\n return this._wrapV;\r\n }\r\n\r\n public 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 public 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 public anisotropicFilteringLevel = 4;\r\n\r\n /**\r\n * Define the current state of the loading sequence when in delayed load mode.\r\n */\r\n public delayLoadState = Constants.DELAYLOADSTATE_NONE;\r\n\r\n /**\r\n * How a texture is mapped.\r\n * Unused in thin texture mode.\r\n */\r\n public get coordinatesMode(): number {\r\n return 0;\r\n }\r\n\r\n /**\r\n * Define if the texture is a cube texture or if false a 2d texture.\r\n */\r\n public get isCube(): boolean {\r\n if (!this._texture) {\r\n return false;\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 set isCube(value: boolean) {\r\n if (!this._texture) {\r\n return;\r\n }\r\n\r\n this._texture.isCube = value;\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 public 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 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 public 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 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 /**\r\n * Get the class name of the texture.\r\n * @returns \"ThinTexture\"\r\n */\r\n public getClassName(): string {\r\n return \"ThinTexture\";\r\n }\r\n\r\n /** @internal */\r\n public _texture: Nullable<InternalTexture> = null;\r\n\r\n protected _engine: Nullable<ThinEngine> = null;\r\n\r\n private _cachedSize: ISize = Size.Zero();\r\n private _cachedBaseSize: ISize = Size.Zero();\r\n\r\n private static _IsRenderTargetWrapper(texture: Nullable<InternalTexture> | Nullable<RenderTargetWrapper>): texture is RenderTargetWrapper {\r\n return (texture as RenderTargetWrapper)?._shareDepth !== undefined;\r\n }\r\n\r\n /**\r\n * Instantiates a new ThinTexture.\r\n * Base class of all the textures in babylon.\r\n * This can be used as an internal texture wrapper in ThinEngine to benefit from the cache\r\n * @param internalTexture Define the internalTexture to wrap. You can also pass a RenderTargetWrapper, in which case the texture will be the render target's texture\r\n */\r\n constructor(internalTexture: Nullable<InternalTexture | RenderTargetWrapper>) {\r\n this._texture = ThinTexture._IsRenderTargetWrapper(internalTexture) ? internalTexture.texture : internalTexture;\r\n if (this._texture) {\r\n this._engine = this._texture.getEngine();\r\n }\r\n }\r\n\r\n /**\r\n * Get if the texture is ready to be used (downloaded, converted, mip mapped...).\r\n * @returns true if fully ready\r\n */\r\n public isReady(): boolean {\r\n if (this.delayLoadState === Constants.DELAYLOADSTATE_NOTLOADED) {\r\n this.delayLoad();\r\n return false;\r\n }\r\n\r\n if (this._texture) {\r\n return this._texture.isReady;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Triggers the load sequence in delayed load mode.\r\n */\r\n public delayLoad(): void {}\r\n\r\n /**\r\n * Get the underlying lower level texture from Babylon.\r\n * @returns the internal texture\r\n */\r\n public getInternalTexture(): Nullable<InternalTexture> {\r\n return this._texture;\r\n }\r\n\r\n /**\r\n * Get the size of the texture.\r\n * @returns the texture size.\r\n */\r\n public getSize(): ISize {\r\n if (this._texture) {\r\n if (this._texture.width) {\r\n this._cachedSize.width = this._texture.width;\r\n this._cachedSize.height = this._texture.height;\r\n return this._cachedSize;\r\n }\r\n\r\n if (this._texture._size) {\r\n this._cachedSize.width = this._texture._size;\r\n this._cachedSize.height = this._texture._size;\r\n return this._cachedSize;\r\n }\r\n }\r\n\r\n return this._cachedSize;\r\n }\r\n\r\n /**\r\n * Get the base size of the texture.\r\n * It can be different from the size if the texture has been resized for POT for instance\r\n * @returns the base size\r\n */\r\n public getBaseSize(): ISize {\r\n if (!this.isReady() || !this._texture) {\r\n this._cachedBaseSize.width = 0;\r\n this._cachedBaseSize.height = 0;\r\n return this._cachedBaseSize;\r\n }\r\n\r\n if (this._texture._size) {\r\n this._cachedBaseSize.width = this._texture._size;\r\n this._cachedBaseSize.height = this._texture._size;\r\n return this._cachedBaseSize;\r\n }\r\n\r\n this._cachedBaseSize.width = this._texture.baseWidth;\r\n this._cachedBaseSize.height = this._texture.baseHeight;\r\n return this._cachedBaseSize;\r\n }\r\n\r\n /** @internal */\r\n protected _initialSamplingMode = Constants.TEXTURE_BILINEAR_SAMPLINGMODE;\r\n\r\n /**\r\n * Get the current sampling mode associated with the texture.\r\n */\r\n public get samplingMode(): number {\r\n if (!this._texture) {\r\n return this._initialSamplingMode;\r\n }\r\n\r\n return this._texture.samplingMode;\r\n }\r\n\r\n /**\r\n * Update the sampling mode of the texture.\r\n * Default is Trilinear mode.\r\n *\r\n * | Value | Type | Description |\r\n * | ----- | ------------------ | ----------- |\r\n * | 1 | NEAREST_SAMPLINGMODE or NEAREST_NEAREST_MIPLINEAR | Nearest is: mag = nearest, min = nearest, mip = linear |\r\n * | 2 | BILINEAR_SAMPLINGMODE or LINEAR_LINEAR_MIPNEAREST | Bilinear is: mag = linear, min = linear, mip = nearest |\r\n * | 3 | TRILINEAR_SAMPLINGMODE or LINEAR_LINEAR_MIPLINEAR | Trilinear is: mag = linear, min = linear, mip = linear |\r\n * | 4 | NEAREST_NEAREST_MIPNEAREST | |\r\n * | 5 | NEAREST_LINEAR_MIPNEAREST | |\r\n * | 6 | NEAREST_LINEAR_MIPLINEAR | |\r\n * | 7 | NEAREST_LINEAR | |\r\n * | 8 | NEAREST_NEAREST | |\r\n * | 9 | LINEAR_NEAREST_MIPNEAREST | |\r\n * | 10 | LINEAR_NEAREST_MIPLINEAR | |\r\n * | 11 | LINEAR_LINEAR | |\r\n * | 12 | LINEAR_NEAREST | |\r\n *\r\n * > _mag_: magnification filter (close to the viewer)\r\n * > _min_: minification filter (far from the viewer)\r\n * > _mip_: filter used between mip map levels\r\n *@param samplingMode Define the new sampling mode of the texture\r\n */\r\n public updateSamplingMode(samplingMode: number): void {\r\n if (this._texture && this._engine) {\r\n this._engine.updateTextureSamplingMode(samplingMode, this._texture);\r\n }\r\n }\r\n\r\n /**\r\n * Release and destroy the underlying lower level texture aka internalTexture.\r\n */\r\n public releaseInternalTexture(): void {\r\n if (this._texture) {\r\n this._texture.dispose();\r\n this._texture = null;\r\n }\r\n }\r\n\r\n /**\r\n * Dispose the texture and release its associated resources.\r\n */\r\n public dispose(): void {\r\n if (this._texture) {\r\n this.releaseInternalTexture();\r\n this._engine = null;\r\n }\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"thinTexture.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/Textures/thinTexture.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAGpD,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAK7C;;;GAGG;AACH,MAAM,OAAO,WAAW;IAEpB;;;;;;OAMG;IACH,IAAW,KAAK;QACZ,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAED,IAAW,KAAK,CAAC,KAAa;QAC1B,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACxB,CA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AAI,CAAC,eAAe,CAAC;SAC/B;QAED,IAAI,CAAC,eAAe,CAAC,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC;QACrD,IAAI,CAAC,eAAe,CAAC,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC;QACvD,OAAO,IAAI,CAAC,eAAe,CAAC;IAChC,CAAC;IAKD;;OAEG;IACH,IAAW,YAAY;QACnB,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YAChB,OAAO,IAAI,CAAC,oBAAoB,CAAC;SACpC;QAED,OAAO,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC;IACtC,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACI,kBAAkB,CAAC,YAAoB;QAC1C,IAAI,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,OAAO,EAAE;YAC/B,IAAI,CAAC,OAAO,CAAC,yBAAyB,CAAC,YAAY,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;SACvE;IACL,CAAC;IAED;;OAEG;IACI,sBAAsB;QACzB,IAAI,IAAI,CAAC,QAAQ,EAAE;YACf,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;YACxB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;SACxB;IACL,CAAC;IAED;;OAEG;IACI,OAAO;QACV,IAAI,IAAI,CAAC,QAAQ,EAAE;YACf,IAAI,CAAC,sBAAsB,EAAE,CAAC;YAC9B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;SACvB;IACL,CAAC;CACJ","sourcesContent":["import type { Nullable } from \"../../types\";\r\nimport type { InternalTexture } from \"../../Materials/Textures/internalTexture\";\r\nimport { Constants } from \"../../Engines/constants\";\r\n\r\nimport type { ISize } from \"../../Maths/math.size\";\r\nimport { Size } from \"../../Maths/math.size\";\r\n\r\nimport type { ThinEngine } from \"../../Engines/thinEngine\";\r\nimport type { RenderTargetWrapper } from \"core/Engines/renderTargetWrapper\";\r\n\r\n/**\r\n * Base class of all the textures in babylon.\r\n * It groups all the common properties required to work with Thin Engine.\r\n */\r\nexport class ThinTexture {\r\n protected _wrapU = Constants.TEXTURE_WRAP_ADDRESSMODE;\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 public get wrapU() {\r\n return this._wrapU;\r\n }\r\n\r\n public set wrapU(value: number) {\r\n this._wrapU = value;\r\n }\r\n\r\n protected _wrapV = Constants.TEXTURE_WRAP_ADDRESSMODE;\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 public get wrapV() {\r\n return this._wrapV;\r\n }\r\n\r\n public 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 public 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 public anisotropicFilteringLevel = 4;\r\n\r\n /**\r\n * Define the current state of the loading sequence when in delayed load mode.\r\n */\r\n public delayLoadState = Constants.DELAYLOADSTATE_NONE;\r\n\r\n /**\r\n * How a texture is mapped.\r\n * Unused in thin texture mode.\r\n */\r\n public get coordinatesMode(): number {\r\n return 0;\r\n }\r\n\r\n /**\r\n * Define if the texture is a cube texture or if false a 2d texture.\r\n */\r\n public get isCube(): boolean {\r\n if (!this._texture) {\r\n return false;\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 set isCube(value: boolean) {\r\n if (!this._texture) {\r\n return;\r\n }\r\n\r\n this._texture.isCube = value;\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 public 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 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 public 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 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 /**\r\n * Get the class name of the texture.\r\n * @returns \"ThinTexture\"\r\n */\r\n public getClassName(): string {\r\n return \"ThinTexture\";\r\n }\r\n\r\n /** @internal */\r\n public _texture: Nullable<InternalTexture> = null;\r\n\r\n protected _engine: Nullable<ThinEngine> = null;\r\n\r\n private _cachedSize: ISize = Size.Zero();\r\n private _cachedBaseSize: ISize = Size.Zero();\r\n\r\n private static _IsRenderTargetWrapper(texture: Nullable<InternalTexture> | Nullable<RenderTargetWrapper>): texture is RenderTargetWrapper {\r\n return (texture as RenderTargetWrapper)?.shareDepth !== undefined;\r\n }\r\n\r\n /**\r\n * Instantiates a new ThinTexture.\r\n * Base class of all the textures in babylon.\r\n * This can be used as an internal texture wrapper in ThinEngine to benefit from the cache\r\n * @param internalTexture Define the internalTexture to wrap. You can also pass a RenderTargetWrapper, in which case the texture will be the render target's texture\r\n */\r\n constructor(internalTexture: Nullable<InternalTexture | RenderTargetWrapper>) {\r\n this._texture = ThinTexture._IsRenderTargetWrapper(internalTexture) ? internalTexture.texture : internalTexture;\r\n if (this._texture) {\r\n this._engine = this._texture.getEngine();\r\n }\r\n }\r\n\r\n /**\r\n * Get if the texture is ready to be used (downloaded, converted, mip mapped...).\r\n * @returns true if fully ready\r\n */\r\n public isReady(): boolean {\r\n if (this.delayLoadState === Constants.DELAYLOADSTATE_NOTLOADED) {\r\n this.delayLoad();\r\n return false;\r\n }\r\n\r\n if (this._texture) {\r\n return this._texture.isReady;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Triggers the load sequence in delayed load mode.\r\n */\r\n public delayLoad(): void {}\r\n\r\n /**\r\n * Get the underlying lower level texture from Babylon.\r\n * @returns the internal texture\r\n */\r\n public getInternalTexture(): Nullable<InternalTexture> {\r\n return this._texture;\r\n }\r\n\r\n /**\r\n * Get the size of the texture.\r\n * @returns the texture size.\r\n */\r\n public getSize(): ISize {\r\n if (this._texture) {\r\n if (this._texture.width) {\r\n this._cachedSize.width = this._texture.width;\r\n this._cachedSize.height = this._texture.height;\r\n return this._cachedSize;\r\n }\r\n\r\n if (this._texture._size) {\r\n this._cachedSize.width = this._texture._size;\r\n this._cachedSize.height = this._texture._size;\r\n return this._cachedSize;\r\n }\r\n }\r\n\r\n return this._cachedSize;\r\n }\r\n\r\n /**\r\n * Get the base size of the texture.\r\n * It can be different from the size if the texture has been resized for POT for instance\r\n * @returns the base size\r\n */\r\n public getBaseSize(): ISize {\r\n if (!this.isReady() || !this._texture) {\r\n this._cachedBaseSize.width = 0;\r\n this._cachedBaseSize.height = 0;\r\n return this._cachedBaseSize;\r\n }\r\n\r\n if (this._texture._size) {\r\n this._cachedBaseSize.width = this._texture._size;\r\n this._cachedBaseSize.height = this._texture._size;\r\n return this._cachedBaseSize;\r\n }\r\n\r\n this._cachedBaseSize.width = this._texture.baseWidth;\r\n this._cachedBaseSize.height = this._texture.baseHeight;\r\n return this._cachedBaseSize;\r\n }\r\n\r\n /** @internal */\r\n protected _initialSamplingMode = Constants.TEXTURE_BILINEAR_SAMPLINGMODE;\r\n\r\n /**\r\n * Get the current sampling mode associated with the texture.\r\n */\r\n public get samplingMode(): number {\r\n if (!this._texture) {\r\n return this._initialSamplingMode;\r\n }\r\n\r\n return this._texture.samplingMode;\r\n }\r\n\r\n /**\r\n * Update the sampling mode of the texture.\r\n * Default is Trilinear mode.\r\n *\r\n * | Value | Type | Description |\r\n * | ----- | ------------------ | ----------- |\r\n * | 1 | NEAREST_SAMPLINGMODE or NEAREST_NEAREST_MIPLINEAR | Nearest is: mag = nearest, min = nearest, mip = linear |\r\n * | 2 | BILINEAR_SAMPLINGMODE or LINEAR_LINEAR_MIPNEAREST | Bilinear is: mag = linear, min = linear, mip = nearest |\r\n * | 3 | TRILINEAR_SAMPLINGMODE or LINEAR_LINEAR_MIPLINEAR | Trilinear is: mag = linear, min = linear, mip = linear |\r\n * | 4 | NEAREST_NEAREST_MIPNEAREST | |\r\n * | 5 | NEAREST_LINEAR_MIPNEAREST | |\r\n * | 6 | NEAREST_LINEAR_MIPLINEAR | |\r\n * | 7 | NEAREST_LINEAR | |\r\n * | 8 | NEAREST_NEAREST | |\r\n * | 9 | LINEAR_NEAREST_MIPNEAREST | |\r\n * | 10 | LINEAR_NEAREST_MIPLINEAR | |\r\n * | 11 | LINEAR_LINEAR | |\r\n * | 12 | LINEAR_NEAREST | |\r\n *\r\n * > _mag_: magnification filter (close to the viewer)\r\n * > _min_: minification filter (far from the viewer)\r\n * > _mip_: filter used between mip map levels\r\n *@param samplingMode Define the new sampling mode of the texture\r\n */\r\n public updateSamplingMode(samplingMode: number): void {\r\n if (this._texture && this._engine) {\r\n this._engine.updateTextureSamplingMode(samplingMode, this._texture);\r\n }\r\n }\r\n\r\n /**\r\n * Release and destroy the underlying lower level texture aka internalTexture.\r\n */\r\n public releaseInternalTexture(): void {\r\n if (this._texture) {\r\n this._texture.dispose();\r\n this._texture = null;\r\n }\r\n }\r\n\r\n /**\r\n * Dispose the texture and release its associated resources.\r\n */\r\n public dispose(): void {\r\n if (this._texture) {\r\n this.releaseInternalTexture();\r\n this._engine = null;\r\n }\r\n }\r\n}\r\n"]}
|
package/Maths/math.vector.d.ts
CHANGED
|
@@ -3441,7 +3441,19 @@ export declare class Matrix implements Tensor<Tuple<Tuple<number, 4>, 4>>, IMatr
|
|
|
3441
3441
|
* @returns a new matrix set with the multiplication result of the current Matrix and the given one
|
|
3442
3442
|
*/
|
|
3443
3443
|
multiply(other: DeepImmutable<Matrix>): this;
|
|
3444
|
+
/**
|
|
3445
|
+
* This method performs component-by-component in-place multiplication, rather than true matrix multiplication.
|
|
3446
|
+
* Use multiply or multiplyToRef for matrix multiplication.
|
|
3447
|
+
* @param other defines the second operand
|
|
3448
|
+
* @returns the current updated matrix
|
|
3449
|
+
*/
|
|
3444
3450
|
multiplyInPlace(other: DeepImmutable<this>): this;
|
|
3451
|
+
/**
|
|
3452
|
+
* This method performs a component-by-component multiplication of the current matrix with the array of transmitted numbers.
|
|
3453
|
+
* Use multiply or multiplyToRef for matrix multiplication.
|
|
3454
|
+
* @param floats defines the array of numbers to multiply the matrix by
|
|
3455
|
+
* @returns the current updated matrix
|
|
3456
|
+
*/
|
|
3445
3457
|
multiplyByFloats(...floats: Tuple<number, 16>): this;
|
|
3446
3458
|
/**
|
|
3447
3459
|
* Multiples the current matrix by the given floats and stores them in the given ref
|
package/Maths/math.vector.js
CHANGED
|
@@ -2453,7 +2453,10 @@ export class Vector3 {
|
|
|
2453
2453
|
const cx = viewport.x;
|
|
2454
2454
|
const cy = viewport.y;
|
|
2455
2455
|
const viewportMatrix = MathTmp.Matrix[1];
|
|
2456
|
-
|
|
2456
|
+
const isNDCHalfZRange = EngineStore.LastCreatedEngine?.isNDCHalfZRange;
|
|
2457
|
+
const zScale = isNDCHalfZRange ? 1 : 0.5;
|
|
2458
|
+
const zOffset = isNDCHalfZRange ? 0 : 0.5;
|
|
2459
|
+
Matrix.FromValuesToRef(cw / 2.0, 0, 0, 0, 0, -ch / 2.0, 0, 0, 0, 0, zScale, 0, cx + cw / 2.0, ch / 2.0 + cy, zOffset, 1, viewportMatrix);
|
|
2457
2460
|
const matrix = MathTmp.Matrix[0];
|
|
2458
2461
|
world.multiplyToRef(transform, matrix);
|
|
2459
2462
|
matrix.multiplyToRef(viewportMatrix, matrix);
|
|
@@ -5632,6 +5635,12 @@ export class Matrix {
|
|
|
5632
5635
|
this.multiplyToRef(other, result);
|
|
5633
5636
|
return result;
|
|
5634
5637
|
}
|
|
5638
|
+
/**
|
|
5639
|
+
* This method performs component-by-component in-place multiplication, rather than true matrix multiplication.
|
|
5640
|
+
* Use multiply or multiplyToRef for matrix multiplication.
|
|
5641
|
+
* @param other defines the second operand
|
|
5642
|
+
* @returns the current updated matrix
|
|
5643
|
+
*/
|
|
5635
5644
|
multiplyInPlace(other) {
|
|
5636
5645
|
const m = this._m, otherM = other.m;
|
|
5637
5646
|
for (let i = 0; i < 16; i++) {
|
|
@@ -5640,10 +5649,16 @@ export class Matrix {
|
|
|
5640
5649
|
this.markAsUpdated();
|
|
5641
5650
|
return this;
|
|
5642
5651
|
}
|
|
5652
|
+
/**
|
|
5653
|
+
* This method performs a component-by-component multiplication of the current matrix with the array of transmitted numbers.
|
|
5654
|
+
* Use multiply or multiplyToRef for matrix multiplication.
|
|
5655
|
+
* @param floats defines the array of numbers to multiply the matrix by
|
|
5656
|
+
* @returns the current updated matrix
|
|
5657
|
+
*/
|
|
5643
5658
|
multiplyByFloats(...floats) {
|
|
5644
5659
|
const m = this._m;
|
|
5645
5660
|
for (let i = 0; i < 16; i++) {
|
|
5646
|
-
m[i]
|
|
5661
|
+
m[i] *= floats[i];
|
|
5647
5662
|
}
|
|
5648
5663
|
this.markAsUpdated();
|
|
5649
5664
|
return this;
|