@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,76 @@
|
|
|
1
|
+
import type { Effect } from "@onerjs/core/Materials/effect.js";
|
|
2
|
+
import { type ShaderProgram, type RuntimeData, ConnectionPointType, type SmartFilter, ShaderBinding, ShaderBlock } from "@onerjs/smart-filters";
|
|
3
|
+
declare const ShaderProgram: ShaderProgram;
|
|
4
|
+
/**
|
|
5
|
+
* The shader bindings for the DirectionalBlur block.
|
|
6
|
+
*/
|
|
7
|
+
export declare class DirectionalBlurShaderBinding extends ShaderBinding {
|
|
8
|
+
private readonly _inputTexture;
|
|
9
|
+
private readonly _blurHorizontalWidth;
|
|
10
|
+
private readonly _blurVerticalWidth;
|
|
11
|
+
/**
|
|
12
|
+
* Creates a new shader binding instance for the DirectionalBlur block.
|
|
13
|
+
* @param inputTexture - The input texture
|
|
14
|
+
* @param blurHorizontalWidth - The horizontal blur width
|
|
15
|
+
* @param blurVerticalWidth - The vertical blur width
|
|
16
|
+
*/
|
|
17
|
+
constructor(inputTexture: RuntimeData<ConnectionPointType.Texture>, blurHorizontalWidth: number, blurVerticalWidth: number);
|
|
18
|
+
/**
|
|
19
|
+
* Binds all the required data to the shader when rendering.
|
|
20
|
+
* @param effect - defines the effect to bind the data to
|
|
21
|
+
*/
|
|
22
|
+
bind(effect: Effect): void;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* A block performing a directional "gaussian" blur.
|
|
26
|
+
*
|
|
27
|
+
* It is aggregated as part of the @see BlurBlock.
|
|
28
|
+
*/
|
|
29
|
+
export declare class DirectionalBlurBlock extends ShaderBlock {
|
|
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
|
+
* Defines how smaller we should make the target compared to the screen size.
|
|
44
|
+
*/
|
|
45
|
+
blurTextureRatio: number;
|
|
46
|
+
/**
|
|
47
|
+
* Defines the horizontal strength of the blur.
|
|
48
|
+
*/
|
|
49
|
+
blurHorizontalWidth: number;
|
|
50
|
+
/**
|
|
51
|
+
* Defines the vertical strength of the blur.
|
|
52
|
+
*/
|
|
53
|
+
blurVerticalWidth: number;
|
|
54
|
+
/**
|
|
55
|
+
* The shader program (vertex and fragment code) to use to render the block
|
|
56
|
+
*/
|
|
57
|
+
static ShaderCode: ShaderProgram;
|
|
58
|
+
/**
|
|
59
|
+
* Instantiates a new Block.
|
|
60
|
+
* @param smartFilter - The smart filter this block belongs to
|
|
61
|
+
* @param name - The friendly name of the block
|
|
62
|
+
*/
|
|
63
|
+
constructor(smartFilter: SmartFilter, name: string);
|
|
64
|
+
/**
|
|
65
|
+
* Prepares the block for runtime.
|
|
66
|
+
* This is called by the smart filter just before creating the smart filter runtime.
|
|
67
|
+
*/
|
|
68
|
+
prepareForRuntime(): void;
|
|
69
|
+
/**
|
|
70
|
+
* Get the class instance that binds all the required data to the shader (effect) when rendering.
|
|
71
|
+
* @returns The class instance that binds the data to the effect
|
|
72
|
+
*/
|
|
73
|
+
getShaderBinding(): ShaderBinding;
|
|
74
|
+
}
|
|
75
|
+
export {};
|
|
76
|
+
//# sourceMappingURL=directionalBlurBlock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"directionalBlurBlock.d.ts","sourceRoot":"","sources":["../../../../../src/blocks/babylon/demo/effects/directionalBlurBlock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,yCAAiC;AAEvD,OAAO,EACH,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,mBAAmB,EACnB,KAAK,WAAW,EAGhB,aAAa,EACb,WAAW,EACd,8BAAsB;AAKvB,QAAA,MAAM,aAAa,EAAE,aA6CpB,CAAC;AAIF;;GAEG;AACH,qBAAa,4BAA6B,SAAQ,aAAa;IAC3D,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA2C;IACzE,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAS;IAC9C,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAS;IAE5C;;;;;OAKG;gBACS,YAAY,EAAE,WAAW,CAAC,mBAAmB,CAAC,OAAO,CAAC,EAAE,mBAAmB,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM;IAO1H;;;OAGG;IACa,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;CAe7C;AAED;;;;GAIG;AACH,qBAAa,oBAAqB,SAAQ,WAAW;IACjD;;OAEG;IACH,OAAuB,SAAS,SAA4B;IAE5D;;OAEG;IACH,OAAuB,SAAS,SAA+B;IAE/D;;OAEG;IACH,SAAgB,KAAK,+EAA6D;IAElF;;OAEG;IAMI,gBAAgB,SAAO;IAE9B;;OAEG;IAMI,mBAAmB,SAAK;IAE/B;;OAEG;IAMI,iBAAiB,SAAK;IAE7B;;OAEG;IACH,OAAuB,UAAU,gBAAiB;IAElD;;;;OAIG;gBACS,WAAW,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM;IAIlD;;;OAGG;IACa,iBAAiB,IAAI,IAAI;IAMzC;;;OAGG;IACI,gBAAgB,IAAI,aAAa;CAK3C"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ISerializedBlockV1, SmartFilter } from "@onerjs/smart-filters";
|
|
2
|
+
import { DirectionalBlurBlock } from "./directionalBlurBlock.js";
|
|
3
|
+
/**
|
|
4
|
+
* The definition of the extra data serialized for directional blur blocks.
|
|
5
|
+
*/
|
|
6
|
+
export interface ISerializedDirectionalBlurBlockV1 extends ISerializedBlockV1 {
|
|
7
|
+
/**
|
|
8
|
+
* The extra data of the block.
|
|
9
|
+
*/
|
|
10
|
+
data: {
|
|
11
|
+
/**
|
|
12
|
+
* The horizontal width of the blur.
|
|
13
|
+
*/
|
|
14
|
+
blurHorizontalWidth: number;
|
|
15
|
+
/**
|
|
16
|
+
* The vertical width of the blur.
|
|
17
|
+
*/
|
|
18
|
+
blurVerticalWidth: number;
|
|
19
|
+
/**
|
|
20
|
+
* The blur texture ratio.
|
|
21
|
+
*/
|
|
22
|
+
blurTextureRatio: number;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* V1 Directional Blur Deserializer.
|
|
27
|
+
* @param smartFilter - The SmartFilter to deserialize the block into
|
|
28
|
+
* @param serializedBlock - The serialized block data
|
|
29
|
+
* @returns A deserialized DirectionalBlurBlock
|
|
30
|
+
*/
|
|
31
|
+
export declare function DirectionalBlurDeserializer(smartFilter: SmartFilter, serializedBlock: ISerializedDirectionalBlurBlockV1): DirectionalBlurBlock;
|
|
32
|
+
//# sourceMappingURL=directionalBlurBlock.deserializer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"directionalBlurBlock.deserializer.d.ts","sourceRoot":"","sources":["../../../../../src/blocks/babylon/demo/effects/directionalBlurBlock.deserializer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,8BAAsB;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE;;GAEG;AACH,MAAM,WAAW,iCAAkC,SAAQ,kBAAkB;IACzE;;OAEG;IACH,IAAI,EAAE;QACF;;WAEG;QACH,mBAAmB,EAAE,MAAM,CAAC;QAE5B;;WAEG;QACH,iBAAiB,EAAE,MAAM,CAAC;QAE1B;;WAEG;QACH,gBAAgB,EAAE,MAAM,CAAC;KAC5B,CAAC;CACL;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,WAAW,EAAE,WAAW,EAAE,eAAe,EAAE,iCAAiC,wBAQvH"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { DirectionalBlurBlock } from "./directionalBlurBlock.js";
|
|
2
|
+
/**
|
|
3
|
+
* V1 Directional Blur Deserializer.
|
|
4
|
+
* @param smartFilter - The SmartFilter to deserialize the block into
|
|
5
|
+
* @param serializedBlock - The serialized block data
|
|
6
|
+
* @returns A deserialized DirectionalBlurBlock
|
|
7
|
+
*/
|
|
8
|
+
export function DirectionalBlurDeserializer(smartFilter, serializedBlock) {
|
|
9
|
+
const block = new DirectionalBlurBlock(smartFilter, serializedBlock.name);
|
|
10
|
+
// If data is missing, use the default value set by the block
|
|
11
|
+
block.blurHorizontalWidth = serializedBlock.data.blurHorizontalWidth ?? block.blurHorizontalWidth;
|
|
12
|
+
block.blurVerticalWidth = serializedBlock.data.blurVerticalWidth ?? block.blurVerticalWidth;
|
|
13
|
+
block.blurTextureRatio = serializedBlock.data.blurTextureRatio ?? block.blurTextureRatio;
|
|
14
|
+
return block;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=directionalBlurBlock.deserializer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"directionalBlurBlock.deserializer.js","sourceRoot":"","sources":["../../../../../src/blocks/babylon/demo/effects/directionalBlurBlock.deserializer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AA2BjE;;;;;GAKG;AACH,MAAM,UAAU,2BAA2B,CAAC,WAAwB,EAAE,eAAkD;IACpH,MAAM,KAAK,GAAG,IAAI,oBAAoB,CAAC,WAAW,EAAE,eAAe,CAAC,IAAI,CAAC,CAAC;IAE1E,6DAA6D;IAC7D,KAAK,CAAC,mBAAmB,GAAG,eAAe,CAAC,IAAI,CAAC,mBAAmB,IAAI,KAAK,CAAC,mBAAmB,CAAC;IAClG,KAAK,CAAC,iBAAiB,GAAG,eAAe,CAAC,IAAI,CAAC,iBAAiB,IAAI,KAAK,CAAC,iBAAiB,CAAC;IAC5F,KAAK,CAAC,gBAAgB,GAAG,eAAe,CAAC,IAAI,CAAC,gBAAgB,IAAI,KAAK,CAAC,gBAAgB,CAAC;IACzF,OAAO,KAAK,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { __decorate } from "@onerjs/core/tslib.es6.js";
|
|
2
|
+
import { ConnectionPointType, editableInPropertyPage, PropertyTypeForEdition, ShaderBinding, ShaderBlock, } from "@onerjs/smart-filters";
|
|
3
|
+
import { directionalBlurBlockType } from "../../../blockTypes.js";
|
|
4
|
+
import { babylonDemoEffectsNamespace } from "../../../blockNamespaces.js";
|
|
5
|
+
const ShaderProgram = {
|
|
6
|
+
fragment: {
|
|
7
|
+
const: `
|
|
8
|
+
const float _epsilon_ = 0.01;
|
|
9
|
+
`,
|
|
10
|
+
uniform: `
|
|
11
|
+
uniform vec2 _texelStep_;
|
|
12
|
+
uniform sampler2D _input_;
|
|
13
|
+
`,
|
|
14
|
+
uniformSingle: `
|
|
15
|
+
uniform float[7] _weights_;
|
|
16
|
+
`,
|
|
17
|
+
mainFunctionName: "_directionalBlur_",
|
|
18
|
+
mainInputTexture: "_input_",
|
|
19
|
+
functions: [
|
|
20
|
+
{
|
|
21
|
+
name: "_directionalBlur_",
|
|
22
|
+
code: `
|
|
23
|
+
vec4 _directionalBlur_(vec2 vUV) {
|
|
24
|
+
vec2 start = vUV - 3.0 * _texelStep_;
|
|
25
|
+
|
|
26
|
+
vec4 finalWeightedColor = vec4(0., 0., 0., 0.);
|
|
27
|
+
|
|
28
|
+
for (int i = 0; i < 7; i++)
|
|
29
|
+
{
|
|
30
|
+
vec2 fetchUV = start + _texelStep_ * float(i);
|
|
31
|
+
fetchUV = clamp(fetchUV, 0., 1.);
|
|
32
|
+
vec4 colorSample = texture2D(_input_, fetchUV);
|
|
33
|
+
|
|
34
|
+
// Ignore samples from mostly transparent pixels
|
|
35
|
+
if (colorSample.a < _epsilon_) continue;
|
|
36
|
+
|
|
37
|
+
finalWeightedColor += colorSample * _weights_[i];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return finalWeightedColor;
|
|
41
|
+
}
|
|
42
|
+
`,
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
const WideWeights = Float32Array.from([0.05, 0.1, 0.2, 0.3, 0.2, 0.1, 0.05]);
|
|
48
|
+
/**
|
|
49
|
+
* The shader bindings for the DirectionalBlur block.
|
|
50
|
+
*/
|
|
51
|
+
export class DirectionalBlurShaderBinding extends ShaderBinding {
|
|
52
|
+
/**
|
|
53
|
+
* Creates a new shader binding instance for the DirectionalBlur block.
|
|
54
|
+
* @param inputTexture - The input texture
|
|
55
|
+
* @param blurHorizontalWidth - The horizontal blur width
|
|
56
|
+
* @param blurVerticalWidth - The vertical blur width
|
|
57
|
+
*/
|
|
58
|
+
constructor(inputTexture, blurHorizontalWidth, blurVerticalWidth) {
|
|
59
|
+
super();
|
|
60
|
+
this._inputTexture = inputTexture;
|
|
61
|
+
this._blurHorizontalWidth = blurHorizontalWidth;
|
|
62
|
+
this._blurVerticalWidth = blurVerticalWidth;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Binds all the required data to the shader when rendering.
|
|
66
|
+
* @param effect - defines the effect to bind the data to
|
|
67
|
+
*/
|
|
68
|
+
bind(effect) {
|
|
69
|
+
// Global pass Setup
|
|
70
|
+
effect.setFloatArray(this.getRemappedName("weights"), WideWeights);
|
|
71
|
+
// V blur
|
|
72
|
+
effect.setTexture(this.getRemappedName("input"), this._inputTexture.value);
|
|
73
|
+
// Texel size
|
|
74
|
+
if (this._inputTexture.value) {
|
|
75
|
+
const inputSize = this._inputTexture.value.getSize();
|
|
76
|
+
const texelWidth = this._blurHorizontalWidth / inputSize.width;
|
|
77
|
+
const texelHeight = this._blurVerticalWidth / inputSize.height;
|
|
78
|
+
effect.setFloat2(this.getRemappedName("texelStep"), texelWidth, texelHeight);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* A block performing a directional "gaussian" blur.
|
|
84
|
+
*
|
|
85
|
+
* It is aggregated as part of the @see BlurBlock.
|
|
86
|
+
*/
|
|
87
|
+
export class DirectionalBlurBlock extends ShaderBlock {
|
|
88
|
+
/**
|
|
89
|
+
* Instantiates a new Block.
|
|
90
|
+
* @param smartFilter - The smart filter this block belongs to
|
|
91
|
+
* @param name - The friendly name of the block
|
|
92
|
+
*/
|
|
93
|
+
constructor(smartFilter, name) {
|
|
94
|
+
super(smartFilter, name, true);
|
|
95
|
+
/**
|
|
96
|
+
* The input texture connection point.
|
|
97
|
+
*/
|
|
98
|
+
this.input = this._registerInput("input", ConnectionPointType.Texture);
|
|
99
|
+
/**
|
|
100
|
+
* Defines how smaller we should make the target compared to the screen size.
|
|
101
|
+
*/
|
|
102
|
+
this.blurTextureRatio = 0.5;
|
|
103
|
+
/**
|
|
104
|
+
* Defines the horizontal strength of the blur.
|
|
105
|
+
*/
|
|
106
|
+
this.blurHorizontalWidth = 0;
|
|
107
|
+
/**
|
|
108
|
+
* Defines the vertical strength of the blur.
|
|
109
|
+
*/
|
|
110
|
+
this.blurVerticalWidth = 1;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Prepares the block for runtime.
|
|
114
|
+
* This is called by the smart filter just before creating the smart filter runtime.
|
|
115
|
+
*/
|
|
116
|
+
prepareForRuntime() {
|
|
117
|
+
super.prepareForRuntime();
|
|
118
|
+
this.outputTextureOptions.ratio = this.blurTextureRatio;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Get the class instance that binds all the required data to the shader (effect) when rendering.
|
|
122
|
+
* @returns The class instance that binds the data to the effect
|
|
123
|
+
*/
|
|
124
|
+
getShaderBinding() {
|
|
125
|
+
const input = this._confirmRuntimeDataSupplied(this.input);
|
|
126
|
+
return new DirectionalBlurShaderBinding(input, this.blurHorizontalWidth, this.blurVerticalWidth);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* The class name of the block.
|
|
131
|
+
*/
|
|
132
|
+
DirectionalBlurBlock.ClassName = directionalBlurBlockType;
|
|
133
|
+
/**
|
|
134
|
+
* The namespace of the block.
|
|
135
|
+
*/
|
|
136
|
+
DirectionalBlurBlock.Namespace = babylonDemoEffectsNamespace;
|
|
137
|
+
/**
|
|
138
|
+
* The shader program (vertex and fragment code) to use to render the block
|
|
139
|
+
*/
|
|
140
|
+
DirectionalBlurBlock.ShaderCode = ShaderProgram;
|
|
141
|
+
__decorate([
|
|
142
|
+
editableInPropertyPage("Texture Ratio", PropertyTypeForEdition.Float, "PROPERTIES", {
|
|
143
|
+
min: 0,
|
|
144
|
+
max: 1,
|
|
145
|
+
notifiers: { rebuild: true },
|
|
146
|
+
})
|
|
147
|
+
], DirectionalBlurBlock.prototype, "blurTextureRatio", void 0);
|
|
148
|
+
__decorate([
|
|
149
|
+
editableInPropertyPage("Horizontal strength", PropertyTypeForEdition.Float, "PROPERTIES", {
|
|
150
|
+
min: 0,
|
|
151
|
+
max: 1,
|
|
152
|
+
notifiers: { rebuild: true },
|
|
153
|
+
})
|
|
154
|
+
], DirectionalBlurBlock.prototype, "blurHorizontalWidth", void 0);
|
|
155
|
+
__decorate([
|
|
156
|
+
editableInPropertyPage("Vertical strength", PropertyTypeForEdition.Float, "PROPERTIES", {
|
|
157
|
+
min: 0,
|
|
158
|
+
max: 1,
|
|
159
|
+
notifiers: { rebuild: true },
|
|
160
|
+
})
|
|
161
|
+
], DirectionalBlurBlock.prototype, "blurVerticalWidth", void 0);
|
|
162
|
+
//# sourceMappingURL=directionalBlurBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"directionalBlurBlock.js","sourceRoot":"","sources":["../../../../../src/blocks/babylon/demo/effects/directionalBlurBlock.ts"],"names":[],"mappings":";AAEA,OAAO,EAGH,mBAAmB,EAEnB,sBAAsB,EACtB,sBAAsB,EACtB,aAAa,EACb,WAAW,GACd,8BAAsB;AAEvB,OAAO,EAAE,wBAAw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aAAa,AAAhB,CAAiB;AAzB3C;IALN,sBAAsB,CAAC,eAAe,EAAE,sBAAsB,CAAC,KAAK,EAAE,YAAY,EAAE;QACjF,GAAG,EAAE,CAAC;QACN,GAAG,EAAE,CAAC;QACN,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;KAC/B,CAAC;8DAC4B;AAUvB;IALN,sBAAsB,CAAC,qBAAqB,EAAE,sBAAsB,CAAC,KAAK,EAAE,YAAY,EAAE;QACvF,GAAG,EAAE,CAAC;QACN,GAAG,EAAE,CAAC;QACN,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;KAC/B,CAAC;iEAC6B;AAUxB;IALN,sBAAsB,CAAC,mBAAmB,EAAE,sBAAsB,CAAC,KAAK,EAAE,YAAY,EAAE;QACrF,GAAG,EAAE,CAAC;QACN,GAAG,EAAE,CAAC;QACN,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;KAC/B,CAAC;+DAC2B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"directionalBlurBlock.serializer.d.ts","sourceRoot":"","sources":["../../../../../src/blocks/babylon/demo/effects/directionalBlurBlock.serializer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAa,8BAAsB;AAKnE;;GAEG;AACH,eAAO,MAAM,8BAA8B,EAAE,kBAqB5C,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { directionalBlurBlockType } from "../../../blockTypes.js";
|
|
2
|
+
import { babylonDemoEffectsNamespace } from "../../../blockNamespaces.js";
|
|
3
|
+
/**
|
|
4
|
+
* The V1 serializer for a Directional Blur Block
|
|
5
|
+
*/
|
|
6
|
+
export const DirectionalBlurBlockSerializer = {
|
|
7
|
+
blockType: directionalBlurBlockType,
|
|
8
|
+
serialize: (block) => {
|
|
9
|
+
if (block.getClassName() !== directionalBlurBlockType) {
|
|
10
|
+
throw new Error("Was asked to serialize an unrecognized block type");
|
|
11
|
+
}
|
|
12
|
+
const directionalBlurBlock = block;
|
|
13
|
+
return {
|
|
14
|
+
name: block.name,
|
|
15
|
+
uniqueId: block.uniqueId,
|
|
16
|
+
blockType: directionalBlurBlockType,
|
|
17
|
+
namespace: babylonDemoEffectsNamespace,
|
|
18
|
+
comments: block.comments,
|
|
19
|
+
data: {
|
|
20
|
+
blurTextureRatio: directionalBlurBlock.blurTextureRatio,
|
|
21
|
+
blurHorizontalWidth: directionalBlurBlock.blurHorizontalWidth,
|
|
22
|
+
blurVerticalWidth: directionalBlurBlock.blurVerticalWidth,
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=directionalBlurBlock.serializer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"directionalBlurBlock.serializer.js","sourceRoot":"","sources":["../../../../../src/blocks/babylon/demo/effects/directionalBlurBlock.serializer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAE1E;;GAEG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAuB;IAC9D,SAAS,EAAE,wBAAwB;IACnC,SAAS,EAAE,CAAC,KAAgB,EAAE,EAAE;QAC5B,IAAI,KAAK,CAAC,YAAY,EAAE,KAAK,wBAAwB,EAAE,CAAC;YACpD,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;QACzE,CAAC;QAED,MAAM,oBAAoB,GAAG,KAA6B,CAAC;QAC3D,OAAO;YACH,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,SAAS,EAAE,wBAAwB;YACnC,SAAS,EAAE,2BAA2B;YACtC,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,IAAI,EAAE;gBACF,gBAAgB,EAAE,oBAAoB,CAAC,gBAAgB;gBACvD,mBAAmB,EAAE,oBAAoB,CAAC,mBAAmB;gBAC7D,iBAAiB,EAAE,oBAAoB,CAAC,iBAAiB;aAC5D;SACJ,CAAC;IACN,CAAC;CACJ,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { DisableableShaderBinding, ConnectionPointType, type SmartFilter, DisableableShaderBlock, type ShaderProgram } from "@onerjs/smart-filters";
|
|
2
|
+
/**
|
|
3
|
+
* The implementation of the ExposureBlock
|
|
4
|
+
*/
|
|
5
|
+
export declare class ExposureBlock 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 amount connection point.
|
|
20
|
+
*/
|
|
21
|
+
readonly amount: import("@onerjs/smart-filters").ConnectionPoint<ConnectionPointType.Float>;
|
|
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 ExposureBlock.
|
|
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=exposureBlock.block.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exposureBlock.block.d.ts","sourceRoot":"","sources":["../../../../../src/blocks/babylon/demo/effects/exposureBlock.block.ts"],"names":[],"mappings":"AAYA,OAAO,EACH,wBAAwB,EAExB,mBAAmB,EACnB,KAAK,WAAW,EAChB,sBAAsB,EACtB,KAAK,aAAa,EAEG,8BAAsB;AAwE/C;;GAEG;AACH,qBAAa,aAAc,SAAQ,sBAAsB;IACrD;;OAEG;IACH,OAAuB,SAAS,SAAmB;IAEnD;;OAEG;IACH,OAAuB,SAAS,SAA0B;IAE1D;;OAEG;IACH,SAAgB,KAAK,+EAAoE;IAEzF;;OAEG;IACH,SAAgB,MAAM,6EAAmE;IAEzF;;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,106 @@
|
|
|
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 float _amount_;`,
|
|
15
|
+
mainInputTexture: "_input_",
|
|
16
|
+
mainFunctionName: "_exposure_",
|
|
17
|
+
functions: [
|
|
18
|
+
{
|
|
19
|
+
name: "_exposure_",
|
|
20
|
+
code: `
|
|
21
|
+
vec4 _exposure_(vec2 vUV) {
|
|
22
|
+
vec4 color = texture2D(_input_, vUV);
|
|
23
|
+
return vec4(color.rgb * _amount_, color.a);
|
|
24
|
+
}
|
|
25
|
+
`,
|
|
26
|
+
params: "vec2 vUV",
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* The uniform names for this shader, to be used in the shader binding so
|
|
33
|
+
* that the names are always in sync.
|
|
34
|
+
*/
|
|
35
|
+
const Uniforms = {
|
|
36
|
+
input: "input",
|
|
37
|
+
amount: "amount",
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* The shader binding for the ExposureBlock, used by the runtime
|
|
41
|
+
*/
|
|
42
|
+
class ExposureBlockShaderBinding extends DisableableShaderBinding {
|
|
43
|
+
/**
|
|
44
|
+
* Creates a new shader binding instance for the block.
|
|
45
|
+
* @param parentBlock - IDisableableBlock
|
|
46
|
+
* @param input - The input runtime value
|
|
47
|
+
* @param amount - The amount runtime value
|
|
48
|
+
*/
|
|
49
|
+
constructor(parentBlock, input, amount) {
|
|
50
|
+
super(parentBlock);
|
|
51
|
+
this._input = input;
|
|
52
|
+
this._amount = amount;
|
|
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
|
+
effect.setFloat(this.getRemappedName(Uniforms.amount), this._amount.value);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* The implementation of the ExposureBlock
|
|
66
|
+
*/
|
|
67
|
+
export class ExposureBlock extends DisableableShaderBlock {
|
|
68
|
+
/**
|
|
69
|
+
* Instantiates a new ExposureBlock.
|
|
70
|
+
* @param smartFilter - The smart filter this block belongs to
|
|
71
|
+
* @param name - The friendly name of the block
|
|
72
|
+
*/
|
|
73
|
+
constructor(smartFilter, name) {
|
|
74
|
+
super(smartFilter, name, false, BlockDisableStrategy.AutoSample);
|
|
75
|
+
/**
|
|
76
|
+
* The input connection point.
|
|
77
|
+
*/
|
|
78
|
+
this.input = this._registerInput(Uniforms.input, ConnectionPointType.Texture);
|
|
79
|
+
/**
|
|
80
|
+
* The amount connection point.
|
|
81
|
+
*/
|
|
82
|
+
this.amount = this._registerInput(Uniforms.amount, ConnectionPointType.Float);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Get the class instance that binds all the required data to the shader (effect) when rendering.
|
|
86
|
+
* @returns The class instance that binds the data to the effect
|
|
87
|
+
*/
|
|
88
|
+
getShaderBinding() {
|
|
89
|
+
const input = this._confirmRuntimeDataSupplied(this.input);
|
|
90
|
+
const amount = this._confirmRuntimeDataSupplied(this.amount);
|
|
91
|
+
return new ExposureBlockShaderBinding(this, input, amount);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* The class name of the block.
|
|
96
|
+
*/
|
|
97
|
+
ExposureBlock.ClassName = "ExposureBlock";
|
|
98
|
+
/**
|
|
99
|
+
* The namespace of the block.
|
|
100
|
+
*/
|
|
101
|
+
ExposureBlock.Namespace = "Babylon.Demo.Effects";
|
|
102
|
+
/**
|
|
103
|
+
* The shader program (vertex and fragment code) to use to render the block
|
|
104
|
+
*/
|
|
105
|
+
ExposureBlock.ShaderCode = BlockShaderProgram;
|
|
106
|
+
//# sourceMappingURL=exposureBlock.block.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exposureBlock.block.js","sourceRoot":"","sources":["../../../../../src/blocks/babylon/demo/effects/exposureBlock.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,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AC,KAAK,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAAC;QAEzF;;WAEG;QACa,WAAM,GAAG,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,MAAM,EAAE,mBAAmB,CAAC,KAAK,CAAC,CAAC;IAczF,CAAC;IAED;;;OAGG;IACI,gBAAgB;QACnB,MAAM,KAAK,GAAG,IAAI,CAAC,2BAA2B,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC3D,MAAM,MAAM,GAAG,IAAI,CAAC,2BAA2B,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAE7D,OAAO,IAAI,0BAA0B,CAAC,IAAI,EAAC,KAAK,EAAC,MAAM,CAAC,CAAC;IAC7D,CAAC;;AA3CD;;GAEG;AACoB,uBAAS,GAAG,eAAe,AAAlB,CAAmB;AAEnD;;GAEG;AACoB,uBAAS,GAAG,sBAAsB,AAAzB,CAA0B;AAY1D;;GAEG;AACoB,wBAAU,GAAG,kBAAkB,AAArB,CAAsB"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { DisableableShaderBinding, ConnectionPointType, type SmartFilter, DisableableShaderBlock, type ShaderProgram } from "@onerjs/smart-filters";
|
|
2
|
+
/**
|
|
3
|
+
* The implementation of the GreenScreenBlock
|
|
4
|
+
*/
|
|
5
|
+
export declare class GreenScreenBlock 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 background connection point.
|
|
20
|
+
*/
|
|
21
|
+
readonly background: import("@onerjs/smart-filters").ConnectionPoint<ConnectionPointType.Texture>;
|
|
22
|
+
/**
|
|
23
|
+
* The reference connection point.
|
|
24
|
+
*/
|
|
25
|
+
readonly reference: import("@onerjs/smart-filters").ConnectionPoint<ConnectionPointType.Color3>;
|
|
26
|
+
/**
|
|
27
|
+
* The distance connection point.
|
|
28
|
+
*/
|
|
29
|
+
readonly distance: import("@onerjs/smart-filters").ConnectionPoint<ConnectionPointType.Float>;
|
|
30
|
+
/**
|
|
31
|
+
* The shader program (vertex and fragment code) to use to render the block
|
|
32
|
+
*/
|
|
33
|
+
static ShaderCode: ShaderProgram;
|
|
34
|
+
/**
|
|
35
|
+
* Instantiates a new GreenScreenBlock.
|
|
36
|
+
* @param smartFilter - The smart filter this block belongs to
|
|
37
|
+
* @param name - The friendly name of the block
|
|
38
|
+
*/
|
|
39
|
+
constructor(smartFilter: SmartFilter, name: string);
|
|
40
|
+
/**
|
|
41
|
+
* Get the class instance that binds all the required data to the shader (effect) when rendering.
|
|
42
|
+
* @returns The class instance that binds the data to the effect
|
|
43
|
+
*/
|
|
44
|
+
getShaderBinding(): DisableableShaderBinding;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=greenScreenBlock.block.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"greenScreenBlock.block.d.ts","sourceRoot":"","sources":["../../../../../src/blocks/babylon/demo/effects/greenScreenBlock.block.ts"],"names":[],"mappings":"AAYA,OAAO,EACH,wBAAwB,EAExB,mBAAmB,EACnB,KAAK,WAAW,EAChB,sBAAsB,EACtB,KAAK,aAAa,EAEG,8BAAsB;AA4F/C;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,sBAAsB;IACxD;;OAEG;IACH,OAAuB,SAAS,SAAsB;IAEtD;;OAEG;IACH,OAAuB,SAAS,SAA0B;IAE1D;;OAEG;IACH,SAAgB,KAAK,+EAAoE;IAEzF;;OAEG;IACH,SAAgB,UAAU,+EAAyE;IAEnG;;OAEG;IACH,SAAgB,SAAS,8EAAuE;IAEhG;;OAEG;IACH,SAAgB,QAAQ,6EAAqE;IAE7F;;OAEG;IACH,OAAuB,UAAU,gBAAsB;IAEvD;;;;OAIG;gBACS,WAAW,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM;IAIlD;;;OAGG;IACI,gBAAgB,IAAI,wBAAwB;CAQtD"}
|