@onerjs/smart-filters-blocks 8.25.2 → 8.25.4
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,132 @@
|
|
|
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
|
+
uniform sampler2D _background_;
|
|
15
|
+
uniform vec3 _reference_;
|
|
16
|
+
uniform float _distance_;`,
|
|
17
|
+
mainInputTexture: "_input_",
|
|
18
|
+
mainFunctionName: "_greenScreen_",
|
|
19
|
+
functions: [
|
|
20
|
+
{
|
|
21
|
+
name: "_greenScreen_",
|
|
22
|
+
code: `
|
|
23
|
+
vec4 _greenScreen_(vec2 vUV) {
|
|
24
|
+
vec4 color = texture2D(_input_, vUV);
|
|
25
|
+
vec4 _background_ = texture2D(_background_, vUV);
|
|
26
|
+
|
|
27
|
+
if (length(color.rgb - _reference_) < _distance_) {
|
|
28
|
+
return _background_;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return color;
|
|
32
|
+
}
|
|
33
|
+
`,
|
|
34
|
+
params: "vec2 vUV",
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* The uniform names for this shader, to be used in the shader binding so
|
|
41
|
+
* that the names are always in sync.
|
|
42
|
+
*/
|
|
43
|
+
const Uniforms = {
|
|
44
|
+
input: "input",
|
|
45
|
+
background: "background",
|
|
46
|
+
reference: "reference",
|
|
47
|
+
distance: "distance",
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* The shader binding for the GreenScreenBlock, used by the runtime
|
|
51
|
+
*/
|
|
52
|
+
class GreenScreenBlockShaderBinding extends DisableableShaderBinding {
|
|
53
|
+
/**
|
|
54
|
+
* Creates a new shader binding instance for the block.
|
|
55
|
+
* @param parentBlock - IDisableableBlock
|
|
56
|
+
* @param input - The input runtime value
|
|
57
|
+
* @param background - The background runtime value
|
|
58
|
+
* @param reference - The reference runtime value
|
|
59
|
+
* @param distance - The distance runtime value
|
|
60
|
+
*/
|
|
61
|
+
constructor(parentBlock, input, background, reference, distance) {
|
|
62
|
+
super(parentBlock);
|
|
63
|
+
this._input = input;
|
|
64
|
+
this._background = background;
|
|
65
|
+
this._reference = reference;
|
|
66
|
+
this._distance = distance;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Binds all the required data to the shader when rendering.
|
|
70
|
+
* @param effect - defines the effect to bind the data to
|
|
71
|
+
*/
|
|
72
|
+
bind(effect) {
|
|
73
|
+
super.bind(effect);
|
|
74
|
+
effect.setTexture(this.getRemappedName(Uniforms.input), this._input.value);
|
|
75
|
+
effect.setTexture(this.getRemappedName(Uniforms.background), this._background.value);
|
|
76
|
+
effect.setColor3(this.getRemappedName(Uniforms.reference), this._reference.value);
|
|
77
|
+
effect.setFloat(this.getRemappedName(Uniforms.distance), this._distance.value);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* The implementation of the GreenScreenBlock
|
|
82
|
+
*/
|
|
83
|
+
export class GreenScreenBlock extends DisableableShaderBlock {
|
|
84
|
+
/**
|
|
85
|
+
* Instantiates a new GreenScreenBlock.
|
|
86
|
+
* @param smartFilter - The smart filter this block belongs to
|
|
87
|
+
* @param name - The friendly name of the block
|
|
88
|
+
*/
|
|
89
|
+
constructor(smartFilter, name) {
|
|
90
|
+
super(smartFilter, name, false, BlockDisableStrategy.AutoSample);
|
|
91
|
+
/**
|
|
92
|
+
* The input connection point.
|
|
93
|
+
*/
|
|
94
|
+
this.input = this._registerInput(Uniforms.input, ConnectionPointType.Texture);
|
|
95
|
+
/**
|
|
96
|
+
* The background connection point.
|
|
97
|
+
*/
|
|
98
|
+
this.background = this._registerInput(Uniforms.background, ConnectionPointType.Texture);
|
|
99
|
+
/**
|
|
100
|
+
* The reference connection point.
|
|
101
|
+
*/
|
|
102
|
+
this.reference = this._registerInput(Uniforms.reference, ConnectionPointType.Color3);
|
|
103
|
+
/**
|
|
104
|
+
* The distance connection point.
|
|
105
|
+
*/
|
|
106
|
+
this.distance = this._registerInput(Uniforms.distance, ConnectionPointType.Float);
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Get the class instance that binds all the required data to the shader (effect) when rendering.
|
|
110
|
+
* @returns The class instance that binds the data to the effect
|
|
111
|
+
*/
|
|
112
|
+
getShaderBinding() {
|
|
113
|
+
const input = this._confirmRuntimeDataSupplied(this.input);
|
|
114
|
+
const background = this._confirmRuntimeDataSupplied(this.background);
|
|
115
|
+
const reference = this._confirmRuntimeDataSupplied(this.reference);
|
|
116
|
+
const distance = this._confirmRuntimeDataSupplied(this.distance);
|
|
117
|
+
return new GreenScreenBlockShaderBinding(this, input, background, reference, distance);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* The class name of the block.
|
|
122
|
+
*/
|
|
123
|
+
GreenScreenBlock.ClassName = "GreenScreenBlock";
|
|
124
|
+
/**
|
|
125
|
+
* The namespace of the block.
|
|
126
|
+
*/
|
|
127
|
+
GreenScreenBlock.Namespace = "Babylon.Demo.Effects";
|
|
128
|
+
/**
|
|
129
|
+
* The shader program (vertex and fragment code) to use to render the block
|
|
130
|
+
*/
|
|
131
|
+
GreenScreenBlock.ShaderCode = BlockShaderProgram;
|
|
132
|
+
//# sourceMappingURL=greenScreenBlock.block.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"greenScreenBlock.block.js","sourceRoot":"","sources":["../../../../../src/blocks/babylon/demo/effects/greenScreenBlock.block.ts"],"names":[],"mappings":"AAAA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2B,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACnE,MAAM,QAAQ,GAAG,IAAI,CAAC,2BAA2B,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAEjE,OAAO,IAAI,6BAA6B,CAAC,IAAI,EAAC,KAAK,EAAC,UAAU,EAAC,SAAS,EAAC,QAAQ,CAAC,CAAC;IACvF,CAAC;;AAvDD;;GAEG;AACoB,0BAAS,GAAG,kBAAkB,AAArB,CAAsB;AAEtD;;GAEG;AACoB,0BAAS,GAAG,sBAAsB,AAAzB,CAA0B;AAsB1D;;GAEG;AACoB,2BAAU,GAAG,kBAAkB,AAArB,CAAsB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export * from "./blackAndWhiteBlock.block.js";
|
|
2
|
+
export * from "./blurBlock.js";
|
|
3
|
+
export * from "./compositionBlock.js";
|
|
4
|
+
export * from "./contrastBlock.block.js";
|
|
5
|
+
export * from "./desaturateBlock.block.js";
|
|
6
|
+
export * from "./directionalBlurBlock.js";
|
|
7
|
+
export * from "./exposureBlock.block.js";
|
|
8
|
+
export * from "./greenScreenBlock.block.js";
|
|
9
|
+
export * from "./kaleidoscopeBlock.js";
|
|
10
|
+
export * from "./maskBlock.block.js";
|
|
11
|
+
export * from "./pixelateBlock.block.js";
|
|
12
|
+
export * from "./posterizeBlock.block.js";
|
|
13
|
+
export * from "./spritesheetBlock.js";
|
|
14
|
+
export * from "./tintBlock.js";
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/blocks/babylon/demo/effects/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export * from "./blackAndWhiteBlock.block.js";
|
|
2
|
+
export * from "./blurBlock.js";
|
|
3
|
+
export * from "./compositionBlock.js";
|
|
4
|
+
export * from "./contrastBlock.block.js";
|
|
5
|
+
export * from "./desaturateBlock.block.js";
|
|
6
|
+
export * from "./directionalBlurBlock.js";
|
|
7
|
+
export * from "./exposureBlock.block.js";
|
|
8
|
+
export * from "./greenScreenBlock.block.js";
|
|
9
|
+
export * from "./kaleidoscopeBlock.js";
|
|
10
|
+
export * from "./maskBlock.block.js";
|
|
11
|
+
export * from "./pixelateBlock.block.js";
|
|
12
|
+
export * from "./posterizeBlock.block.js";
|
|
13
|
+
export * from "./spritesheetBlock.js";
|
|
14
|
+
export * from "./tintBlock.js";
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/blocks/babylon/demo/effects/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { Effect } from "@onerjs/core/Materials/effect.js";
|
|
2
|
+
import { type ShaderProgram, DisableableShaderBinding, type RuntimeData, ConnectionPointType, type IDisableableBlock, DisableableShaderBlock, type SmartFilter } from "@onerjs/smart-filters";
|
|
3
|
+
/**
|
|
4
|
+
* This block uses a custom vertex shader, so it defines the ShaderProgram inline
|
|
5
|
+
*/
|
|
6
|
+
declare const ShaderProgram: ShaderProgram;
|
|
7
|
+
/**
|
|
8
|
+
* The shader bindings for the Kaleidoscope block.
|
|
9
|
+
*/
|
|
10
|
+
export declare class KaleidoscopeShaderBinding extends DisableableShaderBinding {
|
|
11
|
+
private readonly _inputTexture;
|
|
12
|
+
private readonly _time;
|
|
13
|
+
/**
|
|
14
|
+
* Creates a new shader binding instance for the Kaleidoscope block.
|
|
15
|
+
* @param parentBlock - The parent block
|
|
16
|
+
* @param inputTexture - the input texture
|
|
17
|
+
* @param time - the time
|
|
18
|
+
*/
|
|
19
|
+
constructor(parentBlock: IDisableableBlock, inputTexture: RuntimeData<ConnectionPointType.Texture>, time: RuntimeData<ConnectionPointType.Float>);
|
|
20
|
+
/**
|
|
21
|
+
* Binds all the required data to the shader when rendering.
|
|
22
|
+
* @param effect - defines the effect to bind the data to
|
|
23
|
+
*/
|
|
24
|
+
bind(effect: Effect): void;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* A block performing a Kaleidoscope looking like effect.
|
|
28
|
+
*/
|
|
29
|
+
export declare class KaleidoscopeBlock extends DisableableShaderBlock {
|
|
30
|
+
/**
|
|
31
|
+
* The class name of the block.
|
|
32
|
+
*/
|
|
33
|
+
static ClassName: string;
|
|
34
|
+
/**
|
|
35
|
+
* The namespace of the block.
|
|
36
|
+
*/
|
|
37
|
+
static Namespace: string;
|
|
38
|
+
/**
|
|
39
|
+
* The input texture connection point.
|
|
40
|
+
*/
|
|
41
|
+
readonly input: import("@onerjs/smart-filters").ConnectionPoint<ConnectionPointType.Texture>;
|
|
42
|
+
/**
|
|
43
|
+
* The time connection point.
|
|
44
|
+
*/
|
|
45
|
+
readonly time: import("@onerjs/smart-filters").ConnectionPoint<ConnectionPointType.Float>;
|
|
46
|
+
/**
|
|
47
|
+
* The shader program (vertex and fragment code) to use to render the block
|
|
48
|
+
*/
|
|
49
|
+
static ShaderCode: ShaderProgram;
|
|
50
|
+
/**
|
|
51
|
+
* Instantiates a new Block.
|
|
52
|
+
* @param smartFilter - The smart filter this block belongs to
|
|
53
|
+
* @param name - The friendly name of the block
|
|
54
|
+
*/
|
|
55
|
+
constructor(smartFilter: SmartFilter, name: string);
|
|
56
|
+
/**
|
|
57
|
+
* Get the class instance that binds all the required data to the shader (effect) when rendering.
|
|
58
|
+
* @returns The class instance that binds the data to the effect
|
|
59
|
+
*/
|
|
60
|
+
getShaderBinding(): DisableableShaderBinding;
|
|
61
|
+
}
|
|
62
|
+
export {};
|
|
63
|
+
//# sourceMappingURL=kaleidoscopeBlock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kaleidoscopeBlock.d.ts","sourceRoot":"","sources":["../../../../../src/blocks/babylon/demo/effects/kaleidoscopeBlock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,yCAAiC;AAEvD,OAAO,EACH,KAAK,aAAa,EAClB,wBAAwB,EACxB,KAAK,WAAW,EAChB,mBAAmB,EACnB,KAAK,iBAAiB,EACtB,sBAAsB,EACtB,KAAK,WAAW,EAEnB,8BAAsB;AAKvB;;GAEG;AACH,QAAA,MAAM,aAAa,EAAE,aAwFpB,CAAC;AAEF;;GAEG;AACH,qBAAa,yBAA0B,SAAQ,wBAAwB;IACnE,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA2C;IACzE,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAyC;IAE/D;;;;;OAKG;gBACS,WAAW,EAAE,iBAAiB,EAAE,YAAY,EAAE,WAAW,CAAC,mBAAmB,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,WAAW,CAAC,mBAAmB,CAAC,KAAK,CAAC;IAMhJ;;;OAGG;IACa,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;CAK7C;AAED;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,sBAAsB;IACzD;;OAEG;IACH,OAAuB,SAAS,SAAyB;IAEzD;;OAEG;IACH,OAAuB,SAAS,SAA+B;IAE/D;;OAEG;IACH,SAAgB,KAAK,+EAA6D;IAElF;;OAEG;IACH,SAAgB,IAAI,6EAA0D;IAE9E;;OAEG;IACH,OAAuB,UAAU,gBAAiB;IAElD;;;;OAIG;gBACS,WAAW,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM;IAIlD;;;OAGG;IACI,gBAAgB,IAAI,wBAAwB;CAMtD"}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { DisableableShaderBinding, ConnectionPointType, DisableableShaderBlock, BlockDisableStrategy, } from "@onerjs/smart-filters";
|
|
2
|
+
import { kaleidoscopeBlockType } from "../../../blockTypes.js";
|
|
3
|
+
import { babylonDemoEffectsNamespace } from "../../../blockNamespaces.js";
|
|
4
|
+
/**
|
|
5
|
+
* This block uses a custom vertex shader, so it defines the ShaderProgram inline
|
|
6
|
+
*/
|
|
7
|
+
const ShaderProgram = {
|
|
8
|
+
vertex: `
|
|
9
|
+
// Attributes
|
|
10
|
+
attribute vec2 position;
|
|
11
|
+
|
|
12
|
+
// Output
|
|
13
|
+
varying vec2 vUV;
|
|
14
|
+
|
|
15
|
+
void main(void) {
|
|
16
|
+
vUV = position;
|
|
17
|
+
gl_Position = vec4(position, 0.0, 1.0);
|
|
18
|
+
}
|
|
19
|
+
`,
|
|
20
|
+
fragment: {
|
|
21
|
+
uniform: `
|
|
22
|
+
uniform sampler2D _input_;
|
|
23
|
+
uniform float _time_;
|
|
24
|
+
uniform bool _disabled_;
|
|
25
|
+
`,
|
|
26
|
+
const: `
|
|
27
|
+
const float _width_ = 200.;
|
|
28
|
+
const float _height_ = 300.;
|
|
29
|
+
const vec2 _imageRatio_ = vec2(700. / _width_, 1024. / _height_);
|
|
30
|
+
const vec2 _imageRelativeSize_ = 1. / _imageRatio_;
|
|
31
|
+
const float _halfDiag_ = sqrt(_imageRelativeSize_.x * _imageRelativeSize_.x + _imageRelativeSize_.y * _imageRelativeSize_.y) * 0.5;
|
|
32
|
+
|
|
33
|
+
const float _radius_ = 0.9;
|
|
34
|
+
const float _radius2_ = 0.4;
|
|
35
|
+
|
|
36
|
+
const float _segments_ = 6.;
|
|
37
|
+
const float _segmentArc_ = (2. * 3.1415926535897932384626433832795 / _segments_);
|
|
38
|
+
`,
|
|
39
|
+
mainFunctionName: "_kaleidoscope_",
|
|
40
|
+
mainInputTexture: "_input_",
|
|
41
|
+
functions: [
|
|
42
|
+
{
|
|
43
|
+
name: "_kaleidoscope_",
|
|
44
|
+
code: `
|
|
45
|
+
vec4 _kaleidoscope_(vec2 vUV) {
|
|
46
|
+
if (_disabled_) return texture2D(_input_, vUV);
|
|
47
|
+
|
|
48
|
+
float distanceToCircle = abs(length(vUV) - _radius_);
|
|
49
|
+
vec4 result = vec4(0., 0., 0., 0.);
|
|
50
|
+
|
|
51
|
+
if (distanceToCircle < _halfDiag_ * 10000.) {
|
|
52
|
+
float pointTheta = atan(vUV.y, vUV.x);
|
|
53
|
+
pointTheta += _time_;
|
|
54
|
+
for (float i = -1.; i < 2.; i += 1.) {
|
|
55
|
+
float chunk = floor(pointTheta / _segmentArc_) + i;
|
|
56
|
+
float chunkStart = -_time_ + chunk * _segmentArc_ + _segmentArc_ * 0.5;
|
|
57
|
+
vec2 chunkStartCenter = vec2(cos(chunkStart), sin(chunkStart)) * _radius_;
|
|
58
|
+
vec2 chunkStartPoint = vUV - chunkStartCenter;
|
|
59
|
+
chunkStartPoint *= _imageRatio_;
|
|
60
|
+
chunkStartPoint *= vec2(0.5, 0.5);
|
|
61
|
+
chunkStartPoint += vec2(0.5, 0.5);
|
|
62
|
+
|
|
63
|
+
if (chunkStartPoint.x > 0. && chunkStartPoint.x < 1. && chunkStartPoint.y > 0. && chunkStartPoint.y < 1.) {
|
|
64
|
+
result = texture2D(_input_, chunkStartPoint);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
for (float i = -1.; i < 2.; i += 1.) {
|
|
69
|
+
float chunk = floor(pointTheta / _segmentArc_) + i;
|
|
70
|
+
float chunkStart = -_time_ + chunk * _segmentArc_ + _segmentArc_ * 0.5;
|
|
71
|
+
vec2 chunkStartCenter = vec2(cos(chunkStart), sin(chunkStart)) * _radius2_;
|
|
72
|
+
vec2 chunkStartPoint = vUV - chunkStartCenter;
|
|
73
|
+
chunkStartPoint *= _imageRatio_;
|
|
74
|
+
chunkStartPoint *= vec2(0.5, 0.5);
|
|
75
|
+
chunkStartPoint += vec2(0.5, 0.5);
|
|
76
|
+
|
|
77
|
+
if (chunkStartPoint.x > 0. && chunkStartPoint.x < 1. && chunkStartPoint.y > 0. && chunkStartPoint.y < 1.) {
|
|
78
|
+
vec4 top = texture2D(_input_, chunkStartPoint);
|
|
79
|
+
result = mix(result, top, (result.a <= 0.) ? 1. : top.a);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return result;
|
|
85
|
+
}
|
|
86
|
+
`,
|
|
87
|
+
},
|
|
88
|
+
],
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* The shader bindings for the Kaleidoscope block.
|
|
93
|
+
*/
|
|
94
|
+
export class KaleidoscopeShaderBinding extends DisableableShaderBinding {
|
|
95
|
+
/**
|
|
96
|
+
* Creates a new shader binding instance for the Kaleidoscope block.
|
|
97
|
+
* @param parentBlock - The parent block
|
|
98
|
+
* @param inputTexture - the input texture
|
|
99
|
+
* @param time - the time
|
|
100
|
+
*/
|
|
101
|
+
constructor(parentBlock, inputTexture, time) {
|
|
102
|
+
super(parentBlock);
|
|
103
|
+
this._inputTexture = inputTexture;
|
|
104
|
+
this._time = time;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Binds all the required data to the shader when rendering.
|
|
108
|
+
* @param effect - defines the effect to bind the data to
|
|
109
|
+
*/
|
|
110
|
+
bind(effect) {
|
|
111
|
+
super.bind(effect);
|
|
112
|
+
effect.setTexture(this.getRemappedName("input"), this._inputTexture.value);
|
|
113
|
+
effect.setFloat(this.getRemappedName("time"), this._time.value);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* A block performing a Kaleidoscope looking like effect.
|
|
118
|
+
*/
|
|
119
|
+
export class KaleidoscopeBlock extends DisableableShaderBlock {
|
|
120
|
+
/**
|
|
121
|
+
* Instantiates a new Block.
|
|
122
|
+
* @param smartFilter - The smart filter this block belongs to
|
|
123
|
+
* @param name - The friendly name of the block
|
|
124
|
+
*/
|
|
125
|
+
constructor(smartFilter, name) {
|
|
126
|
+
super(smartFilter, name, false, BlockDisableStrategy.Manual);
|
|
127
|
+
/**
|
|
128
|
+
* The input texture connection point.
|
|
129
|
+
*/
|
|
130
|
+
this.input = this._registerInput("input", ConnectionPointType.Texture);
|
|
131
|
+
/**
|
|
132
|
+
* The time connection point.
|
|
133
|
+
*/
|
|
134
|
+
this.time = this._registerInput("time", ConnectionPointType.Float);
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Get the class instance that binds all the required data to the shader (effect) when rendering.
|
|
138
|
+
* @returns The class instance that binds the data to the effect
|
|
139
|
+
*/
|
|
140
|
+
getShaderBinding() {
|
|
141
|
+
const input = this._confirmRuntimeDataSupplied(this.input);
|
|
142
|
+
const time = this._confirmRuntimeDataSupplied(this.time);
|
|
143
|
+
return new KaleidoscopeShaderBinding(this, input, time);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* The class name of the block.
|
|
148
|
+
*/
|
|
149
|
+
KaleidoscopeBlock.ClassName = kaleidoscopeBlockType;
|
|
150
|
+
/**
|
|
151
|
+
* The namespace of the block.
|
|
152
|
+
*/
|
|
153
|
+
KaleidoscopeBlock.Namespace = babylonDemoEffectsNamespace;
|
|
154
|
+
/**
|
|
155
|
+
* The shader program (vertex and fragment code) to use to render the block
|
|
156
|
+
*/
|
|
157
|
+
KaleidoscopeBlock.ShaderCode = ShaderProgram;
|
|
158
|
+
//# sourceMappingURL=kaleidoscopeBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kaleidoscopeBlock.js","sourceRoot":"","sources":["../../../../../src/blocks/babylon/demo/effects/kaleidoscopeBlock.ts"],"names":[],"mappings":"AAEA,OAAO,EAEH,wBAAwB,EAExB,mBAAmB,EAEnB,sBAAsB,EAEtB,oBAAoB,GACvB,8BAAsB;AAEvB,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAE1E;;GAEG;AACH,MAAM,aAAa,GAAkB;IACjC,MAAM,EAAE;;;;;;;;;;;KAWP;IAED,QAAQ,EAAE;QACN,OAAO,EAAE;;;;aAIJ;QAEL,KAAK,EAAE;;;;;;;;;;;;aAYF;QAEL,gBAAgB,EAAE,gBAAgB;QAElC,gBAAgB,EAAE,SAAS;QAE3B,SAAS,EAAE;YACP;gBACI,IAAI,EAAE,gBAAgB;gBACtB,IAAI,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aA0CT;aACA;SACJ;KACJ;CACJ,CAAC;AAEF;;GAEG;AACH,MAAM,OAAO,yBAA0B,SAAQ,wBAAwB;IAInE;;;;;OAKG;IACH,YAAY,WAA8B,EAAE,YAAsD,EAAE,IAA4C;QAC5I,KAAK,CAAC,WAAW,CAAC,CAAC;QACnB,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;QAClC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACtB,CAAC;IAED;;;OAGG;IACa,IAAI,CAAC,MAAc;Q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ock, type ShaderProgram } from "@onerjs/smart-filters";
|
|
2
|
+
/**
|
|
3
|
+
* The implementation of the MaskBlock
|
|
4
|
+
*/
|
|
5
|
+
export declare class MaskBlock 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 mask connection point.
|
|
20
|
+
*/
|
|
21
|
+
readonly mask: import("@onerjs/smart-filters").ConnectionPoint<ConnectionPointType.Texture>;
|
|
22
|
+
/**
|
|
23
|
+
* The shader program (vertex and fragment code) to use to render the block
|
|
24
|
+
*/
|
|
25
|
+
static ShaderCode: ShaderProgram;
|
|
26
|
+
/**
|
|
27
|
+
* Instantiates a new MaskBlock.
|
|
28
|
+
* @param smartFilter - The smart filter this block belongs to
|
|
29
|
+
* @param name - The friendly name of the block
|
|
30
|
+
*/
|
|
31
|
+
constructor(smartFilter: SmartFilter, name: string);
|
|
32
|
+
/**
|
|
33
|
+
* Get the class instance that binds all the required data to the shader (effect) when rendering.
|
|
34
|
+
* @returns The class instance that binds the data to the effect
|
|
35
|
+
*/
|
|
36
|
+
getShaderBinding(): DisableableShaderBinding;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=maskBlock.block.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"maskBlock.block.d.ts","sourceRoot":"","sources":["../../../../../src/blocks/babylon/demo/effects/maskBlock.block.ts"],"names":[],"mappings":"AAYA,OAAO,EACH,wBAAwB,EAExB,mBAAmB,EACnB,KAAK,WAAW,EAChB,sBAAsB,EACtB,KAAK,aAAa,EAEG,8BAAsB;AA2E/C;;GAEG;AACH,qBAAa,SAAU,SAAQ,sBAAsB;IACjD;;OAEG;IACH,OAAuB,SAAS,SAAe;IAE/C;;OAEG;IACH,OAAuB,SAAS,SAA0B;IAE1D;;OAEG;IACH,SAAgB,KAAK,+EAAoE;IAEzF;;OAEG;IACH,SAAgB,IAAI,+EAAmE;IAEvF;;OAEG;IACH,OAAuB,UAAU,gBAAsB;IAEvD;;;;OAIG;gBACS,WAAW,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM;IAIlD;;;OAGG;IACI,gBAAgB,IAAI,wBAAwB;CAMtD"}
|
|
@@ -0,0 +1,109 @@
|
|
|
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
|
+
uniform sampler2D _mask_;`,
|
|
15
|
+
mainInputTexture: "_input_",
|
|
16
|
+
mainFunctionName: "_maskBlock_",
|
|
17
|
+
functions: [
|
|
18
|
+
{
|
|
19
|
+
name: "_maskBlock_",
|
|
20
|
+
code: `
|
|
21
|
+
vec4 _maskBlock_(vec2 vUV) {
|
|
22
|
+
vec4 color = texture2D(_input_, vUV);
|
|
23
|
+
vec3 maskColor = texture2D(_mask_, vUV).rgb;
|
|
24
|
+
float luminance = dot(maskColor, vec3(0.3, 0.59, 0.11));
|
|
25
|
+
|
|
26
|
+
return vec4(color.rgb * luminance, luminance * 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
|
+
mask: "mask",
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* The shader binding for the MaskBlock, used by the runtime
|
|
44
|
+
*/
|
|
45
|
+
class MaskBlockShaderBinding extends DisableableShaderBinding {
|
|
46
|
+
/**
|
|
47
|
+
* Creates a new shader binding instance for the block.
|
|
48
|
+
* @param parentBlock - IDisableableBlock
|
|
49
|
+
* @param input - The input runtime value
|
|
50
|
+
* @param mask - The mask runtime value
|
|
51
|
+
*/
|
|
52
|
+
constructor(parentBlock, input, mask) {
|
|
53
|
+
super(parentBlock);
|
|
54
|
+
this._input = input;
|
|
55
|
+
this._mask = mask;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Binds all the required data to the shader when rendering.
|
|
59
|
+
* @param effect - defines the effect to bind the data to
|
|
60
|
+
*/
|
|
61
|
+
bind(effect) {
|
|
62
|
+
super.bind(effect);
|
|
63
|
+
effect.setTexture(this.getRemappedName(Uniforms.input), this._input.value);
|
|
64
|
+
effect.setTexture(this.getRemappedName(Uniforms.mask), this._mask.value);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* The implementation of the MaskBlock
|
|
69
|
+
*/
|
|
70
|
+
export class MaskBlock extends DisableableShaderBlock {
|
|
71
|
+
/**
|
|
72
|
+
* Instantiates a new MaskBlock.
|
|
73
|
+
* @param smartFilter - The smart filter this block belongs to
|
|
74
|
+
* @param name - The friendly name of the block
|
|
75
|
+
*/
|
|
76
|
+
constructor(smartFilter, name) {
|
|
77
|
+
super(smartFilter, name, false, BlockDisableStrategy.AutoSample);
|
|
78
|
+
/**
|
|
79
|
+
* The input connection point.
|
|
80
|
+
*/
|
|
81
|
+
this.input = this._registerInput(Uniforms.input, ConnectionPointType.Texture);
|
|
82
|
+
/**
|
|
83
|
+
* The mask connection point.
|
|
84
|
+
*/
|
|
85
|
+
this.mask = this._registerInput(Uniforms.mask, ConnectionPointType.Texture);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Get the class instance that binds all the required data to the shader (effect) when rendering.
|
|
89
|
+
* @returns The class instance that binds the data to the effect
|
|
90
|
+
*/
|
|
91
|
+
getShaderBinding() {
|
|
92
|
+
const input = this._confirmRuntimeDataSupplied(this.input);
|
|
93
|
+
const mask = this._confirmRuntimeDataSupplied(this.mask);
|
|
94
|
+
return new MaskBlockShaderBinding(this, input, mask);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* The class name of the block.
|
|
99
|
+
*/
|
|
100
|
+
MaskBlock.ClassName = "MaskBlock";
|
|
101
|
+
/**
|
|
102
|
+
* The namespace of the block.
|
|
103
|
+
*/
|
|
104
|
+
MaskBlock.Namespace = "Babylon.Demo.Effects";
|
|
105
|
+
/**
|
|
106
|
+
* The shader program (vertex and fragment code) to use to render the block
|
|
107
|
+
*/
|
|
108
|
+
MaskBlock.ShaderCode = BlockShaderProgram;
|
|
109
|
+
//# sourceMappingURL=maskBlock.block.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"maskBlock.block.js","sourceRoot":"","sources":["../../../../../src/blocks/babylon/demo/effects/maskBlock.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;;sCAEqB;QAC9B,gBAAgB,EAAE,SAAS;QAC3B,gBAAg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,mBAAmB,CAAC,OAAO,CAAC,CAAC;IAcvF,CAAC;IAED;;;OAGG;IACI,gBAAgB;QACnB,MAAM,KAAK,GAAG,IAAI,CAAC,2BAA2B,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC3D,MAAM,IAAI,GAAG,IAAI,CAAC,2BAA2B,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEzD,OAAO,IAAI,sBAAsB,CAAC,IAAI,EAAC,KAAK,EAAC,IAAI,CAAC,CAAC;IACvD,CAAC;;AA3CD;;GAEG;AACoB,mBAAS,GAAG,WAAW,AAAd,CAAe;AAE/C;;GAEG;AACoB,mBAAS,GAAG,sBAAsB,AAAzB,CAA0B;AAY1D;;GAEG;AACoB,oBAAU,GAAG,kBAAkB,AAArB,CAAsB"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ShaderBinding, ConnectionPointType, type SmartFilter, ShaderBlock, type ShaderProgram } from "@onerjs/smart-filters";
|
|
2
|
+
/**
|
|
3
|
+
* The implementation of the PixelateBlock
|
|
4
|
+
*/
|
|
5
|
+
export declare class PixelateBlock extends ShaderBlock {
|
|
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
|
+
/**
|
|
20
|
+
* The intensity connection point.
|
|
21
|
+
*/
|
|
22
|
+
readonly intensity: import("dev/smartFilters/dist/connection/connectionPointWithDefault").ConnectionPointWithDefault<ConnectionPointType.Float>;
|
|
23
|
+
/**
|
|
24
|
+
/**
|
|
25
|
+
* The disabled connection point.
|
|
26
|
+
*/
|
|
27
|
+
readonly disabled: import("dev/smartFilters/dist/connection/connectionPointWithDefault").ConnectionPointWithDefault<ConnectionPointType.Boolean>;
|
|
28
|
+
/**
|
|
29
|
+
* The shader program (vertex and fragment code) to use to render the block
|
|
30
|
+
*/
|
|
31
|
+
static ShaderCode: ShaderProgram;
|
|
32
|
+
/**
|
|
33
|
+
* Instantiates a new PixelateBlock.
|
|
34
|
+
* @param smartFilter - The smart filter this block belongs to
|
|
35
|
+
* @param name - The friendly name of the block
|
|
36
|
+
*/
|
|
37
|
+
constructor(smartFilter: SmartFilter, name: string);
|
|
38
|
+
/**
|
|
39
|
+
* Get the class instance that binds all the required data to the shader (effect) when rendering.
|
|
40
|
+
* @returns The class instance that binds the data to the effect
|
|
41
|
+
*/
|
|
42
|
+
getShaderBinding(): ShaderBinding;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=pixelateBlock.block.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pixelateBlock.block.d.ts","sourceRoot":"","sources":["../../../../../src/blocks/babylon/demo/effects/pixelateBlock.block.ts"],"names":[],"mappings":"AAYA,OAAO,EACH,aAAa,EAEb,mBAAmB,EACnB,KAAK,WAAW,EAChB,WAAW,EACX,KAAK,aAAa,EACF,8BAAsB;AAyF1C;;GAEG;AACH,qBAAa,aAAc,SAAQ,WAAW;IAC1C;;OAEG;IACH,OAAuB,SAAS,SAAmB;IAEnD;;OAEG;IACH,OAAuB,SAAS,SAA0B;IAE1D;;OAEG;IACH,SAAgB,KAAK,+EAAoE;IAEzF;;;OAGG;IACH,SAAgB,SAAS,8HAIvB;IAEF;;;OAGG;IACH,SAAgB,QAAQ,gIAItB;IAEF;;OAEG;IACH,OAAuB,UAAU,gBAAsB;IAEvD;;;;OAIG;gBACS,WAAW,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM;IAIlD;;;OAGG;IACI,gBAAgB,IAAI,aAAa;CAO3C"}
|