@onerjs/core 8.33.9 → 8.34.1

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 (44) hide show
  1. package/Materials/Textures/envCubeTexture.d.ts +5 -0
  2. package/Materials/Textures/envCubeTexture.js +35 -17
  3. package/Materials/Textures/envCubeTexture.js.map +1 -1
  4. package/Materials/Textures/hdrCubeTexture.js +1 -1
  5. package/Materials/Textures/hdrCubeTexture.js.map +1 -1
  6. package/Materials/index.d.ts +1 -0
  7. package/Materials/index.js +1 -0
  8. package/Materials/index.js.map +1 -1
  9. package/Materials/materialHelper.functions.d.ts +0 -30
  10. package/Materials/materialHelper.functions.js +0 -59
  11. package/Materials/materialHelper.functions.js.map +1 -1
  12. package/Materials/shaderMaterial.js +8 -14
  13. package/Materials/shaderMaterial.js.map +1 -1
  14. package/Materials/vertexPullingHelper.functions.d.ts +32 -0
  15. package/Materials/vertexPullingHelper.functions.js +60 -0
  16. package/Materials/vertexPullingHelper.functions.js.map +1 -0
  17. package/Misc/sceneSerializer.d.ts +14 -2
  18. package/Misc/sceneSerializer.js +10 -5
  19. package/Misc/sceneSerializer.js.map +1 -1
  20. package/Shaders/ShadersInclude/lightFragment.js +7 -5
  21. package/Shaders/ShadersInclude/lightFragment.js.map +1 -1
  22. package/Shaders/ShadersInclude/lightUboDeclaration.js +1 -1
  23. package/Shaders/ShadersInclude/lightUboDeclaration.js.map +1 -1
  24. package/Shaders/ShadersInclude/lightVxFragmentDeclaration.js +1 -1
  25. package/Shaders/ShadersInclude/lightVxFragmentDeclaration.js.map +1 -1
  26. package/Shaders/ShadersInclude/lightVxUboDeclaration.js +1 -1
  27. package/Shaders/ShadersInclude/lightVxUboDeclaration.js.map +1 -1
  28. package/Shaders/ShadersInclude/openpbrDirectLighting.js +4 -4
  29. package/Shaders/ShadersInclude/openpbrDirectLighting.js.map +1 -1
  30. package/Shaders/ShadersInclude/openpbrDirectLightingInit.js +4 -2
  31. package/Shaders/ShadersInclude/openpbrDirectLightingInit.js.map +1 -1
  32. package/ShadersWGSL/ShadersInclude/lightFragment.js +6 -4
  33. package/ShadersWGSL/ShadersInclude/lightFragment.js.map +1 -1
  34. package/ShadersWGSL/ShadersInclude/lightUboDeclaration.js +1 -1
  35. package/ShadersWGSL/ShadersInclude/lightUboDeclaration.js.map +1 -1
  36. package/ShadersWGSL/ShadersInclude/lightVxFragmentDeclaration.js +1 -1
  37. package/ShadersWGSL/ShadersInclude/lightVxFragmentDeclaration.js.map +1 -1
  38. package/ShadersWGSL/ShadersInclude/lightVxUboDeclaration.js +1 -1
  39. package/ShadersWGSL/ShadersInclude/lightVxUboDeclaration.js.map +1 -1
  40. package/ShadersWGSL/ShadersInclude/openpbrDirectLighting.js +4 -4
  41. package/ShadersWGSL/ShadersInclude/openpbrDirectLighting.js.map +1 -1
  42. package/ShadersWGSL/ShadersInclude/openpbrDirectLightingInit.js +4 -2
  43. package/ShadersWGSL/ShadersInclude/openpbrDirectLightingInit.js.map +1 -1
  44. package/package.json +1 -1
