@babylonjs/core 7.52.3 → 7.53.1
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/AudioV2/abstractAudio/subNodes/abstractAudioSubGraph.d.ts +0 -3
- package/AudioV2/abstractAudio/subNodes/abstractAudioSubGraph.js +9 -6
- package/AudioV2/abstractAudio/subNodes/abstractAudioSubGraph.js.map +1 -1
- package/AudioV2/abstractAudio/subProperties/spatialAudio.js +10 -5
- package/AudioV2/abstractAudio/subProperties/spatialAudio.js.map +1 -1
- package/AudioV2/webAudio/subNodes/webAudioBaseSubGraph.js +2 -2
- package/AudioV2/webAudio/subNodes/webAudioBaseSubGraph.js.map +1 -1
- package/AudioV2/webAudio/subNodes/webAudioBusAndSoundSubGraph.js +3 -3
- package/AudioV2/webAudio/subNodes/webAudioBusAndSoundSubGraph.js.map +1 -1
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.js +1 -1
- package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.js.map +1 -1
- package/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.js +7 -2
- package/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.js.map +1 -1
- package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.d.ts +3 -12
- package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.js +16 -36
- package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.d.ts +5 -1
- package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.js +17 -4
- package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.js.map +1 -1
- package/FlowGraph/Blocks/Data/flowGraphGetPropertyBlock.d.ts +3 -11
- package/FlowGraph/Blocks/Data/flowGraphGetPropertyBlock.js +5 -14
- package/FlowGraph/Blocks/Data/flowGraphGetPropertyBlock.js.map +1 -1
- package/FlowGraph/CustomTypes/flowGraphMatrix.d.ts +1 -0
- package/FlowGraph/CustomTypes/flowGraphMatrix.js +18 -17
- package/FlowGraph/CustomTypes/flowGraphMatrix.js.map +1 -1
- package/FlowGraph/flowGraphDataConnection.d.ts +10 -1
- package/FlowGraph/flowGraphDataConnection.js +23 -13
- package/FlowGraph/flowGraphDataConnection.js.map +1 -1
- package/FlowGraph/flowGraphRichTypes.d.ts +5 -0
- package/FlowGraph/flowGraphRichTypes.js +12 -0
- package/FlowGraph/flowGraphRichTypes.js.map +1 -1
- package/FrameGraph/Node/Blocks/Layers/glowLayerBlock.d.ts +2 -2
- package/FrameGraph/Node/Blocks/Layers/glowLayerBlock.js +6 -6
- package/FrameGraph/Node/Blocks/Layers/glowLayerBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/Layers/highlightLayerBlock.d.ts +2 -2
- package/FrameGraph/Node/Blocks/Layers/highlightLayerBlock.js +6 -6
- package/FrameGraph/Node/Blocks/Layers/highlightLayerBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/anaglyphPostProcessBlock.d.ts +30 -0
- package/FrameGraph/Node/Blocks/PostProcesses/anaglyphPostProcessBlock.js +48 -0
- package/FrameGraph/Node/Blocks/PostProcesses/anaglyphPostProcessBlock.js.map +1 -0
- package/FrameGraph/Node/Blocks/PostProcesses/basePostProcessBlock.d.ts +3 -3
- package/FrameGraph/Node/Blocks/PostProcesses/basePostProcessBlock.js +6 -6
- package/FrameGraph/Node/Blocks/PostProcesses/basePostProcessBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/chromaticAberrationPostProcessBlock.d.ts +38 -0
- package/FrameGraph/Node/Blocks/PostProcesses/chromaticAberrationPostProcessBlock.js +88 -0
- package/FrameGraph/Node/Blocks/PostProcesses/chromaticAberrationPostProcessBlock.js.map +1 -0
- package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.d.ts +2 -2
- package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js +6 -6
- package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/Rendering/utilityLayerRendererBlock.d.ts +2 -2
- package/FrameGraph/Node/Blocks/Rendering/utilityLayerRendererBlock.js +6 -6
- package/FrameGraph/Node/Blocks/Rendering/utilityLayerRendererBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/Textures/clearBlock.d.ts +2 -2
- package/FrameGraph/Node/Blocks/Textures/clearBlock.js +7 -7
- package/FrameGraph/Node/Blocks/Textures/clearBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/Textures/copyTextureBlock.d.ts +2 -2
- package/FrameGraph/Node/Blocks/Textures/copyTextureBlock.js +6 -6
- package/FrameGraph/Node/Blocks/Textures/copyTextureBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/Textures/generateMipmapsBlock.d.ts +2 -2
- package/FrameGraph/Node/Blocks/Textures/generateMipmapsBlock.js +7 -7
- package/FrameGraph/Node/Blocks/Textures/generateMipmapsBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/index.d.ts +2 -0
- package/FrameGraph/Node/Blocks/index.js +2 -0
- package/FrameGraph/Node/Blocks/index.js.map +1 -1
- package/FrameGraph/Node/nodeRenderGraph.js +2 -2
- package/FrameGraph/Node/nodeRenderGraph.js.map +1 -1
- package/FrameGraph/Tasks/Layers/baseLayerTask.d.ts +3 -3
- package/FrameGraph/Tasks/Layers/baseLayerTask.js +12 -12
- package/FrameGraph/Tasks/Layers/baseLayerTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/anaglyphTask.d.ts +21 -0
- package/FrameGraph/Tasks/PostProcesses/anaglyphTask.js +27 -0
- package/FrameGraph/Tasks/PostProcesses/anaglyphTask.js.map +1 -0
- package/FrameGraph/Tasks/PostProcesses/bloomTask.d.ts +2 -2
- package/FrameGraph/Tasks/PostProcesses/bloomTask.js +5 -5
- package/FrameGraph/Tasks/PostProcesses/bloomTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/chromaticAberrationTask.d.ts +17 -0
- package/FrameGraph/Tasks/PostProcesses/chromaticAberrationTask.js +23 -0
- package/FrameGraph/Tasks/PostProcesses/chromaticAberrationTask.js.map +1 -0
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.d.ts +2 -2
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.js +5 -5
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/postProcessTask.d.ts +2 -2
- package/FrameGraph/Tasks/PostProcesses/postProcessTask.js +1 -1
- package/FrameGraph/Tasks/PostProcesses/postProcessTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/ssrRenderingPipelineTask.d.ts +2 -2
- package/FrameGraph/Tasks/PostProcesses/ssrRenderingPipelineTask.js +8 -8
- package/FrameGraph/Tasks/PostProcesses/ssrRenderingPipelineTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/objectRendererTask.d.ts +3 -3
- package/FrameGraph/Tasks/Rendering/objectRendererTask.js +9 -9
- package/FrameGraph/Tasks/Rendering/objectRendererTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/taaObjectRendererTask.js +7 -7
- package/FrameGraph/Tasks/Rendering/taaObjectRendererTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/utilityLayerRendererTask.d.ts +3 -3
- package/FrameGraph/Tasks/Rendering/utilityLayerRendererTask.js +3 -3
- package/FrameGraph/Tasks/Rendering/utilityLayerRendererTask.js.map +1 -1
- package/FrameGraph/Tasks/Texture/clearTextureTask.d.ts +3 -3
- package/FrameGraph/Tasks/Texture/clearTextureTask.js +8 -8
- package/FrameGraph/Tasks/Texture/clearTextureTask.js.map +1 -1
- package/FrameGraph/Tasks/Texture/copyToTextureTask.d.ts +3 -3
- package/FrameGraph/Tasks/Texture/copyToTextureTask.js +3 -3
- package/FrameGraph/Tasks/Texture/copyToTextureTask.js.map +1 -1
- package/FrameGraph/Tasks/Texture/generateMipMapsTask.d.ts +2 -2
- package/FrameGraph/Tasks/Texture/generateMipMapsTask.js +5 -5
- package/FrameGraph/Tasks/Texture/generateMipMapsTask.js.map +1 -1
- package/FrameGraph/index.d.ts +2 -0
- package/FrameGraph/index.js +2 -0
- package/FrameGraph/index.js.map +1 -1
- package/Materials/Node/nodeMaterial.js +3 -0
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/materialDefines.js +1 -1
- package/Materials/materialDefines.js.map +1 -1
- package/Meshes/Builders/shapeBuilder.d.ts +6 -0
- package/Meshes/Builders/shapeBuilder.js +7 -4
- package/Meshes/Builders/shapeBuilder.js.map +1 -1
- package/PostProcesses/anaglyphPostProcess.d.ts +0 -1
- package/PostProcesses/anaglyphPostProcess.js +14 -11
- package/PostProcesses/anaglyphPostProcess.js.map +1 -1
- package/PostProcesses/chromaticAberrationPostProcess.d.ts +15 -8
- package/PostProcesses/chromaticAberrationPostProcess.js +72 -42
- package/PostProcesses/chromaticAberrationPostProcess.js.map +1 -1
- package/PostProcesses/index.d.ts +2 -0
- package/PostProcesses/index.js +2 -0
- package/PostProcesses/index.js.map +1 -1
- package/PostProcesses/postProcess.d.ts +5 -0
- package/PostProcesses/postProcess.js +10 -2
- package/PostProcesses/postProcess.js.map +1 -1
- package/PostProcesses/thinAnaglyphPostProcess.d.ts +23 -0
- package/PostProcesses/thinAnaglyphPostProcess.js +42 -0
- package/PostProcesses/thinAnaglyphPostProcess.js.map +1 -0
- package/PostProcesses/thinChromaticAberrationPostProcess.d.ts +45 -0
- package/PostProcesses/thinChromaticAberrationPostProcess.js +69 -0
- package/PostProcesses/thinChromaticAberrationPostProcess.js.map +1 -0
- package/package.json +1 -1
|
@@ -35,7 +35,12 @@ export class FlowGraphDataConnection extends FlowGraphConnection {
|
|
|
35
35
|
this.richType = richType;
|
|
36
36
|
this._defaultValue = _defaultValue;
|
|
37
37
|
this._optional = _optional;
|
|
38
|
-
this.
|
|
38
|
+
this._isDisabled = false;
|
|
39
|
+
/**
|
|
40
|
+
* This is used for debugging purposes! It is the last value that was set to this connection with ANY context.
|
|
41
|
+
* Do not use this value for anything else, as it might be wrong if used in a different context.
|
|
42
|
+
*/
|
|
43
|
+
this._lastValue = null;
|
|
39
44
|
/**
|
|
40
45
|
* a data transformer function, if needed.
|
|
41
46
|
* This can be used, for example, to force seconds into milliseconds output, if it makes sense in your case.
|
|
@@ -58,14 +63,14 @@ export class FlowGraphDataConnection extends FlowGraphConnection {
|
|
|
58
63
|
* If the connection is disabled you will not be able to connect anything to it.
|
|
59
64
|
*/
|
|
60
65
|
get isDisabled() {
|
|
61
|
-
return this.
|
|
66
|
+
return this._isDisabled;
|
|
62
67
|
}
|
|
63
68
|
set isDisabled(value) {
|
|
64
|
-
if (this.
|
|
69
|
+
if (this._isDisabled === value) {
|
|
65
70
|
return;
|
|
66
71
|
}
|
|
67
|
-
this.
|
|
68
|
-
if (this.
|
|
72
|
+
this._isDisabled = value;
|
|
73
|
+
if (this._isDisabled) {
|
|
69
74
|
this.disconnectFromAll();
|
|
70
75
|
}
|
|
71
76
|
}
|
|
@@ -102,7 +107,7 @@ export class FlowGraphDataConnection extends FlowGraphConnection {
|
|
|
102
107
|
* @param point the point to connect to.
|
|
103
108
|
*/
|
|
104
109
|
connectTo(point) {
|
|
105
|
-
if (this.
|
|
110
|
+
if (this._isDisabled) {
|
|
106
111
|
return;
|
|
107
112
|
}
|
|
108
113
|
super.connectTo(point);
|
|
@@ -120,14 +125,19 @@ export class FlowGraphDataConnection extends FlowGraphConnection {
|
|
|
120
125
|
if (this.connectionType === 1 /* FlowGraphConnectionType.Output */) {
|
|
121
126
|
context._notifyExecuteNode(this._ownerBlock);
|
|
122
127
|
this._ownerBlock._updateOutputs(context);
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
return this._getValueOrDefault(context);
|
|
127
|
-
}
|
|
128
|
-
else {
|
|
129
|
-
return this._connectedPoint[0].getValue(context);
|
|
128
|
+
const value = this._getValueOrDefault(context);
|
|
129
|
+
this._lastValue = value;
|
|
130
|
+
return this.richType.typeTransformer ? this.richType.typeTransformer(value) : value;
|
|
130
131
|
}
|
|
132
|
+
const value = !this.isConnected() ? this._getValueOrDefault(context) : this._connectedPoint[0].getValue(context);
|
|
133
|
+
this._lastValue = value;
|
|
134
|
+
return this.richType.typeTransformer ? this.richType.typeTransformer(value) : value;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* @internal
|
|
138
|
+
*/
|
|
139
|
+
_getLastValue() {
|
|
140
|
+
return this._lastValue;
|
|
131
141
|
}
|
|
132
142
|
/**
|
|
133
143
|
* @returns class name of the object.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flowGraphDataConnection.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphDataConnection.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,EAAE,mBAAmB,EAA2B,MAAM,uBAAuB,CAAC;AAGrF,OAAO,EAAE,UAAU,EAAE,8BAA6B;AAClD,OAAO,EAAE,iCAAiC,EAAE,MAAM,iBAAiB,CAAC;AACpE;;;;;GAKG;AACH,MAAM,OAAO,uBAA2B,SAAQ,mBAA+D;IAa3G;;;;;;;;OAQG;IACH,YACI,IAAY,EACZ,cAAuC,EACvC,UAA0B;IAC1B;;OAEG;IACI,QAAqB;IAC5B;;OAEG;IACK,gBAAmB,QAAQ,CAAC,YAAY;IAChD;;OAEG;IACK,YAAqB,KAAK;QAElC,KAAK,CAAC,IAAI,EAAE,cAAc,EAAE,UAAU,CAAC,CAAC;QAVjC,aAAQ,GAAR,QAAQ,CAAa;QAIpB,kBAAa,GAAb,aAAa,CAA2B;QAIxC,cAAS,GAAT,SAAS,CAAiB;QApC9B,eAAU,GAAY,KAAK,CAAC;QAEpC;;;WAG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import type { Nullable } from \"core/types\";\r\nimport { RegisterClass } from \"../Misc/typeStore\";\r\nimport type { FlowGraphBlock } from \"./flowGraphBlock\";\r\nimport { FlowGraphConnection, FlowGraphConnectionType } from \"./flowGraphConnection\";\r\nimport type { FlowGraphContext } from \"./flowGraphContext\";\r\nimport type { RichType } from \"./flowGraphRichTypes\";\r\nimport { Observable } from \"core/Misc/observable\";\r\nimport { defaultValueSerializationFunction } from \"./serialization\";\r\n/**\r\n * Represents a connection point for data.\r\n * An unconnected input point can have a default value.\r\n * An output point will only have a value if it is connected to an input point. Furthermore,\r\n * if the point belongs to a \"function\" node, the node will run its function to update the value.\r\n */\r\nexport class FlowGraphDataConnection<T> extends FlowGraphConnection<FlowGraphBlock, FlowGraphDataConnection<T>> {\r\n private _isDiabled: boolean = false;\r\n\r\n /**\r\n * a data transformer function, if needed.\r\n * This can be used, for example, to force seconds into milliseconds output, if it makes sense in your case.\r\n */\r\n public dataTransformer: Nullable<(value: T) => T> = null;\r\n\r\n /**\r\n * An observable that is triggered when the value of the connection changes.\r\n */\r\n public onValueChangedObservable = new Observable<T>();\r\n /**\r\n * Create a new data connection point.\r\n * @param name the name of the connection\r\n * @param connectionType the type of the connection\r\n * @param ownerBlock the block that owns this connection\r\n * @param richType the type of the data in this block\r\n * @param _defaultValue the default value of the connection\r\n * @param _optional if the connection is optional\r\n */\r\n public constructor(\r\n name: string,\r\n connectionType: FlowGraphConnectionType,\r\n ownerBlock: FlowGraphBlock,\r\n /**\r\n * the type of the data in this block\r\n */\r\n public richType: RichType<T>,\r\n /**\r\n * [any] the default value of the connection\r\n */\r\n private _defaultValue: T = richType.defaultValue,\r\n /**\r\n * [false] if the connection is optional\r\n */\r\n private _optional: boolean = false\r\n ) {\r\n super(name, connectionType, ownerBlock);\r\n }\r\n\r\n /**\r\n * Whether or not the connection is optional.\r\n * Currently only used for UI control.\r\n */\r\n public get optional(): boolean {\r\n return this._optional;\r\n }\r\n\r\n /**\r\n * is this connection disabled\r\n * If the connection is disabled you will not be able to connect anything to it.\r\n */\r\n public get isDisabled(): boolean {\r\n return this._isDiabled;\r\n }\r\n\r\n public set isDisabled(value: boolean) {\r\n if (this._isDiabled === value) {\r\n return;\r\n }\r\n this._isDiabled = value;\r\n if (this._isDiabled) {\r\n this.disconnectFromAll();\r\n }\r\n }\r\n\r\n /**\r\n * An output data block can connect to multiple input data blocks,\r\n * but an input data block can only connect to one output data block.\r\n * @returns true if the connection is singular\r\n */\r\n public override _isSingularConnection(): boolean {\r\n return this.connectionType === FlowGraphConnectionType.Input;\r\n }\r\n\r\n /**\r\n * Set the value of the connection in a specific context.\r\n * @param value the value to set\r\n * @param context the context to which the value is set\r\n */\r\n public setValue(value: T, context: FlowGraphContext): void {\r\n // check if the value is different\r\n if (context._getConnectionValue(this) === value) {\r\n return;\r\n }\r\n context._setConnectionValue(this, value);\r\n this.onValueChangedObservable.notifyObservers(value);\r\n }\r\n\r\n /**\r\n * Reset the value of the connection to the default value.\r\n * @param context the context in which the value is reset\r\n */\r\n public resetToDefaultValue(context: FlowGraphContext): void {\r\n context._setConnectionValue(this, this._defaultValue);\r\n }\r\n\r\n /**\r\n * Connect this point to another point.\r\n * @param point the point to connect to.\r\n */\r\n public override connectTo(point: FlowGraphDataConnection<T>): void {\r\n if (this._isDiabled) {\r\n return;\r\n }\r\n super.connectTo(point);\r\n }\r\n\r\n private _getValueOrDefault(context: FlowGraphContext): T {\r\n const val = context._getConnectionValue(this) ?? this._defaultValue;\r\n return this.dataTransformer ? this.dataTransformer(val) : val;\r\n }\r\n\r\n /**\r\n * Gets the value of the connection in a specific context.\r\n * @param context the context from which the value is retrieved\r\n * @returns the value of the connection\r\n */\r\n public getValue(context: FlowGraphContext): T {\r\n if (this.connectionType === FlowGraphConnectionType.Output) {\r\n context._notifyExecuteNode(this._ownerBlock);\r\n this._ownerBlock._updateOutputs(context);\r\n return this._getValueOrDefault(context);\r\n }\r\n\r\n if (!this.isConnected()) {\r\n return this._getValueOrDefault(context);\r\n } else {\r\n return this._connectedPoint[0].getValue(context);\r\n }\r\n }\r\n\r\n /**\r\n * @returns class name of the object.\r\n */\r\n public override getClassName(): string {\r\n return \"FlowGraphDataConnection\";\r\n }\r\n\r\n /**\r\n * Serializes this object.\r\n * @param serializationObject the object to serialize to\r\n */\r\n public override serialize(serializationObject: any = {}) {\r\n super.serialize(serializationObject);\r\n serializationObject.richType = {};\r\n this.richType.serialize(serializationObject.richType);\r\n serializationObject.optional = this._optional;\r\n defaultValueSerializationFunction(\"defaultValue\", this._defaultValue, serializationObject);\r\n }\r\n}\r\n\r\nRegisterClass(\"FlowGraphDataConnection\", FlowGraphDataConnection);\r\n"]}
|
|
1
|
+
{"version":3,"file":"flowGraphDataConnection.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphDataConnection.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,EAAE,mBAAmB,EAA2B,MAAM,uBAAuB,CAAC;AAGrF,OAAO,EAAE,UAAU,EAAE,8BAA6B;AAClD,OAAO,EAAE,iCAAiC,EAAE,MAAM,iBAAiB,CAAC;AACpE;;;;;GAKG;AACH,MAAM,OAAO,uBAA2B,SAAQ,mBAA+D;IAkB3G;;;;;;;;OAQG;IACH,YACI,IAAY,EACZ,cAAuC,EACvC,UAA0B;IAC1B;;OAEG;IACI,QAAqB;IAC5B;;OAEG;IACK,gBAAmB,QAAQ,CAAC,YAAY;IAChD;;OAEG;IACK,YAAqB,KAAK;QAElC,KAAK,CAAC,IAAI,EAAE,cAAc,EAAE,UAAU,CAAC,CAAC;QAVjC,aAAQ,GAAR,QAAQ,CAAa;QAIpB,kBAAa,GAAb,aAAa,CAA2B;QAIxC,cAAS,GAAT,SAAS,CAAiB;QAzC9B,gBAAW,GAAY,KAAK,CAAC;QACrC;;;WAGG;QACK,eAAU,GAAgB,IAAI,CAAC;QAEvC;;;WAGG;QACI,oBAAe,GAA8B,IAAI,CAAC;QAEzD;;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CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC;QACrC,mBAAmB,CAAC,QAAQ,GAAG,EAAE,CAAC;QAClC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC;QACtD,mBAAmB,CAAC,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC;QAC9C,iCAAiC,CAAC,cAAc,EAAE,IAAI,CAAC,aAAa,EAAE,mBAAmB,CAAC,CAAC;IAC/F,CAAC;CACJ;AAED,aAAa,CAAC,yBAAyB,EAAE,uBAAuB,CAAC,CAAC","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport { RegisterClass } from \"../Misc/typeStore\";\r\nimport type { FlowGraphBlock } from \"./flowGraphBlock\";\r\nimport { FlowGraphConnection, FlowGraphConnectionType } from \"./flowGraphConnection\";\r\nimport type { FlowGraphContext } from \"./flowGraphContext\";\r\nimport type { RichType } from \"./flowGraphRichTypes\";\r\nimport { Observable } from \"core/Misc/observable\";\r\nimport { defaultValueSerializationFunction } from \"./serialization\";\r\n/**\r\n * Represents a connection point for data.\r\n * An unconnected input point can have a default value.\r\n * An output point will only have a value if it is connected to an input point. Furthermore,\r\n * if the point belongs to a \"function\" node, the node will run its function to update the value.\r\n */\r\nexport class FlowGraphDataConnection<T> extends FlowGraphConnection<FlowGraphBlock, FlowGraphDataConnection<T>> {\r\n private _isDisabled: boolean = false;\r\n /**\r\n * This is used for debugging purposes! It is the last value that was set to this connection with ANY context.\r\n * Do not use this value for anything else, as it might be wrong if used in a different context.\r\n */\r\n private _lastValue: Nullable<T> = null;\r\n\r\n /**\r\n * a data transformer function, if needed.\r\n * This can be used, for example, to force seconds into milliseconds output, if it makes sense in your case.\r\n */\r\n public dataTransformer: Nullable<(value: T) => T> = null;\r\n\r\n /**\r\n * An observable that is triggered when the value of the connection changes.\r\n */\r\n public onValueChangedObservable = new Observable<T>();\r\n /**\r\n * Create a new data connection point.\r\n * @param name the name of the connection\r\n * @param connectionType the type of the connection\r\n * @param ownerBlock the block that owns this connection\r\n * @param richType the type of the data in this block\r\n * @param _defaultValue the default value of the connection\r\n * @param _optional if the connection is optional\r\n */\r\n public constructor(\r\n name: string,\r\n connectionType: FlowGraphConnectionType,\r\n ownerBlock: FlowGraphBlock,\r\n /**\r\n * the type of the data in this block\r\n */\r\n public richType: RichType<T>,\r\n /**\r\n * [any] the default value of the connection\r\n */\r\n private _defaultValue: T = richType.defaultValue,\r\n /**\r\n * [false] if the connection is optional\r\n */\r\n private _optional: boolean = false\r\n ) {\r\n super(name, connectionType, ownerBlock);\r\n }\r\n\r\n /**\r\n * Whether or not the connection is optional.\r\n * Currently only used for UI control.\r\n */\r\n public get optional(): boolean {\r\n return this._optional;\r\n }\r\n\r\n /**\r\n * is this connection disabled\r\n * If the connection is disabled you will not be able to connect anything to it.\r\n */\r\n public get isDisabled(): boolean {\r\n return this._isDisabled;\r\n }\r\n\r\n public set isDisabled(value: boolean) {\r\n if (this._isDisabled === value) {\r\n return;\r\n }\r\n this._isDisabled = value;\r\n if (this._isDisabled) {\r\n this.disconnectFromAll();\r\n }\r\n }\r\n\r\n /**\r\n * An output data block can connect to multiple input data blocks,\r\n * but an input data block can only connect to one output data block.\r\n * @returns true if the connection is singular\r\n */\r\n public override _isSingularConnection(): boolean {\r\n return this.connectionType === FlowGraphConnectionType.Input;\r\n }\r\n\r\n /**\r\n * Set the value of the connection in a specific context.\r\n * @param value the value to set\r\n * @param context the context to which the value is set\r\n */\r\n public setValue(value: T, context: FlowGraphContext): void {\r\n // check if the value is different\r\n if (context._getConnectionValue(this) === value) {\r\n return;\r\n }\r\n context._setConnectionValue(this, value);\r\n this.onValueChangedObservable.notifyObservers(value);\r\n }\r\n\r\n /**\r\n * Reset the value of the connection to the default value.\r\n * @param context the context in which the value is reset\r\n */\r\n public resetToDefaultValue(context: FlowGraphContext): void {\r\n context._setConnectionValue(this, this._defaultValue);\r\n }\r\n\r\n /**\r\n * Connect this point to another point.\r\n * @param point the point to connect to.\r\n */\r\n public override connectTo(point: FlowGraphDataConnection<T>): void {\r\n if (this._isDisabled) {\r\n return;\r\n }\r\n super.connectTo(point);\r\n }\r\n\r\n private _getValueOrDefault(context: FlowGraphContext): T {\r\n const val = context._getConnectionValue(this) ?? this._defaultValue;\r\n return this.dataTransformer ? this.dataTransformer(val) : val;\r\n }\r\n\r\n /**\r\n * Gets the value of the connection in a specific context.\r\n * @param context the context from which the value is retrieved\r\n * @returns the value of the connection\r\n */\r\n public getValue(context: FlowGraphContext): T {\r\n if (this.connectionType === FlowGraphConnectionType.Output) {\r\n context._notifyExecuteNode(this._ownerBlock);\r\n this._ownerBlock._updateOutputs(context);\r\n const value = this._getValueOrDefault(context);\r\n this._lastValue = value;\r\n return this.richType.typeTransformer ? this.richType.typeTransformer(value) : value;\r\n }\r\n const value = !this.isConnected() ? this._getValueOrDefault(context) : this._connectedPoint[0].getValue(context);\r\n this._lastValue = value;\r\n return this.richType.typeTransformer ? this.richType.typeTransformer(value) : value;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _getLastValue(): Nullable<T> {\r\n return this._lastValue;\r\n }\r\n\r\n /**\r\n * @returns class name of the object.\r\n */\r\n public override getClassName(): string {\r\n return \"FlowGraphDataConnection\";\r\n }\r\n\r\n /**\r\n * Serializes this object.\r\n * @param serializationObject the object to serialize to\r\n */\r\n public override serialize(serializationObject: any = {}) {\r\n super.serialize(serializationObject);\r\n serializationObject.richType = {};\r\n this.richType.serialize(serializationObject.richType);\r\n serializationObject.optional = this._optional;\r\n defaultValueSerializationFunction(\"defaultValue\", this._defaultValue, serializationObject);\r\n }\r\n}\r\n\r\nRegisterClass(\"FlowGraphDataConnection\", FlowGraphDataConnection);\r\n"]}
|
|
@@ -39,6 +39,11 @@ export declare class RichType<T> {
|
|
|
39
39
|
* [-1] The ANIMATIONTYPE of the type, if available
|
|
40
40
|
*/
|
|
41
41
|
animationType: number;
|
|
42
|
+
/**
|
|
43
|
+
* A function that can be used to transform a value of any type into a value of this rich type.
|
|
44
|
+
* This can be used, for example, between vector4 and quaternion.
|
|
45
|
+
*/
|
|
46
|
+
typeTransformer: (value: any) => T;
|
|
42
47
|
constructor(
|
|
43
48
|
/**
|
|
44
49
|
* The name given to the type.
|
|
@@ -68,6 +68,18 @@ export const RichTypeMatrix3D = new RichType("Matrix3D" /* FlowGraphTypes.Matrix
|
|
|
68
68
|
export const RichTypeColor3 = new RichType("Color3" /* FlowGraphTypes.Color3 */, Color3.Black(), 4);
|
|
69
69
|
export const RichTypeColor4 = new RichType("Color4" /* FlowGraphTypes.Color4 */, new Color4(0, 0, 0, 0), 7);
|
|
70
70
|
export const RichTypeQuaternion = new RichType("Quaternion" /* FlowGraphTypes.Quaternion */, Quaternion.Identity(), 2);
|
|
71
|
+
RichTypeQuaternion.typeTransformer = (value) => {
|
|
72
|
+
if (value.getClassName && value.getClassName() === "Vector4" /* FlowGraphTypes.Vector4 */) {
|
|
73
|
+
return Quaternion.FromArray(value.asArray());
|
|
74
|
+
}
|
|
75
|
+
else if (value.getClassName && value.getClassName() === "Vector3" /* FlowGraphTypes.Vector3 */) {
|
|
76
|
+
return Quaternion.FromEulerVector(value);
|
|
77
|
+
}
|
|
78
|
+
else if (value.getClassName && value.getClassName() === "Matrix" /* FlowGraphTypes.Matrix */) {
|
|
79
|
+
return Quaternion.FromRotationMatrix(value);
|
|
80
|
+
}
|
|
81
|
+
return value;
|
|
82
|
+
};
|
|
71
83
|
export const RichTypeFlowGraphInteger = new RichType("FlowGraphInteger" /* FlowGraphTypes.Integer */, new FlowGraphInteger(0), 0);
|
|
72
84
|
/**
|
|
73
85
|
* Given a value, try to deduce its rich type.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flowGraphRichTypes.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphRichTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM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cesContent":["import { Vector2, Vector3, Vector4, Matrix, Quaternion } from \"../Maths/math.vector\";\r\nimport { Color3, Color4 } from \"../Maths/math.color\";\r\nimport { FlowGraphInteger } from \"./CustomTypes/flowGraphInteger\";\r\nimport { Constants } from \"core/Engines/constants\";\r\nimport { FlowGraphMatrix2D, FlowGraphMatrix3D } from \"./CustomTypes/flowGraphMatrix\";\r\n\r\n/**\r\n * The types supported by the flow graph.\r\n */\r\nexport const enum FlowGraphTypes {\r\n Any = \"any\",\r\n String = \"string\",\r\n Number = \"number\",\r\n Boolean = \"boolean\",\r\n Object = \"object\",\r\n Integer = \"FlowGraphInteger\",\r\n Vector2 = \"Vector2\",\r\n Vector3 = \"Vector3\",\r\n Vector4 = \"Vector4\",\r\n Quaternion = \"Quaternion\",\r\n Matrix = \"Matrix\",\r\n Matrix2D = \"Matrix2D\",\r\n Matrix3D = \"Matrix3D\",\r\n Color3 = \"Color3\",\r\n Color4 = \"Color4\",\r\n}\r\n\r\n/**\r\n * A rich type represents extra information about a type,\r\n * such as its name and a default value constructor.\r\n */\r\nexport class RichType<T> {\r\n constructor(\r\n /**\r\n * The name given to the type.\r\n */\r\n public typeName: string,\r\n /**\r\n * The default value of the type.\r\n */\r\n public defaultValue: T,\r\n\r\n /**\r\n * [-1] The ANIMATIONTYPE of the type, if available\r\n */\r\n public animationType: number = -1\r\n ) {}\r\n\r\n /**\r\n * Serializes this rich type into a serialization object.\r\n * @param serializationObject the object to serialize to\r\n */\r\n serialize(serializationObject: any) {\r\n serializationObject.typeName = this.typeName;\r\n serializationObject.defaultValue = this.defaultValue;\r\n }\r\n}\r\n\r\nexport const RichTypeAny: RichType<any> = new RichType(FlowGraphTypes.Any, undefined);\r\n\r\nexport const RichTypeString: RichType<string> = new RichType(FlowGraphTypes.String, \"\");\r\n\r\nexport const RichTypeNumber: RichType<number> = new RichType(FlowGraphTypes.Number, 0, Constants.ANIMATIONTYPE_FLOAT);\r\n\r\nexport const RichTypeBoolean: RichType<boolean> = new RichType(FlowGraphTypes.Boolean, false);\r\n\r\nexport const RichTypeVector2: RichType<Vector2> = new RichType(FlowGraphTypes.Vector2, Vector2.Zero(), Constants.ANIMATIONTYPE_VECTOR2);\r\n\r\nexport const RichTypeVector3: RichType<Vector3> = new RichType(FlowGraphTypes.Vector3, Vector3.Zero(), Constants.ANIMATIONTYPE_VECTOR3);\r\n\r\nexport const RichTypeVector4: RichType<Vector4> = new RichType(FlowGraphTypes.Vector4, Vector4.Zero());\r\n\r\nexport const RichTypeMatrix: RichType<Matrix> = new RichType(FlowGraphTypes.Matrix, Matrix.Identity(), Constants.ANIMATIONTYPE_MATRIX);\r\n\r\nexport const RichTypeMatrix2D: RichType<FlowGraphMatrix2D> = new RichType(FlowGraphTypes.Matrix2D, new FlowGraphMatrix2D());\r\n\r\nexport const RichTypeMatrix3D: RichType<FlowGraphMatrix3D> = new RichType(FlowGraphTypes.Matrix3D, new FlowGraphMatrix3D());\r\n\r\nexport const RichTypeColor3: RichType<Color3> = new RichType(FlowGraphTypes.Color3, Color3.Black(), Constants.ANIMATIONTYPE_COLOR3);\r\n\r\nexport const RichTypeColor4: RichType<Color4> = new RichType(FlowGraphTypes.Color4, new Color4(0, 0, 0, 0), Constants.ANIMATIONTYPE_COLOR4);\r\n\r\nexport const RichTypeQuaternion: RichType<Quaternion> = new RichType(FlowGraphTypes.Quaternion, Quaternion.Identity(), Constants.ANIMATIONTYPE_QUATERNION);\r\n\r\nexport const RichTypeFlowGraphInteger: RichType<FlowGraphInteger> = new RichType(FlowGraphTypes.Integer, new FlowGraphInteger(0), Constants.ANIMATIONTYPE_FLOAT);\r\n\r\n/**\r\n * Given a value, try to deduce its rich type.\r\n * @param value the value to deduce the rich type from\r\n * @returns the value's rich type, or RichTypeAny if the type could not be deduced.\r\n */\r\nexport function getRichTypeFromValue<T>(value: T): RichType<T> {\r\n const anyValue = value as any;\r\n switch (typeof value) {\r\n case FlowGraphTypes.String:\r\n return RichTypeString as RichType<T>;\r\n case FlowGraphTypes.Number:\r\n return RichTypeNumber as RichType<T>;\r\n case FlowGraphTypes.Boolean:\r\n return RichTypeBoolean as RichType<T>;\r\n case FlowGraphTypes.Object:\r\n if (anyValue.getClassName) {\r\n switch (anyValue.getClassName() as string) {\r\n case FlowGraphTypes.Vector2:\r\n return RichTypeVector2 as RichType<T>;\r\n case FlowGraphTypes.Vector3:\r\n return RichTypeVector3 as RichType<T>;\r\n case FlowGraphTypes.Vector4:\r\n return RichTypeVector4 as RichType<T>;\r\n case FlowGraphTypes.Matrix:\r\n return RichTypeMatrix as RichType<T>;\r\n case FlowGraphTypes.Color3:\r\n return RichTypeColor3 as RichType<T>;\r\n case FlowGraphTypes.Color4:\r\n return RichTypeColor4 as RichType<T>;\r\n case FlowGraphTypes.Quaternion:\r\n return RichTypeQuaternion as RichType<T>;\r\n case FlowGraphTypes.Integer:\r\n return RichTypeFlowGraphInteger as RichType<T>;\r\n case FlowGraphTypes.Matrix2D:\r\n return RichTypeMatrix2D as RichType<T>;\r\n case FlowGraphTypes.Matrix3D:\r\n return RichTypeMatrix3D as RichType<T>;\r\n }\r\n }\r\n return RichTypeAny as RichType<T>;\r\n default:\r\n return RichTypeAny as RichType<T>;\r\n }\r\n}\r\n\r\n/**\r\n * Given a flow graph type, return the rich type that corresponds to it.\r\n * @param flowGraphType the flow graph type\r\n * @returns the rich type that corresponds to the flow graph type\r\n */\r\nexport function getRichTypeByFlowGraphType(flowGraphType?: string): RichType<any> {\r\n switch (flowGraphType) {\r\n case FlowGraphTypes.String:\r\n return RichTypeString;\r\n case FlowGraphTypes.Number:\r\n return RichTypeNumber;\r\n case FlowGraphTypes.Boolean:\r\n return RichTypeBoolean;\r\n case FlowGraphTypes.Vector2:\r\n return RichTypeVector2;\r\n case FlowGraphTypes.Vector3:\r\n return RichTypeVector3;\r\n case FlowGraphTypes.Vector4:\r\n return RichTypeVector4;\r\n case FlowGraphTypes.Matrix:\r\n return RichTypeMatrix;\r\n case FlowGraphTypes.Color3:\r\n return RichTypeColor3;\r\n case FlowGraphTypes.Color4:\r\n return RichTypeColor4;\r\n case FlowGraphTypes.Quaternion:\r\n return RichTypeQuaternion;\r\n case FlowGraphTypes.Integer:\r\n return RichTypeFlowGraphInteger;\r\n case FlowGraphTypes.Matrix2D:\r\n return RichTypeMatrix2D;\r\n case FlowGraphTypes.Matrix3D:\r\n return RichTypeMatrix3D;\r\n default:\r\n return RichTypeAny;\r\n }\r\n}\r\n\r\n/**\r\n * get the animation type for a given flow graph type\r\n * @param flowGraphType the flow graph type\r\n * @returns the animation type for this flow graph type\r\n */\r\nexport function getAnimationTypeByFlowGraphType(flowGraphType: FlowGraphTypes): number {\r\n switch (flowGraphType) {\r\n case FlowGraphTypes.Number:\r\n return Constants.ANIMATIONTYPE_FLOAT;\r\n case FlowGraphTypes.Vector2:\r\n return Constants.ANIMATIONTYPE_VECTOR2;\r\n case FlowGraphTypes.Vector3:\r\n return Constants.ANIMATIONTYPE_VECTOR3;\r\n case FlowGraphTypes.Matrix:\r\n return Constants.ANIMATIONTYPE_MATRIX;\r\n case FlowGraphTypes.Color3:\r\n return Constants.ANIMATIONTYPE_COLOR3;\r\n case FlowGraphTypes.Color4:\r\n return Constants.ANIMATIONTYPE_COLOR4;\r\n case FlowGraphTypes.Quaternion:\r\n return Constants.ANIMATIONTYPE_QUATERNION;\r\n default:\r\n return Constants.ANIMATIONTYPE_FLOAT;\r\n }\r\n}\r\n\r\n/**\r\n * Given an animation type, return the rich type that corresponds to it.\r\n * @param animationType the animation type\r\n * @returns the rich type that corresponds to the animation type\r\n */\r\nexport function getRichTypeByAnimationType(animationType: number): RichType<any> {\r\n switch (animationType) {\r\n case Constants.ANIMATIONTYPE_FLOAT:\r\n return RichTypeNumber;\r\n case Constants.ANIMATIONTYPE_VECTOR2:\r\n return RichTypeVector2;\r\n case Constants.ANIMATIONTYPE_VECTOR3:\r\n return RichTypeVector3;\r\n case Constants.ANIMATIONTYPE_MATRIX:\r\n return RichTypeMatrix;\r\n case Constants.ANIMATIONTYPE_COLOR3:\r\n return RichTypeColor3;\r\n case Constants.ANIMATIONTYPE_COLOR4:\r\n return RichTypeColor4;\r\n case Constants.ANIMATIONTYPE_QUATERNION:\r\n return RichTypeQuaternion;\r\n default:\r\n return RichTypeAny;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"flowGraphRichTypes.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphRichTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACrF,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,gCAA+B;AACnD,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAErF;;GAEG;AACH,MAAM,CAAN,IAAkB,cAgBjB;AAhBD,WAAkB,cAAc;IAC5B,6BAAW,CAAA;IACX,mCAAiB,CAAA;IACjB,mCAAiB,CAAA;IACjB,qCAAmB,CAAA;IACnB,mCAAiB,CAAA;IACjB,8CAA4B,CAAA;IAC5B,qCAAmB,CAAA;IACnB,qCAAmB,CAAA;IACnB,qCAAmB,CAAA;IACnB,2CAAyB,CAAA;IACzB,mCAAiB,CAAA;IACjB,uCAAqB,CAAA;IACrB,uCAAqB,CAAA;IACrB,mCAAiB,CAAA;IACjB,mCAAiB,CAAA;AACrB,CAAC,EAhBiB,cAAc,KAAd,cAAc,QAgB/B;AAED;;;GAGG;AACH,MAAM,OAAO,QAAQ;IAOjB;IACI;;OAEG;IACI,QAAgB;IACvB;;OAEG;IACI,YAAe;IAEtB;;OAEG;IACI,gBAAwB,CAAC,CAAC;QAT1B,aAAQ,GAAR,QAAQ,CAAQ;QAIhB,iBAAY,GAAZ,YAAY,CAAG;QAKf,k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ACpB;YACI,OAAO,SAAS,CAAC,mBAAmB,CAAC;QACzC;YACI,OAAO,SAAS,CAAC,qBAAqB,CAAC;QAC3C;YACI,OAAO,SAAS,CAAC,qBAAqB,CAAC;QAC3C;YACI,OAAO,SAAS,CAAC,oBAAoB,CAAC;QAC1C;YACI,OAAO,SAAS,CAAC,oBAAoB,CAAC;QAC1C;YACI,OAAO,SAAS,CAAC,oBAAoB,CAAC;QAC1C;YACI,OAAO,SAAS,CAAC,wBAAwB,CAAC;QAC9C;YACI,OAAO,SAAS,CAAC,mBAAmB,CAAC;IAC7C,CAAC;AACL,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,0BAA0B,CAAC,aAAqB;IAC5D,QAAQ,aAAa,EAAE,CAAC;QACpB,KAAK,SAAS,CAAC,mBAAmB;YAC9B,OAAO,cAAc,CAAC;QAC1B,KAAK,SAAS,CAAC,qBAAqB;YAChC,OAAO,eAAe,CAAC;QAC3B,KAAK,SAAS,CAAC,qBAAqB;YAChC,OAAO,eAAe,CAAC;QAC3B,KAAK,SAAS,CAAC,oBAAoB;YAC/B,OAAO,cAAc,CAAC;QAC1B,KAAK,SAAS,CAAC,oBAAoB;YAC/B,OAAO,cAAc,CAAC;QAC1B,KAAK,SAAS,CAAC,oBAAoB;YAC/B,OAAO,cAAc,CAAC;QAC1B,KAAK,SAAS,CAAC,wBAAwB;YACnC,OAAO,kBAAkB,CAAC;QAC9B;YACI,OAAO,WAAW,CAAC;IAC3B,CAAC;AACL,CAAC","sourcesContent":["import { Vector2, Vector3, Vector4, Matrix, Quaternion } from \"../Maths/math.vector\";\r\nimport { Color3, Color4 } from \"../Maths/math.color\";\r\nimport { FlowGraphInteger } from \"./CustomTypes/flowGraphInteger\";\r\nimport { Constants } from \"core/Engines/constants\";\r\nimport { FlowGraphMatrix2D, FlowGraphMatrix3D } from \"./CustomTypes/flowGraphMatrix\";\r\n\r\n/**\r\n * The types supported by the flow graph.\r\n */\r\nexport const enum FlowGraphTypes {\r\n Any = \"any\",\r\n String = \"string\",\r\n Number = \"number\",\r\n Boolean = \"boolean\",\r\n Object = \"object\",\r\n Integer = \"FlowGraphInteger\",\r\n Vector2 = \"Vector2\",\r\n Vector3 = \"Vector3\",\r\n Vector4 = \"Vector4\",\r\n Quaternion = \"Quaternion\",\r\n Matrix = \"Matrix\",\r\n Matrix2D = \"Matrix2D\",\r\n Matrix3D = \"Matrix3D\",\r\n Color3 = \"Color3\",\r\n Color4 = \"Color4\",\r\n}\r\n\r\n/**\r\n * A rich type represents extra information about a type,\r\n * such as its name and a default value constructor.\r\n */\r\nexport class RichType<T> {\r\n /**\r\n * A function that can be used to transform a value of any type into a value of this rich type.\r\n * This can be used, for example, between vector4 and quaternion.\r\n */\r\n public typeTransformer: (value: any) => T;\r\n\r\n constructor(\r\n /**\r\n * The name given to the type.\r\n */\r\n public typeName: string,\r\n /**\r\n * The default value of the type.\r\n */\r\n public defaultValue: T,\r\n\r\n /**\r\n * [-1] The ANIMATIONTYPE of the type, if available\r\n */\r\n public animationType: number = -1\r\n ) {}\r\n\r\n /**\r\n * Serializes this rich type into a serialization object.\r\n * @param serializationObject the object to serialize to\r\n */\r\n serialize(serializationObject: any) {\r\n serializationObject.typeName = this.typeName;\r\n serializationObject.defaultValue = this.defaultValue;\r\n }\r\n}\r\n\r\nexport const RichTypeAny: RichType<any> = new RichType(FlowGraphTypes.Any, undefined);\r\n\r\nexport const RichTypeString: RichType<string> = new RichType(FlowGraphTypes.String, \"\");\r\n\r\nexport const RichTypeNumber: RichType<number> = new RichType(FlowGraphTypes.Number, 0, Constants.ANIMATIONTYPE_FLOAT);\r\n\r\nexport const RichTypeBoolean: RichType<boolean> = new RichType(FlowGraphTypes.Boolean, false);\r\n\r\nexport const RichTypeVector2: RichType<Vector2> = new RichType(FlowGraphTypes.Vector2, Vector2.Zero(), Constants.ANIMATIONTYPE_VECTOR2);\r\n\r\nexport const RichTypeVector3: RichType<Vector3> = new RichType(FlowGraphTypes.Vector3, Vector3.Zero(), Constants.ANIMATIONTYPE_VECTOR3);\r\n\r\nexport const RichTypeVector4: RichType<Vector4> = new RichType(FlowGraphTypes.Vector4, Vector4.Zero());\r\n\r\nexport const RichTypeMatrix: RichType<Matrix> = new RichType(FlowGraphTypes.Matrix, Matrix.Identity(), Constants.ANIMATIONTYPE_MATRIX);\r\n\r\nexport const RichTypeMatrix2D: RichType<FlowGraphMatrix2D> = new RichType(FlowGraphTypes.Matrix2D, new FlowGraphMatrix2D());\r\n\r\nexport const RichTypeMatrix3D: RichType<FlowGraphMatrix3D> = new RichType(FlowGraphTypes.Matrix3D, new FlowGraphMatrix3D());\r\n\r\nexport const RichTypeColor3: RichType<Color3> = new RichType(FlowGraphTypes.Color3, Color3.Black(), Constants.ANIMATIONTYPE_COLOR3);\r\n\r\nexport const RichTypeColor4: RichType<Color4> = new RichType(FlowGraphTypes.Color4, new Color4(0, 0, 0, 0), Constants.ANIMATIONTYPE_COLOR4);\r\n\r\nexport const RichTypeQuaternion: RichType<Quaternion> = new RichType(FlowGraphTypes.Quaternion, Quaternion.Identity(), Constants.ANIMATIONTYPE_QUATERNION);\r\nRichTypeQuaternion.typeTransformer = (value: any) => {\r\n if (value.getClassName && value.getClassName() === FlowGraphTypes.Vector4) {\r\n return Quaternion.FromArray(value.asArray());\r\n } else if (value.getClassName && value.getClassName() === FlowGraphTypes.Vector3) {\r\n return Quaternion.FromEulerVector(value);\r\n } else if (value.getClassName && value.getClassName() === FlowGraphTypes.Matrix) {\r\n return Quaternion.FromRotationMatrix(value);\r\n }\r\n return value;\r\n};\r\nexport const RichTypeFlowGraphInteger: RichType<FlowGraphInteger> = new RichType(FlowGraphTypes.Integer, new FlowGraphInteger(0), Constants.ANIMATIONTYPE_FLOAT);\r\n\r\n/**\r\n * Given a value, try to deduce its rich type.\r\n * @param value the value to deduce the rich type from\r\n * @returns the value's rich type, or RichTypeAny if the type could not be deduced.\r\n */\r\nexport function getRichTypeFromValue<T>(value: T): RichType<T> {\r\n const anyValue = value as any;\r\n switch (typeof value) {\r\n case FlowGraphTypes.String:\r\n return RichTypeString as RichType<T>;\r\n case FlowGraphTypes.Number:\r\n return RichTypeNumber as RichType<T>;\r\n case FlowGraphTypes.Boolean:\r\n return RichTypeBoolean as RichType<T>;\r\n case FlowGraphTypes.Object:\r\n if (anyValue.getClassName) {\r\n switch (anyValue.getClassName() as string) {\r\n case FlowGraphTypes.Vector2:\r\n return RichTypeVector2 as RichType<T>;\r\n case FlowGraphTypes.Vector3:\r\n return RichTypeVector3 as RichType<T>;\r\n case FlowGraphTypes.Vector4:\r\n return RichTypeVector4 as RichType<T>;\r\n case FlowGraphTypes.Matrix:\r\n return RichTypeMatrix as RichType<T>;\r\n case FlowGraphTypes.Color3:\r\n return RichTypeColor3 as RichType<T>;\r\n case FlowGraphTypes.Color4:\r\n return RichTypeColor4 as RichType<T>;\r\n case FlowGraphTypes.Quaternion:\r\n return RichTypeQuaternion as RichType<T>;\r\n case FlowGraphTypes.Integer:\r\n return RichTypeFlowGraphInteger as RichType<T>;\r\n case FlowGraphTypes.Matrix2D:\r\n return RichTypeMatrix2D as RichType<T>;\r\n case FlowGraphTypes.Matrix3D:\r\n return RichTypeMatrix3D as RichType<T>;\r\n }\r\n }\r\n return RichTypeAny as RichType<T>;\r\n default:\r\n return RichTypeAny as RichType<T>;\r\n }\r\n}\r\n\r\n/**\r\n * Given a flow graph type, return the rich type that corresponds to it.\r\n * @param flowGraphType the flow graph type\r\n * @returns the rich type that corresponds to the flow graph type\r\n */\r\nexport function getRichTypeByFlowGraphType(flowGraphType?: string): RichType<any> {\r\n switch (flowGraphType) {\r\n case FlowGraphTypes.String:\r\n return RichTypeString;\r\n case FlowGraphTypes.Number:\r\n return RichTypeNumber;\r\n case FlowGraphTypes.Boolean:\r\n return RichTypeBoolean;\r\n case FlowGraphTypes.Vector2:\r\n return RichTypeVector2;\r\n case FlowGraphTypes.Vector3:\r\n return RichTypeVector3;\r\n case FlowGraphTypes.Vector4:\r\n return RichTypeVector4;\r\n case FlowGraphTypes.Matrix:\r\n return RichTypeMatrix;\r\n case FlowGraphTypes.Color3:\r\n return RichTypeColor3;\r\n case FlowGraphTypes.Color4:\r\n return RichTypeColor4;\r\n case FlowGraphTypes.Quaternion:\r\n return RichTypeQuaternion;\r\n case FlowGraphTypes.Integer:\r\n return RichTypeFlowGraphInteger;\r\n case FlowGraphTypes.Matrix2D:\r\n return RichTypeMatrix2D;\r\n case FlowGraphTypes.Matrix3D:\r\n return RichTypeMatrix3D;\r\n default:\r\n return RichTypeAny;\r\n }\r\n}\r\n\r\n/**\r\n * get the animation type for a given flow graph type\r\n * @param flowGraphType the flow graph type\r\n * @returns the animation type for this flow graph type\r\n */\r\nexport function getAnimationTypeByFlowGraphType(flowGraphType: FlowGraphTypes): number {\r\n switch (flowGraphType) {\r\n case FlowGraphTypes.Number:\r\n return Constants.ANIMATIONTYPE_FLOAT;\r\n case FlowGraphTypes.Vector2:\r\n return Constants.ANIMATIONTYPE_VECTOR2;\r\n case FlowGraphTypes.Vector3:\r\n return Constants.ANIMATIONTYPE_VECTOR3;\r\n case FlowGraphTypes.Matrix:\r\n return Constants.ANIMATIONTYPE_MATRIX;\r\n case FlowGraphTypes.Color3:\r\n return Constants.ANIMATIONTYPE_COLOR3;\r\n case FlowGraphTypes.Color4:\r\n return Constants.ANIMATIONTYPE_COLOR4;\r\n case FlowGraphTypes.Quaternion:\r\n return Constants.ANIMATIONTYPE_QUATERNION;\r\n default:\r\n return Constants.ANIMATIONTYPE_FLOAT;\r\n }\r\n}\r\n\r\n/**\r\n * Given an animation type, return the rich type that corresponds to it.\r\n * @param animationType the animation type\r\n * @returns the rich type that corresponds to the animation type\r\n */\r\nexport function getRichTypeByAnimationType(animationType: number): RichType<any> {\r\n switch (animationType) {\r\n case Constants.ANIMATIONTYPE_FLOAT:\r\n return RichTypeNumber;\r\n case Constants.ANIMATIONTYPE_VECTOR2:\r\n return RichTypeVector2;\r\n case Constants.ANIMATIONTYPE_VECTOR3:\r\n return RichTypeVector3;\r\n case Constants.ANIMATIONTYPE_MATRIX:\r\n return RichTypeMatrix;\r\n case Constants.ANIMATIONTYPE_COLOR3:\r\n return RichTypeColor3;\r\n case Constants.ANIMATIONTYPE_COLOR4:\r\n return RichTypeColor4;\r\n case Constants.ANIMATIONTYPE_QUATERNION:\r\n return RichTypeQuaternion;\r\n default:\r\n return RichTypeAny;\r\n }\r\n}\r\n"]}
|
|
@@ -46,9 +46,9 @@ export declare class NodeRenderGraphGlowLayerBlock extends NodeRenderGraphBlock
|
|
|
46
46
|
*/
|
|
47
47
|
getClassName(): string;
|
|
48
48
|
/**
|
|
49
|
-
* Gets the
|
|
49
|
+
* Gets the target texture input component
|
|
50
50
|
*/
|
|
51
|
-
get
|
|
51
|
+
get target(): NodeRenderGraphConnectionPoint;
|
|
52
52
|
/**
|
|
53
53
|
* Gets the layer texture input component
|
|
54
54
|
*/
|
|
@@ -30,14 +30,14 @@ export class NodeRenderGraphGlowLayerBlock extends NodeRenderGraphBlock {
|
|
|
30
30
|
constructor(name, frameGraph, scene, ldrMerge = false, layerTextureRatio = 0.5, layerTextureFixedSize, layerTextureType = 0) {
|
|
31
31
|
super(name, frameGraph, scene);
|
|
32
32
|
this._additionalConstructionParameters = [ldrMerge, layerTextureRatio, layerTextureFixedSize, layerTextureType];
|
|
33
|
-
this.registerInput("
|
|
33
|
+
this.registerInput("target", NodeRenderGraphBlockConnectionPointTypes.Texture);
|
|
34
34
|
this.registerInput("layer", NodeRenderGraphBlockConnectionPointTypes.Texture, true);
|
|
35
35
|
this.registerInput("objectRenderer", NodeRenderGraphBlockConnectionPointTypes.Object, true, new NodeRenderGraphConnectionPointCustomObject("objectRenderer", this, 0 /* NodeRenderGraphConnectionPointDirection.Input */, NodeRenderGraphBaseObjectRendererBlock, "NodeRenderGraphBaseObjectRendererBlock"));
|
|
36
36
|
this._addDependenciesInput();
|
|
37
37
|
this.registerOutput("output", NodeRenderGraphBlockConnectionPointTypes.BasedOnInput);
|
|
38
|
-
this.
|
|
38
|
+
this.target.addAcceptedConnectionPointTypes(NodeRenderGraphBlockConnectionPointTypes.TextureAllButBackBufferDepthStencil);
|
|
39
39
|
this.layer.addAcceptedConnectionPointTypes(NodeRenderGraphBlockConnectionPointTypes.TextureAllButBackBuffer);
|
|
40
|
-
this.output._typeConnectionSource = this.
|
|
40
|
+
this.output._typeConnectionSource = this.target;
|
|
41
41
|
this._frameGraphTask = new FrameGraphGlowLayerTask(this.name, this._frameGraph, this._scene, {
|
|
42
42
|
ldrMerge,
|
|
43
43
|
mainTextureRatio: layerTextureRatio,
|
|
@@ -113,9 +113,9 @@ export class NodeRenderGraphGlowLayerBlock extends NodeRenderGraphBlock {
|
|
|
113
113
|
return "NodeRenderGraphGlowLayerBlock";
|
|
114
114
|
}
|
|
115
115
|
/**
|
|
116
|
-
* Gets the
|
|
116
|
+
* Gets the target texture input component
|
|
117
117
|
*/
|
|
118
|
-
get
|
|
118
|
+
get target() {
|
|
119
119
|
return this._inputs[0];
|
|
120
120
|
}
|
|
121
121
|
/**
|
|
@@ -139,7 +139,7 @@ export class NodeRenderGraphGlowLayerBlock extends NodeRenderGraphBlock {
|
|
|
139
139
|
_buildBlock(state) {
|
|
140
140
|
super._buildBlock(state);
|
|
141
141
|
this.output.value = this._frameGraphTask.outputTexture;
|
|
142
|
-
this._frameGraphTask.
|
|
142
|
+
this._frameGraphTask.targetTexture = this.target.connectedPoint?.value;
|
|
143
143
|
this._frameGraphTask.layerTexture = this.layer.connectedPoint?.value;
|
|
144
144
|
this._frameGraphTask.objectRendererTask = this.objectRenderer.connectedPoint?.value;
|
|
145
145
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glowLayerBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FrameGraph/Node/Blocks/Layers/glowLayerBlock.ts"],"names":[],"mappings":";AASA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAA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D;IADC,sBAAsB,CAAC,kBAAkB,sCAA8B,YAAY,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;mEAG1G;AAQD;IADC,sBAAsB,CAAC,WAAW,wCAAgC,YAAY,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;8DAGnG;AAyEL,aAAa,CAAC,uCAAuC,EAAE,6BAA6B,CAAC,CAAC","sourcesContent":["import type {\r\n Scene,\r\n NodeRenderGraphBuildState,\r\n FrameGraph,\r\n FrameGraphTextureHandle,\r\n NodeRenderGraphConnectionPoint,\r\n FrameGraphObjectRendererTask,\r\n // eslint-disable-next-line import/no-internal-modules\r\n} from \"core/index\";\r\nimport { NodeRenderGraphBlock } from \"../../nodeRenderGraphBlock\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { NodeRenderGraphBlockConnectionPointTypes, NodeRenderGraphConnectionPointDirection } from \"../../Types/nodeRenderGraphTypes\";\r\nimport { editableInPropertyPage, PropertyTypeForEdition } from \"../../../../Decorators/nodeDecorator\";\r\nimport { FrameGraphGlowLayerTask } from \"core/FrameGraph/Tasks/Layers/glowLayerTask\";\r\nimport { Constants } from \"core/Engines/constants\";\r\nimport { NodeRenderGraphConnectionPointCustomObject } from \"../../nodeRenderGraphConnectionPointCustomObject\";\r\nimport { NodeRenderGraphBaseObjectRendererBlock } from \"../Rendering/baseObjectRendererBlock\";\r\n\r\n/**\r\n * Block that implements the glow layer\r\n */\r\nexport class NodeRenderGraphGlowLayerBlock extends NodeRenderGraphBlock {\r\n protected override _frameGraphTask: FrameGraphGlowLayerTask;\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 NodeRenderGraphGlowLayerBlock\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 ldrMerge Forces the merge step to be done in ldr (clamp values > 1). Default: false\r\n * @param layerTextureRatio multiplication factor applied to the main texture size to compute the size of the layer render target texture (default: 0.5)\r\n * @param layerTextureFixedSize defines the fixed size of the layer render target texture. Takes precedence over layerTextureRatio if provided (default: undefined)\r\n * @param layerTextureType defines the type of the layer texture (default: Constants.TEXTURETYPE_UNSIGNED_BYTE)\r\n */\r\n public constructor(\r\n name: string,\r\n frameGraph: FrameGraph,\r\n scene: Scene,\r\n ldrMerge = false,\r\n layerTextureRatio = 0.5,\r\n layerTextureFixedSize?: number,\r\n layerTextureType = Constants.TEXTURETYPE_UNSIGNED_BYTE\r\n ) {\r\n super(name, frameGraph, scene);\r\n\r\n this._additionalConstructionParameters = [ldrMerge, layerTextureRatio, layerTextureFixedSize, layerTextureType];\r\n\r\n this.registerInput(\"destination\", NodeRenderGraphBlockConnectionPointTypes.Texture);\r\n this.registerInput(\"layer\", NodeRenderGraphBlockConnectionPointTypes.Texture, true);\r\n this.registerInput(\r\n \"objectRenderer\",\r\n NodeRenderGraphBlockConnectionPointTypes.Object,\r\n true,\r\n new NodeRenderGraphConnectionPointCustomObject(\r\n \"objectRenderer\",\r\n this,\r\n NodeRenderGraphConnectionPointDirection.Input,\r\n NodeRenderGraphBaseObjectRendererBlock,\r\n \"NodeRenderGraphBaseObjectRendererBlock\"\r\n )\r\n );\r\n this._addDependenciesInput();\r\n\r\n this.registerOutput(\"output\", NodeRenderGraphBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this.destination.addAcceptedConnectionPointTypes(NodeRenderGraphBlockConnectionPointTypes.TextureAllButBackBufferDepthStencil);\r\n this.layer.addAcceptedConnectionPointTypes(NodeRenderGraphBlockConnectionPointTypes.TextureAllButBackBuffer);\r\n\r\n this.output._typeConnectionSource = this.destination;\r\n\r\n this._frameGraphTask = new FrameGraphGlowLayerTask(this.name, this._frameGraph, this._scene, {\r\n ldrMerge,\r\n mainTextureRatio: layerTextureRatio,\r\n mainTextureFixedSize: layerTextureFixedSize,\r\n mainTextureType: layerTextureType,\r\n });\r\n }\r\n\r\n private _createTask(ldrMerge: boolean, layerTextureRatio: number, layerTextureFixedSize: number, layerTextureType: number) {\r\n const blurKernelSize = this.blurKernelSize;\r\n const intensity = this.intensity;\r\n\r\n this._frameGraphTask?.dispose();\r\n\r\n this._frameGraphTask = new FrameGraphGlowLayerTask(this.name, this._frameGraph, this._scene, {\r\n ldrMerge,\r\n mainTextureRatio: layerTextureRatio,\r\n mainTextureFixedSize: layerTextureFixedSize,\r\n mainTextureType: layerTextureType,\r\n });\r\n\r\n this.blurKernelSize = blurKernelSize;\r\n this.intensity = intensity;\r\n\r\n this._additionalConstructionParameters = [ldrMerge, layerTextureRatio, layerTextureFixedSize, layerTextureType];\r\n }\r\n\r\n /** Forces the merge step to be done in ldr (clamp values > 1). Default: false */\r\n @editableInPropertyPage(\"LDR merge\", PropertyTypeForEdition.Boolean, \"PROPERTIES\")\r\n public get ldrMerge() {\r\n return this._frameGraphTask.layer.ldrMerge;\r\n }\r\n\r\n public set ldrMerge(value: boolean) {\r\n const options = this._frameGraphTask.layer._options;\r\n\r\n this._createTask(value, options.mainTextureRatio, options.mainTextureFixedSize, options.mainTextureType);\r\n }\r\n\r\n /** Multiplication factor applied to the main texture size to compute the size of the layer render target texture */\r\n @editableInPropertyPage(\"Layer texture ratio\", PropertyTypeForEdition.Float, \"PROPERTIES\")\r\n public get layerTextureRatio() {\r\n return this._frameGraphTask.layer._options.mainTextureRatio;\r\n }\r\n\r\n public set layerTextureRatio(value: number) {\r\n const options = this._frameGraphTask.layer._options;\r\n\r\n this._createTask(options.ldrMerge, value, options.mainTextureFixedSize, options.mainTextureType);\r\n }\r\n\r\n /** Defines the fixed size of the layer render target texture. Takes precedence over layerTextureRatio if provided */\r\n @editableInPropertyPage(\"Layer texture fixed size\", PropertyTypeForEdition.Float, \"PROPERTIES\")\r\n public get layerTextureFixedSize() {\r\n return this._frameGraphTask.layer._options.mainTextureFixedSize;\r\n }\r\n\r\n public set layerTextureFixedSize(value: number) {\r\n const options = this._frameGraphTask.layer._options;\r\n\r\n this._createTask(options.ldrMerge, options.mainTextureRatio, value, options.mainTextureType);\r\n }\r\n\r\n /** Defines the type of the layer texture */\r\n @editableInPropertyPage(\"Layer texture type\", PropertyTypeForEdition.TextureType, \"PROPERTIES\")\r\n public get layerTextureType() {\r\n return this._frameGraphTask.layer._options.mainTextureType;\r\n }\r\n\r\n public set layerTextureType(value: number) {\r\n const options = this._frameGraphTask.layer._options;\r\n\r\n this._createTask(options.ldrMerge, options.mainTextureRatio, options.mainTextureFixedSize, value);\r\n }\r\n\r\n /** How big is the kernel of the blur texture */\r\n @editableInPropertyPage(\"Blur kernel size\", PropertyTypeForEdition.Int, \"PROPERTIES\", { min: 1, max: 256 })\r\n public get blurKernelSize() {\r\n return this._frameGraphTask.layer.blurKernelSize;\r\n }\r\n\r\n public set blurKernelSize(value: number) {\r\n this._frameGraphTask.layer.blurKernelSize = value;\r\n }\r\n\r\n /** The intensity of the glow */\r\n @editableInPropertyPage(\"Intensity\", PropertyTypeForEdition.Float, \"PROPERTIES\", { min: 0, max: 5 })\r\n public get intensity() {\r\n return this._frameGraphTask.layer.intensity;\r\n }\r\n\r\n public set intensity(value: number) {\r\n this._frameGraphTask.layer.intensity = 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 \"NodeRenderGraphGlowLayerBlock\";\r\n }\r\n\r\n /**\r\n * Gets the destination texture input component\r\n */\r\n public get destination(): NodeRenderGraphConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the layer texture input component\r\n */\r\n public get layer(): NodeRenderGraphConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the objectRenderer input component\r\n */\r\n public get objectRenderer(): NodeRenderGraphConnectionPoint {\r\n return this._inputs[2];\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.output.value = this._frameGraphTask.outputTexture;\r\n\r\n this._frameGraphTask.destinationTexture = this.destination.connectedPoint?.value as FrameGraphTextureHandle;\r\n this._frameGraphTask.layerTexture = this.layer.connectedPoint?.value as FrameGraphTextureHandle;\r\n this._frameGraphTask.objectRendererTask = this.objectRenderer.connectedPoint?.value as FrameGraphObjectRendererTask;\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n const codes: string[] = [];\r\n codes.push(`${this._codeVariableName}.blurKernelSize = ${this.blurKernelSize};`);\r\n codes.push(`${this._codeVariableName}.intensity = ${this.intensity};`);\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.blurKernelSize = this.blurKernelSize;\r\n serializationObject.intensity = this.intensity;\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n this.blurKernelSize = serializationObject.blurKernelSize;\r\n this.intensity = serializationObject.intensity;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.NodeRenderGraphGlowLayerBlock\", NodeRenderGraphGlowLayerBlock);\r\n"]}
|
|
1
|
+
{"version":3,"file":"glowLayerBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FrameGraph/Node/Blocks/Layers/glowLayerBlock.ts"],"names":[],"mappings":";AASA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,wCAAwC,EAA2C,MAAM,kCAAkC,CAAC;AACrI,OAAO,EAAE,sBAAsB,EAA0B,MAAM,sCAAsC,CAAC;AACtG,OAAO,EAAE,uBAAuB,EAAE,+CAAmD;AACrF,OAAO,EAAE,SAAS,EAAE,yCAA+B;A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,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;8DAGnG;AAyEL,aAAa,CAAC,uCAAuC,EAAE,6BAA6B,CAAC,CAAC","sourcesContent":["import type {\r\n Scene,\r\n NodeRenderGraphBuildState,\r\n FrameGraph,\r\n FrameGraphTextureHandle,\r\n NodeRenderGraphConnectionPoint,\r\n FrameGraphObjectRendererTask,\r\n // eslint-disable-next-line import/no-internal-modules\r\n} from \"core/index\";\r\nimport { NodeRenderGraphBlock } from \"../../nodeRenderGraphBlock\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { NodeRenderGraphBlockConnectionPointTypes, NodeRenderGraphConnectionPointDirection } from \"../../Types/nodeRenderGraphTypes\";\r\nimport { editableInPropertyPage, PropertyTypeForEdition } from \"../../../../Decorators/nodeDecorator\";\r\nimport { FrameGraphGlowLayerTask } from \"core/FrameGraph/Tasks/Layers/glowLayerTask\";\r\nimport { Constants } from \"core/Engines/constants\";\r\nimport { NodeRenderGraphConnectionPointCustomObject } from \"../../nodeRenderGraphConnectionPointCustomObject\";\r\nimport { NodeRenderGraphBaseObjectRendererBlock } from \"../Rendering/baseObjectRendererBlock\";\r\n\r\n/**\r\n * Block that implements the glow layer\r\n */\r\nexport class NodeRenderGraphGlowLayerBlock extends NodeRenderGraphBlock {\r\n protected override _frameGraphTask: FrameGraphGlowLayerTask;\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 NodeRenderGraphGlowLayerBlock\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 ldrMerge Forces the merge step to be done in ldr (clamp values > 1). Default: false\r\n * @param layerTextureRatio multiplication factor applied to the main texture size to compute the size of the layer render target texture (default: 0.5)\r\n * @param layerTextureFixedSize defines the fixed size of the layer render target texture. Takes precedence over layerTextureRatio if provided (default: undefined)\r\n * @param layerTextureType defines the type of the layer texture (default: Constants.TEXTURETYPE_UNSIGNED_BYTE)\r\n */\r\n public constructor(\r\n name: string,\r\n frameGraph: FrameGraph,\r\n scene: Scene,\r\n ldrMerge = false,\r\n layerTextureRatio = 0.5,\r\n layerTextureFixedSize?: number,\r\n layerTextureType = Constants.TEXTURETYPE_UNSIGNED_BYTE\r\n ) {\r\n super(name, frameGraph, scene);\r\n\r\n this._additionalConstructionParameters = [ldrMerge, layerTextureRatio, layerTextureFixedSize, layerTextureType];\r\n\r\n this.registerInput(\"target\", NodeRenderGraphBlockConnectionPointTypes.Texture);\r\n this.registerInput(\"layer\", NodeRenderGraphBlockConnectionPointTypes.Texture, true);\r\n this.registerInput(\r\n \"objectRenderer\",\r\n NodeRenderGraphBlockConnectionPointTypes.Object,\r\n true,\r\n new NodeRenderGraphConnectionPointCustomObject(\r\n \"objectRenderer\",\r\n this,\r\n NodeRenderGraphConnectionPointDirection.Input,\r\n NodeRenderGraphBaseObjectRendererBlock,\r\n \"NodeRenderGraphBaseObjectRendererBlock\"\r\n )\r\n );\r\n this._addDependenciesInput();\r\n\r\n this.registerOutput(\"output\", NodeRenderGraphBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this.target.addAcceptedConnectionPointTypes(NodeRenderGraphBlockConnectionPointTypes.TextureAllButBackBufferDepthStencil);\r\n this.layer.addAcceptedConnectionPointTypes(NodeRenderGraphBlockConnectionPointTypes.TextureAllButBackBuffer);\r\n\r\n this.output._typeConnectionSource = this.target;\r\n\r\n this._frameGraphTask = new FrameGraphGlowLayerTask(this.name, this._frameGraph, this._scene, {\r\n ldrMerge,\r\n mainTextureRatio: layerTextureRatio,\r\n mainTextureFixedSize: layerTextureFixedSize,\r\n mainTextureType: layerTextureType,\r\n });\r\n }\r\n\r\n private _createTask(ldrMerge: boolean, layerTextureRatio: number, layerTextureFixedSize: number, layerTextureType: number) {\r\n const blurKernelSize = this.blurKernelSize;\r\n const intensity = this.intensity;\r\n\r\n this._frameGraphTask?.dispose();\r\n\r\n this._frameGraphTask = new FrameGraphGlowLayerTask(this.name, this._frameGraph, this._scene, {\r\n ldrMerge,\r\n mainTextureRatio: layerTextureRatio,\r\n mainTextureFixedSize: layerTextureFixedSize,\r\n mainTextureType: layerTextureType,\r\n });\r\n\r\n this.blurKernelSize = blurKernelSize;\r\n this.intensity = intensity;\r\n\r\n this._additionalConstructionParameters = [ldrMerge, layerTextureRatio, layerTextureFixedSize, layerTextureType];\r\n }\r\n\r\n /** Forces the merge step to be done in ldr (clamp values > 1). Default: false */\r\n @editableInPropertyPage(\"LDR merge\", PropertyTypeForEdition.Boolean, \"PROPERTIES\")\r\n public get ldrMerge() {\r\n return this._frameGraphTask.layer.ldrMerge;\r\n }\r\n\r\n public set ldrMerge(value: boolean) {\r\n const options = this._frameGraphTask.layer._options;\r\n\r\n this._createTask(value, options.mainTextureRatio, options.mainTextureFixedSize, options.mainTextureType);\r\n }\r\n\r\n /** Multiplication factor applied to the main texture size to compute the size of the layer render target texture */\r\n @editableInPropertyPage(\"Layer texture ratio\", PropertyTypeForEdition.Float, \"PROPERTIES\")\r\n public get layerTextureRatio() {\r\n return this._frameGraphTask.layer._options.mainTextureRatio;\r\n }\r\n\r\n public set layerTextureRatio(value: number) {\r\n const options = this._frameGraphTask.layer._options;\r\n\r\n this._createTask(options.ldrMerge, value, options.mainTextureFixedSize, options.mainTextureType);\r\n }\r\n\r\n /** Defines the fixed size of the layer render target texture. Takes precedence over layerTextureRatio if provided */\r\n @editableInPropertyPage(\"Layer texture fixed size\", PropertyTypeForEdition.Float, \"PROPERTIES\")\r\n public get layerTextureFixedSize() {\r\n return this._frameGraphTask.layer._options.mainTextureFixedSize;\r\n }\r\n\r\n public set layerTextureFixedSize(value: number) {\r\n const options = this._frameGraphTask.layer._options;\r\n\r\n this._createTask(options.ldrMerge, options.mainTextureRatio, value, options.mainTextureType);\r\n }\r\n\r\n /** Defines the type of the layer texture */\r\n @editableInPropertyPage(\"Layer texture type\", PropertyTypeForEdition.TextureType, \"PROPERTIES\")\r\n public get layerTextureType() {\r\n return this._frameGraphTask.layer._options.mainTextureType;\r\n }\r\n\r\n public set layerTextureType(value: number) {\r\n const options = this._frameGraphTask.layer._options;\r\n\r\n this._createTask(options.ldrMerge, options.mainTextureRatio, options.mainTextureFixedSize, value);\r\n }\r\n\r\n /** How big is the kernel of the blur texture */\r\n @editableInPropertyPage(\"Blur kernel size\", PropertyTypeForEdition.Int, \"PROPERTIES\", { min: 1, max: 256 })\r\n public get blurKernelSize() {\r\n return this._frameGraphTask.layer.blurKernelSize;\r\n }\r\n\r\n public set blurKernelSize(value: number) {\r\n this._frameGraphTask.layer.blurKernelSize = value;\r\n }\r\n\r\n /** The intensity of the glow */\r\n @editableInPropertyPage(\"Intensity\", PropertyTypeForEdition.Float, \"PROPERTIES\", { min: 0, max: 5 })\r\n public get intensity() {\r\n return this._frameGraphTask.layer.intensity;\r\n }\r\n\r\n public set intensity(value: number) {\r\n this._frameGraphTask.layer.intensity = 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 \"NodeRenderGraphGlowLayerBlock\";\r\n }\r\n\r\n /**\r\n * Gets the target texture input component\r\n */\r\n public get target(): NodeRenderGraphConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the layer texture input component\r\n */\r\n public get layer(): NodeRenderGraphConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the objectRenderer input component\r\n */\r\n public get objectRenderer(): NodeRenderGraphConnectionPoint {\r\n return this._inputs[2];\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.output.value = this._frameGraphTask.outputTexture;\r\n\r\n this._frameGraphTask.targetTexture = this.target.connectedPoint?.value as FrameGraphTextureHandle;\r\n this._frameGraphTask.layerTexture = this.layer.connectedPoint?.value as FrameGraphTextureHandle;\r\n this._frameGraphTask.objectRendererTask = this.objectRenderer.connectedPoint?.value as FrameGraphObjectRendererTask;\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n const codes: string[] = [];\r\n codes.push(`${this._codeVariableName}.blurKernelSize = ${this.blurKernelSize};`);\r\n codes.push(`${this._codeVariableName}.intensity = ${this.intensity};`);\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.blurKernelSize = this.blurKernelSize;\r\n serializationObject.intensity = this.intensity;\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n this.blurKernelSize = serializationObject.blurKernelSize;\r\n this.intensity = serializationObject.intensity;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.NodeRenderGraphGlowLayerBlock\", NodeRenderGraphGlowLayerBlock);\r\n"]}
|
|
@@ -50,9 +50,9 @@ export declare class NodeRenderGraphHighlightLayerBlock extends NodeRenderGraphB
|
|
|
50
50
|
*/
|
|
51
51
|
getClassName(): string;
|
|
52
52
|
/**
|
|
53
|
-
* Gets the
|
|
53
|
+
* Gets the target texture input component
|
|
54
54
|
*/
|
|
55
|
-
get
|
|
55
|
+
get target(): NodeRenderGraphConnectionPoint;
|
|
56
56
|
/**
|
|
57
57
|
* Gets the layer input component
|
|
58
58
|
*/
|
|
@@ -31,14 +31,14 @@ export class NodeRenderGraphHighlightLayerBlock extends NodeRenderGraphBlock {
|
|
|
31
31
|
constructor(name, frameGraph, scene, layerTextureRatio = 0.5, layerTextureFixedSize, blurTextureSizeRatio = 0.5, isStroke = false, layerTextureType = 0) {
|
|
32
32
|
super(name, frameGraph, scene);
|
|
33
33
|
this._additionalConstructionParameters = [layerTextureRatio, layerTextureFixedSize, blurTextureSizeRatio, isStroke, layerTextureType];
|
|
34
|
-
this.registerInput("
|
|
34
|
+
this.registerInput("target", NodeRenderGraphBlockConnectionPointTypes.Texture);
|
|
35
35
|
this.registerInput("layer", NodeRenderGraphBlockConnectionPointTypes.Texture, true);
|
|
36
36
|
this.registerInput("objectRenderer", NodeRenderGraphBlockConnectionPointTypes.Object, true, new NodeRenderGraphConnectionPointCustomObject("objectRenderer", this, 0 /* NodeRenderGraphConnectionPointDirection.Input */, NodeRenderGraphBaseObjectRendererBlock, "NodeRenderGraphBaseObjectRendererBlock"));
|
|
37
37
|
this._addDependenciesInput();
|
|
38
38
|
this.registerOutput("output", NodeRenderGraphBlockConnectionPointTypes.BasedOnInput);
|
|
39
|
-
this.
|
|
39
|
+
this.target.addAcceptedConnectionPointTypes(NodeRenderGraphBlockConnectionPointTypes.TextureAllButBackBufferDepthStencil);
|
|
40
40
|
this.layer.addAcceptedConnectionPointTypes(NodeRenderGraphBlockConnectionPointTypes.TextureAllButBackBuffer);
|
|
41
|
-
this.output._typeConnectionSource = this.
|
|
41
|
+
this.output._typeConnectionSource = this.target;
|
|
42
42
|
this._frameGraphTask = new FrameGraphHighlightLayerTask(this.name, this._frameGraph, this._scene, {
|
|
43
43
|
mainTextureRatio: layerTextureRatio,
|
|
44
44
|
mainTextureFixedSize: layerTextureFixedSize,
|
|
@@ -124,9 +124,9 @@ export class NodeRenderGraphHighlightLayerBlock extends NodeRenderGraphBlock {
|
|
|
124
124
|
return "NodeRenderGraphHighlightLayerBlock";
|
|
125
125
|
}
|
|
126
126
|
/**
|
|
127
|
-
* Gets the
|
|
127
|
+
* Gets the target texture input component
|
|
128
128
|
*/
|
|
129
|
-
get
|
|
129
|
+
get target() {
|
|
130
130
|
return this._inputs[0];
|
|
131
131
|
}
|
|
132
132
|
/**
|
|
@@ -150,7 +150,7 @@ export class NodeRenderGraphHighlightLayerBlock extends NodeRenderGraphBlock {
|
|
|
150
150
|
_buildBlock(state) {
|
|
151
151
|
super._buildBlock(state);
|
|
152
152
|
this.output.value = this._frameGraphTask.outputTexture;
|
|
153
|
-
this._frameGraphTask.
|
|
153
|
+
this._frameGraphTask.targetTexture = this.target.connectedPoint?.value;
|
|
154
154
|
this._frameGraphTask.layerTexture = this.layer.connectedPoint?.value;
|
|
155
155
|
this._frameGraphTask.objectRendererTask = this.objectRenderer.connectedPoint?.value;
|
|
156
156
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"highlightLayerBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FrameGraph/Node/Blocks/Layers/highlightLayerBlock.ts"],"names":[],"mappings":";AASA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,wCAAwC,EAA2C,MAAM,kCAAkC,CAAC;AACrI,OAAO,EAAE,sBAAsB,EAA0B,MAAM,sCAAsC,CAAC;AACtG,OAAO,EAAE,4BAA4B,EAAE,oDAAwD;AAC/F,OAAO,EAAE,SAAS,EAAE,yCAA+B;AACnD,OAAO,EAAE,0CAA0C,EAAE,MAAM,kDAAkD,CAAC;AAC9G,OAAO,EAAE,sCAAsC,EAAE,MAAM,sCAAsC,CAAC;AAE9F;;GAEG;AACH,MAAM,OAAO,kCAAmC,SAAQ,oBAAoB;IAGxE;;OAEG;IACH,IAAoB,IAAI;QACpB,OAAO,IAAI,CAAC,eAAe,CAAC;IAChC,CAAC;IAED;;;;;;;;;;OAUG;IACH,YACI,IAAY,EACZ,UAAsB,EACtB,KAAY,EACZ,iBAAiB,GAAG,GAAG,EACvB,qBAA8B,EAC9B,oBAAoB,GAAG,GAAG,EAC1B,QAAQ,GAAG,KAAK,EAChB,gBAAgB,GAAG,SAAS,CAAC,yBAAyB;QAEtD,KAAK,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;QAE/B,IAAI,CAAC,iCAAiC,GAAG,CAAC,iBAAiB,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,QAAQ,EAAE,gBAAgB,CAAC,CA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E,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;4EAG9G;AAQD;IADC,sBAAsB,CAAC,oBAAoB,wCAAgC,YAAY,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;0EAG5G;AAyEL,aAAa,CAAC,4CAA4C,EAAE,kCAAkC,CAAC,CAAC","sourcesContent":["import type {\r\n Scene,\r\n NodeRenderGraphBuildState,\r\n FrameGraph,\r\n FrameGraphTextureHandle,\r\n NodeRenderGraphConnectionPoint,\r\n FrameGraphObjectRendererTask,\r\n // eslint-disable-next-line import/no-internal-modules\r\n} from \"core/index\";\r\nimport { NodeRenderGraphBlock } from \"../../nodeRenderGraphBlock\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { NodeRenderGraphBlockConnectionPointTypes, NodeRenderGraphConnectionPointDirection } from \"../../Types/nodeRenderGraphTypes\";\r\nimport { editableInPropertyPage, PropertyTypeForEdition } from \"../../../../Decorators/nodeDecorator\";\r\nimport { FrameGraphHighlightLayerTask } from \"core/FrameGraph/Tasks/Layers/highlightLayerTask\";\r\nimport { Constants } from \"core/Engines/constants\";\r\nimport { NodeRenderGraphConnectionPointCustomObject } from \"../../nodeRenderGraphConnectionPointCustomObject\";\r\nimport { NodeRenderGraphBaseObjectRendererBlock } from \"../Rendering/baseObjectRendererBlock\";\r\n\r\n/**\r\n * Block that implements the highlight layer\r\n */\r\nexport class NodeRenderGraphHighlightLayerBlock extends NodeRenderGraphBlock {\r\n protected override _frameGraphTask: FrameGraphHighlightLayerTask;\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 NodeRenderGraphHighlightLayerBlock\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 layerTextureRatio multiplication factor applied to the main texture size to compute the size of the layer render target texture (default: 0.5)\r\n * @param layerTextureFixedSize defines the fixed size of the layer render target texture. Takes precedence over layerTextureRatio if provided (default: undefined)\r\n * @param blurTextureSizeRatio defines the factor to apply to the layer texture size to create the blur textures (default: 0.5)\r\n * @param isStroke should we display highlight as a solid stroke? (default: false)\r\n * @param layerTextureType defines the type of the layer texture (default: Constants.TEXTURETYPE_UNSIGNED_BYTE)\r\n */\r\n public constructor(\r\n name: string,\r\n frameGraph: FrameGraph,\r\n scene: Scene,\r\n layerTextureRatio = 0.5,\r\n layerTextureFixedSize?: number,\r\n blurTextureSizeRatio = 0.5,\r\n isStroke = false,\r\n layerTextureType = Constants.TEXTURETYPE_UNSIGNED_BYTE\r\n ) {\r\n super(name, frameGraph, scene);\r\n\r\n this._additionalConstructionParameters = [layerTextureRatio, layerTextureFixedSize, blurTextureSizeRatio, isStroke, layerTextureType];\r\n\r\n this.registerInput(\"destination\", NodeRenderGraphBlockConnectionPointTypes.Texture);\r\n this.registerInput(\"layer\", NodeRenderGraphBlockConnectionPointTypes.Texture, true);\r\n this.registerInput(\r\n \"objectRenderer\",\r\n NodeRenderGraphBlockConnectionPointTypes.Object,\r\n true,\r\n new NodeRenderGraphConnectionPointCustomObject(\r\n \"objectRenderer\",\r\n this,\r\n NodeRenderGraphConnectionPointDirection.Input,\r\n NodeRenderGraphBaseObjectRendererBlock,\r\n \"NodeRenderGraphBaseObjectRendererBlock\"\r\n )\r\n );\r\n this._addDependenciesInput();\r\n\r\n this.registerOutput(\"output\", NodeRenderGraphBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this.destination.addAcceptedConnectionPointTypes(NodeRenderGraphBlockConnectionPointTypes.TextureAllButBackBufferDepthStencil);\r\n this.layer.addAcceptedConnectionPointTypes(NodeRenderGraphBlockConnectionPointTypes.TextureAllButBackBuffer);\r\n\r\n this.output._typeConnectionSource = this.destination;\r\n\r\n this._frameGraphTask = new FrameGraphHighlightLayerTask(this.name, this._frameGraph, this._scene, {\r\n mainTextureRatio: layerTextureRatio,\r\n mainTextureFixedSize: layerTextureFixedSize,\r\n blurTextureSizeRatio,\r\n isStroke,\r\n mainTextureType: layerTextureType,\r\n });\r\n }\r\n\r\n private _createTask(layerTextureRatio: number, layerTextureFixedSize: number, blurTextureSizeRatio: number, isStroke: boolean, layerTextureType: number) {\r\n const blurHorizontalSize = this.blurHorizontalSize;\r\n const blurVerticalSize = this.blurVerticalSize;\r\n\r\n this._frameGraphTask?.dispose();\r\n\r\n this._frameGraphTask = new FrameGraphHighlightLayerTask(this.name, this._frameGraph, this._scene, {\r\n mainTextureRatio: layerTextureRatio,\r\n mainTextureFixedSize: layerTextureFixedSize,\r\n blurTextureSizeRatio,\r\n isStroke,\r\n mainTextureType: layerTextureType,\r\n });\r\n\r\n this.blurHorizontalSize = blurHorizontalSize;\r\n this.blurVerticalSize = blurVerticalSize;\r\n\r\n this._additionalConstructionParameters = [layerTextureRatio, layerTextureFixedSize, blurTextureSizeRatio, isStroke, layerTextureType];\r\n }\r\n\r\n /** Multiplication factor applied to the main texture size to compute the size of the layer render target texture */\r\n @editableInPropertyPage(\"Layer texture ratio\", PropertyTypeForEdition.Float, \"PROPERTIES\")\r\n public get layerTextureRatio() {\r\n return this._frameGraphTask.layer._options.mainTextureRatio;\r\n }\r\n\r\n public set layerTextureRatio(value: number) {\r\n const options = this._frameGraphTask.layer._options;\r\n\r\n this._createTask(value, options.mainTextureFixedSize, options.blurTextureSizeRatio, options.isStroke, options.mainTextureType);\r\n }\r\n\r\n /** Defines the fixed size of the layer render target texture. Takes precedence over layerTextureRatio if provided */\r\n @editableInPropertyPage(\"Layer texture fixed size\", PropertyTypeForEdition.Float, \"PROPERTIES\")\r\n public get layerTextureFixedSize() {\r\n return this._frameGraphTask.layer._options.mainTextureFixedSize;\r\n }\r\n\r\n public set layerTextureFixedSize(value: number) {\r\n const options = this._frameGraphTask.layer._options;\r\n\r\n this._createTask(options.mainTextureRatio, value, options.blurTextureSizeRatio, options.isStroke, options.mainTextureType);\r\n }\r\n\r\n /** Defines the factor to apply to the layer texture size to create the blur textures */\r\n @editableInPropertyPage(\"Blur texture size ratio\", PropertyTypeForEdition.Float, \"PROPERTIES\")\r\n public get blurTextureSizeRatio() {\r\n return this._frameGraphTask.layer._options.blurTextureSizeRatio;\r\n }\r\n\r\n public set blurTextureSizeRatio(value: number) {\r\n const options = this._frameGraphTask.layer._options;\r\n\r\n this._createTask(options.mainTextureRatio, options.mainTextureFixedSize, value, options.isStroke, options.mainTextureType);\r\n }\r\n\r\n /** Should we display highlight as a solid stroke? */\r\n @editableInPropertyPage(\"Is stroke\", PropertyTypeForEdition.Boolean, \"PROPERTIES\")\r\n public get isStroke() {\r\n return this._frameGraphTask.layer._options.isStroke;\r\n }\r\n\r\n public set isStroke(value: boolean) {\r\n const options = this._frameGraphTask.layer._options;\r\n\r\n this._createTask(options.mainTextureRatio, options.mainTextureFixedSize, options.blurTextureSizeRatio, value, options.mainTextureType);\r\n }\r\n\r\n /** Defines the type of the layer texture */\r\n @editableInPropertyPage(\"Layer texture type\", PropertyTypeForEdition.TextureType, \"PROPERTIES\")\r\n public get layerTextureType() {\r\n return this._frameGraphTask.layer._options.mainTextureType;\r\n }\r\n\r\n public set layerTextureType(value: number) {\r\n const options = this._frameGraphTask.layer._options;\r\n\r\n this._createTask(options.mainTextureRatio, options.mainTextureFixedSize, options.blurTextureSizeRatio, options.isStroke, value);\r\n }\r\n\r\n /** How big is the horizontal kernel of the blur texture */\r\n @editableInPropertyPage(\"Blur horizontal size\", PropertyTypeForEdition.Float, \"PROPERTIES\", { min: 0, max: 4 })\r\n public get blurHorizontalSize() {\r\n return this._frameGraphTask.layer.blurHorizontalSize;\r\n }\r\n\r\n public set blurHorizontalSize(value: number) {\r\n this._frameGraphTask.layer.blurHorizontalSize = value;\r\n }\r\n\r\n /** How big is the vertical kernel of the blur texture */\r\n @editableInPropertyPage(\"Blur vertical size\", PropertyTypeForEdition.Float, \"PROPERTIES\", { min: 0, max: 4 })\r\n public get blurVerticalSize() {\r\n return this._frameGraphTask.layer.blurVerticalSize;\r\n }\r\n\r\n public set blurVerticalSize(value: number) {\r\n this._frameGraphTask.layer.blurVerticalSize = 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 \"NodeRenderGraphHighlightLayerBlock\";\r\n }\r\n\r\n /**\r\n * Gets the destination texture input component\r\n */\r\n public get destination(): NodeRenderGraphConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the layer input component\r\n */\r\n public get layer(): NodeRenderGraphConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the objectRenderer input component\r\n */\r\n public get objectRenderer(): NodeRenderGraphConnectionPoint {\r\n return this._inputs[2];\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.output.value = this._frameGraphTask.outputTexture;\r\n\r\n this._frameGraphTask.destinationTexture = this.destination.connectedPoint?.value as FrameGraphTextureHandle;\r\n this._frameGraphTask.layerTexture = this.layer.connectedPoint?.value as FrameGraphTextureHandle;\r\n this._frameGraphTask.objectRendererTask = this.objectRenderer.connectedPoint?.value as FrameGraphObjectRendererTask;\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n const codes: string[] = [];\r\n codes.push(`${this._codeVariableName}.blurHorizontalSize = ${this.blurHorizontalSize};`);\r\n codes.push(`${this._codeVariableName}.blurVerticalSize = ${this.blurVerticalSize};`);\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.blurHorizontalSize = this.blurHorizontalSize;\r\n serializationObject.blurVerticalSize = this.blurVerticalSize;\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n this.blurHorizontalSize = serializationObject.blurHorizontalSize;\r\n this.blurVerticalSize = serializationObject.blurVerticalSize;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.NodeRenderGraphHighlightLayerBlock\", NodeRenderGraphHighlightLayerBlock);\r\n"]}
|
|
1
|
+
{"version":3,"file":"highlightLayerBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FrameGraph/Node/Blocks/Layers/highlightLayerBlock.ts"],"names":[],"mappings":";AASA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,wCAAwC,EAA2C,MAAM,kCAAkC,CAAC;AACrI,OAAO,EAAE,sBAAsB,EAA0B,MAAM,sCAAsC,CAAC;AACtG,OAAO,EAAE,4BAA4B,EAAE,oDAAwD;AAC/F,OAAO,EAAE,SAAS,EAAE,yCAA+B;AACnD,OAAO,EAAE,0CAA0C,EAAE,MAAM,kDAAkD,CAAC;AAC9G,OAAO,EAAE,sCAAsC,EAAE,MAAM,sCAAsC,CAAC;AAE9F;;GAEG;AACH,MAAM,OAAO,kCAAmC,SAAQ,oBAAoB;IAGxE;;OAEG;IACH,IAAoB,IAAI;QACpB,OAAO,IAAI,CAAC,eAAe,CAAC;IAChC,CAAC;IAED;;;;;;;;;;OAUG;IACH,YACI,IAAY,EACZ,UAAsB,EACtB,KAAY,EACZ,iBAAiB,GAAG,GAAG,EACvB,qBAA8B,EAC9B,oBAAoB,GAAG,GAAG,EAC1B,QAAQ,GAAG,KAAK,EAChB,gBAAgB,GAAG,SAAS,CAAC,yBAAyB;QAEtD,KAAK,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;QAE/B,IAAI,CAAC,iCAAiC,GAAG,CAAC,iBAAiB,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,QAAQ,EAAE,gBAAgB,CAAC,CAAC;QAEtI,IAAI,CAAC,aAAa,CAAC,QAAQ,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;4EAG9G;AAQD;IADC,sBAAsB,CAAC,oBAAoB,wCAAgC,YAAY,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;0EAG5G;AAyEL,aAAa,CAAC,4CAA4C,EAAE,kCAAkC,CAAC,CAAC","sourcesContent":["import type {\r\n Scene,\r\n NodeRenderGraphBuildState,\r\n FrameGraph,\r\n FrameGraphTextureHandle,\r\n NodeRenderGraphConnectionPoint,\r\n FrameGraphObjectRendererTask,\r\n // eslint-disable-next-line import/no-internal-modules\r\n} from \"core/index\";\r\nimport { NodeRenderGraphBlock } from \"../../nodeRenderGraphBlock\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { NodeRenderGraphBlockConnectionPointTypes, NodeRenderGraphConnectionPointDirection } from \"../../Types/nodeRenderGraphTypes\";\r\nimport { editableInPropertyPage, PropertyTypeForEdition } from \"../../../../Decorators/nodeDecorator\";\r\nimport { FrameGraphHighlightLayerTask } from \"core/FrameGraph/Tasks/Layers/highlightLayerTask\";\r\nimport { Constants } from \"core/Engines/constants\";\r\nimport { NodeRenderGraphConnectionPointCustomObject } from \"../../nodeRenderGraphConnectionPointCustomObject\";\r\nimport { NodeRenderGraphBaseObjectRendererBlock } from \"../Rendering/baseObjectRendererBlock\";\r\n\r\n/**\r\n * Block that implements the highlight layer\r\n */\r\nexport class NodeRenderGraphHighlightLayerBlock extends NodeRenderGraphBlock {\r\n protected override _frameGraphTask: FrameGraphHighlightLayerTask;\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 NodeRenderGraphHighlightLayerBlock\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 layerTextureRatio multiplication factor applied to the main texture size to compute the size of the layer render target texture (default: 0.5)\r\n * @param layerTextureFixedSize defines the fixed size of the layer render target texture. Takes precedence over layerTextureRatio if provided (default: undefined)\r\n * @param blurTextureSizeRatio defines the factor to apply to the layer texture size to create the blur textures (default: 0.5)\r\n * @param isStroke should we display highlight as a solid stroke? (default: false)\r\n * @param layerTextureType defines the type of the layer texture (default: Constants.TEXTURETYPE_UNSIGNED_BYTE)\r\n */\r\n public constructor(\r\n name: string,\r\n frameGraph: FrameGraph,\r\n scene: Scene,\r\n layerTextureRatio = 0.5,\r\n layerTextureFixedSize?: number,\r\n blurTextureSizeRatio = 0.5,\r\n isStroke = false,\r\n layerTextureType = Constants.TEXTURETYPE_UNSIGNED_BYTE\r\n ) {\r\n super(name, frameGraph, scene);\r\n\r\n this._additionalConstructionParameters = [layerTextureRatio, layerTextureFixedSize, blurTextureSizeRatio, isStroke, layerTextureType];\r\n\r\n this.registerInput(\"target\", NodeRenderGraphBlockConnectionPointTypes.Texture);\r\n this.registerInput(\"layer\", NodeRenderGraphBlockConnectionPointTypes.Texture, true);\r\n this.registerInput(\r\n \"objectRenderer\",\r\n NodeRenderGraphBlockConnectionPointTypes.Object,\r\n true,\r\n new NodeRenderGraphConnectionPointCustomObject(\r\n \"objectRenderer\",\r\n this,\r\n NodeRenderGraphConnectionPointDirection.Input,\r\n NodeRenderGraphBaseObjectRendererBlock,\r\n \"NodeRenderGraphBaseObjectRendererBlock\"\r\n )\r\n );\r\n this._addDependenciesInput();\r\n\r\n this.registerOutput(\"output\", NodeRenderGraphBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this.target.addAcceptedConnectionPointTypes(NodeRenderGraphBlockConnectionPointTypes.TextureAllButBackBufferDepthStencil);\r\n this.layer.addAcceptedConnectionPointTypes(NodeRenderGraphBlockConnectionPointTypes.TextureAllButBackBuffer);\r\n\r\n this.output._typeConnectionSource = this.target;\r\n\r\n this._frameGraphTask = new FrameGraphHighlightLayerTask(this.name, this._frameGraph, this._scene, {\r\n mainTextureRatio: layerTextureRatio,\r\n mainTextureFixedSize: layerTextureFixedSize,\r\n blurTextureSizeRatio,\r\n isStroke,\r\n mainTextureType: layerTextureType,\r\n });\r\n }\r\n\r\n private _createTask(layerTextureRatio: number, layerTextureFixedSize: number, blurTextureSizeRatio: number, isStroke: boolean, layerTextureType: number) {\r\n const blurHorizontalSize = this.blurHorizontalSize;\r\n const blurVerticalSize = this.blurVerticalSize;\r\n\r\n this._frameGraphTask?.dispose();\r\n\r\n this._frameGraphTask = new FrameGraphHighlightLayerTask(this.name, this._frameGraph, this._scene, {\r\n mainTextureRatio: layerTextureRatio,\r\n mainTextureFixedSize: layerTextureFixedSize,\r\n blurTextureSizeRatio,\r\n isStroke,\r\n mainTextureType: layerTextureType,\r\n });\r\n\r\n this.blurHorizontalSize = blurHorizontalSize;\r\n this.blurVerticalSize = blurVerticalSize;\r\n\r\n this._additionalConstructionParameters = [layerTextureRatio, layerTextureFixedSize, blurTextureSizeRatio, isStroke, layerTextureType];\r\n }\r\n\r\n /** Multiplication factor applied to the main texture size to compute the size of the layer render target texture */\r\n @editableInPropertyPage(\"Layer texture ratio\", PropertyTypeForEdition.Float, \"PROPERTIES\")\r\n public get layerTextureRatio() {\r\n return this._frameGraphTask.layer._options.mainTextureRatio;\r\n }\r\n\r\n public set layerTextureRatio(value: number) {\r\n const options = this._frameGraphTask.layer._options;\r\n\r\n this._createTask(value, options.mainTextureFixedSize, options.blurTextureSizeRatio, options.isStroke, options.mainTextureType);\r\n }\r\n\r\n /** Defines the fixed size of the layer render target texture. Takes precedence over layerTextureRatio if provided */\r\n @editableInPropertyPage(\"Layer texture fixed size\", PropertyTypeForEdition.Float, \"PROPERTIES\")\r\n public get layerTextureFixedSize() {\r\n return this._frameGraphTask.layer._options.mainTextureFixedSize;\r\n }\r\n\r\n public set layerTextureFixedSize(value: number) {\r\n const options = this._frameGraphTask.layer._options;\r\n\r\n this._createTask(options.mainTextureRatio, value, options.blurTextureSizeRatio, options.isStroke, options.mainTextureType);\r\n }\r\n\r\n /** Defines the factor to apply to the layer texture size to create the blur textures */\r\n @editableInPropertyPage(\"Blur texture size ratio\", PropertyTypeForEdition.Float, \"PROPERTIES\")\r\n public get blurTextureSizeRatio() {\r\n return this._frameGraphTask.layer._options.blurTextureSizeRatio;\r\n }\r\n\r\n public set blurTextureSizeRatio(value: number) {\r\n const options = this._frameGraphTask.layer._options;\r\n\r\n this._createTask(options.mainTextureRatio, options.mainTextureFixedSize, value, options.isStroke, options.mainTextureType);\r\n }\r\n\r\n /** Should we display highlight as a solid stroke? */\r\n @editableInPropertyPage(\"Is stroke\", PropertyTypeForEdition.Boolean, \"PROPERTIES\")\r\n public get isStroke() {\r\n return this._frameGraphTask.layer._options.isStroke;\r\n }\r\n\r\n public set isStroke(value: boolean) {\r\n const options = this._frameGraphTask.layer._options;\r\n\r\n this._createTask(options.mainTextureRatio, options.mainTextureFixedSize, options.blurTextureSizeRatio, value, options.mainTextureType);\r\n }\r\n\r\n /** Defines the type of the layer texture */\r\n @editableInPropertyPage(\"Layer texture type\", PropertyTypeForEdition.TextureType, \"PROPERTIES\")\r\n public get layerTextureType() {\r\n return this._frameGraphTask.layer._options.mainTextureType;\r\n }\r\n\r\n public set layerTextureType(value: number) {\r\n const options = this._frameGraphTask.layer._options;\r\n\r\n this._createTask(options.mainTextureRatio, options.mainTextureFixedSize, options.blurTextureSizeRatio, options.isStroke, value);\r\n }\r\n\r\n /** How big is the horizontal kernel of the blur texture */\r\n @editableInPropertyPage(\"Blur horizontal size\", PropertyTypeForEdition.Float, \"PROPERTIES\", { min: 0, max: 4 })\r\n public get blurHorizontalSize() {\r\n return this._frameGraphTask.layer.blurHorizontalSize;\r\n }\r\n\r\n public set blurHorizontalSize(value: number) {\r\n this._frameGraphTask.layer.blurHorizontalSize = value;\r\n }\r\n\r\n /** How big is the vertical kernel of the blur texture */\r\n @editableInPropertyPage(\"Blur vertical size\", PropertyTypeForEdition.Float, \"PROPERTIES\", { min: 0, max: 4 })\r\n public get blurVerticalSize() {\r\n return this._frameGraphTask.layer.blurVerticalSize;\r\n }\r\n\r\n public set blurVerticalSize(value: number) {\r\n this._frameGraphTask.layer.blurVerticalSize = 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 \"NodeRenderGraphHighlightLayerBlock\";\r\n }\r\n\r\n /**\r\n * Gets the target texture input component\r\n */\r\n public get target(): NodeRenderGraphConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the layer input component\r\n */\r\n public get layer(): NodeRenderGraphConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the objectRenderer input component\r\n */\r\n public get objectRenderer(): NodeRenderGraphConnectionPoint {\r\n return this._inputs[2];\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.output.value = this._frameGraphTask.outputTexture;\r\n\r\n this._frameGraphTask.targetTexture = this.target.connectedPoint?.value as FrameGraphTextureHandle;\r\n this._frameGraphTask.layerTexture = this.layer.connectedPoint?.value as FrameGraphTextureHandle;\r\n this._frameGraphTask.objectRendererTask = this.objectRenderer.connectedPoint?.value as FrameGraphObjectRendererTask;\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n const codes: string[] = [];\r\n codes.push(`${this._codeVariableName}.blurHorizontalSize = ${this.blurHorizontalSize};`);\r\n codes.push(`${this._codeVariableName}.blurVerticalSize = ${this.blurVerticalSize};`);\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.blurHorizontalSize = this.blurHorizontalSize;\r\n serializationObject.blurVerticalSize = this.blurVerticalSize;\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n this.blurHorizontalSize = serializationObject.blurHorizontalSize;\r\n this.blurVerticalSize = serializationObject.blurVerticalSize;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.NodeRenderGraphHighlightLayerBlock\", NodeRenderGraphHighlightLayerBlock);\r\n"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { NodeRenderGraphConnectionPoint, Scene, NodeRenderGraphBuildState, FrameGraph } from "../../../../index.js";
|
|
2
|
+
import { FrameGraphAnaglyphTask } from "../../../Tasks/PostProcesses/anaglyphTask.js";
|
|
3
|
+
import { NodeRenderGraphBasePostProcessBlock } from "./basePostProcessBlock";
|
|
4
|
+
/**
|
|
5
|
+
* Block that implements the anaglyph post process
|
|
6
|
+
*/
|
|
7
|
+
export declare class NodeRenderGraphAnaglyphPostProcessBlock extends NodeRenderGraphBasePostProcessBlock {
|
|
8
|
+
protected _frameGraphTask: FrameGraphAnaglyphTask;
|
|
9
|
+
/**
|
|
10
|
+
* Gets the frame graph task associated with this block
|
|
11
|
+
*/
|
|
12
|
+
get task(): FrameGraphAnaglyphTask;
|
|
13
|
+
/**
|
|
14
|
+
* Create a new NodeRenderAnaglyphPostProcessBlock
|
|
15
|
+
* @param name defines the block name
|
|
16
|
+
* @param frameGraph defines the hosting frame graph
|
|
17
|
+
* @param scene defines the hosting scene
|
|
18
|
+
*/
|
|
19
|
+
constructor(name: string, frameGraph: FrameGraph, scene: Scene);
|
|
20
|
+
/**
|
|
21
|
+
* Gets the current class name
|
|
22
|
+
* @returns the class name
|
|
23
|
+
*/
|
|
24
|
+
getClassName(): string;
|
|
25
|
+
/**
|
|
26
|
+
* Gets the left texture input component
|
|
27
|
+
*/
|
|
28
|
+
get leftTexture(): NodeRenderGraphConnectionPoint;
|
|
29
|
+
protected _buildBlock(state: NodeRenderGraphBuildState): void;
|
|
30
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { RegisterClass } from "../../../../Misc/typeStore.js";
|
|
2
|
+
import { NodeRenderGraphBlockConnectionPointTypes } from "../../Types/nodeRenderGraphTypes.js";
|
|
3
|
+
import { FrameGraphAnaglyphTask } from "../../../Tasks/PostProcesses/anaglyphTask.js";
|
|
4
|
+
import { ThinAnaglyphPostProcess } from "../../../../PostProcesses/thinAnaglyphPostProcess.js";
|
|
5
|
+
import { NodeRenderGraphBasePostProcessBlock } from "./basePostProcessBlock.js";
|
|
6
|
+
/**
|
|
7
|
+
* Block that implements the anaglyph post process
|
|
8
|
+
*/
|
|
9
|
+
export class NodeRenderGraphAnaglyphPostProcessBlock extends NodeRenderGraphBasePostProcessBlock {
|
|
10
|
+
/**
|
|
11
|
+
* Gets the frame graph task associated with this block
|
|
12
|
+
*/
|
|
13
|
+
get task() {
|
|
14
|
+
return this._frameGraphTask;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Create a new NodeRenderAnaglyphPostProcessBlock
|
|
18
|
+
* @param name defines the block name
|
|
19
|
+
* @param frameGraph defines the hosting frame graph
|
|
20
|
+
* @param scene defines the hosting scene
|
|
21
|
+
*/
|
|
22
|
+
constructor(name, frameGraph, scene) {
|
|
23
|
+
super(name, frameGraph, scene);
|
|
24
|
+
this.registerInput("leftTexture", NodeRenderGraphBlockConnectionPointTypes.Texture);
|
|
25
|
+
this.leftTexture.addAcceptedConnectionPointTypes(NodeRenderGraphBlockConnectionPointTypes.TextureAllButBackBuffer);
|
|
26
|
+
this._finalizeInputOutputRegistering();
|
|
27
|
+
this._frameGraphTask = new FrameGraphAnaglyphTask(this.name, frameGraph, new ThinAnaglyphPostProcess(name, scene.getEngine()));
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Gets the current class name
|
|
31
|
+
* @returns the class name
|
|
32
|
+
*/
|
|
33
|
+
getClassName() {
|
|
34
|
+
return "NodeRenderGraphAnaglyphPostProcessBlock";
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Gets the left texture input component
|
|
38
|
+
*/
|
|
39
|
+
get leftTexture() {
|
|
40
|
+
return this._inputs[2];
|
|
41
|
+
}
|
|
42
|
+
_buildBlock(state) {
|
|
43
|
+
super._buildBlock(state);
|
|
44
|
+
this._frameGraphTask.leftTexture = this.leftTexture.connectedPoint?.value;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
RegisterClass("BABYLON.NodeRenderGraphAnaglyphPostProcessBlock", NodeRenderGraphAnaglyphPostProcessBlock);
|
|
48
|
+
//# sourceMappingURL=anaglyphPostProcessBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"anaglyphPostProcessBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FrameGraph/Node/Blocks/PostProcesses/anaglyphPostProcessBlock.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,wCAAwC,EAAE,MAAM,kCAAkC,CAAC;AAC5F,OAAO,EAAE,sBAAsB,EAAE,qDAAyD;AAC1F,OAAO,EAAE,uBAAuB,EAAE,6DAAmD;AACrF,OAAO,EAAE,mCAAmC,EAAE,MAAM,wBAAwB,CAAC;AAE7E;;GAEG;AACH,MAAM,OAAO,uCAAwC,SAAQ,mCAAmC;IAG5F;;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,aAAa,EAAE,wCAAwC,CAAC,OAAO,CAAC,CAAC;QAEpF,IAAI,CAAC,WAAW,CAAC,+BAA+B,CAAC,wCAAwC,CAAC,uBAAuB,CAAC,CAAC;QAEnH,IAAI,CAAC,+BAA+B,EAAE,CAAC;QAEvC,IAAI,CAAC,eAAe,GAAG,IAAI,sBAAsB,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,uBAAuB,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;IACnI,CAAC;IAED;;;OAGG;IACa,YAAY;QACxB,OAAO,yCAAyC,CAAC;IACrD,CAAC;IAED;;OAEG;IACH,IAAW,WAAW;QAClB,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;IAEkB,WAAW,CAAC,KAAgC;QAC3D,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QAEzB,IAAI,CAAC,eAAe,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,cAAc,EAAE,KAAgC,CAAC;IACzG,CAAC;CACJ;AAED,aAAa,CAAC,iDAAiD,EAAE,uCAAuC,CAAC,CAAC","sourcesContent":["// eslint-disable-next-line import/no-internal-modules\r\nimport type { NodeRenderGraphConnectionPoint, Scene, NodeRenderGraphBuildState, FrameGraphTextureHandle, FrameGraph } from \"core/index\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { NodeRenderGraphBlockConnectionPointTypes } from \"../../Types/nodeRenderGraphTypes\";\r\nimport { FrameGraphAnaglyphTask } from \"core/FrameGraph/Tasks/PostProcesses/anaglyphTask\";\r\nimport { ThinAnaglyphPostProcess } from \"core/PostProcesses/thinAnaglyphPostProcess\";\r\nimport { NodeRenderGraphBasePostProcessBlock } from \"./basePostProcessBlock\";\r\n\r\n/**\r\n * Block that implements the anaglyph post process\r\n */\r\nexport class NodeRenderGraphAnaglyphPostProcessBlock extends NodeRenderGraphBasePostProcessBlock {\r\n protected override _frameGraphTask: FrameGraphAnaglyphTask;\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 NodeRenderAnaglyphPostProcessBlock\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(\"leftTexture\", NodeRenderGraphBlockConnectionPointTypes.Texture);\r\n\r\n this.leftTexture.addAcceptedConnectionPointTypes(NodeRenderGraphBlockConnectionPointTypes.TextureAllButBackBuffer);\r\n\r\n this._finalizeInputOutputRegistering();\r\n\r\n this._frameGraphTask = new FrameGraphAnaglyphTask(this.name, frameGraph, new ThinAnaglyphPostProcess(name, scene.getEngine()));\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 \"NodeRenderGraphAnaglyphPostProcessBlock\";\r\n }\r\n\r\n /**\r\n * Gets the left texture input component\r\n */\r\n public get leftTexture(): NodeRenderGraphConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n protected override _buildBlock(state: NodeRenderGraphBuildState) {\r\n super._buildBlock(state);\r\n\r\n this._frameGraphTask.leftTexture = this.leftTexture.connectedPoint?.value as FrameGraphTextureHandle;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.NodeRenderGraphAnaglyphPostProcessBlock\", NodeRenderGraphAnaglyphPostProcessBlock);\r\n"]}
|
|
@@ -3,7 +3,7 @@ import { NodeRenderGraphBlock } from "../../nodeRenderGraphBlock";
|
|
|
3
3
|
interface IPostProcessLike {
|
|
4
4
|
sourceSamplingMode: number;
|
|
5
5
|
sourceTexture: FrameGraphTextureHandle;
|
|
6
|
-
|
|
6
|
+
targetTexture?: FrameGraphTextureHandle;
|
|
7
7
|
outputTexture: FrameGraphTextureHandle;
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
@@ -32,9 +32,9 @@ export declare class NodeRenderGraphBasePostProcessBlock extends NodeRenderGraph
|
|
|
32
32
|
*/
|
|
33
33
|
get source(): NodeRenderGraphConnectionPoint;
|
|
34
34
|
/**
|
|
35
|
-
* Gets the
|
|
35
|
+
* Gets the target input component
|
|
36
36
|
*/
|
|
37
|
-
get
|
|
37
|
+
get target(): NodeRenderGraphConnectionPoint;
|
|
38
38
|
/**
|
|
39
39
|
* Gets the output component
|
|
40
40
|
*/
|