@onerjs/core 8.25.4 → 8.25.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Audio/audioEngine.js +5 -0
- package/Audio/audioEngine.js.map +1 -1
- package/Engines/Extensions/engine.rawTexture.d.ts +2 -2
- package/Engines/Extensions/engine.rawTexture.js +9 -5
- package/Engines/Extensions/engine.rawTexture.js.map +1 -1
- package/Engines/WebGL/webGLHardwareTexture.d.ts +1 -0
- package/Engines/WebGL/webGLHardwareTexture.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.rawTexture.d.ts +2 -2
- package/Engines/WebGPU/Extensions/engine.rawTexture.js +9 -5
- package/Engines/WebGPU/Extensions/engine.rawTexture.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/constants.d.ts +6 -6
- package/Engines/constants.js +6 -6
- package/Engines/constants.js.map +1 -1
- package/Engines/thinEngine.js +11 -1
- package/Engines/thinEngine.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.js +1 -0
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.js.map +1 -1
- package/Gizmos/boundingBoxGizmo.js +20 -26
- package/Gizmos/boundingBoxGizmo.js.map +1 -1
- package/Loading/Plugins/babylonFileLoader.d.ts +11 -0
- package/Loading/Plugins/babylonFileLoader.js +25 -12
- package/Loading/Plugins/babylonFileLoader.js.map +1 -1
- package/Materials/Node/nodeMaterial.d.ts +2 -0
- package/Materials/Node/nodeMaterial.js +4 -0
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/Textures/envCubeTexture.d.ts +125 -0
- package/Materials/Textures/envCubeTexture.js +351 -0
- package/Materials/Textures/envCubeTexture.js.map +1 -0
- package/Materials/Textures/exrCubeTexture.d.ts +55 -0
- package/Materials/Textures/exrCubeTexture.js +83 -0
- package/Materials/Textures/exrCubeTexture.js.map +1 -0
- package/Materials/Textures/hdrCubeTexture.d.ts +14 -73
- package/Materials/Textures/hdrCubeTexture.js +25 -308
- package/Materials/Textures/hdrCubeTexture.js.map +1 -1
- package/Materials/Textures/index.d.ts +2 -0
- package/Materials/Textures/index.js +2 -0
- package/Materials/Textures/index.js.map +1 -1
- package/Materials/effectRenderer.d.ts +3 -1
- package/Materials/effectRenderer.js +5 -3
- package/Materials/effectRenderer.js.map +1 -1
- package/Materials/materialPluginBase.d.ts +1 -0
- package/Materials/materialPluginBase.js.map +1 -1
- package/Materials/materialPluginManager.js +5 -0
- package/Materials/materialPluginManager.js.map +1 -1
- package/Materials/uniformBuffer.d.ts +7 -1
- package/Materials/uniformBuffer.js +15 -6
- package/Materials/uniformBuffer.js.map +1 -1
- package/Maths/index.d.ts +1 -0
- package/Maths/index.js +1 -0
- package/Maths/index.js.map +1 -1
- package/Maths/math.vector.functions.d.ts +15 -7
- package/Maths/math.vector.functions.js +13 -4
- package/Maths/math.vector.functions.js.map +1 -1
- package/Meshes/Builders/tiledBoxBuilder.d.ts +1 -1
- package/Meshes/Builders/tiledBoxBuilder.js +36 -60
- package/Meshes/Builders/tiledBoxBuilder.js.map +1 -1
- package/Meshes/GreasedLine/greasedLineMesh.js +19 -9
- package/Meshes/GreasedLine/greasedLineMesh.js.map +1 -1
- package/Meshes/linesMesh.js +1 -0
- package/Meshes/linesMesh.js.map +1 -1
- package/Meshes/mesh.js +8 -7
- package/Meshes/mesh.js.map +1 -1
- package/Misc/HighDynamicRange/panoramaToCubemap.d.ts +2 -1
- package/Misc/HighDynamicRange/panoramaToCubemap.js +26 -16
- package/Misc/HighDynamicRange/panoramaToCubemap.js.map +1 -1
- package/Misc/environmentTextureTools.js.map +1 -1
- package/Misc/greasedLineTools.d.ts +3 -2
- package/Misc/greasedLineTools.js +4 -3
- package/Misc/greasedLineTools.js.map +1 -1
- package/Misc/khronosTextureContainer2.js +2 -2
- package/Misc/khronosTextureContainer2.js.map +1 -1
- package/Misc/rgbdTextureTools.js.map +1 -1
- package/Misc/screenshotTools.d.ts +9 -2
- package/Misc/screenshotTools.js +14 -3
- package/Misc/screenshotTools.js.map +1 -1
- package/Misc/textureTools.js.map +1 -1
- package/Misc/tools.js +1 -1
- package/Misc/tools.js.map +1 -1
- package/Particles/thinParticleSystem.js +2 -2
- package/Particles/thinParticleSystem.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/taaRenderingPipeline.d.ts +1 -0
- package/PostProcesses/RenderPipeline/Pipelines/taaRenderingPipeline.js +2 -0
- package/PostProcesses/RenderPipeline/Pipelines/taaRenderingPipeline.js.map +1 -1
- package/Rendering/depthRenderer.d.ts +2 -1
- package/Rendering/depthRenderer.js +5 -2
- package/Rendering/depthRenderer.js.map +1 -1
- package/Rendering/depthRendererSceneComponent.d.ts +3 -1
- package/Rendering/depthRendererSceneComponent.js +2 -2
- package/Rendering/depthRendererSceneComponent.js.map +1 -1
- package/Rendering/objectRenderer.d.ts +6 -0
- package/Rendering/objectRenderer.js +14 -1
- package/Rendering/objectRenderer.js.map +1 -1
- package/Rendering/renderingGroup.d.ts +2 -0
- package/Rendering/renderingGroup.js +9 -7
- package/Rendering/renderingGroup.js.map +1 -1
- package/Rendering/renderingManager.d.ts +6 -0
- package/Rendering/renderingManager.js +14 -0
- package/Rendering/renderingManager.js.map +1 -1
- package/Shaders/particles.vertex.js +2 -2
- package/Shaders/particles.vertex.js.map +1 -1
- package/ShadersWGSL/particles.vertex.js +7 -7
- package/ShadersWGSL/particles.vertex.js.map +1 -1
- package/XR/webXRCamera.js +1 -0
- package/XR/webXRCamera.js.map +1 -1
- package/assets/Draco/draco_decoder.js +1 -1
- package/assets/Draco/draco_decoder_gltf.js +1 -1
- package/assets/Draco/draco_encoder.js +2 -0
- package/assets/Draco/draco_encoder_wasm_wrapper.js +1 -1
- package/assets/Draco/draco_wasm_wrapper.js +1 -1
- package/assets/Draco/draco_wasm_wrapper_gltf.js +1 -1
- package/package.json +1 -1
- package/scene.js +1 -1
- package/scene.js.map +1 -1
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { EnvCubeTexture } from "./envCubeTexture.js";
|
|
2
|
+
import { RegisterClass } from "../../Misc/typeStore.js";
|
|
3
|
+
import "../../Materials/Textures/baseTexture.polynomial.js";
|
|
4
|
+
import { PanoramaToCubeMapTools } from "../../Misc/HighDynamicRange/panoramaToCubemap.js";
|
|
5
|
+
import { ReadExrDataAsync } from "./Loaders/exrTextureLoader.js";
|
|
6
|
+
/**
|
|
7
|
+
* This represents a texture coming from an EXR input.
|
|
8
|
+
*/
|
|
9
|
+
export class EXRCubeTexture extends EnvCubeTexture {
|
|
10
|
+
/**
|
|
11
|
+
* Instantiates an HDRTexture from the following parameters.
|
|
12
|
+
*
|
|
13
|
+
* @param url The location of the HDR raw data (Panorama stored in RGBE format)
|
|
14
|
+
* @param sceneOrEngine The scene or engine the texture will be used in
|
|
15
|
+
* @param size The cubemap desired size (the more it increases the longer the generation will be)
|
|
16
|
+
* @param noMipmap Forces to not generate the mipmap if true
|
|
17
|
+
* @param generateHarmonics Specifies whether you want to extract the polynomial harmonics during the generation process
|
|
18
|
+
* @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)
|
|
19
|
+
* @param prefilterOnLoad Prefilters HDR texture to allow use of this texture as a PBR reflection texture.
|
|
20
|
+
* @param onLoad on success callback function
|
|
21
|
+
* @param onError on error callback function
|
|
22
|
+
* @param supersample Defines if texture must be supersampled (default: false)
|
|
23
|
+
* @param prefilterIrradianceOnLoad Prefilters HDR texture to allow use of this texture for irradiance lighting.
|
|
24
|
+
* @param prefilterUsingCdf Defines if the prefiltering should be done using a CDF instead of the default approach.
|
|
25
|
+
*/
|
|
26
|
+
constructor(url, sceneOrEngine, size, noMipmap = false, generateHarmonics = true, gammaSpace = false, prefilterOnLoad = false, onLoad = null, onError = null, supersample = false, prefilterIrradianceOnLoad = false, prefilterUsingCdf = false) {
|
|
27
|
+
super(url, sceneOrEngine, size, noMipmap, generateHarmonics, gammaSpace, prefilterOnLoad, onLoad, onError, supersample, prefilterIrradianceOnLoad, prefilterUsingCdf);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Get the current class name of the texture useful for serialization or dynamic coding.
|
|
31
|
+
* @returns "EXRCubeTexture"
|
|
32
|
+
*/
|
|
33
|
+
getClassName() {
|
|
34
|
+
return "EXRCubeTexture";
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Convert the raw data from the server into cubemap faces
|
|
38
|
+
* @param buffer The buffer containing the texture data
|
|
39
|
+
* @param size The cubemap face size
|
|
40
|
+
* @param supersample Defines if texture must be supersampled
|
|
41
|
+
* @returns The cube map data
|
|
42
|
+
*/
|
|
43
|
+
async _getCubeMapTextureDataAsync(buffer, size, supersample) {
|
|
44
|
+
const exrData = await ReadExrDataAsync(buffer);
|
|
45
|
+
if (!exrData.data) {
|
|
46
|
+
throw new Error("EXR data could not be decoded.");
|
|
47
|
+
}
|
|
48
|
+
const cubeMapData = PanoramaToCubeMapTools.ConvertPanoramaToCubemap(exrData.data, exrData.width, exrData.height, size, supersample, false);
|
|
49
|
+
return cubeMapData;
|
|
50
|
+
}
|
|
51
|
+
_instantiateClone() {
|
|
52
|
+
return new EXRCubeTexture(this.url, this.getScene() || this._getEngine(), this._size, this._noMipmap, this._generateHarmonics, this.gammaSpace);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Serialize the texture to a JSON representation.
|
|
56
|
+
* @returns The JSON representation of the texture
|
|
57
|
+
*/
|
|
58
|
+
serialize() {
|
|
59
|
+
const serializationObject = super.serialize();
|
|
60
|
+
if (!serializationObject) {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
serializationObject.customType = "BABYLON.EXRCubeTexture";
|
|
64
|
+
return serializationObject;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Parses a JSON representation of an EXR Texture in order to create the texture
|
|
68
|
+
* @param parsedTexture Define the JSON representation
|
|
69
|
+
* @param scene Define the scene the texture should be created in
|
|
70
|
+
* @param rootUrl Define the root url in case we need to load relative dependencies
|
|
71
|
+
* @returns the newly created texture after parsing
|
|
72
|
+
*/
|
|
73
|
+
static Parse(parsedTexture, scene, rootUrl) {
|
|
74
|
+
if (!parsedTexture.name || parsedTexture.isRenderTarget) {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
const texture = new EXRCubeTexture(rootUrl + parsedTexture.name, scene, parsedTexture.size, parsedTexture.noMipmap, parsedTexture.generateHarmonics, parsedTexture.useInGammaSpace);
|
|
78
|
+
this._Parse(parsedTexture, texture);
|
|
79
|
+
return texture;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
RegisterClass("BABYLON.EXRCubeTexture", EXRCubeTexture);
|
|
83
|
+
//# sourceMappingURL=exrCubeTexture.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exrCubeTexture.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/Textures/exrCubeTexture.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,iDAAiD,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,+CAA+C,CAAC;AAEvF,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAE9D;;GAEG;AACH,MAAM,OAAO,cAAe,SAAQ,cAAc;IAC9C;;;;;;;;;;;;;;;OAeG;IACH,YACI,GAAW,EACX,aAAqC,EACrC,IAAY,EACZ,QAAQ,GAAG,KAAK,EAChB,iBAAiB,GAAG,IAAI,EACxB,UAAU,GAAG,KAAK,EAClB,eAAe,GAAG,KAAK,EACvB,SAA+B,IAAI,EACnC,UAAiE,IAAI,EACrE,WAAW,GAAG,KAAK,EACnB,yBAAyB,GAAG,KAAK,EACjC,iBAAiB,GAAG,KAAK;QAEzB,KAAK,CAAC,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE,QAAQ,EAAE,iBAAiB,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,yBAAyB,EAAE,iBAAiB,CAAC,CAAC;IAC1K,CAAC;IAED;;;OAGG;IACa,YAAY;QACxB,OAAO,gBAAgB,CAAC;IAC5B,CAAC;IAED;;;;;;OAMG;IACO,KAAK,CAAC,2BAA2B,CAAC,MAAmB,EAAE,IAAY,EAAE,WAAoB;QAC/F,MAAM,OAAO,GAAG,MAAM,gBAAgB,CAAC,MAAM,CAAC,CAAC;QAC/C,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;QACtD,CAAC;QAED,MAAM,WAAW,GAAG,sBAAsB,CAAC,wBAAwB,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC;QAC3I,OAAO,WAAW,CAAC;IACvB,CAAC;IAES,iBAAiB;QACvB,OAAO,IAAI,cAAc,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,IAAI,CAAC,UAAU,EAAG,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,UAAU,CAAS,CAAC;IAC7J,CAAC;IAED;;;OAGG;IACa,SAAS;QACrB,MAAM,mBAAmB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAC9C,IAAI,CAAC,mBAAmB,EAAE,CAAC;YACvB,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,mBAAmB,CAAC,UAAU,GAAG,wBAAwB,CAAC;QAE1D,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,KAAK,CAAC,aAAkB,EAAE,KAAY,EAAE,OAAe;QACjE,IAAI,CAAC,aAAa,CAAC,IAAI,IAAI,aAAa,CAAC,cAAc,EAAE,CAAC;YACtD,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,MAAM,OAAO,GAAG,IAAI,cAAc,CAC9B,OAAO,GAAG,aAAa,CAAC,IAAI,EAC5B,KAAK,EACL,aAAa,CAAC,IAAI,EAClB,aAAa,CAAC,QAAQ,EACtB,aAAa,CAAC,iBAAiB,EAC/B,aAAa,CAAC,eAAe,CAChC,CAAC;QACF,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;QACpC,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ;AAED,aAAa,CAAC,wBAAwB,EAAE,cAAc,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"../../types\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { EnvCubeTexture } from \"./envCubeTexture\";\r\nimport { RegisterClass } from \"../../Misc/typeStore\";\r\nimport type { AbstractEngine } from \"../../Engines/abstractEngine\";\r\nimport \"../../Materials/Textures/baseTexture.polynomial\";\r\nimport { PanoramaToCubeMapTools } from \"../../Misc/HighDynamicRange/panoramaToCubemap\";\r\nimport type { CubeMapInfo } from \"../../Misc/HighDynamicRange/panoramaToCubemap\";\r\nimport { ReadExrDataAsync } from \"./Loaders/exrTextureLoader\";\r\n\r\n/**\r\n * This represents a texture coming from an EXR input.\r\n */\r\nexport class EXRCubeTexture extends EnvCubeTexture {\r\n /**\r\n * Instantiates an HDRTexture from the following parameters.\r\n *\r\n * @param url The location of the HDR 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 HDR 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 HDR 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(url, sceneOrEngine, size, noMipmap, generateHarmonics, gammaSpace, prefilterOnLoad, onLoad, onError, supersample, prefilterIrradianceOnLoad, prefilterUsingCdf);\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 \"EXRCubeTexture\"\r\n */\r\n public override getClassName(): string {\r\n return \"EXRCubeTexture\";\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 async _getCubeMapTextureDataAsync(buffer: ArrayBuffer, size: number, supersample: boolean): Promise<CubeMapInfo> {\r\n const exrData = await ReadExrDataAsync(buffer);\r\n if (!exrData.data) {\r\n throw new Error(\"EXR data could not be decoded.\");\r\n }\r\n\r\n const cubeMapData = PanoramaToCubeMapTools.ConvertPanoramaToCubemap(exrData.data, exrData.width, exrData.height, size, supersample, false);\r\n return cubeMapData;\r\n }\r\n\r\n protected _instantiateClone(): this {\r\n return new EXRCubeTexture(this.url, this.getScene() || this._getEngine()!, this._size, this._noMipmap, this._generateHarmonics, this.gammaSpace) as this;\r\n }\r\n\r\n /**\r\n * Serialize the texture to a JSON representation.\r\n * @returns The JSON representation of the texture\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n if (!serializationObject) {\r\n return null;\r\n }\r\n\r\n serializationObject.customType = \"BABYLON.EXRCubeTexture\";\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Parses a JSON representation of an EXR Texture in order to create the texture\r\n * @param parsedTexture Define the JSON representation\r\n * @param scene Define the scene the texture should be created in\r\n * @param rootUrl Define the root url in case we need to load relative dependencies\r\n * @returns the newly created texture after parsing\r\n */\r\n public static Parse(parsedTexture: any, scene: Scene, rootUrl: string): Nullable<EXRCubeTexture> {\r\n if (!parsedTexture.name || parsedTexture.isRenderTarget) {\r\n return null;\r\n }\r\n\r\n const texture = new EXRCubeTexture(\r\n rootUrl + parsedTexture.name,\r\n scene,\r\n parsedTexture.size,\r\n parsedTexture.noMipmap,\r\n parsedTexture.generateHarmonics,\r\n parsedTexture.useInGammaSpace\r\n );\r\n this._Parse(parsedTexture, texture);\r\n return texture;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.EXRCubeTexture\", EXRCubeTexture);\r\n"]}
|
|
@@ -1,68 +1,16 @@
|
|
|
1
1
|
import type { Nullable } from "../../types.js";
|
|
2
2
|
import type { Scene } from "../../scene.js";
|
|
3
|
-
import {
|
|
4
|
-
import { BaseTexture } from "../../Materials/Textures/baseTexture.js";
|
|
5
|
-
import { Observable } from "../../Misc/observable.js";
|
|
3
|
+
import { EnvCubeTexture } from "./envCubeTexture.js";
|
|
6
4
|
import type { AbstractEngine } from "../../Engines/abstractEngine.js";
|
|
7
5
|
import "../../Materials/Textures/baseTexture.polynomial.js";
|
|
6
|
+
import type { CubeMapInfo } from "../../Misc/HighDynamicRange/panoramaToCubemap.js";
|
|
8
7
|
/**
|
|
9
8
|
* This represents a texture coming from an HDR input.
|
|
10
9
|
*
|
|
11
|
-
* The
|
|
10
|
+
* The supported format is currently panorama picture stored in RGBE format.
|
|
12
11
|
* Example of such files can be found on Poly Haven: https://polyhaven.com/hdris
|
|
13
12
|
*/
|
|
14
|
-
export declare class HDRCubeTexture extends
|
|
15
|
-
private static _FacesMapping;
|
|
16
|
-
private _generateHarmonics;
|
|
17
|
-
private _noMipmap;
|
|
18
|
-
private _prefilterOnLoad;
|
|
19
|
-
private _prefilterIrradianceOnLoad;
|
|
20
|
-
private _prefilterUsingCdf;
|
|
21
|
-
private _textureMatrix;
|
|
22
|
-
private _size;
|
|
23
|
-
private _supersample;
|
|
24
|
-
private _onLoad;
|
|
25
|
-
private _onError;
|
|
26
|
-
/**
|
|
27
|
-
* The texture URL.
|
|
28
|
-
*/
|
|
29
|
-
url: string;
|
|
30
|
-
protected _isBlocking: boolean;
|
|
31
|
-
/**
|
|
32
|
-
* Sets whether or not the texture is blocking during loading.
|
|
33
|
-
*/
|
|
34
|
-
set isBlocking(value: boolean);
|
|
35
|
-
/**
|
|
36
|
-
* Gets whether or not the texture is blocking during loading.
|
|
37
|
-
*/
|
|
38
|
-
get isBlocking(): boolean;
|
|
39
|
-
protected _rotationY: number;
|
|
40
|
-
/**
|
|
41
|
-
* Sets texture matrix rotation angle around Y axis in radians.
|
|
42
|
-
*/
|
|
43
|
-
set rotationY(value: number);
|
|
44
|
-
/**
|
|
45
|
-
* Gets texture matrix rotation angle around Y axis radians.
|
|
46
|
-
*/
|
|
47
|
-
get rotationY(): number;
|
|
48
|
-
/**
|
|
49
|
-
* Gets or sets the center of the bounding box associated with the cube texture
|
|
50
|
-
* It must define where the camera used to render the texture was set
|
|
51
|
-
*/
|
|
52
|
-
boundingBoxPosition: Vector3;
|
|
53
|
-
private _boundingBoxSize;
|
|
54
|
-
/**
|
|
55
|
-
* Gets or sets the size of the bounding box associated with the cube texture
|
|
56
|
-
* When defined, the cubemap will switch to local mode
|
|
57
|
-
* @see https://community.arm.com/graphics/b/blog/posts/reflections-based-on-local-cubemaps-in-unity
|
|
58
|
-
* @example https://www.babylonjs-playground.com/#RNASML
|
|
59
|
-
*/
|
|
60
|
-
set boundingBoxSize(value: Vector3);
|
|
61
|
-
get boundingBoxSize(): Vector3;
|
|
62
|
-
/**
|
|
63
|
-
* Observable triggered once the texture has been loaded.
|
|
64
|
-
*/
|
|
65
|
-
onLoadObservable: Observable<HDRCubeTexture>;
|
|
13
|
+
export declare class HDRCubeTexture extends EnvCubeTexture {
|
|
66
14
|
/**
|
|
67
15
|
* Instantiates an HDRTexture from the following parameters.
|
|
68
16
|
*
|
|
@@ -86,25 +34,19 @@ export declare class HDRCubeTexture extends BaseTexture {
|
|
|
86
34
|
*/
|
|
87
35
|
getClassName(): string;
|
|
88
36
|
/**
|
|
89
|
-
*
|
|
37
|
+
* Convert the raw data from the server into cubemap faces
|
|
38
|
+
* @param buffer The buffer containing the texture data
|
|
39
|
+
* @param size The cubemap face size
|
|
40
|
+
* @param supersample Defines if texture must be supersampled
|
|
41
|
+
* @returns The cube map data
|
|
90
42
|
*/
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
delayLoad(): void;
|
|
43
|
+
protected _getCubeMapTextureDataAsync(buffer: ArrayBuffer, size: number, supersample: boolean): Promise<CubeMapInfo>;
|
|
44
|
+
protected _instantiateClone(): this;
|
|
94
45
|
/**
|
|
95
|
-
*
|
|
96
|
-
* @returns the
|
|
46
|
+
* Serialize the texture to a JSON representation.
|
|
47
|
+
* @returns The JSON representation of the texture
|
|
97
48
|
*/
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Set the texture reflection matrix used to rotate/transform the reflection.
|
|
101
|
-
* @param value Define the reflection matrix to set
|
|
102
|
-
*/
|
|
103
|
-
setReflectionTextureMatrix(value: Matrix): void;
|
|
104
|
-
/**
|
|
105
|
-
* Dispose the texture and release its associated resources.
|
|
106
|
-
*/
|
|
107
|
-
dispose(): void;
|
|
49
|
+
serialize(): any;
|
|
108
50
|
/**
|
|
109
51
|
* Parses a JSON representation of an HDR Texture in order to create the texture
|
|
110
52
|
* @param parsedTexture Define the JSON representation
|
|
@@ -113,5 +55,4 @@ export declare class HDRCubeTexture extends BaseTexture {
|
|
|
113
55
|
* @returns the newly created texture after parsing
|
|
114
56
|
*/
|
|
115
57
|
static Parse(parsedTexture: any, scene: Scene, rootUrl: string): Nullable<HDRCubeTexture>;
|
|
116
|
-
serialize(): any;
|
|
117
58
|
}
|
|
@@ -1,68 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { BaseTexture } from "../../Materials/Textures/baseTexture.js";
|
|
3
|
-
import { Texture } from "../../Materials/Textures/texture.js";
|
|
4
|
-
|
|
1
|
+
import { EnvCubeTexture } from "./envCubeTexture.js";
|
|
5
2
|
import { GetCubeMapTextureData } from "../../Misc/HighDynamicRange/hdr.js";
|
|
6
|
-
import { CubeMapToSphericalPolynomialTools } from "../../Misc/HighDynamicRange/cubemapToSphericalPolynomial.js";
|
|
7
3
|
import { RegisterClass } from "../../Misc/typeStore.js";
|
|
8
|
-
import { Observable } from "../../Misc/observable.js";
|
|
9
|
-
import { Tools } from "../../Misc/tools.js";
|
|
10
|
-
import { ToGammaSpace } from "../../Maths/math.constants.js";
|
|
11
|
-
import { HDRFiltering } from "../../Materials/Textures/Filtering/hdrFiltering.js";
|
|
12
|
-
import { HDRIrradianceFiltering } from "../../Materials/Textures/Filtering/hdrIrradianceFiltering.js";
|
|
13
|
-
import { ToHalfFloat } from "../../Misc/textureTools.js";
|
|
14
4
|
import "../../Materials/Textures/baseTexture.polynomial.js";
|
|
15
5
|
/**
|
|
16
6
|
* This represents a texture coming from an HDR input.
|
|
17
7
|
*
|
|
18
|
-
* The
|
|
8
|
+
* The supported format is currently panorama picture stored in RGBE format.
|
|
19
9
|
* Example of such files can be found on Poly Haven: https://polyhaven.com/hdris
|
|
20
10
|
*/
|
|
21
|
-
export class HDRCubeTexture extends
|
|
22
|
-
/**
|
|
23
|
-
* Sets whether or not the texture is blocking during loading.
|
|
24
|
-
*/
|
|
25
|
-
set isBlocking(value) {
|
|
26
|
-
this._isBlocking = value;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Gets whether or not the texture is blocking during loading.
|
|
30
|
-
*/
|
|
31
|
-
get isBlocking() {
|
|
32
|
-
return this._isBlocking;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Sets texture matrix rotation angle around Y axis in radians.
|
|
36
|
-
*/
|
|
37
|
-
set rotationY(value) {
|
|
38
|
-
this._rotationY = value;
|
|
39
|
-
this.setReflectionTextureMatrix(Matrix.RotationY(this._rotationY));
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Gets texture matrix rotation angle around Y axis radians.
|
|
43
|
-
*/
|
|
44
|
-
get rotationY() {
|
|
45
|
-
return this._rotationY;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Gets or sets the size of the bounding box associated with the cube texture
|
|
49
|
-
* When defined, the cubemap will switch to local mode
|
|
50
|
-
* @see https://community.arm.com/graphics/b/blog/posts/reflections-based-on-local-cubemaps-in-unity
|
|
51
|
-
* @example https://www.babylonjs-playground.com/#RNASML
|
|
52
|
-
*/
|
|
53
|
-
set boundingBoxSize(value) {
|
|
54
|
-
if (this._boundingBoxSize && this._boundingBoxSize.equals(value)) {
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
this._boundingBoxSize = value;
|
|
58
|
-
const scene = this.getScene();
|
|
59
|
-
if (scene) {
|
|
60
|
-
scene.markAllMaterialsAsDirty(1);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
get boundingBoxSize() {
|
|
64
|
-
return this._boundingBoxSize;
|
|
65
|
-
}
|
|
11
|
+
export class HDRCubeTexture extends EnvCubeTexture {
|
|
66
12
|
/**
|
|
67
13
|
* Instantiates an HDRTexture from the following parameters.
|
|
68
14
|
*
|
|
@@ -80,64 +26,7 @@ export class HDRCubeTexture extends BaseTexture {
|
|
|
80
26
|
* @param prefilterUsingCdf Defines if the prefiltering should be done using a CDF instead of the default approach.
|
|
81
27
|
*/
|
|
82
28
|
constructor(url, sceneOrEngine, size, noMipmap = false, generateHarmonics = true, gammaSpace = false, prefilterOnLoad = false, onLoad = null, onError = null, supersample = false, prefilterIrradianceOnLoad = false, prefilterUsingCdf = false) {
|
|
83
|
-
super(sceneOrEngine);
|
|
84
|
-
this._generateHarmonics = true;
|
|
85
|
-
this._onError = null;
|
|
86
|
-
this._isBlocking = true;
|
|
87
|
-
this._rotationY = 0;
|
|
88
|
-
/**
|
|
89
|
-
* Gets or sets the center of the bounding box associated with the cube texture
|
|
90
|
-
* It must define where the camera used to render the texture was set
|
|
91
|
-
*/
|
|
92
|
-
this.boundingBoxPosition = Vector3.Zero();
|
|
93
|
-
/**
|
|
94
|
-
* Observable triggered once the texture has been loaded.
|
|
95
|
-
*/
|
|
96
|
-
this.onLoadObservable = new Observable();
|
|
97
|
-
if (!url) {
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
this._coordinatesMode = Texture.CUBIC_MODE;
|
|
101
|
-
this.name = url;
|
|
102
|
-
this.url = url;
|
|
103
|
-
this.hasAlpha = false;
|
|
104
|
-
this.isCube = true;
|
|
105
|
-
this._textureMatrix = Matrix.Identity();
|
|
106
|
-
this._prefilterOnLoad = prefilterOnLoad;
|
|
107
|
-
this._prefilterIrradianceOnLoad = prefilterIrradianceOnLoad;
|
|
108
|
-
this._prefilterUsingCdf = prefilterUsingCdf;
|
|
109
|
-
this._onLoad = () => {
|
|
110
|
-
this.onLoadObservable.notifyObservers(this);
|
|
111
|
-
if (onLoad) {
|
|
112
|
-
onLoad();
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
this._onError = onError;
|
|
116
|
-
this.gammaSpace = gammaSpace;
|
|
117
|
-
this._noMipmap = noMipmap;
|
|
118
|
-
this._size = size;
|
|
119
|
-
// CDF is very sensitive to lost precision due to downsampling. This can result in
|
|
120
|
-
// noticeable brightness differences with different resolutions. Enabling supersampling
|
|
121
|
-
// mitigates this.
|
|
122
|
-
this._supersample = supersample || prefilterUsingCdf;
|
|
123
|
-
this._generateHarmonics = generateHarmonics;
|
|
124
|
-
this._texture = this._getFromCache(url, this._noMipmap, undefined, undefined, undefined, this.isCube);
|
|
125
|
-
if (!this._texture) {
|
|
126
|
-
if (!this.getScene()?.useDelayedTextureLoading) {
|
|
127
|
-
this._loadTexture();
|
|
128
|
-
}
|
|
129
|
-
else {
|
|
130
|
-
this.delayLoadState = 4;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
else {
|
|
134
|
-
if (this._texture.isReady) {
|
|
135
|
-
Tools.SetImmediate(() => this._onLoad());
|
|
136
|
-
}
|
|
137
|
-
else {
|
|
138
|
-
this._texture.onLoadedObservable.add(this._onLoad);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
29
|
+
super(url, sceneOrEngine, size, noMipmap, generateHarmonics, gammaSpace, prefilterOnLoad, onLoad, onError, supersample, prefilterIrradianceOnLoad, prefilterUsingCdf);
|
|
141
30
|
}
|
|
142
31
|
/**
|
|
143
32
|
* Get the current class name of the texture useful for serialization or dynamic coding.
|
|
@@ -147,166 +36,29 @@ export class HDRCubeTexture extends BaseTexture {
|
|
|
147
36
|
return "HDRCubeTexture";
|
|
148
37
|
}
|
|
149
38
|
/**
|
|
150
|
-
*
|
|
39
|
+
* Convert the raw data from the server into cubemap faces
|
|
40
|
+
* @param buffer The buffer containing the texture data
|
|
41
|
+
* @param size The cubemap face size
|
|
42
|
+
* @param supersample Defines if texture must be supersampled
|
|
43
|
+
* @returns The cube map data
|
|
151
44
|
*/
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
const caps = engine.getCaps();
|
|
155
|
-
let textureType = 0;
|
|
156
|
-
if (caps.textureFloat && caps.textureFloatLinearFiltering) {
|
|
157
|
-
textureType = 1;
|
|
158
|
-
}
|
|
159
|
-
else if (caps.textureHalfFloat && caps.textureHalfFloatLinearFiltering) {
|
|
160
|
-
textureType = 2;
|
|
161
|
-
}
|
|
162
|
-
const callback = (buffer) => {
|
|
163
|
-
this.lodGenerationOffset = 0.0;
|
|
164
|
-
this.lodGenerationScale = 0.8;
|
|
165
|
-
// Extract the raw linear data.
|
|
166
|
-
const data = GetCubeMapTextureData(buffer, this._size, this._supersample);
|
|
167
|
-
// Generate harmonics if needed.
|
|
168
|
-
if (this._generateHarmonics) {
|
|
169
|
-
const sphericalPolynomial = CubeMapToSphericalPolynomialTools.ConvertCubeMapToSphericalPolynomial(data);
|
|
170
|
-
this.sphericalPolynomial = sphericalPolynomial;
|
|
171
|
-
}
|
|
172
|
-
const results = [];
|
|
173
|
-
let byteArray = null;
|
|
174
|
-
let shortArray = null;
|
|
175
|
-
// Push each faces.
|
|
176
|
-
for (let j = 0; j < 6; j++) {
|
|
177
|
-
// Create fallback array
|
|
178
|
-
if (textureType === 2) {
|
|
179
|
-
shortArray = new Uint16Array(this._size * this._size * 3);
|
|
180
|
-
}
|
|
181
|
-
else if (textureType === 0) {
|
|
182
|
-
// 3 channels of 1 bytes per pixel in bytes.
|
|
183
|
-
byteArray = new Uint8Array(this._size * this._size * 3);
|
|
184
|
-
}
|
|
185
|
-
const dataFace = data[HDRCubeTexture._FacesMapping[j]];
|
|
186
|
-
// If special cases.
|
|
187
|
-
if (this.gammaSpace || shortArray || byteArray) {
|
|
188
|
-
for (let i = 0; i < this._size * this._size; i++) {
|
|
189
|
-
// Put in gamma space if requested.
|
|
190
|
-
if (this.gammaSpace) {
|
|
191
|
-
dataFace[i * 3 + 0] = Math.pow(dataFace[i * 3 + 0], ToGammaSpace);
|
|
192
|
-
dataFace[i * 3 + 1] = Math.pow(dataFace[i * 3 + 1], ToGammaSpace);
|
|
193
|
-
dataFace[i * 3 + 2] = Math.pow(dataFace[i * 3 + 2], ToGammaSpace);
|
|
194
|
-
}
|
|
195
|
-
// Convert to half float texture for fallback.
|
|
196
|
-
if (shortArray) {
|
|
197
|
-
shortArray[i * 3 + 0] = ToHalfFloat(dataFace[i * 3 + 0]);
|
|
198
|
-
shortArray[i * 3 + 1] = ToHalfFloat(dataFace[i * 3 + 1]);
|
|
199
|
-
shortArray[i * 3 + 2] = ToHalfFloat(dataFace[i * 3 + 2]);
|
|
200
|
-
}
|
|
201
|
-
// Convert to int texture for fallback.
|
|
202
|
-
if (byteArray) {
|
|
203
|
-
let r = Math.max(dataFace[i * 3 + 0] * 255, 0);
|
|
204
|
-
let g = Math.max(dataFace[i * 3 + 1] * 255, 0);
|
|
205
|
-
let b = Math.max(dataFace[i * 3 + 2] * 255, 0);
|
|
206
|
-
// May use luminance instead if the result is not accurate.
|
|
207
|
-
const max = Math.max(Math.max(r, g), b);
|
|
208
|
-
if (max > 255) {
|
|
209
|
-
const scale = 255 / max;
|
|
210
|
-
r *= scale;
|
|
211
|
-
g *= scale;
|
|
212
|
-
b *= scale;
|
|
213
|
-
}
|
|
214
|
-
byteArray[i * 3 + 0] = r;
|
|
215
|
-
byteArray[i * 3 + 1] = g;
|
|
216
|
-
byteArray[i * 3 + 2] = b;
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
if (shortArray) {
|
|
221
|
-
results.push(shortArray);
|
|
222
|
-
}
|
|
223
|
-
else if (byteArray) {
|
|
224
|
-
results.push(byteArray);
|
|
225
|
-
}
|
|
226
|
-
else {
|
|
227
|
-
results.push(dataFace);
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
return results;
|
|
231
|
-
};
|
|
232
|
-
if (engine._features.allowTexturePrefiltering && (this._prefilterOnLoad || this._prefilterIrradianceOnLoad)) {
|
|
233
|
-
const previousOnLoad = this._onLoad;
|
|
234
|
-
const hdrFiltering = new HDRFiltering(engine);
|
|
235
|
-
this._onLoad = () => {
|
|
236
|
-
let irradiancePromise = Promise.resolve(null);
|
|
237
|
-
let radiancePromise = Promise.resolve();
|
|
238
|
-
if (this._prefilterIrradianceOnLoad) {
|
|
239
|
-
const hdrIrradianceFiltering = new HDRIrradianceFiltering(engine, { useCdf: this._prefilterUsingCdf });
|
|
240
|
-
irradiancePromise = hdrIrradianceFiltering.prefilter(this);
|
|
241
|
-
}
|
|
242
|
-
if (this._prefilterOnLoad) {
|
|
243
|
-
radiancePromise = hdrFiltering.prefilter(this);
|
|
244
|
-
}
|
|
245
|
-
// eslint-disable-next-line @typescript-eslint/no-floating-promises, github/no-then
|
|
246
|
-
Promise.all([irradiancePromise, radiancePromise]).then((results) => {
|
|
247
|
-
const irradianceTexture = results[0];
|
|
248
|
-
if (this._prefilterIrradianceOnLoad && irradianceTexture) {
|
|
249
|
-
this.irradianceTexture = irradianceTexture;
|
|
250
|
-
const scene = this.getScene();
|
|
251
|
-
if (scene) {
|
|
252
|
-
scene.markAllMaterialsAsDirty(1);
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
if (previousOnLoad) {
|
|
256
|
-
previousOnLoad();
|
|
257
|
-
}
|
|
258
|
-
});
|
|
259
|
-
};
|
|
260
|
-
}
|
|
261
|
-
this._texture = engine.createRawCubeTextureFromUrl(this.url, this.getScene(), this._size, 4, textureType, this._noMipmap, callback, null, this._onLoad, this._onError);
|
|
262
|
-
}
|
|
263
|
-
clone() {
|
|
264
|
-
const newTexture = new HDRCubeTexture(this.url, this.getScene() || this._getEngine(), this._size, this._noMipmap, this._generateHarmonics, this.gammaSpace);
|
|
265
|
-
// Base texture
|
|
266
|
-
newTexture.level = this.level;
|
|
267
|
-
newTexture.wrapU = this.wrapU;
|
|
268
|
-
newTexture.wrapV = this.wrapV;
|
|
269
|
-
newTexture.coordinatesIndex = this.coordinatesIndex;
|
|
270
|
-
newTexture.coordinatesMode = this.coordinatesMode;
|
|
271
|
-
return newTexture;
|
|
272
|
-
}
|
|
273
|
-
// Methods
|
|
274
|
-
delayLoad() {
|
|
275
|
-
if (this.delayLoadState !== 4) {
|
|
276
|
-
return;
|
|
277
|
-
}
|
|
278
|
-
this.delayLoadState = 1;
|
|
279
|
-
this._texture = this._getFromCache(this.url, this._noMipmap);
|
|
280
|
-
if (!this._texture) {
|
|
281
|
-
this._loadTexture();
|
|
282
|
-
}
|
|
45
|
+
async _getCubeMapTextureDataAsync(buffer, size, supersample) {
|
|
46
|
+
return GetCubeMapTextureData(buffer, size, supersample);
|
|
283
47
|
}
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
* @returns the reflection matrix
|
|
287
|
-
*/
|
|
288
|
-
getReflectionTextureMatrix() {
|
|
289
|
-
return this._textureMatrix;
|
|
48
|
+
_instantiateClone() {
|
|
49
|
+
return new HDRCubeTexture(this.url, this.getScene() || this._getEngine(), this._size, this._noMipmap, this._generateHarmonics, this.gammaSpace);
|
|
290
50
|
}
|
|
291
51
|
/**
|
|
292
|
-
*
|
|
293
|
-
* @
|
|
52
|
+
* Serialize the texture to a JSON representation.
|
|
53
|
+
* @returns The JSON representation of the texture
|
|
294
54
|
*/
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
if (
|
|
298
|
-
return;
|
|
299
|
-
}
|
|
300
|
-
if (value.isIdentity() !== this._textureMatrix.isIdentity()) {
|
|
301
|
-
this.getScene()?.markAllMaterialsAsDirty(1, (mat) => mat.getActiveTextures().indexOf(this) !== -1);
|
|
55
|
+
serialize() {
|
|
56
|
+
const serializationObject = super.serialize();
|
|
57
|
+
if (!serializationObject) {
|
|
58
|
+
return null;
|
|
302
59
|
}
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
* Dispose the texture and release its associated resources.
|
|
306
|
-
*/
|
|
307
|
-
dispose() {
|
|
308
|
-
this.onLoadObservable.clear();
|
|
309
|
-
super.dispose();
|
|
60
|
+
serializationObject.customType = "BABYLON.HDRCubeTexture";
|
|
61
|
+
return serializationObject;
|
|
310
62
|
}
|
|
311
63
|
/**
|
|
312
64
|
* Parses a JSON representation of an HDR Texture in order to create the texture
|
|
@@ -316,48 +68,13 @@ export class HDRCubeTexture extends BaseTexture {
|
|
|
316
68
|
* @returns the newly created texture after parsing
|
|
317
69
|
*/
|
|
318
70
|
static Parse(parsedTexture, scene, rootUrl) {
|
|
319
|
-
|
|
320
|
-
if (parsedTexture.name && !parsedTexture.isRenderTarget) {
|
|
321
|
-
texture = new HDRCubeTexture(rootUrl + parsedTexture.name, scene, parsedTexture.size, parsedTexture.noMipmap, parsedTexture.generateHarmonics, parsedTexture.useInGammaSpace);
|
|
322
|
-
texture.name = parsedTexture.name;
|
|
323
|
-
texture.hasAlpha = parsedTexture.hasAlpha;
|
|
324
|
-
texture.level = parsedTexture.level;
|
|
325
|
-
texture.coordinatesMode = parsedTexture.coordinatesMode;
|
|
326
|
-
texture.isBlocking = parsedTexture.isBlocking;
|
|
327
|
-
}
|
|
328
|
-
if (texture) {
|
|
329
|
-
if (parsedTexture.boundingBoxPosition) {
|
|
330
|
-
texture.boundingBoxPosition = Vector3.FromArray(parsedTexture.boundingBoxPosition);
|
|
331
|
-
}
|
|
332
|
-
if (parsedTexture.boundingBoxSize) {
|
|
333
|
-
texture.boundingBoxSize = Vector3.FromArray(parsedTexture.boundingBoxSize);
|
|
334
|
-
}
|
|
335
|
-
if (parsedTexture.rotationY) {
|
|
336
|
-
texture.rotationY = parsedTexture.rotationY;
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
return texture;
|
|
340
|
-
}
|
|
341
|
-
serialize() {
|
|
342
|
-
if (!this.name) {
|
|
71
|
+
if (!parsedTexture.name || parsedTexture.isRenderTarget) {
|
|
343
72
|
return null;
|
|
344
73
|
}
|
|
345
|
-
const
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
serializationObject.isCube = true;
|
|
349
|
-
serializationObject.level = this.level;
|
|
350
|
-
serializationObject.size = this._size;
|
|
351
|
-
serializationObject.coordinatesMode = this.coordinatesMode;
|
|
352
|
-
serializationObject.useInGammaSpace = this.gammaSpace;
|
|
353
|
-
serializationObject.generateHarmonics = this._generateHarmonics;
|
|
354
|
-
serializationObject.customType = "BABYLON.HDRCubeTexture";
|
|
355
|
-
serializationObject.noMipmap = this._noMipmap;
|
|
356
|
-
serializationObject.isBlocking = this._isBlocking;
|
|
357
|
-
serializationObject.rotationY = this._rotationY;
|
|
358
|
-
return serializationObject;
|
|
74
|
+
const texture = new HDRCubeTexture(rootUrl + parsedTexture.name, scene, parsedTexture.size, parsedTexture.noMipmap, parsedTexture.generateHarmonics, parsedTexture.useInGammaSpace);
|
|
75
|
+
this._Parse(parsedTexture, texture);
|
|
76
|
+
return texture;
|
|
359
77
|
}
|
|
360
78
|
}
|
|
361
|
-
HDRCubeTexture._FacesMapping = ["right", "left", "up", "down", "front", "back"];
|
|
362
79
|
RegisterClass("BABYLON.HDRCubeTexture", HDRCubeTexture);
|
|
363
80
|
//# sourceMappingURL=hdrCubeTexture.js.map
|