@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
@@ -8,23 +8,52 @@ import type { SubMesh } from "../Meshes/subMesh.js";
8
8
  import type { AbstractMesh } from "../Meshes/abstractMesh.js";
9
9
  import type { Mesh } from "../Meshes/mesh.js";
10
10
  import { PrePassConfiguration } from "./prePassConfiguration.js";
11
- import type { IImageProcessingConfigurationDefines } from "./imageProcessingConfiguration.defines.js";
12
11
  import { ImageProcessingConfiguration } from "./imageProcessingConfiguration.js";
13
- import type { ColorCurves } from "./colorCurves.js";
14
12
  import type { FresnelParameters } from "./fresnelParameters.js";
15
13
  import { MaterialDefines } from "../Materials/materialDefines.js";
16
14
  import { PushMaterial } from "./pushMaterial.js";
17
15
  import type { BaseTexture } from "../Materials/Textures/baseTexture.js";
18
16
  import type { RenderTargetTexture } from "../Materials/Textures/renderTargetTexture.js";
19
17
  import { DetailMapConfiguration } from "./material.detailMapConfiguration.js";
18
+ declare const StandardMaterialDefinesBase_base: {
19
+ new (...args: any[]): {
20
+ MAINUV1: boolean;
21
+ MAINUV2: boolean;
22
+ MAINUV3: boolean;
23
+ MAINUV4: boolean;
24
+ MAINUV5: boolean;
25
+ MAINUV6: boolean;
26
+ UV1: boolean;
27
+ UV2: boolean;
28
+ UV3: boolean;
29
+ UV4: boolean;
30
+ UV5: boolean;
31
+ UV6: boolean;
32
+ };
33
+ } & typeof MaterialDefines;
34
+ declare class StandardMaterialDefinesBase extends StandardMaterialDefinesBase_base {
35
+ }
36
+ declare const StandardMaterialDefines_base: {
37
+ new (...args: any[]): {
38
+ IMAGEPROCESSING: boolean;
39
+ VIGNETTE: boolean;
40
+ VIGNETTEBLENDMODEMULTIPLY: boolean;
41
+ VIGNETTEBLENDMODEOPAQUE: boolean;
42
+ TONEMAPPING: number;
43
+ CONTRAST: boolean;
44
+ COLORCURVES: boolean;
45
+ COLORGRADING: boolean;
46
+ COLORGRADING3D: boolean;
47
+ SAMPLER3DGREENDEPTH: boolean;
48
+ SAMPLER3DBGRMAP: boolean;
49
+ DITHER: boolean;
50
+ IMAGEPROCESSINGPOSTPROCESS: boolean;
51
+ SKIPFINALCOLORCLAMP: boolean;
52
+ EXPOSURE: boolean;
53
+ };
54
+ } & typeof StandardMaterialDefinesBase;
20
55
  /** @internal */
