@onerjs/core 8.26.3 → 8.26.4

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 +0 -6
  4. package/FrameGraph/Tasks/Rendering/objectRendererTask.js.map +1 -1
  5. package/FrameGraph/frameGraphContext.d.ts +1 -2
  6. package/FrameGraph/frameGraphContext.js +1 -4
  7. package/FrameGraph/frameGraphContext.js.map +1 -1
  8. package/Lights/Clustered/clusteredLightContainer.d.ts +1 -1
  9. package/Lights/Clustered/clusteredLightContainer.js +5 -4
  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 +91 -19
  18. package/Materials/Background/backgroundMaterial.js +245 -17
  19. package/Materials/Background/backgroundMaterial.js.map +1 -1
  20. package/Materials/Node/Blocks/Dual/lightBlock.js +4 -15
  21. package/Materials/Node/Blocks/Dual/lightBlock.js.map +1 -1
  22. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +5 -28
  23. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
  24. package/Materials/Node/nodeMaterial.d.ts +69 -57
  25. package/Materials/Node/nodeMaterial.js +86 -9
  26. package/Materials/Node/nodeMaterial.js.map +1 -1
  27. package/Materials/Node/nodeMaterialBuildState.d.ts +1 -3
  28. package/Materials/Node/nodeMaterialBuildState.js +15 -35
  29. package/Materials/Node/nodeMaterialBuildState.js.map +1 -1
  30. package/Materials/PBR/index.d.ts +0 -5
  31. package/Materials/PBR/index.js +0 -5
  32. package/Materials/PBR/index.js.map +1 -1
  33. package/Materials/PBR/pbrBaseMaterial.d.ts +43 -57
  34. package/Materials/PBR/pbrBaseMaterial.js +304 -21
  35. package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
  36. package/Materials/PBR/pbrMaterial.d.ts +78 -0
  37. package/Materials/PBR/pbrMaterial.js +110 -0
  38. package/Materials/PBR/pbrMaterial.js.map +1 -1
  39. package/Materials/imageProcessingConfiguration.defines.d.ts +0 -25
  40. package/Materials/imageProcessingConfiguration.defines.js +0 -27
  41. package/Materials/imageProcessingConfiguration.defines.js.map +1 -1
  42. package/Materials/index.d.ts +0 -2
  43. package/Materials/index.js +0 -2
  44. package/Materials/index.js.map +1 -1
  45. package/Materials/material.d.ts +0 -14
  46. package/Materials/material.js +0 -14
  47. package/Materials/material.js.map +1 -1
  48. package/Materials/materialHelper.functions.d.ts +0 -53
  49. package/Materials/materialHelper.functions.js +0 -297
  50. package/Materials/materialHelper.functions.js.map +1 -1
  51. package/Materials/standardMaterial.d.ts +121 -57
  52. package/Materials/standardMaterial.js +250 -21
  53. package/Materials/standardMaterial.js.map +1 -1
  54. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +0 -1
  55. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
  56. package/Misc/decorators.d.ts +0 -7
  57. package/Misc/decorators.js +0 -34
  58. package/Misc/decorators.js.map +1 -1
  59. package/Particles/Node/Blocks/Emitters/createParticleBlock.js +1 -10
  60. package/Particles/Node/Blocks/Emitters/createParticleBlock.js.map +1 -1
  61. package/Particles/Node/Blocks/index.d.ts +0 -2
  62. package/Particles/Node/Blocks/index.js +0 -2
  63. package/Particles/Node/Blocks/index.js.map +1 -1
  64. package/Particles/Node/Blocks/particleInputBlock.js +1 -4
  65. package/Particles/Node/Blocks/particleInputBlock.js.map +1 -1
  66. package/Rendering/IBLShadows/iblShadowsPluginMaterial.d.ts +1 -2
  67. package/Rendering/IBLShadows/iblShadowsPluginMaterial.js +0 -45
  68. package/Rendering/IBLShadows/iblShadowsPluginMaterial.js.map +1 -1
  69. package/Rendering/IBLShadows/iblShadowsRenderPipeline.js +1 -2
  70. package/Rendering/IBLShadows/iblShadowsRenderPipeline.js.map +1 -1
  71. package/Rendering/geometryBufferRenderer.js +4 -6
  72. package/Rendering/geometryBufferRenderer.js.map +1 -1
  73. package/Rendering/iblCdfGenerator.js +20 -28
  74. package/Rendering/iblCdfGenerator.js.map +1 -1
  75. package/Rendering/reflectiveShadowMap.d.ts +3 -3
  76. package/Shaders/ShadersInclude/backgroundUboDeclaration.js +1 -1
  77. package/Shaders/ShadersInclude/backgroundUboDeclaration.js.map +1 -1
  78. package/Shaders/ShadersInclude/clusteredLightingFunctions.js +1 -3
  79. package/Shaders/ShadersInclude/clusteredLightingFunctions.js.map +1 -1
  80. package/Shaders/ShadersInclude/defaultUboDeclaration.js +1 -1
  81. package/Shaders/ShadersInclude/defaultUboDeclaration.js.map +1 -1
  82. package/Shaders/ShadersInclude/hdrFilteringFunctions.js +0 -34
  83. package/Shaders/ShadersInclude/hdrFilteringFunctions.js.map +1 -1
  84. package/Shaders/ShadersInclude/helperFunctions.js +1 -1
  85. package/Shaders/ShadersInclude/helperFunctions.js.map +1 -1
  86. package/Shaders/ShadersInclude/importanceSampling.js +0 -4
  87. package/Shaders/ShadersInclude/importanceSampling.js.map +1 -1
  88. package/Shaders/ShadersInclude/lightsFragmentFunctions.js +0 -1
  89. package/Shaders/ShadersInclude/lightsFragmentFunctions.js.map +1 -1
  90. package/Shaders/ShadersInclude/pbrBRDFFunctions.js +1 -1
  91. package/Shaders/ShadersInclude/pbrBRDFFunctions.js.map +1 -1
  92. package/Shaders/ShadersInclude/pbrClusteredLightingFunctions.js +0 -1
  93. package/Shaders/ShadersInclude/pbrClusteredLightingFunctions.js.map +1 -1
  94. package/Shaders/ShadersInclude/pbrDirectLightingFunctions.js +1 -3
  95. package/Shaders/ShadersInclude/pbrDirectLightingFunctions.js.map +1 -1
  96. package/Shaders/ShadersInclude/pbrHelperFunctions.js +0 -2
  97. package/Shaders/ShadersInclude/pbrHelperFunctions.js.map +1 -1
  98. package/Shaders/ShadersInclude/pbrUboDeclaration.js +1 -1
  99. package/Shaders/ShadersInclude/pbrUboDeclaration.js.map +1 -1
  100. package/ShadersWGSL/ShadersInclude/backgroundUboDeclaration.js +1 -1
  101. package/ShadersWGSL/ShadersInclude/backgroundUboDeclaration.js.map +1 -1
  102. package/ShadersWGSL/ShadersInclude/defaultUboDeclaration.js +1 -1
  103. package/ShadersWGSL/ShadersInclude/defaultUboDeclaration.js.map +1 -1
  104. package/ShadersWGSL/ShadersInclude/hdrFilteringFunctions.js +0 -28
  105. package/ShadersWGSL/ShadersInclude/hdrFilteringFunctions.js.map +1 -1
  106. package/ShadersWGSL/ShadersInclude/importanceSampling.js +0 -4
  107. package/ShadersWGSL/ShadersInclude/importanceSampling.js.map +1 -1
  108. package/ShadersWGSL/ShadersInclude/pbrBRDFFunctions.js +1 -1
  109. package/ShadersWGSL/ShadersInclude/pbrBRDFFunctions.js.map +1 -1
  110. package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js +1 -3
  111. package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js.map +1 -1
  112. package/ShadersWGSL/ShadersInclude/pbrHelperFunctions.js +0 -2
  113. package/ShadersWGSL/ShadersInclude/pbrHelperFunctions.js.map +1 -1
  114. package/ShadersWGSL/ShadersInclude/pbrUboDeclaration.js +1 -1
  115. package/ShadersWGSL/ShadersInclude/pbrUboDeclaration.js.map +1 -1
  116. package/package.json +1 -1
  117. package/scene.d.ts +0 -21
  118. package/scene.js +3 -29
  119. package/scene.js.map +1 -1
  120. package/Materials/PBR/openPbrMaterial.d.ts +0 -998
  121. package/Materials/PBR/openPbrMaterial.js +0 -2069
  122. package/Materials/PBR/openPbrMaterial.js.map +0 -1
  123. package/Materials/floatingOriginMatrixOverrides.d.ts +0 -3
  124. package/Materials/floatingOriginMatrixOverrides.js +0 -91
  125. package/Materials/floatingOriginMatrixOverrides.js.map +0 -1
  126. package/Materials/imageProcessing.d.ts +0 -65
  127. package/Materials/imageProcessing.js +0 -162
  128. package/Materials/imageProcessing.js.map +0 -1
  129. package/Materials/uv.defines.d.ts +0 -22
  130. package/Materials/uv.defines.js +0 -24
  131. package/Materials/uv.defines.js.map +0 -1
  132. package/Particles/Node/Blocks/particleLocalVariableBlock.d.ts +0 -38
  133. package/Particles/Node/Blocks/particleLocalVariableBlock.js +0 -108
  134. package/Particles/Node/Blocks/particleLocalVariableBlock.js.map +0 -1
  135. package/Particles/Node/Blocks/particleVectorLengthBlock.d.ts +0 -26
  136. package/Particles/Node/Blocks/particleVectorLengthBlock.js +0 -50
  137. package/Particles/Node/Blocks/particleVectorLengthBlock.js.map +0 -1
