@onerjs/core 8.26.4 → 8.26.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 (137) hide show
  1. package/Engines/abstractEngine.js +2 -2
  2. package/Engines/abstractEngine.js.map +1 -1
  3. package/FrameGraph/Tasks/Rendering/objectRendererTask.js +6 -0
  4. package/FrameGraph/Tasks/Rendering/objectRendererTask.js.map +1 -1
  5. package/FrameGraph/frameGraphContext.d.ts +2 -1
  6. package/FrameGraph/frameGraphContext.js +4 -1
  7. package/FrameGraph/frameGraphContext.js.map +1 -1
  8. package/Lights/Clustered/clusteredLightContainer.d.ts +1 -1
  9. package/Lights/Clustered/clusteredLightContainer.js +4 -5
  10. package/Lights/Clustered/clusteredLightContainer.js.map +1 -1
  11. package/Lights/pointLight.js +4 -4
  12. package/Lights/pointLight.js.map +1 -1
  13. package/Lights/rectAreaLight.js +4 -4
  14. package/Lights/rectAreaLight.js.map +1 -1
  15. package/Lights/spotLight.js +2 -2
  16. package/Lights/spotLight.js.map +1 -1
  17. package/Materials/Background/backgroundMaterial.d.ts +19 -91
  18. package/Materials/Background/backgroundMaterial.js +17 -245
  19. package/Materials/Background/backgroundMaterial.js.map +1 -1
  20. package/Materials/Node/Blocks/Dual/lightBlock.js +15 -4
  21. package/Materials/Node/Blocks/Dual/lightBlock.js.map +1 -1
  22. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +28 -5
  23. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
  24. package/Materials/Node/nodeMaterial.d.ts +57 -69
  25. package/Materials/Node/nodeMaterial.js +9 -86
  26. package/Materials/Node/nodeMaterial.js.map +1 -1
  27. package/Materials/Node/nodeMaterialBuildState.d.ts +3 -1
  28. package/Materials/Node/nodeMaterialBuildState.js +35 -15
  29. package/Materials/Node/nodeMaterialBuildState.js.map +1 -1
  30. package/Materials/PBR/index.d.ts +5 -0
  31. package/Materials/PBR/index.js +5 -0
  32. package/Materials/PBR/index.js.map +1 -1
  33. package/Materials/PBR/openPbrMaterial.d.ts +998 -0
  34. package/Materials/PBR/openPbrMaterial.js +2069 -0
  35. package/Materials/PBR/openPbrMaterial.js.map +1 -0
  36. package/Materials/PBR/pbrBaseMaterial.d.ts +57 -43
  37. package/Materials/PBR/pbrBaseMaterial.js +21 -304
  38. package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
  39. package/Materials/PBR/pbrMaterial.d.ts +0 -78
  40. package/Materials/PBR/pbrMaterial.js +0 -110
  41. package/Materials/PBR/pbrMaterial.js.map +1 -1
  42. package/Materials/floatingOriginMatrixOverrides.d.ts +3 -0
  43. package/Materials/floatingOriginMatrixOverrides.js +91 -0
  44. package/Materials/floatingOriginMatrixOverrides.js.map +1 -0
  45. package/Materials/imageProcessing.d.ts +65 -0
  46. package/Materials/imageProcessing.js +162 -0
  47. package/Materials/imageProcessing.js.map +1 -0
  48. package/Materials/imageProcessingConfiguration.defines.d.ts +25 -0
  49. package/Materials/imageProcessingConfiguration.defines.js +27 -0
  50. package/Materials/imageProcessingConfiguration.defines.js.map +1 -1
  51. package/Materials/index.d.ts +2 -0
  52. package/Materials/index.js +2 -0
  53. package/Materials/index.js.map +1 -1
  54. package/Materials/material.d.ts +14 -0
  55. package/Materials/material.js +14 -0
  56. package/Materials/material.js.map +1 -1
  57. package/Materials/materialHelper.functions.d.ts +53 -0
  58. package/Materials/materialHelper.functions.js +297 -0
  59. package/Materials/materialHelper.functions.js.map +1 -1
  60. package/Materials/standardMaterial.d.ts +57 -121
  61. package/Materials/standardMaterial.js +21 -250
  62. package/Materials/standardMaterial.js.map +1 -1
  63. package/Materials/uv.defines.d.ts +22 -0
  64. package/Materials/uv.defines.js +24 -0
  65. package/Materials/uv.defines.js.map +1 -0
  66. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +1 -0
  67. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
  68. package/Misc/decorators.d.ts +7 -0
  69. package/Misc/decorators.js +34 -0
  70. package/Misc/decorators.js.map +1 -1
  71. package/Particles/Node/Blocks/Emitters/createParticleBlock.js +10 -1
  72. package/Particles/Node/Blocks/Emitters/createParticleBlock.js.map +1 -1
  73. package/Particles/Node/Blocks/index.d.ts +2 -0
  74. package/Particles/Node/Blocks/index.js +2 -0
  75. package/Particles/Node/Blocks/index.js.map +1 -1
  76. package/Particles/Node/Blocks/particleInputBlock.js +4 -1
  77. package/Particles/Node/Blocks/particleInputBlock.js.map +1 -1
  78. package/Particles/Node/Blocks/particleLocalVariableBlock.d.ts +38 -0
  79. package/Particles/Node/Blocks/particleLocalVariableBlock.js +108 -0
  80. package/Particles/Node/Blocks/particleLocalVariableBlock.js.map +1 -0
  81. package/Particles/Node/Blocks/particleVectorLengthBlock.d.ts +26 -0
  82. package/Particles/Node/Blocks/particleVectorLengthBlock.js +50 -0
  83. package/Particles/Node/Blocks/particleVectorLengthBlock.js.map +1 -0
  84. package/Rendering/IBLShadows/iblShadowsPluginMaterial.d.ts +2 -1
  85. package/Rendering/IBLShadows/iblShadowsPluginMaterial.js +45 -0
  86. package/Rendering/IBLShadows/iblShadowsPluginMaterial.js.map +1 -1
  87. package/Rendering/IBLShadows/iblShadowsRenderPipeline.js +2 -1
  88. package/Rendering/IBLShadows/iblShadowsRenderPipeline.js.map +1 -1
  89. package/Rendering/geometryBufferRenderer.js +6 -4
  90. package/Rendering/geometryBufferRenderer.js.map +1 -1
  91. package/Rendering/iblCdfGenerator.js +28 -20
  92. package/Rendering/iblCdfGenerator.js.map +1 -1
  93. package/Rendering/reflectiveShadowMap.d.ts +3 -3
  94. package/Shaders/ShadersInclude/backgroundUboDeclaration.js +1 -1
  95. package/Shaders/ShadersInclude/backgroundUboDeclaration.js.map +1 -1
  96. package/Shaders/ShadersInclude/clusteredLightingFunctions.js +3 -1
  97. package/Shaders/ShadersInclude/clusteredLightingFunctions.js.map +1 -1
  98. package/Shaders/ShadersInclude/defaultUboDeclaration.js +1 -1
  99. package/Shaders/ShadersInclude/defaultUboDeclaration.js.map +1 -1
  100. package/Shaders/ShadersInclude/hdrFilteringFunctions.js +34 -0
  101. package/Shaders/ShadersInclude/hdrFilteringFunctions.js.map +1 -1
  102. package/Shaders/ShadersInclude/helperFunctions.js +1 -1
  103. package/Shaders/ShadersInclude/helperFunctions.js.map +1 -1
  104. package/Shaders/ShadersInclude/importanceSampling.js +4 -0
  105. package/Shaders/ShadersInclude/importanceSampling.js.map +1 -1
  106. package/Shaders/ShadersInclude/lightsFragmentFunctions.js +1 -0
  107. package/Shaders/ShadersInclude/lightsFragmentFunctions.js.map +1 -1
  108. package/Shaders/ShadersInclude/pbrBRDFFunctions.js +1 -1
  109. package/Shaders/ShadersInclude/pbrBRDFFunctions.js.map +1 -1
  110. package/Shaders/ShadersInclude/pbrClusteredLightingFunctions.js +1 -0
  111. package/Shaders/ShadersInclude/pbrClusteredLightingFunctions.js.map +1 -1
  112. package/Shaders/ShadersInclude/pbrDirectLightingFunctions.js +3 -1
  113. package/Shaders/ShadersInclude/pbrDirectLightingFunctions.js.map +1 -1
  114. package/Shaders/ShadersInclude/pbrHelperFunctions.js +2 -0
  115. package/Shaders/ShadersInclude/pbrHelperFunctions.js.map +1 -1
  116. package/Shaders/ShadersInclude/pbrUboDeclaration.js +1 -1
  117. package/Shaders/ShadersInclude/pbrUboDeclaration.js.map +1 -1
  118. package/ShadersWGSL/ShadersInclude/backgroundUboDeclaration.js +1 -1
  119. package/ShadersWGSL/ShadersInclude/backgroundUboDeclaration.js.map +1 -1
  120. package/ShadersWGSL/ShadersInclude/defaultUboDeclaration.js +1 -1
  121. package/ShadersWGSL/ShadersInclude/defaultUboDeclaration.js.map +1 -1
  122. package/ShadersWGSL/ShadersInclude/hdrFilteringFunctions.js +28 -0
  123. package/ShadersWGSL/ShadersInclude/hdrFilteringFunctions.js.map +1 -1
  124. package/ShadersWGSL/ShadersInclude/importanceSampling.js +4 -0
  125. package/ShadersWGSL/ShadersInclude/importanceSampling.js.map +1 -1
  126. package/ShadersWGSL/ShadersInclude/pbrBRDFFunctions.js +1 -1
  127. package/ShadersWGSL/ShadersInclude/pbrBRDFFunctions.js.map +1 -1
  128. package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js +3 -1
  129. package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js.map +1 -1
  130. package/ShadersWGSL/ShadersInclude/pbrHelperFunctions.js +2 -0
  131. package/ShadersWGSL/ShadersInclude/pbrHelperFunctions.js.map +1 -1
  132. package/ShadersWGSL/ShadersInclude/pbrUboDeclaration.js +1 -1
  133. package/ShadersWGSL/ShadersInclude/pbrUboDeclaration.js.map +1 -1
  134. package/package.json +1 -1
  135. package/scene.d.ts +21 -0
  136. package/scene.js +29 -3
  137. package/scene.js.map +1 -1
