@@ -10,14 +10,12 @@ import { NodeMaterialBuildState } from "./nodeMaterialBuildState";
10
10
import type { IEffectCreationOptions } from "../effect" ;
11
11
import { Effect } from "../effect" ;
12
12
import type { BaseTexture } from "../../Materials/Textures/baseTexture" ;
13
- import type { Observer } from "../../Misc/observable" ;
14
13
import { Observable } from "../../Misc/observable" ;
15
14
import { NodeMaterialBlockTargets } from "./Enums/nodeMaterialBlockTargets" ;
16
15
import { NodeMaterialBuildStateSharedData } from "./nodeMaterialBuildStateSharedData" ;
17
16
import type { SubMesh } from "../../Meshes/subMesh" ;
18
17
import { MaterialDefines } from "../../Materials/materialDefines" ;
19
18
import type { NodeMaterialOptimizer } from "./Optimizers/nodeMaterialOptimizer" ;
20
- import type { ImageProcessingConfiguration } from "../imageProcessingConfiguration" ;
21
19
import type { Nullable } from "../../types" ;
22
20
import { VertexBuffer } from "../../Buffers/buffer" ;
23
21
import { Tools } from "../../Misc/tools" ;
@@ -73,6 +71,7 @@ import { AbstractEngine } from "../../Engines/abstractEngine";
73
71
import type { LoopBlock } from "./Blocks/loopBlock" ;
74
72
import { MaterialHelperGeometryRendering } from "../materialHelper.geometryrendering" ;
75
73
import { UVDefinesMixin } from "../uv.defines" ;
74
+ import { ImageProcessingMixin } from "../imageProcessing" ;
76
75
77
76
const onCreatedEffectParameters = { effect : null as unknown as Effect , subMesh : null as unknown as Nullable < SubMesh > } ;
78
77
@@ -232,10 +231,11 @@ export type NodeMaterialTextureBlocks =
232
231
| BiPlanarBlock
233
232
| PrePassTextureBlock ;
234
233
234
+ class NodeMaterialBase extends ImageProcessingMixin ( PushMaterial ) { }
235
235
/**
236
236
* Class used to create a node based material built by assembling shader blocks
237
237
*/
238
- export class NodeMaterial extends PushMaterial {
238
+ export class NodeMaterial extends NodeMaterialBase {
239
239
private static _BuildIdGenerator : number = 0 ;
240
240
private _options : INodeMaterialOptions ;
241
241
private _vertexCompilationState : NodeMaterialBuildState ;
@@ -373,30 +373,6 @@ export class NodeMaterial extends PushMaterial {
373
373
this . _options = options ;
374
374
}
375
375
376
- /**
377
- * Default configuration related to image processing available in the standard Material.
378
- */
379
- protected _imageProcessingConfiguration : ImageProcessingConfiguration ;
380
-
381
- /**
382
- * Gets the image processing configuration used either in this material.
383
- */
384
- public get imageProcessingConfiguration ( ) : ImageProcessingConfiguration {
385
- return this . _imageProcessingConfiguration ;
386
- }
387
-
388
- /**
389
- * Sets the Default image processing configuration used either in the this material.
390
- *
391
- * If sets to null, the scene one is in use.
392
- */
393
- public set imageProcessingConfiguration ( value : ImageProcessingConfiguration ) {
394
- this . _attachImageProcessingConfiguration ( value ) ;
395
-
396
- // Ensure the effect will be rebuilt.
397
- this . _markAllSubMeshesAsTexturesDirty ( ) ;
398
- }
399
-
400
376
/**
401
377
* Gets an array of blocks that needs to be serialized even if they are not yet connected
402
378
*/
@@ -470,40 +446,6 @@ export class NodeMaterial extends PushMaterial {
470
446
return "NodeMaterial" ;
471
447
}
472
448
473
- /**
474
- * Keep track of the image processing observer to allow dispose and replace.
475
- */
476
- private _imageProcessingObserver : Nullable < Observer < ImageProcessingConfiguration > > ;
477
-
478
- /**
479
- * Attaches a new image processing configuration to the Standard Material.
480
- * @param configuration
481
- */
482
- protected _attachImageProcessingConfiguration ( configuration : Nullable < ImageProcessingConfiguration > ) : void {
483
- if ( configuration === this . _imageProcessingConfiguration ) {
484
- return ;
485
- }
486
-
487
- // Detaches observer.
488
- if ( this . _imageProcessingConfiguration && this . _imageProcessingObserver ) {
489
- this . _imageProcessingConfiguration . onUpdateParameters . remove ( this . _imageProcessingObserver ) ;
490
- }
491
-
492
- // Pick the scene configuration if needed.
493
- if ( ! configuration ) {
494
- this . _imageProcessingConfiguration = this . getScene ( ) . imageProcessingConfiguration ;
495
- } else {
496
- this . _imageProcessingConfiguration = configuration ;
497
- }
498
-
499
- // Attaches observer.
500
- if ( this . _imageProcessingConfiguration ) {
501
- this . _imageProcessingObserver = this . _imageProcessingConfiguration . onUpdateParameters . add ( ( ) => {
502
- this . _markAllSubMeshesAsImageProcessingDirty ( ) ;
503
- } ) ;
504
- }
505
- }
506
-
507
449
/**
508
450
* Get a block by its name
509
451
* @param name defines the name of the block to retrieve
0 commit comments