@@ -1,30 +1,27 @@
1
1
  import { __decorate } from "../../tslib.es6.js";
2
2
  /* eslint-disable @typescript-eslint/naming-convention */
3
- import { serialize, serializeAsColor3, expandToProperty, serializeAsTexture, serializeAsVector3 } from "../../Misc/decorators.js";
3
+ import { serialize, serializeAsColor3, expandToProperty, serializeAsTexture, serializeAsVector3, serializeAsImageProcessingConfiguration } 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";
11
10
  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, BindIBLParameters, BindIBLSamplers, HandleFallbacksForShadows, PrepareAttributesForBones, PrepareAttributesForInstances, PrepareDefinesForAttributes, PrepareDefinesForFrameBoundValues, PrepareDefinesForLights, PrepareDefinesForIBL, PrepareDefinesForMergedUV, PrepareDefinesForMisc, PrepareDefinesForMultiview, PrepareUniformsAndSamplersList, PrepareUniformsAndSamplersForIBL, PrepareUniformLayoutForIBL, } from "../materialHelper.functions.js";
18
+ import { BindBonesParameters, BindFogParameters, BindLights, BindLogDepth, BindTextureMatrix, HandleFallbacksForShadows, PrepareAttributesForBones, PrepareAttributesForInstances, PrepareDefinesForAttributes, PrepareDefinesForFrameBoundValues, PrepareDefinesForLights, PrepareDefinesForMergedUV, PrepareDefinesForMisc, PrepareDefinesForMultiview, PrepareUniformsAndSamplersList, } 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
- }
23
20
  /**
24
21
  * Background material defines definition.
25
22
  * @internal Mainly internal Use
26
23
  */