@@ -1,27 +1,30 @@
1
1
  import { __decorate } from "../../tslib.es6.js";
2
2
  /* eslint-disable @typescript-eslint/naming-convention */
3
- import { serialize, serializeAsColor3, expandToProperty, serializeAsTexture, serializeAsVector3, serializeAsImageProcessingConfiguration } from "../../Misc/decorators.js";
3
+ import { serialize, serializeAsColor3, expandToProperty, serializeAsTexture, serializeAsVector3 } from "../../Misc/decorators.js";
4
4
  import { SmartArray } from "../../Misc/smartArray.js";
5
5
  import { Logger } from "../../Misc/logger.js";
6
6
  import { Vector3, Vector4 } from "../../Maths/math.vector.js";
7
7
  import { VertexBuffer } from "../../Buffers/buffer.js";
8
8
  import { MaterialDefines } from "../../Materials/materialDefines.js";
9
9
  import { PushMaterial } from "../../Materials/pushMaterial.js";
10
+ import { ImageProcessingDefinesMixin } from "../../Materials/imageProcessingConfiguration.defines.js";
10
11
  import { ImageProcessingConfiguration } from "../../Materials/imageProcessingConfiguration.js";
11
- import { Texture } from "../../Materials/Textures/texture.js";
12
12
 
