@babylonjs/core 5.26.0 → 5.27.0
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/Debug/debugLayer.d.ts +3 -3
- package/Debug/debugLayer.js +2 -2
- package/Debug/debugLayer.js.map +1 -1
- package/Engines/thinEngine.js +6 -6
- package/Engines/thinEngine.js.map +1 -1
- package/Inputs/scene.inputManager.js +1 -1
- package/Inputs/scene.inputManager.js.map +1 -1
- package/Layers/glowLayer.d.ts +5 -0
- package/Layers/glowLayer.js +21 -8
- package/Layers/glowLayer.js.map +1 -1
- package/Loading/Plugins/babylonFileLoader.js +3 -3
- package/Loading/Plugins/babylonFileLoader.js.map +1 -1
- package/Materials/Node/nodeMaterialBlockConnectionPoint.d.ts +1 -2
- package/Materials/Node/nodeMaterialBlockConnectionPoint.js.map +1 -1
- package/Materials/PBR/pbrAnisotropicConfiguration.js +2 -0
- package/Materials/PBR/pbrAnisotropicConfiguration.js.map +1 -1
- package/Materials/PBR/pbrClearCoatConfiguration.js +7 -0
- package/Materials/PBR/pbrClearCoatConfiguration.js.map +1 -1
- package/Materials/PBR/pbrIridescenceConfiguration.js +2 -0
- package/Materials/PBR/pbrIridescenceConfiguration.js.map +1 -1
- package/Materials/PBR/pbrSheenConfiguration.js +3 -0
- package/Materials/PBR/pbrSheenConfiguration.js.map +1 -1
- package/Materials/PBR/pbrSubSurfaceConfiguration.js +22 -0
- package/Materials/PBR/pbrSubSurfaceConfiguration.js.map +1 -1
- package/Materials/Textures/texture.d.ts +7 -2
- package/Materials/Textures/texture.js +33 -28
- package/Materials/Textures/texture.js.map +1 -1
- package/Maths/math.polar.d.ts +2 -2
- package/Maths/math.polar.js +4 -4
- package/Maths/math.polar.js.map +1 -1
- package/Maths/math.vector.d.ts +62 -1
- package/Maths/math.vector.js +62 -1
- package/Maths/math.vector.js.map +1 -1
- package/Meshes/abstractMesh.d.ts +8 -0
- package/Meshes/abstractMesh.js +12 -0
- package/Meshes/abstractMesh.js.map +1 -1
- package/Meshes/mesh.js +4 -1
- package/Meshes/mesh.js.map +1 -1
- package/Meshes/transformNode.js +4 -3
- package/Meshes/transformNode.js.map +1 -1
- package/Misc/screenshotTools.js +2 -12
- package/Misc/screenshotTools.js.map +1 -1
- package/Misc/tools.d.ts +2 -8
- package/Misc/tools.js +2 -2
- package/Misc/tools.js.map +1 -1
- package/PostProcesses/blackAndWhitePostProcess.d.ts +1 -1
- package/PostProcesses/blackAndWhitePostProcess.js.map +1 -1
- package/PostProcesses/colorCorrectionPostProcess.d.ts +1 -1
- package/PostProcesses/colorCorrectionPostProcess.js +2 -1
- package/PostProcesses/colorCorrectionPostProcess.js.map +1 -1
- package/PostProcesses/refractionPostProcess.d.ts +2 -1
- package/PostProcesses/refractionPostProcess.js.map +1 -1
- package/PostProcesses/tonemapPostProcess.d.ts +2 -1
- package/PostProcesses/tonemapPostProcess.js.map +1 -1
- package/PostProcesses/volumetricLightScatteringPostProcess.d.ts +2 -1
- package/PostProcesses/volumetricLightScatteringPostProcess.js +1 -1
- package/PostProcesses/volumetricLightScatteringPostProcess.js.map +1 -1
- package/PostProcesses/vrDistortionCorrectionPostProcess.d.ts +2 -1
- package/PostProcesses/vrDistortionCorrectionPostProcess.js.map +1 -1
- package/PostProcesses/vrMultiviewToSingleviewPostProcess.d.ts +2 -1
- package/PostProcesses/vrMultiviewToSingleviewPostProcess.js +3 -2
- package/PostProcesses/vrMultiviewToSingleviewPostProcess.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"texture.js","sourceRoot":"","sources":["../../../../../../lts/core/generated/Materials/Textures/texture.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,yBAAyB,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hD;IADC,SAAS,EAAE;yCAGX;AAwwBL,+BAA+B;AAC/B,aAAa,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC;AAC1C,mBAAmB,CAAC,cAAc,GAAG,OAAO,CAAC,KAAK,CAAC","sourcesContent":["import { serialize, SerializationHelper } 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\ndeclare type CubeTexture = import(\"../../Materials/Textures/cubeTexture\").CubeTexture;\r\ndeclare type MirrorTexture = import(\"../../Materials/Textures/mirrorTexture\").MirrorTexture;\r\ndeclare type RenderTargetTexture = import(\"../../Materials/Textures/renderTargetTexture\").RenderTargetTexture;\r\ndeclare type Scene = import(\"../../scene\").Scene;\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\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/babylon101/materials#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 /**\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 /** nearest is mag = nearest and min = nearest and mip = linear */\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 mip = nearest */\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/how_to/more_materials#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/how_to/more_materials#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/how_to/more_materials#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/how_to/more_materials#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/how_to/more_materials\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/how_to/more_materials\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/how_to/more_materials\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/how_to/debug_layer#extensibility\r\n */\r\n public inspectableCustomProperties: Nullable<IInspectable[]> = null;\r\n\r\n private _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 _cachedProjectionMatrixId: 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 _cachedCoordinatesMode: number = -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 private _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/babylon101/materials#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\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 } else {\r\n noMipmap = !!noMipmapOrOptions;\r\n }\r\n\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) {\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);\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(url: string, buffer: Nullable<string | ArrayBuffer | ArrayBufferView | HTMLImageElement | Blob> = null, onLoad?: () => void, forcedExtension?: string): void {\r\n if (this.url) {\r\n this.releaseInternalTexture();\r\n this.getScene()!.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag);\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);\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\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 if (this.optimizeUVAllocation) {\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 MaterialHelper.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._cachedTextureMatrix!;\r\n }\r\n\r\n if (\r\n this.uOffset === this._cachedUOffset &&\r\n this.vOffset === this._cachedVOffset &&\r\n this.uScale === this._cachedUScale &&\r\n this.vScale === this._cachedVScale &&\r\n this.coordinatesMode === this._cachedCoordinatesMode\r\n ) {\r\n if (this.coordinatesMode === Texture.PROJECTION_MODE) {\r\n if (this._cachedProjectionMatrixId === scene.getProjectionMatrix().updateFlag) {\r\n return this._cachedTextureMatrix!;\r\n }\r\n } else {\r\n return this._cachedTextureMatrix!;\r\n }\r\n }\r\n\r\n if (!this._cachedTextureMatrix) {\r\n this._cachedTextureMatrix = 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._cachedCoordinatesMode !== this.coordinatesMode;\r\n\r\n this._cachedUOffset = this.uOffset;\r\n this._cachedVOffset = this.vOffset;\r\n this._cachedUScale = this.uScale;\r\n this._cachedVScale = this.vScale;\r\n this._cachedCoordinatesMode = this.coordinatesMode;\r\n\r\n switch (this.coordinatesMode) {\r\n case Texture.PLANAR_MODE: {\r\n Matrix.IdentityToRef(this._cachedTextureMatrix);\r\n (<any>this._cachedTextureMatrix)[0] = this.uScale;\r\n (<any>this._cachedTextureMatrix)[5] = this.vScale;\r\n (<any>this._cachedTextureMatrix)[12] = this.uOffset;\r\n (<any>this._cachedTextureMatrix)[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._cachedProjectionMatrixId = projectionMatrix.updateFlag;\r\n projectionMatrix.multiplyToRef(this._projectionModeMatrix, this._cachedTextureMatrix);\r\n break;\r\n }\r\n default:\r\n Matrix.IdentityToRef(this._cachedTextureMatrix);\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.getActiveTextures().indexOf(this) !== -1;\r\n });\r\n }\r\n\r\n return this._cachedTextureMatrix;\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();\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\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 }\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 if (!parsedTexture.name && !parsedTexture.isRenderTarget) {\r\n return null;\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\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 {\r\n let texture: Texture;\r\n\r\n if (parsedTexture.base64String) {\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) {\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 texture = new Texture(url, scene, !generateMipMaps, parsedTexture.invertY, parsedTexture.samplingMode, () => {\r\n onLoaded(texture);\r\n });\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 * @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 ): Texture {\r\n return new Texture(\"data:\" + name, scene, noMipmapOrOptions, invertY, samplingMode, onLoad, onError, data, false, format, undefined, undefined, creationFlags);\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 * @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 ): Texture {\r\n if (name.substr(0, 5) !== \"data:\") {\r\n name = \"data:\" + name;\r\n }\r\n\r\n return new Texture(name, scene, noMipmapOrOptions, invertY, samplingMode, onLoad, onError, buffer, deleteBuffer, format, undefined, undefined, creationFlags);\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":["../../../../../../lts/core/generated/Materials/Textures/texture.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACvE,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,O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CAAC,uBAAuB,CAAC;AAC3E,qCAAqC;AACd,mBAAW,GAAG,SAAS,CAAC,mBAAmB,CAAC;AACnE,qCAAqC;AACd,qBAAa,GAAG,SAAS,CAAC,qBAAqB,CAAC;AACvE,uCAAuC;AAChB,4BAAoB,GAAG,SAAS,CAAC,4BAA4B,CAAC;AACrF,6CAA6C;AACtB,kCAA0B,GAAG,SAAS,CAAC,kCAAkC,CAAC;AACjG,sDAAsD;AAC/B,2CAAmC,GAAG,SAAS,CAAC,2CAA2C,CAAC;AAEnH,mDAAmD;AAC5B,yBAAiB,GAAG,SAAS,CAAC,yBAAyB,CAAC;AAC/E,+CAA+C;AACxB,wBAAgB,GAAG,SAAS,CAAC,wBAAwB,CAAC;AAC7E,wCAAwC;AACjB,0BAAkB,GAAG,SAAS,CAAC,0BAA0B,CAAC;AAEjF;;GAEG;AACW,6BAAqB,GAAG,KAAK,CAAC;AAM5C;IADC,SAAS,EAAE;oCACwB;AAOpC;IADC,SAAS,EAAE;wCACO;AAOnB;IADC,SAAS,EAAE;wCACO;AAOnB;IADC,SAAS,EAAE;uCACQ;AAOpB;IADC,SAAS,EAAE;uCACQ;AAQpB;IADC,SAAS,EAAE;qCACI;AAQhB;IADC,SAAS,EAAE;qCACI;AAQhB;IADC,SAAS,EAAE;qCACI;AAMhB;IADC,SAAS,EAAE;gDACiB;AAM7B;IADC,SAAS,EAAE;gDACiB;AAM7B;IADC,SAAS,EAAE;gDACiB;AAM7B;IADC,SAAS,EAAE;iEACoC;AA4EhD;IADC,SAAS,EAAE;yCAGX;AAwwBL,+BAA+B;AAC/B,aAAa,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC;AAC1C,mBAAmB,CAAC,cAAc,GAAG,OAAO,CAAC,KAAK,CAAC","sourcesContent":["import { serialize, SerializationHelper } 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\ndeclare type CubeTexture = import(\"../../Materials/Textures/cubeTexture\").CubeTexture;\r\ndeclare type MirrorTexture = import(\"../../Materials/Textures/mirrorTexture\").MirrorTexture;\r\ndeclare type RenderTargetTexture = import(\"../../Materials/Textures/renderTargetTexture\").RenderTargetTexture;\r\ndeclare type Scene = import(\"../../scene\").Scene;\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\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/babylon101/materials#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 /**\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 /** nearest is mag = nearest and min = nearest and mip = linear */\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 mip = nearest */\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/how_to/more_materials#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/how_to/more_materials#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/how_to/more_materials#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/how_to/more_materials#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/how_to/more_materials\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/how_to/more_materials\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/how_to/more_materials\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/how_to/debug_layer#extensibility\r\n */\r\n public inspectableCustomProperties: Nullable<IInspectable[]> = null;\r\n\r\n private _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\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 private _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/babylon101/materials#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\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 } else {\r\n noMipmap = !!noMipmapOrOptions;\r\n }\r\n\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) {\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);\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(url: string, buffer: Nullable<string | ArrayBuffer | ArrayBufferView | HTMLImageElement | Blob> = null, onLoad?: () => void, forcedExtension?: string): void {\r\n if (this.url) {\r\n this.releaseInternalTexture();\r\n this.getScene()!.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag);\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);\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\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 if (this.optimizeUVAllocation) {\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 MaterialHelper.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.getActiveTextures().indexOf(this) !== -1;\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();\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\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 }\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 if (!parsedTexture.name && !parsedTexture.isRenderTarget) {\r\n return null;\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\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 {\r\n let texture: Texture;\r\n\r\n if (parsedTexture.base64String) {\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) {\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 texture = new Texture(url, scene, !generateMipMaps, parsedTexture.invertY, parsedTexture.samplingMode, () => {\r\n onLoaded(texture);\r\n });\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 * @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 ): Texture {\r\n return new Texture(\"data:\" + name, scene, noMipmapOrOptions, invertY, samplingMode, onLoad, onError, data, false, format, undefined, undefined, creationFlags);\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 * @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 ): Texture {\r\n if (name.substr(0, 5) !== \"data:\") {\r\n name = \"data:\" + name;\r\n }\r\n\r\n return new Texture(name, scene, noMipmapOrOptions, invertY, samplingMode, onLoad, onError, buffer, deleteBuffer, format, undefined, undefined, creationFlags);\r\n }\r\n}\r\n\r\n// References the dependencies.\r\nRegisterClass(\"BABYLON.Texture\", Texture);\r\nSerializationHelper._TextureParser = Texture.Parse;\r\n"]}
|
package/Maths/math.polar.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DeepImmutable } from "../types";
|
|
2
|
-
import
|
|
2
|
+
import { Vector2, Vector3 } from "./math.vector";
|
|
3
3
|
/**
|
|
4
4
|
* Class used to store (r, theta) vector representation
|
|
5
5
|
*/
|
|
@@ -395,7 +395,7 @@ export declare class Spherical {
|
|
|
395
395
|
toVector3ToRef(ref: DeepImmutable<Vector3>): Vector3;
|
|
396
396
|
/**
|
|
397
397
|
* Gets a Vector3 from the current spherical coordinates
|
|
398
|
-
* @returns the
|
|
398
|
+
* @returns the (x, y,z) form of the current Spherical
|
|
399
399
|
*/
|
|
400
400
|
toVector3(): Vector3;
|
|
401
401
|
/**
|
package/Maths/math.polar.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Vector2, Vector3 } from "./math.vector.js";
|
|
2
2
|
/**
|
|
3
3
|
* Class used to store (r, theta) vector representation
|
|
4
4
|
*/
|
|
@@ -281,7 +281,7 @@ export class Polar {
|
|
|
281
281
|
* @returns the rectangular coordinates
|
|
282
282
|
*/
|
|
283
283
|
toVector2() {
|
|
284
|
-
const ref =
|
|
284
|
+
const ref = new Vector2(0, 0);
|
|
285
285
|
return this.toVector2ToRef(ref);
|
|
286
286
|
}
|
|
287
287
|
/**
|
|
@@ -611,10 +611,10 @@ export class Spherical {
|
|
|
611
611
|
}
|
|
612
612
|
/**
|
|
613
613
|
* Gets a Vector3 from the current spherical coordinates
|
|
614
|
-
* @returns the
|
|
614
|
+
* @returns the (x, y,z) form of the current Spherical
|
|
615
615
|
*/
|
|
616
616
|
toVector3() {
|
|
617
|
-
const ref =
|
|
617
|
+
const ref = new Vector3(0, 0, 0);
|
|
618
618
|
return this.toVector3ToRef(ref);
|
|
619
619
|
}
|
|
620
620
|
/**
|
package/Maths/math.polar.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"math.polar.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Maths/math.polar.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C;;GAEG;AACH,MAAM,OAAO,KAAK;IAId;;;;OAIG;IACH,YAAY,MAAc,EAAE,KAAa;QACrC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACvB,CAAC;IAED;;;OAGG;IACI,YAAY;QACf,OAAO,OAAO,CAAC;IACnB,CAAC;IAED;;;OAGG;IACI,QAAQ;QACX,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;IAED;;;OAGG;IACI,OAAO;QACV,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC;IAED;;;;;OAKG;IACI,QAAQ,CAAC,KAAY,EAAE,GAAU;QACpC,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;QACxC,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;QACrC,OAAO,GAAG,CAAC;IACf,CAAC;IAED;;;;OAIG;IACI,GAAG,CA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I,MAAM,CAAC,SAAS,CAAC,KAAe;QACnC,OAAO,IAAI,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACvD,CAAC;CACJ","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { DeepImmutable } from \"../types\";\r\nimport type { Vector2, Vector3 } from \"./math.vector\";\r\nimport { TmpVectors } from \"./math.vector\";\r\n\r\n/**\r\n * Class used to store (r, theta) vector representation\r\n */\r\nexport class Polar {\r\n public radius: number;\r\n public theta: number;\r\n\r\n /**\r\n * Creates a new Polar object\r\n * @param radius the radius of the vector\r\n * @param theta the angle of the vector\r\n */\r\n constructor(radius: number, theta: number) {\r\n this.radius = radius;\r\n this.theta = theta;\r\n }\r\n\r\n /**\r\n * Gets the class name\r\n * @returns the string \"Polar\"\r\n */\r\n public getClassName() {\r\n return \"Polar\";\r\n }\r\n\r\n /**\r\n * Converts the current polar to a string\r\n * @returns the current polar as a string\r\n */\r\n public toString() {\r\n return JSON.stringify(this);\r\n }\r\n\r\n /**\r\n * Converts the current polar to an array\r\n * @reutrns the current polar as an array\r\n */\r\n public asArray() {\r\n return [this.radius, this.theta];\r\n }\r\n\r\n /**\r\n * Adds the current Polar and the given Polar and stores the result\r\n * @param polar the polar to add\r\n * @param ref the polar to store the result in\r\n * @returns the updated ref\r\n */\r\n public addToRef(polar: Polar, ref: Polar) {\r\n ref.radius = this.radius + polar.radius;\r\n ref.theta = this.theta + polar.theta;\r\n return ref;\r\n }\r\n\r\n /**\r\n * Adds the current Polar and the given Polar\r\n * @param polar the polar to add\r\n * @returns the sum polar\r\n */\r\n public add(polar: Polar) {\r\n const ref = new Polar(0, 0);\r\n this.addToRef(polar, ref);\r\n return ref;\r\n }\r\n\r\n /**\r\n * Adds the given polar to the current polar\r\n * @param polar the polar to add\r\n * @returns the current polar\r\n */\r\n public addInPlace(polar: Polar) {\r\n this.addToRef(polar, this);\r\n return this;\r\n }\r\n\r\n /**\r\n * Adds the provided values to the current polar\r\n * @param radius the amount to add to the radius\r\n * @param theta the amount to add to the theta\r\n * @returns the current polar\r\n */\r\n public addInPlaceFromFloats(radius: number, theta: number) {\r\n this.radius += radius;\r\n this.theta += theta;\r\n return this;\r\n }\r\n\r\n /**\r\n * Subtracts the given Polar from the current Polar and stores the result\r\n * @param polar the polar to subtract\r\n * @param ref the polar to store the result in\r\n * @returns the updated ref\r\n */\r\n public subtractToRef(polar: Polar, ref: Polar) {\r\n ref.radius = this.radius - polar.radius;\r\n ref.theta = this.theta - polar.theta;\r\n return ref;\r\n }\r\n\r\n /**\r\n * Subtracts the given Polar from the current Polar\r\n * @param polar the polar to subtract\r\n * @returns the difference polar\r\n */\r\n public subtract(polar: Polar) {\r\n const ref = new Polar(0, 0);\r\n this.subtractToRef(polar, ref);\r\n return ref;\r\n }\r\n\r\n /**\r\n * Subtracts the given Polar from the current Polar\r\n * @param polar the polar to subtract\r\n * @returns the current polar\r\n */\r\n public subtractInPlace(polar: Polar) {\r\n this.subtractToRef(polar, this);\r\n return this;\r\n }\r\n\r\n /**\r\n * Subtracts the given floats from the current polar\r\n * @param radius the amount to subtract from the radius\r\n * @param theta the amount to subtract from the theta\r\n * @param ref the polar to store the result in\r\n * @returns the updated ref\r\n */\r\n public subtractFromFloatsToRef(radius: number, theta: number, ref: Polar) {\r\n ref.radius = this.radius - radius;\r\n ref.theta = this.theta - theta;\r\n return ref;\r\n }\r\n\r\n /**\r\n * Subtracts the given floats from the current polar\r\n * @param radius the amount to subtract from the radius\r\n * @param theta the amount to subtract from the theta\r\n * @returns the difference polar\r\n */\r\n public subtractFromFloats(radius: number, theta: number) {\r\n const ref = new Polar(0, 0);\r\n this.subtractFromFloatsToRef(radius, theta, ref);\r\n return ref;\r\n }\r\n\r\n /**\r\n * Multiplies the given Polar with the current Polar and stores the result\r\n * @param polar the polar to multiply\r\n * @param ref the polar to store the result in\r\n * @returns the updated ref\r\n */\r\n public multiplyToRef(polar: Polar, ref: Polar) {\r\n ref.radius = this.radius * polar.radius;\r\n ref.theta = this.theta * polar.theta;\r\n return ref;\r\n }\r\n\r\n /**\r\n * Multiplies the given Polar with the current Polar\r\n * @param polar the polar to multiply\r\n * @returns the product polar\r\n */\r\n public multiply(polar: Polar) {\r\n const ref = new Polar(0, 0);\r\n this.multiplyToRef(polar, ref);\r\n return ref;\r\n }\r\n\r\n /**\r\n * Multiplies the given Polar with the current Polar\r\n * @param polar the polar to multiply\r\n * @returns the current polar\r\n */\r\n public multiplyInPlace(polar: Polar) {\r\n this.multiplyToRef(polar, this);\r\n return this;\r\n }\r\n\r\n /**\r\n * Divides the current Polar by the given Polar and stores the result\r\n * @param polar the polar to divide\r\n * @param ref the polar to store the result in\r\n * @returns the updated ref\r\n */\r\n public divideToRef(polar: Polar, ref: Polar) {\r\n ref.radius = this.radius / polar.radius;\r\n ref.theta = this.theta / polar.theta;\r\n return ref;\r\n }\r\n\r\n /**\r\n * Divides the current Polar by the given Polar\r\n * @param polar the polar to divide\r\n * @returns the quotient polar\r\n */\r\n public divide(polar: Polar) {\r\n const ref = new Polar(0, 0);\r\n this.divideToRef(polar, ref);\r\n return ref;\r\n }\r\n\r\n /**\r\n * Divides the current Polar by the given Polar\r\n * @param polar the polar to divide\r\n * @returns the current polar\r\n */\r\n public divideInPlace(polar: Polar) {\r\n this.divideToRef(polar, this);\r\n return this;\r\n }\r\n\r\n /**\r\n * Clones the current polar\r\n * @returns a clone of the current polar\r\n */\r\n public clone() {\r\n return new Polar(this.radius, this.theta);\r\n }\r\n\r\n /**\r\n * Copies the source polar into the current polar\r\n * @param source the polar to copy from\r\n * @returns the current polar\r\n */\r\n public copyFrom(source: Polar) {\r\n this.radius = source.radius;\r\n this.theta = source.theta;\r\n return this;\r\n }\r\n\r\n /**\r\n * Copies the given values into the current polar\r\n * @param radius the radius to use\r\n * @param theta the theta to use\r\n * @returns the current polar\r\n */\r\n public copyFromFloats(radius: number, theta: number) {\r\n this.radius = radius;\r\n this.theta = theta;\r\n return this;\r\n }\r\n\r\n /**\r\n * Scales the current polar and stores the result\r\n * @param scale defines the multiplication factor\r\n * @param ref where to store the result\r\n * @returns the updated ref\r\n */\r\n public scaleToRef(scale: number, ref: Polar) {\r\n ref.radius = this.radius * scale;\r\n ref.theta = this.theta * scale;\r\n return ref;\r\n }\r\n\r\n /**\r\n * Scales the current polar and returns a new polar with the scaled coordinates\r\n * @param scale defines the multiplication factor\r\n * @returns the scaled polar\r\n */\r\n public scale(scale: number) {\r\n const ref = new Polar(0, 0);\r\n this.scaleToRef(scale, ref);\r\n return ref;\r\n }\r\n\r\n /**\r\n * Scales the current polar\r\n * @param scale defines the multiplication factor\r\n * @returns the current polar\r\n */\r\n public scaleInPlace(scale: number) {\r\n this.scaleToRef(scale, this);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the values of the current polar\r\n * @param radius the new radius\r\n * @param theta the new theta\r\n * @returns the current polar\r\n */\r\n public set(radius: number, theta: number) {\r\n this.radius = radius;\r\n this.theta = theta;\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the values of the current polar\r\n * @param value the new values\r\n * @returns the current polar\r\n */\r\n public setAll(value: number) {\r\n this.set(value, value);\r\n return this;\r\n }\r\n\r\n /**\r\n * Gets the rectangular coordinates of the current Polar\r\n * @param ref the reference to assign the result\r\n * @returns the updated reference\r\n */\r\n public toVector2ToRef(ref: Vector2): Vector2 {\r\n const x = this.radius * Math.cos(this.theta);\r\n const y = this.radius * Math.sin(this.theta);\r\n ref.set(x, y);\r\n return ref;\r\n }\r\n\r\n /**\r\n * Gets the rectangular coordinates of the current Polar\r\n * @returns the rectangular coordinates\r\n */\r\n public toVector2(): Vector2 {\r\n const ref = TmpVectors.Vector2[0];\r\n return this.toVector2ToRef(ref);\r\n }\r\n\r\n /**\r\n * Converts a given Vector2 to its polar coordinates\r\n * @param v the Vector2 to convert\r\n * @param ref the reference to assign the result\r\n * @returns the updated reference\r\n */\r\n public static FromVector2ToRef(v: Vector2, ref: Polar): Polar {\r\n const theta = Math.sign(v.y) * Math.acos(v.x / v.length());\r\n ref.radius = v.length();\r\n ref.theta = theta;\r\n return ref;\r\n }\r\n\r\n /**\r\n * Converts a given Vector2 to its polar coordinates\r\n * @param v the Vector2 to convert\r\n * @returns a Polar\r\n */\r\n public static FromVector2(v: Vector2): Polar {\r\n const polar = new Polar(0, 0);\r\n Polar.FromVector2ToRef(v, polar);\r\n return polar;\r\n }\r\n\r\n /**\r\n * Converts an array of floats to a polar\r\n * @param array the array to convert\r\n * @returns the converted polar\r\n */\r\n public static FromArray(array: number[]) {\r\n return new Polar(array[0], array[1]);\r\n }\r\n}\r\n\r\n/**\r\n * Class used for (radius, theta, phi) vector representation.\r\n */\r\nexport class Spherical {\r\n public radius: number;\r\n public theta: number;\r\n public phi: number;\r\n\r\n /**\r\n * @param radius spherical radius\r\n * @param theta angle from positive y axis to radial line from 0 to PI (vertical)\r\n * @param phi angle from positive x axis measured anticlockwise from -PI to PI (horizontal)\r\n */\r\n constructor(radius: number, theta: number, phi: number) {\r\n this.radius = radius;\r\n this.theta = theta;\r\n this.phi = phi;\r\n }\r\n\r\n /**\r\n * Gets the class name\r\n * @returns the string \"Spherical\"\r\n */\r\n public getClassName() {\r\n return \"Spherical\";\r\n }\r\n\r\n /**\r\n * Converts the current spherical to a string\r\n * @returns the current spherical as a string\r\n */\r\n public toString() {\r\n return JSON.stringify(this);\r\n }\r\n\r\n /**\r\n * Converts the current spherical to an array\r\n * @reutrns the current spherical as an array\r\n */\r\n public asArray() {\r\n return [this.radius, this.theta, this.phi];\r\n }\r\n\r\n /**\r\n * Adds the current Spherical and the given Spherical and stores the result\r\n * @param spherical the spherical to add\r\n * @param ref the spherical to store the result in\r\n * @returns the updated ref\r\n */\r\n public addToRef(spherical: Spherical, ref: Spherical) {\r\n ref.radius = this.radius + spherical.radius;\r\n ref.theta = this.theta + spherical.theta;\r\n ref.phi = this.phi + spherical.phi;\r\n return ref;\r\n }\r\n\r\n /**\r\n * Adds the current Spherical and the given Spherical\r\n * @param spherical the spherical to add\r\n * @returns the sum spherical\r\n */\r\n public add(spherical: Spherical) {\r\n const ref = new Spherical(0, 0, 0);\r\n this.addToRef(spherical, ref);\r\n return ref;\r\n }\r\n\r\n /**\r\n * Adds the given spherical to the current spherical\r\n * @param spherical the spherical to add\r\n * @returns the current spherical\r\n */\r\n public addInPlace(spherical: Spherical) {\r\n this.addToRef(spherical, this);\r\n return this;\r\n }\r\n\r\n /**\r\n * Adds the provided values to the current spherical\r\n * @param radius the amount to add to the radius\r\n * @param theta the amount to add to the theta\r\n * @param phi the amount to add to the phi\r\n * @returns the current spherical\r\n */\r\n public addInPlaceFromFloats(radius: number, theta: number, phi: number) {\r\n this.radius += radius;\r\n this.theta += theta;\r\n this.phi += phi;\r\n return this;\r\n }\r\n\r\n /**\r\n * Subtracts the given Spherical from the current Spherical and stores the result\r\n * @param spherical the spherical to subtract\r\n * @param ref the spherical to store the result in\r\n * @returns the updated ref\r\n */\r\n public subtractToRef(spherical: Spherical, ref: Spherical) {\r\n ref.radius = this.radius - spherical.radius;\r\n ref.theta = this.theta - spherical.theta;\r\n ref.phi = this.phi - spherical.phi;\r\n return ref;\r\n }\r\n\r\n /**\r\n * Subtracts the given Spherical from the current Spherical\r\n * @param spherical the spherical to subtract\r\n * @returns the difference spherical\r\n */\r\n public subtract(spherical: Spherical) {\r\n const ref = new Spherical(0, 0, 0);\r\n this.subtractToRef(spherical, ref);\r\n return ref;\r\n }\r\n\r\n /**\r\n * Subtracts the given Spherical from the current Spherical\r\n * @param spherical the spherical to subtract\r\n * @returns the current spherical\r\n */\r\n public subtractInPlace(spherical: Spherical) {\r\n this.subtractToRef(spherical, this);\r\n return this;\r\n }\r\n\r\n /**\r\n * Subtracts the given floats from the current spherical\r\n * @param radius the amount to subtract from the radius\r\n * @param theta the amount to subtract from the theta\r\n * @param phi the amount to subtract from the phi\r\n * @param ref the spherical to store the result in\r\n * @returns the updated ref\r\n */\r\n public subtractFromFloatsToRef(radius: number, theta: number, phi: number, ref: Spherical) {\r\n ref.radius = this.radius - radius;\r\n ref.theta = this.theta - theta;\r\n ref.phi = this.phi - phi;\r\n return ref;\r\n }\r\n\r\n /**\r\n * Subtracts the given floats from the current spherical\r\n * @param radius the amount to subtract from the radius\r\n * @param theta the amount to subtract from the theta\r\n * @param phi the amount to subtract from the phi\r\n * @returns the difference spherical\r\n */\r\n public subtractFromFloats(radius: number, theta: number, phi: number) {\r\n const ref = new Spherical(0, 0, 0);\r\n this.subtractFromFloatsToRef(radius, theta, phi, ref);\r\n return ref;\r\n }\r\n\r\n /**\r\n * Multiplies the given Spherical with the current Spherical and stores the result\r\n * @param spherical the spherical to multiply\r\n * @param ref the spherical to store the result in\r\n * @returns the updated ref\r\n */\r\n public multiplyToRef(spherical: Spherical, ref: Spherical) {\r\n ref.radius = this.radius * spherical.radius;\r\n ref.theta = this.theta * spherical.theta;\r\n ref.phi = this.phi * spherical.phi;\r\n return ref;\r\n }\r\n\r\n /**\r\n * Multiplies the given Spherical with the current Spherical\r\n * @param spherical the spherical to multiply\r\n * @returns the product spherical\r\n */\r\n public multiply(spherical: Spherical) {\r\n const ref = new Spherical(0, 0, 0);\r\n this.multiplyToRef(spherical, ref);\r\n return ref;\r\n }\r\n\r\n /**\r\n * Multiplies the given Spherical with the current Spherical\r\n * @param spherical the spherical to multiply\r\n * @returns the current spherical\r\n */\r\n public multiplyInPlace(spherical: Spherical) {\r\n this.multiplyToRef(spherical, this);\r\n return this;\r\n }\r\n\r\n /**\r\n * Divides the current Spherical by the given Spherical and stores the result\r\n * @param spherical the spherical to divide\r\n * @param ref the spherical to store the result in\r\n * @returns the updated ref\r\n */\r\n public divideToRef(spherical: Spherical, ref: Spherical) {\r\n ref.radius = this.radius / spherical.radius;\r\n ref.theta = this.theta / spherical.theta;\r\n ref.phi = this.phi / spherical.phi;\r\n return ref;\r\n }\r\n\r\n /**\r\n * Divides the current Spherical by the given Spherical\r\n * @param spherical the spherical to divide\r\n * @returns the quotient spherical\r\n */\r\n public divide(spherical: Spherical) {\r\n const ref = new Spherical(0, 0, 0);\r\n this.divideToRef(spherical, ref);\r\n return ref;\r\n }\r\n\r\n /**\r\n * Divides the current Spherical by the given Spherical\r\n * @param spherical the spherical to divide\r\n * @returns the current spherical\r\n */\r\n public divideInPlace(spherical: Spherical) {\r\n this.divideToRef(spherical, this);\r\n return this;\r\n }\r\n\r\n /**\r\n * Clones the current spherical\r\n * @returns a clone of the current spherical\r\n */\r\n public clone() {\r\n return new Spherical(this.radius, this.theta, this.phi);\r\n }\r\n\r\n /**\r\n * Copies the source spherical into the current spherical\r\n * @param source the spherical to copy from\r\n * @returns the current spherical\r\n */\r\n public copyFrom(source: Spherical) {\r\n this.radius = source.radius;\r\n this.theta = source.theta;\r\n this.phi = source.phi;\r\n return this;\r\n }\r\n\r\n /**\r\n * Copies the given values into the current spherical\r\n * @param radius the radius to use\r\n * @param theta the theta to use\r\n * @param phi the phi to use\r\n * @returns the current spherical\r\n */\r\n public copyFromFloats(radius: number, theta: number, phi: number) {\r\n this.radius = radius;\r\n this.theta = theta;\r\n this.phi = phi;\r\n return this;\r\n }\r\n\r\n /**\r\n * Scales the current spherical and stores the result\r\n * @param scale defines the multiplication factor\r\n * @param ref where to store the result\r\n * @returns the updated ref\r\n */\r\n public scaleToRef(scale: number, ref: Spherical) {\r\n ref.radius = this.radius * scale;\r\n ref.theta = this.theta * scale;\r\n ref.phi = this.phi * scale;\r\n return ref;\r\n }\r\n\r\n /**\r\n * Scales the current spherical and returns a new spherical with the scaled coordinates\r\n * @param scale defines the multiplication factor\r\n * @returns the scaled spherical\r\n */\r\n public scale(scale: number) {\r\n const ref = new Spherical(0, 0, 0);\r\n this.scaleToRef(scale, ref);\r\n return ref;\r\n }\r\n\r\n /**\r\n * Scales the current spherical\r\n * @param scale defines the multiplication factor\r\n * @returns the current spherical\r\n */\r\n public scaleInPlace(scale: number) {\r\n this.scaleToRef(scale, this);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the values of the current spherical\r\n * @param radius the new radius\r\n * @param theta the new theta\r\n * @param phi the new phi\r\n * @returns the current spherical\r\n */\r\n public set(radius: number, theta: number, phi: number) {\r\n this.radius = radius;\r\n this.theta = theta;\r\n this.phi = phi;\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the values of the current spherical\r\n * @param value the new values\r\n * @returns the current spherical\r\n */\r\n public setAll(value: number) {\r\n this.set(value, value, value);\r\n return this;\r\n }\r\n\r\n /**\r\n * Assigns the rectangular coordinates of the current Spherical to a Vector3\r\n * @param ref the Vector3 to update\r\n * @returns the updated Vector3\r\n */\r\n public toVector3ToRef(ref: DeepImmutable<Vector3>): Vector3 {\r\n const x = this.radius * Math.sin(this.theta) * Math.cos(this.phi);\r\n const y = this.radius * Math.cos(this.theta);\r\n const z = this.radius * Math.sin(this.theta) * Math.sin(this.phi);\r\n ref.set(x, y, z);\r\n return ref;\r\n }\r\n\r\n /**\r\n * Gets a Vector3 from the current spherical coordinates\r\n * @returns the Vector3\r\n */\r\n public toVector3(): Vector3 {\r\n const ref = TmpVectors.Vector3[0];\r\n return this.toVector3ToRef(ref);\r\n }\r\n\r\n /**\r\n * Assigns the spherical coordinates from a Vector3\r\n * @param vector the vector to convert\r\n * @param ref the Spherical to update\r\n * @returns the updated ref\r\n */\r\n public static FromVector3ToRef(vector: DeepImmutable<Vector3>, ref: Spherical): Spherical {\r\n ref.radius = vector.length();\r\n ref.theta = Math.acos(vector.y / ref.radius);\r\n ref.phi = Math.atan2(vector.z, vector.x);\r\n return ref;\r\n }\r\n\r\n /**\r\n * Gets a Spherical from a Vector3\r\n * @param vector defines the vector in (x, y, z) coordinate space\r\n * @returns a new Spherical\r\n */\r\n public static FromVector3(vector: DeepImmutable<Vector3>): Spherical {\r\n const spherical = new Spherical(0, 0, 0);\r\n Spherical.FromVector3ToRef(vector, spherical);\r\n return spherical;\r\n }\r\n\r\n /**\r\n * Converts an array of floats to a spherical\r\n * @param array the array to convert\r\n * @returns the converted spherical\r\n */\r\n public static FromArray(array: number[]) {\r\n return new Spherical(array[0], array[1], array[2]);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"math.polar.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Maths/math.polar.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAEjD;;GAEG;AACH,MAAM,OAAO,KAAK;IAId;;;;OAIG;IACH,YAAY,MAAc,EAAE,KAAa;QACrC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACvB,CAAC;IAED;;;OAGG;IACI,YAAY;QACf,OAAO,OAAO,CAAC;IACnB,CAAC;IAED;;;OAGG;IACI,QAAQ;QACX,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;IAED;;;OAGG;IACI,OAAO;QACV,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC;IAED;;;;;OAKG;IACI,QAAQ,CAAC,KAAY,EAAE,GAAU;QACpC,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;QACxC,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;QACrC,OAAO,GAAG,CAAC;IACf,CAAC;IAED;;;;OAIG;IACI,GAAG,CAAC,KAAY;QACnB,MAAM,GAAG,GAAG,IAAI,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAC5B,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAC1B,OAAO,GAAG,CAAC;IACf,CAAC;IAED;;;;OAIG;IACI,UAAU,CAAC,KAAY;QAC1B,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,CA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vector2, Vector3 } from \"./math.vector\";\r\n\r\n/**\r\n * Class used to store (r, theta) vector representation\r\n */\r\nexport class Polar {\r\n public radius: number;\r\n public theta: number;\r\n\r\n /**\r\n * Creates a new Polar object\r\n * @param radius the radius of the vector\r\n * @param theta the angle of the vector\r\n */\r\n constructor(radius: number, theta: number) {\r\n this.radius = radius;\r\n this.theta = theta;\r\n }\r\n\r\n /**\r\n * Gets the class name\r\n * @returns the string \"Polar\"\r\n */\r\n public getClassName() {\r\n return \"Polar\";\r\n }\r\n\r\n /**\r\n * Converts the current polar to a string\r\n * @returns the current polar as a string\r\n */\r\n public toString() {\r\n return JSON.stringify(this);\r\n }\r\n\r\n /**\r\n * Converts the current polar to an array\r\n * @reutrns the current polar as an array\r\n */\r\n public asArray() {\r\n return [this.radius, this.theta];\r\n }\r\n\r\n /**\r\n * Adds the current Polar and the given Polar and stores the result\r\n * @param polar the polar to add\r\n * @param ref the polar to store the result in\r\n * @returns the updated ref\r\n */\r\n public addToRef(polar: Polar, ref: Polar) {\r\n ref.radius = this.radius + polar.radius;\r\n ref.theta = this.theta + polar.theta;\r\n return ref;\r\n }\r\n\r\n /**\r\n * Adds the current Polar and the given Polar\r\n * @param polar the polar to add\r\n * @returns the sum polar\r\n */\r\n public add(polar: Polar) {\r\n const ref = new Polar(0, 0);\r\n this.addToRef(polar, ref);\r\n return ref;\r\n }\r\n\r\n /**\r\n * Adds the given polar to the current polar\r\n * @param polar the polar to add\r\n * @returns the current polar\r\n */\r\n public addInPlace(polar: Polar) {\r\n this.addToRef(polar, this);\r\n return this;\r\n }\r\n\r\n /**\r\n * Adds the provided values to the current polar\r\n * @param radius the amount to add to the radius\r\n * @param theta the amount to add to the theta\r\n * @returns the current polar\r\n */\r\n public addInPlaceFromFloats(radius: number, theta: number) {\r\n this.radius += radius;\r\n this.theta += theta;\r\n return this;\r\n }\r\n\r\n /**\r\n * Subtracts the given Polar from the current Polar and stores the result\r\n * @param polar the polar to subtract\r\n * @param ref the polar to store the result in\r\n * @returns the updated ref\r\n */\r\n public subtractToRef(polar: Polar, ref: Polar) {\r\n ref.radius = this.radius - polar.radius;\r\n ref.theta = this.theta - polar.theta;\r\n return ref;\r\n }\r\n\r\n /**\r\n * Subtracts the given Polar from the current Polar\r\n * @param polar the polar to subtract\r\n * @returns the difference polar\r\n */\r\n public subtract(polar: Polar) {\r\n const ref = new Polar(0, 0);\r\n this.subtractToRef(polar, ref);\r\n return ref;\r\n }\r\n\r\n /**\r\n * Subtracts the given Polar from the current Polar\r\n * @param polar the polar to subtract\r\n * @returns the current polar\r\n */\r\n public subtractInPlace(polar: Polar) {\r\n this.subtractToRef(polar, this);\r\n return this;\r\n }\r\n\r\n /**\r\n * Subtracts the given floats from the current polar\r\n * @param radius the amount to subtract from the radius\r\n * @param theta the amount to subtract from the theta\r\n * @param ref the polar to store the result in\r\n * @returns the updated ref\r\n */\r\n public subtractFromFloatsToRef(radius: number, theta: number, ref: Polar) {\r\n ref.radius = this.radius - radius;\r\n ref.theta = this.theta - theta;\r\n return ref;\r\n }\r\n\r\n /**\r\n * Subtracts the given floats from the current polar\r\n * @param radius the amount to subtract from the radius\r\n * @param theta the amount to subtract from the theta\r\n * @returns the difference polar\r\n */\r\n public subtractFromFloats(radius: number, theta: number) {\r\n const ref = new Polar(0, 0);\r\n this.subtractFromFloatsToRef(radius, theta, ref);\r\n return ref;\r\n }\r\n\r\n /**\r\n * Multiplies the given Polar with the current Polar and stores the result\r\n * @param polar the polar to multiply\r\n * @param ref the polar to store the result in\r\n * @returns the updated ref\r\n */\r\n public multiplyToRef(polar: Polar, ref: Polar) {\r\n ref.radius = this.radius * polar.radius;\r\n ref.theta = this.theta * polar.theta;\r\n return ref;\r\n }\r\n\r\n /**\r\n * Multiplies the given Polar with the current Polar\r\n * @param polar the polar to multiply\r\n * @returns the product polar\r\n */\r\n public multiply(polar: Polar) {\r\n const ref = new Polar(0, 0);\r\n this.multiplyToRef(polar, ref);\r\n return ref;\r\n }\r\n\r\n /**\r\n * Multiplies the given Polar with the current Polar\r\n * @param polar the polar to multiply\r\n * @returns the current polar\r\n */\r\n public multiplyInPlace(polar: Polar) {\r\n this.multiplyToRef(polar, this);\r\n return this;\r\n }\r\n\r\n /**\r\n * Divides the current Polar by the given Polar and stores the result\r\n * @param polar the polar to divide\r\n * @param ref the polar to store the result in\r\n * @returns the updated ref\r\n */\r\n public divideToRef(polar: Polar, ref: Polar) {\r\n ref.radius = this.radius / polar.radius;\r\n ref.theta = this.theta / polar.theta;\r\n return ref;\r\n }\r\n\r\n /**\r\n * Divides the current Polar by the given Polar\r\n * @param polar the polar to divide\r\n * @returns the quotient polar\r\n */\r\n public divide(polar: Polar) {\r\n const ref = new Polar(0, 0);\r\n this.divideToRef(polar, ref);\r\n return ref;\r\n }\r\n\r\n /**\r\n * Divides the current Polar by the given Polar\r\n * @param polar the polar to divide\r\n * @returns the current polar\r\n */\r\n public divideInPlace(polar: Polar) {\r\n this.divideToRef(polar, this);\r\n return this;\r\n }\r\n\r\n /**\r\n * Clones the current polar\r\n * @returns a clone of the current polar\r\n */\r\n public clone() {\r\n return new Polar(this.radius, this.theta);\r\n }\r\n\r\n /**\r\n * Copies the source polar into the current polar\r\n * @param source the polar to copy from\r\n * @returns the current polar\r\n */\r\n public copyFrom(source: Polar) {\r\n this.radius = source.radius;\r\n this.theta = source.theta;\r\n return this;\r\n }\r\n\r\n /**\r\n * Copies the given values into the current polar\r\n * @param radius the radius to use\r\n * @param theta the theta to use\r\n * @returns the current polar\r\n */\r\n public copyFromFloats(radius: number, theta: number) {\r\n this.radius = radius;\r\n this.theta = theta;\r\n return this;\r\n }\r\n\r\n /**\r\n * Scales the current polar and stores the result\r\n * @param scale defines the multiplication factor\r\n * @param ref where to store the result\r\n * @returns the updated ref\r\n */\r\n public scaleToRef(scale: number, ref: Polar) {\r\n ref.radius = this.radius * scale;\r\n ref.theta = this.theta * scale;\r\n return ref;\r\n }\r\n\r\n /**\r\n * Scales the current polar and returns a new polar with the scaled coordinates\r\n * @param scale defines the multiplication factor\r\n * @returns the scaled polar\r\n */\r\n public scale(scale: number) {\r\n const ref = new Polar(0, 0);\r\n this.scaleToRef(scale, ref);\r\n return ref;\r\n }\r\n\r\n /**\r\n * Scales the current polar\r\n * @param scale defines the multiplication factor\r\n * @returns the current polar\r\n */\r\n public scaleInPlace(scale: number) {\r\n this.scaleToRef(scale, this);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the values of the current polar\r\n * @param radius the new radius\r\n * @param theta the new theta\r\n * @returns the current polar\r\n */\r\n public set(radius: number, theta: number) {\r\n this.radius = radius;\r\n this.theta = theta;\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the values of the current polar\r\n * @param value the new values\r\n * @returns the current polar\r\n */\r\n public setAll(value: number) {\r\n this.set(value, value);\r\n return this;\r\n }\r\n\r\n /**\r\n * Gets the rectangular coordinates of the current Polar\r\n * @param ref the reference to assign the result\r\n * @returns the updated reference\r\n */\r\n public toVector2ToRef(ref: Vector2): Vector2 {\r\n const x = this.radius * Math.cos(this.theta);\r\n const y = this.radius * Math.sin(this.theta);\r\n ref.set(x, y);\r\n return ref;\r\n }\r\n\r\n /**\r\n * Gets the rectangular coordinates of the current Polar\r\n * @returns the rectangular coordinates\r\n */\r\n public toVector2(): Vector2 {\r\n const ref = new Vector2(0, 0);\r\n return this.toVector2ToRef(ref);\r\n }\r\n\r\n /**\r\n * Converts a given Vector2 to its polar coordinates\r\n * @param v the Vector2 to convert\r\n * @param ref the reference to assign the result\r\n * @returns the updated reference\r\n */\r\n public static FromVector2ToRef(v: Vector2, ref: Polar): Polar {\r\n const theta = Math.sign(v.y) * Math.acos(v.x / v.length());\r\n ref.radius = v.length();\r\n ref.theta = theta;\r\n return ref;\r\n }\r\n\r\n /**\r\n * Converts a given Vector2 to its polar coordinates\r\n * @param v the Vector2 to convert\r\n * @returns a Polar\r\n */\r\n public static FromVector2(v: Vector2): Polar {\r\n const polar = new Polar(0, 0);\r\n Polar.FromVector2ToRef(v, polar);\r\n return polar;\r\n }\r\n\r\n /**\r\n * Converts an array of floats to a polar\r\n * @param array the array to convert\r\n * @returns the converted polar\r\n */\r\n public static FromArray(array: number[]) {\r\n return new Polar(array[0], array[1]);\r\n }\r\n}\r\n\r\n/**\r\n * Class used for (radius, theta, phi) vector representation.\r\n */\r\nexport class Spherical {\r\n public radius: number;\r\n public theta: number;\r\n public phi: number;\r\n\r\n /**\r\n * @param radius spherical radius\r\n * @param theta angle from positive y axis to radial line from 0 to PI (vertical)\r\n * @param phi angle from positive x axis measured anticlockwise from -PI to PI (horizontal)\r\n */\r\n constructor(radius: number, theta: number, phi: number) {\r\n this.radius = radius;\r\n this.theta = theta;\r\n this.phi = phi;\r\n }\r\n\r\n /**\r\n * Gets the class name\r\n * @returns the string \"Spherical\"\r\n */\r\n public getClassName() {\r\n return \"Spherical\";\r\n }\r\n\r\n /**\r\n * Converts the current spherical to a string\r\n * @returns the current spherical as a string\r\n */\r\n public toString() {\r\n return JSON.stringify(this);\r\n }\r\n\r\n /**\r\n * Converts the current spherical to an array\r\n * @reutrns the current spherical as an array\r\n */\r\n public asArray() {\r\n return [this.radius, this.theta, this.phi];\r\n }\r\n\r\n /**\r\n * Adds the current Spherical and the given Spherical and stores the result\r\n * @param spherical the spherical to add\r\n * @param ref the spherical to store the result in\r\n * @returns the updated ref\r\n */\r\n public addToRef(spherical: Spherical, ref: Spherical) {\r\n ref.radius = this.radius + spherical.radius;\r\n ref.theta = this.theta + spherical.theta;\r\n ref.phi = this.phi + spherical.phi;\r\n return ref;\r\n }\r\n\r\n /**\r\n * Adds the current Spherical and the given Spherical\r\n * @param spherical the spherical to add\r\n * @returns the sum spherical\r\n */\r\n public add(spherical: Spherical) {\r\n const ref = new Spherical(0, 0, 0);\r\n this.addToRef(spherical, ref);\r\n return ref;\r\n }\r\n\r\n /**\r\n * Adds the given spherical to the current spherical\r\n * @param spherical the spherical to add\r\n * @returns the current spherical\r\n */\r\n public addInPlace(spherical: Spherical) {\r\n this.addToRef(spherical, this);\r\n return this;\r\n }\r\n\r\n /**\r\n * Adds the provided values to the current spherical\r\n * @param radius the amount to add to the radius\r\n * @param theta the amount to add to the theta\r\n * @param phi the amount to add to the phi\r\n * @returns the current spherical\r\n */\r\n public addInPlaceFromFloats(radius: number, theta: number, phi: number) {\r\n this.radius += radius;\r\n this.theta += theta;\r\n this.phi += phi;\r\n return this;\r\n }\r\n\r\n /**\r\n * Subtracts the given Spherical from the current Spherical and stores the result\r\n * @param spherical the spherical to subtract\r\n * @param ref the spherical to store the result in\r\n * @returns the updated ref\r\n */\r\n public subtractToRef(spherical: Spherical, ref: Spherical) {\r\n ref.radius = this.radius - spherical.radius;\r\n ref.theta = this.theta - spherical.theta;\r\n ref.phi = this.phi - spherical.phi;\r\n return ref;\r\n }\r\n\r\n /**\r\n * Subtracts the given Spherical from the current Spherical\r\n * @param spherical the spherical to subtract\r\n * @returns the difference spherical\r\n */\r\n public subtract(spherical: Spherical) {\r\n const ref = new Spherical(0, 0, 0);\r\n this.subtractToRef(spherical, ref);\r\n return ref;\r\n }\r\n\r\n /**\r\n * Subtracts the given Spherical from the current Spherical\r\n * @param spherical the spherical to subtract\r\n * @returns the current spherical\r\n */\r\n public subtractInPlace(spherical: Spherical) {\r\n this.subtractToRef(spherical, this);\r\n return this;\r\n }\r\n\r\n /**\r\n * Subtracts the given floats from the current spherical\r\n * @param radius the amount to subtract from the radius\r\n * @param theta the amount to subtract from the theta\r\n * @param phi the amount to subtract from the phi\r\n * @param ref the spherical to store the result in\r\n * @returns the updated ref\r\n */\r\n public subtractFromFloatsToRef(radius: number, theta: number, phi: number, ref: Spherical) {\r\n ref.radius = this.radius - radius;\r\n ref.theta = this.theta - theta;\r\n ref.phi = this.phi - phi;\r\n return ref;\r\n }\r\n\r\n /**\r\n * Subtracts the given floats from the current spherical\r\n * @param radius the amount to subtract from the radius\r\n * @param theta the amount to subtract from the theta\r\n * @param phi the amount to subtract from the phi\r\n * @returns the difference spherical\r\n */\r\n public subtractFromFloats(radius: number, theta: number, phi: number) {\r\n const ref = new Spherical(0, 0, 0);\r\n this.subtractFromFloatsToRef(radius, theta, phi, ref);\r\n return ref;\r\n }\r\n\r\n /**\r\n * Multiplies the given Spherical with the current Spherical and stores the result\r\n * @param spherical the spherical to multiply\r\n * @param ref the spherical to store the result in\r\n * @returns the updated ref\r\n */\r\n public multiplyToRef(spherical: Spherical, ref: Spherical) {\r\n ref.radius = this.radius * spherical.radius;\r\n ref.theta = this.theta * spherical.theta;\r\n ref.phi = this.phi * spherical.phi;\r\n return ref;\r\n }\r\n\r\n /**\r\n * Multiplies the given Spherical with the current Spherical\r\n * @param spherical the spherical to multiply\r\n * @returns the product spherical\r\n */\r\n public multiply(spherical: Spherical) {\r\n const ref = new Spherical(0, 0, 0);\r\n this.multiplyToRef(spherical, ref);\r\n return ref;\r\n }\r\n\r\n /**\r\n * Multiplies the given Spherical with the current Spherical\r\n * @param spherical the spherical to multiply\r\n * @returns the current spherical\r\n */\r\n public multiplyInPlace(spherical: Spherical) {\r\n this.multiplyToRef(spherical, this);\r\n return this;\r\n }\r\n\r\n /**\r\n * Divides the current Spherical by the given Spherical and stores the result\r\n * @param spherical the spherical to divide\r\n * @param ref the spherical to store the result in\r\n * @returns the updated ref\r\n */\r\n public divideToRef(spherical: Spherical, ref: Spherical) {\r\n ref.radius = this.radius / spherical.radius;\r\n ref.theta = this.theta / spherical.theta;\r\n ref.phi = this.phi / spherical.phi;\r\n return ref;\r\n }\r\n\r\n /**\r\n * Divides the current Spherical by the given Spherical\r\n * @param spherical the spherical to divide\r\n * @returns the quotient spherical\r\n */\r\n public divide(spherical: Spherical) {\r\n const ref = new Spherical(0, 0, 0);\r\n this.divideToRef(spherical, ref);\r\n return ref;\r\n }\r\n\r\n /**\r\n * Divides the current Spherical by the given Spherical\r\n * @param spherical the spherical to divide\r\n * @returns the current spherical\r\n */\r\n public divideInPlace(spherical: Spherical) {\r\n this.divideToRef(spherical, this);\r\n return this;\r\n }\r\n\r\n /**\r\n * Clones the current spherical\r\n * @returns a clone of the current spherical\r\n */\r\n public clone() {\r\n return new Spherical(this.radius, this.theta, this.phi);\r\n }\r\n\r\n /**\r\n * Copies the source spherical into the current spherical\r\n * @param source the spherical to copy from\r\n * @returns the current spherical\r\n */\r\n public copyFrom(source: Spherical) {\r\n this.radius = source.radius;\r\n this.theta = source.theta;\r\n this.phi = source.phi;\r\n return this;\r\n }\r\n\r\n /**\r\n * Copies the given values into the current spherical\r\n * @param radius the radius to use\r\n * @param theta the theta to use\r\n * @param phi the phi to use\r\n * @returns the current spherical\r\n */\r\n public copyFromFloats(radius: number, theta: number, phi: number) {\r\n this.radius = radius;\r\n this.theta = theta;\r\n this.phi = phi;\r\n return this;\r\n }\r\n\r\n /**\r\n * Scales the current spherical and stores the result\r\n * @param scale defines the multiplication factor\r\n * @param ref where to store the result\r\n * @returns the updated ref\r\n */\r\n public scaleToRef(scale: number, ref: Spherical) {\r\n ref.radius = this.radius * scale;\r\n ref.theta = this.theta * scale;\r\n ref.phi = this.phi * scale;\r\n return ref;\r\n }\r\n\r\n /**\r\n * Scales the current spherical and returns a new spherical with the scaled coordinates\r\n * @param scale defines the multiplication factor\r\n * @returns the scaled spherical\r\n */\r\n public scale(scale: number) {\r\n const ref = new Spherical(0, 0, 0);\r\n this.scaleToRef(scale, ref);\r\n return ref;\r\n }\r\n\r\n /**\r\n * Scales the current spherical\r\n * @param scale defines the multiplication factor\r\n * @returns the current spherical\r\n */\r\n public scaleInPlace(scale: number) {\r\n this.scaleToRef(scale, this);\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the values of the current spherical\r\n * @param radius the new radius\r\n * @param theta the new theta\r\n * @param phi the new phi\r\n * @returns the current spherical\r\n */\r\n public set(radius: number, theta: number, phi: number) {\r\n this.radius = radius;\r\n this.theta = theta;\r\n this.phi = phi;\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the values of the current spherical\r\n * @param value the new values\r\n * @returns the current spherical\r\n */\r\n public setAll(value: number) {\r\n this.set(value, value, value);\r\n return this;\r\n }\r\n\r\n /**\r\n * Assigns the rectangular coordinates of the current Spherical to a Vector3\r\n * @param ref the Vector3 to update\r\n * @returns the updated Vector3\r\n */\r\n public toVector3ToRef(ref: DeepImmutable<Vector3>): Vector3 {\r\n const x = this.radius * Math.sin(this.theta) * Math.cos(this.phi);\r\n const y = this.radius * Math.cos(this.theta);\r\n const z = this.radius * Math.sin(this.theta) * Math.sin(this.phi);\r\n ref.set(x, y, z);\r\n return ref;\r\n }\r\n\r\n /**\r\n * Gets a Vector3 from the current spherical coordinates\r\n * @returns the (x, y,z) form of the current Spherical\r\n */\r\n public toVector3(): Vector3 {\r\n const ref = new Vector3(0, 0, 0);\r\n return this.toVector3ToRef(ref);\r\n }\r\n\r\n /**\r\n * Assigns the spherical coordinates from a Vector3\r\n * @param vector the vector to convert\r\n * @param ref the Spherical to update\r\n * @returns the updated ref\r\n */\r\n public static FromVector3ToRef(vector: DeepImmutable<Vector3>, ref: Spherical): Spherical {\r\n ref.radius = vector.length();\r\n ref.theta = Math.acos(vector.y / ref.radius);\r\n ref.phi = Math.atan2(vector.z, vector.x);\r\n return ref;\r\n }\r\n\r\n /**\r\n * Gets a Spherical from a Vector3\r\n * @param vector defines the vector in (x, y, z) coordinate space\r\n * @returns a new Spherical\r\n */\r\n public static FromVector3(vector: DeepImmutable<Vector3>): Spherical {\r\n const spherical = new Spherical(0, 0, 0);\r\n Spherical.FromVector3ToRef(vector, spherical);\r\n return spherical;\r\n }\r\n\r\n /**\r\n * Converts an array of floats to a spherical\r\n * @param array the array to convert\r\n * @returns the converted spherical\r\n */\r\n public static FromArray(array: number[]) {\r\n return new Spherical(array[0], array[1], array[2]);\r\n }\r\n}\r\n"]}
|