@babylonjs/core 5.9.1 → 5.12.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/Cameras/Inputs/freeCameraTouchInput.d.ts +1 -0
- package/Cameras/Inputs/freeCameraTouchInput.js +3 -2
- package/Cameras/Inputs/freeCameraTouchInput.js.map +1 -1
- package/Engines/Extensions/engine.query.js +1 -1
- package/Engines/Extensions/engine.query.js.map +1 -1
- package/Engines/ICanvas.d.ts +5 -0
- package/Engines/ICanvas.js.map +1 -1
- package/Engines/WebGPU/webgpuConstants.d.ts +1 -1
- package/Engines/WebGPU/webgpuConstants.js +5 -5
- package/Engines/WebGPU/webgpuConstants.js.map +1 -1
- package/Engines/engine.d.ts +2 -2
- package/Engines/thinEngine.js +2 -2
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/webgpuEngine.js +1 -1
- package/Engines/webgpuEngine.js.map +1 -1
- package/Materials/Background/backgroundMaterial.js +2 -1
- package/Materials/Background/backgroundMaterial.js.map +1 -1
- package/Materials/Node/nodeMaterial.js +2 -1
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/PBR/pbrAnisotropicConfiguration.d.ts +1 -1
- package/Materials/PBR/pbrAnisotropicConfiguration.js +1 -1
- package/Materials/PBR/pbrAnisotropicConfiguration.js.map +1 -1
- package/Materials/PBR/pbrBaseMaterial.js +9 -4
- package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
- package/Materials/Textures/baseTexture.d.ts +2 -1
- package/Materials/Textures/baseTexture.js +6 -3
- package/Materials/Textures/baseTexture.js.map +1 -1
- package/Materials/Textures/cubeTexture.js +1 -1
- package/Materials/Textures/cubeTexture.js.map +1 -1
- package/Materials/Textures/equiRectangularCubeTexture.js +1 -1
- package/Materials/Textures/equiRectangularCubeTexture.js.map +1 -1
- package/Materials/Textures/hdrCubeTexture.js +1 -1
- package/Materials/Textures/hdrCubeTexture.js.map +1 -1
- package/Materials/effect.d.ts +5 -0
- package/Materials/effect.js +5 -0
- package/Materials/effect.js.map +1 -1
- package/Materials/material.d.ts +2 -0
- package/Materials/material.js +4 -1
- package/Materials/material.js.map +1 -1
- package/Materials/materialPluginBase.d.ts +14 -0
- package/Materials/materialPluginBase.js +16 -0
- package/Materials/materialPluginBase.js.map +1 -1
- package/Materials/materialPluginEvent.d.ts +2 -0
- package/Materials/materialPluginEvent.js.map +1 -1
- package/Materials/materialPluginManager.d.ts +1 -0
- package/Materials/materialPluginManager.js +13 -1
- package/Materials/materialPluginManager.js.map +1 -1
- package/Materials/shaderMaterial.d.ts +17 -2
- package/Materials/shaderMaterial.js +65 -4
- package/Materials/shaderMaterial.js.map +1 -1
- package/Materials/standardMaterial.js +8 -3
- package/Materials/standardMaterial.js.map +1 -1
- package/Maths/math.vector.d.ts +7 -0
- package/Maths/math.vector.js +43 -11
- package/Maths/math.vector.js.map +1 -1
- package/Meshes/Builders/shapeBuilder.d.ts +12 -0
- package/Meshes/Builders/shapeBuilder.js +48 -10
- package/Meshes/Builders/shapeBuilder.js.map +1 -1
- package/Meshes/mesh.js +1 -1
- package/Meshes/mesh.js.map +1 -1
- package/Meshes/subMesh.d.ts +2 -1
- package/Meshes/subMesh.js +4 -2
- package/Meshes/subMesh.js.map +1 -1
- package/Misc/computePressure.js +4 -3
- package/Misc/computePressure.js.map +1 -1
- package/Misc/iInspectable.d.ts +1 -1
- package/Misc/iInspectable.js.map +1 -1
- package/Misc/screenshotTools.js +31 -14
- package/Misc/screenshotTools.js.map +1 -1
- package/Misc/tools.d.ts +16 -0
- package/Misc/tools.js +44 -30
- package/Misc/tools.js.map +1 -1
- package/Offline/database.js +2 -2
- package/Offline/database.js.map +1 -1
- package/PostProcesses/volumetricLightScatteringPostProcess.d.ts +1 -1
- package/PostProcesses/volumetricLightScatteringPostProcess.js +1 -1
- package/PostProcesses/volumetricLightScatteringPostProcess.js.map +1 -1
- package/Rendering/prePassRendererSceneComponent.js +2 -2
- package/Rendering/prePassRendererSceneComponent.js.map +1 -1
- package/XR/webXRCamera.js +11 -0
- package/XR/webXRCamera.js.map +1 -1
- package/XR/webXRExperienceHelper.js +2 -1
- package/XR/webXRExperienceHelper.js.map +1 -1
- package/package.json +2 -2
- package/sceneComponent.d.ts +2 -2
- package/sceneComponent.js +2 -2
- package/sceneComponent.js.map +1 -1
|
@@ -289,9 +289,10 @@ export declare class BaseTexture extends ThinTexture implements IAnimatable {
|
|
|
289
289
|
* @param sampling
|
|
290
290
|
* @param invertY
|
|
291
291
|
* @param useSRGBBuffer
|
|
292
|
+
* @param isCube
|
|
292
293
|
* @hidden
|
|
293
294
|
*/
|
|
294
|
-
_getFromCache(url: Nullable<string>, noMipmap: boolean, sampling?: number, invertY?: boolean, useSRGBBuffer?: boolean): Nullable<InternalTexture>;
|
|
295
|
+
_getFromCache(url: Nullable<string>, noMipmap: boolean, sampling?: number, invertY?: boolean, useSRGBBuffer?: boolean, isCube?: boolean): Nullable<InternalTexture>;
|
|
295
296
|
/** @hidden */
|
|
296
297
|
_rebuild(): void;
|
|
297
298
|
/**
|
|
@@ -572,9 +572,10 @@ var BaseTexture = /** @class */ (function (_super) {
|
|
|
572
572
|
* @param sampling
|
|
573
573
|
* @param invertY
|
|
574
574
|
* @param useSRGBBuffer
|
|
575
|
+
* @param isCube
|
|
575
576
|
* @hidden
|
|
576
577
|
*/
|
|
577
|
-
BaseTexture.prototype._getFromCache = function (url, noMipmap, sampling, invertY, useSRGBBuffer) {
|
|
578
|
+
BaseTexture.prototype._getFromCache = function (url, noMipmap, sampling, invertY, useSRGBBuffer, isCube) {
|
|
578
579
|
var engine = this._getEngine();
|
|
579
580
|
if (!engine) {
|
|
580
581
|
return null;
|
|
@@ -587,8 +588,10 @@ var BaseTexture = /** @class */ (function (_super) {
|
|
|
587
588
|
if (invertY === undefined || invertY === texturesCacheEntry.invertY) {
|
|
588
589
|
if (texturesCacheEntry.url === url && texturesCacheEntry.generateMipMaps === !noMipmap) {
|
|
589
590
|
if (!sampling || sampling === texturesCacheEntry.samplingMode) {
|
|
590
|
-
texturesCacheEntry.
|
|
591
|
-
|
|
591
|
+
if (isCube === undefined || isCube === texturesCacheEntry.isCube) {
|
|
592
|
+
texturesCacheEntry.incrementReferences();
|
|
593
|
+
return texturesCacheEntry;
|
|
594
|
+
}
|
|
592
595
|
}
|
|
593
596
|
}
|
|
594
597
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"baseTexture.js","sourceRoot":"","sources":["../../../../../../lts/core/generated/Materials/Textures/baseTexture.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3F,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAGnD,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,OAAO,sBAAsB,CAAC;AAE9B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAK5C;;;;GAIG;AACH;IAAiC,+BAAW;IAkexC;;;;;;OAMG;IACH,qBAAY,aAA4C;QAAxD,YACI,kBAAM,IAAI,CAAC,SAmBd;QA1eD;;WAEG;QAEI,cAAQ,GAAQ,IAAI,CAAC;QAE5B;;WAEG;QACI,uBAAiB,GAAQ,IAAI,CAAC;QAG7B,eAAS,GAAG,KAAK,CAAC;QAoBlB,sBAAgB,GAAG,KAAK,CAAC;QAoBjC;;;WAGG;QAEI,WAAK,GAAG,CAAC,CAAC;QAGP,uBAAiB,GAAG,CAAC,CAAC;QAsBtB,sBAAgB,GAAG,SAAS,CAAC,qBAAqB,CAAC;QA+D7D;;;;;;WAMG;QAEI,WAAK,GAAG,SAAS,CAAC,wBAAwB,CAAC;QAElD;;;;WA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sTexture } from \"../../Misc/decorators\";\r\nimport type { Observer } from \"../../Misc/observable\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { Matrix } from \"../../Maths/math.vector\";\r\nimport { EngineStore } from \"../../Engines/engineStore\";\r\nimport type { InternalTexture } from \"../../Materials/Textures/internalTexture\";\r\nimport { Constants } from \"../../Engines/constants\";\r\nimport type { IAnimatable } from \"../../Animations/animatable.interface\";\r\nimport { RandomGUID } from \"../../Misc/guid\";\r\n\r\nimport \"../../Misc/fileTools\";\r\nimport type { ThinEngine } from \"../../Engines/thinEngine\";\r\nimport { ThinTexture } from \"./thinTexture\";\r\nimport type { AbstractScene } from \"../../abstractScene\";\r\n\r\ndeclare type Animation = import(\"../../Animations/animation\").Animation;\r\n\r\n/**\r\n * Base class of all the textures in babylon.\r\n * It groups all the common properties the materials, post process, lights... might need\r\n * in order to make a correct use of the texture.\r\n */\r\nexport class BaseTexture extends ThinTexture implements IAnimatable {\r\n /**\r\n * Default anisotropic filtering level for the application.\r\n * It is set to 4 as a good tradeoff between perf and quality.\r\n */\r\n public static DEFAULT_ANISOTROPIC_FILTERING_LEVEL = 4;\r\n\r\n /**\r\n * Gets or sets the unique id of the texture\r\n */\r\n @serialize()\r\n public uniqueId: number;\r\n\r\n /**\r\n * Define the name of the texture.\r\n */\r\n @serialize()\r\n public name: string;\r\n\r\n /**\r\n * Gets or sets an object used to store user defined information.\r\n */\r\n @serialize()\r\n public metadata: any = null;\r\n\r\n /**\r\n * For internal use only. Please do not use.\r\n */\r\n public reservedDataStore: any = null;\r\n\r\n @serialize(\"hasAlpha\")\r\n private _hasAlpha = false;\r\n /**\r\n * Define if the texture is having a usable alpha value (can be use for transparency or glossiness for instance).\r\n */\r\n public set hasAlpha(value: boolean) {\r\n if (this._hasAlpha === value) {\r\n return;\r\n }\r\n this._hasAlpha = value;\r\n if (this._scene) {\r\n this._scene.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag, (mat) => {\r\n return mat.hasTexture(this);\r\n });\r\n }\r\n }\r\n public get hasAlpha(): boolean {\r\n return this._hasAlpha;\r\n }\r\n\r\n @serialize(\"getAlphaFromRGB\")\r\n private _getAlphaFromRGB = false;\r\n /**\r\n * Defines if the alpha value should be determined via the rgb values.\r\n * If true the luminance of the pixel might be used to find the corresponding alpha value.\r\n */\r\n public set getAlphaFromRGB(value: boolean) {\r\n if (this._getAlphaFromRGB === value) {\r\n return;\r\n }\r\n this._getAlphaFromRGB = value;\r\n if (this._scene) {\r\n this._scene.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag, (mat) => {\r\n return mat.hasTexture(this);\r\n });\r\n }\r\n }\r\n public get getAlphaFromRGB(): boolean {\r\n return this._getAlphaFromRGB;\r\n }\r\n\r\n /**\r\n * Intensity or strength of the texture.\r\n * It is commonly used by materials to fine tune the intensity of the texture\r\n */\r\n @serialize()\r\n public level = 1;\r\n\r\n @serialize(\"coordinatesIndex\")\r\n protected _coordinatesIndex = 0;\r\n\r\n /**\r\n * Define the UV channel to use starting from 0 and defaulting to 0.\r\n * This is part of the texture as textures usually maps to one uv set.\r\n */\r\n public set coordinatesIndex(value: number) {\r\n if (this._coordinatesIndex === value) {\r\n return;\r\n }\r\n this._coordinatesIndex = value;\r\n if (this._scene) {\r\n this._scene.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag, (mat) => {\r\n return mat.hasTexture(this);\r\n });\r\n }\r\n }\r\n public get coordinatesIndex(): number {\r\n return this._coordinatesIndex;\r\n }\r\n\r\n @serialize(\"coordinatesMode\")\r\n protected _coordinatesMode = Constants.TEXTURE_EXPLICIT_MODE;\r\n\r\n /**\r\n * How a texture is mapped.\r\n *\r\n * | Value | Type | Description |\r\n * | ----- | ----------------------------------- | ----------- |\r\n * | 0 | EXPLICIT_MODE | |\r\n * | 1 | SPHERICAL_MODE | |\r\n * | 2 | PLANAR_MODE | |\r\n * | 3 | CUBIC_MODE | |\r\n * | 4 | PROJECTION_MODE | |\r\n * | 5 | SKYBOX_MODE | |\r\n * | 6 | INVCUBIC_MODE | |\r\n * | 7 | EQUIRECTANGULAR_MODE | |\r\n * | 8 | FIXED_EQUIRECTANGULAR_MODE | |\r\n * | 9 | FIXED_EQUIRECTANGULAR_MIRRORED_MODE | |\r\n */\r\n public set coordinatesMode(value: number) {\r\n if (this._coordinatesMode === value) {\r\n return;\r\n }\r\n this._coordinatesMode = value;\r\n if (this._scene) {\r\n this._scene.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag, (mat) => {\r\n return mat.hasTexture(this);\r\n });\r\n }\r\n }\r\n public get coordinatesMode(): number {\r\n return this._coordinatesMode;\r\n }\r\n\r\n /**\r\n * | Value | Type | Description |\r\n * | ----- | ------------------ | ----------- |\r\n * | 0 | CLAMP_ADDRESSMODE | |\r\n * | 1 | WRAP_ADDRESSMODE | |\r\n * | 2 | MIRROR_ADDRESSMODE | |\r\n */\r\n @serialize()\r\n public get wrapU() {\r\n return this._wrapU;\r\n }\r\n public set wrapU(value: number) {\r\n this._wrapU = value;\r\n }\r\n\r\n /**\r\n * | Value | Type | Description |\r\n * | ----- | ------------------ | ----------- |\r\n * | 0 | CLAMP_ADDRESSMODE | |\r\n * | 1 | WRAP_ADDRESSMODE | |\r\n * | 2 | MIRROR_ADDRESSMODE | |\r\n */\r\n @serialize()\r\n public get wrapV() {\r\n return this._wrapV;\r\n }\r\n public set wrapV(value: number) {\r\n this._wrapV = value;\r\n }\r\n\r\n /**\r\n * | Value | Type | Description |\r\n * | ----- | ------------------ | ----------- |\r\n * | 0 | CLAMP_ADDRESSMODE | |\r\n * | 1 | WRAP_ADDRESSMODE | |\r\n * | 2 | MIRROR_ADDRESSMODE | |\r\n */\r\n @serialize()\r\n public wrapR = Constants.TEXTURE_WRAP_ADDRESSMODE;\r\n\r\n /**\r\n * With compliant hardware and browser (supporting anisotropic filtering)\r\n * this defines the level of anisotropic filtering in the texture.\r\n * The higher the better but the slower. This defaults to 4 as it seems to be the best tradeoff.\r\n */\r\n @serialize()\r\n public anisotropicFilteringLevel = BaseTexture.DEFAULT_ANISOTROPIC_FILTERING_LEVEL;\r\n\r\n private _isCube = false;\r\n /**\r\n * Define if the texture is a cube texture or if false a 2d texture.\r\n */\r\n @serialize()\r\n public get isCube(): boolean {\r\n if (!this._texture) {\r\n return this._isCube;\r\n }\r\n\r\n return this._texture.isCube;\r\n }\r\n\r\n public set isCube(value: boolean) {\r\n if (!this._texture) {\r\n this._isCube = value;\r\n } else {\r\n this._texture.isCube = value;\r\n }\r\n }\r\n\r\n /**\r\n * Define if the texture is a 3d texture (webgl 2) or if false a 2d texture.\r\n */\r\n @serialize()\r\n public get is3D(): boolean {\r\n if (!this._texture) {\r\n return false;\r\n }\r\n\r\n return this._texture.is3D;\r\n }\r\n\r\n public set is3D(value: boolean) {\r\n if (!this._texture) {\r\n return;\r\n }\r\n\r\n this._texture.is3D = value;\r\n }\r\n\r\n /**\r\n * Define if the texture is a 2d array texture (webgl 2) or if false a 2d texture.\r\n */\r\n @serialize()\r\n public get is2DArray(): boolean {\r\n if (!this._texture) {\r\n return false;\r\n }\r\n\r\n return this._texture.is2DArray;\r\n }\r\n\r\n public set is2DArray(value: boolean) {\r\n if (!this._texture) {\r\n return;\r\n }\r\n\r\n this._texture.is2DArray = value;\r\n }\r\n\r\n private _gammaSpace = true;\r\n /**\r\n * Define if the texture contains data in gamma space (most of the png/jpg aside bump).\r\n * HDR texture are usually stored in linear space.\r\n * This only impacts the PBR and Background materials\r\n */\r\n @serialize()\r\n public get gammaSpace(): boolean {\r\n if (!this._texture) {\r\n return this._gammaSpace;\r\n } else {\r\n if (this._texture._gammaSpace === null) {\r\n this._texture._gammaSpace = this._gammaSpace;\r\n }\r\n }\r\n\r\n return this._texture._gammaSpace && !this._texture._useSRGBBuffer;\r\n }\r\n\r\n public set gammaSpace(gamma: boolean) {\r\n if (!this._texture) {\r\n if (this._gammaSpace === gamma) {\r\n return;\r\n }\r\n\r\n this._gammaSpace = gamma;\r\n } else {\r\n if (this._texture._gammaSpace === gamma) {\r\n return;\r\n }\r\n this._texture._gammaSpace = gamma;\r\n }\r\n\r\n this._markAllSubMeshesAsTexturesDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets whether or not the texture contains RGBD data.\r\n */\r\n public get isRGBD(): boolean {\r\n return this._texture != null && this._texture._isRGBD;\r\n }\r\n public set isRGBD(value: boolean) {\r\n if (this._texture) {\r\n this._texture._isRGBD = value;\r\n }\r\n }\r\n\r\n /**\r\n * Is Z inverted in the texture (useful in a cube texture).\r\n */\r\n @serialize()\r\n public invertZ = false;\r\n\r\n /**\r\n * Are mip maps generated for this texture or not.\r\n */\r\n public get noMipmap(): boolean {\r\n return false;\r\n }\r\n\r\n /**\r\n * @hidden\r\n */\r\n @serialize()\r\n public lodLevelInAlpha = false;\r\n\r\n /**\r\n * With prefiltered texture, defined the offset used during the prefiltering steps.\r\n */\r\n @serialize()\r\n public get lodGenerationOffset(): number {\r\n if (this._texture) {\r\n return this._texture._lodGenerationOffset;\r\n }\r\n\r\n return 0.0;\r\n }\r\n public set lodGenerationOffset(value: number) {\r\n if (this._texture) {\r\n this._texture._lodGenerationOffset = value;\r\n }\r\n }\r\n\r\n /**\r\n * With prefiltered texture, defined the scale used during the prefiltering steps.\r\n */\r\n @serialize()\r\n public get lodGenerationScale(): number {\r\n if (this._texture) {\r\n return this._texture._lodGenerationScale;\r\n }\r\n\r\n return 0.0;\r\n }\r\n public set lodGenerationScale(value: number) {\r\n if (this._texture) {\r\n this._texture._lodGenerationScale = value;\r\n }\r\n }\r\n\r\n /**\r\n * With prefiltered texture, defined if the specular generation is based on a linear ramp.\r\n * By default we are using a log2 of the linear roughness helping to keep a better resolution for\r\n * average roughness values.\r\n */\r\n @serialize()\r\n public get linearSpecularLOD(): boolean {\r\n if (this._texture) {\r\n return this._texture._linearSpecularLOD;\r\n }\r\n\r\n return false;\r\n }\r\n public set linearSpecularLOD(value: boolean) {\r\n if (this._texture) {\r\n this._texture._linearSpecularLOD = value;\r\n }\r\n }\r\n\r\n /**\r\n * In case a better definition than spherical harmonics is required for the diffuse part of the environment.\r\n * You can set the irradiance texture to rely on a texture instead of the spherical approach.\r\n * This texture need to have the same characteristics than its parent (Cube vs 2d, coordinates mode, Gamma/Linear, RGBD).\r\n */\r\n @serializeAsTexture()\r\n public get irradianceTexture(): Nullable<BaseTexture> {\r\n if (this._texture) {\r\n return this._texture._irradianceTexture;\r\n }\r\n\r\n return null;\r\n }\r\n public set irradianceTexture(value: Nullable<BaseTexture>) {\r\n if (this._texture) {\r\n this._texture._irradianceTexture = value;\r\n }\r\n }\r\n\r\n /**\r\n * Define if the texture is a render target.\r\n */\r\n @serialize()\r\n public isRenderTarget = false;\r\n\r\n /**\r\n * Define the unique id of the texture in the scene.\r\n */\r\n public get uid(): string {\r\n if (!this._uid) {\r\n this._uid = RandomGUID();\r\n }\r\n return this._uid;\r\n }\r\n\r\n /** @hidden */\r\n public _prefiltered: boolean = false;\r\n /** @hidden */\r\n public _forceSerialize: boolean = false;\r\n\r\n /**\r\n * Return a string representation of the texture.\r\n * @returns the texture as a string\r\n */\r\n public toString(): string {\r\n return this.name;\r\n }\r\n\r\n /**\r\n * Get the class name of the texture.\r\n * @returns \"BaseTexture\"\r\n */\r\n public getClassName(): string {\r\n return \"BaseTexture\";\r\n }\r\n\r\n /**\r\n * Define the list of animation attached to the texture.\r\n */\r\n public animations = new Array<Animation>();\r\n\r\n /**\r\n * An event triggered when the texture is disposed.\r\n */\r\n public onDisposeObservable = new Observable<BaseTexture>();\r\n\r\n private _onDisposeObserver: Nullable<Observer<BaseTexture>> = null;\r\n /**\r\n * Callback triggered when the texture has been disposed.\r\n * Kept for back compatibility, you can use the onDisposeObservable instead.\r\n */\r\n public set onDispose(callback: () => void) {\r\n if (this._onDisposeObserver) {\r\n this.onDisposeObservable.remove(this._onDisposeObserver);\r\n }\r\n this._onDisposeObserver = this.onDisposeObservable.add(callback);\r\n }\r\n\r\n protected _scene: Nullable<Scene> = null;\r\n\r\n /** @hidden */\r\n private _uid: Nullable<string> = null;\r\n\r\n /**\r\n * Define if the texture is preventing a material to render or not.\r\n * If not and the texture is not ready, the engine will use a default black texture instead.\r\n */\r\n public get isBlocking(): boolean {\r\n return true;\r\n }\r\n\r\n /** @hidden */\r\n public _parentContainer: Nullable<AbstractScene> = null;\r\n\r\n protected _loadingError: boolean = false;\r\n protected _errorObject?: {\r\n message?: string;\r\n exception?: any;\r\n };\r\n\r\n /**\r\n * Was there any loading error?\r\n */\r\n public get loadingError(): boolean {\r\n return this._loadingError;\r\n }\r\n\r\n /**\r\n * If a loading error occurred this object will be populated with information about the error.\r\n */\r\n public get errorObject():\r\n | {\r\n message?: string;\r\n exception?: any;\r\n }\r\n | undefined {\r\n return this._errorObject;\r\n }\r\n\r\n /**\r\n * Instantiates a new BaseTexture.\r\n * Base class of all the textures in babylon.\r\n * It groups all the common properties the materials, post process, lights... might need\r\n * in order to make a correct use of the texture.\r\n * @param sceneOrEngine Define the scene or engine the texture belongs to\r\n */\r\n constructor(sceneOrEngine?: Nullable<Scene | ThinEngine>) {\r\n super(null);\r\n\r\n if (sceneOrEngine) {\r\n if (BaseTexture._IsScene(sceneOrEngine)) {\r\n this._scene = sceneOrEngine;\r\n } else {\r\n this._engine = sceneOrEngine;\r\n }\r\n } else {\r\n this._scene = EngineStore.LastCreatedScene;\r\n }\r\n\r\n if (this._scene) {\r\n this.uniqueId = this._scene.getUniqueId();\r\n this._scene.addTexture(this);\r\n this._engine = this._scene.getEngine();\r\n }\r\n\r\n this._uid = null;\r\n }\r\n\r\n /**\r\n * Get the scene the texture belongs to.\r\n * @returns the scene or null if undefined\r\n */\r\n public getScene(): Nullable<Scene> {\r\n return this._scene;\r\n }\r\n\r\n /** @hidden */\r\n protected _getEngine(): Nullable<ThinEngine> {\r\n return this._engine;\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<BaseTexture>): boolean {\r\n return texture !== null;\r\n }\r\n\r\n /**\r\n * Get the texture transform matrix used to offset tile the texture for instance.\r\n * @returns the transformation matrix\r\n */\r\n public getTextureMatrix(): Matrix {\r\n return <Matrix>Matrix.IdentityReadOnly;\r\n }\r\n\r\n /**\r\n * Get the texture reflection matrix used to rotate/transform the reflection.\r\n * @returns the reflection matrix\r\n */\r\n public getReflectionTextureMatrix(): Matrix {\r\n return <Matrix>Matrix.IdentityReadOnly;\r\n }\r\n\r\n /**\r\n * Get if the texture is ready to be consumed (either it is ready or it is not blocking)\r\n * @returns true if ready, not blocking or if there was an error loading the texture\r\n */\r\n public isReadyOrNotBlocking(): boolean {\r\n return !this.isBlocking || this.isReady() || this.loadingError;\r\n }\r\n\r\n /**\r\n * Scales the texture if is `canRescale()`\r\n * @param ratio the resize factor we want to use to rescale\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n public scale(ratio: number): void {}\r\n\r\n /**\r\n * Get if the texture can rescale.\r\n */\r\n public get canRescale(): boolean {\r\n return false;\r\n }\r\n\r\n /**\r\n * @param url\r\n * @param noMipmap\r\n * @param sampling\r\n * @param invertY\r\n * @param useSRGBBuffer\r\n * @hidden\r\n */\r\n public _getFromCache(url: Nullable<string>, noMipmap: boolean, sampling?: number, invertY?: boolean, useSRGBBuffer?: boolean): Nullable<InternalTexture> {\r\n const engine = this._getEngine();\r\n if (!engine) {\r\n return null;\r\n }\r\n\r\n const correctedUseSRGBBuffer = engine._getUseSRGBBuffer(!!useSRGBBuffer, noMipmap);\r\n\r\n const texturesCache = engine.getLoadedTexturesCache();\r\n for (let index = 0; index < texturesCache.length; index++) {\r\n const texturesCacheEntry = texturesCache[index];\r\n\r\n if (useSRGBBuffer === undefined || correctedUseSRGBBuffer === texturesCacheEntry._useSRGBBuffer) {\r\n if (invertY === undefined || invertY === texturesCacheEntry.invertY) {\r\n if (texturesCacheEntry.url === url && texturesCacheEntry.generateMipMaps === !noMipmap) {\r\n if (!sampling || sampling === texturesCacheEntry.samplingMode) {\r\n texturesCacheEntry.incrementReferences();\r\n return texturesCacheEntry;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /** @hidden */\r\n public _rebuild(): void {}\r\n\r\n /**\r\n * Clones the texture.\r\n * @returns the cloned texture\r\n */\r\n public clone(): Nullable<BaseTexture> {\r\n return null;\r\n }\r\n\r\n /**\r\n * Get the texture underlying type (INT, FLOAT...)\r\n */\r\n public get textureType(): number {\r\n if (!this._texture) {\r\n return Constants.TEXTURETYPE_UNSIGNED_INT;\r\n }\r\n\r\n return this._texture.type !== undefined ? this._texture.type : Constants.TEXTURETYPE_UNSIGNED_INT;\r\n }\r\n\r\n /**\r\n * Get the texture underlying format (RGB, RGBA...)\r\n */\r\n public get textureFormat(): number {\r\n if (!this._texture) {\r\n return Constants.TEXTUREFORMAT_RGBA;\r\n }\r\n\r\n return this._texture.format !== undefined ? this._texture.format : Constants.TEXTUREFORMAT_RGBA;\r\n }\r\n\r\n /**\r\n * Indicates that textures need to be re-calculated for all materials\r\n */\r\n protected _markAllSubMeshesAsTexturesDirty() {\r\n const scene = this.getScene();\r\n\r\n if (!scene) {\r\n return;\r\n }\r\n\r\n scene.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag);\r\n }\r\n\r\n /**\r\n * Reads the pixels stored in the webgl texture and returns them as an ArrayBuffer.\r\n * This will returns an RGBA array buffer containing either in values (0-255) or\r\n * float values (0-1) depending of the underlying buffer type.\r\n * @param faceIndex defines the face of the texture to read (in case of cube texture)\r\n * @param level defines the LOD level of the texture to read (in case of Mip Maps)\r\n * @param buffer defines a user defined buffer to fill with data (can be null)\r\n * @param flushRenderer true to flush the renderer from the pending commands before reading the pixels\r\n * @param noDataConversion false to convert the data to Uint8Array (if texture type is UNSIGNED_BYTE) or to Float32Array (if texture type is anything but UNSIGNED_BYTE). If true, the type of the generated buffer (if buffer==null) will depend on the type of the texture\r\n * @param x defines the region x coordinates to start reading from (default to 0)\r\n * @param y defines the region y coordinates to start reading from (default to 0)pe is UNSIGNED_BYTE) or to Float32Array (if texture type is anything but UNSIGNED_BYTE). If true, the type of the generated buffer (if buffer==null) will depend on the type of the texture\r\n * @param width defines the region width to read from (default to the texture size at level)\r\n * @param height defines the region width to read from (default to the texture size at level)\r\n * @returns The Array buffer promise containing the pixels data.\r\n */\r\n public readPixels(\r\n faceIndex = 0,\r\n level = 0,\r\n buffer: Nullable<ArrayBufferView> = null,\r\n flushRenderer = true,\r\n noDataConversion = false,\r\n x = 0,\r\n y = 0,\r\n width = Number.MAX_VALUE,\r\n height = Number.MAX_VALUE\r\n ): Nullable<Promise<ArrayBufferView>> {\r\n if (!this._texture) {\r\n return null;\r\n }\r\n\r\n const engine = this._getEngine();\r\n if (!engine) {\r\n return null;\r\n }\r\n\r\n const size = this.getSize();\r\n let maxWidth = size.width;\r\n let maxHeight = size.height;\r\n if (level !== 0) {\r\n maxWidth = maxWidth / Math.pow(2, level);\r\n maxHeight = maxHeight / Math.pow(2, level);\r\n maxWidth = Math.round(maxWidth);\r\n maxHeight = Math.round(maxHeight);\r\n }\r\n\r\n width = Math.min(maxWidth, width);\r\n height = Math.min(maxHeight, height);\r\n\r\n try {\r\n if (this._texture.isCube) {\r\n return engine._readTexturePixels(this._texture, width, height, faceIndex, level, buffer, flushRenderer, noDataConversion, x, y);\r\n }\r\n\r\n return engine._readTexturePixels(this._texture, width, height, -1, level, buffer, flushRenderer, noDataConversion, x, y);\r\n } catch (e) {\r\n return null;\r\n }\r\n }\r\n\r\n /**\r\n * @param faceIndex\r\n * @param level\r\n * @param buffer\r\n * @param flushRenderer\r\n * @param noDataConversion\r\n * @hidden\r\n */\r\n public _readPixelsSync(faceIndex = 0, level = 0, buffer: Nullable<ArrayBufferView> = null, flushRenderer = true, noDataConversion = false): Nullable<ArrayBufferView> {\r\n if (!this._texture) {\r\n return null;\r\n }\r\n\r\n const size = this.getSize();\r\n let width = size.width;\r\n let height = size.height;\r\n\r\n const engine = this._getEngine();\r\n if (!engine) {\r\n return null;\r\n }\r\n\r\n if (level != 0) {\r\n width = width / Math.pow(2, level);\r\n height = height / Math.pow(2, level);\r\n\r\n width = Math.round(width);\r\n height = Math.round(height);\r\n }\r\n\r\n try {\r\n if (this._texture.isCube) {\r\n return engine._readTexturePixelsSync(this._texture, width, height, faceIndex, level, buffer, flushRenderer, noDataConversion);\r\n }\r\n\r\n return engine._readTexturePixelsSync(this._texture, width, height, -1, level, buffer, flushRenderer, noDataConversion);\r\n } catch (e) {\r\n return null;\r\n }\r\n }\r\n\r\n /** @hidden */\r\n public get _lodTextureHigh(): Nullable<BaseTexture> {\r\n if (this._texture) {\r\n return this._texture._lodTextureHigh;\r\n }\r\n return null;\r\n }\r\n\r\n /** @hidden */\r\n public get _lodTextureMid(): Nullable<BaseTexture> {\r\n if (this._texture) {\r\n return this._texture._lodTextureMid;\r\n }\r\n return null;\r\n }\r\n\r\n /** @hidden */\r\n public get _lodTextureLow(): Nullable<BaseTexture> {\r\n if (this._texture) {\r\n return this._texture._lodTextureLow;\r\n }\r\n return null;\r\n }\r\n\r\n /**\r\n * Dispose the texture and release its associated resources.\r\n */\r\n public dispose(): void {\r\n if (this._scene) {\r\n // Animations\r\n if (this._scene.stopAnimation) {\r\n this._scene.stopAnimation(this);\r\n }\r\n\r\n // Remove from scene\r\n this._scene._removePendingData(this);\r\n const index = this._scene.textures.indexOf(this);\r\n\r\n if (index >= 0) {\r\n this._scene.textures.splice(index, 1);\r\n }\r\n this._scene.onTextureRemovedObservable.notifyObservers(this);\r\n this._scene = null;\r\n\r\n if (this._parentContainer) {\r\n const index = this._parentContainer.textures.indexOf(this);\r\n if (index > -1) {\r\n this._parentContainer.textures.splice(index, 1);\r\n }\r\n this._parentContainer = null;\r\n }\r\n }\r\n\r\n // Callback\r\n this.onDisposeObservable.notifyObservers(this);\r\n this.onDisposeObservable.clear();\r\n\r\n this.metadata = null;\r\n\r\n super.dispose();\r\n }\r\n\r\n /**\r\n * Serialize the texture into a JSON representation that can be parsed later on.\r\n * @returns the JSON representation of the texture\r\n */\r\n public serialize(): any {\r\n if (!this.name) {\r\n return null;\r\n }\r\n\r\n const serializationObject = SerializationHelper.Serialize(this);\r\n\r\n // Animations\r\n SerializationHelper.AppendSerializedAnimations(this, serializationObject);\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Helper function to be called back once a list of texture contains only ready textures.\r\n * @param textures Define the list of textures to wait for\r\n * @param callback Define the callback triggered once the entire list will be ready\r\n */\r\n public static WhenAllReady(textures: BaseTexture[], callback: () => void): void {\r\n let numRemaining = textures.length;\r\n if (numRemaining === 0) {\r\n callback();\r\n return;\r\n }\r\n\r\n for (let i = 0; i < textures.length; i++) {\r\n const texture = textures[i];\r\n\r\n if (texture.isReady()) {\r\n if (--numRemaining === 0) {\r\n callback();\r\n }\r\n } else {\r\n const onLoadObservable = (texture as any).onLoadObservable as Observable<BaseTexture>;\r\n\r\n if (onLoadObservable) {\r\n onLoadObservable.addOnce(() => {\r\n if (--numRemaining === 0) {\r\n callback();\r\n }\r\n });\r\n } else {\r\n if (--numRemaining === 0) {\r\n callback();\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n private static _IsScene(sceneOrEngine: Scene | ThinEngine): sceneOrEngine is Scene {\r\n return sceneOrEngine.getClassName() === \"Scene\";\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"baseTexture.js","sourceRoot":"","sources":["../../../../../../lts/core/generated/Materials/Textures/baseTexture.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3F,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAGnD,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA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5B;QADC,SAAS,CAAC,UAAU,CAAC;kDACI;IAoB1B;QADC,SAAS,CAAC,iBAAiB,CAAC;yDACI;IAyBjC;QADC,SAAS,EAAE;8CACK;IAGjB;QADC,SAAS,CAAC,kBAAkB,CAAC;0DACE;IAsBhC;QADC,SAAS,CAAC,iBAAiB,CAAC;yDACgC;IAyC7D;QADC,SAAS,EAAE;4CAGX;IAaD;QADC,SAAS,EAAE;4CAGX;IAaD;QADC,SAAS,EAAE;8CACsC;IAQlD;QADC,SAAS,EAAE;kEACuE;IAOnF;QADC,SAAS,EAAE;6CAOX;IAcD;QADC,SAAS,EAAE;2CAOX;IAcD;QADC,SAAS,EAAE;gDAOX;IAiBD;QADC,SAAS,EAAE;iDAWX;IAmCD;QADC,SAAS,EAAE;gDACW;IAavB;QADC,SAAS,EAAE;wDACmB;IAM/B;QADC,SAAS,EAAE;0DAOX;IAWD;QADC,SAAS,EAAE;yDAOX;IAaD;QADC,SAAS,EAAE;wDAOX;IAaD;QADC,kBAAkB,EAAE;wDAOpB;IAWD;QADC,SAAS,EAAE;uDACkB;IAwelC,kBAAC;CAAA,AA12BD,CAAiC,WAAW,GA02B3C;SA12BY,WAAW","sourcesContent":["import { serialize, SerializationHelper, serializeAsTexture } from \"../../Misc/decorators\";\r\nimport type { Observer } from \"../../Misc/observable\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { Matrix } from \"../../Maths/math.vector\";\r\nimport { EngineStore } from \"../../Engines/engineStore\";\r\nimport type { InternalTexture } from \"../../Materials/Textures/internalTexture\";\r\nimport { Constants } from \"../../Engines/constants\";\r\nimport type { IAnimatable } from \"../../Animations/animatable.interface\";\r\nimport { RandomGUID } from \"../../Misc/guid\";\r\n\r\nimport \"../../Misc/fileTools\";\r\nimport type { ThinEngine } from \"../../Engines/thinEngine\";\r\nimport { ThinTexture } from \"./thinTexture\";\r\nimport type { AbstractScene } from \"../../abstractScene\";\r\n\r\ndeclare type Animation = import(\"../../Animations/animation\").Animation;\r\n\r\n/**\r\n * Base class of all the textures in babylon.\r\n * It groups all the common properties the materials, post process, lights... might need\r\n * in order to make a correct use of the texture.\r\n */\r\nexport class BaseTexture extends ThinTexture implements IAnimatable {\r\n /**\r\n * Default anisotropic filtering level for the application.\r\n * It is set to 4 as a good tradeoff between perf and quality.\r\n */\r\n public static DEFAULT_ANISOTROPIC_FILTERING_LEVEL = 4;\r\n\r\n /**\r\n * Gets or sets the unique id of the texture\r\n */\r\n @serialize()\r\n public uniqueId: number;\r\n\r\n /**\r\n * Define the name of the texture.\r\n */\r\n @serialize()\r\n public name: string;\r\n\r\n /**\r\n * Gets or sets an object used to store user defined information.\r\n */\r\n @serialize()\r\n public metadata: any = null;\r\n\r\n /**\r\n * For internal use only. Please do not use.\r\n */\r\n public reservedDataStore: any = null;\r\n\r\n @serialize(\"hasAlpha\")\r\n private _hasAlpha = false;\r\n /**\r\n * Define if the texture is having a usable alpha value (can be use for transparency or glossiness for instance).\r\n */\r\n public set hasAlpha(value: boolean) {\r\n if (this._hasAlpha === value) {\r\n return;\r\n }\r\n this._hasAlpha = value;\r\n if (this._scene) {\r\n this._scene.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag, (mat) => {\r\n return mat.hasTexture(this);\r\n });\r\n }\r\n }\r\n public get hasAlpha(): boolean {\r\n return this._hasAlpha;\r\n }\r\n\r\n @serialize(\"getAlphaFromRGB\")\r\n private _getAlphaFromRGB = false;\r\n /**\r\n * Defines if the alpha value should be determined via the rgb values.\r\n * If true the luminance of the pixel might be used to find the corresponding alpha value.\r\n */\r\n public set getAlphaFromRGB(value: boolean) {\r\n if (this._getAlphaFromRGB === value) {\r\n return;\r\n }\r\n this._getAlphaFromRGB = value;\r\n if (this._scene) {\r\n this._scene.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag, (mat) => {\r\n return mat.hasTexture(this);\r\n });\r\n }\r\n }\r\n public get getAlphaFromRGB(): boolean {\r\n return this._getAlphaFromRGB;\r\n }\r\n\r\n /**\r\n * Intensity or strength of the texture.\r\n * It is commonly used by materials to fine tune the intensity of the texture\r\n */\r\n @serialize()\r\n public level = 1;\r\n\r\n @serialize(\"coordinatesIndex\")\r\n protected _coordinatesIndex = 0;\r\n\r\n /**\r\n * Define the UV channel to use starting from 0 and defaulting to 0.\r\n * This is part of the texture as textures usually maps to one uv set.\r\n */\r\n public set coordinatesIndex(value: number) {\r\n if (this._coordinatesIndex === value) {\r\n return;\r\n }\r\n this._coordinatesIndex = value;\r\n if (this._scene) {\r\n this._scene.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag, (mat) => {\r\n return mat.hasTexture(this);\r\n });\r\n }\r\n }\r\n public get coordinatesIndex(): number {\r\n return this._coordinatesIndex;\r\n }\r\n\r\n @serialize(\"coordinatesMode\")\r\n protected _coordinatesMode = Constants.TEXTURE_EXPLICIT_MODE;\r\n\r\n /**\r\n * How a texture is mapped.\r\n *\r\n * | Value | Type | Description |\r\n * | ----- | ----------------------------------- | ----------- |\r\n * | 0 | EXPLICIT_MODE | |\r\n * | 1 | SPHERICAL_MODE | |\r\n * | 2 | PLANAR_MODE | |\r\n * | 3 | CUBIC_MODE | |\r\n * | 4 | PROJECTION_MODE | |\r\n * | 5 | SKYBOX_MODE | |\r\n * | 6 | INVCUBIC_MODE | |\r\n * | 7 | EQUIRECTANGULAR_MODE | |\r\n * | 8 | FIXED_EQUIRECTANGULAR_MODE | |\r\n * | 9 | FIXED_EQUIRECTANGULAR_MIRRORED_MODE | |\r\n */\r\n public set coordinatesMode(value: number) {\r\n if (this._coordinatesMode === value) {\r\n return;\r\n }\r\n this._coordinatesMode = value;\r\n if (this._scene) {\r\n this._scene.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag, (mat) => {\r\n return mat.hasTexture(this);\r\n });\r\n }\r\n }\r\n public get coordinatesMode(): number {\r\n return this._coordinatesMode;\r\n }\r\n\r\n /**\r\n * | Value | Type | Description |\r\n * | ----- | ------------------ | ----------- |\r\n * | 0 | CLAMP_ADDRESSMODE | |\r\n * | 1 | WRAP_ADDRESSMODE | |\r\n * | 2 | MIRROR_ADDRESSMODE | |\r\n */\r\n @serialize()\r\n public get wrapU() {\r\n return this._wrapU;\r\n }\r\n public set wrapU(value: number) {\r\n this._wrapU = value;\r\n }\r\n\r\n /**\r\n * | Value | Type | Description |\r\n * | ----- | ------------------ | ----------- |\r\n * | 0 | CLAMP_ADDRESSMODE | |\r\n * | 1 | WRAP_ADDRESSMODE | |\r\n * | 2 | MIRROR_ADDRESSMODE | |\r\n */\r\n @serialize()\r\n public get wrapV() {\r\n return this._wrapV;\r\n }\r\n public set wrapV(value: number) {\r\n this._wrapV = value;\r\n }\r\n\r\n /**\r\n * | Value | Type | Description |\r\n * | ----- | ------------------ | ----------- |\r\n * | 0 | CLAMP_ADDRESSMODE | |\r\n * | 1 | WRAP_ADDRESSMODE | |\r\n * | 2 | MIRROR_ADDRESSMODE | |\r\n */\r\n @serialize()\r\n public wrapR = Constants.TEXTURE_WRAP_ADDRESSMODE;\r\n\r\n /**\r\n * With compliant hardware and browser (supporting anisotropic filtering)\r\n * this defines the level of anisotropic filtering in the texture.\r\n * The higher the better but the slower. This defaults to 4 as it seems to be the best tradeoff.\r\n */\r\n @serialize()\r\n public anisotropicFilteringLevel = BaseTexture.DEFAULT_ANISOTROPIC_FILTERING_LEVEL;\r\n\r\n private _isCube = false;\r\n /**\r\n * Define if the texture is a cube texture or if false a 2d texture.\r\n */\r\n @serialize()\r\n public get isCube(): boolean {\r\n if (!this._texture) {\r\n return this._isCube;\r\n }\r\n\r\n return this._texture.isCube;\r\n }\r\n\r\n public set isCube(value: boolean) {\r\n if (!this._texture) {\r\n this._isCube = value;\r\n } else {\r\n this._texture.isCube = value;\r\n }\r\n }\r\n\r\n /**\r\n * Define if the texture is a 3d texture (webgl 2) or if false a 2d texture.\r\n */\r\n @serialize()\r\n public get is3D(): boolean {\r\n if (!this._texture) {\r\n return false;\r\n }\r\n\r\n return this._texture.is3D;\r\n }\r\n\r\n public set is3D(value: boolean) {\r\n if (!this._texture) {\r\n return;\r\n }\r\n\r\n this._texture.is3D = value;\r\n }\r\n\r\n /**\r\n * Define if the texture is a 2d array texture (webgl 2) or if false a 2d texture.\r\n */\r\n @serialize()\r\n public get is2DArray(): boolean {\r\n if (!this._texture) {\r\n return false;\r\n }\r\n\r\n return this._texture.is2DArray;\r\n }\r\n\r\n public set is2DArray(value: boolean) {\r\n if (!this._texture) {\r\n return;\r\n }\r\n\r\n this._texture.is2DArray = value;\r\n }\r\n\r\n private _gammaSpace = true;\r\n /**\r\n * Define if the texture contains data in gamma space (most of the png/jpg aside bump).\r\n * HDR texture are usually stored in linear space.\r\n * This only impacts the PBR and Background materials\r\n */\r\n @serialize()\r\n public get gammaSpace(): boolean {\r\n if (!this._texture) {\r\n return this._gammaSpace;\r\n } else {\r\n if (this._texture._gammaSpace === null) {\r\n this._texture._gammaSpace = this._gammaSpace;\r\n }\r\n }\r\n\r\n return this._texture._gammaSpace && !this._texture._useSRGBBuffer;\r\n }\r\n\r\n public set gammaSpace(gamma: boolean) {\r\n if (!this._texture) {\r\n if (this._gammaSpace === gamma) {\r\n return;\r\n }\r\n\r\n this._gammaSpace = gamma;\r\n } else {\r\n if (this._texture._gammaSpace === gamma) {\r\n return;\r\n }\r\n this._texture._gammaSpace = gamma;\r\n }\r\n\r\n this._markAllSubMeshesAsTexturesDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets whether or not the texture contains RGBD data.\r\n */\r\n public get isRGBD(): boolean {\r\n return this._texture != null && this._texture._isRGBD;\r\n }\r\n public set isRGBD(value: boolean) {\r\n if (this._texture) {\r\n this._texture._isRGBD = value;\r\n }\r\n }\r\n\r\n /**\r\n * Is Z inverted in the texture (useful in a cube texture).\r\n */\r\n @serialize()\r\n public invertZ = false;\r\n\r\n /**\r\n * Are mip maps generated for this texture or not.\r\n */\r\n public get noMipmap(): boolean {\r\n return false;\r\n }\r\n\r\n /**\r\n * @hidden\r\n */\r\n @serialize()\r\n public lodLevelInAlpha = false;\r\n\r\n /**\r\n * With prefiltered texture, defined the offset used during the prefiltering steps.\r\n */\r\n @serialize()\r\n public get lodGenerationOffset(): number {\r\n if (this._texture) {\r\n return this._texture._lodGenerationOffset;\r\n }\r\n\r\n return 0.0;\r\n }\r\n public set lodGenerationOffset(value: number) {\r\n if (this._texture) {\r\n this._texture._lodGenerationOffset = value;\r\n }\r\n }\r\n\r\n /**\r\n * With prefiltered texture, defined the scale used during the prefiltering steps.\r\n */\r\n @serialize()\r\n public get lodGenerationScale(): number {\r\n if (this._texture) {\r\n return this._texture._lodGenerationScale;\r\n }\r\n\r\n return 0.0;\r\n }\r\n public set lodGenerationScale(value: number) {\r\n if (this._texture) {\r\n this._texture._lodGenerationScale = value;\r\n }\r\n }\r\n\r\n /**\r\n * With prefiltered texture, defined if the specular generation is based on a linear ramp.\r\n * By default we are using a log2 of the linear roughness helping to keep a better resolution for\r\n * average roughness values.\r\n */\r\n @serialize()\r\n public get linearSpecularLOD(): boolean {\r\n if (this._texture) {\r\n return this._texture._linearSpecularLOD;\r\n }\r\n\r\n return false;\r\n }\r\n public set linearSpecularLOD(value: boolean) {\r\n if (this._texture) {\r\n this._texture._linearSpecularLOD = value;\r\n }\r\n }\r\n\r\n /**\r\n * In case a better definition than spherical harmonics is required for the diffuse part of the environment.\r\n * You can set the irradiance texture to rely on a texture instead of the spherical approach.\r\n * This texture need to have the same characteristics than its parent (Cube vs 2d, coordinates mode, Gamma/Linear, RGBD).\r\n */\r\n @serializeAsTexture()\r\n public get irradianceTexture(): Nullable<BaseTexture> {\r\n if (this._texture) {\r\n return this._texture._irradianceTexture;\r\n }\r\n\r\n return null;\r\n }\r\n public set irradianceTexture(value: Nullable<BaseTexture>) {\r\n if (this._texture) {\r\n this._texture._irradianceTexture = value;\r\n }\r\n }\r\n\r\n /**\r\n * Define if the texture is a render target.\r\n */\r\n @serialize()\r\n public isRenderTarget = false;\r\n\r\n /**\r\n * Define the unique id of the texture in the scene.\r\n */\r\n public get uid(): string {\r\n if (!this._uid) {\r\n this._uid = RandomGUID();\r\n }\r\n return this._uid;\r\n }\r\n\r\n /** @hidden */\r\n public _prefiltered: boolean = false;\r\n /** @hidden */\r\n public _forceSerialize: boolean = false;\r\n\r\n /**\r\n * Return a string representation of the texture.\r\n * @returns the texture as a string\r\n */\r\n public toString(): string {\r\n return this.name;\r\n }\r\n\r\n /**\r\n * Get the class name of the texture.\r\n * @returns \"BaseTexture\"\r\n */\r\n public getClassName(): string {\r\n return \"BaseTexture\";\r\n }\r\n\r\n /**\r\n * Define the list of animation attached to the texture.\r\n */\r\n public animations = new Array<Animation>();\r\n\r\n /**\r\n * An event triggered when the texture is disposed.\r\n */\r\n public onDisposeObservable = new Observable<BaseTexture>();\r\n\r\n private _onDisposeObserver: Nullable<Observer<BaseTexture>> = null;\r\n /**\r\n * Callback triggered when the texture has been disposed.\r\n * Kept for back compatibility, you can use the onDisposeObservable instead.\r\n */\r\n public set onDispose(callback: () => void) {\r\n if (this._onDisposeObserver) {\r\n this.onDisposeObservable.remove(this._onDisposeObserver);\r\n }\r\n this._onDisposeObserver = this.onDisposeObservable.add(callback);\r\n }\r\n\r\n protected _scene: Nullable<Scene> = null;\r\n\r\n /** @hidden */\r\n private _uid: Nullable<string> = null;\r\n\r\n /**\r\n * Define if the texture is preventing a material to render or not.\r\n * If not and the texture is not ready, the engine will use a default black texture instead.\r\n */\r\n public get isBlocking(): boolean {\r\n return true;\r\n }\r\n\r\n /** @hidden */\r\n public _parentContainer: Nullable<AbstractScene> = null;\r\n\r\n protected _loadingError: boolean = false;\r\n protected _errorObject?: {\r\n message?: string;\r\n exception?: any;\r\n };\r\n\r\n /**\r\n * Was there any loading error?\r\n */\r\n public get loadingError(): boolean {\r\n return this._loadingError;\r\n }\r\n\r\n /**\r\n * If a loading error occurred this object will be populated with information about the error.\r\n */\r\n public get errorObject():\r\n | {\r\n message?: string;\r\n exception?: any;\r\n }\r\n | undefined {\r\n return this._errorObject;\r\n }\r\n\r\n /**\r\n * Instantiates a new BaseTexture.\r\n * Base class of all the textures in babylon.\r\n * It groups all the common properties the materials, post process, lights... might need\r\n * in order to make a correct use of the texture.\r\n * @param sceneOrEngine Define the scene or engine the texture belongs to\r\n */\r\n constructor(sceneOrEngine?: Nullable<Scene | ThinEngine>) {\r\n super(null);\r\n\r\n if (sceneOrEngine) {\r\n if (BaseTexture._IsScene(sceneOrEngine)) {\r\n this._scene = sceneOrEngine;\r\n } else {\r\n this._engine = sceneOrEngine;\r\n }\r\n } else {\r\n this._scene = EngineStore.LastCreatedScene;\r\n }\r\n\r\n if (this._scene) {\r\n this.uniqueId = this._scene.getUniqueId();\r\n this._scene.addTexture(this);\r\n this._engine = this._scene.getEngine();\r\n }\r\n\r\n this._uid = null;\r\n }\r\n\r\n /**\r\n * Get the scene the texture belongs to.\r\n * @returns the scene or null if undefined\r\n */\r\n public getScene(): Nullable<Scene> {\r\n return this._scene;\r\n }\r\n\r\n /** @hidden */\r\n protected _getEngine(): Nullable<ThinEngine> {\r\n return this._engine;\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<BaseTexture>): boolean {\r\n return texture !== null;\r\n }\r\n\r\n /**\r\n * Get the texture transform matrix used to offset tile the texture for instance.\r\n * @returns the transformation matrix\r\n */\r\n public getTextureMatrix(): Matrix {\r\n return <Matrix>Matrix.IdentityReadOnly;\r\n }\r\n\r\n /**\r\n * Get the texture reflection matrix used to rotate/transform the reflection.\r\n * @returns the reflection matrix\r\n */\r\n public getReflectionTextureMatrix(): Matrix {\r\n return <Matrix>Matrix.IdentityReadOnly;\r\n }\r\n\r\n /**\r\n * Get if the texture is ready to be consumed (either it is ready or it is not blocking)\r\n * @returns true if ready, not blocking or if there was an error loading the texture\r\n */\r\n public isReadyOrNotBlocking(): boolean {\r\n return !this.isBlocking || this.isReady() || this.loadingError;\r\n }\r\n\r\n /**\r\n * Scales the texture if is `canRescale()`\r\n * @param ratio the resize factor we want to use to rescale\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n public scale(ratio: number): void {}\r\n\r\n /**\r\n * Get if the texture can rescale.\r\n */\r\n public get canRescale(): boolean {\r\n return false;\r\n }\r\n\r\n /**\r\n * @param url\r\n * @param noMipmap\r\n * @param sampling\r\n * @param invertY\r\n * @param useSRGBBuffer\r\n * @param isCube\r\n * @hidden\r\n */\r\n public _getFromCache(url: Nullable<string>, noMipmap: boolean, sampling?: number, invertY?: boolean, useSRGBBuffer?: boolean, isCube?: boolean): Nullable<InternalTexture> {\r\n const engine = this._getEngine();\r\n if (!engine) {\r\n return null;\r\n }\r\n\r\n const correctedUseSRGBBuffer = engine._getUseSRGBBuffer(!!useSRGBBuffer, noMipmap);\r\n\r\n const texturesCache = engine.getLoadedTexturesCache();\r\n for (let index = 0; index < texturesCache.length; index++) {\r\n const texturesCacheEntry = texturesCache[index];\r\n\r\n if (useSRGBBuffer === undefined || correctedUseSRGBBuffer === texturesCacheEntry._useSRGBBuffer) {\r\n if (invertY === undefined || invertY === texturesCacheEntry.invertY) {\r\n if (texturesCacheEntry.url === url && texturesCacheEntry.generateMipMaps === !noMipmap) {\r\n if (!sampling || sampling === texturesCacheEntry.samplingMode) {\r\n if (isCube === undefined || isCube === texturesCacheEntry.isCube) {\r\n texturesCacheEntry.incrementReferences();\r\n return texturesCacheEntry;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /** @hidden */\r\n public _rebuild(): void {}\r\n\r\n /**\r\n * Clones the texture.\r\n * @returns the cloned texture\r\n */\r\n public clone(): Nullable<BaseTexture> {\r\n return null;\r\n }\r\n\r\n /**\r\n * Get the texture underlying type (INT, FLOAT...)\r\n */\r\n public get textureType(): number {\r\n if (!this._texture) {\r\n return Constants.TEXTURETYPE_UNSIGNED_INT;\r\n }\r\n\r\n return this._texture.type !== undefined ? this._texture.type : Constants.TEXTURETYPE_UNSIGNED_INT;\r\n }\r\n\r\n /**\r\n * Get the texture underlying format (RGB, RGBA...)\r\n */\r\n public get textureFormat(): number {\r\n if (!this._texture) {\r\n return Constants.TEXTUREFORMAT_RGBA;\r\n }\r\n\r\n return this._texture.format !== undefined ? this._texture.format : Constants.TEXTUREFORMAT_RGBA;\r\n }\r\n\r\n /**\r\n * Indicates that textures need to be re-calculated for all materials\r\n */\r\n protected _markAllSubMeshesAsTexturesDirty() {\r\n const scene = this.getScene();\r\n\r\n if (!scene) {\r\n return;\r\n }\r\n\r\n scene.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag);\r\n }\r\n\r\n /**\r\n * Reads the pixels stored in the webgl texture and returns them as an ArrayBuffer.\r\n * This will returns an RGBA array buffer containing either in values (0-255) or\r\n * float values (0-1) depending of the underlying buffer type.\r\n * @param faceIndex defines the face of the texture to read (in case of cube texture)\r\n * @param level defines the LOD level of the texture to read (in case of Mip Maps)\r\n * @param buffer defines a user defined buffer to fill with data (can be null)\r\n * @param flushRenderer true to flush the renderer from the pending commands before reading the pixels\r\n * @param noDataConversion false to convert the data to Uint8Array (if texture type is UNSIGNED_BYTE) or to Float32Array (if texture type is anything but UNSIGNED_BYTE). If true, the type of the generated buffer (if buffer==null) will depend on the type of the texture\r\n * @param x defines the region x coordinates to start reading from (default to 0)\r\n * @param y defines the region y coordinates to start reading from (default to 0)pe is UNSIGNED_BYTE) or to Float32Array (if texture type is anything but UNSIGNED_BYTE). If true, the type of the generated buffer (if buffer==null) will depend on the type of the texture\r\n * @param width defines the region width to read from (default to the texture size at level)\r\n * @param height defines the region width to read from (default to the texture size at level)\r\n * @returns The Array buffer promise containing the pixels data.\r\n */\r\n public readPixels(\r\n faceIndex = 0,\r\n level = 0,\r\n buffer: Nullable<ArrayBufferView> = null,\r\n flushRenderer = true,\r\n noDataConversion = false,\r\n x = 0,\r\n y = 0,\r\n width = Number.MAX_VALUE,\r\n height = Number.MAX_VALUE\r\n ): Nullable<Promise<ArrayBufferView>> {\r\n if (!this._texture) {\r\n return null;\r\n }\r\n\r\n const engine = this._getEngine();\r\n if (!engine) {\r\n return null;\r\n }\r\n\r\n const size = this.getSize();\r\n let maxWidth = size.width;\r\n let maxHeight = size.height;\r\n if (level !== 0) {\r\n maxWidth = maxWidth / Math.pow(2, level);\r\n maxHeight = maxHeight / Math.pow(2, level);\r\n maxWidth = Math.round(maxWidth);\r\n maxHeight = Math.round(maxHeight);\r\n }\r\n\r\n width = Math.min(maxWidth, width);\r\n height = Math.min(maxHeight, height);\r\n\r\n try {\r\n if (this._texture.isCube) {\r\n return engine._readTexturePixels(this._texture, width, height, faceIndex, level, buffer, flushRenderer, noDataConversion, x, y);\r\n }\r\n\r\n return engine._readTexturePixels(this._texture, width, height, -1, level, buffer, flushRenderer, noDataConversion, x, y);\r\n } catch (e) {\r\n return null;\r\n }\r\n }\r\n\r\n /**\r\n * @param faceIndex\r\n * @param level\r\n * @param buffer\r\n * @param flushRenderer\r\n * @param noDataConversion\r\n * @hidden\r\n */\r\n public _readPixelsSync(faceIndex = 0, level = 0, buffer: Nullable<ArrayBufferView> = null, flushRenderer = true, noDataConversion = false): Nullable<ArrayBufferView> {\r\n if (!this._texture) {\r\n return null;\r\n }\r\n\r\n const size = this.getSize();\r\n let width = size.width;\r\n let height = size.height;\r\n\r\n const engine = this._getEngine();\r\n if (!engine) {\r\n return null;\r\n }\r\n\r\n if (level != 0) {\r\n width = width / Math.pow(2, level);\r\n height = height / Math.pow(2, level);\r\n\r\n width = Math.round(width);\r\n height = Math.round(height);\r\n }\r\n\r\n try {\r\n if (this._texture.isCube) {\r\n return engine._readTexturePixelsSync(this._texture, width, height, faceIndex, level, buffer, flushRenderer, noDataConversion);\r\n }\r\n\r\n return engine._readTexturePixelsSync(this._texture, width, height, -1, level, buffer, flushRenderer, noDataConversion);\r\n } catch (e) {\r\n return null;\r\n }\r\n }\r\n\r\n /** @hidden */\r\n public get _lodTextureHigh(): Nullable<BaseTexture> {\r\n if (this._texture) {\r\n return this._texture._lodTextureHigh;\r\n }\r\n return null;\r\n }\r\n\r\n /** @hidden */\r\n public get _lodTextureMid(): Nullable<BaseTexture> {\r\n if (this._texture) {\r\n return this._texture._lodTextureMid;\r\n }\r\n return null;\r\n }\r\n\r\n /** @hidden */\r\n public get _lodTextureLow(): Nullable<BaseTexture> {\r\n if (this._texture) {\r\n return this._texture._lodTextureLow;\r\n }\r\n return null;\r\n }\r\n\r\n /**\r\n * Dispose the texture and release its associated resources.\r\n */\r\n public dispose(): void {\r\n if (this._scene) {\r\n // Animations\r\n if (this._scene.stopAnimation) {\r\n this._scene.stopAnimation(this);\r\n }\r\n\r\n // Remove from scene\r\n this._scene._removePendingData(this);\r\n const index = this._scene.textures.indexOf(this);\r\n\r\n if (index >= 0) {\r\n this._scene.textures.splice(index, 1);\r\n }\r\n this._scene.onTextureRemovedObservable.notifyObservers(this);\r\n this._scene = null;\r\n\r\n if (this._parentContainer) {\r\n const index = this._parentContainer.textures.indexOf(this);\r\n if (index > -1) {\r\n this._parentContainer.textures.splice(index, 1);\r\n }\r\n this._parentContainer = null;\r\n }\r\n }\r\n\r\n // Callback\r\n this.onDisposeObservable.notifyObservers(this);\r\n this.onDisposeObservable.clear();\r\n\r\n this.metadata = null;\r\n\r\n super.dispose();\r\n }\r\n\r\n /**\r\n * Serialize the texture into a JSON representation that can be parsed later on.\r\n * @returns the JSON representation of the texture\r\n */\r\n public serialize(): any {\r\n if (!this.name) {\r\n return null;\r\n }\r\n\r\n const serializationObject = SerializationHelper.Serialize(this);\r\n\r\n // Animations\r\n SerializationHelper.AppendSerializedAnimations(this, serializationObject);\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Helper function to be called back once a list of texture contains only ready textures.\r\n * @param textures Define the list of textures to wait for\r\n * @param callback Define the callback triggered once the entire list will be ready\r\n */\r\n public static WhenAllReady(textures: BaseTexture[], callback: () => void): void {\r\n let numRemaining = textures.length;\r\n if (numRemaining === 0) {\r\n callback();\r\n return;\r\n }\r\n\r\n for (let i = 0; i < textures.length; i++) {\r\n const texture = textures[i];\r\n\r\n if (texture.isReady()) {\r\n if (--numRemaining === 0) {\r\n callback();\r\n }\r\n } else {\r\n const onLoadObservable = (texture as any).onLoadObservable as Observable<BaseTexture>;\r\n\r\n if (onLoadObservable) {\r\n onLoadObservable.addOnce(() => {\r\n if (--numRemaining === 0) {\r\n callback();\r\n }\r\n });\r\n } else {\r\n if (--numRemaining === 0) {\r\n callback();\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n private static _IsScene(sceneOrEngine: Scene | ThinEngine): sceneOrEngine is Scene {\r\n return sceneOrEngine.getClassName() === \"Scene\";\r\n }\r\n}\r\n"]}
|
|
@@ -296,7 +296,7 @@ var CubeTexture = /** @class */ (function (_super) {
|
|
|
296
296
|
if (onError === void 0) { onError = null; }
|
|
297
297
|
var scene = this.getScene();
|
|
298
298
|
var oldTexture = this._texture;
|
|
299
|
-
this._texture = this._getFromCache(this.url, this._noMipmap, undefined, undefined, this._useSRGBBuffer);
|
|
299
|
+
this._texture = this._getFromCache(this.url, this._noMipmap, undefined, undefined, this._useSRGBBuffer, this.isCube);
|
|
300
300
|
var onLoadProcessing = function () {
|
|
301
301
|
var _a;
|
|
302
302
|
_this.onLoadObservable.notifyObservers(_this);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cubeTexture.js","sourceRoot":"","sources":["../../../../../../lts/core/generated/Materials/Textures/cubeTexture.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC1F,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAGzC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,s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AE,IAAI,CAAC,CAAC;QAET,cAAc,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAEnC,OAAO,cAAc,CAAC;IAC1B,CAAC;IA3bD;QADC,SAAS,EAAE;4CACO;IAyCnB;QADC,SAAS,CAAC,WAAW,CAAC;gDAItB;IAmBD;QADC,SAAS,CAAC,OAAO,CAAC;+CACsB;IAGzC;QADC,SAAS,CAAC,iBAAiB,CAAC;yDACuB;IAUpD;QADC,SAAS,CAAC,YAAY,CAAC;oDACuB;IAG/C;QADC,iBAAiB,CAAC,eAAe,CAAC;uDACJ;IA6WnC,kBAAC;CAAA,AA3cD,CAAiC,WAAW,GA2c3C;SA3cY,WAAW;AA6cxB,OAAO,CAAC,kBAAkB,GAAG,WAAW,CAAC,KAAK,CAAC;AAC/C,6CAA6C;AAC7C,aAAa,CAAC,qBAAqB,EAAE,WAAW,CAAC,CAAC","sourcesContent":["import { serialize, serializeAsMatrix, SerializationHelper } from \"../../Misc/decorators\";\r\nimport { Tools } from \"../../Misc/tools\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { Matrix, Vector3 } from \"../../Maths/math.vector\";\r\nimport { BaseTexture } from \"../../Materials/Textures/baseTexture\";\r\nimport { Texture } from \"../../Materials/Textures/texture\";\r\nimport { Constants } from \"../../Engines/constants\";\r\nimport { GetClass, RegisterClass } from \"../../Misc/typeStore\";\r\nimport type { ThinEngine } from \"../../Engines/thinEngine\";\r\n\r\nimport \"../../Engines/Extensions/engine.cubeTexture\";\r\nimport { Observable } from \"../../Misc/observable\";\r\n\r\n/**\r\n * Class for creating a cube texture\r\n */\r\nexport class CubeTexture extends BaseTexture {\r\n private _delayedOnLoad: Nullable<() => void>;\r\n private _delayedOnError: Nullable<(message?: string, exception?: any) => void>;\r\n private _lodScale: number = 0.8;\r\n private _lodOffset: number = 0;\r\n\r\n /**\r\n * Observable triggered once the texture has been loaded.\r\n */\r\n public onLoadObservable: Observable<CubeTexture> = new Observable<CubeTexture>();\r\n\r\n /**\r\n * The url of the texture\r\n */\r\n @serialize()\r\n public url: string;\r\n\r\n /**\r\n * Gets or sets the center of the bounding box associated with the cube texture.\r\n * It must define where the camera used to render the texture was set\r\n * @see https://doc.babylonjs.com/how_to/reflect#using-local-cubemap-mode\r\n */\r\n public boundingBoxPosition = Vector3.Zero();\r\n\r\n private _boundingBoxSize: Vector3;\r\n\r\n /**\r\n * Gets or sets the size of the bounding box associated with the cube texture\r\n * When defined, the cubemap will switch to local mode\r\n * @see https://community.arm.com/graphics/b/blog/posts/reflections-based-on-local-cubemaps-in-unity\r\n * @example https://www.babylonjs-playground.com/#RNASML\r\n */\r\n public set boundingBoxSize(value: Vector3) {\r\n if (this._boundingBoxSize && this._boundingBoxSize.equals(value)) {\r\n return;\r\n }\r\n this._boundingBoxSize = value;\r\n const scene = this.getScene();\r\n if (scene) {\r\n scene.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag);\r\n }\r\n }\r\n /**\r\n * Returns the bounding box size\r\n * @see https://doc.babylonjs.com/how_to/reflect#using-local-cubemap-mode\r\n */\r\n public get boundingBoxSize(): Vector3 {\r\n return this._boundingBoxSize;\r\n }\r\n\r\n protected _rotationY: number = 0;\r\n\r\n /**\r\n * Sets texture matrix rotation angle around Y axis in radians.\r\n */\r\n @serialize(\"rotationY\")\r\n public set rotationY(value: number) {\r\n this._rotationY = value;\r\n this.setReflectionTextureMatrix(Matrix.RotationY(this._rotationY));\r\n }\r\n /**\r\n * Gets texture matrix rotation angle around Y axis radians.\r\n */\r\n public get rotationY(): number {\r\n return this._rotationY;\r\n }\r\n\r\n /**\r\n * Are mip maps generated for this texture or not.\r\n */\r\n public get noMipmap(): boolean {\r\n return this._noMipmap;\r\n }\r\n\r\n private _noMipmap: boolean;\r\n\r\n /** @hidden */\r\n @serialize(\"files\")\r\n public _files: Nullable<string[]> = null;\r\n\r\n @serialize(\"forcedExtension\")\r\n protected _forcedExtension: Nullable<string> = null;\r\n\r\n /**\r\n * Gets the forced extension (if any)\r\n */\r\n public get forcedExtension(): Nullable<string> {\r\n return this._forcedExtension;\r\n }\r\n\r\n @serialize(\"extensions\")\r\n private _extensions: Nullable<string[]> = null;\r\n\r\n @serializeAsMatrix(\"textureMatrix\")\r\n private _textureMatrix: Matrix;\r\n\r\n private _format: number;\r\n private _createPolynomials: boolean;\r\n private _loaderOptions: any;\r\n private _useSRGBBuffer?: boolean;\r\n\r\n /**\r\n * Creates a cube texture from an array of image urls\r\n * @param files defines an array of image urls\r\n * @param scene defines the hosting scene\r\n * @param noMipmap specifies if mip maps are not used\r\n * @returns a cube texture\r\n */\r\n public static CreateFromImages(files: string[], scene: Scene, noMipmap?: boolean): CubeTexture {\r\n let rootUrlKey = \"\";\r\n\r\n files.forEach((url) => (rootUrlKey += url));\r\n\r\n return new CubeTexture(rootUrlKey, scene, null, noMipmap, files);\r\n }\r\n\r\n /**\r\n * Creates and return a texture created from prefilterd data by tools like IBL Baker or Lys.\r\n * @param url defines the url of the prefiltered texture\r\n * @param scene defines the scene the texture is attached to\r\n * @param forcedExtension defines the extension of the file if different from the url\r\n * @param createPolynomials defines whether or not to create polynomial harmonics from the texture data if necessary\r\n * @return the prefiltered texture\r\n */\r\n public static CreateFromPrefilteredData(url: string, scene: Scene, forcedExtension: any = null, createPolynomials: boolean = true) {\r\n const oldValue = scene.useDelayedTextureLoading;\r\n scene.useDelayedTextureLoading = false;\r\n\r\n const result = new CubeTexture(url, scene, null, false, null, null, null, undefined, true, forcedExtension, createPolynomials);\r\n\r\n scene.useDelayedTextureLoading = oldValue;\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Creates a cube texture to use with reflection for instance. It can be based upon dds or six images as well\r\n * as prefiltered data.\r\n * @param rootUrl defines the url of the texture or the root name of the six images\r\n * @param sceneOrEngine defines the scene or engine the texture is attached to\r\n * @param extensions defines the suffixes add to the picture name in case six images are in use like _px.jpg...\r\n * @param noMipmap defines if mipmaps should be created or not\r\n * @param files defines the six files to load for the different faces in that order: px, py, pz, nx, ny, nz\r\n * @param onLoad defines a callback triggered at the end of the file load if no errors occurred\r\n * @param onError defines a callback triggered in case of error during load\r\n * @param format defines the internal format to use for the texture once loaded\r\n * @param prefiltered defines whether or not the texture is created from prefiltered data\r\n * @param forcedExtension defines the extensions to use (force a special type of file to load) in case it is different from the file name\r\n * @param createPolynomials defines whether or not to create polynomial harmonics from the texture data if necessary\r\n * @param lodScale defines the scale applied to environment texture. This manages the range of LOD level used for IBL according to the roughness\r\n * @param lodOffset defines the offset applied to environment texture. This manages first LOD level used for IBL according to the roughness\r\n * @param loaderOptions options to be passed to the loader\r\n * @param useSRGBBuffer Defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU) (default: false)\r\n * @return the cube texture\r\n */\r\n constructor(\r\n rootUrl: string,\r\n sceneOrEngine: Scene | ThinEngine,\r\n extensions: Nullable<string[]> = null,\r\n noMipmap: boolean = false,\r\n files: Nullable<string[]> = null,\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 prefiltered = false,\r\n forcedExtension: any = null,\r\n createPolynomials: boolean = false,\r\n lodScale: number = 0.8,\r\n lodOffset: number = 0,\r\n loaderOptions?: any,\r\n useSRGBBuffer?: boolean\r\n ) {\r\n super(sceneOrEngine);\r\n\r\n this.name = rootUrl;\r\n this.url = rootUrl;\r\n this._noMipmap = noMipmap;\r\n this.hasAlpha = false;\r\n this._format = format;\r\n this.isCube = true;\r\n this._textureMatrix = Matrix.Identity();\r\n this._createPolynomials = createPolynomials;\r\n this.coordinatesMode = Texture.CUBIC_MODE;\r\n this._extensions = extensions;\r\n this._files = files;\r\n this._forcedExtension = forcedExtension;\r\n this._loaderOptions = loaderOptions;\r\n this._useSRGBBuffer = useSRGBBuffer;\r\n this._lodScale = lodScale;\r\n this._lodOffset = lodOffset;\r\n\r\n if (!rootUrl && !files) {\r\n return;\r\n }\r\n\r\n this.updateURL(rootUrl, forcedExtension, onLoad, prefiltered, onError, extensions, this.getScene()?.useDelayedTextureLoading, files);\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 \"CubeTexture\"\r\n */\r\n public getClassName(): string {\r\n return \"CubeTexture\";\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 forcedExtension defines the extension to use\r\n * @param onLoad callback called when the texture is loaded (defaults to null)\r\n * @param prefiltered Defines whether the updated texture is prefiltered or not\r\n * @param onError callback called if there was an error during the loading process (defaults to null)\r\n * @param extensions defines the suffixes add to the picture name in case six images are in use like _px.jpg...\r\n * @param delayLoad defines if the texture should be loaded now (false by default)\r\n * @param files defines the six files to load for the different faces in that order: px, py, pz, nx, ny, nz\r\n */\r\n public updateURL(\r\n url: string,\r\n forcedExtension?: string,\r\n onLoad: Nullable<() => void> = null,\r\n prefiltered: boolean = false,\r\n onError: Nullable<(message?: string, exception?: any) => void> = null,\r\n extensions: Nullable<string[]> = null,\r\n delayLoad = false,\r\n files: Nullable<string[]> = null\r\n ): void {\r\n if (!this.name || this.name.startsWith(\"data:\")) {\r\n this.name = url;\r\n }\r\n this.url = url;\r\n\r\n if (forcedExtension) {\r\n this._forcedExtension = forcedExtension;\r\n }\r\n\r\n const lastDot = url.lastIndexOf(\".\");\r\n const extension = forcedExtension ? forcedExtension : lastDot > -1 ? url.substring(lastDot).toLowerCase() : \"\";\r\n const isDDS = extension.indexOf(\".dds\") === 0;\r\n const isEnv = extension.indexOf(\".env\") === 0;\r\n\r\n if (isEnv) {\r\n this.gammaSpace = false;\r\n this._prefiltered = false;\r\n this.anisotropicFilteringLevel = 1;\r\n } else {\r\n this._prefiltered = prefiltered;\r\n\r\n if (prefiltered) {\r\n this.gammaSpace = false;\r\n this.anisotropicFilteringLevel = 1;\r\n }\r\n }\r\n\r\n if (files) {\r\n this._files = files;\r\n } else {\r\n if (!isEnv && !isDDS && !extensions) {\r\n extensions = [\"_px.jpg\", \"_py.jpg\", \"_pz.jpg\", \"_nx.jpg\", \"_ny.jpg\", \"_nz.jpg\"];\r\n }\r\n\r\n this._files = this._files || [];\r\n this._files.length = 0;\r\n\r\n if (extensions) {\r\n for (let index = 0; index < extensions.length; index++) {\r\n this._files.push(url + extensions[index]);\r\n }\r\n this._extensions = extensions;\r\n }\r\n }\r\n\r\n if (delayLoad) {\r\n this.delayLoadState = Constants.DELAYLOADSTATE_NOTLOADED;\r\n this._delayedOnLoad = onLoad;\r\n this._delayedOnError = onError;\r\n } else {\r\n this._loadTexture(onLoad, onError);\r\n }\r\n }\r\n\r\n /**\r\n * Delays loading of the cube texture\r\n * @param forcedExtension defines the extension to use\r\n */\r\n public delayLoad(forcedExtension?: string): void {\r\n if (this.delayLoadState !== Constants.DELAYLOADSTATE_NOTLOADED) {\r\n return;\r\n }\r\n if (forcedExtension) {\r\n this._forcedExtension = forcedExtension;\r\n }\r\n\r\n this.delayLoadState = Constants.DELAYLOADSTATE_LOADED;\r\n this._loadTexture(this._delayedOnLoad, this._delayedOnError);\r\n }\r\n\r\n /**\r\n * Returns the reflection texture matrix\r\n * @returns the reflection texture matrix\r\n */\r\n public getReflectionTextureMatrix(): Matrix {\r\n return this._textureMatrix;\r\n }\r\n\r\n /**\r\n * Sets the reflection texture matrix\r\n * @param value Reflection texture matrix\r\n */\r\n public setReflectionTextureMatrix(value: Matrix): void {\r\n if (value.updateFlag === this._textureMatrix.updateFlag) {\r\n return;\r\n }\r\n\r\n if (value.isIdentity() !== this._textureMatrix.isIdentity()) {\r\n this.getScene()?.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag, (mat) => mat.getActiveTextures().indexOf(this) !== -1);\r\n }\r\n\r\n this._textureMatrix = value;\r\n }\r\n\r\n private _loadTexture(onLoad: Nullable<() => void> = null, onError: Nullable<(message?: string, exception?: any) => void> = null) {\r\n const scene = this.getScene();\r\n const oldTexture = this._texture;\r\n this._texture = this._getFromCache(this.url, this._noMipmap, undefined, undefined, this._useSRGBBuffer);\r\n\r\n const onLoadProcessing = () => {\r\n this.onLoadObservable.notifyObservers(this);\r\n if (oldTexture) {\r\n oldTexture.dispose();\r\n this.getScene()?.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag);\r\n }\r\n if (onLoad) {\r\n onLoad();\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._texture) {\r\n if (this._prefiltered) {\r\n this._texture = this._getEngine()!.createPrefilteredCubeTexture(\r\n this.url,\r\n scene,\r\n this._lodScale,\r\n this._lodOffset,\r\n onLoad,\r\n errorHandler,\r\n this._format,\r\n this._forcedExtension,\r\n this._createPolynomials\r\n );\r\n } else {\r\n this._texture = this._getEngine()!.createCubeTexture(\r\n this.url,\r\n scene,\r\n this._files,\r\n this._noMipmap,\r\n onLoad,\r\n errorHandler,\r\n this._format,\r\n this._forcedExtension,\r\n false,\r\n this._lodScale,\r\n this._lodOffset,\r\n null,\r\n this._loaderOptions,\r\n !!this._useSRGBBuffer\r\n );\r\n }\r\n\r\n this._texture?.onLoadedObservable.add(() => this.onLoadObservable.notifyObservers(this));\r\n } else {\r\n if (this._texture.isReady) {\r\n Tools.SetImmediate(() => onLoadProcessing());\r\n } else {\r\n this._texture.onLoadedObservable.add(() => onLoadProcessing());\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Parses text to create a cube texture\r\n * @param parsedTexture define the serialized text to read from\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the root url of the cube texture\r\n * @returns a cube texture\r\n */\r\n public static Parse(parsedTexture: any, scene: Scene, rootUrl: string): CubeTexture {\r\n const texture = SerializationHelper.Parse(\r\n () => {\r\n let prefiltered: boolean = false;\r\n if (parsedTexture.prefiltered) {\r\n prefiltered = parsedTexture.prefiltered;\r\n }\r\n return new CubeTexture(\r\n rootUrl + parsedTexture.name,\r\n scene,\r\n parsedTexture.extensions,\r\n false,\r\n parsedTexture.files || null,\r\n null,\r\n null,\r\n undefined,\r\n prefiltered,\r\n parsedTexture.forcedExtension\r\n );\r\n },\r\n parsedTexture,\r\n scene\r\n );\r\n\r\n // Local Cubemaps\r\n if (parsedTexture.boundingBoxPosition) {\r\n texture.boundingBoxPosition = Vector3.FromArray(parsedTexture.boundingBoxPosition);\r\n }\r\n if (parsedTexture.boundingBoxSize) {\r\n texture.boundingBoxSize = Vector3.FromArray(parsedTexture.boundingBoxSize);\r\n }\r\n\r\n // Animations\r\n if (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 return texture;\r\n }\r\n\r\n /**\r\n * Makes a clone, or deep copy, of the cube texture\r\n * @returns a new cube texture\r\n */\r\n public clone(): CubeTexture {\r\n let uniqueId = 0;\r\n\r\n const newCubeTexture = SerializationHelper.Clone(() => {\r\n const cubeTexture = new CubeTexture(this.url, this.getScene() || this._getEngine()!, this._extensions, this._noMipmap, this._files);\r\n uniqueId = cubeTexture.uniqueId;\r\n\r\n return cubeTexture;\r\n }, this);\r\n\r\n newCubeTexture.uniqueId = uniqueId;\r\n\r\n return newCubeTexture;\r\n }\r\n}\r\n\r\nTexture._CubeTextureParser = CubeTexture.Parse;\r\n// Some exporters relies on Tools.Instantiate\r\nRegisterClass(\"BABYLON.CubeTexture\", CubeTexture);\r\n"]}
|
|
1
|
+
{"version":3,"file":"cubeTexture.js","sourceRoot":"","sources":["../../../../../../lts/core/generated/Materials/Textures/cubeTexture.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,mB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AAQ,EAAE,IAAI,KAAI,CAAC,UAAU,EAAG,EAAE,KAAI,CAAC,WAAW,EAAE,KAAI,CAAC,SAAS,EAAE,KAAI,CAAC,MAAM,CAAC,CAAC;YACpI,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC;YAEhC,OAAO,WAAW,CAAC;QACvB,CAAC,EAAE,IAAI,CAAC,CAAC;QAET,cAAc,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAEnC,OAAO,cAAc,CAAC;IAC1B,CAAC;IA3bD;QADC,SAAS,EAAE;4CACO;IAyCnB;QADC,SAAS,CAAC,WAAW,CAAC;gDAItB;IAmBD;QADC,SAAS,CAAC,OAAO,CAAC;+CACsB;IAGzC;QADC,SAAS,CAAC,iBAAiB,CAAC;yDACuB;IAUpD;QADC,SAAS,CAAC,YAAY,CAAC;oDACuB;IAG/C;QADC,iBAAiB,CAAC,eAAe,CAAC;uDACJ;IA6WnC,kBAAC;CAAA,AA3cD,CAAiC,WAAW,GA2c3C;SA3cY,WAAW;AA6cxB,OAAO,CAAC,kBAAkB,GAAG,WAAW,CAAC,KAAK,CAAC;AAC/C,6CAA6C;AAC7C,aAAa,CAAC,qBAAqB,EAAE,WAAW,CAAC,CAAC","sourcesContent":["import { serialize, serializeAsMatrix, SerializationHelper } from \"../../Misc/decorators\";\r\nimport { Tools } from \"../../Misc/tools\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { Matrix, Vector3 } from \"../../Maths/math.vector\";\r\nimport { BaseTexture } from \"../../Materials/Textures/baseTexture\";\r\nimport { Texture } from \"../../Materials/Textures/texture\";\r\nimport { Constants } from \"../../Engines/constants\";\r\nimport { GetClass, RegisterClass } from \"../../Misc/typeStore\";\r\nimport type { ThinEngine } from \"../../Engines/thinEngine\";\r\n\r\nimport \"../../Engines/Extensions/engine.cubeTexture\";\r\nimport { Observable } from \"../../Misc/observable\";\r\n\r\n/**\r\n * Class for creating a cube texture\r\n */\r\nexport class CubeTexture extends BaseTexture {\r\n private _delayedOnLoad: Nullable<() => void>;\r\n private _delayedOnError: Nullable<(message?: string, exception?: any) => void>;\r\n private _lodScale: number = 0.8;\r\n private _lodOffset: number = 0;\r\n\r\n /**\r\n * Observable triggered once the texture has been loaded.\r\n */\r\n public onLoadObservable: Observable<CubeTexture> = new Observable<CubeTexture>();\r\n\r\n /**\r\n * The url of the texture\r\n */\r\n @serialize()\r\n public url: string;\r\n\r\n /**\r\n * Gets or sets the center of the bounding box associated with the cube texture.\r\n * It must define where the camera used to render the texture was set\r\n * @see https://doc.babylonjs.com/how_to/reflect#using-local-cubemap-mode\r\n */\r\n public boundingBoxPosition = Vector3.Zero();\r\n\r\n private _boundingBoxSize: Vector3;\r\n\r\n /**\r\n * Gets or sets the size of the bounding box associated with the cube texture\r\n * When defined, the cubemap will switch to local mode\r\n * @see https://community.arm.com/graphics/b/blog/posts/reflections-based-on-local-cubemaps-in-unity\r\n * @example https://www.babylonjs-playground.com/#RNASML\r\n */\r\n public set boundingBoxSize(value: Vector3) {\r\n if (this._boundingBoxSize && this._boundingBoxSize.equals(value)) {\r\n return;\r\n }\r\n this._boundingBoxSize = value;\r\n const scene = this.getScene();\r\n if (scene) {\r\n scene.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag);\r\n }\r\n }\r\n /**\r\n * Returns the bounding box size\r\n * @see https://doc.babylonjs.com/how_to/reflect#using-local-cubemap-mode\r\n */\r\n public get boundingBoxSize(): Vector3 {\r\n return this._boundingBoxSize;\r\n }\r\n\r\n protected _rotationY: number = 0;\r\n\r\n /**\r\n * Sets texture matrix rotation angle around Y axis in radians.\r\n */\r\n @serialize(\"rotationY\")\r\n public set rotationY(value: number) {\r\n this._rotationY = value;\r\n this.setReflectionTextureMatrix(Matrix.RotationY(this._rotationY));\r\n }\r\n /**\r\n * Gets texture matrix rotation angle around Y axis radians.\r\n */\r\n public get rotationY(): number {\r\n return this._rotationY;\r\n }\r\n\r\n /**\r\n * Are mip maps generated for this texture or not.\r\n */\r\n public get noMipmap(): boolean {\r\n return this._noMipmap;\r\n }\r\n\r\n private _noMipmap: boolean;\r\n\r\n /** @hidden */\r\n @serialize(\"files\")\r\n public _files: Nullable<string[]> = null;\r\n\r\n @serialize(\"forcedExtension\")\r\n protected _forcedExtension: Nullable<string> = null;\r\n\r\n /**\r\n * Gets the forced extension (if any)\r\n */\r\n public get forcedExtension(): Nullable<string> {\r\n return this._forcedExtension;\r\n }\r\n\r\n @serialize(\"extensions\")\r\n private _extensions: Nullable<string[]> = null;\r\n\r\n @serializeAsMatrix(\"textureMatrix\")\r\n private _textureMatrix: Matrix;\r\n\r\n private _format: number;\r\n private _createPolynomials: boolean;\r\n private _loaderOptions: any;\r\n private _useSRGBBuffer?: boolean;\r\n\r\n /**\r\n * Creates a cube texture from an array of image urls\r\n * @param files defines an array of image urls\r\n * @param scene defines the hosting scene\r\n * @param noMipmap specifies if mip maps are not used\r\n * @returns a cube texture\r\n */\r\n public static CreateFromImages(files: string[], scene: Scene, noMipmap?: boolean): CubeTexture {\r\n let rootUrlKey = \"\";\r\n\r\n files.forEach((url) => (rootUrlKey += url));\r\n\r\n return new CubeTexture(rootUrlKey, scene, null, noMipmap, files);\r\n }\r\n\r\n /**\r\n * Creates and return a texture created from prefilterd data by tools like IBL Baker or Lys.\r\n * @param url defines the url of the prefiltered texture\r\n * @param scene defines the scene the texture is attached to\r\n * @param forcedExtension defines the extension of the file if different from the url\r\n * @param createPolynomials defines whether or not to create polynomial harmonics from the texture data if necessary\r\n * @return the prefiltered texture\r\n */\r\n public static CreateFromPrefilteredData(url: string, scene: Scene, forcedExtension: any = null, createPolynomials: boolean = true) {\r\n const oldValue = scene.useDelayedTextureLoading;\r\n scene.useDelayedTextureLoading = false;\r\n\r\n const result = new CubeTexture(url, scene, null, false, null, null, null, undefined, true, forcedExtension, createPolynomials);\r\n\r\n scene.useDelayedTextureLoading = oldValue;\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Creates a cube texture to use with reflection for instance. It can be based upon dds or six images as well\r\n * as prefiltered data.\r\n * @param rootUrl defines the url of the texture or the root name of the six images\r\n * @param sceneOrEngine defines the scene or engine the texture is attached to\r\n * @param extensions defines the suffixes add to the picture name in case six images are in use like _px.jpg...\r\n * @param noMipmap defines if mipmaps should be created or not\r\n * @param files defines the six files to load for the different faces in that order: px, py, pz, nx, ny, nz\r\n * @param onLoad defines a callback triggered at the end of the file load if no errors occurred\r\n * @param onError defines a callback triggered in case of error during load\r\n * @param format defines the internal format to use for the texture once loaded\r\n * @param prefiltered defines whether or not the texture is created from prefiltered data\r\n * @param forcedExtension defines the extensions to use (force a special type of file to load) in case it is different from the file name\r\n * @param createPolynomials defines whether or not to create polynomial harmonics from the texture data if necessary\r\n * @param lodScale defines the scale applied to environment texture. This manages the range of LOD level used for IBL according to the roughness\r\n * @param lodOffset defines the offset applied to environment texture. This manages first LOD level used for IBL according to the roughness\r\n * @param loaderOptions options to be passed to the loader\r\n * @param useSRGBBuffer Defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU) (default: false)\r\n * @return the cube texture\r\n */\r\n constructor(\r\n rootUrl: string,\r\n sceneOrEngine: Scene | ThinEngine,\r\n extensions: Nullable<string[]> = null,\r\n noMipmap: boolean = false,\r\n files: Nullable<string[]> = null,\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 prefiltered = false,\r\n forcedExtension: any = null,\r\n createPolynomials: boolean = false,\r\n lodScale: number = 0.8,\r\n lodOffset: number = 0,\r\n loaderOptions?: any,\r\n useSRGBBuffer?: boolean\r\n ) {\r\n super(sceneOrEngine);\r\n\r\n this.name = rootUrl;\r\n this.url = rootUrl;\r\n this._noMipmap = noMipmap;\r\n this.hasAlpha = false;\r\n this._format = format;\r\n this.isCube = true;\r\n this._textureMatrix = Matrix.Identity();\r\n this._createPolynomials = createPolynomials;\r\n this.coordinatesMode = Texture.CUBIC_MODE;\r\n this._extensions = extensions;\r\n this._files = files;\r\n this._forcedExtension = forcedExtension;\r\n this._loaderOptions = loaderOptions;\r\n this._useSRGBBuffer = useSRGBBuffer;\r\n this._lodScale = lodScale;\r\n this._lodOffset = lodOffset;\r\n\r\n if (!rootUrl && !files) {\r\n return;\r\n }\r\n\r\n this.updateURL(rootUrl, forcedExtension, onLoad, prefiltered, onError, extensions, this.getScene()?.useDelayedTextureLoading, files);\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 \"CubeTexture\"\r\n */\r\n public getClassName(): string {\r\n return \"CubeTexture\";\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 forcedExtension defines the extension to use\r\n * @param onLoad callback called when the texture is loaded (defaults to null)\r\n * @param prefiltered Defines whether the updated texture is prefiltered or not\r\n * @param onError callback called if there was an error during the loading process (defaults to null)\r\n * @param extensions defines the suffixes add to the picture name in case six images are in use like _px.jpg...\r\n * @param delayLoad defines if the texture should be loaded now (false by default)\r\n * @param files defines the six files to load for the different faces in that order: px, py, pz, nx, ny, nz\r\n */\r\n public updateURL(\r\n url: string,\r\n forcedExtension?: string,\r\n onLoad: Nullable<() => void> = null,\r\n prefiltered: boolean = false,\r\n onError: Nullable<(message?: string, exception?: any) => void> = null,\r\n extensions: Nullable<string[]> = null,\r\n delayLoad = false,\r\n files: Nullable<string[]> = null\r\n ): void {\r\n if (!this.name || this.name.startsWith(\"data:\")) {\r\n this.name = url;\r\n }\r\n this.url = url;\r\n\r\n if (forcedExtension) {\r\n this._forcedExtension = forcedExtension;\r\n }\r\n\r\n const lastDot = url.lastIndexOf(\".\");\r\n const extension = forcedExtension ? forcedExtension : lastDot > -1 ? url.substring(lastDot).toLowerCase() : \"\";\r\n const isDDS = extension.indexOf(\".dds\") === 0;\r\n const isEnv = extension.indexOf(\".env\") === 0;\r\n\r\n if (isEnv) {\r\n this.gammaSpace = false;\r\n this._prefiltered = false;\r\n this.anisotropicFilteringLevel = 1;\r\n } else {\r\n this._prefiltered = prefiltered;\r\n\r\n if (prefiltered) {\r\n this.gammaSpace = false;\r\n this.anisotropicFilteringLevel = 1;\r\n }\r\n }\r\n\r\n if (files) {\r\n this._files = files;\r\n } else {\r\n if (!isEnv && !isDDS && !extensions) {\r\n extensions = [\"_px.jpg\", \"_py.jpg\", \"_pz.jpg\", \"_nx.jpg\", \"_ny.jpg\", \"_nz.jpg\"];\r\n }\r\n\r\n this._files = this._files || [];\r\n this._files.length = 0;\r\n\r\n if (extensions) {\r\n for (let index = 0; index < extensions.length; index++) {\r\n this._files.push(url + extensions[index]);\r\n }\r\n this._extensions = extensions;\r\n }\r\n }\r\n\r\n if (delayLoad) {\r\n this.delayLoadState = Constants.DELAYLOADSTATE_NOTLOADED;\r\n this._delayedOnLoad = onLoad;\r\n this._delayedOnError = onError;\r\n } else {\r\n this._loadTexture(onLoad, onError);\r\n }\r\n }\r\n\r\n /**\r\n * Delays loading of the cube texture\r\n * @param forcedExtension defines the extension to use\r\n */\r\n public delayLoad(forcedExtension?: string): void {\r\n if (this.delayLoadState !== Constants.DELAYLOADSTATE_NOTLOADED) {\r\n return;\r\n }\r\n if (forcedExtension) {\r\n this._forcedExtension = forcedExtension;\r\n }\r\n\r\n this.delayLoadState = Constants.DELAYLOADSTATE_LOADED;\r\n this._loadTexture(this._delayedOnLoad, this._delayedOnError);\r\n }\r\n\r\n /**\r\n * Returns the reflection texture matrix\r\n * @returns the reflection texture matrix\r\n */\r\n public getReflectionTextureMatrix(): Matrix {\r\n return this._textureMatrix;\r\n }\r\n\r\n /**\r\n * Sets the reflection texture matrix\r\n * @param value Reflection texture matrix\r\n */\r\n public setReflectionTextureMatrix(value: Matrix): void {\r\n if (value.updateFlag === this._textureMatrix.updateFlag) {\r\n return;\r\n }\r\n\r\n if (value.isIdentity() !== this._textureMatrix.isIdentity()) {\r\n this.getScene()?.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag, (mat) => mat.getActiveTextures().indexOf(this) !== -1);\r\n }\r\n\r\n this._textureMatrix = value;\r\n }\r\n\r\n private _loadTexture(onLoad: Nullable<() => void> = null, onError: Nullable<(message?: string, exception?: any) => void> = null) {\r\n const scene = this.getScene();\r\n const oldTexture = this._texture;\r\n this._texture = this._getFromCache(this.url, this._noMipmap, undefined, undefined, this._useSRGBBuffer, this.isCube);\r\n\r\n const onLoadProcessing = () => {\r\n this.onLoadObservable.notifyObservers(this);\r\n if (oldTexture) {\r\n oldTexture.dispose();\r\n this.getScene()?.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag);\r\n }\r\n if (onLoad) {\r\n onLoad();\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._texture) {\r\n if (this._prefiltered) {\r\n this._texture = this._getEngine()!.createPrefilteredCubeTexture(\r\n this.url,\r\n scene,\r\n this._lodScale,\r\n this._lodOffset,\r\n onLoad,\r\n errorHandler,\r\n this._format,\r\n this._forcedExtension,\r\n this._createPolynomials\r\n );\r\n } else {\r\n this._texture = this._getEngine()!.createCubeTexture(\r\n this.url,\r\n scene,\r\n this._files,\r\n this._noMipmap,\r\n onLoad,\r\n errorHandler,\r\n this._format,\r\n this._forcedExtension,\r\n false,\r\n this._lodScale,\r\n this._lodOffset,\r\n null,\r\n this._loaderOptions,\r\n !!this._useSRGBBuffer\r\n );\r\n }\r\n\r\n this._texture?.onLoadedObservable.add(() => this.onLoadObservable.notifyObservers(this));\r\n } else {\r\n if (this._texture.isReady) {\r\n Tools.SetImmediate(() => onLoadProcessing());\r\n } else {\r\n this._texture.onLoadedObservable.add(() => onLoadProcessing());\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Parses text to create a cube texture\r\n * @param parsedTexture define the serialized text to read from\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the root url of the cube texture\r\n * @returns a cube texture\r\n */\r\n public static Parse(parsedTexture: any, scene: Scene, rootUrl: string): CubeTexture {\r\n const texture = SerializationHelper.Parse(\r\n () => {\r\n let prefiltered: boolean = false;\r\n if (parsedTexture.prefiltered) {\r\n prefiltered = parsedTexture.prefiltered;\r\n }\r\n return new CubeTexture(\r\n rootUrl + parsedTexture.name,\r\n scene,\r\n parsedTexture.extensions,\r\n false,\r\n parsedTexture.files || null,\r\n null,\r\n null,\r\n undefined,\r\n prefiltered,\r\n parsedTexture.forcedExtension\r\n );\r\n },\r\n parsedTexture,\r\n scene\r\n );\r\n\r\n // Local Cubemaps\r\n if (parsedTexture.boundingBoxPosition) {\r\n texture.boundingBoxPosition = Vector3.FromArray(parsedTexture.boundingBoxPosition);\r\n }\r\n if (parsedTexture.boundingBoxSize) {\r\n texture.boundingBoxSize = Vector3.FromArray(parsedTexture.boundingBoxSize);\r\n }\r\n\r\n // Animations\r\n if (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 return texture;\r\n }\r\n\r\n /**\r\n * Makes a clone, or deep copy, of the cube texture\r\n * @returns a new cube texture\r\n */\r\n public clone(): CubeTexture {\r\n let uniqueId = 0;\r\n\r\n const newCubeTexture = SerializationHelper.Clone(() => {\r\n const cubeTexture = new CubeTexture(this.url, this.getScene() || this._getEngine()!, this._extensions, this._noMipmap, this._files);\r\n uniqueId = cubeTexture.uniqueId;\r\n\r\n return cubeTexture;\r\n }, this);\r\n\r\n newCubeTexture.uniqueId = uniqueId;\r\n\r\n return newCubeTexture;\r\n }\r\n}\r\n\r\nTexture._CubeTextureParser = CubeTexture.Parse;\r\n// Some exporters relies on Tools.Instantiate\r\nRegisterClass(\"BABYLON.CubeTexture\", CubeTexture);\r\n"]}
|
|
@@ -43,7 +43,7 @@ var EquiRectangularCubeTexture = /** @class */ (function (_super) {
|
|
|
43
43
|
_this._onError = onError;
|
|
44
44
|
_this.hasAlpha = false;
|
|
45
45
|
_this.isCube = true;
|
|
46
|
-
_this._texture = _this._getFromCache(url, _this._noMipmap);
|
|
46
|
+
_this._texture = _this._getFromCache(url, _this._noMipmap, undefined, undefined, undefined, _this.isCube);
|
|
47
47
|
if (!_this._texture) {
|
|
48
48
|
if (!scene.useDelayedTextureLoading) {
|
|
49
49
|
_this._loadImage(_this._loadTexture.bind(_this), _this._onError);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"equiRectangularCubeTexture.js","sourceRoot":"","sources":["../../../../../../lts/core/generated/Materials/Textures/equiRectangularCubeTexture.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,+CAA+C,CAAC;AACvF,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,4CAA4C,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD;;GAEG;AACH;IAAgD,8CAAW;IAuBvD;;;;;;;;;;OAUG;IACH,oCACI,GAAW,EACX,KAAY,EACZ,IAAY,EACZ,QAAyB,EACzB,UAA0B,EAC1B,MAAmC,EACnC,OAAqE;QAHrE,yBAAA,EAAA,gBAAyB;QACzB,2BAAA,EAAA,iBAA0B;QAC1B,uBAAA,EAAA,aAAmC;QACnC,wBAAA,EAAA,cAAqE;QAPzE,YASI,kBAAM,KAAK,CAAC,SAiCf;QAvEO,aAAO,GAAyB,IAAI,CAAC;QAC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./baseTexture\";\r\nimport { Texture } from \"./texture\";\r\nimport type { Scene } from \"../../scene\";\r\nimport type { Nullable } from \"../../types\";\r\nimport { Tools } from \"../../Misc/tools\";\r\nimport \"../../Engines/Extensions/engine.rawTexture\";\r\nimport { Constants } from \"../../Engines/constants\";\r\nimport { LoadImage } from \"../../Misc/fileTools\";\r\n\r\n/**\r\n * This represents a texture coming from an equirectangular image supported by the web browser canvas.\r\n */\r\nexport class EquiRectangularCubeTexture extends BaseTexture {\r\n /** The six faces of the cube. */\r\n private static _FacesMapping = [\"right\", \"left\", \"up\", \"down\", \"front\", \"back\"];\r\n\r\n private _noMipmap: boolean;\r\n private _onLoad: Nullable<() => void> = null;\r\n private _onError: Nullable<() => void> = null;\r\n\r\n /** The size of the cubemap. */\r\n private _size: number;\r\n\r\n /** The buffer of the image. */\r\n private _buffer: ArrayBuffer;\r\n\r\n /** The width of the input image. */\r\n private _width: number;\r\n\r\n /** The height of the input image. */\r\n private _height: number;\r\n\r\n /** The URL to the image. */\r\n public url: string;\r\n\r\n /**\r\n * Instantiates an EquiRectangularCubeTexture from the following parameters.\r\n * @param url The location of the image\r\n * @param scene The scene the texture will be used in\r\n * @param size The cubemap desired size (the more it increases the longer the generation will be)\r\n * @param noMipmap Forces to not generate the mipmap if true\r\n * @param gammaSpace Specifies if the texture will be used in gamma or linear space\r\n * (the PBR material requires those textures in linear space, but the standard material would require them in Gamma space)\r\n * @param onLoad — defines a callback called when texture is loaded\r\n * @param onError — defines a callback called if there is an error\r\n */\r\n constructor(\r\n url: string,\r\n scene: Scene,\r\n size: number,\r\n noMipmap: boolean = false,\r\n gammaSpace: boolean = true,\r\n onLoad: Nullable<() => void> = null,\r\n onError: Nullable<(message?: string, exception?: any) => void> = null\r\n ) {\r\n super(scene);\r\n\r\n if (!url) {\r\n throw new Error(\"Image url is not set\");\r\n }\r\n\r\n this._coordinatesMode = Texture.CUBIC_MODE;\r\n this.name = url;\r\n this.url = url;\r\n this._size = size;\r\n this._noMipmap = noMipmap;\r\n this.gammaSpace = gammaSpace;\r\n this._onLoad = onLoad;\r\n this._onError = onError;\r\n\r\n this.hasAlpha = false;\r\n this.isCube = true;\r\n\r\n this._texture = this._getFromCache(url, this._noMipmap);\r\n\r\n if (!this._texture) {\r\n if (!scene.useDelayedTextureLoading) {\r\n this._loadImage(this._loadTexture.bind(this), this._onError);\r\n } else {\r\n this.delayLoadState = Constants.DELAYLOADSTATE_NOTLOADED;\r\n }\r\n } else if (onLoad) {\r\n if (this._texture.isReady) {\r\n Tools.SetImmediate(() => onLoad());\r\n } else {\r\n this._texture.onLoadedObservable.add(onLoad);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Load the image data, by putting the image on a canvas and extracting its buffer.\r\n * @param loadTextureCallback\r\n * @param onError\r\n */\r\n private _loadImage(loadTextureCallback: () => void, onError: Nullable<(message?: string, exception?: any) => void>): void {\r\n const canvas = document.createElement(\"canvas\");\r\n LoadImage(\r\n this.url,\r\n (image) => {\r\n this._width = image.width;\r\n this._height = image.height;\r\n canvas.width = this._width;\r\n canvas.height = this._height;\r\n\r\n const ctx = canvas.getContext(\"2d\") as CanvasRenderingContext2D;\r\n ctx.drawImage(image, 0, 0);\r\n\r\n const imageData = ctx.getImageData(0, 0, image.width, image.height);\r\n this._buffer = imageData.data.buffer as ArrayBuffer;\r\n\r\n canvas.remove();\r\n loadTextureCallback();\r\n },\r\n (_, e) => {\r\n if (onError) {\r\n onError(`${this.getClassName()} could not be loaded`, e);\r\n }\r\n },\r\n null\r\n );\r\n }\r\n\r\n /**\r\n * Convert the image buffer into a cubemap and create a CubeTexture.\r\n */\r\n private _loadTexture(): void {\r\n const scene = this.getScene();\r\n const callback = (): Nullable<ArrayBufferView[]> => {\r\n const imageData = this._getFloat32ArrayFromArrayBuffer(this._buffer);\r\n\r\n // Extract the raw linear data.\r\n const data = PanoramaToCubeMapTools.ConvertPanoramaToCubemap(imageData, this._width, this._height, this._size);\r\n\r\n const results = [];\r\n\r\n // Push each faces.\r\n for (let i = 0; i < 6; i++) {\r\n const dataFace = (data as any)[EquiRectangularCubeTexture._FacesMapping[i]];\r\n results.push(dataFace);\r\n }\r\n\r\n return results;\r\n };\r\n\r\n if (!scene) {\r\n return;\r\n }\r\n this._texture = scene\r\n .getEngine()\r\n .createRawCubeTextureFromUrl(\r\n this.url,\r\n scene,\r\n this._size,\r\n Constants.TEXTUREFORMAT_RGB,\r\n scene.getEngine().getCaps().textureFloat ? Constants.TEXTURETYPE_FLOAT : Constants.TEXTURETYPE_UNSIGNED_INTEGER,\r\n this._noMipmap,\r\n callback,\r\n null,\r\n this._onLoad,\r\n this._onError\r\n );\r\n }\r\n\r\n /**\r\n * Convert the ArrayBuffer into a Float32Array and drop the transparency channel.\r\n * @param buffer The ArrayBuffer that should be converted.\r\n * @returns The buffer as Float32Array.\r\n */\r\n private _getFloat32ArrayFromArrayBuffer(buffer: ArrayBuffer): Float32Array {\r\n const dataView = new DataView(buffer);\r\n const floatImageData = new Float32Array((buffer.byteLength * 3) / 4);\r\n\r\n let k = 0;\r\n for (let i = 0; i < buffer.byteLength; i++) {\r\n // We drop the transparency channel, because we do not need/want it\r\n if ((i + 1) % 4 !== 0) {\r\n floatImageData[k++] = dataView.getUint8(i) / 255;\r\n }\r\n }\r\n\r\n return floatImageData;\r\n }\r\n\r\n /**\r\n * Get the current class name of the texture useful for serialization or dynamic coding.\r\n * @returns \"EquiRectangularCubeTexture\"\r\n */\r\n public getClassName(): string {\r\n return \"EquiRectangularCubeTexture\";\r\n }\r\n\r\n /**\r\n * Create a clone of the current EquiRectangularCubeTexture and return it.\r\n * @returns A clone of the current EquiRectangularCubeTexture.\r\n */\r\n public clone(): EquiRectangularCubeTexture {\r\n const scene = this.getScene();\r\n if (!scene) {\r\n return this;\r\n }\r\n\r\n const newTexture = new EquiRectangularCubeTexture(this.url, scene, this._size, this._noMipmap, this.gammaSpace);\r\n\r\n // Base texture\r\n newTexture.level = this.level;\r\n newTexture.wrapU = this.wrapU;\r\n newTexture.wrapV = this.wrapV;\r\n newTexture.coordinatesIndex = this.coordinatesIndex;\r\n newTexture.coordinatesMode = this.coordinatesMode;\r\n\r\n return newTexture;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"equiRectangularCubeTexture.js","sourceRoot":"","sources":["../../../../../../lts/core/generated/Materials/Textures/equiRectangularCubeTexture.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,+CAA+C,CAAC;AACvF,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,4CAA4C,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD;;GAEG;AACH;IAAgD,8CAAW;IAuBvD;;;;;;;;;;OAUG;IACH,oCACI,GAAW,EACX,KAAY,EACZ,IAAY,EACZ,QAAyB,EACzB,UAA0B,EAC1B,MAAmC,EACnC,OAAqE;QAHrE,yBAAA,EAAA,gBAAyB;QACzB,2BAAA,EAAA,iBAA0B;QAC1B,uBAAA,EAAA,aAAmC;QACnC,wBAAA,EAAA,cAAqE;QAPzE,YASI,kBAAM,KAAK,CAAC,SAiCf;QAvEO,aAAO,GAAyB,IAAI,CAAC;QACrC,cAAQ,GAAyB,IAAI,CAAC;QAuC1C,IAAI,CAAC,GAAG,EAAE;YACN,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;SAC3C;QAED,KAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC,UAAU,CAAC;QAC3C,KAAI,CAAC,IAAI,GAAG,GAAG,CAAC;QAChB,KAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,KAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,KAAI,CAAC,SAAS,GAAG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;OAGG;IACI,iDAAY,GAAnB;QACI,OAAO,4BAA4B,CAAC;IACxC,CAAC;IAED;;;OAGG;IACI,0CAAK,GAAZ;QACI,IAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAC9B,IAAI,CAAC,KAAK,EAAE;YACR,OAAO,IAAI,CAAC;SACf;QAED,IAAM,UAAU,GAAG,IAAI,0BAA0B,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QAEhH,eAAe;QACf,UAAU,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QAC9B,UAAU,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QAC9B,UAAU,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QAC9B,UAAU,CAAC,gBAAgB,GAAG,IAAI,CAAC,gBAAgB,CAAC;QACpD,UAAU,CAAC,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC;QAElD,OAAO,UAAU,CAAC;IACtB,CAAC;IAvMD,iCAAiC;IAClB,wCAAa,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IAuMpF,iCAAC;CAAA,AAzMD,CAAgD,WAAW,GAyM1D;SAzMY,0BAA0B","sourcesContent":["import { PanoramaToCubeMapTools } from \"../../Misc/HighDynamicRange/panoramaToCubemap\";\r\nimport { BaseTexture } from \"./baseTexture\";\r\nimport { Texture } from \"./texture\";\r\nimport type { Scene } from \"../../scene\";\r\nimport type { Nullable } from \"../../types\";\r\nimport { Tools } from \"../../Misc/tools\";\r\nimport \"../../Engines/Extensions/engine.rawTexture\";\r\nimport { Constants } from \"../../Engines/constants\";\r\nimport { LoadImage } from \"../../Misc/fileTools\";\r\n\r\n/**\r\n * This represents a texture coming from an equirectangular image supported by the web browser canvas.\r\n */\r\nexport class EquiRectangularCubeTexture extends BaseTexture {\r\n /** The six faces of the cube. */\r\n private static _FacesMapping = [\"right\", \"left\", \"up\", \"down\", \"front\", \"back\"];\r\n\r\n private _noMipmap: boolean;\r\n private _onLoad: Nullable<() => void> = null;\r\n private _onError: Nullable<() => void> = null;\r\n\r\n /** The size of the cubemap. */\r\n private _size: number;\r\n\r\n /** The buffer of the image. */\r\n private _buffer: ArrayBuffer;\r\n\r\n /** The width of the input image. */\r\n private _width: number;\r\n\r\n /** The height of the input image. */\r\n private _height: number;\r\n\r\n /** The URL to the image. */\r\n public url: string;\r\n\r\n /**\r\n * Instantiates an EquiRectangularCubeTexture from the following parameters.\r\n * @param url The location of the image\r\n * @param scene The scene the texture will be used in\r\n * @param size The cubemap desired size (the more it increases the longer the generation will be)\r\n * @param noMipmap Forces to not generate the mipmap if true\r\n * @param gammaSpace Specifies if the texture will be used in gamma or linear space\r\n * (the PBR material requires those textures in linear space, but the standard material would require them in Gamma space)\r\n * @param onLoad — defines a callback called when texture is loaded\r\n * @param onError — defines a callback called if there is an error\r\n */\r\n constructor(\r\n url: string,\r\n scene: Scene,\r\n size: number,\r\n noMipmap: boolean = false,\r\n gammaSpace: boolean = true,\r\n onLoad: Nullable<() => void> = null,\r\n onError: Nullable<(message?: string, exception?: any) => void> = null\r\n ) {\r\n super(scene);\r\n\r\n if (!url) {\r\n throw new Error(\"Image url is not set\");\r\n }\r\n\r\n this._coordinatesMode = Texture.CUBIC_MODE;\r\n this.name = url;\r\n this.url = url;\r\n this._size = size;\r\n this._noMipmap = noMipmap;\r\n this.gammaSpace = gammaSpace;\r\n this._onLoad = onLoad;\r\n this._onError = onError;\r\n\r\n this.hasAlpha = false;\r\n this.isCube = true;\r\n\r\n this._texture = this._getFromCache(url, this._noMipmap, undefined, undefined, undefined, this.isCube);\r\n\r\n if (!this._texture) {\r\n if (!scene.useDelayedTextureLoading) {\r\n this._loadImage(this._loadTexture.bind(this), this._onError);\r\n } else {\r\n this.delayLoadState = Constants.DELAYLOADSTATE_NOTLOADED;\r\n }\r\n } else if (onLoad) {\r\n if (this._texture.isReady) {\r\n Tools.SetImmediate(() => onLoad());\r\n } else {\r\n this._texture.onLoadedObservable.add(onLoad);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Load the image data, by putting the image on a canvas and extracting its buffer.\r\n * @param loadTextureCallback\r\n * @param onError\r\n */\r\n private _loadImage(loadTextureCallback: () => void, onError: Nullable<(message?: string, exception?: any) => void>): void {\r\n const canvas = document.createElement(\"canvas\");\r\n LoadImage(\r\n this.url,\r\n (image) => {\r\n this._width = image.width;\r\n this._height = image.height;\r\n canvas.width = this._width;\r\n canvas.height = this._height;\r\n\r\n const ctx = canvas.getContext(\"2d\") as CanvasRenderingContext2D;\r\n ctx.drawImage(image, 0, 0);\r\n\r\n const imageData = ctx.getImageData(0, 0, image.width, image.height);\r\n this._buffer = imageData.data.buffer as ArrayBuffer;\r\n\r\n canvas.remove();\r\n loadTextureCallback();\r\n },\r\n (_, e) => {\r\n if (onError) {\r\n onError(`${this.getClassName()} could not be loaded`, e);\r\n }\r\n },\r\n null\r\n );\r\n }\r\n\r\n /**\r\n * Convert the image buffer into a cubemap and create a CubeTexture.\r\n */\r\n private _loadTexture(): void {\r\n const scene = this.getScene();\r\n const callback = (): Nullable<ArrayBufferView[]> => {\r\n const imageData = this._getFloat32ArrayFromArrayBuffer(this._buffer);\r\n\r\n // Extract the raw linear data.\r\n const data = PanoramaToCubeMapTools.ConvertPanoramaToCubemap(imageData, this._width, this._height, this._size);\r\n\r\n const results = [];\r\n\r\n // Push each faces.\r\n for (let i = 0; i < 6; i++) {\r\n const dataFace = (data as any)[EquiRectangularCubeTexture._FacesMapping[i]];\r\n results.push(dataFace);\r\n }\r\n\r\n return results;\r\n };\r\n\r\n if (!scene) {\r\n return;\r\n }\r\n this._texture = scene\r\n .getEngine()\r\n .createRawCubeTextureFromUrl(\r\n this.url,\r\n scene,\r\n this._size,\r\n Constants.TEXTUREFORMAT_RGB,\r\n scene.getEngine().getCaps().textureFloat ? Constants.TEXTURETYPE_FLOAT : Constants.TEXTURETYPE_UNSIGNED_INTEGER,\r\n this._noMipmap,\r\n callback,\r\n null,\r\n this._onLoad,\r\n this._onError\r\n );\r\n }\r\n\r\n /**\r\n * Convert the ArrayBuffer into a Float32Array and drop the transparency channel.\r\n * @param buffer The ArrayBuffer that should be converted.\r\n * @returns The buffer as Float32Array.\r\n */\r\n private _getFloat32ArrayFromArrayBuffer(buffer: ArrayBuffer): Float32Array {\r\n const dataView = new DataView(buffer);\r\n const floatImageData = new Float32Array((buffer.byteLength * 3) / 4);\r\n\r\n let k = 0;\r\n for (let i = 0; i < buffer.byteLength; i++) {\r\n // We drop the transparency channel, because we do not need/want it\r\n if ((i + 1) % 4 !== 0) {\r\n floatImageData[k++] = dataView.getUint8(i) / 255;\r\n }\r\n }\r\n\r\n return floatImageData;\r\n }\r\n\r\n /**\r\n * Get the current class name of the texture useful for serialization or dynamic coding.\r\n * @returns \"EquiRectangularCubeTexture\"\r\n */\r\n public getClassName(): string {\r\n return \"EquiRectangularCubeTexture\";\r\n }\r\n\r\n /**\r\n * Create a clone of the current EquiRectangularCubeTexture and return it.\r\n * @returns A clone of the current EquiRectangularCubeTexture.\r\n */\r\n public clone(): EquiRectangularCubeTexture {\r\n const scene = this.getScene();\r\n if (!scene) {\r\n return this;\r\n }\r\n\r\n const newTexture = new EquiRectangularCubeTexture(this.url, scene, this._size, this._noMipmap, this.gammaSpace);\r\n\r\n // Base texture\r\n newTexture.level = this.level;\r\n newTexture.wrapU = this.wrapU;\r\n newTexture.wrapV = this.wrapV;\r\n newTexture.coordinatesIndex = this.coordinatesIndex;\r\n newTexture.coordinatesMode = this.coordinatesMode;\r\n\r\n return newTexture;\r\n }\r\n}\r\n"]}
|
|
@@ -78,7 +78,7 @@ var HDRCubeTexture = /** @class */ (function (_super) {
|
|
|
78
78
|
_this._noMipmap = noMipmap;
|
|
79
79
|
_this._size = size;
|
|
80
80
|
_this._generateHarmonics = generateHarmonics;
|
|
81
|
-
_this._texture = _this._getFromCache(url, _this._noMipmap);
|
|
81
|
+
_this._texture = _this._getFromCache(url, _this._noMipmap, undefined, undefined, undefined, _this.isCube);
|
|
82
82
|
if (!_this._texture) {
|
|
83
83
|
if (!((_a = _this.getScene()) === null || _a === void 0 ? void 0 : _a.useDelayedTextureLoading)) {
|
|
84
84
|
_this._loadTexture();
|