13
13
  import { RegisterClass } from "../../Misc/typeStore.js";
14
14
  import { MaterialFlags } from "../materialFlags.js";
15
15
  import { Color3 } from "../../Maths/math.color.js";
16
16
  import { EffectFallbacks } from "../effectFallbacks.js";
17
17
  import { AddClipPlaneUniforms, BindClipPlane } from "../clipPlaneMaterialHelper.js";
18
- import { BindBonesParameters, BindFogParameters, BindLights, BindLogDepth, BindTextureMatrix, HandleFallbacksForShadows, PrepareAttributesForBones, PrepareAttributesForInstances, PrepareDefinesForAttributes, PrepareDefinesForFrameBoundValues, PrepareDefinesForLights, PrepareDefinesForMergedUV, PrepareDefinesForMisc, PrepareDefinesForMultiview, PrepareUniformsAndSamplersList, } from "../materialHelper.functions.js";
18
+ import { BindBonesParameters, BindFogParameters, BindLights, BindLogDepth, BindTextureMatrix, BindIBLParameters, BindIBLSamplers, HandleFallbacksForShadows, PrepareAttributesForBones, PrepareAttributesForInstances, PrepareDefinesForAttributes, PrepareDefinesForFrameBoundValues, PrepareDefinesForLights, PrepareDefinesForIBL, PrepareDefinesForMergedUV, PrepareDefinesForMisc, PrepareDefinesForMultiview, PrepareUniformsAndSamplersList, PrepareUniformsAndSamplersForIBL, PrepareUniformLayoutForIBL, } from "../materialHelper.functions.js";
19
19
  import { SerializationHelper } from "../../Misc/decorators.serialization.js";
