@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
@@ -8,52 +8,23 @@ 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";
11
12
  import { ImageProcessingConfiguration } from "./imageProcessingConfiguration.js";
13
+ import type { ColorCurves } from "./colorCurves.js";
12
14
  import type { FresnelParameters } from "./fresnelParameters.js";
13
15
  import { MaterialDefines } from "../Materials/materialDefines.js";
14
16
  import { PushMaterial } from "./pushMaterial.js";
15
17
  import type { BaseTexture } from "../Materials/Textures/baseTexture.js";
16
18
  import type { RenderTargetTexture } from "../Materials/Textures/renderTargetTexture.js";
17
19
  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;
55
20
  /** @internal */
56
- export declare class StandardMaterialDefines extends StandardMaterialDefines_base {
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;
57
28
  DIFFUSE: boolean;
58
29
  DIFFUSEDIRECTUV: number;
59
30
  BAKED_VERTEX_ANIMATION_TEXTURE: boolean;
@@ -93,6 +64,12 @@ export declare class StandardMaterialDefines extends StandardMaterialDefines_bas
93
64
  FRESNEL: boolean;
94
65
  NORMAL: boolean;
95
66
  TANGENT: boolean;
67
+ UV1: boolean;
68
+ UV2: boolean;
69
+ UV3: boolean;
70
+ UV4: boolean;
71
+ UV5: boolean;
72
+ UV6: boolean;
96
73
  VERTEXCOLOR: boolean;
97
74
  VERTEXALPHA: boolean;
98
75
  NUM_BONE_INFLUENCERS: number;
@@ -184,6 +161,20 @@ export declare class StandardMaterialDefines extends StandardMaterialDefines_bas
184
161
  RGBDLIGHTMAP: boolean;
185
162
  RGBDREFLECTION: boolean;
186
163
  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;
187
178
  MULTIVIEW: boolean;
188
179
  ORDER_INDEPENDENT_TRANSPARENCY: boolean;
189
180
  ORDER_INDEPENDENT_TRANSPARENCY_16BITS: boolean;
@@ -201,6 +192,7 @@ export declare class StandardMaterialDefines extends StandardMaterialDefines_bas
201
192
  * @internal
202
193
  */
203
194
  IS_REFRACTION_LINEAR: boolean;
195
+ EXPOSURE: boolean;
204
196
  DECAL_AFTER_DETAIL: boolean;
205
197
  /**
206
198
  * Initializes the Standard Material defines.
@@ -212,30 +204,14 @@ export declare class StandardMaterialDefines extends StandardMaterialDefines_bas
212
204
  default: any;
213
205
  };
214
206
  });
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 {
207
+ setReflectionMode(modeToEnable: string): void;
232
208
  }
233
209
  /**
234
210
  * This is the default material used in Babylon. It is the best trade off between quality
235
211
  * and performances.
236
212
  * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/materials_introduction
237
213
  */
238
- export declare class StandardMaterial extends StandardMaterialBase {
214
+ export declare class StandardMaterial extends PushMaterial {
239
215
  /**
240
216
  * Force all the standard materials to compile to glsl even on WebGPU engines.
241
217
  * False by default. This is mostly meant for backward compatibility.
@@ -466,6 +442,29 @@ export declare class StandardMaterial extends StandardMaterialBase {
466
442
  * If sets to true, the decal map will be applied after the detail map. Else, it is applied before (default: false)
467
443
  */
468
444
  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;
469
468
  private _shadersLoaded;
470
469
  /**
471
470
  * Defines additional PrePass parameters for the material.
@@ -475,6 +474,72 @@ export declare class StandardMaterial extends StandardMaterialBase {
475
474
  * Can this material render to prepass
476
475
  */
477
476
  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>);
478
543
  /**
479
544
  * Can this material render to several textures at once
480
545
  */
@@ -649,4 +714,3 @@ export declare class StandardMaterial extends StandardMaterialBase {
649
714
  static get FresnelEnabled(): boolean;
650
715
  static set FresnelEnabled(value: boolean);
651
716
  }
652
- export {};
@@ -6,33 +6,35 @@ 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";
10
9
  import { ImageProcessingConfiguration } from "./imageProcessingConfiguration.js";
11
10
  import { Material } from "../Materials/material.js";
12
11
  import { MaterialDefines } from "../Materials/materialDefines.js";
13
12
  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, BindIBLParameters, HandleFallbacksForShadows, PrepareAttributesForBakedVertexAnimation, PrepareAttributesForBones, PrepareAttributesForInstances, PrepareAttributesForMorphTargets, PrepareDefinesForAttributes, PrepareDefinesForFrameBoundValues, PrepareDefinesForLights, PrepareDefinesForIBL, PrepareDefinesForMergedUV, PrepareDefinesForMisc, PrepareDefinesForMultiview, PrepareDefinesForOIT, PrepareDefinesForPrePass, PrepareUniformsAndSamplersForIBL, PrepareUniformsAndSamplersList, PrepareUniformLayoutForIBL, } from "./materialHelper.functions.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";
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";
25
23
  const onCreatedEffectParameters = { effect: null, subMesh: null };
26
- class StandardMaterialDefinesBase extends UVDefinesMixin(MaterialDefines) {
27
- }
28
24
  /** @internal */
29
- export class StandardMaterialDefines extends ImageProcessingDefinesMixin(StandardMaterialDefinesBase) {
25
+ export class StandardMaterialDefines extends MaterialDefines {
30
26
  /**
31
27
  * Initializes the Standard Material defines.
32
28
  * @param externalProperties The external properties
33
29
  */
34
30
  constructor(externalProperties) {
35
31
  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;
36
38
  this.DIFFUSE = false;
37
39
  this.DIFFUSEDIRECTUV = 0;
38
40
  this.BAKED_VERTEX_ANIMATION_TEXTURE = false;
@@ -72,6 +74,12 @@ export class StandardMaterialDefines extends ImageProcessingDefinesMixin(Standar
72
74
  this.FRESNEL = false;
73
75
  this.NORMAL = false;
74
76
  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;
75
83
  this.VERTEXCOLOR = false;
76
84
  this.VERTEXALPHA = false;
77
85
  this.NUM_BONE_INFLUENCERS = 0;
@@ -163,6 +171,20 @@ export class StandardMaterialDefines extends ImageProcessingDefinesMixin(Standar
163
171
  this.RGBDLIGHTMAP = false;
164
172
  this.RGBDREFLECTION = false;
165
173
  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;
166
188
  this.MULTIVIEW = false;
167
189
  this.ORDER_INDEPENDENT_TRANSPARENCY = false;
168
190
  this.ORDER_INDEPENDENT_TRANSPARENCY_16BITS = false;
@@ -180,24 +202,176 @@ export class StandardMaterialDefines extends ImageProcessingDefinesMixin(Standar
180
202
  * @internal
181
203
  */
182
204
  this.IS_REFRACTION_LINEAR = false;
205
+ this.EXPOSURE = false;
183
206
  this.DECAL_AFTER_DETAIL = false;
184
207
  this.rebuild();
185
208
  }
186
- }
187
- class StandardMaterialBase extends ImageProcessingMixin(PushMaterial) {
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
+ }
188
226
  }
189
227
  /**
190
228
  * This is the default material used in Babylon. It is the best trade off between quality
191
229
  * and performances.
192
230
  * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/materials_introduction
193
231
  */
194
- export class StandardMaterial extends StandardMaterialBase {
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
+ }
195
275
  /**
196
276
  * Can this material render to prepass
197
277
  */
198
278
  get isPrePassCapable() {
199
279
  return !this.disableDepthWrite;
200
280
  }
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
+ }
201
375
  /**
202
376
  * Can this material render to several textures at once
203
377
  */
@@ -461,15 +635,56 @@ export class StandardMaterial extends StandardMaterialBase {
461
635
  defines.OPACITY = false;
462
636
  }
463
637
  if (this._reflectionTexture && StandardMaterial.ReflectionTextureEnabled) {
464
- defines.ROUGHNESS = this._roughness > 0;
465
- defines.REFLECTIONOVERALPHA = this._useReflectionOverAlpha;
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
+ }
466
684
  }
467
685
  else {
468
- defines.ROUGHNESS = false;
469
- defines.REFLECTIONOVERALPHA = false;
470
- }
471
- if (!PrepareDefinesForIBL(scene, this._reflectionTexture, defines)) {
472
- return false;
686
+ defines.REFLECTION = false;
687
+ defines.REFLECTIONMAP_OPPOSITEZ = false;
473
688
  }
474
689
  if (this._emissiveTexture && StandardMaterial.EmissiveTextureEnabled) {
475
690
  if (!this._emissiveTexture.isReadyOrNotBlocking()) {
@@ -715,6 +930,7 @@ export class StandardMaterial extends StandardMaterialBase {
715
930
  "vDiffuseInfos",
716
931
  "vAmbientInfos",
717
932
  "vOpacityInfos",
933
+ "vReflectionInfos",
718
934
  "vEmissiveInfos",
719
935
  "vSpecularInfos",
720
936
  "vBumpInfos",
@@ -724,6 +940,7 @@ export class StandardMaterial extends StandardMaterialBase {
724
940
  "diffuseMatrix",
725
941
  "ambientMatrix",
726
942
  "opacityMatrix",
943
+ "reflectionMatrix",
727
944
  "emissiveMatrix",
728
945
  "specularMatrix",
729
946
  "bumpMatrix",
@@ -739,6 +956,8 @@ export class StandardMaterial extends StandardMaterialBase {
739
956
  "emissiveRightColor",
740
957
  "refractionLeftColor",
741
958
  "refractionRightColor",
959
+ "vReflectionPosition",
960
+ "vReflectionSize",
742
961
  "vRefractionPosition",
743
962
  "vRefractionSize",
744
963
  "logarithmicDepthConstant",
@@ -768,7 +987,6 @@ export class StandardMaterial extends StandardMaterialBase {
768
987
  "areaLightsLTC1Sampler",
769
988
  "areaLightsLTC2Sampler",
770
989
  ];
771
- PrepareUniformsAndSamplersForIBL(uniforms, samplers, false);
772
990
  const uniformBuffers = ["Material", "Scene", "Mesh"];
773
991
  const indexParameters = { maxSimultaneousLights: this._maxSimultaneousLights, maxSimultaneousMorphTargets: defines.NUM_MORPH_INFLUENCERS };
774
992
  this._eventInfo.fallbacks = fallbacks;
@@ -881,6 +1099,9 @@ export class StandardMaterial extends StandardMaterialBase {
881
1099
  ubo.addUniform("vDiffuseInfos", 2);
882
1100
  ubo.addUniform("vAmbientInfos", 2);
883
1101
  ubo.addUniform("vOpacityInfos", 2);
1102
+ ubo.addUniform("vReflectionInfos", 2);
1103
+ ubo.addUniform("vReflectionPosition", 3);
1104
+ ubo.addUniform("vReflectionSize", 3);
884
1105
  ubo.addUniform("vEmissiveInfos", 2);
885
1106
  ubo.addUniform("vLightmapInfos", 2);
886
1107
  ubo.addUniform("vSpecularInfos", 2);
@@ -888,6 +1109,7 @@ export class StandardMaterial extends StandardMaterialBase {
888
1109
  ubo.addUniform("diffuseMatrix", 16);
889
1110
  ubo.addUniform("ambientMatrix", 16);
890
1111
  ubo.addUniform("opacityMatrix", 16);
1112
+ ubo.addUniform("reflectionMatrix", 16);
891
1113
  ubo.addUniform("emissiveMatrix", 16);
892
1114
  ubo.addUniform("lightmapMatrix", 16);
893
1115
  ubo.addUniform("specularMatrix", 16);
@@ -904,7 +1126,6 @@ export class StandardMaterial extends StandardMaterialBase {
904
1126
  ubo.addUniform("vDiffuseColor", 4);
905
1127
  ubo.addUniform("vAmbientColor", 3);
906
1128
  ubo.addUniform("cameraInfo", 4);
907
- PrepareUniformLayoutForIBL(ubo, false, true);
908
1129
  super.buildUniformLayout();
909
1130
  }
910
1131
  /**
@@ -991,8 +1212,16 @@ export class StandardMaterial extends StandardMaterialBase {
991
1212
  if (this._hasAlphaChannel()) {
992
1213
  ubo.updateFloat("alphaCutOff", this.alphaCutOff);
993
1214
  }
994
- BindIBLParameters(scene, defines, ubo, this._reflectionTexture, false, false, true);
995
- if (!this._reflectionTexture || !StandardMaterial.ReflectionTextureEnabled) {
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 {
996
1225
  ubo.updateFloat2("vReflectionInfos", 0.0, this.roughness);
997
1226
  }
998
1227
  if (this._emissiveTexture && StandardMaterial.EmissiveTextureEnabled) {