@babylonjs/core 8.1.1 → 8.2.0

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 (102) hide show
  1. package/AudioV2/abstractAudio/abstractSound.js +1 -1
  2. package/AudioV2/abstractAudio/abstractSound.js.map +1 -1
  3. package/Culling/ray.core.d.ts +1 -1
  4. package/Culling/ray.core.js +1 -1
  5. package/Culling/ray.core.js.map +1 -1
  6. package/Debug/debugLayer.js +8 -1
  7. package/Debug/debugLayer.js.map +1 -1
  8. package/Engines/abstractEngine.js +2 -2
  9. package/Engines/abstractEngine.js.map +1 -1
  10. package/FrameGraph/Node/Blocks/PostProcesses/imageProcessingPostProcessBlock.d.ts +71 -0
  11. package/FrameGraph/Node/Blocks/PostProcesses/imageProcessingPostProcessBlock.js +246 -0
  12. package/FrameGraph/Node/Blocks/PostProcesses/imageProcessingPostProcessBlock.js.map +1 -0
  13. package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.d.ts +1 -1
  14. package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js +4 -4
  15. package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js.map +1 -1
  16. package/FrameGraph/Node/Blocks/index.d.ts +1 -0
  17. package/FrameGraph/Node/Blocks/index.js +1 -0
  18. package/FrameGraph/Node/Blocks/index.js.map +1 -1
  19. package/FrameGraph/Tasks/PostProcesses/imageProcessingTask.d.ts +17 -0
  20. package/FrameGraph/Tasks/PostProcesses/imageProcessingTask.js +23 -0
  21. package/FrameGraph/Tasks/PostProcesses/imageProcessingTask.js.map +1 -0
  22. package/FrameGraph/Tasks/Rendering/objectRendererTask.d.ts +3 -2
  23. package/FrameGraph/Tasks/Rendering/objectRendererTask.js +5 -4
  24. package/FrameGraph/Tasks/Rendering/objectRendererTask.js.map +1 -1
  25. package/FrameGraph/Tasks/Rendering/taaObjectRendererTask.js +1 -1
  26. package/FrameGraph/Tasks/Rendering/taaObjectRendererTask.js.map +1 -1
  27. package/FrameGraph/index.d.ts +1 -0
  28. package/FrameGraph/index.js +1 -0
  29. package/FrameGraph/index.js.map +1 -1
  30. package/Materials/Node/Blocks/Dual/lightBlock.js +6 -3
  31. package/Materials/Node/Blocks/Dual/lightBlock.js.map +1 -1
  32. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +4 -2
  33. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
  34. package/Materials/PBR/pbrBaseMaterial.js +2 -1
  35. package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
  36. package/Materials/PBR/pbrSubSurfaceConfiguration.d.ts +13 -0
  37. package/Materials/PBR/pbrSubSurfaceConfiguration.js +17 -0
  38. package/Materials/PBR/pbrSubSurfaceConfiguration.js.map +1 -1
  39. package/Materials/Textures/renderTargetTexture.d.ts +4 -3
  40. package/Materials/Textures/renderTargetTexture.js +6 -5
  41. package/Materials/Textures/renderTargetTexture.js.map +1 -1
  42. package/Materials/Textures/texture.js +3 -2
  43. package/Materials/Textures/texture.js.map +1 -1
  44. package/Materials/imageProcessingConfiguration.d.ts +8 -0
  45. package/Materials/imageProcessingConfiguration.js +16 -2
  46. package/Materials/imageProcessingConfiguration.js.map +1 -1
  47. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +15 -6
  48. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
  49. package/Misc/fileTools.d.ts +6 -0
  50. package/Misc/fileTools.js +30 -0
  51. package/Misc/fileTools.js.map +1 -1
  52. package/Physics/v2/characterController.d.ts +5 -0
  53. package/Physics/v2/characterController.js +7 -0
  54. package/Physics/v2/characterController.js.map +1 -1
  55. package/PostProcesses/imageProcessingPostProcess.d.ts +4 -21
  56. package/PostProcesses/imageProcessingPostProcess.js +27 -138
  57. package/PostProcesses/imageProcessingPostProcess.js.map +1 -1
  58. package/PostProcesses/index.d.ts +1 -0
  59. package/PostProcesses/index.js +1 -0
  60. package/PostProcesses/index.js.map +1 -1
  61. package/PostProcesses/thinChromaticAberrationPostProcess.d.ts +2 -2
  62. package/PostProcesses/thinChromaticAberrationPostProcess.js.map +1 -1
  63. package/PostProcesses/thinImageProcessingPostProcess.d.ts +258 -0
  64. package/PostProcesses/thinImageProcessingPostProcess.js +462 -0
  65. package/PostProcesses/thinImageProcessingPostProcess.js.map +1 -0
  66. package/Rendering/objectRenderer.d.ts +5 -5
  67. package/Rendering/objectRenderer.js +11 -11
  68. package/Rendering/objectRenderer.js.map +1 -1
  69. package/Shaders/ShadersInclude/lightFragment.js +10 -7
  70. package/Shaders/ShadersInclude/lightFragment.js.map +1 -1
  71. package/Shaders/ShadersInclude/pbrBRDFFunctions.js +5 -1
  72. package/Shaders/ShadersInclude/pbrBRDFFunctions.js.map +1 -1
  73. package/Shaders/ShadersInclude/pbrBlockDirectLighting.js +1 -1
  74. package/Shaders/ShadersInclude/pbrBlockDirectLighting.js.map +1 -1
  75. package/Shaders/ShadersInclude/pbrBlockFinalUnlitComponents.js +1 -1
  76. package/Shaders/ShadersInclude/pbrBlockFinalUnlitComponents.js.map +1 -1
  77. package/Shaders/ShadersInclude/pbrBlockReflectance.js +1 -1
  78. package/Shaders/ShadersInclude/pbrBlockReflectance.js.map +1 -1
  79. package/Shaders/ShadersInclude/pbrBlockReflectivity.js +2 -2
  80. package/Shaders/ShadersInclude/pbrBlockReflectivity.js.map +1 -1
  81. package/Shaders/ShadersInclude/pbrDirectLightingFunctions.js +16 -4
  82. package/Shaders/ShadersInclude/pbrDirectLightingFunctions.js.map +1 -1
  83. package/Shaders/gaussianSplatting.vertex.js +1 -1
  84. package/Shaders/gaussianSplatting.vertex.js.map +1 -1
  85. package/ShadersWGSL/ShadersInclude/lightFragment.js +10 -7
  86. package/ShadersWGSL/ShadersInclude/lightFragment.js.map +1 -1
  87. package/ShadersWGSL/ShadersInclude/pbrBRDFFunctions.js +5 -1
  88. package/ShadersWGSL/ShadersInclude/pbrBRDFFunctions.js.map +1 -1
  89. package/ShadersWGSL/ShadersInclude/pbrBlockDirectLighting.js +1 -1
  90. package/ShadersWGSL/ShadersInclude/pbrBlockDirectLighting.js.map +1 -1
  91. package/ShadersWGSL/ShadersInclude/pbrBlockFinalUnlitComponents.js +1 -1
  92. package/ShadersWGSL/ShadersInclude/pbrBlockFinalUnlitComponents.js.map +1 -1
  93. package/ShadersWGSL/ShadersInclude/pbrBlockReflectance.js +1 -1
  94. package/ShadersWGSL/ShadersInclude/pbrBlockReflectance.js.map +1 -1
  95. package/ShadersWGSL/ShadersInclude/pbrBlockReflectivity.js +2 -2
  96. package/ShadersWGSL/ShadersInclude/pbrBlockReflectivity.js.map +1 -1
  97. package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js +24 -8
  98. package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js.map +1 -1
  99. package/ShadersWGSL/gaussianSplatting.vertex.d.ts +1 -0
  100. package/ShadersWGSL/gaussianSplatting.vertex.js +4 -1
  101. package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -1
  102. package/package.json +1 -1
