@babylonjs/core 7.35.1 → 7.36.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.
- package/Engines/Extensions/engine.multiRender.d.ts +11 -0
- package/Engines/Extensions/engine.multiRender.js +71 -32
- package/Engines/Extensions/engine.multiRender.js.map +1 -1
- package/Engines/Extensions/engine.prefilteredCubeTexture.js +3 -2
- package/Engines/Extensions/engine.prefilteredCubeTexture.js.map +1 -1
- package/Engines/Extensions/engine.renderTarget.js +1 -13
- package/Engines/Extensions/engine.renderTarget.js.map +1 -1
- package/Engines/WebGL/webGLRenderTargetWrapper.d.ts +2 -0
- package/Engines/WebGL/webGLRenderTargetWrapper.js +37 -7
- package/Engines/WebGL/webGLRenderTargetWrapper.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.multiRender.d.ts +11 -0
- package/Engines/WebGPU/Extensions/engine.multiRender.js +30 -11
- package/Engines/WebGPU/Extensions/engine.multiRender.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.renderTarget.js +2 -5
- package/Engines/WebGPU/Extensions/engine.renderTarget.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheRenderPipeline.js +3 -2
- package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
- package/Engines/WebGPU/webgpuHardwareTexture.d.ts +3 -1
- package/Engines/WebGPU/webgpuHardwareTexture.js +5 -4
- package/Engines/WebGPU/webgpuHardwareTexture.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureManager.js +2 -2
- package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
- package/Engines/abstractEngine.d.ts +11 -0
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/renderTargetWrapper.d.ts +33 -1
- package/Engines/renderTargetWrapper.js +64 -4
- package/Engines/renderTargetWrapper.js.map +1 -1
- package/Engines/thinEngine.d.ts +13 -1
- package/Engines/thinEngine.js +115 -24
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/thinWebGPUEngine.d.ts +2 -0
- package/Engines/thinWebGPUEngine.js +7 -0
- package/Engines/thinWebGPUEngine.js.map +1 -1
- package/Engines/webgpuEngine.d.ts +12 -3
- package/Engines/webgpuEngine.js +39 -9
- package/Engines/webgpuEngine.js.map +1 -1
- package/FrameGraph/Node/Blocks/Textures/clearBlock.d.ts +8 -0
- package/FrameGraph/Node/Blocks/Textures/clearBlock.js +22 -1
- package/FrameGraph/Node/Blocks/Textures/clearBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/inputBlock.d.ts +4 -9
- package/FrameGraph/Node/Blocks/inputBlock.js +15 -25
- package/FrameGraph/Node/Blocks/inputBlock.js.map +1 -1
- package/FrameGraph/Node/nodeRenderGraphBlockConnectionPoint.js +10 -2
- package/FrameGraph/Node/nodeRenderGraphBlockConnectionPoint.js.map +1 -1
- package/FrameGraph/Passes/renderPass.d.ts +10 -10
- package/FrameGraph/Passes/renderPass.js +10 -10
- package/FrameGraph/Passes/renderPass.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/bloomTask.d.ts +10 -5
- package/FrameGraph/Tasks/PostProcesses/bloomTask.js +29 -14
- package/FrameGraph/Tasks/PostProcesses/bloomTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldMergeTask.js +4 -0
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldMergeTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.d.ts +11 -6
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.js +30 -13
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/postProcessTask.js +4 -6
- package/FrameGraph/Tasks/PostProcesses/postProcessTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/cullObjectsTask.d.ts +1 -1
- package/FrameGraph/Tasks/Rendering/cullObjectsTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.d.ts +3 -3
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.js +33 -32
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/objectRendererTask.d.ts +4 -2
- package/FrameGraph/Tasks/Rendering/objectRendererTask.js +8 -12
- package/FrameGraph/Tasks/Rendering/objectRendererTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/taaObjectRendererTask.js +13 -18
- package/FrameGraph/Tasks/Rendering/taaObjectRendererTask.js.map +1 -1
- package/FrameGraph/Tasks/Texture/clearTextureTask.d.ts +15 -2
- package/FrameGraph/Tasks/Texture/clearTextureTask.js +17 -4
- package/FrameGraph/Tasks/Texture/clearTextureTask.js.map +1 -1
- package/FrameGraph/Tasks/Texture/copyToTextureTask.js +2 -2
- package/FrameGraph/Tasks/Texture/copyToTextureTask.js.map +1 -1
- package/FrameGraph/Tasks/Texture/generateMipMapsTask.js +3 -3
- package/FrameGraph/Tasks/Texture/generateMipMapsTask.js.map +1 -1
- package/FrameGraph/frameGraph.d.ts +11 -74
- package/FrameGraph/frameGraph.js +12 -126
- package/FrameGraph/frameGraph.js.map +1 -1
- package/FrameGraph/frameGraphRenderContext.d.ts +17 -8
- package/FrameGraph/frameGraphRenderContext.js +55 -43
- package/FrameGraph/frameGraphRenderContext.js.map +1 -1
- package/FrameGraph/frameGraphRenderTarget.d.ts +16 -0
- package/FrameGraph/frameGraphRenderTarget.js +67 -0
- package/FrameGraph/frameGraphRenderTarget.js.map +1 -0
- package/FrameGraph/frameGraphTask.d.ts +4 -3
- package/FrameGraph/frameGraphTask.js +41 -8
- package/FrameGraph/frameGraphTask.js.map +1 -1
- package/FrameGraph/frameGraphTextureManager.d.ts +130 -22
- package/FrameGraph/frameGraphTextureManager.js +312 -130
- package/FrameGraph/frameGraphTextureManager.js.map +1 -1
- package/FrameGraph/frameGraphTypes.d.ts +28 -13
- package/FrameGraph/frameGraphTypes.js.map +1 -1
- package/FrameGraph/index.d.ts +1 -0
- package/FrameGraph/index.js +1 -0
- package/FrameGraph/index.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js +3 -2
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js.map +1 -1
- package/Materials/Node/Blocks/conditionalBlock.d.ts +2 -0
- package/Materials/Node/Blocks/conditionalBlock.js +13 -0
- package/Materials/Node/Blocks/conditionalBlock.js.map +1 -1
- package/Materials/Node/nodeMaterialBlock.js +4 -1
- package/Materials/Node/nodeMaterialBlock.js.map +1 -1
- package/Materials/Node/nodeMaterialBlockConnectionPoint.js +12 -4
- package/Materials/Node/nodeMaterialBlockConnectionPoint.js.map +1 -1
- package/Materials/Textures/equiRectangularCubeTexture.js +14 -4
- package/Materials/Textures/equiRectangularCubeTexture.js.map +1 -1
- package/Materials/Textures/internalTexture.d.ts +20 -0
- package/Materials/Textures/internalTexture.js +48 -0
- package/Materials/Textures/internalTexture.js.map +1 -1
- package/Materials/Textures/multiRenderTarget.d.ts +5 -0
- package/Materials/Textures/multiRenderTarget.js.map +1 -1
- package/Materials/Textures/textureCreationOptions.d.ts +6 -6
- package/Materials/Textures/textureCreationOptions.js.map +1 -1
- package/Materials/drawWrapper.js +4 -0
- package/Materials/drawWrapper.js.map +1 -1
- package/Materials/effect.js +2 -2
- package/Materials/effect.js.map +1 -1
- package/Materials/material.d.ts +2 -2
- package/Materials/material.js +5 -5
- package/Materials/material.js.map +1 -1
- package/Maths/math.color.d.ts +16 -0
- package/Maths/math.color.js +16 -0
- package/Maths/math.color.js.map +1 -1
- package/Maths/math.vector.d.ts +32 -0
- package/Maths/math.vector.js +32 -0
- package/Maths/math.vector.js.map +1 -1
- package/Meshes/Compression/dracoCompression.d.ts +3 -1
- package/Meshes/Compression/dracoCompression.js +5 -2
- package/Meshes/Compression/dracoCompression.js.map +1 -1
- package/Meshes/Node/Blocks/Matrices/rotationXBlock.d.ts +0 -1
- package/Meshes/Node/Blocks/Matrices/rotationXBlock.js +1 -9
- package/Meshes/Node/Blocks/Matrices/rotationXBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Matrices/rotationYBlock.d.ts +0 -1
- package/Meshes/Node/Blocks/Matrices/rotationYBlock.js +1 -9
- package/Meshes/Node/Blocks/Matrices/rotationYBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Matrices/rotationZBlock.d.ts +0 -1
- package/Meshes/Node/Blocks/Matrices/rotationZBlock.js +1 -9
- package/Meshes/Node/Blocks/Matrices/rotationZBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Set/latticeBlock.js +3 -1
- package/Meshes/Node/Blocks/Set/latticeBlock.js.map +1 -1
- package/Meshes/Node/Blocks/conditionBlock.d.ts +2 -0
- package/Meshes/Node/Blocks/conditionBlock.js +15 -0
- package/Meshes/Node/Blocks/conditionBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryClampBlock.d.ts +4 -4
- package/Meshes/Node/Blocks/geometryClampBlock.js +16 -25
- package/Meshes/Node/Blocks/geometryClampBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryLerpBlock.js +2 -2
- package/Meshes/Node/Blocks/geometryLerpBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryNLerpBlock.js +2 -2
- package/Meshes/Node/Blocks/geometryNLerpBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryReplaceColorBlock.js +2 -2
- package/Meshes/Node/Blocks/geometryReplaceColorBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryRotate2dBlock.js +2 -2
- package/Meshes/Node/Blocks/geometryRotate2dBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometrySmoothStepBlock.js +3 -3
- package/Meshes/Node/Blocks/geometrySmoothStepBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryStepBlock.js +2 -2
- package/Meshes/Node/Blocks/geometryStepBlock.js.map +1 -1
- package/Meshes/Node/nodeGeometry.js +1 -1
- package/Meshes/Node/nodeGeometry.js.map +1 -1
- package/Meshes/Node/nodeGeometryBlock.d.ts +3 -1
- package/Meshes/Node/nodeGeometryBlock.js +2 -1
- package/Meshes/Node/nodeGeometryBlock.js.map +1 -1
- package/Meshes/Node/nodeGeometryBlockConnectionPoint.js +10 -2
- package/Meshes/Node/nodeGeometryBlockConnectionPoint.js.map +1 -1
- package/Meshes/abstractMesh.js +1 -1
- package/Meshes/abstractMesh.js.map +1 -1
- package/Meshes/lattice.material.d.ts +1 -1
- package/Meshes/lattice.material.js +3 -3
- package/Meshes/lattice.material.js.map +1 -1
- package/Misc/observable.d.ts +3 -1
- package/Misc/observable.js +7 -2
- package/Misc/observable.js.map +1 -1
- package/ShadersWGSL/glowMapGeneration.fragment.js +4 -3
- package/ShadersWGSL/glowMapGeneration.fragment.js.map +1 -1
- package/ShadersWGSL/pbr.fragment.js +4 -3
- package/ShadersWGSL/pbr.fragment.js.map +1 -1
- package/package.json +1 -1
- package/scene.js +6 -6
- package/scene.js.map +1 -1
|
@@ -39,10 +39,18 @@ export declare class NodeRenderGraphClearBlock extends NodeRenderGraphBlock {
|
|
|
39
39
|
* Gets the texture input component
|
|
40
40
|
*/
|
|
41
41
|
get texture(): NodeRenderGraphConnectionPoint;
|
|
42
|
+
/**
|
|
43
|
+
* Gets the depth texture input component
|
|
44
|
+
*/
|
|
45
|
+
get depth(): NodeRenderGraphConnectionPoint;
|
|
42
46
|
/**
|
|
43
47
|
* Gets the output component
|
|
44
48
|
*/
|
|
45
49
|
get output(): NodeRenderGraphConnectionPoint;
|
|
50
|
+
/**
|
|
51
|
+
* Gets the output depth component
|
|
52
|
+
*/
|
|
53
|
+
get outputDepth(): NodeRenderGraphConnectionPoint;
|
|
46
54
|
protected _buildBlock(state: NodeRenderGraphBuildState): void;
|
|
47
55
|
protected _dumpPropertiesCode(): string;
|
|
48
56
|
serialize(): any;
|
|
@@ -23,10 +23,14 @@ export class NodeRenderGraphClearBlock extends NodeRenderGraphBlock {
|
|
|
23
23
|
*/
|
|
24
24
|
constructor(name, frameGraph, scene) {
|
|
25
25
|
super(name, frameGraph, scene);
|
|
26
|
-
this.registerInput("texture", NodeRenderGraphBlockConnectionPointTypes.Texture);
|
|
26
|
+
this.registerInput("texture", NodeRenderGraphBlockConnectionPointTypes.Texture, true);
|
|
27
|
+
this.registerInput("depth", NodeRenderGraphBlockConnectionPointTypes.TextureBackBufferDepthStencilAttachment, true);
|
|
27
28
|
this.registerOutput("output", NodeRenderGraphBlockConnectionPointTypes.BasedOnInput);
|
|
29
|
+
this.registerOutput("outputDepth", NodeRenderGraphBlockConnectionPointTypes.BasedOnInput);
|
|
28
30
|
this.texture.addAcceptedConnectionPointTypes(NodeRenderGraphBlockConnectionPointTypes.TextureAll);
|
|
31
|
+
this.depth.addAcceptedConnectionPointTypes(NodeRenderGraphBlockConnectionPointTypes.TextureDepthStencilAttachment);
|
|
29
32
|
this.output._typeConnectionSource = this.texture;
|
|
33
|
+
this.outputDepth._typeConnectionSource = this.depth;
|
|
30
34
|
this._frameGraphTask = new FrameGraphClearTextureTask(name, frameGraph);
|
|
31
35
|
}
|
|
32
36
|
/** Gets or sets the clear color */
|
|
@@ -70,20 +74,37 @@ export class NodeRenderGraphClearBlock extends NodeRenderGraphBlock {
|
|
|
70
74
|
get texture() {
|
|
71
75
|
return this._inputs[0];
|
|
72
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* Gets the depth texture input component
|
|
79
|
+
*/
|
|
80
|
+
get depth() {
|
|
81
|
+
return this._inputs[1];
|
|
82
|
+
}
|
|
73
83
|
/**
|
|
74
84
|
* Gets the output component
|
|
75
85
|
*/
|
|
76
86
|
get output() {
|
|
77
87
|
return this._outputs[0];
|
|
78
88
|
}
|
|
89
|
+
/**
|
|
90
|
+
* Gets the output depth component
|
|
91
|
+
*/
|
|
92
|
+
get outputDepth() {
|
|
93
|
+
return this._outputs[1];
|
|
94
|
+
}
|
|
79
95
|
_buildBlock(state) {
|
|
80
96
|
super._buildBlock(state);
|
|
81
97
|
this._frameGraphTask.name = this.name;
|
|
82
98
|
this._propagateInputValueToOutput(this.texture, this.output);
|
|
99
|
+
this._propagateInputValueToOutput(this.depth, this.outputDepth);
|
|
83
100
|
const textureConnectedPoint = this.texture.connectedPoint;
|
|
84
101
|
if (textureConnectedPoint) {
|
|
85
102
|
this._frameGraphTask.destinationTexture = textureConnectedPoint.value;
|
|
86
103
|
}
|
|
104
|
+
const depthConnectedPoint = this.depth.connectedPoint;
|
|
105
|
+
if (depthConnectedPoint) {
|
|
106
|
+
this._frameGraphTask.depthTexture = depthConnectedPoint.value;
|
|
107
|
+
}
|
|
87
108
|
}
|
|
88
109
|
_dumpPropertiesCode() {
|
|
89
110
|
const codes = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clearBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FrameGraph/Node/Blocks/Textures/clearBlock.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,wCAAwC,EAAE,MAAM,kCAAkC,CAAC;AAC5F,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAA0B,MAAM,sCAAsC,CAAC;AACtG,OAAO,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AAErF;;GAEG;AACH,MAAM,OAAO,yBAA0B,SAAQ,oBAAoB;IAG/D;;OAEG;IACH,IAAoB,IAAI;QACpB,OAAO,IAAI,CAAC,eAAe,CAAC;IAChC,CAAC;IAED;;;;;OAKG;IACH,YAAmB,IAAY,EAAE,UAAsB,EAAE,KAAY;QACjE,KAAK,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;QAE/B,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE,wCAAwC,CAAC,OAAO,CAAC,CAAC;QAChF,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,wCAAwC,CAAC,Y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,EAAE,CAAC;QAC9C,mBAAmB,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;QACjD,mBAAmB,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QACjD,mBAAmB,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QACjD,mBAAmB,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC;QACrD,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEe,YAAY,CAAC,mBAAwB;QACjD,KAAK,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;QACxC,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,SAAS,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;QACzD,IAAI,CAAC,UAAU,GAAG,mBAAmB,CAAC,UAAU,CAAC;QACjD,IAAI,CAAC,UAAU,GAAG,mBAAmB,CAAC,UAAU,CAAC;QACjD,IAAI,CAAC,YAAY,GAAG,mBAAmB,CAAC,YAAY,CAAC;IACzD,CAAC;CACJ;AAjGG;IADC,sBAAsB,CAAC,OAAO,wCAAgC;sDAG9D;AAQD;IADC,sBAAsB,CAAC,aAAa,0CAAkC,SAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;2DAGpG;AAQD;IADC,sBAAsB,CAAC,aAAa,0CAAkC,SAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;2DAGpG;AAQD;IADC,sBAAsB,CAAC,eAAe,0CAAkC,SAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;6DAGtG;AAmEL,aAAa,CAAC,mCAAmC,EAAE,yBAAyB,CAAC,CAAC","sourcesContent":["// eslint-disable-next-line import/no-internal-modules\r\nimport type { NodeRenderGraphConnectionPoint, Scene, FrameGraphTextureHandle, FrameGraph, NodeRenderGraphBuildState } from \"core/index\";\r\nimport { NodeRenderGraphBlock } from \"../../nodeRenderGraphBlock\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { NodeRenderGraphBlockConnectionPointTypes } from \"../../Types/nodeRenderGraphTypes\";\r\nimport { Color4 } from \"../../../../Maths/math.color\";\r\nimport { editableInPropertyPage, PropertyTypeForEdition } from \"../../../../Decorators/nodeDecorator\";\r\nimport { FrameGraphClearTextureTask } from \"../../../Tasks/Texture/clearTextureTask\";\r\n\r\n/**\r\n * Block used to clear a texture\r\n */\r\nexport class NodeRenderGraphClearBlock extends NodeRenderGraphBlock {\r\n protected override _frameGraphTask: FrameGraphClearTextureTask;\r\n\r\n /**\r\n * Gets the frame graph task associated with this block\r\n */\r\n public override get task() {\r\n return this._frameGraphTask;\r\n }\r\n\r\n /**\r\n * Create a new NodeRenderGraphClearBlock\r\n * @param name defines the block name\r\n * @param frameGraph defines the hosting frame graph\r\n * @param scene defines the hosting scene\r\n */\r\n public constructor(name: string, frameGraph: FrameGraph, scene: Scene) {\r\n super(name, frameGraph, scene);\r\n\r\n this.registerInput(\"texture\", NodeRenderGraphBlockConnectionPointTypes.Texture);\r\n this.registerOutput(\"output\", NodeRenderGraphBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this.texture.addAcceptedConnectionPointTypes(NodeRenderGraphBlockConnectionPointTypes.TextureAll);\r\n this.output._typeConnectionSource = this.texture;\r\n\r\n this._frameGraphTask = new FrameGraphClearTextureTask(name, frameGraph);\r\n }\r\n\r\n /** Gets or sets the clear color */\r\n @editableInPropertyPage(\"Color\", PropertyTypeForEdition.Color4)\r\n public get color(): Color4 {\r\n return this._frameGraphTask.color;\r\n }\r\n\r\n public set color(value: Color4) {\r\n this._frameGraphTask.color = value;\r\n }\r\n\r\n /** Gets or sets a boolean indicating whether the color part of the texture should be cleared. */\r\n @editableInPropertyPage(\"Clear color\", PropertyTypeForEdition.Boolean, undefined, { embedded: true })\r\n public get clearColor(): boolean {\r\n return !!this._frameGraphTask.clearColor;\r\n }\r\n\r\n public set clearColor(value: boolean) {\r\n this._frameGraphTask.clearColor = value;\r\n }\r\n\r\n /** Gets or sets a boolean indicating whether the depth part of the texture should be cleared. */\r\n @editableInPropertyPage(\"Clear depth\", PropertyTypeForEdition.Boolean, undefined, { embedded: true })\r\n public get clearDepth(): boolean {\r\n return !!this._frameGraphTask.clearDepth;\r\n }\r\n\r\n public set clearDepth(value: boolean) {\r\n this._frameGraphTask.clearDepth = value;\r\n }\r\n\r\n /** Gets or sets a boolean indicating whether the stencil part of the texture should be cleared. */\r\n @editableInPropertyPage(\"Clear stencil\", PropertyTypeForEdition.Boolean, undefined, { embedded: true })\r\n public get clearStencil(): boolean {\r\n return !!this._frameGraphTask.clearStencil;\r\n }\r\n\r\n public set clearStencil(value: boolean) {\r\n this._frameGraphTask.clearStencil = value;\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"NodeRenderGraphClearBlock\";\r\n }\r\n /**\r\n * Gets the texture input component\r\n */\r\n public get texture(): NodeRenderGraphConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeRenderGraphConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected override _buildBlock(state: NodeRenderGraphBuildState) {\r\n super._buildBlock(state);\r\n\r\n this._frameGraphTask.name = this.name;\r\n\r\n this._propagateInputValueToOutput(this.texture, this.output);\r\n\r\n const textureConnectedPoint = this.texture.connectedPoint;\r\n if (textureConnectedPoint) {\r\n this._frameGraphTask.destinationTexture = textureConnectedPoint.value as FrameGraphTextureHandle;\r\n }\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n const codes: string[] = [];\r\n codes.push(`${this._codeVariableName}.color = new BABYLON.Color4(${this.color.r}, ${this.color.g}, ${this.color.b}, ${this.color.a});`);\r\n codes.push(`${this._codeVariableName}.clearColor = ${this.clearColor};`);\r\n codes.push(`${this._codeVariableName}.clearDepth = ${this.clearDepth};`);\r\n codes.push(`${this._codeVariableName}.clearStencil = ${this.clearStencil};`);\r\n return super._dumpPropertiesCode() + codes.join(\"\\n\");\r\n }\r\n\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.color = this.color.asArray();\r\n serializationObject.clearColor = this.clearColor;\r\n serializationObject.clearDepth = this.clearDepth;\r\n serializationObject.clearStencil = this.clearStencil;\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n this.color = Color4.FromArray(serializationObject.color);\r\n this.clearColor = serializationObject.clearColor;\r\n this.clearDepth = serializationObject.clearDepth;\r\n this.clearStencil = serializationObject.clearStencil;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.NodeRenderGraphClearBlock\", NodeRenderGraphClearBlock);\r\n"]}
|
|
1
|
+
{"version":3,"file":"clearBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FrameGraph/Node/Blocks/Textures/clearBlock.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,wCAAwC,EAAE,MAAM,kCAAkC,CAAC;AAC5F,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAA0B,MAAM,sCAAsC,CAAC;AACtG,OAAO,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AAErF;;GAEG;AACH,MAAM,OAAO,yBAA0B,SAAQ,oBAAoB;IAG/D;;OAEG;IACH,IAAoB,IAAI;QACpB,OAAO,IAAI,CAAC,eAAe,CAAC;IAChC,CAAC;IAED;;;;;OAKG;IACH,YAAmB,IAAY,EAAE,UAAsB,EAAE,KAAY;QACjE,KAAK,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;QAE/B,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE,wCAAwC,CAAC,OAAO,EAAE,IAAI,CAAC,CA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AK,GAAG,MAAM,CAAC,SAAS,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;QACzD,IAAI,CAAC,UAAU,GAAG,mBAAmB,CAAC,UAAU,CAAC;QACjD,IAAI,CAAC,UAAU,GAAG,mBAAmB,CAAC,UAAU,CAAC;QACjD,IAAI,CAAC,YAAY,GAAG,mBAAmB,CAAC,YAAY,CAAC;IACzD,CAAC;CACJ;AAtHG;IADC,sBAAsB,CAAC,OAAO,wCAAgC;sDAG9D;AAQD;IADC,sBAAsB,CAAC,aAAa,0CAAkC,SAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;2DAGpG;AAQD;IADC,sBAAsB,CAAC,aAAa,0CAAkC,SAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;2DAGpG;AAQD;IADC,sBAAsB,CAAC,eAAe,0CAAkC,SAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;6DAGtG;AAwFL,aAAa,CAAC,mCAAmC,EAAE,yBAAyB,CAAC,CAAC","sourcesContent":["// eslint-disable-next-line import/no-internal-modules\r\nimport type { NodeRenderGraphConnectionPoint, Scene, FrameGraphTextureHandle, FrameGraph, NodeRenderGraphBuildState } from \"core/index\";\r\nimport { NodeRenderGraphBlock } from \"../../nodeRenderGraphBlock\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { NodeRenderGraphBlockConnectionPointTypes } from \"../../Types/nodeRenderGraphTypes\";\r\nimport { Color4 } from \"../../../../Maths/math.color\";\r\nimport { editableInPropertyPage, PropertyTypeForEdition } from \"../../../../Decorators/nodeDecorator\";\r\nimport { FrameGraphClearTextureTask } from \"../../../Tasks/Texture/clearTextureTask\";\r\n\r\n/**\r\n * Block used to clear a texture\r\n */\r\nexport class NodeRenderGraphClearBlock extends NodeRenderGraphBlock {\r\n protected override _frameGraphTask: FrameGraphClearTextureTask;\r\n\r\n /**\r\n * Gets the frame graph task associated with this block\r\n */\r\n public override get task() {\r\n return this._frameGraphTask;\r\n }\r\n\r\n /**\r\n * Create a new NodeRenderGraphClearBlock\r\n * @param name defines the block name\r\n * @param frameGraph defines the hosting frame graph\r\n * @param scene defines the hosting scene\r\n */\r\n public constructor(name: string, frameGraph: FrameGraph, scene: Scene) {\r\n super(name, frameGraph, scene);\r\n\r\n this.registerInput(\"texture\", NodeRenderGraphBlockConnectionPointTypes.Texture, true);\r\n this.registerInput(\"depth\", NodeRenderGraphBlockConnectionPointTypes.TextureBackBufferDepthStencilAttachment, true);\r\n\r\n this.registerOutput(\"output\", NodeRenderGraphBlockConnectionPointTypes.BasedOnInput);\r\n this.registerOutput(\"outputDepth\", NodeRenderGraphBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this.texture.addAcceptedConnectionPointTypes(NodeRenderGraphBlockConnectionPointTypes.TextureAll);\r\n this.depth.addAcceptedConnectionPointTypes(NodeRenderGraphBlockConnectionPointTypes.TextureDepthStencilAttachment);\r\n\r\n this.output._typeConnectionSource = this.texture;\r\n this.outputDepth._typeConnectionSource = this.depth;\r\n\r\n this._frameGraphTask = new FrameGraphClearTextureTask(name, frameGraph);\r\n }\r\n\r\n /** Gets or sets the clear color */\r\n @editableInPropertyPage(\"Color\", PropertyTypeForEdition.Color4)\r\n public get color(): Color4 {\r\n return this._frameGraphTask.color;\r\n }\r\n\r\n public set color(value: Color4) {\r\n this._frameGraphTask.color = value;\r\n }\r\n\r\n /** Gets or sets a boolean indicating whether the color part of the texture should be cleared. */\r\n @editableInPropertyPage(\"Clear color\", PropertyTypeForEdition.Boolean, undefined, { embedded: true })\r\n public get clearColor(): boolean {\r\n return !!this._frameGraphTask.clearColor;\r\n }\r\n\r\n public set clearColor(value: boolean) {\r\n this._frameGraphTask.clearColor = value;\r\n }\r\n\r\n /** Gets or sets a boolean indicating whether the depth part of the texture should be cleared. */\r\n @editableInPropertyPage(\"Clear depth\", PropertyTypeForEdition.Boolean, undefined, { embedded: true })\r\n public get clearDepth(): boolean {\r\n return !!this._frameGraphTask.clearDepth;\r\n }\r\n\r\n public set clearDepth(value: boolean) {\r\n this._frameGraphTask.clearDepth = value;\r\n }\r\n\r\n /** Gets or sets a boolean indicating whether the stencil part of the texture should be cleared. */\r\n @editableInPropertyPage(\"Clear stencil\", PropertyTypeForEdition.Boolean, undefined, { embedded: true })\r\n public get clearStencil(): boolean {\r\n return !!this._frameGraphTask.clearStencil;\r\n }\r\n\r\n public set clearStencil(value: boolean) {\r\n this._frameGraphTask.clearStencil = value;\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"NodeRenderGraphClearBlock\";\r\n }\r\n\r\n /**\r\n * Gets the texture input component\r\n */\r\n public get texture(): NodeRenderGraphConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the depth texture input component\r\n */\r\n public get depth(): NodeRenderGraphConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeRenderGraphConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n /**\r\n * Gets the output depth component\r\n */\r\n public get outputDepth(): NodeRenderGraphConnectionPoint {\r\n return this._outputs[1];\r\n }\r\n\r\n protected override _buildBlock(state: NodeRenderGraphBuildState) {\r\n super._buildBlock(state);\r\n\r\n this._frameGraphTask.name = this.name;\r\n\r\n this._propagateInputValueToOutput(this.texture, this.output);\r\n this._propagateInputValueToOutput(this.depth, this.outputDepth);\r\n\r\n const textureConnectedPoint = this.texture.connectedPoint;\r\n if (textureConnectedPoint) {\r\n this._frameGraphTask.destinationTexture = textureConnectedPoint.value as FrameGraphTextureHandle;\r\n }\r\n\r\n const depthConnectedPoint = this.depth.connectedPoint;\r\n if (depthConnectedPoint) {\r\n this._frameGraphTask.depthTexture = depthConnectedPoint.value as FrameGraphTextureHandle;\r\n }\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n const codes: string[] = [];\r\n codes.push(`${this._codeVariableName}.color = new BABYLON.Color4(${this.color.r}, ${this.color.g}, ${this.color.b}, ${this.color.a});`);\r\n codes.push(`${this._codeVariableName}.clearColor = ${this.clearColor};`);\r\n codes.push(`${this._codeVariableName}.clearDepth = ${this.clearDepth};`);\r\n codes.push(`${this._codeVariableName}.clearStencil = ${this.clearStencil};`);\r\n return super._dumpPropertiesCode() + codes.join(\"\\n\");\r\n }\r\n\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.color = this.color.asArray();\r\n serializationObject.clearColor = this.clearColor;\r\n serializationObject.clearDepth = this.clearDepth;\r\n serializationObject.clearStencil = this.clearStencil;\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n this.color = Color4.FromArray(serializationObject.color);\r\n this.clearColor = serializationObject.clearColor;\r\n this.clearDepth = serializationObject.clearDepth;\r\n this.clearStencil = serializationObject.clearStencil;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.NodeRenderGraphClearBlock\", NodeRenderGraphClearBlock);\r\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { NodeRenderGraphConnectionPoint, Scene, FrameGraph, NodeRenderGraphBuildState, Camera,
|
|
1
|
+
import type { NodeRenderGraphConnectionPoint, Scene, FrameGraph, NodeRenderGraphBuildState, Camera, InternalTexture, Nullable, FrameGraphTextureCreationOptions, FrameGraphObjectList } from "../../../index.js";
|
|
2
2
|
import { Observable } from "../../../Misc/observable";
|
|
3
3
|
import { NodeRenderGraphBlockConnectionPointTypes } from "../Types/nodeRenderGraphTypes";
|
|
4
4
|
import { NodeRenderGraphBlock } from "../nodeRenderGraphBlock";
|
|
5
|
-
export type NodeRenderGraphValueType =
|
|
5
|
+
export type NodeRenderGraphValueType = InternalTexture | Camera | FrameGraphObjectList;
|
|
6
6
|
export type NodeRenderGraphInputCreationOptions = FrameGraphTextureCreationOptions;
|
|
7
7
|
/**
|
|
8
8
|
* Block used to expose an input value
|
|
@@ -43,13 +43,8 @@ export declare class NodeRenderGraphInputBlock extends NodeRenderGraphBlock {
|
|
|
43
43
|
*/
|
|
44
44
|
getTypedValue<T extends NodeRenderGraphValueType>(): T;
|
|
45
45
|
/**
|
|
46
|
-
* Gets the value as
|
|
47
|
-
* @returns The
|
|
48
|
-
*/
|
|
49
|
-
getValueAsRenderTargetWrapper(): Nullable<RenderTargetWrapper>;
|
|
50
|
-
/**
|
|
51
|
-
* Gets the value as a render target wrapper
|
|
52
|
-
* @returns The internal texture stored in value if value is a render target wrapper or a thin texture, otherwise null
|
|
46
|
+
* Gets the value as an internal texture
|
|
47
|
+
* @returns The internal texture stored in value if value is an internal texture, otherwise null
|
|
53
48
|
*/
|
|
54
49
|
getInternalTextureFromValue(): Nullable<InternalTexture>;
|
|
55
50
|
/**
|
|
@@ -58,12 +58,10 @@ export class NodeRenderGraphInputBlock extends NodeRenderGraphBlock {
|
|
|
58
58
|
size: { width: 100, height: 100 },
|
|
59
59
|
options: {
|
|
60
60
|
createMipMaps: false,
|
|
61
|
-
generateMipMaps: false,
|
|
62
61
|
types: [0],
|
|
63
62
|
formats: [5],
|
|
64
63
|
samples: 1,
|
|
65
64
|
useSRGBBuffers: [false],
|
|
66
|
-
generateDepthBuffer: false,
|
|
67
65
|
},
|
|
68
66
|
sizeIsPercentage: true,
|
|
69
67
|
};
|
|
@@ -75,13 +73,11 @@ export class NodeRenderGraphInputBlock extends NodeRenderGraphBlock {
|
|
|
75
73
|
size: { width: 100, height: 100 },
|
|
76
74
|
options: {
|
|
77
75
|
createMipMaps: false,
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
76
|
+
types: [0],
|
|
77
|
+
formats: [13],
|
|
78
|
+
useSRGBBuffers: [false],
|
|
79
|
+
labels: [this.name],
|
|
81
80
|
samples: 1,
|
|
82
|
-
generateDepthTexture: true,
|
|
83
|
-
generateDepthBuffer: true,
|
|
84
|
-
generateStencilBuffer: true,
|
|
85
81
|
},
|
|
86
82
|
sizeIsPercentage: true,
|
|
87
83
|
};
|
|
@@ -119,22 +115,12 @@ export class NodeRenderGraphInputBlock extends NodeRenderGraphBlock {
|
|
|
119
115
|
return this._storedValue;
|
|
120
116
|
}
|
|
121
117
|
/**
|
|
122
|
-
* Gets the value as
|
|
123
|
-
* @returns The
|
|
124
|
-
*/
|
|
125
|
-
getValueAsRenderTargetWrapper() {
|
|
126
|
-
if (this._storedValue.shareDepth) {
|
|
127
|
-
return this._storedValue;
|
|
128
|
-
}
|
|
129
|
-
return null;
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Gets the value as a render target wrapper
|
|
133
|
-
* @returns The internal texture stored in value if value is a render target wrapper or a thin texture, otherwise null
|
|
118
|
+
* Gets the value as an internal texture
|
|
119
|
+
* @returns The internal texture stored in value if value is an internal texture, otherwise null
|
|
134
120
|
*/
|
|
135
121
|
getInternalTextureFromValue() {
|
|
136
|
-
if (this._storedValue.
|
|
137
|
-
return this._storedValue
|
|
122
|
+
if (this._storedValue._swapAndDie) {
|
|
123
|
+
return this._storedValue;
|
|
138
124
|
}
|
|
139
125
|
return null;
|
|
140
126
|
}
|
|
@@ -205,9 +191,9 @@ export class NodeRenderGraphInputBlock extends NodeRenderGraphBlock {
|
|
|
205
191
|
if (this._storedValue === undefined || this._storedValue === null) {
|
|
206
192
|
throw new Error(`NodeRenderGraphInputBlock: External input "${this.name}" is not set`);
|
|
207
193
|
}
|
|
208
|
-
const texture = this.
|
|
194
|
+
const texture = this.getInternalTextureFromValue();
|
|
209
195
|
if (texture) {
|
|
210
|
-
this.output.value = this._frameGraph.importTexture(this.name, texture, this.output.value);
|
|
196
|
+
this.output.value = this._frameGraph.textureManager.importTexture(this.name, texture, this.output.value);
|
|
211
197
|
}
|
|
212
198
|
}
|
|
213
199
|
return;
|
|
@@ -217,7 +203,7 @@ export class NodeRenderGraphInputBlock extends NodeRenderGraphBlock {
|
|
|
217
203
|
if (!textureCreateOptions) {
|
|
218
204
|
throw new Error(`NodeRenderGraphInputBlock: Creation options are missing for texture "${this.name}"`);
|
|
219
205
|
}
|
|
220
|
-
this.output.value = this._frameGraph.createRenderTargetTexture(this.name, textureCreateOptions);
|
|
206
|
+
this.output.value = this._frameGraph.textureManager.createRenderTargetTexture(this.name, textureCreateOptions);
|
|
221
207
|
}
|
|
222
208
|
}
|
|
223
209
|
dispose() {
|
|
@@ -259,6 +245,10 @@ export class NodeRenderGraphInputBlock extends NodeRenderGraphBlock {
|
|
|
259
245
|
this.output.type = this._type;
|
|
260
246
|
this.isExternal = serializationObject.isExternal;
|
|
261
247
|
if (serializationObject.creationOptions) {
|
|
248
|
+
if (serializationObject.creationOptions.options.depthTextureFormat !== undefined) {
|
|
249
|
+
// Backward compatibility - remove this code in the future
|
|
250
|
+
serializationObject.creationOptions.options.formats = [serializationObject.creationOptions.options.depthTextureFormat];
|
|
251
|
+
}
|
|
262
252
|
this.creationOptions = serializationObject.creationOptions;
|
|
263
253
|
}
|
|
264
254
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inputBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Node/Blocks/inputBlock.ts"],"names":[],"mappings":";AAcA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,wCAAwC,EAAE,MAAM,+BAA+B,CAAC;AACzF,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAA0B,MAAM,mCAAmC,CAAC;AACnG,OAAO,EAAE,4BAA4B,EAAE,mCAAmC,EAAE,MAAM,qCAAqC,CAAC;AACxH,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAMvD;;GAEG;AACH,MAAM,OAAO,yBAA0B,SAAQ,oBAAoB;IAc/D;;OAEG;IACH,IAAW,IAAI;QACX,OAAO,IAAI,CAAC,KAAK,CAAC;I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AkC,YAAY,CAAC;6DAC1D;AA8Q9B,aAAa,CAAC,mCAAmC,EAAE,yBAAyB,CAAC,CAAC","sourcesContent":["/* eslint-disable import/no-internal-modules */\r\nimport type {\r\n NodeRenderGraphConnectionPoint,\r\n Scene,\r\n FrameGraph,\r\n NodeRenderGraphBuildState,\r\n Camera,\r\n RenderTargetWrapper,\r\n InternalTexture,\r\n Nullable,\r\n FrameGraphTextureCreationOptions,\r\n FrameGraphTextureHandle,\r\n FrameGraphObjectList,\r\n} from \"core/index\";\r\nimport { Observable } from \"../../../Misc/observable\";\r\nimport { NodeRenderGraphBlockConnectionPointTypes } from \"../Types/nodeRenderGraphTypes\";\r\nimport { NodeRenderGraphBlock } from \"../nodeRenderGraphBlock\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { editableInPropertyPage, PropertyTypeForEdition } from \"../../../Decorators/nodeDecorator\";\r\nimport { backbufferColorTextureHandle, backbufferDepthStencilTextureHandle } from \"../../../FrameGraph/frameGraphTypes\";\r\nimport { Constants } from \"../../../Engines/constants\";\r\n\r\nexport type NodeRenderGraphValueType = RenderTargetWrapper | Camera | FrameGraphObjectList;\r\n\r\nexport type NodeRenderGraphInputCreationOptions = FrameGraphTextureCreationOptions;\r\n\r\n/**\r\n * Block used to expose an input value\r\n */\r\nexport class NodeRenderGraphInputBlock extends NodeRenderGraphBlock {\r\n private _storedValue: Nullable<NodeRenderGraphValueType> = null;\r\n private _type: NodeRenderGraphBlockConnectionPointTypes = NodeRenderGraphBlockConnectionPointTypes.Undefined;\r\n\r\n /** Gets an observable raised when the value is changed */\r\n public onValueChangedObservable = new Observable<NodeRenderGraphInputBlock>();\r\n\r\n /** Indicates that the input is externally managed */\r\n @editableInPropertyPage(\"Is external\", PropertyTypeForEdition.Boolean, \"PROPERTIES\")\r\n public isExternal = false;\r\n\r\n /** Gets or sets the options to create the input value */\r\n public creationOptions: NodeRenderGraphInputCreationOptions;\r\n\r\n /**\r\n * Gets or sets the connection point type (default is Undefined)\r\n */\r\n public get type(): NodeRenderGraphBlockConnectionPointTypes {\r\n return this._type;\r\n }\r\n\r\n /**\r\n * Creates a new NodeRenderGraphInputBlock\r\n * @param name defines the block name\r\n * @param frameGraph defines the hosting frame graph\r\n * @param scene defines the hosting scene\r\n * @param type defines the type of the input (can be set to NodeRenderGraphBlockConnectionPointTypes.Undefined)\r\n */\r\n public constructor(name: string, frameGraph: FrameGraph, scene: Scene, type: NodeRenderGraphBlockConnectionPointTypes = NodeRenderGraphBlockConnectionPointTypes.Undefined) {\r\n super(name, frameGraph, scene);\r\n\r\n this._type = type;\r\n this._isInput = true;\r\n this.registerOutput(\"output\", type);\r\n this.setDefaultValue();\r\n }\r\n\r\n /**\r\n * Set the input block to its default value (based on its type)\r\n */\r\n public setDefaultValue() {\r\n switch (this.type) {\r\n case NodeRenderGraphBlockConnectionPointTypes.Texture:\r\n case NodeRenderGraphBlockConnectionPointTypes.TextureViewDepth:\r\n case NodeRenderGraphBlockConnectionPointTypes.TextureScreenDepth:\r\n case NodeRenderGraphBlockConnectionPointTypes.TextureViewNormal:\r\n case NodeRenderGraphBlockConnectionPointTypes.TextureWorldNormal:\r\n case NodeRenderGraphBlockConnectionPointTypes.TextureAlbedo:\r\n case NodeRenderGraphBlockConnectionPointTypes.TextureReflectivity:\r\n case NodeRenderGraphBlockConnectionPointTypes.TextureLocalPosition:\r\n case NodeRenderGraphBlockConnectionPointTypes.TextureWorldPosition:\r\n case NodeRenderGraphBlockConnectionPointTypes.TextureVelocity:\r\n case NodeRenderGraphBlockConnectionPointTypes.TextureLinearVelocity:\r\n case NodeRenderGraphBlockConnectionPointTypes.TextureIrradiance:\r\n case NodeRenderGraphBlockConnectionPointTypes.TextureAlbedoSqrt: {\r\n const options: FrameGraphTextureCreationOptions = {\r\n size: { width: 100, height: 100 },\r\n options: {\r\n createMipMaps: false,\r\n generateMipMaps: false,\r\n types: [Constants.TEXTURETYPE_UNSIGNED_BYTE],\r\n formats: [Constants.TEXTUREFORMAT_RGBA],\r\n samples: 1,\r\n useSRGBBuffers: [false],\r\n generateDepthBuffer: false,\r\n },\r\n sizeIsPercentage: true,\r\n };\r\n this.creationOptions = options;\r\n break;\r\n }\r\n case NodeRenderGraphBlockConnectionPointTypes.TextureDepthStencilAttachment: {\r\n const options: FrameGraphTextureCreationOptions = {\r\n size: { width: 100, height: 100 },\r\n options: {\r\n createMipMaps: false,\r\n generateMipMaps: false,\r\n depthTextureFormat: Constants.TEXTUREFORMAT_DEPTH24_STENCIL8,\r\n textureCount: 0,\r\n samples: 1,\r\n generateDepthTexture: true,\r\n generateDepthBuffer: true,\r\n generateStencilBuffer: true,\r\n },\r\n sizeIsPercentage: true,\r\n };\r\n this.creationOptions = options;\r\n break;\r\n }\r\n case NodeRenderGraphBlockConnectionPointTypes.ObjectList:\r\n this.value = { meshes: [], particleSystems: [] };\r\n this.isExternal = true;\r\n break;\r\n case NodeRenderGraphBlockConnectionPointTypes.Camera:\r\n this.value = this._scene.cameras[0];\r\n this.isExternal = true;\r\n break;\r\n default:\r\n this.isExternal = true;\r\n }\r\n }\r\n\r\n /**\r\n * Gets or sets the value of that point.\r\n */\r\n public get value(): Nullable<NodeRenderGraphValueType> {\r\n return this._storedValue;\r\n }\r\n\r\n public set value(value: Nullable<NodeRenderGraphValueType>) {\r\n this._storedValue = value;\r\n this.output.value = undefined;\r\n this.onValueChangedObservable.notifyObservers(this);\r\n }\r\n\r\n /**\r\n * Gets the value as a specific type\r\n * @returns the value as a specific type\r\n */\r\n public getTypedValue<T extends NodeRenderGraphValueType>(): T {\r\n return this._storedValue as T;\r\n }\r\n\r\n /**\r\n * Gets the value as a render target wrapper\r\n * @returns The value as a render target wrapper if it is a render target wrapper, otherwise undefined\r\n */\r\n public getValueAsRenderTargetWrapper(): Nullable<RenderTargetWrapper> {\r\n if ((this._storedValue as RenderTargetWrapper).shareDepth) {\r\n return this._storedValue as RenderTargetWrapper;\r\n }\r\n return null;\r\n }\r\n\r\n /**\r\n * Gets the value as a render target wrapper\r\n * @returns The internal texture stored in value if value is a render target wrapper or a thin texture, otherwise null\r\n */\r\n public getInternalTextureFromValue(): Nullable<InternalTexture> {\r\n if ((this._storedValue as RenderTargetWrapper).shareDepth) {\r\n return (this._storedValue as RenderTargetWrapper).texture;\r\n }\r\n return null;\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"NodeRenderGraphInputBlock\";\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeRenderGraphConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n /**\r\n * Check if the block is a texture of any type\r\n * @returns true if the block is a texture\r\n */\r\n public isAnyTexture(): boolean {\r\n return (this.type & NodeRenderGraphBlockConnectionPointTypes.TextureAll) !== 0;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating that the connection point is the back buffer texture\r\n * @returns true if the connection point is the back buffer texture\r\n */\r\n public isBackBuffer() {\r\n return (this.type & NodeRenderGraphBlockConnectionPointTypes.TextureBackBuffer) !== 0;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating that the connection point is a depth/stencil attachment texture\r\n * @returns true if the connection point is a depth/stencil attachment texture\r\n */\r\n public isBackBufferDepthStencilAttachment() {\r\n return (this.type & NodeRenderGraphBlockConnectionPointTypes.TextureBackBufferDepthStencilAttachment) !== 0;\r\n }\r\n\r\n /**\r\n * Check if the block is a camera\r\n * @returns true if the block is a camera\r\n */\r\n public isCamera(): boolean {\r\n return (this.type & NodeRenderGraphBlockConnectionPointTypes.Camera) !== 0;\r\n }\r\n\r\n /**\r\n * Check if the block is an object list\r\n * @returns true if the block is an object list\r\n */\r\n public isObjectList(): boolean {\r\n return (this.type & NodeRenderGraphBlockConnectionPointTypes.ObjectList) !== 0;\r\n }\r\n\r\n protected override _buildBlock(state: NodeRenderGraphBuildState) {\r\n super._buildBlock(state);\r\n\r\n if (this.isExternal) {\r\n if (this.isBackBuffer()) {\r\n this.output.value = backbufferColorTextureHandle;\r\n } else if (this.isBackBufferDepthStencilAttachment()) {\r\n this.output.value = backbufferDepthStencilTextureHandle;\r\n } else if (this.isCamera()) {\r\n this.output.value = this.getTypedValue<Camera>();\r\n } else if (this.isObjectList()) {\r\n this.output.value = this.getTypedValue<FrameGraphObjectList>();\r\n } else {\r\n if (this._storedValue === undefined || this._storedValue === null) {\r\n throw new Error(`NodeRenderGraphInputBlock: External input \"${this.name}\" is not set`);\r\n }\r\n const texture = this.getValueAsRenderTargetWrapper();\r\n if (texture) {\r\n this.output.value = this._frameGraph.importTexture(this.name, texture, this.output.value as FrameGraphTextureHandle);\r\n }\r\n }\r\n return;\r\n }\r\n\r\n if ((this.type & NodeRenderGraphBlockConnectionPointTypes.TextureAllButBackBuffer) !== 0) {\r\n const textureCreateOptions = this.creationOptions as FrameGraphTextureCreationOptions;\r\n\r\n if (!textureCreateOptions) {\r\n throw new Error(`NodeRenderGraphInputBlock: Creation options are missing for texture \"${this.name}\"`);\r\n }\r\n\r\n this.output.value = this._frameGraph.createRenderTargetTexture(this.name, textureCreateOptions);\r\n }\r\n }\r\n\r\n public override dispose() {\r\n this._storedValue = null;\r\n this.onValueChangedObservable.clear();\r\n super.dispose();\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n const codes: string[] = [];\r\n codes.push(`${this._codeVariableName}.isExternal = ${this.isExternal};`);\r\n if (this.isAnyTexture()) {\r\n if (!this.isExternal) {\r\n codes.push(`${this._codeVariableName}.creationOptions = ${JSON.stringify(this.creationOptions)};`);\r\n } else {\r\n codes.push(`${this._codeVariableName}.value = EXTERNAL_TEXTURE; // TODO: set the external texture`);\r\n }\r\n } else if (this.isCamera()) {\r\n codes.push(`${this._codeVariableName}.value = EXTERNAL_CAMERA; // TODO: set the external camera`);\r\n } else if (this.isObjectList()) {\r\n codes.push(`${this._codeVariableName}.value = EXTERNAL_OBJECT_LIST; // TODO: set the external object list`);\r\n }\r\n return super._dumpPropertiesCode() + codes.join(\"\\n\");\r\n }\r\n\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.type = this.type;\r\n serializationObject.isExternal = this.isExternal;\r\n if (this.creationOptions) {\r\n serializationObject.creationOptions = this.creationOptions;\r\n }\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n this._type = serializationObject.type;\r\n this.output.type = this._type;\r\n this.isExternal = serializationObject.isExternal;\r\n if (serializationObject.creationOptions) {\r\n this.creationOptions = serializationObject.creationOptions;\r\n }\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.NodeRenderGraphInputBlock\", NodeRenderGraphInputBlock);\r\n"]}
|
|
1
|
+
{"version":3,"file":"inputBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Node/Blocks/inputBlock.ts"],"names":[],"mappings":";AAaA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,wCAAwC,EAAE,MAAM,+BAA+B,CAAC;AACzF,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAA0B,MAAM,mCAAmC,CAAC;AACnG,OAAO,EAAE,4BAA4B,EAAE,mCAAmC,EAAE,MAAM,qCAAqC,CAAC;AACxH,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAMvD;;GAEG;AACH,MAAM,OAAO,yBAA0B,SAAQ,oBAAoB;IAc/D;;OAEG;IACH,IAAW,IAAI;QACX,OAAO,IAAI,CAAC,KAAK,CAAC;IACtB,CAAC;IAED;;;;;;OAMG;IACH,YAAmB,IAAY,EAAE,UAAsB,EAAE,KAAY,EAAE,OAAiD,wCAAwC,CAAC,SAAS;QACtK,KAAK,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;QA5B3B,iBAAY,GAAuC,IAAI,CAAC;QACxD,UAAK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\r\n NodeRenderGraphBuildState,\r\n Camera,\r\n InternalTexture,\r\n Nullable,\r\n FrameGraphTextureCreationOptions,\r\n FrameGraphTextureHandle,\r\n FrameGraphObjectList,\r\n} from \"core/index\";\r\nimport { Observable } from \"../../../Misc/observable\";\r\nimport { NodeRenderGraphBlockConnectionPointTypes } from \"../Types/nodeRenderGraphTypes\";\r\nimport { NodeRenderGraphBlock } from \"../nodeRenderGraphBlock\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { editableInPropertyPage, PropertyTypeForEdition } from \"../../../Decorators/nodeDecorator\";\r\nimport { backbufferColorTextureHandle, backbufferDepthStencilTextureHandle } from \"../../../FrameGraph/frameGraphTypes\";\r\nimport { Constants } from \"../../../Engines/constants\";\r\n\r\nexport type NodeRenderGraphValueType = InternalTexture | Camera | FrameGraphObjectList;\r\n\r\nexport type NodeRenderGraphInputCreationOptions = FrameGraphTextureCreationOptions;\r\n\r\n/**\r\n * Block used to expose an input value\r\n */\r\nexport class NodeRenderGraphInputBlock extends NodeRenderGraphBlock {\r\n private _storedValue: Nullable<NodeRenderGraphValueType> = null;\r\n private _type: NodeRenderGraphBlockConnectionPointTypes = NodeRenderGraphBlockConnectionPointTypes.Undefined;\r\n\r\n /** Gets an observable raised when the value is changed */\r\n public onValueChangedObservable = new Observable<NodeRenderGraphInputBlock>();\r\n\r\n /** Indicates that the input is externally managed */\r\n @editableInPropertyPage(\"Is external\", PropertyTypeForEdition.Boolean, \"PROPERTIES\")\r\n public isExternal = false;\r\n\r\n /** Gets or sets the options to create the input value */\r\n public creationOptions: NodeRenderGraphInputCreationOptions;\r\n\r\n /**\r\n * Gets or sets the connection point type (default is Undefined)\r\n */\r\n public get type(): NodeRenderGraphBlockConnectionPointTypes {\r\n return this._type;\r\n }\r\n\r\n /**\r\n * Creates a new NodeRenderGraphInputBlock\r\n * @param name defines the block name\r\n * @param frameGraph defines the hosting frame graph\r\n * @param scene defines the hosting scene\r\n * @param type defines the type of the input (can be set to NodeRenderGraphBlockConnectionPointTypes.Undefined)\r\n */\r\n public constructor(name: string, frameGraph: FrameGraph, scene: Scene, type: NodeRenderGraphBlockConnectionPointTypes = NodeRenderGraphBlockConnectionPointTypes.Undefined) {\r\n super(name, frameGraph, scene);\r\n\r\n this._type = type;\r\n this._isInput = true;\r\n this.registerOutput(\"output\", type);\r\n this.setDefaultValue();\r\n }\r\n\r\n /**\r\n * Set the input block to its default value (based on its type)\r\n */\r\n public setDefaultValue() {\r\n switch (this.type) {\r\n case NodeRenderGraphBlockConnectionPointTypes.Texture:\r\n case NodeRenderGraphBlockConnectionPointTypes.TextureViewDepth:\r\n case NodeRenderGraphBlockConnectionPointTypes.TextureScreenDepth:\r\n case NodeRenderGraphBlockConnectionPointTypes.TextureViewNormal:\r\n case NodeRenderGraphBlockConnectionPointTypes.TextureWorldNormal:\r\n case NodeRenderGraphBlockConnectionPointTypes.TextureAlbedo:\r\n case NodeRenderGraphBlockConnectionPointTypes.TextureReflectivity:\r\n case NodeRenderGraphBlockConnectionPointTypes.TextureLocalPosition:\r\n case NodeRenderGraphBlockConnectionPointTypes.TextureWorldPosition:\r\n case NodeRenderGraphBlockConnectionPointTypes.TextureVelocity:\r\n case NodeRenderGraphBlockConnectionPointTypes.TextureLinearVelocity:\r\n case NodeRenderGraphBlockConnectionPointTypes.TextureIrradiance:\r\n case NodeRenderGraphBlockConnectionPointTypes.TextureAlbedoSqrt: {\r\n const options: FrameGraphTextureCreationOptions = {\r\n size: { width: 100, height: 100 },\r\n options: {\r\n createMipMaps: false,\r\n types: [Constants.TEXTURETYPE_UNSIGNED_BYTE],\r\n formats: [Constants.TEXTUREFORMAT_RGBA],\r\n samples: 1,\r\n useSRGBBuffers: [false],\r\n },\r\n sizeIsPercentage: true,\r\n };\r\n this.creationOptions = options;\r\n break;\r\n }\r\n case NodeRenderGraphBlockConnectionPointTypes.TextureDepthStencilAttachment: {\r\n const options: FrameGraphTextureCreationOptions = {\r\n size: { width: 100, height: 100 },\r\n options: {\r\n createMipMaps: false,\r\n types: [Constants.TEXTURETYPE_UNSIGNED_BYTE],\r\n formats: [Constants.TEXTUREFORMAT_DEPTH24_STENCIL8],\r\n useSRGBBuffers: [false],\r\n labels: [this.name],\r\n samples: 1,\r\n },\r\n sizeIsPercentage: true,\r\n };\r\n this.creationOptions = options;\r\n break;\r\n }\r\n case NodeRenderGraphBlockConnectionPointTypes.ObjectList:\r\n this.value = { meshes: [], particleSystems: [] };\r\n this.isExternal = true;\r\n break;\r\n case NodeRenderGraphBlockConnectionPointTypes.Camera:\r\n this.value = this._scene.cameras[0];\r\n this.isExternal = true;\r\n break;\r\n default:\r\n this.isExternal = true;\r\n }\r\n }\r\n\r\n /**\r\n * Gets or sets the value of that point.\r\n */\r\n public get value(): Nullable<NodeRenderGraphValueType> {\r\n return this._storedValue;\r\n }\r\n\r\n public set value(value: Nullable<NodeRenderGraphValueType>) {\r\n this._storedValue = value;\r\n this.output.value = undefined;\r\n this.onValueChangedObservable.notifyObservers(this);\r\n }\r\n\r\n /**\r\n * Gets the value as a specific type\r\n * @returns the value as a specific type\r\n */\r\n public getTypedValue<T extends NodeRenderGraphValueType>(): T {\r\n return this._storedValue as T;\r\n }\r\n\r\n /**\r\n * Gets the value as an internal texture\r\n * @returns The internal texture stored in value if value is an internal texture, otherwise null\r\n */\r\n public getInternalTextureFromValue(): Nullable<InternalTexture> {\r\n if ((this._storedValue as InternalTexture)._swapAndDie) {\r\n return this._storedValue as InternalTexture;\r\n }\r\n return null;\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"NodeRenderGraphInputBlock\";\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeRenderGraphConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n /**\r\n * Check if the block is a texture of any type\r\n * @returns true if the block is a texture\r\n */\r\n public isAnyTexture(): boolean {\r\n return (this.type & NodeRenderGraphBlockConnectionPointTypes.TextureAll) !== 0;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating that the connection point is the back buffer texture\r\n * @returns true if the connection point is the back buffer texture\r\n */\r\n public isBackBuffer() {\r\n return (this.type & NodeRenderGraphBlockConnectionPointTypes.TextureBackBuffer) !== 0;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating that the connection point is a depth/stencil attachment texture\r\n * @returns true if the connection point is a depth/stencil attachment texture\r\n */\r\n public isBackBufferDepthStencilAttachment() {\r\n return (this.type & NodeRenderGraphBlockConnectionPointTypes.TextureBackBufferDepthStencilAttachment) !== 0;\r\n }\r\n\r\n /**\r\n * Check if the block is a camera\r\n * @returns true if the block is a camera\r\n */\r\n public isCamera(): boolean {\r\n return (this.type & NodeRenderGraphBlockConnectionPointTypes.Camera) !== 0;\r\n }\r\n\r\n /**\r\n * Check if the block is an object list\r\n * @returns true if the block is an object list\r\n */\r\n public isObjectList(): boolean {\r\n return (this.type & NodeRenderGraphBlockConnectionPointTypes.ObjectList) !== 0;\r\n }\r\n\r\n protected override _buildBlock(state: NodeRenderGraphBuildState) {\r\n super._buildBlock(state);\r\n\r\n if (this.isExternal) {\r\n if (this.isBackBuffer()) {\r\n this.output.value = backbufferColorTextureHandle;\r\n } else if (this.isBackBufferDepthStencilAttachment()) {\r\n this.output.value = backbufferDepthStencilTextureHandle;\r\n } else if (this.isCamera()) {\r\n this.output.value = this.getTypedValue<Camera>();\r\n } else if (this.isObjectList()) {\r\n this.output.value = this.getTypedValue<FrameGraphObjectList>();\r\n } else {\r\n if (this._storedValue === undefined || this._storedValue === null) {\r\n throw new Error(`NodeRenderGraphInputBlock: External input \"${this.name}\" is not set`);\r\n }\r\n const texture = this.getInternalTextureFromValue();\r\n if (texture) {\r\n this.output.value = this._frameGraph.textureManager.importTexture(this.name, texture, this.output.value as FrameGraphTextureHandle);\r\n }\r\n }\r\n return;\r\n }\r\n\r\n if ((this.type & NodeRenderGraphBlockConnectionPointTypes.TextureAllButBackBuffer) !== 0) {\r\n const textureCreateOptions = this.creationOptions as FrameGraphTextureCreationOptions;\r\n\r\n if (!textureCreateOptions) {\r\n throw new Error(`NodeRenderGraphInputBlock: Creation options are missing for texture \"${this.name}\"`);\r\n }\r\n\r\n this.output.value = this._frameGraph.textureManager.createRenderTargetTexture(this.name, textureCreateOptions);\r\n }\r\n }\r\n\r\n public override dispose() {\r\n this._storedValue = null;\r\n this.onValueChangedObservable.clear();\r\n super.dispose();\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n const codes: string[] = [];\r\n codes.push(`${this._codeVariableName}.isExternal = ${this.isExternal};`);\r\n if (this.isAnyTexture()) {\r\n if (!this.isExternal) {\r\n codes.push(`${this._codeVariableName}.creationOptions = ${JSON.stringify(this.creationOptions)};`);\r\n } else {\r\n codes.push(`${this._codeVariableName}.value = EXTERNAL_TEXTURE; // TODO: set the external texture`);\r\n }\r\n } else if (this.isCamera()) {\r\n codes.push(`${this._codeVariableName}.value = EXTERNAL_CAMERA; // TODO: set the external camera`);\r\n } else if (this.isObjectList()) {\r\n codes.push(`${this._codeVariableName}.value = EXTERNAL_OBJECT_LIST; // TODO: set the external object list`);\r\n }\r\n return super._dumpPropertiesCode() + codes.join(\"\\n\");\r\n }\r\n\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.type = this.type;\r\n serializationObject.isExternal = this.isExternal;\r\n if (this.creationOptions) {\r\n serializationObject.creationOptions = this.creationOptions;\r\n }\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n this._type = serializationObject.type;\r\n this.output.type = this._type;\r\n this.isExternal = serializationObject.isExternal;\r\n if (serializationObject.creationOptions) {\r\n if (serializationObject.creationOptions.options.depthTextureFormat !== undefined) {\r\n // Backward compatibility - remove this code in the future\r\n serializationObject.creationOptions.options.formats = [serializationObject.creationOptions.options.depthTextureFormat];\r\n }\r\n this.creationOptions = serializationObject.creationOptions;\r\n }\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.NodeRenderGraphInputBlock\", NodeRenderGraphInputBlock);\r\n"]}
|
|
@@ -19,8 +19,16 @@ export class NodeRenderGraphConnectionPoint {
|
|
|
19
19
|
if (this._connectedPoint) {
|
|
20
20
|
return this._connectedPoint.type;
|
|
21
21
|
}
|
|
22
|
-
if (this._linkedConnectionSource
|
|
23
|
-
|
|
22
|
+
if (this._linkedConnectionSource) {
|
|
23
|
+
if (this._linkedConnectionSource.isConnected) {
|
|
24
|
+
return this._linkedConnectionSource.type;
|
|
25
|
+
}
|
|
26
|
+
if (this._linkedConnectionSource._defaultConnectionPointType) {
|
|
27
|
+
return this._linkedConnectionSource._defaultConnectionPointType;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
if (this._defaultConnectionPointType) {
|
|
31
|
+
return this._defaultConnectionPointType;
|
|
24
32
|
}
|
|
25
33
|
}
|
|
26
34
|
if (this._type === NodeRenderGraphBlockConnectionPointTypes.BasedOnInput) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodeRenderGraphBlockConnectionPoint.js","sourceRoot":"","sources":["../../../../../dev/core/src/FrameGraph/Node/nodeRenderGraphBlockConnectionPoint.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,wCAAwC,EAA8F,MAAM,8BAA8B,CAAC;AAEpL;;GAEG;AACH,MAAM,OAAO,8BAA8B;IAoBvC,sCAAsC;IACtC,IAAW,SAAS;QAChB,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IAqCD;;OAEG;IACH,IAAW,IAAI;QACX,IAAI,IAAI,CAAC,KAAK,KAAK,wCAAwC,CAAC,UAAU,EAAE,CAAC;YACrE,IAAI,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;gBAC3B,OAAQ,IAAI,CAAC,WAAyC,CAAC,IAAI,CAAC;YAChE,CAAC;YAED,IAAI,IAAI,CAAC,eAAe,EAAE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,mBAAmB,CAAC,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC;YAC1C,mBAAmB,CAAC,aAAa,GAAG,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,QAAQ,CAAC;YAC5E,mBAAmB,CAAC,oBAAoB,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC;YACpE,mBAAmB,CAAC,gBAAgB,GAAG,IAAI,CAAC;YAC5C,mBAAmB,CAAC,mBAAmB,GAAG,IAAI,CAAC,mBAAmB,CAAC;QACvE,CAAC;QAED,IAAI,IAAI,CAAC,gBAAgB,IAAI,IAAI,CAAC,mBAAmB,IAAI,CAAC,EAAE,CAAC;YACzD,mBAAmB,CAAC,gBAAgB,GAAG,IAAI,CAAC;YAC5C,mBAAmB,CAAC,mBAAmB,GAAG,IAAI,CAAC,mBAAmB,CAAC;QACvE,CAAC;QAED,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAED;;OAEG;IACI,OAAO;QACV,IAAI,CAAC,sBAAsB,CAAC,KAAK,EAAE,CAAC;QACpC,IAAI,CAAC,yBAAyB,CAAC,KAAK,EAAE,CAAC;IAC3C,CAAC;CACJ","sourcesContent":["// eslint-disable-next-line import/no-internal-modules\r\nimport type { Nullable, NodeRenderGraphBlock, NodeRenderGraphBlockConnectionPointValueType, NodeRenderGraphInputBlock } from \"core/index\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport { NodeRenderGraphBlockConnectionPointTypes, NodeRenderGraphConnectionPointCompatibilityStates, NodeRenderGraphConnectionPointDirection } from \"./Types/nodeRenderGraphTypes\";\r\n\r\n/**\r\n * Defines a connection point for a block\r\n */\r\nexport class NodeRenderGraphConnectionPoint {\r\n private readonly _ownerBlock: NodeRenderGraphBlock;\r\n private _connectedPoint: Nullable<NodeRenderGraphConnectionPoint> = null;\r\n\r\n /** @internal */\r\n public _acceptedConnectionPointType: Nullable<NodeRenderGraphConnectionPoint> = null;\r\n\r\n private _endpoints = new Array<NodeRenderGraphConnectionPoint>();\r\n private readonly _direction: NodeRenderGraphConnectionPointDirection;\r\n private _type = NodeRenderGraphBlockConnectionPointTypes.Undefined;\r\n\r\n /** @internal */\r\n public _linkedConnectionSource: Nullable<NodeRenderGraphConnectionPoint> = null;\r\n\r\n /** @internal */\r\n public _typeConnectionSource: Nullable<NodeRenderGraphConnectionPoint | (() => NodeRenderGraphConnectionPoint)> = null;\r\n\r\n /** @internal */\r\n public _defaultConnectionPointType: Nullable<NodeRenderGraphBlockConnectionPointTypes> = null;\r\n\r\n /** Gets the direction of the point */\r\n public get direction() {\r\n return this._direction;\r\n }\r\n\r\n /**\r\n * The value stored in this connection point\r\n */\r\n public value: NodeRenderGraphBlockConnectionPointValueType | undefined;\r\n\r\n /**\r\n * Gets or sets the additional types supported by this connection point\r\n */\r\n public acceptedConnectionPointTypes: NodeRenderGraphBlockConnectionPointTypes[] = [];\r\n\r\n /**\r\n * Gets or sets the additional types excluded by this connection point\r\n */\r\n public excludedConnectionPointTypes: NodeRenderGraphBlockConnectionPointTypes[] = [];\r\n\r\n /**\r\n * Observable triggered when this point is connected\r\n */\r\n public onConnectionObservable = new Observable<NodeRenderGraphConnectionPoint>();\r\n\r\n /**\r\n * Observable triggered when this point is disconnected\r\n */\r\n public onDisconnectionObservable = new Observable<NodeRenderGraphConnectionPoint>();\r\n\r\n /**\r\n * Gets or sets a boolean indicating that this connection point is exposed on a frame\r\n */\r\n public isExposedOnFrame: boolean = false;\r\n\r\n /**\r\n * Gets or sets number indicating the position that the port is exposed to on a frame\r\n */\r\n public exposedPortPosition: number = -1;\r\n\r\n /**\r\n * Gets or sets the connection point type (default is Undefined)\r\n */\r\n public get type(): NodeRenderGraphBlockConnectionPointTypes {\r\n if (this._type === NodeRenderGraphBlockConnectionPointTypes.AutoDetect) {\r\n if (this._ownerBlock.isInput) {\r\n return (this._ownerBlock as NodeRenderGraphInputBlock).type;\r\n }\r\n\r\n if (this._connectedPoint) {\r\n return this._connectedPoint.type;\r\n }\r\n\r\n if (this._linkedConnectionSource && this._linkedConnectionSource.isConnected) {\r\n return this._linkedConnectionSource.type;\r\n }\r\n }\r\n\r\n if (this._type === NodeRenderGraphBlockConnectionPointTypes.BasedOnInput) {\r\n if (this._typeConnectionSource) {\r\n const typeConnectionSource = typeof this._typeConnectionSource === \"function\" ? this._typeConnectionSource() : this._typeConnectionSource;\r\n if (!typeConnectionSource.isConnected) {\r\n return this._defaultConnectionPointType ?? typeConnectionSource.type;\r\n }\r\n return typeConnectionSource._connectedPoint!.type;\r\n } else if (this._defaultConnectionPointType) {\r\n return this._defaultConnectionPointType;\r\n }\r\n }\r\n\r\n return this._type;\r\n }\r\n\r\n public set type(value: NodeRenderGraphBlockConnectionPointTypes) {\r\n this._type = value;\r\n }\r\n\r\n /**\r\n * Gets or sets the connection point name\r\n */\r\n public name: string;\r\n\r\n /**\r\n * Gets or sets the connection point display name\r\n */\r\n public displayName: string;\r\n\r\n /**\r\n * Gets or sets a boolean indicating that this connection point can be omitted\r\n */\r\n public isOptional: boolean;\r\n\r\n /**\r\n * Gets a boolean indicating that the current point is connected to another NodeRenderGraphBlock\r\n */\r\n public get isConnected(): boolean {\r\n return this.connectedPoint !== null || this.hasEndpoints;\r\n }\r\n\r\n /** Get the other side of the connection (if any) */\r\n public get connectedPoint(): Nullable<NodeRenderGraphConnectionPoint> {\r\n return this._connectedPoint;\r\n }\r\n\r\n /** Get the block that owns this connection point */\r\n public get ownerBlock(): NodeRenderGraphBlock {\r\n return this._ownerBlock;\r\n }\r\n\r\n /** Get the block connected on the other side of this connection (if any) */\r\n public get sourceBlock(): Nullable<NodeRenderGraphBlock> {\r\n if (!this._connectedPoint) {\r\n return null;\r\n }\r\n\r\n return this._connectedPoint.ownerBlock;\r\n }\r\n\r\n /** Get the block connected on the endpoints of this connection (if any) */\r\n public get connectedBlocks(): Array<NodeRenderGraphBlock> {\r\n if (this._endpoints.length === 0) {\r\n return [];\r\n }\r\n\r\n return this._endpoints.map((e) => e.ownerBlock);\r\n }\r\n\r\n /** Gets the list of connected endpoints */\r\n public get endpoints() {\r\n return this._endpoints;\r\n }\r\n\r\n /** Gets a boolean indicating if that output point is connected to at least one input */\r\n public get hasEndpoints(): boolean {\r\n return this._endpoints && this._endpoints.length > 0;\r\n }\r\n\r\n /** Get the inner type (ie AutoDetect for instance instead of the inferred one) */\r\n public get innerType() {\r\n if (this._linkedConnectionSource && this._linkedConnectionSource.isConnected) {\r\n return this.type;\r\n }\r\n return this._type;\r\n }\r\n\r\n /**\r\n * Creates a new connection point\r\n * @param name defines the connection point name\r\n * @param ownerBlock defines the block hosting this connection point\r\n * @param direction defines the direction of the connection point\r\n */\r\n public constructor(name: string, ownerBlock: NodeRenderGraphBlock, direction: NodeRenderGraphConnectionPointDirection) {\r\n this._ownerBlock = ownerBlock;\r\n this.name = name;\r\n this._direction = direction;\r\n }\r\n\r\n /**\r\n * Gets the current class name e.g. \"NodeRenderGraphConnectionPoint\"\r\n * @returns the class name\r\n */\r\n public getClassName(): string {\r\n return \"NodeRenderGraphConnectionPoint\";\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if the current point can be connected to another point\r\n * @param connectionPoint defines the other connection point\r\n * @returns a boolean\r\n */\r\n public canConnectTo(connectionPoint: NodeRenderGraphConnectionPoint) {\r\n return this.checkCompatibilityState(connectionPoint) === NodeRenderGraphConnectionPointCompatibilityStates.Compatible;\r\n }\r\n\r\n /**\r\n * Gets a number indicating if the current point can be connected to another point\r\n * @param connectionPoint defines the other connection point\r\n * @returns a number defining the compatibility state\r\n */\r\n public checkCompatibilityState(connectionPoint: NodeRenderGraphConnectionPoint): NodeRenderGraphConnectionPointCompatibilityStates {\r\n const ownerBlock = this._ownerBlock;\r\n const otherBlock = connectionPoint.ownerBlock;\r\n\r\n if (this.type !== connectionPoint.type && connectionPoint.innerType !== NodeRenderGraphBlockConnectionPointTypes.AutoDetect) {\r\n // Accepted types\r\n if (connectionPoint.acceptedConnectionPointTypes && connectionPoint.acceptedConnectionPointTypes.indexOf(this.type) !== -1) {\r\n return NodeRenderGraphConnectionPointCompatibilityStates.Compatible;\r\n } else {\r\n return NodeRenderGraphConnectionPointCompatibilityStates.TypeIncompatible;\r\n }\r\n }\r\n\r\n // Excluded\r\n if (connectionPoint.excludedConnectionPointTypes && connectionPoint.excludedConnectionPointTypes.indexOf(this.type) !== -1) {\r\n return NodeRenderGraphConnectionPointCompatibilityStates.TypeIncompatible;\r\n }\r\n\r\n // Check hierarchy\r\n let targetBlock = otherBlock;\r\n let sourceBlock = ownerBlock;\r\n if (this.direction === NodeRenderGraphConnectionPointDirection.Input) {\r\n targetBlock = ownerBlock;\r\n sourceBlock = otherBlock;\r\n }\r\n\r\n if (targetBlock.isAnAncestorOf(sourceBlock)) {\r\n return NodeRenderGraphConnectionPointCompatibilityStates.HierarchyIssue;\r\n }\r\n\r\n return NodeRenderGraphConnectionPointCompatibilityStates.Compatible;\r\n }\r\n\r\n /**\r\n * Connect this point to another connection point\r\n * @param connectionPoint defines the other connection point\r\n * @param ignoreConstraints defines if the system will ignore connection type constraints (default is false)\r\n * @returns the current connection point\r\n */\r\n public connectTo(connectionPoint: NodeRenderGraphConnectionPoint, ignoreConstraints = false): NodeRenderGraphConnectionPoint {\r\n if (!ignoreConstraints && !this.canConnectTo(connectionPoint)) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"Cannot connect these two connectors.\";\r\n }\r\n\r\n this._endpoints.push(connectionPoint);\r\n connectionPoint._connectedPoint = this;\r\n\r\n this.onConnectionObservable.notifyObservers(connectionPoint);\r\n connectionPoint.onConnectionObservable.notifyObservers(this);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Disconnect this point from one of his endpoint\r\n * @param endpoint defines the other connection point\r\n * @returns the current connection point\r\n */\r\n public disconnectFrom(endpoint: NodeRenderGraphConnectionPoint): NodeRenderGraphConnectionPoint {\r\n const index = this._endpoints.indexOf(endpoint);\r\n\r\n if (index === -1) {\r\n return this;\r\n }\r\n\r\n this._endpoints.splice(index, 1);\r\n endpoint._connectedPoint = null;\r\n\r\n this.onDisconnectionObservable.notifyObservers(endpoint);\r\n endpoint.onDisconnectionObservable.notifyObservers(this);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Fills the list of excluded connection point types with all types other than those passed in the parameter\r\n * @param mask Types (ORed values of NodeRenderGraphBlockConnectionPointTypes) that are allowed, and thus will not be pushed to the excluded list\r\n */\r\n public addExcludedConnectionPointFromAllowedTypes(mask: number): void {\r\n let bitmask = 0;\r\n let val = 2 ** bitmask;\r\n // Note: don't use 1 << bitmask instead of 2 ** bitmask, as it will cause an infinite loop because 1 << 31 is negative!\r\n while (val < NodeRenderGraphBlockConnectionPointTypes.All) {\r\n if (!(mask & val)) {\r\n this.excludedConnectionPointTypes.push(val);\r\n }\r\n bitmask++;\r\n val = 2 ** bitmask;\r\n }\r\n }\r\n\r\n /**\r\n * Adds accepted connection point types\r\n * @param mask Types (ORed values of NodeRenderGraphBlockConnectionPointTypes) that are allowed to connect to this point\r\n */\r\n public addAcceptedConnectionPointTypes(mask: number): void {\r\n let bitmask = 0;\r\n let val = 2 ** bitmask;\r\n // Note: don't use 1 << bitmask instead of 2 ** bitmask, as it will cause an infinite loop because 1 << 31 is negative!\r\n while (val < NodeRenderGraphBlockConnectionPointTypes.All) {\r\n if (mask & val && this.acceptedConnectionPointTypes.indexOf(val) === -1) {\r\n this.acceptedConnectionPointTypes.push(val);\r\n }\r\n bitmask++;\r\n val = 2 ** bitmask;\r\n }\r\n }\r\n\r\n /**\r\n * Serializes this point in a JSON representation\r\n * @param isInput defines if the connection point is an input (default is true)\r\n * @returns the serialized point object\r\n */\r\n public serialize(isInput = true): any {\r\n const serializationObject: any = {};\r\n\r\n serializationObject.name = this.name;\r\n serializationObject.displayName = this.displayName;\r\n\r\n if (isInput && this.connectedPoint) {\r\n serializationObject.inputName = this.name;\r\n serializationObject.targetBlockId = this.connectedPoint.ownerBlock.uniqueId;\r\n serializationObject.targetConnectionName = this.connectedPoint.name;\r\n serializationObject.isExposedOnFrame = true;\r\n serializationObject.exposedPortPosition = this.exposedPortPosition;\r\n }\r\n\r\n if (this.isExposedOnFrame || this.exposedPortPosition >= 0) {\r\n serializationObject.isExposedOnFrame = true;\r\n serializationObject.exposedPortPosition = this.exposedPortPosition;\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Release resources\r\n */\r\n public dispose() {\r\n this.onConnectionObservable.clear();\r\n this.onDisconnectionObservable.clear();\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"nodeRenderGraphBlockConnectionPoint.js","sourceRoot":"","sources":["../../../../../dev/core/src/FrameGraph/Node/nodeRenderGraphBlockConnectionPoint.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,wCAAwC,EAA8F,MAAM,8BAA8B,CAAC;AAEpL;;GAEG;AACH,MAAM,OAAO,8BAA8B;IAoBvC,sCAAsC;IACtC,IAAW,SAAS;QAChB,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IAqCD;;OAEG;IACH,IAAW,IAAI;QACX,IAAI,IAAI,CAAC,KAAK,KAAK,wCAAwC,CAAC,UAAU,EAAE,CAAC;YACrE,IAAI,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;gBAC3B,OAAQ,IAAI,CAAC,WAAyC,CAAC,IAAI,CAAC;YAChE,CAAC;YAED,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;gBACvB,OAAO,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC;YACrC,CAAC;YAED,IAAI,IAAI,CAAC,uBAAuB,EAAE,CAAC;gBAC/B,IAAI,IAAI,CAAC,uBAAuB,CAAC,WAAW,EAAE,CAAC;oBAC3C,OAAO,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC;gBAC7C,CAAC;gBACD,IAAI,IAAI,CAAC,uBAAuB,CAAC,2BAA2B,EAAE,CAAC;oBAC3D,OAAO,IAAI,CAAC,uBAAu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aAAa,GAAG,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,QAAQ,CAAC;YAC5E,mBAAmB,CAAC,oBAAoB,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC;YACpE,mBAAmB,CAAC,gBAAgB,GAAG,IAAI,CAAC;YAC5C,mBAAmB,CAAC,mBAAmB,GAAG,IAAI,CAAC,mBAAmB,CAAC;QACvE,CAAC;QAED,IAAI,IAAI,CAAC,gBAAgB,IAAI,IAAI,CAAC,mBAAmB,IAAI,CAAC,EAAE,CAAC;YACzD,mBAAmB,CAAC,gBAAgB,GAAG,IAAI,CAAC;YAC5C,mBAAmB,CAAC,mBAAmB,GAAG,IAAI,CAAC,mBAAmB,CAAC;QACvE,CAAC;QAED,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAED;;OAEG;IACI,OAAO;QACV,IAAI,CAAC,sBAAsB,CAAC,KAAK,EAAE,CAAC;QACpC,IAAI,CAAC,yBAAyB,CAAC,KAAK,EAAE,CAAC;IAC3C,CAAC;CACJ","sourcesContent":["// eslint-disable-next-line import/no-internal-modules\r\nimport type { Nullable, NodeRenderGraphBlock, NodeRenderGraphBlockConnectionPointValueType, NodeRenderGraphInputBlock } from \"core/index\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport { NodeRenderGraphBlockConnectionPointTypes, NodeRenderGraphConnectionPointCompatibilityStates, NodeRenderGraphConnectionPointDirection } from \"./Types/nodeRenderGraphTypes\";\r\n\r\n/**\r\n * Defines a connection point for a block\r\n */\r\nexport class NodeRenderGraphConnectionPoint {\r\n private readonly _ownerBlock: NodeRenderGraphBlock;\r\n private _connectedPoint: Nullable<NodeRenderGraphConnectionPoint> = null;\r\n\r\n /** @internal */\r\n public _acceptedConnectionPointType: Nullable<NodeRenderGraphConnectionPoint> = null;\r\n\r\n private _endpoints = new Array<NodeRenderGraphConnectionPoint>();\r\n private readonly _direction: NodeRenderGraphConnectionPointDirection;\r\n private _type = NodeRenderGraphBlockConnectionPointTypes.Undefined;\r\n\r\n /** @internal */\r\n public _linkedConnectionSource: Nullable<NodeRenderGraphConnectionPoint> = null;\r\n\r\n /** @internal */\r\n public _typeConnectionSource: Nullable<NodeRenderGraphConnectionPoint | (() => NodeRenderGraphConnectionPoint)> = null;\r\n\r\n /** @internal */\r\n public _defaultConnectionPointType: Nullable<NodeRenderGraphBlockConnectionPointTypes> = null;\r\n\r\n /** Gets the direction of the point */\r\n public get direction() {\r\n return this._direction;\r\n }\r\n\r\n /**\r\n * The value stored in this connection point\r\n */\r\n public value: NodeRenderGraphBlockConnectionPointValueType | undefined;\r\n\r\n /**\r\n * Gets or sets the additional types supported by this connection point\r\n */\r\n public acceptedConnectionPointTypes: NodeRenderGraphBlockConnectionPointTypes[] = [];\r\n\r\n /**\r\n * Gets or sets the additional types excluded by this connection point\r\n */\r\n public excludedConnectionPointTypes: NodeRenderGraphBlockConnectionPointTypes[] = [];\r\n\r\n /**\r\n * Observable triggered when this point is connected\r\n */\r\n public onConnectionObservable = new Observable<NodeRenderGraphConnectionPoint>();\r\n\r\n /**\r\n * Observable triggered when this point is disconnected\r\n */\r\n public onDisconnectionObservable = new Observable<NodeRenderGraphConnectionPoint>();\r\n\r\n /**\r\n * Gets or sets a boolean indicating that this connection point is exposed on a frame\r\n */\r\n public isExposedOnFrame: boolean = false;\r\n\r\n /**\r\n * Gets or sets number indicating the position that the port is exposed to on a frame\r\n */\r\n public exposedPortPosition: number = -1;\r\n\r\n /**\r\n * Gets or sets the connection point type (default is Undefined)\r\n */\r\n public get type(): NodeRenderGraphBlockConnectionPointTypes {\r\n if (this._type === NodeRenderGraphBlockConnectionPointTypes.AutoDetect) {\r\n if (this._ownerBlock.isInput) {\r\n return (this._ownerBlock as NodeRenderGraphInputBlock).type;\r\n }\r\n\r\n if (this._connectedPoint) {\r\n return this._connectedPoint.type;\r\n }\r\n\r\n if (this._linkedConnectionSource) {\r\n if (this._linkedConnectionSource.isConnected) {\r\n return this._linkedConnectionSource.type;\r\n }\r\n if (this._linkedConnectionSource._defaultConnectionPointType) {\r\n return this._linkedConnectionSource._defaultConnectionPointType;\r\n }\r\n }\r\n\r\n if (this._defaultConnectionPointType) {\r\n return this._defaultConnectionPointType;\r\n }\r\n }\r\n\r\n if (this._type === NodeRenderGraphBlockConnectionPointTypes.BasedOnInput) {\r\n if (this._typeConnectionSource) {\r\n const typeConnectionSource = typeof this._typeConnectionSource === \"function\" ? this._typeConnectionSource() : this._typeConnectionSource;\r\n if (!typeConnectionSource.isConnected) {\r\n return this._defaultConnectionPointType ?? typeConnectionSource.type;\r\n }\r\n return typeConnectionSource._connectedPoint!.type;\r\n } else if (this._defaultConnectionPointType) {\r\n return this._defaultConnectionPointType;\r\n }\r\n }\r\n\r\n return this._type;\r\n }\r\n\r\n public set type(value: NodeRenderGraphBlockConnectionPointTypes) {\r\n this._type = value;\r\n }\r\n\r\n /**\r\n * Gets or sets the connection point name\r\n */\r\n public name: string;\r\n\r\n /**\r\n * Gets or sets the connection point display name\r\n */\r\n public displayName: string;\r\n\r\n /**\r\n * Gets or sets a boolean indicating that this connection point can be omitted\r\n */\r\n public isOptional: boolean;\r\n\r\n /**\r\n * Gets a boolean indicating that the current point is connected to another NodeRenderGraphBlock\r\n */\r\n public get isConnected(): boolean {\r\n return this.connectedPoint !== null || this.hasEndpoints;\r\n }\r\n\r\n /** Get the other side of the connection (if any) */\r\n public get connectedPoint(): Nullable<NodeRenderGraphConnectionPoint> {\r\n return this._connectedPoint;\r\n }\r\n\r\n /** Get the block that owns this connection point */\r\n public get ownerBlock(): NodeRenderGraphBlock {\r\n return this._ownerBlock;\r\n }\r\n\r\n /** Get the block connected on the other side of this connection (if any) */\r\n public get sourceBlock(): Nullable<NodeRenderGraphBlock> {\r\n if (!this._connectedPoint) {\r\n return null;\r\n }\r\n\r\n return this._connectedPoint.ownerBlock;\r\n }\r\n\r\n /** Get the block connected on the endpoints of this connection (if any) */\r\n public get connectedBlocks(): Array<NodeRenderGraphBlock> {\r\n if (this._endpoints.length === 0) {\r\n return [];\r\n }\r\n\r\n return this._endpoints.map((e) => e.ownerBlock);\r\n }\r\n\r\n /** Gets the list of connected endpoints */\r\n public get endpoints() {\r\n return this._endpoints;\r\n }\r\n\r\n /** Gets a boolean indicating if that output point is connected to at least one input */\r\n public get hasEndpoints(): boolean {\r\n return this._endpoints && this._endpoints.length > 0;\r\n }\r\n\r\n /** Get the inner type (ie AutoDetect for instance instead of the inferred one) */\r\n public get innerType() {\r\n if (this._linkedConnectionSource && this._linkedConnectionSource.isConnected) {\r\n return this.type;\r\n }\r\n return this._type;\r\n }\r\n\r\n /**\r\n * Creates a new connection point\r\n * @param name defines the connection point name\r\n * @param ownerBlock defines the block hosting this connection point\r\n * @param direction defines the direction of the connection point\r\n */\r\n public constructor(name: string, ownerBlock: NodeRenderGraphBlock, direction: NodeRenderGraphConnectionPointDirection) {\r\n this._ownerBlock = ownerBlock;\r\n this.name = name;\r\n this._direction = direction;\r\n }\r\n\r\n /**\r\n * Gets the current class name e.g. \"NodeRenderGraphConnectionPoint\"\r\n * @returns the class name\r\n */\r\n public getClassName(): string {\r\n return \"NodeRenderGraphConnectionPoint\";\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if the current point can be connected to another point\r\n * @param connectionPoint defines the other connection point\r\n * @returns a boolean\r\n */\r\n public canConnectTo(connectionPoint: NodeRenderGraphConnectionPoint) {\r\n return this.checkCompatibilityState(connectionPoint) === NodeRenderGraphConnectionPointCompatibilityStates.Compatible;\r\n }\r\n\r\n /**\r\n * Gets a number indicating if the current point can be connected to another point\r\n * @param connectionPoint defines the other connection point\r\n * @returns a number defining the compatibility state\r\n */\r\n public checkCompatibilityState(connectionPoint: NodeRenderGraphConnectionPoint): NodeRenderGraphConnectionPointCompatibilityStates {\r\n const ownerBlock = this._ownerBlock;\r\n const otherBlock = connectionPoint.ownerBlock;\r\n\r\n if (this.type !== connectionPoint.type && connectionPoint.innerType !== NodeRenderGraphBlockConnectionPointTypes.AutoDetect) {\r\n // Accepted types\r\n if (connectionPoint.acceptedConnectionPointTypes && connectionPoint.acceptedConnectionPointTypes.indexOf(this.type) !== -1) {\r\n return NodeRenderGraphConnectionPointCompatibilityStates.Compatible;\r\n } else {\r\n return NodeRenderGraphConnectionPointCompatibilityStates.TypeIncompatible;\r\n }\r\n }\r\n\r\n // Excluded\r\n if (connectionPoint.excludedConnectionPointTypes && connectionPoint.excludedConnectionPointTypes.indexOf(this.type) !== -1) {\r\n return NodeRenderGraphConnectionPointCompatibilityStates.TypeIncompatible;\r\n }\r\n\r\n // Check hierarchy\r\n let targetBlock = otherBlock;\r\n let sourceBlock = ownerBlock;\r\n if (this.direction === NodeRenderGraphConnectionPointDirection.Input) {\r\n targetBlock = ownerBlock;\r\n sourceBlock = otherBlock;\r\n }\r\n\r\n if (targetBlock.isAnAncestorOf(sourceBlock)) {\r\n return NodeRenderGraphConnectionPointCompatibilityStates.HierarchyIssue;\r\n }\r\n\r\n return NodeRenderGraphConnectionPointCompatibilityStates.Compatible;\r\n }\r\n\r\n /**\r\n * Connect this point to another connection point\r\n * @param connectionPoint defines the other connection point\r\n * @param ignoreConstraints defines if the system will ignore connection type constraints (default is false)\r\n * @returns the current connection point\r\n */\r\n public connectTo(connectionPoint: NodeRenderGraphConnectionPoint, ignoreConstraints = false): NodeRenderGraphConnectionPoint {\r\n if (!ignoreConstraints && !this.canConnectTo(connectionPoint)) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"Cannot connect these two connectors.\";\r\n }\r\n\r\n this._endpoints.push(connectionPoint);\r\n connectionPoint._connectedPoint = this;\r\n\r\n this.onConnectionObservable.notifyObservers(connectionPoint);\r\n connectionPoint.onConnectionObservable.notifyObservers(this);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Disconnect this point from one of his endpoint\r\n * @param endpoint defines the other connection point\r\n * @returns the current connection point\r\n */\r\n public disconnectFrom(endpoint: NodeRenderGraphConnectionPoint): NodeRenderGraphConnectionPoint {\r\n const index = this._endpoints.indexOf(endpoint);\r\n\r\n if (index === -1) {\r\n return this;\r\n }\r\n\r\n this._endpoints.splice(index, 1);\r\n endpoint._connectedPoint = null;\r\n\r\n this.onDisconnectionObservable.notifyObservers(endpoint);\r\n endpoint.onDisconnectionObservable.notifyObservers(this);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Fills the list of excluded connection point types with all types other than those passed in the parameter\r\n * @param mask Types (ORed values of NodeRenderGraphBlockConnectionPointTypes) that are allowed, and thus will not be pushed to the excluded list\r\n */\r\n public addExcludedConnectionPointFromAllowedTypes(mask: number): void {\r\n let bitmask = 0;\r\n let val = 2 ** bitmask;\r\n // Note: don't use 1 << bitmask instead of 2 ** bitmask, as it will cause an infinite loop because 1 << 31 is negative!\r\n while (val < NodeRenderGraphBlockConnectionPointTypes.All) {\r\n if (!(mask & val)) {\r\n this.excludedConnectionPointTypes.push(val);\r\n }\r\n bitmask++;\r\n val = 2 ** bitmask;\r\n }\r\n }\r\n\r\n /**\r\n * Adds accepted connection point types\r\n * @param mask Types (ORed values of NodeRenderGraphBlockConnectionPointTypes) that are allowed to connect to this point\r\n */\r\n public addAcceptedConnectionPointTypes(mask: number): void {\r\n let bitmask = 0;\r\n let val = 2 ** bitmask;\r\n // Note: don't use 1 << bitmask instead of 2 ** bitmask, as it will cause an infinite loop because 1 << 31 is negative!\r\n while (val < NodeRenderGraphBlockConnectionPointTypes.All) {\r\n if (mask & val && this.acceptedConnectionPointTypes.indexOf(val) === -1) {\r\n this.acceptedConnectionPointTypes.push(val);\r\n }\r\n bitmask++;\r\n val = 2 ** bitmask;\r\n }\r\n }\r\n\r\n /**\r\n * Serializes this point in a JSON representation\r\n * @param isInput defines if the connection point is an input (default is true)\r\n * @returns the serialized point object\r\n */\r\n public serialize(isInput = true): any {\r\n const serializationObject: any = {};\r\n\r\n serializationObject.name = this.name;\r\n serializationObject.displayName = this.displayName;\r\n\r\n if (isInput && this.connectedPoint) {\r\n serializationObject.inputName = this.name;\r\n serializationObject.targetBlockId = this.connectedPoint.ownerBlock.uniqueId;\r\n serializationObject.targetConnectionName = this.connectedPoint.name;\r\n serializationObject.isExposedOnFrame = true;\r\n serializationObject.exposedPortPosition = this.exposedPortPosition;\r\n }\r\n\r\n if (this.isExposedOnFrame || this.exposedPortPosition >= 0) {\r\n serializationObject.isExposedOnFrame = true;\r\n serializationObject.exposedPortPosition = this.exposedPortPosition;\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Release resources\r\n */\r\n public dispose() {\r\n this.onConnectionObservable.clear();\r\n this.onDisconnectionObservable.clear();\r\n }\r\n}\r\n"]}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import type { Nullable, FrameGraphRenderContext, AbstractEngine, IFrameGraphPass, FrameGraphTextureHandle, FrameGraphTask } from "../../index.js";
|
|
1
|
+
import type { Nullable, FrameGraphRenderContext, AbstractEngine, IFrameGraphPass, FrameGraphTextureHandle, FrameGraphTask, FrameGraphRenderTarget } from "../../index.js";
|
|
2
2
|
import { FrameGraphPass } from "./pass";
|
|
3
3
|
/**
|
|
4
4
|
* Render pass used to render objects.
|
|
5
5
|
*/
|
|
6
6
|
export declare class FrameGraphRenderPass extends FrameGraphPass<FrameGraphRenderContext> {
|
|
7
|
-
protected _engine: AbstractEngine;
|
|
8
|
-
protected _renderTarget: FrameGraphTextureHandle;
|
|
7
|
+
protected readonly _engine: AbstractEngine;
|
|
8
|
+
protected _renderTarget: FrameGraphTextureHandle | FrameGraphTextureHandle[] | undefined;
|
|
9
9
|
protected _renderTargetDepth: FrameGraphTextureHandle | undefined;
|
|
10
|
-
protected _usedTextures: FrameGraphTextureHandle[];
|
|
11
|
-
protected
|
|
10
|
+
protected readonly _usedTextures: FrameGraphTextureHandle[];
|
|
11
|
+
protected _frameGraphRenderTarget: FrameGraphRenderTarget | undefined;
|
|
12
12
|
/**
|
|
13
13
|
* Checks if a pass is a render pass.
|
|
14
14
|
* @param pass The pass to check.
|
|
@@ -16,9 +16,9 @@ export declare class FrameGraphRenderPass extends FrameGraphPass<FrameGraphRende
|
|
|
16
16
|
*/
|
|
17
17
|
static IsRenderPass(pass: IFrameGraphPass): pass is FrameGraphRenderPass;
|
|
18
18
|
/**
|
|
19
|
-
* Gets the render target used by the render pass.
|
|
19
|
+
* Gets the render target(s) used by the render pass.
|
|
20
20
|
*/
|
|
21
|
-
get renderTarget(): FrameGraphTextureHandle;
|
|
21
|
+
get renderTarget(): FrameGraphTextureHandle | FrameGraphTextureHandle[] | undefined;
|
|
22
22
|
/**
|
|
23
23
|
* Gets the render target depth used by the render pass.
|
|
24
24
|
*/
|
|
@@ -33,10 +33,10 @@ export declare class FrameGraphRenderPass extends FrameGraphPass<FrameGraphRende
|
|
|
33
33
|
*/
|
|
34
34
|
useTexture(texture: FrameGraphTextureHandle): void;
|
|
35
35
|
/**
|
|
36
|
-
* Sets the render target to use for rendering.
|
|
37
|
-
* @param renderTargetHandle The render target to use for rendering.
|
|
36
|
+
* Sets the render target(s) to use for rendering.
|
|
37
|
+
* @param renderTargetHandle The render target to use for rendering, or an array of render targets to use for multi render target rendering.
|
|
38
38
|
*/
|
|
39
|
-
setRenderTarget(renderTargetHandle
|
|
39
|
+
setRenderTarget(renderTargetHandle?: FrameGraphTextureHandle | FrameGraphTextureHandle[]): void;
|
|
40
40
|
/**
|
|
41
41
|
* Sets the render target depth to use for rendering.
|
|
42
42
|
* @param renderTargetHandle The render target depth to use for rendering.
|
|
@@ -12,7 +12,7 @@ export class FrameGraphRenderPass extends FrameGraphPass {
|
|
|
12
12
|
return pass.setRenderTarget !== undefined;
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
|
-
* Gets the render target used by the render pass.
|
|
15
|
+
* Gets the render target(s) used by the render pass.
|
|
16
16
|
*/
|
|
17
17
|
get renderTarget() {
|
|
18
18
|
return this._renderTarget;
|
|
@@ -27,7 +27,6 @@ export class FrameGraphRenderPass extends FrameGraphPass {
|
|
|
27
27
|
constructor(name, parentTask, context, engine) {
|
|
28
28
|
super(name, parentTask, context);
|
|
29
29
|
this._usedTextures = [];
|
|
30
|
-
this._depthShared = false;
|
|
31
30
|
this._engine = engine;
|
|
32
31
|
}
|
|
33
32
|
/**
|
|
@@ -40,8 +39,8 @@ export class FrameGraphRenderPass extends FrameGraphPass {
|
|
|
40
39
|
this._usedTextures.push(texture);
|
|
41
40
|
}
|
|
42
41
|
/**
|
|
43
|
-
* Sets the render target to use for rendering.
|
|
44
|
-
* @param renderTargetHandle The render target to use for rendering.
|
|
42
|
+
* Sets the render target(s) to use for rendering.
|
|
43
|
+
* @param renderTargetHandle The render target to use for rendering, or an array of render targets to use for multi render target rendering.
|
|
45
44
|
*/
|
|
46
45
|
setRenderTarget(renderTargetHandle) {
|
|
47
46
|
this._renderTarget = renderTargetHandle;
|
|
@@ -55,18 +54,19 @@ export class FrameGraphRenderPass extends FrameGraphPass {
|
|
|
55
54
|
}
|
|
56
55
|
/** @internal */
|
|
57
56
|
_execute() {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
this._depthShared = true;
|
|
61
|
-
}
|
|
62
|
-
this._context.bindRenderTarget(this._renderTarget, `frame graph - render pass '${this.name}'`);
|
|
57
|
+
this._frameGraphRenderTarget = this._frameGraphRenderTarget || this._context.createRenderTarget(this.name, this._renderTarget, this._renderTargetDepth);
|
|
58
|
+
this._context.bindRenderTarget(this._frameGraphRenderTarget, `frame graph render pass - ${this.name}`);
|
|
63
59
|
super._execute();
|
|
64
60
|
this._context._flushDebugMessages();
|
|
65
61
|
}
|
|
66
62
|
/** @internal */
|
|
67
63
|
_isValid() {
|
|
68
64
|
const errMsg = super._isValid();
|
|
69
|
-
return errMsg
|
|
65
|
+
return errMsg
|
|
66
|
+
? errMsg
|
|
67
|
+
: this._renderTarget !== undefined || this.renderTargetDepth !== undefined
|
|
68
|
+
? null
|
|
69
|
+
: "Render target and render target depth cannot both be undefined.";
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
//# sourceMappingURL=renderPass.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderPass.js","sourceRoot":"","sources":["../../../../../dev/core/src/FrameGraph/Passes/renderPass.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAExC;;GAEG;AACH,MAAM,OAAO,oBAAqB,SAAQ,cAAuC;IAO7E;;;;OAIG;IACI,MAAM,CAAC,YAAY,CAAC,IAAqB;QAC5C,OAAQ,IAA6B,CAAC,eAAe,KAAK,SAAS,CAAC;IACxE,CAAC;IAED;;OAEG;IACH,IAAW,YAAY;QACnB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC9B,CAAC;IAED;;OAEG;IACH,IAAW,iBAAiB;QACxB,OAAO,IAAI,CAAC,kBAAkB,CAAC;IACnC,CAAC;IAED,gBAAgB;IAChB,YAAY,IAAY,EAAE,UAA0B,EAAE,OAAgC,EAAE,MAAsB;QAC1G,KAAK,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"renderPass.js","sourceRoot":"","sources":["../../../../../dev/core/src/FrameGraph/Passes/renderPass.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAExC;;GAEG;AACH,MAAM,OAAO,oBAAqB,SAAQ,cAAuC;IAO7E;;;;OAIG;IACI,MAAM,CAAC,YAAY,CAAC,IAAqB;QAC5C,OAAQ,IAA6B,CAAC,eAAe,KAAK,SAAS,CAAC;IACxE,CAAC;IAED;;OAEG;IACH,IAAW,YAAY;QACnB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC9B,CAAC;IAED;;OAEG;IACH,IAAW,iBAAiB;QACxB,OAAO,IAAI,CAAC,kBAAkB,CAAC;IACnC,CAAC;IAED,gBAAgB;IAChB,YAAY,IAAY,EAAE,UAA0B,EAAE,OAAgC,EAAE,MAAsB;QAC1G,KAAK,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;QA5BlB,kBAAa,GAA8B,EAAE,CAAC;QA6B7D,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IAC1B,CAAC;IAED;;;;;OAKG;IACI,UAAU,CAAC,OAAgC;QAC9C,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC;IAED;;;OAGG;IACI,eAAe,CAAC,kBAAwE;QAC3F,IAAI,CAAC,aAAa,GAAG,kBAAkB,CAAC;IAC5C,CAAC;IAED;;;OAGG;IACI,oBAAoB,CAAC,kBAA4C;QACpE,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;IACjD,CAAC;IAED,gBAAgB;IACA,QAAQ;QACpB,IAAI,CAAC,uBAAuB,GAAG,IAAI,CAAC,uBAAuB,IAAI,IAAI,CAAC,QAAQ,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC;QAExJ,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC,uBAAuB,EAAE,6BAA6B,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QAEvG,KAAK,CAAC,QAAQ,EAAE,CAAC;QAEjB,IAAI,CAAC,QAAQ,CAAC,mBAAmB,EAAE,CAAC;IACxC,CAAC;IAED,gBAAgB;IACA,QAAQ;QACpB,MAAM,MAAM,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC;QAChC,OAAO,MAAM;YACT,CAAC,CAAC,MAAM;YACR,CAAC,CAAC,IAAI,CAAC,aAAa,KAAK,SAAS,IAAI,IAAI,CAAC,iBAAiB,KAAK,SAAS;gBACxE,CAAC,CAAC,IAAI;gBACN,CAAC,CAAC,iEAAiE,CAAC;IAC9E,CAAC;CACJ","sourcesContent":["// eslint-disable-next-line import/no-internal-modules\r\nimport type { Nullable, FrameGraphRenderContext, AbstractEngine, IFrameGraphPass, FrameGraphTextureHandle, FrameGraphTask, FrameGraphRenderTarget } from \"core/index\";\r\nimport { FrameGraphPass } from \"./pass\";\r\n\r\n/**\r\n * Render pass used to render objects.\r\n */\r\nexport class FrameGraphRenderPass extends FrameGraphPass<FrameGraphRenderContext> {\r\n protected readonly _engine: AbstractEngine;\r\n protected _renderTarget: FrameGraphTextureHandle | FrameGraphTextureHandle[] | undefined;\r\n protected _renderTargetDepth: FrameGraphTextureHandle | undefined;\r\n protected readonly _usedTextures: FrameGraphTextureHandle[] = [];\r\n protected _frameGraphRenderTarget: FrameGraphRenderTarget | undefined;\r\n\r\n /**\r\n * Checks if a pass is a render pass.\r\n * @param pass The pass to check.\r\n * @returns True if the pass is a render pass, else false.\r\n */\r\n public static IsRenderPass(pass: IFrameGraphPass): pass is FrameGraphRenderPass {\r\n return (pass as FrameGraphRenderPass).setRenderTarget !== undefined;\r\n }\r\n\r\n /**\r\n * Gets the render target(s) used by the render pass.\r\n */\r\n public get renderTarget(): FrameGraphTextureHandle | FrameGraphTextureHandle[] | undefined {\r\n return this._renderTarget;\r\n }\r\n\r\n /**\r\n * Gets the render target depth used by the render pass.\r\n */\r\n public get renderTargetDepth(): FrameGraphTextureHandle | undefined {\r\n return this._renderTargetDepth;\r\n }\r\n\r\n /** @internal */\r\n constructor(name: string, parentTask: FrameGraphTask, context: FrameGraphRenderContext, engine: AbstractEngine) {\r\n super(name, parentTask, context);\r\n this._engine = engine;\r\n }\r\n\r\n /**\r\n * Indicates that the pass will use the given texture.\r\n * Use this method to indicate that the pass will use a texture so that the frame graph can handle the texture's lifecycle.\r\n * You don't have to call this method for the render target / render target depth textures.\r\n * @param texture The texture used.\r\n */\r\n public useTexture(texture: FrameGraphTextureHandle) {\r\n this._usedTextures.push(texture);\r\n }\r\n\r\n /**\r\n * Sets the render target(s) to use for rendering.\r\n * @param renderTargetHandle The render target to use for rendering, or an array of render targets to use for multi render target rendering.\r\n */\r\n public setRenderTarget(renderTargetHandle?: FrameGraphTextureHandle | FrameGraphTextureHandle[]) {\r\n this._renderTarget = renderTargetHandle;\r\n }\r\n\r\n /**\r\n * Sets the render target depth to use for rendering.\r\n * @param renderTargetHandle The render target depth to use for rendering.\r\n */\r\n public setRenderTargetDepth(renderTargetHandle?: FrameGraphTextureHandle) {\r\n this._renderTargetDepth = renderTargetHandle;\r\n }\r\n\r\n /** @internal */\r\n public override _execute() {\r\n this._frameGraphRenderTarget = this._frameGraphRenderTarget || this._context.createRenderTarget(this.name, this._renderTarget, this._renderTargetDepth);\r\n\r\n this._context.bindRenderTarget(this._frameGraphRenderTarget, `frame graph render pass - ${this.name}`);\r\n\r\n super._execute();\r\n\r\n this._context._flushDebugMessages();\r\n }\r\n\r\n /** @internal */\r\n public override _isValid(): Nullable<string> {\r\n const errMsg = super._isValid();\r\n return errMsg\r\n ? errMsg\r\n : this._renderTarget !== undefined || this.renderTargetDepth !== undefined\r\n ? null\r\n : \"Render target and render target depth cannot both be undefined.\";\r\n }\r\n}\r\n"]}
|
|
@@ -31,11 +31,16 @@ export declare class FrameGraphBloomTask extends FrameGraphTask {
|
|
|
31
31
|
* When true, the bloom effect will use a higher precision texture format (half float or float). Else, it will use unsigned byte.
|
|
32
32
|
*/
|
|
33
33
|
readonly hdr: boolean;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
/**
|
|
35
|
+
* The name of the task.
|
|
36
|
+
*/
|
|
37
|
+
get name(): string;
|
|
38
|
+
set name(name: string);
|
|
39
|
+
private readonly _downscale;
|
|
40
|
+
private readonly _blurX;
|
|
41
|
+
private readonly _blurY;
|
|
42
|
+
private readonly _merge;
|
|
43
|
+
private readonly _defaultPipelineTextureType;
|
|
39
44
|
/**
|
|
40
45
|
* Constructs a new bloom task.
|
|
41
46
|
* @param name Name of the task.
|