@onerjs/core 8.25.3 → 8.25.5

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