@babylonjs/smart-filters-blocks 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (190) hide show
  1. package/dist/blocks/babylon/demo/effects/blackAndWhiteBlock.block.d.ts +34 -0
  2. package/dist/blocks/babylon/demo/effects/blackAndWhiteBlock.block.d.ts.map +1 -0
  3. package/dist/blocks/babylon/demo/effects/blackAndWhiteBlock.block.js +101 -0
  4. package/dist/blocks/babylon/demo/effects/blackAndWhiteBlock.block.js.map +1 -0
  5. package/dist/blocks/babylon/demo/effects/blurBlock.d.ts +53 -0
  6. package/dist/blocks/babylon/demo/effects/blurBlock.d.ts.map +1 -0
  7. package/dist/blocks/babylon/demo/effects/blurBlock.deserializer.d.ts +28 -0
  8. package/dist/blocks/babylon/demo/effects/blurBlock.deserializer.d.ts.map +1 -0
  9. package/dist/blocks/babylon/demo/effects/blurBlock.deserializer.js +17 -0
  10. package/dist/blocks/babylon/demo/effects/blurBlock.deserializer.js.map +1 -0
  11. package/dist/blocks/babylon/demo/effects/blurBlock.js +98 -0
  12. package/dist/blocks/babylon/demo/effects/blurBlock.js.map +1 -0
  13. package/dist/blocks/babylon/demo/effects/blurBlock.serializer.d.ts +8 -0
  14. package/dist/blocks/babylon/demo/effects/blurBlock.serializer.d.ts.map +1 -0
  15. package/dist/blocks/babylon/demo/effects/blurBlock.serializer.js +28 -0
  16. package/dist/blocks/babylon/demo/effects/blurBlock.serializer.js.map +1 -0
  17. package/dist/blocks/babylon/demo/effects/compositionBlock.d.ts +116 -0
  18. package/dist/blocks/babylon/demo/effects/compositionBlock.d.ts.map +1 -0
  19. package/dist/blocks/babylon/demo/effects/compositionBlock.deserializer.d.ts +24 -0
  20. package/dist/blocks/babylon/demo/effects/compositionBlock.deserializer.d.ts.map +1 -0
  21. package/dist/blocks/babylon/demo/effects/compositionBlock.deserializer.js +15 -0
  22. package/dist/blocks/babylon/demo/effects/compositionBlock.deserializer.js.map +1 -0
  23. package/dist/blocks/babylon/demo/effects/compositionBlock.fragment.d.ts +18 -0
  24. package/dist/blocks/babylon/demo/effects/compositionBlock.fragment.d.ts.map +1 -0
  25. package/dist/blocks/babylon/demo/effects/compositionBlock.fragment.js +69 -0
  26. package/dist/blocks/babylon/demo/effects/compositionBlock.fragment.js.map +1 -0
  27. package/dist/blocks/babylon/demo/effects/compositionBlock.js +167 -0
  28. package/dist/blocks/babylon/demo/effects/compositionBlock.js.map +1 -0
  29. package/dist/blocks/babylon/demo/effects/compositionBlock.serializer.d.ts +6 -0
  30. package/dist/blocks/babylon/demo/effects/compositionBlock.serializer.d.ts.map +1 -0
  31. package/dist/blocks/babylon/demo/effects/compositionBlock.serializer.js +25 -0
  32. package/dist/blocks/babylon/demo/effects/compositionBlock.serializer.js.map +1 -0
  33. package/dist/blocks/babylon/demo/effects/contrastBlock.block.d.ts +39 -0
  34. package/dist/blocks/babylon/demo/effects/contrastBlock.block.d.ts.map +1 -0
  35. package/dist/blocks/babylon/demo/effects/contrastBlock.block.js +140 -0
  36. package/dist/blocks/babylon/demo/effects/contrastBlock.block.js.map +1 -0
  37. package/dist/blocks/babylon/demo/effects/desaturateBlock.block.d.ts +39 -0
  38. package/dist/blocks/babylon/demo/effects/desaturateBlock.block.d.ts.map +1 -0
  39. package/dist/blocks/babylon/demo/effects/desaturateBlock.block.js +115 -0
  40. package/dist/blocks/babylon/demo/effects/desaturateBlock.block.js.map +1 -0
  41. package/dist/blocks/babylon/demo/effects/directionalBlurBlock.d.ts +74 -0
  42. package/dist/blocks/babylon/demo/effects/directionalBlurBlock.d.ts.map +1 -0
  43. package/dist/blocks/babylon/demo/effects/directionalBlurBlock.deserializer.d.ts +32 -0
  44. package/dist/blocks/babylon/demo/effects/directionalBlurBlock.deserializer.d.ts.map +1 -0
  45. package/dist/blocks/babylon/demo/effects/directionalBlurBlock.deserializer.js +17 -0
  46. package/dist/blocks/babylon/demo/effects/directionalBlurBlock.deserializer.js.map +1 -0
  47. package/dist/blocks/babylon/demo/effects/directionalBlurBlock.js +167 -0
  48. package/dist/blocks/babylon/demo/effects/directionalBlurBlock.js.map +1 -0
  49. package/dist/blocks/babylon/demo/effects/directionalBlurBlock.serializer.d.ts +6 -0
  50. package/dist/blocks/babylon/demo/effects/directionalBlurBlock.serializer.d.ts.map +1 -0
  51. package/dist/blocks/babylon/demo/effects/directionalBlurBlock.serializer.js +27 -0
  52. package/dist/blocks/babylon/demo/effects/directionalBlurBlock.serializer.js.map +1 -0
  53. package/dist/blocks/babylon/demo/effects/exposureBlock.block.d.ts +38 -0
  54. package/dist/blocks/babylon/demo/effects/exposureBlock.block.d.ts.map +1 -0
  55. package/dist/blocks/babylon/demo/effects/exposureBlock.block.js +107 -0
  56. package/dist/blocks/babylon/demo/effects/exposureBlock.block.js.map +1 -0
  57. package/dist/blocks/babylon/demo/effects/greenScreenBlock.block.d.ts +46 -0
  58. package/dist/blocks/babylon/demo/effects/greenScreenBlock.block.d.ts.map +1 -0
  59. package/dist/blocks/babylon/demo/effects/greenScreenBlock.block.js +133 -0
  60. package/dist/blocks/babylon/demo/effects/greenScreenBlock.block.js.map +1 -0
  61. package/dist/blocks/babylon/demo/effects/index.d.ts +15 -0
  62. package/dist/blocks/babylon/demo/effects/index.d.ts.map +1 -0
  63. package/dist/blocks/babylon/demo/effects/index.js +15 -0
  64. package/dist/blocks/babylon/demo/effects/index.js.map +1 -0
  65. package/dist/blocks/babylon/demo/effects/kaleidoscopeBlock.d.ts +58 -0
  66. package/dist/blocks/babylon/demo/effects/kaleidoscopeBlock.d.ts.map +1 -0
  67. package/dist/blocks/babylon/demo/effects/kaleidoscopeBlock.js +158 -0
  68. package/dist/blocks/babylon/demo/effects/kaleidoscopeBlock.js.map +1 -0
  69. package/dist/blocks/babylon/demo/effects/maskBlock.block.d.ts +38 -0
  70. package/dist/blocks/babylon/demo/effects/maskBlock.block.d.ts.map +1 -0
  71. package/dist/blocks/babylon/demo/effects/maskBlock.block.js +110 -0
  72. package/dist/blocks/babylon/demo/effects/maskBlock.block.js.map +1 -0
  73. package/dist/blocks/babylon/demo/effects/pixelateBlock.block.d.ts +44 -0
  74. package/dist/blocks/babylon/demo/effects/pixelateBlock.block.d.ts.map +1 -0
  75. package/dist/blocks/babylon/demo/effects/pixelateBlock.block.js +125 -0
  76. package/dist/blocks/babylon/demo/effects/pixelateBlock.block.js.map +1 -0
  77. package/dist/blocks/babylon/demo/effects/posterizeBlock.block.d.ts +39 -0
  78. package/dist/blocks/babylon/demo/effects/posterizeBlock.block.d.ts.map +1 -0
  79. package/dist/blocks/babylon/demo/effects/posterizeBlock.block.js +116 -0
  80. package/dist/blocks/babylon/demo/effects/posterizeBlock.block.js.map +1 -0
  81. package/dist/blocks/babylon/demo/effects/spritesheetBlock.d.ts +77 -0
  82. package/dist/blocks/babylon/demo/effects/spritesheetBlock.d.ts.map +1 -0
  83. package/dist/blocks/babylon/demo/effects/spritesheetBlock.fragment.d.ts +18 -0
  84. package/dist/blocks/babylon/demo/effects/spritesheetBlock.fragment.d.ts.map +1 -0
  85. package/dist/blocks/babylon/demo/effects/spritesheetBlock.fragment.js +58 -0
  86. package/dist/blocks/babylon/demo/effects/spritesheetBlock.fragment.js.map +1 -0
  87. package/dist/blocks/babylon/demo/effects/spritesheetBlock.js +98 -0
  88. package/dist/blocks/babylon/demo/effects/spritesheetBlock.js.map +1 -0
  89. package/dist/blocks/babylon/demo/effects/tintBlock.d.ts +7 -0
  90. package/dist/blocks/babylon/demo/effects/tintBlock.d.ts.map +1 -0
  91. package/dist/blocks/babylon/demo/effects/tintBlock.js +51 -0
  92. package/dist/blocks/babylon/demo/effects/tintBlock.js.map +1 -0
  93. package/dist/blocks/babylon/demo/transitions/index.d.ts +2 -0
  94. package/dist/blocks/babylon/demo/transitions/index.d.ts.map +1 -0
  95. package/dist/blocks/babylon/demo/transitions/index.js +2 -0
  96. package/dist/blocks/babylon/demo/transitions/index.js.map +1 -0
  97. package/dist/blocks/babylon/demo/transitions/wipeBlock.block.d.ts +42 -0
  98. package/dist/blocks/babylon/demo/transitions/wipeBlock.block.d.ts.map +1 -0
  99. package/dist/blocks/babylon/demo/transitions/wipeBlock.block.js +116 -0
  100. package/dist/blocks/babylon/demo/transitions/wipeBlock.block.js.map +1 -0
  101. package/dist/blocks/babylon/demo/utilities/index.d.ts +2 -0
  102. package/dist/blocks/babylon/demo/utilities/index.d.ts.map +1 -0
  103. package/dist/blocks/babylon/demo/utilities/index.js +2 -0
  104. package/dist/blocks/babylon/demo/utilities/index.js.map +1 -0
  105. package/dist/blocks/babylon/demo/utilities/premultiplyAlphaBlock.block.d.ts +34 -0
  106. package/dist/blocks/babylon/demo/utilities/premultiplyAlphaBlock.block.d.ts.map +1 -0
  107. package/dist/blocks/babylon/demo/utilities/premultiplyAlphaBlock.block.js +97 -0
  108. package/dist/blocks/babylon/demo/utilities/premultiplyAlphaBlock.block.js.map +1 -0
  109. package/dist/blocks/blockNamespaces.d.ts +5 -0
  110. package/dist/blocks/blockNamespaces.d.ts.map +1 -0
  111. package/dist/blocks/blockNamespaces.js +5 -0
  112. package/dist/blocks/blockNamespaces.js.map +1 -0
  113. package/dist/blocks/blockTypes.d.ts +22 -0
  114. package/dist/blocks/blockTypes.d.ts.map +1 -0
  115. package/dist/blocks/blockTypes.js +22 -0
  116. package/dist/blocks/blockTypes.js.map +1 -0
  117. package/dist/blocks/index.d.ts +6 -0
  118. package/dist/blocks/index.d.ts.map +1 -0
  119. package/dist/blocks/index.js +6 -0
  120. package/dist/blocks/index.js.map +1 -0
  121. package/dist/index.d.ts +3 -0
  122. package/dist/index.d.ts.map +1 -0
  123. package/dist/index.js +3 -0
  124. package/dist/index.js.map +1 -0
  125. package/dist/registration/IBlockRegistration.d.ts +34 -0
  126. package/dist/registration/IBlockRegistration.d.ts.map +1 -0
  127. package/dist/registration/IBlockRegistration.js +2 -0
  128. package/dist/registration/IBlockRegistration.js.map +1 -0
  129. package/dist/registration/blockSerializers.d.ts +13 -0
  130. package/dist/registration/blockSerializers.d.ts.map +1 -0
  131. package/dist/registration/blockSerializers.js +35 -0
  132. package/dist/registration/blockSerializers.js.map +1 -0
  133. package/dist/registration/builtInBlockRegistrations.d.ts +13 -0
  134. package/dist/registration/builtInBlockRegistrations.d.ts.map +1 -0
  135. package/dist/registration/builtInBlockRegistrations.js +269 -0
  136. package/dist/registration/builtInBlockRegistrations.js.map +1 -0
  137. package/dist/registration/index.d.ts +3 -0
  138. package/dist/registration/index.d.ts.map +1 -0
  139. package/dist/registration/index.js +3 -0
  140. package/dist/registration/index.js.map +1 -0
  141. package/license.md +21 -0
  142. package/package.json +52 -0
  143. package/readme.md +7 -0
  144. package/src/blocks/babylon/demo/effects/blackAndWhiteBlock.block.glsl +18 -0
  145. package/src/blocks/babylon/demo/effects/blackAndWhiteBlock.block.ts +133 -0
  146. package/src/blocks/babylon/demo/effects/blurBlock.deserializer.ts +37 -0
  147. package/src/blocks/babylon/demo/effects/blurBlock.serializer.ts +31 -0
  148. package/src/blocks/babylon/demo/effects/blurBlock.ts +122 -0
  149. package/src/blocks/babylon/demo/effects/compositionBlock.deserializer.ts +31 -0
  150. package/src/blocks/babylon/demo/effects/compositionBlock.fragment.glsl +38 -0
  151. package/src/blocks/babylon/demo/effects/compositionBlock.fragment.ts +71 -0
  152. package/src/blocks/babylon/demo/effects/compositionBlock.serializer.ts +28 -0
  153. package/src/blocks/babylon/demo/effects/compositionBlock.ts +243 -0
  154. package/src/blocks/babylon/demo/effects/contrastBlock.block.glsl +36 -0
  155. package/src/blocks/babylon/demo/effects/contrastBlock.block.ts +180 -0
  156. package/src/blocks/babylon/demo/effects/desaturateBlock.block.glsl +24 -0
  157. package/src/blocks/babylon/demo/effects/desaturateBlock.block.ts +155 -0
  158. package/src/blocks/babylon/demo/effects/directionalBlurBlock.deserializer.ts +46 -0
  159. package/src/blocks/babylon/demo/effects/directionalBlurBlock.serializer.ts +30 -0
  160. package/src/blocks/babylon/demo/effects/directionalBlurBlock.ts +196 -0
  161. package/src/blocks/babylon/demo/effects/exposureBlock.block.glsl +15 -0
  162. package/src/blocks/babylon/demo/effects/exposureBlock.block.ts +142 -0
  163. package/src/blocks/babylon/demo/effects/greenScreenBlock.block.glsl +23 -0
  164. package/src/blocks/babylon/demo/effects/greenScreenBlock.block.ts +174 -0
  165. package/src/blocks/babylon/demo/effects/index.ts +14 -0
  166. package/src/blocks/babylon/demo/effects/kaleidoscopeBlock.ts +192 -0
  167. package/src/blocks/babylon/demo/effects/maskBlock.block.glsl +18 -0
  168. package/src/blocks/babylon/demo/effects/maskBlock.block.ts +145 -0
  169. package/src/blocks/babylon/demo/effects/pixelateBlock.block.glsl +28 -0
  170. package/src/blocks/babylon/demo/effects/pixelateBlock.block.ts +169 -0
  171. package/src/blocks/babylon/demo/effects/posterizeBlock.block.glsl +25 -0
  172. package/src/blocks/babylon/demo/effects/posterizeBlock.block.ts +156 -0
  173. package/src/blocks/babylon/demo/effects/spritesheetBlock.fragment.glsl +26 -0
  174. package/src/blocks/babylon/demo/effects/spritesheetBlock.fragment.ts +60 -0
  175. package/src/blocks/babylon/demo/effects/spritesheetBlock.ts +138 -0
  176. package/src/blocks/babylon/demo/effects/tintBlock.ts +51 -0
  177. package/src/blocks/babylon/demo/transitions/index.ts +1 -0
  178. package/src/blocks/babylon/demo/transitions/wipeBlock.block.glsl +11 -0
  179. package/src/blocks/babylon/demo/transitions/wipeBlock.block.ts +152 -0
  180. package/src/blocks/babylon/demo/utilities/index.ts +1 -0
  181. package/src/blocks/babylon/demo/utilities/premultiplyAlphaBlock.block.glsl +14 -0
  182. package/src/blocks/babylon/demo/utilities/premultiplyAlphaBlock.block.ts +129 -0
  183. package/src/blocks/blockNamespaces.ts +4 -0
  184. package/src/blocks/blockTypes.ts +21 -0
  185. package/src/blocks/index.ts +5 -0
  186. package/src/index.ts +2 -0
  187. package/src/registration/IBlockRegistration.ts +43 -0
  188. package/src/registration/blockSerializers.ts +52 -0
  189. package/src/registration/builtInBlockRegistrations.ts +397 -0
  190. package/src/registration/index.ts +2 -0