27
- class BackgroundMaterialDefines extends ImageProcessingDefinesMixin(BackgroundMaterialDefinesBase) {
24
+ class BackgroundMaterialDefines extends MaterialDefines {
28
25
  /**
29
26
  * Constructor of the defines.
30
27
  */
@@ -96,6 +93,22 @@ class BackgroundMaterialDefines extends ImageProcessingDefinesMixin(BackgroundMa
96
93
  * True if ground projection has been enabled.
97
94
  */
98
95
  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;
99
112
  // Reflection.
100
113
  this.REFLECTION = false;
101
114
  this.REFLECTIONMAP_3D = false;
@@ -138,13 +151,11 @@ class BackgroundMaterialDefines extends ImageProcessingDefinesMixin(BackgroundMa
138
151
  this.rebuild();
139
152
  }
140
153
  }
141
- class BackgroundMaterialBase extends ImageProcessingMixin(PushMaterial) {
142
- }
143
154
  /**
144
155
  * Background material used to create an efficient environment around your scene.
145
156
  * #157MGZ: simple test
146
157
  */
147
- export class BackgroundMaterial extends BackgroundMaterialBase {
158
+ export class BackgroundMaterial extends PushMaterial {
148
159
  /**
149
160
  * Experimental Internal Use Only.
150
161
  *
@@ -218,6 +229,143 @@ export class BackgroundMaterial extends BackgroundMaterialBase {
218
229
  }
219
230
  this._fovMultiplier = Math.max(0.0, Math.min(2.0, value));
220
231
  }
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
+ }
221
369
  /**
222
370
  * Instantiates a Background Material in the given scene
223
371
  * @param name The friendly name of the material
@@ -315,6 +463,10 @@ export class BackgroundMaterial extends BackgroundMaterialBase {
315
463
  * Make the material only render shadows
316
464
  */
317
465
  this.shadowOnly = false;
466
+ /**
467
+ * Keep track of the image processing observer to allow dispose and replace.
468
+ */
469
+ this._imageProcessingObserver = null;
318
470
  /**
319
471
  * Due to a bug in iOS10, video tags (which are using the background material) are in BGR and not RGB.
320
472
  * Setting this flag to true (not done automatically!) will convert it back to RGB.
@@ -434,14 +586,53 @@ export class BackgroundMaterial extends BackgroundMaterialBase {
434
586
  defines.OPACITYFRESNEL = false;
435
587
  }
436
588
  const reflectionTexture = this._reflectionTexture;
437
- PrepareDefinesForIBL(scene, reflectionTexture, defines);
438
589
  if (reflectionTexture && MaterialFlags.ReflectionTextureEnabled) {
439
590
  if (!reflectionTexture.isReadyOrNotBlocking()) {
440
591
  return false;
441
592
  }
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;
442
598
  defines.EQUIRECTANGULAR_RELFECTION_FOV = this.useEquirectangularFOV;
443
599
  defines.REFLECTIONBGR = this.switchToBGR;
444
- defines.REFLECTIONBLUR = this._reflectionBlur > 0;
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
+ }
445
636
  if (this.reflectionFresnel) {
446
637
  defines.REFLECTIONFRESNEL = true;
447
638
  defines.REFLECTIONFALLOFF = this.reflectionFalloffDistance > 0;
@@ -456,9 +647,25 @@ export class BackgroundMaterial extends BackgroundMaterialBase {
456
647
  }
457
648
  }
458
649
  else {
650
+ defines.REFLECTION = false;
459
651
  defines.REFLECTIONFRESNEL = false;
460
652
  defines.REFLECTIONFALLOFF = false;
461
653
  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;
462
669
  }
463
670
  }
464
671
  defines.PREMULTIPLYALPHA = this.alphaMode === 7 || this.alphaMode === 8;
@@ -538,6 +745,9 @@ export class BackgroundMaterial extends BackgroundMaterialBase {
538
745
  "mBones",
539
746
  "vPrimaryColor",
540
747
  "vPrimaryColorShadow",
748
+ "vReflectionInfos",
749
+ "reflectionMatrix",
750
+ "vReflectionMicrosurfaceInfos",
541
751
  "fFovMultiplier",
542
752
  "shadowLevel",
543
753
  "alpha",
@@ -549,8 +759,7 @@ export class BackgroundMaterial extends BackgroundMaterialBase {
549
759
  "logarithmicDepthConstant",
550
760
  ];
551
761
  AddClipPlaneUniforms(uniforms);
552
- const samplers = ["diffuseSampler"];
553
- PrepareUniformsAndSamplersForIBL(uniforms, samplers, false);
762
+ const samplers = ["diffuseSampler", "reflectionSampler", "reflectionSamplerLow", "reflectionSamplerHigh"];
554
763
  const uniformBuffers = ["Material", "Scene"];
555
764
  if (ImageProcessingConfiguration) {
556
765
  ImageProcessingConfiguration.PrepareUniforms(uniforms, defines);
@@ -639,7 +848,10 @@ export class BackgroundMaterial extends BackgroundMaterialBase {
639
848
  this._uniformBuffer.addUniform("vPrimaryColor", 4);
640
849
  this._uniformBuffer.addUniform("vPrimaryColorShadow", 4);
641
850
  this._uniformBuffer.addUniform("vDiffuseInfos", 2);
851
+ this._uniformBuffer.addUniform("vReflectionInfos", 2);
642
852
  this._uniformBuffer.addUniform("diffuseMatrix", 16);
853
+ this._uniformBuffer.addUniform("reflectionMatrix", 16);
854
+ this._uniformBuffer.addUniform("vReflectionMicrosurfaceInfos", 3);
643
855
  this._uniformBuffer.addUniform("fFovMultiplier", 1);
644
856
  this._uniformBuffer.addUniform("pointSize", 1);
645
857
  this._uniformBuffer.addUniform("shadowLevel", 1);
@@ -647,7 +859,6 @@ export class BackgroundMaterial extends BackgroundMaterialBase {
647
859
  this._uniformBuffer.addUniform("vBackgroundCenter", 3);
648
860
  this._uniformBuffer.addUniform("vReflectionControl", 4);
649
861
  this._uniformBuffer.addUniform("projectedGroundInfos", 2);
650
- PrepareUniformLayoutForIBL(this._uniformBuffer, true, false, false);
651
862
  this._uniformBuffer.create();
652
863
  }
653
864
  /**
@@ -702,7 +913,11 @@ export class BackgroundMaterial extends BackgroundMaterialBase {
702
913
  this._uniformBuffer.updateFloat2("vDiffuseInfos", this._diffuseTexture.coordinatesIndex, this._diffuseTexture.level);
703
914
  BindTextureMatrix(this._diffuseTexture, this._uniformBuffer, "diffuse");
704
915
  }
705
- BindIBLParameters(scene, defines, this._uniformBuffer, reflectionTexture, false, true);
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
+ }
706
921
  }
707
922
  if (this.shadowLevel > 0) {
708
923
  this._uniformBuffer.updateFloat("shadowLevel", this.shadowLevel);
@@ -727,7 +942,17 @@ export class BackgroundMaterial extends BackgroundMaterialBase {
727
942
  this._uniformBuffer.setTexture("diffuseSampler", this._diffuseTexture);
728
943
  }
729
944
  if (reflectionTexture && MaterialFlags.ReflectionTextureEnabled) {
730
- BindIBLSamplers(scene, defines, this._uniformBuffer, reflectionTexture);
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
+ }
731
956
  if (defines.REFLECTIONFRESNEL) {
732
957
  this._uniformBuffer.updateFloat3("vBackgroundCenter", this.sceneCenter.x, this.sceneCenter.y, this.sceneCenter.z);
733
958
  this._uniformBuffer.updateFloat4("vReflectionControl", this._reflectionControls.x, this._reflectionControls.y, this._reflectionControls.z, this._reflectionControls.w);
@@ -956,6 +1181,9 @@ __decorate([
956
1181
  __decorate([
957
1182
  expandToProperty("_markAllSubMeshesAsLightsDirty")
958
1183
  ], BackgroundMaterial.prototype, "shadowOnly", void 0);
1184
+ __decorate([
1185
+ serializeAsImageProcessingConfiguration()
1186
+ ], BackgroundMaterial.prototype, "_imageProcessingConfiguration", void 0);
959
1187
  __decorate([
960
1188
  serialize(),
961
1189
  expandToProperty("_markAllSubMeshesAsMiscDirty")