@@ -95,6 +95,11 @@ export declare abstract class EnvCubeTexture extends BaseTexture {
95
95
  * Occurs when the file has been loaded.
96
96
  */
97
97
  private _loadTexture;
98
+ /**
99
+ * Refresh envCubeTexture current url
100
+ * @param url
101
+ */
102
+ updateURL(url: string): void;
98
103
  delayLoad(): void;
99
104
  /**
100
105
  * Get the texture reflection matrix used to rotate/transform the reflection.
@@ -117,23 +117,7 @@ export class EnvCubeTexture extends BaseTexture {
117
117
  // mitigates this.
118
118
  this._supersample = supersample || prefilterUsingCdf;
119
119
  this._generateHarmonics = generateHarmonics;
120
- this._texture = this._getFromCache(url, this._noMipmap, undefined, undefined, undefined, this.isCube);
121
- if (!this._texture) {
122
- if (!this.getScene()?.useDelayedTextureLoading) {
123
- this._loadTexture();
124
- }
125
- else {
126
- this.delayLoadState = 4;
127
- }
128
- }
129
- else {
130
- if (this._texture.isReady) {
131
- Tools.SetImmediate(() => this._onLoad());
132
- }
133
- else {
134
- this._texture.onLoadedObservable.add(this._onLoad);
135
- }
136
- }
120
+ this.updateURL(url);
137
121
  }
138
122
  /**
139
123
  * Get the current class name of the texture useful for serialization or dynamic coding.
@@ -260,6 +244,29 @@ export class EnvCubeTexture extends BaseTexture {
260
244
  this._texture._sphericalPolynomial = new SphericalPolynomial();
261
245
  }
262
246
  }
247
+ /**
248
+ * Refresh envCubeTexture current url
249
+ * @param url
250
+ */
251
+ updateURL(url) {
252
+ this._texture = this._getFromCache(url, this._noMipmap, undefined, undefined, undefined, this.isCube);
253
+ if (!this._texture) {
254
+ if (!this.getScene()?.useDelayedTextureLoading) {
255
+ this._loadTexture();
256
+ }
257
+ else {
258
+ this.delayLoadState = 4;
259
+ }
260
+ }
261
+ else {
262
+ if (this._texture.isReady) {
263
+ Tools.SetImmediate(() => this._onLoad());
264
+ }
265
+ else {
266
+ this._texture.onLoadedObservable.add(this._onLoad);
267
+ }
268
+ }
269
+ }
263
270
  // Methods
264
271
  delayLoad() {
265
272
  if (this.delayLoadState !== 4) {
@@ -319,6 +326,14 @@ export class EnvCubeTexture extends BaseTexture {
319
326
  serializationObject.noMipmap = this._noMipmap;
320
327
  serializationObject.isBlocking = this._isBlocking;
321
328
  serializationObject.rotationY = this._rotationY;
329
+ serializationObject.samplingMode = this.samplingMode;
330
+ serializationObject.wrapU = this.wrapU;
331
+ serializationObject.wrapV = this.wrapV;
332
+ serializationObject.wrapR = this.wrapR;
333
+ serializationObject.supersample = this._supersample;
334
+ serializationObject.prefilterIrradianceOnLoad = this._prefilterIrradianceOnLoad;
335
+ serializationObject.prefilterOnLoad = this._prefilterOnLoad;
336
+ serializationObject.prefilterUsingCdf = this._prefilterUsingCdf;
322
337
  serializationObject.metadata = this.metadata;
323
338
  return serializationObject;
324
339
  }
@@ -352,6 +367,9 @@ export class EnvCubeTexture extends BaseTexture {
352
367
  if (parsedTexture.rotationY) {
353
368
  texture.rotationY = parsedTexture.rotationY;
354
369
  }
370
+ if (parsedTexture.samplingMode !== null && parsedTexture.samplingMode !== undefined) {
371
+ texture.updateSamplingMode(parsedTexture.samplingMode);
372
+ }
355
373
  }
356
374
  }
357
375
  EnvCubeTexture._FacesMapping = ["right", "left", "up", "down", "front", "back"];
@@ -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,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,iDAAiD,CAAC;AAEzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAEtE;;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,CAAC;IAGD;;OAEG;IACH,IAAW,SAAS,CAAC,KAAa;QAC9B,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;QACxB,I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AAE,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"]}
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,EAA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AI,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.updateURL(url);\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 /**\r\n * Refresh envCubeTexture current url\r\n * @param url\r\n */\r\n public updateURL(url: string) {\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 // 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.samplingMode = this.samplingMode;\r\n serializationObject.wrapU = this.wrapU;\r\n serializationObject.wrapV = this.wrapV;\r\n serializationObject.wrapR = this.wrapR;\r\n serializationObject.supersample = this._supersample;\r\n serializationObject.prefilterIrradianceOnLoad = this._prefilterIrradianceOnLoad;\r\n serializationObject.prefilterOnLoad = this._prefilterOnLoad;\r\n serializationObject.prefilterUsingCdf = this._prefilterUsingCdf;\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 if (parsedTexture.samplingMode !== null && parsedTexture.samplingMode !== undefined) {\r\n texture.updateSamplingMode(parsedTexture.samplingMode);\r\n }\r\n }\r\n}\r\n"]}
@@ -71,7 +71,7 @@ export class HDRCubeTexture extends EnvCubeTexture {
71
71
  if ((!parsedTexture.name && !parsedTexture.url) || parsedTexture.isRenderTarget) {
72
72
  return null;
73
73
  }
74
- const texture = new HDRCubeTexture(rootUrl + (parsedTexture.url || parsedTexture.name), scene, parsedTexture.size, parsedTexture.noMipmap, parsedTexture.generateHarmonics, parsedTexture.useInGammaSpace);
74
+ const texture = new HDRCubeTexture(rootUrl + (parsedTexture.url || parsedTexture.name), scene, parsedTexture.size, parsedTexture.noMipmap, parsedTexture.generateHarmonics, parsedTexture.useInGammaSpace, parsedTexture.prefilterOnLoad, null, null, parsedTexture.supersample, parsedTexture.prefilterIrradianceOnLoad, parsedTexture.prefilterUsingCdf);
75
75
  this._Parse(parsedTexture, texture);
76
76
  return texture;
77
77
  }
@@ -1 +1 @@
1
- {"version":3,"file":"hdrCubeTexture.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/Textures/hdrCubeTexture.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,iDAAiD,CAAC;AAGzD;;;;;GAKG;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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,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 { GetCubeMapTextureData } from \"../../Misc/HighDynamicRange/hdr\";\r\nimport { RegisterClass } from \"../../Misc/typeStore\";\r\nimport type { AbstractEngine } from \"../../Engines/abstractEngine\";\r\nimport \"../../Materials/Textures/baseTexture.polynomial\";\r\nimport type { CubeMapInfo } from \"../../Misc/HighDynamicRange/panoramaToCubemap\";\r\n\r\n/**\r\n * This represents a texture coming from an HDR input.\r\n *\r\n * The supported format is currently panorama picture stored in RGBE format.\r\n * Example of such files can be found on Poly Haven: https://polyhaven.com/hdris\r\n */\r\nexport class HDRCubeTexture 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 \"HDRCubeTexture\"\r\n */\r\n public override getClassName(): string {\r\n return \"HDRCubeTexture\";\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 return GetCubeMapTextureData(buffer, size, supersample);\r\n }\r\n\r\n protected _instantiateClone(): this {\r\n return new HDRCubeTexture(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.HDRCubeTexture\";\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Parses a JSON representation of an HDR 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<HDRCubeTexture> {\r\n if ((!parsedTexture.name && !parsedTexture.url) || parsedTexture.isRenderTarget) {\r\n return null;\r\n }\r\n\r\n const texture = new HDRCubeTexture(\r\n rootUrl + (parsedTexture.url || 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.HDRCubeTexture\", HDRCubeTexture);\r\n"]}
1
+ {"version":3,"file":"hdrCubeTexture.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/Textures/hdrCubeTexture.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,iDAAiD,CAAC;AAGzD;;;;;GAKG;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,OAAO,qBAAqB,CAAC,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;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 { GetCubeMapTextureData } from \"../../Misc/HighDynamicRange/hdr\";\r\nimport { RegisterClass } from \"../../Misc/typeStore\";\r\nimport type { AbstractEngine } from \"../../Engines/abstractEngine\";\r\nimport \"../../Materials/Textures/baseTexture.polynomial\";\r\nimport type { CubeMapInfo } from \"../../Misc/HighDynamicRange/panoramaToCubemap\";\r\n\r\n/**\r\n * This represents a texture coming from an HDR input.\r\n *\r\n * The supported format is currently panorama picture stored in RGBE format.\r\n * Example of such files can be found on Poly Haven: https://polyhaven.com/hdris\r\n */\r\nexport class HDRCubeTexture 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 \"HDRCubeTexture\"\r\n */\r\n public override getClassName(): string {\r\n return \"HDRCubeTexture\";\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 return GetCubeMapTextureData(buffer, size, supersample);\r\n }\r\n\r\n protected _instantiateClone(): this {\r\n return new HDRCubeTexture(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.HDRCubeTexture\";\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Parses a JSON representation of an HDR 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<HDRCubeTexture> {\r\n if ((!parsedTexture.name && !parsedTexture.url) || parsedTexture.isRenderTarget) {\r\n return null;\r\n }\r\n\r\n const texture = new HDRCubeTexture(\r\n rootUrl + (parsedTexture.url || parsedTexture.name),\r\n scene,\r\n parsedTexture.size,\r\n parsedTexture.noMipmap,\r\n parsedTexture.generateHarmonics,\r\n parsedTexture.useInGammaSpace,\r\n parsedTexture.prefilterOnLoad,\r\n null,\r\n null,\r\n parsedTexture.supersample,\r\n parsedTexture.prefilterIrradianceOnLoad,\r\n parsedTexture.prefilterUsingCdf\r\n );\r\n this._Parse(parsedTexture, texture);\r\n return texture;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.HDRCubeTexture\", HDRCubeTexture);\r\n"]}
@@ -42,6 +42,7 @@ export * from "./materialHelper.geometryrendering.js";
42
42
  export * from "./materialStencilState.js";
43
43
  export * from "./uv.defines.js";
44
44
  export * from "./floatingOriginMatrixOverrides.js";
45
+ export * from "./vertexPullingHelper.functions.js";
45
46
  import "./material.decalMap.js";
46
47
  export * from "../Shaders/default.fragment.js";
47
48
  export * from "../Shaders/default.vertex.js";
@@ -43,6 +43,7 @@ export * from "./materialHelper.geometryrendering.js";
43
43
  export * from "./materialStencilState.js";
44
44
  export * from "./uv.defines.js";
45
45
  export * from "./floatingOriginMatrixOverrides.js";
46
+ export * from "./vertexPullingHelper.functions.js";
46
47
  import "./material.decalMap.js";
47
48
  // async-loaded shaders
48
49
  // StandardMaterial
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../dev/core/src/Materials/index.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AACzB,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mCAAmC,CAAC;AAClD,cAAc,kCAAkC,CAAC;AACjD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yCAAyC,CAAC;AACxD,cAAc,yCAAyC,CAAC;AACxD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+CAA+C,CAAC;AAC9D,cAAc,4BAA4B,CAAC;AAC3C,cAAc,oCAAoC,CAAC;AACnD,cAAc,wBAAwB,CAAC;AACvC,cAAc,cAAc,CAAC;AAC7B,cAAc,iCAAiC,CAAC;AAChD,OAAO,qBAAqB,CAAC;AAE7B,uBAAuB;AAEvB,mBAAmB;AACnB,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iCAAiC,CAAC;AAChD,cAAc,+BAA+B,CAAC;AAE9C,2BAA2B;AAC3B,cAAc,iCAAiC,CAAC;AAChD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qCAAqC,CAAC;AACpD,cAAc,mCAAmC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-restricted-imports */\r\nexport * from \"./Background/index\";\r\nexport * from \"./colorCurves\";\r\nexport * from \"./iEffectFallbacks\";\r\nexport * from \"./effectFallbacks\";\r\nexport * from \"./effect\";\r\nexport * from \"./fresnelParameters\";\r\nexport * from \"./imageProcessing\";\r\nexport * from \"./imageProcessingConfiguration\";\r\nexport * from \"./material\";\r\nexport * from \"./materialDefines\";\r\nexport * from \"./clipPlaneMaterialHelper\";\r\nexport * from \"./materialHelper\";\r\nexport * from \"./multiMaterial\";\r\nexport * from \"./Occlusion/index\";\r\nexport * from \"./PBR/index\";\r\nexport * from \"./pushMaterial\";\r\nexport * from \"./shaderLanguage\";\r\nexport * from \"./shaderMaterial\";\r\nexport * from \"./standardMaterial\";\r\nexport * from \"./Textures/index\";\r\nexport * from \"./uniformBuffer\";\r\nexport * from \"./materialFlags\";\r\nexport * from \"./Node/index\";\r\nexport * from \"./effectRenderer\";\r\nexport * from \"./shadowDepthWrapper\";\r\nexport * from \"./drawWrapper.functions\";\r\nexport * from \"./drawWrapper\";\r\nexport * from \"./materialPluginBase\";\r\nexport * from \"./materialPluginManager\";\r\nexport * from \"./materialPluginEvent\";\r\nexport * from \"./material.detailMapConfiguration\";\r\nexport * from \"./material.decalMapConfiguration\";\r\nexport * from \"./materialPluginFactoryExport\";\r\nexport * from \"./GreasedLine/greasedLinePluginMaterial\";\r\nexport * from \"./GreasedLine/greasedLineSimpleMaterial\";\r\nexport * from \"./GreasedLine/greasedLineMaterialInterfaces\";\r\nexport * from \"./GreasedLine/greasedLineMaterialDefaults\";\r\nexport * from \"./meshDebugPluginMaterial\";\r\nexport * from \"./GaussianSplatting/gaussianSplattingMaterial\";\r\nexport * from \"./materialHelper.functions\";\r\nexport * from \"./materialHelper.geometryrendering\";\r\nexport * from \"./materialStencilState\";\r\nexport * from \"./uv.defines\";\r\nexport * from \"./floatingOriginMatrixOverrides\";\r\nimport \"./material.decalMap\";\r\n\r\n// async-loaded shaders\r\n\r\n// StandardMaterial\r\nexport * from \"../Shaders/default.fragment\";\r\nexport * from \"../Shaders/default.vertex\";\r\nexport * from \"../ShadersWGSL/default.fragment\";\r\nexport * from \"../ShadersWGSL/default.vertex\";\r\n\r\n// GreasedLineSimplMaterial\r\nexport * from \"../Shaders/greasedLine.fragment\";\r\nexport * from \"../Shaders/greasedLine.vertex\";\r\nexport * from \"../ShadersWGSL/greasedLine.fragment\";\r\nexport * from \"../ShadersWGSL/greasedLine.vertex\";\r\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../dev/core/src/Materials/index.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AACzB,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mCAAmC,CAAC;AAClD,cAAc,kCAAkC,CAAC;AACjD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yCAAyC,CAAC;AACxD,cAAc,yCAAyC,CAAC;AACxD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+CAA+C,CAAC;AAC9D,cAAc,4BAA4B,CAAC;AAC3C,cAAc,oCAAoC,CAAC;AACnD,cAAc,wBAAwB,CAAC;AACvC,cAAc,cAAc,CAAC;AAC7B,cAAc,iCAAiC,CAAC;AAChD,cAAc,iCAAiC,CAAC;AAChD,OAAO,qBAAqB,CAAC;AAE7B,uBAAuB;AAEvB,mBAAmB;AACnB,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iCAAiC,CAAC;AAChD,cAAc,+BAA+B,CAAC;AAE9C,2BAA2B;AAC3B,cAAc,iCAAiC,CAAC;AAChD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qCAAqC,CAAC;AACpD,cAAc,mCAAmC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-restricted-imports */\r\nexport * from \"./Background/index\";\r\nexport * from \"./colorCurves\";\r\nexport * from \"./iEffectFallbacks\";\r\nexport * from \"./effectFallbacks\";\r\nexport * from \"./effect\";\r\nexport * from \"./fresnelParameters\";\r\nexport * from \"./imageProcessing\";\r\nexport * from \"./imageProcessingConfiguration\";\r\nexport * from \"./material\";\r\nexport * from \"./materialDefines\";\r\nexport * from \"./clipPlaneMaterialHelper\";\r\nexport * from \"./materialHelper\";\r\nexport * from \"./multiMaterial\";\r\nexport * from \"./Occlusion/index\";\r\nexport * from \"./PBR/index\";\r\nexport * from \"./pushMaterial\";\r\nexport * from \"./shaderLanguage\";\r\nexport * from \"./shaderMaterial\";\r\nexport * from \"./standardMaterial\";\r\nexport * from \"./Textures/index\";\r\nexport * from \"./uniformBuffer\";\r\nexport * from \"./materialFlags\";\r\nexport * from \"./Node/index\";\r\nexport * from \"./effectRenderer\";\r\nexport * from \"./shadowDepthWrapper\";\r\nexport * from \"./drawWrapper.functions\";\r\nexport * from \"./drawWrapper\";\r\nexport * from \"./materialPluginBase\";\r\nexport * from \"./materialPluginManager\";\r\nexport * from \"./materialPluginEvent\";\r\nexport * from \"./material.detailMapConfiguration\";\r\nexport * from \"./material.decalMapConfiguration\";\r\nexport * from \"./materialPluginFactoryExport\";\r\nexport * from \"./GreasedLine/greasedLinePluginMaterial\";\r\nexport * from \"./GreasedLine/greasedLineSimpleMaterial\";\r\nexport * from \"./GreasedLine/greasedLineMaterialInterfaces\";\r\nexport * from \"./GreasedLine/greasedLineMaterialDefaults\";\r\nexport * from \"./meshDebugPluginMaterial\";\r\nexport * from \"./GaussianSplatting/gaussianSplattingMaterial\";\r\nexport * from \"./materialHelper.functions\";\r\nexport * from \"./materialHelper.geometryrendering\";\r\nexport * from \"./materialStencilState\";\r\nexport * from \"./uv.defines\";\r\nexport * from \"./floatingOriginMatrixOverrides\";\r\nexport * from \"./vertexPullingHelper.functions\";\r\nimport \"./material.decalMap\";\r\n\r\n// async-loaded shaders\r\n\r\n// StandardMaterial\r\nexport * from \"../Shaders/default.fragment\";\r\nexport * from \"../Shaders/default.vertex\";\r\nexport * from \"../ShadersWGSL/default.fragment\";\r\nexport * from \"../ShadersWGSL/default.vertex\";\r\n\r\n// GreasedLineSimplMaterial\r\nexport * from \"../Shaders/greasedLine.fragment\";\r\nexport * from \"../Shaders/greasedLine.vertex\";\r\nexport * from \"../ShadersWGSL/greasedLine.fragment\";\r\nexport * from \"../ShadersWGSL/greasedLine.vertex\";\r\n"]}
@@ -12,7 +12,6 @@ import type { Material } from "./material.js";
12
12
  import type { Nullable } from "../types.js";