21
- export declare class StandardMaterialDefines extends MaterialDefines implements IImageProcessingConfigurationDefines {
22
- MAINUV1: boolean;
23
- MAINUV2: boolean;
24
- MAINUV3: boolean;
25
- MAINUV4: boolean;
26
- MAINUV5: boolean;
27
- MAINUV6: boolean;
56
+ export declare class StandardMaterialDefines extends StandardMaterialDefines_base {
28
57
  DIFFUSE: boolean;
29
58
  DIFFUSEDIRECTUV: number;
30
59
  BAKED_VERTEX_ANIMATION_TEXTURE: boolean;
@@ -64,12 +93,6 @@ export declare class StandardMaterialDefines extends MaterialDefines implements
64
93
  FRESNEL: boolean;
65
94
  NORMAL: boolean;
66
95
  TANGENT: boolean;
67
- UV1: boolean;
68
- UV2: boolean;
69
- UV3: boolean;
70
- UV4: boolean;
71
- UV5: boolean;
72
- UV6: boolean;
73
96
  VERTEXCOLOR: boolean;
74
97
  VERTEXALPHA: boolean;
75
98
  NUM_BONE_INFLUENCERS: number;
@@ -161,20 +184,6 @@ export declare class StandardMaterialDefines extends MaterialDefines implements
161
184
  RGBDLIGHTMAP: boolean;
162
185
  RGBDREFLECTION: boolean;
163
186
  RGBDREFRACTION: boolean;
164
- IMAGEPROCESSING: boolean;
165
- VIGNETTE: boolean;
166
- VIGNETTEBLENDMODEMULTIPLY: boolean;
167
- VIGNETTEBLENDMODEOPAQUE: boolean;
168
- TONEMAPPING: number;
169
- CONTRAST: boolean;
170
- COLORCURVES: boolean;
171
- COLORGRADING: boolean;
172
- COLORGRADING3D: boolean;
173
- SAMPLER3DGREENDEPTH: boolean;
174
- SAMPLER3DBGRMAP: boolean;
175
- DITHER: boolean;
176
- IMAGEPROCESSINGPOSTPROCESS: boolean;
177
- SKIPFINALCOLORCLAMP: boolean;
178
187
  MULTIVIEW: boolean;
179
188
  ORDER_INDEPENDENT_TRANSPARENCY: boolean;
180
189
  ORDER_INDEPENDENT_TRANSPARENCY_16BITS: boolean;
@@ -192,7 +201,6 @@ export declare class StandardMaterialDefines extends MaterialDefines implements
192
201
  * @internal
193
202
  */
194
203
  IS_REFRACTION_LINEAR: boolean;
195
- EXPOSURE: boolean;
196
204
  DECAL_AFTER_DETAIL: boolean;
197
205
  /**
198
206
  * Initializes the Standard Material defines.
@@ -204,14 +212,30 @@ export declare class StandardMaterialDefines extends MaterialDefines implements
204
212
  default: any;
205
213
  };
206
214
  });
207
- setReflectionMode(modeToEnable: string): void;
215
+ }
216
+ declare const StandardMaterialBase_base: {
217
+ new (...args: any[]): {
218
+ _imageProcessingConfiguration: ImageProcessingConfiguration;
219
+ imageProcessingConfiguration: ImageProcessingConfiguration;
220
+ _imageProcessingObserver: Nullable<import("../index.js").Observer<ImageProcessingConfiguration>>;
221
+ _attachImageProcessingConfiguration(configuration: Nullable<ImageProcessingConfiguration>): void;
222
+ cameraColorCurvesEnabled: boolean;
223
+ cameraColorGradingEnabled: boolean;
224
+ cameraToneMappingEnabled: boolean;
225
+ cameraExposure: number;
226
+ cameraContrast: number;
227
+ cameraColorGradingTexture: Nullable<BaseTexture>;
228
+ cameraColorCurves: Nullable<import("./colorCurves.js").ColorCurves>;
229
+ };
230
+ } & typeof PushMaterial;
231
+ declare class StandardMaterialBase extends StandardMaterialBase_base {
208
232
  }
209
233
  /**
210
234
  * This is the default material used in Babylon. It is the best trade off between quality
211
235
  * and performances.
212
236
  * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/materials_introduction
213
237
  */
214
- export declare class StandardMaterial extends PushMaterial {
238
+ export declare class StandardMaterial extends StandardMaterialBase {
215
239
  /**
216
240
  * Force all the standard materials to compile to glsl even on WebGPU engines.
217
241
  * False by default. This is mostly meant for backward compatibility.
@@ -442,29 +466,6 @@ export declare class StandardMaterial extends PushMaterial {
442
466
  * If sets to true, the decal map will be applied after the detail map. Else, it is applied before (default: false)
443
467
  */
444
468
  applyDecalMapAfterDetailMap: boolean;
445
- /**
446
- * Default configuration related to image processing available in the standard Material.
447
- */
448
- protected _imageProcessingConfiguration: ImageProcessingConfiguration;
449
- /**
450
- * Gets the image processing configuration used either in this material.
451
- */
452
- get imageProcessingConfiguration(): ImageProcessingConfiguration;
453
- /**
454
- * Sets the Default image processing configuration used either in the this material.
455
- *
456
- * If sets to null, the scene one is in use.
457
- */
458
- set imageProcessingConfiguration(value: ImageProcessingConfiguration);
459
- /**
460
- * Keep track of the image processing observer to allow dispose and replace.
461
- */
462
- private _imageProcessingObserver;
463
- /**
464
- * Attaches a new image processing configuration to the Standard Material.
465
- * @param configuration
466
- */
467
- protected _attachImageProcessingConfiguration(configuration: Nullable<ImageProcessingConfiguration>): void;
468
469
  private _shadersLoaded;
469
470
  /**
470
471
  * Defines additional PrePass parameters for the material.
@@ -474,72 +475,6 @@ export declare class StandardMaterial extends PushMaterial {
474
475
  * Can this material render to prepass
475
476
  */
476
477
  get isPrePassCapable(): boolean;
477
- /**
478
- * Gets whether the color curves effect is enabled.
479
- */
480
- get cameraColorCurvesEnabled(): boolean;
481
- /**
482
- * Sets whether the color curves effect is enabled.
483
- */
484
- set cameraColorCurvesEnabled(value: boolean);
485
- /**
486
- * Gets whether the color grading effect is enabled.
487
- */
488
- get cameraColorGradingEnabled(): boolean;
489
- /**
490
- * Gets whether the color grading effect is enabled.
491
- */
492
- set cameraColorGradingEnabled(value: boolean);
493
- /**
494
- * Gets whether tonemapping is enabled or not.
495
- */
496
- get cameraToneMappingEnabled(): boolean;
497
- /**
498
- * Sets whether tonemapping is enabled or not
499
- */
500
- set cameraToneMappingEnabled(value: boolean);
501
- /**
502
- * The camera exposure used on this material.
503
- * This property is here and not in the camera to allow controlling exposure without full screen post process.
504
- * This corresponds to a photographic exposure.
505
- */
506
- get cameraExposure(): number;
507
- /**
508
- * The camera exposure used on this material.
509
- * This property is here and not in the camera to allow controlling exposure without full screen post process.
510
- * This corresponds to a photographic exposure.
511
- */
512
- set cameraExposure(value: number);
513
- /**
514
- * Gets The camera contrast used on this material.
515
- */
516
- get cameraContrast(): number;
517
- /**
518
- * Sets The camera contrast used on this material.
519
- */
520
- set cameraContrast(value: number);
521
- /**
522
- * Gets the Color Grading 2D Lookup Texture.
523
- */
524
- get cameraColorGradingTexture(): Nullable<BaseTexture>;
525
- /**
526
- * Sets the Color Grading 2D Lookup Texture.
527
- */
528
- set cameraColorGradingTexture(value: Nullable<BaseTexture>);
529
- /**
530
- * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).
531
- * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.
532
- * 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;
533
- * corresponding to low luminance, medium luminance, and high luminance areas respectively.
534
- */
535
- get cameraColorCurves(): Nullable<ColorCurves>;
536
- /**
537
- * The color grading curves provide additional color adjustment that is applied after any color grading transform (3D LUT).
538
- * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.
539
- * 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;
540
- * corresponding to low luminance, medium luminance, and high luminance areas respectively.
541
- */
542
- set cameraColorCurves(value: Nullable<ColorCurves>);
543
478
  /**
544
479
  * Can this material render to several textures at once
545
480
  */
@@ -714,3 +649,4 @@ export declare class StandardMaterial extends PushMaterial {
714
649
  static get FresnelEnabled(): boolean;
715
650
  static set FresnelEnabled(value: boolean);
716
651
  }
652
+ export {};
@@ -6,35 +6,33 @@ import { Scene } from "../scene.js";
6
6
  import { Color3 } from "../Maths/math.color.js";
7
7
  import { VertexBuffer } from "../Buffers/buffer.js";
8
8
  import { PrePassConfiguration } from "./prePassConfiguration.js";
9
+ import { ImageProcessingDefinesMixin } from "./imageProcessingConfiguration.defines.js";
9
10
  import { ImageProcessingConfiguration } from "./imageProcessingConfiguration.js";
10
11
  import { Material } from "../Materials/material.js";
11
12
  import { MaterialDefines } from "../Materials/materialDefines.js";
12
13
  import { PushMaterial } from "./pushMaterial.js";
13
- import { Texture } from "../Materials/Textures/texture.js";
14
14
  import { RegisterClass } from "../Misc/typeStore.js";
15
15
  import { MaterialFlags } from "./materialFlags.js";
16
16
 
17
17
  import { EffectFallbacks } from "./effectFallbacks.js";
18
18
  import { DetailMapConfiguration } from "./material.detailMapConfiguration.js";
19
19
  import { AddClipPlaneUniforms, BindClipPlane } from "./clipPlaneMaterialHelper.js";
20
- import { BindBonesParameters, BindFogParameters, BindLights, BindLogDepth, BindMorphTargetParameters, BindTextureMatrix, HandleFallbacksForShadows, PrepareAttributesForBakedVertexAnimation, PrepareAttributesForBones, PrepareAttributesForInstances, PrepareAttributesForMorphTargets, PrepareDefinesForAttributes, PrepareDefinesForFrameBoundValues, PrepareDefinesForLights, PrepareDefinesForMergedUV, PrepareDefinesForMisc, PrepareDefinesForMultiview, PrepareDefinesForOIT, PrepareDefinesForPrePass, PrepareUniformsAndSamplersList, } from "./materialHelper.functions.js";
20
+ import { BindBonesParameters, BindFogParameters, BindLights, BindLogDepth, BindMorphTargetParameters, BindTextureMatrix, BindIBLParameters, HandleFallbacksForShadows, PrepareAttributesForBakedVertexAnimation, PrepareAttributesForBones, PrepareAttributesForInstances, PrepareAttributesForMorphTargets, PrepareDefinesForAttributes, PrepareDefinesForFrameBoundValues, PrepareDefinesForLights, PrepareDefinesForIBL, PrepareDefinesForMergedUV, PrepareDefinesForMisc, PrepareDefinesForMultiview, PrepareDefinesForOIT, PrepareDefinesForPrePass, PrepareUniformsAndSamplersForIBL, PrepareUniformsAndSamplersList, PrepareUniformLayoutForIBL, } from "./materialHelper.functions.js";
21
21
  import { SerializationHelper } from "../Misc/decorators.serialization.js";
22
22
  import { MaterialHelperGeometryRendering } from "./materialHelper.geometryrendering.js";
23
+ import { UVDefinesMixin } from "./uv.defines.js";
24
+ import { ImageProcessingMixin } from "./imageProcessing.js";
23
25
  const onCreatedEffectParameters = { effect: null, subMesh: null };
26
+ class StandardMaterialDefinesBase extends UVDefinesMixin(MaterialDefines) {
27
+ }
24
28
  /** @internal */
25
- export class StandardMaterialDefines extends MaterialDefines {
29
+ export class StandardMaterialDefines extends ImageProcessingDefinesMixin(StandardMaterialDefinesBase) {
26
30
  /**
27
31
  * Initializes the Standard Material defines.
28
32
  * @param externalProperties The external properties
29
33
  */
30
34
  constructor(externalProperties) {
31
35
  super(externalProperties);
32
- this.MAINUV1 = false;
33
- this.MAINUV2 = false;
34
- this.MAINUV3 = false;
35
- this.MAINUV4 = false;
36
- this.MAINUV5 = false;
37
- this.MAINUV6 = false;
38
36
  this.DIFFUSE = false;
39
37
  this.DIFFUSEDIRECTUV = 0;
40
38
  this.BAKED_VERTEX_ANIMATION_TEXTURE = false;
@@ -74,12 +72,6 @@ export class StandardMaterialDefines extends MaterialDefines {
74
72
  this.FRESNEL = false;
75
73
  this.NORMAL = false;
76
74
  this.TANGENT = false;
77
- this.UV1 = false;
78
- this.UV2 = false;
79
- this.UV3 = false;
80
- this.UV4 = false;
81
- this.UV5 = false;
82
- this.UV6 = false;
83
75
  this.VERTEXCOLOR = false;
84
76
  this.VERTEXALPHA = false;
85
77
  this.NUM_BONE_INFLUENCERS = 0;
@@ -171,20 +163,6 @@ export class StandardMaterialDefines extends MaterialDefines {
171
163
  this.RGBDLIGHTMAP = false;
172
164
  this.RGBDREFLECTION = false;
173
165
  this.RGBDREFRACTION = false;
174
- this.IMAGEPROCESSING = false;
175
- this.VIGNETTE = false;
176
- this.VIGNETTEBLENDMODEMULTIPLY = false;
177
- this.VIGNETTEBLENDMODEOPAQUE = false;
178
- this.TONEMAPPING = 0;
179
- this.CONTRAST = false;
180
- this.COLORCURVES = false;
181
- this.COLORGRADING = false;
182
- this.COLORGRADING3D = false;
183
- this.SAMPLER3DGREENDEPTH = false;
184
- this.SAMPLER3DBGRMAP = false;
185
- this.DITHER = false;
186
- this.IMAGEPROCESSINGPOSTPROCESS = false;
187
- this.SKIPFINALCOLORCLAMP = false;
188
166
  this.MULTIVIEW = false;
189
167
  this.ORDER_INDEPENDENT_TRANSPARENCY = false;
190
168
  this.ORDER_INDEPENDENT_TRANSPARENCY_16BITS = false;
@@ -202,176 +180,24 @@ export class StandardMaterialDefines extends MaterialDefines {
202
180
  * @internal
203
181
  */
204
182
  this.IS_REFRACTION_LINEAR = false;
205
- this.EXPOSURE = false;
206
183
  this.DECAL_AFTER_DETAIL = false;
207
184
  this.rebuild();
208
185
  }
209
- setReflectionMode(modeToEnable) {
210
- const modes = [
211
- "REFLECTIONMAP_CUBIC",
212
- "REFLECTIONMAP_EXPLICIT",
213
- "REFLECTIONMAP_PLANAR",
214
- "REFLECTIONMAP_PROJECTION",
215
- "REFLECTIONMAP_PROJECTION",
216
- "REFLECTIONMAP_SKYBOX",
217
- "REFLECTIONMAP_SPHERICAL",
218
- "REFLECTIONMAP_EQUIRECTANGULAR",
219
- "REFLECTIONMAP_EQUIRECTANGULAR_FIXED",
220
- "REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED",
221
- ];
222
- for (const mode of modes) {
223
- this[mode] = mode === modeToEnable;
224
- }
225
- }
186
+ }
187
+ class StandardMaterialBase extends ImageProcessingMixin(PushMaterial) {
226
188
  }
227
189
  /**
228
190
  * This is the default material used in Babylon. It is the best trade off between quality
229
191
  * and performances.
230
192
  * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/materials_introduction
231
193
  */
232
- export class StandardMaterial extends PushMaterial {
233
- /**
234
- * Gets the image processing configuration used either in this material.
235
- */
236
- get imageProcessingConfiguration() {
237
- return this._imageProcessingConfiguration;
238
- }
239
- /**
240
- * Sets the Default image processing configuration used either in the this material.
241
- *
242
- * If sets to null, the scene one is in use.
243
- */
244
- set imageProcessingConfiguration(value) {
245
- this._attachImageProcessingConfiguration(value);
246
- // Ensure the effect will be rebuilt.
247
- this._markAllSubMeshesAsImageProcessingDirty();
248
- }
249
- /**
250
- * Attaches a new image processing configuration to the Standard Material.
251
- * @param configuration
252
- */
253
- _attachImageProcessingConfiguration(configuration) {
254
- if (configuration === this._imageProcessingConfiguration) {
255
- return;
256
- }
257
- // Detaches observer
258
- if (this._imageProcessingConfiguration && this._imageProcessingObserver) {
259
- this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver);
260
- }
261
- // Pick the scene configuration if needed
262
- if (!configuration) {
263
- this._imageProcessingConfiguration = this.getScene().imageProcessingConfiguration;
264
- }
265
- else {
266
- this._imageProcessingConfiguration = configuration;
267
- }
268
- // Attaches observer
269
- if (this._imageProcessingConfiguration) {
270
- this._imageProcessingObserver = this._imageProcessingConfiguration.onUpdateParameters.add(() => {
271
- this._markAllSubMeshesAsImageProcessingDirty();
272
- });
273
- }
274
- }
194
+ export class StandardMaterial extends StandardMaterialBase {
275
195
  /**
276
196
  * Can this material render to prepass
277
197
  */
278
198
  get isPrePassCapable() {
279
199
  return !this.disableDepthWrite;
280
200
  }
281
- /**
282
- * Gets whether the color curves effect is enabled.
283
- */
284
- get cameraColorCurvesEnabled() {
285
- return this.imageProcessingConfiguration.colorCurvesEnabled;
286
- }
287
- /**
288
- * Sets whether the color curves effect is enabled.
289
- */
290
- set cameraColorCurvesEnabled(value) {
291
- this.imageProcessingConfiguration.colorCurvesEnabled = value;
292
- }
293
- /**
294
- * Gets whether the color grading effect is enabled.
295
- */
296
- get cameraColorGradingEnabled() {
297
- return this.imageProcessingConfiguration.colorGradingEnabled;
298
- }
299
- /**
300
- * Gets whether the color grading effect is enabled.
301
- */
302
- set cameraColorGradingEnabled(value) {
303
- this.imageProcessingConfiguration.colorGradingEnabled = value;
304
- }
305
- /**
306
- * Gets whether tonemapping is enabled or not.
307
- */
308
- get cameraToneMappingEnabled() {
309
- return this._imageProcessingConfiguration.toneMappingEnabled;
310
- }
311
- /**
312
- * Sets whether tonemapping is enabled or not
313
- */
314
- set cameraToneMappingEnabled(value) {
315
- this._imageProcessingConfiguration.toneMappingEnabled = value;
316
- }
317
- /**
318
- * The camera exposure used on this material.
319
- * This property is here and not in the camera to allow controlling exposure without full screen post process.
320
- * This corresponds to a photographic exposure.
321
- */
322
- get cameraExposure() {
323
- return this._imageProcessingConfiguration.exposure;
324
- }
325
- /**
326
- * The camera exposure used on this material.
327
- * This property is here and not in the camera to allow controlling exposure without full screen post process.
328
- * This corresponds to a photographic exposure.
329
- */
330
- set cameraExposure(value) {
331
- this._imageProcessingConfiguration.exposure = value;
332
- }
333
- /**
334
- * Gets The camera contrast used on this material.
335
- */
336
- get cameraContrast() {
337
- return this._imageProcessingConfiguration.contrast;
338
- }
339
- /**
340
- * Sets The camera contrast used on this material.
341
- */
342
- set cameraContrast(value) {
343
- this._imageProcessingConfiguration.contrast = value;
344
- }
345
- /**
346
- * Gets the Color Grading 2D Lookup Texture.
347
- */
348
- get cameraColorGradingTexture() {
349
- return this._imageProcessingConfiguration.colorGradingTexture;
350
- }
351
- /**
352
- * Sets the Color Grading 2D Lookup Texture.
353
- */
354
- set cameraColorGradingTexture(value) {
355
- this._imageProcessingConfiguration.colorGradingTexture = value;
356
- }
357
- /**
358
- * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).
359
- * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.
360
- * 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;
361
- * corresponding to low luminance, medium luminance, and high luminance areas respectively.
362
- */
363
- get cameraColorCurves() {
364
- return this._imageProcessingConfiguration.colorCurves;
365
- }
366
- /**
367
- * The color grading curves provide additional color adjustment that is applied after any color grading transform (3D LUT).
368
- * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.
369
- * 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;
370
- * corresponding to low luminance, medium luminance, and high luminance areas respectively.
371
- */
372
- set cameraColorCurves(value) {
373
- this._imageProcessingConfiguration.colorCurves = value;
374
- }
375
201
  /**
376
202
  * Can this material render to several textures at once
377
203
  */
@@ -635,56 +461,15 @@ export class StandardMaterial extends PushMaterial {
635
461
  defines.OPACITY = false;
636
462
  }
637
463
  if (this._reflectionTexture && StandardMaterial.ReflectionTextureEnabled) {
638
- if (!this._reflectionTexture.isReadyOrNotBlocking()) {
639
- return false;
640
- }
641
- else {
642
- defines._needNormals = true;
643
- defines.REFLECTION = true;
644
- defines.ROUGHNESS = this._roughness > 0;
645
- defines.REFLECTIONOVERALPHA = this._useReflectionOverAlpha;
646
- defines.INVERTCUBICMAP = this._reflectionTexture.coordinatesMode === Texture.INVCUBIC_MODE;
647
- defines.REFLECTIONMAP_3D = this._reflectionTexture.isCube;
648
- defines.REFLECTIONMAP_OPPOSITEZ =
649
- defines.REFLECTIONMAP_3D && this.getScene().useRightHandedSystem ? !this._reflectionTexture.invertZ : this._reflectionTexture.invertZ;
650
- defines.RGBDREFLECTION = this._reflectionTexture.isRGBD;
651
- switch (this._reflectionTexture.coordinatesMode) {
652
- case Texture.EXPLICIT_MODE:
653
- defines.setReflectionMode("REFLECTIONMAP_EXPLICIT");
654
- break;
655
- case Texture.PLANAR_MODE:
656
- defines.setReflectionMode("REFLECTIONMAP_PLANAR");
657
- break;
658
- case Texture.PROJECTION_MODE:
659
- defines.setReflectionMode("REFLECTIONMAP_PROJECTION");
660
- break;
661
- case Texture.SKYBOX_MODE:
662
- defines.setReflectionMode("REFLECTIONMAP_SKYBOX");
663
- break;
664
- case Texture.SPHERICAL_MODE:
665
- defines.setReflectionMode("REFLECTIONMAP_SPHERICAL");
666
- break;
667
- case Texture.EQUIRECTANGULAR_MODE:
668
- defines.setReflectionMode("REFLECTIONMAP_EQUIRECTANGULAR");
669
- break;
670
- case Texture.FIXED_EQUIRECTANGULAR_MODE:
671
- defines.setReflectionMode("REFLECTIONMAP_EQUIRECTANGULAR_FIXED");
672
- break;
673
- case Texture.FIXED_EQUIRECTANGULAR_MIRRORED_MODE:
674
- defines.setReflectionMode("REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED");
675
- break;
676
- case Texture.CUBIC_MODE:
677
- case Texture.INVCUBIC_MODE:
678
- default:
679
- defines.setReflectionMode("REFLECTIONMAP_CUBIC");
680
- break;
681
- }
682
- defines.USE_LOCAL_REFLECTIONMAP_CUBIC = this._reflectionTexture.boundingBoxSize ? true : false;
683
- }
464
+ defines.ROUGHNESS = this._roughness > 0;
465
+ defines.REFLECTIONOVERALPHA = this._useReflectionOverAlpha;
684
466
  }
685
467
  else {
686
- defines.REFLECTION = false;
687
- defines.REFLECTIONMAP_OPPOSITEZ = false;
468
+ defines.ROUGHNESS = false;
469
+ defines.REFLECTIONOVERALPHA = false;
470
+ }
471
+ if (!PrepareDefinesForIBL(scene, this._reflectionTexture, defines)) {
472
+ return false;
688
473
  }
689
474
  if (this._emissiveTexture && StandardMaterial.EmissiveTextureEnabled) {
690
475
  if (!this._emissiveTexture.isReadyOrNotBlocking()) {
@@ -930,7 +715,6 @@ export class StandardMaterial extends PushMaterial {
930
715
  "vDiffuseInfos",
931
716
  "vAmbientInfos",
932
717
  "vOpacityInfos",
933
- "vReflectionInfos",
934
718
  "vEmissiveInfos",
935
719
  "vSpecularInfos",
936
720
  "vBumpInfos",
@@ -940,7 +724,6 @@ export class StandardMaterial extends PushMaterial {
940
724
  "diffuseMatrix",
941
725
  "ambientMatrix",
942
726
  "opacityMatrix",
943
- "reflectionMatrix",
944
727
  "emissiveMatrix",
945
728
  "specularMatrix",
946
729
  "bumpMatrix",
@@ -956,8 +739,6 @@ export class StandardMaterial extends PushMaterial {
956
739
  "emissiveRightColor",
957
740
  "refractionLeftColor",
958
741
  "refractionRightColor",
959
- "vReflectionPosition",
960
- "vReflectionSize",
961
742
  "vRefractionPosition",
962
743
  "vRefractionSize",
963
744
  "logarithmicDepthConstant",
@@ -987,6 +768,7 @@ export class StandardMaterial extends PushMaterial {
987
768
  "areaLightsLTC1Sampler",
988
769
  "areaLightsLTC2Sampler",
989
770
  ];
771
+ PrepareUniformsAndSamplersForIBL(uniforms, samplers, false);
990
772
  const uniformBuffers = ["Material", "Scene", "Mesh"];
991
773
  const indexParameters = { maxSimultaneousLights: this._maxSimultaneousLights, maxSimultaneousMorphTargets: defines.NUM_MORPH_INFLUENCERS };
992
774
  this._eventInfo.fallbacks = fallbacks;
@@ -1099,9 +881,6 @@ export class StandardMaterial extends PushMaterial {
1099
881
  ubo.addUniform("vDiffuseInfos", 2);
1100
882
  ubo.addUniform("vAmbientInfos", 2);
1101
883
  ubo.addUniform("vOpacityInfos", 2);
1102
- ubo.addUniform("vReflectionInfos", 2);
1103
- ubo.addUniform("vReflectionPosition", 3);
1104
- ubo.addUniform("vReflectionSize", 3);
1105
884
  ubo.addUniform("vEmissiveInfos", 2);
1106
885
  ubo.addUniform("vLightmapInfos", 2);
1107
886
  ubo.addUniform("vSpecularInfos", 2);
@@ -1109,7 +888,6 @@ export class StandardMaterial extends PushMaterial {
1109
888
  ubo.addUniform("diffuseMatrix", 16);
1110
889
  ubo.addUniform("ambientMatrix", 16);
1111
890
  ubo.addUniform("opacityMatrix", 16);
1112
- ubo.addUniform("reflectionMatrix", 16);
1113
891
  ubo.addUniform("emissiveMatrix", 16);
1114
892
  ubo.addUniform("lightmapMatrix", 16);
1115
893
  ubo.addUniform("specularMatrix", 16);
@@ -1126,6 +904,7 @@ export class StandardMaterial extends PushMaterial {
1126
904
  ubo.addUniform("vDiffuseColor", 4);
1127
905
  ubo.addUniform("vAmbientColor", 3);
1128
906
  ubo.addUniform("cameraInfo", 4);
907
+ PrepareUniformLayoutForIBL(ubo, false, true);
1129
908
  super.buildUniformLayout();
1130
909
  }
1131
910
  /**
@@ -1212,16 +991,8 @@ export class StandardMaterial extends PushMaterial {
1212
991
  if (this._hasAlphaChannel()) {
1213
992
  ubo.updateFloat("alphaCutOff", this.alphaCutOff);
1214
993
  }
1215
- if (this._reflectionTexture && StandardMaterial.ReflectionTextureEnabled) {
1216
- ubo.updateFloat2("vReflectionInfos", this._reflectionTexture.level, this.roughness);
1217
- ubo.updateMatrix("reflectionMatrix", this._reflectionTexture.getReflectionTextureMatrix());
1218
- if (this._reflectionTexture.boundingBoxSize) {
1219
- const cubeTexture = this._reflectionTexture;
1220
- ubo.updateVector3("vReflectionPosition", cubeTexture.boundingBoxPosition);
1221
- ubo.updateVector3("vReflectionSize", cubeTexture.boundingBoxSize);
1222
- }
1223
- }
1224
- else {
994
+ BindIBLParameters(scene, defines, ubo, this._reflectionTexture, false, false, true);
995
+ if (!this._reflectionTexture || !StandardMaterial.ReflectionTextureEnabled) {
1225
996
  ubo.updateFloat2("vReflectionInfos", 0.0, this.roughness);
1226
997
  }
1227
998
  if (this._emissiveTexture && StandardMaterial.EmissiveTextureEnabled) {