@onerjs/smart-filters-blocks 8.25.1 → 8.25.3
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/blocks/babylon/demo/effects/blackAndWhiteBlock.block.d.ts +34 -0
- package/dist/blocks/babylon/demo/effects/blackAndWhiteBlock.block.d.ts.map +1 -0
- package/dist/blocks/babylon/demo/effects/blackAndWhiteBlock.block.js +100 -0
- package/dist/blocks/babylon/demo/effects/blackAndWhiteBlock.block.js.map +1 -0
- package/dist/blocks/babylon/demo/effects/blurBlock.d.ts +53 -0
- package/dist/blocks/babylon/demo/effects/blurBlock.d.ts.map +1 -0
- package/dist/blocks/babylon/demo/effects/blurBlock.deserializer.d.ts +28 -0
- package/dist/blocks/babylon/demo/effects/blurBlock.deserializer.d.ts.map +1 -0
- package/dist/blocks/babylon/demo/effects/blurBlock.deserializer.js +15 -0
- package/dist/blocks/babylon/demo/effects/blurBlock.deserializer.js.map +1 -0
- package/dist/blocks/babylon/demo/effects/blurBlock.js +93 -0
- package/dist/blocks/babylon/demo/effects/blurBlock.js.map +1 -0
- package/dist/blocks/babylon/demo/effects/blurBlock.serializer.d.ts +8 -0
- package/dist/blocks/babylon/demo/effects/blurBlock.serializer.d.ts.map +1 -0
- package/dist/blocks/babylon/demo/effects/blurBlock.serializer.js +28 -0
- package/dist/blocks/babylon/demo/effects/blurBlock.serializer.js.map +1 -0
- package/dist/blocks/babylon/demo/effects/compositionBlock.d.ts +116 -0
- package/dist/blocks/babylon/demo/effects/compositionBlock.d.ts.map +1 -0
- package/dist/blocks/babylon/demo/effects/compositionBlock.deserializer.d.ts +24 -0
- package/dist/blocks/babylon/demo/effects/compositionBlock.deserializer.d.ts.map +1 -0
- package/dist/blocks/babylon/demo/effects/compositionBlock.deserializer.js +14 -0
- package/dist/blocks/babylon/demo/effects/compositionBlock.deserializer.js.map +1 -0
- package/dist/blocks/babylon/demo/effects/compositionBlock.fragment.d.ts +20 -0
- package/dist/blocks/babylon/demo/effects/compositionBlock.fragment.d.ts.map +1 -0
- package/dist/blocks/babylon/demo/effects/compositionBlock.fragment.js +71 -0
- package/dist/blocks/babylon/demo/effects/compositionBlock.fragment.js.map +1 -0
- package/dist/blocks/babylon/demo/effects/compositionBlock.js +163 -0
- package/dist/blocks/babylon/demo/effects/compositionBlock.js.map +1 -0
- package/dist/blocks/babylon/demo/effects/compositionBlock.serializer.d.ts +6 -0
- package/dist/blocks/babylon/demo/effects/compositionBlock.serializer.d.ts.map +1 -0
- package/dist/blocks/babylon/demo/effects/compositionBlock.serializer.js +25 -0
- package/dist/blocks/babylon/demo/effects/compositionBlock.serializer.js.map +1 -0
- package/dist/blocks/babylon/demo/effects/contrastBlock.block.d.ts +39 -0
- package/dist/blocks/babylon/demo/effects/contrastBlock.block.d.ts.map +1 -0
- package/dist/blocks/babylon/demo/effects/contrastBlock.block.js +137 -0
- package/dist/blocks/babylon/demo/effects/contrastBlock.block.js.map +1 -0
- package/dist/blocks/babylon/demo/effects/desaturateBlock.block.d.ts +39 -0
- package/dist/blocks/babylon/demo/effects/desaturateBlock.block.d.ts.map +1 -0
- package/dist/blocks/babylon/demo/effects/desaturateBlock.block.js +114 -0
- package/dist/blocks/babylon/demo/effects/desaturateBlock.block.js.map +1 -0
- package/dist/blocks/babylon/demo/effects/directionalBlurBlock.d.ts +76 -0
- package/dist/blocks/babylon/demo/effects/directionalBlurBlock.d.ts.map +1 -0
- package/dist/blocks/babylon/demo/effects/directionalBlurBlock.deserializer.d.ts +32 -0
- package/dist/blocks/babylon/demo/effects/directionalBlurBlock.deserializer.d.ts.map +1 -0
- package/dist/blocks/babylon/demo/effects/directionalBlurBlock.deserializer.js +16 -0
- package/dist/blocks/babylon/demo/effects/directionalBlurBlock.deserializer.js.map +1 -0
- package/dist/blocks/babylon/demo/effects/directionalBlurBlock.js +162 -0
- package/dist/blocks/babylon/demo/effects/directionalBlurBlock.js.map +1 -0
- package/dist/blocks/babylon/demo/effects/directionalBlurBlock.serializer.d.ts +6 -0
- package/dist/blocks/babylon/demo/effects/directionalBlurBlock.serializer.d.ts.map +1 -0
- package/dist/blocks/babylon/demo/effects/directionalBlurBlock.serializer.js +27 -0
- package/dist/blocks/babylon/demo/effects/directionalBlurBlock.serializer.js.map +1 -0
- package/dist/blocks/babylon/demo/effects/exposureBlock.block.d.ts +38 -0
- package/dist/blocks/babylon/demo/effects/exposureBlock.block.d.ts.map +1 -0
- package/dist/blocks/babylon/demo/effects/exposureBlock.block.js +106 -0
- package/dist/blocks/babylon/demo/effects/exposureBlock.block.js.map +1 -0
- package/dist/blocks/babylon/demo/effects/greenScreenBlock.block.d.ts +46 -0
- package/dist/blocks/babylon/demo/effects/greenScreenBlock.block.d.ts.map +1 -0
- package/dist/blocks/babylon/demo/effects/greenScreenBlock.block.js +132 -0
- package/dist/blocks/babylon/demo/effects/greenScreenBlock.block.js.map +1 -0
- package/dist/blocks/babylon/demo/effects/index.d.ts +15 -0
- package/dist/blocks/babylon/demo/effects/index.d.ts.map +1 -0
- package/dist/blocks/babylon/demo/effects/index.js +15 -0
- package/dist/blocks/babylon/demo/effects/index.js.map +1 -0
- package/dist/blocks/babylon/demo/effects/kaleidoscopeBlock.d.ts +63 -0
- package/dist/blocks/babylon/demo/effects/kaleidoscopeBlock.d.ts.map +1 -0
- package/dist/blocks/babylon/demo/effects/kaleidoscopeBlock.js +158 -0
- package/dist/blocks/babylon/demo/effects/kaleidoscopeBlock.js.map +1 -0
- package/dist/blocks/babylon/demo/effects/maskBlock.block.d.ts +38 -0
- package/dist/blocks/babylon/demo/effects/maskBlock.block.d.ts.map +1 -0
- package/dist/blocks/babylon/demo/effects/maskBlock.block.js +109 -0
- package/dist/blocks/babylon/demo/effects/maskBlock.block.js.map +1 -0
- package/dist/blocks/babylon/demo/effects/pixelateBlock.block.d.ts +44 -0
- package/dist/blocks/babylon/demo/effects/pixelateBlock.block.d.ts.map +1 -0
- package/dist/blocks/babylon/demo/effects/pixelateBlock.block.js +129 -0
- package/dist/blocks/babylon/demo/effects/pixelateBlock.block.js.map +1 -0
- package/dist/blocks/babylon/demo/effects/posterizeBlock.block.d.ts +39 -0
- package/dist/blocks/babylon/demo/effects/posterizeBlock.block.d.ts.map +1 -0
- package/dist/blocks/babylon/demo/effects/posterizeBlock.block.js +115 -0
- package/dist/blocks/babylon/demo/effects/posterizeBlock.block.js.map +1 -0
- package/dist/blocks/babylon/demo/effects/spritesheetBlock.d.ts +77 -0
- package/dist/blocks/babylon/demo/effects/spritesheetBlock.d.ts.map +1 -0
- package/dist/blocks/babylon/demo/effects/spritesheetBlock.fragment.d.ts +20 -0
- package/dist/blocks/babylon/demo/effects/spritesheetBlock.fragment.d.ts.map +1 -0
- package/dist/blocks/babylon/demo/effects/spritesheetBlock.fragment.js +60 -0
- package/dist/blocks/babylon/demo/effects/spritesheetBlock.fragment.js.map +1 -0
- package/dist/blocks/babylon/demo/effects/spritesheetBlock.js +98 -0
- package/dist/blocks/babylon/demo/effects/spritesheetBlock.js.map +1 -0
- package/dist/blocks/babylon/demo/effects/tintBlock.d.ts +7 -0
- package/dist/blocks/babylon/demo/effects/tintBlock.d.ts.map +1 -0
- package/dist/blocks/babylon/demo/effects/tintBlock.js +51 -0
- package/dist/blocks/babylon/demo/effects/tintBlock.js.map +1 -0
- package/dist/blocks/babylon/demo/transitions/index.d.ts +2 -0
- package/dist/blocks/babylon/demo/transitions/index.d.ts.map +1 -0
- package/dist/blocks/babylon/demo/transitions/index.js +2 -0
- package/dist/blocks/babylon/demo/transitions/index.js.map +1 -0
- package/dist/blocks/babylon/demo/transitions/wipeBlock.block.d.ts +42 -0
- package/dist/blocks/babylon/demo/transitions/wipeBlock.block.d.ts.map +1 -0
- package/dist/blocks/babylon/demo/transitions/wipeBlock.block.js +115 -0
- package/dist/blocks/babylon/demo/transitions/wipeBlock.block.js.map +1 -0
- package/dist/blocks/babylon/demo/utilities/index.d.ts +2 -0
- package/dist/blocks/babylon/demo/utilities/index.d.ts.map +1 -0
- package/dist/blocks/babylon/demo/utilities/index.js +2 -0
- package/dist/blocks/babylon/demo/utilities/index.js.map +1 -0
- package/dist/blocks/babylon/demo/utilities/premultiplyAlphaBlock.block.d.ts +34 -0
- package/dist/blocks/babylon/demo/utilities/premultiplyAlphaBlock.block.d.ts.map +1 -0
- package/dist/blocks/babylon/demo/utilities/premultiplyAlphaBlock.block.js +96 -0
- package/dist/blocks/babylon/demo/utilities/premultiplyAlphaBlock.block.js.map +1 -0
- package/dist/blocks/blockNamespaces.d.ts +5 -0
- package/dist/blocks/blockNamespaces.d.ts.map +1 -0
- package/dist/blocks/blockNamespaces.js +7 -0
- package/dist/blocks/blockNamespaces.js.map +1 -0
- package/dist/blocks/blockTypes.d.ts +22 -0
- package/dist/blocks/blockTypes.d.ts.map +1 -0
- package/dist/blocks/blockTypes.js +24 -0
- package/dist/blocks/blockTypes.js.map +1 -0
- package/dist/blocks/index.d.ts +6 -0
- package/dist/blocks/index.d.ts.map +1 -0
- package/dist/blocks/index.js +7 -0
- package/dist/blocks/index.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/registration/IBlockRegistration.d.ts +38 -0
- package/dist/registration/IBlockRegistration.d.ts.map +1 -0
- package/dist/registration/IBlockRegistration.js +2 -0
- package/dist/registration/IBlockRegistration.js.map +1 -0
- package/dist/registration/blockSerializers.d.ts +13 -0
- package/dist/registration/blockSerializers.d.ts.map +1 -0
- package/dist/registration/blockSerializers.js +33 -0
- package/dist/registration/blockSerializers.js.map +1 -0
- package/dist/registration/builtInBlockRegistrations.d.ts +13 -0
- package/dist/registration/builtInBlockRegistrations.d.ts.map +1 -0
- package/dist/registration/builtInBlockRegistrations.js +273 -0
- package/dist/registration/builtInBlockRegistrations.js.map +1 -0
- package/dist/registration/index.d.ts +4 -0
- package/dist/registration/index.d.ts.map +1 -0
- package/dist/registration/index.js +5 -0
- package/dist/registration/index.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { DisableableShaderBinding, ConnectionPointType, type SmartFilter, DisableableShaderBlock, type ShaderProgram } from "@onerjs/smart-filters";
|
|
2
|
+
/**
|
|
3
|
+
* The implementation of the BlackAndWhiteBlock
|
|
4
|
+
*/
|
|
5
|
+
export declare class BlackAndWhiteBlock extends DisableableShaderBlock {
|
|
6
|
+
/**
|
|
7
|
+
* The class name of the block.
|
|
8
|
+
*/
|
|
9
|
+
static ClassName: string;
|
|
10
|
+
/**
|
|
11
|
+
* The namespace of the block.
|
|
12
|
+
*/
|
|
13
|
+
static Namespace: string;
|
|
14
|
+
/**
|
|
15
|
+
* The input connection point.
|
|
16
|
+
*/
|
|
17
|
+
readonly input: import("@onerjs/smart-filters").ConnectionPoint<ConnectionPointType.Texture>;
|
|
18
|
+
/**
|
|
19
|
+
* The shader program (vertex and fragment code) to use to render the block
|
|
20
|
+
*/
|
|
21
|
+
static ShaderCode: ShaderProgram;
|
|
22
|
+
/**
|
|
23
|
+
* Instantiates a new BlackAndWhiteBlock.
|
|
24
|
+
* @param smartFilter - The smart filter this block belongs to
|
|
25
|
+
* @param name - The friendly name of the block
|
|
26
|
+
*/
|
|
27
|
+
constructor(smartFilter: SmartFilter, name: string);
|
|
28
|
+
/**
|
|
29
|
+
* Get the class instance that binds all the required data to the shader (effect) when rendering.
|
|
30
|
+
* @returns The class instance that binds the data to the effect
|
|
31
|
+
*/
|
|
32
|
+
getShaderBinding(): DisableableShaderBinding;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=blackAndWhiteBlock.block.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blackAndWhiteBlock.block.d.ts","sourceRoot":"","sources":["../../../../../src/blocks/babylon/demo/effects/blackAndWhiteBlock.block.ts"],"names":[],"mappings":"AAYA,OAAO,EACH,wBAAwB,EAExB,mBAAmB,EACnB,KAAK,WAAW,EAChB,sBAAsB,EACtB,KAAK,aAAa,EAEG,8BAAsB;AAqE/C;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,sBAAsB;IAC1D;;OAEG;IACH,OAAuB,SAAS,SAAwB;IAExD;;OAEG;IACH,OAAuB,SAAS,SAA0B;IAE1D;;OAEG;IACH,SAAgB,KAAK,+EAAoE;IAEzF;;OAEG;IACH,OAAuB,UAAU,gBAAsB;IAEvD;;;;OAIG;gBACS,WAAW,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM;IAIlD;;;OAGG;IACI,gBAAgB,IAAI,wBAAwB;CAKtD"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/* eslint-disable prettier/prettier */
|
|
2
|
+
// ************************************************************
|
|
3
|
+
// Note: this file is auto-generated, do not modify it directly
|
|
4
|
+
// ************************************************************
|
|
5
|
+
import { DisableableShaderBinding, ConnectionPointType, DisableableShaderBlock, BlockDisableStrategy } from "@onerjs/smart-filters";
|
|
6
|
+
/**
|
|
7
|
+
* The shader program for the block.
|
|
8
|
+
*/
|
|
9
|
+
const BlockShaderProgram = {
|
|
10
|
+
vertex: undefined,
|
|
11
|
+
fragment: {
|
|
12
|
+
uniform: `
|
|
13
|
+
uniform sampler2D _input_; // main`,
|
|
14
|
+
mainInputTexture: "_input_",
|
|
15
|
+
mainFunctionName: "_blackAndWhite_",
|
|
16
|
+
functions: [
|
|
17
|
+
{
|
|
18
|
+
name: "_blackAndWhite_",
|
|
19
|
+
code: `
|
|
20
|
+
vec4 _blackAndWhite_(vec2 vUV) {
|
|
21
|
+
vec4 color = texture2D(_input_, vUV);
|
|
22
|
+
|
|
23
|
+
float luminance = dot(color.rgb, vec3(0.3, 0.59, 0.11));
|
|
24
|
+
vec3 bg = vec3(luminance, luminance, luminance);
|
|
25
|
+
|
|
26
|
+
return vec4(bg, color.a);
|
|
27
|
+
}
|
|
28
|
+
`,
|
|
29
|
+
params: "vec2 vUV",
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* The uniform names for this shader, to be used in the shader binding so
|
|
36
|
+
* that the names are always in sync.
|
|
37
|
+
*/
|
|
38
|
+
const Uniforms = {
|
|
39
|
+
input: "input",
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* The shader binding for the BlackAndWhiteBlock, used by the runtime
|
|
43
|
+
*/
|
|
44
|
+
class BlackAndWhiteBlockShaderBinding extends DisableableShaderBinding {
|
|
45
|
+
/**
|
|
46
|
+
* Creates a new shader binding instance for the block.
|
|
47
|
+
* @param parentBlock - IDisableableBlock
|
|
48
|
+
* @param input - The input runtime value
|
|
49
|
+
*/
|
|
50
|
+
constructor(parentBlock, input) {
|
|
51
|
+
super(parentBlock);
|
|
52
|
+
this._input = input;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Binds all the required data to the shader when rendering.
|
|
56
|
+
* @param effect - defines the effect to bind the data to
|
|
57
|
+
*/
|
|
58
|
+
bind(effect) {
|
|
59
|
+
super.bind(effect);
|
|
60
|
+
effect.setTexture(this.getRemappedName(Uniforms.input), this._input.value);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* The implementation of the BlackAndWhiteBlock
|
|
65
|
+
*/
|
|
66
|
+
export class BlackAndWhiteBlock extends DisableableShaderBlock {
|
|
67
|
+
/**
|
|
68
|
+
* Instantiates a new BlackAndWhiteBlock.
|
|
69
|
+
* @param smartFilter - The smart filter this block belongs to
|
|
70
|
+
* @param name - The friendly name of the block
|
|
71
|
+
*/
|
|
72
|
+
constructor(smartFilter, name) {
|
|
73
|
+
super(smartFilter, name, false, BlockDisableStrategy.AutoSample);
|
|
74
|
+
/**
|
|
75
|
+
* The input connection point.
|
|
76
|
+
*/
|
|
77
|
+
this.input = this._registerInput(Uniforms.input, ConnectionPointType.Texture);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Get the class instance that binds all the required data to the shader (effect) when rendering.
|
|
81
|
+
* @returns The class instance that binds the data to the effect
|
|
82
|
+
*/
|
|
83
|
+
getShaderBinding() {
|
|
84
|
+
const input = this._confirmRuntimeDataSupplied(this.input);
|
|
85
|
+
return new BlackAndWhiteBlockShaderBinding(this, input);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* The class name of the block.
|
|
90
|
+
*/
|
|
91
|
+
BlackAndWhiteBlock.ClassName = "BlackAndWhiteBlock";
|
|
92
|
+
/**
|
|
93
|
+
* The namespace of the block.
|
|
94
|
+
*/
|
|
95
|
+
BlackAndWhiteBlock.Namespace = "Babylon.Demo.Effects";
|
|
96
|
+
/**
|
|
97
|
+
* The shader program (vertex and fragment code) to use to render the block
|
|
98
|
+
*/
|
|
99
|
+
BlackAndWhiteBlock.ShaderCode = BlockShaderProgram;
|
|
100
|
+
//# sourceMappingURL=blackAndWhiteBlock.block.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blackAndWhiteBlock.block.js","sourceRoot":"","sources":["../../../../../src/blocks/babylon/demo/effects/blackAndWhiteBlock.block.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,+DAA+D;AAC/D,+DAA+D;AAC/D,+DAA+D;AAS/D,OAAO,EACH,wBAAwB,EAExB,mBAAmB,EAEnB,sBAAsB,EAGtB,oBAAoB,EAAC,8BAAsB;AAE/C;;GAEG;AACH,MAAM,kBAAkB,GAAkB;IACtC,MAAM,EAAE,SAAS;IACjB,QAAQ,EAAE;QACN,OAAO,EAAE;+CAC8B;QACvC,gBAAgB,EAAE,SAAS;QAC3B,gBAAgB,EAAE,iBAAiB;QACnC,SAAS,EAAE;YACP;gBACI,IAAI,EAAE,iBAAiB;gBACvB,IAAI,EAAE;;;;;;;;;qBASD;gBACL,MAAM,EAAE,UAAU;aACrB;SACJ;KACJ;CACJ,CAAC;AAEF;;;GAGG;AACH,MAAM,QAAQ,GAAG;IACb,KAAK,EAAE,OAAO;CACjB,CAAC;AAGF;;GAEG;AACH,MAAM,+BAAgC,SAAQ,wBAAwB;IAGlE;;;;OAIG;IACH,YACI,WAA8B,EAC9B,KAA+C;QAE/C,KAAK,CAAC,WAAW,CAAC,CAAC;QACnB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACxB,CAAC;IAED;;;OAGG;IACa,IAAI,CAAC,MAAc;QAC/B,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACnB,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC/E,CAAC;CACJ;AAED;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,sBAAsB;IAqB1D;;;;OAIG;IACH,YAAY,WAAwB,EAAE,IAAY;QAC9C,KAAK,CAAC,WAAW,EAAE,IAAI,EAAE,KAAK,EAAE,oBAAoB,CAAC,UAAU,CAAC,CAAC;QAhBrE;;WAEG;QACa,UAAK,GAAG,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,KAAK,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAAC;IAczF,CAAC;IAED;;;OAGG;IACI,gBAAgB;QACnB,MAAM,KAAK,GAAG,IAAI,CAAC,2BAA2B,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAE3D,OAAO,IAAI,+BAA+B,CAAC,IAAI,EAAC,KAAK,CAAC,CAAC;IAC3D,CAAC;;AArCD;;GAEG;AACoB,4BAAS,GAAG,oBAAoB,AAAvB,CAAwB;AAExD;;GAEG;AACoB,4BAAS,GAAG,sBAAsB,AAAzB,CAA0B;AAO1D;;GAEG;AACoB,6BAAU,GAAG,kBAAkB,AAArB,CAAsB"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { type ConnectionPointType, AggregateBlock, type ConnectionPoint, SmartFilter } from "@onerjs/smart-filters";
|
|
2
|
+
/**
|
|
3
|
+
* A block performing a blur on the input texture.
|
|
4
|
+
*
|
|
5
|
+
* It performs the blur in 4 consecutive passes, 2 verticals and 2 horizontals downsizing the texture as we go.
|
|
6
|
+
*/
|
|
7
|
+
export declare class BlurBlock extends AggregateBlock {
|
|
8
|
+
/**
|
|
9
|
+
* The class name of the block.
|
|
10
|
+
*/
|
|
11
|
+
static ClassName: string;
|
|
12
|
+
/**
|
|
13
|
+
* The namespace of the block.
|
|
14
|
+
*/
|
|
15
|
+
static Namespace: string;
|
|
16
|
+
/**
|
|
17
|
+
* The input texture connection point.
|
|
18
|
+
*/
|
|
19
|
+
readonly input: ConnectionPoint<ConnectionPointType.Texture>;
|
|
20
|
+
/**
|
|
21
|
+
* The output blurred texture connection point.
|
|
22
|
+
*/
|
|
23
|
+
readonly output: ConnectionPoint<ConnectionPointType.Texture>;
|
|
24
|
+
private _blurTextureRatioPerPass;
|
|
25
|
+
private _blurSize;
|
|
26
|
+
private readonly _intermediateBlurV;
|
|
27
|
+
private readonly _intermediateBlurH;
|
|
28
|
+
private readonly _finalBlurV;
|
|
29
|
+
private readonly _finalBlurH;
|
|
30
|
+
/**
|
|
31
|
+
* Gets how much smaller we should make the texture between the 2 consecutive bi lateral passes.
|
|
32
|
+
*/
|
|
33
|
+
get blurTextureRatioPerPass(): number;
|
|
34
|
+
/**
|
|
35
|
+
* Sets how much smaller we should make the texture between the 2 consecutive bi lateral passes.
|
|
36
|
+
*/
|
|
37
|
+
set blurTextureRatioPerPass(value: number);
|
|
38
|
+
/**
|
|
39
|
+
* Gets how far the kernel might fetch the data from.
|
|
40
|
+
*/
|
|
41
|
+
get blurSize(): number;
|
|
42
|
+
/**
|
|
43
|
+
* Sets how far the kernel might fetch the data from.
|
|
44
|
+
*/
|
|
45
|
+
set blurSize(value: number);
|
|
46
|
+
/**
|
|
47
|
+
* Instantiates a new Block.
|
|
48
|
+
* @param smartFilter - The smart filter this block belongs to
|
|
49
|
+
* @param name - The friendly name of the block
|
|
50
|
+
*/
|
|
51
|
+
constructor(smartFilter: SmartFilter, name: string);
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=blurBlock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blurBlock.d.ts","sourceRoot":"","sources":["../../../../../src/blocks/babylon/demo/effects/blurBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,mBAAmB,EAAE,cAAc,EAAE,KAAK,eAAe,EAAkD,WAAW,EAAE,8BAAsB;AAQ5J;;;;GAIG;AACH,qBAAa,SAAU,SAAQ,cAAc;IACzC;;OAEG;IACH,OAAuB,SAAS,SAAiB;IAEjD;;OAEG;IACH,OAAuB,SAAS,SAA+B;IAE/D;;OAEG;IACH,SAAgB,KAAK,EAAE,eAAe,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;IAEpE;;OAEG;IACH,SAAgB,MAAM,EAAE,eAAe,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;IAErE,OAAO,CAAC,wBAAwB,CAAkC;IAClE,OAAO,CAAC,SAAS,CAAmB;IAEpC,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAuB;IAC1D,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAuB;IAC1D,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAuB;IACnD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAuB;IAEnD;;OAEG;IACH,IAAW,uBAAuB,IAAI,MAAM,CAE3C;IAED;;OAEG;IACH,IAKW,uBAAuB,CAAC,KAAK,EAAE,MAAM,EAM/C;IAED;;OAEG;IACH,IAAW,QAAQ,IAAI,MAAM,CAE5B;IAED;;OAEG;IACH,IAGW,QAAQ,CAAC,KAAK,EAAE,MAAM,EAMhC;IAED;;;;OAIG;gBACS,WAAW,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM;CAuBrD"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type SmartFilter, type ISerializedBlockV1 } from "@onerjs/smart-filters";
|
|
2
|
+
import { BlurBlock } from "./blurBlock.js";
|
|
3
|
+
/**
|
|
4
|
+
* The definition of the extra data serialized for blur blocks.
|
|
5
|
+
*/
|
|
6
|
+
export interface ISerializedBlurBlockV1 extends ISerializedBlockV1 {
|
|
7
|
+
/**
|
|
8
|
+
* The extra data of the block.
|
|
9
|
+
*/
|
|
10
|
+
data: {
|
|
11
|
+
/**
|
|
12
|
+
* The blur texture ratio per pass.
|
|
13
|
+
*/
|
|
14
|
+
blurTextureRatioPerPass: number;
|
|
15
|
+
/**
|
|
16
|
+
* The size of the blur.
|
|
17
|
+
*/
|
|
18
|
+
blurSize: number;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* V1 Blur Deserializer.
|
|
23
|
+
* @param smartFilter - The SmartFilter to deserialize the block into
|
|
24
|
+
* @param serializedBlock - The serialized block data
|
|
25
|
+
* @returns A deserialized BlurBlock
|
|
26
|
+
*/
|
|
27
|
+
export declare function BlurBlockDeserializer(smartFilter: SmartFilter, serializedBlock: ISerializedBlurBlockV1): BlurBlock;
|
|
28
|
+
//# sourceMappingURL=blurBlock.deserializer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blurBlock.deserializer.d.ts","sourceRoot":"","sources":["../../../../../src/blocks/babylon/demo/effects/blurBlock.deserializer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,kBAAkB,EAAE,8BAAsB;AAC1E,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C;;GAEG;AACH,MAAM,WAAW,sBAAuB,SAAQ,kBAAkB;IAC9D;;OAEG;IACH,IAAI,EAAE;QACF;;WAEG;QACH,uBAAuB,EAAE,MAAM,CAAC;QAEhC;;WAEG;QACH,QAAQ,EAAE,MAAM,CAAC;KACpB,CAAC;CACL;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,WAAW,EAAE,eAAe,EAAE,sBAAsB,aAOtG"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BlurBlock } from "./blurBlock.js";
|
|
2
|
+
/**
|
|
3
|
+
* V1 Blur Deserializer.
|
|
4
|
+
* @param smartFilter - The SmartFilter to deserialize the block into
|
|
5
|
+
* @param serializedBlock - The serialized block data
|
|
6
|
+
* @returns A deserialized BlurBlock
|
|
7
|
+
*/
|
|
8
|
+
export function BlurBlockDeserializer(smartFilter, serializedBlock) {
|
|
9
|
+
const block = new BlurBlock(smartFilter, serializedBlock.name);
|
|
10
|
+
// If data is missing, use the default value set by the block
|
|
11
|
+
block.blurTextureRatioPerPass = serializedBlock.data.blurTextureRatioPerPass ?? block.blurSize;
|
|
12
|
+
block.blurSize = serializedBlock.data.blurSize ?? block.blurSize;
|
|
13
|
+
return block;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=blurBlock.deserializer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blurBlock.deserializer.js","sourceRoot":"","sources":["../../../../../src/blocks/babylon/demo/effects/blurBlock.deserializer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAsB3C;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CAAC,WAAwB,EAAE,eAAuC;IACnG,MAAM,KAAK,GAAG,IAAI,SAAS,CAAC,WAAW,EAAE,eAAe,CAAC,IAAI,CAAC,CAAC;IAE/D,6DAA6D;IAC7D,KAAK,CAAC,uBAAuB,GAAG,eAAe,CAAC,IAAI,CAAC,uBAAuB,IAAI,KAAK,CAAC,QAAQ,CAAC;IAC/F,KAAK,CAAC,QAAQ,GAAG,eAAe,CAAC,IAAI,CAAC,QAAQ,IAAI,KAAK,CAAC,QAAQ,CAAC;IACjE,OAAO,KAAK,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { __decorate } from "@onerjs/core/tslib.es6.js";
|
|
2
|
+
import { AggregateBlock, editableInPropertyPage, PropertyTypeForEdition, SmartFilter } from "@onerjs/smart-filters";
|
|
3
|
+
import { DirectionalBlurBlock } from "./directionalBlurBlock.js";
|
|
4
|
+
import { blurBlockType } from "../../../blockTypes.js";
|
|
5
|
+
import { babylonDemoEffectsNamespace } from "../../../blockNamespaces.js";
|
|
6
|
+
const DefaultBlurTextureRatioPerPass = 0.5;
|
|
7
|
+
const DefaultBlurSize = 2;
|
|
8
|
+
/**
|
|
9
|
+
* A block performing a blur on the input texture.
|
|
10
|
+
*
|
|
11
|
+
* It performs the blur in 4 consecutive passes, 2 verticals and 2 horizontals downsizing the texture as we go.
|
|
12
|
+
*/
|
|
13
|
+
export class BlurBlock extends AggregateBlock {
|
|
14
|
+
/**
|
|
15
|
+
* Gets how much smaller we should make the texture between the 2 consecutive bi lateral passes.
|
|
16
|
+
*/
|
|
17
|
+
get blurTextureRatioPerPass() {
|
|
18
|
+
return this._blurTextureRatioPerPass;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Sets how much smaller we should make the texture between the 2 consecutive bi lateral passes.
|
|
22
|
+
*/
|
|
23
|
+
set blurTextureRatioPerPass(value) {
|
|
24
|
+
this._blurTextureRatioPerPass = value;
|
|
25
|
+
this._intermediateBlurV.blurTextureRatio = value;
|
|
26
|
+
this._intermediateBlurH.blurTextureRatio = value;
|
|
27
|
+
this._finalBlurV.blurTextureRatio = value * value;
|
|
28
|
+
this._finalBlurH.blurTextureRatio = value * value;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Gets how far the kernel might fetch the data from.
|
|
32
|
+
*/
|
|
33
|
+
get blurSize() {
|
|
34
|
+
return this._blurSize;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Sets how far the kernel might fetch the data from.
|
|
38
|
+
*/
|
|
39
|
+
set blurSize(value) {
|
|
40
|
+
this._blurSize = value;
|
|
41
|
+
this._intermediateBlurV.blurHorizontalWidth = value;
|
|
42
|
+
this._intermediateBlurH.blurVerticalWidth = value;
|
|
43
|
+
this._finalBlurV.blurHorizontalWidth = value;
|
|
44
|
+
this._finalBlurH.blurVerticalWidth = value;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Instantiates a new Block.
|
|
48
|
+
* @param smartFilter - The smart filter this block belongs to
|
|
49
|
+
* @param name - The friendly name of the block
|
|
50
|
+
*/
|
|
51
|
+
constructor(smartFilter, name) {
|
|
52
|
+
super(smartFilter, name);
|
|
53
|
+
this._blurTextureRatioPerPass = DefaultBlurTextureRatioPerPass;
|
|
54
|
+
this._blurSize = DefaultBlurSize;
|
|
55
|
+
const internalFilter = new SmartFilter(name + "_BlurBlock_Aggregated");
|
|
56
|
+
this._intermediateBlurV = new DirectionalBlurBlock(internalFilter, name + "IV");
|
|
57
|
+
this._intermediateBlurH = new DirectionalBlurBlock(internalFilter, name + "IH");
|
|
58
|
+
this._finalBlurV = new DirectionalBlurBlock(internalFilter, name + "V");
|
|
59
|
+
this._finalBlurH = new DirectionalBlurBlock(internalFilter, name + "H");
|
|
60
|
+
this._intermediateBlurV.output.connectTo(this._intermediateBlurH.input);
|
|
61
|
+
this._intermediateBlurH.output.connectTo(this._finalBlurV.input);
|
|
62
|
+
this._finalBlurV.output.connectTo(this._finalBlurH.input);
|
|
63
|
+
this.input = this._registerSubfilterInput("input", [this._intermediateBlurV.input]);
|
|
64
|
+
this.output = this._registerSubfilterOutput("output", this._finalBlurH.output);
|
|
65
|
+
this.blurSize = DefaultBlurSize;
|
|
66
|
+
this.blurTextureRatioPerPass = DefaultBlurTextureRatioPerPass;
|
|
67
|
+
this._intermediateBlurV.blurVerticalWidth = 0;
|
|
68
|
+
this._intermediateBlurH.blurHorizontalWidth = 0;
|
|
69
|
+
this._finalBlurV.blurVerticalWidth = 0;
|
|
70
|
+
this._finalBlurH.blurHorizontalWidth = 0;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* The class name of the block.
|
|
75
|
+
*/
|
|
76
|
+
BlurBlock.ClassName = blurBlockType;
|
|
77
|
+
/**
|
|
78
|
+
* The namespace of the block.
|
|
79
|
+
*/
|
|
80
|
+
BlurBlock.Namespace = babylonDemoEffectsNamespace;
|
|
81
|
+
__decorate([
|
|
82
|
+
editableInPropertyPage("Pass Texture Ratio", PropertyTypeForEdition.Float, "PROPERTIES", {
|
|
83
|
+
min: 0,
|
|
84
|
+
max: 1,
|
|
85
|
+
notifiers: { rebuild: true },
|
|
86
|
+
})
|
|
87
|
+
], BlurBlock.prototype, "blurTextureRatioPerPass", null);
|
|
88
|
+
__decorate([
|
|
89
|
+
editableInPropertyPage("Size", PropertyTypeForEdition.Float, "PROPERTIES", {
|
|
90
|
+
notifiers: { rebuild: true },
|
|
91
|
+
})
|
|
92
|
+
], BlurBlock.prototype, "blurSize", null);
|
|
93
|
+
//# sourceMappingURL=blurBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blurBlock.js","sourceRoot":"","sources":["../../../../../src/blocks/babylon/demo/effects/blurBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAA4B,cAAc,EAAwB,sBAAsB,EAAE,sBAAsB,EAAE,WAAW,EAAE,8BAAsB;AAC5J,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAE1E,MAAM,8BAA8B,GAAG,GAAG,CAAC;AAC3C,MAAM,eAAe,GAAG,CAAC,CAAC;AAE1B;;;;GAIG;AACH,MAAM,OAAO,SAAU,SAAQ,cAAc;IA6BzC;;OAEG;IACH,IAAW,uBAAuB;QAC9B,OAAO,IAAI,CAAC,wBAAwB,CAAC;IACzC,CAAC;IAED;;OAEG;IAMH,IAAW,uBAAuB,CAAC,KAAa;QAC5C,IAAI,CAAC,wBAAwB,GAAG,KAAK,CAAC;QACtC,IAAI,CAAC,k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sBAAsB,CAAC,MAAM,EAAE,sBAAsB,CAAC,KAAK,EAAE,YAAY,EAAE;QACxE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;KAC/B,CAAC;yCAOD"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { IBlockSerializerV1 } from "@onerjs/smart-filters";
|
|
2
|
+
/**
|
|
3
|
+
* The V1 serializer for a Blur Block.
|
|
4
|
+
* Though it is an aggregate block, Blur creates and manages its own blocks
|
|
5
|
+
* internally, so there's no need to worry about serializing them.
|
|
6
|
+
*/
|
|
7
|
+
export declare const BlurBlockSerializer: IBlockSerializerV1;
|
|
8
|
+
//# sourceMappingURL=blurBlock.serializer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blurBlock.serializer.d.ts","sourceRoot":"","sources":["../../../../../src/blocks/babylon/demo/effects/blurBlock.serializer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAa,kBAAkB,EAAE,8BAAsB;AAKnE;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,EAAE,kBAoBjC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { blurBlockType } from "../../../blockTypes.js";
|
|
2
|
+
import { babylonDemoEffectsNamespace } from "../../../blockNamespaces.js";
|
|
3
|
+
/**
|
|
4
|
+
* The V1 serializer for a Blur Block.
|
|
5
|
+
* Though it is an aggregate block, Blur creates and manages its own blocks
|
|
6
|
+
* internally, so there's no need to worry about serializing them.
|
|
7
|
+
*/
|
|
8
|
+
export const BlurBlockSerializer = {
|
|
9
|
+
blockType: blurBlockType,
|
|
10
|
+
serialize: (block) => {
|
|
11
|
+
if (block.getClassName() !== blurBlockType) {
|
|
12
|
+
throw new Error("Was asked to serialize an unrecognized block type");
|
|
13
|
+
}
|
|
14
|
+
const blurBlock = block;
|
|
15
|
+
return {
|
|
16
|
+
name: block.name,
|
|
17
|
+
uniqueId: block.uniqueId,
|
|
18
|
+
blockType: blurBlockType,
|
|
19
|
+
namespace: babylonDemoEffectsNamespace,
|
|
20
|
+
comments: block.comments,
|
|
21
|
+
data: {
|
|
22
|
+
blurTextureRatioPerPass: blurBlock.blurTextureRatioPerPass,
|
|
23
|
+
blurSize: blurBlock.blurSize,
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=blurBlock.serializer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blurBlock.serializer.js","sourceRoot":"","sources":["../../../../../src/blocks/babylon/demo/effects/blurBlock.serializer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAE1E;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAuB;IACnD,SAAS,EAAE,aAAa;IACxB,SAAS,EAAE,CAAC,KAAgB,EAAE,EAAE;QAC5B,IAAI,KAAK,CAAC,YAAY,EAAE,KAAK,aAAa,EAAE,CAAC;YACzC,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;QACzE,CAAC;QAED,MAAM,SAAS,GAAG,KAA6B,CAAC;QAChD,OAAO;YACH,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,SAAS,EAAE,aAAa;YACxB,SAAS,EAAE,2BAA2B;YACtC,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,IAAI,EAAE;gBACF,uBAAuB,EAAE,SAAS,CAAC,uBAAuB;gBAC1D,QAAQ,EAAE,SAAS,CAAC,QAAQ;aAC/B;SACJ,CAAC;IACN,CAAC;CACJ,CAAC"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import type { Effect } from "@onerjs/core/Materials/effect.js";
|
|
2
|
+
import { DisableableShaderBinding, type RuntimeData, ConnectionPointType, type IDisableableBlock, DisableableShaderBlock, type SmartFilter } from "@onerjs/smart-filters";
|
|
3
|
+
/** Defines that alpha blending is disabled */
|
|
4
|
+
export declare const ALPHA_DISABLE = 0;
|
|
5
|
+
/** Defines that alpha blending is SRC ALPHA * SRC + DEST */
|
|
6
|
+
export declare const ALPHA_ADD = 1;
|
|
7
|
+
/** Defines that alpha blending is SRC ALPHA * SRC + (1 - SRC ALPHA) * DEST */
|
|
8
|
+
export declare const ALPHA_COMBINE = 2;
|
|
9
|
+
/** Defines that alpha blending is DEST - SRC * DEST */
|
|
10
|
+
export declare const ALPHA_SUBTRACT = 3;
|
|
11
|
+
/** Defines that alpha blending is SRC * DEST */
|
|
12
|
+
export declare const ALPHA_MULTIPLY = 4;
|
|
13
|
+
/**
|
|
14
|
+
* The shader bindings for the Composition block.
|
|
15
|
+
* This demonstrates how multiple input connection point values can be packed into a single
|
|
16
|
+
* uniform.
|
|
17
|
+
*/
|
|
18
|
+
export declare class CompositionShaderBinding extends DisableableShaderBinding {
|
|
19
|
+
private readonly _backgroundTexture;
|
|
20
|
+
private readonly _foregroundTexture;
|
|
21
|
+
private readonly _foregroundTop;
|
|
22
|
+
private readonly _foregroundLeft;
|
|
23
|
+
private readonly _foregroundWidth;
|
|
24
|
+
private readonly _foregroundHeight;
|
|
25
|
+
private readonly _foregroundAlphaScale;
|
|
26
|
+
private readonly _alphaMode;
|
|
27
|
+
/**
|
|
28
|
+
* Creates a new shader binding instance for the Composition block.
|
|
29
|
+
* @param parentBlock - The parent block
|
|
30
|
+
* @param backgroundTexture - the background texture
|
|
31
|
+
* @param foregroundTexture - the foreground texture
|
|
32
|
+
* @param foregroundTop - the top position of the foreground texture
|
|
33
|
+
* @param foregroundLeft - the left position of the foreground texture
|
|
34
|
+
* @param foregroundWidth - the width of the foreground texture
|
|
35
|
+
* @param foregroundHeight - the height of the foreground texture
|
|
36
|
+
* @param foregroundAlphaScale - the alpha scale of the foreground texture
|
|
37
|
+
* @param alphaMode - the alpha mode to use
|
|
38
|
+
*/
|
|
39
|
+
constructor(parentBlock: IDisableableBlock, backgroundTexture: RuntimeData<ConnectionPointType.Texture>, foregroundTexture: RuntimeData<ConnectionPointType.Texture>, foregroundTop: RuntimeData<ConnectionPointType.Float>, foregroundLeft: RuntimeData<ConnectionPointType.Float>, foregroundWidth: RuntimeData<ConnectionPointType.Float>, foregroundHeight: RuntimeData<ConnectionPointType.Float>, foregroundAlphaScale: RuntimeData<ConnectionPointType.Float>, alphaMode: number);
|
|
40
|
+
/**
|
|
41
|
+
* Binds all the required data to the shader when rendering.
|
|
42
|
+
* @param effect - defines the effect to bind the data to
|
|
43
|
+
* @param width - defines the width of the output
|
|
44
|
+
* @param height - defines the height of the output
|
|
45
|
+
*/
|
|
46
|
+
bind(effect: Effect, width: number, height: number): void;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* A simple compositing Block letting the filter "blend" 2 different layers.
|
|
50
|
+
* It demonstrates how a block can use properties for values which will not change at runtime (alphaMode)
|
|
51
|
+
*
|
|
52
|
+
* The alpha mode of the block can be set to one of the following:
|
|
53
|
+
* - ALPHA_DISABLE: alpha blending is disabled
|
|
54
|
+
* - ALPHA_ADD: alpha blending is SRC ALPHA * SRC + DEST
|
|
55
|
+
* - ALPHA_COMBINE: alpha blending is SRC ALPHA * SRC + (1 - SRC ALPHA) * DEST
|
|
56
|
+
* - ALPHA_SUBTRACT: alpha blending is DEST - SRC * DEST
|
|
57
|
+
* - ALPHA_MULTIPLY: alpha blending is SRC * DEST
|
|
58
|
+
*/
|
|
59
|
+
export declare class CompositionBlock extends DisableableShaderBlock {
|
|
60
|
+
/**
|
|
61
|
+
* The class name of the block.
|
|
62
|
+
*/
|
|
63
|
+
static ClassName: string;
|
|
64
|
+
/**
|
|
65
|
+
* The namespace of the block.
|
|
66
|
+
*/
|
|
67
|
+
static Namespace: string;
|
|
68
|
+
/**
|
|
69
|
+
* The background texture to composite on to.
|
|
70
|
+
*/
|
|
71
|
+
readonly background: import("@onerjs/smart-filters").ConnectionPoint<ConnectionPointType.Texture>;
|
|
72
|
+
/**
|
|
73
|
+
* The foreground texture to composite in.
|
|
74
|
+
*/
|
|
75
|
+
readonly foreground: import("dev/smartFilters/dist/connection/connectionPointWithDefault.js").ConnectionPointWithDefault<ConnectionPointType.Texture>;
|
|
76
|
+
/**
|
|
77
|
+
* Defines where the top of the texture to composite in should be displayed. (between 0 and 1).
|
|
78
|
+
*/
|
|
79
|
+
readonly foregroundTop: import("dev/smartFilters/dist/connection/connectionPointWithDefault.js").ConnectionPointWithDefault<ConnectionPointType.Float>;
|
|
80
|
+
/**
|
|
81
|
+
* Defines where the left of the texture to composite in should be displayed. (between 0 and 1).
|
|
82
|
+
*/
|
|
83
|
+
readonly foregroundLeft: import("dev/smartFilters/dist/connection/connectionPointWithDefault.js").ConnectionPointWithDefault<ConnectionPointType.Float>;
|
|
84
|
+
/**
|
|
85
|
+
* Defines the width of the texture in the composition.
|
|
86
|
+
*/
|
|
87
|
+
readonly foregroundWidth: import("dev/smartFilters/dist/connection/connectionPointWithDefault.js").ConnectionPointWithDefault<ConnectionPointType.Float>;
|
|
88
|
+
/**
|
|
89
|
+
* Defines the height of the texture in the composition.
|
|
90
|
+
*/
|
|
91
|
+
readonly foregroundHeight: import("dev/smartFilters/dist/connection/connectionPointWithDefault.js").ConnectionPointWithDefault<ConnectionPointType.Float>;
|
|
92
|
+
/**
|
|
93
|
+
* Defines a multiplier applied to the foreground's alpha channel.
|
|
94
|
+
*/
|
|
95
|
+
readonly foregroundAlphaScale: import("dev/smartFilters/dist/connection/connectionPointWithDefault.js").ConnectionPointWithDefault<ConnectionPointType.Float>;
|
|
96
|
+
/**
|
|
97
|
+
* Defines blend mode of the composition.
|
|
98
|
+
*/
|
|
99
|
+
alphaMode: number;
|
|
100
|
+
/**
|
|
101
|
+
* The shader program (vertex and fragment code) to use to render the block
|
|
102
|
+
*/
|
|
103
|
+
static ShaderCode: import("@onerjs/smart-filters").ShaderProgram;
|
|
104
|
+
/**
|
|
105
|
+
* Instantiates a new Block.
|
|
106
|
+
* @param smartFilter - The smart filter this block belongs to
|
|
107
|
+
* @param name - The friendly name of the block
|
|
108
|
+
*/
|
|
109
|
+
constructor(smartFilter: SmartFilter, name: string);
|
|
110
|
+
/**
|
|
111
|
+
* Get the class instance that binds all the required data to the shader (effect) when rendering.
|
|
112
|
+
* @returns The class instance that binds the data to the effect
|
|
113
|
+
*/
|
|
114
|
+
getShaderBinding(): DisableableShaderBinding;
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=compositionBlock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compositionBlock.d.ts","sourceRoot":"","sources":["../../../../../src/blocks/babylon/demo/effects/compositionBlock.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,yCAAiC;AACvD,OAAO,EACH,wBAAwB,EACxB,KAAK,WAAW,EAChB,mBAAmB,EACnB,KAAK,iBAAiB,EACtB,sBAAsB,EACtB,KAAK,WAAW,EAInB,8BAAsB;AAKvB,8CAA8C;AAC9C,eAAO,MAAM,aAAa,IAAI,CAAC;AAC/B,4DAA4D;AAC5D,eAAO,MAAM,SAAS,IAAI,CAAC;AAC3B,8EAA8E;AAC9E,eAAO,MAAM,aAAa,IAAI,CAAC;AAC/B,uDAAuD;AACvD,eAAO,MAAM,cAAc,IAAI,CAAC;AAChC,gDAAgD;AAChD,eAAO,MAAM,cAAc,IAAI,CAAC;AAEhC;;;;GAIG;AACH,qBAAa,wBAAyB,SAAQ,wBAAwB;IAClE,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAA2C;IAC9E,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAA2C;IAC9E,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAyC;IACxE,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAyC;IACzE,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAyC;IAC1E,OAAO,CAAC,QAAQ,CAAC,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;;;;OAIG;gBACS,WAAW,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM;IAIlD;;;OAGG;IACI,gBAAgB,IAAI,wBAAwB;CAYtD"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ISerializedBlockV1, SmartFilter } from "@onerjs/smart-filters";
|
|
2
|
+
import { CompositionBlock } from "./compositionBlock.js";
|
|
3
|
+
/**
|
|
4
|
+
* The definition of the extra data serialized for composition blocks.
|
|
5
|
+
*/
|
|
6
|
+
export interface ISerializedCompositionBlockV1 extends ISerializedBlockV1 {
|
|
7
|
+
/**
|
|
8
|
+
* The extra data of the block.
|
|
9
|
+
*/
|
|
10
|
+
data: {
|
|
11
|
+
/**
|
|
12
|
+
* The alpha mode of the composition.
|
|
13
|
+
*/
|
|
14
|
+
alphaMode: number;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* V1 Composition Deserializer.
|
|
19
|
+
* @param smartFilter - The SmartFilter to deserialize the block into
|
|
20
|
+
* @param serializedBlock - The serialized block data
|
|
21
|
+
* @returns A deserialized CompositionBlock
|
|
22
|
+
*/
|
|
23
|
+
export declare function CompositionDeserializer(smartFilter: SmartFilter, serializedBlock: ISerializedCompositionBlockV1): CompositionBlock;
|
|
24
|
+
//# sourceMappingURL=compositionBlock.deserializer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compositionBlock.deserializer.d.ts","sourceRoot":"","sources":["../../../../../src/blocks/babylon/demo/effects/compositionBlock.deserializer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,8BAAsB;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD;;GAEG;AACH,MAAM,WAAW,6BAA8B,SAAQ,kBAAkB;IACrE;;OAEG;IACH,IAAI,EAAE;QACF;;WAEG;QACH,SAAS,EAAE,MAAM,CAAC;KACrB,CAAC;CACL;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,WAAW,EAAE,eAAe,EAAE,6BAA6B,oBAM/G"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CompositionBlock } from "./compositionBlock.js";
|
|
2
|
+
/**
|
|
3
|
+
* V1 Composition Deserializer.
|
|
4
|
+
* @param smartFilter - The SmartFilter to deserialize the block into
|
|
5
|
+
* @param serializedBlock - The serialized block data
|
|
6
|
+
* @returns A deserialized CompositionBlock
|
|
7
|
+
*/
|
|
8
|
+
export function CompositionDeserializer(smartFilter, serializedBlock) {
|
|
9
|
+
const block = new CompositionBlock(smartFilter, serializedBlock.name);
|
|
10
|
+
// If data is missing, use the default value set by the block
|
|
11
|
+
block.alphaMode = serializedBlock.data.alphaMode ?? block.alphaMode;
|
|
12
|
+
return block;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=compositionBlock.deserializer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compositionBlock.deserializer.js","sourceRoot":"","sources":["../../../../../src/blocks/babylon/demo/effects/compositionBlock.deserializer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAiBzD;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CAAC,WAAwB,EAAE,eAA8C;IAC5G,MAAM,KAAK,GAAG,IAAI,gBAAgB,CAAC,WAAW,EAAE,eAAe,CAAC,IAAI,CAAC,CAAC;IAEtE,6DAA6D;IAC7D,KAAK,CAAC,SAAS,GAAG,eAAe,CAAC,IAAI,CAAC,SAAS,IAAI,KAAK,CAAC,SAAS,CAAC;IACpE,OAAO,KAAK,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ShaderProgram } from "@onerjs/smart-filters";
|
|
2
|
+
/**
|
|
3
|
+
* The shader program for the block.
|
|
4
|
+
*/
|
|
5
|
+
declare const BlockShaderProgram: ShaderProgram;
|
|
6
|
+
/**
|
|
7
|
+
* The uniform names for this shader, to be used in the shader binding so
|
|
8
|
+
* that the names are always in sync.
|
|
9
|
+
*/
|
|
10
|
+
declare const Uniforms: {
|
|
11
|
+
background: string;
|
|
12
|
+
foreground: string;
|
|
13
|
+
scaleUV: string;
|
|
14
|
+
translateUV: string;
|
|
15
|
+
alphaMode: string;
|
|
16
|
+
foregroundAlphaScale: string;
|
|
17
|
+
};
|
|
18
|
+
export { BlockShaderProgram, Uniforms };
|
|
19
|
+
export { BlockShaderProgram as shaderProgram, Uniforms as uniforms };
|
|
20
|
+
//# sourceMappingURL=compositionBlock.fragment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compositionBlock.fragment.d.ts","sourceRoot":"","sources":["../../../../../src/blocks/babylon/demo/effects/compositionBlock.fragment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,8BAAsB;AAEnD;;GAEG;AACH,QAAA,MAAM,kBAAkB,EAAE,aAmDzB,CAAC;AAEF;;;GAGG;AACH,QAAA,MAAM,QAAQ;;;;;;;CAOb,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,CAAC;AAExC,OAAO,EAAE,kBAAkB,IAAI,aAAa,EAAE,QAAQ,IAAI,QAAQ,EAAE,CAAC"}
|