20
+ import { ImageProcessingMixin } from "../imageProcessing.js";
21
+ class BackgroundMaterialDefinesBase extends MaterialDefines {
22
+ }
20
23
  /**
21
24
  * Background material defines definition.
22
25
  * @internal Mainly internal Use
23
26
  */
24
- class BackgroundMaterialDefines extends MaterialDefines {
27
+ class BackgroundMaterialDefines extends ImageProcessingDefinesMixin(BackgroundMaterialDefinesBase) {
25
28
  /**
26
29
  * Constructor of the defines.
27
30
  */
@@ -93,22 +96,6 @@ class BackgroundMaterialDefines extends MaterialDefines {
93
96
  * True if ground projection has been enabled.
94
97
  */
95
98
  this.PROJECTED_GROUND = false;
96
- this.IMAGEPROCESSING = false;
97
- this.VIGNETTE = false;
98
- this.VIGNETTEBLENDMODEMULTIPLY = false;
99
- this.VIGNETTEBLENDMODEOPAQUE = false;
100
- this.TONEMAPPING = 0;
101
- this.CONTRAST = false;
102
- this.COLORCURVES = false;
103
- this.COLORGRADING = false;
104
- this.COLORGRADING3D = false;
105
- this.SAMPLER3DGREENDEPTH = false;
106
- this.SAMPLER3DBGRMAP = false;
107
- this.DITHER = false;
108
- this.IMAGEPROCESSINGPOSTPROCESS = false;
109
- this.SKIPFINALCOLORCLAMP = false;
110
- this.EXPOSURE = false;
111
- this.MULTIVIEW = false;
112
99
  // Reflection.
113
100
  this.REFLECTION = false;
114
101
  this.REFLECTIONMAP_3D = false;
@@ -151,11 +138,13 @@ class BackgroundMaterialDefines extends MaterialDefines {
151
138
  this.rebuild();
152
139
  }
153
140
  }
141
+ class BackgroundMaterialBase extends ImageProcessingMixin(PushMaterial) {
142
+ }
154
143
  /**
155
144
  * Background material used to create an efficient environment around your scene.
156
145
  * #157MGZ: simple test
157
146
  */
158
- export class BackgroundMaterial extends PushMaterial {
147
+ export class BackgroundMaterial extends BackgroundMaterialBase {
159
148
  /**
160
149
  * Experimental Internal Use Only.
161
150
  *
@@ -229,143 +218,6 @@ export class BackgroundMaterial extends PushMaterial {
229
218
  }
230
219
  this._fovMultiplier = Math.max(0.0, Math.min(2.0, value));
231
220
  }
232
- /**
233
- * Attaches a new image processing configuration to the PBR Material.
234
- * @param configuration (if null the scene configuration will be use)
235
- */
236
- _attachImageProcessingConfiguration(configuration) {
237
- if (configuration === this._imageProcessingConfiguration) {
238
- return;
239
- }
240
- // Detaches observer.
241
- if (this._imageProcessingConfiguration && this._imageProcessingObserver) {
242
- this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver);
243
- }
244
- // Pick the scene configuration if needed.
245
- if (!configuration) {
246
- this._imageProcessingConfiguration = this.getScene().imageProcessingConfiguration;
247
- }
248
- else {
249
- this._imageProcessingConfiguration = configuration;
250
- }
251
- // Attaches observer.
252
- if (this._imageProcessingConfiguration) {
253
- this._imageProcessingObserver = this._imageProcessingConfiguration.onUpdateParameters.add(() => {
254
- this._computePrimaryColorFromPerceptualColor();
255
- this._markAllSubMeshesAsImageProcessingDirty();
256
- });
257
- }
258
- }
259
- /**
260
- * Gets the image processing configuration used either in this material.
261
- */
262
- get imageProcessingConfiguration() {
263
- return this._imageProcessingConfiguration;
264
- }
265
- /**
266
- * Sets the Default image processing configuration used either in the this material.
267
- *
268
- * If sets to null, the scene one is in use.
269
- */
270
- set imageProcessingConfiguration(value) {
271
- this._attachImageProcessingConfiguration(value);
272
- // Ensure the effect will be rebuilt.
273
- this._markAllSubMeshesAsTexturesDirty();
274
- }
275
- /**
276
- * Gets whether the color curves effect is enabled.
277
- */
278
- get cameraColorCurvesEnabled() {
279
- return this.imageProcessingConfiguration.colorCurvesEnabled;
280
- }
281
- /**
282
- * Sets whether the color curves effect is enabled.
283
- */
284
- set cameraColorCurvesEnabled(value) {
285
- this.imageProcessingConfiguration.colorCurvesEnabled = value;
286
- }
287
- /**
288
- * Gets whether the color grading effect is enabled.
289
- */
290
- get cameraColorGradingEnabled() {
291
- return this.imageProcessingConfiguration.colorGradingEnabled;
292
- }
293
- /**
294
- * Gets whether the color grading effect is enabled.
295
- */
296
- set cameraColorGradingEnabled(value) {
297
- this.imageProcessingConfiguration.colorGradingEnabled = value;
298
- }
299
- /**
300
- * Gets whether tonemapping is enabled or not.
301
- */
302
- get cameraToneMappingEnabled() {
303
- return this._imageProcessingConfiguration.toneMappingEnabled;
304
- }
305
- /**
306
- * Sets whether tonemapping is enabled or not
307
- */
308
- set cameraToneMappingEnabled(value) {
309
- this._imageProcessingConfiguration.toneMappingEnabled = value;
310
- }
311
- /**
312
- * The camera exposure used on this material.
313
- * This property is here and not in the camera to allow controlling exposure without full screen post process.
314
- * This corresponds to a photographic exposure.
315
- */
316
- get cameraExposure() {
317
- return this._imageProcessingConfiguration.exposure;
318
- }
319
- /**
320
- * The camera exposure used on this material.
321
- * This property is here and not in the camera to allow controlling exposure without full screen post process.
322
- * This corresponds to a photographic exposure.
323
- */
324
- set cameraExposure(value) {
325
- this._imageProcessingConfiguration.exposure = value;
326
- }
327
- /**
328
- * Gets The camera contrast used on this material.
329
- */
330
- get cameraContrast() {
331
- return this._imageProcessingConfiguration.contrast;
332
- }
333
- /**
334
- * Sets The camera contrast used on this material.
335
- */
336
- set cameraContrast(value) {
337
- this._imageProcessingConfiguration.contrast = value;
338
- }
339
- /**
340
- * Gets the Color Grading 2D Lookup Texture.
341
- */
342
- get cameraColorGradingTexture() {
343
- return this._imageProcessingConfiguration.colorGradingTexture;
344
- }
345
- /**
346
- * Sets the Color Grading 2D Lookup Texture.
347
- */
348
- set cameraColorGradingTexture(value) {
349
- this.imageProcessingConfiguration.colorGradingTexture = value;
350
- }
351
- /**
352
- * The color grading curves provide additional color adjustment that is applied after any color grading transform (3D LUT).
353
- * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.
354
- * These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image;
355
- * corresponding to low luminance, medium luminance, and high luminance areas respectively.
356
- */
357
- get cameraColorCurves() {
358
- return this.imageProcessingConfiguration.colorCurves;
359
- }
360
- /**
361
- * The color grading curves provide additional color adjustment that is applied after any color grading transform (3D LUT).
362
- * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.
363
- * These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image;
364
- * corresponding to low luminance, medium luminance, and high luminance areas respectively.
365
- */
366
- set cameraColorCurves(value) {
367
- this.imageProcessingConfiguration.colorCurves = value;
368
- }
369
221
  /**
370
222
  * Instantiates a Background Material in the given scene
371
223
  * @param name The friendly name of the material
@@ -463,10 +315,6 @@ export class BackgroundMaterial extends PushMaterial {
463
315
  * Make the material only render shadows
464
316
  */
465
317
  this.shadowOnly = false;
466
- /**
467
- * Keep track of the image processing observer to allow dispose and replace.
468
- */
469
- this._imageProcessingObserver = null;
470
318
  /**
471
319
  * Due to a bug in iOS10, video tags (which are using the background material) are in BGR and not RGB.
472
320
  * Setting this flag to true (not done automatically!) will convert it back to RGB.
@@ -586,53 +434,14 @@ export class BackgroundMaterial extends PushMaterial {
586
434
  defines.OPACITYFRESNEL = false;
587
435
  }
588
436
  const reflectionTexture = this._reflectionTexture;
437
+ PrepareDefinesForIBL(scene, reflectionTexture, defines);
589
438
  if (reflectionTexture && MaterialFlags.ReflectionTextureEnabled) {
590
439
  if (!reflectionTexture.isReadyOrNotBlocking()) {
591
440
  return false;
592
441
  }
593
- defines.REFLECTION = true;
594
- defines.GAMMAREFLECTION = reflectionTexture.gammaSpace;
595
- defines.RGBDREFLECTION = reflectionTexture.isRGBD;
596
- defines.REFLECTIONBLUR = this._reflectionBlur > 0;
597
- defines.LODINREFLECTIONALPHA = reflectionTexture.lodLevelInAlpha;
598
442
  defines.EQUIRECTANGULAR_RELFECTION_FOV = this.useEquirectangularFOV;
599
443
  defines.REFLECTIONBGR = this.switchToBGR;
600
- if (reflectionTexture.coordinatesMode === Texture.INVCUBIC_MODE) {
601
- defines.INVERTCUBICMAP = true;
602
- }
603
- defines.REFLECTIONMAP_3D = reflectionTexture.isCube;
604
- defines.REFLECTIONMAP_OPPOSITEZ = defines.REFLECTIONMAP_3D && this.getScene().useRightHandedSystem ? !reflectionTexture.invertZ : reflectionTexture.invertZ;
605
- switch (reflectionTexture.coordinatesMode) {
606
- case Texture.EXPLICIT_MODE:
607
- defines.REFLECTIONMAP_EXPLICIT = true;
608
- break;
609
- case Texture.PLANAR_MODE:
610
- defines.REFLECTIONMAP_PLANAR = true;
611
- break;
612
- case Texture.PROJECTION_MODE:
613
- defines.REFLECTIONMAP_PROJECTION = true;
614
- break;
615
- case Texture.SKYBOX_MODE:
616
- defines.REFLECTIONMAP_SKYBOX = true;
617
- break;
618
- case Texture.SPHERICAL_MODE:
619
- defines.REFLECTIONMAP_SPHERICAL = true;
620
- break;
621
- case Texture.EQUIRECTANGULAR_MODE:
622
- defines.REFLECTIONMAP_EQUIRECTANGULAR = true;
623
- break;
624
- case Texture.FIXED_EQUIRECTANGULAR_MODE:
625
- defines.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = true;
626
- break;
627
- case Texture.FIXED_EQUIRECTANGULAR_MIRRORED_MODE:
628
- defines.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = true;
629
- break;
630
- case Texture.CUBIC_MODE:
631
- case Texture.INVCUBIC_MODE:
632
- default:
633
- defines.REFLECTIONMAP_CUBIC = true;
634
- break;
635
- }
444
+ defines.REFLECTIONBLUR = this._reflectionBlur > 0;
636
445
  if (this.reflectionFresnel) {
637
446
  defines.REFLECTIONFRESNEL = true;
638
447
  defines.REFLECTIONFALLOFF = this.reflectionFalloffDistance > 0;
@@ -647,25 +456,9 @@ export class BackgroundMaterial extends PushMaterial {
647
456
  }
648
457
  }
649
458
  else {
650
- defines.REFLECTION = false;
651
459
  defines.REFLECTIONFRESNEL = false;
652
460
  defines.REFLECTIONFALLOFF = false;
653
461
  defines.REFLECTIONBLUR = false;
654
- defines.REFLECTIONMAP_3D = false;
655
- defines.REFLECTIONMAP_SPHERICAL = false;
656
- defines.REFLECTIONMAP_PLANAR = false;
657
- defines.REFLECTIONMAP_CUBIC = false;
658
- defines.REFLECTIONMAP_PROJECTION = false;
659
- defines.REFLECTIONMAP_SKYBOX = false;
660
- defines.REFLECTIONMAP_EXPLICIT = false;
661
- defines.REFLECTIONMAP_EQUIRECTANGULAR = false;
662
- defines.REFLECTIONMAP_EQUIRECTANGULAR_FIXED = false;
663
- defines.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED = false;
664
- defines.INVERTCUBICMAP = false;
665
- defines.REFLECTIONMAP_OPPOSITEZ = false;
666
- defines.LODINREFLECTIONALPHA = false;
667
- defines.GAMMAREFLECTION = false;
668
- defines.RGBDREFLECTION = false;
669
462
  }
670
463
  }
671
464
  defines.PREMULTIPLYALPHA = this.alphaMode === 7 || this.alphaMode === 8;
@@ -745,9 +538,6 @@ export class BackgroundMaterial extends PushMaterial {
745
538
  "mBones",
746
539
  "vPrimaryColor",
747
540
  "vPrimaryColorShadow",
748
- "vReflectionInfos",
749
- "reflectionMatrix",
750
- "vReflectionMicrosurfaceInfos",
751
541
  "fFovMultiplier",
752
542
  "shadowLevel",
753
543
  "alpha",
@@ -759,7 +549,8 @@ export class BackgroundMaterial extends PushMaterial {
759
549
  "logarithmicDepthConstant",
760
550
  ];
761
551
  AddClipPlaneUniforms(uniforms);
762
- const samplers = ["diffuseSampler", "reflectionSampler", "reflectionSamplerLow", "reflectionSamplerHigh"];
552
+ const samplers = ["diffuseSampler"];
553
+ PrepareUniformsAndSamplersForIBL(uniforms, samplers, false);
763
554
  const uniformBuffers = ["Material", "Scene"];
764
555
  if (ImageProcessingConfiguration) {
765
556
  ImageProcessingConfiguration.PrepareUniforms(uniforms, defines);
@@ -848,10 +639,7 @@ export class BackgroundMaterial extends PushMaterial {
848
639
  this._uniformBuffer.addUniform("vPrimaryColor", 4);
849
640
  this._uniformBuffer.addUniform("vPrimaryColorShadow", 4);
850
641
  this._uniformBuffer.addUniform("vDiffuseInfos", 2);
851
- this._uniformBuffer.addUniform("vReflectionInfos", 2);
852
642
  this._uniformBuffer.addUniform("diffuseMatrix", 16);
853
- this._uniformBuffer.addUniform("reflectionMatrix", 16);
854
- this._uniformBuffer.addUniform("vReflectionMicrosurfaceInfos", 3);
855
643
  this._uniformBuffer.addUniform("fFovMultiplier", 1);
856
644
  this._uniformBuffer.addUniform("pointSize", 1);
857
645
  this._uniformBuffer.addUniform("shadowLevel", 1);
@@ -859,6 +647,7 @@ export class BackgroundMaterial extends PushMaterial {
859
647
  this._uniformBuffer.addUniform("vBackgroundCenter", 3);
860
648
  this._uniformBuffer.addUniform("vReflectionControl", 4);
861
649
  this._uniformBuffer.addUniform("projectedGroundInfos", 2);
650
+ PrepareUniformLayoutForIBL(this._uniformBuffer, true, false, false);
862
651
  this._uniformBuffer.create();
863
652
  }
864
653
  /**
@@ -913,11 +702,7 @@ export class BackgroundMaterial extends PushMaterial {
913
702
  this._uniformBuffer.updateFloat2("vDiffuseInfos", this._diffuseTexture.coordinatesIndex, this._diffuseTexture.level);
914
703
  BindTextureMatrix(this._diffuseTexture, this._uniformBuffer, "diffuse");
915
704
  }
916
- if (reflectionTexture && MaterialFlags.ReflectionTextureEnabled) {
917
- this._uniformBuffer.updateMatrix("reflectionMatrix", reflectionTexture.getReflectionTextureMatrix());
918
- this._uniformBuffer.updateFloat2("vReflectionInfos", reflectionTexture.level, this._reflectionBlur);
919
- this._uniformBuffer.updateFloat3("vReflectionMicrosurfaceInfos", reflectionTexture.getSize().width, reflectionTexture.lodGenerationScale, reflectionTexture.lodGenerationOffset);
920
- }
705
+ BindIBLParameters(scene, defines, this._uniformBuffer, reflectionTexture, false, true);
921
706
  }
922
707
  if (this.shadowLevel > 0) {
923
708
  this._uniformBuffer.updateFloat("shadowLevel", this.shadowLevel);
@@ -942,17 +727,7 @@ export class BackgroundMaterial extends PushMaterial {
942
727
  this._uniformBuffer.setTexture("diffuseSampler", this._diffuseTexture);
943
728
  }
944
729
  if (reflectionTexture && MaterialFlags.ReflectionTextureEnabled) {
945
- if (defines.REFLECTIONBLUR && defines.TEXTURELODSUPPORT) {
946
- this._uniformBuffer.setTexture("reflectionSampler", reflectionTexture);
947
- }
948
- else if (!defines.REFLECTIONBLUR) {
949
- this._uniformBuffer.setTexture("reflectionSampler", reflectionTexture);
950
- }
951
- else {
952
- this._uniformBuffer.setTexture("reflectionSampler", reflectionTexture._lodTextureMid || reflectionTexture);
953
- this._uniformBuffer.setTexture("reflectionSamplerLow", reflectionTexture._lodTextureLow || reflectionTexture);
954
- this._uniformBuffer.setTexture("reflectionSamplerHigh", reflectionTexture._lodTextureHigh || reflectionTexture);
955
- }
730
+ BindIBLSamplers(scene, defines, this._uniformBuffer, reflectionTexture);
956
731
  if (defines.REFLECTIONFRESNEL) {
957
732
  this._uniformBuffer.updateFloat3("vBackgroundCenter", this.sceneCenter.x, this.sceneCenter.y, this.sceneCenter.z);
958
733
  this._uniformBuffer.updateFloat4("vReflectionControl", this._reflectionControls.x, this._reflectionControls.y, this._reflectionControls.z, this._reflectionControls.w);
@@ -1181,9 +956,6 @@ __decorate([
1181
956
  __decorate([
1182
957
  expandToProperty("_markAllSubMeshesAsLightsDirty")
1183
958
  ], BackgroundMaterial.prototype, "shadowOnly", void 0);
1184
- __decorate([
1185
- serializeAsImageProcessingConfiguration()
1186
- ], BackgroundMaterial.prototype, "_imageProcessingConfiguration", void 0);
1187
959
  __decorate([
1188
960
  serialize(),
1189
961
  expandToProperty("_markAllSubMeshesAsMiscDirty")