@@ -0,0 +1,462 @@
1
+ import { EffectWrapper } from "../Materials/effectRenderer.js";
2
+ import { Engine } from "../Engines/engine.js";
3
+ import { EngineStore } from "../Engines/engineStore.js";
4
+ import { ImageProcessingConfiguration } from "../Materials/imageProcessingConfiguration.js";
5
+ /**
6
+ * Post process used to apply image processing to a scene
7
+ */
8
+ export class ThinImageProcessingPostProcess extends EffectWrapper {
9
+ _gatherImports(useWebGPU, list) {
10
+ if (useWebGPU) {
11
+ this._webGPUReady = true;
12
+ list.push(import("../ShadersWGSL/imageProcessing.fragment.js"));
13
+ }
14
+ else {
15
+ list.push(import("../Shaders/imageProcessing.fragment.js"));
16
+ }
17
+ }
18
+ /**
19
+ * Gets the image processing configuration used either in this material.
20
+ */
21
+ get imageProcessingConfiguration() {
22
+ return this._imageProcessingConfiguration;
23
+ }
24
+ /**
25
+ * Sets the Default image processing configuration used either in the this material.
26
+ *
27
+ * If sets to null, the scene one is in use.
28
+ */
29
+ set imageProcessingConfiguration(value) {
30
+ // We are almost sure it is applied by post process as
31
+ // We are in the post process :-)
32
+ value.applyByPostProcess = true;
33
+ this._attachImageProcessingConfiguration(value);
34
+ }
35
+ /**
36
+ * Attaches a new image processing configuration to the PBR Material.
37
+ * @param configuration
38
+ * @param doNotBuild
39
+ */
40
+ _attachImageProcessingConfiguration(configuration, doNotBuild = false) {
41
+ if (configuration === this._imageProcessingConfiguration) {
42
+ return;
43
+ }
44
+ // Detaches observer.
45
+ if (this._imageProcessingConfiguration && this._imageProcessingObserver) {
46
+ this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver);
47
+ }
48
+ // Pick the scene configuration if needed.
49
+ if (!configuration) {
50
+ let scene = this.options.scene;
51
+ if (!scene) {
52
+ const engine = this.options.engine;
53
+ if (engine && engine.scenes) {
54
+ const scenes = engine.scenes;
55
+ scene = scenes[scenes.length - 1];
56
+ }
57
+ else {
58
+ scene = EngineStore.LastCreatedScene;
59
+ }
60
+ }
61
+ if (scene) {
62
+ this._imageProcessingConfiguration = scene.imageProcessingConfiguration;
63
+ }
64
+ else {
65
+ this._imageProcessingConfiguration = new ImageProcessingConfiguration();
66
+ }
67
+ }
68
+ else {
69
+ this._imageProcessingConfiguration = configuration;
70
+ }
71
+ // Attaches observer.
72
+ if (this._imageProcessingConfiguration) {
73
+ this._imageProcessingObserver = this._imageProcessingConfiguration.onUpdateParameters.add(() => {
74
+ this._updateParameters();
75
+ });
76
+ }
77
+ // Ensure the effect will be rebuilt.
78
+ if (!doNotBuild) {
79
+ this._updateParameters();
80
+ }
81
+ }
82
+ /**
83
+ * Gets Color curves setup used in the effect if colorCurvesEnabled is set to true .
84
+ */
85
+ get colorCurves() {
86
+ return this.imageProcessingConfiguration.colorCurves;
87
+ }
88
+ /**
89
+ * Sets Color curves setup used in the effect if colorCurvesEnabled is set to true .
90
+ */
91
+ set colorCurves(value) {
92
+ this.imageProcessingConfiguration.colorCurves = value;
93
+ }
94
+ /**
95
+ * Gets whether the color curves effect is enabled.
96
+ */
97
+ get colorCurvesEnabled() {
98
+ return this.imageProcessingConfiguration.colorCurvesEnabled;
99
+ }
100
+ /**
101
+ * Sets whether the color curves effect is enabled.
102
+ */
103
+ set colorCurvesEnabled(value) {
104
+ this.imageProcessingConfiguration.colorCurvesEnabled = value;
105
+ }
106
+ /**
107
+ * Gets Color grading LUT texture used in the effect if colorGradingEnabled is set to true.
108
+ */
109
+ get colorGradingTexture() {
110
+ return this.imageProcessingConfiguration.colorGradingTexture;
111
+ }
112
+ /**
113
+ * Sets Color grading LUT texture used in the effect if colorGradingEnabled is set to true.
114
+ */
115
+ set colorGradingTexture(value) {
116
+ this.imageProcessingConfiguration.colorGradingTexture = value;
117
+ }
118
+ /**
119
+ * Gets whether the color grading effect is enabled.
120
+ */
121
+ get colorGradingEnabled() {
122
+ return this.imageProcessingConfiguration.colorGradingEnabled;
123
+ }
124
+ /**
125
+ * Gets whether the color grading effect is enabled.
126
+ */
127
+ set colorGradingEnabled(value) {
128
+ this.imageProcessingConfiguration.colorGradingEnabled = value;
129
+ }
130
+ /**
131
+ * Gets exposure used in the effect.
132
+ */
133
+ get exposure() {
134
+ return this.imageProcessingConfiguration.exposure;
135
+ }
136
+ /**
137
+ * Sets exposure used in the effect.
138
+ */
139
+ set exposure(value) {
140
+ this.imageProcessingConfiguration.exposure = value;
141
+ }
142
+ /**
143
+ * Gets whether tonemapping is enabled or not.
144
+ */
145
+ get toneMappingEnabled() {
146
+ return this._imageProcessingConfiguration.toneMappingEnabled;
147
+ }
148
+ /**
149
+ * Sets whether tonemapping is enabled or not
150
+ */
151
+ set toneMappingEnabled(value) {
152
+ this._imageProcessingConfiguration.toneMappingEnabled = value;
153
+ }
154
+ /**
155
+ * Gets the type of tone mapping effect.
156
+ */
157
+ get toneMappingType() {
158
+ return this._imageProcessingConfiguration.toneMappingType;
159
+ }
160
+ /**
161
+ * Sets the type of tone mapping effect.
162
+ */
163
+ set toneMappingType(value) {
164
+ this._imageProcessingConfiguration.toneMappingType = value;
165
+ }
166
+ /**
167
+ * Gets contrast used in the effect.
168
+ */
169
+ get contrast() {
170
+ return this.imageProcessingConfiguration.contrast;
171
+ }
172
+ /**
173
+ * Sets contrast used in the effect.
174
+ */
175
+ set contrast(value) {
176
+ this.imageProcessingConfiguration.contrast = value;
177
+ }
178
+ /**
179
+ * Gets Vignette stretch size.
180
+ */
181
+ get vignetteStretch() {
182
+ return this.imageProcessingConfiguration.vignetteStretch;
183
+ }
184
+ /**
185
+ * Sets Vignette stretch size.
186
+ */
187
+ set vignetteStretch(value) {
188
+ this.imageProcessingConfiguration.vignetteStretch = value;
189
+ }
190
+ /**
191
+ * Gets Vignette center X Offset.
192
+ * @deprecated use vignetteCenterX instead
193
+ */
194
+ get vignetteCentreX() {
195
+ return this.imageProcessingConfiguration.vignetteCenterX;
196
+ }
197
+ /**
198
+ * Sets Vignette center X Offset.
199
+ * @deprecated use vignetteCenterX instead
200
+ */
201
+ set vignetteCentreX(value) {
202
+ this.imageProcessingConfiguration.vignetteCenterX = value;
203
+ }
204
+ /**
205
+ * Gets Vignette center Y Offset.
206
+ * @deprecated use vignetteCenterY instead
207
+ */
208
+ get vignetteCentreY() {
209
+ return this.imageProcessingConfiguration.vignetteCenterY;
210
+ }
211
+ /**
212
+ * Sets Vignette center Y Offset.
213
+ * @deprecated use vignetteCenterY instead
214
+ */
215
+ set vignetteCentreY(value) {
216
+ this.imageProcessingConfiguration.vignetteCenterY = value;
217
+ }
218
+ /**
219
+ * Vignette center Y Offset.
220
+ */
221
+ get vignetteCenterY() {
222
+ return this.imageProcessingConfiguration.vignetteCenterY;
223
+ }
224
+ set vignetteCenterY(value) {
225
+ this.imageProcessingConfiguration.vignetteCenterY = value;
226
+ }
227
+ /**
228
+ * Vignette center X Offset.
229
+ */
230
+ get vignetteCenterX() {
231
+ return this.imageProcessingConfiguration.vignetteCenterX;
232
+ }
233
+ set vignetteCenterX(value) {
234
+ this.imageProcessingConfiguration.vignetteCenterX = value;
235
+ }
236
+ /**
237
+ * Gets Vignette weight or intensity of the vignette effect.
238
+ */
239
+ get vignetteWeight() {
240
+ return this.imageProcessingConfiguration.vignetteWeight;
241
+ }
242
+ /**
243
+ * Sets Vignette weight or intensity of the vignette effect.
244
+ */
245
+ set vignetteWeight(value) {
246
+ this.imageProcessingConfiguration.vignetteWeight = value;
247
+ }
248
+ /**
249
+ * Gets Color of the vignette applied on the screen through the chosen blend mode (vignetteBlendMode)
250
+ * if vignetteEnabled is set to true.
251
+ */
252
+ get vignetteColor() {
253
+ return this.imageProcessingConfiguration.vignetteColor;
254
+ }
255
+ /**
256
+ * Sets Color of the vignette applied on the screen through the chosen blend mode (vignetteBlendMode)
257
+ * if vignetteEnabled is set to true.
258
+ */
259
+ set vignetteColor(value) {
260
+ this.imageProcessingConfiguration.vignetteColor = value;
261
+ }
262
+ /**
263
+ * Gets Camera field of view used by the Vignette effect.
264
+ */
265
+ get vignetteCameraFov() {
266
+ return this.imageProcessingConfiguration.vignetteCameraFov;
267
+ }
268
+ /**
269
+ * Sets Camera field of view used by the Vignette effect.
270
+ */
271
+ set vignetteCameraFov(value) {
272
+ this.imageProcessingConfiguration.vignetteCameraFov = value;
273
+ }
274
+ /**
275
+ * Gets the vignette blend mode allowing different kind of effect.
276
+ */
277
+ get vignetteBlendMode() {
278
+ return this.imageProcessingConfiguration.vignetteBlendMode;
279
+ }
280
+ /**
281
+ * Sets the vignette blend mode allowing different kind of effect.
282
+ */
283
+ set vignetteBlendMode(value) {
284
+ this.imageProcessingConfiguration.vignetteBlendMode = value;
285
+ }
286
+ /**
287
+ * Gets whether the vignette effect is enabled.
288
+ */
289
+ get vignetteEnabled() {
290
+ return this.imageProcessingConfiguration.vignetteEnabled;
291
+ }
292
+ /**
293
+ * Sets whether the vignette effect is enabled.
294
+ */
295
+ set vignetteEnabled(value) {
296
+ this.imageProcessingConfiguration.vignetteEnabled = value;
297
+ }
298
+ /**
299
+ * Gets intensity of the dithering effect.
300
+ */
301
+ get ditheringIntensity() {
302
+ return this.imageProcessingConfiguration.ditheringIntensity;
303
+ }
304
+ /**
305
+ * Sets intensity of the dithering effect.
306
+ */
307
+ set ditheringIntensity(value) {
308
+ this.imageProcessingConfiguration.ditheringIntensity = value;
309
+ }
310
+ /**
311
+ * Gets whether the dithering effect is enabled.
312
+ */
313
+ get ditheringEnabled() {
314
+ return this.imageProcessingConfiguration.ditheringEnabled;
315
+ }
316
+ /**
317
+ * Sets whether the dithering effect is enabled.
318
+ */
319
+ set ditheringEnabled(value) {
320
+ this.imageProcessingConfiguration.ditheringEnabled = value;
321
+ }
322
+ /**
323
+ * Gets whether the input of the processing is in Gamma or Linear Space.
324
+ */
325
+ get fromLinearSpace() {
326
+ return this._fromLinearSpace;
327
+ }
328
+ /**
329
+ * Sets whether the input of the processing is in Gamma or Linear Space.
330
+ */
331
+ set fromLinearSpace(value) {
332
+ if (this._fromLinearSpace === value) {
333
+ return;
334
+ }
335
+ this._fromLinearSpace = value;
336
+ this._updateParameters();
337
+ }
338
+ /**
339
+ * * Gets the width of the output texture used to store the result of the post process.
340
+ */
341
+ get outputTextureWidth() {
342
+ return this.imageProcessingConfiguration.outputTextureWidth;
343
+ }
344
+ /**
345
+ * * Sets the width of the output texture used to store the result of the post process.
346
+ */
347
+ set outputTextureWidth(value) {
348
+ this.imageProcessingConfiguration.outputTextureWidth = value;
349
+ }
350
+ /**
351
+ * * Gets the height of the output texture used to store the result of the post process.
352
+ */
353
+ get outputTextureHeight() {
354
+ return this.imageProcessingConfiguration.outputTextureHeight;
355
+ }
356
+ /**
357
+ * * Sets the height of the output texture used to store the result of the post process.
358
+ */
359
+ set outputTextureHeight(value) {
360
+ this.imageProcessingConfiguration.outputTextureHeight = value;
361
+ }
362
+ /**
363
+ * Constructs a new image processing post process
364
+ * @param name Name of the effect
365
+ * @param engine Engine to use to render the effect. If not provided, the last created engine will be used
366
+ * @param options Options to configure the effect
367
+ */
368
+ constructor(name, engine = null, options) {
369
+ super({
370
+ ...options,
371
+ name,
372
+ engine: engine || Engine.LastCreatedEngine,
373
+ useShaderStore: true,
374
+ useAsPostProcess: true,
375
+ fragmentShader: ThinImageProcessingPostProcess.FragmentUrl,
376
+ });
377
+ this._fromLinearSpace = true;
378
+ /**
379
+ * Defines cache preventing GC.
380
+ */
381
+ this._defines = {
382
+ IMAGEPROCESSING: false,
383
+ VIGNETTE: false,
384
+ VIGNETTEBLENDMODEMULTIPLY: false,
385
+ VIGNETTEBLENDMODEOPAQUE: false,
386
+ TONEMAPPING: 0,
387
+ CONTRAST: false,
388
+ COLORCURVES: false,
389
+ COLORGRADING: false,
390
+ COLORGRADING3D: false,
391
+ FROMLINEARSPACE: false,
392
+ SAMPLER3DGREENDEPTH: false,
393
+ SAMPLER3DBGRMAP: false,
394
+ DITHER: false,
395
+ IMAGEPROCESSINGPOSTPROCESS: false,
396
+ EXPOSURE: false,
397
+ SKIPFINALCOLORCLAMP: false,
398
+ };
399
+ const imageProcessingConfiguration = options?.imageProcessingConfiguration;
400
+ // Setup the configuration as forced by the constructor. This would then not force the
401
+ // scene materials output in linear space and let untouched the default forward pass.
402
+ if (imageProcessingConfiguration) {
403
+ imageProcessingConfiguration.applyByPostProcess = true;
404
+ this._attachImageProcessingConfiguration(imageProcessingConfiguration, true);
405
+ // This will cause the shader to be compiled
406
+ this._updateParameters();
407
+ }
408
+ // Setup the default processing configuration to the scene.
409
+ else {
410
+ this._attachImageProcessingConfiguration(null, true);
411
+ this.imageProcessingConfiguration.applyByPostProcess = true;
412
+ }
413
+ }
414
+ /**
415
+ * @internal
416
+ */
417
+ _updateParameters() {
418
+ this._defines.FROMLINEARSPACE = this._fromLinearSpace;
419
+ this.imageProcessingConfiguration.prepareDefines(this._defines, true);
420
+ let defines = "";
421
+ for (const prop in this._defines) {
422
+ const value = this._defines[prop];
423
+ const type = typeof value;
424
+ switch (type) {
425
+ case "number":
426
+ case "string":
427
+ defines += `#define ${prop} ${value};\n`;
428
+ break;
429
+ default:
430
+ if (value) {
431
+ defines += `#define ${prop};\n`;
432
+ }
433
+ break;
434
+ }
435
+ }
436
+ const samplers = ["textureSampler"];
437
+ const uniforms = ["scale"];
438
+ if (ImageProcessingConfiguration) {
439
+ ImageProcessingConfiguration.PrepareSamplers(samplers, this._defines);
440
+ ImageProcessingConfiguration.PrepareUniforms(uniforms, this._defines);
441
+ }
442
+ this.updateEffect(defines, uniforms, samplers);
443
+ }
444
+ bind(noDefaultBindings = false) {
445
+ super.bind(noDefaultBindings);
446
+ this.imageProcessingConfiguration.bind(this.effect, this.overrideAspectRatio);
447
+ }
448
+ dispose() {
449
+ super.dispose();
450
+ if (this._imageProcessingConfiguration && this._imageProcessingObserver) {
451
+ this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver);
452
+ }
453
+ if (this._imageProcessingConfiguration) {
454
+ this.imageProcessingConfiguration.applyByPostProcess = false;
455
+ }
456
+ }
457
+ }
458
+ /**
459
+ * The fragment shader url
460
+ */
461
+ ThinImageProcessingPostProcess.FragmentUrl = "imageProcessing";
462
+ //# sourceMappingURL=thinImageProcessingPostProcess.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"thinImageProcessingPostProcess.js","sourceRoot":"","sources":["../../../../dev/core/src/PostProcesses/thinImageProcessingPostProcess.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,OAAO,EAAE,4BAA4B,EAAE,MAAM,2CAA2C,CAAC;AAkBzF;;GAEG;AACH,MAAM,OAAO,8BAA+B,SAAQ,aAAa;IAM1C,cAAc,CAAC,SAAkB,EAAE,IAAoB;QACtE,IAAI,SAAS,EAAE,CAAC;YACZ,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;YACzB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,yCAAyC,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AG,CAAC,OAAO,CAAC,CAAC;QAE3B,IAAI,4BAA4B,EAAE,CAAC;YAC/B,4BAA4B,CAAC,eAAe,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;YACtE,4BAA4B,CAAC,eAAe,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC1E,CAAC;QAED,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACnD,CAAC;IAEe,IAAI,CAAC,iBAAiB,GAAG,KAAK;QAC1C,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;QAC9B,IAAI,CAAC,4BAA4B,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC;IAClF,CAAC;IAEe,OAAO;QACnB,KAAK,CAAC,OAAO,EAAE,CAAC;QAEhB,IAAI,IAAI,CAAC,6BAA6B,IAAI,IAAI,CAAC,wBAAwB,EAAE,CAAC;YACtE,IAAI,CAAC,6BAA6B,CAAC,kBAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;QAChG,CAAC;QAED,IAAI,IAAI,CAAC,6BAA6B,EAAE,CAAC;YACrC,IAAI,CAAC,4BAA4B,CAAC,kBAAkB,GAAG,KAAK,CAAC;QACjE,CAAC;IACL,CAAC;;AAjgBD;;GAEG;AACoB,0CAAW,GAAG,iBAAiB,AAApB,CAAqB","sourcesContent":["// eslint-disable-next-line import/no-internal-modules\r\nimport type { Nullable, AbstractEngine, EffectWrapperCreationOptions, Observer, NonNullableFields, Scene, ColorCurves, BaseTexture, Color4 } from \"core/index\";\r\nimport { EffectWrapper } from \"../Materials/effectRenderer\";\r\nimport { Engine } from \"../Engines/engine\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport type { IImageProcessingConfigurationDefines } from \"../Materials/imageProcessingConfiguration.defines\";\r\nimport { ImageProcessingConfiguration } from \"../Materials/imageProcessingConfiguration\";\r\n\r\n/**\r\n * Options used to create a ThinImageProcessingPostProcessOptions.\r\n */\r\nexport interface ThinImageProcessingPostProcessOptions extends EffectWrapperCreationOptions {\r\n /**\r\n * An existing image processing configuration to use. If not provided, the scene one will be used.\r\n */\r\n imageProcessingConfiguration?: ImageProcessingConfiguration;\r\n\r\n /**\r\n * The scene to retrieve the image processing configuration from if not provided in the options.\r\n * If not provided, the last created scene will be used.\r\n */\r\n scene?: Nullable<Scene>;\r\n}\r\n\r\n/**\r\n * Post process used to apply image processing to a scene\r\n */\r\nexport class ThinImageProcessingPostProcess extends EffectWrapper {\r\n /**\r\n * The fragment shader url\r\n */\r\n public static readonly FragmentUrl = \"imageProcessing\";\r\n\r\n protected override _gatherImports(useWebGPU: boolean, list: Promise<any>[]) {\r\n if (useWebGPU) {\r\n this._webGPUReady = true;\r\n list.push(import(\"../ShadersWGSL/imageProcessing.fragment\"));\r\n } else {\r\n list.push(import(\"../Shaders/imageProcessing.fragment\"));\r\n }\r\n }\r\n\r\n /**\r\n * Default configuration related to image processing available in the PBR Material.\r\n */\r\n protected _imageProcessingConfiguration: ImageProcessingConfiguration;\r\n\r\n /**\r\n * Gets the image processing configuration used either in this material.\r\n */\r\n public get imageProcessingConfiguration(): ImageProcessingConfiguration {\r\n return this._imageProcessingConfiguration;\r\n }\r\n\r\n /**\r\n * Sets the Default image processing configuration used either in the this material.\r\n *\r\n * If sets to null, the scene one is in use.\r\n */\r\n public set imageProcessingConfiguration(value: ImageProcessingConfiguration) {\r\n // We are almost sure it is applied by post process as\r\n // We are in the post process :-)\r\n value.applyByPostProcess = true;\r\n this._attachImageProcessingConfiguration(value);\r\n }\r\n\r\n /**\r\n * Keep track of the image processing observer to allow dispose and replace.\r\n */\r\n private _imageProcessingObserver: Nullable<Observer<ImageProcessingConfiguration>>;\r\n\r\n /**\r\n * Attaches a new image processing configuration to the PBR Material.\r\n * @param configuration\r\n * @param doNotBuild\r\n */\r\n protected _attachImageProcessingConfiguration(configuration: Nullable<ImageProcessingConfiguration>, doNotBuild = false): void {\r\n if (configuration === this._imageProcessingConfiguration) {\r\n return;\r\n }\r\n\r\n // Detaches observer.\r\n if (this._imageProcessingConfiguration && this._imageProcessingObserver) {\r\n this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver);\r\n }\r\n\r\n // Pick the scene configuration if needed.\r\n if (!configuration) {\r\n let scene = this.options.scene;\r\n\r\n if (!scene) {\r\n const engine = this.options.engine;\r\n if (engine && engine.scenes) {\r\n const scenes = engine.scenes;\r\n scene = scenes[scenes.length - 1];\r\n } else {\r\n scene = EngineStore.LastCreatedScene!;\r\n }\r\n }\r\n\r\n if (scene) {\r\n this._imageProcessingConfiguration = scene.imageProcessingConfiguration;\r\n } else {\r\n this._imageProcessingConfiguration = new ImageProcessingConfiguration();\r\n }\r\n } else {\r\n this._imageProcessingConfiguration = configuration;\r\n }\r\n\r\n // Attaches observer.\r\n if (this._imageProcessingConfiguration) {\r\n this._imageProcessingObserver = this._imageProcessingConfiguration.onUpdateParameters.add(() => {\r\n this._updateParameters();\r\n });\r\n }\r\n\r\n // Ensure the effect will be rebuilt.\r\n if (!doNotBuild) {\r\n this._updateParameters();\r\n }\r\n }\r\n\r\n /**\r\n * Gets Color curves setup used in the effect if colorCurvesEnabled is set to true .\r\n */\r\n public get colorCurves(): Nullable<ColorCurves> {\r\n return this.imageProcessingConfiguration.colorCurves;\r\n }\r\n /**\r\n * Sets Color curves setup used in the effect if colorCurvesEnabled is set to true .\r\n */\r\n public set colorCurves(value: Nullable<ColorCurves>) {\r\n this.imageProcessingConfiguration.colorCurves = value;\r\n }\r\n\r\n /**\r\n * Gets whether the color curves effect is enabled.\r\n */\r\n public get colorCurvesEnabled(): boolean {\r\n return this.imageProcessingConfiguration.colorCurvesEnabled;\r\n }\r\n /**\r\n * Sets whether the color curves effect is enabled.\r\n */\r\n public set colorCurvesEnabled(value: boolean) {\r\n this.imageProcessingConfiguration.colorCurvesEnabled = value;\r\n }\r\n\r\n /**\r\n * Gets Color grading LUT texture used in the effect if colorGradingEnabled is set to true.\r\n */\r\n public get colorGradingTexture(): Nullable<BaseTexture> {\r\n return this.imageProcessingConfiguration.colorGradingTexture;\r\n }\r\n /**\r\n * Sets Color grading LUT texture used in the effect if colorGradingEnabled is set to true.\r\n */\r\n public set colorGradingTexture(value: Nullable<BaseTexture>) {\r\n this.imageProcessingConfiguration.colorGradingTexture = value;\r\n }\r\n\r\n /**\r\n * Gets whether the color grading effect is enabled.\r\n */\r\n public get colorGradingEnabled(): boolean {\r\n return this.imageProcessingConfiguration.colorGradingEnabled;\r\n }\r\n /**\r\n * Gets whether the color grading effect is enabled.\r\n */\r\n public set colorGradingEnabled(value: boolean) {\r\n this.imageProcessingConfiguration.colorGradingEnabled = value;\r\n }\r\n\r\n /**\r\n * Gets exposure used in the effect.\r\n */\r\n public get exposure(): number {\r\n return this.imageProcessingConfiguration.exposure;\r\n }\r\n /**\r\n * Sets exposure used in the effect.\r\n */\r\n public set exposure(value: number) {\r\n this.imageProcessingConfiguration.exposure = value;\r\n }\r\n\r\n /**\r\n * Gets whether tonemapping is enabled or not.\r\n */\r\n public get toneMappingEnabled(): boolean {\r\n return this._imageProcessingConfiguration.toneMappingEnabled;\r\n }\r\n /**\r\n * Sets whether tonemapping is enabled or not\r\n */\r\n public set toneMappingEnabled(value: boolean) {\r\n this._imageProcessingConfiguration.toneMappingEnabled = value;\r\n }\r\n\r\n /**\r\n * Gets the type of tone mapping effect.\r\n */\r\n public get toneMappingType(): number {\r\n return this._imageProcessingConfiguration.toneMappingType;\r\n }\r\n /**\r\n * Sets the type of tone mapping effect.\r\n */\r\n public set toneMappingType(value: number) {\r\n this._imageProcessingConfiguration.toneMappingType = value;\r\n }\r\n\r\n /**\r\n * Gets contrast used in the effect.\r\n */\r\n public get contrast(): number {\r\n return this.imageProcessingConfiguration.contrast;\r\n }\r\n /**\r\n * Sets contrast used in the effect.\r\n */\r\n public set contrast(value: number) {\r\n this.imageProcessingConfiguration.contrast = value;\r\n }\r\n\r\n /**\r\n * Gets Vignette stretch size.\r\n */\r\n public get vignetteStretch(): number {\r\n return this.imageProcessingConfiguration.vignetteStretch;\r\n }\r\n /**\r\n * Sets Vignette stretch size.\r\n */\r\n public set vignetteStretch(value: number) {\r\n this.imageProcessingConfiguration.vignetteStretch = value;\r\n }\r\n\r\n /**\r\n * Gets Vignette center X Offset.\r\n * @deprecated use vignetteCenterX instead\r\n */\r\n public get vignetteCentreX(): number {\r\n return this.imageProcessingConfiguration.vignetteCenterX;\r\n }\r\n /**\r\n * Sets Vignette center X Offset.\r\n * @deprecated use vignetteCenterX instead\r\n */\r\n public set vignetteCentreX(value: number) {\r\n this.imageProcessingConfiguration.vignetteCenterX = value;\r\n }\r\n\r\n /**\r\n * Gets Vignette center Y Offset.\r\n * @deprecated use vignetteCenterY instead\r\n */\r\n public get vignetteCentreY(): number {\r\n return this.imageProcessingConfiguration.vignetteCenterY;\r\n }\r\n /**\r\n * Sets Vignette center Y Offset.\r\n * @deprecated use vignetteCenterY instead\r\n */\r\n public set vignetteCentreY(value: number) {\r\n this.imageProcessingConfiguration.vignetteCenterY = value;\r\n }\r\n\r\n /**\r\n * Vignette center Y Offset.\r\n */\r\n public get vignetteCenterY(): number {\r\n return this.imageProcessingConfiguration.vignetteCenterY;\r\n }\r\n public set vignetteCenterY(value: number) {\r\n this.imageProcessingConfiguration.vignetteCenterY = value;\r\n }\r\n\r\n /**\r\n * Vignette center X Offset.\r\n */\r\n public get vignetteCenterX(): number {\r\n return this.imageProcessingConfiguration.vignetteCenterX;\r\n }\r\n public set vignetteCenterX(value: number) {\r\n this.imageProcessingConfiguration.vignetteCenterX = value;\r\n }\r\n\r\n /**\r\n * Gets Vignette weight or intensity of the vignette effect.\r\n */\r\n public get vignetteWeight(): number {\r\n return this.imageProcessingConfiguration.vignetteWeight;\r\n }\r\n /**\r\n * Sets Vignette weight or intensity of the vignette effect.\r\n */\r\n public set vignetteWeight(value: number) {\r\n this.imageProcessingConfiguration.vignetteWeight = value;\r\n }\r\n\r\n /**\r\n * Gets Color of the vignette applied on the screen through the chosen blend mode (vignetteBlendMode)\r\n * if vignetteEnabled is set to true.\r\n */\r\n public get vignetteColor(): Color4 {\r\n return this.imageProcessingConfiguration.vignetteColor;\r\n }\r\n /**\r\n * Sets Color of the vignette applied on the screen through the chosen blend mode (vignetteBlendMode)\r\n * if vignetteEnabled is set to true.\r\n */\r\n public set vignetteColor(value: Color4) {\r\n this.imageProcessingConfiguration.vignetteColor = value;\r\n }\r\n\r\n /**\r\n * Gets Camera field of view used by the Vignette effect.\r\n */\r\n public get vignetteCameraFov(): number {\r\n return this.imageProcessingConfiguration.vignetteCameraFov;\r\n }\r\n /**\r\n * Sets Camera field of view used by the Vignette effect.\r\n */\r\n public set vignetteCameraFov(value: number) {\r\n this.imageProcessingConfiguration.vignetteCameraFov = value;\r\n }\r\n\r\n /**\r\n * Gets the vignette blend mode allowing different kind of effect.\r\n */\r\n public get vignetteBlendMode(): number {\r\n return this.imageProcessingConfiguration.vignetteBlendMode;\r\n }\r\n /**\r\n * Sets the vignette blend mode allowing different kind of effect.\r\n */\r\n public set vignetteBlendMode(value: number) {\r\n this.imageProcessingConfiguration.vignetteBlendMode = value;\r\n }\r\n\r\n /**\r\n * Gets whether the vignette effect is enabled.\r\n */\r\n public get vignetteEnabled(): boolean {\r\n return this.imageProcessingConfiguration.vignetteEnabled;\r\n }\r\n /**\r\n * Sets whether the vignette effect is enabled.\r\n */\r\n public set vignetteEnabled(value: boolean) {\r\n this.imageProcessingConfiguration.vignetteEnabled = value;\r\n }\r\n\r\n /**\r\n * Gets intensity of the dithering effect.\r\n */\r\n public get ditheringIntensity(): number {\r\n return this.imageProcessingConfiguration.ditheringIntensity;\r\n }\r\n /**\r\n * Sets intensity of the dithering effect.\r\n */\r\n public set ditheringIntensity(value: number) {\r\n this.imageProcessingConfiguration.ditheringIntensity = value;\r\n }\r\n\r\n /**\r\n * Gets whether the dithering effect is enabled.\r\n */\r\n public get ditheringEnabled(): boolean {\r\n return this.imageProcessingConfiguration.ditheringEnabled;\r\n }\r\n /**\r\n * Sets whether the dithering effect is enabled.\r\n */\r\n public set ditheringEnabled(value: boolean) {\r\n this.imageProcessingConfiguration.ditheringEnabled = value;\r\n }\r\n\r\n private _fromLinearSpace = true;\r\n /**\r\n * Gets whether the input of the processing is in Gamma or Linear Space.\r\n */\r\n public get fromLinearSpace(): boolean {\r\n return this._fromLinearSpace;\r\n }\r\n /**\r\n * Sets whether the input of the processing is in Gamma or Linear Space.\r\n */\r\n public set fromLinearSpace(value: boolean) {\r\n if (this._fromLinearSpace === value) {\r\n return;\r\n }\r\n\r\n this._fromLinearSpace = value;\r\n this._updateParameters();\r\n }\r\n\r\n /**\r\n * * Gets the width of the output texture used to store the result of the post process.\r\n */\r\n public get outputTextureWidth() {\r\n return this.imageProcessingConfiguration.outputTextureWidth;\r\n }\r\n\r\n /**\r\n * * Sets the width of the output texture used to store the result of the post process.\r\n */\r\n public set outputTextureWidth(value: number) {\r\n this.imageProcessingConfiguration.outputTextureWidth = value;\r\n }\r\n\r\n /**\r\n * * Gets the height of the output texture used to store the result of the post process.\r\n */\r\n public get outputTextureHeight() {\r\n return this.imageProcessingConfiguration.outputTextureHeight;\r\n }\r\n\r\n /**\r\n * * Sets the height of the output texture used to store the result of the post process.\r\n */\r\n public set outputTextureHeight(value: number) {\r\n this.imageProcessingConfiguration.outputTextureHeight = value;\r\n }\r\n\r\n /**\r\n * Gets/sets the aspect ratio used to override the default one.\r\n */\r\n public overrideAspectRatio?: number;\r\n\r\n /**\r\n * Defines cache preventing GC.\r\n */\r\n private _defines: IImageProcessingConfigurationDefines & { FROMLINEARSPACE: boolean } = {\r\n IMAGEPROCESSING: false,\r\n VIGNETTE: false,\r\n VIGNETTEBLENDMODEMULTIPLY: false,\r\n VIGNETTEBLENDMODEOPAQUE: false,\r\n TONEMAPPING: 0,\r\n CONTRAST: false,\r\n COLORCURVES: false,\r\n COLORGRADING: false,\r\n COLORGRADING3D: false,\r\n FROMLINEARSPACE: false,\r\n SAMPLER3DGREENDEPTH: false,\r\n SAMPLER3DBGRMAP: false,\r\n DITHER: false,\r\n IMAGEPROCESSINGPOSTPROCESS: false,\r\n EXPOSURE: false,\r\n SKIPFINALCOLORCLAMP: false,\r\n };\r\n\r\n public override readonly options: Required<NonNullableFields<ThinImageProcessingPostProcessOptions>>;\r\n\r\n /**\r\n * Constructs a new image processing post process\r\n * @param name Name of the effect\r\n * @param engine Engine to use to render the effect. If not provided, the last created engine will be used\r\n * @param options Options to configure the effect\r\n */\r\n constructor(name: string, engine: Nullable<AbstractEngine> = null, options?: ThinImageProcessingPostProcessOptions) {\r\n super({\r\n ...options,\r\n name,\r\n engine: engine || Engine.LastCreatedEngine!,\r\n useShaderStore: true,\r\n useAsPostProcess: true,\r\n fragmentShader: ThinImageProcessingPostProcess.FragmentUrl,\r\n });\r\n\r\n const imageProcessingConfiguration = options?.imageProcessingConfiguration;\r\n\r\n // Setup the configuration as forced by the constructor. This would then not force the\r\n // scene materials output in linear space and let untouched the default forward pass.\r\n if (imageProcessingConfiguration) {\r\n imageProcessingConfiguration.applyByPostProcess = true;\r\n this._attachImageProcessingConfiguration(imageProcessingConfiguration, true);\r\n // This will cause the shader to be compiled\r\n this._updateParameters();\r\n }\r\n // Setup the default processing configuration to the scene.\r\n else {\r\n this._attachImageProcessingConfiguration(null, true);\r\n this.imageProcessingConfiguration.applyByPostProcess = true;\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _updateParameters(): void {\r\n this._defines.FROMLINEARSPACE = this._fromLinearSpace;\r\n this.imageProcessingConfiguration.prepareDefines(this._defines, true);\r\n let defines = \"\";\r\n for (const prop in this._defines) {\r\n const value = (<any>this._defines)[prop];\r\n const type = typeof value;\r\n\r\n switch (type) {\r\n case \"number\":\r\n case \"string\":\r\n defines += `#define ${prop} ${value};\\n`;\r\n break;\r\n default:\r\n if (value) {\r\n defines += `#define ${prop};\\n`;\r\n }\r\n break;\r\n }\r\n }\r\n\r\n const samplers = [\"textureSampler\"];\r\n const uniforms = [\"scale\"];\r\n\r\n if (ImageProcessingConfiguration) {\r\n ImageProcessingConfiguration.PrepareSamplers(samplers, this._defines);\r\n ImageProcessingConfiguration.PrepareUniforms(uniforms, this._defines);\r\n }\r\n\r\n this.updateEffect(defines, uniforms, samplers);\r\n }\r\n\r\n public override bind(noDefaultBindings = false) {\r\n super.bind(noDefaultBindings);\r\n this.imageProcessingConfiguration.bind(this.effect, this.overrideAspectRatio);\r\n }\r\n\r\n public override dispose(): void {\r\n super.dispose();\r\n\r\n if (this._imageProcessingConfiguration && this._imageProcessingObserver) {\r\n this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver);\r\n }\r\n\r\n if (this._imageProcessingConfiguration) {\r\n this.imageProcessingConfiguration.applyByPostProcess = false;\r\n }\r\n }\r\n}\r\n"]}
@@ -77,13 +77,13 @@ export declare class ObjectRenderer {
77
77
  * If not defined, activeCamera will be used. If not defined nor activeCamera, scene's active camera will be used.
78
78
  */
79
79
  cameraForLOD: Nullable<Camera>;
80
- private _renderInLinearSpace;
80
+ private _disableImageProcessing;
81
81
  /**
82
- * If true, the object renderer will render all objects in linear color space.
83
- * If null (default value), the renderer will use the current setting of the scene's image processing configuration to determine if it should render in linear color space.
82
+ * If true, the object renderer will render all objects without any image processing applied.
83
+ * If false (default value), the renderer will use the current setting of the scene's image processing configuration.
84
84
  */
85
- get renderInLinearSpace(): Nullable<boolean>;
86
- set renderInLinearSpace(value: Nullable<boolean>);
85
+ get disableImageProcessing(): boolean;
86
+ set disableImageProcessing(value: boolean);
87
87
  /**
88
88
  * Override the mesh isReady function with your own one.
89
89
  */
@@ -27,17 +27,17 @@ export class ObjectRenderer {
27
27
  this._renderList = value;
28
28
  }
29
29
  /**
30
- * If true, the object renderer will render all objects in linear color space.
31
- * If null (default value), the renderer will use the current setting of the scene's image processing configuration to determine if it should render in linear color space.
30
+ * If true, the object renderer will render all objects without any image processing applied.
31
+ * If false (default value), the renderer will use the current setting of the scene's image processing configuration.
32
32
  */
33
- get renderInLinearSpace() {
34
- return this._renderInLinearSpace;
33
+ get disableImageProcessing() {
34
+ return this._disableImageProcessing;
35
35
  }
36
- set renderInLinearSpace(value) {
37
- if (value === this._renderInLinearSpace) {
36
+ set disableImageProcessing(value) {
37
+ if (value === this._disableImageProcessing) {
38
38
  return;
39
39
  }
40
- this._renderInLinearSpace = value;
40
+ this._disableImageProcessing = value;
41
41
  this._scene.markAllMaterialsAsDirty(64);
42
42
  }
43
43
  /**
@@ -138,7 +138,7 @@ export class ObjectRenderer {
138
138
  * Force checking the layerMask property even if a custom list of meshes is provided (ie. if renderList is not undefined)
139
139
  */
140
140
  this.forceLayerMaskCheck = false;
141
- this._renderInLinearSpace = null;
141
+ this._disableImageProcessing = false;
142
142
  /**
143
143
  * An event triggered before rendering the objects
144
144
  */
@@ -277,9 +277,9 @@ export class ObjectRenderer {
277
277
  }
278
278
  }
279
279
  this._currentApplyByPostProcessSetting = this._scene.imageProcessingConfiguration.applyByPostProcess;
280
- if (this._renderInLinearSpace !== null) {
280
+ if (this._disableImageProcessing) {
281
281
  // we do not use the applyByPostProcess setter to avoid flagging all the materials as "image processing dirty"!
282
- this._scene.imageProcessingConfiguration._applyByPostProcess = this._renderInLinearSpace;
282
+ this._scene.imageProcessingConfiguration._applyByPostProcess = this._disableImageProcessing;
283
283
  }
284
284
  }
285
285
  /**
@@ -305,7 +305,7 @@ export class ObjectRenderer {
305
305
  */
306
306
  finishRender() {
307
307
  const scene = this._scene;
308
- if (this._renderInLinearSpace !== null) {
308
+ if (this._disableImageProcessing) {
309
309
  scene.imageProcessingConfiguration._applyByPostProcess = this._currentApplyByPostProcessSetting;
310
310
  }
311
311
  scene.activeCamera = this._currentSceneCamera;