@onerjs/core 8.33.8 → 8.33.9

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.
@@ -319,6 +319,7 @@ export class EnvCubeTexture extends BaseTexture {
319
319
  serializationObject.noMipmap = this._noMipmap;
320
320
  serializationObject.isBlocking = this._isBlocking;
321
321
  serializationObject.rotationY = this._rotationY;
322
+ serializationObject.metadata = this.metadata;
322
323
  return serializationObject;
323
324
  }
324
325
  /**
@@ -341,6 +342,7 @@ export class EnvCubeTexture extends BaseTexture {
341
342
  texture.level = parsedTexture.level;
342
343
  texture.coordinatesMode = parsedTexture.coordinatesMode;
343
344
  texture.isBlocking = parsedTexture.isBlocking;
345
+ texture.metadata = parsedTexture.metadata;
344
346
  if (parsedTexture.boundingBoxPosition) {
345
347
  texture.boundingBoxPosition = Vector3.FromArray(parsedTexture.boundingBoxPosition);
346
348
  }
@@ -1 +1 @@
1
- {"version":3,"file":"envCubeTexture.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/Textures/envCubeTexture.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,iCAAiC,EAAE,MAAM,0DAA0D,CAAC;AAC7G,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,EAAE,YAAY,EAAE,MAAM,iDAAiD,CAAC;AAC/E,OAAO,EAAE,sBAAsB,EAAE,MAAM,2DAA2D,CAAC;AACnG,OAAO,EAAE,WAAW,EA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e,EAAE,CAAC;YAChC,OAAO,CAAC,eAAe,GAAG,OAAO,CAAC,SAAS,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC;QAC/E,CAAC;QACD,IAAI,aAAa,CAAC,SAAS,EAAE,CAAC;YAC1B,OAAO,CAAC,SAAS,GAAG,aAAa,CAAC,SAAS,CAAC;QAChD,CAAC;IACL,CAAC;;AA5ac,4BAAa,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,AAAnD,CAAoD","sourcesContent":["import 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 { CubeMapToSphericalPolynomialTools } from \"../../Misc/HighDynamicRange/cubemapToSphericalPolynomial\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport { Tools } from \"../../Misc/tools\";\r\nimport { ToGammaSpace } from \"../../Maths/math.constants\";\r\nimport type { AbstractEngine } from \"../../Engines/abstractEngine\";\r\nimport { HDRFiltering } from \"../../Materials/Textures/Filtering/hdrFiltering\";\r\nimport { HDRIrradianceFiltering } from \"../../Materials/Textures/Filtering/hdrIrradianceFiltering\";\r\nimport { ToHalfFloat } from \"../../Misc/textureTools\";\r\nimport \"../../Materials/Textures/baseTexture.polynomial\";\r\nimport type { CubeMapInfo } from \"../../Misc/HighDynamicRange/panoramaToCubemap\";\r\nimport { SphericalPolynomial } from \"../../Maths/sphericalPolynomial\";\r\n\r\n/**\r\n * This represents an environment base texture which could for instance be from HDR or EXR files.\r\n */\r\nexport abstract class EnvCubeTexture extends BaseTexture {\r\n private static _FacesMapping = [\"right\", \"left\", \"up\", \"down\", \"front\", \"back\"];\r\n\r\n protected _generateHarmonics = true;\r\n protected _noMipmap: boolean;\r\n protected _size: number;\r\n\r\n private _prefilterOnLoad: boolean;\r\n private _prefilterIrradianceOnLoad: boolean;\r\n private _prefilterUsingCdf: boolean;\r\n private _textureMatrix: Matrix;\r\n private _supersample: boolean;\r\n private _onLoad: () => void;\r\n private _onError: Nullable<() => void> = null;\r\n\r\n /**\r\n * The texture URL.\r\n */\r\n public url: string;\r\n\r\n protected _isBlocking: boolean = true;\r\n /**\r\n * Sets whether or not the texture is blocking during loading.\r\n */\r\n public override set isBlocking(value: boolean) {\r\n this._isBlocking = value;\r\n }\r\n /**\r\n * Gets whether or not the texture is blocking during loading.\r\n */\r\n public override get isBlocking(): boolean {\r\n return this._isBlocking;\r\n }\r\n\r\n protected _rotationY: number = 0;\r\n /**\r\n * Sets texture matrix rotation angle around Y axis in radians.\r\n */\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 * 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 */\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 public get boundingBoxSize(): Vector3 {\r\n return this._boundingBoxSize;\r\n }\r\n\r\n /**\r\n * Observable triggered once the texture has been loaded.\r\n */\r\n public onLoadObservable: Observable<EnvCubeTexture> = new Observable<EnvCubeTexture>();\r\n\r\n /**\r\n * Instantiates an EnvCubeTexture from the following parameters.\r\n *\r\n * @param url The location of the raw data (Panorama stored in RGBE format)\r\n * @param sceneOrEngine The scene or engine 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 generateHarmonics Specifies whether you want to extract the polynomial harmonics during the generation process\r\n * @param gammaSpace Specifies if the texture will be use in gamma or linear space (the PBR material requires those texture in linear space, but the standard material would require them in Gamma space)\r\n * @param prefilterOnLoad Prefilters texture to allow use of this texture as a PBR reflection texture.\r\n * @param onLoad on success callback function\r\n * @param onError on error callback function\r\n * @param supersample Defines if texture must be supersampled (default: false)\r\n * @param prefilterIrradianceOnLoad Prefilters texture to allow use of this texture for irradiance lighting.\r\n * @param prefilterUsingCdf Defines if the prefiltering should be done using a CDF instead of the default approach.\r\n */\r\n constructor(\r\n url: string,\r\n sceneOrEngine: Scene | AbstractEngine,\r\n size: number,\r\n noMipmap = false,\r\n generateHarmonics = true,\r\n gammaSpace = false,\r\n prefilterOnLoad = false,\r\n onLoad: Nullable<() => void> = null,\r\n onError: Nullable<(message?: string, exception?: any) => void> = null,\r\n supersample = false,\r\n prefilterIrradianceOnLoad = false,\r\n prefilterUsingCdf = false\r\n ) {\r\n super(sceneOrEngine);\r\n\r\n if (!url) {\r\n return;\r\n }\r\n\r\n this._coordinatesMode = Texture.CUBIC_MODE;\r\n this.name = url;\r\n this.url = url;\r\n this.hasAlpha = false;\r\n this.isCube = true;\r\n this._textureMatrix = Matrix.Identity();\r\n this._prefilterOnLoad = prefilterOnLoad;\r\n this._prefilterIrradianceOnLoad = prefilterIrradianceOnLoad;\r\n this._prefilterUsingCdf = prefilterUsingCdf;\r\n this._onLoad = () => {\r\n this.onLoadObservable.notifyObservers(this);\r\n if (onLoad) {\r\n onLoad();\r\n }\r\n };\r\n\r\n this._onError = onError;\r\n this.gammaSpace = gammaSpace;\r\n\r\n this._noMipmap = noMipmap;\r\n this._size = size;\r\n // CDF is very sensitive to lost precision due to downsampling. This can result in\r\n // noticeable brightness differences with different resolutions. Enabling supersampling\r\n // mitigates this.\r\n this._supersample = supersample || prefilterUsingCdf;\r\n this._generateHarmonics = generateHarmonics;\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 (!this.getScene()?.useDelayedTextureLoading) {\r\n this._loadTexture();\r\n } else {\r\n this.delayLoadState = Constants.DELAYLOADSTATE_NOTLOADED;\r\n }\r\n } else {\r\n if (this._texture.isReady) {\r\n Tools.SetImmediate(() => this._onLoad());\r\n } else {\r\n this._texture.onLoadedObservable.add(this._onLoad);\r\n }\r\n }\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 \"EnvCubeTexture\"\r\n */\r\n public override getClassName(): string {\r\n return \"EnvCubeTexture\";\r\n }\r\n\r\n /**\r\n * Convert the raw data from the server into cubemap faces\r\n * @param buffer The buffer containing the texture data\r\n * @param size The cubemap face size\r\n * @param supersample Defines if texture must be supersampled\r\n * @returns The cube map data\r\n */\r\n protected abstract _getCubeMapTextureDataAsync(buffer: ArrayBuffer, size: number, supersample: boolean): Promise<CubeMapInfo>;\r\n\r\n /**\r\n * Occurs when the file has been loaded.\r\n */\r\n private _loadTexture() {\r\n const engine = this._getEngine()!;\r\n const caps = engine.getCaps();\r\n\r\n let textureType = Constants.TEXTURETYPE_UNSIGNED_BYTE;\r\n if (caps.textureFloat && caps.textureFloatLinearFiltering) {\r\n textureType = Constants.TEXTURETYPE_FLOAT;\r\n } else if (caps.textureHalfFloat && caps.textureHalfFloatLinearFiltering) {\r\n textureType = Constants.TEXTURETYPE_HALF_FLOAT;\r\n }\r\n\r\n // eslint-disable-next-line no-restricted-syntax\r\n const callback = async (buffer: ArrayBuffer): Promise<ArrayBufferView<ArrayBufferLike>[]> => {\r\n this.lodGenerationOffset = 0.0;\r\n this.lodGenerationScale = 0.8;\r\n\r\n // Extract the raw linear data.\r\n const data = await this._getCubeMapTextureDataAsync(buffer, this._size, this._supersample);\r\n\r\n // Generate harmonics if needed.\r\n if (this._generateHarmonics) {\r\n const sphericalPolynomial = CubeMapToSphericalPolynomialTools.ConvertCubeMapToSphericalPolynomial(data);\r\n this.sphericalPolynomial = sphericalPolynomial;\r\n }\r\n\r\n const results = [];\r\n\r\n let byteArray: Nullable<Uint8Array> = null;\r\n let shortArray: Nullable<Uint16Array> = null;\r\n\r\n // Push each faces.\r\n for (let j = 0; j < 6; j++) {\r\n // Create fallback array\r\n if (textureType === Constants.TEXTURETYPE_HALF_FLOAT) {\r\n shortArray = new Uint16Array(this._size * this._size * 3);\r\n } else if (textureType === Constants.TEXTURETYPE_UNSIGNED_BYTE) {\r\n // 3 channels of 1 bytes per pixel in bytes.\r\n byteArray = new Uint8Array(this._size * this._size * 3);\r\n }\r\n\r\n const dataFace = <Float32Array>(<any>data)[EnvCubeTexture._FacesMapping[j]];\r\n\r\n // If special cases.\r\n if (this.gammaSpace || shortArray || byteArray) {\r\n for (let i = 0; i < this._size * this._size; i++) {\r\n // Put in gamma space if requested.\r\n if (this.gammaSpace) {\r\n dataFace[i * 3 + 0] = Math.pow(dataFace[i * 3 + 0], ToGammaSpace);\r\n dataFace[i * 3 + 1] = Math.pow(dataFace[i * 3 + 1], ToGammaSpace);\r\n dataFace[i * 3 + 2] = Math.pow(dataFace[i * 3 + 2], ToGammaSpace);\r\n }\r\n\r\n // Convert to half float texture for fallback.\r\n if (shortArray) {\r\n shortArray[i * 3 + 0] = ToHalfFloat(dataFace[i * 3 + 0]);\r\n shortArray[i * 3 + 1] = ToHalfFloat(dataFace[i * 3 + 1]);\r\n shortArray[i * 3 + 2] = ToHalfFloat(dataFace[i * 3 + 2]);\r\n }\r\n\r\n // Convert to int texture for fallback.\r\n if (byteArray) {\r\n let r = Math.max(dataFace[i * 3 + 0] * 255, 0);\r\n let g = Math.max(dataFace[i * 3 + 1] * 255, 0);\r\n let b = Math.max(dataFace[i * 3 + 2] * 255, 0);\r\n\r\n // May use luminance instead if the result is not accurate.\r\n const max = Math.max(Math.max(r, g), b);\r\n if (max > 255) {\r\n const scale = 255 / max;\r\n r *= scale;\r\n g *= scale;\r\n b *= scale;\r\n }\r\n\r\n byteArray[i * 3 + 0] = r;\r\n byteArray[i * 3 + 1] = g;\r\n byteArray[i * 3 + 2] = b;\r\n }\r\n }\r\n }\r\n\r\n if (shortArray) {\r\n results.push(shortArray);\r\n } else if (byteArray) {\r\n results.push(byteArray);\r\n } else {\r\n results.push(dataFace);\r\n }\r\n }\r\n\r\n return results;\r\n };\r\n\r\n if (engine._features.allowTexturePrefiltering && (this._prefilterOnLoad || this._prefilterIrradianceOnLoad)) {\r\n const previousOnLoad = this._onLoad;\r\n const hdrFiltering = new HDRFiltering(engine);\r\n this._onLoad = () => {\r\n let irradiancePromise: Promise<Nullable<BaseTexture>> = Promise.resolve(null);\r\n let radiancePromise: Promise<void> = Promise.resolve();\r\n if (this._prefilterIrradianceOnLoad) {\r\n const hdrIrradianceFiltering = new HDRIrradianceFiltering(engine, { useCdf: this._prefilterUsingCdf });\r\n irradiancePromise = hdrIrradianceFiltering.prefilter(this);\r\n }\r\n if (this._prefilterOnLoad) {\r\n radiancePromise = hdrFiltering.prefilter(this);\r\n }\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises, github/no-then\r\n Promise.all([irradiancePromise, radiancePromise]).then((results) => {\r\n const irradianceTexture = results[0];\r\n if (this._prefilterIrradianceOnLoad && irradianceTexture) {\r\n this.irradianceTexture = irradianceTexture;\r\n const scene = this.getScene();\r\n if (scene) {\r\n scene.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag);\r\n }\r\n }\r\n if (previousOnLoad) {\r\n previousOnLoad();\r\n }\r\n });\r\n };\r\n }\r\n\r\n this._texture = engine.createRawCubeTextureFromUrl(\r\n this.url,\r\n this.getScene(),\r\n this._size,\r\n Constants.TEXTUREFORMAT_RGB,\r\n textureType,\r\n this._noMipmap,\r\n callback,\r\n null,\r\n this._onLoad,\r\n this._onError\r\n );\r\n\r\n if (!this._generateHarmonics && !this._texture._sphericalPolynomial) {\r\n this._texture._sphericalPolynomial = new SphericalPolynomial();\r\n }\r\n }\r\n\r\n // Methods\r\n public override delayLoad(): void {\r\n if (this.delayLoadState !== Constants.DELAYLOADSTATE_NOTLOADED) {\r\n return;\r\n }\r\n\r\n this.delayLoadState = Constants.DELAYLOADSTATE_LOADED;\r\n this._texture = this._getFromCache(this.url, this._noMipmap);\r\n\r\n if (!this._texture) {\r\n this._loadTexture();\r\n }\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 override getReflectionTextureMatrix(): Matrix {\r\n return this._textureMatrix;\r\n }\r\n\r\n /**\r\n * Set the texture reflection matrix used to rotate/transform the reflection.\r\n * @param value Define the reflection matrix to set\r\n */\r\n public setReflectionTextureMatrix(value: Matrix): void {\r\n this._textureMatrix = value;\r\n\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\r\n /**\r\n * Dispose the texture and release its associated resources.\r\n */\r\n public override dispose(): void {\r\n this.onLoadObservable.clear();\r\n super.dispose();\r\n }\r\n\r\n /**\r\n * Serializes the texture to a JSON representation.\r\n * @returns the JSON representation\r\n */\r\n public override serialize(): any {\r\n if (!this.name) {\r\n return null;\r\n }\r\n\r\n const serializationObject: any = {};\r\n serializationObject.name = this.name;\r\n serializationObject.url = this.url;\r\n serializationObject.hasAlpha = this.hasAlpha;\r\n serializationObject.isCube = true;\r\n serializationObject.level = this.level;\r\n serializationObject.size = this._size;\r\n serializationObject.coordinatesMode = this.coordinatesMode;\r\n serializationObject.useInGammaSpace = this.gammaSpace;\r\n serializationObject.generateHarmonics = this._generateHarmonics;\r\n serializationObject.noMipmap = this._noMipmap;\r\n serializationObject.isBlocking = this._isBlocking;\r\n serializationObject.rotationY = this._rotationY;\r\n\r\n return serializationObject;\r\n }\r\n\r\n protected abstract _instantiateClone(): this;\r\n\r\n /**\r\n * Clones the current texture.\r\n * @returns the cloned texture\r\n */\r\n public override clone(): this {\r\n const newTexture = this._instantiateClone();\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 protected static _Parse(parsedTexture: any, texture: EnvCubeTexture): void {\r\n texture.name = parsedTexture.name;\r\n texture.hasAlpha = parsedTexture.hasAlpha;\r\n texture.level = parsedTexture.level;\r\n texture.coordinatesMode = parsedTexture.coordinatesMode;\r\n texture.isBlocking = parsedTexture.isBlocking;\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 if (parsedTexture.rotationY) {\r\n texture.rotationY = parsedTexture.rotationY;\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"envCubeTexture.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/Textures/envCubeTexture.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAC3D,OAAO,EAAE,SAA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I,GAAG,aAAa,CAAC,IAAI,CAAC;QAClC,OAAO,CAAC,QAAQ,GAAG,aAAa,CAAC,QAAQ,CAAC;QAC1C,OAAO,CAAC,KAAK,GAAG,aAAa,CAAC,KAAK,CAAC;QACpC,OAAO,CAAC,eAAe,GAAG,aAAa,CAAC,eAAe,CAAC;QACxD,OAAO,CAAC,UAAU,GAAG,aAAa,CAAC,UAAU,CAAC;QAC9C,OAAO,CAAC,QAAQ,GAAG,aAAa,CAAC,QAAQ,CAAC;QAC1C,IAAI,aAAa,CAAC,mBAAmB,EAAE,CAAC;YACpC,OAAO,CAAC,mBAAmB,GAAG,OAAO,CAAC,SAAS,CAAC,aAAa,CAAC,mBAAmB,CAAC,CAAC;QACvF,CAAC;QACD,IAAI,aAAa,CAAC,eAAe,EAAE,CAAC;YAChC,OAAO,CAAC,eAAe,GAAG,OAAO,CAAC,SAAS,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC;QAC/E,CAAC;QACD,IAAI,aAAa,CAAC,SAAS,EAAE,CAAC;YAC1B,OAAO,CAAC,SAAS,GAAG,aAAa,CAAC,SAAS,CAAC;QAChD,CAAC;IACL,CAAC;;AA9ac,4BAAa,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,AAAnD,CAAoD","sourcesContent":["import 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 { CubeMapToSphericalPolynomialTools } from \"../../Misc/HighDynamicRange/cubemapToSphericalPolynomial\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport { Tools } from \"../../Misc/tools\";\r\nimport { ToGammaSpace } from \"../../Maths/math.constants\";\r\nimport type { AbstractEngine } from \"../../Engines/abstractEngine\";\r\nimport { HDRFiltering } from \"../../Materials/Textures/Filtering/hdrFiltering\";\r\nimport { HDRIrradianceFiltering } from \"../../Materials/Textures/Filtering/hdrIrradianceFiltering\";\r\nimport { ToHalfFloat } from \"../../Misc/textureTools\";\r\nimport \"../../Materials/Textures/baseTexture.polynomial\";\r\nimport type { CubeMapInfo } from \"../../Misc/HighDynamicRange/panoramaToCubemap\";\r\nimport { SphericalPolynomial } from \"../../Maths/sphericalPolynomial\";\r\n\r\n/**\r\n * This represents an environment base texture which could for instance be from HDR or EXR files.\r\n */\r\nexport abstract class EnvCubeTexture extends BaseTexture {\r\n private static _FacesMapping = [\"right\", \"left\", \"up\", \"down\", \"front\", \"back\"];\r\n\r\n protected _generateHarmonics = true;\r\n protected _noMipmap: boolean;\r\n protected _size: number;\r\n\r\n private _prefilterOnLoad: boolean;\r\n private _prefilterIrradianceOnLoad: boolean;\r\n private _prefilterUsingCdf: boolean;\r\n private _textureMatrix: Matrix;\r\n private _supersample: boolean;\r\n private _onLoad: () => void;\r\n private _onError: Nullable<() => void> = null;\r\n\r\n /**\r\n * The texture URL.\r\n */\r\n public url: string;\r\n\r\n protected _isBlocking: boolean = true;\r\n /**\r\n * Sets whether or not the texture is blocking during loading.\r\n */\r\n public override set isBlocking(value: boolean) {\r\n this._isBlocking = value;\r\n }\r\n /**\r\n * Gets whether or not the texture is blocking during loading.\r\n */\r\n public override get isBlocking(): boolean {\r\n return this._isBlocking;\r\n }\r\n\r\n protected _rotationY: number = 0;\r\n /**\r\n * Sets texture matrix rotation angle around Y axis in radians.\r\n */\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 * 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 */\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 public get boundingBoxSize(): Vector3 {\r\n return this._boundingBoxSize;\r\n }\r\n\r\n /**\r\n * Observable triggered once the texture has been loaded.\r\n */\r\n public onLoadObservable: Observable<EnvCubeTexture> = new Observable<EnvCubeTexture>();\r\n\r\n /**\r\n * Instantiates an EnvCubeTexture from the following parameters.\r\n *\r\n * @param url The location of the raw data (Panorama stored in RGBE format)\r\n * @param sceneOrEngine The scene or engine 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 generateHarmonics Specifies whether you want to extract the polynomial harmonics during the generation process\r\n * @param gammaSpace Specifies if the texture will be use in gamma or linear space (the PBR material requires those texture in linear space, but the standard material would require them in Gamma space)\r\n * @param prefilterOnLoad Prefilters texture to allow use of this texture as a PBR reflection texture.\r\n * @param onLoad on success callback function\r\n * @param onError on error callback function\r\n * @param supersample Defines if texture must be supersampled (default: false)\r\n * @param prefilterIrradianceOnLoad Prefilters texture to allow use of this texture for irradiance lighting.\r\n * @param prefilterUsingCdf Defines if the prefiltering should be done using a CDF instead of the default approach.\r\n */\r\n constructor(\r\n url: string,\r\n sceneOrEngine: Scene | AbstractEngine,\r\n size: number,\r\n noMipmap = false,\r\n generateHarmonics = true,\r\n gammaSpace = false,\r\n prefilterOnLoad = false,\r\n onLoad: Nullable<() => void> = null,\r\n onError: Nullable<(message?: string, exception?: any) => void> = null,\r\n supersample = false,\r\n prefilterIrradianceOnLoad = false,\r\n prefilterUsingCdf = false\r\n ) {\r\n super(sceneOrEngine);\r\n\r\n if (!url) {\r\n return;\r\n }\r\n\r\n this._coordinatesMode = Texture.CUBIC_MODE;\r\n this.name = url;\r\n this.url = url;\r\n this.hasAlpha = false;\r\n this.isCube = true;\r\n this._textureMatrix = Matrix.Identity();\r\n this._prefilterOnLoad = prefilterOnLoad;\r\n this._prefilterIrradianceOnLoad = prefilterIrradianceOnLoad;\r\n this._prefilterUsingCdf = prefilterUsingCdf;\r\n this._onLoad = () => {\r\n this.onLoadObservable.notifyObservers(this);\r\n if (onLoad) {\r\n onLoad();\r\n }\r\n };\r\n\r\n this._onError = onError;\r\n this.gammaSpace = gammaSpace;\r\n\r\n this._noMipmap = noMipmap;\r\n this._size = size;\r\n // CDF is very sensitive to lost precision due to downsampling. This can result in\r\n // noticeable brightness differences with different resolutions. Enabling supersampling\r\n // mitigates this.\r\n this._supersample = supersample || prefilterUsingCdf;\r\n this._generateHarmonics = generateHarmonics;\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 (!this.getScene()?.useDelayedTextureLoading) {\r\n this._loadTexture();\r\n } else {\r\n this.delayLoadState = Constants.DELAYLOADSTATE_NOTLOADED;\r\n }\r\n } else {\r\n if (this._texture.isReady) {\r\n Tools.SetImmediate(() => this._onLoad());\r\n } else {\r\n this._texture.onLoadedObservable.add(this._onLoad);\r\n }\r\n }\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 \"EnvCubeTexture\"\r\n */\r\n public override getClassName(): string {\r\n return \"EnvCubeTexture\";\r\n }\r\n\r\n /**\r\n * Convert the raw data from the server into cubemap faces\r\n * @param buffer The buffer containing the texture data\r\n * @param size The cubemap face size\r\n * @param supersample Defines if texture must be supersampled\r\n * @returns The cube map data\r\n */\r\n protected abstract _getCubeMapTextureDataAsync(buffer: ArrayBuffer, size: number, supersample: boolean): Promise<CubeMapInfo>;\r\n\r\n /**\r\n * Occurs when the file has been loaded.\r\n */\r\n private _loadTexture() {\r\n const engine = this._getEngine()!;\r\n const caps = engine.getCaps();\r\n\r\n let textureType = Constants.TEXTURETYPE_UNSIGNED_BYTE;\r\n if (caps.textureFloat && caps.textureFloatLinearFiltering) {\r\n textureType = Constants.TEXTURETYPE_FLOAT;\r\n } else if (caps.textureHalfFloat && caps.textureHalfFloatLinearFiltering) {\r\n textureType = Constants.TEXTURETYPE_HALF_FLOAT;\r\n }\r\n\r\n // eslint-disable-next-line no-restricted-syntax\r\n const callback = async (buffer: ArrayBuffer): Promise<ArrayBufferView<ArrayBufferLike>[]> => {\r\n this.lodGenerationOffset = 0.0;\r\n this.lodGenerationScale = 0.8;\r\n\r\n // Extract the raw linear data.\r\n const data = await this._getCubeMapTextureDataAsync(buffer, this._size, this._supersample);\r\n\r\n // Generate harmonics if needed.\r\n if (this._generateHarmonics) {\r\n const sphericalPolynomial = CubeMapToSphericalPolynomialTools.ConvertCubeMapToSphericalPolynomial(data);\r\n this.sphericalPolynomial = sphericalPolynomial;\r\n }\r\n\r\n const results = [];\r\n\r\n let byteArray: Nullable<Uint8Array> = null;\r\n let shortArray: Nullable<Uint16Array> = null;\r\n\r\n // Push each faces.\r\n for (let j = 0; j < 6; j++) {\r\n // Create fallback array\r\n if (textureType === Constants.TEXTURETYPE_HALF_FLOAT) {\r\n shortArray = new Uint16Array(this._size * this._size * 3);\r\n } else if (textureType === Constants.TEXTURETYPE_UNSIGNED_BYTE) {\r\n // 3 channels of 1 bytes per pixel in bytes.\r\n byteArray = new Uint8Array(this._size * this._size * 3);\r\n }\r\n\r\n const dataFace = <Float32Array>(<any>data)[EnvCubeTexture._FacesMapping[j]];\r\n\r\n // If special cases.\r\n if (this.gammaSpace || shortArray || byteArray) {\r\n for (let i = 0; i < this._size * this._size; i++) {\r\n // Put in gamma space if requested.\r\n if (this.gammaSpace) {\r\n dataFace[i * 3 + 0] = Math.pow(dataFace[i * 3 + 0], ToGammaSpace);\r\n dataFace[i * 3 + 1] = Math.pow(dataFace[i * 3 + 1], ToGammaSpace);\r\n dataFace[i * 3 + 2] = Math.pow(dataFace[i * 3 + 2], ToGammaSpace);\r\n }\r\n\r\n // Convert to half float texture for fallback.\r\n if (shortArray) {\r\n shortArray[i * 3 + 0] = ToHalfFloat(dataFace[i * 3 + 0]);\r\n shortArray[i * 3 + 1] = ToHalfFloat(dataFace[i * 3 + 1]);\r\n shortArray[i * 3 + 2] = ToHalfFloat(dataFace[i * 3 + 2]);\r\n }\r\n\r\n // Convert to int texture for fallback.\r\n if (byteArray) {\r\n let r = Math.max(dataFace[i * 3 + 0] * 255, 0);\r\n let g = Math.max(dataFace[i * 3 + 1] * 255, 0);\r\n let b = Math.max(dataFace[i * 3 + 2] * 255, 0);\r\n\r\n // May use luminance instead if the result is not accurate.\r\n const max = Math.max(Math.max(r, g), b);\r\n if (max > 255) {\r\n const scale = 255 / max;\r\n r *= scale;\r\n g *= scale;\r\n b *= scale;\r\n }\r\n\r\n byteArray[i * 3 + 0] = r;\r\n byteArray[i * 3 + 1] = g;\r\n byteArray[i * 3 + 2] = b;\r\n }\r\n }\r\n }\r\n\r\n if (shortArray) {\r\n results.push(shortArray);\r\n } else if (byteArray) {\r\n results.push(byteArray);\r\n } else {\r\n results.push(dataFace);\r\n }\r\n }\r\n\r\n return results;\r\n };\r\n\r\n if (engine._features.allowTexturePrefiltering && (this._prefilterOnLoad || this._prefilterIrradianceOnLoad)) {\r\n const previousOnLoad = this._onLoad;\r\n const hdrFiltering = new HDRFiltering(engine);\r\n this._onLoad = () => {\r\n let irradiancePromise: Promise<Nullable<BaseTexture>> = Promise.resolve(null);\r\n let radiancePromise: Promise<void> = Promise.resolve();\r\n if (this._prefilterIrradianceOnLoad) {\r\n const hdrIrradianceFiltering = new HDRIrradianceFiltering(engine, { useCdf: this._prefilterUsingCdf });\r\n irradiancePromise = hdrIrradianceFiltering.prefilter(this);\r\n }\r\n if (this._prefilterOnLoad) {\r\n radiancePromise = hdrFiltering.prefilter(this);\r\n }\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises, github/no-then\r\n Promise.all([irradiancePromise, radiancePromise]).then((results) => {\r\n const irradianceTexture = results[0];\r\n if (this._prefilterIrradianceOnLoad && irradianceTexture) {\r\n this.irradianceTexture = irradianceTexture;\r\n const scene = this.getScene();\r\n if (scene) {\r\n scene.markAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag);\r\n }\r\n }\r\n if (previousOnLoad) {\r\n previousOnLoad();\r\n }\r\n });\r\n };\r\n }\r\n\r\n this._texture = engine.createRawCubeTextureFromUrl(\r\n this.url,\r\n this.getScene(),\r\n this._size,\r\n Constants.TEXTUREFORMAT_RGB,\r\n textureType,\r\n this._noMipmap,\r\n callback,\r\n null,\r\n this._onLoad,\r\n this._onError\r\n );\r\n\r\n if (!this._generateHarmonics && !this._texture._sphericalPolynomial) {\r\n this._texture._sphericalPolynomial = new SphericalPolynomial();\r\n }\r\n }\r\n\r\n // Methods\r\n public override delayLoad(): void {\r\n if (this.delayLoadState !== Constants.DELAYLOADSTATE_NOTLOADED) {\r\n return;\r\n }\r\n\r\n this.delayLoadState = Constants.DELAYLOADSTATE_LOADED;\r\n this._texture = this._getFromCache(this.url, this._noMipmap);\r\n\r\n if (!this._texture) {\r\n this._loadTexture();\r\n }\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 override getReflectionTextureMatrix(): Matrix {\r\n return this._textureMatrix;\r\n }\r\n\r\n /**\r\n * Set the texture reflection matrix used to rotate/transform the reflection.\r\n * @param value Define the reflection matrix to set\r\n */\r\n public setReflectionTextureMatrix(value: Matrix): void {\r\n this._textureMatrix = value;\r\n\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\r\n /**\r\n * Dispose the texture and release its associated resources.\r\n */\r\n public override dispose(): void {\r\n this.onLoadObservable.clear();\r\n super.dispose();\r\n }\r\n\r\n /**\r\n * Serializes the texture to a JSON representation.\r\n * @returns the JSON representation\r\n */\r\n public override serialize(): any {\r\n if (!this.name) {\r\n return null;\r\n }\r\n\r\n const serializationObject: any = {};\r\n serializationObject.name = this.name;\r\n serializationObject.url = this.url;\r\n serializationObject.hasAlpha = this.hasAlpha;\r\n serializationObject.isCube = true;\r\n serializationObject.level = this.level;\r\n serializationObject.size = this._size;\r\n serializationObject.coordinatesMode = this.coordinatesMode;\r\n serializationObject.useInGammaSpace = this.gammaSpace;\r\n serializationObject.generateHarmonics = this._generateHarmonics;\r\n serializationObject.noMipmap = this._noMipmap;\r\n serializationObject.isBlocking = this._isBlocking;\r\n serializationObject.rotationY = this._rotationY;\r\n serializationObject.metadata = this.metadata;\r\n\r\n return serializationObject;\r\n }\r\n\r\n protected abstract _instantiateClone(): this;\r\n\r\n /**\r\n * Clones the current texture.\r\n * @returns the cloned texture\r\n */\r\n public override clone(): this {\r\n const newTexture = this._instantiateClone();\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 protected static _Parse(parsedTexture: any, texture: EnvCubeTexture): void {\r\n texture.name = parsedTexture.name;\r\n texture.hasAlpha = parsedTexture.hasAlpha;\r\n texture.level = parsedTexture.level;\r\n texture.coordinatesMode = parsedTexture.coordinatesMode;\r\n texture.isBlocking = parsedTexture.isBlocking;\r\n texture.metadata = parsedTexture.metadata;\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 if (parsedTexture.rotationY) {\r\n texture.rotationY = parsedTexture.rotationY;\r\n }\r\n }\r\n}\r\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onerjs/core",
3
- "version": "8.33.8",
3
+ "version": "8.33.9",
4
4
  "main": "index.js",
5
5
  "module": "index.js",
6
6
  "types": "index.d.ts",