@babylonjs/smart-filters 0.1.0-alpha
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/dist/IDisposable.d.ts +10 -0
- package/dist/IDisposable.d.ts.map +1 -0
- package/dist/IDisposable.js +2 -0
- package/dist/IDisposable.js.map +1 -0
- package/dist/blocks/aggregateBlock.d.ts +50 -0
- package/dist/blocks/aggregateBlock.d.ts.map +1 -0
- package/dist/blocks/aggregateBlock.js +103 -0
- package/dist/blocks/aggregateBlock.js.map +1 -0
- package/dist/blocks/baseBlock.d.ts +160 -0
- package/dist/blocks/baseBlock.d.ts.map +1 -0
- package/dist/blocks/baseBlock.js +256 -0
- package/dist/blocks/baseBlock.js.map +1 -0
- package/dist/blocks/copyBlock.d.ts +59 -0
- package/dist/blocks/copyBlock.d.ts.map +1 -0
- package/dist/blocks/copyBlock.js +84 -0
- package/dist/blocks/copyBlock.js.map +1 -0
- package/dist/blocks/disableableBlock.d.ts +30 -0
- package/dist/blocks/disableableBlock.d.ts.map +1 -0
- package/dist/blocks/disableableBlock.js +22 -0
- package/dist/blocks/disableableBlock.js.map +1 -0
- package/dist/blocks/inputBlock.d.ts +64 -0
- package/dist/blocks/inputBlock.d.ts.map +1 -0
- package/dist/blocks/inputBlock.js +74 -0
- package/dist/blocks/inputBlock.js.map +1 -0
- package/dist/blocks/outputBlock.d.ts +42 -0
- package/dist/blocks/outputBlock.d.ts.map +1 -0
- package/dist/blocks/outputBlock.js +74 -0
- package/dist/blocks/outputBlock.js.map +1 -0
- package/dist/blocks/shaderBlock.d.ts +68 -0
- package/dist/blocks/shaderBlock.d.ts.map +1 -0
- package/dist/blocks/shaderBlock.js +101 -0
- package/dist/blocks/shaderBlock.js.map +1 -0
- package/dist/command/command.d.ts +49 -0
- package/dist/command/command.d.ts.map +1 -0
- package/dist/command/command.js +15 -0
- package/dist/command/command.js.map +1 -0
- package/dist/command/commandBuffer.d.ts +40 -0
- package/dist/command/commandBuffer.d.ts.map +1 -0
- package/dist/command/commandBuffer.js +58 -0
- package/dist/command/commandBuffer.js.map +1 -0
- package/dist/command/commandBufferDebugger.d.ts +7 -0
- package/dist/command/commandBufferDebugger.d.ts.map +1 -0
- package/dist/command/commandBufferDebugger.js +12 -0
- package/dist/command/commandBufferDebugger.js.map +1 -0
- package/dist/connection/connectionPoint.d.ts +110 -0
- package/dist/connection/connectionPoint.d.ts.map +1 -0
- package/dist/connection/connectionPoint.js +153 -0
- package/dist/connection/connectionPoint.js.map +1 -0
- package/dist/connection/connectionPointCompatibilityState.d.ts +20 -0
- package/dist/connection/connectionPointCompatibilityState.d.ts.map +1 -0
- package/dist/connection/connectionPointCompatibilityState.js +32 -0
- package/dist/connection/connectionPointCompatibilityState.js.map +1 -0
- package/dist/connection/connectionPointDirection.d.ts +10 -0
- package/dist/connection/connectionPointDirection.d.ts.map +1 -0
- package/dist/connection/connectionPointDirection.js +11 -0
- package/dist/connection/connectionPointDirection.js.map +1 -0
- package/dist/connection/connectionPointType.d.ts +22 -0
- package/dist/connection/connectionPointType.d.ts.map +1 -0
- package/dist/connection/connectionPointType.js +17 -0
- package/dist/connection/connectionPointType.js.map +1 -0
- package/dist/connection/connectionPointWithDefault.d.ts +23 -0
- package/dist/connection/connectionPointWithDefault.d.ts.map +1 -0
- package/dist/connection/connectionPointWithDefault.js +19 -0
- package/dist/connection/connectionPointWithDefault.js.map +1 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -0
- package/dist/optimization/dependencyGraph.d.ts +31 -0
- package/dist/optimization/dependencyGraph.d.ts.map +1 -0
- package/dist/optimization/dependencyGraph.js +77 -0
- package/dist/optimization/dependencyGraph.js.map +1 -0
- package/dist/optimization/optimizedShaderBlock.d.ts +75 -0
- package/dist/optimization/optimizedShaderBlock.d.ts.map +1 -0
- package/dist/optimization/optimizedShaderBlock.js +105 -0
- package/dist/optimization/optimizedShaderBlock.js.map +1 -0
- package/dist/optimization/smartFilterOptimizer.d.ts +72 -0
- package/dist/optimization/smartFilterOptimizer.d.ts.map +1 -0
- package/dist/optimization/smartFilterOptimizer.js +482 -0
- package/dist/optimization/smartFilterOptimizer.js.map +1 -0
- package/dist/runtime/renderTargetGenerator.d.ts +35 -0
- package/dist/runtime/renderTargetGenerator.d.ts.map +1 -0
- package/dist/runtime/renderTargetGenerator.js +153 -0
- package/dist/runtime/renderTargetGenerator.js.map +1 -0
- package/dist/runtime/shaderRuntime.d.ts +95 -0
- package/dist/runtime/shaderRuntime.d.ts.map +1 -0
- package/dist/runtime/shaderRuntime.js +120 -0
- package/dist/runtime/shaderRuntime.js.map +1 -0
- package/dist/runtime/smartFilterRuntime.d.ts +69 -0
- package/dist/runtime/smartFilterRuntime.d.ts.map +1 -0
- package/dist/runtime/smartFilterRuntime.js +57 -0
- package/dist/runtime/smartFilterRuntime.js.map +1 -0
- package/dist/runtime/strongRef.d.ts +16 -0
- package/dist/runtime/strongRef.d.ts.map +1 -0
- package/dist/runtime/strongRef.js +9 -0
- package/dist/runtime/strongRef.js.map +1 -0
- package/dist/smartFilter.d.ts +100 -0
- package/dist/smartFilter.d.ts.map +1 -0
- package/dist/smartFilter.js +154 -0
- package/dist/smartFilter.js.map +1 -0
- package/dist/utils/shaderCodeUtils.d.ts +131 -0
- package/dist/utils/shaderCodeUtils.d.ts.map +1 -0
- package/dist/utils/shaderCodeUtils.js +115 -0
- package/dist/utils/shaderCodeUtils.js.map +1 -0
- package/dist/utils/textureLoaders.d.ts +14 -0
- package/dist/utils/textureLoaders.d.ts.map +1 -0
- package/dist/utils/textureLoaders.js +22 -0
- package/dist/utils/textureLoaders.js.map +1 -0
- package/license.md +21 -0
- package/package.json +47 -0
- package/readme.md +165 -0
- package/src/IDisposable.ts +9 -0
- package/src/blocks/aggregateBlock.ts +121 -0
- package/src/blocks/baseBlock.ts +341 -0
- package/src/blocks/copyBlock.ts +103 -0
- package/src/blocks/disableableBlock.ts +40 -0
- package/src/blocks/inputBlock.ts +114 -0
- package/src/blocks/outputBlock.ts +97 -0
- package/src/blocks/shaderBlock.ts +145 -0
- package/src/command/command.ts +60 -0
- package/src/command/commandBuffer.ts +71 -0
- package/src/command/commandBufferDebugger.ts +13 -0
- package/src/connection/connectionPoint.ts +212 -0
- package/src/connection/connectionPointCompatibilityState.ts +31 -0
- package/src/connection/connectionPointDirection.ts +9 -0
- package/src/connection/connectionPointType.ts +30 -0
- package/src/connection/connectionPointWithDefault.ts +35 -0
- package/src/index.ts +36 -0
- package/src/optimization/dependencyGraph.ts +94 -0
- package/src/optimization/optimizedShaderBlock.ts +133 -0
- package/src/optimization/smartFilterOptimizer.ts +706 -0
- package/src/runtime/renderTargetGenerator.ts +204 -0
- package/src/runtime/shaderRuntime.ts +155 -0
- package/src/runtime/smartFilterRuntime.ts +104 -0
- package/src/runtime/strongRef.ts +18 -0
- package/src/smartFilter.ts +227 -0
- package/src/utils/shaderCodeUtils.ts +242 -0
- package/src/utils/textureLoaders.ts +28 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { Effect } from "@babylonjs/core/Materials/effect";
|
|
2
|
+
import type { ThinTexture } from "@babylonjs/core/Materials/Textures/thinTexture";
|
|
3
|
+
import type { ShaderProgram } from "../utils/shaderCodeUtils";
|
|
4
|
+
import type { SmartFilter } from "../smartFilter";
|
|
5
|
+
import type { StrongRef } from "../runtime/strongRef";
|
|
6
|
+
import { ConnectionPointType } from "../connection/connectionPointType.js";
|
|
7
|
+
import { ShaderBlock } from "./shaderBlock.js";
|
|
8
|
+
import { ShaderBinding } from "../runtime/shaderRuntime.js";
|
|
9
|
+
/**
|
|
10
|
+
* The shader bindings for the Copy block.
|
|
11
|
+
*/
|
|
12
|
+
export declare class CopyShaderBinding extends ShaderBinding {
|
|
13
|
+
private readonly _inputTexture;
|
|
14
|
+
/**
|
|
15
|
+
* Creates a new shader binding instance for the copy block.
|
|
16
|
+
* @param parentBlock - The parent block
|
|
17
|
+
* @param inputTexture - defines the input texture to copy
|
|
18
|
+
*/
|
|
19
|
+
constructor(parentBlock: CopyBlock, inputTexture: StrongRef<ThinTexture>);
|
|
20
|
+
/**
|
|
21
|
+
* Binds all the required data to the shader when rendering.
|
|
22
|
+
* @param effect - defines the effect to bind the data to
|
|
23
|
+
* @internal
|
|
24
|
+
*/
|
|
25
|
+
bind(effect: Effect): void;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* A block responsible for copying a texture to the output.
|
|
29
|
+
*
|
|
30
|
+
* This might be helpful to duplicate a texture if necessary.
|
|
31
|
+
*
|
|
32
|
+
* It simply takes a texture as input and outputs it to another texture or the main canvas.
|
|
33
|
+
*/
|
|
34
|
+
export declare class CopyBlock extends ShaderBlock {
|
|
35
|
+
/**
|
|
36
|
+
* The class name of the block.
|
|
37
|
+
*/
|
|
38
|
+
static ClassName: string;
|
|
39
|
+
/**
|
|
40
|
+
* The input connection point of the block.
|
|
41
|
+
*/
|
|
42
|
+
readonly input: import("..").ConnectionPoint<ConnectionPointType.Texture>;
|
|
43
|
+
/**
|
|
44
|
+
* The shader program (vertex and fragment code) to use to render the block
|
|
45
|
+
*/
|
|
46
|
+
static ShaderCode: ShaderProgram;
|
|
47
|
+
/**
|
|
48
|
+
* Create a new copy block.
|
|
49
|
+
* @param smartFilter - The smart filter this block belongs to.
|
|
50
|
+
* @param name -The friendly name of the block.
|
|
51
|
+
*/
|
|
52
|
+
constructor(smartFilter: SmartFilter, name: string);
|
|
53
|
+
/**
|
|
54
|
+
* Get the class instance that binds all the required data to the shader (effect) when rendering.
|
|
55
|
+
* @returns The class instance that binds the data to the effect
|
|
56
|
+
*/
|
|
57
|
+
getShaderBinding(): ShaderBinding;
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=copyBlock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copyBlock.d.ts","sourceRoot":"","sources":["../../src/blocks/copyBlock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gDAAgD,CAAC;AAElF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAuB5D;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,aAAa;IAChD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAyB;IAEvD;;;;OAIG;gBACS,WAAW,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,CAAC,WAAW,CAAC;IAKxE;;;;OAIG;IACa,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;CAG7C;AAED;;;;;;GAMG;AACH,qBAAa,SAAU,SAAQ,WAAW;IACtC;;OAEG;IACH,OAAuB,SAAS,SAAe;IAE/C;;OAEG;IACH,SAAgB,KAAK,4DAA6D;IAElF;;OAEG;IACH,OAAuB,UAAU,gBAAiB;IAElD;;;;OAIG;gBACS,WAAW,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM;IAIlD;;;OAGG;IACI,gBAAgB,IAAI,aAAa;CAS3C"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { ConnectionPointType } from "../connection/connectionPointType.js";
|
|
2
|
+
import { ShaderBlock } from "./shaderBlock.js";
|
|
3
|
+
import { ShaderBinding } from "../runtime/shaderRuntime.js";
|
|
4
|
+
const shaderProgram = {
|
|
5
|
+
fragment: {
|
|
6
|
+
uniform: `
|
|
7
|
+
uniform sampler2D _input_;
|
|
8
|
+
`,
|
|
9
|
+
mainFunctionName: "_copy_",
|
|
10
|
+
functions: [
|
|
11
|
+
{
|
|
12
|
+
name: "_copy_",
|
|
13
|
+
code: `
|
|
14
|
+
vec4 _copy_(vec2 vUV) {
|
|
15
|
+
return texture2D(_input_, vUV);
|
|
16
|
+
}
|
|
17
|
+
`,
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* The shader bindings for the Copy block.
|
|
24
|
+
*/
|
|
25
|
+
export class CopyShaderBinding extends ShaderBinding {
|
|
26
|
+
/**
|
|
27
|
+
* Creates a new shader binding instance for the copy block.
|
|
28
|
+
* @param parentBlock - The parent block
|
|
29
|
+
* @param inputTexture - defines the input texture to copy
|
|
30
|
+
*/
|
|
31
|
+
constructor(parentBlock, inputTexture) {
|
|
32
|
+
super(parentBlock);
|
|
33
|
+
this._inputTexture = inputTexture;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Binds all the required data to the shader when rendering.
|
|
37
|
+
* @param effect - defines the effect to bind the data to
|
|
38
|
+
* @internal
|
|
39
|
+
*/
|
|
40
|
+
bind(effect) {
|
|
41
|
+
effect.setTexture(this.getRemappedName("input"), this._inputTexture.value);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* A block responsible for copying a texture to the output.
|
|
46
|
+
*
|
|
47
|
+
* This might be helpful to duplicate a texture if necessary.
|
|
48
|
+
*
|
|
49
|
+
* It simply takes a texture as input and outputs it to another texture or the main canvas.
|
|
50
|
+
*/
|
|
51
|
+
export class CopyBlock extends ShaderBlock {
|
|
52
|
+
/**
|
|
53
|
+
* Create a new copy block.
|
|
54
|
+
* @param smartFilter - The smart filter this block belongs to.
|
|
55
|
+
* @param name -The friendly name of the block.
|
|
56
|
+
*/
|
|
57
|
+
constructor(smartFilter, name) {
|
|
58
|
+
super(smartFilter, name);
|
|
59
|
+
/**
|
|
60
|
+
* The input connection point of the block.
|
|
61
|
+
*/
|
|
62
|
+
this.input = this._registerInput("input", ConnectionPointType.Texture);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Get the class instance that binds all the required data to the shader (effect) when rendering.
|
|
66
|
+
* @returns The class instance that binds the data to the effect
|
|
67
|
+
*/
|
|
68
|
+
getShaderBinding() {
|
|
69
|
+
const input = this.input.runtimeData;
|
|
70
|
+
if (!input) {
|
|
71
|
+
throw new Error(`The input texture is missing for the CopyBlock named ${this.name}`);
|
|
72
|
+
}
|
|
73
|
+
return new CopyShaderBinding(this, input);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* The class name of the block.
|
|
78
|
+
*/
|
|
79
|
+
CopyBlock.ClassName = "CopyBlock";
|
|
80
|
+
/**
|
|
81
|
+
* The shader program (vertex and fragment code) to use to render the block
|
|
82
|
+
*/
|
|
83
|
+
CopyBlock.ShaderCode = shaderProgram;
|
|
84
|
+
//# sourceMappingURL=copyBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copyBlock.js","sourceRoot":"","sources":["../../src/blocks/copyBlock.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D,MAAM,aAAa,GAAkB;IACjC,QAAQ,EAAE;QACN,OAAO,EAAE;;SAER;QAED,gBAAgB,EAAE,QAAQ;QAE1B,SAAS,EAAE;YACP;gBACI,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE;;;;iBAIL;aACJ;SACJ;KACJ;CACJ,CAAC;AAEF;;GAEG;AACH,MAAM,OAAO,iBAAkB,SAAQ,aAAa;IAGhD;;;;OAIG;IACH,YAAY,WAAsB,EAAE,YAAoC;QACpE,KAAK,CAAC,WAAW,CAAC,CAAC;QACnB,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;IACtC,CAAC;IAED;;;;OAIG;IACa,IAAI,CAAC,MAAc;QAC/B,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAC/E,CAAC;CACJ;AAED;;;;;;GAMG;AACH,MAAM,OAAO,SAAU,SAAQ,WAAW;IAgBtC;;;;OAIG;IACH,YAAY,WAAwB,EAAE,IAAY;QAC9C,KAAK,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;QAhB7B;;WAEG;QACa,UAAK,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAAC;IAclF,CAAC;IAED;;;OAGG;IACI,gBAAgB;QACnB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC;QAErC,IAAI,CAAC,KAAK,EAAE,CAAC;YACT,MAAM,IAAI,KAAK,CAAC,wDAAwD,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QACzF,CAAC;QAED,OAAO,IAAI,iBAAiB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC9C,CAAC;;AApCD;;GAEG;AACoB,mBAAS,GAAG,WAAW,AAAd,CAAe;AAO/C;;GAEG;AACoB,oBAAU,GAAG,aAAa,AAAhB,CAAiB"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { SmartFilter } from "../smartFilter";
|
|
2
|
+
import type { ConnectionPoint } from "../connection/connectionPoint";
|
|
3
|
+
import { BaseBlock } from "../blocks/baseBlock.js";
|
|
4
|
+
import { ConnectionPointType } from "../connection/connectionPointType.js";
|
|
5
|
+
/**
|
|
6
|
+
* The interface that describes the disableable block.
|
|
7
|
+
*/
|
|
8
|
+
export interface IDisableableBlock {
|
|
9
|
+
/**
|
|
10
|
+
* The disabled connection point of the block.
|
|
11
|
+
*/
|
|
12
|
+
disabled: ConnectionPoint<ConnectionPointType.Boolean>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* A block that can be disabled.
|
|
16
|
+
*/
|
|
17
|
+
export declare class DisableableBlock extends BaseBlock implements IDisableableBlock {
|
|
18
|
+
/**
|
|
19
|
+
* The disabled connection point of the block.
|
|
20
|
+
*/
|
|
21
|
+
readonly disabled: import("../connection/connectionPointWithDefault").ConnectionPointWithDefault<ConnectionPointType.Boolean>;
|
|
22
|
+
/**
|
|
23
|
+
* Instantiates a new block.
|
|
24
|
+
* @param smartFilter - Defines the smart filter the block belongs to
|
|
25
|
+
* @param name - Defines the name of the block
|
|
26
|
+
* @param disableOptimization - Defines if the block should not be optimized (default: false)
|
|
27
|
+
*/
|
|
28
|
+
constructor(smartFilter: SmartFilter, name: string, disableOptimization?: boolean);
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=disableableBlock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"disableableBlock.d.ts","sourceRoot":"","sources":["../../src/blocks/disableableBlock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAErE,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAG3E;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAC9B;;OAEG;IACH,QAAQ,EAAE,eAAe,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;CAC1D;AAED;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,SAAU,YAAW,iBAAiB;IACxE;;OAEG;IACH,SAAgB,QAAQ,6GAItB;IAEF;;;;;OAKG;gBACS,WAAW,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,mBAAmB,UAAQ;CAGlF"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BaseBlock } from "../blocks/baseBlock.js";
|
|
2
|
+
import { ConnectionPointType } from "../connection/connectionPointType.js";
|
|
3
|
+
import { createStrongRef } from "../runtime/strongRef.js";
|
|
4
|
+
/**
|
|
5
|
+
* A block that can be disabled.
|
|
6
|
+
*/
|
|
7
|
+
export class DisableableBlock extends BaseBlock {
|
|
8
|
+
/**
|
|
9
|
+
* Instantiates a new block.
|
|
10
|
+
* @param smartFilter - Defines the smart filter the block belongs to
|
|
11
|
+
* @param name - Defines the name of the block
|
|
12
|
+
* @param disableOptimization - Defines if the block should not be optimized (default: false)
|
|
13
|
+
*/
|
|
14
|
+
constructor(smartFilter, name, disableOptimization = false) {
|
|
15
|
+
super(smartFilter, name, disableOptimization);
|
|
16
|
+
/**
|
|
17
|
+
* The disabled connection point of the block.
|
|
18
|
+
*/
|
|
19
|
+
this.disabled = this._registerOptionalInput("disabled", ConnectionPointType.Boolean, createStrongRef(false));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=disableableBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"disableableBlock.js","sourceRoot":"","sources":["../../src/blocks/disableableBlock.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAY1D;;GAEG;AACH,MAAM,OAAO,gBAAiB,SAAQ,SAAS;IAU3C;;;;;OAKG;IACH,YAAY,WAAwB,EAAE,IAAY,EAAE,mBAAmB,GAAG,KAAK;QAC3E,KAAK,CAAC,WAAW,EAAE,IAAI,EAAE,mBAAmB,CAAC,CAAC;QAhBlD;;WAEG;QACa,aAAQ,GAAG,IAAI,CAAC,sBAAsB,CAClD,UAAU,EACV,mBAAmB,CAAC,OAAO,EAC3B,eAAe,CAAC,KAAK,CAAC,CACzB,CAAC;IAUF,CAAC;CACJ"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { SmartFilter } from "../smartFilter";
|
|
2
|
+
import type { ConnectionPointValue } from "../connection/connectionPointType";
|
|
3
|
+
import type { RuntimeData } from "../connection/connectionPoint";
|
|
4
|
+
import type { ConnectionPointWithDefault } from "../connection/connectionPointWithDefault";
|
|
5
|
+
import type { DisableableBlock } from "./disableableBlock";
|
|
6
|
+
import { BaseBlock } from "../blocks/baseBlock.js";
|
|
7
|
+
import { ConnectionPointType } from "../connection/connectionPointType.js";
|
|
8
|
+
/**
|
|
9
|
+
* Predicate to check if a block is a texture input block.
|
|
10
|
+
* @param block - The block to check
|
|
11
|
+
* @returns true if the block is a texture input block, otherwise false
|
|
12
|
+
*/
|
|
13
|
+
export declare function isTextureInputBlock(block: BaseBlock): block is InputBlock<ConnectionPointType.Texture>;
|
|
14
|
+
/**
|
|
15
|
+
* Predicate to check if a block is a disableable block.
|
|
16
|
+
* @param block - The block to check
|
|
17
|
+
* @returns true if the block is a disableable block, otherwise false
|
|
18
|
+
*/
|
|
19
|
+
export declare function isDisableableBlock(block: BaseBlock): block is DisableableBlock;
|
|
20
|
+
/**
|
|
21
|
+
* This represents any inputs used in the graph.
|
|
22
|
+
*
|
|
23
|
+
* This is used to provide a way to connect the graph to the outside world.
|
|
24
|
+
*
|
|
25
|
+
* The value is dynamically set by the user.
|
|
26
|
+
*/
|
|
27
|
+
export declare class InputBlock<U extends ConnectionPointType> extends BaseBlock {
|
|
28
|
+
/**
|
|
29
|
+
* The class name of the block.
|
|
30
|
+
*/
|
|
31
|
+
static ClassName: string;
|
|
32
|
+
/**
|
|
33
|
+
* The output connection point of the block.
|
|
34
|
+
*/
|
|
35
|
+
readonly output: ConnectionPointWithDefault<U>;
|
|
36
|
+
/**
|
|
37
|
+
* The type of the input.
|
|
38
|
+
*/
|
|
39
|
+
readonly type: U;
|
|
40
|
+
/**
|
|
41
|
+
* Gets the current value of the input.
|
|
42
|
+
*/
|
|
43
|
+
get runtimeValue(): RuntimeData<U>;
|
|
44
|
+
/**
|
|
45
|
+
* Sets the current value of the input.
|
|
46
|
+
*/
|
|
47
|
+
set runtimeValue(value: RuntimeData<U>);
|
|
48
|
+
/**
|
|
49
|
+
* Creates a new InputBlock.
|
|
50
|
+
* @param smartFilter - The smart filter to add the block to
|
|
51
|
+
* @param name - The friendly name of the block
|
|
52
|
+
* @param type - The type of the input
|
|
53
|
+
* @param initialValue - The initial value of the input
|
|
54
|
+
* @remarks the initial value can either be a strong reference or a value
|
|
55
|
+
*/
|
|
56
|
+
constructor(smartFilter: SmartFilter, name: string, type: U, initialValue: ConnectionPointValue<U> | RuntimeData<U>);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Unionized type of all the possible input types.
|
|
60
|
+
*/
|
|
61
|
+
export type AnyInputBlock = {
|
|
62
|
+
[T in keyof typeof ConnectionPointType]: InputBlock<(typeof ConnectionPointType)[T]>;
|
|
63
|
+
}[keyof typeof ConnectionPointType];
|
|
64
|
+
//# sourceMappingURL=inputBlock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inputBlock.d.ts","sourceRoot":"","sources":["../../src/blocks/inputBlock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,0CAA0C,CAAC;AAC3F,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAa3E;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,SAAS,GAAG,KAAK,IAAI,UAAU,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAEtG;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,SAAS,GAAG,KAAK,IAAI,gBAAgB,CAE9E;AAED;;;;;;GAMG;AACH,qBAAa,UAAU,CAAC,CAAC,SAAS,mBAAmB,CAAE,SAAQ,SAAS;IACpE;;OAEG;IACH,OAAuB,SAAS,SAAgB;IAEhD;;OAEG;IACH,SAAgB,MAAM,EAAE,0BAA0B,CAAC,CAAC,CAAC,CAAC;IAEtD;;OAEG;IACH,SAAgB,IAAI,EAAE,CAAC,CAAC;IAExB;;OAEG;IACH,IAAW,YAAY,IAAI,WAAW,CAAC,CAAC,CAAC,CAExC;IAED;;OAEG;IACH,IAAW,YAAY,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,EAE5C;IAED;;;;;;;OAOG;gBAEC,WAAW,EAAE,WAAW,EACxB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,CAAC,EACP,YAAY,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC;CAmB7D;AAED;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;KACvB,CAAC,IAAI,MAAM,OAAO,mBAAmB,GAAG,UAAU,CAAC,CAAC,OAAO,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC;CACvF,CAAC,MAAM,OAAO,mBAAmB,CAAC,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { BaseBlock } from "../blocks/baseBlock.js";
|
|
2
|
+
import { createStrongRef } from "../runtime/strongRef.js";
|
|
3
|
+
import { ConnectionPointType } from "../connection/connectionPointType.js";
|
|
4
|
+
/**
|
|
5
|
+
* Type predicate to check if value is a strong ref or a direct value
|
|
6
|
+
* @param value - The value to check
|
|
7
|
+
* @returns true if the value is a strong ref, otherwise false
|
|
8
|
+
*/
|
|
9
|
+
function isRuntimeData(value) {
|
|
10
|
+
return value.value !== undefined;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Predicate to check if a block is a texture input block.
|
|
14
|
+
* @param block - The block to check
|
|
15
|
+
* @returns true if the block is a texture input block, otherwise false
|
|
16
|
+
*/
|
|
17
|
+
export function isTextureInputBlock(block) {
|
|
18
|
+
return block.type === ConnectionPointType.Texture;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Predicate to check if a block is a disableable block.
|
|
22
|
+
* @param block - The block to check
|
|
23
|
+
* @returns true if the block is a disableable block, otherwise false
|
|
24
|
+
*/
|
|
25
|
+
export function isDisableableBlock(block) {
|
|
26
|
+
return block.disabled !== undefined;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* This represents any inputs used in the graph.
|
|
30
|
+
*
|
|
31
|
+
* This is used to provide a way to connect the graph to the outside world.
|
|
32
|
+
*
|
|
33
|
+
* The value is dynamically set by the user.
|
|
34
|
+
*/
|
|
35
|
+
export class InputBlock extends BaseBlock {
|
|
36
|
+
/**
|
|
37
|
+
* Gets the current value of the input.
|
|
38
|
+
*/
|
|
39
|
+
get runtimeValue() {
|
|
40
|
+
return this.output.runtimeData;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Sets the current value of the input.
|
|
44
|
+
*/
|
|
45
|
+
set runtimeValue(value) {
|
|
46
|
+
this.output.runtimeData = value;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Creates a new InputBlock.
|
|
50
|
+
* @param smartFilter - The smart filter to add the block to
|
|
51
|
+
* @param name - The friendly name of the block
|
|
52
|
+
* @param type - The type of the input
|
|
53
|
+
* @param initialValue - The initial value of the input
|
|
54
|
+
* @remarks the initial value can either be a strong reference or a value
|
|
55
|
+
*/
|
|
56
|
+
constructor(smartFilter, name, type, initialValue) {
|
|
57
|
+
super(smartFilter, name);
|
|
58
|
+
this.type = type;
|
|
59
|
+
// Creates the output connection point
|
|
60
|
+
this.output = this._registerOutputWithDefault("output", type, isRuntimeData(initialValue) ? initialValue : createStrongRef(initialValue));
|
|
61
|
+
// Creates a strong reference to the initial value in case a reference has not been provided
|
|
62
|
+
if (isRuntimeData(initialValue)) {
|
|
63
|
+
this.runtimeValue = initialValue;
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
this.runtimeValue = createStrongRef(initialValue);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* The class name of the block.
|
|
72
|
+
*/
|
|
73
|
+
InputBlock.ClassName = "InputBlock";
|
|
74
|
+
//# sourceMappingURL=inputBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inputBlock.js","sourceRoot":"","sources":["../../src/blocks/inputBlock.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAE3E;;;;GAIG;AACH,SAAS,aAAa,CAClB,KAA+C;IAE/C,OAAQ,KAA0C,CAAC,KAAK,KAAK,SAAS,CAAC;AAC3E,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAgB;IAChD,OAAQ,KAAiD,CAAC,IAAI,KAAK,mBAAmB,CAAC,OAAO,CAAC;AACnG,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAgB;IAC/C,OAAQ,KAA0B,CAAC,QAAQ,KAAK,SAAS,CAAC;AAC9D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,OAAO,UAA0C,SAAQ,SAAS;IAgBpE;;OAEG;IACH,IAAW,YAAY;QACnB,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC;IACnC,CAAC;IAED;;OAEG;IACH,IAAW,YAAY,CAAC,KAAqB;QACzC,IAAI,CAAC,MAAM,CAAC,WAAW,GAAG,KAAK,CAAC;IACpC,CAAC;IAED;;;;;;;OAOG;IACH,YACI,WAAwB,EACxB,IAAY,EACZ,IAAO,EACP,YAAsD;QAEtD,KAAK,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;QACzB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QAEjB,sCAAsC;QACtC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,0BAA0B,CACzC,QAAQ,EACR,IAAI,EACJ,aAAa,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,eAAe,CAAC,YAAY,CAAC,CAC7E,CAAC;QAEF,4FAA4F;QAC5F,IAAI,aAAa,CAAC,YAAY,CAAC,EAAE,CAAC;YAC9B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACrC,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,YAAY,GAAG,eAAe,CAAC,YAAY,CAAC,CAAC;QACtD,CAAC;IACL,CAAC;;AA3DD;;GAEG;AACoB,oBAAS,GAAG,YAAY,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { InitializationData, SmartFilter } from "../smartFilter";
|
|
2
|
+
import { ConnectionPointType } from "../connection/connectionPointType.js";
|
|
3
|
+
import { BaseBlock } from "./baseBlock.js";
|
|
4
|
+
/**
|
|
5
|
+
* The output block of a smart filter.
|
|
6
|
+
*
|
|
7
|
+
* Only the smart filter will internally create and host the output block.
|
|
8
|
+
* It should not be exported through the main index.ts module.
|
|
9
|
+
*/
|
|
10
|
+
export declare class OutputBlock extends BaseBlock {
|
|
11
|
+
/**
|
|
12
|
+
* The class name of the block.
|
|
13
|
+
*/
|
|
14
|
+
static ClassName: string;
|
|
15
|
+
/**
|
|
16
|
+
* Input connection point of the output block.
|
|
17
|
+
* This takes a texture as input.
|
|
18
|
+
*/
|
|
19
|
+
readonly input: import("..").ConnectionPoint<ConnectionPointType.Texture>;
|
|
20
|
+
private _copyBlock;
|
|
21
|
+
/**
|
|
22
|
+
* Create a new output block.
|
|
23
|
+
* @param smartFilter - The smart filter this block belongs to
|
|
24
|
+
*/
|
|
25
|
+
constructor(smartFilter: SmartFilter);
|
|
26
|
+
private _getCopyBlock;
|
|
27
|
+
/**
|
|
28
|
+
* Prepares all blocks for runtime by traversing the graph.
|
|
29
|
+
*/
|
|
30
|
+
prepareForRuntime(): void;
|
|
31
|
+
/**
|
|
32
|
+
* Propagates the runtime data for all graph blocks.
|
|
33
|
+
*/
|
|
34
|
+
propagateRuntimeData(): void;
|
|
35
|
+
/**
|
|
36
|
+
* Generates the commands needed to execute the block at runtime and gathers promises for initialization work
|
|
37
|
+
* @param initializationData - The initialization data to use
|
|
38
|
+
* @param finalOutput - Defines if the block is the final output of the smart filter
|
|
39
|
+
*/
|
|
40
|
+
generateCommandsAndGatherInitPromises(initializationData: InitializationData, finalOutput: boolean): void;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=outputBlock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outputBlock.d.ts","sourceRoot":"","sources":["../../src/blocks/outputBlock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAC3E,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAK3C;;;;;GAKG;AACH,qBAAa,WAAY,SAAQ,SAAS;IACtC;;OAEG;IACH,OAAuB,SAAS,SAAiB;IAEjD;;;OAGG;IACH,SAAgB,KAAK,4DAA6D;IAElF,OAAO,CAAC,UAAU,CAAmB;IAErC;;;OAGG;gBACS,WAAW,EAAE,WAAW;IAMpC,OAAO,CAAC,aAAa;IASrB;;OAEG;IACa,iBAAiB,IAAI,IAAI;IAQzC;;OAEG;IACa,oBAAoB,IAAI,IAAI;IAQ5C;;;;OAIG;IACa,qCAAqC,CACjD,kBAAkB,EAAE,kBAAkB,EACtC,WAAW,EAAE,OAAO,GACrB,IAAI;CAoBV"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { ConnectionPointType } from "../connection/connectionPointType.js";
|
|
2
|
+
import { BaseBlock } from "./baseBlock.js";
|
|
3
|
+
import { CopyBlock } from "./copyBlock.js";
|
|
4
|
+
import { ShaderRuntime } from "../runtime/shaderRuntime.js";
|
|
5
|
+
import { createCommand } from "../command/command.js";
|
|
6
|
+
/**
|
|
7
|
+
* The output block of a smart filter.
|
|
8
|
+
*
|
|
9
|
+
* Only the smart filter will internally create and host the output block.
|
|
10
|
+
* It should not be exported through the main index.ts module.
|
|
11
|
+
*/
|
|
12
|
+
export class OutputBlock extends BaseBlock {
|
|
13
|
+
/**
|
|
14
|
+
* Create a new output block.
|
|
15
|
+
* @param smartFilter - The smart filter this block belongs to
|
|
16
|
+
*/
|
|
17
|
+
constructor(smartFilter) {
|
|
18
|
+
super(smartFilter, "output");
|
|
19
|
+
/**
|
|
20
|
+
* Input connection point of the output block.
|
|
21
|
+
* This takes a texture as input.
|
|
22
|
+
*/
|
|
23
|
+
this.input = this._registerInput("input", ConnectionPointType.Texture);
|
|
24
|
+
this._copyBlock = null;
|
|
25
|
+
}
|
|
26
|
+
_getCopyBlock() {
|
|
27
|
+
if (!this._copyBlock) {
|
|
28
|
+
this._copyBlock = new CopyBlock(this.smartFilter, "copy");
|
|
29
|
+
this._copyBlock.input.runtimeData = this.input.runtimeData;
|
|
30
|
+
}
|
|
31
|
+
return this._copyBlock;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Prepares all blocks for runtime by traversing the graph.
|
|
35
|
+
*/
|
|
36
|
+
prepareForRuntime() {
|
|
37
|
+
this.visit({}, (block, _extraData) => {
|
|
38
|
+
if (block !== this) {
|
|
39
|
+
block.prepareForRuntime();
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Propagates the runtime data for all graph blocks.
|
|
45
|
+
*/
|
|
46
|
+
propagateRuntimeData() {
|
|
47
|
+
this.visit({}, (block, _extraData) => {
|
|
48
|
+
if (block !== this) {
|
|
49
|
+
block.propagateRuntimeData();
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Generates the commands needed to execute the block at runtime and gathers promises for initialization work
|
|
55
|
+
* @param initializationData - The initialization data to use
|
|
56
|
+
* @param finalOutput - Defines if the block is the final output of the smart filter
|
|
57
|
+
*/
|
|
58
|
+
generateCommandsAndGatherInitPromises(initializationData, finalOutput) {
|
|
59
|
+
const copyBlock = this._getCopyBlock();
|
|
60
|
+
const runtime = initializationData.runtime;
|
|
61
|
+
const shaderBlockRuntime = new ShaderRuntime(runtime.effectRenderer, copyBlock.getShaderProgram(), copyBlock.getShaderBinding());
|
|
62
|
+
initializationData.initializationPromises.push(shaderBlockRuntime.onReadyAsync);
|
|
63
|
+
runtime.registerResource(shaderBlockRuntime);
|
|
64
|
+
runtime.registerCommand(createCommand(`${this.getClassName()}.renderToCanvas`, this, () => {
|
|
65
|
+
shaderBlockRuntime.renderToCanvas();
|
|
66
|
+
}));
|
|
67
|
+
super.generateCommandsAndGatherInitPromises(initializationData, finalOutput);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* The class name of the block.
|
|
72
|
+
*/
|
|
73
|
+
OutputBlock.ClassName = "OutputBlock";
|
|
74
|
+
//# sourceMappingURL=outputBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outputBlock.js","sourceRoot":"","sources":["../../src/blocks/outputBlock.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAC3E,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD;;;;;GAKG;AACH,MAAM,OAAO,WAAY,SAAQ,SAAS;IActC;;;OAGG;IACH,YAAY,WAAwB;QAChC,KAAK,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;QAbjC;;;WAGG;QACa,UAAK,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAAC;QAW9E,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;IAC3B,CAAC;IAEO,aAAa;QACjB,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;YACnB,IAAI,CAAC,UAAU,GAAG,IAAI,SAAS,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;YAC1D,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC;QAC/D,CAAC;QAED,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IAED;;OAEG;IACa,iBAAiB;QAC7B,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,KAAgB,EAAE,UAAkB,EAAE,EAAE;YACpD,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;gBACjB,KAAK,CAAC,iBAAiB,EAAE,CAAC;YAC9B,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;IAED;;OAEG;IACa,oBAAoB;QAChC,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,KAAgB,EAAE,UAAkB,EAAE,EAAE;YACpD,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;gBACjB,KAAK,CAAC,oBAAoB,EAAE,CAAC;YACjC,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;IAED;;;;OAIG;IACa,qCAAqC,CACjD,kBAAsC,EACtC,WAAoB;QAEpB,MAAM,SAAS,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;QACvC,MAAM,OAAO,GAAG,kBAAkB,CAAC,OAAO,CAAC;QAE3C,MAAM,kBAAkB,GAAG,IAAI,aAAa,CACxC,OAAO,CAAC,cAAc,EACtB,SAAS,CAAC,gBAAgB,EAAE,EAC5B,SAAS,CAAC,gBAAgB,EAAE,CAC/B,CAAC;QACF,kBAAkB,CAAC,sBAAsB,CAAC,IAAI,CAAC,kBAAkB,CAAC,YAAY,CAAC,CAAC;QAChF,OAAO,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,CAAC;QAE7C,OAAO,CAAC,eAAe,CACnB,aAAa,CAAC,GAAG,IAAI,CAAC,YAAY,EAAE,iBAAiB,EAAE,IAAI,EAAE,GAAG,EAAE;YAC9D,kBAAkB,CAAC,cAAc,EAAE,CAAC;QACxC,CAAC,CAAC,CACL,CAAC;QAEF,KAAK,CAAC,qCAAqC,CAAC,kBAAkB,EAAE,WAAW,CAAC,CAAC;IACjF,CAAC;;AAjFD;;GAEG;AACoB,qBAAS,GAAG,aAAa,AAAhB,CAAiB"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import "@babylonjs/core/Engines/Extensions/engine.renderTarget.js";
|
|
2
|
+
import type { InitializationData, SmartFilter } from "../smartFilter";
|
|
3
|
+
import type { ShaderProgram } from "../utils/shaderCodeUtils";
|
|
4
|
+
import type { Binding } from "../runtime/shaderRuntime";
|
|
5
|
+
import type { ConnectionPoint } from "../connection/connectionPoint";
|
|
6
|
+
import { ConnectionPointType } from "../connection/connectionPointType.js";
|
|
7
|
+
import { DisableableBlock } from "./disableableBlock.js";
|
|
8
|
+
/**
|
|
9
|
+
* This is the base class for all shader blocks.
|
|
10
|
+
*
|
|
11
|
+
* It contains the redundant part of wrapping a shader for a full screen pass.
|
|
12
|
+
*
|
|
13
|
+
* The only required function to implement is the bind function.
|
|
14
|
+
*/
|
|
15
|
+
export declare abstract class ShaderBlock extends DisableableBlock {
|
|
16
|
+
/**
|
|
17
|
+
* The class name of the block.
|
|
18
|
+
*/
|
|
19
|
+
static ClassName: string;
|
|
20
|
+
/**
|
|
21
|
+
* Get the class instance that binds all the required data to the shader (effect) when rendering.
|
|
22
|
+
* It should throw an error if required inputs are missing.
|
|
23
|
+
* @returns The class instance that binds the data to the effect
|
|
24
|
+
*/
|
|
25
|
+
abstract getShaderBinding(): Binding;
|
|
26
|
+
/**
|
|
27
|
+
* The shader program (vertex and fragment code) to use to render the block
|
|
28
|
+
*/
|
|
29
|
+
static ShaderCode: ShaderProgram;
|
|
30
|
+
/**
|
|
31
|
+
* The output connection point of the block.
|
|
32
|
+
*/
|
|
33
|
+
readonly output: ConnectionPoint<ConnectionPointType.Texture>;
|
|
34
|
+
protected _textureRatio: number;
|
|
35
|
+
/**
|
|
36
|
+
* Gets the texture ratio of the output texture.
|
|
37
|
+
*/
|
|
38
|
+
get textureRatio(): number;
|
|
39
|
+
/**
|
|
40
|
+
* Sets the texture ratio of the output texture.
|
|
41
|
+
*/
|
|
42
|
+
set textureRatio(value: number);
|
|
43
|
+
/**
|
|
44
|
+
* Disconnects the block from the graph.
|
|
45
|
+
* @param disconnectedConnections - Stores the connections that have been broken in the process. You can reconnect them later if needed.
|
|
46
|
+
*/
|
|
47
|
+
disconnectFromGraph(disconnectedConnections?: [ConnectionPoint, ConnectionPoint][]): void;
|
|
48
|
+
protected _getConnectionForMainInputTexture(): ConnectionPoint;
|
|
49
|
+
/**
|
|
50
|
+
* Instantiates a new block.
|
|
51
|
+
* @param smartFilter - Defines the smart filter the block belongs to
|
|
52
|
+
* @param name - Defines the name of the block
|
|
53
|
+
* @param disableOptimization - Defines if the block should not be optimized (default: false)
|
|
54
|
+
*/
|
|
55
|
+
constructor(smartFilter: SmartFilter, name: string, disableOptimization?: boolean);
|
|
56
|
+
/**
|
|
57
|
+
* Gets the shader program to use to render the block.
|
|
58
|
+
* @returns The shader program to use to render the block
|
|
59
|
+
*/
|
|
60
|
+
getShaderProgram(): ShaderProgram;
|
|
61
|
+
/**
|
|
62
|
+
* Generates the commands needed to execute the block at runtime and gathers promises for initialization work
|
|
63
|
+
* @param initializationData - The initialization data to use
|
|
64
|
+
* @param finalOutput - Defines if the block is the final output of the smart filter
|
|
65
|
+
*/
|
|
66
|
+
generateCommandsAndGatherInitPromises(initializationData: InitializationData, finalOutput: boolean): void;
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=shaderBlock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shaderBlock.d.ts","sourceRoot":"","sources":["../../src/blocks/shaderBlock.ts"],"names":[],"mappings":"AACA,OAAO,2DAA2D,CAAC;AAEnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAErE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAE3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAGzD;;;;;;GAMG;AACH,8BAAsB,WAAY,SAAQ,gBAAgB;IACtD;;OAEG;IACH,OAAuB,SAAS,SAAiB;IAEjD;;;;OAIG;aACa,gBAAgB,IAAI,OAAO;IAE3C;;OAEG;IACH,OAAc,UAAU,EAAE,aAAa,CAAC;IAExC;;OAEG;IACH,SAAgB,MAAM,+CAA+D;IAErF,SAAS,CAAC,aAAa,EAAE,MAAM,CAAK;IAEpC;;OAEG;IACH,IAAW,YAAY,IAOQ,MAAM,CALpC;IAED;;OAEG;IACH,IAAW,YAAY,CAAC,KAAK,EAAE,MAAM,EAEpC;IAED;;;OAGG;IACa,mBAAmB,CAAC,uBAAuB,CAAC,EAAE,CAAC,eAAe,EAAE,eAAe,CAAC,EAAE,GAAG,IAAI;IASzG,SAAS,CAAC,iCAAiC,IAAI,eAAe;IAc9D;;;;;OAKG;gBACS,WAAW,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,mBAAmB,UAAQ;IAI/E;;;OAGG;IACI,gBAAgB;IAIvB;;;;OAIG;IACa,qCAAqC,CACjD,kBAAkB,EAAE,kBAAkB,EACtC,WAAW,EAAE,OAAO,GACrB,IAAI;CAgCV"}
|