13
13
  import type { MorphTargetManager } from "../Morph/morphTargetManager.js";
14
14
  import type { Color3 } from "../Maths/math.color.js";
15
- import type { Geometry } from "../Meshes/geometry.js";
16
15
  export * from "./materialHelper.functions.pure.js";
17
16
  /**
18
17
  * Binds the fog information from the scene to the effect for the given mesh.
@@ -180,35 +179,6 @@ export declare function HandleFallbacksForShadows(defines: any, fallbacks: Effec
180
179
  * @returns true if fog must be enabled
181
180
  */
182
181
  export declare function GetFogState(mesh: AbstractMesh, scene: Scene): boolean;
183
- /**
184
- * Interface representing metadata for vertex pulling
185
- */
186
- export interface IVertexPullingMetadata {
187
- /**
188
- * Offset in vertex buffer where data starts
189
- */
190
- offset: number;
191
- /**
192
- * Stride between elements in the vertex buffer
193
- */
194
- stride: number;
195
- /**
196
- * Type of the vertex buffer (e.g., float, int)
197
- */
198
- type: number;
199
- }
200
- /**
201
- * Prepares vertex pulling uniforms for the given attributes and mesh
202
- * @param geometry The geometry containing the vertex buffers
203
- * @returns A map of attribute names to their metadata, or null if unavailable
204
- */
205
- export declare function PrepareVertexPullingUniforms(geometry: Geometry): Nullable<Map<string, IVertexPullingMetadata>>;
206
- /**
207
- * Bind vertex pulling uniforms to the effect
208
- * @param effect The effect to bind the uniforms to
209
- * @param metadata The vertex pulling metadata
210
- */
211
- export declare function BindVertexPullingUniforms(effect: Effect, metadata: Map<string, IVertexPullingMetadata>): void;
212
182
  /**
213
183
  * Helper used to prepare the list of defines associated with misc. values for shader compilation
214
184
  * @param mesh defines the current mesh
@@ -501,65 +501,6 @@ export function HandleFallbacksForShadows(defines, fallbacks, maxSimultaneousLig
501
501
  export function GetFogState(mesh, scene) {
502
502
  return scene.fogEnabled && mesh.applyFog && scene.fogMode !== 0;
503
503
  }
504
- // Store vertex pulling metadata per geometry
505
- const _VertexPullingMetadataCache = new WeakMap();
506
- /**
507
- * Prepares vertex pulling uniforms for the given attributes and mesh
508
- * @param geometry The geometry containing the vertex buffers
509
- * @returns A map of attribute names to their metadata, or null if unavailable
510
- */
511
- export function PrepareVertexPullingUniforms(geometry) {
512
- const vertexBuffers = geometry.getVertexBuffers();
513
- if (!vertexBuffers) {
514
- return null;
515
- }
516
- // Check cache first
517
- let metadata = _VertexPullingMetadataCache.get(geometry);
518
- if (!metadata) {
519
- metadata = new Map();
520
- _VertexPullingMetadataCache.set(geometry, metadata);
521
- }
522
- else {
523
- // Return cached metadata if it exists and hasn't changed
524
- let needsUpdate = false;
525
- for (const vb in vertexBuffers) {
526
- if (!metadata.has(vb)) {
527
- needsUpdate = true;
528
- break;
529
- }
530
- }
531
- if (!needsUpdate) {
532
- return metadata;
533
- }
534
- }
535
- // Build or update metadata
536
- for (const vb in vertexBuffers) {
537
- const vertexBuffer = vertexBuffers[vb];
538
- if (vertexBuffer) {
539
- const offset = vertexBuffer.byteOffset;
540
- const stride = vertexBuffer.byteStride;
541
- const type = vertexBuffer.type;
542
- metadata.set(vb, {
543
- offset: offset,
544
- stride: stride,
545
- type: type,
546
- });
547
- }
548
- }
549
- return metadata;
550
- }
551
- /**
552
- * Bind vertex pulling uniforms to the effect
553
- * @param effect The effect to bind the uniforms to
554
- * @param metadata The vertex pulling metadata
555
- */
556
- export function BindVertexPullingUniforms(effect, metadata) {
557
- metadata.forEach((data, attribute) => {
558
- const uniformName = `vp_${attribute}_info`;
559
- // Pack into vec3: (offset, stride, type)
560
- effect.setFloat3(uniformName, data.offset, data.stride, data.type);
561
- });
562
- }
563
504
  /**
564
505
  * Helper used to prepare the list of defines associated with misc. values for shader compilation
565
506
  * @param mesh defines the current mesh