@@ -0,0 +1,133 @@
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 "@babylonjs/smart-filters";
6
+ /**
7
+ * The shader program for the block.
8
+ */
9
+ const shaderProgram = {
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
+ `,
35
+ params: "vec2 vUV",
36
+ },
37
+ ],
38
+ },
39
+ };
40
+ /**
41
+ * The uniform names for this shader, to be used in the shader binding so
42
+ * that the names are always in sync.
43
+ */
44
+ const uniforms = {
45
+ input: "input",
46
+ background: "background",
47
+ reference: "reference",
48
+ distance: "distance",
49
+ };
50
+ /**
51
+ * The shader binding for the GreenScreenBlock, used by the runtime
52
+ */
53
+ class GreenScreenBlockShaderBinding extends DisableableShaderBinding {
54
+ /**
55
+ * Creates a new shader binding instance for the block.
56
+ * @param parentBlock - IDisableableBlock
57
+ * @param input - The input runtime value
58
+ * @param background - The background runtime value
59
+ * @param reference - The reference runtime value
60
+ * @param distance - The distance runtime value
61
+ */
62
+ constructor(parentBlock, input, background, reference, distance) {
63
+ super(parentBlock);
64
+ this._input = input;
65
+ this._background = background;
66
+ this._reference = reference;
67
+ this._distance = distance;
68
+ }
69
+ /**
70
+ * Binds all the required data to the shader when rendering.
71
+ * @param effect - defines the effect to bind the data to
72
+ */
73
+ bind(effect) {
74
+ super.bind(effect);
75
+ effect.setTexture(this.getRemappedName(uniforms.input), this._input.value);
76
+ effect.setTexture(this.getRemappedName(uniforms.background), this._background.value);
77
+ effect.setColor3(this.getRemappedName(uniforms.reference), this._reference.value);
78
+ effect.setFloat(this.getRemappedName(uniforms.distance), this._distance.value);
79
+ }
80
+ }
81
+ /**
82
+ * The implementation of the GreenScreenBlock
83
+ */
84
+ export class GreenScreenBlock extends DisableableShaderBlock {
85
+ /**
86
+ * Instantiates a new GreenScreenBlock.
87
+ * @param smartFilter - The smart filter this block belongs to
88
+ * @param name - The friendly name of the block
89
+ */
90
+ constructor(smartFilter, name) {
91
+ super(smartFilter, name, false, BlockDisableStrategy.AutoSample);
92
+ /**
93
+ * The input connection point.
94
+ */
95
+ this.input = this._registerInput(uniforms.input, ConnectionPointType.Texture);
96
+ /**
97
+ * The background connection point.
98
+ */
99
+ this.background = this._registerInput(uniforms.background, ConnectionPointType.Texture);
100
+ /**
101
+ * The reference connection point.
102
+ */
103
+ this.reference = this._registerInput(uniforms.reference, ConnectionPointType.Color3);
104
+ /**
105
+ * The distance connection point.
106
+ */
107
+ this.distance = this._registerInput(uniforms.distance, ConnectionPointType.Float);
108
+ }
109
+ /**
110
+ * Get the class instance that binds all the required data to the shader (effect) when rendering.
111
+ * @returns The class instance that binds the data to the effect
112
+ */
113
+ getShaderBinding() {
114
+ const input = this._confirmRuntimeDataSupplied(this.input);
115
+ const background = this._confirmRuntimeDataSupplied(this.background);
116
+ const reference = this._confirmRuntimeDataSupplied(this.reference);
117
+ const distance = this._confirmRuntimeDataSupplied(this.distance);
118
+ return new GreenScreenBlockShaderBinding(this, input, background, reference, distance);
119
+ }
120
+ }
121
+ /**
122
+ * The class name of the block.
123
+ */
124
+ GreenScreenBlock.ClassName = "GreenScreenBlock";
125
+ /**
126
+ * The namespace of the block.
127
+ */
128
+ GreenScreenBlock.Namespace = "Babylon.Demo.Effects";
129
+ /**
130
+ * The shader program (vertex and fragment code) to use to render the block
131
+ */
132
+ GreenScreenBlock.ShaderCode = shaderProgram;
133
+ //# 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,sCAAsC;AACtC,+DAA+D;AAC/D,+DAA+D;AAC/D,+DAA+D;AAS/D,OAAO,EACH,wBAAwB,EAExB,mBAAmB,EAEnB,sBAAsB,EAGtB,oBAAoB,EAAC,MAAM,0BAA0B,CAAC;AAE1D;;GAEG;AACH,MAAM,aAAa,GAAkB;IACjC,MAAM,EAAE,SAAS;IACjB,QAAQ,EAAE;QACN,OAAO,EAAE;;;;sCAIqB;QAC9B,gBAAgB,EAAE,SAAS;QAC3B,gBAAgB,EAAE,eAAe;QACjC,SAAS,EAAE;YACP;gBACI,IAAI,EAAE,eAAe;gBACrB,IAAI,EAAE;;;;;;;;;;;;qBAYD;gBACL,MAAM,EAAE,UAAU;aACrB;SACJ;KACJ;CACJ,CAAC;AAEF;;;GAGG;AACH,MAAM,QAAQ,GAAG;IACb,KAAK,EAAE,OAAO;IACd,UAAU,EAAE,YAAY;IACxB,SAAS,EAAE,WAAW;IACtB,QAAQ,EAAE,UAAU;CACvB,CAAC;AAEF;;GAEG;AACH,MAAM,6BAA8B,SAAQ,wBAAwB;IAMhE;;;;;;;OAOG;IACH,YACI,WAA8B,EAC9B,KAA+C,EAC/C,UAAoD,EACpD,SAAkD,EAClD,QAAgD;QAEhD,KAAK,CAAC,WAAW,CAAC,CAAC;QACnB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;QAC9B,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC9B,CAAC;IAED;;;OAGG;IACa,IAAI,CAAC,MAAc;Q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CAAC;IAED;;;OAGG;IACI,gBAAgB;QACnB,MAAM,KAAK,GAAG,IAAI,CAAC,2BAA2B,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC3D,MAAM,UAAU,GAAG,IAAI,CAAC,2BAA2B,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACrE,MAAM,SAAS,GAAG,IAAI,CAAC,2BAA2B,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,aAAa,AAAhB,CAAiB"}
@@ -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,58 @@
1
+ import type { Effect } from "@babylonjs/core/Materials/effect";
2
+ import { type ShaderProgram, DisableableShaderBinding, type RuntimeData, ConnectionPointType, type IDisableableBlock, DisableableShaderBlock, type SmartFilter } from "@babylonjs/smart-filters";
3
+ /**
4
+ * The shader bindings for the Kaleidoscope block.
5
+ */
6
+ export declare class KaleidoscopeShaderBinding extends DisableableShaderBinding {
7
+ private readonly _inputTexture;
8
+ private readonly _time;
9
+ /**
10
+ * Creates a new shader binding instance for the Kaleidoscope block.
11
+ * @param parentBlock - The parent block
12
+ * @param inputTexture - the input texture
13
+ * @param time - the time
14
+ */
15
+ constructor(parentBlock: IDisableableBlock, inputTexture: RuntimeData<ConnectionPointType.Texture>, time: RuntimeData<ConnectionPointType.Float>);
16
+ /**
17
+ * Binds all the required data to the shader when rendering.
18
+ * @param effect - defines the effect to bind the data to
19
+ */
20
+ bind(effect: Effect): void;
21
+ }
22
+ /**
23
+ * A block performing a Kaleidoscope looking like effect.
24
+ */
25
+ export declare class KaleidoscopeBlock extends DisableableShaderBlock {
26
+ /**
27
+ * The class name of the block.
28
+ */
29
+ static ClassName: string;
30
+ /**
31
+ * The namespace of the block.
32
+ */
33
+ static Namespace: string;
34
+ /**
35
+ * The input texture connection point.
36
+ */
37
+ readonly input: import("@babylonjs/smart-filters").ConnectionPoint<ConnectionPointType.Texture>;
38
+ /**
39
+ * The time connection point.
40
+ */
41
+ readonly time: import("@babylonjs/smart-filters").ConnectionPoint<ConnectionPointType.Float>;
42
+ /**
43
+ * The shader program (vertex and fragment code) to use to render the block
44
+ */
45
+ static ShaderCode: ShaderProgram;
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
+ * Get the class instance that binds all the required data to the shader (effect) when rendering.
54
+ * @returns The class instance that binds the data to the effect
55
+ */
56
+ getShaderBinding(): DisableableShaderBinding;
57
+ }
58
+ //# 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,MAAM,kCAAkC,CAAC;AAE/D,OAAO,EACH,KAAK,aAAa,EAClB,wBAAwB,EACxB,KAAK,WAAW,EAChB,mBAAmB,EACnB,KAAK,iBAAiB,EACtB,sBAAsB,EACtB,KAAK,WAAW,EAEnB,MAAM,0BAA0B,CAAC;AAkGlC;;GAEG;AACH,qBAAa,yBAA0B,SAAQ,wBAAwB;IACnE,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA2C;IACzE,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAyC;IAE/D;;;;;OAKG;gBAEC,WAAW,EAAE,iBAAiB,EAC9B,YAAY,EAAE,WAAW,CAAC,mBAAmB,CAAC,OAAO,CAAC,EACtD,IAAI,EAAE,WAAW,CAAC,mBAAmB,CAAC,KAAK,CAAC;IAOhD;;;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,kFAA6D;IAElF;;OAEG;IACH,SAAgB,IAAI,gFAA0D;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 "@babylonjs/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,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,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O,CAAC,CAAC;QAElF;;WAEG;QACa,SAAI,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,mBAAmB,CAAC,KAAK,CAAC,CAAC;IAc9E,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,yBAAyB,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;IAC5D,CAAC;;AA3CD;;GAEG;AACoB,2BAAS,GAAG,qBAAqB,AAAxB,CAAyB;AAEzD;;GAEG;AACoB,2BAAS,GAAG,2BAA2B,AAA9B,CAA+B;AAY/D;;GAEG;AACoB,4BAAU,GAAG,aAAa,AAAhB,CAAiB"}
@@ -0,0 +1,38 @@
1
+ import { DisableableShaderBinding, ConnectionPointType, type SmartFilter, DisableableShaderBlock, type ShaderProgram } from "@babylonjs/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("@babylonjs/smart-filters").ConnectionPoint<ConnectionPointType.Texture>;
18
+ /**
19
+ * The mask connection point.
20
+ */
21
+ readonly mask: import("@babylonjs/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,MAAM,0BAA0B,CAAC;AA2E1D;;GAEG;AACH,qBAAa,SAAU,SAAQ,sBAAsB;IACjD;;OAEG;IACH,OAAuB,SAAS,SAAe;IAE/C;;OAEG;IACH,OAAuB,SAAS,SAA0B;IAE1D;;OAEG;IACH,SAAgB,KAAK,kFAAoE;IAEzF;;OAEG;IACH,SAAgB,IAAI,kFAAmE;IAEvF;;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,110 @@
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 "@babylonjs/smart-filters";
6
+ /**
7
+ * The shader program for the block.
8
+ */
9
+ const shaderProgram = {
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
+ `,
30
+ params: "vec2 vUV",
31
+ },
32
+ ],
33
+ },
34
+ };
35
+ /**
36
+ * The uniform names for this shader, to be used in the shader binding so
37
+ * that the names are always in sync.
38
+ */
39
+ const uniforms = {
40
+ input: "input",
41
+ mask: "mask",
42
+ };
43
+ /**
44
+ * The shader binding for the MaskBlock, used by the runtime
45
+ */
46
+ class MaskBlockShaderBinding extends DisableableShaderBinding {
47
+ /**
48
+ * Creates a new shader binding instance for the block.
49
+ * @param parentBlock - IDisableableBlock
50
+ * @param input - The input runtime value
51
+ * @param mask - The mask runtime value
52
+ */
53
+ constructor(parentBlock, input, mask) {
54
+ super(parentBlock);
55
+ this._input = input;
56
+ this._mask = mask;
57
+ }
58
+ /**
59
+ * Binds all the required data to the shader when rendering.
60
+ * @param effect - defines the effect to bind the data to
61
+ */
62
+ bind(effect) {
63
+ super.bind(effect);
64
+ effect.setTexture(this.getRemappedName(uniforms.input), this._input.value);
65
+ effect.setTexture(this.getRemappedName(uniforms.mask), this._mask.value);
66
+ }
67
+ }
68
+ /**
69
+ * The implementation of the MaskBlock
70
+ */
71
+ export class MaskBlock extends DisableableShaderBlock {
72
+ /**
73
+ * Instantiates a new MaskBlock.
74
+ * @param smartFilter - The smart filter this block belongs to
75
+ * @param name - The friendly name of the block
76
+ */
77
+ constructor(smartFilter, name) {
78
+ super(smartFilter, name, false, BlockDisableStrategy.AutoSample);
79
+ /**
80
+ * The input connection point.
81
+ */
82
+ this.input = this._registerInput(uniforms.input, ConnectionPointType.Texture);
83
+ /**
84
+ * The mask connection point.
85
+ */
86
+ this.mask = this._registerInput(uniforms.mask, ConnectionPointType.Texture);
87
+ }
88
+ /**
89
+ * Get the class instance that binds all the required data to the shader (effect) when rendering.
90
+ * @returns The class instance that binds the data to the effect
91
+ */
92
+ getShaderBinding() {
93
+ const input = this._confirmRuntimeDataSupplied(this.input);
94
+ const mask = this._confirmRuntimeDataSupplied(this.mask);
95
+ return new MaskBlockShaderBinding(this, input, mask);
96
+ }
97
+ }
98
+ /**
99
+ * The class name of the block.
100
+ */
101
+ MaskBlock.ClassName = "MaskBlock";
102
+ /**
103
+ * The namespace of the block.
104
+ */
105
+ MaskBlock.Namespace = "Babylon.Demo.Effects";
106
+ /**
107
+ * The shader program (vertex and fragment code) to use to render the block
108
+ */
109
+ MaskBlock.ShaderCode = shaderProgram;
110
+ //# 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,MAAM,0BAA0B,CAAC;AAE1D;;GAEG;AACH,MAAM,aAAa,GAAkB;IACjC,MAAM,EAAE,SAAS;IACjB,QAAQ,EAAE;QACN,OAAO,EAAE;;sCAEqB;QAC9B,gBAAgB,EAAE,SAAS;QAC3B,gBAAgB,EAAE,aAAa;QAC/B,SAAS,EAAE;YACP;gBACI,IAAI,EAAE,aAAa;gBACnB,IAAI,EAAE;;;;;;;;;qBASD;gBACL,MAAM,EAAE,UAAU;aACrB;SACJ;KACJ;CACJ,CAAC;AAEF;;;GAGG;AACH,MAAM,QAAQ,GAAG;IACb,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;CACf,CAAC;AAEF;;GAEG;AACH,MAAM,sBAAuB,SAAQ,wBAAwB;IAIzD;;;;;OAKG;IACH,YACI,WAA8B,EAC9B,KAA+C,EAC/C,IAA8C;QAE9C,KAAK,CAAC,WAAW,CAAC,CAAC;QACnB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,C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B,oBAAU,GAAG,aAAa,AAAhB,CAAiB"}
@@ -0,0 +1,44 @@
1
+ import { ShaderBinding, ConnectionPointType, type SmartFilter, ShaderBlock, type ShaderProgram } from "@babylonjs/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("@babylonjs/smart-filters").ConnectionPoint<ConnectionPointType.Texture>;
18
+ /**
19
+ /**
20
+ * The intensity connection point.
21
+ */
22
+ readonly intensity: import("@babylonjs/smart-filters/dist/connection/connectionPointWithDefault").ConnectionPointWithDefault<ConnectionPointType.Float>;
23
+ /**
24
+ /**
25
+ * The disabled connection point.
26
+ */
27
+ readonly disabled: import("@babylonjs/smart-filters/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,MAAM,0BAA0B,CAAC;AAoFrD;;GAEG;AACH,qBAAa,aAAc,SAAQ,WAAW;IAC1C;;OAEG;IACH,OAAuB,SAAS,SAAmB;IAEnD;;OAEG;IACH,OAAuB,SAAS,SAA0B;IAE1D;;OAEG;IACH,SAAgB,KAAK,kFAAoE;IAEzF;;;OAGG;IACH,SAAgB,SAAS,sIAIvB;IAEF;;;OAGG;IACH,SAAgB,QAAQ,wIAItB;IAEF;;OAEG;IACH,OAAuB,UAAU,gBAAiB;IAElD;;;;OAIG;gBACS,WAAW,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM;IAIlD;;;OAGG;IACI,gBAAgB,IAAI,aAAa;CAO3C"}